Sync functional improvements developed in revive-dev into BMAD-METHOD
fork while preserving repo-specific paths:
- Add memory-safe Claude helpers (run_claude_to_file, read_phase_tail)
that pipe output to temp files instead of bash variables, preventing
GB-scale RAM usage during long epic executions
- Add kill_orphaned_test_processes() to clean up zombie jest/vitest/
playwright/pytest processes between stories and on exit
- Replace per-call `env -u CLAUDECODE` with global `unset CLAUDECODE`
at script start for cleaner nested session support
- Port metrics resume/accumulation logic that restores counters from
existing YAML on resumed runs and accumulates duration
- Add log truncation between stories (64KB cap) to prevent unbounded
log growth across multi-story runs
- Add log persistence and cleanup trap to epic-chain.sh
- Revert regression-gate.sh test commands to direct execution (matching
revive-dev pattern)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Wrap all Claude CLI subprocess calls with `env -u CLAUDECODE` to prevent
parent env var interference with child processes (17 sites across 7 files)
- Add `flush_log_to_repo()` to epic-execute.sh for incremental log persistence
after each story completes or fails (prevents log loss on interruption)
- Add portable `run_with_timeout` utility to utils.sh and wrap all test
invocations in epic-execute.sh and regression-gate.sh with configurable
timeout (default 120s via REGRESSION_TEST_TIMEOUT)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port improvements developed in revive-dev: new test-failure-filter module for
baseline-aware failure detection and prompt size management, broken pipe fixes
in regression-gate, and log persistence in epic-execute. Paths adapted to
BMAD-METHOD repo structure.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
H1: Git Add -A Safety
- Add check_sensitive_files() to detect untracked secrets
- Replace git add -A with git add -u (tracked files only)
- Update prompts to use explicit file staging
H2: Cleanup on Exit
- Add cleanup() function with trap handler for EXIT/INT/TERM
- Save checkpoint file for resume capability
- Finalize metrics and report uncommitted changes on exit
- Track CURRENT_STORY_INDEX throughout main loop
H3: Test Count Parsing (Multi-Framework)
- Add extract_test_count() supporting Jest, Mocha, Vitest, AVA, TAP, pytest, Go, Rust
- Try JSON output first, fall back to regex patterns
- Replace inline patterns in init_regression_baseline() and execute_regression_gate()
H4: Story Discovery (Word Boundaries)
- Fix grep pattern with word boundary: ${EPIC_ID}([^0-9]|$)
- Prevents "Epic: 1" from matching "Epic: 10" or "Epic: 100"
- Add associative array deduplication (bash 4+) with fallback
H5: Prompt Size Limits
- Add MAX_PROMPT_SIZE config (default 150KB)
- Add get_byte_size(), truncate_content(), build_sized_prompt()
- Truncate large workflow YAML and decision logs
- Add verbose logging of prompt sizes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add decision log module for context preservation across phases
- Add regression gate module for test baseline tracking
- Add design phase module for pre-implementation planning
- Enhance fix phase to include real tooling output
- Pass design and decision context to dev phase
- Add --skip-design and --skip-regression CLI flags
- Modularize into epic-execute-lib/ for maintainability
Implements improvements from bmad_improvements_v2.md:
- Phase 2.1: Real test output in fix loops
- Phase 2.2: Cumulative decision log
- Phase 2.3: Regression test gate
- Phase 3.1: Pre-implementation design phase
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>