Files
gh-joshuaoliphant-claude-pl…/skills/adw-bootstrap/reference/scaled/workflows/adw_sdlc_iso.py
2025-11-30 08:28:42 +08:00

152 lines
4.5 KiB
Python

#!/usr/bin/env -S uv run
# /// script
# dependencies = ["python-dotenv", "pydantic"]
# ///
"""
ADW SDLC Iso - Complete Software Development Life Cycle workflow with isolation
Usage: uv run adw_sdlc_iso.py <issue-number> [adw-id] [--skip-e2e] [--skip-resolution]
This script runs the complete ADW SDLC pipeline in isolation:
1. adw_plan_iso.py - Planning phase (isolated)
2. adw_build_iso.py - Implementation phase (isolated)
3. adw_test_iso.py - Testing phase (isolated)
4. adw_review_iso.py - Review phase (isolated)
5. adw_document_iso.py - Documentation phase (isolated)
The scripts are chained together via persistent state (adw_state.json).
Each phase runs in its own git worktree with dedicated ports.
"""
import subprocess
import sys
import os
# Add the parent directory to Python path to import modules
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from adw_modules.workflow_ops import ensure_adw_id
def main():
"""Main entry point."""
# Check for flags
skip_e2e = "--skip-e2e" in sys.argv
skip_resolution = "--skip-resolution" in sys.argv
# Remove flags from argv
if skip_e2e:
sys.argv.remove("--skip-e2e")
if skip_resolution:
sys.argv.remove("--skip-resolution")
if len(sys.argv) < 2:
print("Usage: uv run adw_sdlc_iso.py <issue-number> [adw-id] [--skip-e2e] [--skip-resolution]")
print("\nThis runs the complete isolated Software Development Life Cycle:")
print(" 1. Plan (isolated)")
print(" 2. Build (isolated)")
print(" 3. Test (isolated)")
print(" 4. Review (isolated)")
print(" 5. Document (isolated)")
sys.exit(1)
issue_number = sys.argv[1]
adw_id = sys.argv[2] if len(sys.argv) > 2 else None
# Ensure ADW ID exists with initialized state
adw_id = ensure_adw_id(issue_number, adw_id)
print(f"Using ADW ID: {adw_id}")
# Get the directory where this script is located
script_dir = os.path.dirname(os.path.abspath(__file__))
# Run isolated plan with the ADW ID
plan_cmd = [
"uv",
"run",
os.path.join(script_dir, "adw_plan_iso.py"),
issue_number,
adw_id,
]
print(f"\n=== ISOLATED PLAN PHASE ===")
print(f"Running: {' '.join(plan_cmd)}")
plan = subprocess.run(plan_cmd)
if plan.returncode != 0:
print("Isolated plan phase failed")
sys.exit(1)
# Run isolated build with the ADW ID
build_cmd = [
"uv",
"run",
os.path.join(script_dir, "adw_build_iso.py"),
issue_number,
adw_id,
]
print(f"\n=== ISOLATED BUILD PHASE ===")
print(f"Running: {' '.join(build_cmd)}")
build = subprocess.run(build_cmd)
if build.returncode != 0:
print("Isolated build phase failed")
sys.exit(1)
# Run isolated test with the ADW ID
test_cmd = [
"uv",
"run",
os.path.join(script_dir, "adw_test_iso.py"),
issue_number,
adw_id,
"--skip-e2e", # Always skip E2E tests in SDLC workflows
]
print(f"\n=== ISOLATED TEST PHASE ===")
print(f"Running: {' '.join(test_cmd)}")
test = subprocess.run(test_cmd)
if test.returncode != 0:
print("Isolated test phase failed")
# Note: Continue anyway as some tests might be flaky
print("WARNING: Test phase failed but continuing with review")
# Run isolated review with the ADW ID
review_cmd = [
"uv",
"run",
os.path.join(script_dir, "adw_review_iso.py"),
issue_number,
adw_id,
]
if skip_resolution:
review_cmd.append("--skip-resolution")
print(f"\n=== ISOLATED REVIEW PHASE ===")
print(f"Running: {' '.join(review_cmd)}")
review = subprocess.run(review_cmd)
if review.returncode != 0:
print("Isolated review phase failed")
sys.exit(1)
# Run isolated documentation with the ADW ID
document_cmd = [
"uv",
"run",
os.path.join(script_dir, "adw_document_iso.py"),
issue_number,
adw_id,
]
print(f"\n=== ISOLATED DOCUMENTATION PHASE ===")
print(f"Running: {' '.join(document_cmd)}")
document = subprocess.run(document_cmd)
if document.returncode != 0:
print("Isolated documentation phase failed")
sys.exit(1)
print(f"\n=== ISOLATED SDLC COMPLETED ===")
print(f"ADW ID: {adw_id}")
print(f"All phases completed successfully!")
print(f"\nWorktree location: trees/{adw_id}/")
print(f"To clean up: ./scripts/purge_tree.sh {adw_id}")
if __name__ == "__main__":
main()