@nanonets/graft 0.22.1 → 0.23.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 +4 -4
- package/dist/ask/ask.d.ts +0 -3
- package/dist/ask/ask.d.ts.map +1 -1
- package/dist/ask/ask.js +1 -3
- package/dist/ask/ask.js.map +1 -1
- package/dist/brand.d.ts.map +1 -1
- package/dist/brand.js +4 -1
- package/dist/brand.js.map +1 -1
- package/dist/claude/format.d.ts +20 -7
- package/dist/claude/format.d.ts.map +1 -1
- package/dist/claude/format.js +42 -12
- package/dist/claude/format.js.map +1 -1
- package/dist/claude/hook-layers.d.ts.map +1 -1
- package/dist/claude/hook-layers.js +5 -3
- package/dist/claude/hook-layers.js.map +1 -1
- package/dist/claude/hooks.d.ts +23 -3
- package/dist/claude/hooks.d.ts.map +1 -1
- package/dist/claude/hooks.js +173 -20
- package/dist/claude/hooks.js.map +1 -1
- package/dist/claude/init.d.ts +38 -7
- package/dist/claude/init.d.ts.map +1 -1
- package/dist/claude/init.js +172 -33
- package/dist/claude/init.js.map +1 -1
- package/dist/claude/settings-merge.d.ts +23 -0
- package/dist/claude/settings-merge.d.ts.map +1 -1
- package/dist/claude/settings-merge.js +103 -7
- package/dist/claude/settings-merge.js.map +1 -1
- package/dist/claude/shim-template.d.ts.map +1 -1
- package/dist/claude/shim-template.js +7 -2
- package/dist/claude/shim-template.js.map +1 -1
- package/dist/claude/skill-template.d.ts +4 -3
- package/dist/claude/skill-template.d.ts.map +1 -1
- package/dist/claude/skill-template.js +7 -3
- package/dist/claude/skill-template.js.map +1 -1
- package/dist/claude/state.d.ts +1 -1
- package/dist/claude/state.d.ts.map +1 -1
- package/dist/cli.js +61 -40
- package/dist/cli.js.map +1 -1
- package/dist/context/map-dir.d.ts +13 -0
- package/dist/context/map-dir.d.ts.map +1 -0
- package/dist/context/map-dir.js +67 -0
- package/dist/context/map-dir.js.map +1 -0
- package/dist/context/node-file.d.ts +4 -3
- package/dist/context/node-file.d.ts.map +1 -1
- package/dist/context/node-file.js +18 -4
- package/dist/context/node-file.js.map +1 -1
- package/dist/hosts/claude-global.d.ts.map +1 -1
- package/dist/hosts/claude-global.js +31 -11
- package/dist/hosts/claude-global.js.map +1 -1
- package/dist/hosts/config-write.js +1 -1
- package/dist/hosts/config-write.js.map +1 -1
- package/dist/hosts/retract.d.ts.map +1 -1
- package/dist/hosts/retract.js +15 -6
- package/dist/hosts/retract.js.map +1 -1
- package/dist/init-guard.d.ts +11 -0
- package/dist/init-guard.d.ts.map +1 -0
- package/dist/init-guard.js +21 -0
- package/dist/init-guard.js.map +1 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +2 -1
- package/dist/mcp/tools.js.map +1 -1
- package/dist/notes/branches.d.ts +18 -1
- package/dist/notes/branches.d.ts.map +1 -1
- package/dist/notes/branches.js +73 -7
- package/dist/notes/branches.js.map +1 -1
- package/dist/notes/edit-overlap.d.ts +62 -0
- package/dist/notes/edit-overlap.d.ts.map +1 -0
- package/dist/notes/edit-overlap.js +202 -0
- package/dist/notes/edit-overlap.js.map +1 -0
- package/dist/notes/git-facts.d.ts +5 -1
- package/dist/notes/git-facts.d.ts.map +1 -1
- package/dist/notes/git-facts.js +6 -2
- package/dist/notes/git-facts.js.map +1 -1
- package/dist/notes/notes.d.ts +15 -1
- package/dist/notes/notes.d.ts.map +1 -1
- package/dist/notes/notes.js +50 -12
- package/dist/notes/notes.js.map +1 -1
- package/dist/notes/repo-trail.d.ts +3 -1
- package/dist/notes/repo-trail.d.ts.map +1 -1
- package/dist/notes/repo-trail.js +40 -3
- package/dist/notes/repo-trail.js.map +1 -1
- package/dist/notes/session-cost.d.ts +18 -4
- package/dist/notes/session-cost.d.ts.map +1 -1
- package/dist/notes/session-cost.js +127 -13
- package/dist/notes/session-cost.js.map +1 -1
- package/dist/search/grep-cli.d.ts +5 -2
- package/dist/search/grep-cli.d.ts.map +1 -1
- package/dist/search/grep-cli.js +11 -4
- package/dist/search/grep-cli.js.map +1 -1
- package/dist/search/ignored-code.d.ts +9 -0
- package/dist/search/ignored-code.d.ts.map +1 -0
- package/dist/search/ignored-code.js +73 -0
- package/dist/search/ignored-code.js.map +1 -0
- package/dist/upkeep-run.d.ts.map +1 -1
- package/dist/upkeep-run.js +4 -2
- package/dist/upkeep-run.js.map +1 -1
- package/dist/upkeep.js +2 -2
- package/dist/upkeep.js.map +1 -1
- package/dist/util/state.d.ts.map +1 -1
- package/dist/util/state.js +2 -1
- package/dist/util/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shim-template.js","sourceRoot":"","sources":["../../src/claude/shim-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,yFAAyF;AACzF,0FAA0F;AAC1F,8EAA8E;AAC9E,EAAE;AACF,0FAA0F;AAC1F,6FAA6F;AAC7F,2FAA2F;AAC3F,sFAAsF;AACtF,gEAAgE;AAChE,EAAE;AACF,sDAAsD;AACtD,yFAAyF;AACzF,uFAAuF;AACvF,oDAAoD;AACpD,wFAAwF;AACxF,uFAAuF;AACvF,sFAAsF;AACtF,sFAAsF;AACtF,oDAAoD;AACpD,0FAA0F;AAC1F,0FAA0F;AAC1F,4FAA4F;AAC5F,kFAAkF;AAClF,uFAAuF;AACvF,gCAAgC;AAChC,EAAE;AACF,4FAA4F;AAC5F,0FAA0F;AAC1F,sFAAsF;AACtF,4EAA4E;AAC5E,oFAAoF;AACpF,yFAAyF;AACzF,6BAA6B;A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AC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAAE,OAAO;IAChD,IAAI,CAAC;QAAC,eAAe,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,kCAAkC,CAAC,CAAC;AACzH,CAAC"}
|
|
@@ -3,9 +3,10 @@ export declare function skillTemplate(brand?: Brand): string;
|
|
|
3
3
|
/**
|
|
4
4
|
* Agent-facing graft text in trail's spelling, for every file trail writes
|
|
5
5
|
* for an agent: the commands as trail spells them (`graft check` became
|
|
6
|
-
* `trail build --check`, see `cmd`), and the name in prose.
|
|
7
|
-
*
|
|
8
|
-
* as do `graft-…` and
|
|
6
|
+
* `trail build --check`, see `cmd`), and the name in prose. Under trail the
|
|
7
|
+
* code map is in `.trail/cache/` (context/map-dir.ts), so the folder's name
|
|
8
|
+
* changes too; any other `graft` followed by `/` stays, as do `graft-…` and
|
|
9
|
+
* `graft_…` names.
|
|
9
10
|
*/
|
|
10
11
|
export declare function trailSpelling(text: string): string;
|
|
11
12
|
//# sourceMappingURL=skill-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAU9C,wBAAgB,aAAa,CAAC,KAAK,GAAE,KAAe,GAAG,MAAM,CAE5D;AAuDD
|
|
1
|
+
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAU9C,wBAAgB,aAAa,CAAC,KAAK,GAAE,KAAe,GAAG,MAAM,CAE5D;AAuDD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD"}
|
|
@@ -65,12 +65,16 @@ about trail.
|
|
|
65
65
|
/**
|
|
66
66
|
* Agent-facing graft text in trail's spelling, for every file trail writes
|
|
67
67
|
* for an agent: the commands as trail spells them (`graft check` became
|
|
68
|
-
* `trail build --check`, see `cmd`), and the name in prose.
|
|
69
|
-
*
|
|
70
|
-
* as do `graft-…` and
|
|
68
|
+
* `trail build --check`, see `cmd`), and the name in prose. Under trail the
|
|
69
|
+
* code map is in `.trail/cache/` (context/map-dir.ts), so the folder's name
|
|
70
|
+
* changes too; any other `graft` followed by `/` stays, as do `graft-…` and
|
|
71
|
+
* `graft_…` names.
|
|
71
72
|
*/
|
|
72
73
|
export function trailSpelling(text) {
|
|
73
74
|
return text
|
|
75
|
+
.replace(/`graft\/`/g, "`.trail/cache/`")
|
|
76
|
+
.replace(/(?<![\w./-])graft\/INDEX\.md/g, ".trail/cache/INDEX.md")
|
|
77
|
+
.replace(/(?<![\w./-])graft\/(?=[\s.,)])/g, ".trail/cache/")
|
|
74
78
|
.replace(/\bgraft (check|stats)\b(?![\w-])/g, (m) => cmd(m, "trail"))
|
|
75
79
|
.replace(/\bGraft\b(?![/\w-])/g, "Trail")
|
|
76
80
|
.replace(/\bgraft\b(?![/\w-])/g, "trail");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/claude/skill-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAc,MAAM,aAAa,CAAC;AAC9C,uFAAuF;AACvF,yFAAyF;AACzF,uFAAuF;AACvF,uFAAuF;AACvF,oCAAoC;AACpC,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,0DAA0D;AAC1D,MAAM,UAAU,aAAa,CAAC,QAAe,OAAO;IAClD,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU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AAa;IAC/B,MAAM,IAAI,GAAG,aAAa,CACxB,KAAK;SACF,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC;SACpC,OAAO,CAAC,mDAAmD,EAAE,2DAA2D,CAAC,CAC7H,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,aAAa,EAAE,CAAC,CAAC;IACtD,OAAO;;eAEM,iBAAiB;;EAE9B,IAAI,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDf,CAAC;AACF,CAAC;AAED,SAAS,UAAU;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4JR,CAAC;AACF,CAAC"}
|
package/dist/claude/state.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface SessionState {
|
|
|
15
15
|
/** Notes already put in front of the agent this session by the per-prompt
|
|
16
16
|
* hook, by path, so each is shown once (see `notesForPrompt`). */
|
|
17
17
|
injectedNotes?: string[];
|
|
18
|
-
/**
|
|
18
|
+
/** `<branch> <function id>` pairs: a teammate's open branch on a function the agent edited, already put in front of it this session. */
|
|
19
19
|
injectedOverlaps?: string[];
|
|
20
20
|
/** Weak-match nudges spent this session, capped so the line stays signal.
|
|
21
21
|
* Optional for the same backwards-compatibility reason as above. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/claude/state.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,i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;IAC5B;wEACoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;sFAEkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;iFAC6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;yEACqE;IACrE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;gFAC4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;4EAMwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;oBAGgB;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;wDACoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;4DAGwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;wBAIoB;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAMD,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAyC;AAItF;iFACiF;AACjF,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAIlD;AAED,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"}
|
package/dist/cli.js
CHANGED
|
@@ -31,6 +31,7 @@ import { contextDirFor } from "./context/node-file.js";
|
|
|
31
31
|
import { loadGraphCached } from "./graph/load.js";
|
|
32
32
|
import { ensureFreshChildren, ensureFreshGraph, refreshNote } from "./graph/refresh.js";
|
|
33
33
|
import { isWorkspaceBuildRoot, readWorkspace } from "./graph/workspace.js";
|
|
34
|
+
import { NOT_GIT_LINE, homeFolderRefusal, isGitWorkTree } from "./init-guard.js";
|
|
34
35
|
import { hasGraftIndex, nearestGraftRoot } from "./graph/root.js";
|
|
35
36
|
import { unsupportedExtensions, supportedExtensions } from "./graph/source-files.js";
|
|
36
37
|
import { discoverWorkspaceChildren } from "./graph/scopes.js";
|
|
@@ -48,7 +49,7 @@ import { normalizePathPrefix } from "./util/paths.js";
|
|
|
48
49
|
import { latestSession, formatSessionStats, sessionInputRate } from "./claude/session-metrics.js";
|
|
49
50
|
import { listSessionIds, readSession, sessionDir } from "./claude/state.js";
|
|
50
51
|
import { costLabel, listNotes, noteName, notePlace, noteTargets, readingTokens, savedByNote, commitLines, PERSONAL_SAVED_LINE, PR_SPEEDUP, SECTIONS, tokensWorthSaying, sectionLead, shortDate, tokensLabel, writeNote, mentionedFiles } from "./notes/notes.js";
|
|
51
|
-
import { currentSessionCost } from "./notes/session-cost.js";
|
|
52
|
+
import { aboutTerms, currentSessionCost } from "./notes/session-cost.js";
|
|
52
53
|
import { beginPastRead, finishPastRead } from "./notes/cold-start.js";
|
|
53
54
|
import { beginReviewRead, finishReviewRead } from "./notes/pr-reviews.js";
|
|
54
55
|
import { currentBranch, noteAuthor, teammatesOn } from "./notes/git-facts.js";
|
|
@@ -165,7 +166,7 @@ function queryRoot(dir) {
|
|
|
165
166
|
return resolve(dir);
|
|
166
167
|
const { root, levels } = nearestGraftRoot(process.cwd(), program.opts().dir);
|
|
167
168
|
if (levels > 0)
|
|
168
|
-
console.error(`${tag()} no
|
|
169
|
+
console.error(`${tag()} no code map here — answering from ${contextDirFor(root, program.opts().dir)}`);
|
|
169
170
|
return root;
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
@@ -292,10 +293,10 @@ program
|
|
|
292
293
|
// Hidden: spawned detached by maybeRefreshBranches.
|
|
293
294
|
program
|
|
294
295
|
.command("_trail-branches", { hidden: true })
|
|
295
|
-
.description("internal: fetch, then note which files teammates'
|
|
296
|
+
.description("internal: fetch, then note which files teammates' open branches change and the learnings they carry")
|
|
296
297
|
.argument("[dir]", "target repo directory", ".")
|
|
297
298
|
.action((dir) => {
|
|
298
|
-
refreshBranches(resolve(dir));
|
|
299
|
+
refreshBranches(resolve(dir), { prs: true });
|
|
299
300
|
});
|
|
300
301
|
program
|
|
301
302
|
.command("_trail-claim", { hidden: true })
|
|
@@ -380,7 +381,7 @@ function moveHereToTrail(dir) {
|
|
|
380
381
|
}
|
|
381
382
|
grouped(program.command("build"), GROUP.setup)
|
|
382
383
|
.description(TRAIL
|
|
383
|
-
? "Rebuild the code map in
|
|
384
|
+
? "Rebuild the code map in .trail/cache/ ($0, no key). --check fails if it's stale; --deep adds LLM summaries."
|
|
384
385
|
: "Build graft/ from your code — wiring graph + per-file cards ($0, no key). " +
|
|
385
386
|
"Add --deep for the LLM concept map + per-symbol summaries/crux.")
|
|
386
387
|
.argument("[dir]", "repository root", ".")
|
|
@@ -610,11 +611,11 @@ function pointerFile(pointer) {
|
|
|
610
611
|
return pointer.replace(/:L\d+(-L?\d+)?$/, "");
|
|
611
612
|
}
|
|
612
613
|
/**
|
|
613
|
-
* After `ask`, under trail: which shown learnings are a teammate's,
|
|
614
|
-
* teammates' pushed branches change the files the answer points into, and the
|
|
614
|
+
* After `ask`, under trail: which shown learnings are a teammate's, and the
|
|
615
615
|
* shown learnings recorded as a use, which is what the team page counts as
|
|
616
616
|
* reuse. Then the background upkeep that keeps branches and the workspace
|
|
617
|
-
* current. Spawns no git itself.
|
|
617
|
+
* current. Spawns no git itself. Teammates' branches come up after an edit
|
|
618
|
+
* instead, once there's a function to compare (notes/edit-overlap.ts).
|
|
618
619
|
*/
|
|
619
620
|
function afterAsk(r, repo) {
|
|
620
621
|
if (!r.notesChecked)
|
|
@@ -623,12 +624,6 @@ function afterAsk(r, repo) {
|
|
|
623
624
|
maybeRefreshBranches(repo);
|
|
624
625
|
const me = noteAuthor(repo);
|
|
625
626
|
const files = [...new Set(r.hits.map((h) => pointerFile(h.pointer)))];
|
|
626
|
-
const overlaps = overlapsWith(repo, files, me).slice(0, 2);
|
|
627
|
-
if (overlaps.length) {
|
|
628
|
-
r.overlaps = overlaps.map((o) => formatOverlap(o));
|
|
629
|
-
if (!process.stdout.isTTY)
|
|
630
|
-
r.overlaps.push(`${tag()} Start your reply with the overlap line${overlaps.length === 1 ? "" : "s"} above, word for word, so the user knows.`);
|
|
631
|
-
}
|
|
632
627
|
const shown = r.notes ?? [];
|
|
633
628
|
if (shown.length) {
|
|
634
629
|
for (const h of shown)
|
|
@@ -750,7 +745,7 @@ async function runCheckCommand(dirArg, opts, label) {
|
|
|
750
745
|
console.log(JSON.stringify({ context: r, graph: g.missing ? null : g }, null, 2));
|
|
751
746
|
}
|
|
752
747
|
else if (bothMissing) {
|
|
753
|
-
console.log(`${label}: NO GRAPH\n\nNo
|
|
748
|
+
console.log(`${label}: NO GRAPH\n\nNo code map found. Run \`${cmd("graft build")}\` first.`);
|
|
754
749
|
}
|
|
755
750
|
else {
|
|
756
751
|
if (r.missing) {
|
|
@@ -1192,9 +1187,11 @@ async function runNoteCommand(repo, opts) {
|
|
|
1192
1187
|
};
|
|
1193
1188
|
const minutes = wholeNumber(opts.minutes, "--minutes");
|
|
1194
1189
|
const tokens = wholeNumber(opts.tokens, "--tokens");
|
|
1195
|
-
// What the session spent, from the agent's own transcript when there is one
|
|
1196
|
-
//
|
|
1197
|
-
|
|
1190
|
+
// What the session spent, from the agent's own transcript when there is one,
|
|
1191
|
+
// counted from where the work the note names first came up; the flags win,
|
|
1192
|
+
// since only the agent knows for sure where its task began.
|
|
1193
|
+
const named = [...(opts.touches?.split(",").map((t) => t.trim()).filter(Boolean) ?? []), ...mentionedFiles(repo, body)];
|
|
1194
|
+
const spent = currentSessionCost(repo, undefined, Date.now(), aboutTerms(body, named));
|
|
1198
1195
|
const cost = minutes !== undefined || tokens !== undefined || spent
|
|
1199
1196
|
? { minutes: minutes ?? spent?.minutes, tokens: tokens ?? spent?.tokens }
|
|
1200
1197
|
: undefined;
|
|
@@ -1202,10 +1199,10 @@ async function runNoteCommand(repo, opts) {
|
|
|
1202
1199
|
// session edited. Explicit --touches means just this repo.
|
|
1203
1200
|
const targets = opts.touches
|
|
1204
1201
|
? [{ dir: repo, touches: opts.touches.split(",").map((t) => t.trim()).filter(Boolean) }]
|
|
1205
|
-
: noteTargets(repo, spent?.edited ?? [], spent?.startedAt).map((t) => ({
|
|
1206
|
-
|
|
1207
|
-
//
|
|
1208
|
-
touches: [...new Set([...t.touches, ...mentionedFiles(t.dir, body)])].slice(0, 10),
|
|
1202
|
+
: noteTargets(repo, spent?.edited ?? [], spent?.startedAt, spent ? { read: spent.read } : undefined).map((t) => ({
|
|
1203
|
+
dir: t.dir,
|
|
1204
|
+
// Then the files the note names, then the ones the session only read.
|
|
1205
|
+
touches: [...new Set([...t.touches, ...mentionedFiles(t.dir, body), ...(t.read ?? [])])].slice(0, 10),
|
|
1209
1206
|
}));
|
|
1210
1207
|
const author = opts.author?.trim() || noteAuthor(repo);
|
|
1211
1208
|
const date = new Date().toISOString().slice(0, 10);
|
|
@@ -1281,6 +1278,14 @@ async function runInitCommand(dir, opts) {
|
|
|
1281
1278
|
}
|
|
1282
1279
|
const repo = resolve(dir);
|
|
1283
1280
|
const explicit = Array.isArray(opts.agents) ? opts.agents : undefined;
|
|
1281
|
+
// Checked before anything is written: run from the home folder, init wired
|
|
1282
|
+
// it, mapped every code file under it, then said to commit.
|
|
1283
|
+
const refusal = homeFolderRefusal(repo);
|
|
1284
|
+
if (refusal) {
|
|
1285
|
+
console.error(refusal);
|
|
1286
|
+
process.exitCode = 1;
|
|
1287
|
+
return null;
|
|
1288
|
+
}
|
|
1284
1289
|
if (explicit) {
|
|
1285
1290
|
const validIds = [...hostIds(), "claude"];
|
|
1286
1291
|
const unknown = explicit.filter((id) => !validIds.includes(id));
|
|
@@ -1354,6 +1359,20 @@ async function runInitCommand(dir, opts) {
|
|
|
1354
1359
|
}
|
|
1355
1360
|
const wantClaude = ids.includes("claude");
|
|
1356
1361
|
const cliPath = fileURLToPath(import.meta.url);
|
|
1362
|
+
// Under trail, each repo gets its `.trail/learnings/`, committed with the
|
|
1363
|
+
// code, and its folder in ~/.trail for personal learnings and corrections.
|
|
1364
|
+
// First, before the reads below send their first event: that makes the
|
|
1365
|
+
// repo one on trail, so the event's repo id lands in `.trail/cache/` and
|
|
1366
|
+
// not in a `graft/` that nothing ignores.
|
|
1367
|
+
const notesHome = new Map();
|
|
1368
|
+
if (TRAIL)
|
|
1369
|
+
for (const target of targets) {
|
|
1370
|
+
const { place } = ensureRepoHome(target);
|
|
1371
|
+
const created = place.git ? ensureRepoTrail(place.checkout) : false;
|
|
1372
|
+
notesHome.set(target, { created, dir: place.git ? place.checkout : place.dir });
|
|
1373
|
+
if (place.git)
|
|
1374
|
+
maybeRefreshBranches(place.checkout);
|
|
1375
|
+
}
|
|
1357
1376
|
// Under trail, with Claude Code picked: what the person kept telling Claude
|
|
1358
1377
|
// in this repo's past sessions, and what reviewers kept flagging on its
|
|
1359
1378
|
// merged PRs, read while the rest of init runs and saved as learnings at
|
|
@@ -1369,17 +1388,6 @@ async function runInitCommand(dir, opts) {
|
|
|
1369
1388
|
// Today's output, file by file, behind --verbose. Everything else gets one
|
|
1370
1389
|
// line per step: the graph, then one per agent.
|
|
1371
1390
|
const verbose = opts.verbose === true;
|
|
1372
|
-
// Under trail, each repo gets its `.trail/learnings/`, committed with the
|
|
1373
|
-
// code, and its folder in ~/.trail for personal learnings and corrections.
|
|
1374
|
-
const notesHome = new Map();
|
|
1375
|
-
if (TRAIL)
|
|
1376
|
-
for (const target of targets) {
|
|
1377
|
-
const { place } = ensureRepoHome(target);
|
|
1378
|
-
const created = place.git ? ensureRepoTrail(place.checkout) : false;
|
|
1379
|
-
notesHome.set(target, { created, dir: place.git ? place.checkout : place.dir });
|
|
1380
|
-
if (place.git)
|
|
1381
|
-
maybeRefreshBranches(place.checkout);
|
|
1382
|
-
}
|
|
1383
1391
|
const reports = [];
|
|
1384
1392
|
for (const target of targets) {
|
|
1385
1393
|
if (verbose && target !== repo)
|
|
@@ -1523,8 +1531,12 @@ async function runInitCommand(dir, opts) {
|
|
|
1523
1531
|
for (const w of selectedWrites(plan, ids)) {
|
|
1524
1532
|
if (w.scope !== "repo")
|
|
1525
1533
|
continue;
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1534
|
+
const rel = shown(repo, w.path);
|
|
1535
|
+
// trail's Claude Code setup shares one file in .claude/; the rest there is personal.
|
|
1536
|
+
if (TRAIL && rel.startsWith(".claude/") && rel !== ".claude/settings.json")
|
|
1537
|
+
continue;
|
|
1538
|
+
const parts = rel.split("/");
|
|
1539
|
+
const top = TRAIL && rel === ".claude/settings.json" ? rel : parts.length > 1 ? `${parts[0]}/` : parts[0];
|
|
1528
1540
|
if (!tops.includes(top))
|
|
1529
1541
|
tops.push(top);
|
|
1530
1542
|
}
|
|
@@ -1537,9 +1549,14 @@ async function runInitCommand(dir, opts) {
|
|
|
1537
1549
|
return r.status !== 0 || r.stdout.trim().length > 0;
|
|
1538
1550
|
});
|
|
1539
1551
|
tops.splice(0, tops.length, ...changedTops);
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1552
|
+
// Outside git there is nothing to commit to, and `git status` failing above
|
|
1553
|
+
// made every path look changed.
|
|
1554
|
+
if (TRAIL && !children.length && !isGitWorkTree(repo))
|
|
1555
|
+
console.error(NOT_GIT_LINE);
|
|
1556
|
+
else if (tops.length)
|
|
1557
|
+
console.error(TRAIL
|
|
1558
|
+
? `· commit ${tops.slice(0, 5).join(" and ")}${tops.length > 5 ? ` +${tops.length - 5} more` : ""} once — after that, teammates' Claude reads your learnings even before they install trail`
|
|
1559
|
+
: `· commit ${tops.slice(0, 5).join(" ")}${tops.length > 5 ? ` +${tops.length - 5} more` : ""} to share it — graft/ stays local and git-ignored`);
|
|
1543
1560
|
}
|
|
1544
1561
|
// One epilogue for the whole run. A workspace parent holds no nodes of its
|
|
1545
1562
|
// own, so the totals come from the children — the graph the user actually got.
|
|
@@ -1590,8 +1607,12 @@ function wireTarget(repo, ids, ctx) {
|
|
|
1590
1607
|
say(`✓ wrote ${res.settingsPath}`);
|
|
1591
1608
|
for (const s of res.shims)
|
|
1592
1609
|
say(`✓ wrote ${s}`);
|
|
1593
|
-
|
|
1594
|
-
|
|
1610
|
+
if (res.skill)
|
|
1611
|
+
say(`✓ wrote ${res.skill}`);
|
|
1612
|
+
if (!res.mcp) {
|
|
1613
|
+
// trail registers no server for Claude Code: the hooks and the `trail` command cover it.
|
|
1614
|
+
}
|
|
1615
|
+
else if (res.mcp.action === "skipped-unparseable")
|
|
1595
1616
|
say(`⚠ .mcp.json: ${res.mcp.path} left unchanged (not valid JSON) — add the graft server manually`);
|
|
1596
1617
|
else if (res.mcp.action === "unchanged")
|
|
1597
1618
|
say(`· mcp claude: ${res.mcp.path} (already registered)`);
|