cognitive-core 0.2.1 → 0.2.2

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 (331) hide show
  1. package/dist/atlas.d.ts +10 -0
  2. package/dist/atlas.d.ts.map +1 -1
  3. package/dist/atlas.js +65 -0
  4. package/dist/atlas.js.map +1 -1
  5. package/dist/learning/pipeline.d.ts +4 -31
  6. package/dist/learning/pipeline.d.ts.map +1 -1
  7. package/dist/learning/pipeline.js +12 -64
  8. package/dist/learning/pipeline.js.map +1 -1
  9. package/dist/memory/curated-loader.d.ts +21 -4
  10. package/dist/memory/curated-loader.d.ts.map +1 -1
  11. package/dist/memory/curated-loader.js +53 -16
  12. package/dist/memory/curated-loader.js.map +1 -1
  13. package/dist/memory/index.d.ts +2 -1
  14. package/dist/memory/index.d.ts.map +1 -1
  15. package/dist/memory/index.js +3 -1
  16. package/dist/memory/index.js.map +1 -1
  17. package/dist/memory/playbook.d.ts +6 -0
  18. package/dist/memory/playbook.d.ts.map +1 -1
  19. package/dist/memory/playbook.js +15 -0
  20. package/dist/memory/playbook.js.map +1 -1
  21. package/dist/memory/source-resolver.d.ts +120 -0
  22. package/dist/memory/source-resolver.d.ts.map +1 -0
  23. package/dist/memory/source-resolver.js +300 -0
  24. package/dist/memory/source-resolver.js.map +1 -0
  25. package/dist/types/config.d.ts +141 -0
  26. package/dist/types/config.d.ts.map +1 -1
  27. package/dist/types/config.js +40 -0
  28. package/dist/types/config.js.map +1 -1
  29. package/dist/types/index.d.ts +1 -1
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/index.js +1 -1
  32. package/dist/types/index.js.map +1 -1
  33. package/dist/workspace/types.d.ts +12 -54
  34. package/dist/workspace/types.d.ts.map +1 -1
  35. package/dist/workspace/types.js.map +1 -1
  36. package/package.json +2 -2
  37. package/playbooks/compound-engineering/adversarial-review.json +51 -0
  38. package/playbooks/compound-engineering/agent-native-architecture.json +59 -0
  39. package/playbooks/compound-engineering/agent-native-review.json +54 -0
  40. package/playbooks/compound-engineering/api-contract-review.json +52 -0
  41. package/playbooks/compound-engineering/brainstorm-requirements.json +55 -0
  42. package/playbooks/compound-engineering/bug-reproduction.json +62 -0
  43. package/playbooks/compound-engineering/confidence-calibration.json +49 -0
  44. package/playbooks/compound-engineering/correctness-review.json +49 -0
  45. package/playbooks/compound-engineering/data-migration-safety.json +59 -0
  46. package/playbooks/compound-engineering/deployment-verification.json +63 -0
  47. package/playbooks/compound-engineering/error-recovery-patterns.json +53 -0
  48. package/playbooks/compound-engineering/implementation-planning.json +64 -0
  49. package/playbooks/compound-engineering/issue-pattern-analysis.json +53 -0
  50. package/playbooks/compound-engineering/knowledge-compounding.json +63 -0
  51. package/playbooks/compound-engineering/learnings-research.json +54 -0
  52. package/playbooks/compound-engineering/maintainability-review.json +49 -0
  53. package/playbooks/compound-engineering/performance-review.json +54 -0
  54. package/playbooks/compound-engineering/plan-adversarial-review.json +56 -0
  55. package/playbooks/compound-engineering/plan-feasibility-review.json +56 -0
  56. package/playbooks/compound-engineering/project-standards-review.json +52 -0
  57. package/playbooks/compound-engineering/reliability-review.json +53 -0
  58. package/playbooks/compound-engineering/review-orchestration.json +64 -0
  59. package/playbooks/compound-engineering/security-review.json +54 -0
  60. package/playbooks/compound-engineering/systematic-execution.json +64 -0
  61. package/playbooks/compound-engineering/testing-review.json +50 -0
  62. package/src/atlas.ts +96 -0
  63. package/src/memory/curated-loader.ts +69 -16
  64. package/src/memory/index.ts +16 -0
  65. package/src/memory/playbook.ts +19 -0
  66. package/src/memory/source-resolver.ts +422 -0
  67. package/src/types/config.ts +46 -0
  68. package/src/types/index.ts +4 -0
  69. package/src/workspace/types.ts +22 -78
  70. package/tests/integration/curated-sources-e2e.test.ts +502 -0
  71. package/tests/memory/compound-engineering-seed.test.ts +338 -0
  72. package/tests/memory/curated-loader-extended.test.ts +225 -0
  73. package/tests/memory/playbook-quality-validation.test.ts +430 -0
  74. package/tests/memory/source-resolver.test.ts +700 -0
  75. package/.claude/settings.local.json +0 -11
  76. package/dist/learning/llm-extractor.d.ts +0 -88
  77. package/dist/learning/llm-extractor.d.ts.map +0 -1
  78. package/dist/learning/llm-extractor.js +0 -372
  79. package/dist/learning/llm-extractor.js.map +0 -1
  80. package/dist/learning/loop-coordinator.d.ts +0 -61
  81. package/dist/learning/loop-coordinator.d.ts.map +0 -1
  82. package/dist/learning/loop-coordinator.js +0 -96
  83. package/dist/learning/loop-coordinator.js.map +0 -1
  84. package/references/agent-workspace/CLAUDE.md +0 -74
  85. package/references/agent-workspace/README.md +0 -587
  86. package/references/agent-workspace/media/banner.png +0 -0
  87. package/references/agent-workspace/package-lock.json +0 -2061
  88. package/references/agent-workspace/package.json +0 -54
  89. package/references/agent-workspace/src/handle.ts +0 -122
  90. package/references/agent-workspace/src/index.ts +0 -32
  91. package/references/agent-workspace/src/manager.ts +0 -102
  92. package/references/agent-workspace/src/readers/json.ts +0 -71
  93. package/references/agent-workspace/src/readers/markdown.ts +0 -37
  94. package/references/agent-workspace/src/readers/raw.ts +0 -27
  95. package/references/agent-workspace/src/types.ts +0 -68
  96. package/references/agent-workspace/src/validation.ts +0 -93
  97. package/references/agent-workspace/src/writers/json.ts +0 -17
  98. package/references/agent-workspace/src/writers/markdown.ts +0 -27
  99. package/references/agent-workspace/src/writers/raw.ts +0 -22
  100. package/references/agent-workspace/tests/errors.test.ts +0 -652
  101. package/references/agent-workspace/tests/handle.test.ts +0 -144
  102. package/references/agent-workspace/tests/manager.test.ts +0 -124
  103. package/references/agent-workspace/tests/readers.test.ts +0 -205
  104. package/references/agent-workspace/tests/validation.test.ts +0 -196
  105. package/references/agent-workspace/tests/writers.test.ts +0 -108
  106. package/references/agent-workspace/tsconfig.json +0 -20
  107. package/references/agent-workspace/tsup.config.ts +0 -9
  108. package/references/minimem/.claude/settings.json +0 -7
  109. package/references/minimem/.sudocode/issues.jsonl +0 -18
  110. package/references/minimem/.sudocode/specs.jsonl +0 -1
  111. package/references/minimem/CLAUDE.md +0 -310
  112. package/references/minimem/README.md +0 -556
  113. package/references/minimem/claude-plugin/.claude-plugin/plugin.json +0 -10
  114. package/references/minimem/claude-plugin/.mcp.json +0 -7
  115. package/references/minimem/claude-plugin/README.md +0 -158
  116. package/references/minimem/claude-plugin/commands/recall.md +0 -47
  117. package/references/minimem/claude-plugin/commands/remember.md +0 -41
  118. package/references/minimem/claude-plugin/hooks/__tests__/hooks.test.ts +0 -272
  119. package/references/minimem/claude-plugin/hooks/hooks.json +0 -27
  120. package/references/minimem/claude-plugin/hooks/session-end.sh +0 -86
  121. package/references/minimem/claude-plugin/hooks/session-start.sh +0 -85
  122. package/references/minimem/claude-plugin/skills/memory/SKILL.md +0 -108
  123. package/references/minimem/package-lock.json +0 -5373
  124. package/references/minimem/package.json +0 -60
  125. package/references/minimem/scripts/postbuild.js +0 -35
  126. package/references/minimem/src/__tests__/edge-cases.test.ts +0 -371
  127. package/references/minimem/src/__tests__/errors.test.ts +0 -265
  128. package/references/minimem/src/__tests__/helpers.ts +0 -199
  129. package/references/minimem/src/__tests__/internal.test.ts +0 -407
  130. package/references/minimem/src/__tests__/knowledge.test.ts +0 -287
  131. package/references/minimem/src/__tests__/minimem.integration.test.ts +0 -1127
  132. package/references/minimem/src/__tests__/session.test.ts +0 -190
  133. package/references/minimem/src/cli/__tests__/commands.test.ts +0 -759
  134. package/references/minimem/src/cli/commands/__tests__/conflicts.test.ts +0 -141
  135. package/references/minimem/src/cli/commands/append.ts +0 -76
  136. package/references/minimem/src/cli/commands/config.ts +0 -262
  137. package/references/minimem/src/cli/commands/conflicts.ts +0 -413
  138. package/references/minimem/src/cli/commands/daemon.ts +0 -169
  139. package/references/minimem/src/cli/commands/index.ts +0 -12
  140. package/references/minimem/src/cli/commands/init.ts +0 -88
  141. package/references/minimem/src/cli/commands/mcp.ts +0 -177
  142. package/references/minimem/src/cli/commands/push-pull.ts +0 -213
  143. package/references/minimem/src/cli/commands/search.ts +0 -158
  144. package/references/minimem/src/cli/commands/status.ts +0 -84
  145. package/references/minimem/src/cli/commands/sync-init.ts +0 -290
  146. package/references/minimem/src/cli/commands/sync.ts +0 -70
  147. package/references/minimem/src/cli/commands/upsert.ts +0 -197
  148. package/references/minimem/src/cli/config.ts +0 -584
  149. package/references/minimem/src/cli/index.ts +0 -264
  150. package/references/minimem/src/cli/shared.ts +0 -161
  151. package/references/minimem/src/cli/sync/__tests__/central.test.ts +0 -152
  152. package/references/minimem/src/cli/sync/__tests__/conflicts.test.ts +0 -209
  153. package/references/minimem/src/cli/sync/__tests__/daemon.test.ts +0 -118
  154. package/references/minimem/src/cli/sync/__tests__/detection.test.ts +0 -207
  155. package/references/minimem/src/cli/sync/__tests__/integration.test.ts +0 -476
  156. package/references/minimem/src/cli/sync/__tests__/registry.test.ts +0 -363
  157. package/references/minimem/src/cli/sync/__tests__/state.test.ts +0 -255
  158. package/references/minimem/src/cli/sync/__tests__/validation.test.ts +0 -193
  159. package/references/minimem/src/cli/sync/__tests__/watcher.test.ts +0 -178
  160. package/references/minimem/src/cli/sync/central.ts +0 -292
  161. package/references/minimem/src/cli/sync/conflicts.ts +0 -204
  162. package/references/minimem/src/cli/sync/daemon.ts +0 -407
  163. package/references/minimem/src/cli/sync/detection.ts +0 -138
  164. package/references/minimem/src/cli/sync/index.ts +0 -107
  165. package/references/minimem/src/cli/sync/operations.ts +0 -373
  166. package/references/minimem/src/cli/sync/registry.ts +0 -279
  167. package/references/minimem/src/cli/sync/state.ts +0 -355
  168. package/references/minimem/src/cli/sync/validation.ts +0 -206
  169. package/references/minimem/src/cli/sync/watcher.ts +0 -234
  170. package/references/minimem/src/cli/version.ts +0 -34
  171. package/references/minimem/src/core/index.ts +0 -9
  172. package/references/minimem/src/core/indexer.ts +0 -628
  173. package/references/minimem/src/core/searcher.ts +0 -221
  174. package/references/minimem/src/db/schema.ts +0 -183
  175. package/references/minimem/src/db/sqlite-vec.ts +0 -24
  176. package/references/minimem/src/embeddings/__tests__/embeddings.test.ts +0 -431
  177. package/references/minimem/src/embeddings/batch-gemini.ts +0 -392
  178. package/references/minimem/src/embeddings/batch-openai.ts +0 -409
  179. package/references/minimem/src/embeddings/embeddings.ts +0 -434
  180. package/references/minimem/src/index.ts +0 -109
  181. package/references/minimem/src/internal.ts +0 -299
  182. package/references/minimem/src/minimem.ts +0 -1276
  183. package/references/minimem/src/search/__tests__/hybrid.test.ts +0 -247
  184. package/references/minimem/src/search/graph.ts +0 -234
  185. package/references/minimem/src/search/hybrid.ts +0 -151
  186. package/references/minimem/src/search/search.ts +0 -256
  187. package/references/minimem/src/server/__tests__/mcp.test.ts +0 -341
  188. package/references/minimem/src/server/__tests__/tools.test.ts +0 -364
  189. package/references/minimem/src/server/mcp.ts +0 -326
  190. package/references/minimem/src/server/tools.ts +0 -720
  191. package/references/minimem/src/session.ts +0 -460
  192. package/references/minimem/tsconfig.json +0 -19
  193. package/references/minimem/tsup.config.ts +0 -26
  194. package/references/minimem/vitest.config.ts +0 -24
  195. package/references/sessionlog/.husky/pre-commit +0 -1
  196. package/references/sessionlog/.lintstagedrc.json +0 -4
  197. package/references/sessionlog/.prettierignore +0 -4
  198. package/references/sessionlog/.prettierrc.json +0 -11
  199. package/references/sessionlog/LICENSE +0 -21
  200. package/references/sessionlog/README.md +0 -453
  201. package/references/sessionlog/eslint.config.js +0 -58
  202. package/references/sessionlog/package-lock.json +0 -3672
  203. package/references/sessionlog/package.json +0 -65
  204. package/references/sessionlog/src/__tests__/agent-hooks.test.ts +0 -570
  205. package/references/sessionlog/src/__tests__/agent-registry.test.ts +0 -127
  206. package/references/sessionlog/src/__tests__/claude-code-hooks.test.ts +0 -225
  207. package/references/sessionlog/src/__tests__/claude-generator.test.ts +0 -46
  208. package/references/sessionlog/src/__tests__/commit-msg.test.ts +0 -86
  209. package/references/sessionlog/src/__tests__/cursor-agent.test.ts +0 -224
  210. package/references/sessionlog/src/__tests__/e2e-live.test.ts +0 -890
  211. package/references/sessionlog/src/__tests__/event-log.test.ts +0 -183
  212. package/references/sessionlog/src/__tests__/flush-sentinel.test.ts +0 -105
  213. package/references/sessionlog/src/__tests__/gemini-agent.test.ts +0 -375
  214. package/references/sessionlog/src/__tests__/git-hooks.test.ts +0 -78
  215. package/references/sessionlog/src/__tests__/hook-managers.test.ts +0 -121
  216. package/references/sessionlog/src/__tests__/lifecycle-tasks.test.ts +0 -759
  217. package/references/sessionlog/src/__tests__/opencode-agent.test.ts +0 -338
  218. package/references/sessionlog/src/__tests__/redaction.test.ts +0 -136
  219. package/references/sessionlog/src/__tests__/session-repo.test.ts +0 -353
  220. package/references/sessionlog/src/__tests__/session-store.test.ts +0 -166
  221. package/references/sessionlog/src/__tests__/setup-ccweb.test.ts +0 -466
  222. package/references/sessionlog/src/__tests__/skill-live.test.ts +0 -461
  223. package/references/sessionlog/src/__tests__/summarize.test.ts +0 -348
  224. package/references/sessionlog/src/__tests__/task-plan-e2e.test.ts +0 -610
  225. package/references/sessionlog/src/__tests__/task-plan-live.test.ts +0 -632
  226. package/references/sessionlog/src/__tests__/transcript-timestamp.test.ts +0 -121
  227. package/references/sessionlog/src/__tests__/types.test.ts +0 -166
  228. package/references/sessionlog/src/__tests__/utils.test.ts +0 -333
  229. package/references/sessionlog/src/__tests__/validation.test.ts +0 -103
  230. package/references/sessionlog/src/__tests__/worktree.test.ts +0 -57
  231. package/references/sessionlog/src/agent/agents/claude-code.ts +0 -1089
  232. package/references/sessionlog/src/agent/agents/cursor.ts +0 -361
  233. package/references/sessionlog/src/agent/agents/gemini-cli.ts +0 -632
  234. package/references/sessionlog/src/agent/agents/opencode.ts +0 -540
  235. package/references/sessionlog/src/agent/registry.ts +0 -143
  236. package/references/sessionlog/src/agent/session-types.ts +0 -113
  237. package/references/sessionlog/src/agent/types.ts +0 -220
  238. package/references/sessionlog/src/cli.ts +0 -597
  239. package/references/sessionlog/src/commands/clean.ts +0 -133
  240. package/references/sessionlog/src/commands/disable.ts +0 -84
  241. package/references/sessionlog/src/commands/doctor.ts +0 -145
  242. package/references/sessionlog/src/commands/enable.ts +0 -202
  243. package/references/sessionlog/src/commands/explain.ts +0 -261
  244. package/references/sessionlog/src/commands/reset.ts +0 -105
  245. package/references/sessionlog/src/commands/resume.ts +0 -180
  246. package/references/sessionlog/src/commands/rewind.ts +0 -195
  247. package/references/sessionlog/src/commands/setup-ccweb.ts +0 -275
  248. package/references/sessionlog/src/commands/status.ts +0 -172
  249. package/references/sessionlog/src/config.ts +0 -165
  250. package/references/sessionlog/src/events/event-log.ts +0 -126
  251. package/references/sessionlog/src/git-operations.ts +0 -558
  252. package/references/sessionlog/src/hooks/git-hooks.ts +0 -165
  253. package/references/sessionlog/src/hooks/lifecycle.ts +0 -391
  254. package/references/sessionlog/src/index.ts +0 -650
  255. package/references/sessionlog/src/security/redaction.ts +0 -283
  256. package/references/sessionlog/src/session/state-machine.ts +0 -452
  257. package/references/sessionlog/src/store/checkpoint-store.ts +0 -509
  258. package/references/sessionlog/src/store/native-store.ts +0 -173
  259. package/references/sessionlog/src/store/provider-types.ts +0 -99
  260. package/references/sessionlog/src/store/session-store.ts +0 -266
  261. package/references/sessionlog/src/strategy/attribution.ts +0 -296
  262. package/references/sessionlog/src/strategy/common.ts +0 -207
  263. package/references/sessionlog/src/strategy/content-overlap.ts +0 -228
  264. package/references/sessionlog/src/strategy/manual-commit.ts +0 -988
  265. package/references/sessionlog/src/strategy/types.ts +0 -279
  266. package/references/sessionlog/src/summarize/claude-generator.ts +0 -115
  267. package/references/sessionlog/src/summarize/summarize.ts +0 -432
  268. package/references/sessionlog/src/types.ts +0 -508
  269. package/references/sessionlog/src/utils/chunk-files.ts +0 -49
  270. package/references/sessionlog/src/utils/commit-message.ts +0 -65
  271. package/references/sessionlog/src/utils/detect-agent.ts +0 -36
  272. package/references/sessionlog/src/utils/hook-managers.ts +0 -125
  273. package/references/sessionlog/src/utils/ide-tags.ts +0 -32
  274. package/references/sessionlog/src/utils/paths.ts +0 -79
  275. package/references/sessionlog/src/utils/preview-rewind.ts +0 -80
  276. package/references/sessionlog/src/utils/rewind-conflict.ts +0 -121
  277. package/references/sessionlog/src/utils/shadow-branch.ts +0 -109
  278. package/references/sessionlog/src/utils/string-utils.ts +0 -46
  279. package/references/sessionlog/src/utils/todo-extract.ts +0 -188
  280. package/references/sessionlog/src/utils/trailers.ts +0 -187
  281. package/references/sessionlog/src/utils/transcript-parse.ts +0 -177
  282. package/references/sessionlog/src/utils/transcript-timestamp.ts +0 -59
  283. package/references/sessionlog/src/utils/tree-ops.ts +0 -219
  284. package/references/sessionlog/src/utils/tty.ts +0 -72
  285. package/references/sessionlog/src/utils/validation.ts +0 -65
  286. package/references/sessionlog/src/utils/worktree.ts +0 -58
  287. package/references/sessionlog/src/wire-types.ts +0 -59
  288. package/references/sessionlog/templates/setup-env.sh +0 -153
  289. package/references/sessionlog/tsconfig.json +0 -18
  290. package/references/sessionlog/vitest.config.ts +0 -12
  291. package/references/skill-tree/.claude/settings.json +0 -6
  292. package/references/skill-tree/.sudocode/issues.jsonl +0 -19
  293. package/references/skill-tree/.sudocode/specs.jsonl +0 -3
  294. package/references/skill-tree/CLAUDE.md +0 -126
  295. package/references/skill-tree/README.md +0 -372
  296. package/references/skill-tree/docs/GAPS_v1.md +0 -221
  297. package/references/skill-tree/docs/INTEGRATION_PLAN.md +0 -467
  298. package/references/skill-tree/docs/TODOS.md +0 -91
  299. package/references/skill-tree/docs/anthropic_skill_guide.md +0 -1364
  300. package/references/skill-tree/docs/design/federated-skill-trees.md +0 -524
  301. package/references/skill-tree/docs/design/multi-agent-sync.md +0 -759
  302. package/references/skill-tree/docs/scraper/BRAINSTORM.md +0 -583
  303. package/references/skill-tree/docs/scraper/POC_PLAN.md +0 -420
  304. package/references/skill-tree/docs/scraper/README.md +0 -170
  305. package/references/skill-tree/examples/basic-usage.ts +0 -164
  306. package/references/skill-tree/package-lock.json +0 -1852
  307. package/references/skill-tree/package.json +0 -66
  308. package/references/skill-tree/scraper/README.md +0 -123
  309. package/references/skill-tree/scraper/docs/DESIGN.md +0 -683
  310. package/references/skill-tree/scraper/docs/PLAN.md +0 -336
  311. package/references/skill-tree/scraper/drizzle.config.ts +0 -10
  312. package/references/skill-tree/scraper/package-lock.json +0 -6329
  313. package/references/skill-tree/scraper/package.json +0 -68
  314. package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-description.md +0 -7
  315. package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-name.md +0 -7
  316. package/references/skill-tree/scraper/test/fixtures/minimal-skill/SKILL.md +0 -27
  317. package/references/skill-tree/scraper/test/fixtures/skill-json/SKILL.json +0 -21
  318. package/references/skill-tree/scraper/test/fixtures/skill-with-meta/SKILL.md +0 -54
  319. package/references/skill-tree/scraper/test/fixtures/skill-with-meta/_meta.json +0 -24
  320. package/references/skill-tree/scraper/test/fixtures/valid-skill/SKILL.md +0 -93
  321. package/references/skill-tree/scraper/test/fixtures/valid-skill/_meta.json +0 -22
  322. package/references/skill-tree/scraper/tsup.config.ts +0 -14
  323. package/references/skill-tree/scraper/vitest.config.ts +0 -17
  324. package/references/skill-tree/scripts/convert-to-vitest.ts +0 -166
  325. package/references/skill-tree/skills/skill-writer/SKILL.md +0 -339
  326. package/references/skill-tree/skills/skill-writer/references/examples.md +0 -326
  327. package/references/skill-tree/skills/skill-writer/references/patterns.md +0 -210
  328. package/references/skill-tree/skills/skill-writer/references/quality-checklist.md +0 -123
  329. package/references/skill-tree/test/run-all.ts +0 -106
  330. package/references/skill-tree/test/utils.ts +0 -128
  331. package/references/skill-tree/vitest.config.ts +0 -16
