@nanonets/graft 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +38 -8
  2. package/dist/claude/hooks.d.ts +15 -0
  3. package/dist/claude/hooks.d.ts.map +1 -1
  4. package/dist/claude/hooks.js +52 -3
  5. package/dist/claude/hooks.js.map +1 -1
  6. package/dist/claude/init.d.ts +17 -0
  7. package/dist/claude/init.d.ts.map +1 -1
  8. package/dist/claude/init.js +45 -19
  9. package/dist/claude/init.js.map +1 -1
  10. package/dist/claude/settings-merge.d.ts.map +1 -1
  11. package/dist/claude/settings-merge.js +9 -1
  12. package/dist/claude/settings-merge.js.map +1 -1
  13. package/dist/claude/skill-template.d.ts.map +1 -1
  14. package/dist/claude/skill-template.js +11 -3
  15. package/dist/claude/skill-template.js.map +1 -1
  16. package/dist/claude/state.d.ts +2 -20
  17. package/dist/claude/state.d.ts.map +1 -1
  18. package/dist/claude/state.js +9 -72
  19. package/dist/claude/state.js.map +1 -1
  20. package/dist/cli-picker.d.ts +60 -0
  21. package/dist/cli-picker.d.ts.map +1 -0
  22. package/dist/cli-picker.js +268 -0
  23. package/dist/cli-picker.js.map +1 -0
  24. package/dist/cli.js +99 -10
  25. package/dist/cli.js.map +1 -1
  26. package/dist/engine.d.ts +2 -0
  27. package/dist/engine.d.ts.map +1 -1
  28. package/dist/engine.js +1 -0
  29. package/dist/engine.js.map +1 -1
  30. package/dist/graph/build.d.ts +13 -2
  31. package/dist/graph/build.d.ts.map +1 -1
  32. package/dist/graph/build.js +93 -19
  33. package/dist/graph/build.js.map +1 -1
  34. package/dist/graph/extract-cache.d.ts +96 -0
  35. package/dist/graph/extract-cache.d.ts.map +1 -0
  36. package/dist/graph/extract-cache.js +199 -0
  37. package/dist/graph/extract-cache.js.map +1 -0
  38. package/dist/graph/fingerprint.d.ts +70 -0
  39. package/dist/graph/fingerprint.d.ts.map +1 -0
  40. package/dist/graph/fingerprint.js +147 -0
  41. package/dist/graph/fingerprint.js.map +1 -0
  42. package/dist/graph/load.d.ts +11 -0
  43. package/dist/graph/load.d.ts.map +1 -1
  44. package/dist/graph/load.js +14 -0
  45. package/dist/graph/load.js.map +1 -1
  46. package/dist/graph/refresh.d.ts +49 -0
  47. package/dist/graph/refresh.d.ts.map +1 -0
  48. package/dist/graph/refresh.js +202 -0
  49. package/dist/graph/refresh.js.map +1 -0
  50. package/dist/graph/source-files.d.ts +18 -0
  51. package/dist/graph/source-files.d.ts.map +1 -0
  52. package/dist/graph/source-files.js +36 -0
  53. package/dist/graph/source-files.js.map +1 -0
  54. package/dist/hosts/codex-hooks.d.ts +8 -0
  55. package/dist/hosts/codex-hooks.d.ts.map +1 -1
  56. package/dist/hosts/codex-hooks.js +27 -4
  57. package/dist/hosts/codex-hooks.js.map +1 -1
  58. package/dist/hosts/init.d.ts +2 -0
  59. package/dist/hosts/init.d.ts.map +1 -1
  60. package/dist/hosts/init.js +5 -2
  61. package/dist/hosts/init.js.map +1 -1
  62. package/dist/hosts/mcp-config.d.ts +18 -0
  63. package/dist/hosts/mcp-config.d.ts.map +1 -1
  64. package/dist/hosts/mcp-config.js +31 -7
  65. package/dist/hosts/mcp-config.js.map +1 -1
  66. package/dist/hosts/plan.d.ts +32 -0
  67. package/dist/hosts/plan.d.ts.map +1 -0
  68. package/dist/hosts/plan.js +67 -0
  69. package/dist/hosts/plan.js.map +1 -0
  70. package/dist/hosts/registry.d.ts.map +1 -1
  71. package/dist/hosts/registry.js +9 -0
  72. package/dist/hosts/registry.js.map +1 -1
  73. package/dist/mcp/server.d.ts.map +1 -1
  74. package/dist/mcp/server.js +5 -2
  75. package/dist/mcp/server.js.map +1 -1
  76. package/dist/mcp/tools.d.ts +2 -2
  77. package/dist/mcp/tools.d.ts.map +1 -1
  78. package/dist/mcp/tools.js +106 -90
  79. package/dist/mcp/tools.js.map +1 -1
  80. package/dist/util/state.d.ts +45 -0
  81. package/dist/util/state.d.ts.map +1 -0
  82. package/dist/util/state.js +121 -0
  83. package/dist/util/state.js.map +1 -0
  84. package/package.json +1 -1
