feat(res-to-affine): land tree-sitter grammar build pipeline (Phase 2a, Refs #57) by hyperpolymath · Pull Request #321 · hyperpolymath/affinescript · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
29 changes: 27 additions & 2 deletions editors/tree-sitter-rescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,38 @@ snapshots, since AST shapes may shift.

## Install

From the repo root:

```sh
./scripts/install.sh
just install-grammar # justfile recipe
# or directly:
./editors/tree-sitter-rescript/scripts/install.sh
```

This writes a `tree-sitter-rescript` directory under `tools/vendor/`
(gitignored — same convention as the WASI adapter pinning), containing
the generated parser. Requires `git` and `tree-sitter` CLI on PATH.
the generated parser. Requires `git` and the `tree-sitter` CLI on PATH.

The `tree-sitter` CLI can be installed either way:

```sh
cargo install tree-sitter-cli # Rust-native, repo-preferred
npm install -g tree-sitter-cli # Node-based, also fine
```

CI installs via `npm` for speed (`tree-sitter-cli` from npm is a pre-built
binary, ~5 s install). The `cargo` path builds from source (~5 min on a
cold cache) and is the recommended local install because it keeps the
contributor toolchain centred on Rust rather than Node. The
`package.json` in this directory pins the version range; bump it in
sync when the upstream grammar pin moves.

## Continuous integration

The `migration-assistant` job in `.github/workflows/ci.yml` runs `just
install-grammar` on every PR, then smoke-parses
`tools/res-to-affine/test/fixtures/sample.res`. If the pinned commit
stops building cleanly, this job is the first signal.

## Why manifest, not copy

Expand Down
4 changes: 3 additions & 1 deletion editors/tree-sitter-rescript/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ BUILD_DIR="${REPO_ROOT}/tools/vendor/tree-sitter-rescript"

if ! command -v tree-sitter >/dev/null 2>&1; then
echo "error: tree-sitter CLI not found on PATH" >&2
echo " install via: npm install -g tree-sitter-cli" >&2
echo " install via either:" >&2
echo " cargo install tree-sitter-cli (Rust-native, repo-preferred)" >&2
echo " npm install -g tree-sitter-cli (Node-based, also fine)" >&2
exit 2
fi

Expand Down
10 changes: 10 additions & 0 deletions justfile
Loading