claude-flow 2.5.0-alpha.141 → 2.7.0-alpha
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/.claude/agents/reasoning/README.md +171 -0
- package/.claude/agents/reasoning/agent.md +816 -0
- package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/commands/coordination/README.md +9 -0
- package/.claude/commands/memory/README.md +9 -0
- package/.claude/settings.json +3 -3
- package/.claude/sparc-modes.json +108 -0
- package/README.md +1 -6
- package/bin/claude-flow +1 -1
- package/dist/src/cli/command-registry.js +70 -6
- package/dist/src/cli/command-registry.js.map +1 -1
- package/dist/src/cli/help-formatter.js +0 -3
- package/dist/src/cli/help-formatter.js.map +1 -1
- package/dist/src/cli/help-text.js +53 -5
- package/dist/src/cli/help-text.js.map +1 -1
- package/dist/src/cli/simple-cli.js +182 -172
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/agent-booster.js +415 -0
- package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
- package/dist/src/cli/simple-commands/agent.js +856 -13
- package/dist/src/cli/simple-commands/agent.js.map +1 -1
- package/dist/src/cli/simple-commands/env-template.js +180 -0
- package/dist/src/cli/simple-commands/env-template.js.map +1 -0
- package/dist/src/cli/simple-commands/init/help.js +23 -0
- package/dist/src/cli/simple-commands/init/help.js.map +1 -1
- package/dist/src/cli/simple-commands/init/index.js +63 -0
- package/dist/src/cli/simple-commands/init/index.js.map +1 -1
- package/dist/src/cli/simple-commands/memory.js +307 -16
- package/dist/src/cli/simple-commands/memory.js.map +1 -1
- package/dist/src/cli/simple-commands/proxy.js +304 -0
- package/dist/src/cli/simple-commands/proxy.js.map +1 -0
- package/dist/src/cli/simple-commands/sparc.js +16 -19
- package/dist/src/cli/simple-commands/sparc.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js +1 -1
- package/dist/src/execution/agent-executor.js +181 -0
- package/dist/src/execution/agent-executor.js.map +1 -0
- package/dist/src/execution/index.js +12 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/provider-manager.js +110 -0
- package/dist/src/execution/provider-manager.js.map +1 -0
- package/dist/src/hooks/redaction-hook.js +89 -0
- package/dist/src/hooks/redaction-hook.js.map +1 -0
- package/dist/src/memory/swarm-memory.js +340 -421
- package/dist/src/memory/swarm-memory.js.map +1 -1
- package/dist/src/utils/key-redactor.js +108 -0
- package/dist/src/utils/key-redactor.js.map +1 -0
- package/dist/src/utils/metrics-reader.js +37 -39
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
- package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
- package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
- package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
- package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
- package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
- package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
- package/docs/COMMIT_SUMMARY.md +247 -0
- package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
- package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
- package/docs/ENV-SETUP-GUIDE.md +270 -0
- package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
- package/docs/FINAL_VALIDATION_REPORT.md +165 -0
- package/docs/HOOKS-V2-MODIFICATION.md +146 -0
- package/docs/INDEX.md +568 -0
- package/docs/INTEGRATION_COMPLETE.md +414 -0
- package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
- package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
- package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
- package/docs/README.md +35 -0
- package/docs/REASONING-AGENTS.md +482 -0
- package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
- package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
- package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
- package/docs/REASONINGBANK-BENCHMARK.md +396 -0
- package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
- package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
- package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
- package/docs/REASONINGBANK-DEMO.md +419 -0
- package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
- package/docs/REASONINGBANK-VALIDATION.md +532 -0
- package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
- package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
- package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
- package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
- package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
- package/docs/api/API_DOCUMENTATION.md +721 -0
- package/docs/architecture/ARCHITECTURE.md +1690 -0
- package/docs/ci-cd/README.md +368 -0
- package/docs/development/DEPLOYMENT.md +2348 -0
- package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
- package/docs/development/build-analysis-report.md +252 -0
- package/docs/development/pair-optimization.md +156 -0
- package/docs/development/token-tracking-status.md +103 -0
- package/docs/development/training-pipeline-demo.md +163 -0
- package/docs/development/training-pipeline-real-only.md +196 -0
- package/docs/epic-sdk-integration.md +1269 -0
- package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
- package/docs/experimental/computational_verification.py +436 -0
- package/docs/experimental/novel_approaches.md +560 -0
- package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
- package/docs/experimental/riemann_proof_attempt.md +124 -0
- package/docs/experimental/riemann_synthesis.md +277 -0
- package/docs/experimental/verification_results.json +12 -0
- package/docs/experimental/visualization_insights.md +720 -0
- package/docs/guides/USER_GUIDE.md +1138 -0
- package/docs/guides/token-tracking-guide.md +291 -0
- package/docs/reference/AGENTS.md +1011 -0
- package/docs/reference/MCP_TOOLS.md +2188 -0
- package/docs/reference/SPARC.md +717 -0
- package/docs/reference/SWARM.md +2000 -0
- package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
- package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
- package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
- package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
- package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
- package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
- package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
- package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
- package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
- package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
- package/docs/sdk/epic-sdk-integration.md +1269 -0
- package/docs/setup/remote-setup.md +93 -0
- package/docs/validation/final-validation-summary.md +220 -0
- package/docs/validation/verification-integration.md +190 -0
- package/docs/validation/verification-validation.md +349 -0
- package/docs/wiki/background-commands.md +1213 -0
- package/docs/wiki/session-persistence.md +342 -0
- package/docs/wiki/stream-chain-command.md +537 -0
- package/package.json +4 -2
- package/src/cli/command-registry.js +70 -5
- package/src/cli/help-text.js +26 -5
- package/src/cli/simple-cli.ts +18 -7
- package/src/cli/simple-commands/agent-booster.js +515 -0
- package/src/cli/simple-commands/agent.js +1001 -12
- package/src/cli/simple-commands/agent.ts +137 -0
- package/src/cli/simple-commands/config.ts +127 -0
- package/src/cli/simple-commands/env-template.js +190 -0
- package/src/cli/simple-commands/init/help.js +23 -0
- package/src/cli/simple-commands/init/index.js +84 -6
- package/src/cli/simple-commands/memory.js +363 -16
- package/src/cli/simple-commands/proxy.js +384 -0
- package/src/cli/simple-commands/sparc.js +16 -19
- package/src/execution/agent-executor.ts +306 -0
- package/src/execution/index.ts +19 -0
- package/src/execution/provider-manager.ts +187 -0
- package/src/hooks/redaction-hook.ts +115 -0
- package/src/utils/key-redactor.js +178 -0
- package/src/utils/key-redactor.ts +184 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenRouter Proxy Server Commands
|
|
3
|
+
* Standalone proxy server that translates Anthropic API calls to OpenRouter
|
|
4
|
+
* Enables 85-98% cost savings with Claude Code integration
|
|
5
|
+
* NEW in v2.6.0 - Full integration with agentic-flow v1.5.5+
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { printSuccess, printError, printWarning } from '../utils.js';
|
|
9
|
+
import { exec } from 'child_process';
|
|
10
|
+
import { promisify } from 'util';
|
|
11
|
+
|
|
12
|
+
const execAsync = promisify(exec);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Main proxy command handler
|
|
16
|
+
*/
|
|
17
|
+
export async function proxyCommand(subArgs, flags) {
|
|
18
|
+
const proxyCmd = subArgs[0];
|
|
19
|
+
|
|
20
|
+
switch (proxyCmd) {
|
|
21
|
+
case 'start':
|
|
22
|
+
await startProxy(subArgs, flags);
|
|
23
|
+
break;
|
|
24
|
+
|
|
25
|
+
case 'stop':
|
|
26
|
+
await stopProxy(subArgs, flags);
|
|
27
|
+
break;
|
|
28
|
+
|
|
29
|
+
case 'status':
|
|
30
|
+
await getProxyStatus(subArgs, flags);
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case 'logs':
|
|
34
|
+
await getProxyLogs(subArgs, flags);
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 'restart':
|
|
38
|
+
await restartProxy(subArgs, flags);
|
|
39
|
+
break;
|
|
40
|
+
|
|
41
|
+
case 'config':
|
|
42
|
+
case 'configure':
|
|
43
|
+
await configureProxy(subArgs, flags);
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
default:
|
|
47
|
+
showProxyHelp();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Start OpenRouter proxy server
|
|
53
|
+
* Usage: claude-flow proxy start [--port 8080]
|
|
54
|
+
*/
|
|
55
|
+
async function startProxy(subArgs, flags) {
|
|
56
|
+
printSuccess('🚀 Starting OpenRouter proxy server...');
|
|
57
|
+
console.log('This proxy enables Claude Code to use OpenRouter models');
|
|
58
|
+
console.log('Potential cost savings: 85-98% vs direct Anthropic API\n');
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
let cmd = 'npx agentic-flow proxy';
|
|
62
|
+
|
|
63
|
+
if (flags.port) {
|
|
64
|
+
cmd += ` --port ${flags.port}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (flags.host) {
|
|
68
|
+
cmd += ` --host ${flags.host}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (flags.daemon || flags.background) {
|
|
72
|
+
cmd += ' &';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const { stdout, stderr } = await execAsync(cmd, {
|
|
76
|
+
timeout: flags.daemon ? 10000 : 0, // Short timeout for daemon mode
|
|
77
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (stdout) {
|
|
81
|
+
console.log(stdout);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
printSuccess('✅ OpenRouter proxy started successfully!');
|
|
85
|
+
console.log('\n📋 Next steps:');
|
|
86
|
+
console.log(' 1. Set environment variable:');
|
|
87
|
+
console.log(` export ANTHROPIC_BASE_URL=http://localhost:${flags.port || 8080}`);
|
|
88
|
+
console.log(' 2. Configure Claude Code to use the proxy');
|
|
89
|
+
console.log(' 3. Your OpenRouter key will be used automatically');
|
|
90
|
+
console.log(' 4. Check status: claude-flow proxy status');
|
|
91
|
+
console.log('\n💰 Cost Savings:');
|
|
92
|
+
console.log(' - Anthropic Claude 3.5 Sonnet: ~$3 per million tokens');
|
|
93
|
+
console.log(' - OpenRouter Claude 3.5 Sonnet: ~$0.30 per million tokens');
|
|
94
|
+
console.log(' - Savings: ~90% (10x cheaper!)');
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error.killed && flags.daemon) {
|
|
97
|
+
printSuccess('✅ Proxy started in background!');
|
|
98
|
+
console.log('Check status: claude-flow proxy status');
|
|
99
|
+
} else {
|
|
100
|
+
printError('❌ Failed to start proxy server');
|
|
101
|
+
console.error(error.message);
|
|
102
|
+
if (error.stderr) {
|
|
103
|
+
console.error('Details:', error.stderr);
|
|
104
|
+
}
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Stop OpenRouter proxy server
|
|
112
|
+
* Usage: claude-flow proxy stop
|
|
113
|
+
*/
|
|
114
|
+
async function stopProxy(subArgs, flags) {
|
|
115
|
+
printWarning('🛑 Stopping OpenRouter proxy server...');
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const { stdout } = await execAsync('npx agentic-flow proxy stop', {
|
|
119
|
+
timeout: 30000,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
console.log(stdout);
|
|
123
|
+
printSuccess('✅ Proxy server stopped');
|
|
124
|
+
console.log('\nRemember to unset ANTHROPIC_BASE_URL if needed:');
|
|
125
|
+
console.log(' unset ANTHROPIC_BASE_URL');
|
|
126
|
+
} catch (error) {
|
|
127
|
+
printError('❌ Failed to stop proxy server');
|
|
128
|
+
console.error(error.message);
|
|
129
|
+
console.log('\nTip: You can also stop it manually:');
|
|
130
|
+
console.log(' ps aux | grep "agentic-flow proxy"');
|
|
131
|
+
console.log(' kill -9 <PID>');
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get proxy server status
|
|
138
|
+
* Usage: claude-flow proxy status
|
|
139
|
+
*/
|
|
140
|
+
async function getProxyStatus(subArgs, flags) {
|
|
141
|
+
printSuccess('📊 Getting OpenRouter proxy status...');
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
const { stdout } = await execAsync('npx agentic-flow proxy status', {
|
|
145
|
+
timeout: 30000,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
console.log(stdout);
|
|
149
|
+
|
|
150
|
+
if (flags.verbose || flags.detailed) {
|
|
151
|
+
console.log('\n🔧 Configuration:');
|
|
152
|
+
console.log(' Base URL: http://localhost:8080 (default)');
|
|
153
|
+
console.log(' Protocol: HTTP/1.1');
|
|
154
|
+
console.log(' Translation: Anthropic API → OpenRouter API');
|
|
155
|
+
console.log('\n📝 Usage:');
|
|
156
|
+
console.log(' 1. export ANTHROPIC_BASE_URL=http://localhost:8080');
|
|
157
|
+
console.log(' 2. Use Claude Code normally');
|
|
158
|
+
console.log(' 3. All requests route through OpenRouter');
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
printError('❌ Failed to get proxy status');
|
|
162
|
+
console.error(error.message);
|
|
163
|
+
console.log('\nTip: Proxy may not be running. Start it with:');
|
|
164
|
+
console.log(' claude-flow proxy start');
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Get proxy server logs
|
|
171
|
+
* Usage: claude-flow proxy logs [--lines 100] [--follow]
|
|
172
|
+
*/
|
|
173
|
+
async function getProxyLogs(subArgs, flags) {
|
|
174
|
+
printSuccess('📄 Getting OpenRouter proxy logs...');
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
let cmd = 'npx agentic-flow proxy logs';
|
|
178
|
+
|
|
179
|
+
if (flags.lines) {
|
|
180
|
+
cmd += ` --lines ${flags.lines}`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (flags.follow || flags.f) {
|
|
184
|
+
cmd += ' --follow';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (flags.error) {
|
|
188
|
+
cmd += ' --error';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const { stdout } = await execAsync(cmd, {
|
|
192
|
+
timeout: flags.follow ? 0 : 30000, // No timeout for follow mode
|
|
193
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
console.log(stdout);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
printError('❌ Failed to get proxy logs');
|
|
199
|
+
console.error(error.message);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Restart proxy server
|
|
206
|
+
* Usage: claude-flow proxy restart
|
|
207
|
+
*/
|
|
208
|
+
async function restartProxy(subArgs, flags) {
|
|
209
|
+
printWarning('🔄 Restarting OpenRouter proxy server...');
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
// Stop first
|
|
213
|
+
await stopProxy(subArgs, { ...flags, quiet: true });
|
|
214
|
+
|
|
215
|
+
// Wait a moment
|
|
216
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
217
|
+
|
|
218
|
+
// Start again
|
|
219
|
+
await startProxy(subArgs, flags);
|
|
220
|
+
|
|
221
|
+
printSuccess('✅ Proxy server restarted successfully!');
|
|
222
|
+
} catch (error) {
|
|
223
|
+
printError('❌ Failed to restart proxy server');
|
|
224
|
+
console.error(error.message);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Configure proxy server
|
|
231
|
+
* Usage: claude-flow proxy config
|
|
232
|
+
*/
|
|
233
|
+
async function configureProxy(subArgs, flags) {
|
|
234
|
+
printSuccess('🔧 OpenRouter Proxy Configuration');
|
|
235
|
+
|
|
236
|
+
console.log('\n📋 Current Setup:');
|
|
237
|
+
console.log(' 1. Proxy translates Anthropic API calls to OpenRouter');
|
|
238
|
+
console.log(' 2. Default port: 8080');
|
|
239
|
+
console.log(' 3. Requires OPENROUTER_API_KEY environment variable');
|
|
240
|
+
|
|
241
|
+
console.log('\n🔑 API Key Setup:');
|
|
242
|
+
console.log(' export OPENROUTER_API_KEY="sk-or-v1-..."');
|
|
243
|
+
|
|
244
|
+
console.log('\n🌐 Claude Code Integration:');
|
|
245
|
+
console.log(' export ANTHROPIC_BASE_URL="http://localhost:8080"');
|
|
246
|
+
|
|
247
|
+
console.log('\n💡 Recommended Models:');
|
|
248
|
+
console.log(' - anthropic/claude-3.5-sonnet:beta (90% cheaper)');
|
|
249
|
+
console.log(' - anthropic/claude-3-opus:beta (85% cheaper)');
|
|
250
|
+
console.log(' - deepseek/deepseek-r1-0528:free (100% free!)');
|
|
251
|
+
|
|
252
|
+
console.log('\n⚙️ Advanced Configuration:');
|
|
253
|
+
console.log(' export PROXY_PORT=8080 # Custom port');
|
|
254
|
+
console.log(' export PROXY_HOST=0.0.0.0 # Allow external connections');
|
|
255
|
+
console.log(' export PROXY_LOG_LEVEL=debug # Verbose logging');
|
|
256
|
+
|
|
257
|
+
console.log('\n🚀 Quick Start:');
|
|
258
|
+
console.log(' 1. claude-flow agent config set OPENROUTER_API_KEY sk-or-v1-...');
|
|
259
|
+
console.log(' 2. claude-flow proxy start --daemon');
|
|
260
|
+
console.log(' 3. export ANTHROPIC_BASE_URL=http://localhost:8080');
|
|
261
|
+
console.log(' 4. Use Claude Code normally → automatic 90% savings!');
|
|
262
|
+
|
|
263
|
+
if (flags.test) {
|
|
264
|
+
printSuccess('\n🧪 Testing proxy connection...');
|
|
265
|
+
try {
|
|
266
|
+
const { stdout } = await execAsync('curl -s http://localhost:8080/health', {
|
|
267
|
+
timeout: 5000,
|
|
268
|
+
});
|
|
269
|
+
console.log('✅ Proxy is responding:', stdout);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
printWarning('⚠️ Proxy not responding. Start it with: claude-flow proxy start');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Show proxy command help
|
|
278
|
+
*/
|
|
279
|
+
function showProxyHelp() {
|
|
280
|
+
console.log(`
|
|
281
|
+
OpenRouter Proxy Server Commands
|
|
282
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
283
|
+
|
|
284
|
+
Standalone proxy server that translates Anthropic API calls to OpenRouter.
|
|
285
|
+
Enables 85-98% cost savings with Claude Code integration.
|
|
286
|
+
|
|
287
|
+
USAGE:
|
|
288
|
+
claude-flow proxy <command> [options]
|
|
289
|
+
|
|
290
|
+
COMMANDS:
|
|
291
|
+
start Start OpenRouter proxy server
|
|
292
|
+
stop Stop proxy server
|
|
293
|
+
restart Restart proxy server
|
|
294
|
+
status Get proxy server status
|
|
295
|
+
logs View proxy server logs
|
|
296
|
+
config Show proxy configuration guide
|
|
297
|
+
|
|
298
|
+
OPTIONS:
|
|
299
|
+
--port <number> Server port (default: 8080)
|
|
300
|
+
--host <string> Server host (default: localhost)
|
|
301
|
+
--daemon Run in background
|
|
302
|
+
--background Same as --daemon
|
|
303
|
+
--lines <number> Number of log lines (default: 100)
|
|
304
|
+
--follow, -f Follow log output in real-time
|
|
305
|
+
--error Show only error logs
|
|
306
|
+
--test Test proxy connection
|
|
307
|
+
--verbose Verbose output
|
|
308
|
+
|
|
309
|
+
EXAMPLES:
|
|
310
|
+
# Start proxy server
|
|
311
|
+
claude-flow proxy start
|
|
312
|
+
claude-flow proxy start --port 8080 --daemon
|
|
313
|
+
|
|
314
|
+
# Configure Claude Code to use proxy
|
|
315
|
+
export ANTHROPIC_BASE_URL=http://localhost:8080
|
|
316
|
+
|
|
317
|
+
# Check status
|
|
318
|
+
claude-flow proxy status
|
|
319
|
+
claude-flow proxy status --verbose
|
|
320
|
+
|
|
321
|
+
# View logs
|
|
322
|
+
claude-flow proxy logs
|
|
323
|
+
claude-flow proxy logs --lines 50 --follow
|
|
324
|
+
claude-flow proxy logs --error
|
|
325
|
+
|
|
326
|
+
# Stop/restart proxy
|
|
327
|
+
claude-flow proxy stop
|
|
328
|
+
claude-flow proxy restart
|
|
329
|
+
|
|
330
|
+
# Configuration guide
|
|
331
|
+
claude-flow proxy config
|
|
332
|
+
claude-flow proxy config --test
|
|
333
|
+
|
|
334
|
+
SETUP GUIDE:
|
|
335
|
+
1. Get OpenRouter API key: https://openrouter.ai/keys
|
|
336
|
+
2. Set environment variable:
|
|
337
|
+
claude-flow agent config set OPENROUTER_API_KEY sk-or-v1-...
|
|
338
|
+
|
|
339
|
+
3. Start proxy server:
|
|
340
|
+
claude-flow proxy start --daemon
|
|
341
|
+
|
|
342
|
+
4. Configure Claude Code:
|
|
343
|
+
export ANTHROPIC_BASE_URL=http://localhost:8080
|
|
344
|
+
|
|
345
|
+
5. Use Claude Code normally - all requests route through OpenRouter!
|
|
346
|
+
|
|
347
|
+
COST SAVINGS:
|
|
348
|
+
┌────────────────────────────────────────────────────────┐
|
|
349
|
+
│ │
|
|
350
|
+
│ Model: Claude 3.5 Sonnet │
|
|
351
|
+
│ ━━━━━━━━━━━━━━━━━━━━━━━━━ │
|
|
352
|
+
│ │
|
|
353
|
+
│ Anthropic Direct: $3.00 per million tokens │
|
|
354
|
+
│ OpenRouter Proxy: $0.30 per million tokens │
|
|
355
|
+
│ ━━━━━━━━━━━━━━━━━━━━━━━━━ │
|
|
356
|
+
│ Savings: 90% (10x cheaper!) │
|
|
357
|
+
│ │
|
|
358
|
+
│ For 100M tokens: │
|
|
359
|
+
│ - Anthropic: $300 │
|
|
360
|
+
│ - OpenRouter: $30 │
|
|
361
|
+
│ - You save: $270 │
|
|
362
|
+
│ │
|
|
363
|
+
└────────────────────────────────────────────────────────┘
|
|
364
|
+
|
|
365
|
+
FREE MODELS:
|
|
366
|
+
- deepseek/deepseek-r1-0528:free (100% free, high quality)
|
|
367
|
+
- meta-llama/llama-3.1-8b-instruct:free
|
|
368
|
+
- google/gemma-2-9b-it:free
|
|
369
|
+
|
|
370
|
+
FEATURES:
|
|
371
|
+
✅ Transparent API translation (Anthropic → OpenRouter)
|
|
372
|
+
✅ Works with Claude Code out of the box
|
|
373
|
+
✅ Automatic model mapping
|
|
374
|
+
✅ Request/response logging
|
|
375
|
+
✅ Error handling and retries
|
|
376
|
+
✅ Health check endpoint
|
|
377
|
+
✅ Zero code changes required
|
|
378
|
+
|
|
379
|
+
For more information, visit:
|
|
380
|
+
https://github.com/ruvnet/agentic-flow
|
|
381
|
+
https://www.npmjs.com/package/agentic-flow
|
|
382
|
+
https://openrouter.ai
|
|
383
|
+
`);
|
|
384
|
+
}
|
|
@@ -82,21 +82,18 @@ async function listSparcModes(subArgs) {
|
|
|
82
82
|
try {
|
|
83
83
|
// Get the actual working directory where the command was run from
|
|
84
84
|
const workingDir = process.env.PWD || cwd();
|
|
85
|
-
const configPath = `${workingDir}/.
|
|
85
|
+
const configPath = `${workingDir}/.claude/sparc-modes.json`;
|
|
86
86
|
let configContent;
|
|
87
87
|
try {
|
|
88
88
|
configContent = await fs.readFile(configPath, 'utf8');
|
|
89
89
|
} catch (error) {
|
|
90
|
-
printError('SPARC configuration file
|
|
91
|
-
console.log(`
|
|
90
|
+
printError('SPARC configuration file not found');
|
|
91
|
+
console.log(`Looking for: ${configPath}`);
|
|
92
92
|
console.log();
|
|
93
|
-
console.log('
|
|
94
|
-
console.log('
|
|
93
|
+
console.log('✅ SPARC modes are now part of .claude/ folder structure');
|
|
94
|
+
console.log('Run `claude-flow init` to set up the .claude/ folder with SPARC modes');
|
|
95
95
|
console.log();
|
|
96
|
-
console.log('
|
|
97
|
-
console.log(' • .roomodes file with 17+ SPARC development modes');
|
|
98
|
-
console.log(' • .roo/ directory with templates and workflows');
|
|
99
|
-
console.log(' • SPARC-enhanced CLAUDE.md configuration');
|
|
96
|
+
console.log('Or manually ensure .claude/sparc-modes.json exists');
|
|
100
97
|
return;
|
|
101
98
|
}
|
|
102
99
|
|
|
@@ -134,16 +131,16 @@ async function showModeInfo(subArgs) {
|
|
|
134
131
|
try {
|
|
135
132
|
// Get the actual working directory where the command was run from
|
|
136
133
|
const workingDir = process.env.PWD || cwd();
|
|
137
|
-
const configPath = `${workingDir}/.
|
|
134
|
+
const configPath = `${workingDir}/.claude/sparc-modes.json`;
|
|
138
135
|
let configContent;
|
|
139
136
|
try {
|
|
140
137
|
configContent = await fs.readFile(configPath, 'utf8');
|
|
141
138
|
} catch (error) {
|
|
142
|
-
printError('SPARC configuration file
|
|
143
|
-
console.log(`
|
|
139
|
+
printError('SPARC configuration file not found');
|
|
140
|
+
console.log(`Looking for: ${configPath}`);
|
|
144
141
|
console.log();
|
|
145
|
-
console.log('
|
|
146
|
-
console.log('
|
|
142
|
+
console.log('✅ SPARC modes are now part of .claude/ folder structure');
|
|
143
|
+
console.log('Run `claude-flow init` to set up the .claude/ folder with SPARC modes');
|
|
147
144
|
return;
|
|
148
145
|
}
|
|
149
146
|
const config = JSON.parse(configContent);
|
|
@@ -191,16 +188,16 @@ async function runSparcMode(subArgs, flags) {
|
|
|
191
188
|
try {
|
|
192
189
|
// Get the actual working directory where the command was run from
|
|
193
190
|
const workingDir = process.env.PWD || cwd();
|
|
194
|
-
const configPath = `${workingDir}/.
|
|
191
|
+
const configPath = `${workingDir}/.claude/sparc-modes.json`;
|
|
195
192
|
let configContent;
|
|
196
193
|
try {
|
|
197
194
|
configContent = await fs.readFile(configPath, 'utf8');
|
|
198
195
|
} catch (error) {
|
|
199
|
-
printError('SPARC configuration file
|
|
200
|
-
console.log(`
|
|
196
|
+
printError('SPARC configuration file not found');
|
|
197
|
+
console.log(`Looking for: ${configPath}`);
|
|
201
198
|
console.log();
|
|
202
|
-
console.log('
|
|
203
|
-
console.log('
|
|
199
|
+
console.log('✅ SPARC modes are now part of .claude/ folder structure');
|
|
200
|
+
console.log('Run `claude-flow init` to set up the .claude/ folder with SPARC modes');
|
|
204
201
|
return;
|
|
205
202
|
}
|
|
206
203
|
const config = JSON.parse(configContent);
|