gsd-pi 2.73.1-dev.47ed32a → 2.73.1-dev.49397e5
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/dist/cli-web-branch.d.ts +4 -3
- package/dist/cli-web-branch.js +10 -7
- package/dist/cli.js +99 -206
- package/dist/headless-query.js +4 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +1 -1
- package/dist/onboarding.js +59 -53
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +59 -1
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +11 -4
- package/dist/resources/extensions/gsd/auto/phases.js +60 -10
- package/dist/resources/extensions/gsd/auto-dispatch.js +11 -3
- package/dist/resources/extensions/gsd/auto-post-unit.js +93 -57
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +13 -0
- package/dist/resources/extensions/gsd/auto-verification.js +88 -3
- package/dist/resources/extensions/gsd/auto.js +29 -10
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +21 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +26 -1
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +68 -9
- package/dist/resources/extensions/gsd/commands-add-tests.js +111 -0
- package/dist/resources/extensions/gsd/commands-backlog.js +140 -0
- package/dist/resources/extensions/gsd/commands-do.js +79 -0
- package/dist/resources/extensions/gsd/commands-maintenance.js +6 -6
- package/dist/resources/extensions/gsd/commands-pr-branch.js +180 -0
- package/dist/resources/extensions/gsd/commands-session-report.js +82 -0
- package/dist/resources/extensions/gsd/commands-ship.js +187 -0
- package/dist/resources/extensions/gsd/db-writer.js +3 -5
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/gsd-db.js +321 -0
- package/dist/resources/extensions/gsd/index.js +15 -2
- package/dist/resources/extensions/gsd/md-importer.js +3 -4
- package/dist/resources/extensions/gsd/memory-store.js +19 -51
- package/dist/resources/extensions/gsd/milestone-validation-gates.js +13 -12
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -4
- package/dist/resources/extensions/gsd/notification-widget.js +2 -2
- package/dist/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/dist/resources/extensions/gsd/state.js +66 -15
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +3 -14
- package/dist/resources/extensions/gsd/triage-resolution.js +2 -5
- package/dist/resources/extensions/gsd/workflow-manifest.js +8 -69
- package/dist/resources/extensions/gsd/workflow-migration.js +21 -22
- package/dist/resources/extensions/gsd/workflow-projections.js +4 -1
- package/dist/resources/extensions/gsd/workflow-reconcile.js +14 -11
- package/dist/tsconfig.extensions.tsbuildinfo +1 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- 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 +11 -11
- 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/package.json +3 -3
- package/packages/mcp-server/tsconfig.json +1 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -0
- package/packages/native/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-agent-core/tsconfig.json +1 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-ai/tsconfig.json +1 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +10 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +9 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js +52 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +5 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +12 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +73 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +9 -3
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +5 -1
- package/packages/pi-coding-agent/tsconfig.json +1 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +30 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts +1 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +22 -3
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/src/__tests__/tui.test.ts +38 -0
- package/packages/pi-tui/src/tui.ts +20 -3
- package/packages/pi-tui/tsconfig.json +1 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -0
- package/packages/rpc-client/tsconfig.json +1 -0
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +95 -1
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +88 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +12 -4
- package/src/resources/extensions/gsd/auto/loop-deps.ts +6 -0
- package/src/resources/extensions/gsd/auto/phases.ts +90 -10
- package/src/resources/extensions/gsd/auto-dispatch.ts +10 -4
- package/src/resources/extensions/gsd/auto-post-unit.ts +107 -58
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +17 -0
- package/src/resources/extensions/gsd/auto-verification.ts +98 -3
- package/src/resources/extensions/gsd/auto.ts +33 -14
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +26 -1
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +20 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +74 -9
- package/src/resources/extensions/gsd/commands-add-tests.ts +137 -0
- package/src/resources/extensions/gsd/commands-backlog.ts +182 -0
- package/src/resources/extensions/gsd/commands-do.ts +109 -0
- package/src/resources/extensions/gsd/commands-maintenance.ts +6 -6
- package/src/resources/extensions/gsd/commands-pr-branch.ts +234 -0
- package/src/resources/extensions/gsd/commands-session-report.ts +101 -0
- package/src/resources/extensions/gsd/commands-ship.ts +219 -0
- package/src/resources/extensions/gsd/db-writer.ts +3 -5
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/gsd-db.ts +467 -0
- package/src/resources/extensions/gsd/index.ts +18 -2
- package/src/resources/extensions/gsd/md-importer.ts +3 -5
- package/src/resources/extensions/gsd/memory-store.ts +31 -62
- package/src/resources/extensions/gsd/milestone-validation-gates.ts +13 -14
- package/src/resources/extensions/gsd/native-git-bridge.ts +11 -12
- package/src/resources/extensions/gsd/notification-widget.ts +2 -2
- package/src/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/src/resources/extensions/gsd/state.ts +80 -17
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/commands-backlog.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/commands-pr-branch.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/commands-session-report.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/commands-ship.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +68 -8
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +223 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +3 -11
- package/src/resources/extensions/gsd/triage-resolution.ts +2 -7
- package/src/resources/extensions/gsd/workflow-manifest.ts +9 -104
- package/src/resources/extensions/gsd/workflow-migration.ts +21 -29
- package/src/resources/extensions/gsd/workflow-projections.ts +8 -1
- package/src/resources/extensions/gsd/workflow-reconcile.ts +15 -15
- /package/dist/web/standalone/.next/static/{WawMb3TMcYLkGJLTg_x1u → tAsSblRKK1lG7MVOwsO92}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{WawMb3TMcYLkGJLTg_x1u → tAsSblRKK1lG7MVOwsO92}/_ssgManifest.js +0 -0
|
@@ -488,7 +488,7 @@ export async function handleCleanupProjects(args: string, ctx: ExtensionCommandC
|
|
|
488
488
|
* Prints counts of recovered items and the resulting project phase.
|
|
489
489
|
*/
|
|
490
490
|
export async function handleRecover(ctx: ExtensionCommandContext, basePath: string): Promise<void> {
|
|
491
|
-
const { isDbAvailable: dbAvailable,
|
|
491
|
+
const { isDbAvailable: dbAvailable, clearEngineHierarchy, transaction: dbTransaction } = await import("./gsd-db.js");
|
|
492
492
|
const { migrateHierarchyToDb } = await import("./md-importer.js");
|
|
493
493
|
const { invalidateStateCache } = await import("./state.js");
|
|
494
494
|
|
|
@@ -498,12 +498,12 @@ export async function handleRecover(ctx: ExtensionCommandContext, basePath: stri
|
|
|
498
498
|
}
|
|
499
499
|
|
|
500
500
|
try {
|
|
501
|
-
// 1. Delete + re-populate inside a single transaction for atomicity
|
|
502
|
-
|
|
501
|
+
// 1. Delete + re-populate inside a single transaction for atomicity.
|
|
502
|
+
// clearEngineHierarchy() uses transaction() internally but transaction()
|
|
503
|
+
// is re-entrant, so wrapping in dbTransaction() keeps the whole
|
|
504
|
+
// clear+repopulate atomic.
|
|
503
505
|
const counts = dbTransaction(() => {
|
|
504
|
-
|
|
505
|
-
db.exec("DELETE FROM slices");
|
|
506
|
-
db.exec("DELETE FROM milestones");
|
|
506
|
+
clearEngineHierarchy();
|
|
507
507
|
return migrateHierarchyToDb(basePath);
|
|
508
508
|
});
|
|
509
509
|
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Command — /gsd pr-branch
|
|
3
|
+
*
|
|
4
|
+
* Creates a clean PR branch by cherry-picking commits while stripping
|
|
5
|
+
* any changes to .gsd/, .planning/, and PLAN.md paths. Useful for
|
|
6
|
+
* upstream PRs where planning artifacts should not be included.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
|
10
|
+
|
|
11
|
+
import { execFileSync } from "node:child_process";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
nativeGetCurrentBranch,
|
|
15
|
+
nativeDetectMainBranch,
|
|
16
|
+
nativeBranchExists,
|
|
17
|
+
} from "./native-git-bridge.js";
|
|
18
|
+
|
|
19
|
+
const EXCLUDED_PATHS = [".gsd", ".planning", "PLAN.md"] as const;
|
|
20
|
+
|
|
21
|
+
function git(basePath: string, args: readonly string[]): string {
|
|
22
|
+
return execFileSync("git", args, { cwd: basePath, encoding: "utf-8" }).trim();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function gitAllowFail(basePath: string, args: readonly string[]): void {
|
|
26
|
+
try {
|
|
27
|
+
execFileSync("git", args, { cwd: basePath, encoding: "utf-8", stdio: "pipe" });
|
|
28
|
+
} catch {
|
|
29
|
+
// ignored — caller opts into non-fatal behavior
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function hasStagedChanges(basePath: string): boolean {
|
|
34
|
+
try {
|
|
35
|
+
execFileSync("git", ["diff", "--cached", "--quiet"], {
|
|
36
|
+
cwd: basePath,
|
|
37
|
+
stdio: "pipe",
|
|
38
|
+
});
|
|
39
|
+
return false;
|
|
40
|
+
} catch {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function isValidBranchName(name: string): boolean {
|
|
46
|
+
try {
|
|
47
|
+
execFileSync("git", ["check-ref-format", "--branch", name], { stdio: "pipe" });
|
|
48
|
+
return true;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getCodeOnlyCommits(basePath: string, base: string, head: string): string[] {
|
|
55
|
+
try {
|
|
56
|
+
const allCommits = git(basePath, ["log", "--format=%H", `${base}..${head}`])
|
|
57
|
+
.split("\n")
|
|
58
|
+
.filter(Boolean);
|
|
59
|
+
const codeCommits: string[] = [];
|
|
60
|
+
|
|
61
|
+
for (const sha of allCommits) {
|
|
62
|
+
const files = git(basePath, ["diff-tree", "--no-commit-id", "--name-only", "-r", sha])
|
|
63
|
+
.split("\n")
|
|
64
|
+
.filter(Boolean);
|
|
65
|
+
const hasCodeChanges = files.some(
|
|
66
|
+
(f) => !f.startsWith(".gsd/") && !f.startsWith(".planning/") && f !== "PLAN.md",
|
|
67
|
+
);
|
|
68
|
+
if (hasCodeChanges) {
|
|
69
|
+
codeCommits.push(sha);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return codeCommits.reverse(); // chronological for cherry-picking
|
|
74
|
+
} catch {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Cherry-pick a commit while stripping excluded paths from the resulting
|
|
81
|
+
* commit. Returns true if a commit was produced, false if nothing remained
|
|
82
|
+
* after filtering.
|
|
83
|
+
*/
|
|
84
|
+
function cherryPickFiltered(basePath: string, sha: string): boolean {
|
|
85
|
+
git(basePath, ["cherry-pick", "--no-commit", "--allow-empty", sha]);
|
|
86
|
+
|
|
87
|
+
// Unstage any excluded paths introduced by the cherry-pick.
|
|
88
|
+
gitAllowFail(basePath, ["reset", "HEAD", "--", ...EXCLUDED_PATHS]);
|
|
89
|
+
|
|
90
|
+
// Restore worktree state for excluded paths from HEAD (if tracked),
|
|
91
|
+
// then remove any newly introduced untracked files under those paths.
|
|
92
|
+
gitAllowFail(basePath, ["checkout", "HEAD", "--", ...EXCLUDED_PATHS]);
|
|
93
|
+
gitAllowFail(basePath, ["clean", "-fdq", "--", ...EXCLUDED_PATHS]);
|
|
94
|
+
|
|
95
|
+
if (!hasStagedChanges(basePath)) {
|
|
96
|
+
// Nothing remained after filtering — discard worktree residue and skip.
|
|
97
|
+
git(basePath, ["reset", "--hard", "HEAD"]);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
git(basePath, ["commit", "-C", sha]);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function assertNoExcludedPaths(basePath: string, base: string): void {
|
|
106
|
+
const files = git(basePath, [
|
|
107
|
+
"diff",
|
|
108
|
+
"--name-only",
|
|
109
|
+
`${base}..HEAD`,
|
|
110
|
+
])
|
|
111
|
+
.split("\n")
|
|
112
|
+
.filter(Boolean);
|
|
113
|
+
const leaked = files.filter(
|
|
114
|
+
(f) => f.startsWith(".gsd/") || f.startsWith(".planning/") || f === "PLAN.md",
|
|
115
|
+
);
|
|
116
|
+
if (leaked.length > 0) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`PR branch still contains excluded paths: ${leaked.slice(0, 5).join(", ")}${
|
|
119
|
+
leaked.length > 5 ? ` (+${leaked.length - 5} more)` : ""
|
|
120
|
+
}`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export async function handlePrBranch(
|
|
126
|
+
args: string,
|
|
127
|
+
ctx: ExtensionCommandContext,
|
|
128
|
+
): Promise<void> {
|
|
129
|
+
const basePath = process.cwd();
|
|
130
|
+
const dryRun = args.includes("--dry-run");
|
|
131
|
+
const nameMatch = args.match(/--name\s+(\S+)/);
|
|
132
|
+
|
|
133
|
+
const currentBranch = nativeGetCurrentBranch(basePath);
|
|
134
|
+
const mainBranch = nativeDetectMainBranch(basePath);
|
|
135
|
+
|
|
136
|
+
// Determine base ref (prefer upstream/main if available)
|
|
137
|
+
let baseRef: string;
|
|
138
|
+
try {
|
|
139
|
+
git(basePath, ["rev-parse", "--verify", "upstream/main"]);
|
|
140
|
+
baseRef = "upstream/main";
|
|
141
|
+
} catch {
|
|
142
|
+
baseRef = mainBranch;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Find commits with code changes
|
|
146
|
+
const commits = getCodeOnlyCommits(basePath, baseRef, "HEAD");
|
|
147
|
+
|
|
148
|
+
if (commits.length === 0) {
|
|
149
|
+
ctx.ui.notify("No code-only commits found (all commits only touch .gsd/ files).", "info");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (dryRun) {
|
|
154
|
+
const lines = [`Would create PR branch with ${commits.length} commits (filtering .gsd/ paths):\n`];
|
|
155
|
+
for (const sha of commits) {
|
|
156
|
+
const msg = git(basePath, ["log", "--format=%s", "-1", sha]);
|
|
157
|
+
lines.push(` ${sha.slice(0, 8)} ${msg}`);
|
|
158
|
+
}
|
|
159
|
+
ctx.ui.notify(lines.join("\n"), "info");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const requestedName = nameMatch?.[1];
|
|
164
|
+
if (requestedName && !isValidBranchName(requestedName)) {
|
|
165
|
+
ctx.ui.notify(
|
|
166
|
+
`Invalid branch name: ${requestedName}. Must satisfy git check-ref-format.`,
|
|
167
|
+
"error",
|
|
168
|
+
);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const defaultName = `pr/${currentBranch}`;
|
|
173
|
+
const prBranch = requestedName ?? defaultName;
|
|
174
|
+
|
|
175
|
+
if (!isValidBranchName(prBranch)) {
|
|
176
|
+
ctx.ui.notify(
|
|
177
|
+
`Derived branch name is invalid: ${prBranch}. Use --name to override.`,
|
|
178
|
+
"error",
|
|
179
|
+
);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (nativeBranchExists(basePath, prBranch)) {
|
|
184
|
+
ctx.ui.notify(
|
|
185
|
+
`Branch ${prBranch} already exists. Use --name to specify a different name, or delete it first.`,
|
|
186
|
+
"warning",
|
|
187
|
+
);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
// Create clean branch from base
|
|
193
|
+
git(basePath, ["checkout", "-b", prBranch, baseRef]);
|
|
194
|
+
|
|
195
|
+
// Cherry-pick with path filter
|
|
196
|
+
let picked = 0;
|
|
197
|
+
let skipped = 0;
|
|
198
|
+
for (const sha of commits) {
|
|
199
|
+
try {
|
|
200
|
+
if (cherryPickFiltered(basePath, sha)) {
|
|
201
|
+
picked++;
|
|
202
|
+
} else {
|
|
203
|
+
skipped++;
|
|
204
|
+
}
|
|
205
|
+
} catch (pickErr) {
|
|
206
|
+
gitAllowFail(basePath, ["cherry-pick", "--abort"]);
|
|
207
|
+
gitAllowFail(basePath, ["reset", "--hard", "HEAD"]);
|
|
208
|
+
const detail = pickErr instanceof Error ? pickErr.message : String(pickErr);
|
|
209
|
+
ctx.ui.notify(
|
|
210
|
+
`Cherry-pick conflict at ${sha.slice(0, 8)}. Picked ${picked}/${commits.length} commits. Resolve manually.\n${detail}`,
|
|
211
|
+
"warning",
|
|
212
|
+
);
|
|
213
|
+
git(basePath, ["checkout", currentBranch]);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Post-condition: no excluded paths should appear in the PR branch diff.
|
|
219
|
+
assertNoExcludedPaths(basePath, baseRef);
|
|
220
|
+
|
|
221
|
+
const skippedMsg = skipped > 0 ? ` (${skipped} skipped — contained only planning artifacts)` : "";
|
|
222
|
+
ctx.ui.notify(
|
|
223
|
+
`Created ${prBranch} with ${picked} commits${skippedMsg} (no .gsd/ artifacts).\nSwitch back: git checkout ${currentBranch}`,
|
|
224
|
+
"success",
|
|
225
|
+
);
|
|
226
|
+
} catch (err) {
|
|
227
|
+
// Restore original branch on failure
|
|
228
|
+
gitAllowFail(basePath, ["cherry-pick", "--abort"]);
|
|
229
|
+
gitAllowFail(basePath, ["reset", "--hard", "HEAD"]);
|
|
230
|
+
gitAllowFail(basePath, ["checkout", currentBranch]);
|
|
231
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
232
|
+
ctx.ui.notify(`Failed to create PR branch: ${msg}`, "error");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Command — /gsd session-report
|
|
3
|
+
*
|
|
4
|
+
* Summarizes the current session: tasks completed, cost, tokens,
|
|
5
|
+
* duration, model usage breakdown.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
|
9
|
+
|
|
10
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
|
|
13
|
+
import { getLedger, getProjectTotals, aggregateByModel, formatCost, formatTokenCount, loadLedgerFromDisk } from "./metrics.js";
|
|
14
|
+
import type { UnitMetrics } from "./metrics.js";
|
|
15
|
+
import { gsdRoot } from "./paths.js";
|
|
16
|
+
import { formatDuration } from "../shared/format-utils.js";
|
|
17
|
+
|
|
18
|
+
function formatSessionReport(units: UnitMetrics[]): string {
|
|
19
|
+
const totals = getProjectTotals(units);
|
|
20
|
+
const byModel = aggregateByModel(units);
|
|
21
|
+
|
|
22
|
+
const lines: string[] = [];
|
|
23
|
+
lines.push("╭─ Session Report ──────────────────────────────────────╮");
|
|
24
|
+
|
|
25
|
+
if (totals.duration > 0) {
|
|
26
|
+
lines.push(`│ Duration: ${formatDuration(totals.duration).padEnd(40)}│`);
|
|
27
|
+
}
|
|
28
|
+
lines.push(`│ Units: ${String(units.length).padEnd(40)}│`);
|
|
29
|
+
lines.push(`│ Cost: ${formatCost(totals.cost).padEnd(40)}│`);
|
|
30
|
+
lines.push(`│ Tokens: ${`${formatTokenCount(totals.tokens.input)} in / ${formatTokenCount(totals.tokens.output)} out`.padEnd(40)}│`);
|
|
31
|
+
lines.push("│ │");
|
|
32
|
+
|
|
33
|
+
// Work completed
|
|
34
|
+
if (units.length > 0) {
|
|
35
|
+
lines.push("│ Work Completed: │");
|
|
36
|
+
for (const unit of units) {
|
|
37
|
+
const finished = unit.finishedAt > 0;
|
|
38
|
+
const status = finished ? "✓" : "•";
|
|
39
|
+
const label = ` ${status} ${unit.id ?? "unknown"}`;
|
|
40
|
+
lines.push(`│ ${label.padEnd(53)}│`);
|
|
41
|
+
}
|
|
42
|
+
lines.push("│ │");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Model usage
|
|
46
|
+
if (byModel.length > 0) {
|
|
47
|
+
lines.push("│ Model Usage: │");
|
|
48
|
+
for (const m of byModel) {
|
|
49
|
+
const label = ` ${m.model}: ${m.units} units (${formatCost(m.cost)})`;
|
|
50
|
+
lines.push(`│ ${label.padEnd(53)}│`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
lines.push("╰───────────────────────────────────────────────────────╯");
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function handleSessionReport(
|
|
59
|
+
args: string,
|
|
60
|
+
ctx: ExtensionCommandContext,
|
|
61
|
+
): Promise<void> {
|
|
62
|
+
const basePath = process.cwd();
|
|
63
|
+
|
|
64
|
+
// Get units from in-memory ledger or disk
|
|
65
|
+
const ledger = getLedger();
|
|
66
|
+
let units: UnitMetrics[];
|
|
67
|
+
|
|
68
|
+
if (ledger && ledger.units.length > 0) {
|
|
69
|
+
units = ledger.units;
|
|
70
|
+
} else {
|
|
71
|
+
const diskLedger = loadLedgerFromDisk(basePath);
|
|
72
|
+
if (!diskLedger || diskLedger.units.length === 0) {
|
|
73
|
+
ctx.ui.notify("No session data — no units have been executed yet.", "info");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
units = diskLedger.units;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// JSON output
|
|
80
|
+
if (args.includes("--json")) {
|
|
81
|
+
const totals = getProjectTotals(units);
|
|
82
|
+
const byModel = aggregateByModel(units);
|
|
83
|
+
ctx.ui.notify(JSON.stringify({ units: units.length, totals, byModel }, null, 2), "info");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Save to file
|
|
88
|
+
if (args.includes("--save")) {
|
|
89
|
+
const report = formatSessionReport(units);
|
|
90
|
+
const reportsDir = join(gsdRoot(basePath), "reports");
|
|
91
|
+
mkdirSync(reportsDir, { recursive: true });
|
|
92
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
93
|
+
const outPath = join(reportsDir, `session-${timestamp}.md`);
|
|
94
|
+
writeFileSync(outPath, `\`\`\`\n${report}\n\`\`\`\n`, "utf-8");
|
|
95
|
+
ctx.ui.notify(`Report saved: ${outPath}`, "success");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Display
|
|
100
|
+
ctx.ui.notify(formatSessionReport(units), "info");
|
|
101
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Command — /gsd ship
|
|
3
|
+
*
|
|
4
|
+
* Creates a PR from milestone artifacts: generates title + body from
|
|
5
|
+
* roadmap, slice summaries, and metrics, then opens via `gh pr create`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ExtensionAPI, ExtensionCommandContext } from "@gsd/pi-coding-agent";
|
|
9
|
+
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
12
|
+
|
|
13
|
+
import { deriveState } from "./state.js";
|
|
14
|
+
import { resolveMilestoneFile, resolveSlicePath, resolveSliceFile } from "./paths.js";
|
|
15
|
+
import { getLedger, getProjectTotals, aggregateByModel, formatCost, formatTokenCount, loadLedgerFromDisk } from "./metrics.js";
|
|
16
|
+
import { nativeGetCurrentBranch, nativeDetectMainBranch } from "./native-git-bridge.js";
|
|
17
|
+
import { formatDuration } from "../shared/format-utils.js";
|
|
18
|
+
|
|
19
|
+
function git(basePath: string, args: readonly string[]): string {
|
|
20
|
+
return execFileSync("git", args, { cwd: basePath, encoding: "utf-8" }).trim();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isValidRefName(name: string): boolean {
|
|
24
|
+
try {
|
|
25
|
+
execFileSync("git", ["check-ref-format", "--branch", name], { stdio: "pipe" });
|
|
26
|
+
return true;
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface PRContent {
|
|
33
|
+
title: string;
|
|
34
|
+
body: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function listSliceIds(basePath: string, milestoneId: string): string[] {
|
|
38
|
+
// Slices live at <milestoneDir>/slices/<sliceId>/ with canonical S\d+ IDs.
|
|
39
|
+
// Use resolveSlicePath with a probe to find the real slices directory root.
|
|
40
|
+
const probe = resolveSlicePath(basePath, milestoneId, "S01");
|
|
41
|
+
let slicesDir: string | null = null;
|
|
42
|
+
if (probe) {
|
|
43
|
+
// probe looks like <milestoneDir>/slices/S01 — parent is slices dir.
|
|
44
|
+
slicesDir = probe.replace(/[\\/][^\\/]+$/, "");
|
|
45
|
+
} else {
|
|
46
|
+
// Fall back to scanning the milestones roadmap file's sibling slices dir.
|
|
47
|
+
const roadmap = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
48
|
+
if (roadmap) {
|
|
49
|
+
slicesDir = roadmap.replace(/[\\/][^\\/]+$/, "") + "/slices";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!slicesDir || !existsSync(slicesDir)) return [];
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
return readdirSync(slicesDir, { withFileTypes: true })
|
|
56
|
+
.filter((e) => e.isDirectory() && /^S\d+$/.test(e.name))
|
|
57
|
+
.map((e) => e.name)
|
|
58
|
+
.sort();
|
|
59
|
+
} catch {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function collectSliceSummaries(basePath: string, milestoneId: string): string[] {
|
|
65
|
+
const summaries: string[] = [];
|
|
66
|
+
for (const sliceId of listSliceIds(basePath, milestoneId)) {
|
|
67
|
+
const summaryPath = resolveSliceFile(basePath, milestoneId, sliceId, "SUMMARY");
|
|
68
|
+
if (!summaryPath || !existsSync(summaryPath)) continue;
|
|
69
|
+
try {
|
|
70
|
+
const content = readFileSync(summaryPath, "utf-8").trim();
|
|
71
|
+
if (content) summaries.push(`### ${sliceId}\n${content}`);
|
|
72
|
+
} catch {
|
|
73
|
+
// non-fatal
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return summaries;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function generatePRContent(basePath: string, milestoneId: string, milestoneTitle: string): PRContent {
|
|
80
|
+
const title = `feat: ${milestoneTitle || milestoneId}`;
|
|
81
|
+
|
|
82
|
+
const sections: string[] = [];
|
|
83
|
+
|
|
84
|
+
// TL;DR
|
|
85
|
+
sections.push("## TL;DR\n");
|
|
86
|
+
sections.push(`**What:** Ship milestone ${milestoneId} — ${milestoneTitle || "(untitled)"}`);
|
|
87
|
+
sections.push(`**Why:** Milestone work complete, ready for review.`);
|
|
88
|
+
sections.push(`**How:** See slice summaries below.\n`);
|
|
89
|
+
|
|
90
|
+
// What — slice summaries
|
|
91
|
+
const summaries = collectSliceSummaries(basePath, milestoneId);
|
|
92
|
+
if (summaries.length > 0) {
|
|
93
|
+
sections.push("## What\n");
|
|
94
|
+
sections.push(summaries.join("\n\n"));
|
|
95
|
+
sections.push("");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Roadmap status
|
|
99
|
+
const roadmapPath = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
100
|
+
if (roadmapPath && existsSync(roadmapPath)) {
|
|
101
|
+
try {
|
|
102
|
+
const roadmap = readFileSync(roadmapPath, "utf-8");
|
|
103
|
+
const checkboxLines = roadmap.split("\n").filter((l) => /^\s*-\s*\[[ x]\]/.test(l));
|
|
104
|
+
if (checkboxLines.length > 0) {
|
|
105
|
+
sections.push("## Roadmap\n");
|
|
106
|
+
sections.push(checkboxLines.join("\n"));
|
|
107
|
+
sections.push("");
|
|
108
|
+
}
|
|
109
|
+
} catch {
|
|
110
|
+
// non-fatal
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Metrics
|
|
115
|
+
const ledger = getLedger();
|
|
116
|
+
const units = ledger?.units ?? loadLedgerFromDisk(basePath)?.units ?? [];
|
|
117
|
+
if (units.length > 0) {
|
|
118
|
+
const totals = getProjectTotals(units);
|
|
119
|
+
const byModel = aggregateByModel(units);
|
|
120
|
+
sections.push("## Metrics\n");
|
|
121
|
+
sections.push(`- **Units executed:** ${units.length}`);
|
|
122
|
+
sections.push(`- **Total cost:** ${formatCost(totals.cost)}`);
|
|
123
|
+
sections.push(`- **Tokens:** ${formatTokenCount(totals.tokens.input)} input / ${formatTokenCount(totals.tokens.output)} output`);
|
|
124
|
+
if (totals.duration > 0) {
|
|
125
|
+
sections.push(`- **Duration:** ${formatDuration(totals.duration)}`);
|
|
126
|
+
}
|
|
127
|
+
if (byModel.length > 0) {
|
|
128
|
+
sections.push(`- **Models:** ${byModel.map((m) => `${m.model} (${m.units} units)`).join(", ")}`);
|
|
129
|
+
}
|
|
130
|
+
sections.push("");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Change type checklist
|
|
134
|
+
sections.push("## Change type\n");
|
|
135
|
+
sections.push("- [x] `feat` — New feature or capability");
|
|
136
|
+
sections.push("- [ ] `fix` — Bug fix");
|
|
137
|
+
sections.push("- [ ] `refactor` — Code restructuring");
|
|
138
|
+
sections.push("- [ ] `test` — Adding or updating tests");
|
|
139
|
+
sections.push("- [ ] `docs` — Documentation only");
|
|
140
|
+
sections.push("- [ ] `chore` — Build, CI, or tooling changes\n");
|
|
141
|
+
|
|
142
|
+
// AI disclosure
|
|
143
|
+
sections.push("---\n");
|
|
144
|
+
sections.push("*This PR was prepared with AI assistance (GSD auto-mode).*");
|
|
145
|
+
|
|
146
|
+
return { title, body: sections.join("\n") };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export async function handleShip(
|
|
150
|
+
args: string,
|
|
151
|
+
ctx: ExtensionCommandContext,
|
|
152
|
+
_pi: ExtensionAPI,
|
|
153
|
+
): Promise<void> {
|
|
154
|
+
const basePath = process.cwd();
|
|
155
|
+
const dryRun = args.includes("--dry-run");
|
|
156
|
+
const draft = args.includes("--draft");
|
|
157
|
+
const force = args.includes("--force");
|
|
158
|
+
const baseMatch = args.match(/--base\s+(\S+)/);
|
|
159
|
+
const base = baseMatch?.[1] ?? nativeDetectMainBranch(basePath);
|
|
160
|
+
|
|
161
|
+
if (!isValidRefName(base)) {
|
|
162
|
+
ctx.ui.notify(`Invalid base branch name: ${base}`, "error");
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 1. Validate milestone state
|
|
167
|
+
const state = await deriveState(basePath);
|
|
168
|
+
if (!state.activeMilestone) {
|
|
169
|
+
ctx.ui.notify("No active milestone to ship. Complete milestone work first.", "warning");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const milestoneId = state.activeMilestone.id;
|
|
174
|
+
const milestoneTitle = state.activeMilestone.title ?? "";
|
|
175
|
+
|
|
176
|
+
// 2. Check for incomplete work (use GSD phase as proxy — no phase field on ActiveRef)
|
|
177
|
+
if (state.phase !== "complete" && !force) {
|
|
178
|
+
ctx.ui.notify(
|
|
179
|
+
`Milestone ${milestoneId} may not be complete (phase: ${state.phase}). Use --force to ship anyway.`,
|
|
180
|
+
"warning",
|
|
181
|
+
);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// 3. Generate PR content
|
|
186
|
+
const { title, body } = generatePRContent(basePath, milestoneId, milestoneTitle);
|
|
187
|
+
|
|
188
|
+
// 4. Dry-run — just show the PR content
|
|
189
|
+
if (dryRun) {
|
|
190
|
+
ctx.ui.notify(`--- PR Preview ---\n\nTitle: ${title}\n\n${body}`, "info");
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 5. Check git state
|
|
195
|
+
const currentBranch = nativeGetCurrentBranch(basePath);
|
|
196
|
+
if (!isValidRefName(currentBranch)) {
|
|
197
|
+
ctx.ui.notify(`Current branch name is invalid for git: ${currentBranch}`, "error");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (currentBranch === base) {
|
|
201
|
+
ctx.ui.notify(`You're on ${base} — create a feature branch first.`, "warning");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// 6. Push and create PR (all argv-safe, no shell interpolation)
|
|
206
|
+
try {
|
|
207
|
+
git(basePath, ["push", "-u", "origin", currentBranch]);
|
|
208
|
+
|
|
209
|
+
const ghArgs = ["pr", "create", "--base", base, "--title", title, "--body", body];
|
|
210
|
+
if (draft) ghArgs.push("--draft");
|
|
211
|
+
|
|
212
|
+
const prUrl = execFileSync("gh", ghArgs, { cwd: basePath, encoding: "utf-8" }).trim();
|
|
213
|
+
|
|
214
|
+
ctx.ui.notify(`PR created: ${prUrl}`, "success");
|
|
215
|
+
} catch (err) {
|
|
216
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
217
|
+
ctx.ui.notify(`Failed to create PR: ${msg}`, "error");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -346,8 +346,7 @@ export async function saveRequirementToDb(
|
|
|
346
346
|
} catch (diskErr) {
|
|
347
347
|
logError('manifest', 'disk write failed, rolling back DB row', { fn: 'saveRequirementToDb', error: String((diskErr as Error).message) });
|
|
348
348
|
try {
|
|
349
|
-
|
|
350
|
-
rollbackAdapter?.prepare('DELETE FROM requirements WHERE id = :id').run({ ':id': id });
|
|
349
|
+
db.deleteRequirementById(id);
|
|
351
350
|
} catch (rollbackErr) {
|
|
352
351
|
logError('manifest', 'SPLIT BRAIN: disk write failed AND DB rollback failed — DB has orphaned row', { fn: 'saveRequirementToDb', id, error: String((rollbackErr as Error).message) });
|
|
353
352
|
}
|
|
@@ -471,7 +470,7 @@ export async function saveDecisionToDb(
|
|
|
471
470
|
} catch (diskErr) {
|
|
472
471
|
logError('manifest', 'disk write failed, rolling back DB row', { fn: 'saveDecisionToDb', error: String((diskErr as Error).message) });
|
|
473
472
|
try {
|
|
474
|
-
|
|
473
|
+
db.deleteDecisionById(id);
|
|
475
474
|
} catch (rollbackErr) {
|
|
476
475
|
logError('manifest', 'SPLIT BRAIN: disk write failed AND DB rollback failed — DB has orphaned row', { fn: 'saveDecisionToDb', id, error: String((rollbackErr as Error).message) });
|
|
477
476
|
}
|
|
@@ -714,8 +713,7 @@ export async function saveArtifactToDb(
|
|
|
714
713
|
await saveFile(fullPath, opts.content);
|
|
715
714
|
} catch (diskErr) {
|
|
716
715
|
logError('manifest', 'disk write failed, rolling back DB row', { fn: 'saveArtifactToDb', error: String((diskErr as Error).message) });
|
|
717
|
-
|
|
718
|
-
rollbackAdapter?.prepare('DELETE FROM artifacts WHERE path = :path').run({ ':path': opts.path });
|
|
716
|
+
db.deleteArtifactByPath(opts.path);
|
|
719
717
|
throw diskErr;
|
|
720
718
|
}
|
|
721
719
|
}
|
|
@@ -157,7 +157,7 @@ Setting `prefer_skills: []` does **not** disable skill discovery — it just mea
|
|
|
157
157
|
|
|
158
158
|
- `phases`: fine-grained control over which phases run. Usually set by `token_profile`, but can be overridden. Keys:
|
|
159
159
|
- `skip_research`: boolean — skip milestone-level research. Default: `false`.
|
|
160
|
-
- `reassess_after_slice`: boolean — run roadmap reassessment after each completed slice. Default: `
|
|
160
|
+
- `reassess_after_slice`: boolean — run roadmap reassessment after each completed slice. Default: `true`.
|
|
161
161
|
- `skip_reassess`: boolean — force-disable roadmap reassessment even if `reassess_after_slice` is enabled. Default: `false`.
|
|
162
162
|
- `skip_slice_research`: boolean — skip per-slice research. Default: `false`.
|
|
163
163
|
|