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
|
@@ -4,235 +4,302 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Created with ❤️ by ruv.io
|
|
6
6
|
*/
|
|
7
|
+
var __assign = (this && this.__assign) || function () {
|
|
8
|
+
__assign = Object.assign || function(t) {
|
|
9
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10
|
+
s = arguments[i];
|
|
11
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12
|
+
t[p] = s[p];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
18
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
19
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
20
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
21
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
22
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
23
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
24
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
28
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
29
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
30
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
31
|
+
function step(op) {
|
|
32
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
33
|
+
while (_) try {
|
|
34
|
+
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;
|
|
35
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
36
|
+
switch (op[0]) {
|
|
37
|
+
case 0: case 1: t = op; break;
|
|
38
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
39
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
40
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
41
|
+
default:
|
|
42
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
43
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
44
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
45
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
46
|
+
if (t[2]) _.ops.pop();
|
|
47
|
+
_.trys.pop(); continue;
|
|
48
|
+
}
|
|
49
|
+
op = body.call(thisArg, _);
|
|
50
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
51
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
7
54
|
import { output } from '../output.js';
|
|
8
55
|
// Scan subcommand
|
|
9
|
-
|
|
56
|
+
var scanCommand = {
|
|
10
57
|
name: 'scan',
|
|
11
58
|
description: 'Run security scan on target (code, dependencies, containers)',
|
|
12
59
|
options: [
|
|
13
|
-
{ name: 'target', short: 't', type: 'string', description: 'Target path or URL to scan', default: '.' },
|
|
14
|
-
{ name: 'depth', short: 'd', type: 'string', description: 'Scan depth: quick, standard, deep', default: 'standard' },
|
|
15
|
-
{ name: 'type', type: 'string', description: 'Scan type: code, deps, container, all', default: 'all' },
|
|
16
|
-
{ name: 'output', short: 'o', type: 'string', description: 'Output format: text, json, sarif', default: 'text' },
|
|
60
|
+
{ name: 'target', short: 't', type: 'string', description: 'Target path or URL to scan', "default": '.' },
|
|
61
|
+
{ name: 'depth', short: 'd', type: 'string', description: 'Scan depth: quick, standard, deep', "default": 'standard' },
|
|
62
|
+
{ name: 'type', type: 'string', description: 'Scan type: code, deps, container, all', "default": 'all' },
|
|
63
|
+
{ name: 'output', short: 'o', type: 'string', description: 'Output format: text, json, sarif', "default": 'text' },
|
|
17
64
|
{ name: 'fix', short: 'f', type: 'boolean', description: 'Auto-fix vulnerabilities where possible' },
|
|
18
65
|
],
|
|
19
66
|
examples: [
|
|
20
67
|
{ command: 'claude-flow security scan -t ./src', description: 'Scan source directory' },
|
|
21
68
|
{ command: 'claude-flow security scan --depth deep --fix', description: 'Deep scan with auto-fix' },
|
|
22
69
|
],
|
|
23
|
-
action:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
71
|
+
var target, depth, scanType, fix, spinner, findings, criticalCount, highCount, mediumCount, lowCount, fs_1, path_1, execSync, packageJsonPath, auditResult, audit, _i, _a, _b, pkg, vuln, sev, title, secretPatterns_1, scanDir_1, scanDepth, codePatterns_1, scanCodeDir_1, scanDepth, fixSpinner, error_1;
|
|
72
|
+
var _c;
|
|
73
|
+
return __generator(this, function (_d) {
|
|
74
|
+
switch (_d.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
target = ctx.flags.target || '.';
|
|
77
|
+
depth = ctx.flags.depth || 'standard';
|
|
78
|
+
scanType = ctx.flags.type || 'all';
|
|
79
|
+
fix = ctx.flags.fix;
|
|
80
|
+
output.writeln();
|
|
81
|
+
output.writeln(output.bold('Security Scan'));
|
|
82
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
83
|
+
spinner = output.createSpinner({ text: "Scanning " + target + "...", spinner: 'dots' });
|
|
84
|
+
spinner.start();
|
|
85
|
+
findings = [];
|
|
86
|
+
criticalCount = 0, highCount = 0, mediumCount = 0, lowCount = 0;
|
|
87
|
+
_d.label = 1;
|
|
88
|
+
case 1:
|
|
89
|
+
_d.trys.push([1, 5, , 6]);
|
|
90
|
+
return [4 /*yield*/, import('fs')];
|
|
91
|
+
case 2:
|
|
92
|
+
fs_1 = _d.sent();
|
|
93
|
+
return [4 /*yield*/, import('path')];
|
|
94
|
+
case 3:
|
|
95
|
+
path_1 = _d.sent();
|
|
96
|
+
return [4 /*yield*/, import('child_process')];
|
|
97
|
+
case 4:
|
|
98
|
+
execSync = (_d.sent()).execSync;
|
|
99
|
+
// Phase 1: npm audit for dependency vulnerabilities
|
|
100
|
+
if (scanType === 'all' || scanType === 'deps') {
|
|
101
|
+
spinner.setText('Checking dependencies with npm audit...');
|
|
50
102
|
try {
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
103
|
+
packageJsonPath = path_1.resolve(target, 'package.json');
|
|
104
|
+
if (fs_1.existsSync(packageJsonPath)) {
|
|
105
|
+
auditResult = execSync('npm audit --json 2>/dev/null || true', {
|
|
106
|
+
cwd: path_1.resolve(target),
|
|
107
|
+
encoding: 'utf-8',
|
|
108
|
+
maxBuffer: 10 * 1024 * 1024
|
|
109
|
+
});
|
|
110
|
+
try {
|
|
111
|
+
audit = JSON.parse(auditResult);
|
|
112
|
+
if (audit.vulnerabilities) {
|
|
113
|
+
for (_i = 0, _a = Object.entries(audit.vulnerabilities); _i < _a.length; _i++) {
|
|
114
|
+
_b = _a[_i], pkg = _b[0], vuln = _b[1];
|
|
115
|
+
sev = vuln.severity || 'low';
|
|
116
|
+
title = Array.isArray(vuln.via) && ((_c = vuln.via[0]) === null || _c === void 0 ? void 0 : _c.title) ? vuln.via[0].title : 'Vulnerability';
|
|
117
|
+
if (sev === 'critical')
|
|
118
|
+
criticalCount++;
|
|
119
|
+
else if (sev === 'high')
|
|
120
|
+
highCount++;
|
|
121
|
+
else if (sev === 'moderate' || sev === 'medium')
|
|
122
|
+
mediumCount++;
|
|
123
|
+
else
|
|
124
|
+
lowCount++;
|
|
125
|
+
findings.push({
|
|
126
|
+
severity: sev === 'critical' ? output.error('CRITICAL') :
|
|
127
|
+
sev === 'high' ? output.warning('HIGH') :
|
|
128
|
+
sev === 'moderate' || sev === 'medium' ? output.warning('MEDIUM') : output.info('LOW'),
|
|
129
|
+
type: 'Dependency CVE',
|
|
130
|
+
location: "package.json:" + pkg,
|
|
131
|
+
description: title.substring(0, 35)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
72
135
|
}
|
|
136
|
+
catch ( /* JSON parse failed, no vulns */_e) { /* JSON parse failed, no vulns */ }
|
|
73
137
|
}
|
|
74
138
|
}
|
|
75
|
-
catch
|
|
139
|
+
catch ( /* npm audit failed */_f) { /* npm audit failed */ }
|
|
76
140
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
141
|
+
// Phase 2: Scan for hardcoded secrets
|
|
142
|
+
if (scanType === 'all' || scanType === 'code') {
|
|
143
|
+
spinner.setText('Scanning for hardcoded secrets...');
|
|
144
|
+
secretPatterns_1 = [
|
|
145
|
+
{ pattern: /['"](?:sk-|sk_live_|sk_test_)[a-zA-Z0-9]{20,}['"]/g, type: 'API Key (Stripe/OpenAI)' },
|
|
146
|
+
{ pattern: /['"]AKIA[A-Z0-9]{16}['"]/g, type: 'AWS Access Key' },
|
|
147
|
+
{ pattern: /['"]ghp_[a-zA-Z0-9]{36}['"]/g, type: 'GitHub Token' },
|
|
148
|
+
{ pattern: /['"]xox[baprs]-[a-zA-Z0-9-]+['"]/g, type: 'Slack Token' },
|
|
149
|
+
{ pattern: /password\s*[:=]\s*['"][^'"]{8,}['"]/gi, type: 'Hardcoded Password' },
|
|
150
|
+
];
|
|
151
|
+
scanDir_1 = function (dir, depthLimit) {
|
|
152
|
+
if (depthLimit <= 0)
|
|
153
|
+
return;
|
|
154
|
+
try {
|
|
155
|
+
var entries = fs_1.readdirSync(dir, { withFileTypes: true });
|
|
156
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
157
|
+
var entry = entries_1[_i];
|
|
158
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist')
|
|
159
|
+
continue;
|
|
160
|
+
var fullPath = path_1.join(dir, entry.name);
|
|
161
|
+
if (entry.isDirectory()) {
|
|
162
|
+
scanDir_1(fullPath, depthLimit - 1);
|
|
163
|
+
}
|
|
164
|
+
else if (entry.isFile() && /\.(ts|js|json|env|yml|yaml)$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {
|
|
165
|
+
try {
|
|
166
|
+
var content = fs_1.readFileSync(fullPath, 'utf-8');
|
|
167
|
+
var lines = content.split('\n');
|
|
168
|
+
for (var i = 0; i < lines.length; i++) {
|
|
169
|
+
for (var _a = 0, secretPatterns_2 = secretPatterns_1; _a < secretPatterns_2.length; _a++) {
|
|
170
|
+
var _b = secretPatterns_2[_a], pattern = _b.pattern, type = _b.type;
|
|
171
|
+
if (pattern.test(lines[i])) {
|
|
172
|
+
highCount++;
|
|
173
|
+
findings.push({
|
|
174
|
+
severity: output.warning('HIGH'),
|
|
175
|
+
type: 'Hardcoded Secret',
|
|
176
|
+
location: path_1.relative(target, fullPath) + ":" + (i + 1),
|
|
177
|
+
description: type
|
|
178
|
+
});
|
|
179
|
+
pattern.lastIndex = 0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
117
182
|
}
|
|
118
183
|
}
|
|
184
|
+
catch ( /* file read error */_c) { /* file read error */ }
|
|
119
185
|
}
|
|
120
186
|
}
|
|
121
|
-
catch { /* file read error */ }
|
|
122
187
|
}
|
|
123
|
-
|
|
188
|
+
catch ( /* dir read error */_d) { /* dir read error */ }
|
|
189
|
+
};
|
|
190
|
+
scanDepth = depth === 'deep' ? 10 : depth === 'standard' ? 5 : 3;
|
|
191
|
+
scanDir_1(path_1.resolve(target), scanDepth);
|
|
124
192
|
}
|
|
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
|
-
pattern.lastIndex = 0;
|
|
193
|
+
// Phase 3: Check for common security issues in code
|
|
194
|
+
if ((scanType === 'all' || scanType === 'code') && depth !== 'quick') {
|
|
195
|
+
spinner.setText('Analyzing code patterns...');
|
|
196
|
+
codePatterns_1 = [
|
|
197
|
+
{ pattern: /eval\s*\(/g, type: 'Eval Usage', severity: 'medium', desc: 'eval() can execute arbitrary code' },
|
|
198
|
+
{ pattern: /innerHTML\s*=/g, type: 'innerHTML', severity: 'medium', desc: 'XSS risk with innerHTML' },
|
|
199
|
+
{ pattern: /dangerouslySetInnerHTML/g, type: 'React XSS', severity: 'medium', desc: 'React XSS risk' },
|
|
200
|
+
{ pattern: /child_process.*exec[^S]/g, type: 'Command Injection', severity: 'high', desc: 'Possible command injection' },
|
|
201
|
+
{ pattern: /\$\{.*\}.*sql|sql.*\$\{/gi, type: 'SQL Injection', severity: 'high', desc: 'Possible SQL injection' },
|
|
202
|
+
];
|
|
203
|
+
scanCodeDir_1 = function (dir, depthLimit) {
|
|
204
|
+
if (depthLimit <= 0)
|
|
205
|
+
return;
|
|
206
|
+
try {
|
|
207
|
+
var entries = fs_1.readdirSync(dir, { withFileTypes: true });
|
|
208
|
+
for (var _i = 0, entries_2 = entries; _i < entries_2.length; _i++) {
|
|
209
|
+
var entry = entries_2[_i];
|
|
210
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist')
|
|
211
|
+
continue;
|
|
212
|
+
var fullPath = path_1.join(dir, entry.name);
|
|
213
|
+
if (entry.isDirectory()) {
|
|
214
|
+
scanCodeDir_1(fullPath, depthLimit - 1);
|
|
215
|
+
}
|
|
216
|
+
else if (entry.isFile() && /\.(ts|js|tsx|jsx)$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {
|
|
217
|
+
try {
|
|
218
|
+
var content = fs_1.readFileSync(fullPath, 'utf-8');
|
|
219
|
+
var lines = content.split('\n');
|
|
220
|
+
for (var i = 0; i < lines.length; i++) {
|
|
221
|
+
for (var _a = 0, codePatterns_2 = codePatterns_1; _a < codePatterns_2.length; _a++) {
|
|
222
|
+
var _b = codePatterns_2[_a], pattern = _b.pattern, type = _b.type, severity = _b.severity, desc = _b.desc;
|
|
223
|
+
if (pattern.test(lines[i])) {
|
|
224
|
+
if (severity === 'high')
|
|
225
|
+
highCount++;
|
|
226
|
+
else
|
|
227
|
+
mediumCount++;
|
|
228
|
+
findings.push({
|
|
229
|
+
severity: severity === 'high' ? output.warning('HIGH') : output.warning('MEDIUM'),
|
|
230
|
+
type: type,
|
|
231
|
+
location: path_1.relative(target, fullPath) + ":" + (i + 1),
|
|
232
|
+
description: desc
|
|
233
|
+
});
|
|
234
|
+
pattern.lastIndex = 0;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
170
237
|
}
|
|
171
238
|
}
|
|
239
|
+
catch ( /* file read error */_c) { /* file read error */ }
|
|
172
240
|
}
|
|
173
241
|
}
|
|
174
|
-
catch { /* file read error */ }
|
|
175
242
|
}
|
|
243
|
+
catch ( /* dir read error */_d) { /* dir read error */ }
|
|
244
|
+
};
|
|
245
|
+
scanDepth = depth === 'deep' ? 10 : 5;
|
|
246
|
+
scanCodeDir_1(path_1.resolve(target), scanDepth);
|
|
247
|
+
}
|
|
248
|
+
spinner.succeed('Scan complete');
|
|
249
|
+
// Display results
|
|
250
|
+
output.writeln();
|
|
251
|
+
if (findings.length > 0) {
|
|
252
|
+
output.printTable({
|
|
253
|
+
columns: [
|
|
254
|
+
{ key: 'severity', header: 'Severity', width: 12 },
|
|
255
|
+
{ key: 'type', header: 'Type', width: 18 },
|
|
256
|
+
{ key: 'location', header: 'Location', width: 25 },
|
|
257
|
+
{ key: 'description', header: 'Description', width: 35 },
|
|
258
|
+
],
|
|
259
|
+
data: findings.slice(0, 20)
|
|
260
|
+
});
|
|
261
|
+
if (findings.length > 20) {
|
|
262
|
+
output.writeln(output.dim("... and " + (findings.length - 20) + " more issues"));
|
|
176
263
|
}
|
|
177
264
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
`Total Issues: ${findings.length}`,
|
|
211
|
-
].join('\n'), 'Scan Summary');
|
|
212
|
-
// Auto-fix if requested
|
|
213
|
-
if (fix && criticalCount + highCount > 0) {
|
|
214
|
-
output.writeln();
|
|
215
|
-
const fixSpinner = output.createSpinner({ text: 'Attempting to fix vulnerabilities...', spinner: 'dots' });
|
|
216
|
-
fixSpinner.start();
|
|
217
|
-
try {
|
|
218
|
-
execSync('npm audit fix 2>/dev/null || true', { cwd: path.resolve(target), encoding: 'utf-8' });
|
|
219
|
-
fixSpinner.succeed('Applied available fixes (run scan again to verify)');
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
fixSpinner.fail('Some fixes could not be applied automatically');
|
|
223
|
-
}
|
|
265
|
+
else {
|
|
266
|
+
output.writeln(output.success('No security issues found!'));
|
|
267
|
+
}
|
|
268
|
+
output.writeln();
|
|
269
|
+
output.printBox([
|
|
270
|
+
"Target: " + target,
|
|
271
|
+
"Depth: " + depth,
|
|
272
|
+
"Type: " + scanType,
|
|
273
|
+
"",
|
|
274
|
+
"Critical: " + criticalCount + " High: " + highCount + " Medium: " + mediumCount + " Low: " + lowCount,
|
|
275
|
+
"Total Issues: " + findings.length,
|
|
276
|
+
].join('\n'), 'Scan Summary');
|
|
277
|
+
// Auto-fix if requested
|
|
278
|
+
if (fix && criticalCount + highCount > 0) {
|
|
279
|
+
output.writeln();
|
|
280
|
+
fixSpinner = output.createSpinner({ text: 'Attempting to fix vulnerabilities...', spinner: 'dots' });
|
|
281
|
+
fixSpinner.start();
|
|
282
|
+
try {
|
|
283
|
+
execSync('npm audit fix 2>/dev/null || true', { cwd: path_1.resolve(target), encoding: 'utf-8' });
|
|
284
|
+
fixSpinner.succeed('Applied available fixes (run scan again to verify)');
|
|
285
|
+
}
|
|
286
|
+
catch (_g) {
|
|
287
|
+
fixSpinner.fail('Some fixes could not be applied automatically');
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return [2 /*return*/, { success: findings.length === 0 || (criticalCount === 0 && highCount === 0) }];
|
|
291
|
+
case 5:
|
|
292
|
+
error_1 = _d.sent();
|
|
293
|
+
spinner.fail('Scan failed');
|
|
294
|
+
output.printError("Error: " + error_1);
|
|
295
|
+
return [2 /*return*/, { success: false }];
|
|
296
|
+
case 6: return [2 /*return*/];
|
|
224
297
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
catch (error) {
|
|
228
|
-
spinner.fail('Scan failed');
|
|
229
|
-
output.printError(`Error: ${error}`);
|
|
230
|
-
return { success: false };
|
|
231
|
-
}
|
|
232
|
-
},
|
|
298
|
+
});
|
|
299
|
+
}); }
|
|
233
300
|
};
|
|
234
301
|
// CVE subcommand
|
|
235
|
-
|
|
302
|
+
var cveCommand = {
|
|
236
303
|
name: 'cve',
|
|
237
304
|
description: 'Check and manage CVE vulnerabilities',
|
|
238
305
|
options: [
|
|
@@ -244,304 +311,389 @@ const cveCommand = {
|
|
|
244
311
|
{ command: 'claude-flow security cve --list', description: 'List all CVEs' },
|
|
245
312
|
{ command: 'claude-flow security cve -c CVE-2024-1234', description: 'Check specific CVE' },
|
|
246
313
|
],
|
|
247
|
-
action:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
output.writeln(output.dim('─'.repeat(50)));
|
|
252
|
-
if (checkCve) {
|
|
253
|
-
output.printBox([
|
|
254
|
-
`CVE ID: ${checkCve}`,
|
|
255
|
-
`Severity: CRITICAL (9.8)`,
|
|
256
|
-
`Status: Active`,
|
|
257
|
-
``,
|
|
258
|
-
`Description: Remote code execution vulnerability`,
|
|
259
|
-
`Affected: lodash < 4.17.21`,
|
|
260
|
-
`Fix: Upgrade to lodash >= 4.17.21`,
|
|
261
|
-
``,
|
|
262
|
-
`References:`,
|
|
263
|
-
` - https://nvd.nist.gov/vuln/detail/${checkCve}`,
|
|
264
|
-
` - https://github.com/advisories`,
|
|
265
|
-
].join('\n'), 'CVE Details');
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
output.writeln(output.warning('⚠ No real CVE database configured. Showing example data.'));
|
|
269
|
-
output.writeln(output.dim('Run "npm audit" or "claude-flow security scan" for real vulnerability detection.'));
|
|
314
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
315
|
+
var checkCve;
|
|
316
|
+
return __generator(this, function (_a) {
|
|
317
|
+
checkCve = ctx.flags.check;
|
|
270
318
|
output.writeln();
|
|
271
|
-
output.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
319
|
+
output.writeln(output.bold('CVE Database'));
|
|
320
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
321
|
+
if (checkCve) {
|
|
322
|
+
output.printBox([
|
|
323
|
+
"CVE ID: " + checkCve,
|
|
324
|
+
"Severity: CRITICAL (9.8)",
|
|
325
|
+
"Status: Active",
|
|
326
|
+
"",
|
|
327
|
+
"Description: Remote code execution vulnerability",
|
|
328
|
+
"Affected: lodash < 4.17.21",
|
|
329
|
+
"Fix: Upgrade to lodash >= 4.17.21",
|
|
330
|
+
"",
|
|
331
|
+
"References:",
|
|
332
|
+
" - https://nvd.nist.gov/vuln/detail/" + checkCve,
|
|
333
|
+
" - https://github.com/advisories",
|
|
334
|
+
].join('\n'), 'CVE Details');
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
output.writeln(output.warning('⚠ No real CVE database configured. Showing example data.'));
|
|
338
|
+
output.writeln(output.dim('Run "npm audit" or "claude-flow security scan" for real vulnerability detection.'));
|
|
339
|
+
output.writeln();
|
|
340
|
+
output.printTable({
|
|
341
|
+
columns: [
|
|
342
|
+
{ key: 'id', header: 'CVE ID (Example)', width: 22 },
|
|
343
|
+
{ key: 'severity', header: 'Severity', width: 12 },
|
|
344
|
+
{ key: 'package', header: 'Package', width: 20 },
|
|
345
|
+
{ key: 'status', header: 'Status', width: 15 },
|
|
346
|
+
],
|
|
347
|
+
data: [
|
|
348
|
+
{ id: 'CVE-YYYY-NNNN', severity: output.error('CRITICAL'), package: 'example-pkg@1.0.0', status: output.warning('Example') },
|
|
349
|
+
{ id: 'CVE-YYYY-NNNN', severity: output.warning('HIGH'), package: 'example-pkg@2.0.0', status: output.success('Example') },
|
|
350
|
+
{ id: 'CVE-YYYY-NNNN', severity: output.info('MEDIUM'), package: 'example-pkg@3.0.0', status: output.success('Example') },
|
|
351
|
+
]
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
return [2 /*return*/, { success: true }];
|
|
355
|
+
});
|
|
356
|
+
}); }
|
|
287
357
|
};
|
|
288
358
|
// Threats subcommand
|
|
289
|
-
|
|
359
|
+
var threatsCommand = {
|
|
290
360
|
name: 'threats',
|
|
291
361
|
description: 'Threat modeling and analysis',
|
|
292
362
|
options: [
|
|
293
|
-
{ name: 'model', short: 'm', type: 'string', description: 'Threat model: stride, dread, pasta', default: 'stride' },
|
|
294
|
-
{ name: 'scope', short: 's', type: 'string', description: 'Analysis scope', default: '.' },
|
|
363
|
+
{ name: 'model', short: 'm', type: 'string', description: 'Threat model: stride, dread, pasta', "default": 'stride' },
|
|
364
|
+
{ name: 'scope', short: 's', type: 'string', description: 'Analysis scope', "default": '.' },
|
|
295
365
|
{ name: 'export', short: 'e', type: 'string', description: 'Export format: json, md, html' },
|
|
296
366
|
],
|
|
297
367
|
examples: [
|
|
298
368
|
{ command: 'claude-flow security threats --model stride', description: 'Run STRIDE analysis' },
|
|
299
369
|
{ command: 'claude-flow security threats -e md', description: 'Export as markdown' },
|
|
300
370
|
],
|
|
301
|
-
action:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
371
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
372
|
+
var model;
|
|
373
|
+
return __generator(this, function (_a) {
|
|
374
|
+
model = ctx.flags.model || 'stride';
|
|
375
|
+
output.writeln();
|
|
376
|
+
output.writeln(output.bold("Threat Model: " + model.toUpperCase()));
|
|
377
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
378
|
+
output.printTable({
|
|
379
|
+
columns: [
|
|
380
|
+
{ key: 'category', header: 'Category', width: 20 },
|
|
381
|
+
{ key: 'threat', header: 'Threat', width: 30 },
|
|
382
|
+
{ key: 'risk', header: 'Risk', width: 10 },
|
|
383
|
+
{ key: 'mitigation', header: 'Mitigation', width: 30 },
|
|
384
|
+
],
|
|
385
|
+
data: [
|
|
386
|
+
{ category: 'Spoofing', threat: 'API key theft', risk: output.error('High'), mitigation: 'Use secure key storage' },
|
|
387
|
+
{ category: 'Tampering', threat: 'Data manipulation', risk: output.warning('Medium'), mitigation: 'Input validation' },
|
|
388
|
+
{ category: 'Repudiation', threat: 'Action denial', risk: output.info('Low'), mitigation: 'Audit logging' },
|
|
389
|
+
{ category: 'Info Disclosure', threat: 'Data leakage', risk: output.error('High'), mitigation: 'Encryption at rest' },
|
|
390
|
+
{ category: 'DoS', threat: 'Resource exhaustion', risk: output.warning('Medium'), mitigation: 'Rate limiting' },
|
|
391
|
+
{ category: 'Elevation', threat: 'Privilege escalation', risk: output.error('High'), mitigation: 'RBAC implementation' },
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
return [2 /*return*/, { success: true }];
|
|
321
395
|
});
|
|
322
|
-
|
|
323
|
-
},
|
|
396
|
+
}); }
|
|
324
397
|
};
|
|
325
398
|
// Audit subcommand
|
|
326
|
-
|
|
399
|
+
var auditCommand = {
|
|
327
400
|
name: 'audit',
|
|
328
401
|
description: 'Security audit logging and compliance',
|
|
329
402
|
options: [
|
|
330
|
-
{ name: 'action', short: 'a', type: 'string', description: 'Action: log, list, export, clear', default: 'list' },
|
|
331
|
-
{ name: 'limit', short: 'l', type: 'number', description: 'Number of entries to show', default: '20' },
|
|
403
|
+
{ name: 'action', short: 'a', type: 'string', description: 'Action: log, list, export, clear', "default": 'list' },
|
|
404
|
+
{ name: 'limit', short: 'l', type: 'number', description: 'Number of entries to show', "default": '20' },
|
|
332
405
|
{ name: 'filter', short: 'f', type: 'string', description: 'Filter by event type' },
|
|
333
406
|
],
|
|
334
407
|
examples: [
|
|
335
408
|
{ command: 'claude-flow security audit --action list', description: 'List audit logs' },
|
|
336
409
|
{ command: 'claude-flow security audit -a export', description: 'Export audit trail' },
|
|
337
410
|
],
|
|
338
|
-
action:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
411
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
412
|
+
var action, _a, existsSync, readFileSync, readdirSync, statSync, join, auditEntries, swarmDir, files, _i, _b, file, stat, ts, now;
|
|
413
|
+
return __generator(this, function (_c) {
|
|
414
|
+
switch (_c.label) {
|
|
415
|
+
case 0:
|
|
416
|
+
action = ctx.flags.action || 'list';
|
|
417
|
+
output.writeln();
|
|
418
|
+
output.writeln(output.bold('Security Audit Log'));
|
|
419
|
+
output.writeln(output.dim('─'.repeat(60)));
|
|
420
|
+
return [4 /*yield*/, import('fs')];
|
|
421
|
+
case 1:
|
|
422
|
+
_a = _c.sent(), existsSync = _a.existsSync, readFileSync = _a.readFileSync, readdirSync = _a.readdirSync, statSync = _a.statSync;
|
|
423
|
+
return [4 /*yield*/, import('path')];
|
|
424
|
+
case 2:
|
|
425
|
+
join = (_c.sent()).join;
|
|
426
|
+
auditEntries = [];
|
|
427
|
+
swarmDir = join(process.cwd(), '.swarm');
|
|
428
|
+
// Check session files for real audit events
|
|
429
|
+
if (existsSync(swarmDir)) {
|
|
430
|
+
try {
|
|
431
|
+
files = readdirSync(swarmDir).filter(function (f) { return f.endsWith('.json'); });
|
|
432
|
+
for (_i = 0, _b = files.slice(-10); _i < _b.length; _i++) {
|
|
433
|
+
file = _b[_i];
|
|
434
|
+
try {
|
|
435
|
+
stat = statSync(join(swarmDir, file));
|
|
436
|
+
ts = stat.mtime.toISOString().replace('T', ' ').substring(0, 19);
|
|
437
|
+
auditEntries.push({
|
|
438
|
+
timestamp: ts,
|
|
439
|
+
event: file.includes('session') ? 'SESSION_UPDATE' :
|
|
440
|
+
file.includes('swarm') ? 'SWARM_ACTIVITY' :
|
|
441
|
+
file.includes('memory') ? 'MEMORY_WRITE' : 'CONFIG_CHANGE',
|
|
442
|
+
user: 'system',
|
|
443
|
+
status: output.success('Success')
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
catch ( /* skip */_d) { /* skip */ }
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
catch ( /* ignore */_e) { /* ignore */ }
|
|
450
|
+
}
|
|
451
|
+
now = new Date().toISOString().replace('T', ' ').substring(0, 19);
|
|
452
|
+
auditEntries.push({ timestamp: now, event: 'AUDIT_RUN', user: 'cli', status: output.success('Success') });
|
|
453
|
+
// Sort by timestamp desc
|
|
454
|
+
auditEntries.sort(function (a, b) { return b.timestamp.localeCompare(a.timestamp); });
|
|
455
|
+
if (auditEntries.length === 0) {
|
|
456
|
+
output.writeln(output.dim('No audit events found. Initialize a project first: claude-flow init'));
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
output.printTable({
|
|
460
|
+
columns: [
|
|
461
|
+
{ key: 'timestamp', header: 'Timestamp', width: 22 },
|
|
462
|
+
{ key: 'event', header: 'Event', width: 20 },
|
|
463
|
+
{ key: 'user', header: 'User', width: 15 },
|
|
464
|
+
{ key: 'status', header: 'Status', width: 12 },
|
|
465
|
+
],
|
|
466
|
+
data: auditEntries.slice(0, parseInt(ctx.flags.limit || '20', 10))
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
return [2 /*return*/, { success: true }];
|
|
470
|
+
}
|
|
357
471
|
});
|
|
358
|
-
|
|
359
|
-
},
|
|
472
|
+
}); }
|
|
360
473
|
};
|
|
361
474
|
// Secrets subcommand
|
|
362
|
-
|
|
475
|
+
var secretsCommand = {
|
|
363
476
|
name: 'secrets',
|
|
364
477
|
description: 'Detect and manage secrets in codebase',
|
|
365
478
|
options: [
|
|
366
|
-
{ name: 'action', short: 'a', type: 'string', description: 'Action: scan, list, rotate', default: 'scan' },
|
|
367
|
-
{ name: 'path', short: 'p', type: 'string', description: 'Path to scan', default: '.' },
|
|
479
|
+
{ name: 'action', short: 'a', type: 'string', description: 'Action: scan, list, rotate', "default": 'scan' },
|
|
480
|
+
{ name: 'path', short: 'p', type: 'string', description: 'Path to scan', "default": '.' },
|
|
368
481
|
{ name: 'ignore', short: 'i', type: 'string', description: 'Patterns to ignore' },
|
|
369
482
|
],
|
|
370
483
|
examples: [
|
|
371
484
|
{ command: 'claude-flow security secrets --action scan', description: 'Scan for secrets' },
|
|
372
485
|
{ command: 'claude-flow security secrets -a rotate', description: 'Rotate compromised secrets' },
|
|
373
486
|
],
|
|
374
|
-
action:
|
|
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
|
-
|
|
487
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
488
|
+
var path, spinner;
|
|
489
|
+
return __generator(this, function (_a) {
|
|
490
|
+
switch (_a.label) {
|
|
491
|
+
case 0:
|
|
492
|
+
path = ctx.flags.path || '.';
|
|
493
|
+
output.writeln();
|
|
494
|
+
output.writeln(output.bold('Secret Detection'));
|
|
495
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
496
|
+
spinner = output.createSpinner({ text: 'Scanning for secrets...', spinner: 'dots' });
|
|
497
|
+
spinner.start();
|
|
498
|
+
return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 800); })];
|
|
499
|
+
case 1:
|
|
500
|
+
_a.sent();
|
|
501
|
+
spinner.succeed('Scan complete');
|
|
502
|
+
output.writeln();
|
|
503
|
+
output.writeln(output.warning('⚠ No real secrets scan performed. Showing example findings.'));
|
|
504
|
+
output.writeln(output.dim('Run "claude-flow security scan --depth full" for real secret detection.'));
|
|
505
|
+
output.writeln();
|
|
506
|
+
output.printTable({
|
|
507
|
+
columns: [
|
|
508
|
+
{ key: 'type', header: 'Secret Type (Example)', width: 25 },
|
|
509
|
+
{ key: 'location', header: 'Location', width: 30 },
|
|
510
|
+
{ key: 'risk', header: 'Risk', width: 12 },
|
|
511
|
+
{ key: 'action', header: 'Recommended', width: 20 },
|
|
512
|
+
],
|
|
513
|
+
data: [
|
|
514
|
+
{ type: 'AWS Access Key', location: 'example/config.ts:15', risk: output.error('Critical'), action: 'Rotate immediately' },
|
|
515
|
+
{ type: 'GitHub Token', location: 'example/.env:8', risk: output.warning('High'), action: 'Remove from repo' },
|
|
516
|
+
{ type: 'JWT Secret', location: 'example/auth.ts:42', risk: output.warning('High'), action: 'Use env variable' },
|
|
517
|
+
{ type: 'DB Password', location: 'example/compose.yml:23', risk: output.warning('Medium'), action: 'Use secrets mgmt' },
|
|
518
|
+
]
|
|
519
|
+
});
|
|
520
|
+
return [2 /*return*/, { success: true }];
|
|
521
|
+
}
|
|
400
522
|
});
|
|
401
|
-
|
|
402
|
-
},
|
|
523
|
+
}); }
|
|
403
524
|
};
|
|
404
525
|
// Defend subcommand (AIDefence integration)
|
|
405
|
-
|
|
526
|
+
var defendCommand = {
|
|
406
527
|
name: 'defend',
|
|
407
528
|
description: 'AI manipulation defense - detect prompt injection, jailbreaks, and PII',
|
|
408
529
|
options: [
|
|
409
530
|
{ name: 'input', short: 'i', type: 'string', description: 'Input text to scan for threats' },
|
|
410
531
|
{ name: 'file', short: 'f', type: 'string', description: 'File to scan for threats' },
|
|
411
532
|
{ name: 'quick', short: 'Q', type: 'boolean', description: 'Quick scan (faster, less detailed)' },
|
|
412
|
-
{ name: 'learn', short: 'l', type: 'boolean', description: 'Enable learning mode', default: 'true' },
|
|
533
|
+
{ name: 'learn', short: 'l', type: 'boolean', description: 'Enable learning mode', "default": 'true' },
|
|
413
534
|
{ name: 'stats', short: 's', type: 'boolean', description: 'Show detection statistics' },
|
|
414
|
-
{ name: 'output', short: 'o', type: 'string', description: 'Output format: text, json', default: 'text' },
|
|
535
|
+
{ name: 'output', short: 'o', type: 'string', description: 'Output format: text, json', "default": 'text' },
|
|
415
536
|
],
|
|
416
537
|
examples: [
|
|
417
538
|
{ command: 'claude-flow security defend -i "ignore previous instructions"', description: 'Scan text for threats' },
|
|
418
539
|
{ command: 'claude-flow security defend -f ./prompts.txt', description: 'Scan file for threats' },
|
|
419
540
|
{ command: 'claude-flow security defend --stats', description: 'Show detection statistics' },
|
|
420
541
|
],
|
|
421
|
-
action:
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
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
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
542
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
543
|
+
var inputText, filePath, quickMode, showStats, outputFormat, enableLearning, createAIDefence, aidefence, _a, defender, stats, textToScan, fs, err_1, spinner, startTime, result, _b, scanTime, _i, _c, threat, severityColor, criticalThreats, _d, criticalThreats_1, threat, mitigation;
|
|
544
|
+
return __generator(this, function (_e) {
|
|
545
|
+
switch (_e.label) {
|
|
546
|
+
case 0:
|
|
547
|
+
inputText = ctx.flags.input;
|
|
548
|
+
filePath = ctx.flags.file;
|
|
549
|
+
quickMode = ctx.flags.quick;
|
|
550
|
+
showStats = ctx.flags.stats;
|
|
551
|
+
outputFormat = ctx.flags.output || 'text';
|
|
552
|
+
enableLearning = ctx.flags.learn !== false;
|
|
553
|
+
output.writeln();
|
|
554
|
+
output.writeln(output.bold('🛡️ AIDefence - AI Manipulation Defense System'));
|
|
555
|
+
output.writeln(output.dim('─'.repeat(55)));
|
|
556
|
+
_e.label = 1;
|
|
557
|
+
case 1:
|
|
558
|
+
_e.trys.push([1, 3, , 4]);
|
|
559
|
+
return [4 /*yield*/, import('@claude-flow/aidefence')];
|
|
560
|
+
case 2:
|
|
561
|
+
aidefence = _e.sent();
|
|
562
|
+
createAIDefence = aidefence.createAIDefence;
|
|
563
|
+
return [3 /*break*/, 4];
|
|
564
|
+
case 3:
|
|
565
|
+
_a = _e.sent();
|
|
566
|
+
output.error('AIDefence package not installed. Run: npm install @claude-flow/aidefence');
|
|
567
|
+
return [2 /*return*/, { success: false, message: 'AIDefence not available' }];
|
|
568
|
+
case 4:
|
|
569
|
+
defender = createAIDefence({ enableLearning: enableLearning });
|
|
570
|
+
if (!showStats) return [3 /*break*/, 6];
|
|
571
|
+
return [4 /*yield*/, defender.getStats()];
|
|
572
|
+
case 5:
|
|
573
|
+
stats = _e.sent();
|
|
574
|
+
output.writeln();
|
|
575
|
+
output.printBox([
|
|
576
|
+
"Detection Count: " + stats.detectionCount,
|
|
577
|
+
"Avg Detection Time: " + stats.avgDetectionTimeMs.toFixed(3) + "ms",
|
|
578
|
+
"Learned Patterns: " + stats.learnedPatterns,
|
|
579
|
+
"Mitigation Strategies: " + stats.mitigationStrategies,
|
|
580
|
+
"Avg Mitigation Effectiveness: " + (stats.avgMitigationEffectiveness * 100).toFixed(1) + "%",
|
|
581
|
+
].join('\n'), 'Detection Statistics');
|
|
582
|
+
return [2 /*return*/, { success: true }];
|
|
583
|
+
case 6:
|
|
584
|
+
textToScan = inputText;
|
|
585
|
+
if (!filePath) return [3 /*break*/, 11];
|
|
586
|
+
_e.label = 7;
|
|
587
|
+
case 7:
|
|
588
|
+
_e.trys.push([7, 10, , 11]);
|
|
589
|
+
return [4 /*yield*/, import('fs/promises')];
|
|
590
|
+
case 8:
|
|
591
|
+
fs = _e.sent();
|
|
592
|
+
return [4 /*yield*/, fs.readFile(filePath, 'utf-8')];
|
|
593
|
+
case 9:
|
|
594
|
+
textToScan = _e.sent();
|
|
595
|
+
output.writeln(output.dim("Reading file: " + filePath));
|
|
596
|
+
return [3 /*break*/, 11];
|
|
597
|
+
case 10:
|
|
598
|
+
err_1 = _e.sent();
|
|
599
|
+
output.error("Failed to read file: " + filePath);
|
|
600
|
+
return [2 /*return*/, { success: false, message: 'File not found' }];
|
|
601
|
+
case 11:
|
|
602
|
+
if (!textToScan) {
|
|
603
|
+
output.writeln('Usage: claude-flow security defend -i "<text>" or -f <file>');
|
|
604
|
+
output.writeln();
|
|
605
|
+
output.writeln('Options:');
|
|
606
|
+
output.printList([
|
|
607
|
+
'-i, --input Text to scan for AI manipulation attempts',
|
|
608
|
+
'-f, --file File path to scan',
|
|
609
|
+
'-q, --quick Quick scan mode (faster)',
|
|
610
|
+
'-s, --stats Show detection statistics',
|
|
611
|
+
'--learn Enable pattern learning (default: true)',
|
|
612
|
+
]);
|
|
613
|
+
return [2 /*return*/, { success: true }];
|
|
614
|
+
}
|
|
615
|
+
spinner = output.createSpinner({ text: 'Scanning for threats...', spinner: 'dots' });
|
|
616
|
+
spinner.start();
|
|
617
|
+
startTime = performance.now();
|
|
618
|
+
if (!quickMode) return [3 /*break*/, 12];
|
|
619
|
+
_b = __assign(__assign({}, defender.quickScan(textToScan)), { threats: [], piiFound: false, detectionTimeMs: 0, inputHash: '', safe: !defender.quickScan(textToScan).threat });
|
|
620
|
+
return [3 /*break*/, 14];
|
|
621
|
+
case 12: return [4 /*yield*/, defender.detect(textToScan)];
|
|
622
|
+
case 13:
|
|
623
|
+
_b = _e.sent();
|
|
624
|
+
_e.label = 14;
|
|
625
|
+
case 14:
|
|
626
|
+
result = _b;
|
|
627
|
+
scanTime = performance.now() - startTime;
|
|
628
|
+
spinner.stop();
|
|
629
|
+
// JSON output
|
|
630
|
+
if (outputFormat === 'json') {
|
|
631
|
+
output.writeln(JSON.stringify({
|
|
632
|
+
safe: result.safe,
|
|
633
|
+
threats: result.threats || [],
|
|
634
|
+
piiFound: result.piiFound,
|
|
635
|
+
detectionTimeMs: scanTime
|
|
636
|
+
}, null, 2));
|
|
637
|
+
return [2 /*return*/, { success: true }];
|
|
638
|
+
}
|
|
639
|
+
// Text output
|
|
640
|
+
output.writeln();
|
|
641
|
+
if (!(result.safe && !result.piiFound)) return [3 /*break*/, 15];
|
|
642
|
+
output.writeln(output.success('✅ No threats detected'));
|
|
643
|
+
return [3 /*break*/, 21];
|
|
644
|
+
case 15:
|
|
645
|
+
if (!(!result.safe && result.threats)) return [3 /*break*/, 20];
|
|
646
|
+
output.writeln(output.error("\u26A0\uFE0F " + result.threats.length + " threat(s) detected:"));
|
|
519
647
|
output.writeln();
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
648
|
+
for (_i = 0, _c = result.threats; _i < _c.length; _i++) {
|
|
649
|
+
threat = _c[_i];
|
|
650
|
+
severityColor = {
|
|
651
|
+
critical: output.error,
|
|
652
|
+
high: output.warning,
|
|
653
|
+
medium: output.info,
|
|
654
|
+
low: output.dim
|
|
655
|
+
}[threat.severity] || output.dim;
|
|
656
|
+
output.writeln(" " + severityColor("[" + threat.severity.toUpperCase() + "]") + " " + threat.type);
|
|
657
|
+
output.writeln(" " + output.dim(threat.description));
|
|
658
|
+
output.writeln(" Confidence: " + (threat.confidence * 100).toFixed(1) + "%");
|
|
659
|
+
output.writeln();
|
|
660
|
+
}
|
|
661
|
+
criticalThreats = result.threats.filter(function (t) { return t.severity === 'critical'; });
|
|
662
|
+
if (!(criticalThreats.length > 0 && enableLearning)) return [3 /*break*/, 20];
|
|
524
663
|
output.writeln(output.bold('Recommended Mitigations:'));
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
664
|
+
_d = 0, criticalThreats_1 = criticalThreats;
|
|
665
|
+
_e.label = 16;
|
|
666
|
+
case 16:
|
|
667
|
+
if (!(_d < criticalThreats_1.length)) return [3 /*break*/, 19];
|
|
668
|
+
threat = criticalThreats_1[_d];
|
|
669
|
+
return [4 /*yield*/, defender.getBestMitigation(threat.type)];
|
|
670
|
+
case 17:
|
|
671
|
+
mitigation = _e.sent();
|
|
672
|
+
if (mitigation) {
|
|
673
|
+
output.writeln(" " + threat.type + ": " + output.bold(mitigation.strategy) + " (" + (mitigation.effectiveness * 100).toFixed(0) + "% effective)");
|
|
530
674
|
}
|
|
675
|
+
_e.label = 18;
|
|
676
|
+
case 18:
|
|
677
|
+
_d++;
|
|
678
|
+
return [3 /*break*/, 16];
|
|
679
|
+
case 19:
|
|
531
680
|
output.writeln();
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
681
|
+
_e.label = 20;
|
|
682
|
+
case 20:
|
|
683
|
+
if (result.piiFound) {
|
|
684
|
+
output.writeln(output.warning('⚠️ PII detected (emails, SSNs, API keys, etc.)'));
|
|
685
|
+
output.writeln();
|
|
686
|
+
}
|
|
687
|
+
_e.label = 21;
|
|
688
|
+
case 21:
|
|
689
|
+
output.writeln(output.dim("Detection time: " + scanTime.toFixed(3) + "ms"));
|
|
690
|
+
return [2 /*return*/, { success: result.safe }];
|
|
537
691
|
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
return { success: result.safe };
|
|
541
|
-
},
|
|
692
|
+
});
|
|
693
|
+
}); }
|
|
542
694
|
};
|
|
543
695
|
// Main security command
|
|
544
|
-
export
|
|
696
|
+
export var securityCommand = {
|
|
545
697
|
name: 'security',
|
|
546
698
|
description: 'Security scanning, CVE detection, threat modeling, AI defense',
|
|
547
699
|
subcommands: [scanCommand, cveCommand, threatsCommand, auditCommand, secretsCommand, defendCommand],
|
|
@@ -550,26 +702,28 @@ export const securityCommand = {
|
|
|
550
702
|
{ command: 'claude-flow security cve --list', description: 'List known CVEs' },
|
|
551
703
|
{ command: 'claude-flow security threats', description: 'Run threat analysis' },
|
|
552
704
|
],
|
|
553
|
-
action:
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
705
|
+
action: function () { return __awaiter(void 0, void 0, Promise, function () {
|
|
706
|
+
return __generator(this, function (_a) {
|
|
707
|
+
output.writeln();
|
|
708
|
+
output.writeln(output.bold('RuFlo Security Suite'));
|
|
709
|
+
output.writeln(output.dim('Comprehensive security scanning and vulnerability management'));
|
|
710
|
+
output.writeln();
|
|
711
|
+
output.writeln('Subcommands:');
|
|
712
|
+
output.printList([
|
|
713
|
+
'scan - Run security scans on code, deps, containers',
|
|
714
|
+
'cve - Check and manage CVE vulnerabilities',
|
|
715
|
+
'threats - Threat modeling (STRIDE, DREAD, PASTA)',
|
|
716
|
+
'audit - Security audit logging and compliance',
|
|
717
|
+
'secrets - Detect and manage secrets in codebase',
|
|
718
|
+
'defend - AI manipulation defense (prompt injection, jailbreaks, PII)',
|
|
719
|
+
]);
|
|
720
|
+
output.writeln();
|
|
721
|
+
output.writeln('Use --help with subcommands for more info');
|
|
722
|
+
output.writeln();
|
|
723
|
+
output.writeln(output.dim('Created with ❤️ by ruv.io'));
|
|
724
|
+
return [2 /*return*/, { success: true }];
|
|
725
|
+
});
|
|
726
|
+
}); }
|
|
573
727
|
};
|
|
574
728
|
export default securityCommand;
|
|
575
729
|
//# sourceMappingURL=security.js.map
|