kynjal-cli 4.0.0 → 4.0.1
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/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
- package/dist/src/appliance/gguf-engine.js +286 -525
- package/dist/src/appliance/gguf-engine.js.map +1 -1
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +203 -403
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -1
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +154 -208
- package/dist/src/appliance/rvfa-builder.js.map +1 -1
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +260 -423
- package/dist/src/appliance/rvfa-distribution.js.map +1 -1
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-format.js +128 -200
- package/dist/src/appliance/rvfa-format.js.map +1 -1
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +168 -304
- package/dist/src/appliance/rvfa-runner.js.map +1 -1
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +173 -295
- package/dist/src/appliance/rvfa-signing.js.map +1 -1
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +331 -542
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.js +574 -697
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1218 -1548
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.js +158 -267
- package/dist/src/commands/appliance-advanced.js.map +1 -1
- package/dist/src/commands/appliance.js +318 -493
- package/dist/src/commands/appliance.js.map +1 -1
- package/dist/src/commands/benchmark.js +372 -523
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +274 -364
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.js +113 -157
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/completions.js +477 -118
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +237 -303
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.js +487 -596
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +194 -275
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.js +504 -686
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1293 -1543
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +449 -596
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +854 -938
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.js +3112 -3519
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +115 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +126 -308
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.js +788 -940
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +383 -558
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.js +493 -605
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.js +833 -1026
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +282 -347
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.js +1289 -1563
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +497 -643
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +668 -841
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +392 -447
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +162 -256
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +150 -220
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +520 -665
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +505 -651
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +349 -401
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +224 -266
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +37 -75
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +336 -359
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +335 -322
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +375 -431
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +703 -117
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +364 -419
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.js +485 -608
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.js +504 -626
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.js +267 -364
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.js +380 -486
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +408 -488
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.js +423 -538
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +322 -412
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +196 -291
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +386 -486
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +38 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts +77 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +309 -411
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +246 -507
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts +25 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +368 -78
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +1307 -996
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts +60 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +657 -12
- 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.js +33 -37
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.js +76 -77
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.js +801 -3
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +1 -1
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +76 -59
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +81 -125
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +161 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +470 -757
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +391 -492
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.js +332 -533
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +172 -236
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +80 -142
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +252 -375
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +473 -565
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +197 -272
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +500 -572
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +286 -364
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +582 -693
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +260 -311
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +573 -640
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2215 -2648
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +350 -505
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +315 -412
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +420 -480
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +204 -278
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.js +163 -279
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +297 -429
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +185 -234
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +207 -260
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +276 -325
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +270 -336
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +148 -196
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +186 -333
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/types.d.ts +31 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +133 -280
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +405 -450
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +190 -303
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +338 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +569 -794
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +407 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -0
- package/dist/src/memory/memory-bridge.js +1170 -1640
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +412 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +1836 -1851
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +199 -329
- 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 +242 -272
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts +51 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +140 -187
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +285 -521
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +271 -358
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +48 -105
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +69 -107
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +113 -160
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +172 -223
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +190 -228
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +62 -126
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +86 -156
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +139 -220
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +74 -93
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +75 -167
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +436 -560
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +197 -286
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/agent-wasm.js +156 -351
- package/dist/src/ruvector/agent-wasm.js.map +1 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +145 -232
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +287 -419
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +56 -101
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +324 -451
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +260 -336
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +223 -254
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +486 -680
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.d.ts +40 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +36 -106
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +155 -248
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +175 -248
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +228 -286
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +257 -338
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/ruvllm-wasm.js +270 -434
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +60 -67
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +119 -205
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
- package/dist/src/services/agentic-flow-bridge.js +32 -105
- package/dist/src/services/agentic-flow-bridge.js.map +1 -1
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +615 -940
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +398 -666
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +441 -467
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +4 -4
- 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.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +92 -200
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +257 -337
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts +228 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +591 -849
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +331 -548
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +45 -55
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +29 -37
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.js +128 -155
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +84 -142
- 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 +0 -2
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +187 -337
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +288 -434
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +55 -55
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +30 -31
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +165 -232
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +239 -349
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +243 -365
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +63 -130
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +184 -258
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +50 -72
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +64 -96
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +174 -231
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +95 -130
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +194 -239
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +26 -55
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +106 -183
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +135 -198
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +38 -85
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +19 -31
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +38 -64
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -6,70 +6,14 @@
|
|
|
6
6
|
* - TTL-based caching of coverage data
|
|
7
7
|
* - Singleton router instance
|
|
8
8
|
*/
|
|
9
|
-
var __assign = (this && this.__assign) || function () {
|
|
10
|
-
__assign = Object.assign || function(t) {
|
|
11
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12
|
-
s = arguments[i];
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
}
|
|
16
|
-
return t;
|
|
17
|
-
};
|
|
18
|
-
return __assign.apply(this, arguments);
|
|
19
|
-
};
|
|
20
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
30
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
31
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
32
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
33
|
-
function step(op) {
|
|
34
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
35
|
-
while (_) try {
|
|
36
|
-
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;
|
|
37
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
38
|
-
switch (op[0]) {
|
|
39
|
-
case 0: case 1: t = op; break;
|
|
40
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
41
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
42
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
43
|
-
default:
|
|
44
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
45
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
46
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
47
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
48
|
-
if (t[2]) _.ops.pop();
|
|
49
|
-
_.trys.pop(); continue;
|
|
50
|
-
}
|
|
51
|
-
op = body.call(thisArg, _);
|
|
52
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
53
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
57
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
58
|
-
if (ar || !(i in from)) {
|
|
59
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
60
|
-
ar[i] = from[i];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
64
|
-
};
|
|
65
9
|
// ============================================================================
|
|
66
10
|
// Caching for Performance
|
|
67
11
|
// ============================================================================
|
|
68
12
|
/**
|
|
69
13
|
* Cache for coverage data (1 minute TTL)
|
|
70
14
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
15
|
+
const coverageDataCache = new Map();
|
|
16
|
+
const COVERAGE_CACHE_TTL_MS = 60 * 1000; // 1 minute
|
|
73
17
|
/**
|
|
74
18
|
* Clear coverage cache
|
|
75
19
|
*/
|
|
@@ -82,89 +26,74 @@ export function clearCoverageCache() {
|
|
|
82
26
|
export function getCoverageCacheStats() {
|
|
83
27
|
return { size: coverageDataCache.size };
|
|
84
28
|
}
|
|
85
|
-
|
|
29
|
+
const DEFAULT_CONFIG = {
|
|
86
30
|
minCoverage: 70,
|
|
87
31
|
targetCoverage: 85,
|
|
88
32
|
incremental: true,
|
|
89
|
-
coverageTypes: ['line', 'branch', 'function', 'statement']
|
|
33
|
+
coverageTypes: ['line', 'branch', 'function', 'statement'],
|
|
90
34
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.config =
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
return [3 /*break*/, 3];
|
|
115
|
-
case 2:
|
|
116
|
-
_c = _d.sent();
|
|
117
|
-
this.useNative = false;
|
|
118
|
-
return [3 /*break*/, 3];
|
|
119
|
-
case 3: return [2 /*return*/];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
CoverageRouter.prototype.parseCoverage = function (data, format) {
|
|
125
|
-
if (format === void 0) { format = 'json'; }
|
|
35
|
+
export class CoverageRouter {
|
|
36
|
+
config;
|
|
37
|
+
ruvectorEngine = null;
|
|
38
|
+
useNative = false;
|
|
39
|
+
coverageHistory = [];
|
|
40
|
+
constructor(config = {}) {
|
|
41
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
42
|
+
}
|
|
43
|
+
async initialize() {
|
|
44
|
+
try {
|
|
45
|
+
// @ruvector/coverage is optional - gracefully fallback if not installed
|
|
46
|
+
const ruvector = await import('@ruvector/coverage').catch(() => null);
|
|
47
|
+
if (ruvector) {
|
|
48
|
+
this.ruvectorEngine = ruvector.createCoverageRouter?.(this.config);
|
|
49
|
+
this.useNative = !!this.ruvectorEngine;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
this.useNative = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
parseCoverage(data, format = 'json') {
|
|
126
57
|
switch (format) {
|
|
127
58
|
case 'lcov': return this.parseLcov(data);
|
|
128
59
|
case 'istanbul': return this.parseIstanbul(data);
|
|
129
60
|
case 'cobertura': return this.parseCobertura(data);
|
|
130
61
|
default: return this.parseJson(data);
|
|
131
62
|
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return { action
|
|
142
|
-
}
|
|
143
|
-
|
|
63
|
+
}
|
|
64
|
+
route(coverage, changedFiles) {
|
|
65
|
+
const gaps = this.calculateGaps(coverage);
|
|
66
|
+
const targetFiles = this.prioritizeFiles(coverage, changedFiles);
|
|
67
|
+
const action = this.determineAction(coverage, gaps);
|
|
68
|
+
const priority = this.calculatePriority(coverage, changedFiles);
|
|
69
|
+
const testTypes = this.recommendTestTypes(gaps);
|
|
70
|
+
const estimatedEffort = this.estimateEffort(gaps);
|
|
71
|
+
const impactScore = this.calculateImpact(coverage, targetFiles);
|
|
72
|
+
return { action, priority, targetFiles, testTypes, gaps, estimatedEffort, impactScore };
|
|
73
|
+
}
|
|
74
|
+
getTrend() {
|
|
144
75
|
if (this.coverageHistory.length < 2)
|
|
145
76
|
return { direction: 'stable', change: 0 };
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return { direction: change > 0.5 ? 'up' : change < -0.5 ? 'down' : 'stable', change
|
|
150
|
-
}
|
|
151
|
-
|
|
77
|
+
const recent = this.coverageHistory[this.coverageHistory.length - 1];
|
|
78
|
+
const previous = this.coverageHistory[this.coverageHistory.length - 2];
|
|
79
|
+
const change = recent.overall - previous.overall;
|
|
80
|
+
return { direction: change > 0.5 ? 'up' : change < -0.5 ? 'down' : 'stable', change };
|
|
81
|
+
}
|
|
82
|
+
addToHistory(report) {
|
|
152
83
|
this.coverageHistory.push(report);
|
|
153
84
|
if (this.coverageHistory.length > 10)
|
|
154
85
|
this.coverageHistory.shift();
|
|
155
|
-
}
|
|
156
|
-
|
|
86
|
+
}
|
|
87
|
+
getStats() {
|
|
157
88
|
return { useNative: this.useNative, historySize: this.coverageHistory.length, minCoverage: this.config.minCoverage, targetCoverage: this.config.targetCoverage };
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
|
|
165
|
-
var line = lines_1[_i];
|
|
89
|
+
}
|
|
90
|
+
parseLcov(data) {
|
|
91
|
+
const files = [];
|
|
92
|
+
let currentFile = null;
|
|
93
|
+
const lines = data.split('\n');
|
|
94
|
+
for (const line of lines) {
|
|
166
95
|
if (line.startsWith('SF:')) {
|
|
167
|
-
if (currentFile
|
|
96
|
+
if (currentFile?.path)
|
|
168
97
|
files.push(this.finalizeFileCoverage(currentFile));
|
|
169
98
|
currentFile = { path: line.substring(3), uncoveredLines: [], totalLines: 0, coveredLines: 0 };
|
|
170
99
|
}
|
|
@@ -177,95 +106,88 @@ var CoverageRouter = /** @class */ (function () {
|
|
|
177
106
|
currentFile.coveredLines = parseInt(line.substring(3), 10);
|
|
178
107
|
}
|
|
179
108
|
else if (line.startsWith('DA:')) {
|
|
180
|
-
|
|
109
|
+
const [lineNum, hits] = line.substring(3).split(',').map(Number);
|
|
181
110
|
if (currentFile && hits === 0)
|
|
182
|
-
|
|
111
|
+
currentFile.uncoveredLines?.push(lineNum);
|
|
183
112
|
}
|
|
184
113
|
else if (line === 'end_of_record') {
|
|
185
|
-
if (currentFile
|
|
114
|
+
if (currentFile?.path)
|
|
186
115
|
files.push(this.finalizeFileCoverage(currentFile));
|
|
187
116
|
currentFile = null;
|
|
188
117
|
}
|
|
189
118
|
}
|
|
190
119
|
return this.buildReport(files);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
for (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
var branchTotal = Object.values(branches).flat().length;
|
|
120
|
+
}
|
|
121
|
+
parseIstanbul(data) {
|
|
122
|
+
const files = [];
|
|
123
|
+
for (const [path, coverage] of Object.entries(data)) {
|
|
124
|
+
const cov = coverage;
|
|
125
|
+
const statements = cov.s;
|
|
126
|
+
const functions = cov.f;
|
|
127
|
+
const branches = cov.b;
|
|
128
|
+
const statementCovered = Object.values(statements).filter(v => v > 0).length;
|
|
129
|
+
const statementTotal = Object.values(statements).length;
|
|
130
|
+
const functionCovered = Object.values(functions).filter(v => v > 0).length;
|
|
131
|
+
const functionTotal = Object.values(functions).length;
|
|
132
|
+
const branchCovered = Object.values(branches).flat().filter(v => v > 0).length;
|
|
133
|
+
const branchTotal = Object.values(branches).flat().length;
|
|
206
134
|
files.push({
|
|
207
|
-
path:
|
|
208
|
-
lineCoverage: statementTotal > 0 ? (statementCovered / statementTotal) * 100 : 100,
|
|
135
|
+
path, lineCoverage: statementTotal > 0 ? (statementCovered / statementTotal) * 100 : 100,
|
|
209
136
|
branchCoverage: branchTotal > 0 ? (branchCovered / branchTotal) * 100 : 100,
|
|
210
137
|
functionCoverage: functionTotal > 0 ? (functionCovered / functionTotal) * 100 : 100,
|
|
211
138
|
statementCoverage: statementTotal > 0 ? (statementCovered / statementTotal) * 100 : 100,
|
|
212
|
-
uncoveredLines: [], totalLines: statementTotal, coveredLines: statementCovered
|
|
139
|
+
uncoveredLines: [], totalLines: statementTotal, coveredLines: statementCovered,
|
|
213
140
|
});
|
|
214
141
|
}
|
|
215
142
|
return this.buildReport(files);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
for (
|
|
221
|
-
var match = classMatches_1[_i];
|
|
143
|
+
}
|
|
144
|
+
parseCobertura(data) {
|
|
145
|
+
const files = [];
|
|
146
|
+
const classMatches = data.matchAll(/<class[^>]*filename="([^"]+)"[^>]*line-rate="([^"]+)"[^>]*branch-rate="([^"]+)"[^>]*>/g);
|
|
147
|
+
for (const match of classMatches) {
|
|
222
148
|
files.push({
|
|
223
149
|
path: match[1], lineCoverage: parseFloat(match[2]) * 100, branchCoverage: parseFloat(match[3]) * 100,
|
|
224
150
|
functionCoverage: parseFloat(match[2]) * 100, statementCoverage: parseFloat(match[2]) * 100,
|
|
225
|
-
uncoveredLines: [], totalLines: 0, coveredLines: 0
|
|
151
|
+
uncoveredLines: [], totalLines: 0, coveredLines: 0,
|
|
226
152
|
});
|
|
227
153
|
}
|
|
228
154
|
return this.buildReport(files);
|
|
229
|
-
}
|
|
230
|
-
|
|
155
|
+
}
|
|
156
|
+
parseJson(data) {
|
|
231
157
|
if (Array.isArray(data))
|
|
232
158
|
return this.buildReport(data);
|
|
233
|
-
|
|
234
|
-
for (
|
|
235
|
-
|
|
236
|
-
var cov = coverage;
|
|
159
|
+
const files = [];
|
|
160
|
+
for (const [path, coverage] of Object.entries(data)) {
|
|
161
|
+
const cov = coverage;
|
|
237
162
|
files.push({
|
|
238
|
-
path:
|
|
239
|
-
lineCoverage: cov.lineCoverage || 0, branchCoverage: cov.branchCoverage || 0,
|
|
163
|
+
path, lineCoverage: cov.lineCoverage || 0, branchCoverage: cov.branchCoverage || 0,
|
|
240
164
|
functionCoverage: cov.functionCoverage || 0, statementCoverage: cov.statementCoverage || 0,
|
|
241
|
-
uncoveredLines: cov.uncoveredLines || [], totalLines: cov.totalLines || 0, coveredLines: cov.coveredLines || 0
|
|
165
|
+
uncoveredLines: cov.uncoveredLines || [], totalLines: cov.totalLines || 0, coveredLines: cov.coveredLines || 0,
|
|
242
166
|
});
|
|
243
167
|
}
|
|
244
168
|
return this.buildReport(files);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return { path: partial.path || 'unknown', lineCoverage
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
return { overall
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
for (
|
|
265
|
-
var file = files_1[_i];
|
|
169
|
+
}
|
|
170
|
+
finalizeFileCoverage(partial) {
|
|
171
|
+
const lineCoverage = partial.totalLines && partial.totalLines > 0 ? (partial.coveredLines || 0) / partial.totalLines * 100 : 100;
|
|
172
|
+
return { path: partial.path || 'unknown', lineCoverage, branchCoverage: lineCoverage, functionCoverage: lineCoverage, statementCoverage: lineCoverage, uncoveredLines: partial.uncoveredLines || [], totalLines: partial.totalLines || 0, coveredLines: partial.coveredLines || 0 };
|
|
173
|
+
}
|
|
174
|
+
buildReport(files) {
|
|
175
|
+
const totalLines = files.reduce((sum, f) => sum + f.totalLines, 0);
|
|
176
|
+
const coveredLines = files.reduce((sum, f) => sum + f.coveredLines, 0);
|
|
177
|
+
const overall = totalLines > 0 ? (coveredLines / totalLines) * 100 : 100;
|
|
178
|
+
const avgLine = files.length > 0 ? files.reduce((sum, f) => sum + f.lineCoverage, 0) / files.length : 100;
|
|
179
|
+
const avgBranch = files.length > 0 ? files.reduce((sum, f) => sum + f.branchCoverage, 0) / files.length : 100;
|
|
180
|
+
const avgFunction = files.length > 0 ? files.reduce((sum, f) => sum + f.functionCoverage, 0) / files.length : 100;
|
|
181
|
+
const avgStatement = files.length > 0 ? files.reduce((sum, f) => sum + f.statementCoverage, 0) / files.length : 100;
|
|
182
|
+
const sortedByLine = [...files].sort((a, b) => a.lineCoverage - b.lineCoverage);
|
|
183
|
+
return { overall, byType: { line: avgLine, branch: avgBranch, function: avgFunction, statement: avgStatement }, byFile: files, lowestCoverage: sortedByLine.slice(0, 5), highestCoverage: sortedByLine.slice(-5).reverse(), uncoveredCritical: this.findCriticalUncovered(files), timestamp: Date.now() };
|
|
184
|
+
}
|
|
185
|
+
findCriticalUncovered(files) {
|
|
186
|
+
const critical = [];
|
|
187
|
+
const criticalPatterns = [/auth/, /security/, /payment/, /core/, /main/, /index/];
|
|
188
|
+
for (const file of files) {
|
|
266
189
|
if (file.lineCoverage < this.config.minCoverage) {
|
|
267
|
-
for (
|
|
268
|
-
var pattern = criticalPatterns_1[_a];
|
|
190
|
+
for (const pattern of criticalPatterns) {
|
|
269
191
|
if (pattern.test(file.path)) {
|
|
270
192
|
critical.push(file.path);
|
|
271
193
|
break;
|
|
@@ -274,20 +196,19 @@ var CoverageRouter = /** @class */ (function () {
|
|
|
274
196
|
}
|
|
275
197
|
}
|
|
276
198
|
return critical.slice(0, 10);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
for (
|
|
281
|
-
var file = _a[_i];
|
|
199
|
+
}
|
|
200
|
+
calculateGaps(coverage) {
|
|
201
|
+
const gaps = [];
|
|
202
|
+
for (const file of coverage.byFile) {
|
|
282
203
|
if (file.lineCoverage < this.config.targetCoverage) {
|
|
283
|
-
|
|
284
|
-
gaps.push({ file: file.path, currentCoverage: file.lineCoverage, targetCoverage: this.config.targetCoverage, gap
|
|
204
|
+
const gap = this.config.targetCoverage - file.lineCoverage;
|
|
205
|
+
gaps.push({ file: file.path, currentCoverage: file.lineCoverage, targetCoverage: this.config.targetCoverage, gap, suggestedTests: this.suggestTests(file) });
|
|
285
206
|
}
|
|
286
207
|
}
|
|
287
|
-
return gaps.sort(
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
208
|
+
return gaps.sort((a, b) => b.gap - a.gap).slice(0, 10);
|
|
209
|
+
}
|
|
210
|
+
suggestTests(file) {
|
|
211
|
+
const suggestions = [];
|
|
291
212
|
if (file.uncoveredLines.length > 10)
|
|
292
213
|
suggestions.push('Add unit tests for uncovered code paths');
|
|
293
214
|
if (file.branchCoverage < 50)
|
|
@@ -297,17 +218,16 @@ var CoverageRouter = /** @class */ (function () {
|
|
|
297
218
|
if (/api|endpoint|route|handler/.test(file.path))
|
|
298
219
|
suggestions.push('Add integration tests for API endpoints');
|
|
299
220
|
return suggestions.slice(0, 3);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
var targetFiles = coverage.lowestCoverage.map(function (f) { return f.path; });
|
|
221
|
+
}
|
|
222
|
+
prioritizeFiles(coverage, changedFiles) {
|
|
223
|
+
let targetFiles = coverage.lowestCoverage.map(f => f.path);
|
|
304
224
|
if (changedFiles && changedFiles.length > 0) {
|
|
305
|
-
|
|
306
|
-
targetFiles =
|
|
225
|
+
const changedWithLowCoverage = coverage.byFile.filter(f => changedFiles.some(cf => f.path.includes(cf))).filter(f => f.lineCoverage < this.config.targetCoverage).map(f => f.path);
|
|
226
|
+
targetFiles = [...new Set([...changedWithLowCoverage, ...targetFiles])];
|
|
307
227
|
}
|
|
308
228
|
return targetFiles.slice(0, 10);
|
|
309
|
-
}
|
|
310
|
-
|
|
229
|
+
}
|
|
230
|
+
determineAction(coverage, gaps) {
|
|
311
231
|
if (coverage.overall < this.config.minCoverage)
|
|
312
232
|
return 'prioritize';
|
|
313
233
|
if (gaps.length > 5)
|
|
@@ -315,10 +235,9 @@ var CoverageRouter = /** @class */ (function () {
|
|
|
315
235
|
if (coverage.overall < this.config.targetCoverage)
|
|
316
236
|
return 'review-coverage';
|
|
317
237
|
return 'skip';
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
var priority = 5;
|
|
238
|
+
}
|
|
239
|
+
calculatePriority(coverage, changedFiles) {
|
|
240
|
+
let priority = 5;
|
|
322
241
|
if (coverage.overall < 50)
|
|
323
242
|
priority += 4;
|
|
324
243
|
else if (coverage.overall < 70)
|
|
@@ -327,182 +246,144 @@ var CoverageRouter = /** @class */ (function () {
|
|
|
327
246
|
priority += 1;
|
|
328
247
|
priority += Math.min(3, coverage.uncoveredCritical.length);
|
|
329
248
|
if (changedFiles && changedFiles.length > 0) {
|
|
330
|
-
|
|
249
|
+
const changedLowCoverage = coverage.byFile.filter(f => changedFiles.some(cf => f.path.includes(cf))).filter(f => f.lineCoverage < this.config.minCoverage);
|
|
331
250
|
priority += Math.min(2, changedLowCoverage.length);
|
|
332
251
|
}
|
|
333
252
|
return Math.min(10, priority);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
for (
|
|
338
|
-
var gap = gaps_1[_i];
|
|
253
|
+
}
|
|
254
|
+
recommendTestTypes(gaps) {
|
|
255
|
+
const types = new Set(['unit']);
|
|
256
|
+
for (const gap of gaps) {
|
|
339
257
|
if (/api|endpoint|route|handler|service/.test(gap.file))
|
|
340
258
|
types.add('integration');
|
|
341
259
|
if (/page|component|view|ui/.test(gap.file))
|
|
342
260
|
types.add('e2e');
|
|
343
261
|
}
|
|
344
262
|
return Array.from(types);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
for (
|
|
349
|
-
var gap = gaps_2[_i];
|
|
263
|
+
}
|
|
264
|
+
estimateEffort(gaps) {
|
|
265
|
+
let effort = 0;
|
|
266
|
+
for (const gap of gaps)
|
|
350
267
|
effort += (gap.gap / 10) * 0.5;
|
|
351
|
-
}
|
|
352
268
|
return Math.round(effort * 10) / 10;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return fileCov ? sum + (_this.config.targetCoverage - fileCov.lineCoverage) : sum;
|
|
269
|
+
}
|
|
270
|
+
calculateImpact(coverage, targetFiles) {
|
|
271
|
+
const potentialGain = targetFiles.reduce((sum, file) => {
|
|
272
|
+
const fileCov = coverage.byFile.find(f => f.path === file);
|
|
273
|
+
return fileCov ? sum + (this.config.targetCoverage - fileCov.lineCoverage) : sum;
|
|
359
274
|
}, 0);
|
|
360
275
|
return Math.min(100, Math.round(potentialGain / targetFiles.length || 0));
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
}());
|
|
364
|
-
export { CoverageRouter };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
365
278
|
export function createCoverageRouter(config) {
|
|
366
279
|
return new CoverageRouter(config);
|
|
367
280
|
}
|
|
368
281
|
/**
|
|
369
282
|
* Route a task based on coverage analysis
|
|
370
283
|
*/
|
|
371
|
-
export function coverageRoute(task, options) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
var router, coverage;
|
|
375
|
-
return __generator(this, function (_a) {
|
|
376
|
-
switch (_a.label) {
|
|
377
|
-
case 0:
|
|
378
|
-
router = new CoverageRouter({
|
|
379
|
-
targetCoverage: options.threshold || 80
|
|
380
|
-
});
|
|
381
|
-
return [4 /*yield*/, loadProjectCoverage(options.projectRoot)];
|
|
382
|
-
case 1:
|
|
383
|
-
coverage = _a.sent();
|
|
384
|
-
if (!coverage) {
|
|
385
|
-
return [2 /*return*/, {
|
|
386
|
-
action: 'skip',
|
|
387
|
-
priority: 1,
|
|
388
|
-
targetFiles: [],
|
|
389
|
-
testTypes: ['unit'],
|
|
390
|
-
gaps: [],
|
|
391
|
-
estimatedEffort: 0,
|
|
392
|
-
impactScore: 0
|
|
393
|
-
}];
|
|
394
|
-
}
|
|
395
|
-
return [2 /*return*/, router.route(coverage)];
|
|
396
|
-
}
|
|
397
|
-
});
|
|
284
|
+
export async function coverageRoute(task, options = {}) {
|
|
285
|
+
const router = new CoverageRouter({
|
|
286
|
+
targetCoverage: options.threshold || 80,
|
|
398
287
|
});
|
|
288
|
+
// Try to load coverage data
|
|
289
|
+
const coverage = await loadProjectCoverage(options.projectRoot);
|
|
290
|
+
if (!coverage) {
|
|
291
|
+
return {
|
|
292
|
+
action: 'skip',
|
|
293
|
+
priority: 1,
|
|
294
|
+
targetFiles: [],
|
|
295
|
+
testTypes: ['unit'],
|
|
296
|
+
gaps: [],
|
|
297
|
+
estimatedEffort: 0,
|
|
298
|
+
impactScore: 0,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
return router.route(coverage);
|
|
399
302
|
}
|
|
400
303
|
/**
|
|
401
304
|
* Suggest coverage improvements for a path
|
|
402
305
|
*/
|
|
403
|
-
export function coverageSuggest(path, options) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
suggestedTests: suggestTestsForFile(f)
|
|
433
|
-
}); })
|
|
434
|
-
.sort(function (a, b) { return b.priority - a.priority; })
|
|
435
|
-
.slice(0, limit);
|
|
436
|
-
totalGap = suggestions.reduce(function (sum, s) { return sum + s.gap; }, 0);
|
|
437
|
-
estimatedEffort = totalGap * 0.1;
|
|
438
|
-
return [2 /*return*/, { path: path, suggestions: suggestions, totalGap: totalGap, estimatedEffort: estimatedEffort }];
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
});
|
|
306
|
+
export async function coverageSuggest(path, options = {}) {
|
|
307
|
+
const limit = options.limit || 20;
|
|
308
|
+
const threshold = options.threshold || 80;
|
|
309
|
+
const coverage = await loadProjectCoverage(options.projectRoot);
|
|
310
|
+
if (!coverage) {
|
|
311
|
+
return {
|
|
312
|
+
path,
|
|
313
|
+
suggestions: [],
|
|
314
|
+
totalGap: 0,
|
|
315
|
+
estimatedEffort: 0,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
// Filter files matching the path
|
|
319
|
+
const matchingFiles = coverage.byFile.filter(f => f.path.includes(path));
|
|
320
|
+
const belowThreshold = matchingFiles.filter(f => f.lineCoverage < threshold);
|
|
321
|
+
const suggestions = belowThreshold
|
|
322
|
+
.map(f => ({
|
|
323
|
+
file: f.path,
|
|
324
|
+
currentCoverage: f.lineCoverage,
|
|
325
|
+
targetCoverage: threshold,
|
|
326
|
+
gap: threshold - f.lineCoverage,
|
|
327
|
+
priority: calculateFilePriority(f.path, f.lineCoverage, threshold),
|
|
328
|
+
suggestedTests: suggestTestsForFile(f),
|
|
329
|
+
}))
|
|
330
|
+
.sort((a, b) => b.priority - a.priority)
|
|
331
|
+
.slice(0, limit);
|
|
332
|
+
const totalGap = suggestions.reduce((sum, s) => sum + s.gap, 0);
|
|
333
|
+
const estimatedEffort = totalGap * 0.1; // Rough estimate: 0.1 hours per % gap
|
|
334
|
+
return { path, suggestions, totalGap, estimatedEffort };
|
|
442
335
|
}
|
|
443
336
|
/**
|
|
444
337
|
* List all coverage gaps with agent assignments
|
|
445
338
|
*/
|
|
446
|
-
export function coverageGaps(options) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
priority: calculateFilePriority(f.path, f.lineCoverage, threshold),
|
|
473
|
-
suggestedAgent: suggestAgentForFile(f.path)
|
|
474
|
-
}); });
|
|
475
|
-
byAgent = {};
|
|
476
|
-
if (groupByAgent) {
|
|
477
|
-
for (_i = 0, gaps_3 = gaps; _i < gaps_3.length; _i++) {
|
|
478
|
-
gap = gaps_3[_i];
|
|
479
|
-
if (!byAgent[gap.suggestedAgent]) {
|
|
480
|
-
byAgent[gap.suggestedAgent] = [];
|
|
481
|
-
}
|
|
482
|
-
byAgent[gap.suggestedAgent].push(gap.file);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return [2 /*return*/, {
|
|
486
|
-
totalGaps: gaps.length,
|
|
487
|
-
gaps: gaps,
|
|
488
|
-
byAgent: byAgent,
|
|
489
|
-
summary: gaps.length + " files below " + threshold + "% coverage threshold"
|
|
490
|
-
}];
|
|
339
|
+
export async function coverageGaps(options = {}) {
|
|
340
|
+
const threshold = options.threshold || 80;
|
|
341
|
+
const groupByAgent = options.groupByAgent !== false;
|
|
342
|
+
const coverage = await loadProjectCoverage(options.projectRoot);
|
|
343
|
+
if (!coverage) {
|
|
344
|
+
return {
|
|
345
|
+
totalGaps: 0,
|
|
346
|
+
gaps: [],
|
|
347
|
+
byAgent: {},
|
|
348
|
+
summary: 'No coverage data found',
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const belowThreshold = coverage.byFile.filter(f => f.lineCoverage < threshold);
|
|
352
|
+
const gaps = belowThreshold.map(f => ({
|
|
353
|
+
file: f.path,
|
|
354
|
+
currentCoverage: f.lineCoverage,
|
|
355
|
+
targetCoverage: threshold,
|
|
356
|
+
gap: threshold - f.lineCoverage,
|
|
357
|
+
priority: calculateFilePriority(f.path, f.lineCoverage, threshold),
|
|
358
|
+
suggestedAgent: suggestAgentForFile(f.path),
|
|
359
|
+
}));
|
|
360
|
+
const byAgent = {};
|
|
361
|
+
if (groupByAgent) {
|
|
362
|
+
for (const gap of gaps) {
|
|
363
|
+
if (!byAgent[gap.suggestedAgent]) {
|
|
364
|
+
byAgent[gap.suggestedAgent] = [];
|
|
491
365
|
}
|
|
492
|
-
|
|
493
|
-
|
|
366
|
+
byAgent[gap.suggestedAgent].push(gap.file);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
totalGaps: gaps.length,
|
|
371
|
+
gaps,
|
|
372
|
+
byAgent,
|
|
373
|
+
summary: `${gaps.length} files below ${threshold}% coverage threshold`,
|
|
374
|
+
};
|
|
494
375
|
}
|
|
495
376
|
/**
|
|
496
377
|
* Validate and normalize path to prevent directory traversal
|
|
497
378
|
* Returns null if path is invalid or attempts traversal
|
|
498
379
|
*/
|
|
499
380
|
function validateProjectPath(inputPath) {
|
|
500
|
-
|
|
381
|
+
const { resolve, normalize, isAbsolute } = require('path');
|
|
501
382
|
// Default to cwd if not provided
|
|
502
|
-
|
|
383
|
+
const basePath = inputPath || process.cwd();
|
|
503
384
|
// Normalize and resolve the path
|
|
504
|
-
|
|
505
|
-
|
|
385
|
+
const normalizedPath = normalize(basePath);
|
|
386
|
+
const resolvedPath = isAbsolute(normalizedPath) ? normalizedPath : resolve(process.cwd(), normalizedPath);
|
|
506
387
|
// Check for path traversal attempts
|
|
507
388
|
if (normalizedPath.includes('..') && !resolvedPath.startsWith(process.cwd())) {
|
|
508
389
|
// Only allow .. if it resolves within or above cwd
|
|
@@ -522,82 +403,69 @@ function validateProjectPath(inputPath) {
|
|
|
522
403
|
/**
|
|
523
404
|
* Load project coverage data (async with caching)
|
|
524
405
|
*/
|
|
525
|
-
function loadProjectCoverage(projectRoot, skipCache) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
report
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
else if (coveragePath.endsWith('.info')) {
|
|
575
|
-
report = router.parseCoverage(content, 'lcov');
|
|
576
|
-
}
|
|
577
|
-
// Cache the result
|
|
578
|
-
if (report) {
|
|
579
|
-
coverageDataCache.set(root, { report: report, timestamp: Date.now() });
|
|
580
|
-
return [2 /*return*/, report];
|
|
581
|
-
}
|
|
582
|
-
return [3 /*break*/, 5];
|
|
583
|
-
case 4:
|
|
584
|
-
_b = _c.sent();
|
|
585
|
-
return [3 /*break*/, 5];
|
|
586
|
-
case 5:
|
|
587
|
-
_i++;
|
|
588
|
-
return [3 /*break*/, 1];
|
|
589
|
-
case 6: return [2 /*return*/, null];
|
|
406
|
+
async function loadProjectCoverage(projectRoot, skipCache) {
|
|
407
|
+
// Validate and normalize the project root path
|
|
408
|
+
const root = validateProjectPath(projectRoot);
|
|
409
|
+
if (!root) {
|
|
410
|
+
// Invalid path detected, return null safely
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
// Check cache first
|
|
414
|
+
if (!skipCache) {
|
|
415
|
+
const cached = coverageDataCache.get(root);
|
|
416
|
+
if (cached && Date.now() - cached.timestamp < COVERAGE_CACHE_TTL_MS) {
|
|
417
|
+
return cached.report;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const { existsSync } = require('fs');
|
|
421
|
+
const { readFile } = require('fs/promises');
|
|
422
|
+
const { join, normalize } = require('path');
|
|
423
|
+
// Try common coverage locations (all relative to validated root)
|
|
424
|
+
const coverageLocations = [
|
|
425
|
+
['coverage', 'coverage-final.json'],
|
|
426
|
+
['coverage', 'lcov.info'],
|
|
427
|
+
['.nyc_output', 'coverage.json'],
|
|
428
|
+
['coverage.json'],
|
|
429
|
+
];
|
|
430
|
+
for (const pathParts of coverageLocations) {
|
|
431
|
+
// Join and normalize to prevent traversal in coverage paths
|
|
432
|
+
const coveragePath = normalize(join(root, ...pathParts));
|
|
433
|
+
// Ensure the coverage path is still within or under root
|
|
434
|
+
if (!coveragePath.startsWith(root)) {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
if (existsSync(coveragePath)) {
|
|
438
|
+
try {
|
|
439
|
+
// Use async file read for non-blocking I/O
|
|
440
|
+
const content = await readFile(coveragePath, 'utf-8');
|
|
441
|
+
const router = new CoverageRouter();
|
|
442
|
+
let report = null;
|
|
443
|
+
if (coveragePath.endsWith('.json')) {
|
|
444
|
+
report = router.parseCoverage(JSON.parse(content), 'istanbul');
|
|
445
|
+
}
|
|
446
|
+
else if (coveragePath.endsWith('.info')) {
|
|
447
|
+
report = router.parseCoverage(content, 'lcov');
|
|
448
|
+
}
|
|
449
|
+
// Cache the result
|
|
450
|
+
if (report) {
|
|
451
|
+
coverageDataCache.set(root, { report, timestamp: Date.now() });
|
|
452
|
+
return report;
|
|
453
|
+
}
|
|
590
454
|
}
|
|
591
|
-
|
|
592
|
-
|
|
455
|
+
catch {
|
|
456
|
+
// Continue to next path
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
593
461
|
}
|
|
594
462
|
/**
|
|
595
463
|
* Calculate priority for a file based on path and coverage
|
|
596
464
|
*/
|
|
597
465
|
function calculateFilePriority(path, coverage, threshold) {
|
|
598
|
-
|
|
466
|
+
let priority = 5;
|
|
599
467
|
// Gap-based priority
|
|
600
|
-
|
|
468
|
+
const gap = threshold - coverage;
|
|
601
469
|
if (gap > 50)
|
|
602
470
|
priority += 3;
|
|
603
471
|
else if (gap > 30)
|
|
@@ -605,7 +473,7 @@ function calculateFilePriority(path, coverage, threshold) {
|
|
|
605
473
|
else if (gap > 15)
|
|
606
474
|
priority += 1;
|
|
607
475
|
// Path-based priority
|
|
608
|
-
|
|
476
|
+
const lowerPath = path.toLowerCase();
|
|
609
477
|
if (/core|main|index/.test(lowerPath))
|
|
610
478
|
priority += 2;
|
|
611
479
|
if (/auth|security|payment/.test(lowerPath))
|
|
@@ -622,7 +490,7 @@ function calculateFilePriority(path, coverage, threshold) {
|
|
|
622
490
|
* Suggest tests for a file based on its coverage
|
|
623
491
|
*/
|
|
624
492
|
function suggestTestsForFile(file) {
|
|
625
|
-
|
|
493
|
+
const suggestions = [];
|
|
626
494
|
if (file.uncoveredLines.length > 10) {
|
|
627
495
|
suggestions.push('Add unit tests for uncovered code paths');
|
|
628
496
|
}
|
|
@@ -632,7 +500,7 @@ function suggestTestsForFile(file) {
|
|
|
632
500
|
if (file.functionCoverage < 80) {
|
|
633
501
|
suggestions.push('Add tests for untested functions');
|
|
634
502
|
}
|
|
635
|
-
|
|
503
|
+
const lowerPath = file.path.toLowerCase();
|
|
636
504
|
if (/api|endpoint|route|handler/.test(lowerPath)) {
|
|
637
505
|
suggestions.push('Add integration tests for API endpoints');
|
|
638
506
|
}
|
|
@@ -645,7 +513,7 @@ function suggestTestsForFile(file) {
|
|
|
645
513
|
* Suggest an agent type for a file
|
|
646
514
|
*/
|
|
647
515
|
function suggestAgentForFile(path) {
|
|
648
|
-
|
|
516
|
+
const lowerPath = path.toLowerCase();
|
|
649
517
|
if (/api|endpoint|route|controller/.test(lowerPath))
|
|
650
518
|
return 'api-tester';
|
|
651
519
|
if (/component|view|ui|page/.test(lowerPath))
|