From aae46a706d7f612f0f0983f0b75d9a59068f9c47 Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Thu, 9 Apr 2026 11:37:32 -0700 Subject: [PATCH] refactor(quick-dev): extract sprint-status sync into shared file Replace inline sync blocks in step-03, step-05, and step-oneshot with one-line callouts to sync-sprint-status.md. The shared file owns all edge-case handling (idempotency, epic lift, missing file/key) and is parameterized by {target_status}. Any future route picks it up with a single Follow line. --- .../bmad-quick-dev/step-03-implement.md | 15 +----------- .../bmad-quick-dev/step-05-present.md | 13 +--------- .../bmad-quick-dev/step-oneshot.md | 24 ++----------------- .../bmad-quick-dev/sync-sprint-status.md | 19 +++++++++++++++ 4 files changed, 23 insertions(+), 48 deletions(-) create mode 100644 src/bmm-skills/4-implementation/bmad-quick-dev/sync-sprint-status.md diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md index 159347f70..fa2db516d 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-03-implement.md @@ -24,20 +24,7 @@ Capture `baseline_commit` (current HEAD, or `NO_VCS` if version control is unava Change `{spec_file}` status to `in-progress` in the frontmatter before starting implementation. -#### Sync sprint status - -Skip this subsection if `{story_key}` is unset (the intent is not an epic story, or `step-01` could not resolve a sprint-status entry) or if `{sprint_status}` does not exist on disk. - -Otherwise: - -1. Load the FULL `{sprint_status}` file. -2. Find the `development_status` entry matching `{story_key}`. If not found, warn the user once (`"{story_key} not found in sprint-status; skipping sprint sync"`) and skip the remaining sub-steps. -3. Derive the parent epic key as `epic-{N}` where `{N}` is the leading numeric segment of `{story_key}` (e.g., `3-2-digest-delivery` → `epic-3`). -4. **Idempotency check.** If `development_status[{story_key}]` is already `in-progress` AND the parent epic entry is already `in-progress` or `done` (or missing), skip the remaining sub-steps — no write needed. This prevents step-04 loopbacks from clobbering human edits and from bumping `last_updated` without cause. -5. Set `development_status[{story_key}]` to `in-progress`. -6. If the parent epic entry exists and its current value is `backlog`, set it to `in-progress`. Leave it alone otherwise. -7. Refresh `last_updated` to the current date. -8. Save the file, preserving ALL comments and structure including STATUS DEFINITIONS and WORKFLOW NOTES. +Follow `./sync-sprint-status.md` with `{target_status}` = `in-progress`. If `{spec_file}` has a non-empty `context:` list in its frontmatter, load those files before implementation begins. When handing to a sub-agent, include them in the sub-agent prompt so it has access to the referenced context. diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-05-present.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-05-present.md index 9dc8c0ce9..6b1a1501b 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-05-present.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-05-present.md @@ -52,18 +52,7 @@ When there is only one concern, omit the bold label — just list the stops dire Change `{spec_file}` status to `done` in the frontmatter. -### Sync sprint status - -Skip this section if `{story_key}` is unset or `{sprint_status}` does not exist on disk. - -Otherwise: - -1. Load the FULL `{sprint_status}` file. -2. Find the `development_status` entry matching `{story_key}`. If not found, warn the user once (`"{story_key} not found in sprint-status; skipping sprint sync"`) and skip the remaining sub-steps. -3. **Idempotency check.** If `development_status[{story_key}]` is already `review` (or `done`), skip the remaining sub-steps — no write needed. Do not regress a `done` story back to `review`. -4. Set `development_status[{story_key}]` to `review`. Do not touch the parent epic entry — code-review owns the `review → done` transition and will decide whether the epic itself is done. -5. Refresh `last_updated` to the current date. -6. Save the file, preserving ALL comments and structure including STATUS DEFINITIONS and WORKFLOW NOTES. +Follow `./sync-sprint-status.md` with `{target_status}` = `review`. ### Commit and Open diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md index 23ebb5589..62192c74a 100644 --- a/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md @@ -13,18 +13,7 @@ deferred_work_file: '{implementation_artifacts}/deferred-work.md' ### Implement -#### Sync sprint status (start) - -Skip if `{story_key}` is unset or `{sprint_status}` does not exist on disk. Otherwise: - -1. Load the FULL `{sprint_status}` file. -2. Find the `development_status` entry matching `{story_key}`. If not found, warn once and skip. -3. Derive the parent epic key as `epic-{N}` from the leading numeric segment of `{story_key}`. -4. **Idempotency check.** If `development_status[{story_key}]` is already `in-progress` AND the parent epic is already `in-progress` or `done` (or missing), skip — no write needed. -5. Set `development_status[{story_key}]` to `in-progress`. -6. If the parent epic entry exists and is `backlog`, set it to `in-progress`. Leave it alone otherwise. -7. Refresh `last_updated` to the current date. -8. Save the file, preserving ALL comments and structure including STATUS DEFINITIONS and WORKFLOW NOTES. +Follow `./sync-sprint-status.md` with `{target_status}` = `in-progress`. Implement the clarified intent directly. @@ -52,16 +41,7 @@ Write `{spec_file}` using `./spec-template.md`. Fill only these sections — del 2. **Title and Intent** — `# {title}` heading and `## Intent` with **Problem** and **Approach** lines. Reuse the summary you already generated for the terminal. 3. **Suggested Review Order** — append after Intent. Build using the same convention as `./step-05-present.md` § "Generate Suggested Review Order" (spec-file-relative links, concern-based ordering, ultra-concise framing). -### Sync sprint status (end) - -Skip if `{story_key}` is unset or `{sprint_status}` does not exist on disk. Otherwise: - -1. Load the FULL `{sprint_status}` file. -2. Find the `development_status` entry matching `{story_key}`. If not found, warn once and skip. -3. **Idempotency check.** If `development_status[{story_key}]` is already `review` (or `done`), skip — do not regress. -4. Set `development_status[{story_key}]` to `review`. Do not touch the parent epic entry. -5. Refresh `last_updated` to the current date. -6. Save the file, preserving ALL comments and structure including STATUS DEFINITIONS and WORKFLOW NOTES. +Follow `./sync-sprint-status.md` with `{target_status}` = `review`. ### Commit diff --git a/src/bmm-skills/4-implementation/bmad-quick-dev/sync-sprint-status.md b/src/bmm-skills/4-implementation/bmad-quick-dev/sync-sprint-status.md new file mode 100644 index 000000000..2ee1651a0 --- /dev/null +++ b/src/bmm-skills/4-implementation/bmad-quick-dev/sync-sprint-status.md @@ -0,0 +1,19 @@ +# Sync Sprint Status + +Shared sub-step for updating `sprint-status.yaml` during quick-dev. Called from any route (plan-code-review, one-shot, future routes) with a `{target_status}` parameter. + +## Preconditions + +Skip this entire file (return to caller) if ANY of: +- `{story_key}` is unset +- `{sprint_status}` does not exist on disk + +## Instructions + +1. Load the FULL `{sprint_status}` file. +2. Find the `development_status` entry matching `{story_key}`. If not found, warn the user once (`"{story_key} not found in sprint-status; skipping sprint sync"`) and return to caller. +3. **Idempotency check.** If `development_status[{story_key}]` is already at `{target_status}` or a later state (`review` is later than `in-progress`; `done` is later than both), return to caller — no write needed. Never regress a story's status. +4. Set `development_status[{story_key}]` to `{target_status}`. +5. **Epic lift (only when `{target_status}` = `in-progress`).** Derive the parent epic key as `epic-{N}` from the leading numeric segment of `{story_key}` (e.g., `3-2-digest-delivery` → `epic-3`). If that entry exists and is `backlog`, set it to `in-progress`. Leave it alone otherwise. Skip this sub-step entirely when `{target_status}` is not `in-progress`. +6. Refresh `last_updated` to the current date. +7. Save the file, preserving ALL comments and structure including STATUS DEFINITIONS and WORKFLOW NOTES.