@stackmemoryai/stackmemory 0.5.58 → 0.5.59
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/cli/commands/search.js +20 -3
- package/dist/cli/commands/search.js.map +2 -2
- package/dist/core/database/sqlite-adapter.js +13 -3
- package/dist/core/database/sqlite-adapter.js.map +2 -2
- package/dist/core/errors/error-utils.js +208 -0
- package/dist/core/errors/error-utils.js.map +7 -0
- package/dist/core/errors/index.js +13 -4
- package/dist/core/errors/index.js.map +2 -2
- package/dist/core/merge/unified-merge-resolver.js +303 -0
- package/dist/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/core/monitoring/logger.js +61 -9
- package/dist/core/monitoring/logger.js.map +2 -2
- package/dist/core/security/index.js +35 -0
- package/dist/core/security/index.js.map +7 -0
- package/dist/core/security/input-sanitizer.js +321 -0
- package/dist/core/security/input-sanitizer.js.map +7 -0
- package/dist/integrations/linear/client.js +5 -1
- package/dist/integrations/linear/client.js.map +2 -2
- package/dist/integrations/mcp/remote-server.js +27 -36
- package/dist/integrations/mcp/remote-server.js.map +2 -2
- package/dist/integrations/mcp/server.js +44 -29
- package/dist/integrations/mcp/server.js.map +3 -3
- package/dist/scripts/benchmark-performance.js +48 -0
- package/dist/scripts/benchmark-performance.js.map +7 -0
- package/dist/scripts/check-redis.js +42 -0
- package/dist/scripts/check-redis.js.map +7 -0
- package/dist/scripts/initialize.js +116 -0
- package/dist/scripts/initialize.js.map +7 -0
- package/dist/scripts/list-linear-tasks.js +124 -0
- package/dist/scripts/list-linear-tasks.js.map +7 -0
- package/dist/scripts/measure-handoff-impact.js +340 -0
- package/dist/scripts/measure-handoff-impact.js.map +7 -0
- package/dist/scripts/query-chromadb.js +160 -0
- package/dist/scripts/query-chromadb.js.map +7 -0
- package/dist/scripts/show-linear-summary.js +119 -0
- package/dist/scripts/show-linear-summary.js.map +7 -0
- package/dist/scripts/simple-swarm-demo.js +90 -0
- package/dist/scripts/simple-swarm-demo.js.map +7 -0
- package/dist/scripts/status.js +155 -0
- package/dist/scripts/status.js.map +7 -0
- package/dist/scripts/test-chromadb-sync.js +192 -0
- package/dist/scripts/test-chromadb-sync.js.map +7 -0
- package/dist/scripts/test-ralph-iteration-fix.js +86 -0
- package/dist/scripts/test-ralph-iteration-fix.js.map +7 -0
- package/dist/scripts/test-ralph-iterations.js +121 -0
- package/dist/scripts/test-ralph-iterations.js.map +7 -0
- package/dist/scripts/test-redis-storage.js +389 -0
- package/dist/scripts/test-redis-storage.js.map +7 -0
- package/dist/scripts/test-simple-ralph-state-sync.js +115 -0
- package/dist/scripts/test-simple-ralph-state-sync.js.map +7 -0
- package/dist/scripts/test-swarm-fixes.js +125 -0
- package/dist/scripts/test-swarm-fixes.js.map +7 -0
- package/dist/scripts/test-swarm-tui.js +23 -0
- package/dist/scripts/test-swarm-tui.js.map +7 -0
- package/dist/scripts/test-tui-shortcuts.js +52 -0
- package/dist/scripts/test-tui-shortcuts.js.map +7 -0
- package/dist/scripts/validate-tui-shortcuts.js +60 -0
- package/dist/scripts/validate-tui-shortcuts.js.map +7 -0
- package/dist/src/agents/core/agent-task-manager.js +527 -0
- package/dist/src/agents/core/agent-task-manager.js.map +7 -0
- package/dist/src/agents/verifiers/base-verifier.js +133 -0
- package/dist/src/agents/verifiers/base-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/formatter-verifier.js +130 -0
- package/dist/src/agents/verifiers/formatter-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/llm-judge.js +252 -0
- package/dist/src/agents/verifiers/llm-judge.js.map +7 -0
- package/dist/src/cli/auto-detect.js +321 -0
- package/dist/src/cli/auto-detect.js.map +7 -0
- package/dist/src/cli/claude-sm-danger.js +21 -0
- package/dist/src/cli/claude-sm-danger.js.map +7 -0
- package/dist/src/cli/claude-sm.js +1156 -0
- package/dist/src/cli/claude-sm.js.map +7 -0
- package/dist/src/cli/codex-sm-danger.js +21 -0
- package/dist/src/cli/codex-sm-danger.js.map +7 -0
- package/dist/src/cli/codex-sm.js +349 -0
- package/dist/src/cli/codex-sm.js.map +7 -0
- package/dist/src/cli/commands/api.js +232 -0
- package/dist/src/cli/commands/api.js.map +7 -0
- package/dist/src/cli/commands/auto-background.js +180 -0
- package/dist/src/cli/commands/auto-background.js.map +7 -0
- package/dist/src/cli/commands/cleanup-processes.js +68 -0
- package/dist/src/cli/commands/cleanup-processes.js.map +7 -0
- package/dist/src/cli/commands/clear.js +202 -0
- package/dist/src/cli/commands/clear.js.map +7 -0
- package/dist/src/cli/commands/config.js +445 -0
- package/dist/src/cli/commands/config.js.map +7 -0
- package/dist/src/cli/commands/context-rehydrate.js +751 -0
- package/dist/src/cli/commands/context-rehydrate.js.map +7 -0
- package/dist/src/cli/commands/context.js +343 -0
- package/dist/src/cli/commands/context.js.map +7 -0
- package/dist/src/cli/commands/daemon.js +392 -0
- package/dist/src/cli/commands/daemon.js.map +7 -0
- package/dist/src/cli/commands/dashboard.js +210 -0
- package/dist/src/cli/commands/dashboard.js.map +7 -0
- package/dist/src/cli/commands/db.js +147 -0
- package/dist/src/cli/commands/db.js.map +7 -0
- package/dist/src/cli/commands/decision.js +266 -0
- package/dist/src/cli/commands/decision.js.map +7 -0
- package/dist/src/cli/commands/discovery.js +279 -0
- package/dist/src/cli/commands/discovery.js.map +7 -0
- package/dist/src/cli/commands/handoff.js +624 -0
- package/dist/src/cli/commands/handoff.js.map +7 -0
- package/dist/src/cli/commands/hooks.js +298 -0
- package/dist/src/cli/commands/hooks.js.map +7 -0
- package/dist/src/cli/commands/linear.js +529 -0
- package/dist/src/cli/commands/linear.js.map +7 -0
- package/dist/src/cli/commands/log.js +169 -0
- package/dist/src/cli/commands/log.js.map +7 -0
- package/dist/src/cli/commands/login.js +172 -0
- package/dist/src/cli/commands/login.js.map +7 -0
- package/dist/src/cli/commands/migrate.js +240 -0
- package/dist/src/cli/commands/migrate.js.map +7 -0
- package/dist/src/cli/commands/model.js +533 -0
- package/dist/src/cli/commands/model.js.map +7 -0
- package/dist/src/cli/commands/onboard.js +536 -0
- package/dist/src/cli/commands/onboard.js.map +7 -0
- package/dist/src/cli/commands/projects.js +199 -0
- package/dist/src/cli/commands/projects.js.map +7 -0
- package/dist/src/cli/commands/ralph.js +909 -0
- package/dist/src/cli/commands/ralph.js.map +7 -0
- package/dist/src/cli/commands/retrieval.js +248 -0
- package/dist/src/cli/commands/retrieval.js.map +7 -0
- package/dist/src/cli/commands/search.js +173 -0
- package/dist/src/cli/commands/search.js.map +7 -0
- package/dist/src/cli/commands/service.js +749 -0
- package/dist/src/cli/commands/service.js.map +7 -0
- package/dist/src/cli/commands/session.js +200 -0
- package/dist/src/cli/commands/session.js.map +7 -0
- package/dist/src/cli/commands/settings.js +306 -0
- package/dist/src/cli/commands/settings.js.map +7 -0
- package/dist/src/cli/commands/setup.js +701 -0
- package/dist/src/cli/commands/setup.js.map +7 -0
- package/dist/src/cli/commands/shell.js +249 -0
- package/dist/src/cli/commands/shell.js.map +7 -0
- package/dist/src/cli/commands/signup.js +50 -0
- package/dist/src/cli/commands/signup.js.map +7 -0
- package/dist/src/cli/commands/skills.js +470 -0
- package/dist/src/cli/commands/skills.js.map +7 -0
- package/dist/src/cli/commands/sms-notify.js +795 -0
- package/dist/src/cli/commands/sms-notify.js.map +7 -0
- package/dist/src/cli/commands/storage-tier.js +183 -0
- package/dist/src/cli/commands/storage-tier.js.map +7 -0
- package/dist/src/cli/commands/sweep.js +249 -0
- package/dist/src/cli/commands/sweep.js.map +7 -0
- package/dist/src/cli/commands/tasks.js +213 -0
- package/dist/src/cli/commands/tasks.js.map +7 -0
- package/dist/src/cli/commands/worktree.js +319 -0
- package/dist/src/cli/commands/worktree.js.map +7 -0
- package/dist/src/cli/index.js +594 -0
- package/dist/src/cli/index.js.map +7 -0
- package/dist/src/cli/opencode-sm.js +448 -0
- package/dist/src/cli/opencode-sm.js.map +7 -0
- package/dist/src/cli/utils/viewer.js +96 -0
- package/dist/src/cli/utils/viewer.js.map +7 -0
- package/dist/src/core/config/config-manager.js +398 -0
- package/dist/src/core/config/config-manager.js.map +7 -0
- package/dist/src/core/config/feature-flags.js +76 -0
- package/dist/src/core/config/feature-flags.js.map +7 -0
- package/dist/src/core/config/storage-config.js +115 -0
- package/dist/src/core/config/storage-config.js.map +7 -0
- package/dist/src/core/config/types.js +144 -0
- package/dist/src/core/config/types.js.map +7 -0
- package/dist/src/core/context/auto-context.js +80 -0
- package/dist/src/core/context/auto-context.js.map +7 -0
- package/dist/src/core/context/dual-stack-manager.js +870 -0
- package/dist/src/core/context/dual-stack-manager.js.map +7 -0
- package/dist/src/core/context/enhanced-rehydration.js +994 -0
- package/dist/src/core/context/enhanced-rehydration.js.map +7 -0
- package/dist/src/core/context/frame-database.js +479 -0
- package/dist/src/core/context/frame-database.js.map +7 -0
- package/dist/src/core/context/frame-digest.js +250 -0
- package/dist/src/core/context/frame-digest.js.map +7 -0
- package/dist/src/core/context/frame-handoff-manager.js +778 -0
- package/dist/src/core/context/frame-handoff-manager.js.map +7 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js +119 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js.map +7 -0
- package/dist/src/core/context/frame-recovery.js +302 -0
- package/dist/src/core/context/frame-recovery.js.map +7 -0
- package/dist/src/core/context/frame-stack.js +314 -0
- package/dist/src/core/context/frame-stack.js.map +7 -0
- package/dist/src/core/context/frame-types.js +5 -0
- package/dist/src/core/context/frame-types.js.map +7 -0
- package/dist/src/core/context/index.js +25 -0
- package/dist/src/core/context/index.js.map +7 -0
- package/dist/src/core/context/permission-manager.js +185 -0
- package/dist/src/core/context/permission-manager.js.map +7 -0
- package/dist/src/core/context/recursive-context-manager.js +592 -0
- package/dist/src/core/context/recursive-context-manager.js.map +7 -0
- package/dist/src/core/context/refactored-frame-manager.js +754 -0
- package/dist/src/core/context/refactored-frame-manager.js.map +7 -0
- package/dist/src/core/context/shared-context-layer.js +621 -0
- package/dist/src/core/context/shared-context-layer.js.map +7 -0
- package/dist/src/core/context/stack-merge-resolver.js +749 -0
- package/dist/src/core/context/stack-merge-resolver.js.map +7 -0
- package/dist/src/core/context/validation.js +130 -0
- package/dist/src/core/context/validation.js.map +7 -0
- package/dist/src/core/database/batch-operations.js +384 -0
- package/dist/src/core/database/batch-operations.js.map +7 -0
- package/dist/src/core/database/connection-pool.js +330 -0
- package/dist/src/core/database/connection-pool.js.map +7 -0
- package/dist/src/core/database/database-adapter.js +60 -0
- package/dist/src/core/database/database-adapter.js.map +7 -0
- package/dist/src/core/database/migration-manager.js +614 -0
- package/dist/src/core/database/migration-manager.js.map +7 -0
- package/dist/src/core/database/query-cache.js +298 -0
- package/dist/src/core/database/query-cache.js.map +7 -0
- package/dist/src/core/database/query-router.js +430 -0
- package/dist/src/core/database/query-router.js.map +7 -0
- package/dist/src/core/database/sqlite-adapter.js +738 -0
- package/dist/src/core/database/sqlite-adapter.js.map +7 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js +277 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js.map +7 -0
- package/dist/src/core/digest/frame-digest-integration.js +176 -0
- package/dist/src/core/digest/frame-digest-integration.js.map +7 -0
- package/dist/src/core/digest/hybrid-digest-generator.js +553 -0
- package/dist/src/core/digest/hybrid-digest-generator.js.map +7 -0
- package/dist/src/core/digest/index.js +9 -0
- package/dist/src/core/digest/index.js.map +7 -0
- package/dist/src/core/digest/types.js +25 -0
- package/dist/src/core/digest/types.js.map +7 -0
- package/dist/src/core/errors/error-utils.js +208 -0
- package/dist/src/core/errors/error-utils.js.map +7 -0
- package/dist/src/core/errors/index.js +521 -0
- package/dist/src/core/errors/index.js.map +7 -0
- package/dist/src/core/errors/recovery.js +269 -0
- package/dist/src/core/errors/recovery.js.map +7 -0
- package/dist/src/core/execution/parallel-executor.js +258 -0
- package/dist/src/core/execution/parallel-executor.js.map +7 -0
- package/dist/src/core/frame/workflow-templates.js +319 -0
- package/dist/src/core/frame/workflow-templates.js.map +7 -0
- package/dist/src/core/merge/conflict-detector.js +431 -0
- package/dist/src/core/merge/conflict-detector.js.map +7 -0
- package/dist/src/core/merge/index.js +9 -0
- package/dist/src/core/merge/index.js.map +7 -0
- package/dist/src/core/merge/resolution-engine.js +558 -0
- package/dist/src/core/merge/resolution-engine.js.map +7 -0
- package/dist/src/core/merge/stack-diff.js +532 -0
- package/dist/src/core/merge/stack-diff.js.map +7 -0
- package/dist/src/core/merge/types.js +5 -0
- package/dist/src/core/merge/types.js.map +7 -0
- package/dist/src/core/merge/unified-merge-resolver.js +303 -0
- package/dist/src/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/src/core/models/fallback-monitor.js +232 -0
- package/dist/src/core/models/fallback-monitor.js.map +7 -0
- package/dist/src/core/models/model-router.js +340 -0
- package/dist/src/core/models/model-router.js.map +7 -0
- package/dist/src/core/monitoring/error-handler.js +49 -0
- package/dist/src/core/monitoring/error-handler.js.map +7 -0
- package/dist/src/core/monitoring/logger.js +202 -0
- package/dist/src/core/monitoring/logger.js.map +7 -0
- package/dist/src/core/monitoring/metrics.js +172 -0
- package/dist/src/core/monitoring/metrics.js.map +7 -0
- package/dist/src/core/monitoring/progress-tracker.js +189 -0
- package/dist/src/core/monitoring/progress-tracker.js.map +7 -0
- package/dist/src/core/monitoring/session-monitor.js +300 -0
- package/dist/src/core/monitoring/session-monitor.js.map +7 -0
- package/dist/src/core/performance/context-cache.js +273 -0
- package/dist/src/core/performance/context-cache.js.map +7 -0
- package/dist/src/core/performance/index.js +11 -0
- package/dist/src/core/performance/index.js.map +7 -0
- package/dist/src/core/performance/lazy-context-loader.js +327 -0
- package/dist/src/core/performance/lazy-context-loader.js.map +7 -0
- package/dist/src/core/performance/monitor.js +221 -0
- package/dist/src/core/performance/monitor.js.map +7 -0
- package/dist/src/core/performance/optimized-frame-context.js +345 -0
- package/dist/src/core/performance/optimized-frame-context.js.map +7 -0
- package/dist/src/core/performance/performance-benchmark.js +277 -0
- package/dist/src/core/performance/performance-benchmark.js.map +7 -0
- package/dist/src/core/performance/performance-profiler.js +370 -0
- package/dist/src/core/performance/performance-profiler.js.map +7 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js +195 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js.map +7 -0
- package/dist/src/core/persistence/postgres-adapter.js +349 -0
- package/dist/src/core/persistence/postgres-adapter.js.map +7 -0
- package/dist/src/core/projects/project-isolation.js +201 -0
- package/dist/src/core/projects/project-isolation.js.map +7 -0
- package/dist/src/core/projects/project-manager.js +697 -0
- package/dist/src/core/projects/project-manager.js.map +7 -0
- package/dist/src/core/query/query-parser.js +370 -0
- package/dist/src/core/query/query-parser.js.map +7 -0
- package/dist/src/core/query/query-templates.js +321 -0
- package/dist/src/core/query/query-templates.js.map +7 -0
- package/dist/src/core/retrieval/context-retriever.js +479 -0
- package/dist/src/core/retrieval/context-retriever.js.map +7 -0
- package/dist/src/core/retrieval/index.js +8 -0
- package/dist/src/core/retrieval/index.js.map +7 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js +613 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js.map +7 -0
- package/dist/src/core/retrieval/llm-provider.js +151 -0
- package/dist/src/core/retrieval/llm-provider.js.map +7 -0
- package/dist/src/core/retrieval/retrieval-audit.js +236 -0
- package/dist/src/core/retrieval/retrieval-audit.js.map +7 -0
- package/dist/src/core/retrieval/summary-generator.js +589 -0
- package/dist/src/core/retrieval/summary-generator.js.map +7 -0
- package/dist/src/core/retrieval/types.js +21 -0
- package/dist/src/core/retrieval/types.js.map +7 -0
- package/dist/src/core/security/index.js +35 -0
- package/dist/src/core/security/index.js.map +7 -0
- package/dist/src/core/security/input-sanitizer.js +321 -0
- package/dist/src/core/security/input-sanitizer.js.map +7 -0
- package/dist/src/core/session/clear-survival.js +465 -0
- package/dist/src/core/session/clear-survival.js.map +7 -0
- package/dist/src/core/session/enhanced-handoff.js +792 -0
- package/dist/src/core/session/enhanced-handoff.js.map +7 -0
- package/dist/src/core/session/handoff-generator.js +343 -0
- package/dist/src/core/session/handoff-generator.js.map +7 -0
- package/dist/src/core/session/index.js +15 -0
- package/dist/src/core/session/index.js.map +7 -0
- package/dist/src/core/session/session-manager.js +347 -0
- package/dist/src/core/session/session-manager.js.map +7 -0
- package/dist/src/core/skills/index.js +7 -0
- package/dist/src/core/skills/index.js.map +7 -0
- package/dist/src/core/skills/skill-storage.js +764 -0
- package/dist/src/core/skills/skill-storage.js.map +7 -0
- package/dist/src/core/skills/types.js +193 -0
- package/dist/src/core/skills/types.js.map +7 -0
- package/dist/src/core/storage/chromadb-adapter.js +354 -0
- package/dist/src/core/storage/chromadb-adapter.js.map +7 -0
- package/dist/src/core/storage/infinite-storage.js +510 -0
- package/dist/src/core/storage/infinite-storage.js.map +7 -0
- package/dist/src/core/storage/remote-storage.js +489 -0
- package/dist/src/core/storage/remote-storage.js.map +7 -0
- package/dist/src/core/storage/two-tier-storage.js +766 -0
- package/dist/src/core/storage/two-tier-storage.js.map +7 -0
- package/dist/src/core/trace/cli-trace-wrapper.js +132 -0
- package/dist/src/core/trace/cli-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/db-trace-wrapper.js +247 -0
- package/dist/src/core/trace/db-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/debug-trace.js +417 -0
- package/dist/src/core/trace/debug-trace.js.map +7 -0
- package/dist/src/core/trace/index.js +109 -0
- package/dist/src/core/trace/index.js.map +7 -0
- package/dist/src/core/trace/linear-api-wrapper.js +178 -0
- package/dist/src/core/trace/linear-api-wrapper.js.map +7 -0
- package/dist/src/core/trace/trace-detector.js +528 -0
- package/dist/src/core/trace/trace-detector.js.map +7 -0
- package/dist/src/core/trace/trace-store.js +345 -0
- package/dist/src/core/trace/trace-store.js.map +7 -0
- package/dist/src/core/trace/types.js +77 -0
- package/dist/src/core/trace/types.js.map +7 -0
- package/dist/src/core/types.js +5 -0
- package/dist/src/core/types.js.map +7 -0
- package/dist/src/core/utils/async-mutex.js +114 -0
- package/dist/src/core/utils/async-mutex.js.map +7 -0
- package/dist/src/core/utils/compression.js +83 -0
- package/dist/src/core/utils/compression.js.map +7 -0
- package/dist/src/core/utils/update-checker.js +218 -0
- package/dist/src/core/utils/update-checker.js.map +7 -0
- package/dist/src/core/worktree/worktree-manager.js +465 -0
- package/dist/src/core/worktree/worktree-manager.js.map +7 -0
- package/dist/src/daemon/daemon-config.js +149 -0
- package/dist/src/daemon/daemon-config.js.map +7 -0
- package/dist/src/daemon/services/context-service.js +122 -0
- package/dist/src/daemon/services/context-service.js.map +7 -0
- package/dist/src/daemon/services/linear-service.js +136 -0
- package/dist/src/daemon/services/linear-service.js.map +7 -0
- package/dist/src/daemon/session-daemon.js +312 -0
- package/dist/src/daemon/session-daemon.js.map +7 -0
- package/dist/src/daemon/unified-daemon.js +276 -0
- package/dist/src/daemon/unified-daemon.js.map +7 -0
- package/dist/src/features/analytics/api/analytics-api.js +287 -0
- package/dist/src/features/analytics/api/analytics-api.js.map +7 -0
- package/dist/src/features/analytics/core/analytics-service.js +282 -0
- package/dist/src/features/analytics/core/analytics-service.js.map +7 -0
- package/dist/src/features/analytics/index.js +18 -0
- package/dist/src/features/analytics/index.js.map +7 -0
- package/dist/src/features/analytics/queries/metrics-queries.js +277 -0
- package/dist/src/features/analytics/queries/metrics-queries.js.map +7 -0
- package/dist/src/features/analytics/types/metrics.js +5 -0
- package/dist/src/features/analytics/types/metrics.js.map +7 -0
- package/dist/src/features/browser/browser-mcp.js +492 -0
- package/dist/src/features/browser/browser-mcp.js.map +7 -0
- package/dist/src/features/sweep/index.js +20 -0
- package/dist/src/features/sweep/index.js.map +7 -0
- package/dist/src/features/sweep/prediction-client.js +155 -0
- package/dist/src/features/sweep/prediction-client.js.map +7 -0
- package/dist/src/features/sweep/prompt-builder.js +85 -0
- package/dist/src/features/sweep/prompt-builder.js.map +7 -0
- package/dist/src/features/sweep/pty-wrapper.js +171 -0
- package/dist/src/features/sweep/pty-wrapper.js.map +7 -0
- package/dist/src/features/sweep/state-watcher.js +87 -0
- package/dist/src/features/sweep/state-watcher.js.map +7 -0
- package/dist/src/features/sweep/status-bar.js +88 -0
- package/dist/src/features/sweep/status-bar.js.map +7 -0
- package/dist/src/features/sweep/sweep-server-manager.js +226 -0
- package/dist/src/features/sweep/sweep-server-manager.js.map +7 -0
- package/dist/src/features/sweep/tab-interceptor.js +38 -0
- package/dist/src/features/sweep/tab-interceptor.js.map +7 -0
- package/dist/src/features/sweep/types.js +18 -0
- package/dist/src/features/sweep/types.js.map +7 -0
- package/dist/src/features/tasks/linear-task-manager.js +487 -0
- package/dist/src/features/tasks/linear-task-manager.js.map +7 -0
- package/dist/src/features/tasks/task-aware-context.js +410 -0
- package/dist/src/features/tasks/task-aware-context.js.map +7 -0
- package/dist/src/features/tui/simple-monitor.js +116 -0
- package/dist/src/features/tui/simple-monitor.js.map +7 -0
- package/dist/src/features/tui/swarm-monitor.js +648 -0
- package/dist/src/features/tui/swarm-monitor.js.map +7 -0
- package/dist/src/features/web/client/stores/task-store.js +26 -0
- package/dist/src/features/web/client/stores/task-store.js.map +7 -0
- package/dist/src/features/web/server/index.js +194 -0
- package/dist/src/features/web/server/index.js.map +7 -0
- package/dist/src/hooks/auto-background.js +151 -0
- package/dist/src/hooks/auto-background.js.map +7 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js +197 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js.map +7 -0
- package/dist/src/hooks/config.js +150 -0
- package/dist/src/hooks/config.js.map +7 -0
- package/dist/src/hooks/daemon.js +364 -0
- package/dist/src/hooks/daemon.js.map +7 -0
- package/dist/src/hooks/events.js +58 -0
- package/dist/src/hooks/events.js.map +7 -0
- package/dist/src/hooks/index.js +12 -0
- package/dist/src/hooks/index.js.map +7 -0
- package/dist/src/hooks/linear-task-picker.js +186 -0
- package/dist/src/hooks/linear-task-picker.js.map +7 -0
- package/dist/src/hooks/schemas.js +197 -0
- package/dist/src/hooks/schemas.js.map +7 -0
- package/dist/src/hooks/secure-fs.js +49 -0
- package/dist/src/hooks/secure-fs.js.map +7 -0
- package/dist/src/hooks/security-logger.js +155 -0
- package/dist/src/hooks/security-logger.js.map +7 -0
- package/dist/src/hooks/session-summary.js +222 -0
- package/dist/src/hooks/session-summary.js.map +7 -0
- package/dist/src/hooks/sms-action-runner.js +371 -0
- package/dist/src/hooks/sms-action-runner.js.map +7 -0
- package/dist/src/hooks/sms-notify.js +506 -0
- package/dist/src/hooks/sms-notify.js.map +7 -0
- package/dist/src/hooks/sms-watcher.js +93 -0
- package/dist/src/hooks/sms-watcher.js.map +7 -0
- package/dist/src/hooks/sms-webhook.js +555 -0
- package/dist/src/hooks/sms-webhook.js.map +7 -0
- package/dist/src/hooks/whatsapp-commands.js +479 -0
- package/dist/src/hooks/whatsapp-commands.js.map +7 -0
- package/dist/src/hooks/whatsapp-scheduler.js +317 -0
- package/dist/src/hooks/whatsapp-scheduler.js.map +7 -0
- package/dist/src/hooks/whatsapp-sync.js +409 -0
- package/dist/src/hooks/whatsapp-sync.js.map +7 -0
- package/dist/src/index.js +25 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/integrations/anthropic/client.js +263 -0
- package/dist/src/integrations/anthropic/client.js.map +7 -0
- package/dist/src/integrations/claude-code/agent-bridge.js +768 -0
- package/dist/src/integrations/claude-code/agent-bridge.js.map +7 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js +459 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js +254 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js +545 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js +20 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client.js +511 -0
- package/dist/src/integrations/claude-code/subagent-client.js.map +7 -0
- package/dist/src/integrations/claude-code/task-coordinator.js +360 -0
- package/dist/src/integrations/claude-code/task-coordinator.js.map +7 -0
- package/dist/src/integrations/linear/auth.js +337 -0
- package/dist/src/integrations/linear/auth.js.map +7 -0
- package/dist/src/integrations/linear/auto-sync.js +258 -0
- package/dist/src/integrations/linear/auto-sync.js.map +7 -0
- package/dist/src/integrations/linear/client.js +634 -0
- package/dist/src/integrations/linear/client.js.map +7 -0
- package/dist/src/integrations/linear/config.js +130 -0
- package/dist/src/integrations/linear/config.js.map +7 -0
- package/dist/src/integrations/linear/migration.js +361 -0
- package/dist/src/integrations/linear/migration.js.map +7 -0
- package/dist/src/integrations/linear/oauth-server.js +454 -0
- package/dist/src/integrations/linear/oauth-server.js.map +7 -0
- package/dist/src/integrations/linear/rest-client.js +213 -0
- package/dist/src/integrations/linear/rest-client.js.map +7 -0
- package/dist/src/integrations/linear/sync-manager.js +236 -0
- package/dist/src/integrations/linear/sync-manager.js.map +7 -0
- package/dist/src/integrations/linear/sync-service.js +231 -0
- package/dist/src/integrations/linear/sync-service.js.map +7 -0
- package/dist/src/integrations/linear/sync.js +782 -0
- package/dist/src/integrations/linear/sync.js.map +7 -0
- package/dist/src/integrations/linear/types.js +5 -0
- package/dist/src/integrations/linear/types.js.map +7 -0
- package/dist/src/integrations/linear/unified-sync.js +589 -0
- package/dist/src/integrations/linear/unified-sync.js.map +7 -0
- package/dist/src/integrations/linear/webhook-handler.js +219 -0
- package/dist/src/integrations/linear/webhook-handler.js.map +7 -0
- package/dist/src/integrations/linear/webhook-server.js +218 -0
- package/dist/src/integrations/linear/webhook-server.js.map +7 -0
- package/dist/src/integrations/linear/webhook.js +291 -0
- package/dist/src/integrations/linear/webhook.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js +266 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js +257 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js +497 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/index.js +166 -0
- package/dist/src/integrations/mcp/handlers/index.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js +247 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js +529 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js +239 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js +308 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/index.js +23 -0
- package/dist/src/integrations/mcp/index.js.map +7 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js +356 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js.map +7 -0
- package/dist/src/integrations/mcp/refactored-server.js +374 -0
- package/dist/src/integrations/mcp/refactored-server.js.map +7 -0
- package/dist/src/integrations/mcp/remote-server.js +682 -0
- package/dist/src/integrations/mcp/remote-server.js.map +7 -0
- package/dist/src/integrations/mcp/schemas.js +147 -0
- package/dist/src/integrations/mcp/schemas.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +1975 -0
- package/dist/src/integrations/mcp/server.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js +125 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions.js +702 -0
- package/dist/src/integrations/mcp/tool-definitions.js.map +7 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +860 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +7 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js +301 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js.map +7 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +360 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js.map +7 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js +410 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js.map +7 -0
- package/dist/src/integrations/ralph/index.js +18 -0
- package/dist/src/integrations/ralph/index.js.map +7 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js +401 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js.map +7 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js +448 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js +294 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js +108 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js.map +7 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +463 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +400 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +473 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +388 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js +358 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js.map +7 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js +462 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js.map +7 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js +404 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +428 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +996 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js.map +7 -0
- package/dist/src/integrations/ralph/types.js +5 -0
- package/dist/src/integrations/ralph/types.js.map +7 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +585 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js.map +7 -0
- package/dist/src/mcp/stackmemory-mcp-server.js +554 -0
- package/dist/src/mcp/stackmemory-mcp-server.js.map +7 -0
- package/dist/src/middleware/exponential-rate-limiter.js +289 -0
- package/dist/src/middleware/exponential-rate-limiter.js.map +7 -0
- package/dist/src/models/user.model.js +358 -0
- package/dist/src/models/user.model.js.map +7 -0
- package/dist/src/servers/production/auth-middleware.js +528 -0
- package/dist/src/servers/production/auth-middleware.js.map +7 -0
- package/dist/src/services/config-service.js +65 -0
- package/dist/src/services/config-service.js.map +7 -0
- package/dist/src/services/context-service.js +194 -0
- package/dist/src/services/context-service.js.map +7 -0
- package/dist/src/skills/api-discovery.js +354 -0
- package/dist/src/skills/api-discovery.js.map +7 -0
- package/dist/src/skills/api-skill.js +475 -0
- package/dist/src/skills/api-skill.js.map +7 -0
- package/dist/src/skills/claude-skills.js +1061 -0
- package/dist/src/skills/claude-skills.js.map +7 -0
- package/dist/src/skills/dashboard-launcher.js +216 -0
- package/dist/src/skills/dashboard-launcher.js.map +7 -0
- package/dist/src/skills/recursive-agent-orchestrator.js +575 -0
- package/dist/src/skills/recursive-agent-orchestrator.js.map +7 -0
- package/dist/src/skills/repo-ingestion-skill.js +609 -0
- package/dist/src/skills/repo-ingestion-skill.js.map +7 -0
- package/dist/src/skills/unified-rlm-orchestrator.js +404 -0
- package/dist/src/skills/unified-rlm-orchestrator.js.map +7 -0
- package/dist/src/types/task.js +5 -0
- package/dist/src/types/task.js.map +7 -0
- package/dist/src/utils/env.js +50 -0
- package/dist/src/utils/env.js.map +7 -0
- package/dist/src/utils/formatting.js +62 -0
- package/dist/src/utils/formatting.js.map +7 -0
- package/dist/src/utils/process-cleanup.js +136 -0
- package/dist/src/utils/process-cleanup.js.map +7 -0
- package/package.json +3 -3
- package/scripts/initialize.ts +16 -7
- package/scripts/install.sh +14 -62
- package/scripts/status.ts +111 -46
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
2
|
+
import { dirname as __pathDirname } from 'path';
|
|
3
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
4
|
+
const __dirname = __pathDirname(__filename);
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
import { execSync } from "child_process";
|
|
11
|
+
const CLAUDE_DIR = join(homedir(), ".claude");
|
|
12
|
+
const CLAUDE_CONFIG_FILE = join(CLAUDE_DIR, "config.json");
|
|
13
|
+
const MCP_CONFIG_FILE = join(CLAUDE_DIR, "stackmemory-mcp.json");
|
|
14
|
+
const HOOKS_JSON = join(CLAUDE_DIR, "hooks.json");
|
|
15
|
+
function createSetupMCPCommand() {
|
|
16
|
+
return new Command("setup-mcp").description("Auto-configure Claude Code MCP integration").option("--dry-run", "Show what would be configured without making changes").option("--reset", "Reset MCP configuration to defaults").action(async (options) => {
|
|
17
|
+
console.log(chalk.cyan("\nStackMemory MCP Setup\n"));
|
|
18
|
+
if (options.dryRun) {
|
|
19
|
+
console.log(chalk.yellow("[DRY RUN] No changes will be made.\n"));
|
|
20
|
+
}
|
|
21
|
+
if (!existsSync(CLAUDE_DIR)) {
|
|
22
|
+
if (options.dryRun) {
|
|
23
|
+
console.log(chalk.gray(`Would create: ${CLAUDE_DIR}`));
|
|
24
|
+
} else {
|
|
25
|
+
mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
26
|
+
console.log(chalk.green("[OK]") + " Created ~/.claude directory");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const mcpConfig = {
|
|
30
|
+
mcpServers: {
|
|
31
|
+
stackmemory: {
|
|
32
|
+
command: "stackmemory",
|
|
33
|
+
args: ["mcp-server"],
|
|
34
|
+
env: {
|
|
35
|
+
NODE_ENV: "production"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
if (options.dryRun) {
|
|
41
|
+
console.log(
|
|
42
|
+
chalk.gray(`Would write MCP config to: ${MCP_CONFIG_FILE}`)
|
|
43
|
+
);
|
|
44
|
+
console.log(chalk.gray(JSON.stringify(mcpConfig, null, 2)));
|
|
45
|
+
} else {
|
|
46
|
+
writeFileSync(MCP_CONFIG_FILE, JSON.stringify(mcpConfig, null, 2));
|
|
47
|
+
console.log(chalk.green("[OK]") + " Created MCP server configuration");
|
|
48
|
+
}
|
|
49
|
+
let claudeConfig = {};
|
|
50
|
+
if (existsSync(CLAUDE_CONFIG_FILE)) {
|
|
51
|
+
try {
|
|
52
|
+
claudeConfig = JSON.parse(readFileSync(CLAUDE_CONFIG_FILE, "utf8"));
|
|
53
|
+
} catch {
|
|
54
|
+
console.log(
|
|
55
|
+
chalk.yellow("[WARN]") + " Could not parse existing config.json, creating new"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!claudeConfig.mcp) {
|
|
60
|
+
claudeConfig.mcp = {};
|
|
61
|
+
}
|
|
62
|
+
const mcp = claudeConfig.mcp;
|
|
63
|
+
if (!mcp.configFiles) {
|
|
64
|
+
mcp.configFiles = [];
|
|
65
|
+
}
|
|
66
|
+
const configFiles = mcp.configFiles;
|
|
67
|
+
if (!configFiles.includes(MCP_CONFIG_FILE)) {
|
|
68
|
+
configFiles.push(MCP_CONFIG_FILE);
|
|
69
|
+
}
|
|
70
|
+
if (options.dryRun) {
|
|
71
|
+
console.log(chalk.gray(`Would update: ${CLAUDE_CONFIG_FILE}`));
|
|
72
|
+
} else {
|
|
73
|
+
writeFileSync(
|
|
74
|
+
CLAUDE_CONFIG_FILE,
|
|
75
|
+
JSON.stringify(claudeConfig, null, 2)
|
|
76
|
+
);
|
|
77
|
+
console.log(chalk.green("[OK]") + " Updated Claude config.json");
|
|
78
|
+
}
|
|
79
|
+
console.log(chalk.cyan("\nValidating configuration..."));
|
|
80
|
+
try {
|
|
81
|
+
execSync("stackmemory --version", { stdio: "pipe" });
|
|
82
|
+
console.log(chalk.green("[OK]") + " stackmemory CLI is installed");
|
|
83
|
+
} catch {
|
|
84
|
+
console.log(chalk.yellow("[WARN]") + " stackmemory CLI not in PATH");
|
|
85
|
+
console.log(chalk.gray(" You may need to restart your terminal"));
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
execSync("claude --version", { stdio: "pipe" });
|
|
89
|
+
console.log(chalk.green("[OK]") + " Claude Code is installed");
|
|
90
|
+
} catch {
|
|
91
|
+
console.log(chalk.yellow("[WARN]") + " Claude Code not found");
|
|
92
|
+
console.log(chalk.gray(" Install from: https://claude.ai/code"));
|
|
93
|
+
}
|
|
94
|
+
if (!options.dryRun) {
|
|
95
|
+
console.log(chalk.green("\nMCP setup complete!"));
|
|
96
|
+
console.log(chalk.cyan("\nNext steps:"));
|
|
97
|
+
console.log(chalk.white(" 1. Restart Claude Code"));
|
|
98
|
+
console.log(
|
|
99
|
+
chalk.white(
|
|
100
|
+
" 2. The StackMemory MCP tools will be available automatically"
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
console.log(
|
|
104
|
+
chalk.gray(
|
|
105
|
+
'\nTo verify: Run "stackmemory doctor" to check all integrations'
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function createDoctorCommand() {
|
|
112
|
+
return new Command("doctor").description("Diagnose StackMemory configuration and common issues").option("--fix", "Attempt to automatically fix issues").action(async (options) => {
|
|
113
|
+
console.log(chalk.cyan("\nStackMemory Doctor\n"));
|
|
114
|
+
console.log(chalk.gray("Checking configuration and dependencies...\n"));
|
|
115
|
+
const results = [];
|
|
116
|
+
const projectDir = join(process.cwd(), ".stackmemory");
|
|
117
|
+
const dbPath = join(projectDir, "context.db");
|
|
118
|
+
if (existsSync(dbPath)) {
|
|
119
|
+
results.push({
|
|
120
|
+
name: "Project Initialization",
|
|
121
|
+
status: "ok",
|
|
122
|
+
message: "StackMemory is initialized in this project"
|
|
123
|
+
});
|
|
124
|
+
} else if (existsSync(projectDir)) {
|
|
125
|
+
results.push({
|
|
126
|
+
name: "Project Initialization",
|
|
127
|
+
status: "warn",
|
|
128
|
+
message: ".stackmemory directory exists but database not found",
|
|
129
|
+
fix: "Run: stackmemory init"
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
results.push({
|
|
133
|
+
name: "Project Initialization",
|
|
134
|
+
status: "error",
|
|
135
|
+
message: "StackMemory not initialized in this project",
|
|
136
|
+
fix: "Run: stackmemory init"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (existsSync(dbPath)) {
|
|
140
|
+
try {
|
|
141
|
+
const Database = (await import("better-sqlite3")).default;
|
|
142
|
+
const db = new Database(dbPath, { readonly: true });
|
|
143
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table'").all();
|
|
144
|
+
db.close();
|
|
145
|
+
const hasFrames = tables.some((t) => t.name === "frames");
|
|
146
|
+
if (hasFrames) {
|
|
147
|
+
results.push({
|
|
148
|
+
name: "Database Integrity",
|
|
149
|
+
status: "ok",
|
|
150
|
+
message: `Database has ${tables.length} tables`
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
results.push({
|
|
154
|
+
name: "Database Integrity",
|
|
155
|
+
status: "warn",
|
|
156
|
+
message: "Database exists but missing expected tables",
|
|
157
|
+
fix: "Run: stackmemory init --interactive"
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
results.push({
|
|
162
|
+
name: "Database Integrity",
|
|
163
|
+
status: "error",
|
|
164
|
+
message: `Database error: ${error.message}`,
|
|
165
|
+
fix: "Remove .stackmemory/context.db and run: stackmemory init"
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (existsSync(MCP_CONFIG_FILE)) {
|
|
170
|
+
try {
|
|
171
|
+
const config = JSON.parse(readFileSync(MCP_CONFIG_FILE, "utf8"));
|
|
172
|
+
if (config.mcpServers?.stackmemory) {
|
|
173
|
+
results.push({
|
|
174
|
+
name: "MCP Configuration",
|
|
175
|
+
status: "ok",
|
|
176
|
+
message: "MCP server configured"
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
results.push({
|
|
180
|
+
name: "MCP Configuration",
|
|
181
|
+
status: "warn",
|
|
182
|
+
message: "MCP config file exists but stackmemory server not configured",
|
|
183
|
+
fix: "Run: stackmemory setup-mcp"
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
} catch {
|
|
187
|
+
results.push({
|
|
188
|
+
name: "MCP Configuration",
|
|
189
|
+
status: "error",
|
|
190
|
+
message: "Invalid MCP configuration file",
|
|
191
|
+
fix: "Run: stackmemory setup-mcp --reset"
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
results.push({
|
|
196
|
+
name: "MCP Configuration",
|
|
197
|
+
status: "warn",
|
|
198
|
+
message: "MCP not configured for Claude Code",
|
|
199
|
+
fix: "Run: stackmemory setup-mcp"
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (existsSync(HOOKS_JSON)) {
|
|
203
|
+
try {
|
|
204
|
+
const hooks = JSON.parse(readFileSync(HOOKS_JSON, "utf8"));
|
|
205
|
+
const hasTraceHook = !!hooks["tool-use-approval"];
|
|
206
|
+
if (hasTraceHook) {
|
|
207
|
+
results.push({
|
|
208
|
+
name: "Claude Hooks",
|
|
209
|
+
status: "ok",
|
|
210
|
+
message: "Tool tracing hook installed"
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
results.push({
|
|
214
|
+
name: "Claude Hooks",
|
|
215
|
+
status: "warn",
|
|
216
|
+
message: "Hooks file exists but tracing not configured",
|
|
217
|
+
fix: "Run: stackmemory hooks install"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
} catch {
|
|
221
|
+
results.push({
|
|
222
|
+
name: "Claude Hooks",
|
|
223
|
+
status: "warn",
|
|
224
|
+
message: "Could not read hooks.json"
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
results.push({
|
|
229
|
+
name: "Claude Hooks",
|
|
230
|
+
status: "warn",
|
|
231
|
+
message: "Claude hooks not installed (optional)",
|
|
232
|
+
fix: "Run: stackmemory hooks install"
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
const envChecks = [
|
|
236
|
+
{ key: "LINEAR_API_KEY", name: "Linear API Key", optional: true },
|
|
237
|
+
{ key: "TWILIO_ACCOUNT_SID", name: "Twilio Account", optional: true }
|
|
238
|
+
];
|
|
239
|
+
for (const check of envChecks) {
|
|
240
|
+
const value = process.env[check.key];
|
|
241
|
+
if (value) {
|
|
242
|
+
results.push({
|
|
243
|
+
name: check.name,
|
|
244
|
+
status: "ok",
|
|
245
|
+
message: "Environment variable set"
|
|
246
|
+
});
|
|
247
|
+
} else if (!check.optional) {
|
|
248
|
+
results.push({
|
|
249
|
+
name: check.name,
|
|
250
|
+
status: "error",
|
|
251
|
+
message: "Required environment variable not set",
|
|
252
|
+
fix: `Set ${check.key} in your .env file`
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const homeStackmemory = join(homedir(), ".stackmemory");
|
|
257
|
+
if (existsSync(homeStackmemory)) {
|
|
258
|
+
try {
|
|
259
|
+
const testFile = join(homeStackmemory, ".write-test");
|
|
260
|
+
writeFileSync(testFile, "test");
|
|
261
|
+
const { unlinkSync } = await import("fs");
|
|
262
|
+
unlinkSync(testFile);
|
|
263
|
+
results.push({
|
|
264
|
+
name: "File Permissions",
|
|
265
|
+
status: "ok",
|
|
266
|
+
message: "~/.stackmemory is writable"
|
|
267
|
+
});
|
|
268
|
+
} catch {
|
|
269
|
+
results.push({
|
|
270
|
+
name: "File Permissions",
|
|
271
|
+
status: "error",
|
|
272
|
+
message: "~/.stackmemory is not writable",
|
|
273
|
+
fix: "Run: chmod 700 ~/.stackmemory"
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
let hasErrors = false;
|
|
278
|
+
let hasWarnings = false;
|
|
279
|
+
for (const result of results) {
|
|
280
|
+
const icon = result.status === "ok" ? chalk.green("[OK]") : result.status === "warn" ? chalk.yellow("[WARN]") : chalk.red("[ERROR]");
|
|
281
|
+
console.log(`${icon} ${result.name}`);
|
|
282
|
+
console.log(chalk.gray(` ${result.message}`));
|
|
283
|
+
if (result.fix) {
|
|
284
|
+
console.log(chalk.cyan(` Fix: ${result.fix}`));
|
|
285
|
+
if (options.fix && result.status !== "ok") {
|
|
286
|
+
if (result.fix.includes("stackmemory setup-mcp")) {
|
|
287
|
+
console.log(chalk.gray(" Attempting auto-fix..."));
|
|
288
|
+
try {
|
|
289
|
+
execSync("stackmemory setup-mcp", { stdio: "inherit" });
|
|
290
|
+
} catch {
|
|
291
|
+
console.log(chalk.red(" Auto-fix failed"));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (result.status === "error") hasErrors = true;
|
|
297
|
+
if (result.status === "warn") hasWarnings = true;
|
|
298
|
+
}
|
|
299
|
+
console.log("");
|
|
300
|
+
if (hasErrors) {
|
|
301
|
+
console.log(
|
|
302
|
+
chalk.red("Some issues need attention. Run suggested fixes above.")
|
|
303
|
+
);
|
|
304
|
+
process.exit(1);
|
|
305
|
+
} else if (hasWarnings) {
|
|
306
|
+
console.log(
|
|
307
|
+
chalk.yellow(
|
|
308
|
+
"StackMemory is working but some optional features are not configured."
|
|
309
|
+
)
|
|
310
|
+
);
|
|
311
|
+
} else {
|
|
312
|
+
console.log(
|
|
313
|
+
chalk.green("All checks passed! StackMemory is properly configured.")
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function createSetupPluginsCommand() {
|
|
319
|
+
const cmd = new Command("setup-plugins");
|
|
320
|
+
cmd.description("Install StackMemory plugins for Claude Code").option("--force", "Overwrite existing plugins").action(async (options) => {
|
|
321
|
+
console.log(
|
|
322
|
+
chalk.cyan("Installing StackMemory plugins for Claude Code...\n")
|
|
323
|
+
);
|
|
324
|
+
const pluginsDir = join(CLAUDE_DIR, "plugins");
|
|
325
|
+
if (!existsSync(pluginsDir)) {
|
|
326
|
+
mkdirSync(pluginsDir, { recursive: true });
|
|
327
|
+
console.log(chalk.gray(`Created: ${pluginsDir}`));
|
|
328
|
+
}
|
|
329
|
+
const possiblePaths = [
|
|
330
|
+
join(process.cwd(), "plugins"),
|
|
331
|
+
join(__dirname, "..", "..", "..", "plugins"),
|
|
332
|
+
join(homedir(), ".stackmemory", "plugins")
|
|
333
|
+
];
|
|
334
|
+
try {
|
|
335
|
+
const globalRoot = execSync("npm root -g", {
|
|
336
|
+
encoding: "utf-8"
|
|
337
|
+
}).trim();
|
|
338
|
+
possiblePaths.push(
|
|
339
|
+
join(globalRoot, "@stackmemoryai", "stackmemory", "plugins")
|
|
340
|
+
);
|
|
341
|
+
} catch {
|
|
342
|
+
}
|
|
343
|
+
let sourcePluginsDir;
|
|
344
|
+
for (const p of possiblePaths) {
|
|
345
|
+
if (existsSync(p) && existsSync(join(p, "stackmemory"))) {
|
|
346
|
+
sourcePluginsDir = p;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (!sourcePluginsDir) {
|
|
351
|
+
console.log(chalk.red("Could not find StackMemory plugins directory"));
|
|
352
|
+
console.log(chalk.gray("Searched:"));
|
|
353
|
+
possiblePaths.forEach((p) => console.log(chalk.gray(` - ${p}`)));
|
|
354
|
+
process.exit(1);
|
|
355
|
+
}
|
|
356
|
+
console.log(chalk.gray(`Source: ${sourcePluginsDir}
|
|
357
|
+
`));
|
|
358
|
+
const plugins = ["stackmemory", "ralph-wiggum"];
|
|
359
|
+
let installed = 0;
|
|
360
|
+
for (const plugin of plugins) {
|
|
361
|
+
const sourcePath = join(sourcePluginsDir, plugin);
|
|
362
|
+
const targetPath = join(pluginsDir, plugin);
|
|
363
|
+
if (!existsSync(sourcePath)) {
|
|
364
|
+
console.log(chalk.yellow(` [SKIP] ${plugin} - not found in source`));
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (existsSync(targetPath)) {
|
|
368
|
+
if (options.force) {
|
|
369
|
+
try {
|
|
370
|
+
execSync(`rm -rf "${targetPath}"`, { encoding: "utf-8" });
|
|
371
|
+
} catch {
|
|
372
|
+
console.log(
|
|
373
|
+
chalk.red(` [ERROR] ${plugin} - could not remove existing`)
|
|
374
|
+
);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
console.log(
|
|
379
|
+
chalk.gray(` [EXISTS] ${plugin} - use --force to overwrite`)
|
|
380
|
+
);
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
execSync(`ln -s "${sourcePath}" "${targetPath}"`, {
|
|
386
|
+
encoding: "utf-8"
|
|
387
|
+
});
|
|
388
|
+
console.log(chalk.green(` [OK] ${plugin}`));
|
|
389
|
+
installed++;
|
|
390
|
+
} catch (err) {
|
|
391
|
+
console.log(
|
|
392
|
+
chalk.red(` [ERROR] ${plugin} - ${err.message}`)
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
console.log("");
|
|
397
|
+
if (installed > 0) {
|
|
398
|
+
console.log(chalk.green(`Installed ${installed} plugin(s)`));
|
|
399
|
+
console.log(chalk.gray("\nAvailable commands in Claude Code:"));
|
|
400
|
+
console.log(
|
|
401
|
+
chalk.white(" /sm-status ") + chalk.gray("Show StackMemory status")
|
|
402
|
+
);
|
|
403
|
+
console.log(
|
|
404
|
+
chalk.white(" /sm-capture ") + chalk.gray("Capture work for handoff")
|
|
405
|
+
);
|
|
406
|
+
console.log(
|
|
407
|
+
chalk.white(" /sm-restore ") + chalk.gray("Restore from last handoff")
|
|
408
|
+
);
|
|
409
|
+
console.log(
|
|
410
|
+
chalk.white(" /sm-decision ") + chalk.gray("Record a decision")
|
|
411
|
+
);
|
|
412
|
+
console.log(
|
|
413
|
+
chalk.white(" /sm-help ") + chalk.gray("Show all commands")
|
|
414
|
+
);
|
|
415
|
+
console.log(
|
|
416
|
+
chalk.white(" /ralph-loop ") + chalk.gray("Start Ralph iteration loop")
|
|
417
|
+
);
|
|
418
|
+
} else {
|
|
419
|
+
console.log(chalk.yellow("No plugins installed"));
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
return cmd;
|
|
423
|
+
}
|
|
424
|
+
function createSetupRemoteCommand() {
|
|
425
|
+
const cmd = new Command("setup-remote");
|
|
426
|
+
cmd.description("Configure remote MCP server to auto-start on boot").option("--port <number>", "Port for remote server", "3847").option("--project <path>", "Project root directory").option("--uninstall", "Remove the auto-start service").option("--status", "Check service status").action(async (options) => {
|
|
427
|
+
const home = homedir();
|
|
428
|
+
const platform = process.platform;
|
|
429
|
+
const serviceName = platform === "darwin" ? "com.stackmemory.remote-mcp" : "stackmemory-remote-mcp";
|
|
430
|
+
const serviceDir = platform === "darwin" ? join(home, "Library", "LaunchAgents") : join(home, ".config", "systemd", "user");
|
|
431
|
+
const serviceFile = platform === "darwin" ? join(serviceDir, `${serviceName}.plist`) : join(serviceDir, `${serviceName}.service`);
|
|
432
|
+
const logDir = join(home, ".stackmemory", "logs");
|
|
433
|
+
const pidFile = join(home, ".stackmemory", "remote-mcp.pid");
|
|
434
|
+
if (options.status) {
|
|
435
|
+
console.log(chalk.cyan("\nRemote MCP Server Status\n"));
|
|
436
|
+
if (platform === "darwin") {
|
|
437
|
+
try {
|
|
438
|
+
const result = execSync(
|
|
439
|
+
`launchctl list | grep ${serviceName} || true`,
|
|
440
|
+
{ encoding: "utf-8" }
|
|
441
|
+
);
|
|
442
|
+
if (result.includes(serviceName)) {
|
|
443
|
+
console.log(chalk.green("[RUNNING]") + " Service is active");
|
|
444
|
+
try {
|
|
445
|
+
const health = execSync(
|
|
446
|
+
`curl -s http://localhost:${options.port}/health 2>/dev/null`,
|
|
447
|
+
{ encoding: "utf-8" }
|
|
448
|
+
);
|
|
449
|
+
const data = JSON.parse(health);
|
|
450
|
+
console.log(chalk.gray(` Project: ${data.projectId}`));
|
|
451
|
+
console.log(
|
|
452
|
+
chalk.gray(` URL: http://localhost:${options.port}/sse`)
|
|
453
|
+
);
|
|
454
|
+
} catch {
|
|
455
|
+
console.log(
|
|
456
|
+
chalk.yellow(" Server not responding to health check")
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
} else {
|
|
460
|
+
console.log(chalk.yellow("[STOPPED]") + " Service not running");
|
|
461
|
+
}
|
|
462
|
+
} catch {
|
|
463
|
+
console.log(chalk.yellow("[UNKNOWN]") + " Could not check status");
|
|
464
|
+
}
|
|
465
|
+
} else if (platform === "linux") {
|
|
466
|
+
try {
|
|
467
|
+
execSync(`systemctl --user is-active ${serviceName}`, {
|
|
468
|
+
stdio: "pipe"
|
|
469
|
+
});
|
|
470
|
+
console.log(chalk.green("[RUNNING]") + " Service is active");
|
|
471
|
+
} catch {
|
|
472
|
+
console.log(chalk.yellow("[STOPPED]") + " Service not running");
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
console.log(chalk.gray(`
|
|
476
|
+
Service file: ${serviceFile}`));
|
|
477
|
+
console.log(chalk.gray(`Logs: ${logDir}/remote-mcp.log`));
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (options.uninstall) {
|
|
481
|
+
console.log(chalk.cyan("\nUninstalling Remote MCP Server Service\n"));
|
|
482
|
+
if (platform === "darwin") {
|
|
483
|
+
try {
|
|
484
|
+
execSync(`launchctl unload "${serviceFile}"`, { stdio: "pipe" });
|
|
485
|
+
console.log(chalk.green("[OK]") + " Service unloaded");
|
|
486
|
+
} catch {
|
|
487
|
+
console.log(chalk.gray("[SKIP]") + " Service was not loaded");
|
|
488
|
+
}
|
|
489
|
+
if (existsSync(serviceFile)) {
|
|
490
|
+
const fs = await import("fs/promises");
|
|
491
|
+
await fs.unlink(serviceFile);
|
|
492
|
+
console.log(chalk.green("[OK]") + " Service file removed");
|
|
493
|
+
}
|
|
494
|
+
} else if (platform === "linux") {
|
|
495
|
+
try {
|
|
496
|
+
execSync(`systemctl --user stop ${serviceName}`, { stdio: "pipe" });
|
|
497
|
+
execSync(`systemctl --user disable ${serviceName}`, {
|
|
498
|
+
stdio: "pipe"
|
|
499
|
+
});
|
|
500
|
+
console.log(chalk.green("[OK]") + " Service stopped and disabled");
|
|
501
|
+
} catch {
|
|
502
|
+
console.log(chalk.gray("[SKIP]") + " Service was not running");
|
|
503
|
+
}
|
|
504
|
+
if (existsSync(serviceFile)) {
|
|
505
|
+
const fs = await import("fs/promises");
|
|
506
|
+
await fs.unlink(serviceFile);
|
|
507
|
+
execSync("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
508
|
+
console.log(chalk.green("[OK]") + " Service file removed");
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
console.log(chalk.green("\nRemote MCP service uninstalled"));
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
console.log(chalk.cyan("\nSetting up Remote MCP Server Auto-Start\n"));
|
|
515
|
+
if (platform !== "darwin" && platform !== "linux") {
|
|
516
|
+
console.log(
|
|
517
|
+
chalk.red("Auto-start is only supported on macOS and Linux")
|
|
518
|
+
);
|
|
519
|
+
console.log(chalk.gray("\nManual start: stackmemory mcp-remote"));
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
if (!existsSync(serviceDir)) {
|
|
523
|
+
mkdirSync(serviceDir, { recursive: true });
|
|
524
|
+
}
|
|
525
|
+
if (!existsSync(logDir)) {
|
|
526
|
+
mkdirSync(logDir, { recursive: true });
|
|
527
|
+
}
|
|
528
|
+
let nodePath;
|
|
529
|
+
try {
|
|
530
|
+
nodePath = execSync("which node", { encoding: "utf-8" }).trim();
|
|
531
|
+
} catch {
|
|
532
|
+
nodePath = "/usr/local/bin/node";
|
|
533
|
+
}
|
|
534
|
+
let stackmemoryPath;
|
|
535
|
+
try {
|
|
536
|
+
stackmemoryPath = execSync("which stackmemory", {
|
|
537
|
+
encoding: "utf-8"
|
|
538
|
+
}).trim();
|
|
539
|
+
} catch {
|
|
540
|
+
try {
|
|
541
|
+
const npmRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
542
|
+
stackmemoryPath = join(
|
|
543
|
+
npmRoot,
|
|
544
|
+
"@stackmemoryai",
|
|
545
|
+
"stackmemory",
|
|
546
|
+
"dist",
|
|
547
|
+
"cli",
|
|
548
|
+
"index.js"
|
|
549
|
+
);
|
|
550
|
+
} catch {
|
|
551
|
+
stackmemoryPath = "npx stackmemory";
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
const projectPath = options.project || home;
|
|
555
|
+
const port = options.port || "3847";
|
|
556
|
+
if (platform === "darwin") {
|
|
557
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
558
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
559
|
+
<plist version="1.0">
|
|
560
|
+
<dict>
|
|
561
|
+
<key>Label</key>
|
|
562
|
+
<string>${serviceName}</string>
|
|
563
|
+
|
|
564
|
+
<key>ProgramArguments</key>
|
|
565
|
+
<array>
|
|
566
|
+
<string>${stackmemoryPath.includes("npx") ? "npx" : nodePath}</string>
|
|
567
|
+
${stackmemoryPath.includes("npx") ? "<string>stackmemory</string>" : `<string>${stackmemoryPath}</string>`}
|
|
568
|
+
<string>mcp-remote</string>
|
|
569
|
+
<string>--port</string>
|
|
570
|
+
<string>${port}</string>
|
|
571
|
+
<string>--project</string>
|
|
572
|
+
<string>${projectPath}</string>
|
|
573
|
+
</array>
|
|
574
|
+
|
|
575
|
+
<key>RunAtLoad</key>
|
|
576
|
+
<true/>
|
|
577
|
+
|
|
578
|
+
<key>KeepAlive</key>
|
|
579
|
+
<dict>
|
|
580
|
+
<key>SuccessfulExit</key>
|
|
581
|
+
<false/>
|
|
582
|
+
</dict>
|
|
583
|
+
|
|
584
|
+
<key>WorkingDirectory</key>
|
|
585
|
+
<string>${projectPath}</string>
|
|
586
|
+
|
|
587
|
+
<key>StandardOutPath</key>
|
|
588
|
+
<string>${logDir}/remote-mcp.log</string>
|
|
589
|
+
|
|
590
|
+
<key>StandardErrorPath</key>
|
|
591
|
+
<string>${logDir}/remote-mcp.error.log</string>
|
|
592
|
+
|
|
593
|
+
<key>EnvironmentVariables</key>
|
|
594
|
+
<dict>
|
|
595
|
+
<key>HOME</key>
|
|
596
|
+
<string>${home}</string>
|
|
597
|
+
<key>PATH</key>
|
|
598
|
+
<string>/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin</string>
|
|
599
|
+
<key>NODE_ENV</key>
|
|
600
|
+
<string>production</string>
|
|
601
|
+
</dict>
|
|
602
|
+
|
|
603
|
+
<key>ThrottleInterval</key>
|
|
604
|
+
<integer>10</integer>
|
|
605
|
+
</dict>
|
|
606
|
+
</plist>`;
|
|
607
|
+
writeFileSync(serviceFile, plist);
|
|
608
|
+
console.log(chalk.green("[OK]") + " Created launchd service file");
|
|
609
|
+
try {
|
|
610
|
+
execSync(`launchctl unload "${serviceFile}" 2>/dev/null`, {
|
|
611
|
+
stdio: "pipe"
|
|
612
|
+
});
|
|
613
|
+
} catch {
|
|
614
|
+
}
|
|
615
|
+
try {
|
|
616
|
+
execSync(`launchctl load -w "${serviceFile}"`, { stdio: "pipe" });
|
|
617
|
+
console.log(chalk.green("[OK]") + " Service loaded and started");
|
|
618
|
+
} catch (err) {
|
|
619
|
+
console.log(chalk.red("[ERROR]") + ` Failed to load service: ${err}`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
} else if (platform === "linux") {
|
|
623
|
+
const service = `[Unit]
|
|
624
|
+
Description=StackMemory Remote MCP Server
|
|
625
|
+
Documentation=https://github.com/stackmemoryai/stackmemory
|
|
626
|
+
After=network.target
|
|
627
|
+
|
|
628
|
+
[Service]
|
|
629
|
+
Type=simple
|
|
630
|
+
ExecStart=${stackmemoryPath.includes("npx") ? "npx stackmemory" : `${nodePath} ${stackmemoryPath}`} mcp-remote --port ${port} --project ${projectPath}
|
|
631
|
+
Restart=on-failure
|
|
632
|
+
RestartSec=10
|
|
633
|
+
WorkingDirectory=${projectPath}
|
|
634
|
+
|
|
635
|
+
Environment=HOME=${home}
|
|
636
|
+
Environment=PATH=/usr/local/bin:/usr/bin:/bin
|
|
637
|
+
Environment=NODE_ENV=production
|
|
638
|
+
|
|
639
|
+
StandardOutput=append:${logDir}/remote-mcp.log
|
|
640
|
+
StandardError=append:${logDir}/remote-mcp.error.log
|
|
641
|
+
|
|
642
|
+
[Install]
|
|
643
|
+
WantedBy=default.target`;
|
|
644
|
+
writeFileSync(serviceFile, service);
|
|
645
|
+
console.log(chalk.green("[OK]") + " Created systemd service file");
|
|
646
|
+
try {
|
|
647
|
+
execSync("systemctl --user daemon-reload", { stdio: "pipe" });
|
|
648
|
+
execSync(`systemctl --user enable ${serviceName}`, { stdio: "pipe" });
|
|
649
|
+
execSync(`systemctl --user start ${serviceName}`, { stdio: "pipe" });
|
|
650
|
+
console.log(chalk.green("[OK]") + " Service enabled and started");
|
|
651
|
+
} catch (err) {
|
|
652
|
+
console.log(
|
|
653
|
+
chalk.red("[ERROR]") + ` Failed to start service: ${err}`
|
|
654
|
+
);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
console.log(chalk.cyan("\nVerifying server...\n"));
|
|
659
|
+
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
660
|
+
try {
|
|
661
|
+
const health = execSync(
|
|
662
|
+
`curl -s http://localhost:${port}/health 2>/dev/null`,
|
|
663
|
+
{ encoding: "utf-8" }
|
|
664
|
+
);
|
|
665
|
+
const data = JSON.parse(health);
|
|
666
|
+
console.log(chalk.green("[OK]") + " Server is running");
|
|
667
|
+
console.log(chalk.gray(` Project: ${data.projectId}`));
|
|
668
|
+
} catch {
|
|
669
|
+
console.log(
|
|
670
|
+
chalk.yellow("[WARN]") + " Server not responding yet (may still be starting)"
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
console.log(
|
|
674
|
+
chalk.green("\nRemote MCP Server configured for auto-start!")
|
|
675
|
+
);
|
|
676
|
+
console.log(chalk.cyan("\nConnection info:"));
|
|
677
|
+
console.log(chalk.white(` URL: http://localhost:${port}/sse`));
|
|
678
|
+
console.log(chalk.white(` Health: http://localhost:${port}/health`));
|
|
679
|
+
console.log(chalk.gray(`
|
|
680
|
+
Logs: ${logDir}/remote-mcp.log`));
|
|
681
|
+
console.log(chalk.gray(`Service: ${serviceFile}`));
|
|
682
|
+
console.log(chalk.cyan("\nFor external access (ngrok):"));
|
|
683
|
+
console.log(chalk.white(` ngrok http ${port}`));
|
|
684
|
+
console.log(chalk.gray(" Then use the ngrok URL + /sse in Claude.ai"));
|
|
685
|
+
});
|
|
686
|
+
return cmd;
|
|
687
|
+
}
|
|
688
|
+
function registerSetupCommands(program) {
|
|
689
|
+
program.addCommand(createSetupMCPCommand());
|
|
690
|
+
program.addCommand(createDoctorCommand());
|
|
691
|
+
program.addCommand(createSetupPluginsCommand());
|
|
692
|
+
program.addCommand(createSetupRemoteCommand());
|
|
693
|
+
}
|
|
694
|
+
export {
|
|
695
|
+
createDoctorCommand,
|
|
696
|
+
createSetupMCPCommand,
|
|
697
|
+
createSetupPluginsCommand,
|
|
698
|
+
createSetupRemoteCommand,
|
|
699
|
+
registerSetupCommands
|
|
700
|
+
};
|
|
701
|
+
//# sourceMappingURL=setup.js.map
|