feat(cli): add gram check --fix and the fix-idempotent fuzz invariant #300
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!300
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/check-fix"
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 6b of .notes/backlog/plan-dx-et-aides-ecriture.md (phase 1 § 1C, "CLI
gram check"):--fixand the fuzz idempotence invariant. Starts fromdev/1.6with #299 merged.What changes
@gram-lang/modules/lintexportsapplyPreferredFixes(text, uri, diagnostics)(@experimental), a pure pass shared by the CLI and the fuzz. It returns{ text, applied },appliedholding{ diagnostic, fix }pairs.createFile, a patch on another uri, no patch, or a patch outside the text.UNKNOWN_INGREDIENTno longer marks its spelling fix as preferred, since renaming an ingredient changes the recipe. Onmain, VS Code only applies that preferred fix on demand ("Auto Fix…"), so nofix/…onmain. The unreleasedmodules-lint.mdchangeset is corrected to match.gram check --fixoption:runLintPipelinein memory (newentryTextpipeline option), and each file is written once at the end, only if it changed.lint.rulesand// gram-ignoreare respected for free: a code turned off has no diagnostic, so no fix. A@usedependency is never touched.--fix, so none is read as another's dependency while it is being rewritten.N fixes applied, M remainingafter the report. JSON:fixedon each entry offiles[], with the diagnostics left (stillversion: 1), and nothing on stderr.MERGED_STEP_LINE(unreleased,dev/1.6only) leaves alone a line that could not open a block on its own, a bare[Stir]or a## Title ~{60min}.with text after its anchor. Its preferred fix turned these into parse errors. Both were found by the new invariant.fix-idempotent, built onPrepared.fixed:servings:line followed byyields:at the same offset is not a comeback.fuzz/regressions/.cli.mdx:--fixand its guarantee, andfiles[].fixedin the schema table.ai-generation-notes.mdx:--fixin the loop.warnings.mdx:UNKNOWN_INGREDIENTandMERGED_STEP_LINE.modules.mdx:applyPreferredFixes.check-fix.md: minor, cli and modules.Checks
bun test: 4351 pass, 1 skip, 0 fail (was 4322 pass, 1 skip). Each commit is green on its own.## …case, is clean too.deprecations:checkpass.--fix, since a race between files does not reproduce reliably.compile-contractalready guaranteescompilenever throws.