package/README.md CHANGED
@@ -61,7 +61,9 @@ npm install -g @nanonets/graft # install the CLI, once
61
61
  graft init # build the graph + wire it into Claude Code
62
62
  ```
63
63
 
64
- That is the whole setup. `graft init` builds `graft/` from your code and drops a statusline and hooks into `.claude/`, so from the next session on Graft rides along in Claude Code: it pulls the matching nodes into each prompt and rebuilds the graph in the background after every turn. No daemon, no re-indexing to remember, nothing to run or maintain by default — the graph is just files.
64
+ That is the whole setup. `graft init` asks which of your coding agents to wire up, builds `graft/` from your code, and drops a statusline and hooks into `.claude/`, so from the next session on Graft rides along in Claude Code: it pulls the matching nodes into each prompt and rebuilds the graph in the background after every turn. No daemon, no re-indexing to remember, nothing to run or maintain by default — the graph is just files.
65
+
66
+ Nothing is written until you pick. Run `graft init --dry-run` to see every file it would touch first, or `graft init --agents claude` to skip the prompt and wire Claude Code alone.
65
67
 
66
68
  `graft build` adds `graft/` to your `.gitignore` automatically — the graph is a local, regenerable cache (like `node_modules`), not something you commit. What you share is the wiring `init` dropped into `.claude/`; each teammate runs `graft build` to generate their own graph:
67
69
 
@@ -117,7 +119,9 @@ flowchart LR
117
119
  P2 --> N["graft/*.md<br/>markdown node graph"]
118
120
  ```
119
121
 
120
- Both LLM passes are cached by content hash. Re-running only touches the files that changed, so the second build is fast and cheap.
122
+ Every pass is cached by content hash — the LLM ones and the tree-sitter parse alike. Re-running only touches the files that changed, so the second build is fast and cheap (on this repo, 124 files: 0.74s cold, 0.18s after one edited file, 0.18s with nothing changed). `graft build --no-reuse` forces a cold re-parse.
123
+
124
+ That cheapness is what lets **every query refresh the graph before it answers**. A retrieval call stats the tree against the last build's fingerprint (~3ms), and rebuilds only if something moved — so `ask`/`grep`/`callers`/`skeleton`/`map` describe the code as it is right now, including edits that are unsaved to git: uncommitted, unstaged, or staged all look the same to graft, which never reads git at all. The refresh is structural and `$0`; it never calls the LLM. Turn it off per-command with `--no-refresh`, or everywhere with `GRAFT_NO_REFRESH=1`.
121
125
 
122
126
  Alongside the markdown graph, `graft build` builds `graft/.graph/wiring.json` — a per-symbol code graph — plus a per-file wiring card mirroring your source tree. Tier 1 is pure tree-sitter (every function, class, and call edge; deterministic, no model, no network), which is why plain `graft build` needs no key. The `--deep` pass adds a one-line summary and a crux excerpt per symbol, cached by body hash.
123
127
 
@@ -165,16 +169,33 @@ npx @nanonets/graft init
165
169
  # Claude Code additionally gets the live statusline + hooks below
