@claude-flow/cli 3.10.10 → 3.10.11
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/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +10 -8
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +14 -0
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/init/settings-generator.js +1 -1
- package/dist/src/init/statusline-generator.js +2 -2
- package/dist/src/mcp-tools/agent-execute-core.d.ts +2 -2
- package/dist/src/mcp-tools/agent-execute-core.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-execute-core.js +8 -5
- package/dist/src/mcp-tools/agent-execute-core.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +14 -14
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +176 -7
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +5 -2
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/runtime/parent-death-watchdog.d.ts +42 -0
- package/dist/src/runtime/parent-death-watchdog.d.ts.map +1 -0
- package/dist/src/runtime/parent-death-watchdog.js +70 -0
- package/dist/src/runtime/parent-death-watchdog.js.map +1 -0
- package/dist/src/ruvector/codemods/engine.d.ts +45 -0
- package/dist/src/ruvector/codemods/engine.d.ts.map +1 -0
- package/dist/src/ruvector/codemods/engine.js +291 -0
- package/dist/src/ruvector/codemods/engine.js.map +1 -0
- package/dist/src/ruvector/codemods/scope-analysis.d.ts +29 -0
- package/dist/src/ruvector/codemods/scope-analysis.d.ts.map +1 -0
- package/dist/src/ruvector/codemods/scope-analysis.js +162 -0
- package/dist/src/ruvector/codemods/scope-analysis.js.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts +29 -8
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.js +104 -81
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.d.ts +14 -1
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -1
- package/dist/src/ruvector/q-learning-router.js +36 -8
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/scripts/benchmark-codemods.mjs +127 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// benchmark-codemods.mjs — measured benchmark for deterministic Tier-1 codemods (ADR-143).
|
|
3
|
+
//
|
|
4
|
+
// Runs every case in bench/codemod-corpus.json through applyCodemod() and records:
|
|
5
|
+
// - correctness vs the golden `expected` output
|
|
6
|
+
// - latency (avg / p50 / p99 / max)
|
|
7
|
+
// - cost: $0 measured (no API call) + estimated savings vs an LLM edit
|
|
8
|
+
//
|
|
9
|
+
// Writes a run JSON (tagged summary.benchmark="codemod-tier1") into the
|
|
10
|
+
// cost-tracker plugin's runs dir, which is exactly what `cost-trend` reads:
|
|
11
|
+
// plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-<timestamp>.json
|
|
12
|
+
// View the series with: BENCH_NAME=codemod-tier1 node scripts/trend.mjs
|
|
13
|
+
//
|
|
14
|
+
// Usage:
|
|
15
|
+
// node scripts/benchmark-codemods.mjs # build dist first (npm run build)
|
|
16
|
+
// BENCH_JSON=1 node scripts/benchmark-codemods.mjs # machine-readable JSON to stdout
|
|
17
|
+
// BENCH_NO_WRITE=1 node scripts/benchmark-codemods.mjs # don't write a run file
|
|
18
|
+
|
|
19
|
+
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import { dirname, join, resolve } from 'node:path';
|
|
22
|
+
import { performance } from 'node:perf_hooks';
|
|
23
|
+
|
|
24
|
+
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const CLI_ROOT = resolve(SCRIPT_DIR, '..');
|
|
26
|
+
const REPO_ROOT = resolve(SCRIPT_DIR, '../../../..');
|
|
27
|
+
// Write to the cost-tracker plugin's runs dir — the exact path `cost-trend` reads.
|
|
28
|
+
const RUNS_DIR = join(REPO_ROOT, 'plugins', 'ruflo-cost-tracker', 'docs', 'benchmarks', 'runs');
|
|
29
|
+
|
|
30
|
+
// Estimated per-edit LLM cost (USD). Documented estimates, NOT a live call —
|
|
31
|
+
// used only to express the savings of a $0 deterministic codemod.
|
|
32
|
+
const LLM_EDIT_COST = { haiku: 0.0002, sonnet: 0.003, opus: 0.015 };
|
|
33
|
+
|
|
34
|
+
function percentile(sorted, p) {
|
|
35
|
+
if (sorted.length === 0) return 0;
|
|
36
|
+
const idx = Math.min(sorted.length - 1, Math.floor((p / 100) * sorted.length));
|
|
37
|
+
return sorted[idx];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function main() {
|
|
41
|
+
const { applyCodemod } = await import('../dist/src/ruvector/codemods/engine.js');
|
|
42
|
+
const corpus = JSON.parse(readFileSync(join(CLI_ROOT, 'bench', 'codemod-corpus.json'), 'utf-8'));
|
|
43
|
+
const cases = corpus.cases;
|
|
44
|
+
|
|
45
|
+
const results = [];
|
|
46
|
+
const latencies = [];
|
|
47
|
+
let correct = 0;
|
|
48
|
+
|
|
49
|
+
for (const c of cases) {
|
|
50
|
+
const t0 = performance.now();
|
|
51
|
+
const r = applyCodemod(c.intent, c.code, { language: c.language });
|
|
52
|
+
const latencyMs = performance.now() - t0;
|
|
53
|
+
latencies.push(latencyMs);
|
|
54
|
+
const ok = r.success && r.output === c.expected;
|
|
55
|
+
if (ok) correct++;
|
|
56
|
+
results.push({
|
|
57
|
+
id: c.id, intent: c.intent, correct: ok, changed: r.changed,
|
|
58
|
+
edits: r.edits, latencyMs: Number(latencyMs.toFixed(4)),
|
|
59
|
+
...(ok ? {} : { gotPrefix: (r.output ?? '').slice(0, 80), reason: r.reason }),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const sorted = [...latencies].sort((a, b) => a - b);
|
|
64
|
+
const avg = latencies.reduce((s, x) => s + x, 0) / latencies.length;
|
|
65
|
+
const winRate = correct / cases.length;
|
|
66
|
+
const estSavings = {
|
|
67
|
+
vsHaiku: Number((LLM_EDIT_COST.haiku * cases.length).toFixed(6)),
|
|
68
|
+
vsSonnet: Number((LLM_EDIT_COST.sonnet * cases.length).toFixed(6)),
|
|
69
|
+
vsOpus: Number((LLM_EDIT_COST.opus * cases.length).toFixed(6)),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const summary = {
|
|
73
|
+
runAt: new Date().toISOString(),
|
|
74
|
+
benchmark: 'codemod-tier1',
|
|
75
|
+
corpusVersion: corpus.version,
|
|
76
|
+
corpusSize: cases.length,
|
|
77
|
+
winRate,
|
|
78
|
+
winRatePct: `${(winRate * 100).toFixed(1)}%`,
|
|
79
|
+
successCount: correct,
|
|
80
|
+
avgLatencyMs: Number(avg.toFixed(4)),
|
|
81
|
+
p50LatencyMs: Number(percentile(sorted, 50).toFixed(4)),
|
|
82
|
+
p99LatencyMs: Number(percentile(sorted, 99).toFixed(4)),
|
|
83
|
+
maxLatencyMs: Number(Math.max(...latencies).toFixed(4)),
|
|
84
|
+
structuralCostUsd: 0,
|
|
85
|
+
llmBaseline: 'estimated',
|
|
86
|
+
estimatedSavingsUsd: estSavings,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const run = { summary, results };
|
|
90
|
+
|
|
91
|
+
if (process.env.BENCH_JSON) {
|
|
92
|
+
console.log(JSON.stringify(run, null, 2));
|
|
93
|
+
} else {
|
|
94
|
+
console.log(`# Codemod Tier-1 benchmark (${cases.length} cases, corpus v${corpus.version})`);
|
|
95
|
+
console.log('');
|
|
96
|
+
console.log('| Metric | Value |');
|
|
97
|
+
console.log('|---|---:|');
|
|
98
|
+
console.log(`| Win rate (correct vs golden) | ${summary.winRatePct} (${correct}/${cases.length}) |`);
|
|
99
|
+
console.log(`| Avg latency | ${summary.avgLatencyMs} ms |`);
|
|
100
|
+
console.log(`| p50 / p99 / max latency | ${summary.p50LatencyMs} / ${summary.p99LatencyMs} / ${summary.maxLatencyMs} ms |`);
|
|
101
|
+
console.log(`| Measured cost | $0 (no API call) |`);
|
|
102
|
+
console.log(`| Est. savings vs Haiku/Sonnet/Opus | $${estSavings.vsHaiku} / $${estSavings.vsSonnet} / $${estSavings.vsOpus} |`);
|
|
103
|
+
console.log('');
|
|
104
|
+
const failed = results.filter((r) => !r.correct);
|
|
105
|
+
if (failed.length) {
|
|
106
|
+
console.log('## Failures');
|
|
107
|
+
for (const f of failed) console.log(`- \`${f.id}\` (${f.intent}): ${f.reason ?? `got "${f.gotPrefix}"`}`);
|
|
108
|
+
console.log('');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!process.env.BENCH_NO_WRITE) {
|
|
113
|
+
mkdirSync(RUNS_DIR, { recursive: true });
|
|
114
|
+
const stamp = summary.runAt.replace(/[:.]/g, '-');
|
|
115
|
+
writeFileSync(join(RUNS_DIR, `codemod-${stamp}.json`), JSON.stringify(run, null, 2));
|
|
116
|
+
writeFileSync(join(RUNS_DIR, 'codemod-latest.json'), JSON.stringify(run, null, 2));
|
|
117
|
+
if (!process.env.BENCH_JSON) console.log(`Wrote run to ${join(RUNS_DIR, `codemod-${stamp}.json`)}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Non-zero exit if any case regressed — usable as a CI guardrail.
|
|
121
|
+
if (correct !== cases.length) process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
main().catch((err) => {
|
|
125
|
+
console.error('benchmark failed:', err);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
});
|