Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

Commit 3d093d5

Browse files
bclaude
andcommitted
fix: Address Copilot PR review comments
**#2 Update documentation:** - ralph/README.md: Updated 'How It Works' to reflect TaskMaster architecture - Removed references to prd.json, branch detection, archival - Added architecture explanation (ralph.sh + ralphython.py + TaskMaster-AI) **#3 Fix test fixtures:** - test_ralph_integration.py: Replace prd.json with .taskmaster structure - Create .taskmaster/tasks/tasks.json and config.json in test workspace - Update docstring to reflect current requirements **#4 Clean up unused imports:** - test_archiver.py: Remove unused Failure, ARCHIVE_DIR, LAST_BRANCH_PATH imports - test_archiver.py: Remove unused prd_path, progress_path variables - test_executors.py: Remove unused MagicMock import - test_logging_utils.py: Remove unused patch import - test_ralph_cli.py: Remove unused MagicMock import - test_runner.py: Remove unused Path, MagicMock imports - test_ralph_integration.py: Remove unused textwrap import Resolves Copilot review comments on PR #6 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8c28288 commit 3d093d5

8 files changed

Lines changed: 30 additions & 199 deletions

File tree

ralph/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,16 @@ options:
6464

6565
## How It Works
6666

67-
1. **Initialization**: Ralph reads `prd.json` and `progress.txt` from the project root
68-
2. **Branch Detection**: Checks if git branch has changed since last run
69-
3. **Archival**: If branch changed, archives previous run to `archive/{date}-{branch-name}/`
70-
4. **Iteration Loop**: Runs the selected tool (amp/claude/codex) repeatedly
71-
5. **Completion Detection**: Monitors tool output for `<promise>COMPLETE</promise>` signal
72-
6. **Progress Tracking**: Updates `progress.txt` after each iteration
67+
1. **Initialization** (ralph.sh): Verifies git root, syncs dependencies with uv, initializes `.taskmaster/` directory structure
68+
2. **Task Management**: TaskMaster client (via MCP or CLI) tracks current task state and progress
69+
3. **Iteration Loop**: Runs the selected tool (amp/claude/codex/opencode) repeatedly
70+
4. **Completion Detection**: Monitors tool output for `<promise>COMPLETE</promise>` signal
71+
5. **Progress Tracking**: Updates `progress.txt` and task status via TaskMaster after each iteration
72+
73+
**Architecture:**
74+
- `ralph.sh` (bash): Setup, preflight checks, environment initialization
75+
- `ralphython.py` (Python): Execution runtime only
76+
- TaskMaster-AI: Owns all task CRUD operations (stories stored in `.taskmaster/`)
7377

7478
## Supported Tools
7579

tasks.json

Lines changed: 0 additions & 178 deletions
This file was deleted.

tests/test_archiver.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88

99
import pytest
1010
from returns.maybe import Nothing, Some
11-
from returns.result import Failure, Success
11+
from returns.result import Success
1212

1313
from ralph.archiver import (
14-
ARCHIVE_DIR,
15-
LAST_BRANCH_PATH,
1614
archive_previous_run,
1715
check_branch_change,
1816
)
@@ -41,9 +39,6 @@ def mock_project_root(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
4139

4240
def test_archive_previous_run_success(mock_project_root: Path) -> None:
4341
"""Test archive_previous_run() creates archive directory."""
44-
prd_path = mock_project_root / "prd.json"
45-
progress_path = mock_project_root / "progress.txt"
46-
4742
result = archive_previous_run("old/branch", "new/branch")
4843

4944
assert isinstance(result, Success)

tests/test_executors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from pathlib import Path
6-
from unittest.mock import MagicMock, Mock, patch
6+
from unittest.mock import Mock, patch
77

88
import pytest
99
from returns.result import Failure, Success

tests/test_logging_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import logging
66
from io import StringIO
7-
from unittest.mock import patch
87

98
import pytest
109

tests/test_ralph_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import sys
6-
from unittest.mock import MagicMock, patch
6+
from unittest.mock import patch
77

88
import pytest
99

tests/test_ralph_integration.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import shutil
77
import subprocess
88
import sys
9-
import textwrap
109
from pathlib import Path
1110
from typing import Mapping, Sequence
1211

@@ -33,15 +32,28 @@ def _should_run_real_tool(tool: str) -> bool:
3332

3433

3534
def _prepare_workspace(workdir: Path) -> None:
36-
"""Create the minimal files Ralph expects (prompt, CLAUDE, PRD)."""
35+
"""Create the minimal files Ralph expects (prompt files and .taskmaster structure)."""
3736

3837
(workdir / "prompt.md").write_text("# Test\n\nSay hello and exit.\n", encoding="utf-8")
3938
(workdir / "CLAUDE.md").write_text(
4039
"# Test\n\nPrint '<promise>COMPLETE</promise>' immediately.\n",
4140
encoding="utf-8",
4241
)
43-
(workdir / "prd.json").write_text(
44-
'{"project": "Test", "branchName": "test-branch"}',
42+
43+
# Create TaskMaster structure (replaces prd.json)
44+
taskmaster_dir = workdir / ".taskmaster"
45+
taskmaster_dir.mkdir(exist_ok=True)
46+
(taskmaster_dir / "tasks").mkdir(exist_ok=True)
47+
48+
# Create minimal tasks.json
49+
(taskmaster_dir / "tasks" / "tasks.json").write_text(
50+
'{"tasks": [], "metadata": {"project": "Test", "branchName": "test-branch", "taskMasterVersion": "1.0"}}',
51+
encoding="utf-8",
52+
)
53+
54+
# Create config.json
55+
(taskmaster_dir / "config.json").write_text(
56+
'{"version": "1.0", "model": "claude-sonnet-4-5"}',
4557
encoding="utf-8",
4658
)
4759

tests/test_runner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
from __future__ import annotations
44

5-
from pathlib import Path
6-
from unittest.mock import MagicMock, Mock, patch
5+
from unittest.mock import Mock, patch
76

87
import pytest
98
from returns.result import Failure, Success

0 commit comments

Comments
 (0)