gsd-pi 2.60.0-dev.2580e65 → 2.60.0-dev.d9052f5
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/resources/extensions/ask-user-questions.js +4 -7
- package/dist/resources/extensions/gsd/auto/phases.js +7 -15
- package/dist/resources/extensions/gsd/auto-dashboard.js +8 -21
- package/dist/resources/extensions/gsd/auto-dispatch.js +3 -6
- package/dist/resources/extensions/gsd/auto-model-selection.js +9 -58
- package/dist/resources/extensions/gsd/auto-post-unit.js +2 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +20 -36
- package/dist/resources/extensions/gsd/auto-recovery.js +18 -37
- package/dist/resources/extensions/gsd/auto-start.js +5 -9
- package/dist/resources/extensions/gsd/auto-timers.js +5 -11
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +3 -5
- package/dist/resources/extensions/gsd/auto-verification.js +2 -3
- package/dist/resources/extensions/gsd/auto-worktree.js +55 -120
- package/dist/resources/extensions/gsd/auto.js +17 -39
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +3 -6
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +10 -4
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +1 -2
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +0 -7
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +10 -11
- package/dist/resources/extensions/gsd/commands/catalog.js +0 -2
- package/dist/resources/extensions/gsd/commands-codebase.js +21 -48
- package/dist/resources/extensions/gsd/commands-inspect.js +1 -2
- package/dist/resources/extensions/gsd/commands-maintenance.js +19 -32
- package/dist/resources/extensions/gsd/complexity-classifier.js +4 -8
- package/dist/resources/extensions/gsd/custom-verification.js +2 -3
- package/dist/resources/extensions/gsd/gsd-db.js +13 -33
- package/dist/resources/extensions/gsd/guided-flow.js +9 -19
- package/dist/resources/extensions/gsd/init-wizard.js +0 -12
- package/dist/resources/extensions/gsd/markdown-renderer.js +9 -11
- package/dist/resources/extensions/gsd/md-importer.js +4 -5
- package/dist/resources/extensions/gsd/milestone-actions.js +2 -3
- package/dist/resources/extensions/gsd/milestone-ids.js +1 -2
- package/dist/resources/extensions/gsd/model-router.js +121 -156
- package/dist/resources/extensions/gsd/parallel-merge.js +3 -5
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +14 -26
- package/dist/resources/extensions/gsd/preferences-types.js +0 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +0 -45
- package/dist/resources/extensions/gsd/preferences.js +3 -15
- package/dist/resources/extensions/gsd/prompt-loader.js +2 -3
- package/dist/resources/extensions/gsd/prompts/rethink.md +1 -1
- package/dist/resources/extensions/gsd/rule-registry.js +6 -7
- package/dist/resources/extensions/gsd/safe-fs.js +8 -6
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +2 -3
- package/dist/resources/extensions/gsd/tools/complete-slice.js +2 -3
- package/dist/resources/extensions/gsd/tools/complete-task.js +2 -3
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +2 -3
- package/dist/resources/extensions/gsd/tools/plan-slice.js +2 -3
- package/dist/resources/extensions/gsd/tools/plan-task.js +1 -2
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +4 -4
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +1 -2
- package/dist/resources/extensions/gsd/tools/reopen-task.js +1 -2
- package/dist/resources/extensions/gsd/tools/replan-slice.js +1 -2
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +1 -2
- package/dist/resources/extensions/gsd/triage-resolution.js +4 -11
- package/dist/resources/extensions/gsd/workflow-events.js +1 -2
- package/dist/resources/extensions/gsd/workflow-logger.js +4 -37
- package/dist/resources/extensions/gsd/workflow-migration.js +12 -14
- package/dist/resources/extensions/gsd/workflow-projections.js +2 -2
- package/dist/resources/extensions/gsd/workflow-reconcile.js +2 -2
- package/dist/resources/extensions/gsd/worktree-manager.js +14 -26
- package/dist/resources/extensions/shared/interview-ui.js +1 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +19 -19
- 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 +2 -2
- 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 +19 -19
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +0 -5
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -2
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +0 -16
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +0 -26
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/defaults.json +2 -2
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +0 -6
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +0 -19
- package/packages/pi-coding-agent/src/core/extensions/types.ts +0 -26
- package/packages/pi-coding-agent/src/core/lsp/config.ts +1 -7
- package/packages/pi-coding-agent/src/core/lsp/defaults.json +2 -2
- package/src/resources/extensions/ask-user-questions.ts +3 -7
- package/src/resources/extensions/gsd/auto/phases.ts +7 -17
- package/src/resources/extensions/gsd/auto-dashboard.ts +8 -22
- package/src/resources/extensions/gsd/auto-dispatch.ts +3 -7
- package/src/resources/extensions/gsd/auto-model-selection.ts +15 -77
- package/src/resources/extensions/gsd/auto-post-unit.ts +4 -4
- package/src/resources/extensions/gsd/auto-prompts.ts +20 -37
- package/src/resources/extensions/gsd/auto-recovery.ts +18 -38
- package/src/resources/extensions/gsd/auto-start.ts +9 -10
- package/src/resources/extensions/gsd/auto-timers.ts +5 -12
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +2 -6
- package/src/resources/extensions/gsd/auto-verification.ts +6 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +55 -121
- package/src/resources/extensions/gsd/auto.ts +17 -40
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +3 -4
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +16 -4
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +1 -2
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +0 -8
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +10 -11
- package/src/resources/extensions/gsd/commands/catalog.ts +0 -2
- package/src/resources/extensions/gsd/commands-codebase.ts +20 -52
- package/src/resources/extensions/gsd/commands-inspect.ts +1 -2
- package/src/resources/extensions/gsd/commands-maintenance.ts +19 -28
- package/src/resources/extensions/gsd/complexity-classifier.ts +4 -9
- package/src/resources/extensions/gsd/custom-verification.ts +2 -3
- package/src/resources/extensions/gsd/gsd-db.ts +14 -12
- package/src/resources/extensions/gsd/guided-flow.ts +8 -9
- package/src/resources/extensions/gsd/init-wizard.ts +0 -12
- package/src/resources/extensions/gsd/markdown-renderer.ts +17 -11
- package/src/resources/extensions/gsd/md-importer.ts +4 -5
- package/src/resources/extensions/gsd/milestone-actions.ts +2 -3
- package/src/resources/extensions/gsd/milestone-ids.ts +1 -2
- package/src/resources/extensions/gsd/model-router.ts +173 -199
- package/src/resources/extensions/gsd/parallel-merge.ts +3 -5
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +14 -18
- package/src/resources/extensions/gsd/preferences-types.ts +0 -13
- package/src/resources/extensions/gsd/preferences-validation.ts +0 -45
- package/src/resources/extensions/gsd/preferences.ts +3 -16
- package/src/resources/extensions/gsd/prompt-loader.ts +2 -3
- package/src/resources/extensions/gsd/prompts/rethink.md +1 -1
- package/src/resources/extensions/gsd/rule-registry.ts +6 -7
- package/src/resources/extensions/gsd/safe-fs.ts +5 -6
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +0 -63
- package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +2 -27
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/model-router.test.ts +3 -403
- package/src/resources/extensions/gsd/tests/preferences.test.ts +0 -62
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +0 -21
- package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +6 -6
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +6 -3
- package/src/resources/extensions/gsd/tools/complete-slice.ts +6 -3
- package/src/resources/extensions/gsd/tools/complete-task.ts +6 -3
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +6 -3
- package/src/resources/extensions/gsd/tools/plan-slice.ts +6 -3
- package/src/resources/extensions/gsd/tools/plan-task.ts +3 -2
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +6 -4
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +3 -2
- package/src/resources/extensions/gsd/tools/reopen-task.ts +3 -2
- package/src/resources/extensions/gsd/tools/replan-slice.ts +3 -2
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +3 -2
- package/src/resources/extensions/gsd/triage-resolution.ts +4 -11
- package/src/resources/extensions/gsd/types.ts +0 -1
- package/src/resources/extensions/gsd/workflow-events.ts +1 -2
- package/src/resources/extensions/gsd/workflow-logger.ts +5 -52
- package/src/resources/extensions/gsd/workflow-migration.ts +12 -14
- package/src/resources/extensions/gsd/workflow-projections.ts +2 -2
- package/src/resources/extensions/gsd/workflow-reconcile.ts +2 -2
- package/src/resources/extensions/gsd/worktree-manager.ts +14 -16
- package/src/resources/extensions/shared/interview-ui.ts +1 -3
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.d.ts +0 -2
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.d.ts.map +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.js +0 -47
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.js.map +0 -1
- package/packages/pi-coding-agent/src/core/lsp/lsp-legacy-alias.test.ts +0 -70
- package/src/resources/extensions/gsd/tests/capability-router.test.ts +0 -347
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +0 -1188
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +0 -841
- package/src/resources/extensions/gsd/tests/silent-catch-diagnostics.test.ts +0 -284
- package/src/resources/extensions/gsd/tests/workflow-logger-audit.test.ts +0 -120
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +0 -144
- /package/dist/web/standalone/.next/static/{ogyMN7M-3bGGuRY08L5HR → JVkoVYumy0cDhOQISEYdG}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ogyMN7M-3bGGuRY08L5HR → JVkoVYumy0cDhOQISEYdG}/_ssgManifest.js +0 -0
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// and encapsulates mutable hook state as instance fields.
|
|
6
6
|
//
|
|
7
7
|
// A module-level singleton accessor allows existing code to migrate incrementally.
|
|
8
|
-
import { logWarning } from "./workflow-logger.js";
|
|
9
8
|
import { resolvePostUnitHooks, resolvePreDispatchHooks } from "./preferences.js";
|
|
10
9
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
11
10
|
import { join } from "node:path";
|
|
@@ -311,8 +310,8 @@ export class RuleRegistry {
|
|
|
311
310
|
mkdirSync(dir, { recursive: true });
|
|
312
311
|
writeFileSync(this._hookStatePath(basePath), JSON.stringify(state, null, 2), "utf-8");
|
|
313
312
|
}
|
|
314
|
-
catch
|
|
315
|
-
|
|
313
|
+
catch {
|
|
314
|
+
// Non-fatal — state is recreatable from artifacts
|
|
316
315
|
}
|
|
317
316
|
}
|
|
318
317
|
/** Restore hook cycle counts from disk after a crash/restart. */
|
|
@@ -332,8 +331,8 @@ export class RuleRegistry {
|
|
|
332
331
|
}
|
|
333
332
|
}
|
|
334
333
|
}
|
|
335
|
-
catch
|
|
336
|
-
|
|
334
|
+
catch {
|
|
335
|
+
// Non-fatal — fresh state is fine
|
|
337
336
|
}
|
|
338
337
|
}
|
|
339
338
|
/** Clear persisted hook state file from disk. */
|
|
@@ -344,8 +343,8 @@ export class RuleRegistry {
|
|
|
344
343
|
writeFileSync(filePath, JSON.stringify({ cycleCounts: {}, savedAt: new Date().toISOString() }, null, 2), "utf-8");
|
|
345
344
|
}
|
|
346
345
|
}
|
|
347
|
-
catch
|
|
348
|
-
|
|
346
|
+
catch {
|
|
347
|
+
// Non-fatal
|
|
349
348
|
}
|
|
350
349
|
}
|
|
351
350
|
// ── Hook status reporting ───────────────────────────────────────────
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, cpSync } from "node:fs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
|
-
import { logWarning } from "./workflow-logger.js";
|
|
4
3
|
/**
|
|
5
4
|
* Safely creates a directory. Returns true if successful, false on error.
|
|
6
|
-
* Logs
|
|
5
|
+
* Logs to stderr when GSD_DEBUG is set.
|
|
7
6
|
*/
|
|
8
7
|
export function safeMkdir(dirPath) {
|
|
9
8
|
try {
|
|
@@ -11,13 +10,14 @@ export function safeMkdir(dirPath) {
|
|
|
11
10
|
return true;
|
|
12
11
|
}
|
|
13
12
|
catch (err) {
|
|
14
|
-
|
|
13
|
+
if (process.env.GSD_DEBUG)
|
|
14
|
+
console.error(`[gsd] mkdir failed: ${dirPath}`, err);
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Safely copies src to dst. Returns true if successful, false if src doesn't exist or copy fails.
|
|
20
|
-
* Logs
|
|
20
|
+
* Logs to stderr when GSD_DEBUG is set.
|
|
21
21
|
*/
|
|
22
22
|
export function safeCopy(src, dst, opts) {
|
|
23
23
|
if (!existsSync(src))
|
|
@@ -27,7 +27,8 @@ export function safeCopy(src, dst, opts) {
|
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
29
29
|
catch (err) {
|
|
30
|
-
|
|
30
|
+
if (process.env.GSD_DEBUG)
|
|
31
|
+
console.error(`[gsd] copy failed: ${src} → ${dst}`, err);
|
|
31
32
|
return false;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -44,7 +45,8 @@ export function safeCopyRecursive(src, dst, opts) {
|
|
|
44
45
|
return true;
|
|
45
46
|
}
|
|
46
47
|
catch (err) {
|
|
47
|
-
|
|
48
|
+
if (process.env.GSD_DEBUG)
|
|
49
|
+
console.error(`[gsd] recursive copy failed: ${src} → ${dst}`, err);
|
|
48
50
|
return false;
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -15,7 +15,6 @@ import { invalidateStateCache } from "../state.js";
|
|
|
15
15
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
16
16
|
import { writeManifest } from "../workflow-manifest.js";
|
|
17
17
|
import { appendEvent } from "../workflow-events.js";
|
|
18
|
-
import { logWarning } from "../workflow-logger.js";
|
|
19
18
|
function renderMilestoneSummaryMarkdown(params) {
|
|
20
19
|
const now = new Date().toISOString();
|
|
21
20
|
const keyDecisionsYaml = params.keyDecisions.length > 0
|
|
@@ -141,7 +140,7 @@ export async function handleCompleteMilestone(params, basePath) {
|
|
|
141
140
|
}
|
|
142
141
|
catch (renderErr) {
|
|
143
142
|
// Disk render failed — roll back DB status so state stays consistent
|
|
144
|
-
|
|
143
|
+
process.stderr.write(`gsd-db: complete_milestone — disk render failed, rolling back DB status: ${renderErr.message}\n`);
|
|
145
144
|
updateMilestoneStatus(params.milestoneId, 'active', null);
|
|
146
145
|
invalidateStateCache();
|
|
147
146
|
return { error: `disk render failed: ${renderErr.message}` };
|
|
@@ -164,7 +163,7 @@ export async function handleCompleteMilestone(params, basePath) {
|
|
|
164
163
|
});
|
|
165
164
|
}
|
|
166
165
|
catch (hookErr) {
|
|
167
|
-
|
|
166
|
+
process.stderr.write(`gsd: complete-milestone post-mutation hook warning: ${hookErr.message}\n`);
|
|
168
167
|
}
|
|
169
168
|
return {
|
|
170
169
|
milestoneId: params.milestoneId,
|
|
@@ -18,7 +18,6 @@ import { renderRoadmapCheckboxes } from "../markdown-renderer.js";
|
|
|
18
18
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
19
19
|
import { writeManifest } from "../workflow-manifest.js";
|
|
20
20
|
import { appendEvent } from "../workflow-events.js";
|
|
21
|
-
import { logWarning } from "../workflow-logger.js";
|
|
22
21
|
/**
|
|
23
22
|
* Render slice summary markdown matching the template format.
|
|
24
23
|
* YAML frontmatter uses snake_case keys for parseSummary() compatibility.
|
|
@@ -241,7 +240,7 @@ export async function handleCompleteSlice(params, basePath) {
|
|
|
241
240
|
}
|
|
242
241
|
catch (renderErr) {
|
|
243
242
|
// Disk render failed — roll back DB status so state stays consistent
|
|
244
|
-
|
|
243
|
+
process.stderr.write(`gsd-db: complete_slice — disk render failed, rolling back DB status: ${renderErr.message}\n`);
|
|
245
244
|
updateSliceStatus(params.milestoneId, params.sliceId, 'pending');
|
|
246
245
|
invalidateStateCache();
|
|
247
246
|
return { error: `disk render failed: ${renderErr.message}` };
|
|
@@ -266,7 +265,7 @@ export async function handleCompleteSlice(params, basePath) {
|
|
|
266
265
|
});
|
|
267
266
|
}
|
|
268
267
|
catch (hookErr) {
|
|
269
|
-
|
|
268
|
+
process.stderr.write(`gsd: complete-slice post-mutation hook warning: ${hookErr.message}\n`);
|
|
270
269
|
}
|
|
271
270
|
return {
|
|
272
271
|
sliceId: params.sliceId,
|
|
@@ -18,7 +18,6 @@ import { renderPlanCheckboxes } from "../markdown-renderer.js";
|
|
|
18
18
|
import { renderAllProjections, renderSummaryContent } from "../workflow-projections.js";
|
|
19
19
|
import { writeManifest } from "../workflow-manifest.js";
|
|
20
20
|
import { appendEvent } from "../workflow-events.js";
|
|
21
|
-
import { logWarning } from "../workflow-logger.js";
|
|
22
21
|
/**
|
|
23
22
|
* Build a TaskRow-shaped object from CompleteTaskParams so the unified
|
|
24
23
|
* renderSummaryContent() can be used at completion time (#2720).
|
|
@@ -166,7 +165,7 @@ export async function handleCompleteTask(params, basePath) {
|
|
|
166
165
|
}
|
|
167
166
|
catch (renderErr) {
|
|
168
167
|
// Disk render failed — roll back DB status so state stays consistent
|
|
169
|
-
|
|
168
|
+
process.stderr.write(`gsd-db: complete_task — disk render failed, rolling back DB status: ${renderErr.message}\n`);
|
|
170
169
|
// Delete orphaned verification_evidence rows first (FK constraint
|
|
171
170
|
// references tasks, so evidence must go before status change).
|
|
172
171
|
// Without this, retries accumulate duplicate evidence rows (#2724).
|
|
@@ -195,7 +194,7 @@ export async function handleCompleteTask(params, basePath) {
|
|
|
195
194
|
});
|
|
196
195
|
}
|
|
197
196
|
catch (hookErr) {
|
|
198
|
-
|
|
197
|
+
process.stderr.write(`gsd: complete-task post-mutation hook warning: ${hookErr.message}\n`);
|
|
199
198
|
}
|
|
200
199
|
return {
|
|
201
200
|
taskId: params.taskId,
|
|
@@ -7,7 +7,6 @@ import { renderRoadmapFromDb } from "../markdown-renderer.js";
|
|
|
7
7
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
8
8
|
import { writeManifest } from "../workflow-manifest.js";
|
|
9
9
|
import { appendEvent } from "../workflow-events.js";
|
|
10
|
-
import { logWarning } from "../workflow-logger.js";
|
|
11
10
|
function validateRiskEntries(value) {
|
|
12
11
|
if (!Array.isArray(value)) {
|
|
13
12
|
throw new Error("keyRisks must be an array");
|
|
@@ -222,7 +221,7 @@ export async function handlePlanMilestone(rawParams, basePath) {
|
|
|
222
221
|
roadmapPath = renderResult.roadmapPath;
|
|
223
222
|
}
|
|
224
223
|
catch (renderErr) {
|
|
225
|
-
|
|
224
|
+
process.stderr.write(`gsd-db: plan_milestone — render failed (DB rows preserved for debugging): ${renderErr.message}\n`);
|
|
226
225
|
invalidateStateCache();
|
|
227
226
|
return { error: `render failed: ${renderErr.message}` };
|
|
228
227
|
}
|
|
@@ -242,7 +241,7 @@ export async function handlePlanMilestone(rawParams, basePath) {
|
|
|
242
241
|
});
|
|
243
242
|
}
|
|
244
243
|
catch (hookErr) {
|
|
245
|
-
|
|
244
|
+
process.stderr.write(`gsd: plan-milestone post-mutation hook warning: ${hookErr.message}\n`);
|
|
246
245
|
}
|
|
247
246
|
return {
|
|
248
247
|
milestoneId: params.milestoneId,
|
|
@@ -7,7 +7,6 @@ import { renderPlanFromDb } from "../markdown-renderer.js";
|
|
|
7
7
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
8
8
|
import { writeManifest } from "../workflow-manifest.js";
|
|
9
9
|
import { appendEvent } from "../workflow-events.js";
|
|
10
|
-
import { logWarning } from "../workflow-logger.js";
|
|
11
10
|
function validateTasks(value) {
|
|
12
11
|
if (!Array.isArray(value) || value.length === 0) {
|
|
13
12
|
throw new Error("tasks must be a non-empty array");
|
|
@@ -183,7 +182,7 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
183
182
|
});
|
|
184
183
|
}
|
|
185
184
|
catch (hookErr) {
|
|
186
|
-
|
|
185
|
+
process.stderr.write(`gsd: plan-slice post-mutation hook warning: ${hookErr.message}\n`);
|
|
187
186
|
}
|
|
188
187
|
return {
|
|
189
188
|
milestoneId: params.milestoneId,
|
|
@@ -193,7 +192,7 @@ export async function handlePlanSlice(rawParams, basePath) {
|
|
|
193
192
|
};
|
|
194
193
|
}
|
|
195
194
|
catch (renderErr) {
|
|
196
|
-
|
|
195
|
+
process.stderr.write(`gsd-db: plan_slice — render failed (DB rows preserved for debugging): ${renderErr.message}\n`);
|
|
197
196
|
invalidateStateCache();
|
|
198
197
|
return { error: `render failed: ${renderErr.message}` };
|
|
199
198
|
}
|
|
@@ -7,7 +7,6 @@ import { renderTaskPlanFromDb } from "../markdown-renderer.js";
|
|
|
7
7
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
8
8
|
import { writeManifest } from "../workflow-manifest.js";
|
|
9
9
|
import { appendEvent } from "../workflow-events.js";
|
|
10
|
-
import { logWarning } from "../workflow-logger.js";
|
|
11
10
|
function validateParams(params) {
|
|
12
11
|
if (!isNonEmptyString(params?.milestoneId))
|
|
13
12
|
throw new Error("milestoneId is required");
|
|
@@ -107,7 +106,7 @@ export async function handlePlanTask(rawParams, basePath) {
|
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
catch (hookErr) {
|
|
110
|
-
|
|
109
|
+
process.stderr.write(`gsd: plan-task post-mutation hook warning: ${hookErr.message}\n`);
|
|
111
110
|
}
|
|
112
111
|
return {
|
|
113
112
|
milestoneId: params.milestoneId,
|
|
@@ -9,7 +9,6 @@ import { renderRoadmapFromDb, renderAssessmentFromDb } from "../markdown-rendere
|
|
|
9
9
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
10
10
|
import { writeManifest } from "../workflow-manifest.js";
|
|
11
11
|
import { appendEvent } from "../workflow-events.js";
|
|
12
|
-
import { logWarning } from "../workflow-logger.js";
|
|
13
12
|
function validateParams(params) {
|
|
14
13
|
if (!isNonEmptyString(params?.milestoneId))
|
|
15
14
|
throw new Error("milestoneId is required");
|
|
@@ -183,8 +182,9 @@ export async function handleReassessRoadmap(rawParams, basePath) {
|
|
|
183
182
|
if (existsSync(validationFile))
|
|
184
183
|
unlinkSync(validationFile);
|
|
185
184
|
}
|
|
186
|
-
catch
|
|
187
|
-
|
|
185
|
+
catch {
|
|
186
|
+
// Best-effort: DB row is already deleted, so state derivation
|
|
187
|
+
// will not see the file-based verdict as authoritative.
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
// ── Invalidate caches ─────────────────────────────────────────
|
|
@@ -204,7 +204,7 @@ export async function handleReassessRoadmap(rawParams, basePath) {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
catch (hookErr) {
|
|
207
|
-
|
|
207
|
+
process.stderr.write(`gsd: reassess-roadmap post-mutation hook warning: ${hookErr.message}\n`);
|
|
208
208
|
}
|
|
209
209
|
return {
|
|
210
210
|
milestoneId: params.milestoneId,
|
|
@@ -15,7 +15,6 @@ import { isClosedStatus } from "../status-guards.js";
|
|
|
15
15
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
16
16
|
import { writeManifest } from "../workflow-manifest.js";
|
|
17
17
|
import { appendEvent } from "../workflow-events.js";
|
|
18
|
-
import { logWarning } from "../workflow-logger.js";
|
|
19
18
|
export async function handleReopenSlice(params, basePath) {
|
|
20
19
|
// ── Validate required fields ────────────────────────────────────────────
|
|
21
20
|
if (!params.sliceId || typeof params.sliceId !== "string" || params.sliceId.trim() === "") {
|
|
@@ -78,7 +77,7 @@ export async function handleReopenSlice(params, basePath) {
|
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
catch (hookErr) {
|
|
81
|
-
|
|
80
|
+
process.stderr.write(`gsd: reopen-slice post-mutation hook warning: ${hookErr.message}\n`);
|
|
82
81
|
}
|
|
83
82
|
return {
|
|
84
83
|
milestoneId: params.milestoneId,
|
|
@@ -14,7 +14,6 @@ import { isClosedStatus } from "../status-guards.js";
|
|
|
14
14
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
15
15
|
import { writeManifest } from "../workflow-manifest.js";
|
|
16
16
|
import { appendEvent } from "../workflow-events.js";
|
|
17
|
-
import { logWarning } from "../workflow-logger.js";
|
|
18
17
|
export async function handleReopenTask(params, basePath) {
|
|
19
18
|
// ── Validate required fields ────────────────────────────────────────────
|
|
20
19
|
if (!params.taskId || typeof params.taskId !== "string" || params.taskId.trim() === "") {
|
|
@@ -82,7 +81,7 @@ export async function handleReopenTask(params, basePath) {
|
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
catch (hookErr) {
|
|
85
|
-
|
|
84
|
+
process.stderr.write(`gsd: reopen-task post-mutation hook warning: ${hookErr.message}\n`);
|
|
86
85
|
}
|
|
87
86
|
return {
|
|
88
87
|
milestoneId: params.milestoneId,
|
|
@@ -7,7 +7,6 @@ import { renderPlanFromDb, renderReplanFromDb } from "../markdown-renderer.js";
|
|
|
7
7
|
import { renderAllProjections } from "../workflow-projections.js";
|
|
8
8
|
import { writeManifest } from "../workflow-manifest.js";
|
|
9
9
|
import { appendEvent } from "../workflow-events.js";
|
|
10
|
-
import { logWarning } from "../workflow-logger.js";
|
|
11
10
|
function validateParams(params) {
|
|
12
11
|
if (!isNonEmptyString(params?.milestoneId))
|
|
13
12
|
throw new Error("milestoneId is required");
|
|
@@ -174,7 +173,7 @@ export async function handleReplanSlice(rawParams, basePath) {
|
|
|
174
173
|
});
|
|
175
174
|
}
|
|
176
175
|
catch (hookErr) {
|
|
177
|
-
|
|
176
|
+
process.stderr.write(`gsd: replan-slice post-mutation hook warning: ${hookErr.message}\n`);
|
|
178
177
|
}
|
|
179
178
|
return {
|
|
180
179
|
milestoneId: params.milestoneId,
|
|
@@ -15,7 +15,6 @@ import { saveFile, clearParseCache } from "../files.js";
|
|
|
15
15
|
import { invalidateStateCache } from "../state.js";
|
|
16
16
|
import { VALIDATION_VERDICTS, isValidMilestoneVerdict } from "../verdict-parser.js";
|
|
17
17
|
import { insertMilestoneValidationGates } from "../milestone-validation-gates.js";
|
|
18
|
-
import { logWarning } from "../workflow-logger.js";
|
|
19
18
|
function renderValidationMarkdown(params) {
|
|
20
19
|
let md = `---
|
|
21
20
|
verdict: ${params.verdict}
|
|
@@ -96,7 +95,7 @@ export async function handleValidateMilestone(params, basePath) {
|
|
|
96
95
|
await saveFile(validationPath, validationMd);
|
|
97
96
|
}
|
|
98
97
|
catch (renderErr) {
|
|
99
|
-
|
|
98
|
+
process.stderr.write(`gsd-db: validate_milestone — disk render failed, rolling back DB row: ${renderErr.message}\n`);
|
|
100
99
|
deleteAssessmentByScope(params.milestoneId, 'milestone-validation');
|
|
101
100
|
return { error: `disk render failed: ${renderErr.message}` };
|
|
102
101
|
}
|
|
@@ -113,17 +113,10 @@ export function executeReplan(basePath, mid, sid, capture) {
|
|
|
113
113
|
*/
|
|
114
114
|
export function executeBacktrack(basePath, currentMilestoneId, capture) {
|
|
115
115
|
try {
|
|
116
|
-
// Extract target milestone from capture text or resolution
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
const allMatches = [...sourceText.matchAll(/\b(M\d{3}(?:-[a-z0-9]{6})?)\b/g)]
|
|
121
|
-
.map(m => m[1])
|
|
122
|
-
.filter(id => id !== currentMilestoneId);
|
|
123
|
-
// Reject ambiguous multi-target strings — if more than one distinct target remains,
|
|
124
|
-
// don't guess; let the user clarify.
|
|
125
|
-
const uniqueTargets = [...new Set(allMatches)];
|
|
126
|
-
const targetMilestoneId = uniqueTargets.length === 1 ? uniqueTargets[0] : null;
|
|
116
|
+
// Extract target milestone from capture text or resolution
|
|
117
|
+
const targetMatch = (capture.resolution ?? capture.text)
|
|
118
|
+
.match(/\b(M\d{3}(?:-[a-z0-9]{6})?)\b/);
|
|
119
|
+
const targetMilestoneId = targetMatch?.[1] ?? null;
|
|
127
120
|
const ts = new Date().toISOString();
|
|
128
121
|
const triggerPath = join(gsdRoot(basePath), "BACKTRACK-TRIGGER.md");
|
|
129
122
|
const content = [
|
|
@@ -2,7 +2,6 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { appendFileSync, readFileSync, existsSync, mkdirSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { atomicWriteSync } from "./atomic-write.js";
|
|
5
|
-
import { logWarning } from "./workflow-logger.js";
|
|
6
5
|
// ─── Session ID ───────────────────────────────────────────────────────────
|
|
7
6
|
/**
|
|
8
7
|
* Engine-generated session ID — stable for the lifetime of this process.
|
|
@@ -50,7 +49,7 @@ export function readEvents(logPath) {
|
|
|
50
49
|
events.push(JSON.parse(line));
|
|
51
50
|
}
|
|
52
51
|
catch {
|
|
53
|
-
|
|
52
|
+
process.stderr.write(`workflow-events: skipping corrupted event line: ${line.slice(0, 80)}\n`);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
return events;
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Centralized warning/error accumulator for the workflow engine pipeline.
|
|
3
3
|
// Captures structured entries that the auto-loop can drain after each unit
|
|
4
4
|
// to surface root causes for stuck loops, silent degradation, and blocked writes.
|
|
5
|
-
//
|
|
6
|
-
// post-mortem analysis. Warnings are ephemeral (stderr + buffer only) to avoid
|
|
7
|
-
// log amplification from expected-control-flow catch paths.
|
|
5
|
+
// All entries are also persisted to .gsd/audit-log.jsonl for post-mortem analysis.
|
|
8
6
|
//
|
|
9
7
|
// Stderr policy: every logWarning/logError call writes immediately to stderr
|
|
10
8
|
// for terminal visibility. This is intentional — unlike debug-logger (which is
|
|
@@ -179,15 +177,12 @@ function _push(severity, component, message, context) {
|
|
|
179
177
|
if (_buffer.length > MAX_BUFFER) {
|
|
180
178
|
_buffer.shift();
|
|
181
179
|
}
|
|
182
|
-
// Persist
|
|
183
|
-
|
|
184
|
-
// to avoid log amplification from expected-control-flow catch paths.
|
|
185
|
-
if (_auditBasePath && severity === "error") {
|
|
180
|
+
// Persist to .gsd/audit-log.jsonl so entries survive context resets
|
|
181
|
+
if (_auditBasePath) {
|
|
186
182
|
try {
|
|
187
183
|
const auditDir = join(_auditBasePath, ".gsd");
|
|
188
184
|
mkdirSync(auditDir, { recursive: true });
|
|
189
|
-
|
|
190
|
-
appendFileSync(join(auditDir, "audit-log.jsonl"), JSON.stringify(sanitized) + "\n", "utf-8");
|
|
185
|
+
appendFileSync(join(auditDir, "audit-log.jsonl"), JSON.stringify(entry) + "\n", "utf-8");
|
|
191
186
|
}
|
|
192
187
|
catch (auditErr) {
|
|
193
188
|
// Best-effort — never let audit write failures bubble up
|
|
@@ -195,31 +190,3 @@ function _push(severity, component, message, context) {
|
|
|
195
190
|
}
|
|
196
191
|
}
|
|
197
192
|
}
|
|
198
|
-
/**
|
|
199
|
-
* Sanitize a log entry before persisting to the audit JSONL file.
|
|
200
|
-
* Strips potentially sensitive context (raw paths, cwd, full error text)
|
|
201
|
-
* to avoid leaking local environment details into durable telemetry.
|
|
202
|
-
*/
|
|
203
|
-
function _sanitizeForAudit(entry) {
|
|
204
|
-
const sanitized = {
|
|
205
|
-
ts: entry.ts,
|
|
206
|
-
severity: entry.severity,
|
|
207
|
-
component: entry.component,
|
|
208
|
-
// Truncate message to avoid persisting oversized raw error dumps
|
|
209
|
-
message: entry.message.length > 200 ? entry.message.slice(0, 200) + "…[truncated]" : entry.message,
|
|
210
|
-
};
|
|
211
|
-
if (entry.context) {
|
|
212
|
-
// Allowlist: only persist known-safe structured keys
|
|
213
|
-
const SAFE_KEYS = new Set(["fn", "tool", "mid", "sid", "tid", "worktree"]);
|
|
214
|
-
const filtered = {};
|
|
215
|
-
for (const [k, v] of Object.entries(entry.context)) {
|
|
216
|
-
if (SAFE_KEYS.has(k)) {
|
|
217
|
-
filtered[k] = v;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
if (Object.keys(filtered).length > 0) {
|
|
221
|
-
sanitized.context = filtered;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return sanitized;
|
|
225
|
-
}
|
|
@@ -6,7 +6,6 @@ import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { _getAdapter, transaction } from "./gsd-db.js";
|
|
8
8
|
import { parseRoadmap, parsePlan } from "./parsers-legacy.js";
|
|
9
|
-
import { logWarning } from "./workflow-logger.js";
|
|
10
9
|
// ─── needsAutoMigration ───────────────────────────────────────────────────
|
|
11
10
|
/**
|
|
12
11
|
* Returns true when engine tables are empty AND a .gsd/milestones/ directory
|
|
@@ -23,8 +22,8 @@ export function needsAutoMigration(basePath) {
|
|
|
23
22
|
if (row && row["cnt"] > 0)
|
|
24
23
|
return false;
|
|
25
24
|
}
|
|
26
|
-
catch
|
|
27
|
-
|
|
25
|
+
catch {
|
|
26
|
+
// Table might not exist yet — that's fine, we can still migrate
|
|
28
27
|
return false;
|
|
29
28
|
}
|
|
30
29
|
// Check if .gsd/milestones/ directory exists
|
|
@@ -67,7 +66,7 @@ export function migrateFromMarkdown(basePath) {
|
|
|
67
66
|
.map(e => e.name);
|
|
68
67
|
}
|
|
69
68
|
catch {
|
|
70
|
-
|
|
69
|
+
process.stderr.write("workflow-migration: failed to read milestones directory\n");
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
72
|
if (milestoneDirs.length === 0) {
|
|
@@ -103,7 +102,7 @@ export function migrateFromMarkdown(basePath) {
|
|
|
103
102
|
}));
|
|
104
103
|
}
|
|
105
104
|
catch (err) {
|
|
106
|
-
|
|
105
|
+
process.stderr.write(`workflow-migration: failed to parse ROADMAP.md for ${mId}: ${err.message}\n`);
|
|
107
106
|
// Still add milestone with ID as title
|
|
108
107
|
milestoneInserts.push({ id: mId, title: mId, status: milestoneStatus });
|
|
109
108
|
}
|
|
@@ -149,7 +148,7 @@ export function migrateFromMarkdown(basePath) {
|
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
catch (err) {
|
|
152
|
-
|
|
151
|
+
process.stderr.write(`workflow-migration: failed to parse ${slice.id}-PLAN.md for ${mId}: ${err.message}\n`);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
}
|
|
@@ -164,8 +163,8 @@ export function migrateFromMarkdown(basePath) {
|
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
|
-
catch
|
|
168
|
-
|
|
166
|
+
catch {
|
|
167
|
+
// Non-fatal
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
170
|
// Execute all inserts atomically
|
|
@@ -246,20 +245,19 @@ export function validateMigration(basePath) {
|
|
|
246
245
|
const plan = parsePlan(planContent);
|
|
247
246
|
mdTaskCount += plan.tasks.length;
|
|
248
247
|
}
|
|
249
|
-
catch
|
|
250
|
-
|
|
248
|
+
catch {
|
|
249
|
+
// Skip unreadable plan
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
|
-
catch
|
|
256
|
-
|
|
254
|
+
catch {
|
|
255
|
+
// Skip unreadable roadmap
|
|
257
256
|
}
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
catch
|
|
262
|
-
logWarning("migration", `Validation failed to read markdown: ${e.message}`);
|
|
260
|
+
catch {
|
|
263
261
|
return { discrepancies: ["Failed to read markdown for validation"] };
|
|
264
262
|
}
|
|
265
263
|
// Compare counts
|
|
@@ -371,7 +371,7 @@ export function regenerateIfMissing(basePath, milestoneId, sliceId, fileType) {
|
|
|
371
371
|
regenerated++;
|
|
372
372
|
}
|
|
373
373
|
catch (err) {
|
|
374
|
-
|
|
374
|
+
console.error(`[projections] regenerateIfMissing SUMMARY failed for ${task.id}:`, err);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -399,7 +399,7 @@ export function regenerateIfMissing(basePath, milestoneId, sliceId, fileType) {
|
|
|
399
399
|
return true;
|
|
400
400
|
}
|
|
401
401
|
catch (err) {
|
|
402
|
-
|
|
402
|
+
console.error(`[projections] regenerateIfMissing ${fileType} failed:`, err);
|
|
403
403
|
return false;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
@@ -375,8 +375,8 @@ function parseEventBlock(block) {
|
|
|
375
375
|
try {
|
|
376
376
|
params = JSON.parse(paramsMatch[1]);
|
|
377
377
|
}
|
|
378
|
-
catch
|
|
379
|
-
|
|
378
|
+
catch {
|
|
379
|
+
// Keep empty params on parse error
|
|
380
380
|
}
|
|
381
381
|
i++; // consume params line
|
|
382
382
|
}
|