@claude-flow/cli 3.25.4 → 3.25.5

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.
@@ -1516,8 +1516,12 @@ const benchmarkCommand = {
1516
1516
  const spinner = output.createSpinner({ text: 'Running benchmarks...', spinner: 'dots' });
1517
1517
  spinner.start();
1518
1518
  try {
1519
+ // Indirect the specifier through a string variable so tsc doesn't
1520
+ // statically resolve this optional dependency at build time (TS2307
1521
+ // when it isn't installed — install-safety / Build V3 pattern from #2586).
1522
+ const attentionPkg = '@ruvector/attention';
1519
1523
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic import of optional native WASM module with no type declarations
1520
- const attention = await import('@ruvector/attention');
1524
+ const attention = await import(attentionPkg);
1521
1525
  // Manual benchmark since benchmarkAttention has a binding bug
1522
1526
  const benchmarkMechanism = async (name, mechanism) => {
1523
1527
  const query = new Float32Array(dim);
@@ -1591,13 +1595,16 @@ const benchmarkCommand = {
1591
1595
  // Also benchmark MicroLoRA
1592
1596
  spinner.start();
1593
1597
  spinner.setText('Benchmarking MicroLoRA adaptation...');
1594
- // Load WASM file directly (Node.js compatible)
1598
+ // Load WASM file directly (Node.js compatible). Indirect the specifier
1599
+ // through a string variable so tsc doesn't statically resolve this
1600
+ // optional dependency at build time (TS2307 when absent — #2586 pattern).
1595
1601
  const fs = await import('fs');
1596
1602
  const { createRequire } = await import('module');
1597
1603
  const require = createRequire(import.meta.url);
1598
- const wasmPath = require.resolve('@ruvector/learning-wasm/ruvector_learning_wasm_bg.wasm');
1604
+ const learningWasmPkg = '@ruvector/learning-wasm';
1605
+ const wasmPath = require.resolve(`${learningWasmPkg}/ruvector_learning_wasm_bg.wasm`);
1599
1606
  const wasmBuffer = fs.readFileSync(wasmPath);
1600
- const learningWasm = await import('@ruvector/learning-wasm');
1607
+ const learningWasm = await import(learningWasmPkg);
1601
1608
  learningWasm.initSync({ module: wasmBuffer });
1602
1609
  const lora = new learningWasm.WasmMicroLoRA(dim, 0.1, 0.01);
1603
1610
  const gradient = new Float32Array(dim);
@@ -1697,9 +1704,15 @@ const routerTrainCommand = {
1697
1704
  const corpusPath = ctx.flags.corpus;
1698
1705
  const outPath = ctx.flags.out || './router.krr.json';
1699
1706
  const qualityBar = parseFloat(ctx.flags['quality-bar'] || '0.8') || 0.8;
1707
+ // Indirect the optional-dep specifier through a string variable so tsc
1708
+ // doesn't statically resolve `@metaharness/router` at build time (TS2307
1709
+ // when it isn't installed — #2586 pattern). The dep is optional at
1710
+ // runtime; the catch below emits a clear operator message.
1711
+ const metaharnessRouterPkg = '@metaharness/router';
1712
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic import of optional dep; call surface is fluid across upstream versions
1700
1713
  let mh;
1701
1714
  try {
1702
- mh = await import('@metaharness/router');
1715
+ mh = await import(metaharnessRouterPkg);
1703
1716
  }
1704
1717
  catch {
1705
1718
  output.printError('@metaharness/router is not installed. `npm install @metaharness/router@^0.3.2` then re-run.');
@@ -60,7 +60,11 @@ export async function isRuvectorAvailable() {
60
60
  */
61
61
  export async function isWasmBackendAvailable() {
62
62
  try {
63
- const wasm = await import('@ruvector/learning-wasm');
63
+ // Indirect the specifier through a string variable so tsc doesn't
64
+ // statically resolve this optional dep at build time (TS2307 when
65
+ // absent — #2586 pattern). Same runtime behaviour: try/catch guards.
66
+ const learningWasmPkg = '@ruvector/learning-wasm';
67
+ const wasm = (await import(learningWasmPkg));
64
68
  return typeof wasm.WasmMicroLoRA === 'function' && typeof wasm.initSync === 'function';
65
69
  }
66
70
  catch {
@@ -183,10 +183,14 @@ function loadSeedCorpus(path) {
183
183
  }
184
184
  }
185
185
  async function resolveBackend(cfg) {
186
- // 1. Optional dep present?
186
+ // 1. Optional dep present? Indirect the specifier through a string variable
187
+ // so tsc doesn't statically resolve `@metaharness/router` at build time
188
+ // (TS2307 when the optional dep isn't installed — #2586 pattern).
189
+ const metaharnessRouterPkg = '@metaharness/router';
190
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- optional dep; surface is fluid across upstream versions
187
191
  let mh;
188
192
  try {
189
- mh = await import('@metaharness/router');
193
+ mh = await import(metaharnessRouterPkg);
190
194
  }
191
195
  catch {
192
196
  return { available: false, router: null, routedBy: null, reason: '@metaharness/router not installed' };
@@ -231,9 +231,14 @@ export async function initializeTraining(config = {}) {
231
231
  const fs = await import('fs');
232
232
  const { createRequire } = await import('module');
233
233
  const require = createRequire(import.meta.url);
234
- const wasmPath = require.resolve('@ruvector/learning-wasm/ruvector_learning_wasm_bg.wasm');
234
+ // Indirect the optional-dep specifier through a string variable so tsc
235
+ // doesn't statically resolve `@ruvector/learning-wasm` at build time
236
+ // (TS2307 when the optional dep is absent — #2586 pattern).
237
+ const learningWasmPkg = '@ruvector/learning-wasm';
238
+ const wasmPath = require.resolve(`${learningWasmPkg}/ruvector_learning_wasm_bg.wasm`);
235
239
  const wasmBuffer = fs.readFileSync(wasmPath);
236
- const learningWasm = await import('@ruvector/learning-wasm');
240
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- optional-dep dynamic import
241
+ const learningWasm = await import(learningWasmPkg);
237
242
  learningWasm.initSync({ module: wasmBuffer });
238
243
  microLoRA = new learningWasm.WasmMicroLoRA(dim, alpha, lr);
239
244
  features.push(`MicroLoRA/WASM (${dim}-dim, <1μs adaptation)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.25.4",
3
+ "version": "3.25.5",
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",
@@ -88,10 +88,7 @@
88
88
  "test": "vitest run",
89
89
  "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
90
90
  "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
91
- "postinstall": "node ./scripts/postinstall.cjs",
92
- "prepublishOnly": "cp ../../../README.md ./README.md && rm -rf plugins && mkdir -p plugins && cp -r ../../../plugins/ruflo-metaharness plugins/ && node scripts/sign-helpers.mjs && node scripts/verify-helpers.mjs",
93
- "release": "npm version prerelease --preid=alpha && npm run publish:all",
94
- "publish:all": "./scripts/publish.sh"
91
+ "postinstall": "node ./scripts/postinstall.cjs"
95
92
  },
96
93
  "devDependencies": {
97
94
  "typescript": "^5.3.0",