From f5d949b922aa980e040c958748e7244299f6d846 Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Sun, 4 Jan 2026 03:04:56 -0800 Subject: [PATCH] feat(dev-story): capture baseline commit for code-review diff --- .../steps/step-04-adversarial-review.md | 33 ++++++++++--------- .../dev-story/instructions.xml | 11 +++++++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/modules/bmm/workflows/4-implementation/code-review/steps/step-04-adversarial-review.md b/src/modules/bmm/workflows/4-implementation/code-review/steps/step-04-adversarial-review.md index 945d3849..1727c33d 100644 --- a/src/modules/bmm/workflows/4-implementation/code-review/steps/step-04-adversarial-review.md +++ b/src/modules/bmm/workflows/4-implementation/code-review/steps/step-04-adversarial-review.md @@ -22,13 +22,14 @@ nextStepFile: '{workflow_path}/steps/step-05-consolidate-findings.md' From previous steps: - `{story_path}`, `{story_key}` -- `{git_changed_files}` - Files changed according to git +- `{file_list}` - Files listed in story's File List section - `{context_aware_findings}` - Findings from Phase 1 --- ## STATE VARIABLE (capture now) +- `{baseline_commit}` - From story file Dev Agent Record - `{diff_output}` - Complete diff of changes - `{asymmetric_findings}` - Findings from adversarial review @@ -40,29 +41,29 @@ From previous steps: Build complete diff of all changes for this story. -**Determine diff source:** +**Step 1a: Read baseline from story file** -If uncommitted changes exist for story files: +Extract `Baseline Commit` from the story file's Dev Agent Record section. + +- If found and not "NO_GIT": use as `{baseline_commit}` +- If "NO_GIT" or missing: proceed to fallback + +**Step 1b: Construct diff (with baseline)** + +If `{baseline_commit}` is a valid commit hash: ```bash -git diff -git diff --cached +git diff {baseline_commit} -- ':!{implementation_artifacts}' ``` -If story work is already committed, find story-related commits: +This captures all changes (committed + uncommitted) since dev-story started. -```bash -# Find commits that reference this story -git log --oneline --all --grep="{story_key}" --format="%H" -# Or find recent commits touching story files -git log --oneline -10 -- {story_file_list} -``` +**Step 1c: Fallback (no baseline)** -Then construct diff: +If no baseline available, review current state of files in `{file_list}`: -```bash -git diff {first_story_commit}^..HEAD -- {files} -``` +- Read each file listed in the story's File List section +- Review as full file content (not a diff) **Include in `{diff_output}`:** diff --git a/src/modules/bmm/workflows/4-implementation/dev-story/instructions.xml b/src/modules/bmm/workflows/4-implementation/dev-story/instructions.xml index 4fb70efe..3e49b378 100644 --- a/src/modules/bmm/workflows/4-implementation/dev-story/instructions.xml +++ b/src/modules/bmm/workflows/4-implementation/dev-story/instructions.xml @@ -219,6 +219,17 @@ ℹ️ No sprint status file exists - story progress will be tracked in story file only Set {{current_sprint_status}} = "no-sprint-tracking" + + + + Capture current HEAD commit: `git rev-parse HEAD` + Store as {{baseline_commit}} + Write to story file Dev Agent Record: "**Baseline Commit:** {{baseline_commit}}" + + + Set {{baseline_commit}} = "NO_GIT" + Write to story file Dev Agent Record: "**Baseline Commit:** NO_GIT" +