Conversation
Taskfile provides tasks for building, testing, generating, and system-installing the grammar, plus ci: targets for automated checks. Editor install tasks are intentionally omitted — all supported editors require editing user config files, which cannot be done safely or idempotently by automation. See docs/editors/ for manual instructions. The GitHub Actions workflow runs the tree-sitter test corpus and example parsing on push/PR to main, and validates workflow files with zizmor. All action references are pinned to commit SHAs per security best practice. https://claude.ai/code/session_01B9bVHXAhzTQ1kzF9CDj8nq
tree-sitter-cli 0.25.x has native addon issues with Node 24+. Add .tool-versions pinning nodejs 22.16.0 for asdf/mise users, a _check-node internal task that gates generate/test targets on Node >=22 <24, and point the CI workflow at .tool-versions instead of hardcoding lts/*. https://claude.ai/code/session_01B9bVHXAhzTQ1kzF9CDj8nq
The tree-sitter-cli package downloads its binary via a postinstall script. Without an explicit npm ci step, npx finds the package but the binary is missing, causing ENOENT. Add an internal _npm-deps task (with source/generates caching) as a dependency of generate, test, and test:parse-examples. https://claude.ai/code/session_01B9bVHXAhzTQ1kzF9CDj8nq
The tree-sitter-cli npm wrapper downloads a platform-specific binary as a postinstall step. When that download fails silently the binary is missing and every `npx tree-sitter` invocation fails with ENOENT. Instead, require tree-sitter to be installed via `cargo install tree-sitter-cli` (or any other method that puts it in $PATH). The Taskfile now checks for both node and tree-sitter before running tasks. Changes: - Taskfile.yaml: remove TS_NPX var, rename _check-node → _check-tools, add tree-sitter precondition, use bare `tree-sitter` in all commands - package.json: remove tree-sitter-cli devDependency - README.md / docs/editors/vscode.md: replace npx invocations with bare tree-sitter commands https://claude.ai/code/session_01B9bVHXAhzTQ1kzF9CDj8nq
Now that tree-sitter-cli is no longer an npm devDependency, the CI runner needs the binary installed separately. Use the official tree-sitter/setup-action (CLI only, no lib needed). https://claude.ai/code/session_01B9bVHXAhzTQ1kzF9CDj8nq
There was a problem hiding this comment.
Pull request overview
This PR introduces a Taskfile-driven developer workflow and adds GitHub Actions CI for tests, while shifting from npx tree-sitter ... to invoking the tree-sitter CLI directly.
Changes:
- Add
Taskfile.yamlwith build/test/CI tasks and tool precondition checks. - Add GitHub Actions workflow to run tests and validate workflows with zizmor.
- Remove
tree-sitter-clifrom npm devDependencies and update docs/README to stop usingnpx tree-sitter.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Removes tree-sitter-cli from devDependencies (impacts how tree-sitter is provided). |
package-lock.json |
Lockfile updates reflecting removal of tree-sitter-cli. |
README.md |
Updates Quick Start commands to call tree-sitter directly. |
docs/editors/vscode.md |
Updates WASM build command to call tree-sitter directly. |
Taskfile.yaml |
Adds task automation for generate/build/test/CI checks with preconditions. |
.tool-versions |
Pins Node.js version for consistent dev/CI environments. |
.gitignore |
Ignores Task’s working directory .task/. |
.github/workflows/ci.yaml |
Adds CI workflow running Taskfile targets and zizmor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| desc: Validate GitHub Actions workflows with zizmor | ||
| preconditions: | ||
| - sh: command -v zizmor | ||
| msg: "zizmor is not installed — pip install zizmor" |
There was a problem hiding this comment.
The means for a human to install are not those that the CI system should use.
I will push an update which switches GH Actions to use the zizmorcore/zizmor-action action instead.
| with: | ||
| node-version-file: .tool-versions | ||
| cache: npm | ||
| - run: npm ci |
There was a problem hiding this comment.
No: the Taskfile is used by humans, not just by the GH Actions setup, as humans might want to debug what's going on. The GH Actions step does the install as a separate isolation step for better isolation of what's going on, and should ensure that the subsequent task invocation effectively no-ops the npm ci invocation -- all downloads will already be present.
The duplicated invocation, as long as it does not delete and re-download, is absolutely fine.
.github/workflows/ci.yaml
Outdated
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
| - run: pipx run zizmor --format plain .github/workflows/ |
There was a problem hiding this comment.
As above: switching to the official Action instead.
| }, | ||
| "devDependencies": { | ||
| "tree-sitter-cli": "^0.25.3", | ||
| "prebuildify": "^6.0.1" |
There was a problem hiding this comment.
NO. The tree-sitter-cli dep is broken; instead we (1) install tree-sitter in the GH workflow, and (2) have the _check-tools Task check that the tool is installed.
This removal was deliberate and improves reliability and reproducibility.
| ```bash | ||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Generate the parser | ||
| npx tree-sitter generate | ||
| tree-sitter generate | ||
|
|
||
| # Run tests | ||
| npx tree-sitter test | ||
| tree-sitter test | ||
|
|
||
| # Parse a file | ||
| npx tree-sitter parse examples/basic.conf | ||
| tree-sitter parse examples/basic.conf |
There was a problem hiding this comment.
Fair: I will make such a change locally, better.
| git clone https://github.com/synadia-labs/treesitter-nats-server.git | ||
| ``` | ||
| 3. Build the WASM module: | ||
| ```bash | ||
| cd tree-sitter-nats-server-conf | ||
| npx tree-sitter build --wasm | ||
| tree-sitter build --wasm | ||
| ``` |
There was a problem hiding this comment.
Will address with my own phrasing.
| msg: "node is not installed — install Node.js 22 LTS (see .tool-versions)" | ||
| - sh: | | ||
| major=$(node -p "process.versions.node.split(\".\")[0]") | ||
| test "$major" -ge 22 -a "$major" -lt 24 |
There was a problem hiding this comment.
NO: this is taskfile.dev which uses mvdan.cc/sh/v3 to embed an interpreter which implements much of bash. Part of the point here is to avoid the chaos of a bazillion different sh implementations with incompatible subsets of functionality, and instead have a reliable sh.
The task sh: implementation handles this fine and does not need work-arounds.
We now install zizmor via the official `zizmorcore/zizmor-action` action, properly pinned. Update various docs around how the tree-sitter command is installed. Testing the vscode steps created a .wasm file which was not being gitignored, so update `.gitignore` with patterns to match all build artifacts and not assume a sane user/global gitignore.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
I wanted CI tests for protecting merges to main, so asked Claude to write, using
Taskfile.My "bright idea" of
task install:$editor_namefor editors where we could drop in a single file or not do complicated edits resulted in: 0 editors in task, they all require edits which couldn't be safely made.But this has advanced things to where the README docs actually work for dev, not just for install, and made the process more robust, removing an
npxlayer which just created problems.