166
170
  ```
167
171
 
168
- `init` auto-detects which agents are present (via their config directories) and writes a marker-fenced Graft section into each one's shared instruction file — `AGENTS.md`, `GEMINI.md`, `.github/copilot-instructions.md` — or a wholly-owned rule file for the agents that use one — `.cursor/rules/graft.mdc`, `.kiro/steering/graft.md`, `.windsurf/rules/graft.md`. Re-running only updates Graft's own section (or replaces the owned file) and never touches the rest of your content.
172
+ On a terminal, `init` shows you every agent it knows about — flagging the ones it detected (via their config directories) and listing the exact files each would write — and wires only the ones you select. Claude Code is pre-selected; nothing else is. Selected agents get a marker-fenced Graft section in their shared instruction file — `AGENTS.md` (Codex, OpenCode and other CLIs that read it), `GEMINI.md`, `.github/copilot-instructions.md` — or a wholly-owned rule/skill file for the agents that use one — `.cursor/rules/graft.mdc`, `.kiro/steering/graft.md`, `.windsurf/rules/graft.md`, `.adal/skills/graft/SKILL.md` for [AdaL](https://adal.sylph.ai) (progressive-disclosure skill, same shape as the Claude Code skill below). Re-running only updates Graft's own section (or replaces the owned file) and never touches the rest of your content.
173
+
174
+ With no TTY to prompt on — CI, a Dockerfile, a piped shell — `init` writes **nothing** and prints the command to run instead. Pass `--agents <ids>` or `--yes` to make a scripted run explicit.
169
175
 
170
176
  | Flag | Effect |
171
177
  |---|---|
172
- | `--agents <ids...>` | wire only these — ids: `agents`, `cursor`, `gemini`, `copilot`, `kiro`, `windsurf`, `claude` |
178
+ | `--agents <ids...>` | wire only these, no prompt — ids: `agents`, `cursor`, `gemini`, `copilot`, `kiro`, `windsurf`, `adal`, `claude` |
179
+ | `--yes`, `-y` | skip the prompt and wire every **detected** agent |
180
+ | `--dry-run` | print every file `init` would touch, then exit without writing |
173
181
  | `--all-agents` | write instruction files for every known agent, detected or not |
174
182
  | `--no-agents` | Claude Code wiring only; skip other agents |
175
183
  | `--list-agents` | print the known agent ids and exit |
176
184
  | `--no-mcp` | skip MCP server registration |
177
185
  | `--no-hooks` | skip hook installation |
186
+ | `--no-global` | skip writes outside this repo (the `~/.codex/` entries below) |
187
+
188
+ #### Writes outside the repo
189
+
190
+ Selecting the `agents` host also touches your **user-level** Codex config, when `~/.codex/` exists:
191
+
192
+ | Path | What changes |
193
+ |---|---|
194
+ | `~/.codex/config.toml` | registers the Graft MCP server (`[mcp_servers.graft]`) |
195
+ | `~/.codex/hooks/graft/graft-hooks.cjs` | the post-edit hook shim |
196
+ | `~/.codex/hooks.json` | a `PostToolUse` entry matching `Write\|Edit\|MultiEdit` |
197
+
198
+ Both configs are user-level, so they apply to **every** repo you open with Codex, not just this one. The picker labels these `machine-wide`, `--dry-run` lists them in their own section, and `--no-global` skips them while still wiring `AGENTS.md`.
178
199
 
179
200
  ### MCP server
180
201
 
@@ -202,7 +223,7 @@ Where a CLI agent supports user-level `hooks.json`, `init` also installs Graft's
202
223
  `graft init` always wires up Claude Code, and Claude Code gets more than an instruction file. From then on, any Claude Code session opened in the repo gets:
203
224
 
204
225
  - **a live statusline** — graph size, % enriched, and a `⚠ N stale` warning when the code has moved ahead of the graph
205
- - **auto-sync** — after you edit code, Graft rebuilds the graph in the background at the end of the turn (structural, `$0` — it never calls the LLM on its own)
226
+ - **auto-sync** — every graft query brings the graph up to date first, so an answer always describes the code as it is right now, uncommitted edits included. A query refreshes only what it reads; the markdown under `graft/` is refreshed by the background rebuild at the end of a turn that touched code. Both are structural and `$0` — auto-sync never calls the LLM on its own
206
227
  - **context on tap** — each prompt pulls the matching nodes into the session; editing a file surfaces what depends on it ("blast radius"); new sessions start with the repo map
207
228
 
208
229
  <p align="center">
@@ -220,6 +241,7 @@ Where a CLI agent supports user-level `hooks.json`, `init` also installs Graft's
220
241
  graft build [dir] # build graft/ from the code at [dir]: wiring graph + per-file cards (no LLM, no key)
221
242
  graft build --deep # add the LLM layer: concept nodes + per-symbol summary/crux (cached)
222
243
  graft build --extensions .ts .py # only include these code extensions
244
+ graft build --no-reuse # re-parse every file instead of replaying unchanged ones from cache
223
245
 
224
246
  graft ask "<task>" [dir] # query the graph — ranked nodes + exact file:line (no LLM, no key)
225
247
  graft ask "<task>" --json # machine-readable result
@@ -238,15 +260,23 @@ graft grep "<regex>" -i --fixed # case-insensitive; treat the pattern as a
238
260
  graft map [dir] # token-budgeted repo orientation — dir clusters, hubs, hotspots (no LLM, no key)
239
261
  graft map --max-dirs N # raise/lower the number of directories shown
240
262
 
241
- graft check [dir] # fail (exit 1) if graft/ has drifted from the code
263
+ graft check [dir] # fail (exit 1) if graft/ has drifted from the code (never auto-refreshes — it's the drift report)
242
264
  graft check --json # print the drift report as JSON
243
265
 
266
+ # ask / skeleton / callers / grep / map all refresh the graph first if the working tree moved:
267
+ # --no-refresh # answer from the graph exactly as it is on disk
268
+ # GRAFT_NO_REFRESH=1 # same, for every command
269
+ # GRAFT_REFRESH=hash # hash every file instead of trusting size+mtime
270
+
244
271
  graft viz [dir] # see the graph: serves an interactive viewer on localhost
245
272
  graft viz --port 5000 --no-open # pick a port; don't auto-open the browser
246
273
 
247
- graft init [dir] # wire Graft into the coding agents detected in this repo (Claude Code always gets full hooks + statusline + MCP)
274
+ graft init [dir] # pick which agents to wire (prompts on a terminal; writes nothing until you choose)
275
+ graft init --dry-run # list every file it would touch, then exit
276
+ graft init --agents cursor kiro # wire only these agents, no prompt (ids: agents, cursor, gemini, copilot, kiro, windsurf, adal, claude)
277
+ graft init --yes # no prompt; wire every detected agent
278
+ graft init --no-global # skip writes outside this repo (~/.codex/ config + hooks)
248
279
  graft init --no-build # wire the files only; don't build the graph
249
- graft init --agents cursor kiro # wire only these agents (ids: agents, cursor, gemini, copilot, kiro, windsurf, claude)
250
280
  graft init --all-agents # wire every known agent, detected or not
251
281
  graft init --list-agents # list known agent ids and exit
252
282
 
@@ -1,4 +1,19 @@
1
1
  export declare function underGraft(dir: string, file: string): boolean;
2
+ /**
3
+ * How long the prompt hook may let `graft ask` run — derived from the budget that is
4
+ * *actually installed* in this repo's `.claude/settings.json`, not from what the
5
+ * current version of `settings-merge.ts` would install.
6
+ *
7
+ * A query now brings the graph up to date first, so `graft init` raises the
8
+ * UserPromptSubmit budget to 15s to cover the one cold rebuild after an upgrade. But
9
+ * `mergeGraftSettings` only runs during `graft init` — upgrading the npm package does
10
+ * not re-run it. So every repo wired before that change keeps `"timeout": 8000`, and
11
+ * hard-coding a 13s child there means Claude Code kills the hook first: `emit()` and
12
+ * `writeSession()` never run, the turn gets no retrieval pack at all, and the SIGKILLed
13
+ * child can't even release the build lock. Reading the installed number keeps the child
14
+ * strictly inside whatever budget this repo really has.
15
+ */
16
+ export declare function promptAskTimeout(dir: string): number;
2
17
  /**
3
18
  * The "you're working in backend/, weight it" hint: on a multi-scope repo,
4
19
  * narrow the prompt hook's `ask` call to whatever scope the last-edited file
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/claude/hooks.ts"],"names":[],"mappings":"AAyBA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG7D;AAqCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAyBjG;AAoCD,wBAAsB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CvD"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/claude/hooks.ts"],"names":[],"mappings":"AAyBA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG7D;AAUD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIpD;AA0DD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAyBjG;AAoCD,wBAAsB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CvD"}
@@ -34,14 +34,63 @@ export function underGraft(dir, file) {
34
34
  const rel = file.startsWith(dir) ? file.slice(dir.length) : file;
35
35
  return rel.replace(/^[/\\]+/, '').replace(/\\/g, '/').startsWith('graft/');
36
36
  }
37
- function graftJson(dir, args) {
37
+ /** Default budget for a graft child process invoked from a hook, matching the 8s
38
+ * the installed hook entries carry. */
39
+ const CHILD_TIMEOUT_MS = 8000;
40
+ /** Headroom left for the hook's own work (read stdin, score, write session, emit)
41
+ * after its `graft ask` child returns. */
42
+ const HOOK_OVERHEAD_MS = 2000;
43
+ /** Floor, so a hand-edited tiny timeout can't leave the child no time at all. */
44
+ const MIN_CHILD_TIMEOUT_MS = 4000;
45
+ /**
46
+ * How long the prompt hook may let `graft ask` run — derived from the budget that is
47
+ * *actually installed* in this repo's `.claude/settings.json`, not from what the
48
+ * current version of `settings-merge.ts` would install.
49
+ *
50
+ * A query now brings the graph up to date first, so `graft init` raises the
51
+ * UserPromptSubmit budget to 15s to cover the one cold rebuild after an upgrade. But
52
+ * `mergeGraftSettings` only runs during `graft init` — upgrading the npm package does
53
+ * not re-run it. So every repo wired before that change keeps `"timeout": 8000`, and
54
+ * hard-coding a 13s child there means Claude Code kills the hook first: `emit()` and
55
+ * `writeSession()` never run, the turn gets no retrieval pack at all, and the SIGKILLed
56
+ * child can't even release the build lock. Reading the installed number keeps the child
57
+ * strictly inside whatever budget this repo really has.
58
+ */
59
+ export function promptAskTimeout(dir) {
60
+ const installed = installedHookTimeout(dir, 'UserPromptSubmit');
61
+ if (installed === null)
62
+ return CHILD_TIMEOUT_MS - HOOK_OVERHEAD_MS;
63
+ return Math.max(MIN_CHILD_TIMEOUT_MS, installed - HOOK_OVERHEAD_MS);
64
+ }
65
+ /** The timeout on this repo's graft hook entry for `event`, or null if it can't be
66
+ * read (no settings file, hand-edited shape, unparseable JSON). */
67
+ function installedHookTimeout(dir, event) {
68
+ try {
69
+ const settings = JSON.parse(readFileSync(join(dir, '.claude', 'settings.json'), 'utf8'));
70
+ const blocks = settings?.hooks?.[event];
71
+ if (!Array.isArray(blocks))
72
+ return null;
73
+ for (const block of blocks) {
74
+ for (const h of block?.hooks ?? []) {
75
+ if (typeof h?.command === 'string' && h.command.includes('graft-hooks.cjs') && typeof h.timeout === 'number') {
76
+ return h.timeout;
77
+ }
78
+ }
79
+ }
80
+ return null;
81
+ }
82
+ catch {
83
+ return null;
84
+ }
85
+ }
86
+ function graftJson(dir, args, timeout = CHILD_TIMEOUT_MS) {
38
87
  try {
39
88
  // GRAFT_TEST_CLI is a test seam (mirrors GRAFT_TEST_STDIN/GRAFT_TEST_SYNC_RUN) so
40
89
  // tests can point the prompt hook's `graft ask`/`graft check` calls at a stub
41
90
  // script and observe the exact args it was invoked with, instead of shelling
42
91
  // out to the real CLI (which isn't built relative to the TS source under test).
43
92
  const cliPath = process.env.GRAFT_TEST_CLI ?? graftCliPath();
44
- const out = execFileSync(process.execPath, [cliPath, ...args], { cwd: dir, encoding: 'utf8', timeout: 8000, stdio: ['ignore', 'pipe', 'ignore'] });
93
+ const out = execFileSync(process.execPath, [cliPath, ...args], { cwd: dir, encoding: 'utf8', timeout, stdio: ['ignore', 'pipe', 'ignore'] });
45
94
  return JSON.parse(out);
46
95
  }
47
96
  catch (e) {
@@ -198,7 +247,7 @@ export async function main(event) {
198
247
  const scopeHint = lastFileScopeHint(dir, readStats(dir)?.lastFile);
199
248
  if (scopeHint)
200
249
  askArgs.push('--in', scopeHint);
201
- const ask = graftJson(dir, askArgs);
250
+ const ask = graftJson(dir, askArgs, promptAskTimeout(dir));
202
251
  if (!ask)
203
252
  return;
204
253
  const id = input.session_id || 'default';
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/claude/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;sCAEsC;AACtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;I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OAAO;QAC7C,2EAA2E;QAC3E,uEAAuE;QACvE,6EAA6E;QAC7E,0EAA0E;QAC1E,wEAAwE;QACxE,4EAA4E;QAC5E,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAC1D,uEAAuE;QACvE,6EAA6E;QAC7E,MAAM,SAAS,GAAG,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,MAAM,EAAE,GAAG,KAAK,CAAC,UAAU,IAAI,SAAS,CAAC;QACzC,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC;QACrB,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC;QACjC,IAAI,KAAK;YAAE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;QAC3C,MAAM,GAAG,GAAG,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,IAAI,GAAG;YAAE,IAAI,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;QACvC,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC"}
@@ -1,4 +1,21 @@
1
1
  import { type McpWrite } from '../hosts/mcp-config.js';
2
+ import type { PlannedWrite } from '../hosts/plan.js';
3
+ /**
4
+ * The files `runInit` writes — pure, no writes, so `--dry-run` and the picker
5
+ * can report them up front. All repo-local: the Claude Code layer never writes
6
+ * outside the project.
7
+ */
8
+ export declare function claudeTargets(dir: string): PlannedWrite[];
9
+ /**
10
+ * Build the graph if it isn't there yet. Not Claude-specific: the wiring for any
11
+ * host points at `graft/`, so `graft init` builds whichever hosts were selected —
12
+ * this lives beside `runInit` only because that's the caller that owns `built`.
13
+ * Best-effort; the user can always run `graft build` (the epilogue says so).
14
+ */
15
+ export declare function buildGraphIfMissing(dir: string, opts: {
16
+ build?: boolean;
17
+ cliPath?: string;
18
+ }): boolean;
2
19
  export interface InitResult {
3
20
  settingsPath: string;
4
21
  shims: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/claude/init.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEnF,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CAqCjG"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/claude/init.ts"],"names":[],"mappings":"AAOA,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,CAWzD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CASrG;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CA+BjG"}
@@ -1,15 +1,50 @@
1
1
  import { mkdirSync, writeFileSync, readFileSync, existsSync, chmodSync } from 'node:fs';
2
- import { join } from 'node:path';
2
+ import { join, dirname } from 'node:path';
3
3
  import { execFileSync } from 'node:child_process';
4
4
  import { mergeGraftSettings } from './settings-merge.js';
5
5
  import { statuslineShim, hooksShim } from './shim-template.js';
6
6
  import { skillTemplate } from './skill-template.js';
7
7
  import { claudeDistDir } from './paths.js';
8
8
  import { mergeJsonKey, SERVER_ENTRY } from '../hosts/mcp-config.js';
9
+ /**
10
+ * The files `runInit` writes — pure, no writes, so `--dry-run` and the picker
11
+ * can report them up front. All repo-local: the Claude Code layer never writes
12
+ * outside the project.
13
+ */
14
+ export function claudeTargets(dir) {
15
+ const t = (path, what, kind = 'claude') => ({ hostId: 'claude', id: 'claude', path, scope: 'repo', kind, what });
16
+ return [
17
+ t(join(dir, '.claude', 'settings.json'), 'graft statusline + hook blocks'),
18
+ t(join(dir, '.claude', 'helpers', 'graft-statusline.cjs'), 'statusline shim'),
19
+ t(join(dir, '.claude', 'helpers', 'graft-hooks.cjs'), 'hooks shim'),
20
+ t(join(dir, '.claude', 'skills', 'graft', 'SKILL.md'), 'graft skill'),
21
+ // Tagged 'mcp' so the picker doesn't label Claude Code as having no MCP.
22
+ t(join(dir, '.mcp.json'), 'mcpServers.graft', 'mcp'),
23
+ ];
24
+ }
25
+ /**
26
+ * Build the graph if it isn't there yet. Not Claude-specific: the wiring for any
27
+ * host points at `graft/`, so `graft init` builds whichever hosts were selected —
28
+ * this lives beside `runInit` only because that's the caller that owns `built`.
29
+ * Best-effort; the user can always run `graft build` (the epilogue says so).
30
+ */
31
+ export function buildGraphIfMissing(dir, opts) {
32
+ const wiring = join(dir, 'graft', '.graph', 'wiring.json');
33
+ if (opts.build === false || !opts.cliPath || existsSync(wiring))
34
+ return false;
35
+ try {
36
+ execFileSync(process.execPath, [opts.cliPath, 'build', '.'], { cwd: dir, stdio: 'inherit', timeout: 300000 });
37
+ return true;
38
+ }
39
+ catch {
40
+ return false;
41
+ }
42
+ }
9
43
  export function runInit(dir, opts = {}) {
10
- const helpersDir = join(dir, '.claude', 'helpers');
11
- mkdirSync(helpersDir, { recursive: true });
12
- const settingsPath = join(dir, '.claude', 'settings.json');
44
+ // Same list `--dry-run` and the picker report, so the two can't drift apart.
45
+ const [settings, statusline, hooks, skill, mcpTarget] = claudeTargets(dir).map((t) => t.path);
46
+ mkdirSync(dirname(statusline), { recursive: true });
47
+ const settingsPath = settings;
13
48
  let existing = {};
14
49
  try {
15
50
  existing = JSON.parse(readFileSync(settingsPath, 'utf8'));
@@ -17,8 +52,8 @@ export function runInit(dir, opts = {}) {
17
52
  catch { /* none/invalid → start fresh */ }
18
53
  const { merged, warnings } = mergeGraftSettings(existing);
19
54
  writeFileSync(settingsPath, `${JSON.stringify(merged, null, 2)}\n`);
20
- const sl = join(helpersDir, 'graft-statusline.cjs');
21
- const hk = join(helpersDir, 'graft-hooks.cjs');
55
+ const sl = statusline;
56
+ const hk = hooks;
22
57
  const bakedDir = claudeDistDir(); // absolute <pkg>/dist/claude — the shims' primary resolution path
23
58
  writeFileSync(sl, statuslineShim(bakedDir));
24
59
  chmodSync(sl, 0o755);
@@ -26,23 +61,14 @@ export function runInit(dir, opts = {}) {
26
61
  chmodSync(hk, 0o755);
27
62
  // Install the graft skill — the piece that redirects the agent to graft/ before it
28
63
  // greps source. Overwritten each run (graft owns this file), like the shims above.
29
- const skillDir = join(dir, '.claude', 'skills', 'graft');
30
- mkdirSync(skillDir, { recursive: true });
31
- const skillPath = join(skillDir, 'SKILL.md');
64
+ const skillPath = skill;
65
+ mkdirSync(dirname(skillPath), { recursive: true });
32
66
  writeFileSync(skillPath, skillTemplate());
33
67
  // Register the graft MCP server in the project's .mcp.json so Claude Code
34
68
  // exposes graft_ask/graft_callers/etc. as tools — the same keyed merge the
35
69
  // other hosts use (existing servers preserved; unparseable files skipped).
36
- const mcp = mergeJsonKey('claude', join(dir, '.mcp.json'), 'mcpServers', SERVER_ENTRY);
37
- let built = false;
38
- const wiring = join(dir, 'graft', '.graph', 'wiring.json');
39
- if (opts.build !== false && opts.cliPath && !existsSync(wiring)) {
40
- try {
41
- execFileSync(process.execPath, [opts.cliPath, 'build', '.'], { cwd: dir, stdio: 'inherit', timeout: 300000 });
42
- built = true;
43
- }
44
- catch { /* build best-effort; user can run `graft build` manually */ }
45
- }
70
+ const mcp = mergeJsonKey('claude', mcpTarget, 'mcpServers', SERVER_ENTRY);
71
+ const built = buildGraphIfMissing(dir, opts);
46
72
  return { settingsPath, shims: [sl, hk], skill: skillPath, mcp, warnings, built };
47
73
  }
48
74
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/claude/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OA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E,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACnF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings-merge.d.ts","sourceRoot":"","sources":["../../src/claude/settings-merge.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AA4BhC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,IAAI,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCvF"}
1
+ {"version":3,"file":"settings-merge.d.ts","sourceRoot":"","sources":["../../src/claude/settings-merge.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAoChC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,IAAI,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCvF"}
@@ -14,7 +14,15 @@ function graftBlocks() {
14
14
  // is actually present, so non-graft Bash calls cost only a stdin read.
15
15
  { matcher: 'Bash|mcp__graft__', hooks: [{ type: 'command', command: hookCmd('tool-savings'), timeout: 8000 }] },
16
16
  ],
17
- UserPromptSubmit: [{ hooks: [{ type: 'command', command: hookCmd('prompt'), timeout: 8000 }] }],
17
+ // Longer budget than the other hooks: its `graft ask` is a real query, and a
18
+ // query now brings the graph up to date first (graph/refresh.ts) — usually
19
+ // milliseconds, but the first one after an upgrade re-parses the repo once.
20
+ // `hooks.ts` reads this number back out of the installed settings.json at
21
+ // runtime and caps its `graft ask` child just under it, so a repo wired before
22
+ // this bump (8s) keeps a child that fits inside 8s. Changing the number here is
23
+ // therefore safe on its own — but it only reaches an existing repo when someone
24
+ // re-runs `graft init`, since that is the only caller of this function.
25
+ UserPromptSubmit: [{ hooks: [{ type: 'command', command: hookCmd('prompt'), timeout: 15000 }] }],
18
26
  SessionStart: [{ hooks: [{ type: 'command', command: hookCmd('session-start'), timeout: 8000 }] }],
19
27
  Stop: [{ hooks: [{ type: 'command', command: hookCmd('stop'), timeout: 8000 }] }],
20
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"settings-merge.js","sourceRoot":"","sources":["../../src/claude/settings-merge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,sEAAsE,CAAC;AACtF,MAAM,MAAM,GAAG,sBAAsB,CAAC;AACtC,MAAM,aAAa,GAAG,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AAE7D,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,oEAAoE,GAAG,EAAE,CAAC;AACnF,CAAC;AACD,SAAS,WAAW;IAClB,OAAO;QACL,WAAW,EAAE;YACX,EAAE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;YAChH,iFAAiF;YACjF,kFAAkF;YAClF,oFAAoF;YACpF,uEAAuE;YACvE,EAAE,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE;SAChH;QACD,gBAAgB,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC/F,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,EA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C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,IAAI,MAAM,CA0ItC"}
1
+ {"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,IAAI,MAAM,CAkJtC"}
@@ -80,9 +80,17 @@ hotspots, straight from the wiring graph.
80
80
  or ask your way through every subsystem it lists. \`--max-dirs N\` widens it.
81
81
 
82
82
  ### 6 · Lifecycle: \`graft build\` / \`graft check\`
83
- \`build\` regenerates the graph after code changes (\`$0\`; \`--deep\` adds an LLM
84
- concept map, skip unless asked). \`check\` fails when \`graft/\` is stale (for CI).
85
- You rarely touch these mid-task; the graph is already built and committed.
83
+ Every tool above refreshes the graph itself before answering, so what those tools
84
+ return always describes the code as it is right now — including edits you just made
85
+ and have not committed. You do **not** need to run \`build\` after editing.
86
+
87
+ One caveat, if you \`grep\` the markdown under \`graft/\` directly: those cards are a
88
+ projection, rebuilt at the end of the turn rather than on each query, so after an edit
89
+ they can lag. The tools above never do — prefer them, and treat a card's spans as
90
+ stale if you have edited that file this turn.
91
+
92
+ \`build\` is for the LLM layer (\`--deep\` adds a concept map; skip unless asked);
93
+ \`check\` fails when \`graft/\` is stale, for CI.
86
94
 
87
95
  ## Scenarios: the shortest path through a coding task
88
96
 
@@ -1 +1 @@
1
- {"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,yFAAyF;AACzF,uFAAuF;AACvF,uFAAuF;AACvF,oCAAoC;AACpC,MAAM,UAAU,aAAa;IAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIR,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,yFAAyF;AACzF,uFAAuF;AACvF,uFAAuF;AACvF,oCAAoC;AACpC,MAAM,UAAU,aAAa;IAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJR,CAAC;AACF,CAAC"}
@@ -1,15 +1,5 @@
1
- export interface Stats {
2
- nodeCount: number;
3
- edgeCount: number;
4
- languages: string[];
5
- totalCount: number;
6
- readyCount: number;
7
- staleCount: number;
8
- dirty: boolean;
9
- syncing: boolean;
10
- syncedAt: string | null;
11
- lastFile: string | null;
12
- }
1
+ export { LOCK_STALE_MS, acquireLock, acquireLockIn, releaseLockIn, cacheDir, emptyStats, patchStats, readStats, releaseLock, writeJsonAtomic, writeStats, } from '../util/state.js';
2
+ export type { Stats } from '../util/state.js';
13
3
  export interface SessionState {
14
4
  lastQuery: string | null;
15
5
  perAgentQuery: Record<string, string>;
@@ -22,14 +12,6 @@ export interface SessionState {
22
12
  * session files written before this field still parse. */
23
13
  injectedPointers?: string[];
24
14
  }
25
- export declare const LOCK_STALE_MS = 300000;
26
- export declare function emptyStats(): Stats;
27
- export declare function cacheDir(projectDir: string): string;
28
- export declare function readStats(d: string): Stats | null;
29
- export declare function writeStats(d: string, s: Stats): void;
30
- export declare function patchStats(d: string, patch: Partial<Stats>): Stats;
31
15
  export declare function readSession(d: string, id: string): SessionState;
32
16
  export declare function writeSession(d: string, id: string, s: SessionState): void;
33
- export declare function acquireLock(d: string): boolean;
34
- export declare function releaseLock(d: string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MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAE/D;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,GAAG,IAAI,CAEzE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAgB9C;AACD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAA8D"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/claude/state.ts"],"names":[],"mappings":"AASA,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IACxC,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAC;IACpB;;8DAE0D;IAC1D,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAQD,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAE/D;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,GAAG,IAAI,CAEzE"}
@@ -1,83 +1,20 @@
1
- import { readFileSync, writeFileSync, mkdirSync, renameSync, rmSync, statSync } from 'node:fs';
2
- import { join, dirname } from 'node:path';
3
- export const LOCK_STALE_MS = 300000;
4
- export function emptyStats() {
5
- return { nodeCount: 0, edgeCount: 0, languages: [], totalCount: 0, readyCount: 0,
6
- staleCount: 0, dirty: false, syncing: false, syncedAt: null, lastFile: null };
7
- }
1
+ /**
2
+ * Claude Code session state. The shared `graft/.cache/` pieces (the statusline's
3
+ * `Stats` snapshot and the build lock) live in `../util/state.js` so the graph's
4
+ * pre-query auto-refresh can take the same lock; they are re-exported here so
5
+ * every existing import path keeps working.
6
+ */
7
+ import { join } from 'node:path';
8
+ import { cacheDir, readJson, writeJsonAtomic } from '../util/state.js';
9
+ export { LOCK_STALE_MS, acquireLock, acquireLockIn, releaseLockIn, cacheDir, emptyStats, patchStats, readStats, releaseLock, writeJsonAtomic, writeStats, } from '../util/state.js';
8
10
  function emptySession() {
9
11
  return { lastQuery: null, perAgentQuery: {}, graftReads: 0, sourceReads: 0, savedTokens: 0, injectedPointers: [] };
10
12
  }
11
- export function cacheDir(projectDir) { return join(projectDir, 'graft', '.cache'); }
12
- function statsPath(d) { return join(cacheDir(d), 'stats.json'); }
13
13
  function sessionPath(d, id) { return join(cacheDir(d), 'session', `${id}.json`); }
14
- function lockPath(d) { return join(cacheDir(d), '.sync.lock'); }
15
- function readJson(p) {
16
- try {
17
- return JSON.parse(readFileSync(p, 'utf8'));
18
- }
19
- catch {
20
- return null;
21
- }
22
- }
23
- function writeJsonAtomic(p, value) {
24
- mkdirSync(dirname(p), { recursive: true });
25
- const tmp = `${p}.${process.pid}.tmp`;
26
- writeFileSync(tmp, JSON.stringify(value, null, 2));
27
- renameSync(tmp, p);
28
- }
29
- export function readStats(d) { return readJson(statsPath(d)); }
30
- export function writeStats(d, s) { writeJsonAtomic(statsPath(d), s); }
31
- // Best-effort read-modify-write; not atomic across concurrent processes, but acceptable
32
- // for episodic hook writes (worst case is a lost update, not corruption).
33
- export function patchStats(d, patch) {
34
- const next = { ...(readStats(d) ?? emptyStats()), ...patch };
35
- writeStats(d, next);
36
- return next;
37
- }
38
14
  export function readSession(d, id) {
39
15
  return readJson(sessionPath(d, id)) ?? emptySession();
40
16
  }
41
17
  export function writeSession(d, id, s) {
42
18
  writeJsonAtomic(sessionPath(d, id), s);
43
19
  }
44
- export function acquireLock(d) {
45
- const p = lockPath(d);
46
- mkdirSync(cacheDir(d), { recursive: true });
47
- const payload = JSON.stringify({ pid: process.pid, at: new Date().toISOString() });
48
- try {
49
- writeFileSync(p, payload, { flag: 'wx' }); // atomic exclusive create
50
- return true;
51
- }
52
- catch (e) {
53
- if (e?.code !== 'EEXIST')
54
- throw e;
55
- let stale;
56
- try {
57
- stale = Date.now() - statSync(p).mtimeMs >= LOCK_STALE_MS;
58
- }
59
- catch {
60
- stale = true;
61
- }
62
- if (!stale)
63
- return false;
64
- try {
65
- rmSync(p);
66
- }
67
- catch { /* another process reclaimed it */ }
68
- try {
69
- writeFileSync(p, payload, { flag: 'wx' });
70
- return true;
71
- }
72
- catch (e2) {
73
- if (e2?.code === 'EEXIST')
74
- return false;
75
- throw e2;
76
- }
77
- }
78
- }
79
- export function releaseLock(d) { try {
80
- rmSync(lockPath(d));
81
- }
82
- catch { /* already gone */ } }
83
20
  //# sourceMappingURL=state.js.map