feat(cli): run gram check on the shared lint layer and add --format json #299
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!299
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/check-lint-json"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR 6a of
.notes/backlog/plan-dx-et-aides-ecriture.md(phase 1 § 1C, "CLIgram check").--fixand the fuzz idempotence invariant follow in PR 6b.What changes
gram checkrunslintDocument(@gram-lang/modules/lint) on each file, prepared as the language server prepares it: its own AST, the composed and analyzed compilation, the@usegraph, the database, and thelint:settings of the file's own project. The terminal and JSON outputs come from the same list.Databasediagnostic is replaced byUNKNOWN_INGREDIENTon each mention, with the closest name.↳ see base.gram:3:5.MISSING_MACROS,UNKNOWN_MASS,MISSING_INGREDIENT) are listed.--format jsonoption:{ version: 1, files, diagnostics }on stdout, nothing else on stdout.LintDiagnosticfields, plusfile,line,col,endLineandendCol(from 1, UTF-16 columns). Uris arefile://URLs.--formatis validated. When no file matches, the empty report is still printed, with exit code 1.--strictkeeps its meaning: every warning and info becomes an error, never ahint.--skip-dbkeeps the database out.modules/lintchanges:UNKNOWN_INGREDIENTnow carriesdata.name.MISSING_INGREDIENTis left out for an ingredient the file already flags. It is matched on its message, rendered from kitchen's template, so the compiled JSON and the goldens do not move.buildLineIndexandoffsetToPositionare shared with the LSP.cli.mdx: fullversion: 1schema and a CI example.ai-generation-notes.mdx: the "generate, check, correct" loop.warnings.mdx: the "Configure the lint" sentence now namesgram check.minor,cliandmodules. It warns that a strict CI run may now fail on the new checks.Checks
bun test: 4322 pass, 1 skip, 0 fail (was 4312 pass, 1 skip).deprecations:checkpass.dist/server.cjsand the real CLI run on one file with@use,database:andlint.rules, and give the same codes, severities and positions.