@nanonets/graft 0.6.0 → 0.7.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.
- package/README.md +93 -52
- package/dist/ai/llm/types.d.ts +2 -2
- package/dist/ai/llm/types.js +1 -1
- package/dist/ask/ask.d.ts +49 -1
- package/dist/ask/ask.d.ts.map +1 -1
- package/dist/ask/ask.js +270 -68
- package/dist/ask/ask.js.map +1 -1
- package/dist/ask/fuse.d.ts +59 -17
- package/dist/ask/fuse.d.ts.map +1 -1
- package/dist/ask/fuse.js +51 -25
- package/dist/ask/fuse.js.map +1 -1
- package/dist/ask/graphrank.d.ts +6 -0
- package/dist/ask/graphrank.d.ts.map +1 -1
- package/dist/ask/graphrank.js +5 -1
- package/dist/ask/graphrank.js.map +1 -1
- package/dist/claude/format.d.ts +0 -1
- package/dist/claude/format.d.ts.map +1 -1
- package/dist/claude/format.js +18 -21
- package/dist/claude/format.js.map +1 -1
- package/dist/claude/hooks.d.ts +16 -0
- package/dist/claude/hooks.d.ts.map +1 -1
- package/dist/claude/hooks.js +79 -2
- package/dist/claude/hooks.js.map +1 -1
- package/dist/claude/settings-merge.d.ts.map +1 -1
- package/dist/claude/settings-merge.js +13 -6
- package/dist/claude/settings-merge.js.map +1 -1
- package/dist/claude/skill-template.d.ts.map +1 -1
- package/dist/claude/skill-template.js +117 -76
- package/dist/claude/skill-template.js.map +1 -1
- package/dist/cli-epilogue.js +1 -1
- package/dist/cli-epilogue.js.map +1 -1
- package/dist/cli.d.ts +3 -15
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +79 -45
- package/dist/cli.js.map +1 -1
- package/dist/context/node-file.d.ts +10 -0
- package/dist/context/node-file.d.ts.map +1 -1
- package/dist/context/node-file.js +34 -1
- package/dist/context/node-file.js.map +1 -1
- package/dist/context/savings.d.ts +6 -0
- package/dist/context/savings.d.ts.map +1 -1
- package/dist/context/savings.js +9 -1
- package/dist/context/savings.js.map +1 -1
- package/dist/engine.d.ts +1 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +7 -1
- package/dist/engine.js.map +1 -1
- package/dist/graph/build.d.ts.map +1 -1
- package/dist/graph/build.js +37 -1
- package/dist/graph/build.js.map +1 -1
- package/dist/graph/map.d.ts +34 -2
- package/dist/graph/map.d.ts.map +1 -1
- package/dist/graph/map.js +107 -23
- package/dist/graph/map.js.map +1 -1
- package/dist/graph/types.d.ts +12 -0
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/graph/workspace-cli.d.ts +37 -0
- package/dist/graph/workspace-cli.d.ts.map +1 -0
- package/dist/graph/workspace-cli.js +74 -0
- package/dist/graph/workspace-cli.js.map +1 -0
- package/dist/graph/workspace.d.ts +116 -124
- package/dist/graph/workspace.d.ts.map +1 -1
- package/dist/graph/workspace.js +353 -297
- package/dist/graph/workspace.js.map +1 -1
- package/dist/hosts/instructions.d.ts.map +1 -1
- package/dist/hosts/instructions.js +3 -0
- package/dist/hosts/instructions.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +61 -1
- package/dist/mcp/tools.js.map +1 -1
- package/package.json +1 -2
package/dist/claude/hooks.js.map
CHANGED
|
@@ -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,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAA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,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 +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;
|
|
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"}
|
|
@@ -6,10 +6,17 @@ function hookCmd(arg) {
|
|
|
6
6
|
}
|
|
7
7
|
function graftBlocks() {
|
|
8
8
|
return {
|
|
9
|
-
PostToolUse:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
PostToolUse: [
|
|
10
|
+
{ matcher: 'Write|Edit|MultiEdit', hooks: [{ type: 'command', command: hookCmd('post-edit'), timeout: 10000 }] },
|
|
11
|
+
// A retrieval tool (CLI `graft …` via Bash, or the `graft_*` MCP tools) prints a
|
|
12
|
+
// `[graft] tokens saved ≈ N` footer; this hook sums it into the session total the
|
|
13
|
+
// statusline shows. Broad matcher, but the handler no-ops instantly unless a footer
|
|
14
|
+
// is actually present, so non-graft Bash calls cost only a stdin read.
|
|
15
|
+
{ matcher: 'Bash|mcp__graft__', hooks: [{ type: 'command', command: hookCmd('tool-savings'), timeout: 8000 }] },
|
|
16
|
+
],
|
|
17
|
+
UserPromptSubmit: [{ hooks: [{ type: 'command', command: hookCmd('prompt'), timeout: 8000 }] }],
|
|
18
|
+
SessionStart: [{ hooks: [{ type: 'command', command: hookCmd('session-start'), timeout: 8000 }] }],
|
|
19
|
+
Stop: [{ hooks: [{ type: 'command', command: hookCmd('stop'), timeout: 8000 }] }],
|
|
13
20
|
};
|
|
14
21
|
}
|
|
15
22
|
function isGraftHookEntry(entry) {
|
|
@@ -27,10 +34,10 @@ export function mergeGraftSettings(existing) {
|
|
|
27
34
|
else if (merged.subagentStatusLine.command !== SL_CMD)
|
|
28
35
|
warnings.push('Existing subagentStatusLine left untouched.');
|
|
29
36
|
merged.hooks = { ...(merged.hooks ?? {}) };
|
|
30
|
-
for (const [event,
|
|
37
|
+
for (const [event, blocks] of Object.entries(graftBlocks())) {
|
|
31
38
|
const prior = Array.isArray(merged.hooks[event]) ? merged.hooks[event] : [];
|
|
32
39
|
const foreign = prior.filter((e) => !isGraftHookEntry(e)); // drop old Graft entries → idempotent
|
|
33
|
-
merged.hooks[event] = [...foreign,
|
|
40
|
+
merged.hooks[event] = [...foreign, ...blocks];
|
|
34
41
|
}
|
|
35
42
|
const footer = Array.isArray(merged.footerLinksRegexes) ? [...merged.footerLinksRegexes] : [];
|
|
36
43
|
if (!footer.includes(FOOTER))
|
|
@@ -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,W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AEjC,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,
|
|
1
|
+
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,IAAI,MAAM,CA2HtC"}
|
|
@@ -1,89 +1,130 @@
|
|
|
1
1
|
// The graft Claude Code skill, bundled as a string so `graft init` can write it into a
|
|
2
|
-
// consumer repo's .claude/skills/graft/SKILL.md
|
|
3
|
-
// installed graft. This is the single source of truth for the skill text; graft's own
|
|
2
|
+
// consumer repo's .claude/skills/graft/SKILL.md (no network fetch, version-locked to the
|
|
3
|
+
// installed graft). This is the single source of truth for the skill text; graft's own
|
|
4
4
|
// repo copy is regenerated from here when `init` runs in this repo. Mirrors the `.cjs`
|
|
5
5
|
// shim pattern in shim-template.ts.
|
|
6
6
|
export function skillTemplate() {
|
|
7
7
|
return `---
|
|
8
8
|
name: graft
|
|
9
|
-
description: This repo is indexed by graft/. For ANY task here
|
|
10
|
-
how something works, finding where code lives,
|
|
11
|
-
|
|
9
|
+
description: This repo is indexed by graft/. For ANY task here, whether
|
|
10
|
+
understanding how something works, finding where code lives, tracing what
|
|
11
|
+
calls a symbol or what a change breaks, or scoping an edit, get your context
|
|
12
|
+
from graft before grepping or reading source files.
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
# graft
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- **
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
17
|
+
\`graft/\` holds a graph of this repo: small markdown nodes that each explain one
|
|
18
|
+
part in prose and name the exact \`file:line\` spans they cover, plus a wiring
|
|
19
|
+
graph of who-calls-what. Querying a node costs a few hundred tokens; rebuilding
|
|
20
|
+
that understanding by reading source costs thousands, and misses the edges.
|
|
21
|
+
|
|
22
|
+
Every command below is \`$0\`, needs no API key, and returns in under a second.
|
|
23
|
+
There are six of them. **Pick the one that fits the task, run it, act on the
|
|
24
|
+
answer; don't chain tools hoping for more. Most tasks need one call.**
|
|
25
|
+
|
|
26
|
+
## The tools
|
|
27
|
+
|
|
28
|
+
### 1 · \`graft ask "<question>" --source\`: locate + understand (the default)
|
|
29
|
+
Ranked retrieval over the graph, routed automatically between prose nodes and
|
|
30
|
+
the wiring graph, returning the top hits with exact \`file:line\`.
|
|
31
|
+
- \`--source\` inlines the code at each hit, the ≤8-line **crux** of each
|
|
32
|
+
definition, so the result IS the code you need, no follow-up file read. Add
|
|
33
|
+
\`--full\` only when the crux is too small to act on.
|
|
34
|
+
- \`--in <path>\` narrows to a subtree before ranking; \`-n N\` caps results (default 8).
|
|
35
|
+
- **Use it when** the question is conceptual or locational: "how does auth
|
|
36
|
+
work", "where is rate-limiting handled", "what assembles the request pipeline".
|
|
37
|
+
- One ask usually answers. A genuinely multi-part question needs one ask per
|
|
38
|
+
distinct sub-aspect, never the same question reworded. Few or weak hits mean
|
|
39
|
+
switch tool (grep / skeleton / callers), don't re-ask.
|
|
40
|
+
|
|
41
|
+
### 2 · \`graft grep "<pattern>"\`: exhaustive find
|
|
42
|
+
Regex (or \`--fixed\` for a literal) over every indexed file, hits **grouped by
|
|
43
|
+
enclosing symbol** and ranked by coupling; it also reports files it couldn't read.
|
|
44
|
+
- **Use it when** you need every occurrence: all call sites, all uses of a
|
|
45
|
+
constant, all providers. \`ask\` is ranked top-N and *will* miss instances;
|
|
46
|
+
grep won't. One grep replaces a spray of asks.
|
|
47
|
+
- \`-i\` case-insensitive; \`--in <path>\` scopes to a subtree. Fall back to raw
|
|
48
|
+
\`grep -rn\` only for files graft doesn't index (docs, configs, new files).
|
|
49
|
+
|
|
50
|
+
### 3 · \`graft skeleton <file>\`: a file's API at a glance
|
|
51
|
+
Signatures-only view of one file (every function / method / type with its span)
|
|
52
|
+
in ~200 tokens, ~10x cheaper than reading the file.
|
|
53
|
+
- **Use it when** you need "what's in this file / what can I call here" before
|
|
54
|
+
editing or wiring into it. One skeleton is the whole answer for a file; don't
|
|
55
|
+
re-skeleton the same file, and don't skeleton every file \`map\` already named.
|
|
56
|
+
|
|
57
|
+
### 4 · \`graft callers <symbol>\`: the exact edges
|
|
58
|
+
Precomputed call/reference edges, not a text search. Symbol can be bare
|
|
59
|
+
(\`Foo\`), qualified (\`Class.method\`), or package-qualified (\`pkg.Fn\`).
|
|
60
|
+
- default \`--direction in\`: **who calls/references** this; run before you
|
|
61
|
+
rename, delete, or change its signature.
|
|
62
|
+
- \`--direction out\`: **what this symbol itself calls/depends on** (the old \`callees\`).
|
|
63
|
+
- \`--depth N\`: walk transitively N hops for the **full blast radius** (the old
|
|
64
|
+
\`impact\`); \`--depth 2\` is the usual "what breaks if I touch this".
|
|
65
|
+
|
|
66
|
+
### 5 · \`graft map\`: orientation for an unfamiliar repo or area
|
|
67
|
+
A token-budgeted tour: directory clusters, per-directory hubs, and global
|
|
68
|
+
hotspots, straight from the wiring graph.
|
|
69
|
+
- **Use it when** you land in a repo cold or are asked for "the architecture".
|
|
70
|
+
\`map\` alone is the answer: read the hub cards it names; do NOT then skeleton
|
|
71
|
+
or ask your way through every subsystem it lists. \`--max-dirs N\` widens it.
|
|
72
|
+
|
|
73
|
+
### 6 · Lifecycle: \`graft build\` / \`graft check\`
|
|
74
|
+
\`build\` regenerates the graph after code changes (\`$0\`; \`--deep\` adds an LLM
|
|
75
|
+
concept map, skip unless asked). \`check\` fails when \`graft/\` is stale (for CI).
|
|
76
|
+
You rarely touch these mid-task; the graph is already built and committed.
|
|
77
|
+
|
|
78
|
+
## Scenarios: the shortest path through a coding task
|
|
79
|
+
|
|
80
|
+
| When you're… | Reach for | Calls |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| Onboarding / "explain this codebase" | \`graft map\`, then read the named hub cards | 1 |
|
|
83
|
+
| Understanding a flow ("how does X work") | \`graft ask "<flow>" --source\` | 1 |
|
|
84
|
+
| Finding where a change belongs | \`graft ask "where is <behavior>" --source\` | 1 |
|
|
85
|
+
| Editing a known symbol | \`graft ask "<symbol>" --source\`, edit at the \`file:line\` | 1 |
|
|
86
|
+
| Renaming / deleting / changing a signature | \`graft callers <sym> --depth 2\` first | 1 |
|
|
87
|
+
| "What does this depend on?" | \`graft callers <sym> --direction out\` | 1 |
|
|
88
|
+
| Finding every occurrence of a pattern | \`graft grep "<literal>"\` | 1 |
|
|
89
|
+
| "What's the API of this file?" | \`graft skeleton <file>\` | 1 |
|
|
90
|
+
| Debugging a failure in area X | \`graft ask "<symptom>" --source\`, then \`callers\` on the suspect | 1–2 |
|
|
91
|
+
| Judging a diff's risk before merge | \`graft callers <changed sym> --depth 2\` | 1 / symbol |
|
|
92
|
+
| Working inside one repo of a monorepo | add \`--in <scope>/\` to ask / grep / callers | n/a |
|
|
93
|
+
|
|
94
|
+
In a multi-repo workspace, graft ranks fairly so the biggest repo can't drown
|
|
95
|
+
the rest, and every hit carries a \`[scope/]\` label naming its sub-project; when
|
|
96
|
+
you already know where you're working, narrow with \`graft ask "<task>" --in <scope>/\`.
|
|
97
|
+
|
|
98
|
+
## Spend the fewest calls
|
|
99
|
+
- A node's \`covers:\` list already gives exact \`file:line\` for every symbol, so
|
|
100
|
+
cite straight from it. The spans are generated from source and authoritative;
|
|
101
|
+
don't re-open or re-grep files to "double-check".
|
|
102
|
+
- When editing, pull the span with \`graft ask "<symbol>" --source\` and edit at
|
|
103
|
+
that \`file:line\`; never read the whole file to orient, the pack did that.
|
|
104
|
+
- Trust the answer and act. Reach for a second tool only when the first genuinely
|
|
105
|
+
fell short: weak hits, a truncated span, or a need to be exhaustive.
|
|
106
|
+
|
|
107
|
+
## Report what graft saved, every turn
|
|
108
|
+
Each retrieval tool ends its output with a \`[graft] tokens saved ≈ N\` line: the
|
|
109
|
+
estimated tokens that call saved versus reading the files it covers whole.
|
|
110
|
+
Whenever you used any graft tool in a turn, close your reply with a one-line
|
|
111
|
+
tally summing those numbers across every graft call you made, e.g.
|
|
112
|
+
\`🌱 graft saved ~12,400 tokens this turn (3 calls)\`. A call with no footer (tiny
|
|
113
|
+
files, where the pointers cost as much as the source) saved nothing, so skip it.
|
|
114
|
+
This is the per-turn figure; the statusline carries the running session total.
|
|
115
|
+
|
|
116
|
+
## When graft isn't enough
|
|
117
|
+
- Span truncated ("+N more lines"): open the file at that exact range.
|
|
118
|
+
- A node lacks a detail: ask a more specific question; only then read source at
|
|
119
|
+
the exact \`file:line\`, never a whole file to rebuild understanding graft gives.
|
|
120
|
+
- You may also grep / ls / cat inside \`graft/\` directly (plain markdown;
|
|
121
|
+
\`graft/INDEX.md\` indexes the nodes), but the tools above are faster and
|
|
122
|
+
exhaustive where it matters, so reach for them first.
|
|
123
|
+
|
|
124
|
+
When the graft MCP server is connected, these are exposed as tools too:
|
|
125
|
+
\`graft_ask\`, \`graft_grep\`, \`graft_skeleton\`, \`graft_callers\` (with
|
|
126
|
+
\`direction\` / \`depth\`), \`graft_map\`, \`graft_check\`. Use whichever surface is
|
|
127
|
+
available; the guidance is identical.
|
|
87
128
|
`;
|
|
88
129
|
}
|
|
89
130
|
//# sourceMappingURL=skill-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHR,CAAC;AACF,CAAC"}
|
package/dist/cli-epilogue.js
CHANGED
|
@@ -55,7 +55,7 @@ export function formatInitEpilogue(opts) {
|
|
|
55
55
|
stepLines.push(" ".repeat(columnWidth) + extra);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
const closing = `${indent}
|
|
58
|
+
const closing = `${indent}share it: git add .claude && git commit — teammates run \`graft build\` for their own local graph`;
|
|
59
59
|
return [...wordmark, "", ...stepLines, "", closing].join("\n");
|
|
60
60
|
}
|
|
61
61
|
//# sourceMappingURL=cli-epilogue.js.map
|
package/dist/cli-epilogue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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GAAG,KAAK,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,GAAG,MAAM,mGAAmG,CAAC;IAE7H,OAAO,CAAC,GAAG,QAAQ,EAAE,EAAE,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* `graft` CLI. Commands:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ask query the graph ($0, no LLM).
|
|
7
|
-
* check fail if graft/ has drifted from the code — for CI.
|
|
8
|
-
* viz serve the interactive graph viewer.
|
|
9
|
-
* mcp serve the graph over MCP (stdio) for coding agents.
|
|
10
|
-
* callers precise graph traversal for a symbol ($0, no LLM); --direction out = callees, --depth N = blast radius.
|
|
11
|
-
* skeleton signatures-only view of one file ($0, no LLM).
|
|
12
|
-
* grep regex search over indexed files, grouped by enclosing symbol, ranked by coupling ($0, no LLM).
|
|
13
|
-
* map token-budgeted repo orientation — dir clusters, hubs, hotspots ($0, no LLM).
|
|
14
|
-
* init set up the Claude Code integration (.claude/ statusline + hooks + MCP) in this repo.
|
|
15
|
-
*
|
|
16
|
-
* Git is the sync: commit graft/ and anyone who clones the repo has the
|
|
17
|
-
* graph, with no setup.
|
|
3
|
+
* `graft` CLI. Commands: build, ask, check, viz, mcp, callers, skeleton, grep,
|
|
4
|
+
* map, init. Git is the sync: commit graft/ and a clone has the graph. A
|
|
5
|
+
* workspace parent (≥2 git children) federates query commands across children.
|
|
18
6
|
*/
|
|
19
7
|
import "dotenv/config";
|
|
20
8
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,eAAe,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* `graft` CLI. Commands:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ask query the graph ($0, no LLM).
|
|
7
|
-
* check fail if graft/ has drifted from the code — for CI.
|
|
8
|
-
* viz serve the interactive graph viewer.
|
|
9
|
-
* mcp serve the graph over MCP (stdio) for coding agents.
|
|
10
|
-
* callers precise graph traversal for a symbol ($0, no LLM); --direction out = callees, --depth N = blast radius.
|
|
11
|
-
* skeleton signatures-only view of one file ($0, no LLM).
|
|
12
|
-
* grep regex search over indexed files, grouped by enclosing symbol, ranked by coupling ($0, no LLM).
|
|
13
|
-
* map token-budgeted repo orientation — dir clusters, hubs, hotspots ($0, no LLM).
|
|
14
|
-
* init set up the Claude Code integration (.claude/ statusline + hooks + MCP) in this repo.
|
|
15
|
-
*
|
|
16
|
-
* Git is the sync: commit graft/ and anyone who clones the repo has the
|
|
17
|
-
* graph, with no setup.
|
|
3
|
+
* `graft` CLI. Commands: build, ask, check, viz, mcp, callers, skeleton, grep,
|
|
4
|
+
* map, init. Git is the sync: commit graft/ and a clone has the graph. A
|
|
5
|
+
* workspace parent (≥2 git children) federates query commands across children.
|
|
18
6
|
*/
|
|
19
7
|
import "dotenv/config";
|
|
20
8
|
import { Command } from "commander";
|
|
@@ -29,6 +17,8 @@ import { runHostsInit } from "./hosts/init.js";
|
|
|
29
17
|
import { hostIds } from "./hosts/registry.js";
|
|
30
18
|
import { contextDirFor } from "./context/node-file.js";
|
|
31
19
|
import { loadGraphCached } from "./graph/load.js";
|
|
20
|
+
import { isWorkspaceBuildRoot, readWorkspace } from "./graph/workspace.js";
|
|
21
|
+
import { runWorkspaceAsk, runWorkspaceBuild, runWorkspaceCallers, runWorkspaceCheck, runWorkspaceGrep, runWorkspaceMap, } from "./graph/workspace-cli.js";
|
|
32
22
|
import { formatInitEpilogue } from "./cli-epilogue.js";
|
|
33
23
|
import { formatUpgradeReport, formatVersionReport, getNpmViewVersion, readCurrentVersion, runUpgrade } from "./cli-meta.js";
|
|
34
24
|
const program = new Command();
|
|
@@ -53,9 +43,7 @@ function cliConfig() {
|
|
|
53
43
|
baseUrl: o.baseUrl,
|
|
54
44
|
};
|
|
55
45
|
}
|
|
56
|
-
|
|
57
|
-
return new Graft(cliConfig());
|
|
58
|
-
}
|
|
46
|
+
const engineFrom = () => new Graft(cliConfig());
|
|
59
47
|
program
|
|
60
48
|
.command("version")
|
|
61
49
|
.description("Print the installed version and the latest published on npm")
|
|
@@ -91,8 +79,7 @@ program
|
|
|
91
79
|
.sort((a, b) => b[1] - a[1])
|
|
92
80
|
.map(([k, n]) => `${n} ${k}`)
|
|
93
81
|
.join(", ");
|
|
94
|
-
// --deep needs a key; without one, degrade to the $0 structural build
|
|
95
|
-
// rather than failing — the wiring graph is still worth having.
|
|
82
|
+
// --deep needs a key; without one, degrade to the $0 structural build.
|
|
96
83
|
let deep = opts.deep;
|
|
97
84
|
const resolved = resolveConfig(cliConfig());
|
|
98
85
|
if (deep && !resolved.apiKey) {
|
|
@@ -104,8 +91,20 @@ program
|
|
|
104
91
|
if (deep && resolved.usedLegacyEnv) {
|
|
105
92
|
console.error("⚠ using OPENROUTER_API_KEY (deprecated) — prefer GRAFT_API_KEY + GRAFT_BASE_URL.");
|
|
106
93
|
}
|
|
107
|
-
//
|
|
108
|
-
|
|
94
|
+
// Workspace parent: build each child into its OWN graft/ + a workspace index.
|
|
95
|
+
const buildRoot = resolve(dir);
|
|
96
|
+
const buildGlobalDir = program.opts().dir;
|
|
97
|
+
if (isWorkspaceBuildRoot(buildRoot, buildGlobalDir)) {
|
|
98
|
+
await runWorkspaceBuild(buildRoot, {
|
|
99
|
+
deep: !!deep,
|
|
100
|
+
extensions: opts.extensions,
|
|
101
|
+
concurrency,
|
|
102
|
+
childConfig: cliConfig(),
|
|
103
|
+
override: buildGlobalDir,
|
|
104
|
+
});
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// --deep: concept nodes first, then the wiring graph links cards up to them.
|
|
109
108
|
if (deep) {
|
|
110
109
|
const c = await engine.init(dir, {
|
|
111
110
|
extensions: opts.extensions,
|
|
@@ -116,7 +115,7 @@ program
|
|
|
116
115
|
for (const e of c.errors)
|
|
117
116
|
console.error(`✗ ${e}`);
|
|
118
117
|
}
|
|
119
|
-
// Wiring graph
|
|
118
|
+
// Wiring graph — always; LLM meaning only with --deep.
|
|
120
119
|
const g = await engine.graph(dir, {
|
|
121
120
|
llm: deep,
|
|
122
121
|
concurrency,
|
|
@@ -132,7 +131,7 @@ program
|
|
|
132
131
|
for (const e of g.errors)
|
|
133
132
|
console.error(`✗ ${e}`);
|
|
134
133
|
const rel = relative(process.cwd(), g.contextDir) || "graft";
|
|
135
|
-
console.log(`
|
|
134
|
+
console.log(` ${rel}/ is git-ignored (added automatically) — a local cache; teammates run \`graft build\` to get their own.`);
|
|
136
135
|
});
|
|
137
136
|
program
|
|
138
137
|
.command("ask")
|
|
@@ -142,10 +141,26 @@ program
|
|
|
142
141
|
.option("-n, --limit <n>", "max results", "8")
|
|
143
142
|
.option("--source", "inline the source at each file:line hit (retriever mode — the pack IS the answer, no need to re-open files)")
|
|
144
143
|
.option("--full", "with --source: inline whole definition spans instead of the default ≤8-line crux excerpts")
|
|
144
|
+
.option("--in <path>", "narrow to nodes under this path prefix, filtered before scoring (segment-aware, like scopeOf)")
|
|
145
145
|
.option("--json", "output the result as JSON")
|
|
146
146
|
.action(async (query, dir, opts) => {
|
|
147
|
+
const askGlobalDir = program.opts().dir;
|
|
148
|
+
if (readWorkspace(resolve(dir), askGlobalDir)) {
|
|
149
|
+
runWorkspaceAsk(resolve(dir), askGlobalDir, query, {
|
|
150
|
+
limit: Number(opts.limit), source: opts.source, full: opts.full, in: opts.in, json: opts.json,
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
147
154
|
const engine = engineFrom();
|
|
148
|
-
|
|
155
|
+
let r;
|
|
156
|
+
try {
|
|
157
|
+
r = engine.ask(dir, query, { limit: Number(opts.limit), source: opts.source, full: opts.full, in: opts.in });
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
console.error(`✗ ${err instanceof Error ? err.message : String(err)}`);
|
|
161
|
+
process.exit(1);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
149
164
|
if (opts.json) {
|
|
150
165
|
console.log(JSON.stringify(r, null, 2));
|
|
151
166
|
}
|
|
@@ -176,14 +191,17 @@ program
|
|
|
176
191
|
.option("-e, --extensions <exts...>", "code extensions to include")
|
|
177
192
|
.option("--json", "output the drift as JSON")
|
|
178
193
|
.action((dir, opts) => {
|
|
194
|
+
const checkGlobalDir = program.opts().dir;
|
|
195
|
+
if (readWorkspace(resolve(dir), checkGlobalDir)) {
|
|
196
|
+
runWorkspaceCheck(resolve(dir), checkGlobalDir);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
179
199
|
const engine = engineFrom();
|
|
180
200
|
const r = engine.check(dir, { extensions: opts.extensions });
|
|
181
201
|
const g = engine.checkGraph(dir); // graph.json is only judged when it exists
|
|
182
|
-
//
|
|
202
|
+
// A layer that IS present must be in sync; a never-built layer (keyless
|
|
203
|
+
// build skips the markdown layer) is informational, not a failure.
|
|
183
204
|
const bothMissing = r.missing && g.missing;
|
|
184
|
-
// A layer that IS present must be in sync; a layer that was never built
|
|
185
|
-
// (keyless `graft build` skips the markdown/concept layer) is informational,
|
|
186
|
-
// not a failure — the wiring graph stands on its own.
|
|
187
205
|
const markdownFail = !r.missing && !r.ok;
|
|
188
206
|
const wiringFail = !g.missing && !g.ok;
|
|
189
207
|
if (opts.json) {
|
|
@@ -225,8 +243,7 @@ program
|
|
|
225
243
|
console.error(`✗ no context graph at ${contextDir} — run \`graft build --deep\` first`);
|
|
226
244
|
process.exit(1);
|
|
227
245
|
}
|
|
228
|
-
|
|
229
|
-
const viewerDir = fileURLToPath(new URL("./viewer/", import.meta.url));
|
|
246
|
+
const viewerDir = fileURLToPath(new URL("./viewer/", import.meta.url)); // prebuilt
|
|
230
247
|
const srv = await startVizServer({
|
|
231
248
|
contextDir,
|
|
232
249
|
viewerDir,
|
|
@@ -259,8 +276,16 @@ program
|
|
|
259
276
|
.option("--in <path>", "narrow matches to nodes whose path contains this substring")
|
|
260
277
|
.option("--json", "output as JSON")
|
|
261
278
|
.action(async (symbol, dir, opts) => {
|
|
262
|
-
const { runCallersCommand } = await import("./graph/traverse-cli.js");
|
|
263
279
|
const globalOpts = program.opts();
|
|
280
|
+
if (!opts.json && readWorkspace(resolve(dir), globalOpts.dir)) {
|
|
281
|
+
runWorkspaceCallers(resolve(dir), globalOpts.dir, symbol, {
|
|
282
|
+
direction: opts.direction === "out" ? "out" : "in",
|
|
283
|
+
depth: opts.depth ? Number(opts.depth) : undefined,
|
|
284
|
+
in: opts.in,
|
|
285
|
+
});
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const { runCallersCommand } = await import("./graph/traverse-cli.js");
|
|
264
289
|
runCallersCommand(symbol, dir, {
|
|
265
290
|
direction: opts.direction,
|
|
266
291
|
depth: opts.depth,
|
|
@@ -279,8 +304,14 @@ program
|
|
|
279
304
|
.option("--in <path>", "narrow to files whose path contains this substring")
|
|
280
305
|
.option("--json", "output as JSON")
|
|
281
306
|
.action(async (pattern, dir, opts) => {
|
|
282
|
-
const { runGrepCommand } = await import("./search/grep-cli.js");
|
|
283
307
|
const globalOpts = program.opts();
|
|
308
|
+
if (readWorkspace(resolve(dir), globalOpts.dir)) {
|
|
309
|
+
runWorkspaceGrep(resolve(dir), globalOpts.dir, pattern, {
|
|
310
|
+
ignoreCase: opts.ignoreCase, fixed: opts.fixed, json: opts.json,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const { runGrepCommand } = await import("./search/grep-cli.js");
|
|
284
315
|
runGrepCommand(pattern, dir, {
|
|
285
316
|
ignoreCase: opts.ignoreCase,
|
|
286
317
|
fixed: opts.fixed,
|
|
@@ -296,17 +327,9 @@ program
|
|
|
296
327
|
.option("--max-dirs <n>", "max directory entries shown, rest counted into dropped (default 16)")
|
|
297
328
|
.option("--json", "output as JSON")
|
|
298
329
|
.action(async (dir, opts) => {
|
|
299
|
-
const { buildRepoMap, formatRepoMap } = await import("./graph/map.js");
|
|
300
330
|
const root = resolve(dir);
|
|
301
331
|
const globalOpts = program.opts();
|
|
302
|
-
|
|
303
|
-
const graph = loadGraphCached(contextDir);
|
|
304
|
-
if (!graph) {
|
|
305
|
-
console.error("✗ no graph — run graft build first");
|
|
306
|
-
process.exit(1);
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
let maxDirs;
|
|
332
|
+
let maxDirsW;
|
|
310
333
|
if (opts.maxDirs !== undefined) {
|
|
311
334
|
const n = parseInt(opts.maxDirs, 10);
|
|
312
335
|
if (!Number.isFinite(n) || n <= 0) {
|
|
@@ -314,9 +337,21 @@ program
|
|
|
314
337
|
process.exit(1);
|
|
315
338
|
return;
|
|
316
339
|
}
|
|
317
|
-
|
|
340
|
+
maxDirsW = n;
|
|
341
|
+
}
|
|
342
|
+
if (!opts.json && readWorkspace(root, globalOpts.dir)) {
|
|
343
|
+
runWorkspaceMap(root, globalOpts.dir, { maxDirs: maxDirsW });
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const { buildRepoMap, formatRepoMap } = await import("./graph/map.js");
|
|
347
|
+
const contextDir = contextDirFor(root, globalOpts.dir);
|
|
348
|
+
const graph = loadGraphCached(contextDir);
|
|
349
|
+
if (!graph) {
|
|
350
|
+
console.error("✗ no graph — run graft build first");
|
|
351
|
+
process.exit(1);
|
|
352
|
+
return;
|
|
318
353
|
}
|
|
319
|
-
const map = buildRepoMap(graph, { maxDirs });
|
|
354
|
+
const map = buildRepoMap(graph, { maxDirs: maxDirsW });
|
|
320
355
|
if (opts.json) {
|
|
321
356
|
console.log(JSON.stringify(map, null, 2));
|
|
322
357
|
return;
|
|
@@ -380,7 +415,6 @@ program
|
|
|
380
415
|
console.error(`✓ ${w.id}: ${w.path} (${w.action})`);
|
|
381
416
|
if (!explicit && !opts.allAgents && r.written.length === 0)
|
|
382
417
|
console.error("· no other agents detected (see --list-agents / --all-agents)");
|
|
383
|
-
// r.unknown is always empty here — ids are validated above, before any writes.
|
|
384
418
|
for (const m of r.mcp)
|
|
385
419
|
console.error(`✓ mcp ${m.id}: ${m.path} (${m.action})`);
|
|
386
420
|
for (const h of r.hooks)
|