rafcode 1.1.2 → 1.3.2

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.
Files changed (57) hide show
  1. package/RAF/018-workflow-forge/decisions.md +13 -0
  2. package/RAF/018-workflow-forge/input.md +2 -0
  3. package/RAF/018-workflow-forge/outcomes/001-add-task-number-progress.md +61 -0
  4. package/RAF/018-workflow-forge/outcomes/002-update-plan-do-prompts.md +62 -0
  5. package/RAF/018-workflow-forge/plans/001-add-task-number-progress.md +30 -0
  6. package/RAF/018-workflow-forge/plans/002-update-plan-do-prompts.md +34 -0
  7. package/RAF/019-verbose-chronicle/decisions.md +25 -0
  8. package/RAF/019-verbose-chronicle/input.md +3 -0
  9. package/RAF/019-verbose-chronicle/outcomes/001-amend-iteration-references.md +25 -0
  10. package/RAF/019-verbose-chronicle/outcomes/002-verbose-task-name-display.md +31 -0
  11. package/RAF/019-verbose-chronicle/outcomes/003-verbose-streaming-fix.md +48 -0
  12. package/RAF/019-verbose-chronicle/outcomes/004-commit-verification-before-halt.md +56 -0
  13. package/RAF/019-verbose-chronicle/plans/001-amend-iteration-references.md +35 -0
  14. package/RAF/019-verbose-chronicle/plans/002-verbose-task-name-display.md +38 -0
  15. package/RAF/019-verbose-chronicle/plans/003-verbose-streaming-fix.md +45 -0
  16. package/RAF/019-verbose-chronicle/plans/004-commit-verification-before-halt.md +62 -0
  17. package/dist/commands/do.js +24 -15
  18. package/dist/commands/do.js.map +1 -1
  19. package/dist/core/claude-runner.d.ts +52 -1
  20. package/dist/core/claude-runner.d.ts.map +1 -1
  21. package/dist/core/claude-runner.js +195 -17
  22. package/dist/core/claude-runner.js.map +1 -1
  23. package/dist/core/git.d.ts +15 -0
  24. package/dist/core/git.d.ts.map +1 -1
  25. package/dist/core/git.js +44 -0
  26. package/dist/core/git.js.map +1 -1
  27. package/dist/parsers/stream-renderer.d.ts +42 -0
  28. package/dist/parsers/stream-renderer.d.ts.map +1 -0
  29. package/dist/parsers/stream-renderer.js +100 -0
  30. package/dist/parsers/stream-renderer.js.map +1 -0
  31. package/dist/prompts/amend.d.ts.map +1 -1
  32. package/dist/prompts/amend.js +27 -3
  33. package/dist/prompts/amend.js.map +1 -1
  34. package/dist/prompts/execution.d.ts.map +1 -1
  35. package/dist/prompts/execution.js +1 -2
  36. package/dist/prompts/execution.js.map +1 -1
  37. package/dist/prompts/planning.d.ts.map +1 -1
  38. package/dist/prompts/planning.js +16 -3
  39. package/dist/prompts/planning.js.map +1 -1
  40. package/dist/utils/terminal-symbols.d.ts +3 -2
  41. package/dist/utils/terminal-symbols.d.ts.map +1 -1
  42. package/dist/utils/terminal-symbols.js +6 -4
  43. package/dist/utils/terminal-symbols.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/commands/do.ts +25 -15
  46. package/src/core/claude-runner.ts +270 -17
  47. package/src/core/git.ts +44 -0
  48. package/src/parsers/stream-renderer.ts +139 -0
  49. package/src/prompts/amend.ts +28 -3
  50. package/src/prompts/execution.ts +1 -2
  51. package/src/prompts/planning.ts +16 -3
  52. package/src/utils/terminal-symbols.ts +7 -4
  53. package/tests/unit/claude-runner.test.ts +567 -1
  54. package/tests/unit/git-commit-helpers.test.ts +103 -0
  55. package/tests/unit/plan-command.test.ts +51 -0
  56. package/tests/unit/stream-renderer.test.ts +286 -0
  57. package/tests/unit/terminal-symbols.test.ts +20 -0
