claude-flow 3.0.0-alpha.5 → 3.0.0-alpha.63
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/README.md +1573 -41
- package/bin/cli.js +140 -26
- package/bin/mcp-server.js +188 -0
- package/dist/src/commands/agent.d.ts +8 -0
- package/dist/src/commands/agent.d.ts.map +1 -0
- package/dist/src/commands/agent.js +819 -0
- package/dist/src/commands/agent.js.map +1 -0
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +1823 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +288 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.d.ts.map +1 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/completions.js.map +1 -0
- package/dist/src/commands/config.d.ts +8 -0
- package/dist/src/commands/config.d.ts.map +1 -0
- package/dist/src/commands/config.js +406 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +593 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +289 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +448 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +831 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts +8 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -0
- package/dist/src/commands/hive-mind.js +844 -0
- package/dist/src/commands/hive-mind.js.map +1 -0
- package/dist/src/commands/hooks.d.ts +8 -0
- package/dist/src/commands/hooks.d.ts.map +1 -0
- package/dist/src/commands/hooks.js +2892 -0
- package/dist/src/commands/hooks.js.map +1 -0
- package/dist/src/commands/index.d.ts +89 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +258 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +8 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +603 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.d.ts.map +1 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/issues.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +11 -0
- package/dist/src/commands/mcp.d.ts.map +1 -0
- package/dist/src/commands/mcp.js +662 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/commands/memory.d.ts +8 -0
- package/dist/src/commands/memory.d.ts.map +1 -0
- package/dist/src/commands/memory.js +1200 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/migrate.d.ts +8 -0
- package/dist/src/commands/migrate.d.ts.map +1 -0
- package/dist/src/commands/migrate.js +398 -0
- package/dist/src/commands/migrate.js.map +1 -0
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +224 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +262 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +630 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/process.d.ts +10 -0
- package/dist/src/commands/process.d.ts.map +1 -0
- package/dist/src/commands/process.js +641 -0
- package/dist/src/commands/process.js.map +1 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.d.ts.map +1 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/progress.js.map +1 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +232 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.d.ts.map +1 -0
- package/dist/src/commands/route.js +813 -0
- package/dist/src/commands/route.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +261 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/session.d.ts +8 -0
- package/dist/src/commands/session.d.ts.map +1 -0
- package/dist/src/commands/session.js +750 -0
- package/dist/src/commands/session.js.map +1 -0
- package/dist/src/commands/start.d.ts +8 -0
- package/dist/src/commands/start.d.ts.map +1 -0
- package/dist/src/commands/start.js +418 -0
- package/dist/src/commands/start.js.map +1 -0
- package/dist/src/commands/status.d.ts +8 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +584 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/swarm.d.ts +8 -0
- package/dist/src/commands/swarm.d.ts.map +1 -0
- package/dist/src/commands/swarm.js +726 -0
- package/dist/src/commands/swarm.js.map +1 -0
- package/dist/src/commands/task.d.ts +8 -0
- package/dist/src/commands/task.d.ts.map +1 -0
- package/dist/src/commands/task.js +671 -0
- package/dist/src/commands/task.js.map +1 -0
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.d.ts.map +1 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/transfer-store.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +8 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +617 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +185 -0
- package/dist/src/config-adapter.js.map +1 -0
- package/dist/src/index.d.ts +57 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +388 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -0
- package/dist/src/init/claudemd-generator.d.ts +15 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +674 -0
- package/dist/src/init/claudemd-generator.js.map +1 -0
- package/dist/src/init/executor.d.ts +11 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +763 -0
- package/dist/src/init/executor.js.map +1 -0
- package/dist/src/init/helpers-generator.d.ts +42 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +613 -0
- package/dist/src/init/helpers-generator.js.map +1 -0
- package/dist/src/init/index.d.ts +12 -0
- package/dist/src/init/index.d.ts.map +1 -0
- package/dist/src/init/index.js +15 -0
- package/dist/src/init/index.js.map +1 -0
- package/dist/src/init/mcp-generator.d.ts +27 -0
- package/dist/src/init/mcp-generator.d.ts.map +1 -0
- package/dist/src/init/mcp-generator.js +100 -0
- package/dist/src/init/mcp-generator.js.map +1 -0
- package/dist/src/init/settings-generator.d.ts +14 -0
- package/dist/src/init/settings-generator.d.ts.map +1 -0
- package/dist/src/init/settings-generator.js +311 -0
- package/dist/src/init/settings-generator.js.map +1 -0
- package/dist/src/init/statusline-generator.d.ts +20 -0
- package/dist/src/init/statusline-generator.d.ts.map +1 -0
- package/dist/src/init/statusline-generator.js +369 -0
- package/dist/src/init/statusline-generator.js.map +1 -0
- package/dist/src/init/types.d.ts +246 -0
- package/dist/src/init/types.d.ts.map +1 -0
- package/dist/src/init/types.js +216 -0
- package/dist/src/init/types.js.map +1 -0
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +207 -0
- package/dist/src/mcp-client.js.map +1 -0
- package/dist/src/mcp-server.d.ts +158 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +584 -0
- package/dist/src/mcp-server.js.map +1 -0
- package/dist/src/mcp-tools/agent-tools.d.ts +8 -0
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agent-tools.js +426 -0
- package/dist/src/mcp-tools/agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
- package/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/config-tools.js +333 -0
- package/dist/src/mcp-tools/config-tools.js.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +447 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts +41 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.js +1836 -0
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -0
- package/dist/src/mcp-tools/index.d.ts +20 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -0
- package/dist/src/mcp-tools/index.js +19 -0
- package/dist/src/mcp-tools/index.js.map +1 -0
- package/dist/src/mcp-tools/memory-tools.d.ts +8 -0
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/memory-tools.js +235 -0
- package/dist/src/mcp-tools/memory-tools.js.map +1 -0
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/progress-tools.js +343 -0
- package/dist/src/mcp-tools/progress-tools.js.map +1 -0
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/session-tools.js +315 -0
- package/dist/src/mcp-tools/session-tools.js.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts +8 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.js +102 -0
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -0
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/task-tools.js +302 -0
- package/dist/src/mcp-tools/task-tools.js.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.js +396 -0
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -0
- package/dist/src/mcp-tools/types.d.ts +31 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/types.js +7 -0
- package/dist/src/mcp-tools/types.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +481 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/memory/memory-initializer.d.ts +229 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +1248 -0
- package/dist/src/memory/memory-initializer.js.map +1 -0
- package/dist/src/output.d.ts +133 -0
- package/dist/src/output.d.ts.map +1 -0
- package/dist/src/output.js +513 -0
- package/dist/src/output.js.map +1 -0
- package/dist/src/parser.d.ts +41 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +353 -0
- package/dist/src/parser.js.map +1 -0
- package/dist/src/plugins/store/discovery.d.ts +73 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +568 -0
- package/dist/src/plugins/store/discovery.js.map +1 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/index.js.map +1 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/search.js.map +1 -0
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/store/types.js.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/standalone-test.js.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -0
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +501 -0
- package/dist/src/prompt.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/ast-analyzer.js.map +1 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +529 -0
- package/dist/src/ruvector/coverage-router.js.map +1 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/coverage-tools.js.map +1 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +698 -0
- package/dist/src/ruvector/diff-classifier.js.map +1 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-analyzer.js.map +1 -0
- package/dist/src/ruvector/index.d.ts +27 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +53 -0
- package/dist/src/ruvector/index.js.map +1 -0
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +681 -0
- package/dist/src/ruvector/q-learning-router.js.map +1 -0
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +243 -0
- package/dist/src/ruvector/vector-db.js.map +1 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/claim-service.js.map +1 -0
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +581 -0
- package/dist/src/services/container-worker-pool.js.map +1 -0
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +997 -0
- package/dist/src/services/headless-worker-executor.js.map +1 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +203 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +745 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +511 -0
- package/dist/src/services/worker-queue.js.map +1 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/suggest.js.map +1 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.d.ts.map +1 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/anonymization/index.js.map +1 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/deploy-seraphine.js.map +1 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/export.js.map +1 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.d.ts.map +1 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/index.js.map +1 -0
- package/dist/src/transfer/ipfs/client.d.ts +31 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +74 -0
- package/dist/src/transfer/ipfs/client.js.map +1 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +410 -0
- package/dist/src/transfer/ipfs/upload.js.map +1 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/models/seraphine.js.map +1 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +180 -0
- package/dist/src/transfer/serialization/cfp.js.map +1 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +275 -0
- package/dist/src/transfer/store/discovery.js.map +1 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +295 -0
- package/dist/src/transfer/store/download.js.map +1 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/index.js.map +1 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +262 -0
- package/dist/src/transfer/store/publish.js.map +1 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.d.ts.map +1 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/registry.js.map +1 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/search.js.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.d.ts.map +1 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/store/types.js.map +1 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/test-seraphine.js.map +1 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.d.ts.map +1 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/tests/test-store.js.map +1 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/transfer/types.js.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +38 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +33 -47
- package/dist/index.d.ts +0 -30
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Executor
|
|
3
|
+
* Main execution logic for V3 initialization
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { dirname } from 'path';
|
|
9
|
+
// ESM-compatible __dirname
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = dirname(__filename);
|
|
12
|
+
import { detectPlatform } from './types.js';
|
|
13
|
+
import { generateSettingsJson } from './settings-generator.js';
|
|
14
|
+
import { generateMCPJson } from './mcp-generator.js';
|
|
15
|
+
import { generateStatuslineScript, generateStatuslineHook } from './statusline-generator.js';
|
|
16
|
+
import { generatePreCommitHook, generatePostCommitHook, generateSessionManager, generateAgentRouter, generateMemoryHelper, } from './helpers-generator.js';
|
|
17
|
+
import { generateClaudeMd, generateMinimalClaudeMd } from './claudemd-generator.js';
|
|
18
|
+
/**
|
|
19
|
+
* Skills to copy based on configuration
|
|
20
|
+
*/
|
|
21
|
+
const SKILLS_MAP = {
|
|
22
|
+
core: [
|
|
23
|
+
'swarm-orchestration',
|
|
24
|
+
'swarm-advanced',
|
|
25
|
+
'sparc-methodology',
|
|
26
|
+
'hooks-automation',
|
|
27
|
+
'pair-programming',
|
|
28
|
+
'verification-quality',
|
|
29
|
+
'stream-chain',
|
|
30
|
+
'skill-builder',
|
|
31
|
+
],
|
|
32
|
+
agentdb: [
|
|
33
|
+
'agentdb-advanced',
|
|
34
|
+
'agentdb-learning',
|
|
35
|
+
'agentdb-memory-patterns',
|
|
36
|
+
'agentdb-optimization',
|
|
37
|
+
'agentdb-vector-search',
|
|
38
|
+
'reasoningbank-agentdb',
|
|
39
|
+
'reasoningbank-intelligence',
|
|
40
|
+
],
|
|
41
|
+
github: [
|
|
42
|
+
'github-code-review',
|
|
43
|
+
'github-multi-repo',
|
|
44
|
+
'github-project-management',
|
|
45
|
+
'github-release-management',
|
|
46
|
+
'github-workflow-automation',
|
|
47
|
+
],
|
|
48
|
+
flowNexus: [
|
|
49
|
+
'flow-nexus-neural',
|
|
50
|
+
'flow-nexus-platform',
|
|
51
|
+
'flow-nexus-swarm',
|
|
52
|
+
],
|
|
53
|
+
v3: [
|
|
54
|
+
'v3-cli-modernization',
|
|
55
|
+
'v3-core-implementation',
|
|
56
|
+
'v3-ddd-architecture',
|
|
57
|
+
'v3-integration-deep',
|
|
58
|
+
'v3-mcp-optimization',
|
|
59
|
+
'v3-memory-unification',
|
|
60
|
+
'v3-performance-optimization',
|
|
61
|
+
'v3-security-overhaul',
|
|
62
|
+
'v3-swarm-coordination',
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Commands to copy based on configuration
|
|
67
|
+
*/
|
|
68
|
+
const COMMANDS_MAP = {
|
|
69
|
+
core: ['claude-flow-help.md', 'claude-flow-swarm.md', 'claude-flow-memory.md'],
|
|
70
|
+
analysis: ['analysis'],
|
|
71
|
+
automation: ['automation'],
|
|
72
|
+
github: ['github'],
|
|
73
|
+
hooks: ['hooks'],
|
|
74
|
+
monitoring: ['monitoring'],
|
|
75
|
+
optimization: ['optimization'],
|
|
76
|
+
sparc: ['sparc'],
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Agents to copy based on configuration
|
|
80
|
+
*/
|
|
81
|
+
const AGENTS_MAP = {
|
|
82
|
+
core: ['core'],
|
|
83
|
+
consensus: ['consensus'],
|
|
84
|
+
github: ['github'],
|
|
85
|
+
hiveMind: ['hive-mind'],
|
|
86
|
+
sparc: ['sparc'],
|
|
87
|
+
swarm: ['swarm'],
|
|
88
|
+
// V3-specific agents
|
|
89
|
+
v3: ['v3'],
|
|
90
|
+
optimization: ['optimization'],
|
|
91
|
+
templates: ['templates'],
|
|
92
|
+
testing: ['testing'],
|
|
93
|
+
sublinear: ['sublinear'],
|
|
94
|
+
flowNexus: ['flow-nexus'],
|
|
95
|
+
analysis: ['analysis'],
|
|
96
|
+
architecture: ['architecture'],
|
|
97
|
+
development: ['development'],
|
|
98
|
+
devops: ['devops'],
|
|
99
|
+
documentation: ['documentation'],
|
|
100
|
+
specialized: ['specialized'],
|
|
101
|
+
goal: ['goal'],
|
|
102
|
+
sona: ['sona'],
|
|
103
|
+
payments: ['payments'],
|
|
104
|
+
data: ['data'],
|
|
105
|
+
custom: ['custom'],
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Directory structure to create
|
|
109
|
+
*/
|
|
110
|
+
const DIRECTORIES = {
|
|
111
|
+
claude: [
|
|
112
|
+
'.claude',
|
|
113
|
+
'.claude/skills',
|
|
114
|
+
'.claude/commands',
|
|
115
|
+
'.claude/agents',
|
|
116
|
+
'.claude/helpers',
|
|
117
|
+
],
|
|
118
|
+
runtime: [
|
|
119
|
+
'.claude-flow',
|
|
120
|
+
'.claude-flow/data',
|
|
121
|
+
'.claude-flow/logs',
|
|
122
|
+
'.claude-flow/sessions',
|
|
123
|
+
'.claude-flow/hooks',
|
|
124
|
+
'.claude-flow/agents',
|
|
125
|
+
'.claude-flow/workflows',
|
|
126
|
+
],
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Execute initialization
|
|
130
|
+
*/
|
|
131
|
+
export async function executeInit(options) {
|
|
132
|
+
// Detect platform
|
|
133
|
+
const platform = detectPlatform();
|
|
134
|
+
const result = {
|
|
135
|
+
success: true,
|
|
136
|
+
platform,
|
|
137
|
+
created: {
|
|
138
|
+
directories: [],
|
|
139
|
+
files: [],
|
|
140
|
+
},
|
|
141
|
+
skipped: [],
|
|
142
|
+
errors: [],
|
|
143
|
+
summary: {
|
|
144
|
+
skillsCount: 0,
|
|
145
|
+
commandsCount: 0,
|
|
146
|
+
agentsCount: 0,
|
|
147
|
+
hooksEnabled: 0,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
const targetDir = options.targetDir;
|
|
151
|
+
try {
|
|
152
|
+
// Create directory structure
|
|
153
|
+
await createDirectories(targetDir, options, result);
|
|
154
|
+
// Generate and write settings.json
|
|
155
|
+
if (options.components.settings) {
|
|
156
|
+
await writeSettings(targetDir, options, result);
|
|
157
|
+
}
|
|
158
|
+
// Generate and write .mcp.json
|
|
159
|
+
if (options.components.mcp) {
|
|
160
|
+
await writeMCPConfig(targetDir, options, result);
|
|
161
|
+
}
|
|
162
|
+
// Copy skills
|
|
163
|
+
if (options.components.skills) {
|
|
164
|
+
await copySkills(targetDir, options, result);
|
|
165
|
+
}
|
|
166
|
+
// Copy commands
|
|
167
|
+
if (options.components.commands) {
|
|
168
|
+
await copyCommands(targetDir, options, result);
|
|
169
|
+
}
|
|
170
|
+
// Copy agents
|
|
171
|
+
if (options.components.agents) {
|
|
172
|
+
await copyAgents(targetDir, options, result);
|
|
173
|
+
}
|
|
174
|
+
// Generate helpers
|
|
175
|
+
if (options.components.helpers) {
|
|
176
|
+
await writeHelpers(targetDir, options, result);
|
|
177
|
+
}
|
|
178
|
+
// Generate statusline
|
|
179
|
+
if (options.components.statusline) {
|
|
180
|
+
await writeStatusline(targetDir, options, result);
|
|
181
|
+
}
|
|
182
|
+
// Generate runtime config
|
|
183
|
+
if (options.components.runtime) {
|
|
184
|
+
await writeRuntimeConfig(targetDir, options, result);
|
|
185
|
+
}
|
|
186
|
+
// Generate CLAUDE.md
|
|
187
|
+
if (options.components.claudeMd) {
|
|
188
|
+
await writeClaudeMd(targetDir, options, result);
|
|
189
|
+
}
|
|
190
|
+
// Count enabled hooks
|
|
191
|
+
result.summary.hooksEnabled = countEnabledHooks(options);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
result.success = false;
|
|
195
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
196
|
+
}
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Create directory structure
|
|
201
|
+
*/
|
|
202
|
+
async function createDirectories(targetDir, options, result) {
|
|
203
|
+
const dirs = [
|
|
204
|
+
...DIRECTORIES.claude,
|
|
205
|
+
...(options.components.runtime ? DIRECTORIES.runtime : []),
|
|
206
|
+
];
|
|
207
|
+
for (const dir of dirs) {
|
|
208
|
+
const fullPath = path.join(targetDir, dir);
|
|
209
|
+
if (!fs.existsSync(fullPath)) {
|
|
210
|
+
fs.mkdirSync(fullPath, { recursive: true });
|
|
211
|
+
result.created.directories.push(dir);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Write settings.json
|
|
217
|
+
*/
|
|
218
|
+
async function writeSettings(targetDir, options, result) {
|
|
219
|
+
const settingsPath = path.join(targetDir, '.claude', 'settings.json');
|
|
220
|
+
if (fs.existsSync(settingsPath) && !options.force) {
|
|
221
|
+
result.skipped.push('.claude/settings.json');
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const content = generateSettingsJson(options);
|
|
225
|
+
fs.writeFileSync(settingsPath, content, 'utf-8');
|
|
226
|
+
result.created.files.push('.claude/settings.json');
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Write .mcp.json
|
|
230
|
+
*/
|
|
231
|
+
async function writeMCPConfig(targetDir, options, result) {
|
|
232
|
+
const mcpPath = path.join(targetDir, '.mcp.json');
|
|
233
|
+
if (fs.existsSync(mcpPath) && !options.force) {
|
|
234
|
+
result.skipped.push('.mcp.json');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const content = generateMCPJson(options);
|
|
238
|
+
fs.writeFileSync(mcpPath, content, 'utf-8');
|
|
239
|
+
result.created.files.push('.mcp.json');
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Copy skills from source
|
|
243
|
+
*/
|
|
244
|
+
async function copySkills(targetDir, options, result) {
|
|
245
|
+
const skillsConfig = options.skills;
|
|
246
|
+
const targetSkillsDir = path.join(targetDir, '.claude', 'skills');
|
|
247
|
+
// Determine which skills to copy
|
|
248
|
+
const skillsToCopy = [];
|
|
249
|
+
if (skillsConfig.all) {
|
|
250
|
+
// Copy all available skills
|
|
251
|
+
Object.values(SKILLS_MAP).forEach(skills => skillsToCopy.push(...skills));
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
if (skillsConfig.core)
|
|
255
|
+
skillsToCopy.push(...SKILLS_MAP.core);
|
|
256
|
+
if (skillsConfig.agentdb)
|
|
257
|
+
skillsToCopy.push(...SKILLS_MAP.agentdb);
|
|
258
|
+
if (skillsConfig.github)
|
|
259
|
+
skillsToCopy.push(...SKILLS_MAP.github);
|
|
260
|
+
if (skillsConfig.flowNexus)
|
|
261
|
+
skillsToCopy.push(...SKILLS_MAP.flowNexus);
|
|
262
|
+
if (skillsConfig.v3)
|
|
263
|
+
skillsToCopy.push(...SKILLS_MAP.v3);
|
|
264
|
+
}
|
|
265
|
+
// Find source skills directory
|
|
266
|
+
const sourceSkillsDir = findSourceDir('skills', options.sourceBaseDir);
|
|
267
|
+
if (!sourceSkillsDir) {
|
|
268
|
+
result.errors.push('Could not find source skills directory');
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// Copy each skill
|
|
272
|
+
for (const skillName of [...new Set(skillsToCopy)]) {
|
|
273
|
+
const sourcePath = path.join(sourceSkillsDir, skillName);
|
|
274
|
+
const targetPath = path.join(targetSkillsDir, skillName);
|
|
275
|
+
if (fs.existsSync(sourcePath)) {
|
|
276
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
277
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
278
|
+
result.created.files.push(`.claude/skills/${skillName}`);
|
|
279
|
+
result.summary.skillsCount++;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
result.skipped.push(`.claude/skills/${skillName}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Copy commands from source
|
|
289
|
+
*/
|
|
290
|
+
async function copyCommands(targetDir, options, result) {
|
|
291
|
+
const commandsConfig = options.commands;
|
|
292
|
+
const targetCommandsDir = path.join(targetDir, '.claude', 'commands');
|
|
293
|
+
// Determine which commands to copy
|
|
294
|
+
const commandsToCopy = [];
|
|
295
|
+
if (commandsConfig.all) {
|
|
296
|
+
Object.values(COMMANDS_MAP).forEach(cmds => commandsToCopy.push(...cmds));
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
if (commandsConfig.core)
|
|
300
|
+
commandsToCopy.push(...COMMANDS_MAP.core);
|
|
301
|
+
if (commandsConfig.analysis)
|
|
302
|
+
commandsToCopy.push(...COMMANDS_MAP.analysis);
|
|
303
|
+
if (commandsConfig.automation)
|
|
304
|
+
commandsToCopy.push(...COMMANDS_MAP.automation);
|
|
305
|
+
if (commandsConfig.github)
|
|
306
|
+
commandsToCopy.push(...COMMANDS_MAP.github);
|
|
307
|
+
if (commandsConfig.hooks)
|
|
308
|
+
commandsToCopy.push(...COMMANDS_MAP.hooks);
|
|
309
|
+
if (commandsConfig.monitoring)
|
|
310
|
+
commandsToCopy.push(...COMMANDS_MAP.monitoring);
|
|
311
|
+
if (commandsConfig.optimization)
|
|
312
|
+
commandsToCopy.push(...COMMANDS_MAP.optimization);
|
|
313
|
+
if (commandsConfig.sparc)
|
|
314
|
+
commandsToCopy.push(...COMMANDS_MAP.sparc);
|
|
315
|
+
}
|
|
316
|
+
// Find source commands directory
|
|
317
|
+
const sourceCommandsDir = findSourceDir('commands', options.sourceBaseDir);
|
|
318
|
+
if (!sourceCommandsDir) {
|
|
319
|
+
result.errors.push('Could not find source commands directory');
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
// Copy each command/directory
|
|
323
|
+
for (const cmdName of [...new Set(commandsToCopy)]) {
|
|
324
|
+
const sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
325
|
+
const targetPath = path.join(targetCommandsDir, cmdName);
|
|
326
|
+
if (fs.existsSync(sourcePath)) {
|
|
327
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
328
|
+
if (fs.statSync(sourcePath).isDirectory()) {
|
|
329
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
333
|
+
}
|
|
334
|
+
result.created.files.push(`.claude/commands/${cmdName}`);
|
|
335
|
+
result.summary.commandsCount++;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
result.skipped.push(`.claude/commands/${cmdName}`);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Copy agents from source
|
|
345
|
+
*/
|
|
346
|
+
async function copyAgents(targetDir, options, result) {
|
|
347
|
+
const agentsConfig = options.agents;
|
|
348
|
+
const targetAgentsDir = path.join(targetDir, '.claude', 'agents');
|
|
349
|
+
// Determine which agents to copy
|
|
350
|
+
const agentsToCopy = [];
|
|
351
|
+
if (agentsConfig.all) {
|
|
352
|
+
Object.values(AGENTS_MAP).forEach(agents => agentsToCopy.push(...agents));
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
if (agentsConfig.core)
|
|
356
|
+
agentsToCopy.push(...AGENTS_MAP.core);
|
|
357
|
+
if (agentsConfig.consensus)
|
|
358
|
+
agentsToCopy.push(...AGENTS_MAP.consensus);
|
|
359
|
+
if (agentsConfig.github)
|
|
360
|
+
agentsToCopy.push(...AGENTS_MAP.github);
|
|
361
|
+
if (agentsConfig.hiveMind)
|
|
362
|
+
agentsToCopy.push(...AGENTS_MAP.hiveMind);
|
|
363
|
+
if (agentsConfig.sparc)
|
|
364
|
+
agentsToCopy.push(...AGENTS_MAP.sparc);
|
|
365
|
+
if (agentsConfig.swarm)
|
|
366
|
+
agentsToCopy.push(...AGENTS_MAP.swarm);
|
|
367
|
+
// V3-specific agent categories
|
|
368
|
+
if (agentsConfig.v3)
|
|
369
|
+
agentsToCopy.push(...(AGENTS_MAP.v3 || []));
|
|
370
|
+
if (agentsConfig.optimization)
|
|
371
|
+
agentsToCopy.push(...(AGENTS_MAP.optimization || []));
|
|
372
|
+
if (agentsConfig.testing)
|
|
373
|
+
agentsToCopy.push(...(AGENTS_MAP.testing || []));
|
|
374
|
+
}
|
|
375
|
+
// Find source agents directory
|
|
376
|
+
const sourceAgentsDir = findSourceDir('agents', options.sourceBaseDir);
|
|
377
|
+
if (!sourceAgentsDir) {
|
|
378
|
+
result.errors.push('Could not find source agents directory');
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
// Copy each agent category
|
|
382
|
+
for (const agentCategory of [...new Set(agentsToCopy)]) {
|
|
383
|
+
const sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
384
|
+
const targetPath = path.join(targetAgentsDir, agentCategory);
|
|
385
|
+
if (fs.existsSync(sourcePath)) {
|
|
386
|
+
if (!fs.existsSync(targetPath) || options.force) {
|
|
387
|
+
copyDirRecursive(sourcePath, targetPath);
|
|
388
|
+
// Count agent files (.yaml and .md)
|
|
389
|
+
const yamlFiles = countFiles(sourcePath, '.yaml');
|
|
390
|
+
const mdFiles = countFiles(sourcePath, '.md');
|
|
391
|
+
result.summary.agentsCount += yamlFiles + mdFiles;
|
|
392
|
+
result.created.files.push(`.claude/agents/${agentCategory}`);
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
result.skipped.push(`.claude/agents/${agentCategory}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Find source helpers directory
|
|
402
|
+
*/
|
|
403
|
+
function findSourceHelpersDir(sourceBaseDir) {
|
|
404
|
+
const possiblePaths = [];
|
|
405
|
+
// If explicit source base directory is provided, check it first
|
|
406
|
+
if (sourceBaseDir) {
|
|
407
|
+
possiblePaths.push(path.join(sourceBaseDir, '.claude', 'helpers'));
|
|
408
|
+
}
|
|
409
|
+
// IMPORTANT: Check the package's own .claude/helpers directory
|
|
410
|
+
// This is the primary path when running as an npm package
|
|
411
|
+
// __dirname is typically /path/to/node_modules/@claude-flow/cli/dist/src/init
|
|
412
|
+
// We need to go up 4 levels to reach the package root
|
|
413
|
+
const packageRoot = path.resolve(__dirname, '..', '..', '..', '..');
|
|
414
|
+
const packageHelpers = path.join(packageRoot, '.claude', 'helpers');
|
|
415
|
+
if (fs.existsSync(packageHelpers)) {
|
|
416
|
+
possiblePaths.unshift(packageHelpers); // Add to beginning (highest priority)
|
|
417
|
+
}
|
|
418
|
+
// From dist/src/init -> go up to project root
|
|
419
|
+
let currentDir = __dirname;
|
|
420
|
+
for (let i = 0; i < 10; i++) {
|
|
421
|
+
const parentDir = path.dirname(currentDir);
|
|
422
|
+
const helpersPath = path.join(parentDir, '.claude', 'helpers');
|
|
423
|
+
if (fs.existsSync(helpersPath)) {
|
|
424
|
+
possiblePaths.push(helpersPath);
|
|
425
|
+
}
|
|
426
|
+
currentDir = parentDir;
|
|
427
|
+
}
|
|
428
|
+
// Also check relative to process.cwd() for development
|
|
429
|
+
const cwdBased = [
|
|
430
|
+
path.join(process.cwd(), '.claude', 'helpers'),
|
|
431
|
+
path.join(process.cwd(), '..', '.claude', 'helpers'),
|
|
432
|
+
path.join(process.cwd(), '..', '..', '.claude', 'helpers'),
|
|
433
|
+
];
|
|
434
|
+
possiblePaths.push(...cwdBased);
|
|
435
|
+
for (const p of possiblePaths) {
|
|
436
|
+
if (fs.existsSync(p)) {
|
|
437
|
+
return p;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Write helper scripts
|
|
444
|
+
*/
|
|
445
|
+
async function writeHelpers(targetDir, options, result) {
|
|
446
|
+
const helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
447
|
+
// Find source helpers directory (works for npm package and local dev)
|
|
448
|
+
const sourceHelpersDir = findSourceHelpersDir(options.sourceBaseDir);
|
|
449
|
+
// Try to copy existing helpers from source first
|
|
450
|
+
if (sourceHelpersDir && fs.existsSync(sourceHelpersDir)) {
|
|
451
|
+
const helperFiles = fs.readdirSync(sourceHelpersDir);
|
|
452
|
+
let copiedCount = 0;
|
|
453
|
+
for (const file of helperFiles) {
|
|
454
|
+
const sourcePath = path.join(sourceHelpersDir, file);
|
|
455
|
+
const destPath = path.join(helpersDir, file);
|
|
456
|
+
// Skip directories and only copy files
|
|
457
|
+
if (!fs.statSync(sourcePath).isFile())
|
|
458
|
+
continue;
|
|
459
|
+
if (!fs.existsSync(destPath) || options.force) {
|
|
460
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
461
|
+
// Make shell scripts and mjs files executable
|
|
462
|
+
if (file.endsWith('.sh') || file.endsWith('.mjs')) {
|
|
463
|
+
fs.chmodSync(destPath, '755');
|
|
464
|
+
}
|
|
465
|
+
result.created.files.push(`.claude/helpers/${file}`);
|
|
466
|
+
copiedCount++;
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
result.skipped.push(`.claude/helpers/${file}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if (copiedCount > 0) {
|
|
473
|
+
return; // Skip generating if we copied from source
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
// Fall back to generating helpers if source not available
|
|
477
|
+
const helpers = {
|
|
478
|
+
'pre-commit': generatePreCommitHook(),
|
|
479
|
+
'post-commit': generatePostCommitHook(),
|
|
480
|
+
'session.js': generateSessionManager(),
|
|
481
|
+
'router.js': generateAgentRouter(),
|
|
482
|
+
'memory.js': generateMemoryHelper(),
|
|
483
|
+
};
|
|
484
|
+
for (const [name, content] of Object.entries(helpers)) {
|
|
485
|
+
const filePath = path.join(helpersDir, name);
|
|
486
|
+
if (!fs.existsSync(filePath) || options.force) {
|
|
487
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
488
|
+
// Make shell scripts executable
|
|
489
|
+
if (!name.endsWith('.js')) {
|
|
490
|
+
fs.chmodSync(filePath, '755');
|
|
491
|
+
}
|
|
492
|
+
result.created.files.push(`.claude/helpers/${name}`);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
result.skipped.push(`.claude/helpers/${name}`);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Find source .claude directory for statusline files
|
|
501
|
+
*/
|
|
502
|
+
function findSourceClaudeDir(sourceBaseDir) {
|
|
503
|
+
const possiblePaths = [];
|
|
504
|
+
// If explicit source base directory is provided, check it first
|
|
505
|
+
if (sourceBaseDir) {
|
|
506
|
+
possiblePaths.push(path.join(sourceBaseDir, '.claude'));
|
|
507
|
+
}
|
|
508
|
+
// IMPORTANT: Check the package's own .claude directory
|
|
509
|
+
const packageRoot = path.resolve(__dirname, '..', '..', '..', '..');
|
|
510
|
+
const packageClaude = path.join(packageRoot, '.claude');
|
|
511
|
+
if (fs.existsSync(packageClaude)) {
|
|
512
|
+
possiblePaths.unshift(packageClaude); // Add to beginning (highest priority)
|
|
513
|
+
}
|
|
514
|
+
// From dist/src/init -> go up to project root
|
|
515
|
+
let currentDir = __dirname;
|
|
516
|
+
for (let i = 0; i < 10; i++) {
|
|
517
|
+
const parentDir = path.dirname(currentDir);
|
|
518
|
+
const claudePath = path.join(parentDir, '.claude');
|
|
519
|
+
if (fs.existsSync(claudePath)) {
|
|
520
|
+
possiblePaths.push(claudePath);
|
|
521
|
+
}
|
|
522
|
+
currentDir = parentDir;
|
|
523
|
+
}
|
|
524
|
+
for (const p of possiblePaths) {
|
|
525
|
+
if (fs.existsSync(p)) {
|
|
526
|
+
return p;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Write statusline configuration
|
|
533
|
+
*/
|
|
534
|
+
async function writeStatusline(targetDir, options, result) {
|
|
535
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
536
|
+
const helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
537
|
+
// Find source .claude directory (works for npm package and local dev)
|
|
538
|
+
const sourceClaudeDir = findSourceClaudeDir(options.sourceBaseDir);
|
|
539
|
+
// Try to copy existing advanced statusline files from source
|
|
540
|
+
const advancedStatuslineFiles = [
|
|
541
|
+
{ src: 'statusline.sh', dest: 'statusline.sh', dir: claudeDir },
|
|
542
|
+
{ src: 'statusline.mjs', dest: 'statusline.mjs', dir: claudeDir },
|
|
543
|
+
];
|
|
544
|
+
let copiedAdvanced = false;
|
|
545
|
+
if (sourceClaudeDir) {
|
|
546
|
+
for (const file of advancedStatuslineFiles) {
|
|
547
|
+
const sourcePath = path.join(sourceClaudeDir, file.src);
|
|
548
|
+
const destPath = path.join(file.dir, file.dest);
|
|
549
|
+
if (fs.existsSync(sourcePath)) {
|
|
550
|
+
if (!fs.existsSync(destPath) || options.force) {
|
|
551
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
552
|
+
// Make shell scripts and mjs executable
|
|
553
|
+
if (file.src.endsWith('.sh') || file.src.endsWith('.mjs')) {
|
|
554
|
+
fs.chmodSync(destPath, '755');
|
|
555
|
+
}
|
|
556
|
+
result.created.files.push(`.claude/${file.dest}`);
|
|
557
|
+
copiedAdvanced = true;
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
result.skipped.push(`.claude/${file.dest}`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
// Fall back to generating simple statusline if advanced files not available
|
|
566
|
+
if (!copiedAdvanced) {
|
|
567
|
+
const statuslineScript = generateStatuslineScript(options);
|
|
568
|
+
const statuslineHook = generateStatuslineHook(options);
|
|
569
|
+
const files = {
|
|
570
|
+
'statusline.cjs': statuslineScript, // .cjs for ES module project compatibility
|
|
571
|
+
'statusline-hook.sh': statuslineHook,
|
|
572
|
+
};
|
|
573
|
+
for (const [name, content] of Object.entries(files)) {
|
|
574
|
+
const filePath = path.join(helpersDir, name);
|
|
575
|
+
if (!fs.existsSync(filePath) || options.force) {
|
|
576
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
577
|
+
result.created.files.push(`.claude/helpers/${name}`);
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
result.skipped.push(`.claude/helpers/${name}`);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Write runtime configuration (.claude-flow/)
|
|
587
|
+
*/
|
|
588
|
+
async function writeRuntimeConfig(targetDir, options, result) {
|
|
589
|
+
const configPath = path.join(targetDir, '.claude-flow', 'config.yaml');
|
|
590
|
+
if (fs.existsSync(configPath) && !options.force) {
|
|
591
|
+
result.skipped.push('.claude-flow/config.yaml');
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const config = `# Claude Flow V3 Runtime Configuration
|
|
595
|
+
# Generated: ${new Date().toISOString()}
|
|
596
|
+
|
|
597
|
+
version: "3.0.0"
|
|
598
|
+
|
|
599
|
+
swarm:
|
|
600
|
+
topology: ${options.runtime.topology}
|
|
601
|
+
maxAgents: ${options.runtime.maxAgents}
|
|
602
|
+
autoScale: true
|
|
603
|
+
coordinationStrategy: consensus
|
|
604
|
+
|
|
605
|
+
memory:
|
|
606
|
+
backend: ${options.runtime.memoryBackend}
|
|
607
|
+
enableHNSW: ${options.runtime.enableHNSW}
|
|
608
|
+
persistPath: .claude-flow/data
|
|
609
|
+
cacheSize: 100
|
|
610
|
+
|
|
611
|
+
neural:
|
|
612
|
+
enabled: ${options.runtime.enableNeural}
|
|
613
|
+
modelPath: .claude-flow/neural
|
|
614
|
+
|
|
615
|
+
hooks:
|
|
616
|
+
enabled: true
|
|
617
|
+
autoExecute: true
|
|
618
|
+
|
|
619
|
+
mcp:
|
|
620
|
+
autoStart: ${options.mcp.autoStart}
|
|
621
|
+
port: ${options.mcp.port}
|
|
622
|
+
`;
|
|
623
|
+
fs.writeFileSync(configPath, config, 'utf-8');
|
|
624
|
+
result.created.files.push('.claude-flow/config.yaml');
|
|
625
|
+
// Write .gitignore
|
|
626
|
+
const gitignorePath = path.join(targetDir, '.claude-flow', '.gitignore');
|
|
627
|
+
const gitignore = `# Claude Flow runtime files
|
|
628
|
+
data/
|
|
629
|
+
logs/
|
|
630
|
+
sessions/
|
|
631
|
+
neural/
|
|
632
|
+
*.log
|
|
633
|
+
*.tmp
|
|
634
|
+
`;
|
|
635
|
+
if (!fs.existsSync(gitignorePath) || options.force) {
|
|
636
|
+
fs.writeFileSync(gitignorePath, gitignore, 'utf-8');
|
|
637
|
+
result.created.files.push('.claude-flow/.gitignore');
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Write CLAUDE.md with swarm guidance
|
|
642
|
+
*/
|
|
643
|
+
async function writeClaudeMd(targetDir, options, result) {
|
|
644
|
+
const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
|
|
645
|
+
if (fs.existsSync(claudeMdPath) && !options.force) {
|
|
646
|
+
result.skipped.push('CLAUDE.md');
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
// Use minimal version for minimal init, full version otherwise
|
|
650
|
+
const isMinimal = !options.components.commands && !options.components.agents;
|
|
651
|
+
const content = isMinimal ? generateMinimalClaudeMd(options) : generateClaudeMd(options);
|
|
652
|
+
fs.writeFileSync(claudeMdPath, content, 'utf-8');
|
|
653
|
+
result.created.files.push('CLAUDE.md');
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Find source directory for skills/commands/agents
|
|
657
|
+
*/
|
|
658
|
+
function findSourceDir(type, sourceBaseDir) {
|
|
659
|
+
// Build list of possible paths to check
|
|
660
|
+
const possiblePaths = [];
|
|
661
|
+
// If explicit source base directory is provided, use it first
|
|
662
|
+
if (sourceBaseDir) {
|
|
663
|
+
possiblePaths.push(path.join(sourceBaseDir, '.claude', type));
|
|
664
|
+
}
|
|
665
|
+
// IMPORTANT: Check the package's own .claude directory first
|
|
666
|
+
// This is the primary path when running as an npm package
|
|
667
|
+
// __dirname is typically /path/to/node_modules/@claude-flow/cli/dist/src/init
|
|
668
|
+
// We need to go up 4 levels to reach the package root
|
|
669
|
+
const packageRoot = path.resolve(__dirname, '..', '..', '..', '..');
|
|
670
|
+
const packageDotClaude = path.join(packageRoot, '.claude', type);
|
|
671
|
+
if (fs.existsSync(packageDotClaude)) {
|
|
672
|
+
possiblePaths.unshift(packageDotClaude); // Add to beginning (highest priority)
|
|
673
|
+
}
|
|
674
|
+
// From dist/src/init -> go up to project root
|
|
675
|
+
const distPath = __dirname;
|
|
676
|
+
// Try to find the project root by looking for .claude directory
|
|
677
|
+
let currentDir = distPath;
|
|
678
|
+
for (let i = 0; i < 10; i++) {
|
|
679
|
+
const parentDir = path.dirname(currentDir);
|
|
680
|
+
const dotClaudePath = path.join(parentDir, '.claude', type);
|
|
681
|
+
if (fs.existsSync(dotClaudePath)) {
|
|
682
|
+
possiblePaths.push(dotClaudePath);
|
|
683
|
+
}
|
|
684
|
+
currentDir = parentDir;
|
|
685
|
+
}
|
|
686
|
+
// Also check relative to process.cwd() for development
|
|
687
|
+
const cwdBased = [
|
|
688
|
+
path.join(process.cwd(), '.claude', type),
|
|
689
|
+
path.join(process.cwd(), '..', '.claude', type),
|
|
690
|
+
path.join(process.cwd(), '..', '..', '.claude', type),
|
|
691
|
+
];
|
|
692
|
+
possiblePaths.push(...cwdBased);
|
|
693
|
+
// Check v2 directory for agents
|
|
694
|
+
if (type === 'agents') {
|
|
695
|
+
possiblePaths.push(path.join(process.cwd(), 'v2', '.claude', type), path.join(process.cwd(), '..', 'v2', '.claude', type));
|
|
696
|
+
}
|
|
697
|
+
// Plugin directory
|
|
698
|
+
possiblePaths.push(path.join(process.cwd(), 'plugin', type), path.join(process.cwd(), '..', 'plugin', type));
|
|
699
|
+
for (const p of possiblePaths) {
|
|
700
|
+
if (fs.existsSync(p)) {
|
|
701
|
+
return p;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Copy directory recursively
|
|
708
|
+
*/
|
|
709
|
+
function copyDirRecursive(src, dest) {
|
|
710
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
711
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
712
|
+
for (const entry of entries) {
|
|
713
|
+
const srcPath = path.join(src, entry.name);
|
|
714
|
+
const destPath = path.join(dest, entry.name);
|
|
715
|
+
if (entry.isDirectory()) {
|
|
716
|
+
copyDirRecursive(srcPath, destPath);
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
fs.copyFileSync(srcPath, destPath);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Count files with extension in directory
|
|
725
|
+
*/
|
|
726
|
+
function countFiles(dir, ext) {
|
|
727
|
+
let count = 0;
|
|
728
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
729
|
+
for (const entry of entries) {
|
|
730
|
+
const fullPath = path.join(dir, entry.name);
|
|
731
|
+
if (entry.isDirectory()) {
|
|
732
|
+
count += countFiles(fullPath, ext);
|
|
733
|
+
}
|
|
734
|
+
else if (entry.name.endsWith(ext)) {
|
|
735
|
+
count++;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return count;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Count enabled hooks
|
|
742
|
+
*/
|
|
743
|
+
function countEnabledHooks(options) {
|
|
744
|
+
const hooks = options.hooks;
|
|
745
|
+
let count = 0;
|
|
746
|
+
if (hooks.preToolUse)
|
|
747
|
+
count++;
|
|
748
|
+
if (hooks.postToolUse)
|
|
749
|
+
count++;
|
|
750
|
+
if (hooks.userPromptSubmit)
|
|
751
|
+
count++;
|
|
752
|
+
if (hooks.sessionStart)
|
|
753
|
+
count++;
|
|
754
|
+
if (hooks.stop)
|
|
755
|
+
count++;
|
|
756
|
+
if (hooks.notification)
|
|
757
|
+
count++;
|
|
758
|
+
if (hooks.permissionRequest)
|
|
759
|
+
count++;
|
|
760
|
+
return count;
|
|
761
|
+
}
|
|
762
|
+
export default executeInit;
|
|
763
|
+
//# sourceMappingURL=executor.js.map
|