mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js
This commit is contained in:
1 parent
289bd8f404
commit
075fce503e
3 files changed
+74
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250812-181417", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js", "timestamp": "2025-08-12T18:14:17Z", "type": "pre-edit", "original_branch": "alpha-89"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250812-181418", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js", "timestamp": "2025-08-12T18:14:18Z", "type": "post-edit", "branch": "alpha-89", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 12 ++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +++--- .claude/checkpoints/1755022444.json | 1 + .claude/checkpoints/1755022446.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/stream-chain.js | 2 +- 7 files changed, 19 insertions(+), 5 deletions(-) "}
|
||||
@@ -8,6 +8,78 @@ import { spawn, execSync } from 'child_process';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
/**
|
||||
* Check if claude CLI is available
|
||||
*/
|
||||
function checkClaudeAvailable() {
|
||||
try {
|
||||
execSync('which claude', { stdio: 'ignore' });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock stream step implementation when claude CLI isn't available
|
||||
*/
|
||||
function mockStreamStep(prompt, inputStream, isLast, flags, resolve, startTime) {
|
||||
const duration = Date.now() - startTime;
|
||||
|
||||
// Simulate processing time
|
||||
setTimeout(() => {
|
||||
const mockOutput = generateMockOutput(prompt, inputStream);
|
||||
|
||||
if (flags.verbose) {
|
||||
console.log('\n📝 Mock output generated (claude CLI not available)');
|
||||
console.log(' Install claude CLI for real stream chaining');
|
||||
}
|
||||
|
||||
resolve({
|
||||
success: true,
|
||||
duration: duration + 500,
|
||||
output: mockOutput.text,
|
||||
stream: !isLast ? mockOutput.stream : null,
|
||||
error: null
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate mock output based on prompt
|
||||
*/
|
||||
function generateMockOutput(prompt, inputStream) {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
// Create mock stream-json output
|
||||
const streamJson = JSON.stringify({
|
||||
type: 'message',
|
||||
role: 'assistant',
|
||||
content: [{
|
||||
type: 'text',
|
||||
text: `Mock processing: ${prompt.slice(0, 50)}...`
|
||||
}],
|
||||
timestamp
|
||||
});
|
||||
|
||||
// Create mock text output
|
||||
const text = `✅ Mock Step Completed
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
Prompt: ${prompt.slice(0, 100)}...
|
||||
${inputStream ? 'Input: Received from previous step' : 'Input: None'}
|
||||
|
||||
Note: This is a mock response. Install claude CLI for real execution:
|
||||
npm install -g @anthropic-ai/claude-cli
|
||||
|
||||
Or use with Claude Code:
|
||||
claude -p --output-format stream-json "${prompt}"`;
|
||||
|
||||
return {
|
||||
text,
|
||||
stream: streamJson
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream Chain command handler
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user