Skip to content

The rule catalog

harness catalog renders a Markdown table of every rule in the registry: its id, category, whether it is CI-critical, and its description. It is generated from the registry, so it cannot drift from what lint-meta enforces. The catalog only imports the registry; it never runs a rule.

Terminal window
npx harness catalog # write RULES.md beside the registry
npx harness catalog --out docs/RULES.md # or anywhere, relative to --dir
npx harness catalog --check # the gate: exit 1 and a diff when stale
.noctcore/lint-meta/RULES.md
# lint-meta rule catalog
Do not edit between the markers by hand: change the rule, then run
`npx @noctcore/harness catalog` to regenerate. Text outside the markers is kept.
<!-- harness:rule-catalog:start -->
Generated by `harness catalog` from `.noctcore/lint-meta/registry.mts`. 4 rules, 4 CI-critical.
A CI-critical rule reds the build when it reports a violation; the others only report.
| Rule ID | Category | CI-critical | What it guards |
| ----------------------------------- | ----------- | ----------- | ---------------------------------- |
| `github-actions-secret-no-install` | ci | **yes** | A workflow job that can read a ... |
| `github-actions-security-no-cancel` | ci | **yes** | Security workflows (security-*... |
| `readme-has-license` | config | **yes** | The README has a License section. |
| `max-file-lines` | source-text | **yes** | Source files stay at or under ... |
<!-- harness:rule-catalog:end -->

(Descriptions are shortened here; the real table carries each rule’s full description.)

The registry path in the header is relative to the repo root, so the output is the same on every machine and --check passes in CI.

The generated table sits between <!-- harness:rule-catalog:start --> and <!-- harness:rule-catalog:end -->. When the file already has both markers, only the text between them is replaced: an intro, a “how to add a rule” section or links around the table stay as you wrote them. A file without the markers is replaced by the default document.

--check writes nothing. It exits 0 when the committed file matches what would be generated, and 1 when the file is missing or differs, printing the changed lines:

catalog: /repo/.noctcore/lint-meta/RULES.md is out of date. Run `harness catalog` to regenerate it.
--- committed
+++ generated
...

Add it to the manifest so a rule change without a catalog update fails:

{ "name": "rule-catalog", "kind": "lint-meta", "command": "npx harness catalog --check" }

The registry is found the same way as for lint-meta (the default paths, or --registry), with the same presence rules.