@cloudpftc/opencode-orchestrator 3.5.15
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/.opencode/agents/architect.yaml +33 -0
- package/.opencode/agents/coder.yaml +45 -0
- package/.opencode/agents/coordinator.yaml +38 -0
- package/.opencode/agents/performance-engineer.yaml +33 -0
- package/.opencode/agents/researcher.yaml +32 -0
- package/.opencode/agents/reviewer.yaml +32 -0
- package/.opencode/agents/security-architect.yaml +32 -0
- package/.opencode/agents/tester.yaml +37 -0
- package/.opencode/skills/agent-adaptive-coordinator/SKILL.md +403 -0
- package/.opencode/skills/agent-agent/SKILL.md +823 -0
- package/.opencode/skills/agent-agentic-payments/SKILL.md +133 -0
- package/.opencode/skills/agent-analyze-code-quality/SKILL.md +186 -0
- package/.opencode/skills/agent-app-store/SKILL.md +95 -0
- package/.opencode/skills/agent-arch-system-design/SKILL.md +162 -0
- package/.opencode/skills/agent-architecture/SKILL.md +479 -0
- package/.opencode/skills/agent-authentication/SKILL.md +76 -0
- package/.opencode/skills/agent-automation-smart-agent/SKILL.md +212 -0
- package/.opencode/skills/agent-base-template-generator/SKILL.md +49 -0
- package/.opencode/skills/agent-benchmark-suite/SKILL.md +672 -0
- package/.opencode/skills/agent-byzantine-coordinator/SKILL.md +70 -0
- package/.opencode/skills/agent-challenges/SKILL.md +88 -0
- package/.opencode/skills/agent-code-analyzer/SKILL.md +217 -0
- package/.opencode/skills/agent-code-goal-planner/SKILL.md +453 -0
- package/.opencode/skills/agent-code-review-swarm/SKILL.md +545 -0
- package/.opencode/skills/agent-coder/SKILL.md +273 -0
- package/.opencode/skills/agent-collective-intelligence-coordinator/SKILL.md +137 -0
- package/.opencode/skills/agent-consensus-coordinator/SKILL.md +345 -0
- package/.opencode/skills/agent-coordination/SKILL.md +82 -0
- package/.opencode/skills/agent-coordinator-swarm-init/SKILL.md +112 -0
- package/.opencode/skills/agent-crdt-synchronizer/SKILL.md +1004 -0
- package/.opencode/skills/agent-data-ml-model/SKILL.md +200 -0
- package/.opencode/skills/agent-dev-backend-api/SKILL.md +352 -0
- package/.opencode/skills/agent-docs-api-openapi/SKILL.md +181 -0
- package/.opencode/skills/agent-github-modes/SKILL.md +180 -0
- package/.opencode/skills/agent-github-pr-manager/SKILL.md +184 -0
- package/.opencode/skills/agent-goal-planner/SKILL.md +80 -0
- package/.opencode/skills/agent-gossip-coordinator/SKILL.md +70 -0
- package/.opencode/skills/agent-hierarchical-coordinator/SKILL.md +334 -0
- package/.opencode/skills/agent-implementer-sparc-coder/SKILL.md +266 -0
- package/.opencode/skills/agent-issue-tracker/SKILL.md +326 -0
- package/.opencode/skills/agent-load-balancer/SKILL.md +438 -0
- package/.opencode/skills/agent-matrix-optimizer/SKILL.md +192 -0
- package/.opencode/skills/agent-memory-coordinator/SKILL.md +194 -0
- package/.opencode/skills/agent-mesh-coordinator/SKILL.md +399 -0
- package/.opencode/skills/agent-migration-plan/SKILL.md +753 -0
- package/.opencode/skills/agent-multi-repo-swarm/SKILL.md +560 -0
- package/.opencode/skills/agent-neural-network/SKILL.md +95 -0
- package/.opencode/skills/agent-ops-cicd-github/SKILL.md +171 -0
- package/.opencode/skills/agent-orchestrator-task/SKILL.md +146 -0
- package/.opencode/skills/agent-pagerank-analyzer/SKILL.md +306 -0
- package/.opencode/skills/agent-payments/SKILL.md +90 -0
- package/.opencode/skills/agent-performance-analyzer/SKILL.md +206 -0
- package/.opencode/skills/agent-performance-benchmarker/SKILL.md +858 -0
- package/.opencode/skills/agent-performance-monitor/SKILL.md +679 -0
- package/.opencode/skills/agent-performance-optimizer/SKILL.md +375 -0
- package/.opencode/skills/agent-planner/SKILL.md +175 -0
- package/.opencode/skills/agent-pr-manager/SKILL.md +198 -0
- package/.opencode/skills/agent-production-validator/SKILL.md +402 -0
- package/.opencode/skills/agent-project-board-sync/SKILL.md +516 -0
- package/.opencode/skills/agent-pseudocode/SKILL.md +325 -0
- package/.opencode/skills/agent-queen-coordinator/SKILL.md +210 -0
- package/.opencode/skills/agent-quorum-manager/SKILL.md +830 -0
- package/.opencode/skills/agent-raft-manager/SKILL.md +70 -0
- package/.opencode/skills/agent-refinement/SKILL.md +532 -0
- package/.opencode/skills/agent-release-manager/SKILL.md +374 -0
- package/.opencode/skills/agent-release-swarm/SKILL.md +590 -0
- package/.opencode/skills/agent-repo-architect/SKILL.md +405 -0
- package/.opencode/skills/agent-researcher/SKILL.md +197 -0
- package/.opencode/skills/agent-resource-allocator/SKILL.md +681 -0
- package/.opencode/skills/agent-reviewer/SKILL.md +333 -0
- package/.opencode/skills/agent-safla-neural/SKILL.md +81 -0
- package/.opencode/skills/agent-sandbox/SKILL.md +83 -0
- package/.opencode/skills/agent-scout-explorer/SKILL.md +249 -0
- package/.opencode/skills/agent-security-manager/SKILL.md +629 -0
- package/.opencode/skills/agent-sona-learning-optimizer/SKILL.md +81 -0
- package/.opencode/skills/agent-sparc-coordinator/SKILL.md +190 -0
- package/.opencode/skills/agent-spec-mobile-react-native/SKILL.md +232 -0
- package/.opencode/skills/agent-specification/SKILL.md +283 -0
- package/.opencode/skills/agent-swarm/SKILL.md +83 -0
- package/.opencode/skills/agent-swarm-issue/SKILL.md +580 -0
- package/.opencode/skills/agent-swarm-memory-manager/SKILL.md +200 -0
- package/.opencode/skills/agent-swarm-pr/SKILL.md +435 -0
- package/.opencode/skills/agent-sync-coordinator/SKILL.md +459 -0
- package/.opencode/skills/agent-tdd-london-swarm/SKILL.md +251 -0
- package/.opencode/skills/agent-test-long-runner/SKILL.md +51 -0
- package/.opencode/skills/agent-tester/SKILL.md +326 -0
- package/.opencode/skills/agent-topology-optimizer/SKILL.md +815 -0
- package/.opencode/skills/agent-trading-predictor/SKILL.md +253 -0
- package/.opencode/skills/agent-user-tools/SKILL.md +103 -0
- package/.opencode/skills/agent-v3-integration-architect/SKILL.md +353 -0
- package/.opencode/skills/agent-v3-memory-specialist/SKILL.md +325 -0
- package/.opencode/skills/agent-v3-performance-engineer/SKILL.md +404 -0
- package/.opencode/skills/agent-v3-queen-coordinator/SKILL.md +105 -0
- package/.opencode/skills/agent-v3-security-architect/SKILL.md +181 -0
- package/.opencode/skills/agent-worker-specialist/SKILL.md +224 -0
- package/.opencode/skills/agent-workflow/SKILL.md +91 -0
- package/.opencode/skills/agent-workflow-automation/SKILL.md +642 -0
- package/.opencode/skills/agentdb-advanced/SKILL.md +552 -0
- package/.opencode/skills/agentdb-learning/SKILL.md +547 -0
- package/.opencode/skills/agentdb-memory-patterns/SKILL.md +341 -0
- package/.opencode/skills/agentdb-optimization/SKILL.md +511 -0
- package/.opencode/skills/agentdb-vector-search/SKILL.md +341 -0
- package/.opencode/skills/agentic-jujutsu/SKILL.md +647 -0
- package/.opencode/skills/claims/SKILL.md +72 -0
- package/.opencode/skills/embeddings/SKILL.md +71 -0
- package/.opencode/skills/flow-nexus-neural/SKILL.md +740 -0
- package/.opencode/skills/flow-nexus-platform/SKILL.md +1159 -0
- package/.opencode/skills/flow-nexus-swarm/SKILL.md +612 -0
- package/.opencode/skills/github-automation/SKILL.md +65 -0
- package/.opencode/skills/github-code-review/SKILL.md +1142 -0
- package/.opencode/skills/github-multi-repo/SKILL.md +876 -0
- package/.opencode/skills/github-project-management/SKILL.md +1279 -0
- package/.opencode/skills/github-release-management/SKILL.md +1083 -0
- package/.opencode/skills/github-workflow-automation/SKILL.md +1067 -0
- package/.opencode/skills/hive-mind/SKILL.md +67 -0
- package/.opencode/skills/hive-mind-advanced/SKILL.md +714 -0
- package/.opencode/skills/hooks-automation/SKILL.md +1203 -0
- package/.opencode/skills/memory-management/SKILL.md +128 -0
- package/.opencode/skills/neural-training/SKILL.md +70 -0
- package/.opencode/skills/pair-programming/SKILL.md +1204 -0
- package/.opencode/skills/performance-analysis/SKILL.md +565 -0
- package/.opencode/skills/reasoningbank-agentdb/SKILL.md +448 -0
- package/.opencode/skills/reasoningbank-intelligence/SKILL.md +203 -0
- package/.opencode/skills/security-audit/SKILL.md +137 -0
- package/.opencode/skills/skill-builder/SKILL.md +912 -0
- package/.opencode/skills/sparc-methodology/SKILL.md +120 -0
- package/.opencode/skills/stream-chain/SKILL.md +565 -0
- package/.opencode/skills/swarm-advanced/SKILL.md +975 -0
- package/.opencode/skills/swarm-orchestration/SKILL.md +116 -0
- package/.opencode/skills/v3-cli-modernization/SKILL.md +874 -0
- package/.opencode/skills/v3-core-implementation/SKILL.md +799 -0
- package/.opencode/skills/v3-ddd-architecture/SKILL.md +444 -0
- package/.opencode/skills/v3-integration-deep/SKILL.md +243 -0
- package/.opencode/skills/v3-mcp-optimization/SKILL.md +779 -0
- package/.opencode/skills/v3-memory-unification/SKILL.md +176 -0
- package/.opencode/skills/v3-performance-optimization/SKILL.md +392 -0
- package/.opencode/skills/v3-security-overhaul/SKILL.md +84 -0
- package/.opencode/skills/v3-swarm-coordination/SKILL.md +342 -0
- package/.opencode/skills/verification-quality/SKILL.md +651 -0
- package/.opencode/skills/worker-benchmarks/SKILL.md +137 -0
- package/.opencode/skills/worker-integration/SKILL.md +156 -0
- package/.opencode/skills/workflow-automation/SKILL.md +80 -0
- package/LICENSE +21 -0
- package/README.md +7393 -0
- package/bin/cli.js +11 -0
- package/bin/npx-repair.js +7 -0
- package/bin/npx-safe-launch.js +9 -0
- package/opencode.json +84 -0
- package/package.json +131 -0
- package/v3/@claude-flow/cli/README.md +7536 -0
- package/v3/@claude-flow/cli/bin/cli.js +156 -0
- package/v3/@claude-flow/cli/bin/mcp-server.js +189 -0
- package/v3/@claude-flow/cli/bin/preinstall.cjs +2 -0
- package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/v3/@claude-flow/cli/dist/src/appliance/gguf-engine.js +425 -0
- package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/v3/@claude-flow/cli/dist/src/appliance/ruvllm-bridge.js +292 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-builder.js +328 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-distribution.js +370 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-format.js +393 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-runner.js +237 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/v3/@claude-flow/cli/dist/src/appliance/rvfa-signing.js +347 -0
- package/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/benchmarks/pretrain/index.js +404 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent.js +819 -0
- package/v3/@claude-flow/cli/dist/src/commands/analyze.d.ts +19 -0
- package/v3/@claude-flow/cli/dist/src/commands/analyze.js +1823 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance-advanced.js +215 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/appliance.js +406 -0
- package/v3/@claude-flow/cli/dist/src/commands/benchmark.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/benchmark.js +459 -0
- package/v3/@claude-flow/cli/dist/src/commands/claims.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/claims.js +373 -0
- package/v3/@claude-flow/cli/dist/src/commands/completions.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/completions.js +539 -0
- package/v3/@claude-flow/cli/dist/src/commands/config.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/config.js +406 -0
- package/v3/@claude-flow/cli/dist/src/commands/daemon.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/daemon.js +609 -0
- package/v3/@claude-flow/cli/dist/src/commands/deployment.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/deployment.js +289 -0
- package/v3/@claude-flow/cli/dist/src/commands/doctor.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/doctor.js +548 -0
- package/v3/@claude-flow/cli/dist/src/commands/embeddings.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1576 -0
- package/v3/@claude-flow/cli/dist/src/commands/guidance.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/guidance.js +560 -0
- package/v3/@claude-flow/cli/dist/src/commands/hive-mind.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +1145 -0
- package/v3/@claude-flow/cli/dist/src/commands/hooks.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +3759 -0
- package/v3/@claude-flow/cli/dist/src/commands/index.d.ts +113 -0
- package/v3/@claude-flow/cli/dist/src/commands/index.js +368 -0
- package/v3/@claude-flow/cli/dist/src/commands/init.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/init.js +822 -0
- package/v3/@claude-flow/cli/dist/src/commands/issues.d.ts +21 -0
- package/v3/@claude-flow/cli/dist/src/commands/issues.js +567 -0
- package/v3/@claude-flow/cli/dist/src/commands/mcp.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/mcp.js +715 -0
- package/v3/@claude-flow/cli/dist/src/commands/memory.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/memory.js +1292 -0
- package/v3/@claude-flow/cli/dist/src/commands/migrate.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/migrate.js +410 -0
- package/v3/@claude-flow/cli/dist/src/commands/neural.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/neural.js +1448 -0
- package/v3/@claude-flow/cli/dist/src/commands/performance.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/performance.js +579 -0
- package/v3/@claude-flow/cli/dist/src/commands/plugins.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/plugins.js +820 -0
- package/v3/@claude-flow/cli/dist/src/commands/process.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/process.js +641 -0
- package/v3/@claude-flow/cli/dist/src/commands/progress.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/progress.js +259 -0
- package/v3/@claude-flow/cli/dist/src/commands/providers.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/providers.js +232 -0
- package/v3/@claude-flow/cli/dist/src/commands/route.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/commands/route.js +813 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/backup.js +746 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/benchmark.js +480 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/import.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/import.js +349 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/index.d.ts +29 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/index.js +129 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/init.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/init.js +431 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/migrate.js +481 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/optimize.js +503 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/setup.js +765 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/status.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/commands/ruvector/status.js +456 -0
- package/v3/@claude-flow/cli/dist/src/commands/security.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/security.js +575 -0
- package/v3/@claude-flow/cli/dist/src/commands/session.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/session.js +750 -0
- package/v3/@claude-flow/cli/dist/src/commands/start.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/start.js +418 -0
- package/v3/@claude-flow/cli/dist/src/commands/status.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/status.js +591 -0
- package/v3/@claude-flow/cli/dist/src/commands/swarm.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/swarm.js +748 -0
- package/v3/@claude-flow/cli/dist/src/commands/task.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/task.js +671 -0
- package/v3/@claude-flow/cli/dist/src/commands/transfer-store.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +428 -0
- package/v3/@claude-flow/cli/dist/src/commands/update.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/update.js +276 -0
- package/v3/@claude-flow/cli/dist/src/commands/workflow.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/commands/workflow.js +617 -0
- package/v3/@claude-flow/cli/dist/src/config-adapter.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/config-adapter.js +186 -0
- package/v3/@claude-flow/cli/dist/src/index.d.ts +76 -0
- package/v3/@claude-flow/cli/dist/src/index.js +470 -0
- package/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/v3/@claude-flow/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +25 -0
- package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +486 -0
- package/v3/@claude-flow/cli/dist/src/init/executor.d.ts +41 -0
- package/v3/@claude-flow/cli/dist/src/init/executor.js +1734 -0
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +60 -0
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +1166 -0
- package/v3/@claude-flow/cli/dist/src/init/index.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/init/index.js +15 -0
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +31 -0
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +147 -0
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +399 -0
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +28 -0
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +817 -0
- package/v3/@claude-flow/cli/dist/src/init/types.d.ts +283 -0
- package/v3/@claude-flow/cli/dist/src/init/types.js +254 -0
- package/v3/@claude-flow/cli/dist/src/mcp-client.d.ts +92 -0
- package/v3/@claude-flow/cli/dist/src/mcp-client.js +237 -0
- package/v3/@claude-flow/cli/dist/src/mcp-server.d.ts +161 -0
- package/v3/@claude-flow/cli/dist/src/mcp-server.js +627 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +549 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +557 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/auto-install.js +131 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.js +550 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +732 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.js +343 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +486 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +426 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +782 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +373 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +583 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +2969 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/index.d.ts +23 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/index.js +22 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +499 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +461 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +534 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/progress-tools.js +348 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +434 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +315 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +197 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +417 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +338 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.js +246 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.js +396 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/types.d.ts +31 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/types.js +7 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +572 -0
- package/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.d.ts +271 -0
- package/v3/@claude-flow/cli/dist/src/memory/ewc-consolidation.js +542 -0
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +285 -0
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +794 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +407 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +1494 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +405 -0
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +2105 -0
- package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +633 -0
- package/v3/@claude-flow/cli/dist/src/output.d.ts +133 -0
- package/v3/@claude-flow/cli/dist/src/output.js +514 -0
- package/v3/@claude-flow/cli/dist/src/parser.d.ts +41 -0
- package/v3/@claude-flow/cli/dist/src/parser.js +377 -0
- package/v3/@claude-flow/cli/dist/src/plugins/manager.d.ts +133 -0
- package/v3/@claude-flow/cli/dist/src/plugins/manager.js +400 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.d.ts +88 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +1147 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/index.d.ts +76 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/index.js +141 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/search.d.ts +46 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/search.js +230 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/types.d.ts +274 -0
- package/v3/@claude-flow/cli/dist/src/plugins/store/types.js +7 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/standalone-test.js +188 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/v3/@claude-flow/cli/dist/src/production/circuit-breaker.d.ts +101 -0
- package/v3/@claude-flow/cli/dist/src/production/circuit-breaker.js +241 -0
- package/v3/@claude-flow/cli/dist/src/production/error-handler.d.ts +92 -0
- package/v3/@claude-flow/cli/dist/src/production/error-handler.js +299 -0
- package/v3/@claude-flow/cli/dist/src/production/index.d.ts +23 -0
- package/v3/@claude-flow/cli/dist/src/production/index.js +18 -0
- package/v3/@claude-flow/cli/dist/src/production/monitoring.d.ts +161 -0
- package/v3/@claude-flow/cli/dist/src/production/monitoring.js +356 -0
- package/v3/@claude-flow/cli/dist/src/production/rate-limiter.d.ts +80 -0
- package/v3/@claude-flow/cli/dist/src/production/rate-limiter.js +201 -0
- package/v3/@claude-flow/cli/dist/src/production/retry.d.ts +48 -0
- package/v3/@claude-flow/cli/dist/src/production/retry.js +179 -0
- package/v3/@claude-flow/cli/dist/src/prompt.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/prompt.js +501 -0
- package/v3/@claude-flow/cli/dist/src/runtime/headless.d.ts +60 -0
- package/v3/@claude-flow/cli/dist/src/runtime/headless.js +284 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ast-analyzer.js +277 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-router.js +529 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/coverage-tools.js +157 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +698 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/enhanced-model-router.js +529 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.js +643 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/graph-analyzer.js +929 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/index.d.ts +34 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/index.js +60 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/lora-adapter.js +455 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/model-router.d.ts +220 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/model-router.js +488 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.d.ts +206 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.js +626 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/q-learning-router.js +681 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/semantic-router.js +178 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/vector-db.d.ts +69 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/vector-db.js +243 -0
- package/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/v3/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +95 -0
- package/v3/@claude-flow/cli/dist/src/services/claim-service.d.ts +204 -0
- package/v3/@claude-flow/cli/dist/src/services/claim-service.js +818 -0
- package/v3/@claude-flow/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/v3/@claude-flow/cli/dist/src/services/container-worker-pool.js +583 -0
- package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.d.ts +302 -0
- package/v3/@claude-flow/cli/dist/src/services/headless-worker-executor.js +971 -0
- package/v3/@claude-flow/cli/dist/src/services/index.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/services/index.js +11 -0
- package/v3/@claude-flow/cli/dist/src/services/registry-api.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/services/registry-api.js +146 -0
- package/v3/@claude-flow/cli/dist/src/services/ruvector-training.d.ts +214 -0
- package/v3/@claude-flow/cli/dist/src/services/ruvector-training.js +497 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +203 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +756 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-queue.d.ts +194 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-queue.js +513 -0
- package/v3/@claude-flow/cli/dist/src/suggest.d.ts +53 -0
- package/v3/@claude-flow/cli/dist/src/suggest.js +200 -0
- package/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/v3/@claude-flow/cli/dist/src/transfer/anonymization/index.js +175 -0
- package/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/transfer/deploy-seraphine.js +205 -0
- package/v3/@claude-flow/cli/dist/src/transfer/export.d.ts +25 -0
- package/v3/@claude-flow/cli/dist/src/transfer/export.js +113 -0
- package/v3/@claude-flow/cli/dist/src/transfer/index.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/transfer/index.js +31 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/client.js +307 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/v3/@claude-flow/cli/dist/src/transfer/ipfs/upload.js +411 -0
- package/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/v3/@claude-flow/cli/dist/src/transfer/models/seraphine.js +373 -0
- package/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/v3/@claude-flow/cli/dist/src/transfer/serialization/cfp.js +183 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/gcs.js +256 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/index.d.ts +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/storage/index.js +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.d.ts +84 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.js +382 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/download.d.ts +70 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/download.js +334 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/index.d.ts +84 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/index.js +153 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/publish.d.ts +76 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/publish.js +294 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/registry.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/registry.js +285 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/search.d.ts +54 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/search.js +232 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/types.d.ts +193 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/types.js +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/v3/@claude-flow/cli/dist/src/transfer/test-seraphine.js +105 -0
- package/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/transfer/tests/test-store.js +214 -0
- package/v3/@claude-flow/cli/dist/src/transfer/types.d.ts +245 -0
- package/v3/@claude-flow/cli/dist/src/transfer/types.js +6 -0
- package/v3/@claude-flow/cli/dist/src/types.d.ts +198 -0
- package/v3/@claude-flow/cli/dist/src/types.js +38 -0
- package/v3/@claude-flow/cli/dist/src/update/checker.d.ts +34 -0
- package/v3/@claude-flow/cli/dist/src/update/checker.js +190 -0
- package/v3/@claude-flow/cli/dist/src/update/executor.d.ts +32 -0
- package/v3/@claude-flow/cli/dist/src/update/executor.js +181 -0
- package/v3/@claude-flow/cli/dist/src/update/index.d.ts +33 -0
- package/v3/@claude-flow/cli/dist/src/update/index.js +64 -0
- package/v3/@claude-flow/cli/dist/src/update/rate-limiter.d.ts +20 -0
- package/v3/@claude-flow/cli/dist/src/update/rate-limiter.js +96 -0
- package/v3/@claude-flow/cli/dist/src/update/validator.d.ts +17 -0
- package/v3/@claude-flow/cli/dist/src/update/validator.js +123 -0
- package/v3/@claude-flow/cli/package.json +108 -0
- package/v3/@claude-flow/guidance/README.md +1195 -0
- package/v3/@claude-flow/guidance/dist/adversarial.d.ts +284 -0
- package/v3/@claude-flow/guidance/dist/adversarial.js +572 -0
- package/v3/@claude-flow/guidance/dist/analyzer.d.ts +530 -0
- package/v3/@claude-flow/guidance/dist/analyzer.js +2518 -0
- package/v3/@claude-flow/guidance/dist/artifacts.d.ts +283 -0
- package/v3/@claude-flow/guidance/dist/artifacts.js +356 -0
- package/v3/@claude-flow/guidance/dist/authority.d.ts +290 -0
- package/v3/@claude-flow/guidance/dist/authority.js +558 -0
- package/v3/@claude-flow/guidance/dist/capabilities.d.ts +209 -0
- package/v3/@claude-flow/guidance/dist/capabilities.js +485 -0
- package/v3/@claude-flow/guidance/dist/coherence.d.ts +233 -0
- package/v3/@claude-flow/guidance/dist/coherence.js +372 -0
- package/v3/@claude-flow/guidance/dist/compiler.d.ts +87 -0
- package/v3/@claude-flow/guidance/dist/compiler.js +419 -0
- package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +225 -0
- package/v3/@claude-flow/guidance/dist/conformance-kit.js +629 -0
- package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +214 -0
- package/v3/@claude-flow/guidance/dist/continue-gate.js +353 -0
- package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +17 -0
- package/v3/@claude-flow/guidance/dist/crypto-utils.js +24 -0
- package/v3/@claude-flow/guidance/dist/evolution.d.ts +282 -0
- package/v3/@claude-flow/guidance/dist/evolution.js +500 -0
- package/v3/@claude-flow/guidance/dist/gates.d.ts +79 -0
- package/v3/@claude-flow/guidance/dist/gates.js +302 -0
- package/v3/@claude-flow/guidance/dist/gateway.d.ts +206 -0
- package/v3/@claude-flow/guidance/dist/gateway.js +452 -0
- package/v3/@claude-flow/guidance/dist/generators.d.ts +153 -0
- package/v3/@claude-flow/guidance/dist/generators.js +682 -0
- package/v3/@claude-flow/guidance/dist/headless.d.ts +177 -0
- package/v3/@claude-flow/guidance/dist/headless.js +342 -0
- package/v3/@claude-flow/guidance/dist/hooks.d.ts +109 -0
- package/v3/@claude-flow/guidance/dist/hooks.js +347 -0
- package/v3/@claude-flow/guidance/dist/index.d.ts +205 -0
- package/v3/@claude-flow/guidance/dist/index.js +321 -0
- package/v3/@claude-flow/guidance/dist/ledger.d.ts +162 -0
- package/v3/@claude-flow/guidance/dist/ledger.js +375 -0
- package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +289 -0
- package/v3/@claude-flow/guidance/dist/manifest-validator.js +838 -0
- package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +222 -0
- package/v3/@claude-flow/guidance/dist/memory-gate.js +382 -0
- package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +265 -0
- package/v3/@claude-flow/guidance/dist/meta-governance.js +348 -0
- package/v3/@claude-flow/guidance/dist/optimizer.d.ts +104 -0
- package/v3/@claude-flow/guidance/dist/optimizer.js +329 -0
- package/v3/@claude-flow/guidance/dist/persistence.d.ts +189 -0
- package/v3/@claude-flow/guidance/dist/persistence.js +464 -0
- package/v3/@claude-flow/guidance/dist/proof.d.ts +185 -0
- package/v3/@claude-flow/guidance/dist/proof.js +238 -0
- package/v3/@claude-flow/guidance/dist/retriever.d.ts +116 -0
- package/v3/@claude-flow/guidance/dist/retriever.js +394 -0
- package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +370 -0
- package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +738 -0
- package/v3/@claude-flow/guidance/dist/temporal.d.ts +426 -0
- package/v3/@claude-flow/guidance/dist/temporal.js +658 -0
- package/v3/@claude-flow/guidance/dist/trust.d.ts +283 -0
- package/v3/@claude-flow/guidance/dist/trust.js +473 -0
- package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +276 -0
- package/v3/@claude-flow/guidance/dist/truth-anchors.js +488 -0
- package/v3/@claude-flow/guidance/dist/types.d.ts +378 -0
- package/v3/@claude-flow/guidance/dist/types.js +10 -0
- package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +372 -0
- package/v3/@claude-flow/guidance/dist/uncertainty.js +619 -0
- package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +48 -0
- package/v3/@claude-flow/guidance/dist/wasm-kernel.js +158 -0
- package/v3/@claude-flow/guidance/package.json +197 -0
- package/v3/@claude-flow/shared/README.md +323 -0
- package/v3/@claude-flow/shared/dist/core/config/defaults.d.ts +41 -0
- package/v3/@claude-flow/shared/dist/core/config/defaults.js +186 -0
- package/v3/@claude-flow/shared/dist/core/config/index.d.ts +8 -0
- package/v3/@claude-flow/shared/dist/core/config/index.js +12 -0
- package/v3/@claude-flow/shared/dist/core/config/loader.d.ts +45 -0
- package/v3/@claude-flow/shared/dist/core/config/loader.js +222 -0
- package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +1134 -0
- package/v3/@claude-flow/shared/dist/core/config/schema.js +158 -0
- package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +92 -0
- package/v3/@claude-flow/shared/dist/core/config/validator.js +147 -0
- package/v3/@claude-flow/shared/dist/core/event-bus.d.ts +31 -0
- package/v3/@claude-flow/shared/dist/core/event-bus.js +197 -0
- package/v3/@claude-flow/shared/dist/core/index.d.ts +15 -0
- package/v3/@claude-flow/shared/dist/core/index.js +19 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +200 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.js +6 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +310 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +7 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +224 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.js +46 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/index.d.ts +10 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/index.js +15 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +298 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.js +7 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +185 -0
- package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.js +6 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +35 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +101 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +60 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +166 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/index.d.ts +46 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/index.js +64 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +56 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +195 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +83 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.js +193 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +49 -0
- package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.js +253 -0
- package/v3/@claude-flow/shared/dist/events/domain-events.d.ts +282 -0
- package/v3/@claude-flow/shared/dist/events/domain-events.js +165 -0
- package/v3/@claude-flow/shared/dist/events/event-store.d.ts +126 -0
- package/v3/@claude-flow/shared/dist/events/event-store.js +416 -0
- package/v3/@claude-flow/shared/dist/events/event-store.test.d.ts +8 -0
- package/v3/@claude-flow/shared/dist/events/event-store.test.js +293 -0
- package/v3/@claude-flow/shared/dist/events/example-usage.d.ts +10 -0
- package/v3/@claude-flow/shared/dist/events/example-usage.js +193 -0
- package/v3/@claude-flow/shared/dist/events/index.d.ts +21 -0
- package/v3/@claude-flow/shared/dist/events/index.js +22 -0
- package/v3/@claude-flow/shared/dist/events/projections.d.ts +177 -0
- package/v3/@claude-flow/shared/dist/events/projections.js +421 -0
- package/v3/@claude-flow/shared/dist/events/rvf-event-log.d.ts +82 -0
- package/v3/@claude-flow/shared/dist/events/rvf-event-log.js +340 -0
- package/v3/@claude-flow/shared/dist/events/state-reconstructor.d.ts +101 -0
- package/v3/@claude-flow/shared/dist/events/state-reconstructor.js +263 -0
- package/v3/@claude-flow/shared/dist/events.d.ts +80 -0
- package/v3/@claude-flow/shared/dist/events.js +249 -0
- package/v3/@claude-flow/shared/dist/hooks/example-usage.d.ts +42 -0
- package/v3/@claude-flow/shared/dist/hooks/example-usage.js +351 -0
- package/v3/@claude-flow/shared/dist/hooks/executor.d.ts +100 -0
- package/v3/@claude-flow/shared/dist/hooks/executor.js +264 -0
- package/v3/@claude-flow/shared/dist/hooks/hooks.test.d.ts +9 -0
- package/v3/@claude-flow/shared/dist/hooks/hooks.test.js +322 -0
- package/v3/@claude-flow/shared/dist/hooks/index.d.ts +52 -0
- package/v3/@claude-flow/shared/dist/hooks/index.js +51 -0
- package/v3/@claude-flow/shared/dist/hooks/registry.d.ts +133 -0
- package/v3/@claude-flow/shared/dist/hooks/registry.js +277 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +105 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.js +481 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +144 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.js +328 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +158 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.js +450 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/index.d.ts +17 -0
- package/v3/@claude-flow/shared/dist/hooks/safety/index.js +17 -0
- package/v3/@claude-flow/shared/dist/hooks/session-hooks.d.ts +234 -0
- package/v3/@claude-flow/shared/dist/hooks/session-hooks.js +334 -0
- package/v3/@claude-flow/shared/dist/hooks/task-hooks.d.ts +163 -0
- package/v3/@claude-flow/shared/dist/hooks/task-hooks.js +326 -0
- package/v3/@claude-flow/shared/dist/hooks/types.d.ts +267 -0
- package/v3/@claude-flow/shared/dist/hooks/types.js +62 -0
- package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +9 -0
- package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +93 -0
- package/v3/@claude-flow/shared/dist/index.d.ts +20 -0
- package/v3/@claude-flow/shared/dist/index.js +50 -0
- package/v3/@claude-flow/shared/dist/mcp/connection-pool.d.ts +98 -0
- package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +364 -0
- package/v3/@claude-flow/shared/dist/mcp/index.d.ts +69 -0
- package/v3/@claude-flow/shared/dist/mcp/index.js +84 -0
- package/v3/@claude-flow/shared/dist/mcp/server.d.ts +166 -0
- package/v3/@claude-flow/shared/dist/mcp/server.js +593 -0
- package/v3/@claude-flow/shared/dist/mcp/session-manager.d.ts +136 -0
- package/v3/@claude-flow/shared/dist/mcp/session-manager.js +335 -0
- package/v3/@claude-flow/shared/dist/mcp/tool-registry.d.ts +178 -0
- package/v3/@claude-flow/shared/dist/mcp/tool-registry.js +439 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +104 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/http.js +476 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/index.d.ts +102 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/index.js +238 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +104 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/stdio.js +263 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +133 -0
- package/v3/@claude-flow/shared/dist/mcp/transport/websocket.js +396 -0
- package/v3/@claude-flow/shared/dist/mcp/types.d.ts +438 -0
- package/v3/@claude-flow/shared/dist/mcp/types.js +54 -0
- package/v3/@claude-flow/shared/dist/plugin-interface.d.ts +544 -0
- package/v3/@claude-flow/shared/dist/plugin-interface.js +23 -0
- package/v3/@claude-flow/shared/dist/plugin-loader.d.ts +139 -0
- package/v3/@claude-flow/shared/dist/plugin-loader.js +434 -0
- package/v3/@claude-flow/shared/dist/plugin-registry.d.ts +183 -0
- package/v3/@claude-flow/shared/dist/plugin-registry.js +457 -0
- package/v3/@claude-flow/shared/dist/plugins/index.d.ts +10 -0
- package/v3/@claude-flow/shared/dist/plugins/index.js +10 -0
- package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +106 -0
- package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +241 -0
- package/v3/@claude-flow/shared/dist/plugins/official/index.d.ts +10 -0
- package/v3/@claude-flow/shared/dist/plugins/official/index.js +10 -0
- package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +121 -0
- package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +355 -0
- package/v3/@claude-flow/shared/dist/plugins/types.d.ts +93 -0
- package/v3/@claude-flow/shared/dist/plugins/types.js +9 -0
- package/v3/@claude-flow/shared/dist/resilience/bulkhead.d.ts +105 -0
- package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +206 -0
- package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +132 -0
- package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.js +233 -0
- package/v3/@claude-flow/shared/dist/resilience/index.d.ts +19 -0
- package/v3/@claude-flow/shared/dist/resilience/index.js +19 -0
- package/v3/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +168 -0
- package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +314 -0
- package/v3/@claude-flow/shared/dist/resilience/retry.d.ts +91 -0
- package/v3/@claude-flow/shared/dist/resilience/retry.js +159 -0
- package/v3/@claude-flow/shared/dist/security/index.d.ts +10 -0
- package/v3/@claude-flow/shared/dist/security/index.js +12 -0
- package/v3/@claude-flow/shared/dist/security/input-validation.d.ts +73 -0
- package/v3/@claude-flow/shared/dist/security/input-validation.js +201 -0
- package/v3/@claude-flow/shared/dist/security/secure-random.d.ts +92 -0
- package/v3/@claude-flow/shared/dist/security/secure-random.js +142 -0
- package/v3/@claude-flow/shared/dist/services/index.d.ts +7 -0
- package/v3/@claude-flow/shared/dist/services/index.js +7 -0
- package/v3/@claude-flow/shared/dist/services/v3-progress.service.d.ts +124 -0
- package/v3/@claude-flow/shared/dist/services/v3-progress.service.js +402 -0
- package/v3/@claude-flow/shared/dist/types/agent.types.d.ts +137 -0
- package/v3/@claude-flow/shared/dist/types/agent.types.js +6 -0
- package/v3/@claude-flow/shared/dist/types/index.d.ts +11 -0
- package/v3/@claude-flow/shared/dist/types/index.js +17 -0
- package/v3/@claude-flow/shared/dist/types/mcp.types.d.ts +266 -0
- package/v3/@claude-flow/shared/dist/types/mcp.types.js +7 -0
- package/v3/@claude-flow/shared/dist/types/memory.types.d.ts +236 -0
- package/v3/@claude-flow/shared/dist/types/memory.types.js +7 -0
- package/v3/@claude-flow/shared/dist/types/swarm.types.d.ts +186 -0
- package/v3/@claude-flow/shared/dist/types/swarm.types.js +65 -0
- package/v3/@claude-flow/shared/dist/types/task.types.d.ts +178 -0
- package/v3/@claude-flow/shared/dist/types/task.types.js +32 -0
- package/v3/@claude-flow/shared/dist/types.d.ts +197 -0
- package/v3/@claude-flow/shared/dist/types.js +21 -0
- package/v3/@claude-flow/shared/dist/utils/secure-logger.d.ts +69 -0
- package/v3/@claude-flow/shared/dist/utils/secure-logger.js +208 -0
- package/v3/@claude-flow/shared/package.json +42 -0
- package/v3/README.md +493 -0
|
@@ -0,0 +1,1166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers Generator
|
|
3
|
+
* Creates utility scripts in .claude/helpers/
|
|
4
|
+
*/
|
|
5
|
+
import { generateStatuslineScript, generateStatuslineHook } from './statusline-generator.js';
|
|
6
|
+
/**
|
|
7
|
+
* Generate pre-commit hook script
|
|
8
|
+
*/
|
|
9
|
+
export function generatePreCommitHook() {
|
|
10
|
+
return `#!/bin/bash
|
|
11
|
+
# Claude Flow Pre-Commit Hook
|
|
12
|
+
# Validates code quality before commit
|
|
13
|
+
|
|
14
|
+
set -e
|
|
15
|
+
|
|
16
|
+
echo "🔍 Running Claude Flow pre-commit checks..."
|
|
17
|
+
|
|
18
|
+
# Get staged files
|
|
19
|
+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
20
|
+
|
|
21
|
+
# Run validation for each staged file
|
|
22
|
+
for FILE in $STAGED_FILES; do
|
|
23
|
+
if [[ "$FILE" =~ \\.(ts|js|tsx|jsx)$ ]]; then
|
|
24
|
+
echo " Validating: $FILE"
|
|
25
|
+
npx @claude-flow/cli hooks pre-edit --file "$FILE" --validate-syntax 2>/dev/null || true
|
|
26
|
+
fi
|
|
27
|
+
done
|
|
28
|
+
|
|
29
|
+
# Run tests if available
|
|
30
|
+
if [ -f "package.json" ] && grep -q '"test"' package.json; then
|
|
31
|
+
echo "🧪 Running tests..."
|
|
32
|
+
npm test --if-present 2>/dev/null || echo " Tests skipped or failed"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
echo "✅ Pre-commit checks complete"
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generate post-commit hook script
|
|
40
|
+
*/
|
|
41
|
+
export function generatePostCommitHook() {
|
|
42
|
+
return `#!/bin/bash
|
|
43
|
+
# Claude Flow Post-Commit Hook
|
|
44
|
+
# Records commit metrics and trains patterns
|
|
45
|
+
|
|
46
|
+
COMMIT_HASH=$(git rev-parse HEAD)
|
|
47
|
+
COMMIT_MSG=$(git log -1 --pretty=%B)
|
|
48
|
+
|
|
49
|
+
echo "📊 Recording commit metrics..."
|
|
50
|
+
|
|
51
|
+
# Notify claude-flow of commit
|
|
52
|
+
npx @claude-flow/cli hooks notify \\
|
|
53
|
+
--message "Commit: $COMMIT_MSG" \\
|
|
54
|
+
--level info \\
|
|
55
|
+
--metadata '{"hash": "'$COMMIT_HASH'"}' 2>/dev/null || true
|
|
56
|
+
|
|
57
|
+
echo "✅ Commit recorded"
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Generate session manager script
|
|
62
|
+
*/
|
|
63
|
+
export function generateSessionManager() {
|
|
64
|
+
return `#!/usr/bin/env node
|
|
65
|
+
/**
|
|
66
|
+
* Claude Flow Session Manager
|
|
67
|
+
* Handles session lifecycle: start, restore, end
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
const fs = require('fs');
|
|
71
|
+
const path = require('path');
|
|
72
|
+
|
|
73
|
+
const SESSION_DIR = path.join(process.cwd(), '.claude-flow', 'sessions');
|
|
74
|
+
const SESSION_FILE = path.join(SESSION_DIR, 'current.json');
|
|
75
|
+
|
|
76
|
+
const commands = {
|
|
77
|
+
start: () => {
|
|
78
|
+
const sessionId = \`session-\${Date.now()}\`;
|
|
79
|
+
const session = {
|
|
80
|
+
id: sessionId,
|
|
81
|
+
startedAt: new Date().toISOString(),
|
|
82
|
+
cwd: process.cwd(),
|
|
83
|
+
context: {},
|
|
84
|
+
metrics: {
|
|
85
|
+
edits: 0,
|
|
86
|
+
commands: 0,
|
|
87
|
+
tasks: 0,
|
|
88
|
+
errors: 0,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
fs.mkdirSync(SESSION_DIR, { recursive: true });
|
|
93
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
94
|
+
|
|
95
|
+
console.log(\`Session started: \${sessionId}\`);
|
|
96
|
+
return session;
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
restore: () => {
|
|
100
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
101
|
+
console.log('No session to restore');
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
106
|
+
session.restoredAt = new Date().toISOString();
|
|
107
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
108
|
+
|
|
109
|
+
console.log(\`Session restored: \${session.id}\`);
|
|
110
|
+
return session;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
end: () => {
|
|
114
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
115
|
+
console.log('No active session');
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
120
|
+
session.endedAt = new Date().toISOString();
|
|
121
|
+
session.duration = Date.now() - new Date(session.startedAt).getTime();
|
|
122
|
+
|
|
123
|
+
// Archive session
|
|
124
|
+
const archivePath = path.join(SESSION_DIR, \`\${session.id}.json\`);
|
|
125
|
+
fs.writeFileSync(archivePath, JSON.stringify(session, null, 2));
|
|
126
|
+
fs.unlinkSync(SESSION_FILE);
|
|
127
|
+
|
|
128
|
+
console.log(\`Session ended: \${session.id}\`);
|
|
129
|
+
console.log(\`Duration: \${Math.round(session.duration / 1000 / 60)} minutes\`);
|
|
130
|
+
console.log(\`Metrics: \${JSON.stringify(session.metrics)}\`);
|
|
131
|
+
|
|
132
|
+
return session;
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
status: () => {
|
|
136
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
137
|
+
console.log('No active session');
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
142
|
+
const duration = Date.now() - new Date(session.startedAt).getTime();
|
|
143
|
+
|
|
144
|
+
console.log(\`Session: \${session.id}\`);
|
|
145
|
+
console.log(\`Started: \${session.startedAt}\`);
|
|
146
|
+
console.log(\`Duration: \${Math.round(duration / 1000 / 60)} minutes\`);
|
|
147
|
+
console.log(\`Metrics: \${JSON.stringify(session.metrics)}\`);
|
|
148
|
+
|
|
149
|
+
return session;
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
update: (key, value) => {
|
|
153
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
154
|
+
console.log('No active session');
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
159
|
+
session.context[key] = value;
|
|
160
|
+
session.updatedAt = new Date().toISOString();
|
|
161
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
162
|
+
|
|
163
|
+
return session;
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
metric: (name) => {
|
|
167
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
172
|
+
if (session.metrics[name] !== undefined) {
|
|
173
|
+
session.metrics[name]++;
|
|
174
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return session;
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// CLI
|
|
182
|
+
const [,, command, ...args] = process.argv;
|
|
183
|
+
|
|
184
|
+
if (command && commands[command]) {
|
|
185
|
+
commands[command](...args);
|
|
186
|
+
} else {
|
|
187
|
+
console.log('Usage: session.js <start|restore|end|status|update|metric> [args]');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
module.exports = commands;
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Generate agent router script
|
|
195
|
+
*/
|
|
196
|
+
export function generateAgentRouter() {
|
|
197
|
+
return `#!/usr/bin/env node
|
|
198
|
+
/**
|
|
199
|
+
* Claude Flow Agent Router
|
|
200
|
+
* Routes tasks to optimal agents based on learned patterns
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
const AGENT_CAPABILITIES = {
|
|
204
|
+
coder: ['code-generation', 'refactoring', 'debugging', 'implementation'],
|
|
205
|
+
tester: ['unit-testing', 'integration-testing', 'coverage', 'test-generation'],
|
|
206
|
+
reviewer: ['code-review', 'security-audit', 'quality-check', 'best-practices'],
|
|
207
|
+
researcher: ['web-search', 'documentation', 'analysis', 'summarization'],
|
|
208
|
+
architect: ['system-design', 'architecture', 'patterns', 'scalability'],
|
|
209
|
+
'backend-dev': ['api', 'database', 'server', 'authentication'],
|
|
210
|
+
'frontend-dev': ['ui', 'react', 'css', 'components'],
|
|
211
|
+
devops: ['ci-cd', 'docker', 'deployment', 'infrastructure'],
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const TASK_PATTERNS = {
|
|
215
|
+
// Code patterns
|
|
216
|
+
'implement|create|build|add|write code': 'coder',
|
|
217
|
+
'test|spec|coverage|unit test|integration': 'tester',
|
|
218
|
+
'review|audit|check|validate|security': 'reviewer',
|
|
219
|
+
'research|find|search|documentation|explore': 'researcher',
|
|
220
|
+
'design|architect|structure|plan': 'architect',
|
|
221
|
+
|
|
222
|
+
// Domain patterns
|
|
223
|
+
'api|endpoint|server|backend|database': 'backend-dev',
|
|
224
|
+
'ui|frontend|component|react|css|style': 'frontend-dev',
|
|
225
|
+
'deploy|docker|ci|cd|pipeline|infrastructure': 'devops',
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
function routeTask(task) {
|
|
229
|
+
const taskLower = task.toLowerCase();
|
|
230
|
+
|
|
231
|
+
// Check patterns
|
|
232
|
+
for (const [pattern, agent] of Object.entries(TASK_PATTERNS)) {
|
|
233
|
+
const regex = new RegExp(pattern, 'i');
|
|
234
|
+
if (regex.test(taskLower)) {
|
|
235
|
+
return {
|
|
236
|
+
agent,
|
|
237
|
+
confidence: 0.8,
|
|
238
|
+
reason: \`Matched pattern: \${pattern}\`,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Default to coder for unknown tasks
|
|
244
|
+
return {
|
|
245
|
+
agent: 'coder',
|
|
246
|
+
confidence: 0.5,
|
|
247
|
+
reason: 'Default routing - no specific pattern matched',
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// CLI
|
|
252
|
+
const task = process.argv.slice(2).join(' ');
|
|
253
|
+
|
|
254
|
+
if (task) {
|
|
255
|
+
const result = routeTask(task);
|
|
256
|
+
console.log(JSON.stringify(result, null, 2));
|
|
257
|
+
} else {
|
|
258
|
+
console.log('Usage: router.js <task description>');
|
|
259
|
+
console.log('\\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Generate memory helper script
|
|
267
|
+
*/
|
|
268
|
+
export function generateMemoryHelper() {
|
|
269
|
+
return `#!/usr/bin/env node
|
|
270
|
+
/**
|
|
271
|
+
* Claude Flow Memory Helper
|
|
272
|
+
* Simple key-value memory for cross-session context
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
const fs = require('fs');
|
|
276
|
+
const path = require('path');
|
|
277
|
+
|
|
278
|
+
const MEMORY_DIR = path.join(process.cwd(), '.claude-flow', 'data');
|
|
279
|
+
const MEMORY_FILE = path.join(MEMORY_DIR, 'memory.json');
|
|
280
|
+
|
|
281
|
+
function loadMemory() {
|
|
282
|
+
try {
|
|
283
|
+
if (fs.existsSync(MEMORY_FILE)) {
|
|
284
|
+
return JSON.parse(fs.readFileSync(MEMORY_FILE, 'utf-8'));
|
|
285
|
+
}
|
|
286
|
+
} catch (e) {
|
|
287
|
+
// Ignore
|
|
288
|
+
}
|
|
289
|
+
return {};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function saveMemory(memory) {
|
|
293
|
+
fs.mkdirSync(MEMORY_DIR, { recursive: true });
|
|
294
|
+
fs.writeFileSync(MEMORY_FILE, JSON.stringify(memory, null, 2));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const commands = {
|
|
298
|
+
get: (key) => {
|
|
299
|
+
const memory = loadMemory();
|
|
300
|
+
const value = key ? memory[key] : memory;
|
|
301
|
+
console.log(JSON.stringify(value, null, 2));
|
|
302
|
+
return value;
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
set: (key, value) => {
|
|
306
|
+
if (!key) {
|
|
307
|
+
console.error('Key required');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const memory = loadMemory();
|
|
311
|
+
memory[key] = value;
|
|
312
|
+
memory._updated = new Date().toISOString();
|
|
313
|
+
saveMemory(memory);
|
|
314
|
+
console.log(\`Set: \${key}\`);
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
delete: (key) => {
|
|
318
|
+
if (!key) {
|
|
319
|
+
console.error('Key required');
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const memory = loadMemory();
|
|
323
|
+
delete memory[key];
|
|
324
|
+
saveMemory(memory);
|
|
325
|
+
console.log(\`Deleted: \${key}\`);
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
clear: () => {
|
|
329
|
+
saveMemory({});
|
|
330
|
+
console.log('Memory cleared');
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
keys: () => {
|
|
334
|
+
const memory = loadMemory();
|
|
335
|
+
const keys = Object.keys(memory).filter(k => !k.startsWith('_'));
|
|
336
|
+
console.log(keys.join('\\n'));
|
|
337
|
+
return keys;
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// CLI
|
|
342
|
+
const [,, command, key, ...valueParts] = process.argv;
|
|
343
|
+
const value = valueParts.join(' ');
|
|
344
|
+
|
|
345
|
+
if (command && commands[command]) {
|
|
346
|
+
commands[command](key, value);
|
|
347
|
+
} else {
|
|
348
|
+
console.log('Usage: memory.js <get|set|delete|clear|keys> [key] [value]');
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
module.exports = commands;
|
|
352
|
+
`;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Generate hook-handler.cjs (cross-platform hook dispatcher)
|
|
356
|
+
* This is the inline fallback when file copy from the package fails.
|
|
357
|
+
* Uses string concatenation instead of template literals to avoid escaping issues.
|
|
358
|
+
*/
|
|
359
|
+
export function generateHookHandler() {
|
|
360
|
+
// Build as array of lines to avoid template-in-template escaping nightmares
|
|
361
|
+
const lines = [
|
|
362
|
+
'#!/usr/bin/env node',
|
|
363
|
+
'/**',
|
|
364
|
+
' * Claude Flow Hook Handler (Cross-Platform)',
|
|
365
|
+
' * Dispatches hook events to the appropriate helper modules.',
|
|
366
|
+
' */',
|
|
367
|
+
'',
|
|
368
|
+
"const path = require('path');",
|
|
369
|
+
"const fs = require('fs');",
|
|
370
|
+
'',
|
|
371
|
+
'const helpersDir = __dirname;',
|
|
372
|
+
'',
|
|
373
|
+
'function safeRequire(modulePath) {',
|
|
374
|
+
' try {',
|
|
375
|
+
' if (fs.existsSync(modulePath)) {',
|
|
376
|
+
' const origLog = console.log;',
|
|
377
|
+
' const origError = console.error;',
|
|
378
|
+
' console.log = () => {};',
|
|
379
|
+
' console.error = () => {};',
|
|
380
|
+
' try {',
|
|
381
|
+
' const mod = require(modulePath);',
|
|
382
|
+
' return mod;',
|
|
383
|
+
' } finally {',
|
|
384
|
+
' console.log = origLog;',
|
|
385
|
+
' console.error = origError;',
|
|
386
|
+
' }',
|
|
387
|
+
' }',
|
|
388
|
+
' } catch (e) {',
|
|
389
|
+
' // silently fail',
|
|
390
|
+
' }',
|
|
391
|
+
' return null;',
|
|
392
|
+
'}',
|
|
393
|
+
'',
|
|
394
|
+
"const router = safeRequire(path.join(helpersDir, 'router.js'));",
|
|
395
|
+
"const session = safeRequire(path.join(helpersDir, 'session.js'));",
|
|
396
|
+
"const memory = safeRequire(path.join(helpersDir, 'memory.js'));",
|
|
397
|
+
"const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));",
|
|
398
|
+
'',
|
|
399
|
+
'const [,, command, ...args] = process.argv;',
|
|
400
|
+
'',
|
|
401
|
+
'// Read stdin with timeout — Claude Code sends hook data as JSON via stdin.',
|
|
402
|
+
'// Timeout prevents hanging when stdin is in an ambiguous state (not TTY, not pipe).',
|
|
403
|
+
'async function readStdin() {',
|
|
404
|
+
' if (process.stdin.isTTY) return "";',
|
|
405
|
+
' return new Promise((resolve) => {',
|
|
406
|
+
' let data = "";',
|
|
407
|
+
' const timer = setTimeout(() => {',
|
|
408
|
+
' process.stdin.removeAllListeners();',
|
|
409
|
+
' process.stdin.pause();',
|
|
410
|
+
' resolve(data);',
|
|
411
|
+
' }, 500);',
|
|
412
|
+
' process.stdin.setEncoding("utf8");',
|
|
413
|
+
' process.stdin.on("data", (chunk) => { data += chunk; });',
|
|
414
|
+
' process.stdin.on("end", () => { clearTimeout(timer); resolve(data); });',
|
|
415
|
+
' process.stdin.on("error", () => { clearTimeout(timer); resolve(data); });',
|
|
416
|
+
' process.stdin.resume();',
|
|
417
|
+
' });',
|
|
418
|
+
'}',
|
|
419
|
+
'',
|
|
420
|
+
'async function main() {',
|
|
421
|
+
' let stdinData = "";',
|
|
422
|
+
' try { stdinData = await readStdin(); } catch (e) { /* ignore */ }',
|
|
423
|
+
' let hookInput = {};',
|
|
424
|
+
' if (stdinData.trim()) {',
|
|
425
|
+
' try { hookInput = JSON.parse(stdinData); } catch (e) { /* ignore */ }',
|
|
426
|
+
' }',
|
|
427
|
+
' // Prefer stdin fields, then env, then argv',
|
|
428
|
+
" var prompt = hookInput.prompt || hookInput.command || hookInput.toolInput || process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';",
|
|
429
|
+
'',
|
|
430
|
+
'const handlers = {',
|
|
431
|
+
" 'route': () => {",
|
|
432
|
+
' if (intelligence && intelligence.getContext) {',
|
|
433
|
+
' try {',
|
|
434
|
+
' const ctx = intelligence.getContext(prompt);',
|
|
435
|
+
' if (ctx) console.log(ctx);',
|
|
436
|
+
' } catch (e) { /* non-fatal */ }',
|
|
437
|
+
' }',
|
|
438
|
+
' if (router && router.routeTask) {',
|
|
439
|
+
' const result = router.routeTask(prompt);',
|
|
440
|
+
' var output = [];',
|
|
441
|
+
" output.push('[INFO] Routing task: ' + (prompt.substring(0, 80) || '(no prompt)'));",
|
|
442
|
+
" output.push('');",
|
|
443
|
+
" output.push('+------------------- Primary Recommendation -------------------+');",
|
|
444
|
+
" output.push('| Agent: ' + result.agent.padEnd(53) + '|');",
|
|
445
|
+
" output.push('| Confidence: ' + (result.confidence * 100).toFixed(1) + '%' + ' '.repeat(44) + '|');",
|
|
446
|
+
" output.push('| Reason: ' + result.reason.substring(0, 53).padEnd(53) + '|');",
|
|
447
|
+
" output.push('+--------------------------------------------------------------+');",
|
|
448
|
+
" console.log(output.join('\\n'));",
|
|
449
|
+
' } else {',
|
|
450
|
+
" console.log('[INFO] Router not available, using default routing');",
|
|
451
|
+
' }',
|
|
452
|
+
' },',
|
|
453
|
+
'',
|
|
454
|
+
" 'pre-bash': () => {",
|
|
455
|
+
' var cmd = prompt.toLowerCase();',
|
|
456
|
+
" var dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\\\', ':(){:|:&};:'];",
|
|
457
|
+
' for (var i = 0; i < dangerous.length; i++) {',
|
|
458
|
+
' if (cmd.includes(dangerous[i])) {',
|
|
459
|
+
" console.error('[BLOCKED] Dangerous command detected: ' + dangerous[i]);",
|
|
460
|
+
' process.exit(1);',
|
|
461
|
+
' }',
|
|
462
|
+
' }',
|
|
463
|
+
" console.log('[OK] Command validated');",
|
|
464
|
+
' },',
|
|
465
|
+
'',
|
|
466
|
+
" 'post-edit': () => {",
|
|
467
|
+
' if (session && session.metric) {',
|
|
468
|
+
" try { session.metric('edits'); } catch (e) { /* no active session */ }",
|
|
469
|
+
' }',
|
|
470
|
+
' if (intelligence && intelligence.recordEdit) {',
|
|
471
|
+
' try {',
|
|
472
|
+
" var file = process.env.TOOL_INPUT_file_path || args[0] || '';",
|
|
473
|
+
' intelligence.recordEdit(file);',
|
|
474
|
+
' } catch (e) { /* non-fatal */ }',
|
|
475
|
+
' }',
|
|
476
|
+
" console.log('[OK] Edit recorded');",
|
|
477
|
+
' },',
|
|
478
|
+
'',
|
|
479
|
+
" 'session-restore': () => {",
|
|
480
|
+
' if (session) {',
|
|
481
|
+
' var existing = session.restore && session.restore();',
|
|
482
|
+
' if (!existing) {',
|
|
483
|
+
' session.start && session.start();',
|
|
484
|
+
' }',
|
|
485
|
+
' } else {',
|
|
486
|
+
" console.log('[OK] Session restored: session-' + Date.now());",
|
|
487
|
+
' }',
|
|
488
|
+
' if (intelligence && intelligence.init) {',
|
|
489
|
+
' try {',
|
|
490
|
+
' var result = intelligence.init();',
|
|
491
|
+
' if (result && result.nodes > 0) {',
|
|
492
|
+
" console.log('[INTELLIGENCE] Loaded ' + result.nodes + ' patterns, ' + result.edges + ' edges');",
|
|
493
|
+
' }',
|
|
494
|
+
' } catch (e) { /* non-fatal */ }',
|
|
495
|
+
' }',
|
|
496
|
+
' },',
|
|
497
|
+
'',
|
|
498
|
+
" 'session-end': () => {",
|
|
499
|
+
' if (intelligence && intelligence.consolidate) {',
|
|
500
|
+
' try {',
|
|
501
|
+
' var result = intelligence.consolidate();',
|
|
502
|
+
' if (result && result.entries > 0) {',
|
|
503
|
+
" var msg = '[INTELLIGENCE] Consolidated: ' + result.entries + ' entries, ' + result.edges + ' edges';",
|
|
504
|
+
" if (result.newEntries > 0) msg += ', ' + result.newEntries + ' new';",
|
|
505
|
+
" msg += ', PageRank recomputed';",
|
|
506
|
+
' console.log(msg);',
|
|
507
|
+
' }',
|
|
508
|
+
' } catch (e) { /* non-fatal */ }',
|
|
509
|
+
' }',
|
|
510
|
+
' if (session && session.end) {',
|
|
511
|
+
' session.end();',
|
|
512
|
+
' } else {',
|
|
513
|
+
" console.log('[OK] Session ended');",
|
|
514
|
+
' }',
|
|
515
|
+
' },',
|
|
516
|
+
'',
|
|
517
|
+
" 'pre-task': () => {",
|
|
518
|
+
' if (session && session.metric) {',
|
|
519
|
+
" try { session.metric('tasks'); } catch (e) { /* no active session */ }",
|
|
520
|
+
' }',
|
|
521
|
+
' if (router && router.routeTask && prompt) {',
|
|
522
|
+
' var result = router.routeTask(prompt);',
|
|
523
|
+
" console.log('[INFO] Task routed to: ' + result.agent + ' (confidence: ' + result.confidence + ')');",
|
|
524
|
+
' } else {',
|
|
525
|
+
" console.log('[OK] Task started');",
|
|
526
|
+
' }',
|
|
527
|
+
' },',
|
|
528
|
+
'',
|
|
529
|
+
" 'post-task': () => {",
|
|
530
|
+
' if (intelligence && intelligence.feedback) {',
|
|
531
|
+
' try {',
|
|
532
|
+
' intelligence.feedback(true);',
|
|
533
|
+
' } catch (e) { /* non-fatal */ }',
|
|
534
|
+
' }',
|
|
535
|
+
" console.log('[OK] Task completed');",
|
|
536
|
+
' },',
|
|
537
|
+
'',
|
|
538
|
+
" 'compact-manual': () => {",
|
|
539
|
+
" console.log('PreCompact Guidance:');",
|
|
540
|
+
" console.log('IMPORTANT: Review CLAUDE.md in project root for:');",
|
|
541
|
+
" console.log(' - Available agents and concurrent usage patterns');",
|
|
542
|
+
" console.log(' - Swarm coordination strategies (hierarchical, mesh, adaptive)');",
|
|
543
|
+
" console.log(' - Critical concurrent execution rules (1 MESSAGE = ALL OPERATIONS)');",
|
|
544
|
+
" console.log('Ready for compact operation');",
|
|
545
|
+
' },',
|
|
546
|
+
'',
|
|
547
|
+
" 'compact-auto': () => {",
|
|
548
|
+
" console.log('Auto-Compact Guidance (Context Window Full):');",
|
|
549
|
+
" console.log('CRITICAL: Before compacting, ensure you understand:');",
|
|
550
|
+
" console.log(' - All agents available in .claude/agents/ directory');",
|
|
551
|
+
" console.log(' - Concurrent execution patterns from CLAUDE.md');",
|
|
552
|
+
" console.log(' - Swarm coordination strategies for complex tasks');",
|
|
553
|
+
" console.log('Apply GOLDEN RULE: Always batch operations in single messages');",
|
|
554
|
+
" console.log('Auto-compact proceeding with full agent context');",
|
|
555
|
+
' },',
|
|
556
|
+
'',
|
|
557
|
+
" 'status': () => {",
|
|
558
|
+
" console.log('[OK] Status check');",
|
|
559
|
+
' },',
|
|
560
|
+
'',
|
|
561
|
+
" 'stats': () => {",
|
|
562
|
+
' if (intelligence && intelligence.stats) {',
|
|
563
|
+
" intelligence.stats(args.includes('--json'));",
|
|
564
|
+
' } else {',
|
|
565
|
+
" console.log('[WARN] Intelligence module not available. Run session-restore first.');",
|
|
566
|
+
' }',
|
|
567
|
+
' },',
|
|
568
|
+
'};',
|
|
569
|
+
'',
|
|
570
|
+
'if (command && handlers[command]) {',
|
|
571
|
+
' try {',
|
|
572
|
+
' handlers[command]();',
|
|
573
|
+
' } catch (e) {',
|
|
574
|
+
" console.log('[WARN] Hook ' + command + ' encountered an error: ' + e.message);",
|
|
575
|
+
' }',
|
|
576
|
+
'} else if (command) {',
|
|
577
|
+
" console.log('[OK] Hook: ' + command);",
|
|
578
|
+
'} else {',
|
|
579
|
+
" console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|compact-manual|compact-auto|status|stats>');",
|
|
580
|
+
'}',
|
|
581
|
+
'} // end main',
|
|
582
|
+
'',
|
|
583
|
+
'process.exitCode = 0;',
|
|
584
|
+
'main().catch(() => { process.exitCode = 0; });',
|
|
585
|
+
];
|
|
586
|
+
return lines.join('\n') + '\n';
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Generate a minimal intelligence.cjs stub for fallback installs.
|
|
590
|
+
* Provides the same API as the full intelligence.cjs but with simplified logic.
|
|
591
|
+
* Gets overwritten when source copy succeeds (full version has PageRank, Jaccard, etc.)
|
|
592
|
+
*/
|
|
593
|
+
export function generateIntelligenceStub() {
|
|
594
|
+
const lines = [
|
|
595
|
+
'#!/usr/bin/env node',
|
|
596
|
+
'/**',
|
|
597
|
+
' * Intelligence Layer Stub (ADR-050)',
|
|
598
|
+
' * Minimal fallback — full version is copied from package source.',
|
|
599
|
+
' * Provides: init, getContext, recordEdit, feedback, consolidate',
|
|
600
|
+
' */',
|
|
601
|
+
"'use strict';",
|
|
602
|
+
'',
|
|
603
|
+
"const fs = require('fs');",
|
|
604
|
+
"const path = require('path');",
|
|
605
|
+
"const os = require('os');",
|
|
606
|
+
'',
|
|
607
|
+
"const DATA_DIR = path.join(process.cwd(), '.claude-flow', 'data');",
|
|
608
|
+
"const STORE_PATH = path.join(DATA_DIR, 'auto-memory-store.json');",
|
|
609
|
+
"const RANKED_PATH = path.join(DATA_DIR, 'ranked-context.json');",
|
|
610
|
+
"const PENDING_PATH = path.join(DATA_DIR, 'pending-insights.jsonl');",
|
|
611
|
+
"const SESSION_DIR = path.join(process.cwd(), '.claude-flow', 'sessions');",
|
|
612
|
+
"const SESSION_FILE = path.join(SESSION_DIR, 'current.json');",
|
|
613
|
+
'',
|
|
614
|
+
'function ensureDir(dir) {',
|
|
615
|
+
' if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });',
|
|
616
|
+
'}',
|
|
617
|
+
'',
|
|
618
|
+
'function readJSON(p) {',
|
|
619
|
+
' try { return fs.existsSync(p) ? JSON.parse(fs.readFileSync(p, "utf-8")) : null; }',
|
|
620
|
+
' catch { return null; }',
|
|
621
|
+
'}',
|
|
622
|
+
'',
|
|
623
|
+
'function writeJSON(p, data) {',
|
|
624
|
+
' ensureDir(path.dirname(p));',
|
|
625
|
+
' fs.writeFileSync(p, JSON.stringify(data, null, 2), "utf-8");',
|
|
626
|
+
'}',
|
|
627
|
+
'',
|
|
628
|
+
'// Read session context key',
|
|
629
|
+
'function sessionGet(key) {',
|
|
630
|
+
' var session = readJSON(SESSION_FILE);',
|
|
631
|
+
' if (!session) return null;',
|
|
632
|
+
' return key ? (session.context || {})[key] : session.context;',
|
|
633
|
+
'}',
|
|
634
|
+
'',
|
|
635
|
+
'// Write session context key',
|
|
636
|
+
'function sessionSet(key, value) {',
|
|
637
|
+
' var session = readJSON(SESSION_FILE);',
|
|
638
|
+
' if (!session) return;',
|
|
639
|
+
' if (!session.context) session.context = {};',
|
|
640
|
+
' session.context[key] = value;',
|
|
641
|
+
' writeJSON(SESSION_FILE, session);',
|
|
642
|
+
'}',
|
|
643
|
+
'',
|
|
644
|
+
'// Tokenize text into words',
|
|
645
|
+
'function tokenize(text) {',
|
|
646
|
+
' if (!text) return [];',
|
|
647
|
+
' return text.toLowerCase().replace(/[^a-z0-9\\s]/g, " ").split(/\\s+/).filter(function(w) { return w.length > 2; });',
|
|
648
|
+
'}',
|
|
649
|
+
'',
|
|
650
|
+
'// Bootstrap entries from MEMORY.md files when store is empty',
|
|
651
|
+
'function bootstrapFromMemoryFiles() {',
|
|
652
|
+
' var entries = [];',
|
|
653
|
+
' var candidates = [',
|
|
654
|
+
' path.join(os.homedir(), ".claude", "projects"),',
|
|
655
|
+
' path.join(process.cwd(), ".claude-flow", "memory"),',
|
|
656
|
+
' path.join(process.cwd(), ".claude", "memory"),',
|
|
657
|
+
' ];',
|
|
658
|
+
' for (var i = 0; i < candidates.length; i++) {',
|
|
659
|
+
' try {',
|
|
660
|
+
' if (!fs.existsSync(candidates[i])) continue;',
|
|
661
|
+
' var files = [];',
|
|
662
|
+
' try {',
|
|
663
|
+
' var items = fs.readdirSync(candidates[i], { withFileTypes: true, recursive: true });',
|
|
664
|
+
' for (var j = 0; j < items.length; j++) {',
|
|
665
|
+
' if (items[j].name === "MEMORY.md") {',
|
|
666
|
+
' var fp = items[j].path ? path.join(items[j].path, items[j].name) : path.join(candidates[i], items[j].name);',
|
|
667
|
+
' files.push(fp);',
|
|
668
|
+
' }',
|
|
669
|
+
' }',
|
|
670
|
+
' } catch (e) { continue; }',
|
|
671
|
+
' for (var k = 0; k < files.length; k++) {',
|
|
672
|
+
' try {',
|
|
673
|
+
' var content = fs.readFileSync(files[k], "utf-8");',
|
|
674
|
+
' var sections = content.split(/^##\\s+/m).filter(function(s) { return s.trim().length > 20; });',
|
|
675
|
+
' for (var s = 0; s < sections.length; s++) {',
|
|
676
|
+
' var lines2 = sections[s].split("\\n");',
|
|
677
|
+
' var title = lines2[0] ? lines2[0].trim() : "section-" + s;',
|
|
678
|
+
' entries.push({',
|
|
679
|
+
' id: "mem-" + entries.length,',
|
|
680
|
+
' content: sections[s].substring(0, 500),',
|
|
681
|
+
' summary: title.substring(0, 100),',
|
|
682
|
+
' category: "memory",',
|
|
683
|
+
' confidence: 0.5,',
|
|
684
|
+
' sourceFile: files[k],',
|
|
685
|
+
' words: tokenize(sections[s].substring(0, 500)),',
|
|
686
|
+
' });',
|
|
687
|
+
' }',
|
|
688
|
+
' } catch (e) { /* skip */ }',
|
|
689
|
+
' }',
|
|
690
|
+
' } catch (e) { /* skip */ }',
|
|
691
|
+
' }',
|
|
692
|
+
' return entries;',
|
|
693
|
+
'}',
|
|
694
|
+
'',
|
|
695
|
+
'// Load entries from auto-memory-store or bootstrap from MEMORY.md',
|
|
696
|
+
'function loadEntries() {',
|
|
697
|
+
' var store = readJSON(STORE_PATH);',
|
|
698
|
+
' if (store && store.entries && store.entries.length > 0) {',
|
|
699
|
+
' return store.entries.map(function(e, i) {',
|
|
700
|
+
' return {',
|
|
701
|
+
' id: e.id || ("entry-" + i),',
|
|
702
|
+
' content: e.content || e.value || "",',
|
|
703
|
+
' summary: e.summary || e.key || "",',
|
|
704
|
+
' category: e.category || e.namespace || "default",',
|
|
705
|
+
' confidence: e.confidence || 0.5,',
|
|
706
|
+
' sourceFile: e.sourceFile || "",',
|
|
707
|
+
' words: tokenize((e.content || e.value || "") + " " + (e.summary || e.key || "")),',
|
|
708
|
+
' };',
|
|
709
|
+
' });',
|
|
710
|
+
' }',
|
|
711
|
+
' return bootstrapFromMemoryFiles();',
|
|
712
|
+
'}',
|
|
713
|
+
'',
|
|
714
|
+
'// Simple keyword match score',
|
|
715
|
+
'function matchScore(promptWords, entryWords) {',
|
|
716
|
+
' if (!promptWords.length || !entryWords.length) return 0;',
|
|
717
|
+
' var entrySet = {};',
|
|
718
|
+
' for (var i = 0; i < entryWords.length; i++) entrySet[entryWords[i]] = true;',
|
|
719
|
+
' var overlap = 0;',
|
|
720
|
+
' for (var j = 0; j < promptWords.length; j++) {',
|
|
721
|
+
' if (entrySet[promptWords[j]]) overlap++;',
|
|
722
|
+
' }',
|
|
723
|
+
' var union = Object.keys(entrySet).length + promptWords.length - overlap;',
|
|
724
|
+
' return union > 0 ? overlap / union : 0;',
|
|
725
|
+
'}',
|
|
726
|
+
'',
|
|
727
|
+
'var cachedEntries = null;',
|
|
728
|
+
'',
|
|
729
|
+
'module.exports = {',
|
|
730
|
+
' init: function() {',
|
|
731
|
+
' cachedEntries = loadEntries();',
|
|
732
|
+
' var ranked = cachedEntries.map(function(e) {',
|
|
733
|
+
' return { id: e.id, content: e.content, summary: e.summary, category: e.category, confidence: e.confidence, words: e.words };',
|
|
734
|
+
' });',
|
|
735
|
+
' writeJSON(RANKED_PATH, { version: 1, computedAt: Date.now(), entries: ranked });',
|
|
736
|
+
' return { nodes: cachedEntries.length, edges: 0 };',
|
|
737
|
+
' },',
|
|
738
|
+
'',
|
|
739
|
+
' getContext: function(prompt) {',
|
|
740
|
+
' if (!prompt) return null;',
|
|
741
|
+
' var ranked = readJSON(RANKED_PATH);',
|
|
742
|
+
' var entries = (ranked && ranked.entries) || (cachedEntries || []);',
|
|
743
|
+
' if (!entries.length) return null;',
|
|
744
|
+
' var promptWords = tokenize(prompt);',
|
|
745
|
+
' if (!promptWords.length) return null;',
|
|
746
|
+
' var scored = entries.map(function(e) {',
|
|
747
|
+
' return { entry: e, score: matchScore(promptWords, e.words || tokenize(e.content + " " + e.summary)) };',
|
|
748
|
+
' }).filter(function(s) { return s.score > 0.05; });',
|
|
749
|
+
' scored.sort(function(a, b) { return b.score - a.score; });',
|
|
750
|
+
' var top = scored.slice(0, 5);',
|
|
751
|
+
' if (!top.length) return null;',
|
|
752
|
+
' var prevMatched = sessionGet("lastMatchedPatterns");',
|
|
753
|
+
' var matchedIds = top.map(function(s) { return s.entry.id; });',
|
|
754
|
+
' sessionSet("lastMatchedPatterns", matchedIds);',
|
|
755
|
+
' if (prevMatched && Array.isArray(prevMatched)) {',
|
|
756
|
+
' var newSet = {};',
|
|
757
|
+
' for (var i = 0; i < matchedIds.length; i++) newSet[matchedIds[i]] = true;',
|
|
758
|
+
' }',
|
|
759
|
+
' var lines2 = ["[INTELLIGENCE] Relevant patterns for this task:"];',
|
|
760
|
+
' for (var j = 0; j < top.length; j++) {',
|
|
761
|
+
' var e = top[j];',
|
|
762
|
+
' var conf = e.entry.confidence || 0.5;',
|
|
763
|
+
' var summary = (e.entry.summary || e.entry.content || "").substring(0, 80);',
|
|
764
|
+
' lines2.push(" * (" + conf.toFixed(2) + ") " + summary);',
|
|
765
|
+
' }',
|
|
766
|
+
' return lines2.join("\\n");',
|
|
767
|
+
' },',
|
|
768
|
+
'',
|
|
769
|
+
' recordEdit: function(file) {',
|
|
770
|
+
' if (!file) return;',
|
|
771
|
+
' ensureDir(DATA_DIR);',
|
|
772
|
+
' var line = JSON.stringify({ type: "edit", file: file, timestamp: Date.now() }) + "\\n";',
|
|
773
|
+
' fs.appendFileSync(PENDING_PATH, line, "utf-8");',
|
|
774
|
+
' },',
|
|
775
|
+
'',
|
|
776
|
+
' feedback: function(success) {',
|
|
777
|
+
' // Stub: no-op in minimal version',
|
|
778
|
+
' },',
|
|
779
|
+
'',
|
|
780
|
+
' consolidate: function() {',
|
|
781
|
+
' var count = 0;',
|
|
782
|
+
' if (fs.existsSync(PENDING_PATH)) {',
|
|
783
|
+
' try {',
|
|
784
|
+
' var content = fs.readFileSync(PENDING_PATH, "utf-8").trim();',
|
|
785
|
+
' count = content ? content.split("\\n").length : 0;',
|
|
786
|
+
' fs.writeFileSync(PENDING_PATH, "", "utf-8");',
|
|
787
|
+
' } catch (e) { /* skip */ }',
|
|
788
|
+
' }',
|
|
789
|
+
' return { entries: count, edges: 0, newEntries: 0 };',
|
|
790
|
+
' },',
|
|
791
|
+
'};',
|
|
792
|
+
];
|
|
793
|
+
return lines.join('\n') + '\n';
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Generate a minimal auto-memory-hook.mjs fallback for fresh installs.
|
|
797
|
+
* This ESM script handles import/sync/status commands gracefully when
|
|
798
|
+
* @claude-flow/memory is not installed. Gets overwritten when source copy succeeds.
|
|
799
|
+
*/
|
|
800
|
+
export function generateAutoMemoryHook() {
|
|
801
|
+
return `#!/usr/bin/env node
|
|
802
|
+
/**
|
|
803
|
+
* Auto Memory Bridge Hook (ADR-048/049) — Minimal Fallback
|
|
804
|
+
* Full version is copied from package source when available.
|
|
805
|
+
*
|
|
806
|
+
* Usage:
|
|
807
|
+
* node auto-memory-hook.mjs import # SessionStart
|
|
808
|
+
* node auto-memory-hook.mjs sync # SessionEnd / Stop
|
|
809
|
+
* node auto-memory-hook.mjs status # Show bridge status
|
|
810
|
+
*/
|
|
811
|
+
|
|
812
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
813
|
+
import { join, dirname } from 'path';
|
|
814
|
+
import { fileURLToPath } from 'url';
|
|
815
|
+
|
|
816
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
817
|
+
const __dirname = dirname(__filename);
|
|
818
|
+
const PROJECT_ROOT = join(__dirname, '../..');
|
|
819
|
+
const DATA_DIR = join(PROJECT_ROOT, '.claude-flow', 'data');
|
|
820
|
+
const STORE_PATH = join(DATA_DIR, 'auto-memory-store.json');
|
|
821
|
+
|
|
822
|
+
const DIM = '\\x1b[2m';
|
|
823
|
+
const RESET = '\\x1b[0m';
|
|
824
|
+
const dim = (msg) => console.log(\` \${DIM}\${msg}\${RESET}\`);
|
|
825
|
+
|
|
826
|
+
// Ensure data dir
|
|
827
|
+
if (!existsSync(DATA_DIR)) mkdirSync(DATA_DIR, { recursive: true });
|
|
828
|
+
|
|
829
|
+
async function loadMemoryPackage() {
|
|
830
|
+
// Strategy 1: Use createRequire for CJS-style resolution (handles nested node_modules
|
|
831
|
+
// when installed as a transitive dependency via npx ruflo / npx claude-flow)
|
|
832
|
+
try {
|
|
833
|
+
const { createRequire } = await import('module');
|
|
834
|
+
const require = createRequire(join(PROJECT_ROOT, 'package.json'));
|
|
835
|
+
return require('@claude-flow/memory');
|
|
836
|
+
} catch { /* fall through */ }
|
|
837
|
+
|
|
838
|
+
// Strategy 2: ESM import (works when @claude-flow/memory is a direct dependency)
|
|
839
|
+
try { return await import('@claude-flow/memory'); } catch { /* fall through */ }
|
|
840
|
+
|
|
841
|
+
// Strategy 3: Walk up from PROJECT_ROOT looking for the package in any node_modules
|
|
842
|
+
let searchDir = PROJECT_ROOT;
|
|
843
|
+
const { parse } = await import('path');
|
|
844
|
+
while (searchDir !== parse(searchDir).root) {
|
|
845
|
+
const candidate = join(searchDir, 'node_modules', '@claude-flow', 'memory', 'dist', 'index.js');
|
|
846
|
+
if (existsSync(candidate)) {
|
|
847
|
+
try { return await import(\`file://\${candidate}\`); } catch { /* fall through */ }
|
|
848
|
+
}
|
|
849
|
+
searchDir = dirname(searchDir);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
async function doImport() {
|
|
856
|
+
const memPkg = await loadMemoryPackage();
|
|
857
|
+
|
|
858
|
+
if (!memPkg || !memPkg.AutoMemoryBridge) {
|
|
859
|
+
dim('Memory package not available — auto memory import skipped (non-critical)');
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// Full implementation deferred to copied version
|
|
864
|
+
dim('Auto memory import available — run init --upgrade for full support');
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
async function doSync() {
|
|
868
|
+
if (!existsSync(STORE_PATH)) {
|
|
869
|
+
dim('No entries to sync');
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const memPkg = await loadMemoryPackage();
|
|
874
|
+
|
|
875
|
+
if (!memPkg || !memPkg.AutoMemoryBridge) {
|
|
876
|
+
dim('Memory package not available — sync skipped (non-critical)');
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
dim('Auto memory sync available — run init --upgrade for full support');
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
function doStatus() {
|
|
884
|
+
console.log('\\n=== Auto Memory Bridge Status ===\\n');
|
|
885
|
+
console.log(' Package: Fallback mode (run init --upgrade for full)');
|
|
886
|
+
console.log(\` Store: \${existsSync(STORE_PATH) ? 'Initialized' : 'Not initialized'}\`);
|
|
887
|
+
console.log('');
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const command = process.argv[2] || 'status';
|
|
891
|
+
|
|
892
|
+
try {
|
|
893
|
+
switch (command) {
|
|
894
|
+
case 'import': await doImport(); break;
|
|
895
|
+
case 'sync': await doSync(); break;
|
|
896
|
+
case 'status': doStatus(); break;
|
|
897
|
+
default:
|
|
898
|
+
console.log('Usage: auto-memory-hook.mjs <import|sync|status>');
|
|
899
|
+
process.exit(1);
|
|
900
|
+
}
|
|
901
|
+
} catch (err) {
|
|
902
|
+
// Hooks must never crash Claude Code - fail silently
|
|
903
|
+
dim(\`Error (non-critical): \${err.message}\`);
|
|
904
|
+
}
|
|
905
|
+
`;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Generate Windows PowerShell daemon manager
|
|
909
|
+
*/
|
|
910
|
+
export function generateWindowsDaemonManager() {
|
|
911
|
+
return `# RuFlo V3 Daemon Manager for Windows
|
|
912
|
+
# PowerShell script for managing background processes
|
|
913
|
+
|
|
914
|
+
param(
|
|
915
|
+
[Parameter(Position=0)]
|
|
916
|
+
[ValidateSet('start', 'stop', 'status', 'restart')]
|
|
917
|
+
[string]$Action = 'status'
|
|
918
|
+
)
|
|
919
|
+
|
|
920
|
+
$ErrorActionPreference = 'SilentlyContinue'
|
|
921
|
+
$ClaudeFlowDir = Join-Path $PWD '.claude-flow'
|
|
922
|
+
$PidDir = Join-Path $ClaudeFlowDir 'pids'
|
|
923
|
+
|
|
924
|
+
# Ensure directories exist
|
|
925
|
+
if (-not (Test-Path $PidDir)) {
|
|
926
|
+
New-Item -ItemType Directory -Path $PidDir -Force | Out-Null
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
function Get-DaemonStatus {
|
|
930
|
+
param([string]$Name, [string]$PidFile)
|
|
931
|
+
|
|
932
|
+
if (Test-Path $PidFile) {
|
|
933
|
+
$pid = Get-Content $PidFile
|
|
934
|
+
$process = Get-Process -Id $pid -ErrorAction SilentlyContinue
|
|
935
|
+
if ($process) {
|
|
936
|
+
return @{ Running = $true; Pid = $pid }
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return @{ Running = $false; Pid = $null }
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function Start-SwarmMonitor {
|
|
943
|
+
$pidFile = Join-Path $PidDir 'swarm-monitor.pid'
|
|
944
|
+
$status = Get-DaemonStatus -Name 'swarm-monitor' -PidFile $pidFile
|
|
945
|
+
|
|
946
|
+
if ($status.Running) {
|
|
947
|
+
Write-Host "Swarm monitor already running (PID: $($status.Pid))" -ForegroundColor Yellow
|
|
948
|
+
return
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
Write-Host "Starting swarm monitor..." -ForegroundColor Cyan
|
|
952
|
+
$process = Start-Process -FilePath 'node' -ArgumentList @(
|
|
953
|
+
'-e',
|
|
954
|
+
'setInterval(() => { require("fs").writeFileSync(".claude-flow/metrics/swarm-activity.json", JSON.stringify({swarm:{active:true,agent_count:0},timestamp:Date.now()})) }, 5000)'
|
|
955
|
+
) -PassThru -WindowStyle Hidden
|
|
956
|
+
|
|
957
|
+
$process.Id | Out-File $pidFile
|
|
958
|
+
Write-Host "Swarm monitor started (PID: $($process.Id))" -ForegroundColor Green
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
function Stop-SwarmMonitor {
|
|
962
|
+
$pidFile = Join-Path $PidDir 'swarm-monitor.pid'
|
|
963
|
+
$status = Get-DaemonStatus -Name 'swarm-monitor' -PidFile $pidFile
|
|
964
|
+
|
|
965
|
+
if (-not $status.Running) {
|
|
966
|
+
Write-Host "Swarm monitor not running" -ForegroundColor Yellow
|
|
967
|
+
return
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
Stop-Process -Id $status.Pid -Force
|
|
971
|
+
Remove-Item $pidFile -Force
|
|
972
|
+
Write-Host "Swarm monitor stopped" -ForegroundColor Green
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
function Show-Status {
|
|
976
|
+
Write-Host ""
|
|
977
|
+
Write-Host "RuFlo V3 Daemon Status" -ForegroundColor Cyan
|
|
978
|
+
Write-Host "=============================" -ForegroundColor Cyan
|
|
979
|
+
|
|
980
|
+
$swarmPid = Join-Path $PidDir 'swarm-monitor.pid'
|
|
981
|
+
$swarmStatus = Get-DaemonStatus -Name 'swarm-monitor' -PidFile $swarmPid
|
|
982
|
+
|
|
983
|
+
if ($swarmStatus.Running) {
|
|
984
|
+
Write-Host " Swarm Monitor: RUNNING (PID: $($swarmStatus.Pid))" -ForegroundColor Green
|
|
985
|
+
} else {
|
|
986
|
+
Write-Host " Swarm Monitor: STOPPED" -ForegroundColor Red
|
|
987
|
+
}
|
|
988
|
+
Write-Host ""
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
switch ($Action) {
|
|
992
|
+
'start' {
|
|
993
|
+
Start-SwarmMonitor
|
|
994
|
+
Show-Status
|
|
995
|
+
}
|
|
996
|
+
'stop' {
|
|
997
|
+
Stop-SwarmMonitor
|
|
998
|
+
Show-Status
|
|
999
|
+
}
|
|
1000
|
+
'restart' {
|
|
1001
|
+
Stop-SwarmMonitor
|
|
1002
|
+
Start-Sleep -Seconds 1
|
|
1003
|
+
Start-SwarmMonitor
|
|
1004
|
+
Show-Status
|
|
1005
|
+
}
|
|
1006
|
+
'status' {
|
|
1007
|
+
Show-Status
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
`;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Generate Windows batch file wrapper
|
|
1014
|
+
*/
|
|
1015
|
+
export function generateWindowsBatchWrapper() {
|
|
1016
|
+
return `@echo off
|
|
1017
|
+
REM RuFlo V3 - Windows Batch Wrapper
|
|
1018
|
+
REM Routes to PowerShell daemon manager
|
|
1019
|
+
|
|
1020
|
+
PowerShell -ExecutionPolicy Bypass -File "%~dp0daemon-manager.ps1" %*
|
|
1021
|
+
`;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Generate cross-platform session manager
|
|
1025
|
+
*/
|
|
1026
|
+
export function generateCrossPlatformSessionManager() {
|
|
1027
|
+
return `#!/usr/bin/env node
|
|
1028
|
+
/**
|
|
1029
|
+
* Claude Flow Cross-Platform Session Manager
|
|
1030
|
+
* Works on Windows, macOS, and Linux
|
|
1031
|
+
*/
|
|
1032
|
+
|
|
1033
|
+
const fs = require('fs');
|
|
1034
|
+
const path = require('path');
|
|
1035
|
+
const os = require('os');
|
|
1036
|
+
|
|
1037
|
+
// Platform-specific paths
|
|
1038
|
+
const platform = os.platform();
|
|
1039
|
+
const homeDir = os.homedir();
|
|
1040
|
+
|
|
1041
|
+
// Get data directory based on platform
|
|
1042
|
+
function getDataDir() {
|
|
1043
|
+
const localDir = path.join(process.cwd(), '.claude-flow', 'sessions');
|
|
1044
|
+
if (fs.existsSync(path.dirname(localDir))) {
|
|
1045
|
+
return localDir;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
switch (platform) {
|
|
1049
|
+
case 'win32':
|
|
1050
|
+
return path.join(process.env.APPDATA || homeDir, 'claude-flow', 'sessions');
|
|
1051
|
+
case 'darwin':
|
|
1052
|
+
return path.join(homeDir, 'Library', 'Application Support', 'claude-flow', 'sessions');
|
|
1053
|
+
default:
|
|
1054
|
+
return path.join(homeDir, '.claude-flow', 'sessions');
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
const SESSION_DIR = getDataDir();
|
|
1059
|
+
const SESSION_FILE = path.join(SESSION_DIR, 'current.json');
|
|
1060
|
+
|
|
1061
|
+
// Ensure directory exists
|
|
1062
|
+
function ensureDir(dir) {
|
|
1063
|
+
if (!fs.existsSync(dir)) {
|
|
1064
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
const commands = {
|
|
1069
|
+
start: () => {
|
|
1070
|
+
ensureDir(SESSION_DIR);
|
|
1071
|
+
const sessionId = \`session-\${Date.now()}\`;
|
|
1072
|
+
const session = {
|
|
1073
|
+
id: sessionId,
|
|
1074
|
+
startedAt: new Date().toISOString(),
|
|
1075
|
+
platform: platform,
|
|
1076
|
+
cwd: process.cwd(),
|
|
1077
|
+
context: {},
|
|
1078
|
+
metrics: { edits: 0, commands: 0, tasks: 0, errors: 0 }
|
|
1079
|
+
};
|
|
1080
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
1081
|
+
console.log(\`Session started: \${sessionId}\`);
|
|
1082
|
+
return session;
|
|
1083
|
+
},
|
|
1084
|
+
|
|
1085
|
+
restore: () => {
|
|
1086
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
1087
|
+
console.log('No session to restore');
|
|
1088
|
+
return null;
|
|
1089
|
+
}
|
|
1090
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
1091
|
+
session.restoredAt = new Date().toISOString();
|
|
1092
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
1093
|
+
console.log(\`Session restored: \${session.id}\`);
|
|
1094
|
+
return session;
|
|
1095
|
+
},
|
|
1096
|
+
|
|
1097
|
+
end: () => {
|
|
1098
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
1099
|
+
console.log('No active session');
|
|
1100
|
+
return null;
|
|
1101
|
+
}
|
|
1102
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
1103
|
+
session.endedAt = new Date().toISOString();
|
|
1104
|
+
session.duration = Date.now() - new Date(session.startedAt).getTime();
|
|
1105
|
+
|
|
1106
|
+
const archivePath = path.join(SESSION_DIR, \`\${session.id}.json\`);
|
|
1107
|
+
fs.writeFileSync(archivePath, JSON.stringify(session, null, 2));
|
|
1108
|
+
fs.unlinkSync(SESSION_FILE);
|
|
1109
|
+
|
|
1110
|
+
console.log(\`Session ended: \${session.id}\`);
|
|
1111
|
+
console.log(\`Duration: \${Math.round(session.duration / 1000 / 60)} minutes\`);
|
|
1112
|
+
return session;
|
|
1113
|
+
},
|
|
1114
|
+
|
|
1115
|
+
status: () => {
|
|
1116
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
1117
|
+
console.log('No active session');
|
|
1118
|
+
return null;
|
|
1119
|
+
}
|
|
1120
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
1121
|
+
const duration = Date.now() - new Date(session.startedAt).getTime();
|
|
1122
|
+
console.log(\`Session: \${session.id}\`);
|
|
1123
|
+
console.log(\`Platform: \${session.platform}\`);
|
|
1124
|
+
console.log(\`Started: \${session.startedAt}\`);
|
|
1125
|
+
console.log(\`Duration: \${Math.round(duration / 1000 / 60)} minutes\`);
|
|
1126
|
+
return session;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
// CLI
|
|
1131
|
+
const [,, command, ...args] = process.argv;
|
|
1132
|
+
if (command && commands[command]) {
|
|
1133
|
+
commands[command](...args);
|
|
1134
|
+
} else {
|
|
1135
|
+
console.log('Usage: session.js <start|restore|end|status>');
|
|
1136
|
+
console.log(\`Platform: \${platform}\`);
|
|
1137
|
+
console.log(\`Data dir: \${SESSION_DIR}\`);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
module.exports = commands;
|
|
1141
|
+
`;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Generate all helper files
|
|
1145
|
+
*/
|
|
1146
|
+
export function generateHelpers(options) {
|
|
1147
|
+
const helpers = {};
|
|
1148
|
+
if (options.components.helpers) {
|
|
1149
|
+
// Unix/macOS shell scripts
|
|
1150
|
+
helpers['pre-commit'] = generatePreCommitHook();
|
|
1151
|
+
helpers['post-commit'] = generatePostCommitHook();
|
|
1152
|
+
// Cross-platform Node.js scripts
|
|
1153
|
+
helpers['session.js'] = generateCrossPlatformSessionManager();
|
|
1154
|
+
helpers['router.js'] = generateAgentRouter();
|
|
1155
|
+
helpers['memory.js'] = generateMemoryHelper();
|
|
1156
|
+
// Windows-specific scripts
|
|
1157
|
+
helpers['daemon-manager.ps1'] = generateWindowsDaemonManager();
|
|
1158
|
+
helpers['daemon-manager.cmd'] = generateWindowsBatchWrapper();
|
|
1159
|
+
}
|
|
1160
|
+
if (options.components.statusline) {
|
|
1161
|
+
helpers['statusline.cjs'] = generateStatuslineScript(options); // .cjs for ES module compatibility
|
|
1162
|
+
helpers['statusline-hook.sh'] = generateStatuslineHook(options);
|
|
1163
|
+
}
|
|
1164
|
+
return helpers;
|
|
1165
|
+
}
|
|
1166
|
+
//# sourceMappingURL=helpers-generator.js.map
|