@@ -35,7 +35,11 @@ export function getAmendPrompt(params: AmendPromptParams): AmendPromptResult {
35
35
  : '[PENDING]';
36
36
  const modifiability =
37
37
  task.status === 'completed' ? '[PROTECTED]' : '[MODIFIABLE]';
38
- return `- Task ${task.id}: ${task.taskName} ${status} ${modifiability}`;
38
+ const outcomeRef =
39
+ task.status === 'completed'
40
+ ? `\n Outcome: ${projectPath}/outcomes/${task.planFile.replace('plans/', '').replace(/\.md$/, '')}.md`
41
+ : '';
42
+ return `- Task ${task.id}: ${task.taskName} ${status} ${modifiability}${outcomeRef}`;
39
43
  })
40
44
  .join('\n');
41
45
 
@@ -94,6 +98,13 @@ Read the user's description of new tasks and identify what needs to be added. Co
94
98
  - Dependencies on completed tasks (check the ## Dependencies section in existing plan files)
95
99
  - Whether new tasks should reference existing task outcomes
96
100
 
101
+ **Identifying Follow-up Tasks**: When a new task is a follow-up, fix, or iteration of a previously completed task, you MUST reference the previous task's outcome in the new plan's Context section. This gives the executing agent full context about what was done before.
102
+
103
+ Use this format in the Context section:
104
+ \`This is a follow-up to task NNN. See outcome: {projectPath}/outcomes/NNN-task-name.md\`
105
+
106
+ The outcome file paths for completed tasks are listed above in the Existing Tasks section.
107
+
97
108
  ### Step 3: Interview the User
98
109
 
99
110
  For EACH new task you identify, use the AskUserQuestion tool to gather:
@@ -109,7 +120,7 @@ After EACH interview question is answered, append the Q&A pair to the existing d
109
120
 
110
121
  Use this format:
111
122
  \`\`\`markdown
112
- ## [Amendment] [Question asked]
123
+ ## [Question asked]
113
124
  [User's answer]
114
125
  \`\`\`
115
126
 
@@ -131,6 +142,7 @@ Each plan file should follow this structure:
131
142
  ## Context
132
143
  [Why this task is needed, how it fits into the larger project]
133
144
  [Reference relevant existing tasks if applicable]
145
+ [For follow-up/fix tasks: "This is a follow-up to task NNN. See outcome: {projectPath}/outcomes/NNN-task-name.md"]
134
146
 
135
147
  ## Dependencies
136
148
  [Optional section - omit if task has no dependencies]
@@ -182,7 +194,20 @@ Planning complete! Press Ctrl-C twice to exit to exit this session
182
194
  6. Each plan should be self-contained with all context needed
183
195
  7. Specify task dependencies using the ## Dependencies section with task IDs only (e.g., "001, 002")
184
196
  8. Tasks without dependencies should omit the Dependencies section entirely
185
- 9. Be specific - vague plans lead to poor execution`;
197
+ 9. Be specific - vague plans lead to poor execution
198
+
199
+ ## Plan Output Style
200
+
201
+ **CRITICAL**: Plans should be HIGH-LEVEL and CONCEPTUAL:
202
+ - Describe WHAT needs to be done, not HOW to code it
203
+ - Focus on architecture, data flow, and component interactions
204
+ - NO code snippets or implementation details in plans
205
+ - File paths ARE acceptable when referencing:
206
+ - Existing project files to modify
207
+ - Previous plan/outcome files for context
208
+ - Project structure and directories
209
+ - Let the executing agent decide implementation specifics
210
+ - Plans guide the work; they don't prescribe exact code`;
186
211
 
187
212
  const userMessage = `I want to add the following new tasks to this project:
188
213
 
@@ -167,8 +167,7 @@ Follow the implementation steps in the plan. Key guidelines:
167
167
  - Write clean, maintainable code
168
168
  - Follow existing code patterns in the project
169
169
  - Add appropriate error handling
170
- - Write tests if specified in the plan
171
- - Follow any CLAUDE.md instructions if present
170
+ - Follow any CLAUDE.md instructions
172
171
  ${dependencyContextSection}${outcomesSection}
173
172
  ### Step 3: Verify Completion
174
173
 
@@ -20,7 +20,7 @@ export function getPlanningPrompt(params: PlanningPromptParams): PlanningPromptR
20
20
 
21
21
  ## Your Goals
22
22
 
23
- 1. **Analyze the input** and identify 3-8 distinct, actionable tasks
23
+ 1. **Analyze the input** and identify distinct, actionable tasks
24
24
  2. **Interview the user** about EACH task to gather specific requirements
25
25
  3. **Create plan files** for each task with clear instructions
26
26
 
@@ -32,7 +32,7 @@ Project folder: ${projectPath}
32
32
 
33
33
  ### Step 1: Identify and Order Tasks
34
34
 
35
- Based on the project description, identify 3-8 distinct tasks. Each task should:
35
+ Based on the project description, identify distinct tasks. Each task should:
36
36
  - Be independently completable
37
37
  - Have a clear outcome
38
38
  - Take roughly 10-30 minutes of work for Claude
@@ -163,7 +163,20 @@ Planning complete! To exit this session and run your tasks:
163
163
  5. Infer dependencies automatically - analyze task relationships, don't ask the user about dependencies
164
164
  6. Only add Dependencies section when a task genuinely requires another to complete first
165
165
  7. Dependencies must only reference lower-numbered tasks to prevent circular dependencies
166
- 8. Be specific - vague plans lead to poor execution`;
166
+ 8. Be specific - vague plans lead to poor execution
167
+
168
+ ## Plan Output Style
169
+
170
+ **CRITICAL**: Plans should be HIGH-LEVEL and CONCEPTUAL:
171
+ - Describe WHAT needs to be done, not HOW to code it
172
+ - Focus on architecture, data flow, and component interactions
173
+ - NO code snippets or implementation details in plans
174
+ - File paths ARE acceptable when referencing:
175
+ - Existing project files to modify
176
+ - Previous plan/outcome files for context
177
+ - Project structure and directories
178
+ - Let the executing agent decide implementation specifics
179
+ - Plans guide the work; they don't prescribe exact code`;
167
180
 
168
181
  const userMessage = `Here is my project description:
169
182
 
@@ -36,25 +36,28 @@ function truncate(str: string, maxLength: number): string {
36
36
  * @param status - Task status
37
37
  * @param name - Task name
38
38
  * @param elapsedMs - Optional elapsed time in milliseconds
39
- * @returns Formatted string like "● auth-login 1:23" or "✓ auth-login 1/5"
39
+ * @param taskId - Optional task ID for [NNN] prefix display
40
+ * @returns Formatted string like "● [001] auth-login 1:23" or "✓ [001] auth-login 1/5"
40
41
  */
41
42
  export function formatTaskProgress(
42
43
  current: number,
43
44
  total: number,
44
45
  status: TaskStatus,
45
46
  name: string,
46
- elapsedMs?: number
47
+ elapsedMs?: number,
48
+ taskId?: string
47
49
  ): string {
48
50
  const symbol = SYMBOLS[status];
49
51
  const displayName = truncate(name || 'task', 40);
52
+ const idPrefix = taskId ? `[${taskId}] ` : '';
50
53
 
51
54
  // Show elapsed time for running tasks, completed tasks, and failed tasks
52
55
  if (elapsedMs !== undefined) {
53
56
  const timeStr = formatElapsedTime(elapsedMs);
54
- return `${symbol} ${displayName} ${timeStr}`;
57
+ return `${symbol} ${idPrefix}${displayName} ${timeStr}`;
55
58
  }
56
59
 
57
- return `${symbol} ${displayName} ${current}/${total}`;
60
+ return `${symbol} ${idPrefix}${displayName} ${current}/${total}`;
58
61
  }
59
62
 
60
63
  /**