Repository navigation
Guides Graftcode Demo
This walkthrough runs a small TypeScript page that lists a repository's changed
files by calling Quinjet through its generated npm Graft. Stage a file in
Quinjet, press Refresh, and the page shows the new status next to the typed
call that fetched it. The code is in
examples/graftcode-web.

browser: examples/graftcode-web
await Quinjet.status("", "")
│ npm Graft, binary WebSocket
▼
Graftcode gateway (gg) on ws://localhost:7381/ws
started by `quinjet graft serve --publish`
│
▼
quinjet status --json, in the repository the gateway serves
There is no server code in the example. The Graft is an ordinary npm package
generated from Quinjet's method signatures; it opens a WebSocket to the gateway
and returns the same JSON that quinjet status --json prints.
- Quinjet 0.0.90 or later
- Node.js 22.18 or later, for the frontend only; the gateway carries its own runtime
- A Git repository with a few uncommitted changes
In the repository you want the page to show:
quinjet graft serve --publishThe first start downloads the Graftcode gateway (gg) into Quinjet's cache,
verified against its SHA-256 digest, and can take a minute. Quinjet prints the
addresses once the gateway answers:
Quinjet is grafted for /home/you/code/my-repo
MCP http://localhost:7381/mcp
Vision http://localhost:7381/GV
WebSocket ws://localhost:7381/ws
Tools 27 (read-only; pass --allow-writes for mutations)
Published method signatures went to grft.dev for typed Grafts
--publish uploads the method signatures, never repository content, to grft.dev
so the typed packages can be installed. Without --allow-writes the gateway
exposes only the commands that read, which is all this page needs. Leave it
running.
In a second terminal, from a clone of Quinjet:
cd examples/graftcode-web
npm install
npm run graftnpm run graft asks the gateway for its npm install command (the one Vision
shows under npm) and installs that package under the name quinjet-graft, so
the source imports it the same way on every machine:
npm install --no-save --registry https://grft.dev/<registry>__free \
quinjet-graft@npm:@graft/npm-quinjet-graft_<id>@0.0.90The registry address changes every time the gateway starts, so it is not
written into package.json. Run npm run graft again after any later
npm install.
npm run devOpen http://localhost:5173. The page calls Quinjet.status as soon as it
loads and lists the changes under the same groups as Quinjet's Changes view.
Stage something, either in Quinjet's terminal interface (s or Space on a
file row) or from the command line:
quinjet stage README.mdPress Refresh, or r. The file moves to Staged Changes, and the call
line shows how many changes came back and how long the round trip took, usually
a few tens of milliseconds.
All of the Graftcode-specific code is three lines in
src/main.ts:
import { GraftConfig, Quinjet } from "quinjet-graft";
GraftConfig.host = "ws://localhost:7381/ws";
const status = JSON.parse(String(await Quinjet.status("", ""))) as Status;Quinjet.status comes from the Graft's own type declarations, with the two
trailing optional arguments every Quinjet method has: repoPath, empty for the
gateway's repository, and accessToken, empty because graft serve needs none.
src/status.ts types the JSON
document, which follows quinjet status.
| Variable | Default | Used by |
|---|---|---|
VITE_QUINJET_GATEWAY |
ws://localhost:7381/ws |
The page, for the gateway's WebSocket |
QUINJET_GATEWAY_HTTP |
http://localhost:7381 |
npm run graft, for the gateway's install command |
A gateway started with --port 7400 is reached with
VITE_QUINJET_GATEWAY=ws://localhost:7400/ws npm run dev.
Every read command is a method on the same class, so the page grows by calling
more of them: Quinjet.log, Quinjet.diff, Quinjet.branchList,
Quinjet.prView, and the rest listed in the Graftcode guide.
Restart the gateway with --allow-writes to add stage, commit, and the
other commands that change the repository, but only on a network you trust:
graft serve has no token, and any machine that can reach the port can call
them.
| Symptom | Cause |
|---|---|
npm run graft says no gateway answered |
The gateway is not running, or listens on another port. Start it, or set QUINJET_GATEWAY_HTTP. |
npm run graft says there is no published npm Graft |
The gateway was started without --publish. |
The page shows Opening handshake has timed out
|
The first call reached the gateway while it was still starting. Press Refresh. |
Vite cannot resolve quinjet-graft
|
npm install removed it. Run npm run graft again. |
Generated from docs/, edit the docs in the repo, not the wiki.
CLI reference
Pull Request
- View
- Commits
- Files
- Diff
- Conversation
- Checks
- Logs
- Open
- Merge
- Admin Merge
- Auto Merge
- Disable Auto Merge
- Dequeue
- Ready
- Draft
- Review
- Reviews
- Comment
- Edit Last Comment
- Delete Last Comment
- Edit
- Update Branch
- Lock
- Unlock
- Subscribe
- Unsubscribe
- Allow Maintainer Edits
- Disallow Maintainer Edits
- Revert
- Close
- Reopen
Guides
Optimization
Rust practices