Skip to content
systemfsoftwarePublic

About

Conventions gate for repo config files, a Rust CLI on the GritQL engine, delivered as a Nix flake.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gritlint

License: MIT

gritlint runs GritQL rule packs over a repository's config files and reports every violation with its reason and the next action. A pack is a set of rules that encode one convention, such as where a service module may hold a driver, or how a public npm package must publish. You enable the packs you want and gritlint checks them.

It is a single Rust binary. The GritQL engine is Biome's.

Quick start

Build the CLI from the flake, then check a repository:

nix build github:systemfsoftware/gritlint#gritlint
./result/bin/gritlint check .

Enable packs in gritlint.json at the repository root. A pack that takes no parameters is enabled with an empty object:

{
  "packs": {
    "cell-architecture": {}
  }
}

gritlint check reads the packs from that file and scans the tree from the path you give it.

Packs

These packs ship with the CLI:

Pack Enforces
cell-architecture A *.service.ts module holds no driver and exports no Layer value.
source-resolution A workspace package's name resolves to its src/ for workspace tools and to dist/ for registry consumers, across the export map, tsconfig, Vite and api-extractor.
typecheck-build-mode A reference-only tsconfig root's typecheck script runs tsc -b, so it reaches the referenced projects.
tsconfig-roles Every tsconfig file is one of a closed set of roles, tsconfig.json is a solution file whose references stay in its directory, and no config combines DOM with node or Worker types.
ts-extensions No tsconfig option allows a .ts extension in an import, and no import, export-from or dynamic import specifier ends in .ts, .tsx, .mts or .cts.
build-output-imports No import, export-from or dynamic import specifier reaches into another package's dist/ by path; packages are imported by name and an exports subpath.
npm-provenance Public npm packages publish with trusted publishing (OIDC) and provenance.

Each pack's README lists its rules and its parameters.

Path rules

A rule whose fenced block is path instead of grit judges file paths and never reads a file. gritlint walks every non-ignored file whatever its extension, so a .txt file or one with no extension is judged too. A path that is in scope and matches no allow pattern is one finding at that path.

---
reasonCode: docs-misnamed
nextAction: Name the plan docs/plans/YYYY-MM-DD-HHMM-<name>-plan.md.
---

# A plan is named by its date

```path
scope docs/plans/.*
allow docs/plans/[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{4}-[a-z0-9]+(?:-[a-z0-9]+)*-plan\.md
```

The rest of each line is the regex. A pattern matches the whole relative path, written with / separators, so no ^ or $ is needed. scope may appear once and is optional; allow may repeat. A path rule takes no locate key and does not export to Biome. Files the walk skips (gitignored, hidden, node_modules, the config's ignore globs) are not judged.

Commands

Command What it does
gritlint check [root] Scan a tree and report findings.
gritlint test Run a pack's fixtures against its rules.
gritlint lsp Serve findings to an editor over the Language Server Protocol on stdio.
gritlint export biome Print a rule as a Biome GritQL plugin, or list which rules export.

check takes these flags:

Flag Meaning
--config <PATH> Use this config file instead of gritlint.json at the root.
--rules <PATH> Load extra rules from this path. Repeatable.
--format <FORMAT> human (default), json, concise, github or github-summary.

human lists every finding with its reason code and next action, and the count per rule. json writes the versioned report. github writes one GitHub Actions ::error annotation per finding, and github-summary writes Markdown for $GITHUB_STEP_SUMMARY.

Install

Install from the flake, which is the supported route:

nix build github:systemfsoftware/gritlint#gritlint

Or take packages.<system>.gritlint from the flake as an input of your own flake.

Contributing

Development setup, the test commands and the layout are in CONTRIBUTING.md.

License

MIT. See LICENSE.

About

Conventions gate for repo config files, a Rust CLI on the GritQL engine, delivered as a Nix flake.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages