kynjal-cli 3.1.3 → 4.0.0
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/core/coder.md +1 -1
- package/.claude/agents/core/planner.md +2 -2
- package/.claude/agents/core/researcher.md +1 -1
- package/.claude/agents/core/reviewer.md +1 -1
- package/.claude/agents/core/tester.md +1 -1
- package/.claude/agents/data/data-ml-model.md +4 -4
- package/.claude/agents/development/dev-backend-api.md +4 -4
- package/.claude/agents/documentation/docs-api-openapi.md +4 -4
- package/.claude/agents/github/code-review-swarm.md +2 -2
- package/.claude/agents/github/issue-tracker.md +2 -2
- package/.claude/agents/github/pr-manager.md +2 -2
- package/.claude/agents/github/release-manager.md +2 -2
- package/.claude/agents/github/workflow-automation.md +2 -2
- package/.claude/agents/sparc/architecture.md +3 -3
- package/.claude/agents/sparc/pseudocode.md +2 -2
- package/.claude/agents/sparc/refinement.md +3 -3
- package/.claude/agents/sparc/specification.md +2 -2
- package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
- package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
- package/.claude/agents/swarm/mesh-coordinator.md +1 -1
- package/.claude/agents/templates/base-template-generator.md +25 -4
- package/.claude/agents/templates/sparc-coordinator.md +3 -3
- package/.claude/helpers/auto-commit.sh +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +27 -9
- package/.claude/helpers/hook-handler.cjs +58 -18
- package/.claude/helpers/statusline.cjs +14 -33
- package/.claude/helpers/statusline.js +3 -3
- package/.claude/settings.json +9 -9
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
- package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
- package/README.md +383 -170
- package/bin/cli.js +6 -6
- package/bin/mcp-server.js +1 -1
- package/bin/preinstall.cjs +2 -0
- package/dist/src/appliance/gguf-engine.js +664 -0
- package/dist/src/appliance/gguf-engine.js.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +492 -0
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +383 -0
- package/dist/src/appliance/rvfa-builder.js.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +533 -0
- package/dist/src/appliance/rvfa-distribution.js.map +1 -0
- package/dist/src/appliance/rvfa-format.js +465 -0
- package/dist/src/appliance/rvfa-format.js.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +373 -0
- package/dist/src/appliance/rvfa-runner.js.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +469 -0
- package/dist/src/appliance/rvfa-signing.js.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +542 -331
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +725 -502
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1548 -1218
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
- package/dist/src/commands/appliance-advanced.js +324 -0
- package/dist/src/commands/appliance-advanced.js.map +1 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.d.ts.map +1 -0
- package/dist/src/commands/appliance.js +581 -0
- package/dist/src/commands/appliance.js.map +1 -0
- package/dist/src/commands/benchmark.js +523 -372
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +364 -274
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.d.ts.map +1 -0
- package/dist/src/commands/cleanup.js +262 -0
- package/dist/src/commands/cleanup.js.map +1 -0
- package/dist/src/commands/completions.js +118 -477
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +303 -237
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +597 -425
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +275 -194
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +690 -460
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1543 -1293
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +596 -449
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +938 -854
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +3677 -2570
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.js +322 -122
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +943 -787
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +558 -383
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +605 -475
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +1031 -814
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +347 -282
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts.map +1 -1
- package/dist/src/commands/neural.js +1563 -1283
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +643 -497
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +841 -668
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +447 -392
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +256 -162
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +220 -150
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +665 -520
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +651 -505
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +401 -349
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +267 -225
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +75 -37
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +359 -336
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +322 -335
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +431 -375
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +117 -703
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +419 -364
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +610 -456
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts +1 -1
- package/dist/src/commands/session.js +627 -505
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts +1 -1
- package/dist/src/commands/start.js +368 -271
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +492 -379
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +488 -408
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts +1 -1
- package/dist/src/commands/task.js +539 -424
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +412 -322
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +291 -196
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +486 -386
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.js +40 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.js +416 -312
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.js +507 -246
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.js +78 -368
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.js +1019 -1345
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +60 -635
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +1 -1
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +1 -1
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts +0 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +62 -42
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +167 -100
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +16 -8
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +20 -1300
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +15 -5
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +66 -76
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.js +130 -76
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.js +758 -445
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +492 -391
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.js +758 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +236 -172
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.js +142 -80
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +375 -252
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +565 -473
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +284 -190
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +600 -349
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +367 -289
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +693 -582
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +312 -261
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +2 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +2 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +514 -329
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +428 -326
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +480 -420
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +278 -204
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +429 -297
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +234 -185
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +303 -64
- package/dist/src/mcp-tools/swarm-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 +352 -200
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +357 -189
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +196 -148
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +333 -186
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +471 -335
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.js +345 -173
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.js +841 -359
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.js +1964 -0
- package/dist/src/memory/memory-bridge.js.map +1 -0
- package/dist/src/memory/memory-initializer.js +1895 -1602
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.js +329 -199
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/output.d.ts +2 -2
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +273 -242
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.js +217 -124
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.js +531 -278
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.js +362 -275
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.js +105 -48
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.js +107 -69
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +223 -172
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +228 -190
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.js +126 -62
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.js +156 -86
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.js +220 -139
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.js +93 -74
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.js +167 -75
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.js +560 -436
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.js +289 -200
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.js +511 -0
- package/dist/src/ruvector/agent-wasm.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +232 -145
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.js +419 -287
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +101 -56
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.js +451 -324
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.js +337 -251
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.js +254 -223
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.js +680 -486
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.js +113 -27
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.js +248 -155
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.js +248 -175
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.js +286 -228
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.js +338 -257
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.js +527 -0
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
- package/dist/src/ruvector/semantic-router.js +67 -60
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.js +205 -119
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.js +168 -0
- package/dist/src/services/agentic-flow-bridge.js.map +1 -0
- package/dist/src/services/claim-service.js +940 -615
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.js +669 -399
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.js +467 -441
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +5 -5
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/index.js +4 -4
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/registry-api.js +201 -93
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.js +414 -144
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.js +928 -531
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.js +550 -331
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.js +55 -45
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +37 -29
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
- package/dist/src/transfer/deploy-seraphine.js +156 -129
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.js +142 -84
- package/dist/src/transfer/export.js.map +1 -1
- package/dist/src/transfer/index.d.ts +1 -1
- package/dist/src/transfer/index.d.ts.map +1 -1
- package/dist/src/transfer/index.js +2 -0
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.js +337 -179
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.js +434 -290
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.js +58 -58
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.js +37 -33
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.js +248 -139
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.js +353 -243
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.js +365 -243
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.js +130 -63
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.js +258 -184
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +73 -51
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.js +96 -64
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +231 -174
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +130 -95
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +239 -194
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/types.js +56 -27
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.js +183 -106
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.js +198 -135
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.js +85 -38
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.js +31 -19
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.js +64 -38
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
- package/.claude/agents/custom/design-architect.yaml +0 -48
- package/.claude/agents/custom/ui-developer.yaml +0 -46
- package/.claude/agents/custom/ux-researcher.yaml +0 -60
- package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
- package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
- package/dist/src/commands/index.d.ts +0 -108
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/config-adapter.d.ts +0 -15
- package/dist/src/config-adapter.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -76
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
- package/dist/src/init/claudemd-generator.d.ts +0 -25
- package/dist/src/init/claudemd-generator.d.ts.map +0 -1
- package/dist/src/init/executor.d.ts +0 -41
- package/dist/src/init/executor.d.ts.map +0 -1
- package/dist/src/init/helpers-generator.d.ts +0 -60
- package/dist/src/init/helpers-generator.d.ts.map +0 -1
- package/dist/src/mcp-client.d.ts +0 -92
- package/dist/src/mcp-client.d.ts.map +0 -1
- package/dist/src/mcp-server.d.ts +0 -161
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-tools/auto-install.d.ts +0 -83
- package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
- package/dist/src/mcp-tools/types.d.ts +0 -31
- package/dist/src/mcp-tools/types.d.ts.map +0 -1
- package/dist/src/memory/ewc-consolidation.d.ts +0 -271
- package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
- package/dist/src/memory/intelligence.d.ts +0 -285
- package/dist/src/memory/intelligence.d.ts.map +0 -1
- package/dist/src/memory/memory-initializer.d.ts +0 -396
- package/dist/src/memory/memory-initializer.d.ts.map +0 -1
- package/dist/src/memory/sona-optimizer.d.ts +0 -227
- package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
- package/dist/src/parser.d.ts +0 -41
- package/dist/src/parser.d.ts.map +0 -1
- package/dist/src/plugins/manager.d.ts +0 -133
- package/dist/src/plugins/manager.d.ts.map +0 -1
- package/dist/src/plugins/store/discovery.d.ts +0 -88
- package/dist/src/plugins/store/discovery.d.ts.map +0 -1
- package/dist/src/plugins/store/index.d.ts +0 -76
- package/dist/src/plugins/store/index.d.ts.map +0 -1
- package/dist/src/plugins/store/search.d.ts +0 -46
- package/dist/src/plugins/store/search.d.ts.map +0 -1
- package/dist/src/plugins/store/types.d.ts +0 -274
- package/dist/src/plugins/store/types.d.ts.map +0 -1
- package/dist/src/production/circuit-breaker.d.ts +0 -101
- package/dist/src/production/circuit-breaker.d.ts.map +0 -1
- package/dist/src/production/error-handler.d.ts +0 -92
- package/dist/src/production/error-handler.d.ts.map +0 -1
- package/dist/src/production/monitoring.d.ts +0 -161
- package/dist/src/production/monitoring.d.ts.map +0 -1
- package/dist/src/production/rate-limiter.d.ts +0 -80
- package/dist/src/production/rate-limiter.d.ts.map +0 -1
- package/dist/src/production/retry.d.ts +0 -48
- package/dist/src/production/retry.d.ts.map +0 -1
- package/dist/src/prompt.d.ts +0 -44
- package/dist/src/prompt.d.ts.map +0 -1
- package/dist/src/runtime/headless.d.ts +0 -60
- package/dist/src/runtime/headless.d.ts.map +0 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
- package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/coverage-router.d.ts +0 -160
- package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
- package/dist/src/ruvector/diff-classifier.d.ts +0 -175
- package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
- package/dist/src/ruvector/flash-attention.d.ts +0 -195
- package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
- package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/index.d.ts +0 -34
- package/dist/src/ruvector/index.d.ts.map +0 -1
- package/dist/src/ruvector/lora-adapter.d.ts +0 -218
- package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
- package/dist/src/ruvector/model-router.d.ts +0 -220
- package/dist/src/ruvector/model-router.d.ts.map +0 -1
- package/dist/src/ruvector/moe-router.d.ts +0 -206
- package/dist/src/ruvector/moe-router.d.ts.map +0 -1
- package/dist/src/ruvector/q-learning-router.d.ts +0 -211
- package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
- package/dist/src/ruvector/semantic-router.d.ts +0 -77
- package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
- package/dist/src/ruvector/vector-db.d.ts +0 -69
- package/dist/src/ruvector/vector-db.d.ts.map +0 -1
- package/dist/src/services/claim-service.d.ts +0 -204
- package/dist/src/services/claim-service.d.ts.map +0 -1
- package/dist/src/services/container-worker-pool.d.ts +0 -197
- package/dist/src/services/container-worker-pool.d.ts.map +0 -1
- package/dist/src/services/headless-worker-executor.d.ts +0 -304
- package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
- package/dist/src/services/registry-api.d.ts +0 -58
- package/dist/src/services/registry-api.d.ts.map +0 -1
- package/dist/src/services/ruvector-training.d.ts +0 -213
- package/dist/src/services/ruvector-training.d.ts.map +0 -1
- package/dist/src/services/worker-daemon.d.ts +0 -203
- package/dist/src/services/worker-daemon.d.ts.map +0 -1
- package/dist/src/services/worker-queue.d.ts +0 -194
- package/dist/src/services/worker-queue.d.ts.map +0 -1
- package/dist/src/suggest.d.ts +0 -53
- package/dist/src/suggest.d.ts.map +0 -1
- package/dist/src/transfer/export.d.ts +0 -25
- package/dist/src/transfer/export.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/client.d.ts +0 -109
- package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/upload.d.ts +0 -95
- package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
- package/dist/src/transfer/models/seraphine.d.ts +0 -72
- package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
- package/dist/src/transfer/serialization/cfp.d.ts +0 -49
- package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
- package/dist/src/transfer/storage/gcs.d.ts +0 -82
- package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
- package/dist/src/transfer/store/discovery.d.ts +0 -84
- package/dist/src/transfer/store/discovery.d.ts.map +0 -1
- package/dist/src/transfer/store/download.d.ts +0 -70
- package/dist/src/transfer/store/download.d.ts.map +0 -1
- package/dist/src/transfer/store/index.d.ts +0 -84
- package/dist/src/transfer/store/index.d.ts.map +0 -1
- package/dist/src/transfer/store/publish.d.ts +0 -76
- package/dist/src/transfer/store/publish.d.ts.map +0 -1
- package/dist/src/transfer/store/search.d.ts +0 -54
- package/dist/src/transfer/store/search.d.ts.map +0 -1
- package/dist/src/transfer/types.d.ts +0 -245
- package/dist/src/transfer/types.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -198
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/update/checker.d.ts +0 -34
- package/dist/src/update/checker.d.ts.map +0 -1
- package/dist/src/update/executor.d.ts +0 -32
- package/dist/src/update/executor.d.ts.map +0 -1
- package/dist/src/update/index.d.ts +0 -33
- package/dist/src/update/index.d.ts.map +0 -1
- package/dist/src/update/rate-limiter.d.ts +0 -20
- package/dist/src/update/rate-limiter.d.ts.map +0 -1
- package/dist/src/update/validator.d.ts +0 -17
- package/dist/src/update/validator.d.ts.map +0 -1
|
@@ -10,12 +10,48 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Created with love by ruv.io
|
|
12
12
|
*/
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
13
49
|
import { output } from '../output.js';
|
|
14
50
|
import { createQLearningRouter, isRuvectorAvailable, } from '../ruvector/index.js';
|
|
15
51
|
/**
|
|
16
52
|
* Available agent types for routing
|
|
17
53
|
*/
|
|
18
|
-
|
|
54
|
+
var AGENT_TYPES = [
|
|
19
55
|
{ id: 'coder', name: 'Coder', description: 'Implements features and writes code', capabilities: ['coding', 'implementation', 'refactoring'], priority: 1 },
|
|
20
56
|
{ id: 'tester', name: 'Tester', description: 'Creates tests and validates functionality', capabilities: ['testing', 'validation', 'quality'], priority: 2 },
|
|
21
57
|
{ id: 'reviewer', name: 'Reviewer', description: 'Reviews code quality and security', capabilities: ['review', 'security', 'best-practices'], priority: 3 },
|
|
@@ -28,31 +64,40 @@ const AGENT_TYPES = [
|
|
|
28
64
|
// ============================================================================
|
|
29
65
|
// Router Singleton
|
|
30
66
|
// ============================================================================
|
|
31
|
-
|
|
32
|
-
|
|
67
|
+
var routerInstance = null;
|
|
68
|
+
var routerInitialized = false;
|
|
33
69
|
/**
|
|
34
70
|
* Get or create the router instance
|
|
35
71
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
72
|
+
function getRouter() {
|
|
73
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
if (!routerInstance) {
|
|
78
|
+
routerInstance = createQLearningRouter();
|
|
79
|
+
}
|
|
80
|
+
if (!!routerInitialized) return [3 /*break*/, 2];
|
|
81
|
+
return [4 /*yield*/, routerInstance.initialize()];
|
|
82
|
+
case 1:
|
|
83
|
+
_a.sent();
|
|
84
|
+
routerInitialized = true;
|
|
85
|
+
_a.label = 2;
|
|
86
|
+
case 2: return [2 /*return*/, routerInstance];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
45
90
|
}
|
|
46
91
|
/**
|
|
47
92
|
* Get agent type by route name
|
|
48
93
|
*/
|
|
49
94
|
function getAgentType(route) {
|
|
50
|
-
return AGENT_TYPES.find(a
|
|
95
|
+
return AGENT_TYPES.find(function (a) { return a.id === route; });
|
|
51
96
|
}
|
|
52
97
|
// ============================================================================
|
|
53
98
|
// Route Subcommand
|
|
54
99
|
// ============================================================================
|
|
55
|
-
|
|
100
|
+
var routeTaskCommand = {
|
|
56
101
|
name: 'task',
|
|
57
102
|
description: 'Route a task to the optimal agent using Q-Learning',
|
|
58
103
|
options: [
|
|
@@ -61,27 +106,27 @@ const routeTaskCommand = {
|
|
|
61
106
|
short: 'q',
|
|
62
107
|
description: 'Use Q-Learning for agent selection (default: true)',
|
|
63
108
|
type: 'boolean',
|
|
64
|
-
default: true
|
|
109
|
+
"default": true
|
|
65
110
|
},
|
|
66
111
|
{
|
|
67
112
|
name: 'agent',
|
|
68
113
|
short: 'a',
|
|
69
114
|
description: 'Force specific agent (bypasses Q-Learning)',
|
|
70
|
-
type: 'string'
|
|
115
|
+
type: 'string'
|
|
71
116
|
},
|
|
72
117
|
{
|
|
73
118
|
name: 'explore',
|
|
74
119
|
short: 'e',
|
|
75
120
|
description: 'Enable exploration (random selection chance)',
|
|
76
121
|
type: 'boolean',
|
|
77
|
-
default: true
|
|
122
|
+
"default": true
|
|
78
123
|
},
|
|
79
124
|
{
|
|
80
125
|
name: 'json',
|
|
81
126
|
short: 'j',
|
|
82
127
|
description: 'Output in JSON format',
|
|
83
128
|
type: 'boolean',
|
|
84
|
-
default: false
|
|
129
|
+
"default": false
|
|
85
130
|
},
|
|
86
131
|
],
|
|
87
132
|
examples: [
|
|
@@ -89,123 +134,137 @@ const routeTaskCommand = {
|
|
|
89
134
|
{ command: 'claude-flow route task "write unit tests" --q-learning', description: 'Use Q-Learning routing' },
|
|
90
135
|
{ command: 'claude-flow route task "review code" --agent reviewer', description: 'Force specific agent' },
|
|
91
136
|
],
|
|
92
|
-
action:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
137
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
138
|
+
var taskDescription, forceAgent, useExploration, jsonOutput, spinner, agent_1, router, result, agent, confidence, confidenceColor, qValues, maxQValue, capabilities, alternatives, error_1;
|
|
139
|
+
var _a;
|
|
140
|
+
return __generator(this, function (_b) {
|
|
141
|
+
switch (_b.label) {
|
|
142
|
+
case 0:
|
|
143
|
+
taskDescription = ctx.args[0];
|
|
144
|
+
forceAgent = ctx.flags.agent;
|
|
145
|
+
useExploration = ctx.flags.explore;
|
|
146
|
+
jsonOutput = ctx.flags.json;
|
|
147
|
+
if (!taskDescription) {
|
|
148
|
+
output.printError('Task description is required');
|
|
149
|
+
output.writeln(output.dim('Usage: claude-flow route task "task description"'));
|
|
150
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
151
|
+
}
|
|
152
|
+
spinner = output.createSpinner({ text: 'Analyzing task...', spinner: 'dots' });
|
|
153
|
+
spinner.start();
|
|
154
|
+
_b.label = 1;
|
|
155
|
+
case 1:
|
|
156
|
+
_b.trys.push([1, 3, , 4]);
|
|
157
|
+
if (forceAgent) {
|
|
158
|
+
agent_1 = getAgentType(forceAgent) ||
|
|
159
|
+
AGENT_TYPES.find(function (a) { return a.name.toLowerCase() === forceAgent.toLowerCase(); });
|
|
160
|
+
if (!agent_1) {
|
|
161
|
+
spinner.fail("Agent \"" + forceAgent + "\" not found");
|
|
162
|
+
output.writeln();
|
|
163
|
+
output.writeln('Available agents:');
|
|
164
|
+
output.printList(AGENT_TYPES.map(function (a) { return output.highlight(a.id) + " - " + a.description; }));
|
|
165
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
166
|
+
}
|
|
167
|
+
spinner.succeed("Routed to " + agent_1.name);
|
|
168
|
+
if (jsonOutput) {
|
|
169
|
+
output.printJson({
|
|
170
|
+
task: taskDescription,
|
|
171
|
+
agentId: agent_1.id,
|
|
172
|
+
agentName: agent_1.name,
|
|
173
|
+
confidence: 1.0,
|
|
174
|
+
method: 'forced'
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
output.writeln();
|
|
179
|
+
output.printBox([
|
|
180
|
+
"Task: " + taskDescription,
|
|
181
|
+
"Agent: " + output.highlight(agent_1.name) + " (" + agent_1.id + ")",
|
|
182
|
+
"Confidence: " + output.success('100%') + " (forced)",
|
|
183
|
+
"Description: " + agent_1.description,
|
|
184
|
+
].join('\n'), 'Routing Result');
|
|
185
|
+
}
|
|
186
|
+
return [2 /*return*/, { success: true, data: { agentId: agent_1.id, agentName: agent_1.name } }];
|
|
187
|
+
}
|
|
188
|
+
return [4 /*yield*/, getRouter()];
|
|
189
|
+
case 2:
|
|
190
|
+
router = _b.sent();
|
|
191
|
+
result = router.route(taskDescription, useExploration);
|
|
192
|
+
agent = getAgentType(result.route) || AGENT_TYPES[0];
|
|
193
|
+
spinner.succeed("Routed to " + agent.name);
|
|
194
|
+
if (jsonOutput) {
|
|
195
|
+
output.printJson({
|
|
196
|
+
task: taskDescription,
|
|
197
|
+
agentId: result.route,
|
|
198
|
+
agentName: agent.name,
|
|
199
|
+
confidence: result.confidence,
|
|
200
|
+
qValues: result.qValues,
|
|
201
|
+
explored: result.explored,
|
|
202
|
+
alternatives: result.alternatives.map(function (a) {
|
|
203
|
+
var _a;
|
|
204
|
+
return ({
|
|
205
|
+
agentId: a.route,
|
|
206
|
+
agentName: ((_a = getAgentType(a.route)) === null || _a === void 0 ? void 0 : _a.name) || a.route,
|
|
207
|
+
score: a.score
|
|
208
|
+
});
|
|
209
|
+
})
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
output.writeln();
|
|
214
|
+
confidence = (_a = result.confidence) !== null && _a !== void 0 ? _a : 0;
|
|
215
|
+
confidenceColor = confidence >= 0.7
|
|
216
|
+
? function (text) { return output.success(text); }
|
|
217
|
+
: confidence >= 0.4
|
|
218
|
+
? function (text) { return output.warning(text); }
|
|
219
|
+
: function (text) { return output.error(text); };
|
|
220
|
+
qValues = result.qValues || [0];
|
|
221
|
+
maxQValue = Math.max.apply(Math, qValues);
|
|
222
|
+
capabilities = agent.capabilities || [];
|
|
223
|
+
alternatives = result.alternatives || [];
|
|
224
|
+
output.printBox([
|
|
225
|
+
"Task: " + taskDescription,
|
|
226
|
+
"",
|
|
227
|
+
"Agent: " + output.highlight(agent.name) + " (" + result.route + ")",
|
|
228
|
+
"Confidence: " + confidenceColor((confidence * 100).toFixed(1) + "%"),
|
|
229
|
+
"Q-Value: " + maxQValue.toFixed(3),
|
|
230
|
+
"Exploration: " + (result.explored ? output.warning('Yes') : 'No'),
|
|
231
|
+
"",
|
|
232
|
+
"Description: " + agent.description,
|
|
233
|
+
"Capabilities: " + capabilities.join(', '),
|
|
234
|
+
].join('\n'), 'Q-Learning Routing');
|
|
235
|
+
if (alternatives.length > 0) {
|
|
236
|
+
output.writeln();
|
|
237
|
+
output.writeln(output.bold('Alternatives:'));
|
|
238
|
+
output.printTable({
|
|
239
|
+
columns: [
|
|
240
|
+
{ key: 'agent', header: 'Agent', width: 20 },
|
|
241
|
+
{ key: 'score', header: 'Score', width: 12, align: 'right' },
|
|
242
|
+
],
|
|
243
|
+
data: alternatives.map(function (a) {
|
|
244
|
+
var _a, _b;
|
|
245
|
+
return ({
|
|
246
|
+
agent: ((_a = getAgentType(a.route)) === null || _a === void 0 ? void 0 : _a.name) || a.route,
|
|
247
|
+
score: ((_b = a.score) !== null && _b !== void 0 ? _b : 0).toFixed(3)
|
|
248
|
+
});
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return [2 /*return*/, { success: true, data: { agentId: result.route, result: result } }];
|
|
254
|
+
case 3:
|
|
255
|
+
error_1 = _b.sent();
|
|
256
|
+
spinner.fail('Routing failed');
|
|
257
|
+
output.printError(error_1 instanceof Error ? error_1.message : String(error_1));
|
|
258
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
259
|
+
case 4: return [2 /*return*/];
|
|
195
260
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
catch (error) {
|
|
199
|
-
spinner.fail('Routing failed');
|
|
200
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
201
|
-
return { success: false, exitCode: 1 };
|
|
202
|
-
}
|
|
203
|
-
},
|
|
261
|
+
});
|
|
262
|
+
}); }
|
|
204
263
|
};
|
|
205
264
|
// ============================================================================
|
|
206
265
|
// List Agents Subcommand
|
|
207
266
|
// ============================================================================
|
|
208
|
-
|
|
267
|
+
var listAgentsCommand = {
|
|
209
268
|
name: 'list-agents',
|
|
210
269
|
aliases: ['agents', 'ls'],
|
|
211
270
|
description: 'List all available agent types for routing',
|
|
@@ -215,53 +274,57 @@ const listAgentsCommand = {
|
|
|
215
274
|
short: 'j',
|
|
216
275
|
description: 'Output in JSON format',
|
|
217
276
|
type: 'boolean',
|
|
218
|
-
default: false
|
|
277
|
+
"default": false
|
|
219
278
|
},
|
|
220
279
|
],
|
|
221
280
|
examples: [
|
|
222
281
|
{ command: 'claude-flow route list-agents', description: 'List all agents' },
|
|
223
282
|
{ command: 'claude-flow route agents --json', description: 'List agents as JSON' },
|
|
224
283
|
],
|
|
225
|
-
action:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
284
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
285
|
+
var jsonOutput;
|
|
286
|
+
return __generator(this, function (_a) {
|
|
287
|
+
jsonOutput = ctx.flags.json;
|
|
288
|
+
try {
|
|
289
|
+
if (jsonOutput) {
|
|
290
|
+
output.printJson(AGENT_TYPES);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
output.writeln();
|
|
294
|
+
output.writeln(output.bold('Available Agent Types'));
|
|
295
|
+
output.writeln(output.dim('Ordered by priority (highest first)'));
|
|
296
|
+
output.writeln();
|
|
297
|
+
output.printTable({
|
|
298
|
+
columns: [
|
|
299
|
+
{ key: 'id', header: 'ID', width: 15 },
|
|
300
|
+
{ key: 'name', header: 'Name', width: 15 },
|
|
301
|
+
{ key: 'priority', header: 'Priority', width: 10, align: 'right' },
|
|
302
|
+
{ key: 'description', header: 'Description', width: 45 },
|
|
303
|
+
],
|
|
304
|
+
data: AGENT_TYPES.map(function (a) { return ({
|
|
305
|
+
id: output.highlight(a.id),
|
|
306
|
+
name: a.name,
|
|
307
|
+
priority: String(a.priority),
|
|
308
|
+
description: a.description
|
|
309
|
+
}); })
|
|
310
|
+
});
|
|
311
|
+
output.writeln();
|
|
312
|
+
output.writeln(output.dim("Total: " + AGENT_TYPES.length + " agent types"));
|
|
313
|
+
}
|
|
314
|
+
return [2 /*return*/, { success: true, data: AGENT_TYPES }];
|
|
230
315
|
}
|
|
231
|
-
|
|
232
|
-
output.
|
|
233
|
-
|
|
234
|
-
output.writeln(output.dim('Ordered by priority (highest first)'));
|
|
235
|
-
output.writeln();
|
|
236
|
-
output.printTable({
|
|
237
|
-
columns: [
|
|
238
|
-
{ key: 'id', header: 'ID', width: 15 },
|
|
239
|
-
{ key: 'name', header: 'Name', width: 15 },
|
|
240
|
-
{ key: 'priority', header: 'Priority', width: 10, align: 'right' },
|
|
241
|
-
{ key: 'description', header: 'Description', width: 45 },
|
|
242
|
-
],
|
|
243
|
-
data: AGENT_TYPES.map(a => ({
|
|
244
|
-
id: output.highlight(a.id),
|
|
245
|
-
name: a.name,
|
|
246
|
-
priority: String(a.priority),
|
|
247
|
-
description: a.description,
|
|
248
|
-
})),
|
|
249
|
-
});
|
|
250
|
-
output.writeln();
|
|
251
|
-
output.writeln(output.dim(`Total: ${AGENT_TYPES.length} agent types`));
|
|
316
|
+
catch (error) {
|
|
317
|
+
output.printError(error instanceof Error ? error.message : String(error));
|
|
318
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
252
319
|
}
|
|
253
|
-
return
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
257
|
-
return { success: false, exitCode: 1 };
|
|
258
|
-
}
|
|
259
|
-
},
|
|
320
|
+
return [2 /*return*/];
|
|
321
|
+
});
|
|
322
|
+
}); }
|
|
260
323
|
};
|
|
261
324
|
// ============================================================================
|
|
262
325
|
// Stats Subcommand
|
|
263
326
|
// ============================================================================
|
|
264
|
-
|
|
327
|
+
var statsCommand = {
|
|
265
328
|
name: 'stats',
|
|
266
329
|
description: 'Show Q-Learning router statistics',
|
|
267
330
|
options: [
|
|
@@ -270,64 +333,76 @@ const statsCommand = {
|
|
|
270
333
|
short: 'j',
|
|
271
334
|
description: 'Output in JSON format',
|
|
272
335
|
type: 'boolean',
|
|
273
|
-
default: false
|
|
336
|
+
"default": false
|
|
274
337
|
},
|
|
275
338
|
],
|
|
276
339
|
examples: [
|
|
277
340
|
{ command: 'claude-flow route stats', description: 'Show routing statistics' },
|
|
278
341
|
],
|
|
279
|
-
action:
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
342
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
343
|
+
var jsonOutput, router, stats, ruvectorAvailable, ruvectorStatus, error_2;
|
|
344
|
+
return __generator(this, function (_a) {
|
|
345
|
+
switch (_a.label) {
|
|
346
|
+
case 0:
|
|
347
|
+
jsonOutput = ctx.flags.json;
|
|
348
|
+
_a.label = 1;
|
|
349
|
+
case 1:
|
|
350
|
+
_a.trys.push([1, 4, , 5]);
|
|
351
|
+
return [4 /*yield*/, getRouter()];
|
|
352
|
+
case 2:
|
|
353
|
+
router = _a.sent();
|
|
354
|
+
stats = router.getStats();
|
|
355
|
+
return [4 /*yield*/, isRuvectorAvailable()];
|
|
356
|
+
case 3:
|
|
357
|
+
ruvectorAvailable = _a.sent();
|
|
358
|
+
ruvectorStatus = {
|
|
359
|
+
available: ruvectorAvailable,
|
|
360
|
+
wasmAccelerated: stats.useNative === 1,
|
|
361
|
+
backend: stats.useNative === 1 ? 'ruvector-native' : 'fallback'
|
|
362
|
+
};
|
|
363
|
+
if (jsonOutput) {
|
|
364
|
+
output.printJson({ stats: stats, ruvector: ruvectorStatus });
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
output.writeln();
|
|
368
|
+
output.writeln(output.bold('Q-Learning Router Statistics'));
|
|
369
|
+
output.writeln();
|
|
370
|
+
output.printTable({
|
|
371
|
+
columns: [
|
|
372
|
+
{ key: 'metric', header: 'Metric', width: 25 },
|
|
373
|
+
{ key: 'value', header: 'Value', width: 20, align: 'right' },
|
|
374
|
+
],
|
|
375
|
+
data: [
|
|
376
|
+
{ metric: 'Update Count', value: String(stats.updateCount) },
|
|
377
|
+
{ metric: 'Q-Table Size', value: String(stats.qTableSize) },
|
|
378
|
+
{ metric: 'Step Count', value: String(stats.stepCount) },
|
|
379
|
+
{ metric: 'Epsilon', value: stats.epsilon.toFixed(4) },
|
|
380
|
+
{ metric: 'Avg TD Error', value: stats.avgTDError.toFixed(4) },
|
|
381
|
+
{ metric: 'Native Backend', value: stats.useNative === 1 ? 'Yes' : 'No' },
|
|
382
|
+
]
|
|
383
|
+
});
|
|
384
|
+
output.writeln();
|
|
385
|
+
output.writeln(output.bold('RuVector Status'));
|
|
386
|
+
output.printList([
|
|
387
|
+
"Available: " + (ruvectorStatus.available ? output.success('Yes') : output.warning('No (using fallback)')),
|
|
388
|
+
"WASM Accelerated: " + (ruvectorStatus.wasmAccelerated ? output.success('Yes') : 'No'),
|
|
389
|
+
"Backend: " + ruvectorStatus.backend,
|
|
390
|
+
]);
|
|
391
|
+
}
|
|
392
|
+
return [2 /*return*/, { success: true, data: { stats: stats, ruvector: ruvectorStatus } }];
|
|
393
|
+
case 4:
|
|
394
|
+
error_2 = _a.sent();
|
|
395
|
+
output.printError(error_2 instanceof Error ? error_2.message : String(error_2));
|
|
396
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
397
|
+
case 5: return [2 /*return*/];
|
|
318
398
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
catch (error) {
|
|
322
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
323
|
-
return { success: false, exitCode: 1 };
|
|
324
|
-
}
|
|
325
|
-
},
|
|
399
|
+
});
|
|
400
|
+
}); }
|
|
326
401
|
};
|
|
327
402
|
// ============================================================================
|
|
328
403
|
// Feedback Subcommand
|
|
329
404
|
// ============================================================================
|
|
330
|
-
|
|
405
|
+
var feedbackCommand = {
|
|
331
406
|
name: 'feedback',
|
|
332
407
|
description: 'Provide feedback on a routing decision',
|
|
333
408
|
options: [
|
|
@@ -336,75 +411,84 @@ const feedbackCommand = {
|
|
|
336
411
|
short: 't',
|
|
337
412
|
description: 'Task description (context for learning)',
|
|
338
413
|
type: 'string',
|
|
339
|
-
required: true
|
|
414
|
+
required: true
|
|
340
415
|
},
|
|
341
416
|
{
|
|
342
417
|
name: 'agent',
|
|
343
418
|
short: 'a',
|
|
344
419
|
description: 'Agent that was used',
|
|
345
420
|
type: 'string',
|
|
346
|
-
required: true
|
|
421
|
+
required: true
|
|
347
422
|
},
|
|
348
423
|
{
|
|
349
424
|
name: 'reward',
|
|
350
425
|
short: 'r',
|
|
351
426
|
description: 'Reward value (-1 to 1, where 1 is best)',
|
|
352
427
|
type: 'number',
|
|
353
|
-
default: 0.8
|
|
428
|
+
"default": 0.8
|
|
354
429
|
},
|
|
355
430
|
{
|
|
356
431
|
name: 'next-task',
|
|
357
432
|
short: 'n',
|
|
358
433
|
description: 'Next task description (for multi-step learning)',
|
|
359
|
-
type: 'string'
|
|
434
|
+
type: 'string'
|
|
360
435
|
},
|
|
361
436
|
],
|
|
362
437
|
examples: [
|
|
363
438
|
{ command: 'claude-flow route feedback -t "implement auth" -a coder -r 0.9', description: 'Positive feedback' },
|
|
364
439
|
{ command: 'claude-flow route feedback -t "write tests" -a tester -r -0.5', description: 'Negative feedback' },
|
|
365
440
|
],
|
|
366
|
-
action:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
441
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
442
|
+
var taskDescription, agentId, reward, nextTask, agent, router, clampedReward, tdError, error_3;
|
|
443
|
+
return __generator(this, function (_a) {
|
|
444
|
+
switch (_a.label) {
|
|
445
|
+
case 0:
|
|
446
|
+
taskDescription = ctx.flags.task;
|
|
447
|
+
agentId = ctx.flags.agent;
|
|
448
|
+
reward = ctx.flags.reward;
|
|
449
|
+
nextTask = ctx.flags['next-task'];
|
|
450
|
+
if (!taskDescription || !agentId) {
|
|
451
|
+
output.printError('Task description and agent are required');
|
|
452
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
453
|
+
}
|
|
454
|
+
agent = getAgentType(agentId);
|
|
455
|
+
if (!agent) {
|
|
456
|
+
output.printError("Unknown agent: " + agentId);
|
|
457
|
+
output.writeln('Available agents:');
|
|
458
|
+
output.printList(AGENT_TYPES.map(function (a) { return a.id; }));
|
|
459
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
460
|
+
}
|
|
461
|
+
_a.label = 1;
|
|
462
|
+
case 1:
|
|
463
|
+
_a.trys.push([1, 3, , 4]);
|
|
464
|
+
return [4 /*yield*/, getRouter()];
|
|
465
|
+
case 2:
|
|
466
|
+
router = _a.sent();
|
|
467
|
+
clampedReward = Math.max(-1, Math.min(1, reward));
|
|
468
|
+
tdError = router.update(taskDescription, agentId, clampedReward, nextTask);
|
|
469
|
+
output.printSuccess("Feedback recorded for agent \"" + agent.name + "\"");
|
|
470
|
+
output.writeln();
|
|
471
|
+
output.printBox([
|
|
472
|
+
"Task: " + taskDescription,
|
|
473
|
+
"Agent: " + agent.name + " (" + agentId + ")",
|
|
474
|
+
"Reward: " + (clampedReward >= 0 ? output.success(clampedReward.toFixed(2)) : output.error(clampedReward.toFixed(2))),
|
|
475
|
+
"TD Error: " + Math.abs(tdError).toFixed(4),
|
|
476
|
+
nextTask ? "Next Task: " + nextTask : '',
|
|
477
|
+
].filter(Boolean).join('\n'), 'Feedback Recorded');
|
|
478
|
+
return [2 /*return*/, { success: true, data: { tdError: tdError } }];
|
|
479
|
+
case 3:
|
|
480
|
+
error_3 = _a.sent();
|
|
481
|
+
output.printError(error_3 instanceof Error ? error_3.message : String(error_3));
|
|
482
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
483
|
+
case 4: return [2 /*return*/];
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}); }
|
|
403
487
|
};
|
|
404
488
|
// ============================================================================
|
|
405
489
|
// Reset Subcommand
|
|
406
490
|
// ============================================================================
|
|
407
|
-
|
|
491
|
+
var resetCommand = {
|
|
408
492
|
name: 'reset',
|
|
409
493
|
description: 'Reset the Q-Learning router state',
|
|
410
494
|
options: [
|
|
@@ -413,36 +497,46 @@ const resetCommand = {
|
|
|
413
497
|
short: 'f',
|
|
414
498
|
description: 'Force reset without confirmation',
|
|
415
499
|
type: 'boolean',
|
|
416
|
-
default: false
|
|
500
|
+
"default": false
|
|
417
501
|
},
|
|
418
502
|
],
|
|
419
503
|
examples: [
|
|
420
504
|
{ command: 'claude-flow route reset', description: 'Reset router state' },
|
|
421
505
|
{ command: 'claude-flow route reset --force', description: 'Force reset' },
|
|
422
506
|
],
|
|
423
|
-
action:
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
507
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
508
|
+
var force, router, error_4;
|
|
509
|
+
return __generator(this, function (_a) {
|
|
510
|
+
switch (_a.label) {
|
|
511
|
+
case 0:
|
|
512
|
+
force = ctx.flags.force;
|
|
513
|
+
if (!force && ctx.interactive) {
|
|
514
|
+
output.printWarning('This will reset all learned Q-values and statistics.');
|
|
515
|
+
output.writeln(output.dim('Use --force to skip this confirmation.'));
|
|
516
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
517
|
+
}
|
|
518
|
+
_a.label = 1;
|
|
519
|
+
case 1:
|
|
520
|
+
_a.trys.push([1, 3, , 4]);
|
|
521
|
+
return [4 /*yield*/, getRouter()];
|
|
522
|
+
case 2:
|
|
523
|
+
router = _a.sent();
|
|
524
|
+
router.reset();
|
|
525
|
+
output.printSuccess('Q-Learning router state has been reset');
|
|
526
|
+
return [2 /*return*/, { success: true }];
|
|
527
|
+
case 3:
|
|
528
|
+
error_4 = _a.sent();
|
|
529
|
+
output.printError(error_4 instanceof Error ? error_4.message : String(error_4));
|
|
530
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
531
|
+
case 4: return [2 /*return*/];
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}); }
|
|
441
535
|
};
|
|
442
536
|
// ============================================================================
|
|
443
537
|
// Export/Import Subcommands
|
|
444
538
|
// ============================================================================
|
|
445
|
-
|
|
539
|
+
var exportCommand = {
|
|
446
540
|
name: 'export',
|
|
447
541
|
description: 'Export Q-table for persistence',
|
|
448
542
|
options: [
|
|
@@ -450,35 +544,49 @@ const exportCommand = {
|
|
|
450
544
|
name: 'file',
|
|
451
545
|
short: 'f',
|
|
452
546
|
description: 'Output file path (outputs to stdout if not specified)',
|
|
453
|
-
type: 'string'
|
|
547
|
+
type: 'string'
|
|
454
548
|
},
|
|
455
549
|
],
|
|
456
550
|
examples: [
|
|
457
551
|
{ command: 'claude-flow route export', description: 'Export Q-table to stdout' },
|
|
458
552
|
{ command: 'claude-flow route export -f qtable.json', description: 'Export to file' },
|
|
459
553
|
],
|
|
460
|
-
action:
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
554
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
555
|
+
var filePath, router, data, fs, error_5;
|
|
556
|
+
return __generator(this, function (_a) {
|
|
557
|
+
switch (_a.label) {
|
|
558
|
+
case 0:
|
|
559
|
+
filePath = ctx.flags.file;
|
|
560
|
+
_a.label = 1;
|
|
561
|
+
case 1:
|
|
562
|
+
_a.trys.push([1, 7, , 8]);
|
|
563
|
+
return [4 /*yield*/, getRouter()];
|
|
564
|
+
case 2:
|
|
565
|
+
router = _a.sent();
|
|
566
|
+
data = router["export"]();
|
|
567
|
+
if (!filePath) return [3 /*break*/, 5];
|
|
568
|
+
return [4 /*yield*/, import('node:fs/promises')];
|
|
569
|
+
case 3:
|
|
570
|
+
fs = _a.sent();
|
|
571
|
+
return [4 /*yield*/, fs.writeFile(filePath, JSON.stringify(data, null, 2))];
|
|
572
|
+
case 4:
|
|
573
|
+
_a.sent();
|
|
574
|
+
output.printSuccess("Q-table exported to " + filePath);
|
|
575
|
+
return [3 /*break*/, 6];
|
|
576
|
+
case 5:
|
|
577
|
+
output.printJson(data);
|
|
578
|
+
_a.label = 6;
|
|
579
|
+
case 6: return [2 /*return*/, { success: true, data: data }];
|
|
580
|
+
case 7:
|
|
581
|
+
error_5 = _a.sent();
|
|
582
|
+
output.printError(error_5 instanceof Error ? error_5.message : String(error_5));
|
|
583
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
584
|
+
case 8: return [2 /*return*/];
|
|
472
585
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
catch (error) {
|
|
476
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
477
|
-
return { success: false, exitCode: 1 };
|
|
478
|
-
}
|
|
479
|
-
},
|
|
586
|
+
});
|
|
587
|
+
}); }
|
|
480
588
|
};
|
|
481
|
-
|
|
589
|
+
var importCommand = {
|
|
482
590
|
name: 'import',
|
|
483
591
|
description: 'Import Q-table from file',
|
|
484
592
|
options: [
|
|
@@ -487,38 +595,52 @@ const importCommand = {
|
|
|
487
595
|
short: 'f',
|
|
488
596
|
description: 'Input file path',
|
|
489
597
|
type: 'string',
|
|
490
|
-
required: true
|
|
598
|
+
required: true
|
|
491
599
|
},
|
|
492
600
|
],
|
|
493
601
|
examples: [
|
|
494
602
|
{ command: 'claude-flow route import -f qtable.json', description: 'Import Q-table from file' },
|
|
495
603
|
],
|
|
496
|
-
action:
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
604
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
605
|
+
var filePath, fs, content, data, router, error_6;
|
|
606
|
+
return __generator(this, function (_a) {
|
|
607
|
+
switch (_a.label) {
|
|
608
|
+
case 0:
|
|
609
|
+
filePath = ctx.flags.file;
|
|
610
|
+
if (!filePath) {
|
|
611
|
+
output.printError('File path is required');
|
|
612
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
613
|
+
}
|
|
614
|
+
_a.label = 1;
|
|
615
|
+
case 1:
|
|
616
|
+
_a.trys.push([1, 5, , 6]);
|
|
617
|
+
return [4 /*yield*/, import('node:fs/promises')];
|
|
618
|
+
case 2:
|
|
619
|
+
fs = _a.sent();
|
|
620
|
+
return [4 /*yield*/, fs.readFile(filePath, 'utf-8')];
|
|
621
|
+
case 3:
|
|
622
|
+
content = _a.sent();
|
|
623
|
+
data = JSON.parse(content);
|
|
624
|
+
return [4 /*yield*/, getRouter()];
|
|
625
|
+
case 4:
|
|
626
|
+
router = _a.sent();
|
|
627
|
+
router["import"](data);
|
|
628
|
+
output.printSuccess("Q-table imported from " + filePath);
|
|
629
|
+
output.writeln(output.dim("Loaded " + Object.keys(data).length + " state entries"));
|
|
630
|
+
return [2 /*return*/, { success: true }];
|
|
631
|
+
case 5:
|
|
632
|
+
error_6 = _a.sent();
|
|
633
|
+
output.printError(error_6 instanceof Error ? error_6.message : String(error_6));
|
|
634
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
635
|
+
case 6: return [2 /*return*/];
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
}); }
|
|
517
639
|
};
|
|
518
640
|
// ============================================================================
|
|
519
641
|
// Coverage-Aware Routing Subcommand
|
|
520
642
|
// ============================================================================
|
|
521
|
-
|
|
643
|
+
var coverageRouteCommand = {
|
|
522
644
|
name: 'coverage',
|
|
523
645
|
aliases: ['cov'],
|
|
524
646
|
description: 'Route tasks based on test coverage analysis (ADR-017)',
|
|
@@ -527,35 +649,35 @@ const coverageRouteCommand = {
|
|
|
527
649
|
name: 'path',
|
|
528
650
|
short: 'p',
|
|
529
651
|
description: 'Path to analyze for coverage',
|
|
530
|
-
type: 'string'
|
|
652
|
+
type: 'string'
|
|
531
653
|
},
|
|
532
654
|
{
|
|
533
655
|
name: 'threshold',
|
|
534
656
|
short: 't',
|
|
535
657
|
description: 'Coverage threshold percentage (default: 80)',
|
|
536
658
|
type: 'number',
|
|
537
|
-
default: 80
|
|
659
|
+
"default": 80
|
|
538
660
|
},
|
|
539
661
|
{
|
|
540
662
|
name: 'suggest',
|
|
541
663
|
short: 's',
|
|
542
664
|
description: 'Get suggestions for improving coverage',
|
|
543
665
|
type: 'boolean',
|
|
544
|
-
default: false
|
|
666
|
+
"default": false
|
|
545
667
|
},
|
|
546
668
|
{
|
|
547
669
|
name: 'gaps',
|
|
548
670
|
short: 'g',
|
|
549
671
|
description: 'List coverage gaps with agent assignments',
|
|
550
672
|
type: 'boolean',
|
|
551
|
-
default: false
|
|
673
|
+
"default": false
|
|
552
674
|
},
|
|
553
675
|
{
|
|
554
676
|
name: 'json',
|
|
555
677
|
short: 'j',
|
|
556
678
|
description: 'Output in JSON format',
|
|
557
679
|
type: 'boolean',
|
|
558
|
-
default: false
|
|
680
|
+
"default": false
|
|
559
681
|
},
|
|
560
682
|
],
|
|
561
683
|
examples: [
|
|
@@ -564,170 +686,185 @@ const coverageRouteCommand = {
|
|
|
564
686
|
{ command: 'claude-flow route coverage --gaps', description: 'List coverage gaps by agent' },
|
|
565
687
|
{ command: 'claude-flow route coverage -p src/auth -t 90', description: 'Analyze specific path with threshold' },
|
|
566
688
|
],
|
|
567
|
-
action:
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (
|
|
591
|
-
|
|
592
|
-
output.writeln(`${output.highlight(agent)} (${files.length} files)`);
|
|
593
|
-
for (const file of files.slice(0, 5)) {
|
|
594
|
-
output.writeln(` ${output.dim('•')} ${file}`);
|
|
595
|
-
}
|
|
596
|
-
if (files.length > 5) {
|
|
597
|
-
output.writeln(output.dim(` ... and ${files.length - 5} more`));
|
|
598
|
-
}
|
|
599
|
-
output.writeln();
|
|
600
|
-
}
|
|
689
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
690
|
+
var path, threshold, suggestMode, gapsMode, jsonOutput, spinner, _a, coverageRoute, coverageSuggest, coverageGaps, result, _i, _b, _c, agent, files, _d, _e, file, result, routeResult, actionColors, colorFn, error_7;
|
|
691
|
+
return __generator(this, function (_f) {
|
|
692
|
+
switch (_f.label) {
|
|
693
|
+
case 0:
|
|
694
|
+
path = ctx.flags.path || '';
|
|
695
|
+
threshold = ctx.flags.threshold || 80;
|
|
696
|
+
suggestMode = ctx.flags.suggest;
|
|
697
|
+
gapsMode = ctx.flags.gaps;
|
|
698
|
+
jsonOutput = ctx.flags.json;
|
|
699
|
+
spinner = output.createSpinner({ text: 'Analyzing coverage...', spinner: 'dots' });
|
|
700
|
+
spinner.start();
|
|
701
|
+
_f.label = 1;
|
|
702
|
+
case 1:
|
|
703
|
+
_f.trys.push([1, 8, , 9]);
|
|
704
|
+
return [4 /*yield*/, import('../ruvector/coverage-router.js')];
|
|
705
|
+
case 2:
|
|
706
|
+
_a = _f.sent(), coverageRoute = _a.coverageRoute, coverageSuggest = _a.coverageSuggest, coverageGaps = _a.coverageGaps;
|
|
707
|
+
if (!gapsMode) return [3 /*break*/, 4];
|
|
708
|
+
return [4 /*yield*/, coverageGaps({ threshold: threshold, groupByAgent: true })];
|
|
709
|
+
case 3:
|
|
710
|
+
result = _f.sent();
|
|
711
|
+
spinner.succeed("Found " + result.totalGaps + " coverage gaps");
|
|
712
|
+
if (jsonOutput) {
|
|
713
|
+
output.printJson(result);
|
|
601
714
|
}
|
|
602
715
|
else {
|
|
603
|
-
output.printSuccess('No coverage gaps found!');
|
|
604
|
-
}
|
|
605
|
-
output.writeln();
|
|
606
|
-
output.writeln(output.bold('Top Gaps:'));
|
|
607
|
-
output.printTable({
|
|
608
|
-
columns: [
|
|
609
|
-
{ key: 'file', header: 'File', width: 50 },
|
|
610
|
-
{ key: 'coverage', header: 'Coverage', width: 12, align: 'right' },
|
|
611
|
-
{ key: 'gap', header: 'Gap', width: 10, align: 'right' },
|
|
612
|
-
{ key: 'agent', header: 'Agent', width: 15 },
|
|
613
|
-
],
|
|
614
|
-
data: result.gaps.slice(0, 10).map(g => ({
|
|
615
|
-
file: g.file.length > 48 ? '...' + g.file.slice(-45) : g.file,
|
|
616
|
-
coverage: `${g.currentCoverage.toFixed(1)}%`,
|
|
617
|
-
gap: `${g.gap.toFixed(1)}%`,
|
|
618
|
-
agent: g.suggestedAgent,
|
|
619
|
-
})),
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
return { success: true, data: result };
|
|
623
|
-
}
|
|
624
|
-
if (suggestMode || path) {
|
|
625
|
-
// Suggest improvements for path
|
|
626
|
-
const result = await coverageSuggest(path || '.', { threshold, limit: 20 });
|
|
627
|
-
spinner.succeed(`Found ${result.suggestions.length} coverage suggestions`);
|
|
628
|
-
if (jsonOutput) {
|
|
629
|
-
output.printJson(result);
|
|
630
|
-
}
|
|
631
|
-
else {
|
|
632
|
-
output.writeln();
|
|
633
|
-
output.writeln(output.bold('Coverage Improvement Suggestions'));
|
|
634
|
-
output.writeln(output.dim(`Path: ${result.path}, Threshold: ${threshold}%`));
|
|
635
|
-
output.writeln();
|
|
636
|
-
if (result.suggestions.length === 0) {
|
|
637
|
-
output.printSuccess('All files meet coverage threshold!');
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
output.writeln(`Total Gap: ${output.warning(`${result.totalGap.toFixed(1)}%`)}`);
|
|
641
|
-
output.writeln(`Estimated Effort: ${output.dim(`${result.estimatedEffort.toFixed(1)} hours`)}`);
|
|
642
716
|
output.writeln();
|
|
717
|
+
output.writeln(output.bold('Coverage Gaps by Agent'));
|
|
718
|
+
output.writeln(output.dim(result.summary));
|
|
719
|
+
output.writeln();
|
|
720
|
+
if (Object.keys(result.byAgent).length > 0) {
|
|
721
|
+
for (_i = 0, _b = Object.entries(result.byAgent); _i < _b.length; _i++) {
|
|
722
|
+
_c = _b[_i], agent = _c[0], files = _c[1];
|
|
723
|
+
output.writeln(output.highlight(agent) + " (" + files.length + " files)");
|
|
724
|
+
for (_d = 0, _e = files.slice(0, 5); _d < _e.length; _d++) {
|
|
725
|
+
file = _e[_d];
|
|
726
|
+
output.writeln(" " + output.dim('•') + " " + file);
|
|
727
|
+
}
|
|
728
|
+
if (files.length > 5) {
|
|
729
|
+
output.writeln(output.dim(" ... and " + (files.length - 5) + " more"));
|
|
730
|
+
}
|
|
731
|
+
output.writeln();
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
output.printSuccess('No coverage gaps found!');
|
|
736
|
+
}
|
|
737
|
+
output.writeln();
|
|
738
|
+
output.writeln(output.bold('Top Gaps:'));
|
|
643
739
|
output.printTable({
|
|
644
740
|
columns: [
|
|
645
|
-
{ key: 'file', header: 'File', width:
|
|
646
|
-
{ key: '
|
|
647
|
-
{ key: '
|
|
648
|
-
{ key: '
|
|
741
|
+
{ key: 'file', header: 'File', width: 50 },
|
|
742
|
+
{ key: 'coverage', header: 'Coverage', width: 12, align: 'right' },
|
|
743
|
+
{ key: 'gap', header: 'Gap', width: 10, align: 'right' },
|
|
744
|
+
{ key: 'agent', header: 'Agent', width: 15 },
|
|
649
745
|
],
|
|
650
|
-
data: result.
|
|
651
|
-
file:
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
}))
|
|
746
|
+
data: result.gaps.slice(0, 10).map(function (g) { return ({
|
|
747
|
+
file: g.file.length > 48 ? '...' + g.file.slice(-45) : g.file,
|
|
748
|
+
coverage: g.currentCoverage.toFixed(1) + "%",
|
|
749
|
+
gap: g.gap.toFixed(1) + "%",
|
|
750
|
+
agent: g.suggestedAgent
|
|
751
|
+
}); })
|
|
656
752
|
});
|
|
657
|
-
|
|
658
|
-
|
|
753
|
+
}
|
|
754
|
+
return [2 /*return*/, { success: true, data: result }];
|
|
755
|
+
case 4:
|
|
756
|
+
if (!(suggestMode || path)) return [3 /*break*/, 6];
|
|
757
|
+
return [4 /*yield*/, coverageSuggest(path || '.', { threshold: threshold, limit: 20 })];
|
|
758
|
+
case 5:
|
|
759
|
+
result = _f.sent();
|
|
760
|
+
spinner.succeed("Found " + result.suggestions.length + " coverage suggestions");
|
|
761
|
+
if (jsonOutput) {
|
|
762
|
+
output.printJson(result);
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
output.writeln();
|
|
766
|
+
output.writeln(output.bold('Coverage Improvement Suggestions'));
|
|
767
|
+
output.writeln(output.dim("Path: " + result.path + ", Threshold: " + threshold + "%"));
|
|
768
|
+
output.writeln();
|
|
769
|
+
if (result.suggestions.length === 0) {
|
|
770
|
+
output.printSuccess('All files meet coverage threshold!');
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
output.writeln("Total Gap: " + output.warning(result.totalGap.toFixed(1) + "%"));
|
|
774
|
+
output.writeln("Estimated Effort: " + output.dim(result.estimatedEffort.toFixed(1) + " hours"));
|
|
659
775
|
output.writeln();
|
|
660
|
-
output.
|
|
661
|
-
|
|
776
|
+
output.printTable({
|
|
777
|
+
columns: [
|
|
778
|
+
{ key: 'file', header: 'File', width: 45 },
|
|
779
|
+
{ key: 'current', header: 'Current', width: 10, align: 'right' },
|
|
780
|
+
{ key: 'target', header: 'Target', width: 10, align: 'right' },
|
|
781
|
+
{ key: 'priority', header: 'Priority', width: 10, align: 'right' },
|
|
782
|
+
],
|
|
783
|
+
data: result.suggestions.slice(0, 15).map(function (s) { return ({
|
|
784
|
+
file: s.file.length > 43 ? '...' + s.file.slice(-40) : s.file,
|
|
785
|
+
current: s.currentCoverage.toFixed(1) + "%",
|
|
786
|
+
target: s.targetCoverage.toFixed(1) + "%",
|
|
787
|
+
priority: String(s.priority)
|
|
788
|
+
}); })
|
|
789
|
+
});
|
|
790
|
+
// Show test suggestions for top file
|
|
791
|
+
if (result.suggestions.length > 0 && result.suggestions[0].suggestedTests.length > 0) {
|
|
792
|
+
output.writeln();
|
|
793
|
+
output.writeln(output.bold('Suggested Tests for Top Priority File:'));
|
|
794
|
+
output.printList(result.suggestions[0].suggestedTests);
|
|
795
|
+
}
|
|
662
796
|
}
|
|
663
797
|
}
|
|
664
|
-
|
|
665
|
-
return
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
output.printJson(routeResult);
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
output.writeln();
|
|
675
|
-
output.writeln(output.bold('Coverage-Aware Routing'));
|
|
676
|
-
output.writeln();
|
|
677
|
-
const actionColors = {
|
|
678
|
-
'add-tests': (s) => output.error(s),
|
|
679
|
-
'review-coverage': (s) => output.warning(s),
|
|
680
|
-
'prioritize': (s) => output.error(s),
|
|
681
|
-
'skip': (s) => output.success(s),
|
|
682
|
-
};
|
|
683
|
-
const colorFn = actionColors[routeResult.action] || ((s) => s);
|
|
684
|
-
output.printBox([
|
|
685
|
-
`Action: ${colorFn(routeResult.action.toUpperCase())}`,
|
|
686
|
-
`Priority: ${routeResult.priority}/10`,
|
|
687
|
-
`Impact Score: ${routeResult.impactScore}%`,
|
|
688
|
-
`Estimated Effort: ${routeResult.estimatedEffort} hours`,
|
|
689
|
-
``,
|
|
690
|
-
`Test Types: ${routeResult.testTypes.join(', ')}`,
|
|
691
|
-
`Target Files: ${routeResult.targetFiles.length}`,
|
|
692
|
-
].join('\n'), 'Coverage Analysis');
|
|
693
|
-
if (routeResult.targetFiles.length > 0) {
|
|
694
|
-
output.writeln();
|
|
695
|
-
output.writeln(output.bold('Target Files:'));
|
|
696
|
-
output.printList(routeResult.targetFiles.slice(0, 5).map(f => f.length > 60 ? '...' + f.slice(-57) : f));
|
|
697
|
-
if (routeResult.targetFiles.length > 5) {
|
|
698
|
-
output.writeln(output.dim(` ... and ${routeResult.targetFiles.length - 5} more`));
|
|
798
|
+
return [2 /*return*/, { success: true, data: result }];
|
|
799
|
+
case 6: return [4 /*yield*/, coverageRoute('', { threshold: threshold })];
|
|
800
|
+
case 7:
|
|
801
|
+
routeResult = _f.sent();
|
|
802
|
+
spinner.succeed('Coverage analysis complete');
|
|
803
|
+
if (jsonOutput) {
|
|
804
|
+
output.printJson(routeResult);
|
|
699
805
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
806
|
+
else {
|
|
807
|
+
output.writeln();
|
|
808
|
+
output.writeln(output.bold('Coverage-Aware Routing'));
|
|
809
|
+
output.writeln();
|
|
810
|
+
actionColors = {
|
|
811
|
+
'add-tests': function (s) { return output.error(s); },
|
|
812
|
+
'review-coverage': function (s) { return output.warning(s); },
|
|
813
|
+
'prioritize': function (s) { return output.error(s); },
|
|
814
|
+
'skip': function (s) { return output.success(s); }
|
|
815
|
+
};
|
|
816
|
+
colorFn = actionColors[routeResult.action] || (function (s) { return s; });
|
|
817
|
+
output.printBox([
|
|
818
|
+
"Action: " + colorFn(routeResult.action.toUpperCase()),
|
|
819
|
+
"Priority: " + routeResult.priority + "/10",
|
|
820
|
+
"Impact Score: " + routeResult.impactScore + "%",
|
|
821
|
+
"Estimated Effort: " + routeResult.estimatedEffort + " hours",
|
|
822
|
+
"",
|
|
823
|
+
"Test Types: " + routeResult.testTypes.join(', '),
|
|
824
|
+
"Target Files: " + routeResult.targetFiles.length,
|
|
825
|
+
].join('\n'), 'Coverage Analysis');
|
|
826
|
+
if (routeResult.targetFiles.length > 0) {
|
|
827
|
+
output.writeln();
|
|
828
|
+
output.writeln(output.bold('Target Files:'));
|
|
829
|
+
output.printList(routeResult.targetFiles.slice(0, 5).map(function (f) {
|
|
830
|
+
return f.length > 60 ? '...' + f.slice(-57) : f;
|
|
831
|
+
}));
|
|
832
|
+
if (routeResult.targetFiles.length > 5) {
|
|
833
|
+
output.writeln(output.dim(" ... and " + (routeResult.targetFiles.length - 5) + " more"));
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (routeResult.gaps.length > 0) {
|
|
837
|
+
output.writeln();
|
|
838
|
+
output.writeln(output.bold('Coverage Gaps:'));
|
|
839
|
+
output.printTable({
|
|
840
|
+
columns: [
|
|
841
|
+
{ key: 'file', header: 'File', width: 40 },
|
|
842
|
+
{ key: 'current', header: 'Current', width: 10, align: 'right' },
|
|
843
|
+
{ key: 'gap', header: 'Gap', width: 10, align: 'right' },
|
|
844
|
+
],
|
|
845
|
+
data: routeResult.gaps.slice(0, 5).map(function (g) { return ({
|
|
846
|
+
file: g.file.length > 38 ? '...' + g.file.slice(-35) : g.file,
|
|
847
|
+
current: g.currentCoverage.toFixed(1) + "%",
|
|
848
|
+
gap: g.gap.toFixed(1) + "%"
|
|
849
|
+
}); })
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return [2 /*return*/, { success: true, data: routeResult }];
|
|
854
|
+
case 8:
|
|
855
|
+
error_7 = _f.sent();
|
|
856
|
+
spinner.fail('Coverage analysis failed');
|
|
857
|
+
output.printError(error_7 instanceof Error ? error_7.message : String(error_7));
|
|
858
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
859
|
+
case 9: return [2 /*return*/];
|
|
717
860
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
catch (error) {
|
|
721
|
-
spinner.fail('Coverage analysis failed');
|
|
722
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
723
|
-
return { success: false, exitCode: 1 };
|
|
724
|
-
}
|
|
725
|
-
},
|
|
861
|
+
});
|
|
862
|
+
}); }
|
|
726
863
|
};
|
|
727
864
|
// ============================================================================
|
|
728
865
|
// Main Route Command
|
|
729
866
|
// ============================================================================
|
|
730
|
-
export
|
|
867
|
+
export var routeCommand = {
|
|
731
868
|
name: 'route',
|
|
732
869
|
description: 'Intelligent task-to-agent routing using Q-Learning',
|
|
733
870
|
subcommands: [
|
|
@@ -746,13 +883,13 @@ export const routeCommand = {
|
|
|
746
883
|
short: 'q',
|
|
747
884
|
description: 'Use Q-Learning for agent selection',
|
|
748
885
|
type: 'boolean',
|
|
749
|
-
default: true
|
|
886
|
+
"default": true
|
|
750
887
|
},
|
|
751
888
|
{
|
|
752
889
|
name: 'agent',
|
|
753
890
|
short: 'a',
|
|
754
891
|
description: 'Force specific agent',
|
|
755
|
-
type: 'string'
|
|
892
|
+
type: 'string'
|
|
756
893
|
},
|
|
757
894
|
],
|
|
758
895
|
examples: [
|
|
@@ -762,52 +899,60 @@ export const routeCommand = {
|
|
|
762
899
|
{ command: 'claude-flow route list-agents', description: 'List available agents' },
|
|
763
900
|
{ command: 'claude-flow route stats', description: 'Show routing statistics' },
|
|
764
901
|
],
|
|
765
|
-
action:
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
902
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
903
|
+
var result, ruvectorAvailable;
|
|
904
|
+
return __generator(this, function (_a) {
|
|
905
|
+
switch (_a.label) {
|
|
906
|
+
case 0:
|
|
907
|
+
if (!(ctx.args.length > 0 && routeTaskCommand.action)) return [3 /*break*/, 2];
|
|
908
|
+
return [4 /*yield*/, routeTaskCommand.action(ctx)];
|
|
909
|
+
case 1:
|
|
910
|
+
result = _a.sent();
|
|
911
|
+
if (result)
|
|
912
|
+
return [2 /*return*/, result];
|
|
913
|
+
return [2 /*return*/, { success: true }];
|
|
914
|
+
case 2:
|
|
915
|
+
// Show help
|
|
916
|
+
output.writeln();
|
|
917
|
+
output.writeln(output.bold('Q-Learning Agent Router'));
|
|
918
|
+
output.writeln(output.dim('Intelligent task-to-agent routing using reinforcement learning'));
|
|
919
|
+
output.writeln();
|
|
920
|
+
output.writeln('Usage: claude-flow route <task> [options]');
|
|
921
|
+
output.writeln(' claude-flow route <subcommand>');
|
|
922
|
+
output.writeln();
|
|
923
|
+
output.writeln(output.bold('Subcommands:'));
|
|
924
|
+
output.printList([
|
|
925
|
+
output.highlight('task') + " - Route a task to optimal agent",
|
|
926
|
+
output.highlight('list-agents') + " - List available agent types",
|
|
927
|
+
output.highlight('stats') + " - Show router statistics",
|
|
928
|
+
output.highlight('feedback') + " - Provide routing feedback",
|
|
929
|
+
output.highlight('reset') + " - Reset router state",
|
|
930
|
+
output.highlight('export') + " - Export Q-table",
|
|
931
|
+
output.highlight('import') + " - Import Q-table",
|
|
932
|
+
]);
|
|
933
|
+
output.writeln();
|
|
934
|
+
output.writeln(output.bold('How It Works:'));
|
|
935
|
+
output.printList([
|
|
936
|
+
'Analyzes task description using hash-based state encoding',
|
|
937
|
+
'Uses Q-Learning to learn from routing outcomes',
|
|
938
|
+
'Epsilon-greedy exploration for continuous improvement',
|
|
939
|
+
'Provides confidence scores and alternatives',
|
|
940
|
+
]);
|
|
941
|
+
output.writeln();
|
|
942
|
+
return [4 /*yield*/, isRuvectorAvailable()];
|
|
943
|
+
case 3:
|
|
944
|
+
ruvectorAvailable = _a.sent();
|
|
945
|
+
output.writeln(output.bold('Backend Status:'));
|
|
946
|
+
output.printList([
|
|
947
|
+
"RuVector: " + (ruvectorAvailable ? output.success('Available') : output.warning('Fallback mode')),
|
|
948
|
+
"Backend: " + (ruvectorAvailable ? 'ruvector-native' : 'JavaScript fallback'),
|
|
949
|
+
]);
|
|
950
|
+
output.writeln();
|
|
951
|
+
output.writeln(output.dim('Run "claude-flow route <subcommand> --help" for more info'));
|
|
952
|
+
return [2 /*return*/, { success: true }];
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
}); }
|
|
811
956
|
};
|
|
812
957
|
export default routeCommand;
|
|
813
958
|
//# sourceMappingURL=route.js.map
|