feat(#3149): add dedicated init.debug entry point for /gsd:debug

/gsd:debug was one of the last workflows with no cmdInit* of its own: its
Step 0 made three separate round-trips (state.load, resolve-model
gsd-debugger, config-get workflow.tdd_mode) to assemble one context. Because
no debug-scoped fact was computed at any entry point, ADR-1671 admission gate
(2) could never be satisfied for debug — an applicability atom naming such a
fact would evaluate FALSE forever and silently exclude its section.

Adds cmdInitDebug (init.debug), registers it in the init router and the
command-alias table, and collapses debug.md Step 0 to one call. Every field
resolves through the same primitive the call it replaces used: loadConfig for
commit_docs, withProjectRoot for response_language (#2402), planningPaths for
debug_dir, resolveModelInternal for debugger_model, and the existing
Boolean(workflow.tdd_mode) idiom for tdd_mode.

PlanningPaths gains a debug field so state.load and init.debug share ONE
debug-directory expression rather than two kept in sync by hand. state.load
keeps emitting debug_dir: it is a shipped query surface with its own test
anchor, so narrowing it would break unseen consumers for no gain.

No WHEN_VOCABULARY atom and no gsd:section marker: gate (1), a consuming
section of at least 400 bytes, belongs to the change that adds the section.

Closes #3149

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
sim
2026-08-07 09:30:27 -04:00
parent 0d93a5cfe5
commit 2bead6ca1d
11 changed files with 214 additions and 16 deletions

View File

@@ -351,10 +351,12 @@ function cmdStateLoad(cwd: string, raw: boolean): void {
config_exists: configExists,
// #2376: absolute (anchored on cwd), not orchestrator-cwd-relative — a
// spawned subagent's own cwd may differ from the orchestrator's.
// debug.md has no init.* call of its own; it reads this field from
// `state load` to build debug_file_path for its gsd-debug-session-manager
// spawns instead of hardcoding '.planning/debug/{slug}.md'.
debug_dir: toPosixPath(path.join(planDir, 'debug')),
// #3149: debug.md now has its own `init.debug` entry point and reads this
// field from there, not from `state load`. This stays on the state.load
// bundle regardless: it is a shipped query surface with its own test anchor
// (tests/state.test.cjs), so narrowing it would break unseen consumers for
// no gain (Hyrum's Law). Both emit the SAME `planningPaths(cwd).debug`.
debug_dir: toPosixPath(planningPaths(cwd).debug),
};
// For --raw, output a condensed key=value format