rralph 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/rralph/cli.rb +1 -1
- data/lib/rralph/parser.rb +8 -4
- data/lib/rralph/runner.rb +11 -5
- data/lib/rralph.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 342f736981b882762e1089ae9634979a2ff8a78a479f2ff96e6a48b04092a305
|
|
4
|
+
data.tar.gz: 629522ae73440accec26b6f98d9ad2319ceaaf5e5d6b107874451c510d71cbbd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f324c2d16637c7ef11fb888bc19dba3f9463034eccc94ecb32b3e385cc755a4eb5acb94aac6ce5414c1d0011e0cfaac3793923b90273f94947786f080dbfe75e
|
|
7
|
+
data.tar.gz: 1b0218500f664da874a48bec6fe45015b623ea2f0984b283e951714a3d3c92eaf09cf5c62e4450036ca5603eb4cc704ae105880c5d44137f7d65a0839230d246
|
data/README.md
CHANGED
|
@@ -84,7 +84,7 @@ rralph --max-failures 2 --watch
|
|
|
84
84
|
### Command-Line Options
|
|
85
85
|
|
|
86
86
|
```
|
|
87
|
-
➜ rralph help
|
|
87
|
+
➜ rralph help
|
|
88
88
|
Commands:
|
|
89
89
|
rralph help [COMMAND] # Describe available commands or one specific command
|
|
90
90
|
rralph start # Run the rralph orchestrator
|
|
@@ -100,7 +100,7 @@ Options:
|
|
|
100
100
|
-m, [--max-failures=N] # Maximum allowed failures before stopping
|
|
101
101
|
# Default: 3
|
|
102
102
|
-a, [--ai-command=AI_COMMAND] # AI command to invoke
|
|
103
|
-
# Default: qwen-code -y -s
|
|
103
|
+
# Default: qwen-code -y -s -o stream-json
|
|
104
104
|
-w, [--watch], [--no-watch], [--skip-watch] # Run in continuous loop until completion or max failures
|
|
105
105
|
# Default: false
|
|
106
106
|
-p, [--plan-path=PLAN_PATH] # Path to plan.md file
|
|
@@ -129,10 +129,10 @@ Run continuously until all tasks are done or max failures reached:
|
|
|
129
129
|
rralph start --watch --max-failures 5
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
Use a custom AI command:
|
|
132
|
+
Use a custom AI command (e.g claude-code-router + claude-code):
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
rralph start --ai-command "
|
|
135
|
+
rralph start --ai-command "ccr code"
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
Skip git commits between tasks (files are updated but not committed):
|
|
@@ -155,7 +155,7 @@ Learnings: 6 lines
|
|
|
155
155
|
1. **Read** — `rralph` reads `plan.md`, `learnings.md`, and `todo.md`
|
|
156
156
|
2. **Prompt** — Builds a prompt with file contents and sends to LLM
|
|
157
157
|
3. **Parse** — Analyzes AI response for:
|
|
158
|
-
- `
|
|
158
|
+
- `TASK_FAILURE` keyword (case-sensitive, whole word)
|
|
159
159
|
- New learnings to extract
|
|
160
160
|
4. **Update** — On success:
|
|
161
161
|
- Marks current task as complete in `todo.md`
|
|
@@ -165,7 +165,7 @@ Learnings: 6 lines
|
|
|
165
165
|
|
|
166
166
|
### Failure Handling
|
|
167
167
|
|
|
168
|
-
- Each `
|
|
168
|
+
- Each `TASK_FAILURE` response increments a counter
|
|
169
169
|
- Non-failure responses reset the counter to 0
|
|
170
170
|
- When max failures reached, `rralph` exits with error:
|
|
171
171
|
- ```
|
|
@@ -192,6 +192,7 @@ rralph start --verbose
|
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
Verbose output shows:
|
|
195
|
+
|
|
195
196
|
- Thinking: AI's thought process as it thinks
|
|
196
197
|
- Real-time text output from the AI
|
|
197
198
|
- Completion metrics (duration, token usage)
|
data/lib/rralph/cli.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Rralph
|
|
|
11
11
|
desc: 'Maximum allowed failures before stopping'
|
|
12
12
|
method_option :ai_command,
|
|
13
13
|
type: :string,
|
|
14
|
-
default: 'qwen-code -y -s',
|
|
14
|
+
default: 'qwen-code -y -s -o stream-json',
|
|
15
15
|
aliases: '-a',
|
|
16
16
|
desc: 'AI command to invoke'
|
|
17
17
|
method_option :watch,
|
data/lib/rralph/parser.rb
CHANGED
|
@@ -58,7 +58,11 @@ module Rralph
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def failure_detected?(response)
|
|
61
|
-
response.match?(/\
|
|
61
|
+
response.match?(/\bTASK_FAILURE\b/)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def task_completed?(response)
|
|
65
|
+
response.match?(/\bTASK_DONE\b/)
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
def extract_learnings(response)
|
|
@@ -117,15 +121,15 @@ module Rralph
|
|
|
117
121
|
2. Write a unit test for it
|
|
118
122
|
3. Run the test
|
|
119
123
|
4. Respond with exactly one of:
|
|
120
|
-
- "
|
|
121
|
-
- "
|
|
124
|
+
- "TASK_DONE" if the task is complete and test passes
|
|
125
|
+
- "TASK_FAILURE" if the test fails after your best effort
|
|
122
126
|
5. Optionally add learnings as: "Learning: <insight>"
|
|
123
127
|
|
|
124
128
|
IMPORTANT RULES:
|
|
125
129
|
- Work on ONE task only - the one shown above
|
|
126
130
|
- Do NOT implement other tasks from the todo list
|
|
127
131
|
- Do NOT mark tasks as done yourself
|
|
128
|
-
- After you respond "
|
|
132
|
+
- After you respond "TASK_DONE", the system will mark this task complete
|
|
129
133
|
- Then you will receive the next task
|
|
130
134
|
|
|
131
135
|
--- plan.md (context) ---
|
data/lib/rralph/runner.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Rralph
|
|
|
7
7
|
|
|
8
8
|
def initialize(
|
|
9
9
|
max_failures: 3,
|
|
10
|
-
ai_command: 'qwen-code -y -s',
|
|
10
|
+
ai_command: 'qwen-code -y -s -o stream-json',
|
|
11
11
|
watch: false,
|
|
12
12
|
plan_path: 'plan.md',
|
|
13
13
|
learnings_path: 'learnings.md',
|
|
@@ -104,7 +104,13 @@ module Rralph
|
|
|
104
104
|
|
|
105
105
|
if @parser.failure_detected?(response)
|
|
106
106
|
@failure_count += 1
|
|
107
|
-
log("❌ [Cycle #{@cycle_count}]
|
|
107
|
+
log("❌ [Cycle #{@cycle_count}] TASK_FAILURE detected. Failures: #{@failure_count}/#{@max_failures}")
|
|
108
|
+
return handle_failure
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
unless @parser.task_completed?(response)
|
|
112
|
+
@failure_count += 1
|
|
113
|
+
log("❌ [Cycle #{@cycle_count}] Neither TASK_DONE nor TASK_FAILURE found. Failures: #{@failure_count}/#{@max_failures}")
|
|
108
114
|
return handle_failure
|
|
109
115
|
end
|
|
110
116
|
|
|
@@ -151,8 +157,7 @@ module Rralph
|
|
|
151
157
|
begin
|
|
152
158
|
log('Executing AI command...')
|
|
153
159
|
|
|
154
|
-
|
|
155
|
-
cmd = "#{@ai_command} -y -s -o stream-json"
|
|
160
|
+
cmd = @ai_command
|
|
156
161
|
|
|
157
162
|
Open3.popen3(cmd) do |stdin, stdout, _stderr, wait_thr|
|
|
158
163
|
# Write prompt to stdin and close
|
|
@@ -206,7 +211,8 @@ module Rralph
|
|
|
206
211
|
log(" [event: #{event['type']}]") if @verbose
|
|
207
212
|
end
|
|
208
213
|
rescue JSON::ParserError
|
|
209
|
-
#
|
|
214
|
+
# Non-JSON output (e.g., plain text from AI) - still capture it
|
|
215
|
+
full_response += line
|
|
210
216
|
log(" #{line.chomp}") if @verbose
|
|
211
217
|
end
|
|
212
218
|
|
data/lib/rralph.rb
CHANGED