gsd-pi 2.82.0-dev.725028083 → 2.82.0-dev.9d5798940
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 +3 -2
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +3 -1
- package/dist/resources/extensions/claude-code-cli/partial-builder.js +2 -1
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/orchestrator.js +113 -6
- package/dist/resources/extensions/gsd/auto-dispatch.js +13 -6
- package/dist/resources/extensions/gsd/auto-post-unit.js +232 -126
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +31 -1
- package/dist/resources/extensions/gsd/auto-start.js +7 -3
- package/dist/resources/extensions/gsd/auto-verification.js +28 -22
- package/dist/resources/extensions/gsd/auto-worktree.js +96 -0
- package/dist/resources/extensions/gsd/auto.js +128 -52
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +4 -1
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +16 -7
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +16 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +37 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/db/unit-dispatches.js +2 -2
- package/dist/resources/extensions/gsd/export-html.js +27 -425
- package/dist/resources/extensions/gsd/md-importer.js +1 -1
- package/dist/resources/extensions/gsd/migrate/command.js +5 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +9 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +51 -4
- package/dist/resources/extensions/gsd/migrate/writer.js +11 -1
- package/dist/resources/extensions/gsd/milestone-actions.js +11 -4
- package/dist/resources/extensions/gsd/native-git-bridge.js +8 -3
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +6 -1
- package/dist/resources/extensions/gsd/tools/plan-slice.js +2 -1
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +32 -10
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +49 -9
- package/dist/resources/extensions/shared/html-shell.js +388 -0
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +124 -0
- package/dist/resources/extensions/visual-brief/prompts.js +140 -0
- 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 +15 -15
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- 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/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +4 -7
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -7
- 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 +4 -5
- 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 +2 -5
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -7
- 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 +4 -7
- 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 +4 -5
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -5
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
- package/dist/web/standalone/.next/server/chunks/4266.js +2 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- 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/web/standalone/.next/static/chunks/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/{8359.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/layout-8c10ec293ae0f1d5.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-9a4db269f9ed63ad.js} +1 -1
- package/dist/web/standalone/.next/static/css/746ee28c929d1880.css +1 -0
- package/package.json +3 -3
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/mcp-server/README.md +13 -4
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +22 -0
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +5 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/tui.ts +6 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/src/resources/GSD-WORKFLOW.md +3 -1
- package/src/resources/extensions/claude-code-cli/partial-builder.ts +2 -1
- package/src/resources/extensions/claude-code-cli/tests/partial-builder.test.ts +19 -2
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +46 -11
- package/src/resources/extensions/gsd/auto/orchestrator.ts +118 -6
- package/src/resources/extensions/gsd/auto-dispatch.ts +14 -6
- package/src/resources/extensions/gsd/auto-post-unit.ts +265 -138
- package/src/resources/extensions/gsd/auto-prompts.ts +2 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +29 -0
- package/src/resources/extensions/gsd/auto-start.ts +7 -3
- package/src/resources/extensions/gsd/auto-verification.ts +36 -34
- package/src/resources/extensions/gsd/auto-worktree.ts +104 -0
- package/src/resources/extensions/gsd/auto.ts +136 -51
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +6 -1
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +16 -6
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +19 -3
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +40 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/db/unit-dispatches.ts +3 -3
- package/src/resources/extensions/gsd/export-html.ts +27 -427
- package/src/resources/extensions/gsd/md-importer.ts +1 -1
- package/src/resources/extensions/gsd/migrate/command.ts +5 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +10 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +58 -4
- package/src/resources/extensions/gsd/migrate/writer.ts +14 -1
- package/src/resources/extensions/gsd/milestone-actions.ts +10 -4
- package/src/resources/extensions/gsd/native-git-bridge.ts +8 -3
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +8 -1
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +408 -4
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +6 -5
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +12 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +57 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/export-html-enhancements.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +48 -3
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/park-db-sync.test.ts +55 -1
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-unit-git-failure.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/remediation-completion-guard.test.ts +46 -2
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/stuck-state-via-db.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +86 -7
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +64 -12
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +47 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +2 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/unit-context-manifest.ts +47 -11
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +54 -9
- package/src/resources/extensions/shared/html-shell.ts +412 -0
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +136 -0
- package/src/resources/extensions/visual-brief/prompts.ts +183 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +212 -0
- package/dist/web/standalone/.next/server/chunks/5822.js +0 -2
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/layout-a16c7a7ecdf0c2cf.js +0 -1
- package/dist/web/standalone/.next/static/css/54ec2745c1da488b.css +0 -1
- package/dist/web/standalone/.next/static/css/de70bee13400563f.css +0 -1
- package/dist/web/standalone/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/747892c23ea88013-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/8d697b304b401681-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
- package/dist/web/standalone/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → BdZQhe8yKl6bdKLiXVEzh}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{KDRTXR-22LPCsa80X9dey → BdZQhe8yKl6bdKLiXVEzh}/_ssgManifest.js +0 -0
|
@@ -8,14 +8,153 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Design constraints (from Trek-e approval):
|
|
10
10
|
* - Warn the user before stashing (no silent surprises)
|
|
11
|
-
* - git stash push / git stash
|
|
12
|
-
* - Stash/
|
|
11
|
+
* - git stash push / git stash apply+drop for targeted restore
|
|
12
|
+
* - Stash/apply errors are logged but MUST NOT block the merge itself
|
|
13
13
|
* - Fast-path status check — clean trees pay no extra cost
|
|
14
14
|
*/
|
|
15
15
|
import { execFileSync } from "node:child_process";
|
|
16
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
16
18
|
import { GIT_NO_PROMPT_ENV } from "./git-constants.js";
|
|
17
19
|
import { logWarning } from "./workflow-logger.js";
|
|
18
20
|
import { nativeHasChanges } from "./native-git-bridge.js";
|
|
21
|
+
function gitText(basePath, args) {
|
|
22
|
+
return execFileSync("git", args, {
|
|
23
|
+
cwd: basePath,
|
|
24
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
25
|
+
encoding: "utf-8",
|
|
26
|
+
env: GIT_NO_PROMPT_ENV,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function gitBuffer(basePath, args) {
|
|
30
|
+
return execFileSync("git", args, {
|
|
31
|
+
cwd: basePath,
|
|
32
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
33
|
+
env: GIT_NO_PROMPT_ENV,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function errorText(err) {
|
|
37
|
+
if (!err || typeof err !== "object")
|
|
38
|
+
return String(err);
|
|
39
|
+
const parts = [];
|
|
40
|
+
const stderr = err.stderr;
|
|
41
|
+
const stdout = err.stdout;
|
|
42
|
+
for (const value of [stderr, stdout]) {
|
|
43
|
+
if (typeof value === "string")
|
|
44
|
+
parts.push(value);
|
|
45
|
+
else if (value instanceof Uint8Array)
|
|
46
|
+
parts.push(Buffer.from(value).toString("utf-8"));
|
|
47
|
+
}
|
|
48
|
+
parts.push(err instanceof Error ? err.message : String(err));
|
|
49
|
+
return parts.filter(Boolean).join("\n");
|
|
50
|
+
}
|
|
51
|
+
function parseAlreadyExistsNoCheckoutPaths(text) {
|
|
52
|
+
const paths = [];
|
|
53
|
+
for (const line of text.split(/\r?\n/)) {
|
|
54
|
+
const match = /^(.+?) already exists, no checkout$/i.exec(line.trim());
|
|
55
|
+
if (match?.[1])
|
|
56
|
+
paths.push(match[1]);
|
|
57
|
+
}
|
|
58
|
+
return [...new Set(paths)];
|
|
59
|
+
}
|
|
60
|
+
function readZeroDelimitedPaths(output) {
|
|
61
|
+
return output.split("\0").filter(Boolean);
|
|
62
|
+
}
|
|
63
|
+
function listStashUntrackedPaths(basePath, stashRef) {
|
|
64
|
+
try {
|
|
65
|
+
const output = gitText(basePath, ["ls-tree", "-r", "-z", "--name-only", `${stashRef}^3`]);
|
|
66
|
+
return readZeroDelimitedPaths(output);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function listStashTrackedPaths(basePath, stashRef) {
|
|
73
|
+
try {
|
|
74
|
+
const output = gitText(basePath, ["diff", "--name-only", "-z", `${stashRef}^1`, stashRef]);
|
|
75
|
+
return readZeroDelimitedPaths(output);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function isWorktreeClean(basePath) {
|
|
82
|
+
try {
|
|
83
|
+
return gitText(basePath, ["status", "--porcelain"]).trim() === "";
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function stashBlobEqualsWorktreeFile(basePath, stashRef, path) {
|
|
90
|
+
try {
|
|
91
|
+
const worktreePath = join(basePath, path);
|
|
92
|
+
if (!existsSync(worktreePath))
|
|
93
|
+
return false;
|
|
94
|
+
const worktreeContent = readFileSync(worktreePath);
|
|
95
|
+
const stashContent = gitBuffer(basePath, ["show", `${stashRef}^3:${path}`]);
|
|
96
|
+
return Buffer.compare(worktreeContent, stashContent) === 0;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function reconcileAlreadyPresentUntrackedStash(basePath, milestoneId, stashRef, err) {
|
|
103
|
+
const text = errorText(err);
|
|
104
|
+
const collidedPaths = parseAlreadyExistsNoCheckoutPaths(text);
|
|
105
|
+
if (collidedPaths.length === 0)
|
|
106
|
+
return null;
|
|
107
|
+
const untrackedPaths = listStashUntrackedPaths(basePath, stashRef);
|
|
108
|
+
if (!untrackedPaths || untrackedPaths.length === 0)
|
|
109
|
+
return null;
|
|
110
|
+
const trackedPaths = listStashTrackedPaths(basePath, stashRef);
|
|
111
|
+
if (trackedPaths === null || trackedPaths.length > 0)
|
|
112
|
+
return null;
|
|
113
|
+
const untrackedPathSet = new Set(untrackedPaths);
|
|
114
|
+
if (!collidedPaths.every((path) => untrackedPathSet.has(path)))
|
|
115
|
+
return null;
|
|
116
|
+
if (!untrackedPaths.every((path) => existsSync(join(basePath, path))))
|
|
117
|
+
return null;
|
|
118
|
+
if (isWorktreeClean(basePath) !== true)
|
|
119
|
+
return null;
|
|
120
|
+
const blobComparisons = untrackedPaths.map((path) => stashBlobEqualsWorktreeFile(basePath, stashRef, path));
|
|
121
|
+
if (blobComparisons.some((result) => result === null))
|
|
122
|
+
return null;
|
|
123
|
+
const allIdentical = blobComparisons.every(Boolean);
|
|
124
|
+
if (allIdentical) {
|
|
125
|
+
let dropped = true;
|
|
126
|
+
try {
|
|
127
|
+
execFileSync("git", ["stash", "drop", stashRef], {
|
|
128
|
+
cwd: basePath,
|
|
129
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
130
|
+
encoding: "utf-8",
|
|
131
|
+
env: GIT_NO_PROMPT_ENV,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
dropped = false;
|
|
136
|
+
logWarning("preflight", `git stash drop ${stashRef} failed after identical preflight stash reconciliation: ${err instanceof Error ? err.message : String(err)}`);
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
restored: true,
|
|
140
|
+
needsManualRecovery: false,
|
|
141
|
+
message: dropped
|
|
142
|
+
? `Preflight stash for milestone ${milestoneId} contained files already present after merge; identical stash dropped.`
|
|
143
|
+
: `Preflight stash for milestone ${milestoneId} contained files already present after merge, but ${stashRef} could not be dropped and remains as a backup.`,
|
|
144
|
+
stashRef,
|
|
145
|
+
resolution: dropped ? "already-present-dropped" : "already-present-preserved",
|
|
146
|
+
collidedPaths,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
restored: false,
|
|
151
|
+
needsManualRecovery: false,
|
|
152
|
+
message: `Preflight stash for milestone ${milestoneId} contained untracked files already present after merge. Keeping merged files and preserving ${stashRef} as a backup.`,
|
|
153
|
+
stashRef,
|
|
154
|
+
resolution: "already-present-preserved",
|
|
155
|
+
collidedPaths,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
19
158
|
function findPreflightStashRef(basePath, milestoneId, stashMarker) {
|
|
20
159
|
const markerPrefix = `gsd-preflight-stash:${milestoneId}:`;
|
|
21
160
|
let fallbackRef = null;
|
|
@@ -115,28 +254,50 @@ export function postflightPopStash(basePath, milestoneId, stashMarker, notify) {
|
|
|
115
254
|
message: msg,
|
|
116
255
|
};
|
|
117
256
|
}
|
|
118
|
-
execFileSync("git", ["stash", "
|
|
257
|
+
execFileSync("git", ["stash", "apply", stashRef], {
|
|
119
258
|
cwd: basePath,
|
|
120
259
|
stdio: ["ignore", "pipe", "pipe"],
|
|
121
260
|
encoding: "utf-8",
|
|
122
261
|
env: GIT_NO_PROMPT_ENV,
|
|
123
262
|
});
|
|
263
|
+
let dropWarning = null;
|
|
264
|
+
try {
|
|
265
|
+
execFileSync("git", ["stash", "drop", stashRef], {
|
|
266
|
+
cwd: basePath,
|
|
267
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
268
|
+
encoding: "utf-8",
|
|
269
|
+
env: GIT_NO_PROMPT_ENV,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
dropWarning = ` Stash was restored, but git stash drop ${stashRef} failed: ${err instanceof Error ? err.message : String(err)}.`;
|
|
274
|
+
logWarning("preflight", dropWarning.trim());
|
|
275
|
+
}
|
|
124
276
|
const msg = `Restored stashed changes after milestone ${milestoneId} merge.`;
|
|
125
|
-
notify(msg
|
|
277
|
+
notify(`${msg}${dropWarning ?? ""}`, dropWarning ? "warning" : "info");
|
|
126
278
|
return {
|
|
127
279
|
restored: true,
|
|
128
280
|
needsManualRecovery: false,
|
|
129
|
-
message: msg
|
|
281
|
+
message: `${msg}${dropWarning ?? ""}`,
|
|
130
282
|
stashRef,
|
|
283
|
+
resolution: "applied",
|
|
131
284
|
};
|
|
132
285
|
}
|
|
133
286
|
catch (err) {
|
|
134
|
-
|
|
287
|
+
if (stashRef) {
|
|
288
|
+
const reconciled = reconcileAlreadyPresentUntrackedStash(basePath, milestoneId, stashRef, err);
|
|
289
|
+
if (reconciled) {
|
|
290
|
+
logWarning("preflight", reconciled.message);
|
|
291
|
+
notify(reconciled.message, reconciled.resolution === "already-present-preserved" ? "warning" : "info");
|
|
292
|
+
return reconciled;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// Apply conflicts mean the merged code collides with the stashed changes.
|
|
135
296
|
// Log a warning — the user needs to resolve manually, but the merge succeeded.
|
|
136
297
|
const restoreHint = stashRef
|
|
137
|
-
? `Run "git stash
|
|
298
|
+
? `Run "git stash apply ${stashRef}" manually to restore the correct stash, then "git stash drop ${stashRef}" after recovery.`
|
|
138
299
|
: `Run "git stash list" to find the matching GSD preflight stash before restoring manually.`;
|
|
139
|
-
const msg = `git stash
|
|
300
|
+
const msg = `git stash apply ${stashRef ?? ""}`.trim() + ` failed after merge of milestone ${milestoneId}: ${err instanceof Error ? err.message : String(err)}. ${restoreHint}`;
|
|
140
301
|
logWarning("preflight", msg);
|
|
141
302
|
notify(msg, "warning");
|
|
142
303
|
return {
|
|
@@ -144,6 +305,7 @@ export function postflightPopStash(basePath, milestoneId, stashMarker, notify) {
|
|
|
144
305
|
needsManualRecovery: true,
|
|
145
306
|
message: msg,
|
|
146
307
|
...(stashRef ? { stashRef } : {}),
|
|
308
|
+
resolution: "manual-recovery",
|
|
147
309
|
};
|
|
148
310
|
}
|
|
149
311
|
}
|
|
@@ -2,7 +2,8 @@ import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { loadRegistry } from "../workflow-templates.js";
|
|
4
4
|
import { gsdHome } from "../gsd-home.js";
|
|
5
|
-
|
|
5
|
+
import { VISUAL_BRIEF_MODES } from "../../visual-brief/prompts.js";
|
|
6
|
+
export const GSD_COMMAND_DESCRIPTION = "GSD — Get Shit Done: /gsd help|start|templates|next|auto|stop|pause|status|widget|visualize|brief|queue|quick|discuss|capture|triage|dispatch|history|undo|undo-task|reset-slice|rate|skip|export|cleanup|model|mode|prefs|config|keys|hooks|run-hook|skill-health|doctor|debug|logs|forensics|changelog|migrate|remote|steer|knowledge|new-milestone|new-project|parallel|cmux|park|unpark|init|setup|onboarding|inspect|extensions|update|fast|mcp|rethink|workflow|codebase|notifications|ship|do|session-report|backlog|pr-branch|add-tests|scan|language|worktree|eval-review";
|
|
6
7
|
export const TOP_LEVEL_SUBCOMMANDS = [
|
|
7
8
|
{ cmd: "help", desc: "Categorized command reference with descriptions" },
|
|
8
9
|
{ cmd: "next", desc: "Explicit step mode (same as /gsd)" },
|
|
@@ -12,6 +13,7 @@ export const TOP_LEVEL_SUBCOMMANDS = [
|
|
|
12
13
|
{ cmd: "status", desc: "Progress dashboard" },
|
|
13
14
|
{ cmd: "widget", desc: "Cycle widget: full → small → min → off" },
|
|
14
15
|
{ cmd: "visualize", desc: "Open 10-tab workflow visualizer (progress, timeline, deps, metrics, health, agent, changes, knowledge, captures, export)" },
|
|
16
|
+
{ cmd: "brief", desc: "Generate a visual HTML brief: diagram, plan, diff review, recap, table, or slides" },
|
|
15
17
|
{ cmd: "queue", desc: "Queue and reorder future milestones" },
|
|
16
18
|
{ cmd: "quick", desc: "Execute a quick task without full planning overhead" },
|
|
17
19
|
{ cmd: "discuss", desc: "Discuss architecture and decisions" },
|
|
@@ -75,6 +77,7 @@ export const TOP_LEVEL_SUBCOMMANDS = [
|
|
|
75
77
|
{ cmd: "eval-review", desc: "Audit a slice's AI evaluation strategy and write a scored EVAL-REVIEW.md (--force, --show)" },
|
|
76
78
|
];
|
|
77
79
|
const NESTED_COMPLETIONS = {
|
|
80
|
+
brief: VISUAL_BRIEF_MODES.map((mode) => ({ cmd: mode.mode, desc: mode.description })),
|
|
78
81
|
auto: [
|
|
79
82
|
{ cmd: "--verbose", desc: "Show detailed execution output" },
|
|
80
83
|
{ cmd: "--debug", desc: "Enable debug logging" },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { computeProgressScore, formatProgressLine } from "../../progress-score.js";
|
|
2
3
|
import { getGlobalGSDPreferencesPath, getProjectGSDPreferencesPath } from "../../preferences.js";
|
|
3
4
|
import { ensurePreferencesFile, handlePrefs, handlePrefsMode, handlePrefsWizard, handleLanguage } from "../../commands-prefs-wizard.js";
|
|
@@ -7,6 +8,8 @@ import { handleCmux } from "../../commands-cmux.js";
|
|
|
7
8
|
import { setSessionModelOverride } from "../../session-model-override.js";
|
|
8
9
|
import { projectRoot } from "../context.js";
|
|
9
10
|
import { formattedShortcutPair } from "../../shortcut-defs.js";
|
|
11
|
+
import { getVisualBriefOutputDir } from "../../../visual-brief/artifact-policy.js";
|
|
12
|
+
import { buildVisualBriefPrompt, parseVisualBriefArgs, VISUAL_BRIEF_USAGE } from "../../../visual-brief/prompts.js";
|
|
10
13
|
export function showHelp(ctx, args = "") {
|
|
11
14
|
const summaryLines = [
|
|
12
15
|
"GSD — Get Shit Done\n",
|
|
@@ -22,6 +25,7 @@ export function showHelp(ctx, args = "") {
|
|
|
22
25
|
` /gsd parallel watch Parallel monitor (${formattedShortcutPair("parallel")})`,
|
|
23
26
|
` /gsd notifications Notification history (${formattedShortcutPair("notifications")})`,
|
|
24
27
|
" /gsd visualize Interactive 10-tab TUI",
|
|
28
|
+
" /gsd brief <mode> Visual HTML brief (diagram, plan, diff, recap, table, slides)",
|
|
25
29
|
" /gsd queue Show queued/dispatched units",
|
|
26
30
|
"",
|
|
27
31
|
"COURSE CORRECTION",
|
|
@@ -69,6 +73,7 @@ export function showHelp(ctx, args = "") {
|
|
|
69
73
|
` /gsd parallel watch Open parallel worker monitor (${formattedShortcutPair("parallel")})`,
|
|
70
74
|
" /gsd widget Cycle status widget [full|small|min|off]",
|
|
71
75
|
" /gsd visualize Interactive 10-tab TUI (progress, timeline, deps, metrics, health, agent, changes, knowledge, captures, export)",
|
|
76
|
+
" /gsd brief <mode> Generate a visual HTML brief [diagram|plan|diff|recap|table|slides] [topic] [--slides]",
|
|
72
77
|
" /gsd queue Show queued/dispatched units and execution order",
|
|
73
78
|
" /gsd history View execution history [--cost] [--phase] [--model] [N]",
|
|
74
79
|
" /gsd changelog Show categorized release notes [version]",
|
|
@@ -182,6 +187,34 @@ export async function handleVisualize(ctx) {
|
|
|
182
187
|
ctx.ui.notify("Visualizer requires an interactive terminal. Use /gsd status for a text-based overview.", "warning");
|
|
183
188
|
}
|
|
184
189
|
}
|
|
190
|
+
export async function handleBrief(args, ctx, pi) {
|
|
191
|
+
const request = parseVisualBriefArgs(args);
|
|
192
|
+
if (!request) {
|
|
193
|
+
ctx.ui.notify(VISUAL_BRIEF_USAGE, "info");
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (!pi?.sendUserMessage) {
|
|
197
|
+
ctx.ui.notify("Visual brief generation is unavailable in this context.", "warning");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const outputDir = getVisualBriefOutputDir();
|
|
201
|
+
const version = resolveGsdVersion();
|
|
202
|
+
pi.sendUserMessage(buildVisualBriefPrompt(request, { outputDir, version }));
|
|
203
|
+
}
|
|
204
|
+
const briefRequire = createRequire(import.meta.url);
|
|
205
|
+
function resolveGsdVersion() {
|
|
206
|
+
const envVersion = process.env.GSD_VERSION?.trim();
|
|
207
|
+
if (envVersion)
|
|
208
|
+
return envVersion;
|
|
209
|
+
try {
|
|
210
|
+
const pkg = briefRequire("../../../../../../package.json");
|
|
211
|
+
const fromPkg = typeof pkg.version === "string" ? pkg.version.trim() : "";
|
|
212
|
+
return fromPkg || undefined;
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
185
218
|
export async function handleSetup(args, ctx, pi) {
|
|
186
219
|
const { detectProjectState, hasGlobalSetup } = await import("../../detection.js");
|
|
187
220
|
const { isOnboardingComplete, readOnboardingRecord } = await import("../../onboarding-state.js");
|
|
@@ -370,6 +403,10 @@ export async function handleCoreCommand(trimmed, ctx, pi) {
|
|
|
370
403
|
await handleVisualize(ctx);
|
|
371
404
|
return true;
|
|
372
405
|
}
|
|
406
|
+
if (trimmed === "brief" || trimmed.startsWith("brief ")) {
|
|
407
|
+
await handleBrief(trimmed.replace(/^brief\s*/, "").trim(), ctx, pi);
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
373
410
|
if (trimmed === "widget" || trimmed.startsWith("widget ")) {
|
|
374
411
|
const { cycleWidgetMode, setWidgetMode, getWidgetMode } = await import("../../auto-dashboard.js");
|
|
375
412
|
const arg = trimmed.replace(/^widget\s*/, "").trim();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { importExtensionModule } from "@gsd/pi-coding-agent";
|
|
2
|
+
import { VISUAL_BRIEF_MODES } from "../visual-brief/prompts.js";
|
|
2
3
|
const TOP_LEVEL_SUBCOMMANDS = [
|
|
3
4
|
{ cmd: "help", desc: "Categorized command reference with descriptions" },
|
|
4
5
|
{ cmd: "next", desc: "Explicit step mode (same as /gsd)" },
|
|
@@ -7,6 +8,7 @@ const TOP_LEVEL_SUBCOMMANDS = [
|
|
|
7
8
|
{ cmd: "pause", desc: "Pause auto-mode (preserves state, /gsd auto to resume)" },
|
|
8
9
|
{ cmd: "status", desc: "Progress dashboard" },
|
|
9
10
|
{ cmd: "visualize", desc: "Open workflow visualizer" },
|
|
11
|
+
{ cmd: "brief", desc: "Generate a visual HTML brief" },
|
|
10
12
|
{ cmd: "queue", desc: "Queue and reorder future milestones" },
|
|
11
13
|
{ cmd: "quick", desc: "Execute a quick task without full planning overhead" },
|
|
12
14
|
{ cmd: "discuss", desc: "Discuss architecture and decisions" },
|
|
@@ -75,6 +77,9 @@ function getGsdArgumentCompletions(prefix) {
|
|
|
75
77
|
{ cmd: "--dry-run", desc: "Preview next step without executing" },
|
|
76
78
|
], "next");
|
|
77
79
|
}
|
|
80
|
+
if (parts[0] === "brief" && parts.length <= 2) {
|
|
81
|
+
return filterStartsWith(partial, VISUAL_BRIEF_MODES.map((mode) => ({ cmd: mode.mode, desc: mode.description })), "brief");
|
|
82
|
+
}
|
|
78
83
|
if ((parts[0] === "new-project" || parts[0] === "new-milestone") && parts.length <= 2) {
|
|
79
84
|
return filterStartsWith(partial, [
|
|
80
85
|
{ cmd: "--deep", desc: "Enable deep planning mode (staged project-level discovery)" },
|
|
@@ -391,7 +391,7 @@ export function getRecentUnitKeysForProjectRoot(projectRootRealpath, limit = 20)
|
|
|
391
391
|
if (!isDbAvailable())
|
|
392
392
|
return [];
|
|
393
393
|
const db = _getAdapter();
|
|
394
|
-
const rows = db.prepare(`SELECT ud.unit_id
|
|
394
|
+
const rows = db.prepare(`SELECT ud.unit_type, ud.unit_id
|
|
395
395
|
FROM unit_dispatches ud
|
|
396
396
|
INNER JOIN workers w ON w.worker_id = ud.worker_id
|
|
397
397
|
WHERE w.project_root_realpath = :project_root_realpath
|
|
@@ -400,7 +400,7 @@ export function getRecentUnitKeysForProjectRoot(projectRootRealpath, limit = 20)
|
|
|
400
400
|
":project_root_realpath": projectRootRealpath,
|
|
401
401
|
":limit": limit,
|
|
402
402
|
});
|
|
403
|
-
return rows.reverse().map((r) => ({ key: r.unit_id }));
|
|
403
|
+
return rows.reverse().map((r) => ({ key: `${r.unit_type}/${r.unit_id}` }));
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
406
406
|
* Fetch dispatches for a milestone filtered by status. Useful for janitors
|