Integrate Tree-sitter
The published package is @cyber-nomad-collective/beskid-tree-sitter. A consumer can keep the shorter @beskid/tree-sitter import through an npm alias.
Prerequisites
Section titled “Prerequisites”Use Node.js 22 for the pinned package workflow. Complete the shared web package credential setup with read:packages access before installation.
Use pnpm as the normal package manager. The pinned Tree-sitter publication workflow uses Bun 1.3.0 and a Bun lockfile. Use Bun only to reproduce that pinned component workflow.
Version 0.1.3 is a component-specific exception to the superrepo @beskid/* version convention. It is the version in the pinned Tree-sitter package manifest.
| Boundary | Owned source or output |
|---|---|
| Handwritten declarations | scripts/lib/declaration-rules.mjs |
| Handwritten expressions and conflicts | scripts/lib/manual-grammar.mjs |
| Generated grammar | grammar.js; generated output, so do not hand-edit it. |
| Generated parser | src/parser.c and generated node metadata. |
| Corpus inputs and expected trees | test/corpus/*.txt |
| Drift report | node scripts/check-pest-drift.mjs |
Actions
Section titled “Actions”- Put
"@beskid/tree-sitter": "npm:@cyber-nomad-collective/beskid-tree-sitter@^0.1.3"in the consumer dependency map. - Run
pnpm installin the consumer repository. - Change
scripts/lib/declaration-rules.mjsorscripts/lib/manual-grammar.mjsonly when you own a grammar update. - Run
./scripts/sync-from-pest.shfrombeskid_treesitter/after a grammar-source change. - Run
node scripts/check-pest-drift.mjsto check rule-name drift. - Run
bunx tree-sitter testto verify the generated parser against the corpus.
Expected result
Section titled “Expected result”The consumer resolves the published package through the alias. For a grammar change, the sync updates generated outputs, the corpus tests pass, and the drift check reports no unreviewed rule-name difference.
Recovery
Section titled “Recovery”If grammar.js differs without an owned handwritten rule change, regenerate it; do not patch it by hand. If corpus output changes, review the related handwritten rule source and each changed expected tree. Stop when the syntax authority and generated result disagree.
Next task
Section titled “Next task”Use the VS Code project workflow to verify editor behavior that consumes Beskid language tooling.