gsd-pi 2.60.0-dev.d9052f5 → 2.61.0-dev.7aed0bf
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 +7 -4
- package/dist/resources/extensions/gsd/auto/phases.js +15 -7
- package/dist/resources/extensions/gsd/auto-dashboard.js +21 -8
- package/dist/resources/extensions/gsd/auto-dispatch.js +6 -3
- package/dist/resources/extensions/gsd/auto-model-selection.js +58 -9
- package/dist/resources/extensions/gsd/auto-post-unit.js +3 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +36 -20
- package/dist/resources/extensions/gsd/auto-recovery.js +37 -18
- package/dist/resources/extensions/gsd/auto-start.js +9 -5
- package/dist/resources/extensions/gsd/auto-timers.js +11 -5
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +5 -3
- package/dist/resources/extensions/gsd/auto-verification.js +3 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +120 -55
- package/dist/resources/extensions/gsd/auto.js +39 -17
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +6 -3
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +4 -10
- package/dist/resources/extensions/gsd/bootstrap/journal-tools.js +2 -1
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +7 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +11 -10
- package/dist/resources/extensions/gsd/commands/catalog.js +2 -0
- package/dist/resources/extensions/gsd/commands-codebase.js +48 -21
- package/dist/resources/extensions/gsd/commands-inspect.js +2 -1
- package/dist/resources/extensions/gsd/commands-maintenance.js +32 -19
- package/dist/resources/extensions/gsd/complexity-classifier.js +8 -4
- package/dist/resources/extensions/gsd/custom-verification.js +3 -2
- package/dist/resources/extensions/gsd/gsd-db.js +33 -13
- package/dist/resources/extensions/gsd/guided-flow.js +19 -9
- package/dist/resources/extensions/gsd/init-wizard.js +12 -0
- package/dist/resources/extensions/gsd/markdown-renderer.js +11 -9
- package/dist/resources/extensions/gsd/md-importer.js +5 -4
- package/dist/resources/extensions/gsd/milestone-actions.js +3 -2
- package/dist/resources/extensions/gsd/milestone-ids.js +2 -1
- package/dist/resources/extensions/gsd/model-router.js +156 -121
- package/dist/resources/extensions/gsd/parallel-merge.js +5 -3
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +26 -14
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +45 -0
- package/dist/resources/extensions/gsd/preferences.js +15 -3
- package/dist/resources/extensions/gsd/prompt-loader.js +3 -2
- package/dist/resources/extensions/gsd/prompts/rethink.md +1 -1
- package/dist/resources/extensions/gsd/rule-registry.js +7 -6
- package/dist/resources/extensions/gsd/safe-fs.js +6 -8
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +3 -2
- package/dist/resources/extensions/gsd/tools/complete-slice.js +3 -2
- package/dist/resources/extensions/gsd/tools/complete-task.js +3 -2
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +3 -2
- package/dist/resources/extensions/gsd/tools/plan-slice.js +3 -2
- package/dist/resources/extensions/gsd/tools/plan-task.js +2 -1
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +4 -4
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +2 -1
- package/dist/resources/extensions/gsd/tools/reopen-task.js +2 -1
- package/dist/resources/extensions/gsd/tools/replan-slice.js +2 -1
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +2 -1
- package/dist/resources/extensions/gsd/triage-resolution.js +11 -4
- package/dist/resources/extensions/gsd/workflow-events.js +2 -1
- package/dist/resources/extensions/gsd/workflow-logger.js +37 -4
- package/dist/resources/extensions/gsd/workflow-migration.js +14 -12
- 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 +26 -14
- package/dist/resources/extensions/shared/interview-ui.js +3 -1
- 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 +5 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +16 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +26 -0
- 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 +6 -1
- 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/dist/core/lsp/lsp-legacy-alias.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.js +47 -0
- package/packages/pi-coding-agent/dist/core/lsp/lsp-legacy-alias.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +6 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +19 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +26 -0
- package/packages/pi-coding-agent/src/core/lsp/config.ts +7 -1
- package/packages/pi-coding-agent/src/core/lsp/defaults.json +2 -2
- package/packages/pi-coding-agent/src/core/lsp/lsp-legacy-alias.test.ts +70 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/ask-user-questions.ts +7 -3
- package/src/resources/extensions/gsd/auto/phases.ts +17 -7
- package/src/resources/extensions/gsd/auto-dashboard.ts +22 -8
- package/src/resources/extensions/gsd/auto-dispatch.ts +7 -3
- package/src/resources/extensions/gsd/auto-model-selection.ts +77 -15
- package/src/resources/extensions/gsd/auto-post-unit.ts +4 -4
- package/src/resources/extensions/gsd/auto-prompts.ts +37 -20
- package/src/resources/extensions/gsd/auto-recovery.ts +38 -18
- package/src/resources/extensions/gsd/auto-start.ts +10 -9
- package/src/resources/extensions/gsd/auto-timers.ts +12 -5
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +6 -2
- package/src/resources/extensions/gsd/auto-verification.ts +3 -6
- package/src/resources/extensions/gsd/auto-worktree.ts +121 -55
- package/src/resources/extensions/gsd/auto.ts +40 -17
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +4 -3
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +4 -16
- package/src/resources/extensions/gsd/bootstrap/journal-tools.ts +2 -1
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +8 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +11 -10
- package/src/resources/extensions/gsd/commands/catalog.ts +2 -0
- package/src/resources/extensions/gsd/commands-codebase.ts +52 -20
- package/src/resources/extensions/gsd/commands-inspect.ts +2 -1
- package/src/resources/extensions/gsd/commands-maintenance.ts +28 -19
- package/src/resources/extensions/gsd/complexity-classifier.ts +9 -4
- package/src/resources/extensions/gsd/custom-verification.ts +3 -2
- package/src/resources/extensions/gsd/gsd-db.ts +12 -14
- package/src/resources/extensions/gsd/guided-flow.ts +9 -8
- package/src/resources/extensions/gsd/init-wizard.ts +12 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +11 -17
- package/src/resources/extensions/gsd/md-importer.ts +5 -4
- package/src/resources/extensions/gsd/milestone-actions.ts +3 -2
- package/src/resources/extensions/gsd/milestone-ids.ts +2 -1
- package/src/resources/extensions/gsd/model-router.ts +199 -173
- package/src/resources/extensions/gsd/parallel-merge.ts +5 -3
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +18 -14
- package/src/resources/extensions/gsd/preferences-types.ts +13 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +45 -0
- package/src/resources/extensions/gsd/preferences.ts +16 -3
- package/src/resources/extensions/gsd/prompt-loader.ts +3 -2
- package/src/resources/extensions/gsd/prompts/rethink.md +1 -1
- package/src/resources/extensions/gsd/rule-registry.ts +7 -6
- package/src/resources/extensions/gsd/safe-fs.ts +6 -5
- package/src/resources/extensions/gsd/tests/capability-router.test.ts +347 -0
- package/src/resources/extensions/gsd/tests/codebase-generator.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/complexity-classifier.test.ts +27 -2
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +1188 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +841 -0
- package/src/resources/extensions/gsd/tests/model-router.test.ts +403 -3
- package/src/resources/extensions/gsd/tests/preferences.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/remote-questions.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/silent-catch-diagnostics.test.ts +284 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-audit.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +6 -6
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +3 -6
- package/src/resources/extensions/gsd/tools/complete-slice.ts +3 -6
- package/src/resources/extensions/gsd/tools/complete-task.ts +3 -6
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +3 -6
- package/src/resources/extensions/gsd/tools/plan-slice.ts +3 -6
- package/src/resources/extensions/gsd/tools/plan-task.ts +2 -3
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +4 -6
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +2 -3
- package/src/resources/extensions/gsd/tools/reopen-task.ts +2 -3
- package/src/resources/extensions/gsd/tools/replan-slice.ts +2 -3
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +2 -3
- package/src/resources/extensions/gsd/triage-resolution.ts +11 -4
- package/src/resources/extensions/gsd/types.ts +1 -0
- package/src/resources/extensions/gsd/workflow-events.ts +2 -1
- package/src/resources/extensions/gsd/workflow-logger.ts +52 -5
- package/src/resources/extensions/gsd/workflow-migration.ts +14 -12
- 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 +16 -14
- package/src/resources/extensions/shared/interview-ui.ts +3 -1
- package/src/resources/extensions/shared/tests/interview-notes-loop.test.ts +144 -0
- /package/dist/web/standalone/.next/static/{JVkoVYumy0cDhOQISEYdG → b7FOoMHaUb3FPoLNbxar4}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{JVkoVYumy0cDhOQISEYdG → b7FOoMHaUb3FPoLNbxar4}/_ssgManifest.js +0 -0
|
@@ -38,15 +38,18 @@ const UNIT_TYPE_TIERS = {
|
|
|
38
38
|
export function classifyUnitComplexity(unitType, unitId, basePath, budgetPct, metadata) {
|
|
39
39
|
// Hook units default to light
|
|
40
40
|
if (unitType.startsWith("hook/")) {
|
|
41
|
-
const result = { tier: "light", reason: "hook unit", downgraded: false };
|
|
41
|
+
const result = { tier: "light", reason: "hook unit", downgraded: false, taskMetadata: undefined };
|
|
42
42
|
return applyBudgetPressure(result, budgetPct);
|
|
43
43
|
}
|
|
44
44
|
// Start with the default tier for this unit type
|
|
45
45
|
let tier = UNIT_TYPE_TIERS[unitType] ?? "standard";
|
|
46
46
|
let reason = `unit type: ${unitType}`;
|
|
47
|
+
let taskMeta;
|
|
47
48
|
// For execute-task, analyze task metadata for complexity signals
|
|
48
49
|
if (unitType === "execute-task") {
|
|
49
|
-
|
|
50
|
+
// Extract metadata once and reuse throughout to avoid double-extraction
|
|
51
|
+
taskMeta = metadata ?? extractTaskMetadata(unitId, basePath);
|
|
52
|
+
const taskAnalysis = analyzeTaskComplexity(unitId, basePath, taskMeta);
|
|
50
53
|
tier = taskAnalysis.tier;
|
|
51
54
|
reason = taskAnalysis.reason;
|
|
52
55
|
}
|
|
@@ -59,13 +62,14 @@ export function classifyUnitComplexity(unitType, unitId, basePath, budgetPct, me
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
// Adaptive learning: check if history suggests bumping the tier
|
|
62
|
-
|
|
65
|
+
// Use already-extracted taskMeta.tags if available to avoid double-extraction
|
|
66
|
+
const tags = taskMeta?.tags ?? metadata?.tags;
|
|
63
67
|
const adaptiveAdjustment = getAdaptiveTierAdjustment(unitType, tier, tags);
|
|
64
68
|
if (adaptiveAdjustment && tierOrdinal(adaptiveAdjustment) > tierOrdinal(tier)) {
|
|
65
69
|
reason = `${reason} (adaptive: high failure rate at ${tier})`;
|
|
66
70
|
tier = adaptiveAdjustment;
|
|
67
71
|
}
|
|
68
|
-
const result = { tier, reason, downgraded: false };
|
|
72
|
+
const result = { tier, reason, downgraded: false, taskMetadata: taskMeta };
|
|
69
73
|
return applyBudgetPressure(result, budgetPct);
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* - content-heuristic logs the specific failure (missing file, below minSize, pattern mismatch).
|
|
17
17
|
* - The frozen DEFINITION.yaml on disk is the single source of truth for step policies.
|
|
18
18
|
*/
|
|
19
|
+
import { logWarning } from "./workflow-logger.js";
|
|
19
20
|
import { readFileSync, existsSync, statSync } from "node:fs";
|
|
20
21
|
import { resolve, sep } from "node:path";
|
|
21
22
|
import { spawnSync } from "node:child_process";
|
|
@@ -105,8 +106,8 @@ function handleContentHeuristic(runDir, step, verify) {
|
|
|
105
106
|
return "pause";
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
catch {
|
|
109
|
-
|
|
109
|
+
catch (e) {
|
|
110
|
+
logWarning("engine", `content-heuristic regex failed: ${e.message}`);
|
|
110
111
|
return "pause";
|
|
111
112
|
}
|
|
112
113
|
}
|
|
@@ -8,7 +8,7 @@ import { createRequire } from "node:module";
|
|
|
8
8
|
import { existsSync, copyFileSync, mkdirSync, realpathSync } from "node:fs";
|
|
9
9
|
import { dirname } from "node:path";
|
|
10
10
|
import { GSDError, GSD_STALE_STATE } from "./errors.js";
|
|
11
|
-
import { logError } from "./workflow-logger.js";
|
|
11
|
+
import { logError, logWarning } from "./workflow-logger.js";
|
|
12
12
|
const _require = createRequire(import.meta.url);
|
|
13
13
|
let providerName = null;
|
|
14
14
|
let providerModule = null;
|
|
@@ -710,7 +710,9 @@ export function openDatabase(path) {
|
|
|
710
710
|
try {
|
|
711
711
|
adapter.close();
|
|
712
712
|
}
|
|
713
|
-
catch {
|
|
713
|
+
catch (e) {
|
|
714
|
+
logWarning("db", `close after VACUUM failed: ${e.message}`);
|
|
715
|
+
}
|
|
714
716
|
throw retryErr;
|
|
715
717
|
}
|
|
716
718
|
}
|
|
@@ -718,7 +720,9 @@ export function openDatabase(path) {
|
|
|
718
720
|
try {
|
|
719
721
|
adapter.close();
|
|
720
722
|
}
|
|
721
|
-
catch {
|
|
723
|
+
catch (e) {
|
|
724
|
+
logWarning("db", `close after VACUUM failed: ${e.message}`);
|
|
725
|
+
}
|
|
722
726
|
throw err;
|
|
723
727
|
}
|
|
724
728
|
}
|
|
@@ -730,7 +734,9 @@ export function openDatabase(path) {
|
|
|
730
734
|
process.on("exit", () => { try {
|
|
731
735
|
closeDatabase();
|
|
732
736
|
}
|
|
733
|
-
catch {
|
|
737
|
+
catch (e) {
|
|
738
|
+
logWarning("db", `exit handler close failed: ${e.message}`);
|
|
739
|
+
} });
|
|
734
740
|
}
|
|
735
741
|
return true;
|
|
736
742
|
}
|
|
@@ -739,17 +745,21 @@ export function closeDatabase() {
|
|
|
739
745
|
try {
|
|
740
746
|
currentDb.exec('PRAGMA wal_checkpoint(TRUNCATE)');
|
|
741
747
|
}
|
|
742
|
-
catch {
|
|
748
|
+
catch (e) {
|
|
749
|
+
logWarning("db", `WAL checkpoint failed: ${e.message}`);
|
|
750
|
+
}
|
|
743
751
|
try {
|
|
744
752
|
// Incremental vacuum to reclaim space without blocking
|
|
745
753
|
currentDb.exec('PRAGMA incremental_vacuum(64)');
|
|
746
754
|
}
|
|
747
|
-
catch {
|
|
755
|
+
catch (e) {
|
|
756
|
+
logWarning("db", `incremental vacuum failed: ${e.message}`);
|
|
757
|
+
}
|
|
748
758
|
try {
|
|
749
759
|
currentDb.close();
|
|
750
760
|
}
|
|
751
|
-
catch {
|
|
752
|
-
|
|
761
|
+
catch (e) {
|
|
762
|
+
logWarning("db", `database close failed: ${e.message}`);
|
|
753
763
|
}
|
|
754
764
|
currentDb = null;
|
|
755
765
|
currentPath = null;
|
|
@@ -763,7 +773,9 @@ export function vacuumDatabase() {
|
|
|
763
773
|
try {
|
|
764
774
|
currentDb.exec('VACUUM');
|
|
765
775
|
}
|
|
766
|
-
catch {
|
|
776
|
+
catch (e) {
|
|
777
|
+
logWarning("db", `VACUUM failed: ${e.message}`);
|
|
778
|
+
}
|
|
767
779
|
}
|
|
768
780
|
let _txDepth = 0;
|
|
769
781
|
export function transaction(fn) {
|
|
@@ -961,7 +973,9 @@ export function clearArtifacts() {
|
|
|
961
973
|
try {
|
|
962
974
|
currentDb.exec("DELETE FROM artifacts");
|
|
963
975
|
}
|
|
964
|
-
catch {
|
|
976
|
+
catch (e) {
|
|
977
|
+
logWarning("db", `clearArtifacts failed: ${e.message}`);
|
|
978
|
+
}
|
|
965
979
|
}
|
|
966
980
|
export function insertArtifact(a) {
|
|
967
981
|
if (!currentDb)
|
|
@@ -1488,7 +1502,9 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1488
1502
|
if (realpathSync(mainDbPath) === realpathSync(worktreeDbPath))
|
|
1489
1503
|
return zero;
|
|
1490
1504
|
}
|
|
1491
|
-
catch {
|
|
1505
|
+
catch (e) {
|
|
1506
|
+
logWarning("db", `realpathSync failed: ${e.message}`);
|
|
1507
|
+
}
|
|
1492
1508
|
// Sanitize path: reject any characters that could break ATTACH syntax.
|
|
1493
1509
|
// ATTACH DATABASE doesn't support parameterized paths in all providers,
|
|
1494
1510
|
// so we use strict allowlist validation instead.
|
|
@@ -1610,7 +1626,9 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1610
1626
|
try {
|
|
1611
1627
|
adapter.exec("ROLLBACK");
|
|
1612
1628
|
}
|
|
1613
|
-
catch {
|
|
1629
|
+
catch (e) {
|
|
1630
|
+
logWarning("db", `rollback failed: ${e.message}`);
|
|
1631
|
+
}
|
|
1614
1632
|
throw txErr;
|
|
1615
1633
|
}
|
|
1616
1634
|
return { ...merged, conflicts };
|
|
@@ -1619,7 +1637,9 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1619
1637
|
try {
|
|
1620
1638
|
adapter.exec("DETACH DATABASE wt");
|
|
1621
1639
|
}
|
|
1622
|
-
catch {
|
|
1640
|
+
catch (e) {
|
|
1641
|
+
logWarning("db", `detach worktree DB failed: ${e.message}`);
|
|
1642
|
+
}
|
|
1623
1643
|
}
|
|
1624
1644
|
}
|
|
1625
1645
|
catch (err) {
|
|
@@ -37,6 +37,7 @@ import { selectAndApplyModel } from "./auto-model-selection.js";
|
|
|
37
37
|
export { MILESTONE_ID_RE, generateMilestoneSuffix, nextMilestoneId, extractMilestoneSeq, parseMilestoneId, milestoneIdSort, maxMilestoneNum, findMilestoneIds, reserveMilestoneId, claimReservedId, getReservedMilestoneIds, clearReservedMilestoneIds, } from "./milestone-ids.js";
|
|
38
38
|
export { showQueue, handleQueueReorder, showQueueAdd, buildExistingMilestonesContext, } from "./guided-flow-queue.js";
|
|
39
39
|
import { getErrorMessage } from "./error-utils.js";
|
|
40
|
+
import { logWarning } from "./workflow-logger.js";
|
|
40
41
|
// ─── ID Generation with Reservation ─────────────────────────────────────────
|
|
41
42
|
/**
|
|
42
43
|
* Generate the next milestone ID, accounting for reserved IDs, and reserve it.
|
|
@@ -144,7 +145,9 @@ export function checkAutoStartAfterDiscuss() {
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
|
-
catch {
|
|
148
|
+
catch (e) {
|
|
149
|
+
logWarning("guided", `PROJECT.md parsing failed: ${e.message}`);
|
|
150
|
+
}
|
|
148
151
|
}
|
|
149
152
|
// Gate 4: Discussion manifest process verification (multi-milestone only)
|
|
150
153
|
// The LLM writes DISCUSSION-MANIFEST.json after each Phase 3 gate decision.
|
|
@@ -171,7 +174,9 @@ export function checkAutoStartAfterDiscuss() {
|
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
|
-
catch {
|
|
177
|
+
catch (e) {
|
|
178
|
+
logWarning("guided", `discussion manifest verification failed: ${e.message}`);
|
|
179
|
+
}
|
|
175
180
|
}
|
|
176
181
|
// Draft promotion cleanup: if a CONTEXT-DRAFT.md exists alongside the new
|
|
177
182
|
// CONTEXT.md, delete the draft — it's been consumed by the discussion.
|
|
@@ -180,18 +185,21 @@ export function checkAutoStartAfterDiscuss() {
|
|
|
180
185
|
if (draftFile)
|
|
181
186
|
unlinkSync(draftFile);
|
|
182
187
|
}
|
|
183
|
-
catch {
|
|
188
|
+
catch (e) {
|
|
189
|
+
logWarning("guided", `CONTEXT-DRAFT.md unlink failed: ${e.message}`);
|
|
190
|
+
}
|
|
184
191
|
// Cleanup: remove discussion manifest after auto-start (only needed during discussion)
|
|
185
192
|
try {
|
|
186
193
|
unlinkSync(manifestPath);
|
|
187
194
|
}
|
|
188
|
-
catch {
|
|
195
|
+
catch (e) {
|
|
196
|
+
logWarning("guided", `manifest unlink failed: ${e.message}`);
|
|
197
|
+
}
|
|
189
198
|
pendingAutoStartMap.delete(basePath);
|
|
190
199
|
ctx.ui.notify(`Milestone ${milestoneId} ready.`, "info");
|
|
191
200
|
startAuto(ctx, pi, basePath, false, { step }).catch((err) => {
|
|
192
201
|
ctx.ui.notify(`Auto-start failed: ${getErrorMessage(err)}`, "error");
|
|
193
|
-
|
|
194
|
-
console.error('[gsd] auto start error:', err);
|
|
202
|
+
logWarning("guided", `auto start error: ${getErrorMessage(err)}`);
|
|
195
203
|
debugLog("auto-start-failed", { error: getErrorMessage(err) });
|
|
196
204
|
});
|
|
197
205
|
return true;
|
|
@@ -744,8 +752,8 @@ function selfHealRuntimeRecords(basePath, ctx) {
|
|
|
744
752
|
}
|
|
745
753
|
return { cleared };
|
|
746
754
|
}
|
|
747
|
-
catch {
|
|
748
|
-
|
|
755
|
+
catch (e) {
|
|
756
|
+
logWarning("guided", `self-heal stale runtime records failed: ${e.message}`);
|
|
749
757
|
return { cleared: 0 };
|
|
750
758
|
}
|
|
751
759
|
}
|
|
@@ -952,7 +960,9 @@ export async function showSmartEntry(ctx, pi, basePath, options) {
|
|
|
952
960
|
return;
|
|
953
961
|
}
|
|
954
962
|
}
|
|
955
|
-
catch {
|
|
963
|
+
catch (e) {
|
|
964
|
+
logWarning("guided", `directory read failed: ${e.message}`);
|
|
965
|
+
}
|
|
956
966
|
}
|
|
957
967
|
}
|
|
958
968
|
const uniqueMilestoneIds = !!loadEffectiveGSDPreferences()?.preferences?.unique_milestone_ids;
|
|
@@ -13,6 +13,7 @@ import { ensureGitignore, untrackRuntimeFiles } from "./gitignore.js";
|
|
|
13
13
|
import { gsdRoot } from "./paths.js";
|
|
14
14
|
import { assertSafeDirectory } from "./validate-directory.js";
|
|
15
15
|
import { runSkillInstallStep } from "./skill-catalog.js";
|
|
16
|
+
import { generateCodebaseMap, writeCodebaseMap } from "./codebase-generator.js";
|
|
16
17
|
// ─── Defaults ───────────────────────────────────────────────────────────────────
|
|
17
18
|
const DEFAULT_PREFS = {
|
|
18
19
|
mode: "solo",
|
|
@@ -189,6 +190,17 @@ export async function showProjectInit(ctx, pi, basePath, detection) {
|
|
|
189
190
|
// Ensure .gitignore
|
|
190
191
|
ensureGitignore(basePath);
|
|
191
192
|
untrackRuntimeFiles(basePath);
|
|
193
|
+
// Auto-generate codebase map for instant agent orientation
|
|
194
|
+
try {
|
|
195
|
+
const result = generateCodebaseMap(basePath);
|
|
196
|
+
if (result.fileCount > 0) {
|
|
197
|
+
writeCodebaseMap(basePath, result.content);
|
|
198
|
+
ctx.ui.notify(`Codebase map generated: ${result.fileCount} files`, "info");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Non-fatal — codebase map generation failure should never block project init
|
|
203
|
+
}
|
|
192
204
|
ctx.ui.notify("GSD initialized. Starting your first milestone...", "info");
|
|
193
205
|
return { completed: true, bootstrapped: true };
|
|
194
206
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// Critical invariant: rendered markdown must round-trip through
|
|
9
9
|
// parseRoadmap(), parsePlan(), parseSummary() in files.ts.
|
|
10
10
|
import { readFileSync, existsSync, mkdirSync } from "node:fs";
|
|
11
|
+
import { logWarning } from "./workflow-logger.js";
|
|
11
12
|
import { isClosedStatus } from "./status-guards.js";
|
|
12
13
|
import { join, relative } from "node:path";
|
|
13
14
|
import { createRequire } from "node:module";
|
|
@@ -56,7 +57,7 @@ function loadArtifactContent(artifactPath, absPath, opts) {
|
|
|
56
57
|
content = readFileSync(absPath, "utf-8");
|
|
57
58
|
}
|
|
58
59
|
catch {
|
|
59
|
-
|
|
60
|
+
logWarning("renderer", `cannot read file from disk: ${absPath}`);
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
// Store in DB for future use (graceful degradation path)
|
|
@@ -72,7 +73,7 @@ function loadArtifactContent(artifactPath, absPath, opts) {
|
|
|
72
73
|
}
|
|
73
74
|
catch {
|
|
74
75
|
// Non-fatal: we have the content, DB storage is best-effort
|
|
75
|
-
|
|
76
|
+
logWarning("renderer", `failed to store disk fallback in DB: ${artifactPath}`);
|
|
76
77
|
}
|
|
77
78
|
return content;
|
|
78
79
|
}
|
|
@@ -93,7 +94,7 @@ async function writeAndStore(absPath, artifactPath, content, opts) {
|
|
|
93
94
|
}
|
|
94
95
|
catch {
|
|
95
96
|
// Non-fatal: file is on disk, DB is best-effort
|
|
96
|
-
|
|
97
|
+
logWarning("renderer", `failed to update artifact in DB: ${artifactPath}`);
|
|
97
98
|
}
|
|
98
99
|
invalidateCaches();
|
|
99
100
|
}
|
|
@@ -613,7 +614,8 @@ export function detectStaleRenders(basePath) {
|
|
|
613
614
|
parseRoadmap = m.parseRoadmap;
|
|
614
615
|
parsePlan = m.parsePlan;
|
|
615
616
|
}
|
|
616
|
-
catch {
|
|
617
|
+
catch (e) {
|
|
618
|
+
logWarning("renderer", `parsers-legacy.ts require failed, falling back to .js: ${e.message}`);
|
|
617
619
|
const m = _require("./parsers-legacy.js");
|
|
618
620
|
parseRoadmap = m.parseRoadmap;
|
|
619
621
|
parsePlan = m.parsePlan;
|
|
@@ -647,8 +649,8 @@ export function detectStaleRenders(basePath) {
|
|
|
647
649
|
}
|
|
648
650
|
}
|
|
649
651
|
}
|
|
650
|
-
catch {
|
|
651
|
-
|
|
652
|
+
catch (e) {
|
|
653
|
+
logWarning("renderer", `roadmap parse failed: ${e.message}`);
|
|
652
654
|
}
|
|
653
655
|
}
|
|
654
656
|
// ── Check plan checkbox state and summaries for each slice ────────
|
|
@@ -679,8 +681,8 @@ export function detectStaleRenders(basePath) {
|
|
|
679
681
|
}
|
|
680
682
|
}
|
|
681
683
|
}
|
|
682
|
-
catch {
|
|
683
|
-
|
|
684
|
+
catch (e) {
|
|
685
|
+
logWarning("renderer", `plan parse failed: ${e.message}`);
|
|
684
686
|
}
|
|
685
687
|
}
|
|
686
688
|
// Check missing task summary files
|
|
@@ -824,7 +826,7 @@ export async function repairStaleRenders(basePath) {
|
|
|
824
826
|
}
|
|
825
827
|
}
|
|
826
828
|
catch (err) {
|
|
827
|
-
|
|
829
|
+
logWarning("renderer", `repair failed for ${entry.path}: ${err.message}`);
|
|
828
830
|
}
|
|
829
831
|
}
|
|
830
832
|
if (repairCount > 0) {
|
|
@@ -10,6 +10,7 @@ import { resolveGsdRootFile, resolveMilestoneFile, resolveSliceFile, resolveTask
|
|
|
10
10
|
import { findMilestoneIds } from './guided-flow.js';
|
|
11
11
|
import { parseRoadmap, parsePlan } from './parsers-legacy.js';
|
|
12
12
|
import { parseContextDependsOn } from './files.js';
|
|
13
|
+
import { logWarning } from './workflow-logger.js';
|
|
13
14
|
// ─── DECISIONS.md Parser ───────────────────────────────────────────────────
|
|
14
15
|
const VALID_MADE_BY = new Set(['human', 'agent', 'collaborative']);
|
|
15
16
|
/**
|
|
@@ -597,25 +598,25 @@ export function migrateFromMarkdown(gsdDir) {
|
|
|
597
598
|
decisions = importDecisions(gsdDir);
|
|
598
599
|
}
|
|
599
600
|
catch (err) {
|
|
600
|
-
|
|
601
|
+
logWarning("migration", `skipping decisions import: ${err.message}`);
|
|
601
602
|
}
|
|
602
603
|
try {
|
|
603
604
|
requirements = importRequirements(gsdDir);
|
|
604
605
|
}
|
|
605
606
|
catch (err) {
|
|
606
|
-
|
|
607
|
+
logWarning("migration", `skipping requirements import: ${err.message}`);
|
|
607
608
|
}
|
|
608
609
|
try {
|
|
609
610
|
artifacts = importHierarchyArtifacts(gsdDir);
|
|
610
611
|
}
|
|
611
612
|
catch (err) {
|
|
612
|
-
|
|
613
|
+
logWarning("migration", `skipping artifacts import: ${err.message}`);
|
|
613
614
|
}
|
|
614
615
|
try {
|
|
615
616
|
hierarchy = migrateHierarchyToDb(gsdDir);
|
|
616
617
|
}
|
|
617
618
|
catch (err) {
|
|
618
|
-
|
|
619
|
+
logWarning("migration", `skipping hierarchy migration: ${err.message}`);
|
|
619
620
|
}
|
|
620
621
|
});
|
|
621
622
|
process.stderr.write(`gsd-migrate: imported ${decisions} decisions, ${requirements} requirements, ${artifacts} artifacts, ${hierarchy.milestones}M/${hierarchy.slices}S/${hierarchy.tasks}T hierarchy\n`);
|
|
@@ -16,6 +16,7 @@ import { resolveMilestonePath, resolveMilestoneFile, buildMilestoneFileName, } f
|
|
|
16
16
|
import { invalidateAllCaches } from "./cache.js";
|
|
17
17
|
import { loadQueueOrder, saveQueueOrder } from "./queue-order.js";
|
|
18
18
|
import { isDbAvailable, updateMilestoneStatus } from "./gsd-db.js";
|
|
19
|
+
import { logWarning } from "./workflow-logger.js";
|
|
19
20
|
// ─── Park ──────────────────────────────────────────────────────────────────
|
|
20
21
|
/**
|
|
21
22
|
* Park a milestone — creates a PARKED.md marker file with reason and timestamp.
|
|
@@ -51,7 +52,7 @@ export function parkMilestone(basePath, milestoneId, reason) {
|
|
|
51
52
|
updateMilestoneStatus(milestoneId, "parked");
|
|
52
53
|
}
|
|
53
54
|
catch (err) {
|
|
54
|
-
|
|
55
|
+
logWarning("engine", `parkMilestone DB sync failed for ${milestoneId}: ${err.message}`);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
invalidateAllCaches();
|
|
@@ -76,7 +77,7 @@ export function unparkMilestone(basePath, milestoneId) {
|
|
|
76
77
|
updateMilestoneStatus(milestoneId, "active");
|
|
77
78
|
}
|
|
78
79
|
catch (err) {
|
|
79
|
-
|
|
80
|
+
logWarning("engine", `unparkMilestone DB sync failed for ${milestoneId}: ${err.message}`);
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
invalidateAllCaches();
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Consumed by 15+ modules across the GSD extension. Zero side-effects.
|
|
6
6
|
*/
|
|
7
7
|
import { randomInt } from "node:crypto";
|
|
8
|
+
import { logWarning } from "./workflow-logger.js";
|
|
8
9
|
import { readdirSync, existsSync } from "node:fs";
|
|
9
10
|
import { milestonesDir } from "./paths.js";
|
|
10
11
|
import { loadQueueOrder, sortByQueueOrder } from "./queue-order.js";
|
|
@@ -109,7 +110,7 @@ export function findMilestoneIds(basePath) {
|
|
|
109
110
|
catch (err) {
|
|
110
111
|
// Log why milestone scanning failed — silent [] here causes infinite loops (#456)
|
|
111
112
|
if (existsSync(dir)) {
|
|
112
|
-
|
|
113
|
+
logWarning("engine", `findMilestoneIds: .gsd/milestones/ exists but readdirSync failed — ${getErrorMessage(err)}`);
|
|
113
114
|
}
|
|
114
115
|
return [];
|
|
115
116
|
}
|