feat(cli): delegate commands to gnd by default#2125
Conversation
🦋 Changeset detectedLatest commit: ca825d4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploying graph-tooling with
|
| Latest commit: |
ca825d4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1cf3a50e.graph-tooling.pages.dev |
| Branch Preview URL: | https://lutter-with-gnd.graph-tooling.pages.dev |
There was a problem hiding this comment.
Pull request overview
Makes the Rust @graphprotocol/gnd binary the default executor for graph commands while keeping the TypeScript implementation reachable via an escape hatch. bin/run.js now delegates to gnd for everything except graph local, and an oclif dev shim is added so the command stays visible in TS-mode help. The deprecated TS-side graph node install (and its local-node helpers) are removed, since installation is now handled by depending on @graphprotocol/gnd directly. CLAUDE.md docs and a changeset are added; pnpm is bumped to v10.
Changes:
- Add
@graphprotocol/gndruntime dep and dispatch wrapper (bin/run.js,src/command-helpers/gnd.ts,src/commands/dev.ts), gated byGRAPH_CLI_IGNORE_GND(set in the test global setup). - Delete
src/commands/node.tsandsrc/command-helpers/local-node.ts(now superseded by the gnd npm package). - Add monorepo/cli/ts
CLAUDE.mddocs, changeset entry, and bump rootengines.pnpmto>=10withpackageManager: pnpm@10.17.1.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Lockfile updates for the new @graphprotocol/gnd package and unrelated drift. |
| packages/cli/package.json | Adds @graphprotocol/gnd dependency; leaves progress/decompress behind. |
| packages/cli/bin/run.js | New top-level dispatch that execs gnd unless command is local or env opt-out is set. |
| packages/cli/src/command-helpers/gnd.ts | Spawn helper that resolves and execs the gnd binary, forwarding stdio/signals. |
| packages/cli/src/commands/dev.ts | Oclif shim that always delegates to gnd dev. |
| packages/cli/src/commands/node.ts | Removed — replaced by gnd dependency. |
| packages/cli/src/command-helpers/local-node.ts | Removed — GitHub download/install logic no longer needed. |
| packages/cli/tests/cli/globalSetup.ts | Forces TS mode in tests via GRAPH_CLI_IGNORE_GND=1. |
| package.json | Bumps required pnpm to >=10 and pins packageManager. |
| CLAUDE.md / packages/cli/CLAUDE.md / packages/ts/CLAUDE.md | New high-level docs for the monorepo and each package. |
| .changeset/...dependencies.md | Records the new @graphprotocol/gnd dependency for changesets. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/cli/src/command-helpers/gnd.ts:16
process.kill(process.pid, signal)is used to "re-raise" the child's terminating signal in the parent. On Windows this throws for most signal names other thanSIGTERM/SIGKILL/SIGINT/0, so if the child is killed by e.g.SIGHUPthe parent will crash with an unhandled exception instead of exiting cleanly. Consider wrapping in a try/catch and falling back toprocess.exit(1)when re-raising fails, or only forwarding the small set of signals that are portable.
child.on('exit', (code, signal) => {
if (signal) {
process.kill(process.pid, signal);
} else {
process.exit(code ?? 1);
}
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8dc54c4 to
a0fcbde
Compare
Bump engines.pnpm to ^10 (pnpm 9 reached EOL) and align CI plumbing
with the new constraint:
- Add root .npmrc with `public-hoist-pattern[]=*eslint*` and `*prettier*`
so transitive plugins of @theguild/{prettier,eslint}-config remain
resolvable from the workspace root after pnpm 10's hoist defaults
changed (otherwise `prettier -c .` errors with
"Cannot find package 'prettier-plugin-sh'").
- Rewrite the pnpm-version step in setup-node/action.yml so it honors
the `packageManagerVersion` input first, falls back to a sane default,
and fixes the broken `if [ ! -z {{inputs.packageManager}} ]` shell
(missing `$`, was always truthy).
- Pin pnpm to 10.17.1 explicitly via packageManagerVersion at every
setup-node call site in ci.yml and publish.yml.
No root `packageManager` field is added: yarn 1 (still the system yarn
on GitHub runners) refuses to coexist with a non-yarn value, which
trips the CLI init tests' `yarn link @graphprotocol/graph-cli` step.
Add documentation files to help Claude (and developers) understand the codebase structure, key patterns, and development workflows. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace the `graph node install` GitHub-release downloader with a direct dependency on `@graphprotocol/gnd`, the unified npm wrapper now published from the graph-node repo. The wrapper declares the five platform-specific binary packages as its own optional dependencies, so `pnpm install` of graph-cli automatically resolves the correct binary for the host and exposes a `gnd` launcher on `node_modules/.bin`. The `graph node install` command, its `local-node.ts` GitHub downloader, and the `commands/node.ts` oclif command all become dead code and are removed.
`graph <cmd>` now execs the matching `gnd <cmd>` (the Rust `@graphprotocol/gnd` binary). Two exceptions stay on the oclif/TS path: `local`, which has no gnd equivalent, and `dev`, which is a thin oclif shim that spawns `gnd dev` so the command is discoverable from `graph --help`. Set `GRAPH_CLI_IGNORE_GND=1` to force the TS implementation everywhere; the test suite does this automatically.
Add a changeset describing the major-version bump, document the new gnd dispatch in the CLI README (including the GRAPH_CLI_IGNORE_GND escape hatch and the removal of `graph node install`), add `graph dev` to the command list, and mark `graph local` as deprecated in favor of `graph dev`.
Summary
graph <cmd>now execsgnd <cmd>(the Rust@graphprotocol/gndbinary) by default.graph localstays on the TS path — gnd has no equivalent command.graph devoclif command shims tognd devso the command stays discoverable viagraph --helpin TS mode.GRAPH_CLI_IGNORE_GND=1to force every command through the oclif/TS implementation. The test suite sets thisautomatically in
tests/cli/globalSetup.ts.Dispatch lives in
bin/run.js; the spawn helper insrc/command-helpers/gnd.tsis shared withsrc/commands/dev.ts.Test plan
./bin/run.js --versionreports the gnd versionGRAPH_CLI_IGNORE_GND=1 ./bin/run.js --versionreports the graph-cli version./bin/run.js local --helpshows the TSlocalhelp (with or without the env var)./bin/run.js dev --watchactually starts gnd devGRAPH_CLI_IGNORE_GND=1 ./bin/run.js dev --watchalso starts gnd dev (via the oclif shim)pnpm test:clipasses (200/200)