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
|
@@ -2,14 +2,70 @@
|
|
|
2
2
|
* Init Executor
|
|
3
3
|
* Main execution logic for V3 initialization
|
|
4
4
|
*/
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (_) try {
|
|
32
|
+
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;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
53
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
54
|
+
if (ar || !(i in from)) {
|
|
55
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
56
|
+
ar[i] = from[i];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
60
|
+
};
|
|
5
61
|
import * as fs from 'fs';
|
|
6
62
|
import * as path from 'path';
|
|
7
63
|
import { fileURLToPath } from 'url';
|
|
8
64
|
import { createRequire } from 'module';
|
|
9
65
|
import { dirname } from 'path';
|
|
10
66
|
// ESM-compatible __dirname
|
|
11
|
-
|
|
12
|
-
|
|
67
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
68
|
+
var __dirname = dirname(__filename);
|
|
13
69
|
import { detectPlatform, DEFAULT_INIT_OPTIONS } from './types.js';
|
|
14
70
|
import { generateSettingsJson, generateSettings } from './settings-generator.js';
|
|
15
71
|
import { generateMCPJson } from './mcp-generator.js';
|
|
@@ -19,7 +75,7 @@ import { generateClaudeMd } from './claudemd-generator.js';
|
|
|
19
75
|
/**
|
|
20
76
|
* Skills to copy based on configuration
|
|
21
77
|
*/
|
|
22
|
-
|
|
78
|
+
var SKILLS_MAP = {
|
|
23
79
|
core: [
|
|
24
80
|
'swarm-orchestration',
|
|
25
81
|
'swarm-advanced',
|
|
@@ -30,8 +86,8 @@ const SKILLS_MAP = {
|
|
|
30
86
|
'stream-chain',
|
|
31
87
|
'skill-builder',
|
|
32
88
|
],
|
|
33
|
-
browser: ['browser'],
|
|
34
|
-
dualMode: ['dual-mode'],
|
|
89
|
+
browser: ['browser'],
|
|
90
|
+
dualMode: ['dual-mode'],
|
|
35
91
|
agentdb: [
|
|
36
92
|
'agentdb-advanced',
|
|
37
93
|
'agentdb-learning',
|
|
@@ -53,6 +109,7 @@ const SKILLS_MAP = {
|
|
|
53
109
|
'flow-nexus-platform',
|
|
54
110
|
'flow-nexus-swarm',
|
|
55
111
|
],
|
|
112
|
+
design: ['ui-ux-pro-max'],
|
|
56
113
|
v3: [
|
|
57
114
|
'v3-cli-modernization',
|
|
58
115
|
'v3-core-implementation',
|
|
@@ -63,12 +120,12 @@ const SKILLS_MAP = {
|
|
|
63
120
|
'v3-performance-optimization',
|
|
64
121
|
'v3-security-overhaul',
|
|
65
122
|
'v3-swarm-coordination',
|
|
66
|
-
]
|
|
123
|
+
]
|
|
67
124
|
};
|
|
68
125
|
/**
|
|
69
126
|
* Commands to copy based on configuration
|
|
70
127
|
*/
|
|
71
|
-
|
|
128
|
+
var COMMANDS_MAP = {
|
|
72
129
|
core: ['claude-flow-help.md', 'claude-flow-swarm.md', 'claude-flow-memory.md'],
|
|
73
130
|
analysis: ['analysis'],
|
|
74
131
|
automation: ['automation'],
|
|
@@ -76,20 +133,20 @@ const COMMANDS_MAP = {
|
|
|
76
133
|
hooks: ['hooks'],
|
|
77
134
|
monitoring: ['monitoring'],
|
|
78
135
|
optimization: ['optimization'],
|
|
79
|
-
sparc: ['sparc']
|
|
136
|
+
sparc: ['sparc']
|
|
80
137
|
};
|
|
81
138
|
/**
|
|
82
139
|
* Agents to copy based on configuration
|
|
83
140
|
*/
|
|
84
|
-
|
|
141
|
+
var AGENTS_MAP = {
|
|
85
142
|
core: ['core'],
|
|
86
143
|
consensus: ['consensus'],
|
|
87
144
|
github: ['github'],
|
|
88
145
|
hiveMind: ['hive-mind'],
|
|
89
146
|
sparc: ['sparc'],
|
|
90
147
|
swarm: ['swarm'],
|
|
91
|
-
browser: ['browser'],
|
|
92
|
-
dualMode: ['dual-mode'],
|
|
148
|
+
browser: ['browser'],
|
|
149
|
+
dualMode: ['dual-mode'],
|
|
93
150
|
// V3-specific agents
|
|
94
151
|
v3: ['v3'],
|
|
95
152
|
optimization: ['optimization'],
|
|
@@ -107,12 +164,13 @@ const AGENTS_MAP = {
|
|
|
107
164
|
sona: ['sona'],
|
|
108
165
|
payments: ['payments'],
|
|
109
166
|
data: ['data'],
|
|
110
|
-
|
|
167
|
+
design: ['design'],
|
|
168
|
+
custom: ['custom']
|
|
111
169
|
};
|
|
112
170
|
/**
|
|
113
171
|
* Directory structure to create
|
|
114
172
|
*/
|
|
115
|
-
|
|
173
|
+
var DIRECTORIES = {
|
|
116
174
|
claude: [
|
|
117
175
|
'.claude',
|
|
118
176
|
'.claude/skills',
|
|
@@ -128,82 +186,115 @@ const DIRECTORIES = {
|
|
|
128
186
|
'.claude-flow/hooks',
|
|
129
187
|
'.claude-flow/agents',
|
|
130
188
|
'.claude-flow/workflows',
|
|
131
|
-
]
|
|
189
|
+
]
|
|
132
190
|
};
|
|
133
191
|
/**
|
|
134
192
|
* Execute initialization
|
|
135
193
|
*/
|
|
136
|
-
export
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
194
|
+
export function executeInit(options) {
|
|
195
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
196
|
+
var platform, result, targetDir, error_1;
|
|
197
|
+
return __generator(this, function (_a) {
|
|
198
|
+
switch (_a.label) {
|
|
199
|
+
case 0:
|
|
200
|
+
platform = detectPlatform();
|
|
201
|
+
result = {
|
|
202
|
+
success: true,
|
|
203
|
+
platform: platform,
|
|
204
|
+
created: {
|
|
205
|
+
directories: [],
|
|
206
|
+
files: []
|
|
207
|
+
},
|
|
208
|
+
skipped: [],
|
|
209
|
+
errors: [],
|
|
210
|
+
summary: {
|
|
211
|
+
skillsCount: 0,
|
|
212
|
+
commandsCount: 0,
|
|
213
|
+
agentsCount: 0,
|
|
214
|
+
hooksEnabled: 0
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
targetDir = options.targetDir;
|
|
218
|
+
_a.label = 1;
|
|
219
|
+
case 1:
|
|
220
|
+
_a.trys.push([1, 23, , 24]);
|
|
221
|
+
// Create directory structure
|
|
222
|
+
return [4 /*yield*/, createDirectories(targetDir, options, result)];
|
|
223
|
+
case 2:
|
|
224
|
+
// Create directory structure
|
|
225
|
+
_a.sent();
|
|
226
|
+
if (!options.components.settings) return [3 /*break*/, 4];
|
|
227
|
+
return [4 /*yield*/, writeSettings(targetDir, options, result)];
|
|
228
|
+
case 3:
|
|
229
|
+
_a.sent();
|
|
230
|
+
_a.label = 4;
|
|
231
|
+
case 4:
|
|
232
|
+
if (!options.components.mcp) return [3 /*break*/, 6];
|
|
233
|
+
return [4 /*yield*/, writeMCPConfig(targetDir, options, result)];
|
|
234
|
+
case 5:
|
|
235
|
+
_a.sent();
|
|
236
|
+
_a.label = 6;
|
|
237
|
+
case 6:
|
|
238
|
+
if (!options.components.skills) return [3 /*break*/, 8];
|
|
239
|
+
return [4 /*yield*/, copySkills(targetDir, options, result)];
|
|
240
|
+
case 7:
|
|
241
|
+
_a.sent();
|
|
242
|
+
_a.label = 8;
|
|
243
|
+
case 8:
|
|
244
|
+
if (!options.components.commands) return [3 /*break*/, 10];
|
|
245
|
+
return [4 /*yield*/, copyCommands(targetDir, options, result)];
|
|
246
|
+
case 9:
|
|
247
|
+
_a.sent();
|
|
248
|
+
_a.label = 10;
|
|
249
|
+
case 10:
|
|
250
|
+
if (!options.components.agents) return [3 /*break*/, 12];
|
|
251
|
+
return [4 /*yield*/, copyAgents(targetDir, options, result)];
|
|
252
|
+
case 11:
|
|
253
|
+
_a.sent();
|
|
254
|
+
_a.label = 12;
|
|
255
|
+
case 12:
|
|
256
|
+
if (!options.components.helpers) return [3 /*break*/, 14];
|
|
257
|
+
return [4 /*yield*/, writeHelpers(targetDir, options, result)];
|
|
258
|
+
case 13:
|
|
259
|
+
_a.sent();
|
|
260
|
+
_a.label = 14;
|
|
261
|
+
case 14:
|
|
262
|
+
if (!options.components.statusline) return [3 /*break*/, 16];
|
|
263
|
+
return [4 /*yield*/, writeStatusline(targetDir, options, result)];
|
|
264
|
+
case 15:
|
|
265
|
+
_a.sent();
|
|
266
|
+
_a.label = 16;
|
|
267
|
+
case 16:
|
|
268
|
+
if (!options.components.runtime) return [3 /*break*/, 18];
|
|
269
|
+
return [4 /*yield*/, writeRuntimeConfig(targetDir, options, result)];
|
|
270
|
+
case 17:
|
|
271
|
+
_a.sent();
|
|
272
|
+
_a.label = 18;
|
|
273
|
+
case 18:
|
|
274
|
+
if (!options.components.statusline) return [3 /*break*/, 20];
|
|
275
|
+
return [4 /*yield*/, writeInitialMetrics(targetDir, options, result)];
|
|
276
|
+
case 19:
|
|
277
|
+
_a.sent();
|
|
278
|
+
_a.label = 20;
|
|
279
|
+
case 20:
|
|
280
|
+
if (!options.components.claudeMd) return [3 /*break*/, 22];
|
|
281
|
+
return [4 /*yield*/, writeClaudeMd(targetDir, options, result)];
|
|
282
|
+
case 21:
|
|
283
|
+
_a.sent();
|
|
284
|
+
_a.label = 22;
|
|
285
|
+
case 22:
|
|
286
|
+
// Count enabled hooks
|
|
287
|
+
result.summary.hooksEnabled = countEnabledHooks(options);
|
|
288
|
+
return [3 /*break*/, 24];
|
|
289
|
+
case 23:
|
|
290
|
+
error_1 = _a.sent();
|
|
291
|
+
result.success = false;
|
|
292
|
+
result.errors.push(error_1 instanceof Error ? error_1.message : String(error_1));
|
|
293
|
+
return [3 /*break*/, 24];
|
|
294
|
+
case 24: return [2 /*return*/, result];
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
});
|
|
207
298
|
}
|
|
208
299
|
/**
|
|
209
300
|
* Merge new settings into existing settings.json
|
|
@@ -211,63 +302,57 @@ export async function executeInit(options) {
|
|
|
211
302
|
* Uses platform-specific commands for Mac, Linux, and Windows
|
|
212
303
|
*/
|
|
213
304
|
function mergeSettingsForUpgrade(existing) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
305
|
+
var _a, _b, _c;
|
|
306
|
+
var merged = __assign({}, existing);
|
|
307
|
+
var platform = detectPlatform();
|
|
308
|
+
var isWindows = platform.os === 'windows';
|
|
217
309
|
// Platform-specific command wrappers
|
|
218
310
|
// Windows: Use PowerShell-compatible commands
|
|
219
311
|
// Mac/Linux: Use bash-compatible commands with 2>/dev/null
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const taskCompletedCmd = isWindows
|
|
224
|
-
? 'if ($env:TASK_ID) { npx @kynjal/cli@latest hooks task-completed --task-id $env:TASK_ID --train-patterns true 2>$null }; exit 0'
|
|
225
|
-
: '[ -n "$TASK_ID" ] && npx @kynjal/cli@latest hooks task-completed --task-id "$TASK_ID" --train-patterns true 2>/dev/null || true';
|
|
312
|
+
// NOTE: teammateIdleCmd and taskCompletedCmd were removed.
|
|
313
|
+
// TeammateIdle/TaskCompleted are not valid Claude Code hook events and caused warnings.
|
|
314
|
+
// Agent Teams hook config lives in claudeFlow.agentTeams.hooks instead.
|
|
226
315
|
// 1. Merge env vars (preserve existing, add new)
|
|
227
|
-
|
|
228
|
-
merged.env = {
|
|
229
|
-
...existingEnv,
|
|
230
|
-
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1',
|
|
231
|
-
CLAUDE_FLOW_V3_ENABLED: existingEnv.CLAUDE_FLOW_V3_ENABLED || 'true',
|
|
232
|
-
CLAUDE_FLOW_HOOKS_ENABLED: existingEnv.CLAUDE_FLOW_HOOKS_ENABLED || 'true',
|
|
233
|
-
};
|
|
316
|
+
var existingEnv = existing.env || {};
|
|
317
|
+
merged.env = __assign(__assign({}, existingEnv), { CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1', CLAUDE_FLOW_V3_ENABLED: existingEnv.CLAUDE_FLOW_V3_ENABLED || 'true', CLAUDE_FLOW_HOOKS_ENABLED: existingEnv.CLAUDE_FLOW_HOOKS_ENABLED || 'true' });
|
|
234
318
|
// 2. Merge hooks (preserve existing, add new Agent Teams + auto-memory hooks)
|
|
235
|
-
|
|
236
|
-
merged.hooks = {
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
319
|
+
var existingHooks = existing.hooks || {};
|
|
320
|
+
merged.hooks = __assign({}, existingHooks);
|
|
321
|
+
// Cross-platform auto-memory hook commands that resolve paths via git root.
|
|
322
|
+
// Uses node -e with git rev-parse so hooks work regardless of CWD (#1259, #1284).
|
|
323
|
+
var gitRootResolver = "var c=require('child_process'),p=require('path'),u=require('url'),r;"
|
|
324
|
+
+ "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}"
|
|
325
|
+
+ 'catch(e){r=process.cwd()}';
|
|
326
|
+
var autoMemoryScript = '.claude/helpers/auto-memory-hook.mjs';
|
|
327
|
+
var autoMemoryImportCmd = "node -e \"" + gitRootResolver + "var f=p.join(r,'" + autoMemoryScript + "');import(u.pathToFileURL(f).href)\" import";
|
|
328
|
+
var autoMemorySyncCmd = "node -e \"" + gitRootResolver + "var f=p.join(r,'" + autoMemoryScript + "');import(u.pathToFileURL(f).href)\" sync";
|
|
244
329
|
// Add auto-memory import to SessionStart (if not already present)
|
|
245
|
-
|
|
246
|
-
|
|
330
|
+
var sessionStartHooks = existingHooks.SessionStart;
|
|
331
|
+
var hasAutoMemoryImport = sessionStartHooks === null || sessionStartHooks === void 0 ? void 0 : sessionStartHooks.some(function (group) { var _a; return (_a = group.hooks) === null || _a === void 0 ? void 0 : _a.some(function (h) { var _a; return (_a = h.command) === null || _a === void 0 ? void 0 : _a.includes('auto-memory-hook'); }); });
|
|
247
332
|
if (!hasAutoMemoryImport) {
|
|
248
|
-
|
|
333
|
+
var startHooks = merged.hooks;
|
|
249
334
|
if (!startHooks.SessionStart) {
|
|
250
335
|
startHooks.SessionStart = [{ hooks: [] }];
|
|
251
336
|
}
|
|
252
|
-
|
|
337
|
+
var startGroup = startHooks.SessionStart[0];
|
|
253
338
|
if (!startGroup.hooks)
|
|
254
339
|
startGroup.hooks = [];
|
|
255
340
|
startGroup.hooks.push({
|
|
256
341
|
type: 'command',
|
|
257
342
|
command: autoMemoryImportCmd,
|
|
258
343
|
timeout: 6000,
|
|
259
|
-
continueOnError: true
|
|
344
|
+
continueOnError: true
|
|
260
345
|
});
|
|
261
346
|
}
|
|
262
347
|
// Add auto-memory sync to SessionEnd (if not already present)
|
|
263
|
-
|
|
264
|
-
|
|
348
|
+
var sessionEndHooks = existingHooks.SessionEnd;
|
|
349
|
+
var hasAutoMemorySync = sessionEndHooks === null || sessionEndHooks === void 0 ? void 0 : sessionEndHooks.some(function (group) { var _a; return (_a = group.hooks) === null || _a === void 0 ? void 0 : _a.some(function (h) { var _a; return (_a = h.command) === null || _a === void 0 ? void 0 : _a.includes('auto-memory-hook'); }); });
|
|
265
350
|
if (!hasAutoMemorySync) {
|
|
266
|
-
|
|
351
|
+
var endHooks = merged.hooks;
|
|
267
352
|
if (!endHooks.SessionEnd) {
|
|
268
353
|
endHooks.SessionEnd = [{ hooks: [] }];
|
|
269
354
|
}
|
|
270
|
-
|
|
355
|
+
var endGroup = endHooks.SessionEnd[0];
|
|
271
356
|
if (!endGroup.hooks)
|
|
272
357
|
endGroup.hooks = [];
|
|
273
358
|
// Insert at beginning so sync runs before other cleanup
|
|
@@ -275,47 +360,28 @@ function mergeSettingsForUpgrade(existing) {
|
|
|
275
360
|
type: 'command',
|
|
276
361
|
command: autoMemorySyncCmd,
|
|
277
362
|
timeout: 8000,
|
|
278
|
-
continueOnError: true
|
|
363
|
+
continueOnError: true
|
|
279
364
|
});
|
|
280
365
|
}
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
// Add TaskCompleted hook if not present
|
|
297
|
-
if (!existingHooks.TaskCompleted) {
|
|
298
|
-
merged.hooks.TaskCompleted = [
|
|
299
|
-
{
|
|
300
|
-
hooks: [
|
|
301
|
-
{
|
|
302
|
-
type: 'command',
|
|
303
|
-
command: taskCompletedCmd,
|
|
304
|
-
timeout: 5000,
|
|
305
|
-
continueOnError: true,
|
|
306
|
-
},
|
|
307
|
-
],
|
|
308
|
-
},
|
|
309
|
-
];
|
|
366
|
+
// NOTE: TeammateIdle and TaskCompleted are NOT valid Claude Code hook events.
|
|
367
|
+
// They cause warnings when present in settings.json hooks.
|
|
368
|
+
// Remove them if they exist from a previous init.
|
|
369
|
+
delete merged.hooks.TeammateIdle;
|
|
370
|
+
delete merged.hooks.TaskCompleted;
|
|
371
|
+
// Their configuration lives in claudeFlow.agentTeams.hooks instead.
|
|
372
|
+
// 3. Fix statusLine config (remove invalid fields, ensure correct format)
|
|
373
|
+
// Claude Code only supports: type, command, padding
|
|
374
|
+
var existingStatusLine = existing.statusLine;
|
|
375
|
+
if (existingStatusLine) {
|
|
376
|
+
merged.statusLine = {
|
|
377
|
+
type: 'command',
|
|
378
|
+
command: existingStatusLine.command || "node -e \"var c=require('child_process'),p=require('path'),r;try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}catch(e){r=process.cwd()}var s=p.join(r,'.claude/helpers/statusline.cjs');process.argv.splice(1,0,s);require(s)\""
|
|
379
|
+
};
|
|
310
380
|
}
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
merged.claudeFlow = {
|
|
315
|
-
...existingClaudeFlow,
|
|
316
|
-
version: existingClaudeFlow.version || '3.0.0',
|
|
317
|
-
enabled: existingClaudeFlow.enabled !== false,
|
|
318
|
-
agentTeams: {
|
|
381
|
+
// 4. Merge claudeFlow settings (preserve existing, add agentTeams + memory)
|
|
382
|
+
var existingClaudeFlow = existing.claudeFlow || {};
|
|
383
|
+
var existingMemory = existingClaudeFlow.memory || {};
|
|
384
|
+
merged.claudeFlow = __assign(__assign({}, existingClaudeFlow), { version: existingClaudeFlow.version || '3.0.0', enabled: existingClaudeFlow.enabled !== false, agentTeams: {
|
|
319
385
|
enabled: true,
|
|
320
386
|
teammateMode: 'auto',
|
|
321
387
|
taskListEnabled: true,
|
|
@@ -324,20 +390,13 @@ function mergeSettingsForUpgrade(existing) {
|
|
|
324
390
|
autoAssignOnIdle: true,
|
|
325
391
|
trainPatternsOnComplete: true,
|
|
326
392
|
notifyLeadOnComplete: true,
|
|
327
|
-
sharedMemoryNamespace: 'agent-teams'
|
|
393
|
+
sharedMemoryNamespace: 'agent-teams'
|
|
328
394
|
},
|
|
329
395
|
hooks: {
|
|
330
396
|
teammateIdle: { enabled: true, autoAssign: true, checkTaskList: true },
|
|
331
|
-
taskCompleted: { enabled: true, trainPatterns: true, notifyLead: true }
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
memory: {
|
|
335
|
-
...existingMemory,
|
|
336
|
-
learningBridge: existingMemory.learningBridge ?? { enabled: true },
|
|
337
|
-
memoryGraph: existingMemory.memoryGraph ?? { enabled: true },
|
|
338
|
-
agentScopes: existingMemory.agentScopes ?? { enabled: true },
|
|
339
|
-
},
|
|
340
|
-
};
|
|
397
|
+
taskCompleted: { enabled: true, trainPatterns: true, notifyLead: true }
|
|
398
|
+
}
|
|
399
|
+
}, memory: __assign(__assign({}, existingMemory), { learningBridge: (_a = existingMemory.learningBridge) !== null && _a !== void 0 ? _a : { enabled: true }, memoryGraph: (_b = existingMemory.memoryGraph) !== null && _b !== void 0 ? _b : { enabled: true }, agentScopes: (_c = existingMemory.agentScopes) !== null && _c !== void 0 ? _c : { enabled: true } }) });
|
|
341
400
|
return merged;
|
|
342
401
|
}
|
|
343
402
|
/**
|
|
@@ -346,200 +405,190 @@ function mergeSettingsForUpgrade(existing) {
|
|
|
346
405
|
* @param targetDir - Target directory
|
|
347
406
|
* @param upgradeSettings - If true, merge new settings into existing settings.json
|
|
348
407
|
*/
|
|
349
|
-
export
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
if (sourceHelpersForUpgrade) {
|
|
375
|
-
const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs'];
|
|
376
|
-
for (const helperName of criticalHelpers) {
|
|
377
|
-
const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
378
|
-
const sourcePath = path.join(sourceHelpersForUpgrade, helperName);
|
|
379
|
-
if (fs.existsSync(sourcePath)) {
|
|
380
|
-
if (fs.existsSync(targetPath)) {
|
|
381
|
-
result.updated.push(`.claude/helpers/${helperName}`);
|
|
408
|
+
export function executeUpgrade(targetDir, upgradeSettings) {
|
|
409
|
+
if (upgradeSettings === void 0) { upgradeSettings = false; }
|
|
410
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
411
|
+
var result, dirs, _i, dirs_1, dir, fullPath, sourceHelpersForUpgrade, criticalHelpers, _a, criticalHelpers_1, helperName, targetPath, sourcePath, generatedCritical, _b, _c, _d, helperName, content, targetPath, statuslinePath, upgradeOptions, statuslineContent, metricsDir, securityDir, progressPath, progress, activityPath, activity, learningPath, learning, auditPath, audit, settingsPath, existingSettings, mergedSettings, defaultSettings;
|
|
412
|
+
return __generator(this, function (_e) {
|
|
413
|
+
result = {
|
|
414
|
+
success: true,
|
|
415
|
+
updated: [],
|
|
416
|
+
created: [],
|
|
417
|
+
preserved: [],
|
|
418
|
+
errors: [],
|
|
419
|
+
settingsUpdated: []
|
|
420
|
+
};
|
|
421
|
+
try {
|
|
422
|
+
dirs = [
|
|
423
|
+
'.claude/helpers',
|
|
424
|
+
'.claude-flow/metrics',
|
|
425
|
+
'.claude-flow/security',
|
|
426
|
+
'.claude-flow/learning',
|
|
427
|
+
];
|
|
428
|
+
for (_i = 0, dirs_1 = dirs; _i < dirs_1.length; _i++) {
|
|
429
|
+
dir = dirs_1[_i];
|
|
430
|
+
fullPath = path.join(targetDir, dir);
|
|
431
|
+
if (!fs.existsSync(fullPath)) {
|
|
432
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
382
433
|
}
|
|
383
|
-
|
|
384
|
-
|
|
434
|
+
}
|
|
435
|
+
sourceHelpersForUpgrade = findSourceHelpersDir();
|
|
436
|
+
if (sourceHelpersForUpgrade) {
|
|
437
|
+
criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs'];
|
|
438
|
+
for (_a = 0, criticalHelpers_1 = criticalHelpers; _a < criticalHelpers_1.length; _a++) {
|
|
439
|
+
helperName = criticalHelpers_1[_a];
|
|
440
|
+
targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
441
|
+
sourcePath = path.join(sourceHelpersForUpgrade, helperName);
|
|
442
|
+
if (fs.existsSync(sourcePath)) {
|
|
443
|
+
if (fs.existsSync(targetPath)) {
|
|
444
|
+
result.updated.push(".claude/helpers/" + helperName);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
result.created.push(".claude/helpers/" + helperName);
|
|
448
|
+
}
|
|
449
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
450
|
+
try {
|
|
451
|
+
fs.chmodSync(targetPath, '755');
|
|
452
|
+
}
|
|
453
|
+
catch (_f) { }
|
|
454
|
+
}
|
|
385
455
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
generatedCritical = {
|
|
459
|
+
'hook-handler.cjs': generateHookHandler(),
|
|
460
|
+
'intelligence.cjs': generateIntelligenceStub(),
|
|
461
|
+
'auto-memory-hook.mjs': generateAutoMemoryHook()
|
|
462
|
+
};
|
|
463
|
+
for (_b = 0, _c = Object.entries(generatedCritical); _b < _c.length; _b++) {
|
|
464
|
+
_d = _c[_b], helperName = _d[0], content = _d[1];
|
|
465
|
+
targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
466
|
+
if (fs.existsSync(targetPath)) {
|
|
467
|
+
result.updated.push(".claude/helpers/" + helperName);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
result.created.push(".claude/helpers/" + helperName);
|
|
471
|
+
}
|
|
472
|
+
fs.writeFileSync(targetPath, content, 'utf-8');
|
|
473
|
+
try {
|
|
474
|
+
fs.chmodSync(targetPath, '755');
|
|
475
|
+
}
|
|
476
|
+
catch (_g) { }
|
|
389
477
|
}
|
|
390
|
-
catch { }
|
|
391
478
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
'hook-handler.cjs': generateHookHandler(),
|
|
398
|
-
'intelligence.cjs': generateIntelligenceStub(),
|
|
399
|
-
'auto-memory-hook.mjs': generateAutoMemoryHook(),
|
|
400
|
-
};
|
|
401
|
-
for (const [helperName, content] of Object.entries(generatedCritical)) {
|
|
402
|
-
const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
403
|
-
if (fs.existsSync(targetPath)) {
|
|
404
|
-
result.updated.push(`.claude/helpers/${helperName}`);
|
|
479
|
+
statuslinePath = path.join(targetDir, '.claude', 'helpers', 'statusline.cjs');
|
|
480
|
+
upgradeOptions = __assign(__assign({}, DEFAULT_INIT_OPTIONS), { targetDir: targetDir, force: true, statusline: __assign(__assign({}, DEFAULT_INIT_OPTIONS.statusline), { refreshInterval: 5000 }) });
|
|
481
|
+
statuslineContent = generateStatuslineScript(upgradeOptions);
|
|
482
|
+
if (fs.existsSync(statuslinePath)) {
|
|
483
|
+
result.updated.push('.claude/helpers/statusline.cjs');
|
|
405
484
|
}
|
|
406
485
|
else {
|
|
407
|
-
result.created.push(
|
|
486
|
+
result.created.push('.claude/helpers/statusline.cjs');
|
|
408
487
|
}
|
|
409
|
-
fs.writeFileSync(
|
|
410
|
-
|
|
411
|
-
|
|
488
|
+
fs.writeFileSync(statuslinePath, statuslineContent, 'utf-8');
|
|
489
|
+
metricsDir = path.join(targetDir, '.claude-flow', 'metrics');
|
|
490
|
+
securityDir = path.join(targetDir, '.claude-flow', 'security');
|
|
491
|
+
progressPath = path.join(metricsDir, 'v3-progress.json');
|
|
492
|
+
if (!fs.existsSync(progressPath)) {
|
|
493
|
+
progress = {
|
|
494
|
+
version: '3.0.0',
|
|
495
|
+
initialized: new Date().toISOString(),
|
|
496
|
+
domains: { completed: 0, total: 5, status: 'INITIALIZING' },
|
|
497
|
+
ddd: { progress: 0, modules: 0, totalFiles: 0, totalLines: 0 },
|
|
498
|
+
swarm: { activeAgents: 0, maxAgents: 15, topology: 'hierarchical-mesh' },
|
|
499
|
+
learning: { status: 'READY', patternsLearned: 0, sessionsCompleted: 0 },
|
|
500
|
+
_note: 'Metrics will update as you use Ruflo'
|
|
501
|
+
};
|
|
502
|
+
fs.writeFileSync(progressPath, JSON.stringify(progress, null, 2), 'utf-8');
|
|
503
|
+
result.created.push('.claude-flow/metrics/v3-progress.json');
|
|
412
504
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
-
const activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
459
|
-
if (!fs.existsSync(activityPath)) {
|
|
460
|
-
const activity = {
|
|
461
|
-
timestamp: new Date().toISOString(),
|
|
462
|
-
processes: { agentic_flow: 0, mcp_server: 0, estimated_agents: 0 },
|
|
463
|
-
swarm: { active: false, agent_count: 0, coordination_active: false },
|
|
464
|
-
integration: { agentic_flow_active: false, mcp_active: false },
|
|
465
|
-
_initialized: true
|
|
466
|
-
};
|
|
467
|
-
fs.writeFileSync(activityPath, JSON.stringify(activity, null, 2), 'utf-8');
|
|
468
|
-
result.created.push('.claude-flow/metrics/swarm-activity.json');
|
|
469
|
-
}
|
|
470
|
-
else {
|
|
471
|
-
result.preserved.push('.claude-flow/metrics/swarm-activity.json');
|
|
472
|
-
}
|
|
473
|
-
// learning.json
|
|
474
|
-
const learningPath = path.join(metricsDir, 'learning.json');
|
|
475
|
-
if (!fs.existsSync(learningPath)) {
|
|
476
|
-
const learning = {
|
|
477
|
-
initialized: new Date().toISOString(),
|
|
478
|
-
routing: { accuracy: 0, decisions: 0 },
|
|
479
|
-
patterns: { shortTerm: 0, longTerm: 0, quality: 0 },
|
|
480
|
-
sessions: { total: 0, current: null },
|
|
481
|
-
_note: 'Intelligence grows as you use KynjalFlow'
|
|
482
|
-
};
|
|
483
|
-
fs.writeFileSync(learningPath, JSON.stringify(learning, null, 2), 'utf-8');
|
|
484
|
-
result.created.push('.claude-flow/metrics/learning.json');
|
|
485
|
-
}
|
|
486
|
-
else {
|
|
487
|
-
result.preserved.push('.claude-flow/metrics/learning.json');
|
|
488
|
-
}
|
|
489
|
-
// audit-status.json
|
|
490
|
-
const auditPath = path.join(securityDir, 'audit-status.json');
|
|
491
|
-
if (!fs.existsSync(auditPath)) {
|
|
492
|
-
const audit = {
|
|
493
|
-
initialized: new Date().toISOString(),
|
|
494
|
-
status: 'PENDING',
|
|
495
|
-
cvesFixed: 0,
|
|
496
|
-
totalCves: 3,
|
|
497
|
-
lastScan: null,
|
|
498
|
-
_note: 'Run: npx @kynjal/cli@latest security scan'
|
|
499
|
-
};
|
|
500
|
-
fs.writeFileSync(auditPath, JSON.stringify(audit, null, 2), 'utf-8');
|
|
501
|
-
result.created.push('.claude-flow/security/audit-status.json');
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
result.preserved.push('.claude-flow/security/audit-status.json');
|
|
505
|
-
}
|
|
506
|
-
// 3. Merge settings if requested
|
|
507
|
-
if (upgradeSettings) {
|
|
508
|
-
const settingsPath = path.join(targetDir, '.claude', 'settings.json');
|
|
509
|
-
if (fs.existsSync(settingsPath)) {
|
|
510
|
-
try {
|
|
511
|
-
const existingSettings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
512
|
-
const mergedSettings = mergeSettingsForUpgrade(existingSettings);
|
|
513
|
-
fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2), 'utf-8');
|
|
514
|
-
result.updated.push('.claude/settings.json');
|
|
515
|
-
result.settingsUpdated = [
|
|
516
|
-
'env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS',
|
|
517
|
-
'hooks.SessionStart (auto-memory import)',
|
|
518
|
-
'hooks.SessionEnd (auto-memory sync)',
|
|
519
|
-
'hooks.TeammateIdle',
|
|
520
|
-
'hooks.TaskCompleted',
|
|
521
|
-
'claudeFlow.agentTeams',
|
|
522
|
-
'claudeFlow.memory (learningBridge, memoryGraph, agentScopes)',
|
|
523
|
-
];
|
|
505
|
+
else {
|
|
506
|
+
result.preserved.push('.claude-flow/metrics/v3-progress.json');
|
|
507
|
+
}
|
|
508
|
+
activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
509
|
+
if (!fs.existsSync(activityPath)) {
|
|
510
|
+
activity = {
|
|
511
|
+
timestamp: new Date().toISOString(),
|
|
512
|
+
processes: { agentic_flow: 0, mcp_server: 0, estimated_agents: 0 },
|
|
513
|
+
swarm: { active: false, agent_count: 0, coordination_active: false },
|
|
514
|
+
integration: { agentic_flow_active: false, mcp_active: false },
|
|
515
|
+
_initialized: true
|
|
516
|
+
};
|
|
517
|
+
fs.writeFileSync(activityPath, JSON.stringify(activity, null, 2), 'utf-8');
|
|
518
|
+
result.created.push('.claude-flow/metrics/swarm-activity.json');
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
result.preserved.push('.claude-flow/metrics/swarm-activity.json');
|
|
522
|
+
}
|
|
523
|
+
learningPath = path.join(metricsDir, 'learning.json');
|
|
524
|
+
if (!fs.existsSync(learningPath)) {
|
|
525
|
+
learning = {
|
|
526
|
+
initialized: new Date().toISOString(),
|
|
527
|
+
routing: { accuracy: 0, decisions: 0 },
|
|
528
|
+
patterns: { shortTerm: 0, longTerm: 0, quality: 0 },
|
|
529
|
+
sessions: { total: 0, current: null },
|
|
530
|
+
_note: 'Intelligence grows as you use Ruflo'
|
|
531
|
+
};
|
|
532
|
+
fs.writeFileSync(learningPath, JSON.stringify(learning, null, 2), 'utf-8');
|
|
533
|
+
result.created.push('.claude-flow/metrics/learning.json');
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
result.preserved.push('.claude-flow/metrics/learning.json');
|
|
537
|
+
}
|
|
538
|
+
auditPath = path.join(securityDir, 'audit-status.json');
|
|
539
|
+
if (!fs.existsSync(auditPath)) {
|
|
540
|
+
audit = {
|
|
541
|
+
initialized: new Date().toISOString(),
|
|
542
|
+
status: 'PENDING',
|
|
543
|
+
cvesFixed: 0,
|
|
544
|
+
totalCves: 3,
|
|
545
|
+
lastScan: null,
|
|
546
|
+
_note: 'Run: npx @claude-flow/cli@latest security scan'
|
|
547
|
+
};
|
|
548
|
+
fs.writeFileSync(auditPath, JSON.stringify(audit, null, 2), 'utf-8');
|
|
549
|
+
result.created.push('.claude-flow/security/audit-status.json');
|
|
524
550
|
}
|
|
525
|
-
|
|
526
|
-
result.
|
|
551
|
+
else {
|
|
552
|
+
result.preserved.push('.claude-flow/security/audit-status.json');
|
|
553
|
+
}
|
|
554
|
+
// 3. Merge settings if requested
|
|
555
|
+
if (upgradeSettings) {
|
|
556
|
+
settingsPath = path.join(targetDir, '.claude', 'settings.json');
|
|
557
|
+
if (fs.existsSync(settingsPath)) {
|
|
558
|
+
try {
|
|
559
|
+
existingSettings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
560
|
+
mergedSettings = mergeSettingsForUpgrade(existingSettings);
|
|
561
|
+
fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2), 'utf-8');
|
|
562
|
+
result.updated.push('.claude/settings.json');
|
|
563
|
+
result.settingsUpdated = [
|
|
564
|
+
'env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS',
|
|
565
|
+
'hooks.SessionStart (auto-memory import)',
|
|
566
|
+
'hooks.SessionEnd (auto-memory sync)',
|
|
567
|
+
'hooks.TeammateIdle (removed — not a valid Claude Code hook)',
|
|
568
|
+
'hooks.TaskCompleted (removed — not a valid Claude Code hook)',
|
|
569
|
+
'claudeFlow.agentTeams',
|
|
570
|
+
'claudeFlow.memory (learningBridge, memoryGraph, agentScopes)',
|
|
571
|
+
];
|
|
572
|
+
}
|
|
573
|
+
catch (settingsError) {
|
|
574
|
+
result.errors.push("Settings merge failed: " + (settingsError instanceof Error ? settingsError.message : String(settingsError)));
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
defaultSettings = generateSettings(DEFAULT_INIT_OPTIONS);
|
|
579
|
+
fs.writeFileSync(settingsPath, JSON.stringify(defaultSettings, null, 2), 'utf-8');
|
|
580
|
+
result.created.push('.claude/settings.json');
|
|
581
|
+
result.settingsUpdated = ['Created new settings.json with Agent Teams'];
|
|
582
|
+
}
|
|
527
583
|
}
|
|
528
584
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
fs.writeFileSync(settingsPath, JSON.stringify(defaultSettings, null, 2), 'utf-8');
|
|
533
|
-
result.created.push('.claude/settings.json');
|
|
534
|
-
result.settingsUpdated = ['Created new settings.json with Agent Teams'];
|
|
585
|
+
catch (error) {
|
|
586
|
+
result.success = false;
|
|
587
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
535
588
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
result.success = false;
|
|
540
|
-
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
541
|
-
}
|
|
542
|
-
return result;
|
|
589
|
+
return [2 /*return*/, result];
|
|
590
|
+
});
|
|
591
|
+
});
|
|
543
592
|
}
|
|
544
593
|
/**
|
|
545
594
|
* Execute upgrade with --add-missing flag
|
|
@@ -547,308 +596,351 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
|
547
596
|
* @param targetDir - Target directory
|
|
548
597
|
* @param upgradeSettings - If true, merge new settings into existing settings.json
|
|
549
598
|
*/
|
|
550
|
-
export
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
// Ensure target directories exist
|
|
562
|
-
const skillsDir = path.join(targetDir, '.claude', 'skills');
|
|
563
|
-
const agentsDir = path.join(targetDir, '.claude', 'agents');
|
|
564
|
-
const commandsDir = path.join(targetDir, '.claude', 'commands');
|
|
565
|
-
for (const dir of [skillsDir, agentsDir, commandsDir]) {
|
|
566
|
-
if (!fs.existsSync(dir)) {
|
|
567
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
// Find source directories
|
|
571
|
-
const sourceSkillsDir = findSourceDir('skills');
|
|
572
|
-
const sourceAgentsDir = findSourceDir('agents');
|
|
573
|
-
const sourceCommandsDir = findSourceDir('commands');
|
|
574
|
-
// Debug: Log source directories found
|
|
575
|
-
if (process.env.DEBUG || process.env.CLAUDE_FLOW_DEBUG) {
|
|
576
|
-
console.log('[DEBUG] Source directories:');
|
|
577
|
-
console.log(` Skills: ${sourceSkillsDir || 'NOT FOUND'}`);
|
|
578
|
-
console.log(` Agents: ${sourceAgentsDir || 'NOT FOUND'}`);
|
|
579
|
-
console.log(` Commands: ${sourceCommandsDir || 'NOT FOUND'}`);
|
|
580
|
-
}
|
|
581
|
-
// Add missing skills
|
|
582
|
-
if (sourceSkillsDir) {
|
|
583
|
-
const allSkills = Object.values(SKILLS_MAP).flat();
|
|
584
|
-
const debugMode = process.env.DEBUG || process.env.CLAUDE_FLOW_DEBUG;
|
|
585
|
-
if (debugMode) {
|
|
586
|
-
console.log(`[DEBUG] Checking ${allSkills.length} skills from SKILLS_MAP`);
|
|
587
|
-
}
|
|
588
|
-
for (const skillName of [...new Set(allSkills)]) {
|
|
589
|
-
const sourcePath = path.join(sourceSkillsDir, skillName);
|
|
590
|
-
const targetPath = path.join(skillsDir, skillName);
|
|
591
|
-
const sourceExists = fs.existsSync(sourcePath);
|
|
592
|
-
const targetExists = fs.existsSync(targetPath);
|
|
593
|
-
if (debugMode) {
|
|
594
|
-
console.log(`[DEBUG] Skill '${skillName}': source=${sourceExists}, target=${targetExists}`);
|
|
595
|
-
}
|
|
596
|
-
if (sourceExists && !targetExists) {
|
|
597
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
598
|
-
result.addedSkills.push(skillName);
|
|
599
|
-
result.created.push(`.claude/skills/${skillName}`);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
// Add missing agents
|
|
604
|
-
if (sourceAgentsDir) {
|
|
605
|
-
const allAgents = Object.values(AGENTS_MAP).flat();
|
|
606
|
-
for (const agentCategory of [...new Set(allAgents)]) {
|
|
607
|
-
const sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
608
|
-
const targetPath = path.join(agentsDir, agentCategory);
|
|
609
|
-
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
610
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
611
|
-
result.addedAgents.push(agentCategory);
|
|
612
|
-
result.created.push(`.claude/agents/${agentCategory}`);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
// Add missing commands
|
|
617
|
-
if (sourceCommandsDir) {
|
|
618
|
-
const allCommands = Object.values(COMMANDS_MAP).flat();
|
|
619
|
-
for (const cmdName of [...new Set(allCommands)]) {
|
|
620
|
-
const sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
621
|
-
const targetPath = path.join(commandsDir, cmdName);
|
|
622
|
-
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
623
|
-
if (fs.statSync(sourcePath).isDirectory()) {
|
|
624
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
599
|
+
export function executeUpgradeWithMissing(targetDir, upgradeSettings) {
|
|
600
|
+
if (upgradeSettings === void 0) { upgradeSettings = false; }
|
|
601
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
602
|
+
var result, skillsDir, agentsDir, commandsDir, _i, _a, dir, sourceSkillsDir, sourceAgentsDir, sourceCommandsDir, allSkills, debugMode, _b, _c, skillName, sourcePath, targetPath, sourceExists, targetExists, allAgents, _d, _e, agentCategory, sourcePath, targetPath, allCommands, _f, _g, cmdName, sourcePath, targetPath;
|
|
603
|
+
return __generator(this, function (_h) {
|
|
604
|
+
switch (_h.label) {
|
|
605
|
+
case 0: return [4 /*yield*/, executeUpgrade(targetDir, upgradeSettings)];
|
|
606
|
+
case 1:
|
|
607
|
+
result = _h.sent();
|
|
608
|
+
if (!result.success) {
|
|
609
|
+
return [2 /*return*/, result];
|
|
625
610
|
}
|
|
626
|
-
|
|
627
|
-
|
|
611
|
+
// Initialize tracking arrays
|
|
612
|
+
result.addedSkills = [];
|
|
613
|
+
result.addedAgents = [];
|
|
614
|
+
result.addedCommands = [];
|
|
615
|
+
try {
|
|
616
|
+
skillsDir = path.join(targetDir, '.claude', 'skills');
|
|
617
|
+
agentsDir = path.join(targetDir, '.claude', 'agents');
|
|
618
|
+
commandsDir = path.join(targetDir, '.claude', 'commands');
|
|
619
|
+
for (_i = 0, _a = [skillsDir, agentsDir, commandsDir]; _i < _a.length; _i++) {
|
|
620
|
+
dir = _a[_i];
|
|
621
|
+
if (!fs.existsSync(dir)) {
|
|
622
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
sourceSkillsDir = findSourceDir('skills');
|
|
626
|
+
sourceAgentsDir = findSourceDir('agents');
|
|
627
|
+
sourceCommandsDir = findSourceDir('commands');
|
|
628
|
+
// Debug: Log source directories found
|
|
629
|
+
if (process.env.DEBUG || process.env.CLAUDE_FLOW_DEBUG) {
|
|
630
|
+
console.log('[DEBUG] Source directories:');
|
|
631
|
+
console.log(" Skills: " + (sourceSkillsDir || 'NOT FOUND'));
|
|
632
|
+
console.log(" Agents: " + (sourceAgentsDir || 'NOT FOUND'));
|
|
633
|
+
console.log(" Commands: " + (sourceCommandsDir || 'NOT FOUND'));
|
|
634
|
+
}
|
|
635
|
+
// Add missing skills
|
|
636
|
+
if (sourceSkillsDir) {
|
|
637
|
+
allSkills = Object.values(SKILLS_MAP).flat();
|
|
638
|
+
debugMode = process.env.DEBUG || process.env.CLAUDE_FLOW_DEBUG;
|
|
639
|
+
if (debugMode) {
|
|
640
|
+
console.log("[DEBUG] Checking " + allSkills.length + " skills from SKILLS_MAP");
|
|
641
|
+
}
|
|
642
|
+
for (_b = 0, _c = __spreadArray([], new Set(allSkills), true); _b < _c.length; _b++) {
|
|
643
|
+
skillName = _c[_b];
|
|
644
|
+
sourcePath = path.join(sourceSkillsDir, skillName);
|
|
645
|
+
targetPath = path.join(skillsDir, skillName);
|
|
646
|
+
sourceExists = fs.existsSync(sourcePath);
|
|
647
|
+
targetExists = fs.existsSync(targetPath);
|
|
648
|
+
if (debugMode) {
|
|
649
|
+
console.log("[DEBUG] Skill '" + skillName + "': source=" + sourceExists + ", target=" + targetExists);
|
|
650
|
+
}
|
|
651
|
+
if (sourceExists && !targetExists) {
|
|
652
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
653
|
+
result.addedSkills.push(skillName);
|
|
654
|
+
result.created.push(".claude/skills/" + skillName);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
// Add missing agents
|
|
659
|
+
if (sourceAgentsDir) {
|
|
660
|
+
allAgents = Object.values(AGENTS_MAP).flat();
|
|
661
|
+
for (_d = 0, _e = __spreadArray([], new Set(allAgents), true); _d < _e.length; _d++) {
|
|
662
|
+
agentCategory = _e[_d];
|
|
663
|
+
sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
664
|
+
targetPath = path.join(agentsDir, agentCategory);
|
|
665
|
+
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
666
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
667
|
+
result.addedAgents.push(agentCategory);
|
|
668
|
+
result.created.push(".claude/agents/" + agentCategory);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
// Add missing commands
|
|
673
|
+
if (sourceCommandsDir) {
|
|
674
|
+
allCommands = Object.values(COMMANDS_MAP).flat();
|
|
675
|
+
for (_f = 0, _g = __spreadArray([], new Set(allCommands), true); _f < _g.length; _f++) {
|
|
676
|
+
cmdName = _g[_f];
|
|
677
|
+
sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
678
|
+
targetPath = path.join(commandsDir, cmdName);
|
|
679
|
+
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
680
|
+
if (fs.statSync(sourcePath).isDirectory()) {
|
|
681
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
685
|
+
}
|
|
686
|
+
result.addedCommands.push(cmdName);
|
|
687
|
+
result.created.push(".claude/commands/" + cmdName);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
628
691
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
692
|
+
catch (error) {
|
|
693
|
+
result.errors.push("Add missing failed: " + (error instanceof Error ? error.message : String(error)));
|
|
694
|
+
}
|
|
695
|
+
return [2 /*return*/, result];
|
|
632
696
|
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
catch (error) {
|
|
636
|
-
result.errors.push(`Add missing failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
637
|
-
}
|
|
638
|
-
return result;
|
|
697
|
+
});
|
|
698
|
+
});
|
|
639
699
|
}
|
|
640
700
|
/**
|
|
641
701
|
* Create directory structure
|
|
642
702
|
*/
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
703
|
+
function createDirectories(targetDir, options, result) {
|
|
704
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
705
|
+
var dirs, _i, dirs_2, dir, fullPath;
|
|
706
|
+
return __generator(this, function (_a) {
|
|
707
|
+
dirs = __spreadArray(__spreadArray([], DIRECTORIES.claude, true), (options.components.runtime ? DIRECTORIES.runtime : []), true);
|
|
708
|
+
for (_i = 0, dirs_2 = dirs; _i < dirs_2.length; _i++) {
|
|
709
|
+
dir = dirs_2[_i];
|
|
710
|
+
fullPath = path.join(targetDir, dir);
|
|
711
|
+
if (!fs.existsSync(fullPath)) {
|
|
712
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
713
|
+
result.created.directories.push(dir);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return [2 /*return*/];
|
|
717
|
+
});
|
|
718
|
+
});
|
|
655
719
|
}
|
|
656
720
|
/**
|
|
657
721
|
* Write settings.json
|
|
658
722
|
*/
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
723
|
+
function writeSettings(targetDir, options, result) {
|
|
724
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
725
|
+
var settingsPath, content;
|
|
726
|
+
return __generator(this, function (_a) {
|
|
727
|
+
settingsPath = path.join(targetDir, '.claude', 'settings.json');
|
|
728
|
+
if (fs.existsSync(settingsPath) && !options.force) {
|
|
729
|
+
result.skipped.push('.claude/settings.json');
|
|
730
|
+
return [2 /*return*/];
|
|
731
|
+
}
|
|
732
|
+
content = generateSettingsJson(options);
|
|
733
|
+
fs.writeFileSync(settingsPath, content, 'utf-8');
|
|
734
|
+
result.created.files.push('.claude/settings.json');
|
|
735
|
+
return [2 /*return*/];
|
|
736
|
+
});
|
|
737
|
+
});
|
|
668
738
|
}
|
|
669
739
|
/**
|
|
670
740
|
* Write .mcp.json
|
|
671
741
|
*/
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
742
|
+
function writeMCPConfig(targetDir, options, result) {
|
|
743
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
744
|
+
var mcpPath, content;
|
|
745
|
+
return __generator(this, function (_a) {
|
|
746
|
+
mcpPath = path.join(targetDir, '.mcp.json');
|
|
747
|
+
if (fs.existsSync(mcpPath) && !options.force) {
|
|
748
|
+
result.skipped.push('.mcp.json');
|
|
749
|
+
return [2 /*return*/];
|
|
750
|
+
}
|
|
751
|
+
content = generateMCPJson(options);
|
|
752
|
+
fs.writeFileSync(mcpPath, content, 'utf-8');
|
|
753
|
+
result.created.files.push('.mcp.json');
|
|
754
|
+
return [2 /*return*/];
|
|
755
|
+
});
|
|
756
|
+
});
|
|
681
757
|
}
|
|
682
758
|
/**
|
|
683
759
|
* Copy skills from source
|
|
684
760
|
*/
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
if (skillsConfig.core)
|
|
696
|
-
skillsToCopy.push(...SKILLS_MAP.core);
|
|
697
|
-
if (skillsConfig.agentdb)
|
|
698
|
-
skillsToCopy.push(...SKILLS_MAP.agentdb);
|
|
699
|
-
if (skillsConfig.github)
|
|
700
|
-
skillsToCopy.push(...SKILLS_MAP.github);
|
|
701
|
-
if (skillsConfig.flowNexus)
|
|
702
|
-
skillsToCopy.push(...SKILLS_MAP.flowNexus);
|
|
703
|
-
if (skillsConfig.browser)
|
|
704
|
-
skillsToCopy.push(...SKILLS_MAP.browser);
|
|
705
|
-
if (skillsConfig.v3)
|
|
706
|
-
skillsToCopy.push(...SKILLS_MAP.v3);
|
|
707
|
-
if (skillsConfig.dualMode)
|
|
708
|
-
skillsToCopy.push(...SKILLS_MAP.dualMode);
|
|
709
|
-
}
|
|
710
|
-
// Find source skills directory
|
|
711
|
-
const sourceSkillsDir = findSourceDir('skills', options.sourceBaseDir);
|
|
712
|
-
if (!sourceSkillsDir) {
|
|
713
|
-
result.errors.push('Could not find source skills directory');
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
// Copy each skill
|
|
717
|
-
for (const skillName of [...new Set(skillsToCopy)]) {
|
|
718
|
-
const sourcePath = path.join(sourceSkillsDir, skillName);
|
|
719
|
-
const targetPath = path.join(targetSkillsDir, skillName);
|
|
720
|
-
if (fs.existsSync(sourcePath)) {
|
|
721
|
-
if (!fs.existsSync(targetPath) || options.force) {
|
|
722
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
723
|
-
result.created.files.push(`.claude/skills/${skillName}`);
|
|
724
|
-
result.summary.skillsCount++;
|
|
761
|
+
function copySkills(targetDir, options, result) {
|
|
762
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
763
|
+
var skillsConfig, targetSkillsDir, skillsToCopy, sourceSkillsDir, _i, _a, skillName, sourcePath, targetPath;
|
|
764
|
+
return __generator(this, function (_b) {
|
|
765
|
+
skillsConfig = options.skills;
|
|
766
|
+
targetSkillsDir = path.join(targetDir, '.claude', 'skills');
|
|
767
|
+
skillsToCopy = [];
|
|
768
|
+
if (skillsConfig.all) {
|
|
769
|
+
// Copy all available skills
|
|
770
|
+
Object.values(SKILLS_MAP).forEach(function (skills) { return skillsToCopy.push.apply(skillsToCopy, skills); });
|
|
725
771
|
}
|
|
726
772
|
else {
|
|
727
|
-
|
|
773
|
+
if (skillsConfig.core)
|
|
774
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.core);
|
|
775
|
+
if (skillsConfig.agentdb)
|
|
776
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.agentdb);
|
|
777
|
+
if (skillsConfig.github)
|
|
778
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.github);
|
|
779
|
+
if (skillsConfig.flowNexus)
|
|
780
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.flowNexus);
|
|
781
|
+
if (skillsConfig.browser)
|
|
782
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.browser);
|
|
783
|
+
if (skillsConfig.v3)
|
|
784
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.v3);
|
|
785
|
+
if (skillsConfig.dualMode)
|
|
786
|
+
skillsToCopy.push.apply(skillsToCopy, SKILLS_MAP.dualMode);
|
|
787
|
+
if (skillsConfig.design)
|
|
788
|
+
skillsToCopy.push.apply(skillsToCopy, (SKILLS_MAP.design || []));
|
|
728
789
|
}
|
|
729
|
-
|
|
730
|
-
|
|
790
|
+
sourceSkillsDir = findSourceDir('skills', options.sourceBaseDir);
|
|
791
|
+
if (!sourceSkillsDir) {
|
|
792
|
+
result.errors.push('Could not find source skills directory');
|
|
793
|
+
return [2 /*return*/];
|
|
794
|
+
}
|
|
795
|
+
// Copy each skill
|
|
796
|
+
for (_i = 0, _a = __spreadArray([], new Set(skillsToCopy), true); _i < _a.length; _i++) {
|
|
797
|
+
skillName = _a[_i];
|
|
798
|
+
sourcePath = path.join(sourceSkillsDir, skillName);
|
|
799
|
+
targetPath = path.join(targetSkillsDir, skillName);
|
|
800
|
+
if (fs.existsSync(sourcePath)) {
|
|
801
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
802
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
803
|
+
result.created.files.push(".claude/skills/" + skillName);
|
|
804
|
+
result.summary.skillsCount++;
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
result.skipped.push(".claude/skills/" + skillName);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return [2 /*return*/];
|
|
812
|
+
});
|
|
813
|
+
});
|
|
731
814
|
}
|
|
732
815
|
/**
|
|
733
816
|
* Copy commands from source
|
|
734
817
|
*/
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
if (commandsConfig.core)
|
|
745
|
-
commandsToCopy.push(...COMMANDS_MAP.core);
|
|
746
|
-
if (commandsConfig.analysis)
|
|
747
|
-
commandsToCopy.push(...COMMANDS_MAP.analysis);
|
|
748
|
-
if (commandsConfig.automation)
|
|
749
|
-
commandsToCopy.push(...COMMANDS_MAP.automation);
|
|
750
|
-
if (commandsConfig.github)
|
|
751
|
-
commandsToCopy.push(...COMMANDS_MAP.github);
|
|
752
|
-
if (commandsConfig.hooks)
|
|
753
|
-
commandsToCopy.push(...COMMANDS_MAP.hooks);
|
|
754
|
-
if (commandsConfig.monitoring)
|
|
755
|
-
commandsToCopy.push(...COMMANDS_MAP.monitoring);
|
|
756
|
-
if (commandsConfig.optimization)
|
|
757
|
-
commandsToCopy.push(...COMMANDS_MAP.optimization);
|
|
758
|
-
if (commandsConfig.sparc)
|
|
759
|
-
commandsToCopy.push(...COMMANDS_MAP.sparc);
|
|
760
|
-
}
|
|
761
|
-
// Find source commands directory
|
|
762
|
-
const sourceCommandsDir = findSourceDir('commands', options.sourceBaseDir);
|
|
763
|
-
if (!sourceCommandsDir) {
|
|
764
|
-
result.errors.push('Could not find source commands directory');
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
// Copy each command/directory
|
|
768
|
-
for (const cmdName of [...new Set(commandsToCopy)]) {
|
|
769
|
-
const sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
770
|
-
const targetPath = path.join(targetCommandsDir, cmdName);
|
|
771
|
-
if (fs.existsSync(sourcePath)) {
|
|
772
|
-
if (!fs.existsSync(targetPath) || options.force) {
|
|
773
|
-
if (fs.statSync(sourcePath).isDirectory()) {
|
|
774
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
775
|
-
}
|
|
776
|
-
else {
|
|
777
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
778
|
-
}
|
|
779
|
-
result.created.files.push(`.claude/commands/${cmdName}`);
|
|
780
|
-
result.summary.commandsCount++;
|
|
818
|
+
function copyCommands(targetDir, options, result) {
|
|
819
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
820
|
+
var commandsConfig, targetCommandsDir, commandsToCopy, sourceCommandsDir, _i, _a, cmdName, sourcePath, targetPath;
|
|
821
|
+
return __generator(this, function (_b) {
|
|
822
|
+
commandsConfig = options.commands;
|
|
823
|
+
targetCommandsDir = path.join(targetDir, '.claude', 'commands');
|
|
824
|
+
commandsToCopy = [];
|
|
825
|
+
if (commandsConfig.all) {
|
|
826
|
+
Object.values(COMMANDS_MAP).forEach(function (cmds) { return commandsToCopy.push.apply(commandsToCopy, cmds); });
|
|
781
827
|
}
|
|
782
828
|
else {
|
|
783
|
-
|
|
829
|
+
if (commandsConfig.core)
|
|
830
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.core);
|
|
831
|
+
if (commandsConfig.analysis)
|
|
832
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.analysis);
|
|
833
|
+
if (commandsConfig.automation)
|
|
834
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.automation);
|
|
835
|
+
if (commandsConfig.github)
|
|
836
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.github);
|
|
837
|
+
if (commandsConfig.hooks)
|
|
838
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.hooks);
|
|
839
|
+
if (commandsConfig.monitoring)
|
|
840
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.monitoring);
|
|
841
|
+
if (commandsConfig.optimization)
|
|
842
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.optimization);
|
|
843
|
+
if (commandsConfig.sparc)
|
|
844
|
+
commandsToCopy.push.apply(commandsToCopy, COMMANDS_MAP.sparc);
|
|
784
845
|
}
|
|
785
|
-
|
|
786
|
-
|
|
846
|
+
sourceCommandsDir = findSourceDir('commands', options.sourceBaseDir);
|
|
847
|
+
if (!sourceCommandsDir) {
|
|
848
|
+
result.errors.push('Could not find source commands directory');
|
|
849
|
+
return [2 /*return*/];
|
|
850
|
+
}
|
|
851
|
+
// Copy each command/directory
|
|
852
|
+
for (_i = 0, _a = __spreadArray([], new Set(commandsToCopy), true); _i < _a.length; _i++) {
|
|
853
|
+
cmdName = _a[_i];
|
|
854
|
+
sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
855
|
+
targetPath = path.join(targetCommandsDir, cmdName);
|
|
856
|
+
if (fs.existsSync(sourcePath)) {
|
|
857
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
858
|
+
if (fs.statSync(sourcePath).isDirectory()) {
|
|
859
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
863
|
+
}
|
|
864
|
+
result.created.files.push(".claude/commands/" + cmdName);
|
|
865
|
+
result.summary.commandsCount++;
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
result.skipped.push(".claude/commands/" + cmdName);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return [2 /*return*/];
|
|
873
|
+
});
|
|
874
|
+
});
|
|
787
875
|
}
|
|
788
876
|
/**
|
|
789
877
|
* Copy agents from source
|
|
790
878
|
*/
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (agentsConfig.core)
|
|
801
|
-
agentsToCopy.push(...AGENTS_MAP.core);
|
|
802
|
-
if (agentsConfig.consensus)
|
|
803
|
-
agentsToCopy.push(...AGENTS_MAP.consensus);
|
|
804
|
-
if (agentsConfig.github)
|
|
805
|
-
agentsToCopy.push(...AGENTS_MAP.github);
|
|
806
|
-
if (agentsConfig.hiveMind)
|
|
807
|
-
agentsToCopy.push(...AGENTS_MAP.hiveMind);
|
|
808
|
-
if (agentsConfig.sparc)
|
|
809
|
-
agentsToCopy.push(...AGENTS_MAP.sparc);
|
|
810
|
-
if (agentsConfig.swarm)
|
|
811
|
-
agentsToCopy.push(...AGENTS_MAP.swarm);
|
|
812
|
-
if (agentsConfig.browser)
|
|
813
|
-
agentsToCopy.push(...AGENTS_MAP.browser);
|
|
814
|
-
// V3-specific agent categories
|
|
815
|
-
if (agentsConfig.v3)
|
|
816
|
-
agentsToCopy.push(...(AGENTS_MAP.v3 || []));
|
|
817
|
-
if (agentsConfig.optimization)
|
|
818
|
-
agentsToCopy.push(...(AGENTS_MAP.optimization || []));
|
|
819
|
-
if (agentsConfig.testing)
|
|
820
|
-
agentsToCopy.push(...(AGENTS_MAP.testing || []));
|
|
821
|
-
// Dual-mode agents (Claude Code + Codex hybrid)
|
|
822
|
-
if (agentsConfig.dualMode)
|
|
823
|
-
agentsToCopy.push(...(AGENTS_MAP.dualMode || []));
|
|
824
|
-
// Custom agents (always included)
|
|
825
|
-
if (agentsConfig.custom !== false)
|
|
826
|
-
agentsToCopy.push(...(AGENTS_MAP.custom || []));
|
|
827
|
-
}
|
|
828
|
-
// Find source agents directory
|
|
829
|
-
const sourceAgentsDir = findSourceDir('agents', options.sourceBaseDir);
|
|
830
|
-
if (!sourceAgentsDir) {
|
|
831
|
-
result.errors.push('Could not find source agents directory');
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
// Copy each agent category
|
|
835
|
-
for (const agentCategory of [...new Set(agentsToCopy)]) {
|
|
836
|
-
const sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
837
|
-
const targetPath = path.join(targetAgentsDir, agentCategory);
|
|
838
|
-
if (fs.existsSync(sourcePath)) {
|
|
839
|
-
if (!fs.existsSync(targetPath) || options.force) {
|
|
840
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
841
|
-
// Count agent files (.yaml and .md)
|
|
842
|
-
const yamlFiles = countFiles(sourcePath, '.yaml');
|
|
843
|
-
const mdFiles = countFiles(sourcePath, '.md');
|
|
844
|
-
result.summary.agentsCount += yamlFiles + mdFiles;
|
|
845
|
-
result.created.files.push(`.claude/agents/${agentCategory}`);
|
|
879
|
+
function copyAgents(targetDir, options, result) {
|
|
880
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
881
|
+
var agentsConfig, targetAgentsDir, agentsToCopy, sourceAgentsDir, _i, _a, agentCategory, sourcePath, targetPath, yamlFiles, mdFiles;
|
|
882
|
+
return __generator(this, function (_b) {
|
|
883
|
+
agentsConfig = options.agents;
|
|
884
|
+
targetAgentsDir = path.join(targetDir, '.claude', 'agents');
|
|
885
|
+
agentsToCopy = [];
|
|
886
|
+
if (agentsConfig.all) {
|
|
887
|
+
Object.values(AGENTS_MAP).forEach(function (agents) { return agentsToCopy.push.apply(agentsToCopy, agents); });
|
|
846
888
|
}
|
|
847
889
|
else {
|
|
848
|
-
|
|
890
|
+
if (agentsConfig.core)
|
|
891
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.core);
|
|
892
|
+
if (agentsConfig.consensus)
|
|
893
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.consensus);
|
|
894
|
+
if (agentsConfig.github)
|
|
895
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.github);
|
|
896
|
+
if (agentsConfig.hiveMind)
|
|
897
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.hiveMind);
|
|
898
|
+
if (agentsConfig.sparc)
|
|
899
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.sparc);
|
|
900
|
+
if (agentsConfig.swarm)
|
|
901
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.swarm);
|
|
902
|
+
if (agentsConfig.browser)
|
|
903
|
+
agentsToCopy.push.apply(agentsToCopy, AGENTS_MAP.browser);
|
|
904
|
+
// V3-specific agent categories
|
|
905
|
+
if (agentsConfig.v3)
|
|
906
|
+
agentsToCopy.push.apply(agentsToCopy, (AGENTS_MAP.v3 || []));
|
|
907
|
+
if (agentsConfig.optimization)
|
|
908
|
+
agentsToCopy.push.apply(agentsToCopy, (AGENTS_MAP.optimization || []));
|
|
909
|
+
if (agentsConfig.testing)
|
|
910
|
+
agentsToCopy.push.apply(agentsToCopy, (AGENTS_MAP.testing || []));
|
|
911
|
+
// Design agents (design-architect, ux-researcher, ui-developer, accessibility-auditor)
|
|
912
|
+
if (agentsConfig.design)
|
|
913
|
+
agentsToCopy.push.apply(agentsToCopy, (AGENTS_MAP.design || []));
|
|
914
|
+
// Dual-mode agents (Claude Code + Codex hybrid)
|
|
915
|
+
if (agentsConfig.dualMode)
|
|
916
|
+
agentsToCopy.push.apply(agentsToCopy, (AGENTS_MAP.dualMode || []));
|
|
849
917
|
}
|
|
850
|
-
|
|
851
|
-
|
|
918
|
+
sourceAgentsDir = findSourceDir('agents', options.sourceBaseDir);
|
|
919
|
+
if (!sourceAgentsDir) {
|
|
920
|
+
result.errors.push('Could not find source agents directory');
|
|
921
|
+
return [2 /*return*/];
|
|
922
|
+
}
|
|
923
|
+
// Copy each agent category
|
|
924
|
+
for (_i = 0, _a = __spreadArray([], new Set(agentsToCopy), true); _i < _a.length; _i++) {
|
|
925
|
+
agentCategory = _a[_i];
|
|
926
|
+
sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
927
|
+
targetPath = path.join(targetAgentsDir, agentCategory);
|
|
928
|
+
if (fs.existsSync(sourcePath)) {
|
|
929
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
930
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
931
|
+
yamlFiles = countFiles(sourcePath, '.yaml');
|
|
932
|
+
mdFiles = countFiles(sourcePath, '.md');
|
|
933
|
+
result.summary.agentsCount += yamlFiles + mdFiles;
|
|
934
|
+
result.created.files.push(".claude/agents/" + agentCategory);
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
result.skipped.push(".claude/agents/" + agentCategory);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return [2 /*return*/];
|
|
942
|
+
});
|
|
943
|
+
});
|
|
852
944
|
}
|
|
853
945
|
/**
|
|
854
946
|
* Find source helpers directory.
|
|
@@ -856,45 +948,46 @@ async function copyAgents(targetDir, options, result) {
|
|
|
856
948
|
* returning the target directory or an incomplete source.
|
|
857
949
|
*/
|
|
858
950
|
function findSourceHelpersDir(sourceBaseDir) {
|
|
859
|
-
|
|
860
|
-
|
|
951
|
+
var possiblePaths = [];
|
|
952
|
+
var SENTINEL_FILE = 'hook-handler.cjs'; // Must exist in valid source
|
|
861
953
|
// If explicit source base directory is provided, check it first
|
|
862
954
|
if (sourceBaseDir) {
|
|
863
955
|
possiblePaths.push(path.join(sourceBaseDir, '.claude', 'helpers'));
|
|
864
956
|
}
|
|
865
957
|
// Strategy 1: require.resolve to find package root (most reliable for npx)
|
|
866
958
|
try {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
959
|
+
var esmRequire = createRequire(import.meta.url);
|
|
960
|
+
var pkgJsonPath = esmRequire.resolve('@claude-flow/cli/package.json');
|
|
961
|
+
var pkgRoot = path.dirname(pkgJsonPath);
|
|
870
962
|
possiblePaths.push(path.join(pkgRoot, '.claude', 'helpers'));
|
|
871
963
|
}
|
|
872
|
-
catch {
|
|
964
|
+
catch (_a) {
|
|
873
965
|
// Not installed as a package — skip
|
|
874
966
|
}
|
|
875
967
|
// Strategy 2: __dirname-based (dist/src/init -> package root)
|
|
876
|
-
|
|
877
|
-
|
|
968
|
+
var packageRoot = path.resolve(__dirname, '..', '..', '..');
|
|
969
|
+
var packageHelpers = path.join(packageRoot, '.claude', 'helpers');
|
|
878
970
|
possiblePaths.push(packageHelpers);
|
|
879
971
|
// Strategy 3: Walk up from __dirname looking for package root
|
|
880
|
-
|
|
881
|
-
for (
|
|
882
|
-
|
|
972
|
+
var currentDir = __dirname;
|
|
973
|
+
for (var i = 0; i < 10; i++) {
|
|
974
|
+
var parentDir = path.dirname(currentDir);
|
|
883
975
|
if (parentDir === currentDir)
|
|
884
976
|
break; // hit filesystem root
|
|
885
|
-
|
|
977
|
+
var helpersPath = path.join(parentDir, '.claude', 'helpers');
|
|
886
978
|
possiblePaths.push(helpersPath);
|
|
887
979
|
currentDir = parentDir;
|
|
888
980
|
}
|
|
889
981
|
// Strategy 4: Check cwd-relative paths (for local dev)
|
|
890
|
-
|
|
982
|
+
var cwdBased = [
|
|
891
983
|
path.join(process.cwd(), '.claude', 'helpers'),
|
|
892
984
|
path.join(process.cwd(), '..', '.claude', 'helpers'),
|
|
893
985
|
path.join(process.cwd(), '..', '..', '.claude', 'helpers'),
|
|
894
986
|
];
|
|
895
|
-
possiblePaths.push(
|
|
987
|
+
possiblePaths.push.apply(possiblePaths, cwdBased);
|
|
896
988
|
// Return first path that exists AND contains the sentinel file
|
|
897
|
-
for (
|
|
989
|
+
for (var _i = 0, possiblePaths_1 = possiblePaths; _i < possiblePaths_1.length; _i++) {
|
|
990
|
+
var p = possiblePaths_1[_i];
|
|
898
991
|
if (fs.existsSync(p) && fs.existsSync(path.join(p, SENTINEL_FILE))) {
|
|
899
992
|
return p;
|
|
900
993
|
}
|
|
@@ -904,90 +997,97 @@ function findSourceHelpersDir(sourceBaseDir) {
|
|
|
904
997
|
/**
|
|
905
998
|
* Write helper scripts
|
|
906
999
|
*/
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1000
|
+
function writeHelpers(targetDir, options, result) {
|
|
1001
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
1002
|
+
var helpersDir, sourceHelpersDir, helperFiles, copiedCount, _i, helperFiles_1, file, sourcePath, destPath, helpers, _a, _b, _c, name, content, filePath;
|
|
1003
|
+
return __generator(this, function (_d) {
|
|
1004
|
+
helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
1005
|
+
sourceHelpersDir = findSourceHelpersDir(options.sourceBaseDir);
|
|
1006
|
+
// Try to copy existing helpers from source first
|
|
1007
|
+
if (sourceHelpersDir && fs.existsSync(sourceHelpersDir)) {
|
|
1008
|
+
helperFiles = fs.readdirSync(sourceHelpersDir);
|
|
1009
|
+
copiedCount = 0;
|
|
1010
|
+
for (_i = 0, helperFiles_1 = helperFiles; _i < helperFiles_1.length; _i++) {
|
|
1011
|
+
file = helperFiles_1[_i];
|
|
1012
|
+
sourcePath = path.join(sourceHelpersDir, file);
|
|
1013
|
+
destPath = path.join(helpersDir, file);
|
|
1014
|
+
// Skip directories and only copy files
|
|
1015
|
+
if (!fs.statSync(sourcePath).isFile())
|
|
1016
|
+
continue;
|
|
1017
|
+
if (!fs.existsSync(destPath) || options.force) {
|
|
1018
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
1019
|
+
// Make shell scripts and mjs files executable
|
|
1020
|
+
if (file.endsWith('.sh') || file.endsWith('.mjs')) {
|
|
1021
|
+
fs.chmodSync(destPath, '755');
|
|
1022
|
+
}
|
|
1023
|
+
result.created.files.push(".claude/helpers/" + file);
|
|
1024
|
+
copiedCount++;
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
result.skipped.push(".claude/helpers/" + file);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (copiedCount > 0) {
|
|
1031
|
+
return [2 /*return*/]; // Skip generating if we copied from source
|
|
926
1032
|
}
|
|
927
|
-
result.created.files.push(`.claude/helpers/${file}`);
|
|
928
|
-
copiedCount++;
|
|
929
|
-
}
|
|
930
|
-
else {
|
|
931
|
-
result.skipped.push(`.claude/helpers/${file}`);
|
|
932
1033
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1034
|
+
helpers = {
|
|
1035
|
+
'pre-commit': generatePreCommitHook(),
|
|
1036
|
+
'post-commit': generatePostCommitHook(),
|
|
1037
|
+
'session.js': generateSessionManager(),
|
|
1038
|
+
'router.js': generateAgentRouter(),
|
|
1039
|
+
'memory.js': generateMemoryHelper(),
|
|
1040
|
+
'hook-handler.cjs': generateHookHandler(),
|
|
1041
|
+
'intelligence.cjs': generateIntelligenceStub(),
|
|
1042
|
+
'auto-memory-hook.mjs': generateAutoMemoryHook()
|
|
1043
|
+
};
|
|
1044
|
+
for (_a = 0, _b = Object.entries(helpers); _a < _b.length; _a++) {
|
|
1045
|
+
_c = _b[_a], name = _c[0], content = _c[1];
|
|
1046
|
+
filePath = path.join(helpersDir, name);
|
|
1047
|
+
if (!fs.existsSync(filePath) || options.force) {
|
|
1048
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
1049
|
+
// Make shell scripts executable
|
|
1050
|
+
if (!name.endsWith('.js')) {
|
|
1051
|
+
fs.chmodSync(filePath, '755');
|
|
1052
|
+
}
|
|
1053
|
+
result.created.files.push(".claude/helpers/" + name);
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
result.skipped.push(".claude/helpers/" + name);
|
|
1057
|
+
}
|
|
956
1058
|
}
|
|
957
|
-
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
result.skipped.push(`.claude/helpers/${name}`);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
1059
|
+
return [2 /*return*/];
|
|
1060
|
+
});
|
|
1061
|
+
});
|
|
963
1062
|
}
|
|
964
1063
|
/**
|
|
965
1064
|
* Find source .claude directory for statusline files
|
|
966
1065
|
*/
|
|
967
1066
|
function findSourceClaudeDir(sourceBaseDir) {
|
|
968
|
-
|
|
1067
|
+
var possiblePaths = [];
|
|
969
1068
|
// If explicit source base directory is provided, check it first
|
|
970
1069
|
if (sourceBaseDir) {
|
|
971
1070
|
possiblePaths.push(path.join(sourceBaseDir, '.claude'));
|
|
972
1071
|
}
|
|
973
1072
|
// IMPORTANT: Check the package's own .claude directory
|
|
974
1073
|
// Go up 3 levels: dist/src/init -> dist/src -> dist -> root
|
|
975
|
-
|
|
976
|
-
|
|
1074
|
+
var packageRoot = path.resolve(__dirname, '..', '..', '..');
|
|
1075
|
+
var packageClaude = path.join(packageRoot, '.claude');
|
|
977
1076
|
if (fs.existsSync(packageClaude)) {
|
|
978
1077
|
possiblePaths.unshift(packageClaude); // Add to beginning (highest priority)
|
|
979
1078
|
}
|
|
980
1079
|
// From dist/src/init -> go up to project root
|
|
981
|
-
|
|
982
|
-
for (
|
|
983
|
-
|
|
984
|
-
|
|
1080
|
+
var currentDir = __dirname;
|
|
1081
|
+
for (var i = 0; i < 10; i++) {
|
|
1082
|
+
var parentDir = path.dirname(currentDir);
|
|
1083
|
+
var claudePath = path.join(parentDir, '.claude');
|
|
985
1084
|
if (fs.existsSync(claudePath)) {
|
|
986
1085
|
possiblePaths.push(claudePath);
|
|
987
1086
|
}
|
|
988
1087
|
currentDir = parentDir;
|
|
989
1088
|
}
|
|
990
|
-
for (
|
|
1089
|
+
for (var _i = 0, possiblePaths_2 = possiblePaths; _i < possiblePaths_2.length; _i++) {
|
|
1090
|
+
var p = possiblePaths_2[_i];
|
|
991
1091
|
if (fs.existsSync(p)) {
|
|
992
1092
|
return p;
|
|
993
1093
|
}
|
|
@@ -997,664 +1097,235 @@ function findSourceClaudeDir(sourceBaseDir) {
|
|
|
997
1097
|
/**
|
|
998
1098
|
* Write statusline configuration
|
|
999
1099
|
*/
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
fs.
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1100
|
+
function writeStatusline(targetDir, options, result) {
|
|
1101
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
1102
|
+
var claudeDir, helpersDir, sourceClaudeDir, advancedStatuslineFiles, _i, advancedStatuslineFiles_1, file, sourcePath, destPath, statuslineScript, statuslinePath;
|
|
1103
|
+
return __generator(this, function (_a) {
|
|
1104
|
+
claudeDir = path.join(targetDir, '.claude');
|
|
1105
|
+
helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
1106
|
+
sourceClaudeDir = findSourceClaudeDir(options.sourceBaseDir);
|
|
1107
|
+
advancedStatuslineFiles = [
|
|
1108
|
+
{ src: 'statusline.sh', dest: 'statusline.sh', dir: claudeDir },
|
|
1109
|
+
{ src: 'statusline.mjs', dest: 'statusline.mjs', dir: claudeDir },
|
|
1110
|
+
];
|
|
1111
|
+
if (sourceClaudeDir) {
|
|
1112
|
+
for (_i = 0, advancedStatuslineFiles_1 = advancedStatuslineFiles; _i < advancedStatuslineFiles_1.length; _i++) {
|
|
1113
|
+
file = advancedStatuslineFiles_1[_i];
|
|
1114
|
+
sourcePath = path.join(sourceClaudeDir, file.src);
|
|
1115
|
+
destPath = path.join(file.dir, file.dest);
|
|
1116
|
+
if (fs.existsSync(sourcePath)) {
|
|
1117
|
+
if (!fs.existsSync(destPath) || options.force) {
|
|
1118
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
1119
|
+
// Make shell scripts and mjs executable
|
|
1120
|
+
if (file.src.endsWith('.sh') || file.src.endsWith('.mjs')) {
|
|
1121
|
+
fs.chmodSync(destPath, '755');
|
|
1122
|
+
}
|
|
1123
|
+
result.created.files.push(".claude/" + file.dest);
|
|
1124
|
+
}
|
|
1125
|
+
else {
|
|
1126
|
+
result.skipped.push(".claude/" + file.dest);
|
|
1127
|
+
}
|
|
1020
1128
|
}
|
|
1021
|
-
result.created.files.push(`.claude/${file.dest}`);
|
|
1022
|
-
}
|
|
1023
|
-
else {
|
|
1024
|
-
result.skipped.push(`.claude/${file.dest}`);
|
|
1025
1129
|
}
|
|
1026
1130
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
fs.writeFileSync(statuslinePath, statuslineScript, 'utf-8');
|
|
1035
|
-
result.created.files.push('.claude/helpers/statusline.cjs');
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1038
|
-
result.skipped.push('.claude/helpers/statusline.cjs');
|
|
1039
|
-
}
|
|
1131
|
+
statuslineScript = generateStatuslineScript(options);
|
|
1132
|
+
statuslinePath = path.join(helpersDir, 'statusline.cjs');
|
|
1133
|
+
fs.writeFileSync(statuslinePath, statuslineScript, 'utf-8');
|
|
1134
|
+
result.created.files.push('.claude/helpers/statusline.cjs');
|
|
1135
|
+
return [2 /*return*/];
|
|
1136
|
+
});
|
|
1137
|
+
});
|
|
1040
1138
|
}
|
|
1041
1139
|
/**
|
|
1042
1140
|
* Write runtime configuration (.claude-flow/)
|
|
1043
1141
|
*/
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
return
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
topology:
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
enabled: ${options.runtime.enableMemoryGraph ?? true}
|
|
1075
|
-
pageRankDamping: 0.85
|
|
1076
|
-
maxNodes: 5000
|
|
1077
|
-
similarityThreshold: 0.8
|
|
1078
|
-
agentScopes:
|
|
1079
|
-
enabled: ${options.runtime.enableAgentScopes ?? true}
|
|
1080
|
-
defaultScope: project
|
|
1081
|
-
|
|
1082
|
-
neural:
|
|
1083
|
-
enabled: ${options.runtime.enableNeural}
|
|
1084
|
-
modelPath: .claude-flow/neural
|
|
1085
|
-
|
|
1086
|
-
hooks:
|
|
1087
|
-
enabled: true
|
|
1088
|
-
autoExecute: true
|
|
1089
|
-
|
|
1090
|
-
mcp:
|
|
1091
|
-
autoStart: ${options.mcp.autoStart}
|
|
1092
|
-
port: ${options.mcp.port}
|
|
1093
|
-
`;
|
|
1094
|
-
fs.writeFileSync(configPath, config, 'utf-8');
|
|
1095
|
-
result.created.files.push('.claude-flow/config.yaml');
|
|
1096
|
-
// Write .gitignore
|
|
1097
|
-
const gitignorePath = path.join(targetDir, '.claude-flow', '.gitignore');
|
|
1098
|
-
const gitignore = `# KynjalFlow runtime files
|
|
1099
|
-
data/
|
|
1100
|
-
logs/
|
|
1101
|
-
sessions/
|
|
1102
|
-
neural/
|
|
1103
|
-
*.log
|
|
1104
|
-
*.tmp
|
|
1105
|
-
`;
|
|
1106
|
-
if (!fs.existsSync(gitignorePath) || options.force) {
|
|
1107
|
-
fs.writeFileSync(gitignorePath, gitignore, 'utf-8');
|
|
1108
|
-
result.created.files.push('.claude-flow/.gitignore');
|
|
1109
|
-
}
|
|
1110
|
-
// Write CAPABILITIES.md with full system overview
|
|
1111
|
-
await writeCapabilitiesDoc(targetDir, options, result);
|
|
1142
|
+
function writeRuntimeConfig(targetDir, options, result) {
|
|
1143
|
+
var _a, _b, _c;
|
|
1144
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
1145
|
+
var configPath, config, gitignorePath, gitignore;
|
|
1146
|
+
return __generator(this, function (_d) {
|
|
1147
|
+
switch (_d.label) {
|
|
1148
|
+
case 0:
|
|
1149
|
+
configPath = path.join(targetDir, '.claude-flow', 'config.yaml');
|
|
1150
|
+
if (fs.existsSync(configPath) && !options.force) {
|
|
1151
|
+
result.skipped.push('.claude-flow/config.yaml');
|
|
1152
|
+
return [2 /*return*/];
|
|
1153
|
+
}
|
|
1154
|
+
config = "# RuFlo V3 Runtime Configuration\n# Generated: " + new Date().toISOString() + "\n\nversion: \"3.0.0\"\n\nswarm:\n topology: " + options.runtime.topology + "\n maxAgents: " + options.runtime.maxAgents + "\n autoScale: true\n coordinationStrategy: consensus\n\nmemory:\n backend: " + options.runtime.memoryBackend + "\n enableHNSW: " + options.runtime.enableHNSW + "\n persistPath: .claude-flow/data\n cacheSize: 100\n # ADR-049: Self-Learning Memory\n learningBridge:\n enabled: " + ((_a = options.runtime.enableLearningBridge) !== null && _a !== void 0 ? _a : options.runtime.enableNeural) + "\n sonaMode: balanced\n confidenceDecayRate: 0.005\n accessBoostAmount: 0.03\n consolidationThreshold: 10\n memoryGraph:\n enabled: " + ((_b = options.runtime.enableMemoryGraph) !== null && _b !== void 0 ? _b : true) + "\n pageRankDamping: 0.85\n maxNodes: 5000\n similarityThreshold: 0.8\n agentScopes:\n enabled: " + ((_c = options.runtime.enableAgentScopes) !== null && _c !== void 0 ? _c : true) + "\n defaultScope: project\n\nneural:\n enabled: " + options.runtime.enableNeural + "\n modelPath: .claude-flow/neural\n\nhooks:\n enabled: true\n autoExecute: true\n\nmcp:\n autoStart: " + options.mcp.autoStart + "\n port: " + options.mcp.port + "\n";
|
|
1155
|
+
fs.writeFileSync(configPath, config, 'utf-8');
|
|
1156
|
+
result.created.files.push('.claude-flow/config.yaml');
|
|
1157
|
+
gitignorePath = path.join(targetDir, '.claude-flow', '.gitignore');
|
|
1158
|
+
gitignore = "# Claude Flow runtime files\ndata/\nlogs/\nsessions/\nneural/\n*.log\n*.tmp\n";
|
|
1159
|
+
if (!fs.existsSync(gitignorePath) || options.force) {
|
|
1160
|
+
fs.writeFileSync(gitignorePath, gitignore, 'utf-8');
|
|
1161
|
+
result.created.files.push('.claude-flow/.gitignore');
|
|
1162
|
+
}
|
|
1163
|
+
// Write CAPABILITIES.md with full system overview
|
|
1164
|
+
return [4 /*yield*/, writeCapabilitiesDoc(targetDir, options, result)];
|
|
1165
|
+
case 1:
|
|
1166
|
+
// Write CAPABILITIES.md with full system overview
|
|
1167
|
+
_d.sent();
|
|
1168
|
+
return [2 /*return*/];
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
});
|
|
1112
1172
|
}
|
|
1113
1173
|
/**
|
|
1114
1174
|
* Write initial metrics files for statusline
|
|
1115
1175
|
* Creates baseline data so statusline shows meaningful state instead of all zeros
|
|
1116
1176
|
*/
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1177
|
+
function writeInitialMetrics(targetDir, options, result) {
|
|
1178
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
1179
|
+
var metricsDir, learningDir, securityDir, _i, _a, dir, progressPath, progress, activityPath, activity, learningPath, learning, auditPath, audit;
|
|
1180
|
+
return __generator(this, function (_b) {
|
|
1181
|
+
metricsDir = path.join(targetDir, '.claude-flow', 'metrics');
|
|
1182
|
+
learningDir = path.join(targetDir, '.claude-flow', 'learning');
|
|
1183
|
+
securityDir = path.join(targetDir, '.claude-flow', 'security');
|
|
1184
|
+
// Ensure directories exist
|
|
1185
|
+
for (_i = 0, _a = [metricsDir, learningDir, securityDir]; _i < _a.length; _i++) {
|
|
1186
|
+
dir = _a[_i];
|
|
1187
|
+
if (!fs.existsSync(dir)) {
|
|
1188
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
progressPath = path.join(metricsDir, 'v3-progress.json');
|
|
1192
|
+
if (!fs.existsSync(progressPath) || options.force) {
|
|
1193
|
+
progress = {
|
|
1194
|
+
version: '3.0.0',
|
|
1195
|
+
initialized: new Date().toISOString(),
|
|
1196
|
+
domains: {
|
|
1197
|
+
completed: 0,
|
|
1198
|
+
total: 5,
|
|
1199
|
+
status: 'INITIALIZING'
|
|
1200
|
+
},
|
|
1201
|
+
ddd: {
|
|
1202
|
+
progress: 0,
|
|
1203
|
+
modules: 0,
|
|
1204
|
+
totalFiles: 0,
|
|
1205
|
+
totalLines: 0
|
|
1206
|
+
},
|
|
1207
|
+
swarm: {
|
|
1208
|
+
activeAgents: 0,
|
|
1209
|
+
maxAgents: options.runtime.maxAgents,
|
|
1210
|
+
topology: options.runtime.topology
|
|
1211
|
+
},
|
|
1212
|
+
learning: {
|
|
1213
|
+
status: 'READY',
|
|
1214
|
+
patternsLearned: 0,
|
|
1215
|
+
sessionsCompleted: 0
|
|
1216
|
+
},
|
|
1217
|
+
_note: 'Metrics will update as you use Ruflo. Run: npx ruflo@latest daemon start'
|
|
1218
|
+
};
|
|
1219
|
+
fs.writeFileSync(progressPath, JSON.stringify(progress, null, 2), 'utf-8');
|
|
1220
|
+
result.created.files.push('.claude-flow/metrics/v3-progress.json');
|
|
1221
|
+
}
|
|
1222
|
+
activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
1223
|
+
if (!fs.existsSync(activityPath) || options.force) {
|
|
1224
|
+
activity = {
|
|
1225
|
+
timestamp: new Date().toISOString(),
|
|
1226
|
+
processes: {
|
|
1227
|
+
agentic_flow: 0,
|
|
1228
|
+
mcp_server: 0,
|
|
1229
|
+
estimated_agents: 0
|
|
1230
|
+
},
|
|
1231
|
+
swarm: {
|
|
1232
|
+
active: false,
|
|
1233
|
+
agent_count: 0,
|
|
1234
|
+
coordination_active: false
|
|
1235
|
+
},
|
|
1236
|
+
integration: {
|
|
1237
|
+
agentic_flow_active: false,
|
|
1238
|
+
mcp_active: false
|
|
1239
|
+
},
|
|
1240
|
+
_initialized: true
|
|
1241
|
+
};
|
|
1242
|
+
fs.writeFileSync(activityPath, JSON.stringify(activity, null, 2), 'utf-8');
|
|
1243
|
+
result.created.files.push('.claude-flow/metrics/swarm-activity.json');
|
|
1244
|
+
}
|
|
1245
|
+
learningPath = path.join(metricsDir, 'learning.json');
|
|
1246
|
+
if (!fs.existsSync(learningPath) || options.force) {
|
|
1247
|
+
learning = {
|
|
1248
|
+
initialized: new Date().toISOString(),
|
|
1249
|
+
routing: {
|
|
1250
|
+
accuracy: 0,
|
|
1251
|
+
decisions: 0
|
|
1252
|
+
},
|
|
1253
|
+
patterns: {
|
|
1254
|
+
shortTerm: 0,
|
|
1255
|
+
longTerm: 0,
|
|
1256
|
+
quality: 0
|
|
1257
|
+
},
|
|
1258
|
+
sessions: {
|
|
1259
|
+
total: 0,
|
|
1260
|
+
current: null
|
|
1261
|
+
},
|
|
1262
|
+
_note: 'Intelligence grows as you use Ruflo'
|
|
1263
|
+
};
|
|
1264
|
+
fs.writeFileSync(learningPath, JSON.stringify(learning, null, 2), 'utf-8');
|
|
1265
|
+
result.created.files.push('.claude-flow/metrics/learning.json');
|
|
1266
|
+
}
|
|
1267
|
+
auditPath = path.join(securityDir, 'audit-status.json');
|
|
1268
|
+
if (!fs.existsSync(auditPath) || options.force) {
|
|
1269
|
+
audit = {
|
|
1270
|
+
initialized: new Date().toISOString(),
|
|
1271
|
+
status: 'PENDING',
|
|
1272
|
+
cvesFixed: 0,
|
|
1273
|
+
totalCves: 3,
|
|
1274
|
+
lastScan: null,
|
|
1275
|
+
_note: 'Run: npx @claude-flow/cli@latest security scan'
|
|
1276
|
+
};
|
|
1277
|
+
fs.writeFileSync(auditPath, JSON.stringify(audit, null, 2), 'utf-8');
|
|
1278
|
+
result.created.files.push('.claude-flow/security/audit-status.json');
|
|
1279
|
+
}
|
|
1280
|
+
return [2 /*return*/];
|
|
1281
|
+
});
|
|
1282
|
+
});
|
|
1220
1283
|
}
|
|
1221
1284
|
/**
|
|
1222
|
-
* Write CAPABILITIES.md - comprehensive overview of all
|
|
1285
|
+
* Write CAPABILITIES.md - comprehensive overview of all Ruflo features
|
|
1223
1286
|
*/
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
4. [CLI Commands (26 Commands, 140+ Subcommands)](#cli-commands)
|
|
1240
|
-
5. [Hooks System (27 Hooks + 12 Workers)](#hooks-system)
|
|
1241
|
-
6. [Memory & Intelligence (RuVector)](#memory--intelligence)
|
|
1242
|
-
7. [Hive-Mind Consensus](#hive-mind-consensus)
|
|
1243
|
-
8. [Performance Targets](#performance-targets)
|
|
1244
|
-
9. [Integration Ecosystem](#integration-ecosystem)
|
|
1245
|
-
|
|
1246
|
-
---
|
|
1247
|
-
|
|
1248
|
-
## Overview
|
|
1249
|
-
|
|
1250
|
-
KynjalFlow V3 is a domain-driven design architecture for multi-agent AI coordination with:
|
|
1251
|
-
|
|
1252
|
-
- **15-Agent Swarm Coordination** with hierarchical and mesh topologies
|
|
1253
|
-
- **HNSW Vector Search** - 150x-12,500x faster pattern retrieval
|
|
1254
|
-
- **SONA Neural Learning** - Self-optimizing with <0.05ms adaptation
|
|
1255
|
-
- **Byzantine Fault Tolerance** - Queen-led consensus mechanisms
|
|
1256
|
-
- **MCP Server Integration** - Model Context Protocol support
|
|
1257
|
-
|
|
1258
|
-
### Current Configuration
|
|
1259
|
-
| Setting | Value |
|
|
1260
|
-
|---------|-------|
|
|
1261
|
-
| Topology | ${options.runtime.topology} |
|
|
1262
|
-
| Max Agents | ${options.runtime.maxAgents} |
|
|
1263
|
-
| Memory Backend | ${options.runtime.memoryBackend} |
|
|
1264
|
-
| HNSW Indexing | ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'} |
|
|
1265
|
-
| Neural Learning | ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'} |
|
|
1266
|
-
| LearningBridge | ${options.runtime.enableLearningBridge ? 'Enabled (SONA + ReasoningBank)' : 'Disabled'} |
|
|
1267
|
-
| Knowledge Graph | ${options.runtime.enableMemoryGraph ? 'Enabled (PageRank + Communities)' : 'Disabled'} |
|
|
1268
|
-
| Agent Scopes | ${options.runtime.enableAgentScopes ? 'Enabled (project/local/user)' : 'Disabled'} |
|
|
1269
|
-
|
|
1270
|
-
---
|
|
1271
|
-
|
|
1272
|
-
## Swarm Orchestration
|
|
1273
|
-
|
|
1274
|
-
### Topologies
|
|
1275
|
-
| Topology | Description | Best For |
|
|
1276
|
-
|----------|-------------|----------|
|
|
1277
|
-
| \`hierarchical\` | Queen controls workers directly | Anti-drift, tight control |
|
|
1278
|
-
| \`mesh\` | Fully connected peer network | Distributed tasks |
|
|
1279
|
-
| \`hierarchical-mesh\` | V3 hybrid (recommended) | 10+ agents |
|
|
1280
|
-
| \`ring\` | Circular communication | Sequential workflows |
|
|
1281
|
-
| \`star\` | Central coordinator | Simple coordination |
|
|
1282
|
-
| \`adaptive\` | Dynamic based on load | Variable workloads |
|
|
1283
|
-
|
|
1284
|
-
### Strategies
|
|
1285
|
-
- \`balanced\` - Even distribution across agents
|
|
1286
|
-
- \`specialized\` - Clear roles, no overlap (anti-drift)
|
|
1287
|
-
- \`adaptive\` - Dynamic task routing
|
|
1288
|
-
|
|
1289
|
-
### Quick Commands
|
|
1290
|
-
\`\`\`bash
|
|
1291
|
-
# Initialize swarm
|
|
1292
|
-
npx @kynjal/cli@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized
|
|
1293
|
-
|
|
1294
|
-
# Check status
|
|
1295
|
-
npx @kynjal/cli@latest swarm status
|
|
1296
|
-
|
|
1297
|
-
# Monitor activity
|
|
1298
|
-
npx @kynjal/cli@latest swarm monitor
|
|
1299
|
-
\`\`\`
|
|
1300
|
-
|
|
1301
|
-
---
|
|
1302
|
-
|
|
1303
|
-
## Available Agents
|
|
1304
|
-
|
|
1305
|
-
### Core Development (5)
|
|
1306
|
-
\`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
|
|
1307
|
-
|
|
1308
|
-
### V3 Specialized (4)
|
|
1309
|
-
\`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
|
|
1310
|
-
|
|
1311
|
-
### Swarm Coordination (5)
|
|
1312
|
-
\`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
|
|
1313
|
-
|
|
1314
|
-
### Consensus & Distributed (7)
|
|
1315
|
-
\`byzantine-coordinator\`, \`raft-manager\`, \`gossip-coordinator\`, \`consensus-builder\`, \`crdt-synchronizer\`, \`quorum-manager\`, \`security-manager\`
|
|
1316
|
-
|
|
1317
|
-
### Performance & Optimization (5)
|
|
1318
|
-
\`perf-analyzer\`, \`performance-benchmarker\`, \`task-orchestrator\`, \`memory-coordinator\`, \`smart-agent\`
|
|
1319
|
-
|
|
1320
|
-
### GitHub & Repository (9)
|
|
1321
|
-
\`github-modes\`, \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`, \`workflow-automation\`, \`project-board-sync\`, \`repo-architect\`, \`multi-repo-swarm\`
|
|
1322
|
-
|
|
1323
|
-
### SPARC Methodology (6)
|
|
1324
|
-
\`sparc-coord\`, \`sparc-coder\`, \`specification\`, \`pseudocode\`, \`architecture\`, \`refinement\`
|
|
1325
|
-
|
|
1326
|
-
### Specialized Development (8)
|
|
1327
|
-
\`backend-dev\`, \`mobile-dev\`, \`ml-developer\`, \`cicd-engineer\`, \`api-docs\`, \`system-architect\`, \`code-analyzer\`, \`base-template-generator\`
|
|
1328
|
-
|
|
1329
|
-
### Testing & Validation (2)
|
|
1330
|
-
\`tdd-london-swarm\`, \`production-validator\`
|
|
1331
|
-
|
|
1332
|
-
### Agent Routing by Task
|
|
1333
|
-
| Task Type | Recommended Agents | Topology |
|
|
1334
|
-
|-----------|-------------------|----------|
|
|
1335
|
-
| Bug Fix | researcher, coder, tester | mesh |
|
|
1336
|
-
| New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
|
|
1337
|
-
| Refactoring | architect, coder, reviewer | mesh |
|
|
1338
|
-
| Performance | researcher, perf-engineer, coder | hierarchical |
|
|
1339
|
-
| Security | security-architect, auditor, reviewer | hierarchical |
|
|
1340
|
-
| Docs | researcher, api-docs | mesh |
|
|
1341
|
-
|
|
1342
|
-
---
|
|
1343
|
-
|
|
1344
|
-
## CLI Commands
|
|
1345
|
-
|
|
1346
|
-
### Core Commands (12)
|
|
1347
|
-
| Command | Subcommands | Description |
|
|
1348
|
-
|---------|-------------|-------------|
|
|
1349
|
-
| \`init\` | 4 | Project initialization |
|
|
1350
|
-
| \`agent\` | 8 | Agent lifecycle management |
|
|
1351
|
-
| \`swarm\` | 6 | Multi-agent coordination |
|
|
1352
|
-
| \`memory\` | 11 | AgentDB with HNSW search |
|
|
1353
|
-
| \`mcp\` | 9 | MCP server management |
|
|
1354
|
-
| \`task\` | 6 | Task assignment |
|
|
1355
|
-
| \`session\` | 7 | Session persistence |
|
|
1356
|
-
| \`config\` | 7 | Configuration |
|
|
1357
|
-
| \`status\` | 3 | System monitoring |
|
|
1358
|
-
| \`workflow\` | 6 | Workflow templates |
|
|
1359
|
-
| \`hooks\` | 17 | Self-learning hooks |
|
|
1360
|
-
| \`hive-mind\` | 6 | Consensus coordination |
|
|
1361
|
-
|
|
1362
|
-
### Advanced Commands (14)
|
|
1363
|
-
| Command | Subcommands | Description |
|
|
1364
|
-
|---------|-------------|-------------|
|
|
1365
|
-
| \`daemon\` | 5 | Background workers |
|
|
1366
|
-
| \`neural\` | 5 | Pattern training |
|
|
1367
|
-
| \`security\` | 6 | Security scanning |
|
|
1368
|
-
| \`performance\` | 5 | Profiling & benchmarks |
|
|
1369
|
-
| \`providers\` | 5 | AI provider config |
|
|
1370
|
-
| \`plugins\` | 5 | Plugin management |
|
|
1371
|
-
| \`deployment\` | 5 | Deploy management |
|
|
1372
|
-
| \`embeddings\` | 4 | Vector embeddings |
|
|
1373
|
-
| \`claims\` | 4 | Authorization |
|
|
1374
|
-
| \`migrate\` | 5 | V2→V3 migration |
|
|
1375
|
-
| \`process\` | 4 | Process management |
|
|
1376
|
-
| \`doctor\` | 1 | Health diagnostics |
|
|
1377
|
-
| \`completions\` | 4 | Shell completions |
|
|
1378
|
-
|
|
1379
|
-
### Example Commands
|
|
1380
|
-
\`\`\`bash
|
|
1381
|
-
# Initialize
|
|
1382
|
-
npx @kynjal/cli@latest init --wizard
|
|
1383
|
-
|
|
1384
|
-
# Spawn agent
|
|
1385
|
-
npx @kynjal/cli@latest agent spawn -t coder --name my-coder
|
|
1386
|
-
|
|
1387
|
-
# Memory operations
|
|
1388
|
-
npx @kynjal/cli@latest memory store --key "pattern" --value "data" --namespace patterns
|
|
1389
|
-
npx @kynjal/cli@latest memory search --query "authentication"
|
|
1390
|
-
|
|
1391
|
-
# Diagnostics
|
|
1392
|
-
npx @kynjal/cli@latest doctor --fix
|
|
1393
|
-
\`\`\`
|
|
1394
|
-
|
|
1395
|
-
---
|
|
1396
|
-
|
|
1397
|
-
## Hooks System
|
|
1398
|
-
|
|
1399
|
-
### 27 Available Hooks
|
|
1400
|
-
|
|
1401
|
-
#### Core Hooks (6)
|
|
1402
|
-
| Hook | Description |
|
|
1403
|
-
|------|-------------|
|
|
1404
|
-
| \`pre-edit\` | Context before file edits |
|
|
1405
|
-
| \`post-edit\` | Record edit outcomes |
|
|
1406
|
-
| \`pre-command\` | Risk assessment |
|
|
1407
|
-
| \`post-command\` | Command metrics |
|
|
1408
|
-
| \`pre-task\` | Task start + agent suggestions |
|
|
1409
|
-
| \`post-task\` | Task completion learning |
|
|
1410
|
-
|
|
1411
|
-
#### Session Hooks (4)
|
|
1412
|
-
| Hook | Description |
|
|
1413
|
-
|------|-------------|
|
|
1414
|
-
| \`session-start\` | Start/restore session |
|
|
1415
|
-
| \`session-end\` | Persist state |
|
|
1416
|
-
| \`session-restore\` | Restore previous |
|
|
1417
|
-
| \`notify\` | Cross-agent notifications |
|
|
1418
|
-
|
|
1419
|
-
#### Intelligence Hooks (5)
|
|
1420
|
-
| Hook | Description |
|
|
1421
|
-
|------|-------------|
|
|
1422
|
-
| \`route\` | Optimal agent routing |
|
|
1423
|
-
| \`explain\` | Routing decisions |
|
|
1424
|
-
| \`pretrain\` | Bootstrap intelligence |
|
|
1425
|
-
| \`build-agents\` | Generate configs |
|
|
1426
|
-
| \`transfer\` | Pattern transfer |
|
|
1427
|
-
|
|
1428
|
-
#### Coverage Hooks (3)
|
|
1429
|
-
| Hook | Description |
|
|
1430
|
-
|------|-------------|
|
|
1431
|
-
| \`coverage-route\` | Coverage-based routing |
|
|
1432
|
-
| \`coverage-suggest\` | Improvement suggestions |
|
|
1433
|
-
| \`coverage-gaps\` | Gap analysis |
|
|
1434
|
-
|
|
1435
|
-
### 12 Background Workers
|
|
1436
|
-
| Worker | Priority | Purpose |
|
|
1437
|
-
|--------|----------|---------|
|
|
1438
|
-
| \`ultralearn\` | normal | Deep knowledge |
|
|
1439
|
-
| \`optimize\` | high | Performance |
|
|
1440
|
-
| \`consolidate\` | low | Memory consolidation |
|
|
1441
|
-
| \`predict\` | normal | Predictive preload |
|
|
1442
|
-
| \`audit\` | critical | Security |
|
|
1443
|
-
| \`map\` | normal | Codebase mapping |
|
|
1444
|
-
| \`preload\` | low | Resource preload |
|
|
1445
|
-
| \`deepdive\` | normal | Deep analysis |
|
|
1446
|
-
| \`document\` | normal | Auto-docs |
|
|
1447
|
-
| \`refactor\` | normal | Suggestions |
|
|
1448
|
-
| \`benchmark\` | normal | Benchmarking |
|
|
1449
|
-
| \`testgaps\` | normal | Coverage gaps |
|
|
1450
|
-
|
|
1451
|
-
---
|
|
1452
|
-
|
|
1453
|
-
## Memory & Intelligence
|
|
1454
|
-
|
|
1455
|
-
### RuVector Intelligence System
|
|
1456
|
-
- **SONA**: Self-Optimizing Neural Architecture (<0.05ms)
|
|
1457
|
-
- **MoE**: Mixture of Experts routing
|
|
1458
|
-
- **HNSW**: 150x-12,500x faster search
|
|
1459
|
-
- **EWC++**: Prevents catastrophic forgetting
|
|
1460
|
-
- **Flash Attention**: 2.49x-7.47x speedup
|
|
1461
|
-
- **Int8 Quantization**: 3.92x memory reduction
|
|
1462
|
-
|
|
1463
|
-
### 4-Step Intelligence Pipeline
|
|
1464
|
-
1. **RETRIEVE** - HNSW pattern search
|
|
1465
|
-
2. **JUDGE** - Success/failure verdicts
|
|
1466
|
-
3. **DISTILL** - LoRA learning extraction
|
|
1467
|
-
4. **CONSOLIDATE** - EWC++ preservation
|
|
1468
|
-
|
|
1469
|
-
### Self-Learning Memory (ADR-049)
|
|
1470
|
-
|
|
1471
|
-
| Component | Status | Description |
|
|
1472
|
-
|-----------|--------|-------------|
|
|
1473
|
-
| **LearningBridge** | ${options.runtime.enableLearningBridge ? '✅ Enabled' : '⏸ Disabled'} | Connects insights to SONA/ReasoningBank neural pipeline |
|
|
1474
|
-
| **MemoryGraph** | ${options.runtime.enableMemoryGraph ? '✅ Enabled' : '⏸ Disabled'} | PageRank knowledge graph + community detection |
|
|
1475
|
-
| **AgentMemoryScope** | ${options.runtime.enableAgentScopes ? '✅ Enabled' : '⏸ Disabled'} | 3-scope agent memory (project/local/user) |
|
|
1476
|
-
|
|
1477
|
-
**LearningBridge** - Insights trigger learning trajectories. Confidence evolves: +0.03 on access, -0.005/hour decay. Consolidation runs the JUDGE/DISTILL/CONSOLIDATE pipeline.
|
|
1478
|
-
|
|
1479
|
-
**MemoryGraph** - Builds a knowledge graph from entry references. PageRank identifies influential insights. Communities group related knowledge. Graph-aware ranking blends vector + structural scores.
|
|
1480
|
-
|
|
1481
|
-
**AgentMemoryScope** - Maps Claude Code 3-scope directories:
|
|
1482
|
-
- \`project\`: \`<gitRoot>/.claude/agent-memory/<agent>/\`
|
|
1483
|
-
- \`local\`: \`<gitRoot>/.claude/agent-memory-local/<agent>/\`
|
|
1484
|
-
- \`user\`: \`~/.claude/agent-memory/<agent>/\`
|
|
1485
|
-
|
|
1486
|
-
High-confidence insights (>0.8) can transfer between agents.
|
|
1487
|
-
|
|
1488
|
-
### Memory Commands
|
|
1489
|
-
\`\`\`bash
|
|
1490
|
-
# Store pattern
|
|
1491
|
-
npx @kynjal/cli@latest memory store --key "name" --value "data" --namespace patterns
|
|
1492
|
-
|
|
1493
|
-
# Semantic search
|
|
1494
|
-
npx @kynjal/cli@latest memory search --query "authentication"
|
|
1495
|
-
|
|
1496
|
-
# List entries
|
|
1497
|
-
npx @kynjal/cli@latest memory list --namespace patterns
|
|
1498
|
-
|
|
1499
|
-
# Initialize database
|
|
1500
|
-
npx @kynjal/cli@latest memory init --force
|
|
1501
|
-
\`\`\`
|
|
1502
|
-
|
|
1503
|
-
---
|
|
1504
|
-
|
|
1505
|
-
## Hive-Mind Consensus
|
|
1506
|
-
|
|
1507
|
-
### Queen Types
|
|
1508
|
-
| Type | Role |
|
|
1509
|
-
|------|------|
|
|
1510
|
-
| Strategic Queen | Long-term planning |
|
|
1511
|
-
| Tactical Queen | Execution coordination |
|
|
1512
|
-
| Adaptive Queen | Dynamic optimization |
|
|
1513
|
-
|
|
1514
|
-
### Worker Types (8)
|
|
1515
|
-
\`researcher\`, \`coder\`, \`analyst\`, \`tester\`, \`architect\`, \`reviewer\`, \`optimizer\`, \`documenter\`
|
|
1516
|
-
|
|
1517
|
-
### Consensus Mechanisms
|
|
1518
|
-
| Mechanism | Fault Tolerance | Use Case |
|
|
1519
|
-
|-----------|-----------------|----------|
|
|
1520
|
-
| \`byzantine\` | f < n/3 faulty | Adversarial |
|
|
1521
|
-
| \`raft\` | f < n/2 failed | Leader-based |
|
|
1522
|
-
| \`gossip\` | Eventually consistent | Large scale |
|
|
1523
|
-
| \`crdt\` | Conflict-free | Distributed |
|
|
1524
|
-
| \`quorum\` | Configurable | Flexible |
|
|
1525
|
-
|
|
1526
|
-
### Hive-Mind Commands
|
|
1527
|
-
\`\`\`bash
|
|
1528
|
-
# Initialize
|
|
1529
|
-
npx @kynjal/cli@latest hive-mind init --queen-type strategic
|
|
1530
|
-
|
|
1531
|
-
# Status
|
|
1532
|
-
npx @kynjal/cli@latest hive-mind status
|
|
1533
|
-
|
|
1534
|
-
# Spawn workers
|
|
1535
|
-
npx @kynjal/cli@latest hive-mind spawn --count 5 --type worker
|
|
1536
|
-
|
|
1537
|
-
# Consensus
|
|
1538
|
-
npx @kynjal/cli@latest hive-mind consensus --propose "task"
|
|
1539
|
-
\`\`\`
|
|
1540
|
-
|
|
1541
|
-
---
|
|
1542
|
-
|
|
1543
|
-
## Performance Targets
|
|
1544
|
-
|
|
1545
|
-
| Metric | Target | Status |
|
|
1546
|
-
|--------|--------|--------|
|
|
1547
|
-
| HNSW Search | 150x-12,500x faster | ✅ Implemented |
|
|
1548
|
-
| Memory Reduction | 50-75% | ✅ Implemented (3.92x) |
|
|
1549
|
-
| SONA Integration | Pattern learning | ✅ Implemented |
|
|
1550
|
-
| Flash Attention | 2.49x-7.47x | 🔄 In Progress |
|
|
1551
|
-
| MCP Response | <100ms | ✅ Achieved |
|
|
1552
|
-
| CLI Startup | <500ms | ✅ Achieved |
|
|
1553
|
-
| SONA Adaptation | <0.05ms | 🔄 In Progress |
|
|
1554
|
-
| Graph Build (1k) | <200ms | ✅ 2.78ms (71.9x headroom) |
|
|
1555
|
-
| PageRank (1k) | <100ms | ✅ 12.21ms (8.2x headroom) |
|
|
1556
|
-
| Insight Recording | <5ms/each | ✅ 0.12ms (41x headroom) |
|
|
1557
|
-
| Consolidation | <500ms | ✅ 0.26ms (1,955x headroom) |
|
|
1558
|
-
| Knowledge Transfer | <100ms | ✅ 1.25ms (80x headroom) |
|
|
1559
|
-
|
|
1560
|
-
---
|
|
1561
|
-
|
|
1562
|
-
## Integration Ecosystem
|
|
1563
|
-
|
|
1564
|
-
### Integrated Packages
|
|
1565
|
-
| Package | Version | Purpose |
|
|
1566
|
-
|---------|---------|---------|
|
|
1567
|
-
| agentic-flow | 2.0.1-alpha | Core coordination |
|
|
1568
|
-
| agentdb | 2.0.0-alpha.3.4 | Vector database |
|
|
1569
|
-
| @ruvector/attention | 0.1.3 | Flash attention |
|
|
1570
|
-
| @ruvector/sona | 0.1.5 | Neural learning |
|
|
1571
|
-
|
|
1572
|
-
### Optional Integrations
|
|
1573
|
-
| Package | Command |
|
|
1574
|
-
|---------|---------|
|
|
1575
|
-
| ruv-swarm | \`npx ruv-swarm mcp start\` |
|
|
1576
|
-
| flow-nexus | \`npx flow-nexus@latest mcp start\` |
|
|
1577
|
-
| agentic-jujutsu | \`npx agentic-jujutsu@latest\` |
|
|
1578
|
-
|
|
1579
|
-
### MCP Server Setup
|
|
1580
|
-
\`\`\`bash
|
|
1581
|
-
# Add KynjalFlow MCP
|
|
1582
|
-
claude mcp add claude-flow -- npx -y @claude-flow/cli@latest
|
|
1583
|
-
|
|
1584
|
-
# Optional servers
|
|
1585
|
-
claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start
|
|
1586
|
-
claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start
|
|
1587
|
-
\`\`\`
|
|
1588
|
-
|
|
1589
|
-
---
|
|
1590
|
-
|
|
1591
|
-
## Quick Reference
|
|
1592
|
-
|
|
1593
|
-
### Essential Commands
|
|
1594
|
-
\`\`\`bash
|
|
1595
|
-
# Setup
|
|
1596
|
-
npx @kynjal/cli@latest init --wizard
|
|
1597
|
-
npx @kynjal/cli@latest daemon start
|
|
1598
|
-
npx @kynjal/cli@latest doctor --fix
|
|
1599
|
-
|
|
1600
|
-
# Swarm
|
|
1601
|
-
npx @kynjal/cli@latest swarm init --topology hierarchical --max-agents 8
|
|
1602
|
-
npx @kynjal/cli@latest swarm status
|
|
1603
|
-
|
|
1604
|
-
# Agents
|
|
1605
|
-
npx @kynjal/cli@latest agent spawn -t coder
|
|
1606
|
-
npx @kynjal/cli@latest agent list
|
|
1607
|
-
|
|
1608
|
-
# Memory
|
|
1609
|
-
npx @kynjal/cli@latest memory search --query "patterns"
|
|
1610
|
-
|
|
1611
|
-
# Hooks
|
|
1612
|
-
npx @kynjal/cli@latest hooks pre-task --description "task"
|
|
1613
|
-
npx @kynjal/cli@latest hooks worker dispatch --trigger optimize
|
|
1614
|
-
\`\`\`
|
|
1615
|
-
|
|
1616
|
-
### File Structure
|
|
1617
|
-
\`\`\`
|
|
1618
|
-
.claude-flow/
|
|
1619
|
-
├── config.yaml # Runtime configuration
|
|
1620
|
-
├── CAPABILITIES.md # This file
|
|
1621
|
-
├── data/ # Memory storage
|
|
1622
|
-
├── logs/ # Operation logs
|
|
1623
|
-
├── sessions/ # Session state
|
|
1624
|
-
├── hooks/ # Custom hooks
|
|
1625
|
-
├── agents/ # Agent configs
|
|
1626
|
-
└── workflows/ # Workflow templates
|
|
1627
|
-
\`\`\`
|
|
1628
|
-
|
|
1629
|
-
---
|
|
1630
|
-
|
|
1631
|
-
**Full Documentation**: https://github.com/KingJune28/claude-flow
|
|
1632
|
-
**Issues**: https://github.com/KingJune28/claude-flow/issues
|
|
1633
|
-
`;
|
|
1634
|
-
fs.writeFileSync(capabilitiesPath, capabilities, 'utf-8');
|
|
1635
|
-
result.created.files.push('.claude-flow/CAPABILITIES.md');
|
|
1287
|
+
function writeCapabilitiesDoc(targetDir, options, result) {
|
|
1288
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
1289
|
+
var capabilitiesPath, capabilities;
|
|
1290
|
+
return __generator(this, function (_a) {
|
|
1291
|
+
capabilitiesPath = path.join(targetDir, '.claude-flow', 'CAPABILITIES.md');
|
|
1292
|
+
if (fs.existsSync(capabilitiesPath) && !options.force) {
|
|
1293
|
+
result.skipped.push('.claude-flow/CAPABILITIES.md');
|
|
1294
|
+
return [2 /*return*/];
|
|
1295
|
+
}
|
|
1296
|
+
capabilities = "# RuFlo V3 - Complete Capabilities Reference\n> Generated: " + new Date().toISOString() + "\n> Full documentation: https://github.com/ruvnet/claude-flow\n\n## \uD83D\uDCCB Table of Contents\n\n1. [Overview](#overview)\n2. [Swarm Orchestration](#swarm-orchestration)\n3. [Available Agents (60+)](#available-agents)\n4. [CLI Commands (26 Commands, 140+ Subcommands)](#cli-commands)\n5. [Hooks System (27 Hooks + 12 Workers)](#hooks-system)\n6. [Memory & Intelligence (RuVector)](#memory--intelligence)\n7. [Hive-Mind Consensus](#hive-mind-consensus)\n8. [Performance Targets](#performance-targets)\n9. [Integration Ecosystem](#integration-ecosystem)\n\n---\n\n## Overview\n\nRuFlo V3 is a domain-driven design architecture for multi-agent AI coordination with:\n\n- **15-Agent Swarm Coordination** with hierarchical and mesh topologies\n- **HNSW Vector Search** - 150x-12,500x faster pattern retrieval\n- **SONA Neural Learning** - Self-optimizing with <0.05ms adaptation\n- **Byzantine Fault Tolerance** - Queen-led consensus mechanisms\n- **MCP Server Integration** - Model Context Protocol support\n\n### Current Configuration\n| Setting | Value |\n|---------|-------|\n| Topology | " + options.runtime.topology + " |\n| Max Agents | " + options.runtime.maxAgents + " |\n| Memory Backend | " + options.runtime.memoryBackend + " |\n| HNSW Indexing | " + (options.runtime.enableHNSW ? 'Enabled' : 'Disabled') + " |\n| Neural Learning | " + (options.runtime.enableNeural ? 'Enabled' : 'Disabled') + " |\n| LearningBridge | " + (options.runtime.enableLearningBridge ? 'Enabled (SONA + ReasoningBank)' : 'Disabled') + " |\n| Knowledge Graph | " + (options.runtime.enableMemoryGraph ? 'Enabled (PageRank + Communities)' : 'Disabled') + " |\n| Agent Scopes | " + (options.runtime.enableAgentScopes ? 'Enabled (project/local/user)' : 'Disabled') + " |\n\n---\n\n## Swarm Orchestration\n\n### Topologies\n| Topology | Description | Best For |\n|----------|-------------|----------|\n| `hierarchical` | Queen controls workers directly | Anti-drift, tight control |\n| `mesh` | Fully connected peer network | Distributed tasks |\n| `hierarchical-mesh` | V3 hybrid (recommended) | 10+ agents |\n| `ring` | Circular communication | Sequential workflows |\n| `star` | Central coordinator | Simple coordination |\n| `adaptive` | Dynamic based on load | Variable workloads |\n\n### Strategies\n- `balanced` - Even distribution across agents\n- `specialized` - Clear roles, no overlap (anti-drift)\n- `adaptive` - Dynamic task routing\n\n### Quick Commands\n```bash\n# Initialize swarm\nnpx @claude-flow/cli@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized\n\n# Check status\nnpx @claude-flow/cli@latest swarm status\n\n# Monitor activity\nnpx @claude-flow/cli@latest swarm monitor\n```\n\n---\n\n## Available Agents\n\n### Core Development (5)\n`coder`, `reviewer`, `tester`, `planner`, `researcher`\n\n### V3 Specialized (4)\n`security-architect`, `security-auditor`, `memory-specialist`, `performance-engineer`\n\n### Swarm Coordination (5)\n`hierarchical-coordinator`, `mesh-coordinator`, `adaptive-coordinator`, `collective-intelligence-coordinator`, `swarm-memory-manager`\n\n### Consensus & Distributed (7)\n`byzantine-coordinator`, `raft-manager`, `gossip-coordinator`, `consensus-builder`, `crdt-synchronizer`, `quorum-manager`, `security-manager`\n\n### Performance & Optimization (5)\n`perf-analyzer`, `performance-benchmarker`, `task-orchestrator`, `memory-coordinator`, `smart-agent`\n\n### GitHub & Repository (9)\n`github-modes`, `pr-manager`, `code-review-swarm`, `issue-tracker`, `release-manager`, `workflow-automation`, `project-board-sync`, `repo-architect`, `multi-repo-swarm`\n\n### SPARC Methodology (6)\n`sparc-coord`, `sparc-coder`, `specification`, `pseudocode`, `architecture`, `refinement`\n\n### Specialized Development (8)\n`backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`, `api-docs`, `system-architect`, `code-analyzer`, `base-template-generator`\n\n### Testing & Validation (2)\n`tdd-london-swarm`, `production-validator`\n\n### Agent Routing by Task\n| Task Type | Recommended Agents | Topology |\n|-----------|-------------------|----------|\n| Bug Fix | researcher, coder, tester | mesh |\n| New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |\n| Refactoring | architect, coder, reviewer | mesh |\n| Performance | researcher, perf-engineer, coder | hierarchical |\n| Security | security-architect, auditor, reviewer | hierarchical |\n| Docs | researcher, api-docs | mesh |\n\n---\n\n## CLI Commands\n\n### Core Commands (12)\n| Command | Subcommands | Description |\n|---------|-------------|-------------|\n| `init` | 4 | Project initialization |\n| `agent` | 8 | Agent lifecycle management |\n| `swarm` | 6 | Multi-agent coordination |\n| `memory` | 11 | AgentDB with HNSW search |\n| `mcp` | 9 | MCP server management |\n| `task` | 6 | Task assignment |\n| `session` | 7 | Session persistence |\n| `config` | 7 | Configuration |\n| `status` | 3 | System monitoring |\n| `workflow` | 6 | Workflow templates |\n| `hooks` | 17 | Self-learning hooks |\n| `hive-mind` | 6 | Consensus coordination |\n\n### Advanced Commands (14)\n| Command | Subcommands | Description |\n|---------|-------------|-------------|\n| `daemon` | 5 | Background workers |\n| `neural` | 5 | Pattern training |\n| `security` | 6 | Security scanning |\n| `performance` | 5 | Profiling & benchmarks |\n| `providers` | 5 | AI provider config |\n| `plugins` | 5 | Plugin management |\n| `deployment` | 5 | Deploy management |\n| `embeddings` | 4 | Vector embeddings |\n| `claims` | 4 | Authorization |\n| `migrate` | 5 | V2\u2192V3 migration |\n| `process` | 4 | Process management |\n| `doctor` | 1 | Health diagnostics |\n| `completions` | 4 | Shell completions |\n\n### Example Commands\n```bash\n# Initialize\nnpx @claude-flow/cli@latest init --wizard\n\n# Spawn agent\nnpx @claude-flow/cli@latest agent spawn -t coder --name my-coder\n\n# Memory operations\nnpx @claude-flow/cli@latest memory store --key \"pattern\" --value \"data\" --namespace patterns\nnpx @claude-flow/cli@latest memory search --query \"authentication\"\n\n# Diagnostics\nnpx @claude-flow/cli@latest doctor --fix\n```\n\n---\n\n## Hooks System\n\n### 27 Available Hooks\n\n#### Core Hooks (6)\n| Hook | Description |\n|------|-------------|\n| `pre-edit` | Context before file edits |\n| `post-edit` | Record edit outcomes |\n| `pre-command` | Risk assessment |\n| `post-command` | Command metrics |\n| `pre-task` | Task start + agent suggestions |\n| `post-task` | Task completion learning |\n\n#### Session Hooks (4)\n| Hook | Description |\n|------|-------------|\n| `session-start` | Start/restore session |\n| `session-end` | Persist state |\n| `session-restore` | Restore previous |\n| `notify` | Cross-agent notifications |\n\n#### Intelligence Hooks (5)\n| Hook | Description |\n|------|-------------|\n| `route` | Optimal agent routing |\n| `explain` | Routing decisions |\n| `pretrain` | Bootstrap intelligence |\n| `build-agents` | Generate configs |\n| `transfer` | Pattern transfer |\n\n#### Coverage Hooks (3)\n| Hook | Description |\n|------|-------------|\n| `coverage-route` | Coverage-based routing |\n| `coverage-suggest` | Improvement suggestions |\n| `coverage-gaps` | Gap analysis |\n\n### 12 Background Workers\n| Worker | Priority | Purpose |\n|--------|----------|---------|\n| `ultralearn` | normal | Deep knowledge |\n| `optimize` | high | Performance |\n| `consolidate` | low | Memory consolidation |\n| `predict` | normal | Predictive preload |\n| `audit` | critical | Security |\n| `map` | normal | Codebase mapping |\n| `preload` | low | Resource preload |\n| `deepdive` | normal | Deep analysis |\n| `document` | normal | Auto-docs |\n| `refactor` | normal | Suggestions |\n| `benchmark` | normal | Benchmarking |\n| `testgaps` | normal | Coverage gaps |\n\n---\n\n## Memory & Intelligence\n\n### RuVector Intelligence System\n- **SONA**: Self-Optimizing Neural Architecture (<0.05ms)\n- **MoE**: Mixture of Experts routing\n- **HNSW**: 150x-12,500x faster search\n- **EWC++**: Prevents catastrophic forgetting\n- **Flash Attention**: 2.49x-7.47x speedup\n- **Int8 Quantization**: 3.92x memory reduction\n\n### 4-Step Intelligence Pipeline\n1. **RETRIEVE** - HNSW pattern search\n2. **JUDGE** - Success/failure verdicts\n3. **DISTILL** - LoRA learning extraction\n4. **CONSOLIDATE** - EWC++ preservation\n\n### Self-Learning Memory (ADR-049)\n\n| Component | Status | Description |\n|-----------|--------|-------------|\n| **LearningBridge** | " + (options.runtime.enableLearningBridge ? '✅ Enabled' : '⏸ Disabled') + " | Connects insights to SONA/ReasoningBank neural pipeline |\n| **MemoryGraph** | " + (options.runtime.enableMemoryGraph ? '✅ Enabled' : '⏸ Disabled') + " | PageRank knowledge graph + community detection |\n| **AgentMemoryScope** | " + (options.runtime.enableAgentScopes ? '✅ Enabled' : '⏸ Disabled') + " | 3-scope agent memory (project/local/user) |\n\n**LearningBridge** - Insights trigger learning trajectories. Confidence evolves: +0.03 on access, -0.005/hour decay. Consolidation runs the JUDGE/DISTILL/CONSOLIDATE pipeline.\n\n**MemoryGraph** - Builds a knowledge graph from entry references. PageRank identifies influential insights. Communities group related knowledge. Graph-aware ranking blends vector + structural scores.\n\n**AgentMemoryScope** - Maps Claude Code 3-scope directories:\n- `project`: `<gitRoot>/.claude/agent-memory/<agent>/`\n- `local`: `<gitRoot>/.claude/agent-memory-local/<agent>/`\n- `user`: `~/.claude/agent-memory/<agent>/`\n\nHigh-confidence insights (>0.8) can transfer between agents.\n\n### Memory Commands\n```bash\n# Store pattern\nnpx @claude-flow/cli@latest memory store --key \"name\" --value \"data\" --namespace patterns\n\n# Semantic search\nnpx @claude-flow/cli@latest memory search --query \"authentication\"\n\n# List entries\nnpx @claude-flow/cli@latest memory list --namespace patterns\n\n# Initialize database\nnpx @claude-flow/cli@latest memory init --force\n```\n\n---\n\n## Hive-Mind Consensus\n\n### Queen Types\n| Type | Role |\n|------|------|\n| Strategic Queen | Long-term planning |\n| Tactical Queen | Execution coordination |\n| Adaptive Queen | Dynamic optimization |\n\n### Worker Types (8)\n`researcher`, `coder`, `analyst`, `tester`, `architect`, `reviewer`, `optimizer`, `documenter`\n\n### Consensus Mechanisms\n| Mechanism | Fault Tolerance | Use Case |\n|-----------|-----------------|----------|\n| `byzantine` | f < n/3 faulty | Adversarial |\n| `raft` | f < n/2 failed | Leader-based |\n| `gossip` | Eventually consistent | Large scale |\n| `crdt` | Conflict-free | Distributed |\n| `quorum` | Configurable | Flexible |\n\n### Hive-Mind Commands\n```bash\n# Initialize\nnpx @claude-flow/cli@latest hive-mind init --queen-type strategic\n\n# Status\nnpx @claude-flow/cli@latest hive-mind status\n\n# Spawn workers\nnpx @claude-flow/cli@latest hive-mind spawn --count 5 --type worker\n\n# Consensus\nnpx @claude-flow/cli@latest hive-mind consensus --propose \"task\"\n```\n\n---\n\n## Performance Targets\n\n| Metric | Target | Status |\n|--------|--------|--------|\n| HNSW Search | 150x-12,500x faster | \u2705 Implemented |\n| Memory Reduction | 50-75% | \u2705 Implemented (3.92x) |\n| SONA Integration | Pattern learning | \u2705 Implemented |\n| Flash Attention | 2.49x-7.47x | \uD83D\uDD04 In Progress |\n| MCP Response | <100ms | \u2705 Achieved |\n| CLI Startup | <500ms | \u2705 Achieved |\n| SONA Adaptation | <0.05ms | \uD83D\uDD04 In Progress |\n| Graph Build (1k) | <200ms | \u2705 2.78ms (71.9x headroom) |\n| PageRank (1k) | <100ms | \u2705 12.21ms (8.2x headroom) |\n| Insight Recording | <5ms/each | \u2705 0.12ms (41x headroom) |\n| Consolidation | <500ms | \u2705 0.26ms (1,955x headroom) |\n| Knowledge Transfer | <100ms | \u2705 1.25ms (80x headroom) |\n\n---\n\n## Integration Ecosystem\n\n### Integrated Packages\n| Package | Version | Purpose |\n|---------|---------|---------|\n| agentic-flow | 3.0.0-alpha.1 | Core coordination + ReasoningBank + Router |\n| agentdb | 3.0.0-alpha.10 | Vector database + 8 controllers |\n| @ruvector/attention | 0.1.3 | Flash attention |\n| @ruvector/sona | 0.1.5 | Neural learning |\n\n### Optional Integrations\n| Package | Command |\n|---------|---------|\n| ruv-swarm | `npx ruv-swarm mcp start` |\n| flow-nexus | `npx flow-nexus@latest mcp start` |\n| agentic-jujutsu | `npx agentic-jujutsu@latest` |\n\n### MCP Server Setup\n```bash\n# Add Ruflo MCP\nclaude mcp add ruflo -- npx -y ruflo@latest\n\n# Optional servers\nclaude mcp add ruv-swarm -- npx -y ruv-swarm mcp start\nclaude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start\n```\n\n---\n\n## Quick Reference\n\n### Essential Commands\n```bash\n# Setup\nnpx ruflo@latest init --wizard\nnpx ruflo@latest daemon start\nnpx ruflo@latest doctor --fix\n\n# Swarm\nnpx ruflo@latest swarm init --topology hierarchical --max-agents 8\nnpx ruflo@latest swarm status\n\n# Agents\nnpx ruflo@latest agent spawn -t coder\nnpx ruflo@latest agent list\n\n# Memory\nnpx ruflo@latest memory search --query \"patterns\"\n\n# Hooks\nnpx ruflo@latest hooks pre-task --description \"task\"\nnpx ruflo@latest hooks worker dispatch --trigger optimize\n```\n\n### File Structure\n```\n.claude-flow/\n\u251C\u2500\u2500 config.yaml # Runtime configuration\n\u251C\u2500\u2500 CAPABILITIES.md # This file\n\u251C\u2500\u2500 data/ # Memory storage\n\u251C\u2500\u2500 logs/ # Operation logs\n\u251C\u2500\u2500 sessions/ # Session state\n\u251C\u2500\u2500 hooks/ # Custom hooks\n\u251C\u2500\u2500 agents/ # Agent configs\n\u2514\u2500\u2500 workflows/ # Workflow templates\n```\n\n---\n\n**Full Documentation**: https://github.com/ruvnet/claude-flow\n**Issues**: https://github.com/ruvnet/claude-flow/issues\n";
|
|
1297
|
+
fs.writeFileSync(capabilitiesPath, capabilities, 'utf-8');
|
|
1298
|
+
result.created.files.push('.claude-flow/CAPABILITIES.md');
|
|
1299
|
+
return [2 /*return*/];
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1636
1302
|
}
|
|
1637
1303
|
/**
|
|
1638
1304
|
* Write CLAUDE.md with swarm guidance
|
|
1639
1305
|
*/
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1306
|
+
function writeClaudeMd(targetDir, options, result) {
|
|
1307
|
+
return __awaiter(this, void 0, Promise, function () {
|
|
1308
|
+
var claudeMdPath, inferredTemplate, content;
|
|
1309
|
+
return __generator(this, function (_a) {
|
|
1310
|
+
claudeMdPath = path.join(targetDir, 'CLAUDE.md');
|
|
1311
|
+
if (fs.existsSync(claudeMdPath) && !options.force) {
|
|
1312
|
+
result.skipped.push('CLAUDE.md');
|
|
1313
|
+
return [2 /*return*/];
|
|
1314
|
+
}
|
|
1315
|
+
inferredTemplate = (!options.components.commands && !options.components.agents) ? 'minimal' : undefined;
|
|
1316
|
+
content = generateClaudeMd(options, inferredTemplate);
|
|
1317
|
+
fs.writeFileSync(claudeMdPath, content, 'utf-8');
|
|
1318
|
+
result.created.files.push('CLAUDE.md');
|
|
1319
|
+
return [2 /*return*/];
|
|
1320
|
+
});
|
|
1321
|
+
});
|
|
1651
1322
|
}
|
|
1652
1323
|
/**
|
|
1653
1324
|
* Find source directory for skills/commands/agents
|
|
1654
1325
|
*/
|
|
1655
1326
|
function findSourceDir(type, sourceBaseDir) {
|
|
1656
1327
|
// Build list of possible paths to check
|
|
1657
|
-
|
|
1328
|
+
var possiblePaths = [];
|
|
1658
1329
|
// If explicit source base directory is provided, use it first
|
|
1659
1330
|
if (sourceBaseDir) {
|
|
1660
1331
|
possiblePaths.push(path.join(sourceBaseDir, '.claude', type));
|
|
@@ -1663,37 +1334,38 @@ function findSourceDir(type, sourceBaseDir) {
|
|
|
1663
1334
|
// This is the primary path when running as an npm package
|
|
1664
1335
|
// __dirname is typically /path/to/node_modules/@claude-flow/cli/dist/src/init
|
|
1665
1336
|
// We need to go up 3 levels to reach the package root (dist/src/init -> dist/src -> dist -> root)
|
|
1666
|
-
|
|
1667
|
-
|
|
1337
|
+
var packageRoot = path.resolve(__dirname, '..', '..', '..');
|
|
1338
|
+
var packageDotClaude = path.join(packageRoot, '.claude', type);
|
|
1668
1339
|
if (fs.existsSync(packageDotClaude)) {
|
|
1669
1340
|
possiblePaths.unshift(packageDotClaude); // Add to beginning (highest priority)
|
|
1670
1341
|
}
|
|
1671
1342
|
// From dist/src/init -> go up to project root
|
|
1672
|
-
|
|
1343
|
+
var distPath = __dirname;
|
|
1673
1344
|
// Try to find the project root by looking for .claude directory
|
|
1674
|
-
|
|
1675
|
-
for (
|
|
1676
|
-
|
|
1677
|
-
|
|
1345
|
+
var currentDir = distPath;
|
|
1346
|
+
for (var i = 0; i < 10; i++) {
|
|
1347
|
+
var parentDir = path.dirname(currentDir);
|
|
1348
|
+
var dotClaudePath = path.join(parentDir, '.claude', type);
|
|
1678
1349
|
if (fs.existsSync(dotClaudePath)) {
|
|
1679
1350
|
possiblePaths.push(dotClaudePath);
|
|
1680
1351
|
}
|
|
1681
1352
|
currentDir = parentDir;
|
|
1682
1353
|
}
|
|
1683
1354
|
// Also check relative to process.cwd() for development
|
|
1684
|
-
|
|
1355
|
+
var cwdBased = [
|
|
1685
1356
|
path.join(process.cwd(), '.claude', type),
|
|
1686
1357
|
path.join(process.cwd(), '..', '.claude', type),
|
|
1687
1358
|
path.join(process.cwd(), '..', '..', '.claude', type),
|
|
1688
1359
|
];
|
|
1689
|
-
possiblePaths.push(
|
|
1360
|
+
possiblePaths.push.apply(possiblePaths, cwdBased);
|
|
1690
1361
|
// Check v2 directory for agents
|
|
1691
1362
|
if (type === 'agents') {
|
|
1692
1363
|
possiblePaths.push(path.join(process.cwd(), 'v2', '.claude', type), path.join(process.cwd(), '..', 'v2', '.claude', type));
|
|
1693
1364
|
}
|
|
1694
1365
|
// Plugin directory
|
|
1695
1366
|
possiblePaths.push(path.join(process.cwd(), 'plugin', type), path.join(process.cwd(), '..', 'plugin', type));
|
|
1696
|
-
for (
|
|
1367
|
+
for (var _i = 0, possiblePaths_3 = possiblePaths; _i < possiblePaths_3.length; _i++) {
|
|
1368
|
+
var p = possiblePaths_3[_i];
|
|
1697
1369
|
if (fs.existsSync(p)) {
|
|
1698
1370
|
return p;
|
|
1699
1371
|
}
|
|
@@ -1705,10 +1377,11 @@ function findSourceDir(type, sourceBaseDir) {
|
|
|
1705
1377
|
*/
|
|
1706
1378
|
function copyDirRecursive(src, dest) {
|
|
1707
1379
|
fs.mkdirSync(dest, { recursive: true });
|
|
1708
|
-
|
|
1709
|
-
for (
|
|
1710
|
-
|
|
1711
|
-
|
|
1380
|
+
var entries = fs.readdirSync(src, { withFileTypes: true });
|
|
1381
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
1382
|
+
var entry = entries_1[_i];
|
|
1383
|
+
var srcPath = path.join(src, entry.name);
|
|
1384
|
+
var destPath = path.join(dest, entry.name);
|
|
1712
1385
|
if (entry.isDirectory()) {
|
|
1713
1386
|
copyDirRecursive(srcPath, destPath);
|
|
1714
1387
|
}
|
|
@@ -1721,10 +1394,11 @@ function copyDirRecursive(src, dest) {
|
|
|
1721
1394
|
* Count files with extension in directory
|
|
1722
1395
|
*/
|
|
1723
1396
|
function countFiles(dir, ext) {
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
for (
|
|
1727
|
-
|
|
1397
|
+
var count = 0;
|
|
1398
|
+
var entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1399
|
+
for (var _i = 0, entries_2 = entries; _i < entries_2.length; _i++) {
|
|
1400
|
+
var entry = entries_2[_i];
|
|
1401
|
+
var fullPath = path.join(dir, entry.name);
|
|
1728
1402
|
if (entry.isDirectory()) {
|
|
1729
1403
|
count += countFiles(fullPath, ext);
|
|
1730
1404
|
}
|
|
@@ -1738,8 +1412,8 @@ function countFiles(dir, ext) {
|
|
|
1738
1412
|
* Count enabled hooks
|
|
1739
1413
|
*/
|
|
1740
1414
|
function countEnabledHooks(options) {
|
|
1741
|
-
|
|
1742
|
-
|
|
1415
|
+
var hooks = options.hooks;
|
|
1416
|
+
var count = 0;
|
|
1743
1417
|
if (hooks.preToolUse)
|
|
1744
1418
|
count++;
|
|
1745
1419
|
if (hooks.postToolUse)
|