🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/automation-executor.js

This commit is contained in:
rUv committed 2025-08-04 20:23:19 +00:00
1 parent abf77bb629
commit 27ff6bd836
3 files changed
+27 -49

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"branch": "checkpoint/pre-edit-20250804-202253", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/automation-executor.js", "timestamp": "2025-08-04T20:22:53Z", "type": "pre-edit", "original_branch": "alpha-85"}
+1
View File
@@ -0,0 +1 @@
{"tag": "checkpoint-20250804-202255", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/automation-executor.js", "timestamp": "2025-08-04T20:22:55Z", "type": "post-edit", "branch": "alpha-85", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 24 ++++++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +++--- .claude/checkpoints/1754338960.json | 1 + .claude/checkpoints/1754338962.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/automation-executor.js | 3 +-- 7 files changed, 31 insertions(+), 6 deletions(-) "}
+25 -49
View File
@@ -234,62 +234,38 @@ export class WorkflowExecutor {
shell: false,
});
// No need to manually handle stdout in non-interactive mode with inherit
if (false && this.options.nonInteractive && claudeProcess.stdout) {
let buffer = '';
claudeProcess.stdout.on('data', (data) => {
const dataStr = data.toString();
buffer += dataStr;
// Also log raw data for debugging
if (this.options.logLevel === 'debug') {
console.log(`[DEBUG] Raw stdout from ${agent.name}:`, dataStr);
// Handle stdout with stream processor for better formatting
if (this.options.nonInteractive && this.options.outputFormat === 'stream-json' && claudeProcess.stdout) {
// Import and use stream processor
const { createStreamProcessor } = await import('./stream-processor.js');
const streamProcessor = createStreamProcessor(
agent.name,
this.getAgentIcon(agent.id),
{
verbose: this.options.logLevel === 'debug',
taskId: agent.taskId
}
// Process complete JSON objects from the stream
const lines = buffer.split('\n');
buffer = lines.pop() || ''; // Keep incomplete line in buffer
for (const line of lines) {
if (line.trim()) {
try {
const event = JSON.parse(line);
this.handleClaudeStreamEvent(agent, event);
} catch (error) {
// Not JSON, might be regular output
if (this.options.outputFormat === 'stream-json') {
console.log(JSON.stringify({
type: 'agent_output',
agent: agent.id,
name: agent.name,
message: line,
timestamp: new Date().toISOString()
}));
} else {
console.log(` [${agent.name}] ${line}`);
}
}
}
}
});
);
// Pipe stdout through processor
claudeProcess.stdout.pipe(streamProcessor);
// Handle stderr
claudeProcess.stderr.on('data', (data) => {
const message = data.toString().trim();
if (message) {
if (this.options.outputFormat === 'stream-json') {
console.log(JSON.stringify({
type: 'agent_error',
agent: agent.id,
name: agent.name,
error: message,
timestamp: new Date().toISOString()
}));
} else {
console.error(` ❌ [${agent.name}] Error: ${message}`);
}
console.error(` ❌ [${agent.name}] Error: ${message}`);
}
});
} else if (this.options.outputFormat !== 'stream-json') {
// For non-stream-json output, show stdout directly
claudeProcess.stdout.on('data', (data) => {
console.log(data.toString().trimEnd());
});
claudeProcess.stderr.on('data', (data) => {
console.error(data.toString().trimEnd());
});
}
// Handle process events