mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/analysis.js
This commit is contained in:
1 parent
9c073680fe
commit
9d71ca1cc2
6 files changed
+75
-32
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250813-201924", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/analysis.js", "timestamp": "2025-08-13T20:19:24Z", "type": "pre-edit", "original_branch": "alpha-89"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250813-201925", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/analysis.js", "timestamp": "2025-08-13T20:19:25Z", "type": "post-edit", "branch": "alpha-89", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 36 ++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1755116334.json | 1 + .claude/checkpoints/1755116336.json | 1 + analysis-reports/token-usage-1755116357970.csv | 8 +++ claude-flow-wiki | 0 src/cli/simple-commands/analysis.js | 76 ++++++++++++++++++++++++++ 8 files changed, 126 insertions(+), 4 deletions(-) "}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"scope": "system",
|
||||
"target": "all",
|
||||
"bottlenecks": [
|
||||
{
|
||||
"severity": "good",
|
||||
"component": "Overall system",
|
||||
"metric": "No bottlenecks detected"
|
||||
}
|
||||
],
|
||||
"recommendations": [],
|
||||
"analysisDuration": 263.92715,
|
||||
"confidenceScore": 0.85,
|
||||
"issuesDetected": 0
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Timestamp,Session,Agent,Command,Input Tokens,Output Tokens,Total
|
||||
|
||||
SUMMARY
|
||||
Total Input Tokens,0
|
||||
Total Output Tokens,0
|
||||
Total Tokens,0
|
||||
|
||||
BY AGENT TYPE
|
||||
|
@@ -0,0 +1,8 @@
|
||||
Timestamp,Session,Agent,Command,Input Tokens,Output Tokens,Total
|
||||
|
||||
SUMMARY
|
||||
Total Input Tokens,0
|
||||
Total Output Tokens,0
|
||||
Total Tokens,0
|
||||
|
||||
BY AGENT TYPE
|
||||
|
@@ -297,43 +297,53 @@ async function tokenUsageCommand(subArgs, flags) {
|
||||
|
||||
printSuccess(`✅ Token usage analysis completed`);
|
||||
|
||||
// Display real token usage
|
||||
console.log(`\n🔢 TOKEN USAGE SUMMARY:`);
|
||||
console.log(` 📝 Total tokens consumed: ${tokenData.total.toLocaleString()}`);
|
||||
console.log(` 📥 Input tokens: ${tokenData.input.toLocaleString()} (${((tokenData.input / tokenData.total) * 100).toFixed(1)}%)`);
|
||||
console.log(` 📤 Output tokens: ${tokenData.output.toLocaleString()} (${((tokenData.output / tokenData.total) * 100).toFixed(1)}%)`);
|
||||
|
||||
if (costAnalysis) {
|
||||
const cost = calculateCost(tokenData);
|
||||
console.log(` 💰 Estimated cost: $${cost.total.toFixed(2)}`);
|
||||
console.log(` Input cost: $${cost.input.toFixed(2)}`);
|
||||
console.log(` Output cost: $${cost.output.toFixed(2)}`);
|
||||
// Check if we have any data
|
||||
if (tokenData.total === 0) {
|
||||
// Show instructions when no data available
|
||||
await showSimulatedTokenUsage(breakdown, costAnalysis);
|
||||
|
||||
// Still generate empty report for consistency
|
||||
const reportPath = await generateTokenUsageReport(tokenData, agent);
|
||||
console.log(`\n📄 Detailed usage log: ${reportPath}`);
|
||||
} else {
|
||||
// Display real token usage
|
||||
console.log(`\n🔢 TOKEN USAGE SUMMARY:`);
|
||||
console.log(` 📝 Total tokens consumed: ${tokenData.total.toLocaleString()}`);
|
||||
console.log(` 📥 Input tokens: ${tokenData.input.toLocaleString()} (${((tokenData.input / tokenData.total) * 100).toFixed(1)}%)`);
|
||||
console.log(` 📤 Output tokens: ${tokenData.output.toLocaleString()} (${((tokenData.output / tokenData.total) * 100).toFixed(1)}%)`);
|
||||
|
||||
if (costAnalysis) {
|
||||
const cost = calculateCost(tokenData);
|
||||
console.log(` 💰 Estimated cost: $${cost.total.toFixed(2)}`);
|
||||
console.log(` Input cost: $${cost.input.toFixed(2)}`);
|
||||
console.log(` Output cost: $${cost.output.toFixed(2)}`);
|
||||
}
|
||||
|
||||
if (breakdown && tokenData.byAgent) {
|
||||
console.log(`\n📊 BREAKDOWN BY AGENT TYPE:`);
|
||||
Object.entries(tokenData.byAgent).forEach(([agentType, usage]) => {
|
||||
const percentage = ((usage / tokenData.total) * 100).toFixed(1);
|
||||
const icon = getAgentIcon(agentType);
|
||||
console.log(` ${icon} ${agentType}: ${usage.toLocaleString()} tokens (${percentage}%)`);
|
||||
});
|
||||
|
||||
console.log(`\n💡 OPTIMIZATION OPPORTUNITIES:`);
|
||||
const opportunities = generateOptimizationSuggestions(tokenData);
|
||||
opportunities.forEach(suggestion => {
|
||||
console.log(` • ${suggestion}`);
|
||||
});
|
||||
}
|
||||
|
||||
// Generate real CSV report
|
||||
const reportPath = await generateTokenUsageReport(tokenData, agent);
|
||||
console.log(`\n📄 Detailed usage log: ${reportPath}`);
|
||||
}
|
||||
|
||||
if (breakdown && tokenData.byAgent) {
|
||||
console.log(`\n📊 BREAKDOWN BY AGENT TYPE:`);
|
||||
Object.entries(tokenData.byAgent).forEach(([agentType, usage]) => {
|
||||
const percentage = ((usage / tokenData.total) * 100).toFixed(1);
|
||||
const icon = getAgentIcon(agentType);
|
||||
console.log(` ${icon} ${agentType}: ${usage.toLocaleString()} tokens (${percentage}%)`);
|
||||
});
|
||||
|
||||
console.log(`\n💡 OPTIMIZATION OPPORTUNITIES:`);
|
||||
const opportunities = generateOptimizationSuggestions(tokenData);
|
||||
opportunities.forEach(suggestion => {
|
||||
console.log(` • ${suggestion}`);
|
||||
});
|
||||
}
|
||||
|
||||
// Generate real CSV report
|
||||
const reportPath = await generateTokenUsageReport(tokenData, agent);
|
||||
console.log(`\n📄 Detailed usage log: ${reportPath}`);
|
||||
|
||||
} catch (err) {
|
||||
printError(`Failed to get real token usage: ${err.message}`);
|
||||
printWarning('Falling back to simulated data...');
|
||||
printWarning('Falling back to help instructions...');
|
||||
|
||||
// Fallback to simulated data
|
||||
// Fallback to instructions
|
||||
await showSimulatedTokenUsage(breakdown, costAnalysis);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user