rafcode 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RAF/016-planning-scalpel/decisions.md +7 -0
- package/RAF/016-planning-scalpel/input.md +1 -0
- package/RAF/016-planning-scalpel/outcomes/001-update-git-commit-instructions.md +38 -0
- package/RAF/016-planning-scalpel/plans/001-update-git-commit-instructions.md +43 -0
- package/RAF/017-decision-vault/decisions.md +13 -0
- package/RAF/017-decision-vault/input.md +2 -0
- package/RAF/017-decision-vault/outcomes/001-create-git-commit-utility.md +53 -0
- package/RAF/017-decision-vault/outcomes/002-integrate-commit-into-plan.md +44 -0
- package/RAF/017-decision-vault/outcomes/003-add-tests-for-planning-commit.md +51 -0
- package/RAF/017-decision-vault/plans/001-create-git-commit-utility.md +38 -0
- package/RAF/017-decision-vault/plans/002-integrate-commit-into-plan.md +39 -0
- package/RAF/017-decision-vault/plans/003-add-tests-for-planning-commit.md +40 -0
- package/README.md +83 -55
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +5 -0
- package/dist/commands/plan.js.map +1 -1
- package/dist/core/claude-runner.d.ts.map +1 -1
- package/dist/core/claude-runner.js +26 -6
- package/dist/core/claude-runner.js.map +1 -1
- package/dist/core/git.d.ts +8 -0
- package/dist/core/git.d.ts.map +1 -1
- package/dist/core/git.js +61 -0
- package/dist/core/git.js.map +1 -1
- package/dist/prompts/execution.d.ts.map +1 -1
- package/dist/prompts/execution.js +4 -2
- package/dist/prompts/execution.js.map +1 -1
- package/dist/ui/name-picker.d.ts.map +1 -1
- package/dist/ui/name-picker.js +27 -4
- package/dist/ui/name-picker.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/plan.ts +7 -0
- package/src/core/claude-runner.ts +28 -6
- package/src/core/git.ts +71 -0
- package/src/prompts/execution.ts +4 -2
- package/src/ui/name-picker.ts +29 -4
- package/tests/manual/test-pty-cleanup.ts +86 -0
- package/tests/unit/commit-planning-artifacts.test.ts +232 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Project Decisions
|
|
2
|
+
|
|
3
|
+
## What files should be included in the task commit?
|
|
4
|
+
Code + outcome + this task's plan - Commit the code changes made during the task, the outcome file, and the plan file for this specific task (e.g., 001-task-name.md). Not all plan files, just the one related to the current task.
|
|
5
|
+
|
|
6
|
+
## How should Claude determine which code files to commit?
|
|
7
|
+
Trust Claude's judgment - Instruct Claude to only add files it explicitly modified during the task, relying on its awareness of changes. No need to verify with git diff.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
commit only plan that is related to the task (change instruction in task execution prompt)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Outcome: Update Git Commit Instructions
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Updated the task execution prompt to commit only files related to the current task instead of using `git add -A` which staged all changes including unrelated files.
|
|
6
|
+
|
|
7
|
+
## Key Changes
|
|
8
|
+
|
|
9
|
+
**File modified**: `src/prompts/execution.ts` (lines 89-104)
|
|
10
|
+
|
|
11
|
+
**Before**:
|
|
12
|
+
```
|
|
13
|
+
1. Stage all changes with `git add -A`
|
|
14
|
+
- This includes any new plan files in the `plans/` folder
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**After**:
|
|
18
|
+
```
|
|
19
|
+
1. Stage only the files you modified during this task:
|
|
20
|
+
- Add each code file you changed: `git add <file1> <file2> ...`
|
|
21
|
+
- Add the outcome file: `git add ${outcomeFilePath}`
|
|
22
|
+
- Add this task's plan file: `git add ${planPath}`
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Acceptance Criteria Verification
|
|
26
|
+
|
|
27
|
+
- [x] `git add -A` is no longer used in the execution prompt
|
|
28
|
+
- [x] Instructions clearly tell Claude to add only modified files
|
|
29
|
+
- [x] Outcome file path is explicitly included in staging instructions
|
|
30
|
+
- [x] Plan file path for the current task is explicitly included
|
|
31
|
+
- [x] All existing tests pass (733 tests passed)
|
|
32
|
+
|
|
33
|
+
## Notes
|
|
34
|
+
|
|
35
|
+
- The `planPath` and `outcomeFilePath` variables were already available in the function scope, so no additional code changes were needed
|
|
36
|
+
- This is a prompt text change only - no structural code changes
|
|
37
|
+
|
|
38
|
+
<promise>COMPLETE</promise>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Task: Update Git Commit Instructions
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
Modify the task execution prompt to commit only files related to the current task instead of all changes.
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
Currently, the execution prompt instructs Claude to use `git add -A`, which stages all changes including unrelated files. This can result in commits containing changes that don't belong to the current task. The fix ensures each task commit is scoped to only its relevant changes.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
- Replace `git add -A` with explicit file staging
|
|
11
|
+
- Commit must include: code files modified during the task, the outcome file, and the plan file for the current task
|
|
12
|
+
- Claude should use its own judgment about which files it modified (no git diff verification needed)
|
|
13
|
+
- Remove the misleading comment about "any new plan files in the plans/ folder"
|
|
14
|
+
|
|
15
|
+
## Implementation Steps
|
|
16
|
+
1. Read `src/prompts/execution.ts`
|
|
17
|
+
2. Locate the `commitInstructions` section (around lines 89-101)
|
|
18
|
+
3. Replace the current git add instruction:
|
|
19
|
+
```typescript
|
|
20
|
+
// Current (lines 93-95):
|
|
21
|
+
1. Stage all changes with \`git add -A\`
|
|
22
|
+
- This includes any new plan files in the \`plans/\` folder
|
|
23
|
+
|
|
24
|
+
// Replace with:
|
|
25
|
+
1. Stage only the files you modified during this task:
|
|
26
|
+
- Add each code file you changed: \`git add <file1> <file2> ...\`
|
|
27
|
+
- Add the outcome file: \`git add ${outcomeFilePath}\`
|
|
28
|
+
- Add this task's plan file: \`git add ${planPath}\`
|
|
29
|
+
```
|
|
30
|
+
4. Ensure the string template variables (`${outcomeFilePath}`, `${planPath}`) are properly interpolated
|
|
31
|
+
5. Run tests to verify no regressions
|
|
32
|
+
|
|
33
|
+
## Acceptance Criteria
|
|
34
|
+
- [ ] `git add -A` is no longer used in the execution prompt
|
|
35
|
+
- [ ] Instructions clearly tell Claude to add only modified files
|
|
36
|
+
- [ ] Outcome file path is explicitly included in staging instructions
|
|
37
|
+
- [ ] Plan file path for the current task is explicitly included
|
|
38
|
+
- [ ] All existing tests pass
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
- The `planPath` variable is already available in the `getExecutionPrompt` function params
|
|
42
|
+
- The `outcomeFilePath` variable is also already available
|
|
43
|
+
- This is a prompt text change only - no structural code changes needed
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Project Decisions
|
|
2
|
+
|
|
3
|
+
## What commit message format should be used for planning artifacts?
|
|
4
|
+
RAF[NNN] Plan: project-name - Follow existing RAF commit convention with 'Plan:' prefix
|
|
5
|
+
|
|
6
|
+
## Should this commit happen automatically or be opt-in via a flag?
|
|
7
|
+
Always commit automatically after every successful planning session
|
|
8
|
+
|
|
9
|
+
## What should happen if the git commit fails (e.g., not in a git repo)?
|
|
10
|
+
Warn and continue - Show a warning message but don't fail the planning session
|
|
11
|
+
|
|
12
|
+
## Which files should be committed after planning?
|
|
13
|
+
Only input.md and decisions.md - Just the input and decisions, not the generated plans
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Outcome: Create Git Commit Utility for Planning Artifacts
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Created the `commitPlanningArtifacts` function in `src/core/git.ts` that commits planning artifacts (input.md and decisions.md) with a consistent commit message format.
|
|
6
|
+
|
|
7
|
+
## Changes Made
|
|
8
|
+
|
|
9
|
+
### Files Modified
|
|
10
|
+
- **src/core/git.ts**: Added `commitPlanningArtifacts` function and required imports
|
|
11
|
+
|
|
12
|
+
### Files Created
|
|
13
|
+
- **tests/unit/commit-planning-artifacts.test.ts**: Comprehensive unit tests (8 test cases)
|
|
14
|
+
|
|
15
|
+
## Implementation Details
|
|
16
|
+
|
|
17
|
+
The `commitPlanningArtifacts(projectPath: string): Promise<void>` function:
|
|
18
|
+
|
|
19
|
+
1. **Extracts project info** from the path using existing `extractProjectNumber` and `extractProjectName` utilities
|
|
20
|
+
2. **Stages only specific files**: Uses explicit paths for `input.md` and `decisions.md` (no wildcards)
|
|
21
|
+
3. **Commit message format**: `RAF[NNN] Plan: project-name` (e.g., `RAF[017] Plan: decision-vault`)
|
|
22
|
+
4. **Graceful error handling**:
|
|
23
|
+
- Logs warning if not in git repo
|
|
24
|
+
- Logs warning if project number/name can't be extracted
|
|
25
|
+
- Handles "nothing to commit" silently (debug log)
|
|
26
|
+
- Other errors logged as warnings, never thrown
|
|
27
|
+
|
|
28
|
+
## Test Coverage
|
|
29
|
+
|
|
30
|
+
8 unit tests covering:
|
|
31
|
+
- Correct commit message format (numeric and base36 project numbers)
|
|
32
|
+
- Staging only input.md and decisions.md (no wildcards)
|
|
33
|
+
- Not in git repository handling
|
|
34
|
+
- Invalid project path handling
|
|
35
|
+
- "Nothing to commit" handling (both early check and commit error)
|
|
36
|
+
- Other git error handling (warning log, no throw)
|
|
37
|
+
|
|
38
|
+
## Acceptance Criteria Verification
|
|
39
|
+
|
|
40
|
+
- [x] Function `commitPlanningArtifacts` exists in `src/core/git.ts`
|
|
41
|
+
- [x] Function stages only input.md and decisions.md
|
|
42
|
+
- [x] Commit message follows format `RAF[NNN] Plan: project-name`
|
|
43
|
+
- [x] Git failures result in warning log, not thrown error
|
|
44
|
+
- [x] Function handles "nothing to commit" gracefully
|
|
45
|
+
- [x] TypeScript compiles without errors (verified with `npm run build`)
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
- The plan suggested `src/utils/git.ts` but `src/core/git.ts` already existed with git utilities, so the function was added there for consistency
|
|
50
|
+
- The function is exported and ready to be integrated into the plan command (Task 002)
|
|
51
|
+
- All 741 existing tests continue to pass
|
|
52
|
+
|
|
53
|
+
<promise>COMPLETE</promise>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Outcome: Integrate Commit into Plan Command
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Integrated the `commitPlanningArtifacts` function (from Task 001) into the plan command to automatically commit planning artifacts (input.md and decisions.md) after successful planning in both regular and amend modes.
|
|
6
|
+
|
|
7
|
+
## Changes Made
|
|
8
|
+
|
|
9
|
+
### Files Modified
|
|
10
|
+
- **src/commands/plan.ts**: Added import and commit calls in both `runPlanCommand()` and `runAmendCommand()`
|
|
11
|
+
|
|
12
|
+
## Implementation Details
|
|
13
|
+
|
|
14
|
+
1. **Import added** at the top of plan.ts:
|
|
15
|
+
```typescript
|
|
16
|
+
import { commitPlanningArtifacts } from '../core/git.js';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. **Integration in `runPlanCommand()`** (line 207-208):
|
|
20
|
+
- Placed after the "Planning complete!" success message
|
|
21
|
+
- Placed before the "Run 'raf do'" info message
|
|
22
|
+
- Inside the `if (planFiles.length > 0)` block (no commit if no plans created)
|
|
23
|
+
|
|
24
|
+
3. **Integration in `runAmendCommand()`** (line 388-389):
|
|
25
|
+
- Placed after the "Amendment complete!" success message
|
|
26
|
+
- Placed before the "Total tasks" / "Run 'raf do'" info messages
|
|
27
|
+
- Inside the `if (newPlanFiles.length > 0)` block (no commit if no new plans created)
|
|
28
|
+
|
|
29
|
+
## Acceptance Criteria Verification
|
|
30
|
+
|
|
31
|
+
- [x] Regular `raf plan` commits input.md and decisions.md after planning
|
|
32
|
+
- [x] `raf plan --amend` commits input.md and decisions.md after amendment
|
|
33
|
+
- [x] No commit attempted if no plan files were created
|
|
34
|
+
- [x] Git warnings displayed but don't interrupt success flow
|
|
35
|
+
- [x] TypeScript compiles without errors (verified with `npm run build`)
|
|
36
|
+
- [x] All 741 existing tests continue to pass
|
|
37
|
+
|
|
38
|
+
## Notes
|
|
39
|
+
|
|
40
|
+
- The `commitPlanningArtifacts` function handles all error cases gracefully (logs warnings, never throws)
|
|
41
|
+
- Commit happens automatically without any user flag
|
|
42
|
+
- The flow maintains clean logging - git warnings appear but don't overshadow the success message
|
|
43
|
+
|
|
44
|
+
<promise>COMPLETE</promise>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Outcome: Add Tests for Planning Commit Functionality
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Verified that comprehensive unit tests for `commitPlanningArtifacts` already exist from Task 001. The tests cover all required scenarios and all acceptance criteria are satisfied.
|
|
6
|
+
|
|
7
|
+
## Analysis
|
|
8
|
+
|
|
9
|
+
### Plan vs Reality
|
|
10
|
+
|
|
11
|
+
The plan requested tests at `tests/utils/git.test.ts`, but Task 001 already created tests at `tests/unit/commit-planning-artifacts.test.ts`. This location is actually preferable because:
|
|
12
|
+
|
|
13
|
+
1. It follows the existing project convention (all unit tests are in `tests/unit/`)
|
|
14
|
+
2. There's already a `tests/unit/git.test.ts` that tests other git utilities (`parseGitStatus`)
|
|
15
|
+
3. Having a dedicated file for `commitPlanningArtifacts` improves test organization
|
|
16
|
+
|
|
17
|
+
### Existing Test Coverage (8 tests)
|
|
18
|
+
|
|
19
|
+
| Test | Acceptance Criteria |
|
|
20
|
+
|------|---------------------|
|
|
21
|
+
| should commit input.md and decisions.md with correct message format | Successful commit scenario |
|
|
22
|
+
| should handle base36 project numbers | Commit message format (base36) |
|
|
23
|
+
| should warn and return when not in git repository | Not a git repo scenario |
|
|
24
|
+
| should warn when project number cannot be extracted | Error handling |
|
|
25
|
+
| should handle "nothing to commit" gracefully | Nothing to commit (early check) |
|
|
26
|
+
| should handle commit error with "nothing to commit" message | Nothing to commit (commit error) |
|
|
27
|
+
| should warn on other git errors without throwing | Error handling |
|
|
28
|
+
| should only stage input.md and decisions.md | Verifies no wildcards |
|
|
29
|
+
|
|
30
|
+
### Test Results
|
|
31
|
+
|
|
32
|
+
- All 8 `commitPlanningArtifacts` tests pass
|
|
33
|
+
- All 741 tests in the project pass
|
|
34
|
+
- No new code changes were needed
|
|
35
|
+
|
|
36
|
+
## Acceptance Criteria Verification
|
|
37
|
+
|
|
38
|
+
- [x] Test file exists (at `tests/unit/commit-planning-artifacts.test.ts`)
|
|
39
|
+
- [x] Tests cover successful commit scenario
|
|
40
|
+
- [x] Tests verify commit message format
|
|
41
|
+
- [x] Tests cover "not a git repo" scenario
|
|
42
|
+
- [x] Tests cover "nothing to commit" scenario
|
|
43
|
+
- [x] All tests pass with `npm test`
|
|
44
|
+
|
|
45
|
+
## Notes
|
|
46
|
+
|
|
47
|
+
- The "files don't exist" scenario mentioned in the plan is implicitly covered by the "nothing to commit" tests, since git add on non-existent files results in nothing staged
|
|
48
|
+
- Task 001 followed TDD practices and created tests alongside the implementation
|
|
49
|
+
- No additional tests or changes were required for this task
|
|
50
|
+
|
|
51
|
+
<promise>COMPLETE</promise>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Task: Create Git Commit Utility for Planning Artifacts
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
Create a utility function that commits input.md and decisions.md files after planning completes.
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
RAF currently commits code changes during task execution, but planning artifacts (input.md and decisions.md) are not committed. This task creates a reusable utility to commit these files with a consistent commit message format.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
- Commit only `input.md` and `decisions.md` from the project folder (not plans/)
|
|
11
|
+
- Use commit message format: `RAF[NNN] Plan: project-name`
|
|
12
|
+
- NNN is the 3-digit project number (e.g., 017)
|
|
13
|
+
- project-name is the kebab-case project name (e.g., decision-vault)
|
|
14
|
+
- If git commit fails (not in repo, nothing to commit, etc.), log a warning and continue
|
|
15
|
+
- Never fail the planning session due to git issues
|
|
16
|
+
|
|
17
|
+
## Implementation Steps
|
|
18
|
+
1. Create a new file `src/utils/git.ts` (or add to existing git utilities if present)
|
|
19
|
+
2. Implement `commitPlanningArtifacts(projectPath: string): Promise<void>` function:
|
|
20
|
+
- Extract project number and name from projectPath
|
|
21
|
+
- Build the commit message: `RAF[NNN] Plan: project-name`
|
|
22
|
+
- Run `git add` for only `input.md` and `decisions.md` (use explicit paths)
|
|
23
|
+
- Run `git commit -m "message"`
|
|
24
|
+
- Catch any errors and log warning (don't throw)
|
|
25
|
+
3. Export the function for use in plan command
|
|
26
|
+
|
|
27
|
+
## Acceptance Criteria
|
|
28
|
+
- [ ] Function `commitPlanningArtifacts` exists in `src/utils/git.ts`
|
|
29
|
+
- [ ] Function stages only input.md and decisions.md
|
|
30
|
+
- [ ] Commit message follows format `RAF[NNN] Plan: project-name`
|
|
31
|
+
- [ ] Git failures result in warning log, not thrown error
|
|
32
|
+
- [ ] Function handles "nothing to commit" gracefully
|
|
33
|
+
- [ ] TypeScript compiles without errors
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
- Look at existing git usage in the codebase for patterns (execution prompt uses git for task commits)
|
|
37
|
+
- Use `child_process.exec` or similar for git commands
|
|
38
|
+
- The function should be idempotent - calling it when files are already committed should just warn
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Task: Integrate Commit into Plan Command
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
Call the git commit utility after planning completes successfully in both regular and amend modes.
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
The commit utility from task 001 needs to be integrated into the plan command. The commit should happen automatically after Claude finishes planning and plan files have been created.
|
|
8
|
+
|
|
9
|
+
## Dependencies
|
|
10
|
+
001
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
- Commit happens automatically (no flag needed)
|
|
14
|
+
- Commit after both regular `raf plan` and `raf plan --amend`
|
|
15
|
+
- Only attempt commit if at least one plan file was created
|
|
16
|
+
- Warning on failure should not affect the success message shown to user
|
|
17
|
+
|
|
18
|
+
## Implementation Steps
|
|
19
|
+
1. Import `commitPlanningArtifacts` in `src/commands/plan.ts`
|
|
20
|
+
2. In `runPlanCommand()`:
|
|
21
|
+
- After the "Planning complete!" success message (around line 199-207)
|
|
22
|
+
- Before the final `logger.info` about running `raf do`
|
|
23
|
+
- Call `await commitPlanningArtifacts(projectPath)`
|
|
24
|
+
3. In `runAmendCommand()`:
|
|
25
|
+
- After the "Amendment complete!" success message (around line 376-386)
|
|
26
|
+
- Before the final `logger.info` about running `raf do`
|
|
27
|
+
- Call `await commitPlanningArtifacts(projectPath)`
|
|
28
|
+
4. Ensure the commit call is inside the `if (planFiles.length > 0)` block so we only commit when plans exist
|
|
29
|
+
|
|
30
|
+
## Acceptance Criteria
|
|
31
|
+
- [ ] Regular `raf plan` commits input.md and decisions.md after planning
|
|
32
|
+
- [ ] `raf plan --amend` commits input.md and decisions.md after amendment
|
|
33
|
+
- [ ] No commit attempted if no plan files were created
|
|
34
|
+
- [ ] Git warnings displayed but don't interrupt success flow
|
|
35
|
+
- [ ] TypeScript compiles without errors
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
- The projectPath variable is already available in both functions
|
|
39
|
+
- Keep the logging flow clean - git warning should appear but not overshadow success message
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Task: Add Tests for Planning Commit Functionality
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
Write unit tests for the git commit utility to ensure correct behavior in various scenarios.
|
|
5
|
+
|
|
6
|
+
## Context
|
|
7
|
+
The new git commit functionality needs test coverage to verify it works correctly and handles edge cases properly.
|
|
8
|
+
|
|
9
|
+
## Dependencies
|
|
10
|
+
001
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
- Test the `commitPlanningArtifacts` function
|
|
14
|
+
- Cover success and failure scenarios
|
|
15
|
+
- Mock git commands to avoid actual git operations in tests
|
|
16
|
+
|
|
17
|
+
## Implementation Steps
|
|
18
|
+
1. Create test file `tests/utils/git.test.ts`
|
|
19
|
+
2. Write tests for:
|
|
20
|
+
- **Happy path**: Successfully commits input.md and decisions.md
|
|
21
|
+
- **Correct commit message**: Verifies format `RAF[NNN] Plan: project-name`
|
|
22
|
+
- **Not a git repo**: Warns and continues (doesn't throw)
|
|
23
|
+
- **Nothing to commit**: Warns and continues (doesn't throw)
|
|
24
|
+
- **Files don't exist**: Warns and continues (doesn't throw)
|
|
25
|
+
3. Mock `child_process.exec` or the underlying git execution
|
|
26
|
+
4. Verify correct files are staged (only input.md and decisions.md)
|
|
27
|
+
5. Run tests and ensure they pass
|
|
28
|
+
|
|
29
|
+
## Acceptance Criteria
|
|
30
|
+
- [ ] Test file exists at `tests/utils/git.test.ts`
|
|
31
|
+
- [ ] Tests cover successful commit scenario
|
|
32
|
+
- [ ] Tests verify commit message format
|
|
33
|
+
- [ ] Tests cover "not a git repo" scenario
|
|
34
|
+
- [ ] Tests cover "nothing to commit" scenario
|
|
35
|
+
- [ ] All tests pass with `npm test`
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
- Follow existing test patterns in the codebase
|
|
39
|
+
- Use Jest mocking for git command execution
|
|
40
|
+
- Look at other test files in `tests/` for patterns and conventions
|
package/README.md
CHANGED
|
@@ -8,92 +8,91 @@ RAF is a CLI tool that orchestrates task planning and execution using Claude Cod
|
|
|
8
8
|
|
|
9
9
|
**GitHub:** [https://github.com/john-veresk/raf](https://github.com/john-veresk/raf)
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Vision
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
Good software of the future will be built with good decisions by humans, not AI. RAF is software that builds other software by capitalizing on human ability to **make choices** and take ownership.
|
|
14
|
+
|
|
15
|
+
## Why RAF?
|
|
16
|
+
|
|
17
|
+
**Human decisions matter** — RAF focuses on interviewing you during planning. Right questions lead to right decisions, and right decisions lead to better software.
|
|
18
|
+
|
|
19
|
+
**Better reviews** — Review the intent, decisions, plan and outcomes, not AI generated code.
|
|
20
|
+
|
|
21
|
+
**Context rot** — Long AI sessions lose focus and make mistakes. RAF splits work into small, focused tasks that Claude executes one at a time with fresh context.
|
|
22
|
+
|
|
23
|
+
**Reliable execution** — Modern LLMs are remarkably capable when given clear instructions. A well-crafted plan yields working solutions reliably. RAF helps you build good plans.
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
**Save on tokens** — Less back-and-forth during debugging saves tokens, even with planning overhead.
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
21
28
|
|
|
22
29
|
```bash
|
|
30
|
+
# Install
|
|
23
31
|
npm install -g raf
|
|
32
|
+
|
|
33
|
+
# Plan a project - Claude will interview you and create a detailed plan
|
|
34
|
+
raf plan
|
|
35
|
+
|
|
36
|
+
# Execute the plan
|
|
37
|
+
raf do
|
|
24
38
|
```
|
|
25
39
|
|
|
40
|
+
That's it! RAF will guide you through breaking down your task and then execute it step by step.
|
|
41
|
+
|
|
26
42
|
## Requirements
|
|
27
43
|
|
|
28
44
|
- Node.js 20+
|
|
29
45
|
- Claude Code CLI installed and configured
|
|
30
46
|
|
|
31
|
-
##
|
|
47
|
+
## Features
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
- **Interactive Planning**: Claude interviews you to break down complex tasks into 3-8 distinct tasks
|
|
50
|
+
- **Automated Execution**: Execute plans with retry logic and progress tracking
|
|
51
|
+
- **Resume Support**: Continue from where you left off after interruption
|
|
52
|
+
- **Git Integration**: Automatic commits after each completed task
|
|
53
|
+
- **Task Dependencies**: Tasks can depend on other tasks, with automatic blocking on failure
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
raf plan [projectName]
|
|
37
|
-
```
|
|
55
|
+
## Commands
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
1. Identify 3-8 distinct tasks
|
|
41
|
-
2. Interview you about each task
|
|
42
|
-
3. Create detailed plan files
|
|
57
|
+
### `raf plan`
|
|
43
58
|
|
|
44
|
-
|
|
59
|
+
Opens your `$EDITOR` to write a project description, then Claude will interview you and create detailed task plans.
|
|
45
60
|
|
|
46
61
|
```bash
|
|
47
|
-
raf plan
|
|
62
|
+
raf plan # Create a new project
|
|
63
|
+
raf plan my-feature # Create with a specific name
|
|
64
|
+
raf plan --amend 3 # Add tasks to existing project #3
|
|
48
65
|
```
|
|
49
66
|
|
|
50
|
-
###
|
|
67
|
+
### `raf do`
|
|
51
68
|
|
|
52
|
-
|
|
53
|
-
raf do <projects...>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Execute one or more projects. Accepts project identifiers in multiple formats:
|
|
69
|
+
Execute project tasks. Without arguments, shows a picker to select a pending project.
|
|
57
70
|
|
|
58
71
|
```bash
|
|
59
|
-
raf do
|
|
60
|
-
raf do 3
|
|
61
|
-
raf do
|
|
62
|
-
raf do 3 4 5
|
|
72
|
+
raf do # Interactive picker
|
|
73
|
+
raf do 3 # Execute project #3
|
|
74
|
+
raf do my-project # Execute by name
|
|
75
|
+
raf do 3 4 5 # Execute multiple projects
|
|
63
76
|
```
|
|
64
77
|
|
|
65
|
-
|
|
66
|
-
- `-t, --timeout <minutes>` - Timeout per task (default: 60)
|
|
67
|
-
- `-v, --verbose` - Show full Claude output
|
|
68
|
-
- `-d, --debug` - Save all logs and show debug output
|
|
69
|
-
- `-f, --force` - Re-run all tasks regardless of status
|
|
78
|
+
### `raf status`
|
|
70
79
|
|
|
71
|
-
|
|
80
|
+
Check project status.
|
|
72
81
|
|
|
73
82
|
```bash
|
|
74
|
-
raf status
|
|
83
|
+
raf status # List all projects
|
|
84
|
+
raf status 3 # Show details for project #3
|
|
75
85
|
```
|
|
76
86
|
|
|
77
|
-
|
|
87
|
+
## Status Symbols
|
|
78
88
|
|
|
79
|
-
```bash
|
|
80
|
-
raf status # List all projects
|
|
81
|
-
raf status my-project # Show details for a project
|
|
82
|
-
raf status 3 # By project number
|
|
83
|
-
raf status --json # Output as JSON
|
|
84
89
|
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
Project status badges:
|
|
92
|
-
- `[P]` planning
|
|
93
|
-
- `[R]` ready
|
|
94
|
-
- `[~]` executing
|
|
95
|
-
- `[x]` completed
|
|
96
|
-
- `[!]` failed
|
|
90
|
+
○ pending - task not yet started
|
|
91
|
+
● running - task currently executing
|
|
92
|
+
✓ completed - task finished successfully
|
|
93
|
+
✗ failed - task failed
|
|
94
|
+
⊘ blocked - task blocked by failed dependency
|
|
95
|
+
```
|
|
97
96
|
|
|
98
97
|
## Project Structure
|
|
99
98
|
|
|
@@ -102,7 +101,7 @@ RAF creates a `./RAF/` folder with numbered project directories:
|
|
|
102
101
|
```
|
|
103
102
|
./RAF/
|
|
104
103
|
├── 001-auth-system/
|
|
105
|
-
│ ├── input.md # Your original
|
|
104
|
+
│ ├── input.md # Your original intent (raw prompt)
|
|
106
105
|
│ ├── decisions.md # Design decisions from planning
|
|
107
106
|
│ ├── plans/ # Generated task plans
|
|
108
107
|
│ ├── outcomes/ # Execution results
|
|
@@ -111,6 +110,35 @@ RAF creates a `./RAF/` folder with numbered project directories:
|
|
|
111
110
|
└── ...
|
|
112
111
|
```
|
|
113
112
|
|
|
113
|
+
## Command Reference
|
|
114
|
+
|
|
115
|
+
### `raf plan [projectName]`
|
|
116
|
+
|
|
117
|
+
| Option | Description |
|
|
118
|
+
|--------|-------------|
|
|
119
|
+
| `--amend <id>` | Add tasks to existing project |
|
|
120
|
+
| `-y, --auto` | Skip permission prompts (runs in dangerous mode) |
|
|
121
|
+
|
|
122
|
+
### `raf do [projects...]`
|
|
123
|
+
|
|
124
|
+
| Option | Description |
|
|
125
|
+
|--------|-------------|
|
|
126
|
+
| `-t, --timeout <min>` | Timeout per task (default: 60) |
|
|
127
|
+
| `-f, --force` | Re-run all tasks regardless of status |
|
|
128
|
+
| `-d, --debug` | Save all logs and show debug output |
|
|
129
|
+
| `-m, --model <name>` | Claude model (sonnet, haiku, opus) |
|
|
130
|
+
| `--sonnet` | Shorthand for `--model sonnet` |
|
|
131
|
+
|
|
132
|
+
Alias: `raf act`
|
|
133
|
+
|
|
134
|
+
> **Note:** `raf do` and `raf plan -y` run Claude with `--dangerously-skip-permissions` for fully automated execution without interactive prompts.
|
|
135
|
+
|
|
136
|
+
### `raf status [identifier]`
|
|
137
|
+
|
|
138
|
+
| Option | Description |
|
|
139
|
+
|--------|-------------|
|
|
140
|
+
| `--json` | Output as JSON |
|
|
141
|
+
|
|
114
142
|
## License
|
|
115
143
|
|
|
116
144
|
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsCpC,wBAAgB,iBAAiB,IAAI,OAAO,CAqC3C"}
|
package/dist/commands/plan.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ProjectManager } from '../core/project-manager.js';
|
|
|
4
4
|
import { ClaudeRunner } from '../core/claude-runner.js';
|
|
5
5
|
import { openEditor, getInputTemplate } from '../core/editor.js';
|
|
6
6
|
import { shutdownHandler } from '../core/shutdown-handler.js';
|
|
7
|
+
import { commitPlanningArtifacts } from '../core/git.js';
|
|
7
8
|
import { getPlanningPrompt } from '../prompts/planning.js';
|
|
8
9
|
import { getAmendPrompt } from '../prompts/amend.js';
|
|
9
10
|
import { validateEnvironment, reportValidation, validateProjectName, resolveModelOption, } from '../utils/validation.js';
|
|
@@ -156,6 +157,8 @@ async function runPlanCommand(projectName, model, autoMode = false) {
|
|
|
156
157
|
for (const planFile of planFiles) {
|
|
157
158
|
logger.info(` - plans/${planFile}`);
|
|
158
159
|
}
|
|
160
|
+
// Commit planning artifacts (input.md and decisions.md)
|
|
161
|
+
await commitPlanningArtifacts(projectPath);
|
|
159
162
|
logger.newline();
|
|
160
163
|
logger.info(`Run 'raf do ${finalProjectName}' to execute the plans.`);
|
|
161
164
|
}
|
|
@@ -308,6 +311,8 @@ async function runAmendCommand(identifier, model, autoMode = false) {
|
|
|
308
311
|
for (const planFile of newPlanFiles) {
|
|
309
312
|
logger.info(` - plans/${planFile}`);
|
|
310
313
|
}
|
|
314
|
+
// Commit planning artifacts (input.md and decisions.md)
|
|
315
|
+
await commitPlanningArtifacts(projectPath);
|
|
311
316
|
logger.newline();
|
|
312
317
|
logger.info(`Total tasks: ${allPlanFiles.length}`);
|
|
313
318
|
logger.info(`Run 'raf do ${identifier}' to execute the new tasks.`);
|