@stackmemoryai/stackmemory 0.5.59 → 0.5.62

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.
Files changed (652) hide show
  1. package/README.md +105 -1
  2. package/dist/scripts/initialize.js +68 -1
  3. package/dist/scripts/initialize.js.map +2 -2
  4. package/dist/src/cli/claude-sm.js +130 -50
  5. package/dist/src/cli/claude-sm.js.map +2 -2
  6. package/dist/src/cli/index.js +18 -3
  7. package/dist/src/cli/index.js.map +3 -3
  8. package/dist/src/core/extensions/custom-tools.js +567 -0
  9. package/dist/src/core/extensions/custom-tools.js.map +7 -0
  10. package/dist/src/core/extensions/index.js +55 -0
  11. package/dist/src/core/extensions/index.js.map +7 -0
  12. package/dist/src/core/extensions/loader.js +709 -0
  13. package/dist/src/core/extensions/loader.js.map +7 -0
  14. package/dist/src/core/extensions/plugin-system.js +506 -0
  15. package/dist/src/core/extensions/plugin-system.js.map +7 -0
  16. package/dist/src/core/extensions/provider-adapter.js +617 -0
  17. package/dist/src/core/extensions/provider-adapter.js.map +7 -0
  18. package/dist/src/core/extensions/sandbox-runtime.js +664 -0
  19. package/dist/src/core/extensions/sandbox-runtime.js.map +7 -0
  20. package/dist/src/core/retrieval/index.js +2 -0
  21. package/dist/src/core/retrieval/index.js.map +2 -2
  22. package/dist/src/core/retrieval/privacy-filter.js +129 -0
  23. package/dist/src/core/retrieval/privacy-filter.js.map +7 -0
  24. package/dist/src/core/retrieval/unified-context-assembler.js +273 -0
  25. package/dist/src/core/retrieval/unified-context-assembler.js.map +7 -0
  26. package/dist/src/core/storage/chromadb-adapter.js +32 -6
  27. package/dist/src/core/storage/chromadb-adapter.js.map +2 -2
  28. package/dist/src/hooks/diffmem-hooks.js +377 -0
  29. package/dist/src/hooks/diffmem-hooks.js.map +7 -0
  30. package/dist/src/integrations/diffmem/client.js +209 -0
  31. package/dist/src/integrations/diffmem/client.js.map +7 -0
  32. package/dist/src/integrations/diffmem/config.js +15 -0
  33. package/dist/src/integrations/diffmem/config.js.map +7 -0
  34. package/dist/{core/session → src/integrations/diffmem}/index.js +5 -8
  35. package/dist/src/integrations/diffmem/index.js.map +7 -0
  36. package/dist/src/integrations/mcp/handlers/diffmem-handlers.js +456 -0
  37. package/dist/src/integrations/mcp/handlers/diffmem-handlers.js.map +7 -0
  38. package/dist/src/integrations/mcp/server.js +121 -0
  39. package/dist/src/integrations/mcp/server.js.map +2 -2
  40. package/dist/src/skills/repo-ingestion-skill.js +35 -12
  41. package/dist/src/skills/repo-ingestion-skill.js.map +2 -2
  42. package/package.json +13 -7
  43. package/scripts/background-sync-manager.js +145 -83
  44. package/scripts/claude-sm-autostart.js +17 -12
  45. package/scripts/gepa/README.md +275 -0
  46. package/scripts/gepa/config.json +53 -0
  47. package/scripts/gepa/evals/coding-tasks.jsonl +5 -0
  48. package/scripts/gepa/evals/fixtures/buggy-loop.js +18 -0
  49. package/scripts/gepa/evals/fixtures/callback-hell.js +53 -0
  50. package/scripts/gepa/generations/gen-000/baseline.md +124 -0
  51. package/scripts/gepa/hooks/auto-optimize.js +494 -0
  52. package/scripts/gepa/hooks/eval-tracker.js +203 -0
  53. package/scripts/gepa/hooks/reflect.js +311 -0
  54. package/scripts/gepa/optimize.js +611 -0
  55. package/scripts/gepa/state.json +14 -0
  56. package/scripts/initialize.ts +83 -1
  57. package/scripts/test-pre-publish-quick.sh +1 -1
  58. package/dist/agents/core/agent-task-manager.js +0 -527
  59. package/dist/agents/core/agent-task-manager.js.map +0 -7
  60. package/dist/agents/testing-agent.js +0 -614
  61. package/dist/agents/testing-agent.js.map +0 -7
  62. package/dist/agents/verifiers/base-verifier.js +0 -133
  63. package/dist/agents/verifiers/base-verifier.js.map +0 -7
  64. package/dist/agents/verifiers/formatter-verifier.js +0 -130
  65. package/dist/agents/verifiers/formatter-verifier.js.map +0 -7
  66. package/dist/agents/verifiers/llm-judge.js +0 -252
  67. package/dist/agents/verifiers/llm-judge.js.map +0 -7
  68. package/dist/cli/auto-detect.js +0 -321
  69. package/dist/cli/auto-detect.js.map +0 -7
  70. package/dist/cli/browser-test.js +0 -33
  71. package/dist/cli/browser-test.js.map +0 -7
  72. package/dist/cli/claude-sm-danger.js +0 -21
  73. package/dist/cli/claude-sm-danger.js.map +0 -7
  74. package/dist/cli/claude-sm.js +0 -1156
  75. package/dist/cli/claude-sm.js.map +0 -7
  76. package/dist/cli/codex-sm-danger.js +0 -21
  77. package/dist/cli/codex-sm-danger.js.map +0 -7
  78. package/dist/cli/codex-sm.js +0 -349
  79. package/dist/cli/codex-sm.js.map +0 -7
  80. package/dist/cli/commands/api.js +0 -232
  81. package/dist/cli/commands/api.js.map +0 -7
  82. package/dist/cli/commands/auto-background.js +0 -180
  83. package/dist/cli/commands/auto-background.js.map +0 -7
  84. package/dist/cli/commands/cleanup-processes.js +0 -68
  85. package/dist/cli/commands/cleanup-processes.js.map +0 -7
  86. package/dist/cli/commands/clear.js +0 -202
  87. package/dist/cli/commands/clear.js.map +0 -7
  88. package/dist/cli/commands/config.js +0 -445
  89. package/dist/cli/commands/config.js.map +0 -7
  90. package/dist/cli/commands/context-rehydrate.js +0 -751
  91. package/dist/cli/commands/context-rehydrate.js.map +0 -7
  92. package/dist/cli/commands/context.js +0 -343
  93. package/dist/cli/commands/context.js.map +0 -7
  94. package/dist/cli/commands/daemon.js +0 -392
  95. package/dist/cli/commands/daemon.js.map +0 -7
  96. package/dist/cli/commands/dashboard.js +0 -210
  97. package/dist/cli/commands/dashboard.js.map +0 -7
  98. package/dist/cli/commands/db.js +0 -147
  99. package/dist/cli/commands/db.js.map +0 -7
  100. package/dist/cli/commands/decision.js +0 -266
  101. package/dist/cli/commands/decision.js.map +0 -7
  102. package/dist/cli/commands/discovery.js +0 -279
  103. package/dist/cli/commands/discovery.js.map +0 -7
  104. package/dist/cli/commands/handoff.js +0 -624
  105. package/dist/cli/commands/handoff.js.map +0 -7
  106. package/dist/cli/commands/hooks.js +0 -298
  107. package/dist/cli/commands/hooks.js.map +0 -7
  108. package/dist/cli/commands/linear-unified.js +0 -353
  109. package/dist/cli/commands/linear-unified.js.map +0 -7
  110. package/dist/cli/commands/linear.js +0 -529
  111. package/dist/cli/commands/linear.js.map +0 -7
  112. package/dist/cli/commands/log.js +0 -169
  113. package/dist/cli/commands/log.js.map +0 -7
  114. package/dist/cli/commands/login.js +0 -172
  115. package/dist/cli/commands/login.js.map +0 -7
  116. package/dist/cli/commands/migrate.js +0 -240
  117. package/dist/cli/commands/migrate.js.map +0 -7
  118. package/dist/cli/commands/model.js +0 -533
  119. package/dist/cli/commands/model.js.map +0 -7
  120. package/dist/cli/commands/monitor.js +0 -313
  121. package/dist/cli/commands/monitor.js.map +0 -7
  122. package/dist/cli/commands/onboard.js +0 -536
  123. package/dist/cli/commands/onboard.js.map +0 -7
  124. package/dist/cli/commands/projects.js +0 -199
  125. package/dist/cli/commands/projects.js.map +0 -7
  126. package/dist/cli/commands/quality.js +0 -413
  127. package/dist/cli/commands/quality.js.map +0 -7
  128. package/dist/cli/commands/ralph.js +0 -909
  129. package/dist/cli/commands/ralph.js.map +0 -7
  130. package/dist/cli/commands/retrieval.js +0 -248
  131. package/dist/cli/commands/retrieval.js.map +0 -7
  132. package/dist/cli/commands/search.js +0 -173
  133. package/dist/cli/commands/search.js.map +0 -7
  134. package/dist/cli/commands/service.js +0 -749
  135. package/dist/cli/commands/service.js.map +0 -7
  136. package/dist/cli/commands/session.js +0 -200
  137. package/dist/cli/commands/session.js.map +0 -7
  138. package/dist/cli/commands/settings.js +0 -306
  139. package/dist/cli/commands/settings.js.map +0 -7
  140. package/dist/cli/commands/setup.js +0 -701
  141. package/dist/cli/commands/setup.js.map +0 -7
  142. package/dist/cli/commands/shell.js +0 -249
  143. package/dist/cli/commands/shell.js.map +0 -7
  144. package/dist/cli/commands/signup.js +0 -50
  145. package/dist/cli/commands/signup.js.map +0 -7
  146. package/dist/cli/commands/skills.js +0 -470
  147. package/dist/cli/commands/skills.js.map +0 -7
  148. package/dist/cli/commands/sms-notify.js +0 -795
  149. package/dist/cli/commands/sms-notify.js.map +0 -7
  150. package/dist/cli/commands/storage-tier.js +0 -183
  151. package/dist/cli/commands/storage-tier.js.map +0 -7
  152. package/dist/cli/commands/storage.js +0 -360
  153. package/dist/cli/commands/storage.js.map +0 -7
  154. package/dist/cli/commands/sweep.js +0 -249
  155. package/dist/cli/commands/sweep.js.map +0 -7
  156. package/dist/cli/commands/tasks.js +0 -213
  157. package/dist/cli/commands/tasks.js.map +0 -7
  158. package/dist/cli/commands/test.js +0 -286
  159. package/dist/cli/commands/test.js.map +0 -7
  160. package/dist/cli/commands/workflow.js +0 -142
  161. package/dist/cli/commands/workflow.js.map +0 -7
  162. package/dist/cli/commands/worktree.js +0 -319
  163. package/dist/cli/commands/worktree.js.map +0 -7
  164. package/dist/cli/index.js +0 -594
  165. package/dist/cli/index.js.map +0 -7
  166. package/dist/cli/opencode-sm.js +0 -448
  167. package/dist/cli/opencode-sm.js.map +0 -7
  168. package/dist/cli/utils/viewer.js +0 -96
  169. package/dist/cli/utils/viewer.js.map +0 -7
  170. package/dist/core/analytics/team-analytics.js +0 -378
  171. package/dist/core/analytics/team-analytics.js.map +0 -7
  172. package/dist/core/config/config-manager.js +0 -398
  173. package/dist/core/config/config-manager.js.map +0 -7
  174. package/dist/core/config/feature-flags.js +0 -76
  175. package/dist/core/config/feature-flags.js.map +0 -7
  176. package/dist/core/config/storage-config.js +0 -115
  177. package/dist/core/config/storage-config.js.map +0 -7
  178. package/dist/core/config/types.js +0 -144
  179. package/dist/core/config/types.js.map +0 -7
  180. package/dist/core/context/auto-context.js +0 -80
  181. package/dist/core/context/auto-context.js.map +0 -7
  182. package/dist/core/context/dual-stack-manager.js +0 -870
  183. package/dist/core/context/dual-stack-manager.js.map +0 -7
  184. package/dist/core/context/enhanced-rehydration.js +0 -994
  185. package/dist/core/context/enhanced-rehydration.js.map +0 -7
  186. package/dist/core/context/frame-database.js +0 -479
  187. package/dist/core/context/frame-database.js.map +0 -7
  188. package/dist/core/context/frame-digest.js +0 -250
  189. package/dist/core/context/frame-digest.js.map +0 -7
  190. package/dist/core/context/frame-handoff-manager.js +0 -778
  191. package/dist/core/context/frame-handoff-manager.js.map +0 -7
  192. package/dist/core/context/frame-lifecycle-hooks.js +0 -119
  193. package/dist/core/context/frame-lifecycle-hooks.js.map +0 -7
  194. package/dist/core/context/frame-manager.js +0 -1069
  195. package/dist/core/context/frame-manager.js.map +0 -7
  196. package/dist/core/context/frame-recovery.js +0 -302
  197. package/dist/core/context/frame-recovery.js.map +0 -7
  198. package/dist/core/context/frame-stack.js +0 -314
  199. package/dist/core/context/frame-stack.js.map +0 -7
  200. package/dist/core/context/frame-types.js +0 -5
  201. package/dist/core/context/frame-types.js.map +0 -7
  202. package/dist/core/context/incremental-gc.js +0 -290
  203. package/dist/core/context/incremental-gc.js.map +0 -7
  204. package/dist/core/context/index.js +0 -25
  205. package/dist/core/context/index.js.map +0 -7
  206. package/dist/core/context/model-aware-compaction.js +0 -623
  207. package/dist/core/context/model-aware-compaction.js.map +0 -7
  208. package/dist/core/context/permission-manager.js +0 -185
  209. package/dist/core/context/permission-manager.js.map +0 -7
  210. package/dist/core/context/recursive-context-manager.js +0 -592
  211. package/dist/core/context/recursive-context-manager.js.map +0 -7
  212. package/dist/core/context/refactored-frame-manager.js +0 -754
  213. package/dist/core/context/refactored-frame-manager.js.map +0 -7
  214. package/dist/core/context/shared-context-layer.js +0 -621
  215. package/dist/core/context/shared-context-layer.js.map +0 -7
  216. package/dist/core/context/stack-merge-resolver.js +0 -749
  217. package/dist/core/context/stack-merge-resolver.js.map +0 -7
  218. package/dist/core/context/validation.js +0 -130
  219. package/dist/core/context/validation.js.map +0 -7
  220. package/dist/core/database/batch-operations.js +0 -384
  221. package/dist/core/database/batch-operations.js.map +0 -7
  222. package/dist/core/database/connection-pool.js +0 -330
  223. package/dist/core/database/connection-pool.js.map +0 -7
  224. package/dist/core/database/database-adapter.js +0 -60
  225. package/dist/core/database/database-adapter.js.map +0 -7
  226. package/dist/core/database/migration-manager.js +0 -614
  227. package/dist/core/database/migration-manager.js.map +0 -7
  228. package/dist/core/database/paradedb-adapter.js +0 -990
  229. package/dist/core/database/paradedb-adapter.js.map +0 -7
  230. package/dist/core/database/query-cache.js +0 -298
  231. package/dist/core/database/query-cache.js.map +0 -7
  232. package/dist/core/database/query-router.js +0 -430
  233. package/dist/core/database/query-router.js.map +0 -7
  234. package/dist/core/database/sqlite-adapter.js +0 -738
  235. package/dist/core/database/sqlite-adapter.js.map +0 -7
  236. package/dist/core/digest/enhanced-hybrid-digest.js +0 -277
  237. package/dist/core/digest/enhanced-hybrid-digest.js.map +0 -7
  238. package/dist/core/digest/frame-digest-integration.js +0 -176
  239. package/dist/core/digest/frame-digest-integration.js.map +0 -7
  240. package/dist/core/digest/hybrid-digest-generator.js +0 -553
  241. package/dist/core/digest/hybrid-digest-generator.js.map +0 -7
  242. package/dist/core/digest/index.js +0 -9
  243. package/dist/core/digest/index.js.map +0 -7
  244. package/dist/core/digest/types.js +0 -25
  245. package/dist/core/digest/types.js.map +0 -7
  246. package/dist/core/errors/error-utils.js +0 -208
  247. package/dist/core/errors/error-utils.js.map +0 -7
  248. package/dist/core/errors/index.js +0 -521
  249. package/dist/core/errors/index.js.map +0 -7
  250. package/dist/core/errors/recovery.js +0 -269
  251. package/dist/core/errors/recovery.js.map +0 -7
  252. package/dist/core/execution/parallel-executor.js +0 -258
  253. package/dist/core/execution/parallel-executor.js.map +0 -7
  254. package/dist/core/frame/workflow-templates.js +0 -319
  255. package/dist/core/frame/workflow-templates.js.map +0 -7
  256. package/dist/core/merge/conflict-detector.js +0 -431
  257. package/dist/core/merge/conflict-detector.js.map +0 -7
  258. package/dist/core/merge/index.js +0 -9
  259. package/dist/core/merge/index.js.map +0 -7
  260. package/dist/core/merge/resolution-engine.js +0 -558
  261. package/dist/core/merge/resolution-engine.js.map +0 -7
  262. package/dist/core/merge/stack-diff.js +0 -532
  263. package/dist/core/merge/stack-diff.js.map +0 -7
  264. package/dist/core/merge/unified-merge-resolver.js +0 -303
  265. package/dist/core/merge/unified-merge-resolver.js.map +0 -7
  266. package/dist/core/models/fallback-monitor.js +0 -232
  267. package/dist/core/models/fallback-monitor.js.map +0 -7
  268. package/dist/core/models/model-router.js +0 -340
  269. package/dist/core/models/model-router.js.map +0 -7
  270. package/dist/core/monitoring/error-handler.js +0 -49
  271. package/dist/core/monitoring/error-handler.js.map +0 -7
  272. package/dist/core/monitoring/logger.js +0 -202
  273. package/dist/core/monitoring/logger.js.map +0 -7
  274. package/dist/core/monitoring/metrics.js +0 -172
  275. package/dist/core/monitoring/metrics.js.map +0 -7
  276. package/dist/core/monitoring/progress-tracker.js +0 -189
  277. package/dist/core/monitoring/progress-tracker.js.map +0 -7
  278. package/dist/core/monitoring/session-monitor.js +0 -300
  279. package/dist/core/monitoring/session-monitor.js.map +0 -7
  280. package/dist/core/performance/context-cache.js +0 -273
  281. package/dist/core/performance/context-cache.js.map +0 -7
  282. package/dist/core/performance/index.js +0 -11
  283. package/dist/core/performance/index.js.map +0 -7
  284. package/dist/core/performance/lazy-context-loader.js +0 -327
  285. package/dist/core/performance/lazy-context-loader.js.map +0 -7
  286. package/dist/core/performance/monitor.js +0 -221
  287. package/dist/core/performance/monitor.js.map +0 -7
  288. package/dist/core/performance/optimized-frame-context.js +0 -345
  289. package/dist/core/performance/optimized-frame-context.js.map +0 -7
  290. package/dist/core/performance/performance-benchmark.js +0 -277
  291. package/dist/core/performance/performance-benchmark.js.map +0 -7
  292. package/dist/core/performance/performance-profiler.js +0 -370
  293. package/dist/core/performance/performance-profiler.js.map +0 -7
  294. package/dist/core/performance/streaming-jsonl-parser.js +0 -195
  295. package/dist/core/performance/streaming-jsonl-parser.js.map +0 -7
  296. package/dist/core/persistence/postgres-adapter.js +0 -349
  297. package/dist/core/persistence/postgres-adapter.js.map +0 -7
  298. package/dist/core/projects/project-isolation.js +0 -201
  299. package/dist/core/projects/project-isolation.js.map +0 -7
  300. package/dist/core/projects/project-manager.js +0 -697
  301. package/dist/core/projects/project-manager.js.map +0 -7
  302. package/dist/core/query/query-parser.js +0 -370
  303. package/dist/core/query/query-parser.js.map +0 -7
  304. package/dist/core/query/query-templates.js +0 -321
  305. package/dist/core/query/query-templates.js.map +0 -7
  306. package/dist/core/retrieval/context-retriever.js +0 -479
  307. package/dist/core/retrieval/context-retriever.js.map +0 -7
  308. package/dist/core/retrieval/graph-retrieval.js +0 -662
  309. package/dist/core/retrieval/graph-retrieval.js.map +0 -7
  310. package/dist/core/retrieval/hierarchical-retrieval.js +0 -656
  311. package/dist/core/retrieval/hierarchical-retrieval.js.map +0 -7
  312. package/dist/core/retrieval/index.js +0 -8
  313. package/dist/core/retrieval/index.js.map +0 -7
  314. package/dist/core/retrieval/llm-context-retrieval.js +0 -613
  315. package/dist/core/retrieval/llm-context-retrieval.js.map +0 -7
  316. package/dist/core/retrieval/llm-provider.js +0 -151
  317. package/dist/core/retrieval/llm-provider.js.map +0 -7
  318. package/dist/core/retrieval/retrieval-audit.js +0 -236
  319. package/dist/core/retrieval/retrieval-audit.js.map +0 -7
  320. package/dist/core/retrieval/retrieval-benchmarks.js +0 -521
  321. package/dist/core/retrieval/retrieval-benchmarks.js.map +0 -7
  322. package/dist/core/retrieval/summary-generator.js +0 -589
  323. package/dist/core/retrieval/summary-generator.js.map +0 -7
  324. package/dist/core/retrieval/types.js +0 -21
  325. package/dist/core/retrieval/types.js.map +0 -7
  326. package/dist/core/security/index.js +0 -35
  327. package/dist/core/security/index.js.map +0 -7
  328. package/dist/core/security/input-sanitizer.js +0 -321
  329. package/dist/core/security/input-sanitizer.js.map +0 -7
  330. package/dist/core/session/clear-survival.js +0 -465
  331. package/dist/core/session/clear-survival.js.map +0 -7
  332. package/dist/core/session/enhanced-handoff.js +0 -792
  333. package/dist/core/session/enhanced-handoff.js.map +0 -7
  334. package/dist/core/session/handoff-generator.js +0 -343
  335. package/dist/core/session/handoff-generator.js.map +0 -7
  336. package/dist/core/session/index.js.map +0 -7
  337. package/dist/core/session/session-manager.js +0 -347
  338. package/dist/core/session/session-manager.js.map +0 -7
  339. package/dist/core/skills/index.js +0 -7
  340. package/dist/core/skills/index.js.map +0 -7
  341. package/dist/core/skills/skill-storage.js +0 -764
  342. package/dist/core/skills/skill-storage.js.map +0 -7
  343. package/dist/core/skills/types.js +0 -193
  344. package/dist/core/skills/types.js.map +0 -7
  345. package/dist/core/storage/chromadb-adapter.js +0 -354
  346. package/dist/core/storage/chromadb-adapter.js.map +0 -7
  347. package/dist/core/storage/infinite-storage.js +0 -510
  348. package/dist/core/storage/infinite-storage.js.map +0 -7
  349. package/dist/core/storage/railway-optimized-storage.js +0 -591
  350. package/dist/core/storage/railway-optimized-storage.js.map +0 -7
  351. package/dist/core/storage/remote-storage.js +0 -489
  352. package/dist/core/storage/remote-storage.js.map +0 -7
  353. package/dist/core/storage/two-tier-storage.js +0 -766
  354. package/dist/core/storage/two-tier-storage.js.map +0 -7
  355. package/dist/core/trace/cli-trace-wrapper.js +0 -132
  356. package/dist/core/trace/cli-trace-wrapper.js.map +0 -7
  357. package/dist/core/trace/db-trace-wrapper.js +0 -247
  358. package/dist/core/trace/db-trace-wrapper.js.map +0 -7
  359. package/dist/core/trace/debug-trace.js +0 -417
  360. package/dist/core/trace/debug-trace.js.map +0 -7
  361. package/dist/core/trace/index.js +0 -109
  362. package/dist/core/trace/index.js.map +0 -7
  363. package/dist/core/trace/linear-api-wrapper.js +0 -178
  364. package/dist/core/trace/linear-api-wrapper.js.map +0 -7
  365. package/dist/core/trace/trace-demo.js +0 -154
  366. package/dist/core/trace/trace-demo.js.map +0 -7
  367. package/dist/core/trace/trace-detector.demo.js +0 -142
  368. package/dist/core/trace/trace-detector.demo.js.map +0 -7
  369. package/dist/core/trace/trace-detector.js +0 -528
  370. package/dist/core/trace/trace-detector.js.map +0 -7
  371. package/dist/core/trace/trace-store.js +0 -345
  372. package/dist/core/trace/trace-store.js.map +0 -7
  373. package/dist/core/trace/types.js +0 -77
  374. package/dist/core/trace/types.js.map +0 -7
  375. package/dist/core/utils/async-mutex.js +0 -114
  376. package/dist/core/utils/async-mutex.js.map +0 -7
  377. package/dist/core/utils/compression.js +0 -83
  378. package/dist/core/utils/compression.js.map +0 -7
  379. package/dist/core/utils/update-checker.js +0 -218
  380. package/dist/core/utils/update-checker.js.map +0 -7
  381. package/dist/core/worktree/worktree-manager.js +0 -465
  382. package/dist/core/worktree/worktree-manager.js.map +0 -7
  383. package/dist/daemon/daemon-config.js +0 -149
  384. package/dist/daemon/daemon-config.js.map +0 -7
  385. package/dist/daemon/services/context-service.js +0 -122
  386. package/dist/daemon/services/context-service.js.map +0 -7
  387. package/dist/daemon/services/linear-service.js +0 -136
  388. package/dist/daemon/services/linear-service.js.map +0 -7
  389. package/dist/daemon/session-daemon.js +0 -312
  390. package/dist/daemon/session-daemon.js.map +0 -7
  391. package/dist/daemon/unified-daemon.js +0 -276
  392. package/dist/daemon/unified-daemon.js.map +0 -7
  393. package/dist/features/analytics/api/analytics-api.js +0 -287
  394. package/dist/features/analytics/api/analytics-api.js.map +0 -7
  395. package/dist/features/analytics/core/analytics-service.js +0 -282
  396. package/dist/features/analytics/core/analytics-service.js.map +0 -7
  397. package/dist/features/analytics/index.js +0 -18
  398. package/dist/features/analytics/index.js.map +0 -7
  399. package/dist/features/analytics/queries/metrics-queries.js +0 -277
  400. package/dist/features/analytics/queries/metrics-queries.js.map +0 -7
  401. package/dist/features/analytics/types/metrics.js +0 -5
  402. package/dist/features/analytics/types/metrics.js.map +0 -7
  403. package/dist/features/browser/browser-mcp.js +0 -492
  404. package/dist/features/browser/browser-mcp.js.map +0 -7
  405. package/dist/features/sweep/index.js +0 -20
  406. package/dist/features/sweep/index.js.map +0 -7
  407. package/dist/features/sweep/prediction-client.js +0 -155
  408. package/dist/features/sweep/prediction-client.js.map +0 -7
  409. package/dist/features/sweep/prompt-builder.js +0 -85
  410. package/dist/features/sweep/prompt-builder.js.map +0 -7
  411. package/dist/features/sweep/pty-wrapper.js +0 -171
  412. package/dist/features/sweep/pty-wrapper.js.map +0 -7
  413. package/dist/features/sweep/state-watcher.js +0 -87
  414. package/dist/features/sweep/state-watcher.js.map +0 -7
  415. package/dist/features/sweep/status-bar.js +0 -88
  416. package/dist/features/sweep/status-bar.js.map +0 -7
  417. package/dist/features/sweep/sweep-server-manager.js +0 -226
  418. package/dist/features/sweep/sweep-server-manager.js.map +0 -7
  419. package/dist/features/sweep/tab-interceptor.js +0 -38
  420. package/dist/features/sweep/tab-interceptor.js.map +0 -7
  421. package/dist/features/sweep/types.js +0 -18
  422. package/dist/features/sweep/types.js.map +0 -7
  423. package/dist/features/tasks/linear-task-manager.js +0 -487
  424. package/dist/features/tasks/linear-task-manager.js.map +0 -7
  425. package/dist/features/tasks/task-aware-context.js +0 -410
  426. package/dist/features/tasks/task-aware-context.js.map +0 -7
  427. package/dist/features/tui/simple-monitor.js +0 -116
  428. package/dist/features/tui/simple-monitor.js.map +0 -7
  429. package/dist/features/tui/swarm-monitor.js +0 -648
  430. package/dist/features/tui/swarm-monitor.js.map +0 -7
  431. package/dist/features/web/client/stores/task-store.js +0 -26
  432. package/dist/features/web/client/stores/task-store.js.map +0 -7
  433. package/dist/features/web/server/index.js +0 -194
  434. package/dist/features/web/server/index.js.map +0 -7
  435. package/dist/hooks/auto-background.js +0 -151
  436. package/dist/hooks/auto-background.js.map +0 -7
  437. package/dist/hooks/claude-code-whatsapp-hook.js +0 -197
  438. package/dist/hooks/claude-code-whatsapp-hook.js.map +0 -7
  439. package/dist/hooks/config.js +0 -150
  440. package/dist/hooks/config.js.map +0 -7
  441. package/dist/hooks/daemon.js +0 -364
  442. package/dist/hooks/daemon.js.map +0 -7
  443. package/dist/hooks/events.js +0 -58
  444. package/dist/hooks/events.js.map +0 -7
  445. package/dist/hooks/index.js +0 -12
  446. package/dist/hooks/index.js.map +0 -7
  447. package/dist/hooks/linear-task-picker.js +0 -186
  448. package/dist/hooks/linear-task-picker.js.map +0 -7
  449. package/dist/hooks/schemas.js +0 -197
  450. package/dist/hooks/schemas.js.map +0 -7
  451. package/dist/hooks/secure-fs.js +0 -49
  452. package/dist/hooks/secure-fs.js.map +0 -7
  453. package/dist/hooks/security-logger.js +0 -155
  454. package/dist/hooks/security-logger.js.map +0 -7
  455. package/dist/hooks/session-summary.js +0 -222
  456. package/dist/hooks/session-summary.js.map +0 -7
  457. package/dist/hooks/sms-action-runner.js +0 -371
  458. package/dist/hooks/sms-action-runner.js.map +0 -7
  459. package/dist/hooks/sms-notify.js +0 -506
  460. package/dist/hooks/sms-notify.js.map +0 -7
  461. package/dist/hooks/sms-watcher.js +0 -93
  462. package/dist/hooks/sms-watcher.js.map +0 -7
  463. package/dist/hooks/sms-webhook.js +0 -555
  464. package/dist/hooks/sms-webhook.js.map +0 -7
  465. package/dist/hooks/whatsapp-commands.js +0 -479
  466. package/dist/hooks/whatsapp-commands.js.map +0 -7
  467. package/dist/hooks/whatsapp-scheduler.js +0 -317
  468. package/dist/hooks/whatsapp-scheduler.js.map +0 -7
  469. package/dist/hooks/whatsapp-sync.js +0 -409
  470. package/dist/hooks/whatsapp-sync.js.map +0 -7
  471. package/dist/index.js +0 -25
  472. package/dist/index.js.map +0 -7
  473. package/dist/integrations/anthropic/client.js +0 -263
  474. package/dist/integrations/anthropic/client.js.map +0 -7
  475. package/dist/integrations/claude-code/agent-bridge.js +0 -768
  476. package/dist/integrations/claude-code/agent-bridge.js.map +0 -7
  477. package/dist/integrations/claude-code/enhanced-pre-clear-hooks.js +0 -459
  478. package/dist/integrations/claude-code/enhanced-pre-clear-hooks.js.map +0 -7
  479. package/dist/integrations/claude-code/lifecycle-hooks.js +0 -254
  480. package/dist/integrations/claude-code/lifecycle-hooks.js.map +0 -7
  481. package/dist/integrations/claude-code/post-task-hooks.js +0 -545
  482. package/dist/integrations/claude-code/post-task-hooks.js.map +0 -7
  483. package/dist/integrations/claude-code/subagent-client-stub.js +0 -20
  484. package/dist/integrations/claude-code/subagent-client-stub.js.map +0 -7
  485. package/dist/integrations/claude-code/subagent-client.js +0 -511
  486. package/dist/integrations/claude-code/subagent-client.js.map +0 -7
  487. package/dist/integrations/claude-code/task-coordinator.js +0 -360
  488. package/dist/integrations/claude-code/task-coordinator.js.map +0 -7
  489. package/dist/integrations/linear/auth.js +0 -337
  490. package/dist/integrations/linear/auth.js.map +0 -7
  491. package/dist/integrations/linear/auto-sync.js +0 -258
  492. package/dist/integrations/linear/auto-sync.js.map +0 -7
  493. package/dist/integrations/linear/client.js +0 -634
  494. package/dist/integrations/linear/client.js.map +0 -7
  495. package/dist/integrations/linear/config.js +0 -130
  496. package/dist/integrations/linear/config.js.map +0 -7
  497. package/dist/integrations/linear/migration.js +0 -361
  498. package/dist/integrations/linear/migration.js.map +0 -7
  499. package/dist/integrations/linear/oauth-server.js +0 -454
  500. package/dist/integrations/linear/oauth-server.js.map +0 -7
  501. package/dist/integrations/linear/rest-client.js +0 -213
  502. package/dist/integrations/linear/rest-client.js.map +0 -7
  503. package/dist/integrations/linear/sync-manager.js +0 -236
  504. package/dist/integrations/linear/sync-manager.js.map +0 -7
  505. package/dist/integrations/linear/sync-service.js +0 -231
  506. package/dist/integrations/linear/sync-service.js.map +0 -7
  507. package/dist/integrations/linear/sync.js +0 -782
  508. package/dist/integrations/linear/sync.js.map +0 -7
  509. package/dist/integrations/linear/types.js +0 -5
  510. package/dist/integrations/linear/types.js.map +0 -7
  511. package/dist/integrations/linear/unified-sync.js +0 -589
  512. package/dist/integrations/linear/unified-sync.js.map +0 -7
  513. package/dist/integrations/linear/webhook-handler.js +0 -219
  514. package/dist/integrations/linear/webhook-handler.js.map +0 -7
  515. package/dist/integrations/linear/webhook-server.js +0 -218
  516. package/dist/integrations/linear/webhook-server.js.map +0 -7
  517. package/dist/integrations/linear/webhook.js +0 -291
  518. package/dist/integrations/linear/webhook.js.map +0 -7
  519. package/dist/integrations/mcp/handlers/code-execution-handlers.js +0 -266
  520. package/dist/integrations/mcp/handlers/code-execution-handlers.js.map +0 -7
  521. package/dist/integrations/mcp/handlers/context-handlers.js +0 -257
  522. package/dist/integrations/mcp/handlers/context-handlers.js.map +0 -7
  523. package/dist/integrations/mcp/handlers/discovery-handlers.js +0 -497
  524. package/dist/integrations/mcp/handlers/discovery-handlers.js.map +0 -7
  525. package/dist/integrations/mcp/handlers/index.js +0 -166
  526. package/dist/integrations/mcp/handlers/index.js.map +0 -7
  527. package/dist/integrations/mcp/handlers/linear-handlers.js +0 -247
  528. package/dist/integrations/mcp/handlers/linear-handlers.js.map +0 -7
  529. package/dist/integrations/mcp/handlers/skill-handlers.js +0 -529
  530. package/dist/integrations/mcp/handlers/skill-handlers.js.map +0 -7
  531. package/dist/integrations/mcp/handlers/task-handlers.js +0 -239
  532. package/dist/integrations/mcp/handlers/task-handlers.js.map +0 -7
  533. package/dist/integrations/mcp/handlers/trace-handlers.js +0 -308
  534. package/dist/integrations/mcp/handlers/trace-handlers.js.map +0 -7
  535. package/dist/integrations/mcp/index.js +0 -23
  536. package/dist/integrations/mcp/index.js.map +0 -7
  537. package/dist/integrations/mcp/middleware/tool-scoring.js +0 -356
  538. package/dist/integrations/mcp/middleware/tool-scoring.js.map +0 -7
  539. package/dist/integrations/mcp/refactored-server.js +0 -374
  540. package/dist/integrations/mcp/refactored-server.js.map +0 -7
  541. package/dist/integrations/mcp/remote-server.js +0 -682
  542. package/dist/integrations/mcp/remote-server.js.map +0 -7
  543. package/dist/integrations/mcp/schemas.js +0 -147
  544. package/dist/integrations/mcp/schemas.js.map +0 -7
  545. package/dist/integrations/mcp/server.js +0 -1975
  546. package/dist/integrations/mcp/server.js.map +0 -7
  547. package/dist/integrations/mcp/tool-definitions-code.js +0 -125
  548. package/dist/integrations/mcp/tool-definitions-code.js.map +0 -7
  549. package/dist/integrations/mcp/tool-definitions.js +0 -702
  550. package/dist/integrations/mcp/tool-definitions.js.map +0 -7
  551. package/dist/integrations/mcp/trace-test.js +0 -48
  552. package/dist/integrations/mcp/trace-test.js.map +0 -7
  553. package/dist/integrations/pg-aiguide/embedding-provider.js +0 -189
  554. package/dist/integrations/pg-aiguide/embedding-provider.js.map +0 -7
  555. package/dist/integrations/pg-aiguide/semantic-search.js +0 -187
  556. package/dist/integrations/pg-aiguide/semantic-search.js.map +0 -7
  557. package/dist/integrations/pg-aiguide/timescale-analytics.js +0 -224
  558. package/dist/integrations/pg-aiguide/timescale-analytics.js.map +0 -7
  559. package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js +0 -860
  560. package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +0 -7
  561. package/dist/integrations/ralph/context/context-budget-manager.js +0 -301
  562. package/dist/integrations/ralph/context/context-budget-manager.js.map +0 -7
  563. package/dist/integrations/ralph/context/stackmemory-context-loader.js +0 -360
  564. package/dist/integrations/ralph/context/stackmemory-context-loader.js.map +0 -7
  565. package/dist/integrations/ralph/coordination/enhanced-coordination.js +0 -410
  566. package/dist/integrations/ralph/coordination/enhanced-coordination.js.map +0 -7
  567. package/dist/integrations/ralph/index.js +0 -18
  568. package/dist/integrations/ralph/index.js.map +0 -7
  569. package/dist/integrations/ralph/learning/pattern-learner.js +0 -401
  570. package/dist/integrations/ralph/learning/pattern-learner.js.map +0 -7
  571. package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js +0 -448
  572. package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js.map +0 -7
  573. package/dist/integrations/ralph/monitoring/swarm-dashboard.js +0 -294
  574. package/dist/integrations/ralph/monitoring/swarm-dashboard.js.map +0 -7
  575. package/dist/integrations/ralph/monitoring/swarm-registry.js +0 -108
  576. package/dist/integrations/ralph/monitoring/swarm-registry.js.map +0 -7
  577. package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js +0 -463
  578. package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +0 -7
  579. package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js +0 -400
  580. package/dist/integrations/ralph/patterns/compounding-engineering-pattern.js.map +0 -7
  581. package/dist/integrations/ralph/patterns/extended-coherence-sessions.js +0 -473
  582. package/dist/integrations/ralph/patterns/extended-coherence-sessions.js.map +0 -7
  583. package/dist/integrations/ralph/patterns/oracle-worker-pattern.js +0 -388
  584. package/dist/integrations/ralph/patterns/oracle-worker-pattern.js.map +0 -7
  585. package/dist/integrations/ralph/performance/performance-optimizer.js +0 -358
  586. package/dist/integrations/ralph/performance/performance-optimizer.js.map +0 -7
  587. package/dist/integrations/ralph/ralph-integration-demo.js +0 -182
  588. package/dist/integrations/ralph/ralph-integration-demo.js.map +0 -7
  589. package/dist/integrations/ralph/recovery/crash-recovery.js +0 -462
  590. package/dist/integrations/ralph/recovery/crash-recovery.js.map +0 -7
  591. package/dist/integrations/ralph/state/state-reconciler.js +0 -404
  592. package/dist/integrations/ralph/state/state-reconciler.js.map +0 -7
  593. package/dist/integrations/ralph/swarm/git-workflow-manager.js +0 -428
  594. package/dist/integrations/ralph/swarm/git-workflow-manager.js.map +0 -7
  595. package/dist/integrations/ralph/swarm/swarm-coordinator.js +0 -996
  596. package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +0 -7
  597. package/dist/integrations/ralph/types.js +0 -5
  598. package/dist/integrations/ralph/types.js.map +0 -7
  599. package/dist/integrations/ralph/visualization/ralph-debugger.js +0 -585
  600. package/dist/integrations/ralph/visualization/ralph-debugger.js.map +0 -7
  601. package/dist/mcp/stackmemory-mcp-server.js +0 -554
  602. package/dist/mcp/stackmemory-mcp-server.js.map +0 -7
  603. package/dist/middleware/exponential-rate-limiter.js +0 -289
  604. package/dist/middleware/exponential-rate-limiter.js.map +0 -7
  605. package/dist/models/user.model.js +0 -358
  606. package/dist/models/user.model.js.map +0 -7
  607. package/dist/servers/production/auth-middleware.js +0 -528
  608. package/dist/servers/production/auth-middleware.js.map +0 -7
  609. package/dist/servers/railway/config.js +0 -55
  610. package/dist/servers/railway/config.js.map +0 -7
  611. package/dist/servers/railway/index-enhanced.js +0 -160
  612. package/dist/servers/railway/index-enhanced.js.map +0 -7
  613. package/dist/servers/railway/index.js +0 -1349
  614. package/dist/servers/railway/index.js.map +0 -7
  615. package/dist/servers/railway/simple.js +0 -64
  616. package/dist/servers/railway/simple.js.map +0 -7
  617. package/dist/servers/railway/storage-test.js +0 -459
  618. package/dist/servers/railway/storage-test.js.map +0 -7
  619. package/dist/services/config-service.js +0 -65
  620. package/dist/services/config-service.js.map +0 -7
  621. package/dist/services/context-service.js +0 -194
  622. package/dist/services/context-service.js.map +0 -7
  623. package/dist/skills/api-discovery.js +0 -354
  624. package/dist/skills/api-discovery.js.map +0 -7
  625. package/dist/skills/api-skill.js +0 -475
  626. package/dist/skills/api-skill.js.map +0 -7
  627. package/dist/skills/claude-skills.js +0 -1061
  628. package/dist/skills/claude-skills.js.map +0 -7
  629. package/dist/skills/dashboard-launcher.js +0 -216
  630. package/dist/skills/dashboard-launcher.js.map +0 -7
  631. package/dist/skills/recursive-agent-orchestrator.js +0 -575
  632. package/dist/skills/recursive-agent-orchestrator.js.map +0 -7
  633. package/dist/skills/repo-ingestion-skill.js +0 -609
  634. package/dist/skills/repo-ingestion-skill.js.map +0 -7
  635. package/dist/skills/security-secrets-scanner.js +0 -284
  636. package/dist/skills/security-secrets-scanner.js.map +0 -7
  637. package/dist/skills/unified-rlm-orchestrator.js +0 -404
  638. package/dist/skills/unified-rlm-orchestrator.js.map +0 -7
  639. package/dist/types/task.js +0 -5
  640. package/dist/types/task.js.map +0 -7
  641. package/dist/utils/env.js +0 -50
  642. package/dist/utils/env.js.map +0 -7
  643. package/dist/utils/formatting.js +0 -62
  644. package/dist/utils/formatting.js.map +0 -7
  645. package/dist/utils/process-cleanup.js +0 -136
  646. package/dist/utils/process-cleanup.js.map +0 -7
  647. package/dist/validation/schemas.js +0 -222
  648. package/dist/validation/schemas.js.map +0 -7
  649. /package/dist/{core/merge → src/core/extensions}/types.js +0 -0
  650. /package/dist/{core/merge → src/core/extensions}/types.js.map +0 -0
  651. /package/dist/{core → src/integrations/diffmem}/types.js +0 -0
  652. /package/dist/{core → src/integrations/diffmem}/types.js.map +0 -0
@@ -1,701 +0,0 @@
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