diff --git a/gsd-core/workflows/onboard.md b/gsd-core/workflows/onboard.md index 69e4d6c27..ee3016dd4 100644 --- a/gsd-core/workflows/onboard.md +++ b/gsd-core/workflows/onboard.md @@ -199,6 +199,18 @@ invocations do not create `subdir/.planning` artifacts. Create `{ONBOARDING_ROOT}/.planning/onboarding/SUMMARY.md` only after PROJECT.md exists. If it already exists, update it only after confirmation; do not overwrite silently. +Before summary keep/update choices, derive map status values safely: + +- If `has_codebase_map` is true: + - `CODEBASE_MAP_SUMMARY_STATUS=.planning/codebase/ (complete)` + - `CODEBASE_MAP_FINAL_STATUS=(complete)` +- Else if `fast_mode && has_fast_codebase_map` is true: + - `CODEBASE_MAP_SUMMARY_STATUS=.planning/codebase/ (fast/partial-but-accepted codebase map)` + - `CODEBASE_MAP_FINAL_STATUS=(fast/partial-but-accepted; required fast files present)` +- Else: + - `CODEBASE_MAP_SUMMARY_STATUS=.planning/codebase/ (incomplete or skipped)` + - `CODEBASE_MAP_FINAL_STATUS=(incomplete or skipped; missing: {missing_codebase_map_files})` + If `onboarding_summary_exists` is true: - If `TEXT_MODE=true`, print: @@ -226,18 +238,6 @@ If the user chooses to keep the existing summary, skip to Step 7 without writing If `onboarding_summary_exists` is false or the user confirms an update, write the summary using the template below. -Before rendering summary and final status, derive map status values: - -- If `has_codebase_map` is true: - - `CODEBASE_MAP_SUMMARY_STATUS=.planning/codebase/ (complete)` - - `CODEBASE_MAP_FINAL_STATUS=(complete)` -- Else if `fast_mode && has_fast_codebase_map` is true: - - `CODEBASE_MAP_SUMMARY_STATUS=.planning/codebase/ (fast/partial-but-accepted codebase map)` - - `CODEBASE_MAP_FINAL_STATUS=(fast/partial-but-accepted; required fast files present)` -- Else: - - `CODEBASE_MAP_SUMMARY_STATUS=.planning/codebase/ (incomplete or skipped)` - - `CODEBASE_MAP_FINAL_STATUS=(incomplete or skipped; missing: {missing_codebase_map_files})` - Summary contents: ```markdown diff --git a/tests/onboard-command.test.cjs b/tests/onboard-command.test.cjs index d75df86ad..afd6ec81e 100644 --- a/tests/onboard-command.test.cjs +++ b/tests/onboard-command.test.cjs @@ -288,6 +288,14 @@ describe('/gsd:onboard command contract', () => { /CODEBASE_MAP_FINAL_STATUS=\(fast\/partial-but-accepted; required fast files present\)/, 'final status must distinguish complete maps from accepted fast maps', ); + const deriveMapStatusIndex = content.indexOf('Before summary keep/update choices, derive map status values safely:'); + const keepExistingSummaryIndex = content.indexOf('If `onboarding_summary_exists` is true:'); + assert.ok(deriveMapStatusIndex >= 0, 'workflow must derive map status values'); + assert.ok(keepExistingSummaryIndex >= 0, 'workflow must define the existing-summary branch'); + assert.ok( + deriveMapStatusIndex < keepExistingSummaryIndex, + 'workflow must derive final map status before a keep-existing-summary path can skip to final status', + ); assert.match(content, /overwrite|idempotent|do not overwrite/i, 'workflow must protect existing planning'); assert.ok(content.includes('requirements_exists'), 'workflow must parse requirements existence'); assert.match(content, /REQUIREMENTS\.md: \{requirements_exists \? "present" : "missing"\}/, 'workflow must report missing requirements in partial planning');