Implements ADR-1411 P2 / #1415, closing #1366. Part 1 — config-loader.cts: - Adds `loadConfigResolved(cwd, options) → ConfigResolution { config, source, degraded }` with six tagged branch return paths: A1 ws+wsconfig → source:'workstream', degraded:false A2 no-ws+config → source:'root', degraded:false B ws requested, wsconfig absent → source:'root', degraded:true (intercepts recursive call) C .planning/ exists, no config → source:'builtin-defaults', degraded:false D no .planning/, global defaults readable → source:'global-defaults', degraded:false E no .planning/, no global → source:'builtin-defaults', degraded:false - `loadConfigResolved` calls `findProjectRoot` at entry to anchor resolution to the nearest .planning/ ancestor (cwd-drift fix, heuristic 4 from P1) - `loadConfig` becomes a one-line delegation: `return loadConfigResolved(cwd, options).config` - Exports `loadConfigResolved` in the `export =` block Part 2 — init.cts cmdAgentSkills: - Imports `findProjectRoot` from `./project-root.cjs` - Anchors to project root before loading config (fixes #1366 cwd-drift) - Uses `loadConfigResolved` for provenance; passes projectRoot to buildAgentSkillsBlock - Computes `configured` + `reason` (AgentSkillsReason enum): 'resolved' | 'not_configured' | 'configured_empty' | 'configured_unresolved' - configured_empty and configured_unresolved emit stderr WARNING; not_configured is silent - --json IR gains: configured, reason, source, degraded (in addition to existing agent_type, block, skills_count, warnings) Tests (TDD): - tests/config-loader.test.cjs: 8 new provenance tests (RED before impl, GREEN after) - tests/agent-skills.test.cjs: 7 new diagnostic tests (RED before impl, GREEN after) - All 306 tests across 4 suites pass (config-loader:33, agent-skills:72, init:105, workstream:96) Docs: - CONTEXT.md: Config Loader Module entry updated with loadConfigResolved interface; Resolution Provenance entry notes P2 is now implemented - docs/CLI-TOOLS.md: --json field reference table added for agent-skills Closes #1366 Part of #1411 Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1.1 KiB
type, pr
| type | pr |
|---|---|
| Fixed | 1424 |
gsd-tools query agent-skills no longer silently drops a configured agent's skills under cwd or workstream drift — cmdAgentSkills now anchors to the project root via findProjectRoot before loading config, so invoking it from a descendant subdirectory or with a GSD_WORKSTREAM that has no scoped config correctly resolves the configured agent_skills block. A new loadConfigResolved(cwd, options) → { config, source, degraded } function reports provenance alongside the config object: source distinguishes 'root' | 'workstream' | 'builtin-defaults' | 'global-defaults'; degraded:true signals a workstream was requested but its config.json was absent. The --json IR of agent-skills gains four new fields — configured (bool), reason ('resolved' | 'not_configured' | 'configured_empty' | 'configured_unresolved'), source, and degraded — making silent failures visible and testable. A configured_empty or configured_unresolved agent emits a stderr WARNING; an unconfigured agent stays silent. (Closes #1366. Part of #1411, P2 / #1415.)