# okham-lint

`okham-lint` is the reference linter implementation for OKHAM verification standards.

It consumes:
- **OLR** (Open Linting Ruleset): portable lint rulesets
- **OAS** (Open Assertion Spec): portable, versioned assertion primitives (optional, recommended)

It emits:
- **OVR** (Open Validation Report): portable validation/lint report

---

## Install

### Go

```bash
go install github.com/okham-io/okham-tools/cmd/okham-lint@latest
```

(For CI, pin a tag instead of `@latest`.)

---

## Basic usage

```bash
okham-lint \
  -target ./path/to/contracts \
  -ruleset ./path/to/ruleset.olr.yaml \
  -format ovr
```

### Multiple rulesets

```bash
okham-lint \
  -target ./path/to/contracts \
  -ruleset ./rulesets/mvp.olr.yaml \
  -ruleset ./rulesets/canonical-types.olr.yaml \
  -format ovr
```

---

## Using OAS assertions (recommended)

If your OLR rules include `assertionRef`, you can point `okham-lint` to an assertions catalog registry:

```bash
okham-lint \
  -target ./path/to/contracts \
  -ruleset ./ruleset.olr.yaml \
  --assertions-registry ../okham-catalog/packages/assertions/registry.json \
  -format ovr
```

When present, `okham-lint` validates `rule.params` against the referenced assertion `paramsSchema` and reports any problems as **OVR issues** (portable for CI/CD and LLM tooling).

---

## CI exit codes (`--fail-on`)

`okham-lint` can be used as a CI gate via `--fail-on`:

- `--fail-on error` (default): fail if there is at least one **error**
- `--fail-on warn`: fail if there is at least one **warning or error**
- `--fail-on info`: fail if there is at least one **info/warn/error**
- `--fail-on never`: never fail (report only)

Example:

```bash
okham-lint \
  -target ./contracts \
  -ruleset ./rulesets/mvp.olr.yaml \
  --fail-on warn \
  -format ovr \
  -out ovr.json
```

---

## Outputs

- `-format ovr` emits an OVR JSON report to stdout (or `-out <file>`).

OVR is designed to be consumed by:
- CI/CD pipelines
- LLM toolchains
- dashboards/aggregators

---

## Standards

- OVR schema: https://okham.org/schemas/ovr/0.1.0/schema.json
- OLR schema: https://okham.org/schemas/olr/0.1.0/schema.json
- OAS schema: https://okham.org/schemas/oas/0.1.0/schema.json
