gsd-pi 2.78.1-dev.84a383f51 → 2.78.1-dev.8a893322c
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 +1 -0
- package/dist/bundled-resource-path.d.ts +7 -0
- package/dist/bundled-resource-path.js +34 -2
- package/dist/claude-cli-check.js +18 -6
- package/dist/headless-query.js +21 -6
- package/dist/loader.js +2 -3
- package/dist/resource-loader.js +2 -8
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +19 -7
- package/dist/resources/extensions/google-search/index.js +2 -6
- package/dist/resources/extensions/gsd/auto/phases.js +3 -11
- package/dist/resources/extensions/gsd/auto/session.js +2 -6
- package/dist/resources/extensions/gsd/auto-dashboard.js +3 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +18 -6
- package/dist/resources/extensions/gsd/auto-prompts.js +63 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +30 -13
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +19 -1
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +22 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +11 -0
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +84 -2
- package/dist/resources/extensions/gsd/commands/catalog.js +8 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +8 -0
- package/dist/resources/extensions/gsd/commands-config.js +3 -2
- package/dist/resources/extensions/gsd/commands-extensions.js +46 -3
- package/dist/resources/extensions/gsd/commands-handlers.js +3 -2
- package/dist/resources/extensions/gsd/commands-worktree.js +309 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +6 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +2 -1
- package/dist/resources/extensions/gsd/forensics.js +8 -6
- package/dist/resources/extensions/gsd/guided-flow.js +2 -1
- package/dist/resources/extensions/gsd/home-dir.js +16 -0
- package/dist/resources/extensions/gsd/key-manager.js +2 -1
- package/dist/resources/extensions/gsd/migrate/command.js +3 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +10 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +10 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +10 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +10 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +29 -4
- package/dist/resources/extensions/gsd/worktree-manager.js +20 -1
- package/dist/resources/extensions/gsd/worktree-resolver.js +4 -13
- package/dist/resources/extensions/gsd/worktree-root.js +124 -0
- package/dist/resources/extensions/gsd/worktree.js +4 -115
- package/dist/resources/extensions/mcp-client/index.js +0 -6
- package/dist/resources/extensions/ollama/index.js +15 -2
- package/dist/resources/extensions/ollama/model-capabilities.js +31 -0
- package/dist/resources/extensions/ollama/ollama-client.js +40 -4
- package/dist/resources/extensions/subagent/index.js +324 -178
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +17 -17
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +17 -17
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/welcome-screen.js +27 -1
- package/dist/worktree-cli.d.ts +1 -0
- package/dist/worktree-cli.js +9 -3
- package/package.json +1 -3
- package/packages/mcp-server/src/workflow-tools.test.ts +52 -0
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +20 -7
- package/src/resources/extensions/google-search/index.ts +2 -9
- package/src/resources/extensions/gsd/auto/phases.ts +3 -11
- package/src/resources/extensions/gsd/auto/session.ts +2 -6
- package/src/resources/extensions/gsd/auto-dashboard.ts +3 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +18 -6
- package/src/resources/extensions/gsd/auto-prompts.ts +60 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +44 -12
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +19 -0
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +20 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +11 -0
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +103 -1
- package/src/resources/extensions/gsd/commands/catalog.ts +8 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +10 -0
- package/src/resources/extensions/gsd/commands-config.ts +3 -2
- package/src/resources/extensions/gsd/commands-extensions.ts +43 -3
- package/src/resources/extensions/gsd/commands-handlers.ts +3 -2
- package/src/resources/extensions/gsd/commands-worktree.ts +383 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +6 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +2 -1
- package/src/resources/extensions/gsd/forensics.ts +10 -5
- package/src/resources/extensions/gsd/guided-flow.ts +2 -1
- package/src/resources/extensions/gsd/home-dir.ts +19 -0
- package/src/resources/extensions/gsd/journal.ts +4 -1
- package/src/resources/extensions/gsd/key-manager.ts +2 -1
- package/src/resources/extensions/gsd/migrate/command.ts +3 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +10 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +10 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +10 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +10 -0
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/bundled-skill-triggers.test.ts +50 -27
- package/src/resources/extensions/gsd/tests/commands-extensions-version-compare.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/commands-worktree-clean.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/google-search-stub.test.ts +25 -65
- package/src/resources/extensions/gsd/tests/home-dir.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +50 -1
- package/src/resources/extensions/gsd/tests/milestone-report-path.test.ts +18 -1
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/steer-worktree-path.test.ts +17 -1
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +38 -3
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +34 -33
- package/src/resources/extensions/gsd/tests/worktree.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +116 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +36 -4
- package/src/resources/extensions/gsd/worktree-manager.ts +40 -1
- package/src/resources/extensions/gsd/worktree-resolver.ts +4 -14
- package/src/resources/extensions/gsd/worktree-root.ts +144 -0
- package/src/resources/extensions/gsd/worktree.ts +8 -119
- package/src/resources/extensions/mcp-client/index.ts +0 -7
- package/src/resources/extensions/ollama/index.ts +16 -2
- package/src/resources/extensions/ollama/model-capabilities.ts +34 -0
- package/src/resources/extensions/ollama/ollama-client.ts +41 -4
- package/src/resources/extensions/ollama/tests/model-capabilities.test.ts +96 -0
- package/src/resources/extensions/ollama/tests/ollama-client-timeout-env.test.ts +147 -0
- package/src/resources/extensions/subagent/index.ts +165 -7
- /package/dist/web/standalone/.next/static/{UF5VF4F1tB0miEtJS7LyX → QK8fABiGPmonfTgboN0Y9}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{UF5VF4F1tB0miEtJS7LyX → QK8fABiGPmonfTgboN0Y9}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// GSD-2 — In-TUI handler for /gsd worktree commands (list, merge, clean, remove).
|
|
2
|
+
//
|
|
3
|
+
// Mirrors the CLI subcommands in src/worktree-cli.ts but emits results via
|
|
4
|
+
// ctx.ui.notify() instead of writing colored output to stderr. Reuses the
|
|
5
|
+
// same extension modules (worktree-manager, native-git-bridge, etc.) so the
|
|
6
|
+
// behavior is identical to the CLI surface.
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { projectRoot } from "./commands/context.js";
|
|
9
|
+
import { listWorktrees, removeWorktree, mergeWorktreeToMain, diffWorktreeAll, diffWorktreeNumstat, worktreeBranchName, } from "./worktree-manager.js";
|
|
10
|
+
import { nativeHasChanges, nativeDetectMainBranch, nativeCommitCountBetween, } from "./native-git-bridge.js";
|
|
11
|
+
import { inferCommitType } from "./git-service.js";
|
|
12
|
+
import { autoCommitCurrentBranch } from "./worktree.js";
|
|
13
|
+
import { GSDError, GSD_GIT_ERROR } from "./errors.js";
|
|
14
|
+
// ─── Status helper ─────────────────────────────────────────────────────────
|
|
15
|
+
function getStatus(basePath, name, wtPath) {
|
|
16
|
+
const diff = diffWorktreeAll(basePath, name);
|
|
17
|
+
const numstat = diffWorktreeNumstat(basePath, name);
|
|
18
|
+
const filesChanged = diff.added.length + diff.modified.length + diff.removed.length;
|
|
19
|
+
let linesAdded = 0;
|
|
20
|
+
let linesRemoved = 0;
|
|
21
|
+
for (const s of numstat) {
|
|
22
|
+
linesAdded += s.added;
|
|
23
|
+
linesRemoved += s.removed;
|
|
24
|
+
}
|
|
25
|
+
let uncommitted = false;
|
|
26
|
+
try {
|
|
27
|
+
uncommitted = existsSync(wtPath) && nativeHasChanges(wtPath);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// native check failure → treat as clean for display purposes
|
|
31
|
+
}
|
|
32
|
+
let commits = 0;
|
|
33
|
+
try {
|
|
34
|
+
const main = nativeDetectMainBranch(basePath);
|
|
35
|
+
commits = nativeCommitCountBetween(basePath, main, worktreeBranchName(name));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// commit count unavailable → leave at 0
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
name,
|
|
42
|
+
path: wtPath,
|
|
43
|
+
branch: worktreeBranchName(name),
|
|
44
|
+
exists: existsSync(wtPath),
|
|
45
|
+
filesChanged,
|
|
46
|
+
linesAdded,
|
|
47
|
+
linesRemoved,
|
|
48
|
+
uncommitted,
|
|
49
|
+
commits,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// ─── Formatters (exported for tests) ────────────────────────────────────────
|
|
53
|
+
export function formatWorktreeList(statuses) {
|
|
54
|
+
if (statuses.length === 0) {
|
|
55
|
+
return "No worktrees.\n\nCreate one from the CLI: gsd -w <name>";
|
|
56
|
+
}
|
|
57
|
+
const lines = [`Worktrees — ${statuses.length}`, ""];
|
|
58
|
+
for (const s of statuses) {
|
|
59
|
+
const badge = s.uncommitted
|
|
60
|
+
? "(uncommitted)"
|
|
61
|
+
: s.filesChanged > 0
|
|
62
|
+
? "(unmerged)"
|
|
63
|
+
: "(clean)";
|
|
64
|
+
lines.push(` ${s.name} ${badge}`);
|
|
65
|
+
lines.push(` branch ${s.branch}`);
|
|
66
|
+
lines.push(` path ${s.path}`);
|
|
67
|
+
if (s.filesChanged > 0) {
|
|
68
|
+
lines.push(` diff ${s.filesChanged} file${s.filesChanged === 1 ? "" : "s"}, +${s.linesAdded} -${s.linesRemoved}, ${s.commits} commit${s.commits === 1 ? "" : "s"}`);
|
|
69
|
+
}
|
|
70
|
+
lines.push("");
|
|
71
|
+
}
|
|
72
|
+
lines.push("Commands:");
|
|
73
|
+
lines.push(" /gsd worktree merge <name> Merge into main and clean up");
|
|
74
|
+
lines.push(" /gsd worktree remove <name> Remove a worktree (--force to skip safety checks)");
|
|
75
|
+
lines.push(" /gsd worktree clean Remove all merged/empty worktrees");
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
export function formatCleanKeepReason(status) {
|
|
79
|
+
if (!status.exists) {
|
|
80
|
+
return "directory missing — run 'git worktree prune' to unregister";
|
|
81
|
+
}
|
|
82
|
+
if (status.filesChanged > 0) {
|
|
83
|
+
return `${status.filesChanged} changed file${status.filesChanged === 1 ? "" : "s"}${status.uncommitted ? ", uncommitted" : ""}`;
|
|
84
|
+
}
|
|
85
|
+
return "uncommitted changes";
|
|
86
|
+
}
|
|
87
|
+
// ─── Subcommand: list ───────────────────────────────────────────────────────
|
|
88
|
+
async function handleList(ctx) {
|
|
89
|
+
const basePath = projectRoot();
|
|
90
|
+
const worktrees = listWorktrees(basePath);
|
|
91
|
+
const statuses = worktrees.map((wt) => getStatus(basePath, wt.name, wt.path));
|
|
92
|
+
ctx.ui.notify(formatWorktreeList(statuses), "info");
|
|
93
|
+
}
|
|
94
|
+
// ─── Subcommand: merge ──────────────────────────────────────────────────────
|
|
95
|
+
async function handleMerge(args, ctx) {
|
|
96
|
+
const basePath = projectRoot();
|
|
97
|
+
const worktrees = listWorktrees(basePath);
|
|
98
|
+
const trimmed = args.trim();
|
|
99
|
+
let target = trimmed;
|
|
100
|
+
if (!target) {
|
|
101
|
+
if (worktrees.length === 1) {
|
|
102
|
+
target = worktrees[0].name;
|
|
103
|
+
}
|
|
104
|
+
else if (worktrees.length === 0) {
|
|
105
|
+
ctx.ui.notify("No worktrees to merge.", "info");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const names = worktrees.map((w) => w.name).join(", ");
|
|
110
|
+
ctx.ui.notify(`Usage: /gsd worktree merge <name>\n\nWorktrees: ${names}`, "warning");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const wt = worktrees.find((w) => w.name === target);
|
|
115
|
+
if (!wt) {
|
|
116
|
+
const available = worktrees.map((w) => w.name).join(", ") || "(none)";
|
|
117
|
+
ctx.ui.notify(`Worktree "${target}" not found.\n\nAvailable: ${available}`, "error");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const status = getStatus(basePath, target, wt.path);
|
|
121
|
+
if (status.filesChanged === 0 && !status.uncommitted) {
|
|
122
|
+
try {
|
|
123
|
+
removeWorktree(basePath, target, { deleteBranch: true });
|
|
124
|
+
ctx.ui.notify(`Removed empty worktree ${target}.`, "info");
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
128
|
+
ctx.ui.notify(`Worktree partially removed: ${msg}\n\nRun 'git worktree prune' to clean up any dangling registrations.`, "error");
|
|
129
|
+
}
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (status.uncommitted) {
|
|
133
|
+
try {
|
|
134
|
+
autoCommitCurrentBranch(wt.path, "worktree-merge", target);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
138
|
+
ctx.ui.notify([
|
|
139
|
+
`Auto-commit before merge failed: ${msg}`,
|
|
140
|
+
"",
|
|
141
|
+
`Commit or stash changes in ${wt.path}, then re-run /gsd worktree merge ${target}.`,
|
|
142
|
+
].join("\n"), "error");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const commitType = inferCommitType(target);
|
|
147
|
+
const mainBranch = nativeDetectMainBranch(basePath);
|
|
148
|
+
const commitMessage = `${commitType}: merge worktree ${target}\n\nGSD-Worktree: ${target}`;
|
|
149
|
+
try {
|
|
150
|
+
mergeWorktreeToMain(basePath, target, commitMessage);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
154
|
+
if (err instanceof GSDError && err.code === GSD_GIT_ERROR) {
|
|
155
|
+
ctx.ui.notify(`Merge requires the main branch to be checked out: ${msg}\n\nSwitch to ${mainBranch} (e.g. 'git checkout ${mainBranch}'), then re-run /gsd worktree merge ${target}.`, "error");
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
ctx.ui.notify(`Merge failed: ${msg}\n\nResolve conflicts manually, then run /gsd worktree merge ${target} again.`, "error");
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const successLines = [
|
|
163
|
+
`Merged ${target} → ${mainBranch}`,
|
|
164
|
+
` ${status.filesChanged} file${status.filesChanged === 1 ? "" : "s"}, +${status.linesAdded} -${status.linesRemoved}`,
|
|
165
|
+
` commit: ${commitMessage.split("\n")[0]}`,
|
|
166
|
+
];
|
|
167
|
+
try {
|
|
168
|
+
removeWorktree(basePath, target, { deleteBranch: true });
|
|
169
|
+
ctx.ui.notify(successLines.join("\n"), "info");
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
173
|
+
const cleanupLines = [
|
|
174
|
+
...successLines,
|
|
175
|
+
"",
|
|
176
|
+
`Cleanup failed after the merge succeeded: ${msg}`,
|
|
177
|
+
err instanceof GSDError && err.code === GSD_GIT_ERROR
|
|
178
|
+
? `Switch to ${mainBranch} (e.g. 'git checkout ${mainBranch}'), then remove the worktree manually with /gsd worktree remove ${target} --force.`
|
|
179
|
+
: `Remove the worktree manually with /gsd worktree remove ${target} --force, or run 'git worktree prune' to clean up dangling registrations.`,
|
|
180
|
+
];
|
|
181
|
+
ctx.ui.notify(cleanupLines.join("\n"), "warning");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// ─── Subcommand: clean ──────────────────────────────────────────────────────
|
|
185
|
+
async function handleClean(ctx) {
|
|
186
|
+
const basePath = projectRoot();
|
|
187
|
+
const worktrees = listWorktrees(basePath);
|
|
188
|
+
if (worktrees.length === 0) {
|
|
189
|
+
ctx.ui.notify("No worktrees to clean.", "info");
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const removed = [];
|
|
193
|
+
const kept = [];
|
|
194
|
+
for (const wt of worktrees) {
|
|
195
|
+
const status = getStatus(basePath, wt.name, wt.path);
|
|
196
|
+
if (status.filesChanged === 0 && !status.uncommitted) {
|
|
197
|
+
try {
|
|
198
|
+
removeWorktree(basePath, wt.name, { deleteBranch: true });
|
|
199
|
+
removed.push(wt.name);
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
203
|
+
kept.push(`${wt.name} (failed: ${msg})`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const reason = formatCleanKeepReason(status);
|
|
208
|
+
kept.push(`${wt.name} (${reason})`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const lines = [`Cleaned ${removed.length} worktree${removed.length === 1 ? "" : "s"}.`];
|
|
212
|
+
if (removed.length > 0) {
|
|
213
|
+
lines.push("", "Removed:");
|
|
214
|
+
for (const n of removed)
|
|
215
|
+
lines.push(` ✓ ${n}`);
|
|
216
|
+
}
|
|
217
|
+
if (kept.length > 0) {
|
|
218
|
+
lines.push("", "Kept:");
|
|
219
|
+
for (const n of kept)
|
|
220
|
+
lines.push(` ─ ${n}`);
|
|
221
|
+
}
|
|
222
|
+
ctx.ui.notify(lines.join("\n"), "info");
|
|
223
|
+
}
|
|
224
|
+
// ─── Subcommand: remove ─────────────────────────────────────────────────────
|
|
225
|
+
async function handleRemove(args, ctx) {
|
|
226
|
+
const basePath = projectRoot();
|
|
227
|
+
const tokens = args.trim().split(/\s+/).filter(Boolean);
|
|
228
|
+
const force = tokens.includes("--force");
|
|
229
|
+
const name = tokens.find((t) => t !== "--force");
|
|
230
|
+
if (!name) {
|
|
231
|
+
ctx.ui.notify("Usage: /gsd worktree remove <name> [--force]", "warning");
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const worktrees = listWorktrees(basePath);
|
|
235
|
+
const wt = worktrees.find((w) => w.name === name);
|
|
236
|
+
if (!wt) {
|
|
237
|
+
const available = worktrees.map((w) => w.name).join(", ") || "(none)";
|
|
238
|
+
ctx.ui.notify(`Worktree "${name}" not found.\n\nAvailable: ${available}`, "error");
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const status = getStatus(basePath, name, wt.path);
|
|
242
|
+
if ((status.filesChanged > 0 || status.uncommitted) && !force) {
|
|
243
|
+
ctx.ui.notify([
|
|
244
|
+
`Worktree "${name}" has pending changes (${formatCleanKeepReason(status)}).`,
|
|
245
|
+
"",
|
|
246
|
+
` Merge first: /gsd worktree merge ${name}`,
|
|
247
|
+
` Or force-remove: /gsd worktree remove ${name} --force`,
|
|
248
|
+
].join("\n"), "warning");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
removeWorktree(basePath, name, { deleteBranch: true });
|
|
253
|
+
ctx.ui.notify(`Removed worktree ${name}.`, "info");
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
257
|
+
ctx.ui.notify(`Worktree partially removed: ${msg}\n\nRun 'git worktree prune' to clean up any dangling registrations.`, "error");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// ─── Help text ──────────────────────────────────────────────────────────────
|
|
261
|
+
const HELP_TEXT = [
|
|
262
|
+
"Usage: /gsd worktree <command> [args]",
|
|
263
|
+
"",
|
|
264
|
+
"Commands:",
|
|
265
|
+
" list Show all worktrees with status",
|
|
266
|
+
" merge [name] Merge a worktree into main, then remove it",
|
|
267
|
+
" remove <name> [--force] Remove a worktree (refuses unmerged changes without --force)",
|
|
268
|
+
" clean Remove all merged/empty worktrees",
|
|
269
|
+
"",
|
|
270
|
+
"The -w flag (CLI only) creates/resumes worktrees on session start:",
|
|
271
|
+
" gsd -w Auto-name a new worktree, or resume the only active one",
|
|
272
|
+
" gsd -w my-feature Create or resume a named worktree",
|
|
273
|
+
].join("\n");
|
|
274
|
+
// ─── Dispatcher ─────────────────────────────────────────────────────────────
|
|
275
|
+
export async function handleWorktree(args, ctx) {
|
|
276
|
+
const trimmed = args.trim();
|
|
277
|
+
const lowered = trimmed.toLowerCase();
|
|
278
|
+
if (!lowered || lowered === "help" || lowered === "--help" || lowered === "-h") {
|
|
279
|
+
ctx.ui.notify(HELP_TEXT, "info");
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
try {
|
|
283
|
+
if (lowered === "list" || lowered === "ls") {
|
|
284
|
+
await handleList(ctx);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (lowered === "merge" || lowered.startsWith("merge ")) {
|
|
288
|
+
await handleMerge(trimmed.replace(/^merge\s*/i, ""), ctx);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (lowered === "clean") {
|
|
292
|
+
await handleClean(ctx);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (lowered === "remove" ||
|
|
296
|
+
lowered.startsWith("remove ") ||
|
|
297
|
+
lowered === "rm" ||
|
|
298
|
+
lowered.startsWith("rm ")) {
|
|
299
|
+
const stripped = trimmed.replace(/^(remove|rm)\s*/i, "");
|
|
300
|
+
await handleRemove(stripped, ctx);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
ctx.ui.notify(`Unknown worktree command: ${trimmed}\n\n${HELP_TEXT}`, "warning");
|
|
304
|
+
}
|
|
305
|
+
catch (err) {
|
|
306
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
307
|
+
ctx.ui.notify(`Worktree command failed: ${msg}`, "error");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
@@ -165,6 +165,12 @@ Setting `prefer_skills: []` does **not** disable skill discovery — it just mea
|
|
|
165
165
|
- `skip_reassess`: boolean — force-disable roadmap reassessment even if `reassess_after_slice` is enabled. Default: `false`.
|
|
166
166
|
- `skip_slice_research`: boolean — skip per-slice research. Default: `false`.
|
|
167
167
|
|
|
168
|
+
- `reactive_execution`: controls automatic parallel task dispatch inside a slice. Reactive execution is enabled by default when omitted; set `enabled: false` to opt out. With default-on behavior, GSD only attempts a reactive batch when at least three ready tasks are available and the task-plan IO graph is non-ambiguous. If you set `enabled: true` explicitly, GSD uses the earlier opt-in threshold of two ready tasks. Keys:
|
|
169
|
+
- `enabled`: boolean — set `false` to force sequential task execution. Default: `true`.
|
|
170
|
+
- `max_parallel`: number — maximum tasks to dispatch in one batch, range `1`-`8`. Default: `2`.
|
|
171
|
+
- `isolation_mode`: `"same-tree"` — currently the only supported value.
|
|
172
|
+
- `subagent_model`: string — optional model override for reactive task subagents. Falls back to the `models.subagent` routing when omitted.
|
|
173
|
+
|
|
168
174
|
- `remote_questions`: route interactive questions to Slack/Discord for headless auto-mode. Keys:
|
|
169
175
|
- `channel`: `"slack"` or `"discord"` — channel type.
|
|
170
176
|
- `channel_id`: string or number — channel ID.
|
|
@@ -16,6 +16,7 @@ import { AuthStorage } from "@gsd/pi-coding-agent";
|
|
|
16
16
|
import { getEnvApiKey } from "@gsd/pi-ai";
|
|
17
17
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
18
18
|
import { getAuthPath, PROVIDER_REGISTRY } from "./key-manager.js";
|
|
19
|
+
import { getHomeDir } from "./home-dir.js";
|
|
19
20
|
// ── Provider routing constants ────────────────────────────────────────────────
|
|
20
21
|
/**
|
|
21
22
|
* Providers that use external CLI authentication (not API keys).
|
|
@@ -158,7 +159,7 @@ function isCliBinaryInPath(providerId) {
|
|
|
158
159
|
return pathDirs.some(dir => executableNames.some(name => existsSync(join(dir, name))));
|
|
159
160
|
}
|
|
160
161
|
function modelsJsonPaths() {
|
|
161
|
-
const home =
|
|
162
|
+
const home = getHomeDir();
|
|
162
163
|
return [
|
|
163
164
|
join(home, ".gsd", "agent", "models.json"),
|
|
164
165
|
// Keep parity with custom-provider discovery during auto bootstrap.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { join, dirname, relative } from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
|
-
import {
|
|
13
|
+
import { getHomeDir } from "./home-dir.js";
|
|
14
14
|
import { extractTrace } from "./session-forensics.js";
|
|
15
15
|
import { nativeParseJsonlTail } from "./native-parser-bridge.js";
|
|
16
16
|
import { MAX_JSONL_BYTES, parseJSONL } from "./jsonl-utils.js";
|
|
@@ -135,7 +135,7 @@ export async function handleForensics(args, ctx, pi) {
|
|
|
135
135
|
// when import.meta.url resolves to the npm-global install path (Windows).
|
|
136
136
|
let gsdSourceDir = dirname(fileURLToPath(import.meta.url));
|
|
137
137
|
if (!existsSync(join(gsdSourceDir, "prompts"))) {
|
|
138
|
-
const gsdHome = process.env.GSD_HOME || join(
|
|
138
|
+
const gsdHome = process.env.GSD_HOME || join(getHomeDir(), ".gsd");
|
|
139
139
|
const fallback = join(gsdHome, "agent", "extensions", "gsd");
|
|
140
140
|
if (existsSync(join(fallback, "prompts")))
|
|
141
141
|
gsdSourceDir = fallback;
|
|
@@ -1109,11 +1109,13 @@ function formatReportForPrompt(report) {
|
|
|
1109
1109
|
// ─── Redaction ────────────────────────────────────────────────────────────────
|
|
1110
1110
|
function redactForGitHub(text, basePath) {
|
|
1111
1111
|
let result = text;
|
|
1112
|
+
// Build regex that matches both / and \ separator variants (Windows)
|
|
1113
|
+
// Normalize to / first, escape for regex, then replace each / with [/\\]
|
|
1114
|
+
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1115
|
+
const pathRe = (p) => new RegExp(esc(p.replace(/\\/g, "/")).replace(/\//g, "[/\\\\]"), "gi");
|
|
1112
1116
|
// Replace absolute paths
|
|
1113
|
-
result = result.
|
|
1114
|
-
|
|
1115
|
-
if (home)
|
|
1116
|
-
result = result.replaceAll(home, "~");
|
|
1117
|
+
result = result.replace(pathRe(basePath), ".");
|
|
1118
|
+
result = result.replace(pathRe(getHomeDir()), "~");
|
|
1117
1119
|
// Strip API key patterns
|
|
1118
1120
|
result = result.replace(/sk-[a-zA-Z0-9]{20,}/g, "sk-***");
|
|
1119
1121
|
result = result.replace(/Bearer\s+\S+/g, "Bearer ***");
|
|
@@ -18,6 +18,7 @@ import { clearLock } from "./crash-recovery.js";
|
|
|
18
18
|
import { assessInterruptedSession, formatInterruptedSessionRunningMessage, formatInterruptedSessionSummary, } from "./interrupted-session.js";
|
|
19
19
|
import { listUnitRuntimeRecords, clearUnitRuntimeRecord } from "./unit-runtime.js";
|
|
20
20
|
import { resolveExpectedArtifactPath } from "./auto.js";
|
|
21
|
+
import { getHomeDir } from "./home-dir.js";
|
|
21
22
|
import { gsdRoot, milestonesDir, resolveMilestoneFile, resolveSliceFile, resolveSlicePath, resolveGsdRootFile, relGsdRootFile, relMilestoneFile, relSliceFile, } from "./paths.js";
|
|
22
23
|
import { join } from "node:path";
|
|
23
24
|
import { readFileSync, existsSync, mkdirSync, readdirSync, unlinkSync } from "node:fs";
|
|
@@ -495,7 +496,7 @@ async function dispatchWorkflow(pi, note, customType = "gsd-run", ctx, unitType)
|
|
|
495
496
|
removed: currentTools.length - scopedTools.length,
|
|
496
497
|
});
|
|
497
498
|
}
|
|
498
|
-
const workflowPath = process.env.GSD_WORKFLOW_PATH ?? join(
|
|
499
|
+
const workflowPath = process.env.GSD_WORKFLOW_PATH ?? join(getHomeDir(), ".gsd", "agent", "GSD-WORKFLOW.md");
|
|
499
500
|
const workflow = readFileSync(workflowPath, "utf-8");
|
|
500
501
|
pi.sendMessage({
|
|
501
502
|
customType,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform home directory resolution.
|
|
3
|
+
*
|
|
4
|
+
* `process.env.HOME` is not set on Windows (CMD/PowerShell).
|
|
5
|
+
* Falls back to USERPROFILE, then os.homedir(), then throws.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/gsd-build/gsd-2/issues/5015
|
|
8
|
+
*/
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
export function getHomeDir() {
|
|
11
|
+
const home = process.env.HOME || process.env.USERPROFILE || homedir();
|
|
12
|
+
if (!home) {
|
|
13
|
+
throw new Error("Cannot resolve home directory. Set HOME or USERPROFILE environment variable.");
|
|
14
|
+
}
|
|
15
|
+
return home;
|
|
16
|
+
}
|
|
@@ -9,6 +9,7 @@ import { existsSync, statSync, chmodSync } from "node:fs";
|
|
|
9
9
|
import { join, dirname } from "node:path";
|
|
10
10
|
import { mkdirSync } from "node:fs";
|
|
11
11
|
import { getErrorMessage } from "./error-utils.js";
|
|
12
|
+
import { getHomeDir } from "./home-dir.js";
|
|
12
13
|
export const PROVIDER_REGISTRY = [
|
|
13
14
|
// LLM Providers
|
|
14
15
|
{ id: "anthropic", label: "Anthropic (Claude)", category: "llm", envVar: "ANTHROPIC_API_KEY", prefixes: ["sk-ant-"], hasOAuth: true, dashboardUrl: "console.anthropic.com" },
|
|
@@ -98,7 +99,7 @@ export function describeCredential(cred) {
|
|
|
98
99
|
* Get the auth.json path.
|
|
99
100
|
*/
|
|
100
101
|
export function getAuthPath() {
|
|
101
|
-
return join(
|
|
102
|
+
return join(getHomeDir(), ".gsd", "agent", "auth.json");
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
104
105
|
* Create an AuthStorage instance for key management.
|
|
@@ -13,6 +13,7 @@ import { resolve, join, dirname } from "node:path";
|
|
|
13
13
|
import { gsdRoot } from "../paths.js";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
import { showNextAction } from "../../shared/tui.js";
|
|
16
|
+
import { getHomeDir } from "../home-dir.js";
|
|
16
17
|
import { validatePlanningDirectory, parsePlanningDirectory, transformToGSD, generatePreview, writeGSDDirectory, } from "./index.js";
|
|
17
18
|
/** Format preview stats for embedding in the review prompt. */
|
|
18
19
|
function formatPreviewStats(preview) {
|
|
@@ -50,10 +51,10 @@ export async function handleMigrate(args, ctx, pi) {
|
|
|
50
51
|
// Default to cwd when no args given; expand ~ to HOME
|
|
51
52
|
let rawPath = args.trim() || ".";
|
|
52
53
|
if (rawPath.startsWith("~/")) {
|
|
53
|
-
rawPath = join(
|
|
54
|
+
rawPath = join(getHomeDir(), rawPath.slice(2));
|
|
54
55
|
}
|
|
55
56
|
else if (rawPath === "~") {
|
|
56
|
-
rawPath =
|
|
57
|
+
rawPath = getHomeDir();
|
|
57
58
|
}
|
|
58
59
|
let sourcePath = resolve(process.cwd(), rawPath);
|
|
59
60
|
if (!sourcePath.endsWith(".planning")) {
|
|
@@ -16,6 +16,16 @@ Start with what the excerpts give you. Read full files when the section heads si
|
|
|
16
16
|
|
|
17
17
|
**On-demand Read ordering:** Complete all slice SUMMARY Reads you need for cross-slice synthesis, the Decision Re-evaluation table, and LEARNINGS **before** calling `gsd_complete_milestone` (step 10). Once that tool runs, the milestone is marked complete in the DB — running out of tool budget between step 10 and the LEARNINGS write (step 12) leaves the milestone committed without its LEARNINGS artifact.
|
|
18
18
|
|
|
19
|
+
### Delegate Review Work
|
|
20
|
+
|
|
21
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate review work that benefits from a fresh context window. For non-trivial milestones, delegate before drafting LEARNINGS:
|
|
22
|
+
|
|
23
|
+
- **Cross-slice integrations or new public APIs** → dispatch the **reviewer** agent with the milestone diff and roadmap; treat its findings as input to your Decision Re-evaluation and LEARNINGS sections.
|
|
24
|
+
- **Touched auth, network, parsing, file IO, shell exec, or crypto** → dispatch the **security** agent for an OWASP-style audit across the merged slices.
|
|
25
|
+
- **Significant test surface added or changed** → dispatch the **tester** agent to assess coverage gaps relative to the milestone success criteria.
|
|
26
|
+
|
|
27
|
+
Subagents read the diff and report findings — they do **not** write user source. Apply their feedback into the milestone summary and any captured decisions before calling `gsd_complete_milestone`.
|
|
28
|
+
|
|
19
29
|
{{inlinedContext}}
|
|
20
30
|
|
|
21
31
|
Then:
|
|
@@ -20,6 +20,16 @@ All relevant context has been preloaded below — the slice plan, all task summa
|
|
|
20
20
|
|
|
21
21
|
**Match effort to complexity.** A simple slice with 1-2 tasks needs a brief summary and lightweight verification. A complex slice with 5 tasks across multiple subsystems needs thorough verification and a detailed summary. Scale the work below accordingly.
|
|
22
22
|
|
|
23
|
+
### Delegate Review Work
|
|
24
|
+
|
|
25
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate review work that benefits from a fresh context window. Strongly consider delegating when the slice is non-trivial:
|
|
26
|
+
|
|
27
|
+
- **Cross-cutting code or new abstractions** → dispatch the **reviewer** agent with the slice diff and plan; apply High/Critical findings before completing.
|
|
28
|
+
- **Touched auth, network, parsing, file IO, shell exec, or crypto** → dispatch the **security** agent for an OWASP-style audit.
|
|
29
|
+
- **Added or modified tests** → dispatch the **tester** agent to assess coverage gaps relative to the slice plan.
|
|
30
|
+
|
|
31
|
+
Subagents read the diff and report findings — they do **not** write user source. You remain responsible for acting on their feedback before calling `gsd_complete_slice` with `milestoneId` and `sliceId`.
|
|
32
|
+
|
|
23
33
|
Then:
|
|
24
34
|
1. Use the **Slice Summary** and **UAT** output templates from the inlined context above
|
|
25
35
|
2. {{skillActivation}}
|
|
@@ -20,6 +20,16 @@ Pay particular attention to **Forward Intelligence** sections — they contain h
|
|
|
20
20
|
|
|
21
21
|
You have full tool access. Before decomposing, explore the relevant code to ground your plan in reality.
|
|
22
22
|
|
|
23
|
+
### Delegate Recon and Sub-Decomposition When Useful
|
|
24
|
+
|
|
25
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate work that benefits from an isolated context window. Prefer delegation over inline work when:
|
|
26
|
+
|
|
27
|
+
- You'd otherwise read more than ~3 files to understand a subsystem → dispatch the **scout** agent for codebase recon and work from its compressed report.
|
|
28
|
+
- The slice spans multiple subsystems and the decomposition isn't obvious → dispatch the **planner** agent or use the **decompose-into-slices** skill on a focused sub-area, then integrate.
|
|
29
|
+
- You need current external information (library docs, API behavior, recent changes) → dispatch the **researcher** agent.
|
|
30
|
+
|
|
31
|
+
**Do not** dispatch implementation-tier agents (`worker`, `refactorer`, `tester`) from this unit — they would write user source and bypass this unit's write isolation. Implementation belongs in `execute-task`.
|
|
32
|
+
|
|
23
33
|
### Verify Roadmap Assumptions (JIT Reassessment — ADR-003 §4)
|
|
24
34
|
|
|
25
35
|
Before planning this slice, verify that the roadmap's assumptions still hold given prior slice summaries. Check inlined dependency summaries (below) for discovered constraints, changed approaches, or flagged fragility.
|
|
@@ -20,6 +20,16 @@ Pay particular attention to **Forward Intelligence** sections — they contain h
|
|
|
20
20
|
|
|
21
21
|
## Your Role in the Pipeline
|
|
22
22
|
|
|
23
|
+
### Delegate Recon When Useful
|
|
24
|
+
|
|
25
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate recon and sub-decomposition. Prefer delegation over inline work when:
|
|
26
|
+
|
|
27
|
+
- You'd otherwise read more than ~3 files to understand a subsystem touched by the sketch → dispatch the **scout** agent and work from its compressed report.
|
|
28
|
+
- A specific area of the refinement needs deeper architectural analysis → dispatch the **planner** agent for a focused sub-plan, then integrate.
|
|
29
|
+
- You need current external information (library docs, API behavior) → dispatch the **researcher** agent.
|
|
30
|
+
|
|
31
|
+
**Do not** dispatch implementation-tier agents (`worker`, `refactorer`, `tester`) — they would write user source and bypass write isolation. Implementation belongs in `execute-task`.
|
|
32
|
+
|
|
23
33
|
### Respect the Sketch Scope
|
|
24
34
|
|
|
25
35
|
The sketch scope inlined above is a **hard constraint**. Plan within it. If, after exploring the codebase, the scope is too narrow to deliver the goal, surface this as a deviation in the plan's narrative and still produce the plan — do not silently expand the scope.
|
|
@@ -73,6 +73,18 @@ const COMMON_BUDGET_SMALL = 250_000; // ~65K tokens
|
|
|
73
73
|
// allowed-path set for the docs policy lives in one reviewable place.
|
|
74
74
|
const TOOLS_ALL = { mode: "all" };
|
|
75
75
|
const TOOLS_PLANNING = { mode: "planning" };
|
|
76
|
+
// Like TOOLS_PLANNING but permits dispatch to read-only recon/planning
|
|
77
|
+
// specialists. Runtime-enforced by write-gate.ts before the subagent tool runs.
|
|
78
|
+
const TOOLS_PLANNING_DISPATCH_RECON = {
|
|
79
|
+
mode: "planning-dispatch",
|
|
80
|
+
allowedSubagents: ["scout", "planner"],
|
|
81
|
+
};
|
|
82
|
+
// Like TOOLS_PLANNING_DISPATCH_RECON, but for closeout units that fan out
|
|
83
|
+
// verification work to review-tier specialists.
|
|
84
|
+
const TOOLS_PLANNING_DISPATCH_REVIEW = {
|
|
85
|
+
mode: "planning-dispatch",
|
|
86
|
+
allowedSubagents: ["reviewer", "security", "tester"],
|
|
87
|
+
};
|
|
76
88
|
const TOOLS_DOCS = {
|
|
77
89
|
mode: "docs",
|
|
78
90
|
// Globs are resolved relative to project basePath. The set is intentionally
|
|
@@ -177,7 +189,11 @@ export const UNIT_MANIFESTS = {
|
|
|
177
189
|
memory: "prompt-relevant",
|
|
178
190
|
codebaseMap: false,
|
|
179
191
|
preferences: "active-only",
|
|
180
|
-
|
|
192
|
+
// planning-dispatch: completion is a high-leverage place to fan out to
|
|
193
|
+
// reviewer / security / tester subagents. They read the diff and report
|
|
194
|
+
// findings; they do not write user source. Write isolation to .gsd/ is
|
|
195
|
+
// preserved.
|
|
196
|
+
tools: TOOLS_PLANNING_DISPATCH_REVIEW,
|
|
181
197
|
artifacts: {
|
|
182
198
|
// #4780 landed slice-summary as excerpt for this unit; phase 2 of
|
|
183
199
|
// the architecture will read this manifest as the source of truth
|
|
@@ -209,7 +225,10 @@ export const UNIT_MANIFESTS = {
|
|
|
209
225
|
memory: "prompt-relevant",
|
|
210
226
|
codebaseMap: true,
|
|
211
227
|
preferences: "active-only",
|
|
212
|
-
|
|
228
|
+
// planning-dispatch: allows subagent dispatch so the planner can fan out
|
|
229
|
+
// to scout for codebase recon and to planner/decompose-style specialists
|
|
230
|
+
// for sub-decomposition. Write-isolation to .gsd/ is preserved.
|
|
231
|
+
tools: TOOLS_PLANNING_DISPATCH_RECON,
|
|
213
232
|
artifacts: {
|
|
214
233
|
inline: ["roadmap", "slice-research", "dependency-summaries", "requirements", "decisions", "templates"],
|
|
215
234
|
excerpt: [],
|
|
@@ -223,7 +242,10 @@ export const UNIT_MANIFESTS = {
|
|
|
223
242
|
memory: "prompt-relevant",
|
|
224
243
|
codebaseMap: true,
|
|
225
244
|
preferences: "active-only",
|
|
226
|
-
|
|
245
|
+
// See plan-slice — same rationale: dispatch to scout/planner-style
|
|
246
|
+
// specialists during refinement is materially better than re-doing recon
|
|
247
|
+
// inline.
|
|
248
|
+
tools: TOOLS_PLANNING_DISPATCH_RECON,
|
|
227
249
|
artifacts: {
|
|
228
250
|
inline: ["slice-plan", "slice-research", "dependency-summaries", "templates"],
|
|
229
251
|
excerpt: [],
|
|
@@ -251,7 +273,10 @@ export const UNIT_MANIFESTS = {
|
|
|
251
273
|
memory: "prompt-relevant",
|
|
252
274
|
codebaseMap: false,
|
|
253
275
|
preferences: "active-only",
|
|
254
|
-
|
|
276
|
+
// See complete-milestone — same rationale: dispatch to reviewer / security /
|
|
277
|
+
// tester subagents to fan out review work without bloating this unit's
|
|
278
|
+
// context.
|
|
279
|
+
tools: TOOLS_PLANNING_DISPATCH_REVIEW,
|
|
255
280
|
artifacts: {
|
|
256
281
|
// Phase 3 migration (#4782): matches today's actual
|
|
257
282
|
// buildCompleteSlicePrompt inlining order. Overrides prepend +
|