Commit Graph

4 Commits

Author SHA1 Message Date
Caleb cdc92d0d90 feat(scripts): port memory-safe execution and reliability improvements from revive-dev
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>
2026-04-12 11:52:39 -05:00
Caleb a58fb564d1 feat(scripts): add env isolation, incremental logging, and test timeouts
- 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>
2026-02-14 05:19:53 -06:00
Caleb 51e31ada91 feat(epic-execute): implement low-priority UX improvements (L1-L5)
- L1: Add checkpoint/resume capability with --resume flag
  - load_checkpoint(), save_checkpoint(), clear_checkpoint() in utils.sh
  - Auto-saves progress after each story, 7-day expiration
- L2: Add comprehensive --help option with grouped options and examples
  - show_help() function with environment variables and file locations
- L3: Add verbose Claude output streaming
  - execute_claude_verbose() for real-time output when --verbose set
- L4: Add metrics file archival to prevent unbounded growth
  - Archives to metrics/archive/, keeps last 10 per epic
- L5: Add workflow file content validation
  - validate_yaml_content(), validate_xml_content() with fallbacks
  - Integrated into validate_workflows()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 15:18:20 -06:00
Caleb 06ce7e7fca feat(epic-execute): implement medium-priority reliability fixes (M1-M5)
Add new utils.sh module with cross-platform support and reliability improvements:
- M1: execute_with_retry() with exponential backoff for transient failures
- M2: validate_yq() to detect Go vs Python yq versions with fallback
- M3: check_phase_completion_fuzzy() for case-insensitive signal detection
- M4: sed_inplace() for cross-platform sed (macOS/Linux compatibility)
- M5: check_branch_protection() to prevent commits to main/master

Update json-output.sh with enhanced JSON extraction using awk for multi-block
handling, normalized status comparison, and fuzzy matching fallback.

Update epic-execute.sh to source utils.sh and use cross-platform sed functions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 15:11:41 -06:00