@sparkleideas/cli 3.1.0-alpha.19 → 3.1.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
- package/dist/src/appliance/gguf-engine.js +425 -0
- package/dist/src/appliance/gguf-engine.js.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +292 -0
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +329 -0
- package/dist/src/appliance/rvfa-builder.js.map +1 -0
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +370 -0
- package/dist/src/appliance/rvfa-distribution.js.map +1 -0
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-format.js +393 -0
- package/dist/src/appliance/rvfa-format.js.map +1 -0
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +237 -0
- package/dist/src/appliance/rvfa-runner.js.map +1 -0
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +347 -0
- package/dist/src/appliance/rvfa-signing.js.map +1 -0
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +404 -0
- package/dist/src/benchmarks/pretrain/index.js.map +1 -0
- package/dist/src/commands/agent.d.ts +8 -0
- package/dist/src/commands/agent.d.ts.map +1 -0
- package/dist/src/commands/agent.js +819 -0
- package/dist/src/commands/agent.js.map +1 -0
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +1823 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
- package/dist/src/commands/appliance-advanced.js +215 -0
- package/dist/src/commands/appliance-advanced.js.map +1 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.d.ts.map +1 -0
- package/dist/src/commands/appliance.js +406 -0
- package/dist/src/commands/appliance.js.map +1 -0
- package/dist/src/commands/benchmark.d.ts +10 -0
- package/dist/src/commands/benchmark.d.ts.map +1 -0
- package/dist/src/commands/benchmark.js +459 -0
- package/dist/src/commands/benchmark.js.map +1 -0
- package/dist/src/commands/categories.d.ts +75 -0
- package/dist/src/commands/categories.d.ts.map +1 -0
- package/dist/src/commands/categories.js +178 -0
- package/dist/src/commands/categories.js.map +1 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +373 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.d.ts.map +1 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/completions.js.map +1 -0
- package/dist/src/commands/config.d.ts +8 -0
- package/dist/src/commands/config.d.ts.map +1 -0
- package/dist/src/commands/config.js +406 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +609 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +289 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +602 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +1576 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/guidance.d.ts +8 -0
- package/dist/src/commands/guidance.d.ts.map +1 -0
- package/dist/src/commands/guidance.js +560 -0
- package/dist/src/commands/guidance.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts +11 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -0
- package/dist/src/commands/hive-mind.js +1230 -0
- package/dist/src/commands/hive-mind.js.map +1 -0
- package/dist/src/commands/hooks.d.ts +8 -0
- package/dist/src/commands/hooks.d.ts.map +1 -0
- package/dist/src/commands/hooks.js +3759 -0
- package/dist/src/commands/hooks.js.map +1 -0
- package/dist/src/commands/index.d.ts +113 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +368 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +8 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +965 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.d.ts.map +1 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/issues.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +11 -0
- package/dist/src/commands/mcp.d.ts.map +1 -0
- package/dist/src/commands/mcp.js +715 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/commands/memory.d.ts +8 -0
- package/dist/src/commands/memory.d.ts.map +1 -0
- package/dist/src/commands/memory.js +1292 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/migrate.d.ts +8 -0
- package/dist/src/commands/migrate.d.ts.map +1 -0
- package/dist/src/commands/migrate.js +410 -0
- package/dist/src/commands/migrate.js.map +1 -0
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +1448 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +579 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +820 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/process.d.ts +10 -0
- package/dist/src/commands/process.d.ts.map +1 -0
- package/dist/src/commands/process.js +641 -0
- package/dist/src/commands/process.js.map +1 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.d.ts.map +1 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/progress.js.map +1 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +232 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.d.ts.map +1 -0
- package/dist/src/commands/route.js +813 -0
- package/dist/src/commands/route.js.map +1 -0
- package/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/dist/src/commands/ruvector/backup.d.ts.map +1 -0
- package/dist/src/commands/ruvector/backup.js +746 -0
- package/dist/src/commands/ruvector/backup.js.map +1 -0
- package/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/dist/src/commands/ruvector/benchmark.d.ts.map +1 -0
- package/dist/src/commands/ruvector/benchmark.js +480 -0
- package/dist/src/commands/ruvector/benchmark.js.map +1 -0
- package/dist/src/commands/ruvector/import.d.ts +18 -0
- package/dist/src/commands/ruvector/import.d.ts.map +1 -0
- package/dist/src/commands/ruvector/import.js +349 -0
- package/dist/src/commands/ruvector/import.js.map +1 -0
- package/dist/src/commands/ruvector/index.d.ts +29 -0
- package/dist/src/commands/ruvector/index.d.ts.map +1 -0
- package/dist/src/commands/ruvector/index.js +129 -0
- package/dist/src/commands/ruvector/index.js.map +1 -0
- package/dist/src/commands/ruvector/init.d.ts +11 -0
- package/dist/src/commands/ruvector/init.d.ts.map +1 -0
- package/dist/src/commands/ruvector/init.js +431 -0
- package/dist/src/commands/ruvector/init.js.map +1 -0
- package/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/dist/src/commands/ruvector/migrate.d.ts.map +1 -0
- package/dist/src/commands/ruvector/migrate.js +481 -0
- package/dist/src/commands/ruvector/migrate.js.map +1 -0
- package/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/dist/src/commands/ruvector/optimize.d.ts.map +1 -0
- package/dist/src/commands/ruvector/optimize.js +503 -0
- package/dist/src/commands/ruvector/optimize.js.map +1 -0
- package/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/dist/src/commands/ruvector/setup.d.ts.map +1 -0
- package/dist/src/commands/ruvector/setup.js +765 -0
- package/dist/src/commands/ruvector/setup.js.map +1 -0
- package/dist/src/commands/ruvector/status.d.ts +11 -0
- package/dist/src/commands/ruvector/status.d.ts.map +1 -0
- package/dist/src/commands/ruvector/status.js +456 -0
- package/dist/src/commands/ruvector/status.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +575 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/session.d.ts +8 -0
- package/dist/src/commands/session.d.ts.map +1 -0
- package/dist/src/commands/session.js +750 -0
- package/dist/src/commands/session.js.map +1 -0
- package/dist/src/commands/start.d.ts +8 -0
- package/dist/src/commands/start.d.ts.map +1 -0
- package/dist/src/commands/start.js +418 -0
- package/dist/src/commands/start.js.map +1 -0
- package/dist/src/commands/status.d.ts +8 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +591 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/swarm.d.ts +8 -0
- package/dist/src/commands/swarm.d.ts.map +1 -0
- package/dist/src/commands/swarm.js +748 -0
- package/dist/src/commands/swarm.js.map +1 -0
- package/dist/src/commands/task.d.ts +8 -0
- package/dist/src/commands/task.d.ts.map +1 -0
- package/dist/src/commands/task.js +671 -0
- package/dist/src/commands/task.js.map +1 -0
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.d.ts.map +1 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/transfer-store.js.map +1 -0
- package/dist/src/commands/update.d.ts +8 -0
- package/dist/src/commands/update.d.ts.map +1 -0
- package/dist/src/commands/update.js +276 -0
- package/dist/src/commands/update.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +8 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +617 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +186 -0
- package/dist/src/config-adapter.js.map +1 -0
- package/dist/src/index.d.ts +76 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +470 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -0
- package/dist/src/init/claudemd-generator.d.ts +25 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +486 -0
- package/dist/src/init/claudemd-generator.js.map +1 -0
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +1741 -0
- package/dist/src/init/executor.js.map +1 -0
- package/dist/src/init/helpers-generator.d.ts +60 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +1166 -0
- package/dist/src/init/helpers-generator.js.map +1 -0
- package/dist/src/init/index.d.ts +13 -0
- package/dist/src/init/index.d.ts.map +1 -0
- package/dist/src/init/index.js +15 -0
- package/dist/src/init/index.js.map +1 -0
- package/dist/src/init/mcp-generator.d.ts +26 -0
- package/dist/src/init/mcp-generator.d.ts.map +1 -0
- package/dist/src/init/mcp-generator.js +116 -0
- package/dist/src/init/mcp-generator.js.map +1 -0
- package/dist/src/init/settings-generator.d.ts +14 -0
- package/dist/src/init/settings-generator.d.ts.map +1 -0
- package/dist/src/init/settings-generator.js +399 -0
- package/dist/src/init/settings-generator.js.map +1 -0
- package/dist/src/init/statusline-generator.d.ts +28 -0
- package/dist/src/init/statusline-generator.d.ts.map +1 -0
- package/dist/src/init/statusline-generator.js +817 -0
- package/dist/src/init/statusline-generator.js.map +1 -0
- package/dist/src/init/types.d.ts +287 -0
- package/dist/src/init/types.d.ts.map +1 -0
- package/dist/src/init/types.js +259 -0
- package/dist/src/init/types.js.map +1 -0
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +237 -0
- package/dist/src/mcp-client.js.map +1 -0
- package/dist/src/mcp-server.d.ts +161 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +627 -0
- package/dist/src/mcp-server.js.map +1 -0
- package/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agent-tools.js +549 -0
- package/dist/src/mcp-tools/agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.js +557 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +131 -0
- package/dist/src/mcp-tools/auto-install.js.map +1 -0
- package/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/dist/src/mcp-tools/browser-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/browser-tools.js +550 -0
- package/dist/src/mcp-tools/browser-tools.js.map +1 -0
- package/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/dist/src/mcp-tools/claims-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/claims-tools.js +732 -0
- package/dist/src/mcp-tools/claims-tools.js.map +1 -0
- package/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/config-tools.js +343 -0
- package/dist/src/mcp-tools/config-tools.js.map +1 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/coordination-tools.js +486 -0
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -0
- package/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/dist/src/mcp-tools/daa-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/daa-tools.js +426 -0
- package/dist/src/mcp-tools/daa-tools.js.map +1 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/embeddings-tools.js +782 -0
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -0
- package/dist/src/mcp-tools/github-tools.d.ts +13 -0
- package/dist/src/mcp-tools/github-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/github-tools.js +373 -0
- package/dist/src/mcp-tools/github-tools.js.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +583 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.js +2969 -0
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -0
- package/dist/src/mcp-tools/index.d.ts +23 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -0
- package/dist/src/mcp-tools/index.js +22 -0
- package/dist/src/mcp-tools/index.js.map +1 -0
- package/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/memory-tools.js +499 -0
- package/dist/src/mcp-tools/memory-tools.js.map +1 -0
- package/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/neural-tools.js +461 -0
- package/dist/src/mcp-tools/neural-tools.js.map +1 -0
- package/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/performance-tools.js +534 -0
- package/dist/src/mcp-tools/performance-tools.js.map +1 -0
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/progress-tools.js +348 -0
- package/dist/src/mcp-tools/progress-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +434 -0
- package/dist/src/mcp-tools/security-tools.js.map +1 -0
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/session-tools.js +315 -0
- package/dist/src/mcp-tools/session-tools.js.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts +8 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.js +102 -0
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -0
- package/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/system-tools.js +417 -0
- package/dist/src/mcp-tools/system-tools.js.map +1 -0
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/task-tools.js +338 -0
- package/dist/src/mcp-tools/task-tools.js.map +1 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts +13 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/terminal-tools.js +246 -0
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.js +396 -0
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -0
- package/dist/src/mcp-tools/types.d.ts +31 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/types.js +7 -0
- package/dist/src/mcp-tools/types.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +572 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/memory/ewc-consolidation.d.ts +271 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +542 -0
- package/dist/src/memory/ewc-consolidation.js.map +1 -0
- package/dist/src/memory/intelligence.d.ts +285 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +794 -0
- package/dist/src/memory/intelligence.js.map +1 -0
- package/dist/src/memory/memory-bridge.d.ts +407 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -0
- package/dist/src/memory/memory-bridge.js +1494 -0
- package/dist/src/memory/memory-bridge.js.map +1 -0
- package/dist/src/memory/memory-initializer.d.ts +405 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +2105 -0
- package/dist/src/memory/memory-initializer.js.map +1 -0
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +633 -0
- package/dist/src/memory/sona-optimizer.js.map +1 -0
- package/dist/src/output.d.ts +133 -0
- package/dist/src/output.d.ts.map +1 -0
- package/dist/src/output.js +514 -0
- package/dist/src/output.js.map +1 -0
- package/dist/src/parser.d.ts +41 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +377 -0
- package/dist/src/parser.js.map +1 -0
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +400 -0
- package/dist/src/plugins/manager.js.map +1 -0
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +1147 -0
- package/dist/src/plugins/store/discovery.js.map +1 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/index.js.map +1 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/search.js.map +1 -0
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/store/types.js.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/standalone-test.js.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -0
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +241 -0
- package/dist/src/production/circuit-breaker.js.map +1 -0
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +299 -0
- package/dist/src/production/error-handler.js.map +1 -0
- package/dist/src/production/index.d.ts +23 -0
- package/dist/src/production/index.d.ts.map +1 -0
- package/dist/src/production/index.js +18 -0
- package/dist/src/production/index.js.map +1 -0
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +356 -0
- package/dist/src/production/monitoring.js.map +1 -0
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +201 -0
- package/dist/src/production/rate-limiter.js.map +1 -0
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +179 -0
- package/dist/src/production/retry.js.map +1 -0
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +501 -0
- package/dist/src/prompt.js.map +1 -0
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +284 -0
- package/dist/src/runtime/headless.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/ast-analyzer.js.map +1 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +529 -0
- package/dist/src/ruvector/coverage-router.js.map +1 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/coverage-tools.js.map +1 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +698 -0
- package/dist/src/ruvector/diff-classifier.js.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +529 -0
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -0
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +643 -0
- package/dist/src/ruvector/flash-attention.js.map +1 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-analyzer.js.map +1 -0
- package/dist/src/ruvector/index.d.ts +34 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +60 -0
- package/dist/src/ruvector/index.js.map +1 -0
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +455 -0
- package/dist/src/ruvector/lora-adapter.js.map +1 -0
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +488 -0
- package/dist/src/ruvector/model-router.js.map +1 -0
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +626 -0
- package/dist/src/ruvector/moe-router.js.map +1 -0
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +681 -0
- package/dist/src/ruvector/q-learning-router.js.map +1 -0
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +178 -0
- package/dist/src/ruvector/semantic-router.js.map +1 -0
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +243 -0
- package/dist/src/ruvector/vector-db.js.map +1 -0
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
- package/dist/src/services/agentic-flow-bridge.js +95 -0
- package/dist/src/services/agentic-flow-bridge.js.map +1 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/claim-service.js.map +1 -0
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +583 -0
- package/dist/src/services/container-worker-pool.js.map +1 -0
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +999 -0
- package/dist/src/services/headless-worker-executor.js.map +1 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +146 -0
- package/dist/src/services/registry-api.js.map +1 -0
- package/dist/src/services/ruvector-training.d.ts +214 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +497 -0
- package/dist/src/services/ruvector-training.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +203 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +756 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +513 -0
- package/dist/src/services/worker-queue.js.map +1 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/suggest.js.map +1 -0
- package/dist/src/tests/ruvector-integration-benchmark.d.ts +6 -0
- package/dist/src/tests/ruvector-integration-benchmark.d.ts.map +1 -0
- package/dist/src/tests/ruvector-integration-benchmark.js +385 -0
- package/dist/src/tests/ruvector-integration-benchmark.js.map +1 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.d.ts.map +1 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/anonymization/index.js.map +1 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/deploy-seraphine.js.map +1 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/export.js.map +1 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.d.ts.map +1 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/index.js.map +1 -0
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +307 -0
- package/dist/src/transfer/ipfs/client.js.map +1 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +411 -0
- package/dist/src/transfer/ipfs/upload.js.map +1 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/models/seraphine.js.map +1 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +183 -0
- package/dist/src/transfer/serialization/cfp.js.map +1 -0
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +256 -0
- package/dist/src/transfer/storage/gcs.js.map +1 -0
- package/dist/src/transfer/storage/index.d.ts +6 -0
- package/dist/src/transfer/storage/index.d.ts.map +1 -0
- package/dist/src/transfer/storage/index.js +6 -0
- package/dist/src/transfer/storage/index.js.map +1 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +382 -0
- package/dist/src/transfer/store/discovery.js.map +1 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +334 -0
- package/dist/src/transfer/store/download.js.map +1 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/index.js.map +1 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +294 -0
- package/dist/src/transfer/store/publish.js.map +1 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.d.ts.map +1 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/registry.js.map +1 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/search.js.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.d.ts.map +1 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/store/types.js.map +1 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/test-seraphine.js.map +1 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.d.ts.map +1 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/tests/test-store.js.map +1 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/transfer/types.js.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +38 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +190 -0
- package/dist/src/update/checker.js.map +1 -0
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +181 -0
- package/dist/src/update/executor.js.map +1 -0
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +64 -0
- package/dist/src/update/index.js.map +1 -0
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +96 -0
- package/dist/src/update/rate-limiter.js.map +1 -0
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +123 -0
- package/dist/src/update/validator.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,1292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 CLI Memory Command
|
|
3
|
+
* Memory operations for AgentDB integration
|
|
4
|
+
*/
|
|
5
|
+
import { output } from '../output.js';
|
|
6
|
+
import { select, confirm, input } from '../prompt.js';
|
|
7
|
+
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
8
|
+
// Memory backends
|
|
9
|
+
const BACKENDS = [
|
|
10
|
+
{ value: '@sparkleideas/agentdb', label: 'AgentDB', hint: 'Vector database with HNSW indexing (150x-12,500x faster)' },
|
|
11
|
+
{ value: 'sqlite', label: 'SQLite', hint: 'Lightweight local storage' },
|
|
12
|
+
{ value: 'hybrid', label: 'Hybrid', hint: 'SQLite + AgentDB (recommended)' },
|
|
13
|
+
{ value: 'memory', label: 'In-Memory', hint: 'Fast but non-persistent' }
|
|
14
|
+
];
|
|
15
|
+
// Store command
|
|
16
|
+
const storeCommand = {
|
|
17
|
+
name: 'store',
|
|
18
|
+
description: 'Store data in memory',
|
|
19
|
+
options: [
|
|
20
|
+
{
|
|
21
|
+
name: 'key',
|
|
22
|
+
short: 'k',
|
|
23
|
+
description: 'Storage key/namespace',
|
|
24
|
+
type: 'string',
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'value',
|
|
29
|
+
// Note: No short flag - global -v is reserved for verbose
|
|
30
|
+
description: 'Value to store (use --value)',
|
|
31
|
+
type: 'string'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'namespace',
|
|
35
|
+
short: 'n',
|
|
36
|
+
description: 'Memory namespace',
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: 'default'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'ttl',
|
|
42
|
+
description: 'Time to live in seconds',
|
|
43
|
+
type: 'number'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'tags',
|
|
47
|
+
description: 'Comma-separated tags',
|
|
48
|
+
type: 'string'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'vector',
|
|
52
|
+
description: 'Store as vector embedding',
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'upsert',
|
|
58
|
+
short: 'u',
|
|
59
|
+
description: 'Update if key exists (insert or replace)',
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
default: false
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
examples: [
|
|
65
|
+
{ command: '@sparkleideas/claude-flow memory store -k "api/auth" -v "JWT implementation"', description: 'Store text' },
|
|
66
|
+
{ command: '@sparkleideas/claude-flow memory store -k "pattern/singleton" --vector', description: 'Store vector' },
|
|
67
|
+
{ command: '@sparkleideas/claude-flow memory store -k "pattern" -v "updated" --upsert', description: 'Update existing' }
|
|
68
|
+
],
|
|
69
|
+
action: async (ctx) => {
|
|
70
|
+
const key = ctx.flags.key;
|
|
71
|
+
let value = ctx.flags.value || ctx.args[0];
|
|
72
|
+
const namespace = ctx.flags.namespace;
|
|
73
|
+
const ttl = ctx.flags.ttl;
|
|
74
|
+
const tags = ctx.flags.tags ? ctx.flags.tags.split(',') : [];
|
|
75
|
+
const asVector = ctx.flags.vector;
|
|
76
|
+
const upsert = ctx.flags.upsert;
|
|
77
|
+
if (!key) {
|
|
78
|
+
output.printError('Key is required. Use --key or -k');
|
|
79
|
+
return { success: false, exitCode: 1 };
|
|
80
|
+
}
|
|
81
|
+
if (!value && ctx.interactive) {
|
|
82
|
+
value = await input({
|
|
83
|
+
message: 'Enter value to store:',
|
|
84
|
+
validate: (v) => v.length > 0 || 'Value is required'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (!value) {
|
|
88
|
+
output.printError('Value is required. Use --value');
|
|
89
|
+
return { success: false, exitCode: 1 };
|
|
90
|
+
}
|
|
91
|
+
const storeData = {
|
|
92
|
+
key,
|
|
93
|
+
namespace,
|
|
94
|
+
value,
|
|
95
|
+
ttl,
|
|
96
|
+
tags,
|
|
97
|
+
asVector,
|
|
98
|
+
storedAt: new Date().toISOString(),
|
|
99
|
+
size: Buffer.byteLength(value, 'utf8')
|
|
100
|
+
};
|
|
101
|
+
output.printInfo(`Storing in ${namespace}/${key}...`);
|
|
102
|
+
// Use direct sql.js storage with automatic embedding generation
|
|
103
|
+
try {
|
|
104
|
+
const { storeEntry } = await import('../memory/memory-initializer.js');
|
|
105
|
+
if (asVector) {
|
|
106
|
+
output.writeln(output.dim(' Generating embedding vector...'));
|
|
107
|
+
}
|
|
108
|
+
const result = await storeEntry({
|
|
109
|
+
key,
|
|
110
|
+
value,
|
|
111
|
+
namespace,
|
|
112
|
+
generateEmbeddingFlag: true, // Always generate embeddings for semantic search
|
|
113
|
+
tags,
|
|
114
|
+
ttl,
|
|
115
|
+
upsert
|
|
116
|
+
});
|
|
117
|
+
if (!result.success) {
|
|
118
|
+
output.printError(result.error || 'Failed to store');
|
|
119
|
+
return { success: false, exitCode: 1 };
|
|
120
|
+
}
|
|
121
|
+
output.writeln();
|
|
122
|
+
output.printTable({
|
|
123
|
+
columns: [
|
|
124
|
+
{ key: 'property', header: 'Property', width: 15 },
|
|
125
|
+
{ key: 'val', header: 'Value', width: 40 }
|
|
126
|
+
],
|
|
127
|
+
data: [
|
|
128
|
+
{ property: 'Key', val: key },
|
|
129
|
+
{ property: 'Namespace', val: namespace },
|
|
130
|
+
{ property: 'Size', val: `${storeData.size} bytes` },
|
|
131
|
+
{ property: 'TTL', val: ttl ? `${ttl}s` : 'None' },
|
|
132
|
+
{ property: 'Tags', val: tags.length > 0 ? tags.join(', ') : 'None' },
|
|
133
|
+
{ property: 'Vector', val: result.embedding ? `Yes (${result.embedding.dimensions}-dim)` : 'No' },
|
|
134
|
+
{ property: 'ID', val: result.id.substring(0, 20) }
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
output.writeln();
|
|
138
|
+
output.printSuccess('Data stored successfully');
|
|
139
|
+
return { success: true, data: { ...storeData, id: result.id, embedding: result.embedding } };
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
output.printError(`Failed to store: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
143
|
+
return { success: false, exitCode: 1 };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
// Retrieve command
|
|
148
|
+
const retrieveCommand = {
|
|
149
|
+
name: 'retrieve',
|
|
150
|
+
aliases: ['get'],
|
|
151
|
+
description: 'Retrieve data from memory',
|
|
152
|
+
options: [
|
|
153
|
+
{
|
|
154
|
+
name: 'key',
|
|
155
|
+
short: 'k',
|
|
156
|
+
description: 'Storage key',
|
|
157
|
+
type: 'string'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'namespace',
|
|
161
|
+
short: 'n',
|
|
162
|
+
description: 'Memory namespace',
|
|
163
|
+
type: 'string',
|
|
164
|
+
default: 'default'
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
action: async (ctx) => {
|
|
168
|
+
const key = ctx.flags.key || ctx.args[0];
|
|
169
|
+
const namespace = ctx.flags.namespace;
|
|
170
|
+
if (!key) {
|
|
171
|
+
output.printError('Key is required');
|
|
172
|
+
return { success: false, exitCode: 1 };
|
|
173
|
+
}
|
|
174
|
+
// Use sql.js directly for consistent data access
|
|
175
|
+
try {
|
|
176
|
+
const { getEntry } = await import('../memory/memory-initializer.js');
|
|
177
|
+
const result = await getEntry({ key, namespace });
|
|
178
|
+
if (!result.success) {
|
|
179
|
+
output.printError(`Failed to retrieve: ${result.error}`);
|
|
180
|
+
return { success: false, exitCode: 1 };
|
|
181
|
+
}
|
|
182
|
+
if (!result.found || !result.entry) {
|
|
183
|
+
output.printWarning(`Key not found: ${key}`);
|
|
184
|
+
return { success: false, exitCode: 1, data: { key, found: false } };
|
|
185
|
+
}
|
|
186
|
+
const entry = result.entry;
|
|
187
|
+
if (ctx.flags.format === 'json') {
|
|
188
|
+
output.printJson(entry);
|
|
189
|
+
return { success: true, data: entry };
|
|
190
|
+
}
|
|
191
|
+
output.writeln();
|
|
192
|
+
output.printBox([
|
|
193
|
+
`Namespace: ${entry.namespace}`,
|
|
194
|
+
`Key: ${entry.key}`,
|
|
195
|
+
`Size: ${entry.content.length} bytes`,
|
|
196
|
+
`Access Count: ${entry.accessCount}`,
|
|
197
|
+
`Tags: ${entry.tags.length > 0 ? entry.tags.join(', ') : 'None'}`,
|
|
198
|
+
`Vector: ${entry.hasEmbedding ? 'Yes' : 'No'}`,
|
|
199
|
+
'',
|
|
200
|
+
output.bold('Value:'),
|
|
201
|
+
entry.content
|
|
202
|
+
].join('\n'), 'Memory Entry');
|
|
203
|
+
return { success: true, data: entry };
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
output.printError(`Failed to retrieve: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
207
|
+
return { success: false, exitCode: 1 };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
// Search command
|
|
212
|
+
const searchCommand = {
|
|
213
|
+
name: 'search',
|
|
214
|
+
description: 'Search memory with semantic/vector search',
|
|
215
|
+
options: [
|
|
216
|
+
{
|
|
217
|
+
name: 'query',
|
|
218
|
+
short: 'q',
|
|
219
|
+
description: 'Search query',
|
|
220
|
+
type: 'string',
|
|
221
|
+
required: true
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'namespace',
|
|
225
|
+
short: 'n',
|
|
226
|
+
description: 'Memory namespace',
|
|
227
|
+
type: 'string'
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'limit',
|
|
231
|
+
short: 'l',
|
|
232
|
+
description: 'Maximum results',
|
|
233
|
+
type: 'number',
|
|
234
|
+
default: 10
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'threshold',
|
|
238
|
+
description: 'Similarity threshold (0-1)',
|
|
239
|
+
type: 'number',
|
|
240
|
+
default: 0.7
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'type',
|
|
244
|
+
short: 't',
|
|
245
|
+
description: 'Search type (semantic, keyword, hybrid)',
|
|
246
|
+
type: 'string',
|
|
247
|
+
default: 'semantic',
|
|
248
|
+
choices: ['semantic', 'keyword', 'hybrid']
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'build-hnsw',
|
|
252
|
+
description: 'Build/rebuild HNSW index before searching (enables 150x-12,500x speedup)',
|
|
253
|
+
type: 'boolean',
|
|
254
|
+
default: false
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
examples: [
|
|
258
|
+
{ command: '@sparkleideas/claude-flow memory search -q "authentication patterns"', description: 'Semantic search' },
|
|
259
|
+
{ command: '@sparkleideas/claude-flow memory search -q "JWT" -t keyword', description: 'Keyword search' },
|
|
260
|
+
{ command: '@sparkleideas/claude-flow memory search -q "test" --build-hnsw', description: 'Build HNSW index and search' }
|
|
261
|
+
],
|
|
262
|
+
action: async (ctx) => {
|
|
263
|
+
const query = ctx.flags.query || ctx.args[0];
|
|
264
|
+
const namespace = ctx.flags.namespace || 'all';
|
|
265
|
+
const limit = ctx.flags.limit || 10;
|
|
266
|
+
const threshold = ctx.flags.threshold || 0.3;
|
|
267
|
+
const searchType = ctx.flags.type || 'semantic';
|
|
268
|
+
const buildHnsw = (ctx.flags['build-hnsw'] || ctx.flags.buildHnsw);
|
|
269
|
+
if (!query) {
|
|
270
|
+
output.printError('Query is required. Use --query or -q');
|
|
271
|
+
return { success: false, exitCode: 1 };
|
|
272
|
+
}
|
|
273
|
+
// Build/rebuild HNSW index if requested
|
|
274
|
+
if (buildHnsw) {
|
|
275
|
+
output.printInfo('Building HNSW index...');
|
|
276
|
+
try {
|
|
277
|
+
const { getHNSWIndex, getHNSWStatus } = await import('../memory/memory-initializer.js');
|
|
278
|
+
const startTime = Date.now();
|
|
279
|
+
const index = await getHNSWIndex({ forceRebuild: true });
|
|
280
|
+
const buildTime = Date.now() - startTime;
|
|
281
|
+
if (index) {
|
|
282
|
+
const status = getHNSWStatus();
|
|
283
|
+
output.printSuccess(`HNSW index built (${status.entryCount} vectors, ${buildTime}ms)`);
|
|
284
|
+
output.writeln(output.dim(` Dimensions: ${status.dimensions}, Metric: cosine`));
|
|
285
|
+
output.writeln(output.dim(` Search speedup: ${status.entryCount > 10000 ? '12,500x' : status.entryCount > 1000 ? '150x' : '10x'}`));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
output.printWarning('HNSW index not available (install @ruvector/core for acceleration)');
|
|
289
|
+
}
|
|
290
|
+
output.writeln();
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
output.printWarning(`HNSW build failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
294
|
+
output.writeln(output.dim(' Falling back to brute-force search'));
|
|
295
|
+
output.writeln();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
output.printInfo(`Searching: "${query}" (${searchType})`);
|
|
299
|
+
output.writeln();
|
|
300
|
+
// Use direct sql.js search with vector similarity
|
|
301
|
+
try {
|
|
302
|
+
const { searchEntries } = await import('../memory/memory-initializer.js');
|
|
303
|
+
const searchResult = await searchEntries({
|
|
304
|
+
query,
|
|
305
|
+
namespace,
|
|
306
|
+
limit,
|
|
307
|
+
threshold
|
|
308
|
+
});
|
|
309
|
+
if (!searchResult.success) {
|
|
310
|
+
output.printError(searchResult.error || 'Search failed');
|
|
311
|
+
return { success: false, exitCode: 1 };
|
|
312
|
+
}
|
|
313
|
+
const results = searchResult.results.map(r => ({
|
|
314
|
+
key: r.key,
|
|
315
|
+
score: r.score,
|
|
316
|
+
namespace: r.namespace,
|
|
317
|
+
preview: r.content
|
|
318
|
+
}));
|
|
319
|
+
if (ctx.flags.format === 'json') {
|
|
320
|
+
output.printJson({ query, searchType, results, searchTime: `${searchResult.searchTime}ms` });
|
|
321
|
+
return { success: true, data: results };
|
|
322
|
+
}
|
|
323
|
+
// Performance stats
|
|
324
|
+
output.writeln(output.dim(` Search time: ${searchResult.searchTime}ms`));
|
|
325
|
+
output.writeln();
|
|
326
|
+
if (results.length === 0) {
|
|
327
|
+
output.printWarning('No results found');
|
|
328
|
+
output.writeln(output.dim('Try: @sparkleideas/claude-flow memory store -k "key" --value "data"'));
|
|
329
|
+
return { success: true, data: [] };
|
|
330
|
+
}
|
|
331
|
+
output.printTable({
|
|
332
|
+
columns: [
|
|
333
|
+
{ key: 'key', header: 'Key', width: 20 },
|
|
334
|
+
{ key: 'score', header: 'Score', width: 8, align: 'right', format: (v) => Number(v).toFixed(2) },
|
|
335
|
+
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
336
|
+
{ key: 'preview', header: 'Preview', width: 35 }
|
|
337
|
+
],
|
|
338
|
+
data: results
|
|
339
|
+
});
|
|
340
|
+
output.writeln();
|
|
341
|
+
output.printInfo(`Found ${results.length} results`);
|
|
342
|
+
return { success: true, data: results };
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
output.printError(`Search failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
346
|
+
return { success: false, exitCode: 1 };
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
// List command
|
|
351
|
+
const listCommand = {
|
|
352
|
+
name: 'list',
|
|
353
|
+
aliases: ['ls'],
|
|
354
|
+
description: 'List memory entries',
|
|
355
|
+
options: [
|
|
356
|
+
{
|
|
357
|
+
name: 'namespace',
|
|
358
|
+
short: 'n',
|
|
359
|
+
description: 'Filter by namespace',
|
|
360
|
+
type: 'string'
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: 'tags',
|
|
364
|
+
short: 't',
|
|
365
|
+
description: 'Filter by tags (comma-separated)',
|
|
366
|
+
type: 'string'
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: 'limit',
|
|
370
|
+
short: 'l',
|
|
371
|
+
description: 'Maximum entries',
|
|
372
|
+
type: 'number',
|
|
373
|
+
default: 20
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
action: async (ctx) => {
|
|
377
|
+
const namespace = ctx.flags.namespace;
|
|
378
|
+
const limit = ctx.flags.limit;
|
|
379
|
+
// Use sql.js directly for consistent data access
|
|
380
|
+
try {
|
|
381
|
+
const { listEntries } = await import('../memory/memory-initializer.js');
|
|
382
|
+
const listResult = await listEntries({ namespace, limit, offset: 0 });
|
|
383
|
+
if (!listResult.success) {
|
|
384
|
+
output.printError(`Failed to list: ${listResult.error}`);
|
|
385
|
+
return { success: false, exitCode: 1 };
|
|
386
|
+
}
|
|
387
|
+
// Format entries for display
|
|
388
|
+
const entries = listResult.entries.map(e => ({
|
|
389
|
+
key: e.key,
|
|
390
|
+
namespace: e.namespace,
|
|
391
|
+
size: e.size + ' B',
|
|
392
|
+
vector: e.hasEmbedding ? '✓' : '-',
|
|
393
|
+
accessCount: e.accessCount,
|
|
394
|
+
updated: formatRelativeTime(e.updatedAt)
|
|
395
|
+
}));
|
|
396
|
+
if (ctx.flags.format === 'json') {
|
|
397
|
+
output.printJson(listResult.entries);
|
|
398
|
+
return { success: true, data: listResult.entries };
|
|
399
|
+
}
|
|
400
|
+
output.writeln();
|
|
401
|
+
output.writeln(output.bold('Memory Entries'));
|
|
402
|
+
output.writeln();
|
|
403
|
+
if (entries.length === 0) {
|
|
404
|
+
output.printWarning('No entries found');
|
|
405
|
+
output.printInfo('Store data: @sparkleideas/claude-flow memory store -k "key" --value "data"');
|
|
406
|
+
return { success: true, data: [] };
|
|
407
|
+
}
|
|
408
|
+
output.printTable({
|
|
409
|
+
columns: [
|
|
410
|
+
{ key: 'key', header: 'Key', width: 25 },
|
|
411
|
+
{ key: 'namespace', header: 'Namespace', width: 12 },
|
|
412
|
+
{ key: 'size', header: 'Size', width: 10, align: 'right' },
|
|
413
|
+
{ key: 'vector', header: 'Vector', width: 8, align: 'center' },
|
|
414
|
+
{ key: 'accessCount', header: 'Accessed', width: 10, align: 'right' },
|
|
415
|
+
{ key: 'updated', header: 'Updated', width: 12 }
|
|
416
|
+
],
|
|
417
|
+
data: entries
|
|
418
|
+
});
|
|
419
|
+
output.writeln();
|
|
420
|
+
output.printInfo(`Showing ${entries.length} of ${listResult.total} entries`);
|
|
421
|
+
return { success: true, data: listResult.entries };
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
output.printError(`Failed to list: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
425
|
+
return { success: false, exitCode: 1 };
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
// Helper function to format relative time
|
|
430
|
+
function formatRelativeTime(isoDate) {
|
|
431
|
+
const now = Date.now();
|
|
432
|
+
const date = new Date(isoDate).getTime();
|
|
433
|
+
const diff = now - date;
|
|
434
|
+
const seconds = Math.floor(diff / 1000);
|
|
435
|
+
const minutes = Math.floor(seconds / 60);
|
|
436
|
+
const hours = Math.floor(minutes / 60);
|
|
437
|
+
const days = Math.floor(hours / 24);
|
|
438
|
+
if (days > 0)
|
|
439
|
+
return `${days}d ago`;
|
|
440
|
+
if (hours > 0)
|
|
441
|
+
return `${hours}h ago`;
|
|
442
|
+
if (minutes > 0)
|
|
443
|
+
return `${minutes}m ago`;
|
|
444
|
+
return 'just now';
|
|
445
|
+
}
|
|
446
|
+
// Delete command
|
|
447
|
+
const deleteCommand = {
|
|
448
|
+
name: 'delete',
|
|
449
|
+
aliases: ['rm'],
|
|
450
|
+
description: 'Delete memory entry',
|
|
451
|
+
options: [
|
|
452
|
+
{
|
|
453
|
+
name: 'key',
|
|
454
|
+
short: 'k',
|
|
455
|
+
description: 'Storage key',
|
|
456
|
+
type: 'string'
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: 'namespace',
|
|
460
|
+
short: 'n',
|
|
461
|
+
description: 'Memory namespace',
|
|
462
|
+
type: 'string',
|
|
463
|
+
default: 'default'
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
name: 'force',
|
|
467
|
+
short: 'f',
|
|
468
|
+
description: 'Skip confirmation',
|
|
469
|
+
type: 'boolean',
|
|
470
|
+
default: false
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
examples: [
|
|
474
|
+
{ command: '@sparkleideas/claude-flow memory delete -k "mykey"', description: 'Delete entry with default namespace' },
|
|
475
|
+
{ command: '@sparkleideas/claude-flow memory delete -k "lesson" -n "lessons"', description: 'Delete entry from specific namespace' },
|
|
476
|
+
{ command: '@sparkleideas/claude-flow memory delete mykey -f', description: 'Delete without confirmation' }
|
|
477
|
+
],
|
|
478
|
+
action: async (ctx) => {
|
|
479
|
+
// Support both --key flag and positional argument
|
|
480
|
+
const key = ctx.flags.key || ctx.args[0];
|
|
481
|
+
const namespace = ctx.flags.namespace || 'default';
|
|
482
|
+
const force = ctx.flags.force;
|
|
483
|
+
if (!key) {
|
|
484
|
+
output.printError('Key is required. Use: memory delete -k "key" [-n "namespace"]');
|
|
485
|
+
return { success: false, exitCode: 1 };
|
|
486
|
+
}
|
|
487
|
+
if (!force && ctx.interactive) {
|
|
488
|
+
const confirmed = await confirm({
|
|
489
|
+
message: `Delete memory entry "${key}" from namespace "${namespace}"?`,
|
|
490
|
+
default: false
|
|
491
|
+
});
|
|
492
|
+
if (!confirmed) {
|
|
493
|
+
output.printInfo('Operation cancelled');
|
|
494
|
+
return { success: true };
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// Use sql.js directly for consistent data access (Issue #980)
|
|
498
|
+
try {
|
|
499
|
+
const { deleteEntry } = await import('../memory/memory-initializer.js');
|
|
500
|
+
const result = await deleteEntry({ key, namespace });
|
|
501
|
+
if (!result.success) {
|
|
502
|
+
output.printError(result.error || 'Failed to delete');
|
|
503
|
+
return { success: false, exitCode: 1 };
|
|
504
|
+
}
|
|
505
|
+
if (result.deleted) {
|
|
506
|
+
output.printSuccess(`Deleted "${key}" from namespace "${namespace}"`);
|
|
507
|
+
output.printInfo(`Remaining entries: ${result.remainingEntries}`);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
output.printWarning(`Key not found: "${key}" in namespace "${namespace}"`);
|
|
511
|
+
}
|
|
512
|
+
return { success: result.deleted, data: result };
|
|
513
|
+
}
|
|
514
|
+
catch (error) {
|
|
515
|
+
output.printError(`Failed to delete: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
516
|
+
return { success: false, exitCode: 1 };
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
// Stats command
|
|
521
|
+
const statsCommand = {
|
|
522
|
+
name: 'stats',
|
|
523
|
+
description: 'Show memory statistics',
|
|
524
|
+
action: async (ctx) => {
|
|
525
|
+
// Call MCP memory/stats tool for real statistics
|
|
526
|
+
try {
|
|
527
|
+
const statsResult = await callMCPTool('memory_stats', {});
|
|
528
|
+
const stats = {
|
|
529
|
+
backend: statsResult.backend,
|
|
530
|
+
entries: {
|
|
531
|
+
total: statsResult.totalEntries,
|
|
532
|
+
vectors: 0, // Would need vector backend support
|
|
533
|
+
text: statsResult.totalEntries
|
|
534
|
+
},
|
|
535
|
+
storage: {
|
|
536
|
+
total: statsResult.totalSize,
|
|
537
|
+
location: statsResult.location
|
|
538
|
+
},
|
|
539
|
+
version: statsResult.version,
|
|
540
|
+
oldestEntry: statsResult.oldestEntry,
|
|
541
|
+
newestEntry: statsResult.newestEntry
|
|
542
|
+
};
|
|
543
|
+
if (ctx.flags.format === 'json') {
|
|
544
|
+
output.printJson(stats);
|
|
545
|
+
return { success: true, data: stats };
|
|
546
|
+
}
|
|
547
|
+
output.writeln();
|
|
548
|
+
output.writeln(output.bold('Memory Statistics'));
|
|
549
|
+
output.writeln();
|
|
550
|
+
output.writeln(output.bold('Overview'));
|
|
551
|
+
output.printTable({
|
|
552
|
+
columns: [
|
|
553
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
554
|
+
{ key: 'value', header: 'Value', width: 30, align: 'right' }
|
|
555
|
+
],
|
|
556
|
+
data: [
|
|
557
|
+
{ metric: 'Backend', value: stats.backend },
|
|
558
|
+
{ metric: 'Version', value: stats.version },
|
|
559
|
+
{ metric: 'Total Entries', value: stats.entries.total.toLocaleString() },
|
|
560
|
+
{ metric: 'Total Storage', value: stats.storage.total },
|
|
561
|
+
{ metric: 'Location', value: stats.storage.location }
|
|
562
|
+
]
|
|
563
|
+
});
|
|
564
|
+
output.writeln();
|
|
565
|
+
output.writeln(output.bold('Timeline'));
|
|
566
|
+
output.printTable({
|
|
567
|
+
columns: [
|
|
568
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
569
|
+
{ key: 'value', header: 'Value', width: 30, align: 'right' }
|
|
570
|
+
],
|
|
571
|
+
data: [
|
|
572
|
+
{ metric: 'Oldest Entry', value: stats.oldestEntry || 'N/A' },
|
|
573
|
+
{ metric: 'Newest Entry', value: stats.newestEntry || 'N/A' }
|
|
574
|
+
]
|
|
575
|
+
});
|
|
576
|
+
output.writeln();
|
|
577
|
+
output.printInfo('V3 Performance: 150x-12,500x faster search with HNSW indexing');
|
|
578
|
+
return { success: true, data: stats };
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
output.printError(`Failed to get stats: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
582
|
+
return { success: false, exitCode: 1 };
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
// Configure command
|
|
587
|
+
const configureCommand = {
|
|
588
|
+
name: 'configure',
|
|
589
|
+
aliases: ['config'],
|
|
590
|
+
description: 'Configure memory backend',
|
|
591
|
+
options: [
|
|
592
|
+
{
|
|
593
|
+
name: 'backend',
|
|
594
|
+
short: 'b',
|
|
595
|
+
description: 'Memory backend',
|
|
596
|
+
type: 'string',
|
|
597
|
+
choices: BACKENDS.map(b => b.value)
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: 'path',
|
|
601
|
+
description: 'Storage path',
|
|
602
|
+
type: 'string'
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: 'cache-size',
|
|
606
|
+
description: 'Cache size in MB',
|
|
607
|
+
type: 'number'
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: 'hnsw-m',
|
|
611
|
+
description: 'HNSW M parameter',
|
|
612
|
+
type: 'number',
|
|
613
|
+
default: 16
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: 'hnsw-ef',
|
|
617
|
+
description: 'HNSW ef parameter',
|
|
618
|
+
type: 'number',
|
|
619
|
+
default: 200
|
|
620
|
+
}
|
|
621
|
+
],
|
|
622
|
+
action: async (ctx) => {
|
|
623
|
+
let backend = ctx.flags.backend;
|
|
624
|
+
if (!backend && ctx.interactive) {
|
|
625
|
+
backend = await select({
|
|
626
|
+
message: 'Select memory backend:',
|
|
627
|
+
options: BACKENDS,
|
|
628
|
+
default: 'hybrid'
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
const config = {
|
|
632
|
+
backend: backend || 'hybrid',
|
|
633
|
+
path: ctx.flags.path || './data/memory',
|
|
634
|
+
cacheSize: ctx.flags.cacheSize || 256,
|
|
635
|
+
hnsw: {
|
|
636
|
+
m: ctx.flags.hnswM || 16,
|
|
637
|
+
ef: ctx.flags.hnswEf || 200
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
output.writeln();
|
|
641
|
+
output.printInfo('Memory Configuration');
|
|
642
|
+
output.writeln();
|
|
643
|
+
output.printTable({
|
|
644
|
+
columns: [
|
|
645
|
+
{ key: 'setting', header: 'Setting', width: 20 },
|
|
646
|
+
{ key: 'value', header: 'Value', width: 25 }
|
|
647
|
+
],
|
|
648
|
+
data: [
|
|
649
|
+
{ setting: 'Backend', value: config.backend },
|
|
650
|
+
{ setting: 'Storage Path', value: config.path },
|
|
651
|
+
{ setting: 'Cache Size', value: `${config.cacheSize} MB` },
|
|
652
|
+
{ setting: 'HNSW M', value: config.hnsw.m },
|
|
653
|
+
{ setting: 'HNSW ef', value: config.hnsw.ef }
|
|
654
|
+
]
|
|
655
|
+
});
|
|
656
|
+
output.writeln();
|
|
657
|
+
output.printSuccess('Memory configuration updated');
|
|
658
|
+
return { success: true, data: config };
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
// Cleanup command
|
|
662
|
+
const cleanupCommand = {
|
|
663
|
+
name: 'cleanup',
|
|
664
|
+
description: 'Clean up stale and expired memory entries',
|
|
665
|
+
options: [
|
|
666
|
+
{
|
|
667
|
+
name: 'dry-run',
|
|
668
|
+
short: 'd',
|
|
669
|
+
description: 'Show what would be deleted',
|
|
670
|
+
type: 'boolean',
|
|
671
|
+
default: false
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: 'older-than',
|
|
675
|
+
short: 'o',
|
|
676
|
+
description: 'Delete entries older than (e.g., "7d", "30d")',
|
|
677
|
+
type: 'string'
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: 'expired-only',
|
|
681
|
+
short: 'e',
|
|
682
|
+
description: 'Only delete expired TTL entries',
|
|
683
|
+
type: 'boolean',
|
|
684
|
+
default: false
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
name: 'low-quality',
|
|
688
|
+
short: 'l',
|
|
689
|
+
description: 'Delete low quality patterns (threshold)',
|
|
690
|
+
type: 'number'
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
name: 'namespace',
|
|
694
|
+
short: 'n',
|
|
695
|
+
description: 'Clean specific namespace only',
|
|
696
|
+
type: 'string'
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
name: 'force',
|
|
700
|
+
short: 'f',
|
|
701
|
+
description: 'Skip confirmation',
|
|
702
|
+
type: 'boolean',
|
|
703
|
+
default: false
|
|
704
|
+
}
|
|
705
|
+
],
|
|
706
|
+
examples: [
|
|
707
|
+
{ command: '@sparkleideas/claude-flow memory cleanup --dry-run', description: 'Preview cleanup' },
|
|
708
|
+
{ command: '@sparkleideas/claude-flow memory cleanup --older-than 30d', description: 'Delete entries older than 30 days' },
|
|
709
|
+
{ command: '@sparkleideas/claude-flow memory cleanup --expired-only', description: 'Clean expired entries' }
|
|
710
|
+
],
|
|
711
|
+
action: async (ctx) => {
|
|
712
|
+
const dryRun = ctx.flags.dryRun;
|
|
713
|
+
const force = ctx.flags.force;
|
|
714
|
+
if (dryRun) {
|
|
715
|
+
output.writeln(output.warning('DRY RUN - No changes will be made'));
|
|
716
|
+
}
|
|
717
|
+
output.printInfo('Analyzing memory for cleanup...');
|
|
718
|
+
try {
|
|
719
|
+
const result = await callMCPTool('memory_cleanup', {
|
|
720
|
+
dryRun,
|
|
721
|
+
olderThan: ctx.flags.olderThan,
|
|
722
|
+
expiredOnly: ctx.flags.expiredOnly,
|
|
723
|
+
lowQualityThreshold: ctx.flags.lowQuality,
|
|
724
|
+
namespace: ctx.flags.namespace,
|
|
725
|
+
});
|
|
726
|
+
if (ctx.flags.format === 'json') {
|
|
727
|
+
output.printJson(result);
|
|
728
|
+
return { success: true, data: result };
|
|
729
|
+
}
|
|
730
|
+
output.writeln();
|
|
731
|
+
output.writeln(output.bold('Cleanup Analysis'));
|
|
732
|
+
output.printTable({
|
|
733
|
+
columns: [
|
|
734
|
+
{ key: 'category', header: 'Category', width: 20 },
|
|
735
|
+
{ key: 'count', header: 'Count', width: 15, align: 'right' }
|
|
736
|
+
],
|
|
737
|
+
data: [
|
|
738
|
+
{ category: 'Expired (TTL)', count: result.candidates.expired },
|
|
739
|
+
{ category: 'Stale (unused)', count: result.candidates.stale },
|
|
740
|
+
{ category: 'Low Quality', count: result.candidates.lowQuality },
|
|
741
|
+
{ category: output.bold('Total'), count: output.bold(String(result.candidates.total)) }
|
|
742
|
+
]
|
|
743
|
+
});
|
|
744
|
+
if (!dryRun && result.candidates.total > 0 && !force) {
|
|
745
|
+
const confirmed = await confirm({
|
|
746
|
+
message: `Delete ${result.candidates.total} entries (${result.freed.formatted})?`,
|
|
747
|
+
default: false
|
|
748
|
+
});
|
|
749
|
+
if (!confirmed) {
|
|
750
|
+
output.printInfo('Cleanup cancelled');
|
|
751
|
+
return { success: true, data: result };
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (!dryRun) {
|
|
755
|
+
output.writeln();
|
|
756
|
+
output.printSuccess(`Cleaned ${result.deleted.entries} entries`);
|
|
757
|
+
output.printList([
|
|
758
|
+
`Vectors removed: ${result.deleted.vectors}`,
|
|
759
|
+
`Patterns removed: ${result.deleted.patterns}`,
|
|
760
|
+
`Space freed: ${result.freed.formatted}`,
|
|
761
|
+
`Duration: ${result.duration}ms`
|
|
762
|
+
]);
|
|
763
|
+
}
|
|
764
|
+
return { success: true, data: result };
|
|
765
|
+
}
|
|
766
|
+
catch (error) {
|
|
767
|
+
if (error instanceof MCPClientError) {
|
|
768
|
+
output.printError(`Cleanup error: ${error.message}`);
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
772
|
+
}
|
|
773
|
+
return { success: false, exitCode: 1 };
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
// Compress command
|
|
778
|
+
const compressCommand = {
|
|
779
|
+
name: 'compress',
|
|
780
|
+
description: 'Compress and optimize memory storage',
|
|
781
|
+
options: [
|
|
782
|
+
{
|
|
783
|
+
name: 'level',
|
|
784
|
+
short: 'l',
|
|
785
|
+
description: 'Compression level (fast, balanced, max)',
|
|
786
|
+
type: 'string',
|
|
787
|
+
choices: ['fast', 'balanced', 'max'],
|
|
788
|
+
default: 'balanced'
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: 'target',
|
|
792
|
+
short: 't',
|
|
793
|
+
description: 'Target (vectors, text, patterns, all)',
|
|
794
|
+
type: 'string',
|
|
795
|
+
choices: ['vectors', 'text', 'patterns', 'all'],
|
|
796
|
+
default: 'all'
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
name: 'quantize',
|
|
800
|
+
short: 'z',
|
|
801
|
+
description: 'Enable vector quantization (reduces memory 4-32x)',
|
|
802
|
+
type: 'boolean',
|
|
803
|
+
default: false
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
name: 'bits',
|
|
807
|
+
description: 'Quantization bits (4, 8, 16)',
|
|
808
|
+
type: 'number',
|
|
809
|
+
default: 8
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
name: 'rebuild-index',
|
|
813
|
+
short: 'r',
|
|
814
|
+
description: 'Rebuild HNSW index after compression',
|
|
815
|
+
type: 'boolean',
|
|
816
|
+
default: true
|
|
817
|
+
}
|
|
818
|
+
],
|
|
819
|
+
examples: [
|
|
820
|
+
{ command: '@sparkleideas/claude-flow memory compress', description: 'Balanced compression' },
|
|
821
|
+
{ command: '@sparkleideas/claude-flow memory compress --quantize --bits 4', description: '4-bit quantization (32x reduction)' },
|
|
822
|
+
{ command: '@sparkleideas/claude-flow memory compress -l max -t vectors', description: 'Max compression on vectors' }
|
|
823
|
+
],
|
|
824
|
+
action: async (ctx) => {
|
|
825
|
+
const level = ctx.flags.level || 'balanced';
|
|
826
|
+
const target = ctx.flags.target || 'all';
|
|
827
|
+
const quantize = ctx.flags.quantize;
|
|
828
|
+
const bits = ctx.flags.bits || 8;
|
|
829
|
+
const rebuildIndex = ctx.flags.rebuildIndex ?? true;
|
|
830
|
+
output.writeln();
|
|
831
|
+
output.writeln(output.bold('Memory Compression'));
|
|
832
|
+
output.writeln(output.dim(`Level: ${level}, Target: ${target}, Quantize: ${quantize ? `${bits}-bit` : 'no'}`));
|
|
833
|
+
output.writeln();
|
|
834
|
+
const spinner = output.createSpinner({ text: 'Analyzing current storage...', spinner: 'dots' });
|
|
835
|
+
spinner.start();
|
|
836
|
+
try {
|
|
837
|
+
const result = await callMCPTool('memory_compress', {
|
|
838
|
+
level,
|
|
839
|
+
target,
|
|
840
|
+
quantize,
|
|
841
|
+
bits,
|
|
842
|
+
rebuildIndex,
|
|
843
|
+
});
|
|
844
|
+
spinner.succeed('Compression complete');
|
|
845
|
+
if (ctx.flags.format === 'json') {
|
|
846
|
+
output.printJson(result);
|
|
847
|
+
return { success: true, data: result };
|
|
848
|
+
}
|
|
849
|
+
output.writeln();
|
|
850
|
+
output.writeln(output.bold('Storage Comparison'));
|
|
851
|
+
output.printTable({
|
|
852
|
+
columns: [
|
|
853
|
+
{ key: 'category', header: 'Category', width: 15 },
|
|
854
|
+
{ key: 'before', header: 'Before', width: 12, align: 'right' },
|
|
855
|
+
{ key: 'after', header: 'After', width: 12, align: 'right' },
|
|
856
|
+
{ key: 'saved', header: 'Saved', width: 12, align: 'right' }
|
|
857
|
+
],
|
|
858
|
+
data: [
|
|
859
|
+
{ category: 'Vectors', before: result.before.vectorsSize, after: result.after.vectorsSize, saved: '-' },
|
|
860
|
+
{ category: 'Text', before: result.before.textSize, after: result.after.textSize, saved: '-' },
|
|
861
|
+
{ category: 'Patterns', before: result.before.patternsSize, after: result.after.patternsSize, saved: '-' },
|
|
862
|
+
{ category: 'Index', before: result.before.indexSize, after: result.after.indexSize, saved: '-' },
|
|
863
|
+
{ category: output.bold('Total'), before: result.before.totalSize, after: result.after.totalSize, saved: output.success(result.compression.formattedSaved) }
|
|
864
|
+
]
|
|
865
|
+
});
|
|
866
|
+
output.writeln();
|
|
867
|
+
output.printBox([
|
|
868
|
+
`Compression Ratio: ${result.compression.ratio.toFixed(2)}x`,
|
|
869
|
+
`Space Saved: ${result.compression.formattedSaved}`,
|
|
870
|
+
`Quantization: ${result.compression.quantizationApplied ? `Yes (${bits}-bit)` : 'No'}`,
|
|
871
|
+
`Index Rebuilt: ${result.compression.indexRebuilt ? 'Yes' : 'No'}`,
|
|
872
|
+
`Duration: ${(result.duration / 1000).toFixed(1)}s`
|
|
873
|
+
].join('\n'), 'Results');
|
|
874
|
+
if (result.performance) {
|
|
875
|
+
output.writeln();
|
|
876
|
+
output.writeln(output.bold('Performance Impact'));
|
|
877
|
+
output.printList([
|
|
878
|
+
`Search latency: ${result.performance.searchLatencyBefore.toFixed(2)}ms → ${result.performance.searchLatencyAfter.toFixed(2)}ms`,
|
|
879
|
+
`Speedup: ${output.success(result.performance.searchSpeedup)}`
|
|
880
|
+
]);
|
|
881
|
+
}
|
|
882
|
+
return { success: true, data: result };
|
|
883
|
+
}
|
|
884
|
+
catch (error) {
|
|
885
|
+
spinner.fail('Compression failed');
|
|
886
|
+
if (error instanceof MCPClientError) {
|
|
887
|
+
output.printError(`Compression error: ${error.message}`);
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
891
|
+
}
|
|
892
|
+
return { success: false, exitCode: 1 };
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
// Export command
|
|
897
|
+
const exportCommand = {
|
|
898
|
+
name: 'export',
|
|
899
|
+
description: 'Export memory to file',
|
|
900
|
+
options: [
|
|
901
|
+
{
|
|
902
|
+
name: 'output',
|
|
903
|
+
short: 'o',
|
|
904
|
+
description: 'Output file path',
|
|
905
|
+
type: 'string',
|
|
906
|
+
required: true
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
name: 'format',
|
|
910
|
+
short: 'f',
|
|
911
|
+
description: 'Export format (json, csv, binary)',
|
|
912
|
+
type: 'string',
|
|
913
|
+
choices: ['json', 'csv', 'binary'],
|
|
914
|
+
default: 'json'
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
name: 'namespace',
|
|
918
|
+
short: 'n',
|
|
919
|
+
description: 'Export specific namespace',
|
|
920
|
+
type: 'string'
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: 'include-vectors',
|
|
924
|
+
description: 'Include vector embeddings',
|
|
925
|
+
type: 'boolean',
|
|
926
|
+
default: true
|
|
927
|
+
}
|
|
928
|
+
],
|
|
929
|
+
examples: [
|
|
930
|
+
{ command: '@sparkleideas/claude-flow memory export -o ./backup.json', description: 'Export all to JSON' },
|
|
931
|
+
{ command: '@sparkleideas/claude-flow memory export -o ./data.csv -f csv', description: 'Export to CSV' }
|
|
932
|
+
],
|
|
933
|
+
action: async (ctx) => {
|
|
934
|
+
const outputPath = ctx.flags.output;
|
|
935
|
+
const format = ctx.flags.format || 'json';
|
|
936
|
+
if (!outputPath) {
|
|
937
|
+
output.printError('Output path is required. Use --output or -o');
|
|
938
|
+
return { success: false, exitCode: 1 };
|
|
939
|
+
}
|
|
940
|
+
output.printInfo(`Exporting memory to ${outputPath}...`);
|
|
941
|
+
try {
|
|
942
|
+
const result = await callMCPTool('memory_export', {
|
|
943
|
+
outputPath,
|
|
944
|
+
format,
|
|
945
|
+
namespace: ctx.flags.namespace,
|
|
946
|
+
includeVectors: ctx.flags.includeVectors ?? true,
|
|
947
|
+
});
|
|
948
|
+
output.printSuccess(`Exported to ${result.outputPath}`);
|
|
949
|
+
output.printList([
|
|
950
|
+
`Entries: ${result.exported.entries}`,
|
|
951
|
+
`Vectors: ${result.exported.vectors}`,
|
|
952
|
+
`Patterns: ${result.exported.patterns}`,
|
|
953
|
+
`File size: ${result.fileSize}`
|
|
954
|
+
]);
|
|
955
|
+
return { success: true, data: result };
|
|
956
|
+
}
|
|
957
|
+
catch (error) {
|
|
958
|
+
if (error instanceof MCPClientError) {
|
|
959
|
+
output.printError(`Export error: ${error.message}`);
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
963
|
+
}
|
|
964
|
+
return { success: false, exitCode: 1 };
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
// Import command
|
|
969
|
+
const importCommand = {
|
|
970
|
+
name: 'import',
|
|
971
|
+
description: 'Import memory from file',
|
|
972
|
+
options: [
|
|
973
|
+
{
|
|
974
|
+
name: 'input',
|
|
975
|
+
short: 'i',
|
|
976
|
+
description: 'Input file path',
|
|
977
|
+
type: 'string',
|
|
978
|
+
required: true
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
name: 'merge',
|
|
982
|
+
short: 'm',
|
|
983
|
+
description: 'Merge with existing (skip duplicates)',
|
|
984
|
+
type: 'boolean',
|
|
985
|
+
default: true
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
name: 'namespace',
|
|
989
|
+
short: 'n',
|
|
990
|
+
description: 'Import into specific namespace',
|
|
991
|
+
type: 'string'
|
|
992
|
+
}
|
|
993
|
+
],
|
|
994
|
+
examples: [
|
|
995
|
+
{ command: '@sparkleideas/claude-flow memory import -i ./backup.json', description: 'Import from file' },
|
|
996
|
+
{ command: '@sparkleideas/claude-flow memory import -i ./data.json -n archive', description: 'Import to namespace' }
|
|
997
|
+
],
|
|
998
|
+
action: async (ctx) => {
|
|
999
|
+
const inputPath = ctx.flags.input || ctx.args[0];
|
|
1000
|
+
if (!inputPath) {
|
|
1001
|
+
output.printError('Input path is required. Use --input or -i');
|
|
1002
|
+
return { success: false, exitCode: 1 };
|
|
1003
|
+
}
|
|
1004
|
+
output.printInfo(`Importing memory from ${inputPath}...`);
|
|
1005
|
+
try {
|
|
1006
|
+
const result = await callMCPTool('memory_import', {
|
|
1007
|
+
inputPath,
|
|
1008
|
+
merge: ctx.flags.merge ?? true,
|
|
1009
|
+
namespace: ctx.flags.namespace,
|
|
1010
|
+
});
|
|
1011
|
+
output.printSuccess(`Imported from ${result.inputPath}`);
|
|
1012
|
+
output.printList([
|
|
1013
|
+
`Entries: ${result.imported.entries}`,
|
|
1014
|
+
`Vectors: ${result.imported.vectors}`,
|
|
1015
|
+
`Patterns: ${result.imported.patterns}`,
|
|
1016
|
+
`Skipped (duplicates): ${result.skipped}`,
|
|
1017
|
+
`Duration: ${result.duration}ms`
|
|
1018
|
+
]);
|
|
1019
|
+
return { success: true, data: result };
|
|
1020
|
+
}
|
|
1021
|
+
catch (error) {
|
|
1022
|
+
if (error instanceof MCPClientError) {
|
|
1023
|
+
output.printError(`Import error: ${error.message}`);
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
1027
|
+
}
|
|
1028
|
+
return { success: false, exitCode: 1 };
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
// Init subcommand - initialize memory database using sql.js
|
|
1033
|
+
const initMemoryCommand = {
|
|
1034
|
+
name: 'init',
|
|
1035
|
+
description: 'Initialize memory database with sql.js (WASM SQLite) - includes vector embeddings, pattern learning, temporal decay',
|
|
1036
|
+
options: [
|
|
1037
|
+
{
|
|
1038
|
+
name: 'backend',
|
|
1039
|
+
short: 'b',
|
|
1040
|
+
description: 'Backend type: hybrid (default), sqlite, or @sparkleideas/agentdb',
|
|
1041
|
+
type: 'string',
|
|
1042
|
+
default: 'hybrid'
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
name: 'path',
|
|
1046
|
+
short: 'p',
|
|
1047
|
+
description: 'Database path',
|
|
1048
|
+
type: 'string'
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: 'force',
|
|
1052
|
+
short: 'f',
|
|
1053
|
+
description: 'Overwrite existing database',
|
|
1054
|
+
type: 'boolean',
|
|
1055
|
+
default: false
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: 'verbose',
|
|
1059
|
+
description: 'Show detailed initialization output',
|
|
1060
|
+
type: 'boolean',
|
|
1061
|
+
default: false
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
name: 'verify',
|
|
1065
|
+
description: 'Run verification tests after initialization',
|
|
1066
|
+
type: 'boolean',
|
|
1067
|
+
default: true
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
name: 'load-embeddings',
|
|
1071
|
+
description: 'Pre-load ONNX embedding model (lazy by default)',
|
|
1072
|
+
type: 'boolean',
|
|
1073
|
+
default: false
|
|
1074
|
+
}
|
|
1075
|
+
],
|
|
1076
|
+
examples: [
|
|
1077
|
+
{ command: '@sparkleideas/claude-flow memory init', description: 'Initialize hybrid backend with all features' },
|
|
1078
|
+
{ command: '@sparkleideas/claude-flow memory init -b @sparkleideas/agentdb', description: 'Initialize AgentDB backend' },
|
|
1079
|
+
{ command: '@sparkleideas/claude-flow memory init -p ./data/memory.db --force', description: 'Reinitialize at custom path' },
|
|
1080
|
+
{ command: '@sparkleideas/claude-flow memory init --verbose --verify', description: 'Initialize with full verification' }
|
|
1081
|
+
],
|
|
1082
|
+
action: async (ctx) => {
|
|
1083
|
+
const backend = ctx.flags.backend || 'hybrid';
|
|
1084
|
+
const customPath = ctx.flags.path;
|
|
1085
|
+
const force = ctx.flags.force;
|
|
1086
|
+
const verbose = ctx.flags.verbose;
|
|
1087
|
+
const verify = ctx.flags.verify !== false; // Default true
|
|
1088
|
+
const loadEmbeddings = ctx.flags.loadEmbeddings;
|
|
1089
|
+
output.writeln();
|
|
1090
|
+
output.writeln(output.bold('Initializing Memory Database'));
|
|
1091
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
1092
|
+
const spinner = output.createSpinner({ text: 'Initializing schema...', spinner: 'dots' });
|
|
1093
|
+
spinner.start();
|
|
1094
|
+
try {
|
|
1095
|
+
// Import the memory initializer
|
|
1096
|
+
const { initializeMemoryDatabase, loadEmbeddingModel, verifyMemoryInit } = await import('../memory/memory-initializer.js');
|
|
1097
|
+
const result = await initializeMemoryDatabase({
|
|
1098
|
+
backend,
|
|
1099
|
+
dbPath: customPath,
|
|
1100
|
+
force,
|
|
1101
|
+
verbose
|
|
1102
|
+
});
|
|
1103
|
+
if (!result.success) {
|
|
1104
|
+
spinner.fail('Initialization failed');
|
|
1105
|
+
output.printError(result.error || 'Unknown error');
|
|
1106
|
+
return { success: false, exitCode: 1 };
|
|
1107
|
+
}
|
|
1108
|
+
spinner.succeed('Schema initialized');
|
|
1109
|
+
// Lazy load or pre-load embedding model
|
|
1110
|
+
if (loadEmbeddings) {
|
|
1111
|
+
const embeddingSpinner = output.createSpinner({ text: 'Loading embedding model...', spinner: 'dots' });
|
|
1112
|
+
embeddingSpinner.start();
|
|
1113
|
+
const embeddingResult = await loadEmbeddingModel({ verbose });
|
|
1114
|
+
if (embeddingResult.success) {
|
|
1115
|
+
embeddingSpinner.succeed(`Embedding model loaded: ${embeddingResult.modelName} (${embeddingResult.dimensions}-dim, ${embeddingResult.loadTime}ms)`);
|
|
1116
|
+
}
|
|
1117
|
+
else {
|
|
1118
|
+
embeddingSpinner.stop(output.warning(`Embedding model: ${embeddingResult.error || 'Using fallback'}`));
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
output.writeln();
|
|
1122
|
+
// Show features enabled with detailed capabilities
|
|
1123
|
+
const featureLines = [
|
|
1124
|
+
`Backend: ${result.backend}`,
|
|
1125
|
+
`Schema Version: ${result.schemaVersion}`,
|
|
1126
|
+
`Database Path: ${result.dbPath}`,
|
|
1127
|
+
'',
|
|
1128
|
+
output.bold('Features:'),
|
|
1129
|
+
` Vector Embeddings: ${result.features.vectorEmbeddings ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1130
|
+
` Pattern Learning: ${result.features.patternLearning ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1131
|
+
` Temporal Decay: ${result.features.temporalDecay ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1132
|
+
` HNSW Indexing: ${result.features.hnswIndexing ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`,
|
|
1133
|
+
` Migration Tracking: ${result.features.migrationTracking ? output.success('✓ Enabled') : output.dim('✗ Disabled')}`
|
|
1134
|
+
];
|
|
1135
|
+
if (verbose) {
|
|
1136
|
+
featureLines.push('', output.bold('HNSW Configuration:'), ` M (connections): 16`, ` ef (construction): 200`, ` ef (search): 100`, ` Metric: cosine`, '', output.bold('Pattern Learning:'), ` Confidence scoring: 0.0 - 1.0`, ` Temporal decay: Half-life 30 days`, ` Pattern versioning: Enabled`, ` Types: task-routing, error-recovery, optimization, coordination, prediction`);
|
|
1137
|
+
}
|
|
1138
|
+
output.printBox(featureLines.join('\n'), 'Configuration');
|
|
1139
|
+
output.writeln();
|
|
1140
|
+
// ADR-053: Show ControllerRegistry activation results
|
|
1141
|
+
if (result.controllers) {
|
|
1142
|
+
const { activated, failed, initTimeMs } = result.controllers;
|
|
1143
|
+
if (activated.length > 0 || failed.length > 0) {
|
|
1144
|
+
const controllerLines = [
|
|
1145
|
+
output.bold('AgentDB Controllers:'),
|
|
1146
|
+
` Activated: ${activated.length} Failed: ${failed.length} Init: ${Math.round(initTimeMs)}ms`,
|
|
1147
|
+
];
|
|
1148
|
+
if (verbose && activated.length > 0) {
|
|
1149
|
+
controllerLines.push('');
|
|
1150
|
+
for (const name of activated) {
|
|
1151
|
+
controllerLines.push(` ${output.success('✓')} ${name}`);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
if (failed.length > 0 && verbose) {
|
|
1155
|
+
controllerLines.push('');
|
|
1156
|
+
for (const name of failed) {
|
|
1157
|
+
controllerLines.push(` ${output.dim('✗')} ${name}`);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
output.printBox(controllerLines.join('\n'), 'Controller Registry (ADR-053)');
|
|
1161
|
+
output.writeln();
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
// Show tables created
|
|
1165
|
+
if (verbose && result.tablesCreated.length > 0) {
|
|
1166
|
+
output.writeln(output.bold('Tables Created:'));
|
|
1167
|
+
output.printTable({
|
|
1168
|
+
columns: [
|
|
1169
|
+
{ key: 'table', header: 'Table', width: 22 },
|
|
1170
|
+
{ key: 'purpose', header: 'Purpose', width: 38 }
|
|
1171
|
+
],
|
|
1172
|
+
data: [
|
|
1173
|
+
{ table: 'memory_entries', purpose: 'Core memory storage with embeddings' },
|
|
1174
|
+
{ table: 'patterns', purpose: 'Learned patterns with confidence scores' },
|
|
1175
|
+
{ table: 'pattern_history', purpose: 'Pattern versioning and evolution' },
|
|
1176
|
+
{ table: 'trajectories', purpose: 'SONA learning trajectories' },
|
|
1177
|
+
{ table: 'trajectory_steps', purpose: 'Individual trajectory steps' },
|
|
1178
|
+
{ table: 'migration_state', purpose: 'Migration progress tracking' },
|
|
1179
|
+
{ table: 'sessions', purpose: 'Context persistence' },
|
|
1180
|
+
{ table: 'vector_indexes', purpose: 'HNSW index configuration' },
|
|
1181
|
+
{ table: 'metadata', purpose: 'System metadata' }
|
|
1182
|
+
]
|
|
1183
|
+
});
|
|
1184
|
+
output.writeln();
|
|
1185
|
+
output.writeln(output.bold('Indexes Created:'));
|
|
1186
|
+
output.printList(result.indexesCreated.slice(0, 8).map(idx => output.dim(idx)));
|
|
1187
|
+
if (result.indexesCreated.length > 8) {
|
|
1188
|
+
output.writeln(output.dim(` ... and ${result.indexesCreated.length - 8} more`));
|
|
1189
|
+
}
|
|
1190
|
+
output.writeln();
|
|
1191
|
+
}
|
|
1192
|
+
// Run verification if enabled
|
|
1193
|
+
if (verify) {
|
|
1194
|
+
const verifySpinner = output.createSpinner({ text: 'Verifying initialization...', spinner: 'dots' });
|
|
1195
|
+
verifySpinner.start();
|
|
1196
|
+
const verification = await verifyMemoryInit(result.dbPath, { verbose });
|
|
1197
|
+
if (verification.success) {
|
|
1198
|
+
verifySpinner.succeed(`Verification passed (${verification.summary.passed}/${verification.summary.total} tests)`);
|
|
1199
|
+
}
|
|
1200
|
+
else {
|
|
1201
|
+
verifySpinner.fail(`Verification failed (${verification.summary.failed}/${verification.summary.total} tests failed)`);
|
|
1202
|
+
}
|
|
1203
|
+
if (verbose || !verification.success) {
|
|
1204
|
+
output.writeln();
|
|
1205
|
+
output.writeln(output.bold('Verification Results:'));
|
|
1206
|
+
output.printTable({
|
|
1207
|
+
columns: [
|
|
1208
|
+
{ key: 'status', header: '', width: 3 },
|
|
1209
|
+
{ key: 'name', header: 'Test', width: 22 },
|
|
1210
|
+
{ key: 'details', header: 'Details', width: 30 },
|
|
1211
|
+
{ key: 'duration', header: 'Time', width: 8, align: 'right' }
|
|
1212
|
+
],
|
|
1213
|
+
data: verification.tests.map(t => ({
|
|
1214
|
+
status: t.passed ? output.success('✓') : output.error('✗'),
|
|
1215
|
+
name: t.name,
|
|
1216
|
+
details: t.details || '',
|
|
1217
|
+
duration: t.duration ? `${t.duration}ms` : '-'
|
|
1218
|
+
}))
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
output.writeln();
|
|
1222
|
+
}
|
|
1223
|
+
// Show next steps
|
|
1224
|
+
output.writeln(output.bold('Next Steps:'));
|
|
1225
|
+
output.printList([
|
|
1226
|
+
`Store data: ${output.highlight('@sparkleideas/claude-flow memory store -k "key" --value "data"')}`,
|
|
1227
|
+
`Search: ${output.highlight('@sparkleideas/claude-flow memory search -q "query"')}`,
|
|
1228
|
+
`Train patterns: ${output.highlight('@sparkleideas/claude-flow neural train -p coordination')}`,
|
|
1229
|
+
`View stats: ${output.highlight('@sparkleideas/claude-flow memory stats')}`
|
|
1230
|
+
]);
|
|
1231
|
+
// Also sync to .claude directory
|
|
1232
|
+
const fs = await import('fs');
|
|
1233
|
+
const path = await import('path');
|
|
1234
|
+
const claudeDir = path.join(process.cwd(), '.claude');
|
|
1235
|
+
const claudeDbPath = path.join(claudeDir, 'memory.db');
|
|
1236
|
+
if (!fs.existsSync(claudeDir)) {
|
|
1237
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
1238
|
+
}
|
|
1239
|
+
if (fs.existsSync(result.dbPath) && (!fs.existsSync(claudeDbPath) || force)) {
|
|
1240
|
+
fs.copyFileSync(result.dbPath, claudeDbPath);
|
|
1241
|
+
output.writeln();
|
|
1242
|
+
output.writeln(output.dim(`Synced to: ${claudeDbPath}`));
|
|
1243
|
+
}
|
|
1244
|
+
return {
|
|
1245
|
+
success: true,
|
|
1246
|
+
data: result
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
catch (error) {
|
|
1250
|
+
spinner.fail('Initialization failed');
|
|
1251
|
+
output.printError(`Failed to initialize memory: ${error instanceof Error ? error.message : String(error)}`);
|
|
1252
|
+
return { success: false, exitCode: 1 };
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
// Main memory command
|
|
1257
|
+
export const memoryCommand = {
|
|
1258
|
+
name: 'memory',
|
|
1259
|
+
description: 'Memory management commands',
|
|
1260
|
+
subcommands: [initMemoryCommand, storeCommand, retrieveCommand, searchCommand, listCommand, deleteCommand, statsCommand, configureCommand, cleanupCommand, compressCommand, exportCommand, importCommand],
|
|
1261
|
+
options: [],
|
|
1262
|
+
examples: [
|
|
1263
|
+
{ command: '@sparkleideas/claude-flow memory store -k "key" -v "value"', description: 'Store data' },
|
|
1264
|
+
{ command: '@sparkleideas/claude-flow memory search -q "auth patterns"', description: 'Search memory' },
|
|
1265
|
+
{ command: '@sparkleideas/claude-flow memory stats', description: 'Show statistics' }
|
|
1266
|
+
],
|
|
1267
|
+
action: async (ctx) => {
|
|
1268
|
+
output.writeln();
|
|
1269
|
+
output.writeln(output.bold('Memory Management Commands'));
|
|
1270
|
+
output.writeln();
|
|
1271
|
+
output.writeln('Usage: @sparkleideas/claude-flow memory <subcommand> [options]');
|
|
1272
|
+
output.writeln();
|
|
1273
|
+
output.writeln('Subcommands:');
|
|
1274
|
+
output.printList([
|
|
1275
|
+
`${output.highlight('init')} - Initialize memory database (sql.js)`,
|
|
1276
|
+
`${output.highlight('store')} - Store data in memory`,
|
|
1277
|
+
`${output.highlight('retrieve')} - Retrieve data from memory`,
|
|
1278
|
+
`${output.highlight('search')} - Semantic/vector search`,
|
|
1279
|
+
`${output.highlight('list')} - List memory entries`,
|
|
1280
|
+
`${output.highlight('delete')} - Delete memory entry`,
|
|
1281
|
+
`${output.highlight('stats')} - Show statistics`,
|
|
1282
|
+
`${output.highlight('configure')} - Configure backend`,
|
|
1283
|
+
`${output.highlight('cleanup')} - Clean expired entries`,
|
|
1284
|
+
`${output.highlight('compress')} - Compress database`,
|
|
1285
|
+
`${output.highlight('export')} - Export memory to file`,
|
|
1286
|
+
`${output.highlight('import')} - Import from file`
|
|
1287
|
+
]);
|
|
1288
|
+
return { success: true };
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
export default memoryCommand;
|
|
1292
|
+
//# sourceMappingURL=memory.js.map
|