@opengsd/gsd-core 1.7.0-rc.6 → 1.8.0
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.opencode/plugins/gsd-core.js +14 -0
- package/README.md +2 -0
- package/agents/gsd-debug-session-manager.md +42 -4
- package/agents/gsd-debugger.md +87 -29
- package/agents/gsd-executor.md +31 -3
- package/agents/gsd-planner.md +29 -36
- package/agents/gsd-security-auditor.md +13 -15
- package/agents/gsd-verifier.md +2 -2
- package/bin/install.js +1157 -84
- package/commands/gsd/ai-integration-phase.md +1 -1
- package/commands/gsd/mempalace-capture.md +31 -1
- package/commands/gsd/new-milestone.md +1 -1
- package/commands/gsd/plan-phase.md +5 -3
- package/commands/gsd/plan-review-convergence.md +3 -2
- package/commands/gsd/surface.md +6 -6
- package/gsd-core/bin/gsd-tools.cjs +1866 -2434
- package/gsd-core/bin/lib/adapter-imperative.cjs +8 -1
- package/gsd-core/bin/lib/agent-command-router.cjs +20 -5
- package/gsd-core/bin/lib/api-coverage.cjs +341 -49
- package/gsd-core/bin/lib/audit.cjs +7 -6
- package/gsd-core/bin/lib/broken-windows.cjs +716 -0
- package/gsd-core/bin/lib/capability-command-router.cjs +733 -0
- package/gsd-core/bin/lib/capability-registry.cjs +157 -88
- package/gsd-core/bin/lib/capability-writer.cjs +6 -1
- package/gsd-core/bin/lib/check-command-router.cjs +129 -26
- package/gsd-core/bin/lib/claude-orchestration-command-router.cjs +115 -27
- package/gsd-core/bin/lib/claude-orchestration.cjs +84 -9
- package/gsd-core/bin/lib/clock.cjs +19 -0
- package/gsd-core/bin/lib/command-aliases.cjs +14 -0
- package/gsd-core/bin/lib/commands.cjs +129 -13
- package/gsd-core/bin/lib/config-loader.cjs +20 -4
- package/gsd-core/bin/lib/config.cjs +81 -18
- package/gsd-core/bin/lib/core-utils.cjs +14 -3
- package/gsd-core/bin/lib/decisions.cjs +32 -8
- package/gsd-core/bin/lib/docs.cjs +6 -0
- package/gsd-core/bin/lib/drift.cjs +4 -4
- package/gsd-core/bin/lib/external-descriptor-trust.cjs +14 -2
- package/gsd-core/bin/lib/frontmatter.cjs +22 -0
- package/gsd-core/bin/lib/gap-checker.cjs +17 -2
- package/gsd-core/bin/lib/gsd2-import.cjs +2 -1
- package/gsd-core/bin/lib/init.cjs +138 -60
- package/gsd-core/bin/lib/install-engine.cjs +301 -25
- package/gsd-core/bin/lib/install-profiles.cjs +239 -1
- package/gsd-core/bin/lib/installer-migration-authoring.cjs +2 -1
- package/gsd-core/bin/lib/installer-migrations/005-opencode-baseline-commands-dir.cjs +146 -0
- package/gsd-core/bin/lib/installer-migrations/006-pi-extension-cjs-to-js.cjs +91 -0
- package/gsd-core/bin/lib/installer-migrations.cjs +45 -6
- package/gsd-core/bin/lib/markdown-sectionizer.cjs +449 -0
- package/gsd-core/bin/lib/markdown-table.cjs +698 -0
- package/gsd-core/bin/lib/milestone.cjs +463 -43
- package/gsd-core/bin/lib/model-catalog.cjs +19 -4
- package/gsd-core/bin/lib/model-resolver.cjs +189 -7
- package/gsd-core/bin/lib/onboard-projection.cjs +11 -8
- package/gsd-core/bin/lib/phase-command-router.cjs +50 -2
- package/gsd-core/bin/lib/phase-id.cjs +26 -4
- package/gsd-core/bin/lib/phase-lifecycle.cjs +62 -36
- package/gsd-core/bin/lib/phase-locator.cjs +23 -2
- package/gsd-core/bin/lib/phase.cjs +636 -72
- package/gsd-core/bin/lib/plan-scan.cjs +73 -2
- package/gsd-core/bin/lib/roadmap-parser.cjs +225 -17
- package/gsd-core/bin/lib/roadmap.cjs +113 -52
- package/gsd-core/bin/lib/runtime-artifact-conversion.cjs +14 -7
- package/gsd-core/bin/lib/runtime-artifact-install-plan.cjs +3 -2
- package/gsd-core/bin/lib/runtime-artifact-layout.cjs +24 -9
- package/gsd-core/bin/lib/runtime-hooks-surface.cjs +41 -17
- package/gsd-core/bin/lib/schema-detect.cjs +2 -1
- package/gsd-core/bin/lib/security.cjs +1 -1
- package/gsd-core/bin/lib/shell-command-projection.cjs +61 -25
- package/gsd-core/bin/lib/smart-entry.cjs +73 -7
- package/gsd-core/bin/lib/state-document.cjs +7 -4
- package/gsd-core/bin/lib/state-transition.cjs +122 -46
- package/gsd-core/bin/lib/state.cjs +456 -137
- package/gsd-core/bin/lib/surface.cjs +53 -11
- package/gsd-core/bin/lib/template.cjs +2 -1
- package/gsd-core/bin/lib/uat.cjs +474 -13
- package/gsd-core/bin/lib/ui-safety-gate.cjs +23 -1
- package/gsd-core/bin/lib/validate.cjs +12 -8
- package/gsd-core/bin/lib/verification.cjs +112 -17
- package/gsd-core/bin/lib/verify.cjs +224 -25
- package/gsd-core/bin/lib/workstream.cjs +3 -2
- package/gsd-core/bin/lib/worktree-safety.cjs +1 -1
- package/gsd-core/bin/lib/write-set.cjs +38 -0
- package/gsd-core/bin/shared/config-schema.manifest.json +5 -2
- package/gsd-core/references/api-coverage.md +37 -7
- package/gsd-core/references/checkpoints.md +13 -1
- package/gsd-core/references/common-bug-patterns.md +13 -0
- package/gsd-core/references/debugger-bug-taxonomy.md +111 -0
- package/gsd-core/references/debugger-fix-acceptance.md +157 -0
- package/gsd-core/references/debugger-philosophy.md +1 -0
- package/gsd-core/references/debugger-prevention.md +98 -0
- package/gsd-core/references/debugger-rca-branching.md +98 -0
- package/gsd-core/references/debugger-repro-hardening.md +130 -0
- package/gsd-core/references/debugger-sbfl.md +110 -0
- package/gsd-core/references/debugger-semantic-recall.md +81 -0
- package/gsd-core/references/execute-phase-quota-recovery.md +55 -0
- package/gsd-core/references/execute-phase-requirement-revert.md +8 -0
- package/gsd-core/references/execute-phase-response-language.md +7 -0
- package/gsd-core/references/planner-antipatterns.md +6 -0
- package/gsd-core/references/planner-mvp-mode.md +12 -13
- package/gsd-core/references/planner-preconditions.md +156 -0
- package/gsd-core/references/planner-reversibility.md +132 -0
- package/gsd-core/references/reviewer-instances.md +9 -7
- package/gsd-core/references/skeleton-template.md +1 -1
- package/gsd-core/references/thinking-models-planning.md +3 -1
- package/gsd-core/templates/DEBUG.md +5 -3
- package/gsd-core/workflows/add-phase.md +2 -0
- package/gsd-core/workflows/add-tests.md +4 -2
- package/gsd-core/workflows/add-todo.md +32 -1
- package/gsd-core/workflows/ai-integration-phase.md +4 -2
- package/gsd-core/workflows/audit-fix.md +2 -2
- package/gsd-core/workflows/check-todos.md +3 -1
- package/gsd-core/workflows/cleanup.md +7 -1
- package/gsd-core/workflows/code-review.md +17 -5
- package/gsd-core/workflows/complete-milestone.md +3 -0
- package/gsd-core/workflows/debug.md +27 -5
- package/gsd-core/workflows/diagnose-issues.md +1 -1
- package/gsd-core/workflows/discovery-phase.md +7 -0
- package/gsd-core/workflows/discuss-phase/templates/context.md +16 -2
- package/gsd-core/workflows/discuss-phase-assumptions.md +3 -0
- package/gsd-core/workflows/do.md +7 -1
- package/gsd-core/workflows/docs-update.md +1 -0
- package/gsd-core/workflows/eval-review.md +3 -0
- package/gsd-core/workflows/execute-phase/steps/post-merge-gate.md +4 -4
- package/gsd-core/workflows/execute-phase/steps/regression-gate.md +2 -2
- package/gsd-core/workflows/execute-phase.md +30 -37
- package/gsd-core/workflows/execute-plan.md +15 -4
- package/gsd-core/workflows/fast.md +8 -22
- package/gsd-core/workflows/graduation.md +3 -0
- package/gsd-core/workflows/health.md +7 -1
- package/gsd-core/workflows/help/modes/full.md +6 -2
- package/gsd-core/workflows/import.md +8 -2
- package/gsd-core/workflows/inbox.md +7 -0
- package/gsd-core/workflows/ingest-docs.md +15 -10
- package/gsd-core/workflows/manager.md +3 -1
- package/gsd-core/workflows/map-codebase.md +4 -4
- package/gsd-core/workflows/mvp-phase.md +3 -0
- package/gsd-core/workflows/new-milestone.md +69 -21
- package/gsd-core/workflows/new-project.md +17 -15
- package/gsd-core/workflows/new-workspace.md +3 -1
- package/gsd-core/workflows/onboard.md +3 -0
- package/gsd-core/workflows/plan-phase.md +14 -5
- package/gsd-core/workflows/plan-review-convergence.md +48 -3
- package/gsd-core/workflows/plant-seed.md +3 -0
- package/gsd-core/workflows/profile-user.md +7 -1
- package/gsd-core/workflows/progress.md +33 -5
- package/gsd-core/workflows/quick.md +21 -7
- package/gsd-core/workflows/remove-workspace.md +3 -0
- package/gsd-core/workflows/review.md +123 -68
- package/gsd-core/workflows/scan.md +1 -1
- package/gsd-core/workflows/secure-phase.md +4 -1
- package/gsd-core/workflows/settings-integrations.md +3 -0
- package/gsd-core/workflows/settings.md +3 -0
- package/gsd-core/workflows/ship.md +58 -5
- package/gsd-core/workflows/sketch.md +3 -0
- package/gsd-core/workflows/smart-entry.md +3 -0
- package/gsd-core/workflows/spec-phase.md +1 -1
- package/gsd-core/workflows/spike.md +7 -1
- package/gsd-core/workflows/transition.md +1 -1
- package/gsd-core/workflows/ui-phase.md +3 -1
- package/gsd-core/workflows/ui-review.md +3 -0
- package/gsd-core/workflows/undo.md +7 -0
- package/gsd-core/workflows/update.md +2 -0
- package/gsd-core/workflows/validate-phase.md +3 -0
- package/gsd-core/workflows/verify-phase.md +2 -2
- package/gsd-core/workflows/verify-work.md +7 -3
- package/hooks/dist/gsd-context-monitor.js +27 -9
- package/hooks/dist/gsd-statusline.js +252 -17
- package/hooks/gsd-context-monitor.js +27 -9
- package/hooks/gsd-statusline.js +252 -17
- package/package.json +8 -4
- package/pi/gsd.cjs +8 -2
- package/scripts/changeset/lint.cjs +1 -0
- package/scripts/changeset/parse.cjs +26 -0
- package/scripts/check-glossary-refs.cjs +220 -0
- package/scripts/ci-rebase-check.cjs +48 -4
- package/scripts/ci-test-scope.cjs +39 -1
- package/scripts/gen-adr-index.cjs +526 -0
- package/scripts/gen-golden-install-parity-zcode.cjs +35 -45
- package/scripts/gen-install-tree-fixtures.cjs +75 -0
- package/scripts/gen-test-timings.cjs +201 -0
- package/scripts/lint-allow-test-rule-refs.allowlist.json +0 -1
- package/scripts/lint-portable-timeout.cjs +140 -0
- package/scripts/lint-table-schema-drift.cjs +157 -0
- package/scripts/lint-test-file-count.allowlist.json +1 -0
- package/scripts/release-tarball-smoke.cjs +18 -11
- package/scripts/run-tests.cjs +420 -58
- package/skills/gsd-ai-integration-phase/SKILL.md +1 -1
- package/skills/gsd-mempalace-capture/SKILL.md +31 -1
- package/skills/gsd-new-milestone/SKILL.md +1 -1
- package/skills/gsd-plan-phase/SKILL.md +5 -3
- package/skills/gsd-plan-review-convergence/SKILL.md +3 -2
- package/skills/gsd-surface/SKILL.md +6 -6
- package/vscode/package.json +1 -1
|
@@ -15,6 +15,17 @@
|
|
|
15
15
|
* inside a fenced code block) is ignored — this is the exact failure mode that
|
|
16
16
|
* issue #586 / PR #650 identified. The shared extractFrontmatter parser anchors
|
|
17
17
|
* its regex at byte 0 of the document, which provides this guarantee.
|
|
18
|
+
*
|
|
19
|
+
* #2348 staleness signal: whether a *-VERIFICATION.md is stale (a summary newer
|
|
20
|
+
* than it) is decided from git commit time when a file is committed AND clean,
|
|
21
|
+
* and from filesystem mtime otherwise. mtimes are assigned at checkout time and
|
|
22
|
+
* are not preserved by `git clone` / `cp -R`, and any unrelated `touch` /
|
|
23
|
+
* reformat / editor-save re-stales a valid report — so a committed phase could
|
|
24
|
+
* read `passed` on one machine and `stale` on a fresh clone purely from checkout
|
|
25
|
+
* order. Git commit time is content-tied and clone-stable; mtime is retained
|
|
26
|
+
* only for uncommitted or working-tree-dirty files, where it is the true
|
|
27
|
+
* last-changed signal. Both are real wall-clock change times, so the comparison
|
|
28
|
+
* is sound even when one file uses each.
|
|
18
29
|
*/
|
|
19
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -29,6 +40,7 @@ const phaseId = require("./phase-id.cjs");
|
|
|
29
40
|
const frontmatterMod = require("./frontmatter.cjs");
|
|
30
41
|
// eslint-disable-next-line @typescript-eslint/no-require-imports -- plan-scan.cjs is an export= CommonJS module
|
|
31
42
|
const scanPhasePlans = require("./plan-scan.cjs");
|
|
43
|
+
const shell_command_projection_cjs_1 = require("./shell-command-projection.cjs");
|
|
32
44
|
const { output, error } = io;
|
|
33
45
|
const { extractPhaseToken } = phaseId;
|
|
34
46
|
const { extractFrontmatter } = frontmatterMod;
|
|
@@ -87,6 +99,79 @@ const VERIFICATION_ROUTING_TABLE = {
|
|
|
87
99
|
next_command: '/gsd:execute-phase',
|
|
88
100
|
},
|
|
89
101
|
};
|
|
102
|
+
/** Normalize separators to posix (git emits `/`; callers may pass `\` on Windows). */
|
|
103
|
+
function toPosix(p) {
|
|
104
|
+
return p.replace(/\\/g, '/');
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Match a git-emitted (repo-root-relative) path back to the caller's
|
|
108
|
+
* phaseDir-relative request by exact match or `/`-bounded suffix — precise
|
|
109
|
+
* enough that a root file and a nested `plans/` file can never collide (a plain
|
|
110
|
+
* basename match could). Returns the original caller-form file string, or null.
|
|
111
|
+
*/
|
|
112
|
+
function matchRequestedFile(gitPath, requested, requestedPosix) {
|
|
113
|
+
const g = toPosix(gitPath);
|
|
114
|
+
for (let i = 0; i < requested.length; i++) {
|
|
115
|
+
const want = requestedPosix[i];
|
|
116
|
+
if (g === want || g.endsWith('/' + want))
|
|
117
|
+
return requested[i];
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parse `git log --format=%ct --name-only` output into file → most-recent commit
|
|
123
|
+
* time (ms). Output is reverse-chronological, so a file's FIRST appearance
|
|
124
|
+
* top-down is its latest commit. `%ct` headers are pure digits; path lines
|
|
125
|
+
* contain a `.` (the `.md` extension) — so the two are unambiguous.
|
|
126
|
+
*/
|
|
127
|
+
function parseCommitTimes(stdout, requested, requestedPosix) {
|
|
128
|
+
const out = new Map();
|
|
129
|
+
let currentCt = null;
|
|
130
|
+
for (const line of stdout.split('\n')) {
|
|
131
|
+
if (line.length === 0)
|
|
132
|
+
continue;
|
|
133
|
+
if (/^\d+$/.test(line)) {
|
|
134
|
+
currentCt = Number.parseInt(line, 10);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (currentCt === null)
|
|
138
|
+
continue;
|
|
139
|
+
const rel = matchRequestedFile(line, requested, requestedPosix);
|
|
140
|
+
if (rel !== null && !out.has(rel))
|
|
141
|
+
out.set(rel, currentCt * 1000);
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
function defaultPhaseCleanCommitTimesMs(phaseDir, files, execGitFn = shell_command_projection_cjs_1.execGit) {
|
|
146
|
+
if (files.length === 0)
|
|
147
|
+
return new Map();
|
|
148
|
+
const requestedPosix = files.map(toPosix);
|
|
149
|
+
const logRes = execGitFn(['log', '--first-parent', '--format=%ct', '--name-only', '--', ...files], {
|
|
150
|
+
cwd: phaseDir,
|
|
151
|
+
});
|
|
152
|
+
if (logRes.error || logRes.exitCode !== 0 || logRes.stdout.length === 0)
|
|
153
|
+
return new Map();
|
|
154
|
+
const commitTimes = parseCommitTimes(logRes.stdout, files, requestedPosix);
|
|
155
|
+
if (commitTimes.size === 0)
|
|
156
|
+
return commitTimes;
|
|
157
|
+
// Drop dirty files (working tree ≠ HEAD) so their mtime is used instead. If the
|
|
158
|
+
// dirty-check itself is INCONCLUSIVE (git diff errored / non-zero — as opposed
|
|
159
|
+
// to "ran and reported no dirty files"), we cannot prove any file is clean, so
|
|
160
|
+
// fail SAFE: discard the commit times and let every file fall back to mtime,
|
|
161
|
+
// the same direction as a git-log failure. Trusting possibly-stale commit times
|
|
162
|
+
// here would silently mask a real edit (false "not stale"). (#2348)
|
|
163
|
+
const diffRes = execGitFn(['diff', '--name-only', 'HEAD', '--', ...files], { cwd: phaseDir });
|
|
164
|
+
if (diffRes.error || diffRes.exitCode !== 0)
|
|
165
|
+
return new Map();
|
|
166
|
+
for (const line of diffRes.stdout.split('\n')) {
|
|
167
|
+
if (line.length === 0)
|
|
168
|
+
continue;
|
|
169
|
+
const rel = matchRequestedFile(line, files, requestedPosix);
|
|
170
|
+
if (rel !== null)
|
|
171
|
+
commitTimes.delete(rel);
|
|
172
|
+
}
|
|
173
|
+
return commitTimes;
|
|
174
|
+
}
|
|
90
175
|
/**
|
|
91
176
|
* Build a 'missing' result from the routing table.
|
|
92
177
|
* Used for two early-return paths: no *-VERIFICATION.md file found, and
|
|
@@ -100,7 +185,7 @@ function missingResult() {
|
|
|
100
185
|
next_command: route.next_command,
|
|
101
186
|
};
|
|
102
187
|
}
|
|
103
|
-
function findStaleVerificationSummary(phaseDir, fsImpl = node_fs_1.default) {
|
|
188
|
+
function findStaleVerificationSummary(phaseDir, fsImpl = node_fs_1.default, phaseCleanCommitTimesMs = defaultPhaseCleanCommitTimesMs) {
|
|
104
189
|
// FS errors (TOCTOU: a SUMMARY listed by scanPhasePlans then removed before statSync;
|
|
105
190
|
// unreadable dir; broken symlink; file->dir swap) must degrade to "not stale" rather
|
|
106
191
|
// than throw uncaught into callers that are NOT under the planning lock
|
|
@@ -112,23 +197,31 @@ function findStaleVerificationSummary(phaseDir, fsImpl = node_fs_1.default) {
|
|
|
112
197
|
const verificationFile = phaseFiles.filter((f) => f.endsWith('-VERIFICATION.md')).sort()[0];
|
|
113
198
|
if (!verificationFile)
|
|
114
199
|
return null;
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
200
|
+
const summaryFiles = scanPhasePlans(phaseDir).summaryFiles
|
|
201
|
+
.slice()
|
|
202
|
+
.sort();
|
|
203
|
+
// No summary can be newer than the verification → never stale. Return before
|
|
204
|
+
// touching git so a phase with no summaries costs zero subprocesses. (#2348)
|
|
205
|
+
if (summaryFiles.length === 0)
|
|
206
|
+
return null;
|
|
207
|
+
// Each file's effective "last changed" time = its commit time when committed
|
|
208
|
+
// AND clean (content-tied and clone-stable), else its filesystem mtime (the
|
|
209
|
+
// uncommitted working-tree edit). Both are real wall-clock change times, so
|
|
210
|
+
// comparing a clean file's commit time against a dirty file's mtime is sound.
|
|
211
|
+
// One resolver call = two git subprocesses for the whole phase. (#2348)
|
|
212
|
+
const cleanCommitMs = phaseCleanCommitTimesMs(phaseDir, [verificationFile, ...summaryFiles]);
|
|
213
|
+
const effectiveTimeMs = (file) => cleanCommitMs.has(file)
|
|
214
|
+
? cleanCommitMs.get(file)
|
|
215
|
+
: fsImpl.statSync(node_path_1.default.join(phaseDir, file)).mtimeMs;
|
|
216
|
+
const verificationTimeMs = effectiveTimeMs(verificationFile);
|
|
217
|
+
for (const summaryFile of summaryFiles) {
|
|
218
|
+
// The caller only needs whether the phase is stale, not which summary —
|
|
219
|
+
// the first stale summary (in sorted order) is enough. Short-circuit.
|
|
220
|
+
if (effectiveTimeMs(summaryFile) > verificationTimeMs) {
|
|
221
|
+
return { verificationFile, summaryFile };
|
|
124
222
|
}
|
|
125
223
|
}
|
|
126
|
-
|
|
127
|
-
return null;
|
|
128
|
-
return {
|
|
129
|
-
verificationFile,
|
|
130
|
-
summaryFile: newestStaleSummary.summaryFile,
|
|
131
|
-
};
|
|
224
|
+
return null;
|
|
132
225
|
}
|
|
133
226
|
catch {
|
|
134
227
|
return null;
|
|
@@ -151,6 +244,7 @@ function findStaleVerificationSummary(phaseDir, fsImpl = node_fs_1.default) {
|
|
|
151
244
|
*/
|
|
152
245
|
function readVerificationStatus(phaseDir, opts = {}) {
|
|
153
246
|
const fsImpl = opts.fs ?? node_fs_1.default;
|
|
247
|
+
const phaseCleanCommitTimesMs = opts.phaseCleanCommitTimesMs ?? defaultPhaseCleanCommitTimesMs;
|
|
154
248
|
// Phase token for the gaps_found command
|
|
155
249
|
const baseName = node_path_1.default.basename(phaseDir);
|
|
156
250
|
const phaseToken = extractPhaseToken(baseName);
|
|
@@ -200,7 +294,7 @@ function readVerificationStatus(phaseDir, opts = {}) {
|
|
|
200
294
|
next_command: `/gsd:plan-phase ${phaseNumber} --gaps`,
|
|
201
295
|
};
|
|
202
296
|
}
|
|
203
|
-
const staleVerification = findStaleVerificationSummary(phaseDir, fsImpl);
|
|
297
|
+
const staleVerification = findStaleVerificationSummary(phaseDir, fsImpl, phaseCleanCommitTimesMs);
|
|
204
298
|
if (staleVerification) {
|
|
205
299
|
const entry = VERIFICATION_ROUTING_TABLE['stale'];
|
|
206
300
|
return {
|
|
@@ -251,6 +345,7 @@ function cmdVerificationStatus(cwd, phaseDirArg, raw) {
|
|
|
251
345
|
module.exports = {
|
|
252
346
|
VERIFIER_STATUSES,
|
|
253
347
|
VERIFICATION_ROUTING_TABLE,
|
|
348
|
+
defaultPhaseCleanCommitTimesMs,
|
|
254
349
|
findStaleVerificationSummary,
|
|
255
350
|
readVerificationStatus,
|
|
256
351
|
cmdVerificationStatus,
|
|
@@ -13,6 +13,7 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
14
|
const node_os_1 = __importDefault(require("node:os"));
|
|
15
15
|
const validate_cjs_1 = require("./validate.cjs");
|
|
16
|
+
const clock_cjs_1 = require("./clock.cjs");
|
|
16
17
|
const validate_cjs_2 = require("./validate.cjs");
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-require-imports -- planning-workspace.cjs is an export= CommonJS module
|
|
18
19
|
const planningWorkspace = require("./planning-workspace.cjs");
|
|
@@ -30,6 +31,7 @@ const runtime_slash_cjs_1 = require("./runtime-slash.cjs");
|
|
|
30
31
|
const schema_detect_cjs_1 = require("./schema-detect.cjs");
|
|
31
32
|
const artifacts_cjs_1 = require("./artifacts.cjs");
|
|
32
33
|
const markdown_sectionizer_cjs_1 = require("./markdown-sectionizer.cjs");
|
|
34
|
+
const model_catalog_cjs_1 = require("./model-catalog.cjs");
|
|
33
35
|
// eslint-disable-next-line @typescript-eslint/no-require-imports -- agent-install-check.cjs is an export= CommonJS module
|
|
34
36
|
const agentInstallCheck = require("./agent-install-check.cjs");
|
|
35
37
|
const { checkAgentsInstalled } = agentInstallCheck;
|
|
@@ -41,7 +43,7 @@ const configLoaderMod = require("./config-loader.cjs");
|
|
|
41
43
|
const { loadConfig, CONFIG_DEFAULTS } = configLoaderMod;
|
|
42
44
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
43
45
|
const phaseIdMod = require("./phase-id.cjs");
|
|
44
|
-
const { normalizePhaseName, phaseTokenMatches, escapeRegex, getMilestoneFromPhaseId, OPTIONAL_PHASE_TAG_SOURCE, PHASE_NUMBER_TOKEN_SOURCE } = phaseIdMod;
|
|
46
|
+
const { normalizePhaseName, phaseTokenMatches, escapeRegex, getMilestoneFromPhaseId, OPTIONAL_PHASE_TAG_SOURCE, PHASE_NUMBER_TOKEN_SOURCE, extractPhaseToken, comparePhaseNum } = phaseIdMod;
|
|
45
47
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
46
48
|
const phaseLocatorMod = require("./phase-locator.cjs");
|
|
47
49
|
const { findPhaseInternal } = phaseLocatorMod;
|
|
@@ -51,6 +53,9 @@ const { getMilestoneInfo, stripShippedMilestones, extractCurrentMilestone } = ro
|
|
|
51
53
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
52
54
|
const worktreeSafetyMod = require("./worktree-safety.cjs");
|
|
53
55
|
const { inspectWorktreeHealth } = worktreeSafetyMod;
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- commands.cjs is an export= CommonJS module
|
|
57
|
+
const commandsMod = require("./commands.cjs");
|
|
58
|
+
const { determinePhaseStatus } = commandsMod;
|
|
54
59
|
const { planningDir, planningRoot } = planningWorkspace;
|
|
55
60
|
const { extractFrontmatter, parseMustHavesBlock } = frontmatterMod;
|
|
56
61
|
const { writeStateMd } = stateMod;
|
|
@@ -515,6 +520,131 @@ function scanFileWideNegativeGateConflict(content) {
|
|
|
515
520
|
// This detector is warn-only: it never sets valid=false.
|
|
516
521
|
return { warnings, valid: true };
|
|
517
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* Single pass over `<task ...>…</task>` blocks. The body pattern is
|
|
525
|
+
* ReDoS-safe stop-at-next-open (mirrors `taggedBlockPattern` in
|
|
526
|
+
* markdown-sectionizer.cts): bounded attributes (`[^>]{0,1000}`) and a body
|
|
527
|
+
* boundary that terminates at the NEXT `<task[\s>]` opening, so a document
|
|
528
|
+
* full of unclosed `<task>` openings scans linearly. Captures both the
|
|
529
|
+
* attribute string (group 1, so the `type=` selector is not lost the way it is
|
|
530
|
+
* with `extractTaggedBlocks`) and the body (group 2).
|
|
531
|
+
*/
|
|
532
|
+
const PLAN_TASK_BLOCK_RE = /<task(\s[^>]{0,1000})?>((?:(?!<task[\s>])[\s\S])*?)<\/task>/g;
|
|
533
|
+
/**
|
|
534
|
+
* Extract one `PlanTaskInfo` per `<task …>…</task>` block in `content`.
|
|
535
|
+
*
|
|
536
|
+
* Why a dedicated regex instead of `extractTaggedBlocks('task', true)`:
|
|
537
|
+
* `extractTaggedBlocks` discards the opening tag, so the task's `type=`
|
|
538
|
+
* attribute (which selects the validation branch) is lost. This helper
|
|
539
|
+
* captures both the attribute string and the body in one pass, then reuses
|
|
540
|
+
* `extractTaggedBlocks` on the body for sub-element extraction.
|
|
541
|
+
*/
|
|
542
|
+
function extractPlanTaskInfos(content) {
|
|
543
|
+
const infos = [];
|
|
544
|
+
if (typeof content !== 'string' || content.length === 0)
|
|
545
|
+
return infos;
|
|
546
|
+
PLAN_TASK_BLOCK_RE.lastIndex = 0;
|
|
547
|
+
let match;
|
|
548
|
+
while ((match = PLAN_TASK_BLOCK_RE.exec(content)) !== null) {
|
|
549
|
+
const attrs = match[1] ?? '';
|
|
550
|
+
const body = match[2] ?? '';
|
|
551
|
+
const typeMatch = attrs.match(/\btype\s*=\s*["']?([\w:-]+)/i);
|
|
552
|
+
const type = typeMatch ? typeMatch[1].toLowerCase() : '';
|
|
553
|
+
const nameArr = (0, markdown_sectionizer_cjs_1.extractTaggedBlocks)(body, 'name');
|
|
554
|
+
const hasName = nameArr.length > 0;
|
|
555
|
+
const name = hasName ? nameArr[0].trim() : '';
|
|
556
|
+
infos.push({
|
|
557
|
+
name,
|
|
558
|
+
type,
|
|
559
|
+
hasName,
|
|
560
|
+
hasFiles: /<files>/.test(body),
|
|
561
|
+
hasAction: /<action>/.test(body),
|
|
562
|
+
hasVerify: /<verify>/.test(body),
|
|
563
|
+
hasDone: /<done>/.test(body),
|
|
564
|
+
hasWhatBuilt: /<what-built>/.test(body),
|
|
565
|
+
hasHowToVerify: /<how-to-verify>/.test(body),
|
|
566
|
+
hasDecision: /<decision>/.test(body),
|
|
567
|
+
hasOptions: /<options>/.test(body),
|
|
568
|
+
hasInstructions: /<instructions>/.test(body),
|
|
569
|
+
hasVerification: /<verification>/.test(body),
|
|
570
|
+
hasResumeSignal: /<resume-signal>/.test(body),
|
|
571
|
+
});
|
|
572
|
+
// Guard against zero-length matches looping forever.
|
|
573
|
+
if (match.index === PLAN_TASK_BLOCK_RE.lastIndex) {
|
|
574
|
+
PLAN_TASK_BLOCK_RE.lastIndex++;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return infos;
|
|
578
|
+
}
|
|
579
|
+
function isCheckpointType(type) {
|
|
580
|
+
return type.startsWith('checkpoint:');
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Validate one plan task's structure against its type-specific canonical field
|
|
584
|
+
* set (per `gsd-core/references/checkpoints.md`):
|
|
585
|
+
* - `checkpoint:human-verify` requires `<what-built>` / `<how-to-verify>` /
|
|
586
|
+
* `<resume-signal>` (the "checkpoint triple").
|
|
587
|
+
* - `checkpoint:decision` requires `<decision>` / `<options>` /
|
|
588
|
+
* `<resume-signal>`.
|
|
589
|
+
* - `checkpoint:human-action` requires `<action>` / `<instructions>` /
|
|
590
|
+
* `<verification>` / `<resume-signal>`.
|
|
591
|
+
* - Unknown `checkpoint:*` subtypes require only the universal
|
|
592
|
+
* `<resume-signal>` (forward-compat — newer checkpoint types registered
|
|
593
|
+
* in the reference don't need a verifier change to pass structure
|
|
594
|
+
* validation).
|
|
595
|
+
* - All other types (`auto`, `tracer`, `manual`, bare `<task>`, …) keep the
|
|
596
|
+
* historical `<action>` / `<verify>` / `<done>` / `<files>` requirements.
|
|
597
|
+
*/
|
|
598
|
+
function validatePlanTaskStructure(task) {
|
|
599
|
+
const errors = [];
|
|
600
|
+
const warnings = [];
|
|
601
|
+
const taskName = task.hasName ? task.name : 'unnamed';
|
|
602
|
+
if (!task.hasName) {
|
|
603
|
+
errors.push('Task missing <name> element');
|
|
604
|
+
}
|
|
605
|
+
if (isCheckpointType(task.type)) {
|
|
606
|
+
if (!task.hasResumeSignal) {
|
|
607
|
+
errors.push(`Task '${taskName}' missing <resume-signal>`);
|
|
608
|
+
}
|
|
609
|
+
switch (task.type) {
|
|
610
|
+
case 'checkpoint:human-verify':
|
|
611
|
+
if (!task.hasWhatBuilt)
|
|
612
|
+
errors.push(`Task '${taskName}' missing <what-built>`);
|
|
613
|
+
if (!task.hasHowToVerify)
|
|
614
|
+
errors.push(`Task '${taskName}' missing <how-to-verify>`);
|
|
615
|
+
break;
|
|
616
|
+
case 'checkpoint:decision':
|
|
617
|
+
if (!task.hasDecision)
|
|
618
|
+
errors.push(`Task '${taskName}' missing <decision>`);
|
|
619
|
+
if (!task.hasOptions)
|
|
620
|
+
errors.push(`Task '${taskName}' missing <options>`);
|
|
621
|
+
break;
|
|
622
|
+
case 'checkpoint:human-action':
|
|
623
|
+
if (!task.hasAction)
|
|
624
|
+
errors.push(`Task '${taskName}' missing <action>`);
|
|
625
|
+
if (!task.hasInstructions)
|
|
626
|
+
errors.push(`Task '${taskName}' missing <instructions>`);
|
|
627
|
+
if (!task.hasVerification)
|
|
628
|
+
errors.push(`Task '${taskName}' missing <verification>`);
|
|
629
|
+
break;
|
|
630
|
+
default:
|
|
631
|
+
// Unknown checkpoint:* subtype: <resume-signal> is the only universal
|
|
632
|
+
// requirement (forward-compat).
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
if (!task.hasAction)
|
|
638
|
+
errors.push(`Task '${taskName}' missing <action>`);
|
|
639
|
+
if (!task.hasVerify)
|
|
640
|
+
warnings.push(`Task '${taskName}' missing <verify>`);
|
|
641
|
+
if (!task.hasDone)
|
|
642
|
+
warnings.push(`Task '${taskName}' missing <done>`);
|
|
643
|
+
if (!task.hasFiles)
|
|
644
|
+
warnings.push(`Task '${taskName}' missing <files>`);
|
|
645
|
+
}
|
|
646
|
+
return { errors, warnings };
|
|
647
|
+
}
|
|
518
648
|
function cmdVerifyPlanStructure(cwd, filePath, raw) {
|
|
519
649
|
if (!filePath) {
|
|
520
650
|
error('file path required');
|
|
@@ -533,25 +663,20 @@ function cmdVerifyPlanStructure(cwd, filePath, raw) {
|
|
|
533
663
|
if (fm[field] === undefined)
|
|
534
664
|
errors.push(`Missing required frontmatter field: ${field}`);
|
|
535
665
|
}
|
|
666
|
+
const extractedTasks = extractPlanTaskInfos(content);
|
|
536
667
|
const tasks = [];
|
|
537
|
-
for (const
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
warnings.push(`Task '${taskName}' missing <verify>`);
|
|
550
|
-
if (!hasDone)
|
|
551
|
-
warnings.push(`Task '${taskName}' missing <done>`);
|
|
552
|
-
if (!hasFiles)
|
|
553
|
-
warnings.push(`Task '${taskName}' missing <files>`);
|
|
554
|
-
tasks.push({ name: taskName, hasFiles, hasAction, hasVerify, hasDone });
|
|
668
|
+
for (const task of extractedTasks) {
|
|
669
|
+
const verdict = validatePlanTaskStructure(task);
|
|
670
|
+
errors.push(...verdict.errors);
|
|
671
|
+
warnings.push(...verdict.warnings);
|
|
672
|
+
tasks.push({
|
|
673
|
+
name: task.hasName ? task.name : 'unnamed',
|
|
674
|
+
type: task.type,
|
|
675
|
+
hasFiles: task.hasFiles,
|
|
676
|
+
hasAction: task.hasAction,
|
|
677
|
+
hasVerify: task.hasVerify,
|
|
678
|
+
hasDone: task.hasDone,
|
|
679
|
+
});
|
|
555
680
|
}
|
|
556
681
|
if (tasks.length === 0)
|
|
557
682
|
warnings.push('No <task> elements found');
|
|
@@ -566,6 +691,24 @@ function cmdVerifyPlanStructure(cwd, filePath, raw) {
|
|
|
566
691
|
if (hasCheckpoints && fm['autonomous'] !== 'false' && String(fm['autonomous']) !== 'false') {
|
|
567
692
|
errors.push('Has checkpoint tasks but autonomous is not false');
|
|
568
693
|
}
|
|
694
|
+
// #1951: a decision rated one-way is supposed to be confirmed before it is
|
|
695
|
+
// walked through. Warn (never error — <reversibility> stays additive) when a
|
|
696
|
+
// one-way rating has no checkpoint:decision anywhere ahead of it in the plan,
|
|
697
|
+
// which is the planner emitting the rating but skipping the gate.
|
|
698
|
+
const decisionCheckpointOffsets = [];
|
|
699
|
+
for (const m of content.matchAll(/<task\s+type=["']?checkpoint:decision/g)) {
|
|
700
|
+
if (m.index !== undefined)
|
|
701
|
+
decisionCheckpointOffsets.push(m.index);
|
|
702
|
+
}
|
|
703
|
+
for (const m of content.matchAll(/<reversibility\s[^>]*rating=["']?one-way/g)) {
|
|
704
|
+
const at = m.index;
|
|
705
|
+
if (at === undefined)
|
|
706
|
+
continue;
|
|
707
|
+
if (!decisionCheckpointOffsets.some((offset) => offset < at)) {
|
|
708
|
+
warnings.push('Task rated <reversibility rating="one-way"> has no preceding checkpoint:decision — '
|
|
709
|
+
+ 'a one-way door must be confirmed before the agent walks through it');
|
|
710
|
+
}
|
|
711
|
+
}
|
|
569
712
|
const echoScan = scanNegativeGrepCommentEcho(content);
|
|
570
713
|
errors.push(...echoScan.errors);
|
|
571
714
|
warnings.push(...echoScan.warnings);
|
|
@@ -1049,7 +1192,7 @@ function cmdValidateConsistency(cwd, raw) {
|
|
|
1049
1192
|
.sort();
|
|
1050
1193
|
for (const dir of dirs) {
|
|
1051
1194
|
const phasePath = node_path_1.default.join(phaseRoot, dir);
|
|
1052
|
-
const phaseLabel = node_path_1.default.relative(planBase, phasePath)
|
|
1195
|
+
const phaseLabel = (0, shell_command_projection_cjs_1.posixNormalize)(node_path_1.default.relative(planBase, phasePath));
|
|
1053
1196
|
const phaseFiles = node_fs_1.default.readdirSync(phasePath);
|
|
1054
1197
|
const plans = phaseFiles.filter((f) => f.endsWith('-PLAN.md')).sort();
|
|
1055
1198
|
const planNums = plans
|
|
@@ -1206,9 +1349,22 @@ function cmdValidateHealth(cwd, options, raw) {
|
|
|
1206
1349
|
try {
|
|
1207
1350
|
const rawCfg = node_fs_1.default.readFileSync(configPath, 'utf-8');
|
|
1208
1351
|
const parsed = JSON.parse(rawCfg);
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1352
|
+
if (parsed['model_profile'] && !model_catalog_cjs_1.VALID_PROFILES.includes(parsed['model_profile'])) {
|
|
1353
|
+
addIssue('warning', 'W004', `config.json: invalid model_profile "${parsed['model_profile']}"`, `Valid values: ${model_catalog_cjs_1.VALID_PROFILES.join(', ')}`);
|
|
1354
|
+
}
|
|
1355
|
+
const configModels = parsed['models'];
|
|
1356
|
+
if (configModels && typeof configModels === 'object' && !Array.isArray(configModels)) {
|
|
1357
|
+
for (const [phaseType, tierValue] of Object.entries(configModels)) {
|
|
1358
|
+
if (!model_catalog_cjs_1.VALID_PHASE_TYPES.has(phaseType)) {
|
|
1359
|
+
addIssue('warning', 'W022', `config.json: models has an unknown phase type "${phaseType}" which will be ignored`, `Valid phase types: ${[...model_catalog_cjs_1.VALID_PHASE_TYPES].join(', ')}`);
|
|
1360
|
+
}
|
|
1361
|
+
else if (typeof tierValue !== 'string' || !model_catalog_cjs_1.VALID_TIERS.has(tierValue)) {
|
|
1362
|
+
addIssue('warning', 'W022', `config.json: models.${phaseType} has an invalid tier value ${JSON.stringify(tierValue)} which will be ignored`, `Valid tiers: ${[...model_catalog_cjs_1.VALID_TIERS].join(', ')}`);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
else if (configModels !== undefined && configModels !== null) {
|
|
1367
|
+
addIssue('warning', 'W022', `config.json: models is set to ${JSON.stringify(configModels)}, but must be an object mapping phase types to tiers — this value will be ignored`, `Set models to an object like {"planning": "sonnet"}, or remove the key to use profile defaults`);
|
|
1212
1368
|
}
|
|
1213
1369
|
}
|
|
1214
1370
|
catch (err) {
|
|
@@ -1259,6 +1415,49 @@ function cmdValidateHealth(cwd, options, raw) {
|
|
|
1259
1415
|
addIssue('warning', 'W005', `Phase directory "${e.name}" doesn't follow NN-name format`, 'Rename to match pattern (e.g., 01-setup)');
|
|
1260
1416
|
}
|
|
1261
1417
|
}
|
|
1418
|
+
// W023 (#2408): detect two or more real on-disk phase directories that
|
|
1419
|
+
// normalize to the same phase key (e.g. `05-real/` + `05-real-stray/`).
|
|
1420
|
+
// The collision silently breaks /gsd-stats status accuracy (now folded by
|
|
1421
|
+
// precedence — see commands.cts foldPhaseStatus) and forces an operator
|
|
1422
|
+
// decision. Wording is neutral — never guesses which directory is "real".
|
|
1423
|
+
{
|
|
1424
|
+
const groups = new Map();
|
|
1425
|
+
for (const e of phaseDirEntries) {
|
|
1426
|
+
// extractPhaseToken never returns empty — for unparseable dir names it
|
|
1427
|
+
// falls back to the dir name itself. Two distinct unparseable names
|
|
1428
|
+
// therefore normalize to distinct keys and cannot false-positive here;
|
|
1429
|
+
// only dirs whose tokens collapse to the same key (e.g. `05-real` and
|
|
1430
|
+
// `05-real-stray` → token `05`) produce a collision group.
|
|
1431
|
+
const token = extractPhaseToken(e.name);
|
|
1432
|
+
const key = normalizePhaseName(token);
|
|
1433
|
+
const list = groups.get(key);
|
|
1434
|
+
if (list)
|
|
1435
|
+
list.push(e.name);
|
|
1436
|
+
else
|
|
1437
|
+
groups.set(key, [e.name]);
|
|
1438
|
+
}
|
|
1439
|
+
for (const [key, dirs] of groups) {
|
|
1440
|
+
if (dirs.length < 2)
|
|
1441
|
+
continue;
|
|
1442
|
+
// Compute each dir's status independently so the warning is informative.
|
|
1443
|
+
// Sort by phase id for stable output regardless of readdir order; tie-
|
|
1444
|
+
// break on the dir name itself so two dirs sharing the same phase token
|
|
1445
|
+
// (the collision case itself) still sort deterministically (V8's stable
|
|
1446
|
+
// sort would otherwise fall back to non-portable fs.readdirSync order).
|
|
1447
|
+
const described = dirs
|
|
1448
|
+
.slice()
|
|
1449
|
+
.sort((a, b) => comparePhaseNum(a, b) || String(a).localeCompare(String(b)))
|
|
1450
|
+
.map((d) => {
|
|
1451
|
+
const files = phaseDirFiles.get(d) || [];
|
|
1452
|
+
const plans = files.filter(f => f.endsWith('-PLAN.md') || f === 'PLAN.md').length;
|
|
1453
|
+
const summaries = files.filter(f => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md').length;
|
|
1454
|
+
const status = determinePhaseStatus(plans, summaries, node_path_1.default.join(phasesDir, d), 'Not Started');
|
|
1455
|
+
return `${d} (${status})`;
|
|
1456
|
+
})
|
|
1457
|
+
.join(', ');
|
|
1458
|
+
addIssue('warning', 'W023', `Phase directories collide on normalized key "${key}": ${described}`, 'Inspect each directory; rename or remove the duplicate so only one directory maps to this phase key');
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1262
1461
|
for (const e of phaseDirEntries) {
|
|
1263
1462
|
const phaseFiles = phaseDirFiles.get(e.name) || [];
|
|
1264
1463
|
const plans = phaseFiles.filter((f) => f.endsWith('-PLAN.md') || f === 'PLAN.md');
|
|
@@ -1591,7 +1790,7 @@ function cmdValidateHealth(cwd, options, raw) {
|
|
|
1591
1790
|
stateContent += `**Current phase:** (determining...)\n`;
|
|
1592
1791
|
stateContent += `**Status:** Resuming\n\n`;
|
|
1593
1792
|
stateContent += `## Session Log\n\n`;
|
|
1594
|
-
stateContent += `- ${
|
|
1793
|
+
stateContent += `- ${clock_cjs_1.realClock.localToday()}: STATE.md regenerated by ${slash('health')} --repair\n`;
|
|
1595
1794
|
writeStateMd(statePath, stateContent, cwd);
|
|
1596
1795
|
repairActions.push({ action: repair, success: true, path: 'STATE.md' });
|
|
1597
1796
|
break;
|
|
@@ -1647,7 +1846,7 @@ function cmdValidateHealth(cwd, options, raw) {
|
|
|
1647
1846
|
case 'backfillMilestones': {
|
|
1648
1847
|
if (!options['backfill'] && !options['repair'])
|
|
1649
1848
|
break;
|
|
1650
|
-
const today =
|
|
1849
|
+
const today = clock_cjs_1.realClock.localToday();
|
|
1651
1850
|
let backfilled = 0;
|
|
1652
1851
|
for (const ver of missingFromRegistry) {
|
|
1653
1852
|
try {
|
|
@@ -17,6 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
};
|
|
18
18
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
19
19
|
const node_path_1 = __importDefault(require("node:path"));
|
|
20
|
+
const clock_cjs_1 = require("./clock.cjs");
|
|
20
21
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
22
|
const io = require("./io.cjs");
|
|
22
23
|
const { output, error } = io;
|
|
@@ -154,7 +155,7 @@ function cmdWorkstreamCreate(cwd, name, options, raw) {
|
|
|
154
155
|
}
|
|
155
156
|
(0, shell_command_projection_cjs_1.platformEnsureDir)(wsDir);
|
|
156
157
|
(0, shell_command_projection_cjs_1.platformEnsureDir)(node_path_1.default.join(wsDir, 'phases'));
|
|
157
|
-
const today =
|
|
158
|
+
const today = clock_cjs_1.realClock.localToday();
|
|
158
159
|
const stateContent = [
|
|
159
160
|
'---',
|
|
160
161
|
`workstream: ${slug}`,
|
|
@@ -264,7 +265,7 @@ function cmdWorkstreamComplete(cwd, name, options, raw) {
|
|
|
264
265
|
if (active === name)
|
|
265
266
|
setActiveWorkstream(cwd, null);
|
|
266
267
|
const archiveDir = node_path_1.default.join(root, 'milestones');
|
|
267
|
-
const today =
|
|
268
|
+
const today = clock_cjs_1.realClock.localToday();
|
|
268
269
|
let archivePath = node_path_1.default.join(archiveDir, `ws-${name}-${today}`);
|
|
269
270
|
let suffix = 1;
|
|
270
271
|
while (node_fs_1.default.existsSync(archivePath)) {
|
|
@@ -440,7 +440,7 @@ function rescueSummaryArtifacts(worktreePath, repoRoot, deps) {
|
|
|
440
440
|
// relPath is the path relative to the worktree root (e.g. ".planning/q1-SUMMARY.md")
|
|
441
441
|
// Normalize to forward slashes so the Set comparison against `git status --porcelain`
|
|
442
442
|
// output works on Windows too (git always emits forward slashes in porcelain output).
|
|
443
|
-
const relPath = absPath.slice(worktreePath.length).replace(/^[/\\]/, '')
|
|
443
|
+
const relPath = (0, shell_command_projection_cjs_1.posixNormalize)(absPath.slice(worktreePath.length).replace(/^[/\\]/, ''));
|
|
444
444
|
// #706: skip rescue when the SUMMARY is already committed on the branch.
|
|
445
445
|
// Use `git cat-file -e HEAD:<relPath>` (not `ls-files --error-unmatch`) so
|
|
446
446
|
// the check is against the committed tree, not the index. ls-files also
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Write-Set — shared fail-loud parse `Result` and per-surface write-set
|
|
4
|
+
* contracts (ADR-2143, epic #2143). Pure, Node built-ins only, no I/O.
|
|
5
|
+
* Compiled by tsc to gsd-core/bin/lib/write-set.cjs.
|
|
6
|
+
*
|
|
7
|
+
* ADR-2143 §5 (fail-loud parsing, no null-swallow): seam parse operations
|
|
8
|
+
* and document-model accessors return a typed `Result<T>` — never a bare
|
|
9
|
+
* `null` a caller can mistake for "empty but fine." This is the same
|
|
10
|
+
* `{ ok: true; value: T } | { ok: false; reason: string }` shape
|
|
11
|
+
* `markdown-table.cts` already defined for `parseMarkdownTable` /
|
|
12
|
+
* `appendQuickTaskRow`; this module is now the single source of truth for
|
|
13
|
+
* it and `markdown-table.cjs` re-exports the type so existing importers of
|
|
14
|
+
* `Result` from that module keep working unchanged.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: deliberately distinct from command-routing-hub's dispatch `Result`
|
|
17
|
+
* (`{ok,data}|{ok:false,kind}`) — the two never mix (different modules,
|
|
18
|
+
* different shapes, different purposes).
|
|
19
|
+
*
|
|
20
|
+
* ADR-2143 §6 (write-set results for multi-surface commands, no
|
|
21
|
+
* OR-into-one-flag): a command that mutates more than one surface returns
|
|
22
|
+
* an explicit per-surface write-set — `{ surface, applied }` outcomes — and
|
|
23
|
+
* its top-level "did this fully succeed" signal is true only if EVERY
|
|
24
|
+
* surface in the set applied. ORing independent surfaces into a single
|
|
25
|
+
* boolean is the direct anti-pattern that let a checkbox-only partial
|
|
26
|
+
* write (#2140) report full success.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.writeSetComplete = writeSetComplete;
|
|
30
|
+
/**
|
|
31
|
+
* True only if the write-set is non-empty AND every surface in it applied.
|
|
32
|
+
* An empty write-set is never "complete" — there is nothing to be complete
|
|
33
|
+
* about, so treating it as vacuously true would let a no-op masquerade as
|
|
34
|
+
* a full success (the same OR-into-one-flag class ADR-2143 §6 prohibits).
|
|
35
|
+
*/
|
|
36
|
+
function writeSetComplete(ws) {
|
|
37
|
+
return ws.length > 0 && ws.every((o) => o.applied);
|
|
38
|
+
}
|
|
@@ -71,6 +71,9 @@
|
|
|
71
71
|
"workflow.context_coverage_gate",
|
|
72
72
|
"statusline.show_last_command",
|
|
73
73
|
"statusline.context_position",
|
|
74
|
+
"statusline.show_context_tokens",
|
|
75
|
+
"statusline.state_format",
|
|
76
|
+
"statusline.show_git",
|
|
74
77
|
"workflow.max_discuss_passes",
|
|
75
78
|
"features.thinking_partner",
|
|
76
79
|
"context",
|
|
@@ -146,8 +149,8 @@
|
|
|
146
149
|
},
|
|
147
150
|
{
|
|
148
151
|
"topLevel": "dynamic_routing",
|
|
149
|
-
"source": "^dynamic_routing\\.(enabled|escalate_on_failure|max_escalations|tier_models\\.(light|standard|heavy))$",
|
|
150
|
-
"description": "dynamic_routing.<enabled|escalate_on_failure|max_escalations|tier_models.<light|standard|heavy>>"
|
|
152
|
+
"source": "^dynamic_routing\\.(enabled|escalate_on_failure|max_escalations|provider_escalation|tier_models\\.(light|standard|heavy))$",
|
|
153
|
+
"description": "dynamic_routing.<enabled|escalate_on_failure|max_escalations|provider_escalation|tier_models.<light|standard|heavy>>"
|
|
151
154
|
},
|
|
152
155
|
{
|
|
153
156
|
"topLevel": "model_overrides",
|