fix(#2376): emit absolute subagent-facing paths from init/state, convert workflow literals (#2428)

* fix(#2376): emit absolute subagent-facing init/state paths

Make init.* and state.* path fields absolute rather than cwd-relative
so subagent prompts resolve correctly regardless of working directory.
Adds intel_dir/conflicts_path/requirements_path/roadmap_path/state_path
to cmdInitIngestDocs, an absolute debug_dir to cmdStateLoad, and
replaces bare .planning/... literals in 12 workflow Agent() prompt
blocks with the absolute init-JSON path fields. Includes decoy-cwd
regression tests and realpath'd tmpdir fixtures for macOS.

Squashed rebase of the #2376 commit series onto a fresh origin/next
(previous merge ee25543a1 was against a now-stale next).

* chore(#2376): add changeset

* chore(#2376): regenerate golden fixtures + workflow size baseline

Regenerated after rebasing the absolute-path fix onto current next
(picks up #2351's run-with-timeout content in execute-phase.md too).

* fix(#2376): trim execute-phase.md redundancy to stay under the size margin

* chore(#2376): regenerate golden/size baseline after rebase onto next
This commit is contained in:
Tom Boucher
2026-07-19 15:43:48 -04:00
committed by GitHub
parent d04e287fa9
commit 1a46bc068a
42 changed files with 905 additions and 510 deletions

View File

@@ -281,6 +281,30 @@ function toPosixPath(p) {
return p == null ? p : p.split(path.sep).join('/');
}
/**
* Build the expected absolute, POSIX-normalized `.planning/...` path for a
* given fixture root — the shape #2376's init/state path-field output now
* emits (anchored on process.cwd() / --cwd) instead of the historical
* relative literal.
*
* Centralizes the identical inline `absPlanningPath` helper previously
* duplicated across tests/quick-research.test.cjs, tests/init.test.cjs,
* tests/onboard-command.test.cjs, and tests/roadmap-parser.test.cjs.
*
* Callers MUST pass a realpath'd fixture root (e.g.
* `fs.realpathSync(createTempProject())`) so the expected value matches
* what a spawned child process actually resolves via `process.cwd()` — on
* macOS `os.tmpdir()` is a symlink (`/var/...` -> `/private/var/...`) that
* the child's cwd resolves through but a bare `mkdtempSync()` does not.
*
* @param {string} base - fixture root (should be realpath'd by the caller).
* @param {...string} segments - path segments under `.planning/`.
* @returns {string} POSIX-normalized absolute path.
*/
function absPlanningPath(base, ...segments) {
return toPosixPath(path.join(base, '.planning', ...segments));
}
/**
* Run an npm command via execFileSync with cross-platform portability.
*
@@ -426,4 +450,4 @@ function resetRuntimeWarningCaches() {
modelResolver._resetModelOverrideWarningCacheForTests();
}
module.exports = { runGsdTools, createTempDir, createTempProject, createTempGitProject, cleanup, parseFrontmatter, isUsageOutput, captureConsole, toPosixPath, runNpm, isolatedNpmEnv, withIsolatedProcessState, delay, waitFor, resetRuntimeWarningCaches, TOOLS_PATH };
module.exports = { runGsdTools, createTempDir, createTempProject, createTempGitProject, cleanup, parseFrontmatter, isUsageOutput, captureConsole, toPosixPath, absPlanningPath, runNpm, isolatedNpmEnv, withIsolatedProcessState, delay, waitFor, resetRuntimeWarningCaches, TOOLS_PATH };