flight-rules 0.13.0 → 0.13.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.
- package/dist/commands/ralph.js +30 -3
- package/package.json +1 -1
- package/payload/AGENTS.md +1 -1
package/dist/commands/ralph.js
CHANGED
|
@@ -103,9 +103,16 @@ async function isClaudeCliAvailable() {
|
|
|
103
103
|
*/
|
|
104
104
|
async function runClaudeWithPrompt(promptContent, verbose) {
|
|
105
105
|
return new Promise((resolve, reject) => {
|
|
106
|
-
|
|
106
|
+
// Use --output-format stream-json for real-time streaming output
|
|
107
|
+
// Note: Claude CLI requires --verbose when using stream-json with -p
|
|
108
|
+
const claude = spawn('claude', [
|
|
109
|
+
'--dangerously-skip-permissions',
|
|
110
|
+
'-p',
|
|
111
|
+
'--verbose',
|
|
112
|
+
'--output-format',
|
|
113
|
+
'stream-json',
|
|
114
|
+
], {
|
|
107
115
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
108
|
-
shell: true,
|
|
109
116
|
});
|
|
110
117
|
let output = '';
|
|
111
118
|
let errorOutput = '';
|
|
@@ -113,7 +120,27 @@ async function runClaudeWithPrompt(promptContent, verbose) {
|
|
|
113
120
|
const text = data.toString();
|
|
114
121
|
output += text;
|
|
115
122
|
if (verbose) {
|
|
116
|
-
|
|
123
|
+
// Parse stream-json format and extract text content
|
|
124
|
+
const lines = text.split('\n').filter((line) => line.trim());
|
|
125
|
+
for (const line of lines) {
|
|
126
|
+
try {
|
|
127
|
+
const parsed = JSON.parse(line);
|
|
128
|
+
// Handle different message types in stream-json format
|
|
129
|
+
if (parsed.type === 'assistant' && parsed.message?.content) {
|
|
130
|
+
for (const block of parsed.message.content) {
|
|
131
|
+
if (block.type === 'text' && block.text) {
|
|
132
|
+
process.stdout.write(block.text);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else if (parsed.type === 'content_block_delta' && parsed.delta?.text) {
|
|
137
|
+
process.stdout.write(parsed.delta.text);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Not valid JSON or incomplete line, skip
|
|
142
|
+
}
|
|
143
|
+
}
|
|
117
144
|
}
|
|
118
145
|
});
|
|
119
146
|
claude.stderr?.on('data', (data) => {
|
package/package.json
CHANGED