Repository navigation
feat(vale): publish Vale's grammars as @taskless/vale-grammars - #704
Conversation
Vale 3.27.0 moved its tree-sitter grammars out of the binary. Without them it reads code comments by delimiters, which fails 6 vendor-contract cases on #703. Propose @taskless/vale-grammars, pinned and released with the platform packages, named to Vale through VALE_GRAMMARS_PATH.
Vale 3.27.0 ships its tree-sitter grammars as separate WebAssembly modules. Add a grammars section to vale-manifest.json pinning all 22 upstream grammar archives for 3.27.0. Upstream's checksums file does not cover them, so each digest is the one GitHub records for the release asset; all 22 match a local download. vale-release.cjs validates the section, lists the seven packages a release covers, reads grammar digests from a release's asset list, and accepts an explicit stamp for the grammar package's bootstrap publish. packages/vale-grammars holds only metadata; the pipeline places the modules. The design and tasks now record the GitHub digest source and that all seven pins share one exact stamp, as vale-upgrade-detect already requires.
vale-prepare.cjs packs @taskless/vale-grammars beside the six platform packages. Each grammar archive is verified against its committed digest, then its one module is streamed out with unzip -p and must carry the WebAssembly magic, so nothing in the archive reaches the filesystem. --version stamps a package at a version the set already carries, for the grammar package's manual first publish. vale-detect.cjs reads the grammar list and digests from the release's asset list; vale-gate.cjs counts the grammar package as part of a published release. vale-upgrade-detect.cjs needs no change: the grammar pin matches @taskless/vale-* and is held to the same single version, which the new tests pin. Workflow comments and PR bodies now say seven.
|
@claude /review |
|
Claude finished @theCodeDrift's task in 3m 3s —— View job Review mode: incremental — read 0 prior review thread(s) before reviewing.
SummaryThis is a careful, well-tested piece of infrastructure work. The core additions hold up under close reading:
Two minor, non-blocking documentation nits found ([New]):
Nothing else raised. In particular, I did not find issues with: the digest validation logic, the stamp/version invariants ( |
603562a to
a83b34d
Compare
Both nits are fixed in a83b34d: — AI Coding Agent |
Stack (root → tip):
Vale 3.27.0 moved its tree-sitter grammars out of the binary into WebAssembly modules that
vale syncinstalls. We never runvale sync, so on 3.27.0 Vale reads code comments by their delimiters. That's what fails 6 vendor-contract cases on #703://nolint,# noqa,// eslint-disable…,// NOSONAR) and Python docstring:param:lines get linted as prose./* … */comments aren't linted at all.W101 grammar "<name>" is not installedfor each language.With the upstream grammars supplied through
VALE_GRAMMARS_PATH, all 373 Vale tests pass on 3.27.0 unchanged.This is the first of two landings. It packages and publishes the grammars as one platform-independent package,
@taskless/vale-grammars, so every OS gets the same bytes. It changes nothing for a CLI user. The CLI doesn't pin the new package until the second PR, so there's no changeset.What's here
vale-grammars-package: proposal, design, and deltas forvale-binary-packages,cli-vale-rule-engineandcli-runtime-binary-export. It's archived by the second PR.vale-manifest.jsongains agrammarssection pinning all 22 upstream grammar archives for 3.27.0. Upstream'schecksums.txtdoesn't cover them, so each digest is thesha256GitHub records for the release asset at upload. Detect reads those from the releases API, and you can check them the same way:gh api repos/errata-ai/vale/releases/tags/v3.27.0 --jq '.assets[]|select(.name|startswith("grammar-"))|"\(.name) \(.digest)"'. All 22 match a local download.vale-prepare.cjsverifies each archive against the manifest, then streams its one.wasmmember out withunzip -pand checks the WebAssembly magic bytes. No archive path is ever written to disk.--versionstamps at a version the rest of the set already has, for the bootstrap below.vale-gate.cjscounts the grammar package as part of a published release.vale-detect.cjsrewrites the grammar list and digests from the release's assets.vale-upgrade-detect.cjsneeds no logic change. The grammar package matches@taskless/vale-*, so once pinned it's held to the same single exact version as the binaries. New tests cover that.packages/vale-grammars/: metadata only. The modules are gitignored and placed by the pipeline.The workflow filenames, workflow names and
environment:are unchanged, so the existing OIDC bindings still hold.Before merging: bootstrap publish (maintainer)
npm trusted publishing can't create a package, so the first publish is manual, and it has to happen before this merges. Otherwise the gate sees the grammar package missing and tries to publish all seven.
Then register the trusted publisher for
@taskless/vale-grammarsagainstrelease-vale.ymland thenpm-autopublishenvironment. The stamp matches the 3.27.0 binaries, so all seven pins can share one version. After merging, the gate should report all seven published and publish nothing.Next
The second PR is cut from #703's head. It pins the grammar package, sets
VALE_GRAMMARS_PATH, refuses a.taskless/rules/vale/config/grammars/directory invalidateandcheck, exports the grammar resolver from@taskless/cli/node/runtimes, adds the coverage check, and supersedes #703.Refs #703