@@ -1,759 +0,0 @@
1
- /**
2
- * Tests for CLI commands
3
- *
4
- * These tests exercise the CLI command functions directly.
5
- * Uses mock fetch for deterministic embeddings.
6
- *
7
- * Run with: npm run test:cli
8
- */
9
-
10
- import fs from "node:fs/promises";
11
- import os from "node:os";
12
- import path from "node:path";
13
- import { after, afterEach, before, beforeEach, describe, it } from "node:test";
14
- import assert from "node:assert";
15
-
16
- import { init } from "../commands/init.js";
17
- import { search } from "../commands/search.js";
18
- import { sync } from "../commands/sync.js";
19
- import { status } from "../commands/status.js";
20
- import { append } from "../commands/append.js";
21
- import { upsert } from "../commands/upsert.js";
22
- import { config } from "../commands/config.js";
23
- import { ensureGlobalInitialized } from "../commands/mcp.js";
24
- import {
25
- isInitialized,
26
- expandPath,
27
- getXdgConfigPath,
28
- loadXdgConfig,
29
- saveXdgConfig,
30
- getMachineId,
31
- getSyncConfig,
32
- getDefaultSyncConfig,
33
- getDefaultGlobalSyncConfig,
34
- resolveMemoryDirs,
35
- getDirName,
36
- type GlobalConfig,
37
- } from "../config.js";
38
- import { createMockFetch, captureConsole } from "../../__tests__/helpers.js";
39
-
40
- describe("CLI Commands", () => {
41
- let tempDir: string;
42
- let originalFetch: typeof fetch;
43
- let mockFetch: ReturnType<typeof createMockFetch>;
44
- let originalExit: typeof process.exit;
45
- let exitCode: number | undefined;
46
-
47
- before(() => {
48
- // Mock fetch globally
49
- originalFetch = globalThis.fetch;
50
- mockFetch = createMockFetch();
51
- globalThis.fetch = mockFetch as unknown as typeof fetch;
52
-
53
- // Set API key for tests
54
- process.env.OPENAI_API_KEY = "test-key";
55
-
56
- // Mock process.exit to prevent test from exiting
57
- originalExit = process.exit;
58
- process.exit = ((code?: number) => {
59
- exitCode = code;
60
- throw new Error(`process.exit(${code})`);
61
- }) as typeof process.exit;
62
- });
63
-
64
- after(() => {
65
- globalThis.fetch = originalFetch;
66
- delete process.env.OPENAI_API_KEY;
67
- process.exit = originalExit;
68
- });
69
-
70
- beforeEach(async () => {
71
- // Create fresh temp directory for each test
72
- tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "minimem-cli-test-"));
73
- exitCode = undefined;
74
- });
75
-
76
- afterEach(async () => {
77
- // Clean up temp directory
78
- await fs.rm(tempDir, { recursive: true, force: true });
79
- });
80
-
81
- describe("init command", () => {
82
- it("should initialize a new memory directory", async () => {
83
- const capture = captureConsole();
84
-
85
- try {
86
- await init(tempDir, { global: false, force: false });
87
- } finally {
88
- capture.restore();
89
- }
90
-
91
- // Check files were created
92
- const memoryMd = await fs.readFile(path.join(tempDir, "MEMORY.md"), "utf-8");
93
- assert.ok(memoryMd.includes("# Memory"), "MEMORY.md should have header");
94
-
95
- const configPath = path.join(tempDir, ".minimem", "config.json");
96
- const config = JSON.parse(await fs.readFile(configPath, "utf-8"));
97
- assert.strictEqual(config.embedding.provider, "auto");
98
-
99
- const memoryDir = await fs.stat(path.join(tempDir, "memory"));
100
- assert.ok(memoryDir.isDirectory(), "memory/ directory should exist");
101
-
102
- // Check output
103
- assert.ok(capture.logs.some(l => l.includes("Initializing")));
104
- assert.ok(capture.logs.some(l => l.includes("Done!")));
105
- });
106
-
107
- it("should not reinitialize without --force", async () => {
108
- // Initialize first
109
- await init(tempDir, { global: false, force: false });
110
-
111
- const capture = captureConsole();
112
- try {
113
- await init(tempDir, { global: false, force: false });
114
- } finally {
115
- capture.restore();
116
- }
117
-
118
- // Should indicate already initialized (logs to stdout, not stderr)
119
- assert.ok(capture.logs.some(l => l.includes("Already initialized")));
120
- });
121
-
122
- it("should reinitialize with --force", async () => {
123
- // Initialize first
124
- await init(tempDir, { global: false, force: false });
125
-
126
- // Modify MEMORY.md
127
- await fs.writeFile(path.join(tempDir, "MEMORY.md"), "Custom content");
128
-
129
- const capture = captureConsole();
130
- try {
131
- await init(tempDir, { global: false, force: true });
132
- } finally {
133
- capture.restore();
134
- }
135
-
136
- // Check MEMORY.md was NOT overwritten (force only resets config)
137
- const memoryMd = await fs.readFile(path.join(tempDir, "MEMORY.md"), "utf-8");
138
- assert.strictEqual(memoryMd, "Custom content");
139
-
140
- assert.ok(capture.logs.some(l => l.includes("Done!")));
141
- });
142
- });
143
-
144
- describe("upsert command", () => {
145
- beforeEach(async () => {
146
- // Initialize memory directory
147
- await init(tempDir, { global: false, force: false });
148
- });
149
-
150
- it("should create a new file", async () => {
151
- const capture = captureConsole();
152
-
153
- try {
154
- await upsert("test-note.md", "# Test Note\n\nThis is a test.", { dir: tempDir });
155
- } finally {
156
- capture.restore();
157
- }
158
-
159
- const content = await fs.readFile(path.join(tempDir, "test-note.md"), "utf-8");
160
- assert.strictEqual(content, "# Test Note\n\nThis is a test.");
161
- assert.ok(capture.logs.some(l => l.includes("Created")));
162
- });
163
-
164
- it("should update an existing file", async () => {
165
- // Create file first
166
- await fs.writeFile(path.join(tempDir, "existing.md"), "Old content");
167
-
168
- const capture = captureConsole();
169
-
170
- try {
171
- await upsert("existing.md", "New content", { dir: tempDir });
172
- } finally {
173
- capture.restore();
174
- }
175
-
176
- const content = await fs.readFile(path.join(tempDir, "existing.md"), "utf-8");
177
- assert.strictEqual(content, "New content");
178
- assert.ok(capture.logs.some(l => l.includes("Updated")));
179
- });
180
-
181
- it("should create file in memory/ subdirectory", async () => {
182
- const capture = captureConsole();
183
-
184
- try {
185
- await upsert("memory/notes.md", "# Notes", { dir: tempDir });
186
- } finally {
187
- capture.restore();
188
- }
189
-
190
- const content = await fs.readFile(path.join(tempDir, "memory", "notes.md"), "utf-8");
191
- assert.strictEqual(content, "# Notes");
192
- });
193
-
194
- it("should reject paths outside memory directory", async () => {
195
- const capture = captureConsole();
196
-
197
- try {
198
- await upsert("/tmp/outside.md", "Bad content", { dir: tempDir });
199
- assert.fail("Should have exited");
200
- } catch (e) {
201
- // Expected
202
- } finally {
203
- capture.restore();
204
- }
205
-
206
- assert.ok(capture.errors.some(l => l.includes("must be within")));
207
- });
208
- });
209
-
210
- describe("append command", () => {
211
- beforeEach(async () => {
212
- await init(tempDir, { global: false, force: false });
213
- });
214
-
215
- it("should append to today's daily log", async () => {
216
- const capture = captureConsole();
217
-
218
- try {
219
- await append("Test entry 1", { dir: tempDir });
220
- await append("Test entry 2", { dir: tempDir });
221
- } finally {
222
- capture.restore();
223
- }
224
-
225
- // Check today's log file
226
- const today = new Date().toISOString().split("T")[0];
227
- const logPath = path.join(tempDir, "memory", `${today}.md`);
228
- const content = await fs.readFile(logPath, "utf-8");
229
-
230
- assert.ok(content.includes("Test entry 1"));
231
- assert.ok(content.includes("Test entry 2"));
232
- });
233
-
234
- it("should append to specific file with --file", async () => {
235
- const capture = captureConsole();
236
-
237
- try {
238
- // Must use valid memory path (memory/*.md)
239
- await append("Custom entry", { dir: tempDir, file: "memory/custom-log.md" });
240
- } finally {
241
- capture.restore();
242
- }
243
-
244
- const content = await fs.readFile(path.join(tempDir, "memory", "custom-log.md"), "utf-8");
245
- assert.ok(content.includes("Custom entry"));
246
- });
247
- });
248
-
249
- describe("sync command", () => {
250
- beforeEach(async () => {
251
- await init(tempDir, { global: false, force: false });
252
-
253
- // Add some content to index
254
- await fs.writeFile(
255
- path.join(tempDir, "MEMORY.md"),
256
- "# Memory\n\nImportant project decisions here."
257
- );
258
- await fs.writeFile(
259
- path.join(tempDir, "memory", "notes.md"),
260
- "# Notes\n\nMeeting notes about the API design."
261
- );
262
- });
263
-
264
- it("should sync memory files", async () => {
265
- const capture = captureConsole();
266
-
267
- try {
268
- await sync({ dir: tempDir, force: false });
269
- } finally {
270
- capture.restore();
271
- }
272
-
273
- assert.ok(capture.logs.some(l => l.includes("Syncing")));
274
- assert.ok(capture.logs.some(l => l.includes("Files:") || l.includes("Chunks:")));
275
- });
276
-
277
- it("should force full re-index with --force", async () => {
278
- // First sync
279
- await sync({ dir: tempDir, force: false });
280
-
281
- const capture = captureConsole();
282
-
283
- try {
284
- await sync({ dir: tempDir, force: true });
285
- } finally {
286
- capture.restore();
287
- }
288
-
289
- // Force sync should complete and show results
290
- assert.ok(capture.logs.some(l => l.includes("Sync complete")));
291
- assert.ok(capture.logs.some(l => l.includes("Files:")));
292
- });
293
- });
294
-
295
- describe("status command", () => {
296
- beforeEach(async () => {
297
- await init(tempDir, { global: false, force: false });
298
- await fs.writeFile(
299
- path.join(tempDir, "MEMORY.md"),
300
- "# Memory\n\nTest content."
301
- );
302
- });
303
-
304
- it("should show index status", async () => {
305
- const capture = captureConsole();
306
-
307
- try {
308
- await status({ dir: tempDir });
309
- } finally {
310
- capture.restore();
311
- }
312
-
313
- assert.ok(capture.logs.some(l => l.includes("Provider") || l.includes("provider")));
314
- assert.ok(capture.logs.some(l => l.includes("Files") || l.includes("files")));
315
- });
316
-
317
- it("should output JSON with --json flag", async () => {
318
- const capture = captureConsole();
319
-
320
- try {
321
- await status({ dir: tempDir, json: true });
322
- } finally {
323
- capture.restore();
324
- }
325
-
326
- // Should have valid JSON output
327
- const jsonOutput = capture.logs.find(l => l.startsWith("{"));
328
- assert.ok(jsonOutput, "Should have JSON output");
329
-
330
- const parsed = JSON.parse(jsonOutput);
331
- assert.ok("provider" in parsed || "files" in parsed || "chunks" in parsed);
332
- });
333
- });
334
-
335
- describe("search command", () => {
336
- beforeEach(async () => {
337
- await init(tempDir, { global: false, force: false });
338
-
339
- // Create searchable content
340
- await fs.writeFile(
341
- path.join(tempDir, "MEMORY.md"),
342
- `# Memory
343
-
344
- ## Project Decisions
345
- We decided to use PostgreSQL for the database.
346
- The API will use REST endpoints.
347
-
348
- ## Meeting Notes
349
- Important meeting about project planning.
350
- `
351
- );
352
-
353
- await fs.writeFile(
354
- path.join(tempDir, "memory", "bugs.md"),
355
- `# Bug Tracker
356
-
357
- ## Bug #1: Login Error
358
- Users report login errors when password contains special characters.
359
- This is an urgent bug fix needed.
360
- `
361
- );
362
-
363
- // Sync to index the content
364
- await sync({ dir: tempDir, force: false });
365
- });
366
-
367
- it("should search memory files", async () => {
368
- const capture = captureConsole();
369
-
370
- try {
371
- await search("database decision", { dir: [tempDir] });
372
- } finally {
373
- capture.restore();
374
- }
375
-
376
- // Should find results
377
- assert.ok(
378
- capture.logs.some(l => l.includes("result") || l.includes("%")),
379
- "Should show search results"
380
- );
381
- });
382
-
383
- it("should output JSON with --json flag", async () => {
384
- const capture = captureConsole();
385
-
386
- try {
387
- await search("project", { dir: [tempDir], json: true });
388
- } finally {
389
- capture.restore();
390
- }
391
-
392
- const jsonOutput = capture.logs.find(l => l.startsWith("["));
393
- assert.ok(jsonOutput, "Should have JSON array output");
394
-
395
- const results = JSON.parse(jsonOutput);
396
- assert.ok(Array.isArray(results));
397
- });
398
-
399
- it("should respect --max option", async () => {
400
- const capture = captureConsole();
401
-
402
- try {
403
- await search("project", { dir: [tempDir], max: "1" });
404
- } finally {
405
- capture.restore();
406
- }
407
-
408
- // Count result entries (lines with percentage scores)
409
- const resultLines = capture.logs.filter(l => l.match(/\[\d+\.\d+%\]/));
410
- assert.ok(resultLines.length <= 1, "Should have at most 1 result");
411
- });
412
-
413
- it("should search multiple directories", async () => {
414
- // Create second memory directory
415
- const tempDir2 = await fs.mkdtemp(path.join(os.tmpdir(), "minimem-cli-test2-"));
416
-
417
- try {
418
- await init(tempDir2, { global: false, force: false });
419
- await fs.writeFile(
420
- path.join(tempDir2, "MEMORY.md"),
421
- "# Second Memory\n\nDifferent project notes about testing."
422
- );
423
- await sync({ dir: tempDir2, force: false });
424
-
425
- const capture = captureConsole();
426
-
427
- try {
428
- await search("project", { dir: [tempDir, tempDir2] });
429
- } finally {
430
- capture.restore();
431
- }
432
-
433
- // Should mention searching multiple directories
434
- assert.ok(
435
- capture.logs.some(l => l.includes("directories") || l.includes("result")),
436
- "Should search across directories"
437
- );
438
- } finally {
439
- await fs.rm(tempDir2, { recursive: true, force: true });
440
- }
441
- });
442
-
443
- it("should warn about uninitialized directories", async () => {
444
- const capture = captureConsole();
445
- const nonExistent = path.join(tempDir, "nonexistent");
446
-
447
- try {
448
- await search("test", { dir: [tempDir, nonExistent] });
449
- } finally {
450
- capture.restore();
451
- }
452
-
453
- assert.ok(
454
- capture.errors.some(l => l.includes("not initialized") || l.includes("skipping")),
455
- "Should warn about uninitialized directory"
456
- );
457
- });
458
- });
459
-
460
- describe("mcp command helpers", () => {
461
- describe("resolveMemoryDirs", () => {
462
- it("should use current directory by default", () => {
463
- const dirs = resolveMemoryDirs({});
464
- assert.strictEqual(dirs.length, 1);
465
- assert.strictEqual(dirs[0], process.cwd());
466
- });
467
-
468
- it("should use specified directories", () => {
469
- const dirs = resolveMemoryDirs({ dir: ["/path/one", "/path/two"] });
470
- assert.strictEqual(dirs.length, 2);
471
- assert.ok(dirs[0].endsWith("one"));
472
- assert.ok(dirs[1].endsWith("two"));
473
- });
474
-
475
- it("should add global directory with --global flag", () => {
476
- const dirs = resolveMemoryDirs({ global: true });
477
- assert.strictEqual(dirs.length, 1);
478
- assert.ok(dirs[0].endsWith(".minimem"), "Should include global directory");
479
- });
480
-
481
- it("should combine --dir and --global", () => {
482
- const dirs = resolveMemoryDirs({ dir: ["/path/project"], global: true });
483
- assert.strictEqual(dirs.length, 2);
484
- assert.ok(dirs[0].endsWith("project"));
485
- assert.ok(dirs[1].endsWith(".minimem"));
486
- });
487
-
488
- it("should not duplicate global directory", () => {
489
- const globalPath = path.join(os.homedir(), ".minimem");
490
- const dirs = resolveMemoryDirs({ dir: [globalPath], global: true });
491
- assert.strictEqual(dirs.length, 1);
492
- assert.strictEqual(dirs[0], globalPath);
493
- });
494
- });
495
-
496
- describe("getDirName", () => {
497
- it("should return 'global' for ~/.minimem", () => {
498
- const globalDir = path.join(os.homedir(), ".minimem");
499
- assert.strictEqual(getDirName(globalDir), "global");
500
- });
501
-
502
- it("should return directory name for regular paths", () => {
503
- assert.strictEqual(getDirName("/path/to/my-project"), "my-project");
504
- });
505
-
506
- it("should include parent for hidden directories", () => {
507
- const name = getDirName("/path/to/project/.hidden");
508
- assert.ok(name.includes("project"));
509
- assert.ok(name.includes(".hidden"));
510
- });
511
- });
512
-
513
- describe("ensureGlobalInitialized", () => {
514
- it("should create global directory structure", async () => {
515
- const fakeGlobalDir = path.join(tempDir, ".fake-minimem");
516
-
517
- const capture = captureConsole();
518
- try {
519
- await ensureGlobalInitialized(fakeGlobalDir);
520
- } finally {
521
- capture.restore();
522
- }
523
-
524
- // Check directory was created
525
- assert.ok(await isInitialized(fakeGlobalDir), "Should be initialized");
526
-
527
- // Check MEMORY.md exists with global template
528
- const memoryMd = await fs.readFile(path.join(fakeGlobalDir, "MEMORY.md"), "utf-8");
529
- assert.ok(memoryMd.includes("Global Memory"), "Should have global template");
530
-
531
- // Check config exists
532
- const configPath = path.join(fakeGlobalDir, ".minimem", "config.json");
533
- const configData = JSON.parse(await fs.readFile(configPath, "utf-8"));
534
- assert.strictEqual(configData.embedding.provider, "auto");
535
-
536
- // Check .gitignore exists
537
- const gitignore = await fs.readFile(
538
- path.join(fakeGlobalDir, ".minimem", ".gitignore"),
539
- "utf-8"
540
- );
541
- assert.ok(gitignore.includes("index.db"));
542
-
543
- // Check output messages
544
- assert.ok(capture.errors.some(l => l.includes("Auto-initializing")));
545
- assert.ok(capture.errors.some(l => l.includes("Created")));
546
- });
547
-
548
- it("should not overwrite existing MEMORY.md", async () => {
549
- const fakeGlobalDir = path.join(tempDir, ".fake-minimem2");
550
-
551
- // Pre-create with custom content
552
- await fs.mkdir(fakeGlobalDir, { recursive: true });
553
- await fs.writeFile(path.join(fakeGlobalDir, "MEMORY.md"), "My custom content");
554
-
555
- const capture = captureConsole();
556
- try {
557
- await ensureGlobalInitialized(fakeGlobalDir);
558
- } finally {
559
- capture.restore();
560
- }
561
-
562
- // Check MEMORY.md was preserved
563
- const memoryMd = await fs.readFile(path.join(fakeGlobalDir, "MEMORY.md"), "utf-8");
564
- assert.strictEqual(memoryMd, "My custom content", "Should preserve existing MEMORY.md");
565
- });
566
- });
567
- });
568
-
569
- describe("config utilities", () => {
570
- describe("expandPath", () => {
571
- it("should expand ~ to home directory", () => {
572
- const expanded = expandPath("~/test/path");
573
- assert.strictEqual(expanded, path.join(os.homedir(), "test/path"));
574
- });
575
-
576
- it("should expand lone ~", () => {
577
- const expanded = expandPath("~");
578
- assert.strictEqual(expanded, os.homedir());
579
- });
580
-
581
- it("should not modify paths without ~", () => {
582
- const expanded = expandPath("/absolute/path");
583
- assert.strictEqual(expanded, "/absolute/path");
584
- });
585
-
586
- it("should not expand ~ in the middle of path", () => {
587
- const expanded = expandPath("/some/~path");
588
- assert.strictEqual(expanded, "/some/~path");
589
- });
590
- });
591
-
592
- describe("getDefaultSyncConfig", () => {
593
- it("should return default sync configuration", () => {
594
- const defaults = getDefaultSyncConfig();
595
- assert.strictEqual(defaults.enabled, false);
596
- assert.deepStrictEqual(defaults.include, ["MEMORY.md", "memory/**/*.md"]);
597
- assert.deepStrictEqual(defaults.exclude, []);
598
- });
599
- });
600
-
601
- describe("getDefaultGlobalSyncConfig", () => {
602
- it("should return default global sync configuration", () => {
603
- const defaults = getDefaultGlobalSyncConfig();
604
- assert.strictEqual(defaults.conflictStrategy, "keep-both");
605
- assert.strictEqual(defaults.autoSync, false);
606
- assert.strictEqual(defaults.autoCommit, false);
607
- });
608
- });
609
- });
610
-
611
- describe("hooks config", () => {
612
- beforeEach(async () => {
613
- await init(tempDir, { global: false, force: false });
614
- });
615
-
616
- it("should set hooks.sessionStart via config command", async () => {
617
- const capture = captureConsole();
618
-
619
- try {
620
- await config({ dir: tempDir, set: "hooks.sessionStart=true" });
621
- } finally {
622
- capture.restore();
623
- }
624
-
625
- const configPath = path.join(tempDir, ".minimem", "config.json");
626
- const savedConfig = JSON.parse(await fs.readFile(configPath, "utf-8"));
627
- assert.strictEqual(savedConfig.hooks?.sessionStart, true);
628
- });
629
-
630
- it("should set hooks.sessionEnd via config command", async () => {
631
- const capture = captureConsole();
632
-
633
- try {
634
- await config({ dir: tempDir, set: "hooks.sessionEnd=true" });
635
- } finally {
636
- capture.restore();
637
- }
638
-
639
- const configPath = path.join(tempDir, ".minimem", "config.json");
640
- const savedConfig = JSON.parse(await fs.readFile(configPath, "utf-8"));
641
- assert.strictEqual(savedConfig.hooks?.sessionEnd, true);
642
- });
643
-
644
- it("should disable hooks via config command", async () => {
645
- // First enable
646
- await config({ dir: tempDir, set: "hooks.sessionStart=true" });
647
-
648
- const capture = captureConsole();
649
-
650
- try {
651
- await config({ dir: tempDir, set: "hooks.sessionStart=false" });
652
- } finally {
653
- capture.restore();
654
- }
655
-
656
- const configPath = path.join(tempDir, ".minimem", "config.json");
657
- const savedConfig = JSON.parse(await fs.readFile(configPath, "utf-8"));
658
- assert.strictEqual(savedConfig.hooks?.sessionStart, false);
659
- });
660
-
661
- it("should set both hooks independently", async () => {
662
- const capture = captureConsole();
663
-
664
- try {
665
- await config({ dir: tempDir, set: "hooks.sessionStart=true" });
666
- await config({ dir: tempDir, set: "hooks.sessionEnd=false" });
667
- } finally {
668
- capture.restore();
669
- }
670
-
671
- const configPath = path.join(tempDir, ".minimem", "config.json");
672
- const savedConfig = JSON.parse(await fs.readFile(configPath, "utf-8"));
673
- assert.strictEqual(savedConfig.hooks?.sessionStart, true);
674
- assert.strictEqual(savedConfig.hooks?.sessionEnd, false);
675
- });
676
- });
677
-
678
- describe("sync config", () => {
679
- beforeEach(async () => {
680
- await init(tempDir, { global: false, force: false });
681
- });
682
-
683
- it("should set sync.enabled via config command", async () => {
684
- const capture = captureConsole();
685
-
686
- try {
687
- await config({ dir: tempDir, set: "sync.enabled=true" });
688
- } finally {
689
- capture.restore();
690
- }
691
-
692
- // Verify the config was set
693
- const configPath = path.join(tempDir, ".minimem", "config.json");
694
- const savedConfig = JSON.parse(await fs.readFile(configPath, "utf-8"));
695
- assert.strictEqual(savedConfig.sync?.enabled, true);
696
- });
697
-
698
- it("should set sync.path via config command", async () => {
699
- const capture = captureConsole();
700
-
701
- try {
702
- await config({ dir: tempDir, set: "sync.path=myproject/" });
703
- } finally {
704
- capture.restore();
705
- }
706
-
707
- const configPath = path.join(tempDir, ".minimem", "config.json");
708
- const savedConfig = JSON.parse(await fs.readFile(configPath, "utf-8"));
709
- assert.strictEqual(savedConfig.sync?.path, "myproject/");
710
- });
711
-
712
- it("should get sync config with defaults", async () => {
713
- const syncConfig = await getSyncConfig(tempDir);
714
-
715
- // Should have defaults applied
716
- assert.strictEqual(syncConfig.enabled, false);
717
- assert.deepStrictEqual(syncConfig.include, ["MEMORY.md", "memory/**/*.md"]);
718
- assert.strictEqual(syncConfig.conflictStrategy, "keep-both");
719
- assert.strictEqual(syncConfig.autoSync, false);
720
- });
721
-
722
- it("should merge local sync config with defaults", async () => {
723
- // Set some local config
724
- const configPath = path.join(tempDir, ".minimem", "config.json");
725
- const localConfig = {
726
- embedding: { provider: "auto" },
727
- sync: {
728
- enabled: true,
729
- path: "test-project/",
730
- include: ["MEMORY.md", "custom/**/*.md"],
731
- },
732
- };
733
- await fs.writeFile(configPath, JSON.stringify(localConfig, null, 2));
734
-
735
- const syncConfig = await getSyncConfig(tempDir);
736
-
737
- assert.strictEqual(syncConfig.enabled, true);
738
- assert.strictEqual(syncConfig.path, "test-project/");
739
- assert.deepStrictEqual(syncConfig.include, ["MEMORY.md", "custom/**/*.md"]);
740
- // Defaults still applied for unset values
741
- assert.strictEqual(syncConfig.conflictStrategy, "keep-both");
742
- });
743
-
744
- it("should display sync config in config command output", async () => {
745
- const capture = captureConsole();
746
-
747
- try {
748
- await config({ dir: tempDir });
749
- } finally {
750
- capture.restore();
751
- }
752
-
753
- // Should show sync sections
754
- assert.ok(capture.logs.some(l => l.includes("Sync (Local)")));
755
- assert.ok(capture.logs.some(l => l.includes("Sync (Global)")));
756
- assert.ok(capture.logs.some(l => l.includes("conflictStrategy")));
757
- });
758
- });
759
- });