fivocell 4.3.1 → 4.3.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 (874) hide show
  1. package/README.md +45 -23
  2. package/bin/cell.js +1 -1
  3. package/dist/__tests__/agents-md.test.js +1 -1
  4. package/dist/__tests__/agents-md.test.js.map +1 -1
  5. package/dist/__tests__/antigravity-rich-format.test.js +2 -2
  6. package/dist/__tests__/antigravity-rich-format.test.js.map +1 -1
  7. package/dist/__tests__/atcell-live-fallback.test.js +2 -2
  8. package/dist/__tests__/atcell-live-fallback.test.js.map +1 -1
  9. package/dist/__tests__/behavior-intelligence-bug.test.js +1 -1
  10. package/dist/__tests__/behavior-intelligence-bug.test.js.map +1 -1
  11. package/dist/__tests__/branch-context.test.d.ts +2 -0
  12. package/dist/__tests__/branch-context.test.d.ts.map +1 -0
  13. package/dist/__tests__/branch-context.test.js +215 -0
  14. package/dist/__tests__/branch-context.test.js.map +1 -0
  15. package/dist/__tests__/cell-state-setup.test.d.ts +2 -0
  16. package/dist/__tests__/cell-state-setup.test.d.ts.map +1 -0
  17. package/dist/__tests__/cell-state-setup.test.js +190 -0
  18. package/dist/__tests__/cell-state-setup.test.js.map +1 -0
  19. package/dist/__tests__/cli-regression.test.d.ts +2 -0
  20. package/dist/__tests__/cli-regression.test.d.ts.map +1 -0
  21. package/dist/__tests__/cli-regression.test.js +105 -0
  22. package/dist/__tests__/cli-regression.test.js.map +1 -0
  23. package/dist/__tests__/cli-smoke.test.d.ts +2 -0
  24. package/dist/__tests__/cli-smoke.test.d.ts.map +1 -0
  25. package/dist/__tests__/cli-smoke.test.js +79 -0
  26. package/dist/__tests__/cli-smoke.test.js.map +1 -0
  27. package/dist/__tests__/code-scanner-blindspot.test.js +1 -1
  28. package/dist/__tests__/code-scanner-blindspot.test.js.map +1 -1
  29. package/dist/__tests__/code-scanner-error-recovery.test.js +1 -1
  30. package/dist/__tests__/code-scanner-error-recovery.test.js.map +1 -1
  31. package/dist/__tests__/code-scanner-sql-fix.test.js +1 -1
  32. package/dist/__tests__/code-scanner-sql-fix.test.js.map +1 -1
  33. package/dist/__tests__/community-store.test.js +20 -20
  34. package/dist/__tests__/community-store.test.js.map +1 -1
  35. package/dist/__tests__/cross-memory-continue.test.d.ts +8 -0
  36. package/dist/__tests__/cross-memory-continue.test.d.ts.map +1 -0
  37. package/dist/__tests__/cross-memory-continue.test.js +179 -0
  38. package/dist/__tests__/cross-memory-continue.test.js.map +1 -0
  39. package/dist/__tests__/cross-memory-editor-monitor.test.d.ts +6 -0
  40. package/dist/__tests__/cross-memory-editor-monitor.test.d.ts.map +1 -0
  41. package/dist/__tests__/cross-memory-editor-monitor.test.js +109 -0
  42. package/dist/__tests__/cross-memory-editor-monitor.test.js.map +1 -0
  43. package/dist/__tests__/cross-memory-event-capture.test.d.ts +2 -0
  44. package/dist/__tests__/cross-memory-event-capture.test.d.ts.map +1 -0
  45. package/dist/__tests__/cross-memory-event-capture.test.js +530 -0
  46. package/dist/__tests__/cross-memory-event-capture.test.js.map +1 -0
  47. package/dist/__tests__/cross-memory-replay.test.d.ts +2 -0
  48. package/dist/__tests__/cross-memory-replay.test.d.ts.map +1 -0
  49. package/dist/__tests__/cross-memory-replay.test.js +362 -0
  50. package/dist/__tests__/cross-memory-replay.test.js.map +1 -0
  51. package/dist/__tests__/cross-memory-socket-bridge.test.d.ts +9 -0
  52. package/dist/__tests__/cross-memory-socket-bridge.test.d.ts.map +1 -0
  53. package/dist/__tests__/cross-memory-socket-bridge.test.js +633 -0
  54. package/dist/__tests__/cross-memory-socket-bridge.test.js.map +1 -0
  55. package/dist/__tests__/enhanced-blind-spots.test.js +89 -1
  56. package/dist/__tests__/enhanced-blind-spots.test.js.map +1 -1
  57. package/dist/__tests__/failure-memory.test.d.ts +2 -0
  58. package/dist/__tests__/failure-memory.test.d.ts.map +1 -0
  59. package/dist/__tests__/failure-memory.test.js +108 -0
  60. package/dist/__tests__/failure-memory.test.js.map +1 -0
  61. package/dist/__tests__/journey-memory.test.d.ts +2 -0
  62. package/dist/__tests__/journey-memory.test.d.ts.map +1 -0
  63. package/dist/__tests__/journey-memory.test.js +141 -0
  64. package/dist/__tests__/journey-memory.test.js.map +1 -0
  65. package/dist/__tests__/knowledge-graph-store.test.js +3 -3
  66. package/dist/__tests__/knowledge-graph-store.test.js.map +1 -1
  67. package/dist/__tests__/live-watcher.test.js +24 -24
  68. package/dist/__tests__/live-watcher.test.js.map +1 -1
  69. package/dist/__tests__/mcp-cell-tools.test.js +2 -2
  70. package/dist/__tests__/mcp-cell-tools.test.js.map +1 -1
  71. package/dist/__tests__/multi-project.test.js +1 -1
  72. package/dist/__tests__/multi-project.test.js.map +1 -1
  73. package/dist/__tests__/pc-scanner-paths.test.js +1 -1
  74. package/dist/__tests__/pc-scanner-paths.test.js.map +1 -1
  75. package/dist/__tests__/prelaunch-reality-check.test.js +27 -27
  76. package/dist/__tests__/prelaunch-reality-check.test.js.map +1 -1
  77. package/dist/__tests__/project-name-override.test.js +2 -2
  78. package/dist/__tests__/project-name-override.test.js.map +1 -1
  79. package/dist/__tests__/prompt-builder-realdata.test.js +90 -2
  80. package/dist/__tests__/prompt-builder-realdata.test.js.map +1 -1
  81. package/dist/__tests__/prompt-builder-sessions.test.js +2 -2
  82. package/dist/__tests__/prompt-builder-sessions.test.js.map +1 -1
  83. package/dist/__tests__/repl.test.js +3 -3
  84. package/dist/__tests__/repl.test.js.map +1 -1
  85. package/dist/__tests__/security.test.js +19 -19
  86. package/dist/__tests__/security.test.js.map +1 -1
  87. package/dist/__tests__/session-bridge.test.js +2 -2
  88. package/dist/__tests__/session-bridge.test.js.map +1 -1
  89. package/dist/__tests__/session-memory-tables.test.js +2 -2
  90. package/dist/__tests__/session-memory-tables.test.js.map +1 -1
  91. package/dist/__tests__/setup.test.js +1 -1
  92. package/dist/__tests__/setup.test.js.map +1 -1
  93. package/dist/__tests__/staleness-detection.test.js +3 -3
  94. package/dist/__tests__/staleness-detection.test.js.map +1 -1
  95. package/dist/__tests__/team-collaboration.test.js +10 -10
  96. package/dist/__tests__/team-collaboration.test.js.map +1 -1
  97. package/dist/__tests__/tool-specific-format.test.js +2 -2
  98. package/dist/__tests__/tool-specific-format.test.js.map +1 -1
  99. package/dist/__tests__/usage-intelligence-store.test.js +23 -23
  100. package/dist/__tests__/usage-intelligence-store.test.js.map +1 -1
  101. package/dist/__tests__/watch-cli.test.js +1 -1
  102. package/dist/__tests__/watch-cli.test.js.map +1 -1
  103. package/dist/core/__tests__/ab-test-framework.test.js +1 -1
  104. package/dist/core/__tests__/ab-test-framework.test.js.map +1 -1
  105. package/dist/core/__tests__/ai-memory.test.js +1 -1
  106. package/dist/core/__tests__/ai-memory.test.js.map +1 -1
  107. package/dist/core/__tests__/ast-differ.test.d.ts +2 -0
  108. package/dist/core/__tests__/ast-differ.test.d.ts.map +1 -0
  109. package/dist/core/__tests__/ast-differ.test.js +68 -0
  110. package/dist/core/__tests__/ast-differ.test.js.map +1 -0
  111. package/dist/core/__tests__/build-failure-predictor.test.js +1 -1
  112. package/dist/core/__tests__/build-failure-predictor.test.js.map +1 -1
  113. package/dist/core/__tests__/chapter3-verify.test.js +3 -3
  114. package/dist/core/__tests__/chapter3-verify.test.js.map +1 -1
  115. package/dist/core/__tests__/chapter4-hostile.test.js +2 -2
  116. package/dist/core/__tests__/chapter4-hostile.test.js.map +1 -1
  117. package/dist/core/__tests__/chapter4-verify.test.js +3 -3
  118. package/dist/core/__tests__/chapter4-verify.test.js.map +1 -1
  119. package/dist/core/__tests__/community-full.test.js +1 -1
  120. package/dist/core/__tests__/community-full.test.js.map +1 -1
  121. package/dist/core/__tests__/community-live.test.js +1 -1
  122. package/dist/core/__tests__/community-live.test.js.map +1 -1
  123. package/dist/core/__tests__/config-attribution.test.js +1 -1
  124. package/dist/core/__tests__/config-attribution.test.js.map +1 -1
  125. package/dist/core/__tests__/convention-detector.test.js +1 -1
  126. package/dist/core/__tests__/convention-detector.test.js.map +1 -1
  127. package/dist/core/__tests__/cost-optimizer.test.js +1 -1
  128. package/dist/core/__tests__/cost-optimizer.test.js.map +1 -1
  129. package/dist/core/__tests__/cross-domain-projections.test.js +1 -1
  130. package/dist/core/__tests__/cross-domain-projections.test.js.map +1 -1
  131. package/dist/core/__tests__/cross-project-sync.test.js +1 -1
  132. package/dist/core/__tests__/cross-project-sync.test.js.map +1 -1
  133. package/dist/core/__tests__/error-predictor.test.js +1 -1
  134. package/dist/core/__tests__/error-predictor.test.js.map +1 -1
  135. package/dist/core/__tests__/explainability.test.js +3 -3
  136. package/dist/core/__tests__/explainability.test.js.map +1 -1
  137. package/dist/core/__tests__/extraction-cascade.test.d.ts +2 -0
  138. package/dist/core/__tests__/extraction-cascade.test.d.ts.map +1 -0
  139. package/dist/core/__tests__/extraction-cascade.test.js +59 -0
  140. package/dist/core/__tests__/extraction-cascade.test.js.map +1 -0
  141. package/dist/core/__tests__/failure-memory.test.js +1 -1
  142. package/dist/core/__tests__/failure-memory.test.js.map +1 -1
  143. package/dist/core/__tests__/git-branch-pregenerator.test.js +1 -1
  144. package/dist/core/__tests__/git-branch-pregenerator.test.js.map +1 -1
  145. package/dist/core/__tests__/interruption-recovery.test.js +1 -1
  146. package/dist/core/__tests__/interruption-recovery.test.js.map +1 -1
  147. package/dist/core/__tests__/knowledge-graph.test.js +1 -1
  148. package/dist/core/__tests__/knowledge-graph.test.js.map +1 -1
  149. package/dist/core/__tests__/marketplace.test.js +1 -1
  150. package/dist/core/__tests__/marketplace.test.js.map +1 -1
  151. package/dist/core/__tests__/merge-conflict-predictor.test.js +1 -1
  152. package/dist/core/__tests__/merge-conflict-predictor.test.js.map +1 -1
  153. package/dist/core/__tests__/performance-predictor.test.js +1 -1
  154. package/dist/core/__tests__/performance-predictor.test.js.map +1 -1
  155. package/dist/core/__tests__/playbook-generator.test.js +1 -1
  156. package/dist/core/__tests__/playbook-generator.test.js.map +1 -1
  157. package/dist/core/__tests__/pr-review-assistant.test.js +1 -1
  158. package/dist/core/__tests__/pr-review-assistant.test.js.map +1 -1
  159. package/dist/core/__tests__/privacy-manager.test.js +1 -1
  160. package/dist/core/__tests__/privacy-manager.test.js.map +1 -1
  161. package/dist/core/__tests__/project-dna.test.js +1 -1
  162. package/dist/core/__tests__/project-dna.test.js.map +1 -1
  163. package/dist/core/__tests__/reputation.test.js +1 -1
  164. package/dist/core/__tests__/reputation.test.js.map +1 -1
  165. package/dist/core/__tests__/security-predictor.test.js +1 -1
  166. package/dist/core/__tests__/security-predictor.test.js.map +1 -1
  167. package/dist/core/__tests__/signal-capture.test.js +1 -1
  168. package/dist/core/__tests__/signal-capture.test.js.map +1 -1
  169. package/dist/core/__tests__/team-composer.test.js +1 -1
  170. package/dist/core/__tests__/team-composer.test.js.map +1 -1
  171. package/dist/core/__tests__/time-saved.test.js +1 -1
  172. package/dist/core/__tests__/time-saved.test.js.map +1 -1
  173. package/dist/core/__tests__/validation-run.test.js +1 -1
  174. package/dist/core/__tests__/validation-run.test.js.map +1 -1
  175. package/dist/core/__tests__/workflow-outcome-graph.test.js +1 -1
  176. package/dist/core/__tests__/workflow-outcome-graph.test.js.map +1 -1
  177. package/dist/core/architecture-engine.js +1 -1
  178. package/dist/core/architecture-engine.js.map +1 -1
  179. package/dist/core/backend-engine.js +1 -1
  180. package/dist/core/backend-engine.js.map +1 -1
  181. package/dist/core/cross-project-sync.d.ts +1 -1
  182. package/dist/core/cross-project-sync.d.ts.map +1 -1
  183. package/dist/core/enhanced-blind-spots.d.ts +8 -0
  184. package/dist/core/enhanced-blind-spots.d.ts.map +1 -1
  185. package/dist/core/enhanced-blind-spots.js +59 -0
  186. package/dist/core/enhanced-blind-spots.js.map +1 -1
  187. package/dist/core/extraction-cascade.d.ts +2 -2
  188. package/dist/core/extraction-cascade.d.ts.map +1 -1
  189. package/dist/core/extraction-cascade.js +2 -2
  190. package/dist/core/extraction-cascade.js.map +1 -1
  191. package/dist/core/frontend-engine.js +1 -1
  192. package/dist/core/frontend-engine.js.map +1 -1
  193. package/dist/core/learning-layer.d.ts +1 -1
  194. package/dist/core/learning-layer.d.ts.map +1 -1
  195. package/dist/core/naming-engine.js +1 -1
  196. package/dist/core/naming-engine.js.map +1 -1
  197. package/dist/core/productivity-engine.js +1 -1
  198. package/dist/core/productivity-engine.js.map +1 -1
  199. package/dist/core/project-registry.js +1 -1
  200. package/dist/core/project-registry.js.map +1 -1
  201. package/dist/core/search-engine.js +1 -1
  202. package/dist/core/search-engine.js.map +1 -1
  203. package/dist/core/similarity-engine.d.ts +1 -1
  204. package/dist/core/similarity-engine.d.ts.map +1 -1
  205. package/dist/core/structure-engine.js +1 -1
  206. package/dist/core/structure-engine.js.map +1 -1
  207. package/dist/core/syntax-engine.js +1 -1
  208. package/dist/core/syntax-engine.js.map +1 -1
  209. package/dist/core/team-advanced-engine.js +1 -1
  210. package/dist/core/team-advanced-engine.js.map +1 -1
  211. package/dist/core/team-composer.d.ts +1 -1
  212. package/dist/core/team-composer.d.ts.map +1 -1
  213. package/dist/core/team-engine.js +1 -1
  214. package/dist/core/team-engine.js.map +1 -1
  215. package/dist/index.d.ts +40 -46
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +33 -65
  218. package/dist/index.js.map +1 -1
  219. package/dist/validation/quick-run.js +1 -1
  220. package/dist/validation/quick-run.js.map +1 -1
  221. package/dist/walls/01-context/context/agents-md.d.ts.map +1 -0
  222. package/dist/walls/01-context/context/agents-md.js.map +1 -0
  223. package/dist/walls/01-context/context/ide-intelligence.d.ts.map +1 -0
  224. package/dist/{ide-intelligence.js → walls/01-context/context/ide-intelligence.js} +1 -1
  225. package/dist/walls/01-context/context/ide-intelligence.js.map +1 -0
  226. package/dist/walls/01-context/context/prompt-builder.d.ts.map +1 -0
  227. package/dist/{core → walls/01-context/context}/prompt-builder.js +27 -3
  228. package/dist/walls/01-context/context/prompt-builder.js.map +1 -0
  229. package/dist/walls/01-context/context/user-intelligence.d.ts.map +1 -0
  230. package/dist/walls/01-context/context/user-intelligence.js.map +1 -0
  231. package/dist/walls/01-context/sessions/event-capture.d.ts +126 -0
  232. package/dist/walls/01-context/sessions/event-capture.d.ts.map +1 -0
  233. package/dist/walls/01-context/sessions/event-capture.js +418 -0
  234. package/dist/walls/01-context/sessions/event-capture.js.map +1 -0
  235. package/dist/walls/01-context/sessions/interruption-recovery.d.ts.map +1 -0
  236. package/dist/walls/01-context/sessions/interruption-recovery.js.map +1 -0
  237. package/dist/walls/01-context/sessions/replay.d.ts +50 -0
  238. package/dist/walls/01-context/sessions/replay.d.ts.map +1 -0
  239. package/dist/walls/01-context/sessions/replay.js +426 -0
  240. package/dist/walls/01-context/sessions/replay.js.map +1 -0
  241. package/dist/walls/01-context/sessions/session-memory.d.ts.map +1 -0
  242. package/dist/{core → walls/01-context/sessions}/session-memory.js +2 -2
  243. package/dist/walls/01-context/sessions/session-memory.js.map +1 -0
  244. package/dist/walls/02-scanner/blindspots/code-scanner.d.ts.map +1 -0
  245. package/dist/{code-scanner.js → walls/02-scanner/blindspots/code-scanner.js} +15 -10
  246. package/dist/walls/02-scanner/blindspots/code-scanner.js.map +1 -0
  247. package/dist/{developer-intelligence.d.ts → walls/02-scanner/profile/developer-intelligence.d.ts} +3 -3
  248. package/dist/walls/02-scanner/profile/developer-intelligence.d.ts.map +1 -0
  249. package/dist/{developer-intelligence.js → walls/02-scanner/profile/developer-intelligence.js} +4 -4
  250. package/dist/walls/02-scanner/profile/developer-intelligence.js.map +1 -0
  251. package/dist/walls/02-scanner/stack/pc-scanner.d.ts.map +1 -0
  252. package/dist/{pc-scanner.js → walls/02-scanner/stack/pc-scanner.js} +1 -1
  253. package/dist/walls/02-scanner/stack/pc-scanner.js.map +1 -0
  254. package/dist/walls/02-scanner/stack/stack-detector.d.ts.map +1 -0
  255. package/dist/walls/02-scanner/stack/stack-detector.js.map +1 -0
  256. package/dist/walls/02-scanner/style/style-pull.d.ts.map +1 -0
  257. package/dist/walls/02-scanner/style/style-pull.js.map +1 -0
  258. package/dist/walls/03-knowledge/decisions/ab-test-framework.d.ts.map +1 -0
  259. package/dist/walls/03-knowledge/decisions/ab-test-framework.js.map +1 -0
  260. package/dist/walls/03-knowledge/decisions/ai-bridge.d.ts.map +1 -0
  261. package/dist/{ai-bridge.js → walls/03-knowledge/decisions/ai-bridge.js} +68 -68
  262. package/dist/walls/03-knowledge/decisions/ai-bridge.js.map +1 -0
  263. package/dist/{core → walls/03-knowledge/decisions}/ai-memory.d.ts +1 -1
  264. package/dist/walls/03-knowledge/decisions/ai-memory.d.ts.map +1 -0
  265. package/dist/{core → walls/03-knowledge/decisions}/ai-memory.js +1 -1
  266. package/dist/walls/03-knowledge/decisions/ai-memory.js.map +1 -0
  267. package/dist/walls/03-knowledge/decisions/behavior-intelligence.d.ts.map +1 -0
  268. package/dist/walls/03-knowledge/decisions/behavior-intelligence.js.map +1 -0
  269. package/dist/walls/03-knowledge/decisions/behavioral-tracker.d.ts.map +1 -0
  270. package/dist/{behavioral-tracker.js → walls/03-knowledge/decisions/behavioral-tracker.js} +80 -80
  271. package/dist/walls/03-knowledge/decisions/behavioral-tracker.js.map +1 -0
  272. package/dist/walls/03-knowledge/decisions/branch-snapshot.d.ts +20 -0
  273. package/dist/walls/03-knowledge/decisions/branch-snapshot.d.ts.map +1 -0
  274. package/dist/walls/03-knowledge/decisions/branch-snapshot.js +175 -0
  275. package/dist/walls/03-knowledge/decisions/branch-snapshot.js.map +1 -0
  276. package/dist/walls/03-knowledge/decisions/build-failure-predictor.d.ts.map +1 -0
  277. package/dist/walls/03-knowledge/decisions/build-failure-predictor.js.map +1 -0
  278. package/dist/walls/03-knowledge/decisions/cost-optimizer.d.ts.map +1 -0
  279. package/dist/{core → walls/03-knowledge/decisions}/cost-optimizer.js +1 -1
  280. package/dist/walls/03-knowledge/decisions/cost-optimizer.js.map +1 -0
  281. package/dist/walls/03-knowledge/decisions/cross-model-engine.d.ts.map +1 -0
  282. package/dist/{cross-model-engine.js → walls/03-knowledge/decisions/cross-model-engine.js} +23 -23
  283. package/dist/walls/03-knowledge/decisions/cross-model-engine.js.map +1 -0
  284. package/dist/walls/03-knowledge/decisions/cross-model-memory.d.ts.map +1 -0
  285. package/dist/{cross-model-memory.js → walls/03-knowledge/decisions/cross-model-memory.js} +1 -1
  286. package/dist/walls/03-knowledge/decisions/cross-model-memory.js.map +1 -0
  287. package/dist/walls/03-knowledge/decisions/developer-profile.d.ts +6 -0
  288. package/dist/walls/03-knowledge/decisions/developer-profile.d.ts.map +1 -0
  289. package/dist/walls/03-knowledge/decisions/developer-profile.js.map +1 -0
  290. package/dist/walls/03-knowledge/decisions/error-predictor.d.ts.map +1 -0
  291. package/dist/walls/03-knowledge/decisions/error-predictor.js.map +1 -0
  292. package/dist/{core → walls/03-knowledge/decisions}/failure-memory.d.ts +7 -6
  293. package/dist/walls/03-knowledge/decisions/failure-memory.d.ts.map +1 -0
  294. package/dist/walls/03-knowledge/decisions/failure-memory.js +288 -0
  295. package/dist/walls/03-knowledge/decisions/failure-memory.js.map +1 -0
  296. package/dist/walls/03-knowledge/decisions/focus-report.d.ts.map +1 -0
  297. package/dist/walls/03-knowledge/decisions/focus-report.js.map +1 -0
  298. package/dist/{core → walls/03-knowledge/decisions}/git-branch-pregenerator.d.ts +1 -1
  299. package/dist/walls/03-knowledge/decisions/git-branch-pregenerator.d.ts.map +1 -0
  300. package/dist/walls/03-knowledge/decisions/git-branch-pregenerator.js.map +1 -0
  301. package/dist/walls/03-knowledge/decisions/insight-generator.d.ts.map +1 -0
  302. package/dist/walls/03-knowledge/decisions/insight-generator.js.map +1 -0
  303. package/dist/walls/03-knowledge/decisions/journey-memory.d.ts.map +1 -0
  304. package/dist/walls/03-knowledge/decisions/journey-memory.js.map +1 -0
  305. package/dist/walls/03-knowledge/decisions/merge-conflict-predictor.d.ts.map +1 -0
  306. package/dist/walls/03-knowledge/decisions/merge-conflict-predictor.js.map +1 -0
  307. package/dist/walls/03-knowledge/decisions/model-intelligence.d.ts.map +1 -0
  308. package/dist/walls/03-knowledge/decisions/model-intelligence.js.map +1 -0
  309. package/dist/{core → walls/03-knowledge/decisions}/outcome-engine.d.ts +2 -2
  310. package/dist/walls/03-knowledge/decisions/outcome-engine.d.ts.map +1 -0
  311. package/dist/walls/03-knowledge/decisions/outcome-engine.js.map +1 -0
  312. package/dist/{core → walls/03-knowledge/decisions}/outcome-recorder.d.ts +1 -1
  313. package/dist/walls/03-knowledge/decisions/outcome-recorder.d.ts.map +1 -0
  314. package/dist/walls/03-knowledge/decisions/outcome-recorder.js.map +1 -0
  315. package/dist/walls/03-knowledge/decisions/performance-predictor.d.ts.map +1 -0
  316. package/dist/walls/03-knowledge/decisions/performance-predictor.js.map +1 -0
  317. package/dist/walls/03-knowledge/decisions/platt-calibration.d.ts.map +1 -0
  318. package/dist/walls/03-knowledge/decisions/platt-calibration.js.map +1 -0
  319. package/dist/walls/03-knowledge/decisions/predictive-engine.d.ts.map +1 -0
  320. package/dist/{predictive-engine.js → walls/03-knowledge/decisions/predictive-engine.js} +1 -1
  321. package/dist/walls/03-knowledge/decisions/predictive-engine.js.map +1 -0
  322. package/dist/walls/03-knowledge/decisions/predictive-intelligence.d.ts.map +1 -0
  323. package/dist/{predictive-intelligence.js → walls/03-knowledge/decisions/predictive-intelligence.js} +1 -1
  324. package/dist/walls/03-knowledge/decisions/predictive-intelligence.js.map +1 -0
  325. package/dist/walls/03-knowledge/decisions/realtime-guardian.d.ts.map +1 -0
  326. package/dist/walls/03-knowledge/decisions/realtime-guardian.js.map +1 -0
  327. package/dist/{core → walls/03-knowledge/decisions}/recommendation-engine.d.ts +5 -5
  328. package/dist/walls/03-knowledge/decisions/recommendation-engine.d.ts.map +1 -0
  329. package/dist/{core → walls/03-knowledge/decisions}/recommendation-engine.js +1 -1
  330. package/dist/walls/03-knowledge/decisions/recommendation-engine.js.map +1 -0
  331. package/dist/walls/03-knowledge/decisions/security-predictor.d.ts.map +1 -0
  332. package/dist/walls/03-knowledge/decisions/security-predictor.js.map +1 -0
  333. package/dist/walls/03-knowledge/decisions/time-saved.d.ts.map +1 -0
  334. package/dist/walls/03-knowledge/decisions/time-saved.js.map +1 -0
  335. package/dist/walls/03-knowledge/decisions/workflow-outcome-graph.d.ts.map +1 -0
  336. package/dist/walls/03-knowledge/decisions/workflow-outcome-graph.js.map +1 -0
  337. package/dist/{core → walls/03-knowledge/decisions}/workflow-tracker.d.ts +1 -1
  338. package/dist/walls/03-knowledge/decisions/workflow-tracker.d.ts.map +1 -0
  339. package/dist/walls/03-knowledge/decisions/workflow-tracker.js.map +1 -0
  340. package/dist/{core → walls/03-knowledge/dna}/config-attribution.d.ts +1 -1
  341. package/dist/walls/03-knowledge/dna/config-attribution.d.ts.map +1 -0
  342. package/dist/walls/03-knowledge/dna/config-attribution.js.map +1 -0
  343. package/dist/{core → walls/03-knowledge/dna}/convention-detector.d.ts +1 -1
  344. package/dist/walls/03-knowledge/dna/convention-detector.d.ts.map +1 -0
  345. package/dist/{core → walls/03-knowledge/dna}/convention-detector.js +1 -1
  346. package/dist/walls/03-knowledge/dna/convention-detector.js.map +1 -0
  347. package/dist/walls/03-knowledge/dna/cross-domain-projections.d.ts.map +1 -0
  348. package/dist/walls/03-knowledge/dna/cross-domain-projections.js.map +1 -0
  349. package/dist/walls/03-knowledge/dna/cross-language-mappings.d.ts.map +1 -0
  350. package/dist/walls/03-knowledge/dna/cross-language-mappings.js.map +1 -0
  351. package/dist/{core → walls/03-knowledge/dna}/explainability.d.ts +1 -1
  352. package/dist/walls/03-knowledge/dna/explainability.d.ts.map +1 -0
  353. package/dist/{core → walls/03-knowledge/dna}/explainability.js +2 -2
  354. package/dist/walls/03-knowledge/dna/explainability.js.map +1 -0
  355. package/dist/walls/03-knowledge/dna/personal-intelligence.d.ts.map +1 -0
  356. package/dist/{personal-intelligence.js → walls/03-knowledge/dna/personal-intelligence.js} +1 -1
  357. package/dist/walls/03-knowledge/dna/personal-intelligence.js.map +1 -0
  358. package/dist/{core → walls/03-knowledge/dna}/project-dna.d.ts +2 -2
  359. package/dist/walls/03-knowledge/dna/project-dna.d.ts.map +1 -0
  360. package/dist/{core → walls/03-knowledge/dna}/project-dna.js +1 -1
  361. package/dist/walls/03-knowledge/dna/project-dna.js.map +1 -0
  362. package/dist/walls/03-knowledge/dna/proof-engine.d.ts.map +1 -0
  363. package/dist/{core → walls/03-knowledge/dna}/proof-engine.js +1 -1
  364. package/dist/walls/03-knowledge/dna/proof-engine.js.map +1 -0
  365. package/dist/walls/03-knowledge/graph/knowledge-graph-builder.d.ts.map +1 -0
  366. package/dist/walls/03-knowledge/graph/knowledge-graph-builder.js.map +1 -0
  367. package/dist/walls/03-knowledge/graph/knowledge-graph-engine.d.ts.map +1 -0
  368. package/dist/{core → walls/03-knowledge/graph}/knowledge-graph-engine.js +1 -1
  369. package/dist/walls/03-knowledge/graph/knowledge-graph-engine.js.map +1 -0
  370. package/dist/walls/03-knowledge/graph/knowledge-graph.d.ts.map +1 -0
  371. package/dist/{core → walls/03-knowledge/graph}/knowledge-graph.js +1 -1
  372. package/dist/walls/03-knowledge/graph/knowledge-graph.js.map +1 -0
  373. package/dist/walls/04-team/collab/team-collaboration.d.ts.map +1 -0
  374. package/dist/{team-collaboration.js → walls/04-team/collab/team-collaboration.js} +1 -1
  375. package/dist/walls/04-team/collab/team-collaboration.js.map +1 -0
  376. package/dist/walls/04-team/collab/team-git.d.ts.map +1 -0
  377. package/dist/{team-git.js → walls/04-team/collab/team-git.js} +1 -1
  378. package/dist/walls/04-team/collab/team-git.js.map +1 -0
  379. package/dist/walls/04-team/collab/team-intel.d.ts.map +1 -0
  380. package/dist/walls/04-team/collab/team-intel.js.map +1 -0
  381. package/dist/{core → walls/04-team/review}/pr-review-assistant.d.ts +1 -1
  382. package/dist/walls/04-team/review/pr-review-assistant.d.ts.map +1 -0
  383. package/dist/walls/04-team/review/pr-review-assistant.js.map +1 -0
  384. package/dist/walls/05-community/privacy/privacy-manager.d.ts.map +1 -0
  385. package/dist/walls/05-community/privacy/privacy-manager.js.map +1 -0
  386. package/dist/walls/05-community/privacy/security.d.ts.map +1 -0
  387. package/dist/walls/05-community/privacy/security.js.map +1 -0
  388. package/dist/walls/05-community/share/identity-resolver.d.ts.map +1 -0
  389. package/dist/walls/05-community/share/identity-resolver.js.map +1 -0
  390. package/dist/walls/05-community/share/marketplace.d.ts.map +1 -0
  391. package/dist/walls/05-community/share/marketplace.js.map +1 -0
  392. package/dist/walls/05-community/share/reputation.d.ts.map +1 -0
  393. package/dist/walls/05-community/share/reputation.js.map +1 -0
  394. package/dist/{core → walls/05-community/share}/signal-capture.d.ts +1 -1
  395. package/dist/walls/05-community/share/signal-capture.d.ts.map +1 -0
  396. package/dist/{core → walls/05-community/share}/signal-capture.js +2 -2
  397. package/dist/walls/05-community/share/signal-capture.js.map +1 -0
  398. package/dist/walls/05-community/stats/community-advanced-engine.d.ts.map +1 -0
  399. package/dist/{core → walls/05-community/stats}/community-advanced-engine.js +1 -1
  400. package/dist/walls/05-community/stats/community-advanced-engine.js.map +1 -0
  401. package/dist/walls/05-community/stats/community-engine.d.ts.map +1 -0
  402. package/dist/{core → walls/05-community/stats}/community-engine.js +1 -1
  403. package/dist/walls/05-community/stats/community-engine.js.map +1 -0
  404. package/dist/{core → walls/05-community/stats}/community-full.d.ts +1 -1
  405. package/dist/walls/05-community/stats/community-full.d.ts.map +1 -0
  406. package/dist/walls/05-community/stats/community-full.js.map +1 -0
  407. package/dist/walls/05-community/stats/community-intel.d.ts.map +1 -0
  408. package/dist/{community-intel.js → walls/05-community/stats/community-intel.js} +1 -1
  409. package/dist/walls/05-community/stats/community-intel.js.map +1 -0
  410. package/dist/walls/05-community/stats/community-intelligence.d.ts.map +1 -0
  411. package/dist/walls/05-community/stats/community-intelligence.js.map +1 -0
  412. package/dist/walls/05-community/stats/community-live.d.ts.map +1 -0
  413. package/dist/walls/05-community/stats/community-live.js.map +1 -0
  414. package/dist/{core → walls/05-community/stats}/community-prior.d.ts +1 -1
  415. package/dist/walls/05-community/stats/community-prior.d.ts.map +1 -0
  416. package/dist/walls/05-community/stats/community-prior.js.map +1 -0
  417. package/dist/walls/05-community/stats/community-v2.d.ts.map +1 -0
  418. package/dist/{community-v2.js → walls/05-community/stats/community-v2.js} +1 -1
  419. package/dist/walls/05-community/stats/community-v2.js.map +1 -0
  420. package/dist/walls/05-community/stats/layers.d.ts.map +1 -0
  421. package/dist/walls/05-community/stats/layers.js.map +1 -0
  422. package/dist/{core → walls/05-community/stats}/playbook-generator.d.ts +1 -1
  423. package/dist/walls/05-community/stats/playbook-generator.d.ts.map +1 -0
  424. package/dist/walls/05-community/stats/playbook-generator.js.map +1 -0
  425. package/dist/walls/06-memory/database/database.d.ts.map +1 -0
  426. package/dist/{core → walls/06-memory/database}/database.js +37 -2
  427. package/dist/walls/06-memory/database/database.js.map +1 -0
  428. package/dist/walls/06-memory/database/logger.d.ts.map +1 -0
  429. package/dist/walls/06-memory/database/logger.js.map +1 -0
  430. package/dist/walls/06-memory/stores/cell-store.d.ts.map +1 -0
  431. package/dist/walls/06-memory/stores/cell-store.js.map +1 -0
  432. package/dist/walls/06-memory/stores/community-store.d.ts.map +1 -0
  433. package/dist/{core → walls/06-memory/stores}/community-store.js +1 -1
  434. package/dist/walls/06-memory/stores/community-store.js.map +1 -0
  435. package/dist/walls/06-memory/stores/decay-engine.d.ts.map +1 -0
  436. package/dist/walls/06-memory/stores/decay-engine.js.map +1 -0
  437. package/dist/{core → walls/06-memory/stores}/knowledge-graph-store.d.ts +1 -1
  438. package/dist/walls/06-memory/stores/knowledge-graph-store.d.ts.map +1 -0
  439. package/dist/{core → walls/06-memory/stores}/knowledge-graph-store.js +47 -47
  440. package/dist/walls/06-memory/stores/knowledge-graph-store.js.map +1 -0
  441. package/dist/walls/06-memory/stores/outcome-store.d.ts.map +1 -0
  442. package/dist/walls/06-memory/stores/outcome-store.js.map +1 -0
  443. package/dist/walls/06-memory/stores/outcome-types.d.ts.map +1 -0
  444. package/dist/walls/06-memory/stores/outcome-types.js.map +1 -0
  445. package/dist/{core → walls/06-memory/stores}/pattern-store.d.ts +4 -4
  446. package/dist/walls/06-memory/stores/pattern-store.d.ts.map +1 -0
  447. package/dist/{core → walls/06-memory/stores}/pattern-store.js +9 -9
  448. package/dist/walls/06-memory/stores/pattern-store.js.map +1 -0
  449. package/dist/walls/06-memory/stores/recommendation-store.d.ts.map +1 -0
  450. package/dist/walls/06-memory/stores/recommendation-store.js.map +1 -0
  451. package/dist/walls/06-memory/stores/recommendation-types.d.ts.map +1 -0
  452. package/dist/walls/06-memory/stores/recommendation-types.js.map +1 -0
  453. package/dist/walls/06-memory/stores/usage-intelligence-store.d.ts.map +1 -0
  454. package/dist/{core → walls/06-memory/stores}/usage-intelligence-store.js +1 -1
  455. package/dist/walls/06-memory/stores/usage-intelligence-store.js.map +1 -0
  456. package/dist/walls/07-runtime/cli/cli-repl.d.ts.map +1 -0
  457. package/dist/{cli-repl.js → walls/07-runtime/cli/cli-repl.js} +11 -0
  458. package/dist/walls/07-runtime/cli/cli-repl.js.map +1 -0
  459. package/dist/walls/07-runtime/cli/cli.d.ts.map +1 -0
  460. package/dist/{cli.js → walls/07-runtime/cli/cli.js} +1561 -68
  461. package/dist/walls/07-runtime/cli/cli.js.map +1 -0
  462. package/dist/walls/07-runtime/daemon/lifecycle.d.ts.map +1 -0
  463. package/dist/walls/07-runtime/daemon/lifecycle.js.map +1 -0
  464. package/dist/walls/07-runtime/daemon/server.d.ts +83 -0
  465. package/dist/walls/07-runtime/daemon/server.d.ts.map +1 -0
  466. package/dist/{daemon → walls/07-runtime/daemon}/server.js +211 -279
  467. package/dist/walls/07-runtime/daemon/server.js.map +1 -0
  468. package/dist/walls/07-runtime/daemon/watchdog.d.ts.map +1 -0
  469. package/dist/walls/07-runtime/daemon/watchdog.js.map +1 -0
  470. package/dist/walls/07-runtime/daemon/websocket.d.ts.map +1 -0
  471. package/dist/{daemon → walls/07-runtime/daemon}/websocket.js +1 -1
  472. package/dist/walls/07-runtime/daemon/websocket.js.map +1 -0
  473. package/dist/walls/07-runtime/setup/cell-state.d.ts +17 -0
  474. package/dist/walls/07-runtime/setup/cell-state.d.ts.map +1 -0
  475. package/dist/walls/07-runtime/setup/cell-state.js +94 -0
  476. package/dist/walls/07-runtime/setup/cell-state.js.map +1 -0
  477. package/dist/walls/07-runtime/setup/first-run.d.ts.map +1 -0
  478. package/dist/walls/07-runtime/setup/first-run.js.map +1 -0
  479. package/dist/walls/07-runtime/setup/production.d.ts.map +1 -0
  480. package/dist/{production.js → walls/07-runtime/setup/production.js} +2 -2
  481. package/dist/walls/07-runtime/setup/production.js.map +1 -0
  482. package/dist/walls/07-runtime/setup/setup.d.ts.map +1 -0
  483. package/dist/{core → walls/07-runtime/setup}/setup.js +5 -5
  484. package/dist/walls/07-runtime/setup/setup.js.map +1 -0
  485. package/dist/walls/07-runtime/watcher/editor-monitor.d.ts +93 -0
  486. package/dist/walls/07-runtime/watcher/editor-monitor.d.ts.map +1 -0
  487. package/dist/walls/07-runtime/watcher/editor-monitor.js +497 -0
  488. package/dist/walls/07-runtime/watcher/editor-monitor.js.map +1 -0
  489. package/dist/walls/07-runtime/watcher/live-watcher.d.ts.map +1 -0
  490. package/dist/{core → walls/07-runtime/watcher}/live-watcher.js +46 -46
  491. package/dist/walls/07-runtime/watcher/live-watcher.js.map +1 -0
  492. package/dist/walls/07-runtime/watcher/socket-bridge.d.ts +139 -0
  493. package/dist/walls/07-runtime/watcher/socket-bridge.d.ts.map +1 -0
  494. package/dist/walls/07-runtime/watcher/socket-bridge.js +566 -0
  495. package/dist/walls/07-runtime/watcher/socket-bridge.js.map +1 -0
  496. package/dist/walls/07-runtime/watcher/watch-cli.d.ts.map +1 -0
  497. package/dist/walls/07-runtime/watcher/watch-cli.js.map +1 -0
  498. package/dist/walls/08-cloud-bridge/sync/ai-bridge.d.ts +20 -0
  499. package/dist/walls/08-cloud-bridge/sync/ai-bridge.d.ts.map +1 -0
  500. package/dist/walls/08-cloud-bridge/sync/ai-bridge.js +250 -0
  501. package/dist/walls/08-cloud-bridge/sync/ai-bridge.js.map +1 -0
  502. package/dist/walls/08-cloud-bridge/sync/cloud-client.d.ts.map +1 -0
  503. package/dist/{core → walls/08-cloud-bridge/sync}/cloud-client.js +1 -1
  504. package/dist/walls/08-cloud-bridge/sync/cloud-client.js.map +1 -0
  505. package/dist/walls/08-cloud-bridge/sync/cloud-sync.d.ts.map +1 -0
  506. package/dist/{cloud-sync.js → walls/08-cloud-bridge/sync/cloud-sync.js} +2 -2
  507. package/dist/walls/08-cloud-bridge/sync/cloud-sync.js.map +1 -0
  508. package/package.json +4 -5
  509. package/dist/ai-bridge.d.ts.map +0 -1
  510. package/dist/ai-bridge.js.map +0 -1
  511. package/dist/behavior-intelligence.d.ts.map +0 -1
  512. package/dist/behavior-intelligence.js.map +0 -1
  513. package/dist/behavioral-tracker.d.ts.map +0 -1
  514. package/dist/behavioral-tracker.js.map +0 -1
  515. package/dist/cli-repl.d.ts.map +0 -1
  516. package/dist/cli-repl.js.map +0 -1
  517. package/dist/cli.d.ts.map +0 -1
  518. package/dist/cli.js.map +0 -1
  519. package/dist/cloud-sync.d.ts.map +0 -1
  520. package/dist/cloud-sync.js.map +0 -1
  521. package/dist/code-scanner.d.ts.map +0 -1
  522. package/dist/code-scanner.js.map +0 -1
  523. package/dist/community-intel.d.ts.map +0 -1
  524. package/dist/community-intel.js.map +0 -1
  525. package/dist/community-intelligence.d.ts.map +0 -1
  526. package/dist/community-intelligence.js.map +0 -1
  527. package/dist/community-v2.d.ts.map +0 -1
  528. package/dist/community-v2.js.map +0 -1
  529. package/dist/core/ab-test-framework.d.ts.map +0 -1
  530. package/dist/core/ab-test-framework.js.map +0 -1
  531. package/dist/core/agents-md.d.ts.map +0 -1
  532. package/dist/core/agents-md.js.map +0 -1
  533. package/dist/core/ai-memory.d.ts.map +0 -1
  534. package/dist/core/ai-memory.js.map +0 -1
  535. package/dist/core/build-failure-predictor.d.ts.map +0 -1
  536. package/dist/core/build-failure-predictor.js.map +0 -1
  537. package/dist/core/cell-store.d.ts.map +0 -1
  538. package/dist/core/cell-store.js.map +0 -1
  539. package/dist/core/cloud-client.d.ts.map +0 -1
  540. package/dist/core/cloud-client.js.map +0 -1
  541. package/dist/core/community-advanced-engine.d.ts.map +0 -1
  542. package/dist/core/community-advanced-engine.js.map +0 -1
  543. package/dist/core/community-engine.d.ts.map +0 -1
  544. package/dist/core/community-engine.js.map +0 -1
  545. package/dist/core/community-full.d.ts.map +0 -1
  546. package/dist/core/community-full.js.map +0 -1
  547. package/dist/core/community-live.d.ts.map +0 -1
  548. package/dist/core/community-live.js.map +0 -1
  549. package/dist/core/community-prior.d.ts.map +0 -1
  550. package/dist/core/community-prior.js.map +0 -1
  551. package/dist/core/community-store.d.ts.map +0 -1
  552. package/dist/core/community-store.js.map +0 -1
  553. package/dist/core/config-attribution.d.ts.map +0 -1
  554. package/dist/core/config-attribution.js.map +0 -1
  555. package/dist/core/convention-detector.d.ts.map +0 -1
  556. package/dist/core/convention-detector.js.map +0 -1
  557. package/dist/core/cost-optimizer.d.ts.map +0 -1
  558. package/dist/core/cost-optimizer.js.map +0 -1
  559. package/dist/core/cross-domain-projections.d.ts.map +0 -1
  560. package/dist/core/cross-domain-projections.js.map +0 -1
  561. package/dist/core/cross-language-mappings.d.ts.map +0 -1
  562. package/dist/core/cross-language-mappings.js.map +0 -1
  563. package/dist/core/database.d.ts.map +0 -1
  564. package/dist/core/database.js.map +0 -1
  565. package/dist/core/decay-engine.d.ts.map +0 -1
  566. package/dist/core/decay-engine.js.map +0 -1
  567. package/dist/core/developer-profile.d.ts +0 -6
  568. package/dist/core/developer-profile.d.ts.map +0 -1
  569. package/dist/core/developer-profile.js.map +0 -1
  570. package/dist/core/error-predictor.d.ts.map +0 -1
  571. package/dist/core/error-predictor.js.map +0 -1
  572. package/dist/core/explainability.d.ts.map +0 -1
  573. package/dist/core/explainability.js.map +0 -1
  574. package/dist/core/failure-memory.d.ts.map +0 -1
  575. package/dist/core/failure-memory.js +0 -113
  576. package/dist/core/failure-memory.js.map +0 -1
  577. package/dist/core/git-branch-pregenerator.d.ts.map +0 -1
  578. package/dist/core/git-branch-pregenerator.js.map +0 -1
  579. package/dist/core/identity-resolver.d.ts.map +0 -1
  580. package/dist/core/identity-resolver.js.map +0 -1
  581. package/dist/core/interruption-recovery.d.ts.map +0 -1
  582. package/dist/core/interruption-recovery.js.map +0 -1
  583. package/dist/core/knowledge-graph-engine.d.ts.map +0 -1
  584. package/dist/core/knowledge-graph-engine.js.map +0 -1
  585. package/dist/core/knowledge-graph-store.d.ts.map +0 -1
  586. package/dist/core/knowledge-graph-store.js.map +0 -1
  587. package/dist/core/knowledge-graph.d.ts.map +0 -1
  588. package/dist/core/knowledge-graph.js.map +0 -1
  589. package/dist/core/live-watcher.d.ts.map +0 -1
  590. package/dist/core/live-watcher.js.map +0 -1
  591. package/dist/core/logger.d.ts.map +0 -1
  592. package/dist/core/logger.js.map +0 -1
  593. package/dist/core/marketplace.d.ts.map +0 -1
  594. package/dist/core/marketplace.js.map +0 -1
  595. package/dist/core/merge-conflict-predictor.d.ts.map +0 -1
  596. package/dist/core/merge-conflict-predictor.js.map +0 -1
  597. package/dist/core/model-intelligence.d.ts.map +0 -1
  598. package/dist/core/model-intelligence.js.map +0 -1
  599. package/dist/core/outcome-engine.d.ts.map +0 -1
  600. package/dist/core/outcome-engine.js.map +0 -1
  601. package/dist/core/outcome-recorder.d.ts.map +0 -1
  602. package/dist/core/outcome-recorder.js.map +0 -1
  603. package/dist/core/outcome-store.d.ts.map +0 -1
  604. package/dist/core/outcome-store.js.map +0 -1
  605. package/dist/core/outcome-types.d.ts.map +0 -1
  606. package/dist/core/outcome-types.js.map +0 -1
  607. package/dist/core/pattern-store.d.ts.map +0 -1
  608. package/dist/core/pattern-store.js.map +0 -1
  609. package/dist/core/performance-predictor.d.ts.map +0 -1
  610. package/dist/core/performance-predictor.js.map +0 -1
  611. package/dist/core/platt-calibration.d.ts.map +0 -1
  612. package/dist/core/platt-calibration.js.map +0 -1
  613. package/dist/core/playbook-generator.d.ts.map +0 -1
  614. package/dist/core/playbook-generator.js.map +0 -1
  615. package/dist/core/pr-review-assistant.d.ts.map +0 -1
  616. package/dist/core/pr-review-assistant.js.map +0 -1
  617. package/dist/core/privacy-manager.d.ts.map +0 -1
  618. package/dist/core/privacy-manager.js.map +0 -1
  619. package/dist/core/project-dna.d.ts.map +0 -1
  620. package/dist/core/project-dna.js.map +0 -1
  621. package/dist/core/prompt-builder.d.ts.map +0 -1
  622. package/dist/core/prompt-builder.js.map +0 -1
  623. package/dist/core/proof-engine.d.ts.map +0 -1
  624. package/dist/core/proof-engine.js.map +0 -1
  625. package/dist/core/realtime-guardian.d.ts.map +0 -1
  626. package/dist/core/realtime-guardian.js.map +0 -1
  627. package/dist/core/recommendation-engine.d.ts.map +0 -1
  628. package/dist/core/recommendation-engine.js.map +0 -1
  629. package/dist/core/recommendation-store.d.ts.map +0 -1
  630. package/dist/core/recommendation-store.js.map +0 -1
  631. package/dist/core/recommendation-types.d.ts.map +0 -1
  632. package/dist/core/recommendation-types.js.map +0 -1
  633. package/dist/core/reputation.d.ts.map +0 -1
  634. package/dist/core/reputation.js.map +0 -1
  635. package/dist/core/security-predictor.d.ts.map +0 -1
  636. package/dist/core/security-predictor.js.map +0 -1
  637. package/dist/core/security.d.ts.map +0 -1
  638. package/dist/core/security.js.map +0 -1
  639. package/dist/core/session-memory.d.ts.map +0 -1
  640. package/dist/core/session-memory.js.map +0 -1
  641. package/dist/core/setup.d.ts.map +0 -1
  642. package/dist/core/setup.js.map +0 -1
  643. package/dist/core/signal-capture.d.ts.map +0 -1
  644. package/dist/core/signal-capture.js.map +0 -1
  645. package/dist/core/time-saved.d.ts.map +0 -1
  646. package/dist/core/time-saved.js.map +0 -1
  647. package/dist/core/usage-intelligence-store.d.ts.map +0 -1
  648. package/dist/core/usage-intelligence-store.js.map +0 -1
  649. package/dist/core/watch-cli.d.ts.map +0 -1
  650. package/dist/core/watch-cli.js.map +0 -1
  651. package/dist/core/workflow-outcome-graph.d.ts.map +0 -1
  652. package/dist/core/workflow-outcome-graph.js.map +0 -1
  653. package/dist/core/workflow-tracker.d.ts.map +0 -1
  654. package/dist/core/workflow-tracker.js.map +0 -1
  655. package/dist/cross-model-engine.d.ts.map +0 -1
  656. package/dist/cross-model-engine.js.map +0 -1
  657. package/dist/cross-model-memory.d.ts.map +0 -1
  658. package/dist/cross-model-memory.js.map +0 -1
  659. package/dist/daemon/lifecycle.d.ts.map +0 -1
  660. package/dist/daemon/lifecycle.js.map +0 -1
  661. package/dist/daemon/server.d.ts +0 -83
  662. package/dist/daemon/server.d.ts.map +0 -1
  663. package/dist/daemon/server.js.map +0 -1
  664. package/dist/daemon/watchdog.d.ts.map +0 -1
  665. package/dist/daemon/watchdog.js.map +0 -1
  666. package/dist/daemon/websocket.d.ts.map +0 -1
  667. package/dist/daemon/websocket.js.map +0 -1
  668. package/dist/developer-intelligence.d.ts.map +0 -1
  669. package/dist/developer-intelligence.js.map +0 -1
  670. package/dist/first-run.d.ts.map +0 -1
  671. package/dist/first-run.js.map +0 -1
  672. package/dist/focus-report.d.ts.map +0 -1
  673. package/dist/focus-report.js.map +0 -1
  674. package/dist/ide-intelligence.d.ts.map +0 -1
  675. package/dist/ide-intelligence.js.map +0 -1
  676. package/dist/insight-generator.d.ts.map +0 -1
  677. package/dist/insight-generator.js.map +0 -1
  678. package/dist/journey-memory.d.ts.map +0 -1
  679. package/dist/journey-memory.js.map +0 -1
  680. package/dist/knowledge-graph-builder.d.ts.map +0 -1
  681. package/dist/knowledge-graph-builder.js.map +0 -1
  682. package/dist/layers.d.ts.map +0 -1
  683. package/dist/layers.js.map +0 -1
  684. package/dist/mcp-server.d.ts +0 -406
  685. package/dist/mcp-server.d.ts.map +0 -1
  686. package/dist/mcp-server.js +0 -414
  687. package/dist/mcp-server.js.map +0 -1
  688. package/dist/onboarding-scan.d.ts +0 -174
  689. package/dist/onboarding-scan.d.ts.map +0 -1
  690. package/dist/onboarding-scan.js +0 -1039
  691. package/dist/onboarding-scan.js.map +0 -1
  692. package/dist/pc-scanner.d.ts.map +0 -1
  693. package/dist/pc-scanner.js.map +0 -1
  694. package/dist/personal-intelligence.d.ts.map +0 -1
  695. package/dist/personal-intelligence.js.map +0 -1
  696. package/dist/predictive-engine.d.ts.map +0 -1
  697. package/dist/predictive-engine.js.map +0 -1
  698. package/dist/predictive-intelligence.d.ts.map +0 -1
  699. package/dist/predictive-intelligence.js.map +0 -1
  700. package/dist/production.d.ts.map +0 -1
  701. package/dist/production.js.map +0 -1
  702. package/dist/senior-features.d.ts +0 -63
  703. package/dist/senior-features.d.ts.map +0 -1
  704. package/dist/senior-features.js +0 -325
  705. package/dist/senior-features.js.map +0 -1
  706. package/dist/stack-detector.d.ts.map +0 -1
  707. package/dist/stack-detector.js.map +0 -1
  708. package/dist/store.d.ts +0 -4
  709. package/dist/store.d.ts.map +0 -1
  710. package/dist/store.js +0 -47
  711. package/dist/store.js.map +0 -1
  712. package/dist/style-pull.d.ts.map +0 -1
  713. package/dist/style-pull.js.map +0 -1
  714. package/dist/team-collaboration.d.ts.map +0 -1
  715. package/dist/team-collaboration.js.map +0 -1
  716. package/dist/team-git.d.ts.map +0 -1
  717. package/dist/team-git.js.map +0 -1
  718. package/dist/team-intel.d.ts.map +0 -1
  719. package/dist/team-intel.js.map +0 -1
  720. package/dist/team-intelligence.d.ts +0 -64
  721. package/dist/team-intelligence.d.ts.map +0 -1
  722. package/dist/team-intelligence.js +0 -289
  723. package/dist/team-intelligence.js.map +0 -1
  724. package/dist/test-touch-145026.d.ts +0 -1
  725. package/dist/test-touch-145026.d.ts.map +0 -1
  726. package/dist/test-touch-145026.js +0 -2
  727. package/dist/test-touch-145026.js.map +0 -1
  728. package/dist/test-watch.d.ts +0 -2
  729. package/dist/test-watch.d.ts.map +0 -1
  730. package/dist/test-watch.js +0 -8
  731. package/dist/test-watch.js.map +0 -1
  732. package/dist/user-intelligence.d.ts.map +0 -1
  733. package/dist/user-intelligence.js.map +0 -1
  734. package/dist/verify-145929.d.ts +0 -1
  735. package/dist/verify-145929.d.ts.map +0 -1
  736. package/dist/verify-145929.js +0 -2
  737. package/dist/verify-145929.js.map +0 -1
  738. package/dist/verify2-150021.d.ts +0 -1
  739. package/dist/verify2-150021.d.ts.map +0 -1
  740. package/dist/verify2-150021.js +0 -2
  741. package/dist/verify2-150021.js.map +0 -1
  742. package/dist/work-style.d.ts +0 -49
  743. package/dist/work-style.d.ts.map +0 -1
  744. package/dist/work-style.js +0 -247
  745. package/dist/work-style.js.map +0 -1
  746. /package/dist/{core → walls/01-context/context}/agents-md.d.ts +0 -0
  747. /package/dist/{core → walls/01-context/context}/agents-md.js +0 -0
  748. /package/dist/{ide-intelligence.d.ts → walls/01-context/context/ide-intelligence.d.ts} +0 -0
  749. /package/dist/{core → walls/01-context/context}/prompt-builder.d.ts +0 -0
  750. /package/dist/{user-intelligence.d.ts → walls/01-context/context/user-intelligence.d.ts} +0 -0
  751. /package/dist/{user-intelligence.js → walls/01-context/context/user-intelligence.js} +0 -0
  752. /package/dist/{core → walls/01-context/sessions}/interruption-recovery.d.ts +0 -0
  753. /package/dist/{core → walls/01-context/sessions}/interruption-recovery.js +0 -0
  754. /package/dist/{core → walls/01-context/sessions}/session-memory.d.ts +0 -0
  755. /package/dist/{code-scanner.d.ts → walls/02-scanner/blindspots/code-scanner.d.ts} +0 -0
  756. /package/dist/{pc-scanner.d.ts → walls/02-scanner/stack/pc-scanner.d.ts} +0 -0
  757. /package/dist/{stack-detector.d.ts → walls/02-scanner/stack/stack-detector.d.ts} +0 -0
  758. /package/dist/{stack-detector.js → walls/02-scanner/stack/stack-detector.js} +0 -0
  759. /package/dist/{style-pull.d.ts → walls/02-scanner/style/style-pull.d.ts} +0 -0
  760. /package/dist/{style-pull.js → walls/02-scanner/style/style-pull.js} +0 -0
  761. /package/dist/{core → walls/03-knowledge/decisions}/ab-test-framework.d.ts +0 -0
  762. /package/dist/{core → walls/03-knowledge/decisions}/ab-test-framework.js +0 -0
  763. /package/dist/{ai-bridge.d.ts → walls/03-knowledge/decisions/ai-bridge.d.ts} +0 -0
  764. /package/dist/{behavior-intelligence.d.ts → walls/03-knowledge/decisions/behavior-intelligence.d.ts} +0 -0
  765. /package/dist/{behavior-intelligence.js → walls/03-knowledge/decisions/behavior-intelligence.js} +0 -0
  766. /package/dist/{behavioral-tracker.d.ts → walls/03-knowledge/decisions/behavioral-tracker.d.ts} +0 -0
  767. /package/dist/{core → walls/03-knowledge/decisions}/build-failure-predictor.d.ts +0 -0
  768. /package/dist/{core → walls/03-knowledge/decisions}/build-failure-predictor.js +0 -0
  769. /package/dist/{core → walls/03-knowledge/decisions}/cost-optimizer.d.ts +0 -0
  770. /package/dist/{cross-model-engine.d.ts → walls/03-knowledge/decisions/cross-model-engine.d.ts} +0 -0
  771. /package/dist/{cross-model-memory.d.ts → walls/03-knowledge/decisions/cross-model-memory.d.ts} +0 -0
  772. /package/dist/{core → walls/03-knowledge/decisions}/developer-profile.js +0 -0
  773. /package/dist/{core → walls/03-knowledge/decisions}/error-predictor.d.ts +0 -0
  774. /package/dist/{core → walls/03-knowledge/decisions}/error-predictor.js +0 -0
  775. /package/dist/{focus-report.d.ts → walls/03-knowledge/decisions/focus-report.d.ts} +0 -0
  776. /package/dist/{focus-report.js → walls/03-knowledge/decisions/focus-report.js} +0 -0
  777. /package/dist/{core → walls/03-knowledge/decisions}/git-branch-pregenerator.js +0 -0
  778. /package/dist/{insight-generator.d.ts → walls/03-knowledge/decisions/insight-generator.d.ts} +0 -0
  779. /package/dist/{insight-generator.js → walls/03-knowledge/decisions/insight-generator.js} +0 -0
  780. /package/dist/{journey-memory.d.ts → walls/03-knowledge/decisions/journey-memory.d.ts} +0 -0
  781. /package/dist/{journey-memory.js → walls/03-knowledge/decisions/journey-memory.js} +0 -0
  782. /package/dist/{core → walls/03-knowledge/decisions}/merge-conflict-predictor.d.ts +0 -0
  783. /package/dist/{core → walls/03-knowledge/decisions}/merge-conflict-predictor.js +0 -0
  784. /package/dist/{core → walls/03-knowledge/decisions}/model-intelligence.d.ts +0 -0
  785. /package/dist/{core → walls/03-knowledge/decisions}/model-intelligence.js +0 -0
  786. /package/dist/{core → walls/03-knowledge/decisions}/outcome-engine.js +0 -0
  787. /package/dist/{core → walls/03-knowledge/decisions}/outcome-recorder.js +0 -0
  788. /package/dist/{core → walls/03-knowledge/decisions}/performance-predictor.d.ts +0 -0
  789. /package/dist/{core → walls/03-knowledge/decisions}/performance-predictor.js +0 -0
  790. /package/dist/{core → walls/03-knowledge/decisions}/platt-calibration.d.ts +0 -0
  791. /package/dist/{core → walls/03-knowledge/decisions}/platt-calibration.js +0 -0
  792. /package/dist/{predictive-engine.d.ts → walls/03-knowledge/decisions/predictive-engine.d.ts} +0 -0
  793. /package/dist/{predictive-intelligence.d.ts → walls/03-knowledge/decisions/predictive-intelligence.d.ts} +0 -0
  794. /package/dist/{core → walls/03-knowledge/decisions}/realtime-guardian.d.ts +0 -0
  795. /package/dist/{core → walls/03-knowledge/decisions}/realtime-guardian.js +0 -0
  796. /package/dist/{core → walls/03-knowledge/decisions}/security-predictor.d.ts +0 -0
  797. /package/dist/{core → walls/03-knowledge/decisions}/security-predictor.js +0 -0
  798. /package/dist/{core → walls/03-knowledge/decisions}/time-saved.d.ts +0 -0
  799. /package/dist/{core → walls/03-knowledge/decisions}/time-saved.js +0 -0
  800. /package/dist/{core → walls/03-knowledge/decisions}/workflow-outcome-graph.d.ts +0 -0
  801. /package/dist/{core → walls/03-knowledge/decisions}/workflow-outcome-graph.js +0 -0
  802. /package/dist/{core → walls/03-knowledge/decisions}/workflow-tracker.js +0 -0
  803. /package/dist/{core → walls/03-knowledge/dna}/config-attribution.js +0 -0
  804. /package/dist/{core → walls/03-knowledge/dna}/cross-domain-projections.d.ts +0 -0
  805. /package/dist/{core → walls/03-knowledge/dna}/cross-domain-projections.js +0 -0
  806. /package/dist/{core → walls/03-knowledge/dna}/cross-language-mappings.d.ts +0 -0
  807. /package/dist/{core → walls/03-knowledge/dna}/cross-language-mappings.js +0 -0
  808. /package/dist/{personal-intelligence.d.ts → walls/03-knowledge/dna/personal-intelligence.d.ts} +0 -0
  809. /package/dist/{core → walls/03-knowledge/dna}/proof-engine.d.ts +0 -0
  810. /package/dist/{knowledge-graph-builder.d.ts → walls/03-knowledge/graph/knowledge-graph-builder.d.ts} +0 -0
  811. /package/dist/{knowledge-graph-builder.js → walls/03-knowledge/graph/knowledge-graph-builder.js} +0 -0
  812. /package/dist/{core → walls/03-knowledge/graph}/knowledge-graph-engine.d.ts +0 -0
  813. /package/dist/{core → walls/03-knowledge/graph}/knowledge-graph.d.ts +0 -0
  814. /package/dist/{team-collaboration.d.ts → walls/04-team/collab/team-collaboration.d.ts} +0 -0
  815. /package/dist/{team-git.d.ts → walls/04-team/collab/team-git.d.ts} +0 -0
  816. /package/dist/{team-intel.d.ts → walls/04-team/collab/team-intel.d.ts} +0 -0
  817. /package/dist/{team-intel.js → walls/04-team/collab/team-intel.js} +0 -0
  818. /package/dist/{core → walls/04-team/review}/pr-review-assistant.js +0 -0
  819. /package/dist/{core → walls/05-community/privacy}/privacy-manager.d.ts +0 -0
  820. /package/dist/{core → walls/05-community/privacy}/privacy-manager.js +0 -0
  821. /package/dist/{core → walls/05-community/privacy}/security.d.ts +0 -0
  822. /package/dist/{core → walls/05-community/privacy}/security.js +0 -0
  823. /package/dist/{core → walls/05-community/share}/identity-resolver.d.ts +0 -0
  824. /package/dist/{core → walls/05-community/share}/identity-resolver.js +0 -0
  825. /package/dist/{core → walls/05-community/share}/marketplace.d.ts +0 -0
  826. /package/dist/{core → walls/05-community/share}/marketplace.js +0 -0
  827. /package/dist/{core → walls/05-community/share}/reputation.d.ts +0 -0
  828. /package/dist/{core → walls/05-community/share}/reputation.js +0 -0
  829. /package/dist/{core → walls/05-community/stats}/community-advanced-engine.d.ts +0 -0
  830. /package/dist/{core → walls/05-community/stats}/community-engine.d.ts +0 -0
  831. /package/dist/{core → walls/05-community/stats}/community-full.js +0 -0
  832. /package/dist/{community-intel.d.ts → walls/05-community/stats/community-intel.d.ts} +0 -0
  833. /package/dist/{community-intelligence.d.ts → walls/05-community/stats/community-intelligence.d.ts} +0 -0
  834. /package/dist/{community-intelligence.js → walls/05-community/stats/community-intelligence.js} +0 -0
  835. /package/dist/{core → walls/05-community/stats}/community-live.d.ts +0 -0
  836. /package/dist/{core → walls/05-community/stats}/community-live.js +0 -0
  837. /package/dist/{core → walls/05-community/stats}/community-prior.js +0 -0
  838. /package/dist/{community-v2.d.ts → walls/05-community/stats/community-v2.d.ts} +0 -0
  839. /package/dist/{layers.d.ts → walls/05-community/stats/layers.d.ts} +0 -0
  840. /package/dist/{layers.js → walls/05-community/stats/layers.js} +0 -0
  841. /package/dist/{core → walls/05-community/stats}/playbook-generator.js +0 -0
  842. /package/dist/{core → walls/06-memory/database}/database.d.ts +0 -0
  843. /package/dist/{core → walls/06-memory/database}/logger.d.ts +0 -0
  844. /package/dist/{core → walls/06-memory/database}/logger.js +0 -0
  845. /package/dist/{core → walls/06-memory/stores}/cell-store.d.ts +0 -0
  846. /package/dist/{core → walls/06-memory/stores}/cell-store.js +0 -0
  847. /package/dist/{core → walls/06-memory/stores}/community-store.d.ts +0 -0
  848. /package/dist/{core → walls/06-memory/stores}/decay-engine.d.ts +0 -0
  849. /package/dist/{core → walls/06-memory/stores}/decay-engine.js +0 -0
  850. /package/dist/{core → walls/06-memory/stores}/outcome-store.d.ts +0 -0
  851. /package/dist/{core → walls/06-memory/stores}/outcome-store.js +0 -0
  852. /package/dist/{core → walls/06-memory/stores}/outcome-types.d.ts +0 -0
  853. /package/dist/{core → walls/06-memory/stores}/outcome-types.js +0 -0
  854. /package/dist/{core → walls/06-memory/stores}/recommendation-store.d.ts +0 -0
  855. /package/dist/{core → walls/06-memory/stores}/recommendation-store.js +0 -0
  856. /package/dist/{core → walls/06-memory/stores}/recommendation-types.d.ts +0 -0
  857. /package/dist/{core → walls/06-memory/stores}/recommendation-types.js +0 -0
  858. /package/dist/{core → walls/06-memory/stores}/usage-intelligence-store.d.ts +0 -0
  859. /package/dist/{cli-repl.d.ts → walls/07-runtime/cli/cli-repl.d.ts} +0 -0
  860. /package/dist/{cli.d.ts → walls/07-runtime/cli/cli.d.ts} +0 -0
  861. /package/dist/{daemon → walls/07-runtime/daemon}/lifecycle.d.ts +0 -0
  862. /package/dist/{daemon → walls/07-runtime/daemon}/lifecycle.js +0 -0
  863. /package/dist/{daemon → walls/07-runtime/daemon}/watchdog.d.ts +0 -0
  864. /package/dist/{daemon → walls/07-runtime/daemon}/watchdog.js +0 -0
  865. /package/dist/{daemon → walls/07-runtime/daemon}/websocket.d.ts +0 -0
  866. /package/dist/{first-run.d.ts → walls/07-runtime/setup/first-run.d.ts} +0 -0
  867. /package/dist/{first-run.js → walls/07-runtime/setup/first-run.js} +0 -0
  868. /package/dist/{production.d.ts → walls/07-runtime/setup/production.d.ts} +0 -0
  869. /package/dist/{core → walls/07-runtime/setup}/setup.d.ts +0 -0
  870. /package/dist/{core → walls/07-runtime/watcher}/live-watcher.d.ts +0 -0
  871. /package/dist/{core → walls/07-runtime/watcher}/watch-cli.d.ts +0 -0
  872. /package/dist/{core → walls/07-runtime/watcher}/watch-cli.js +0 -0
  873. /package/dist/{core → walls/08-cloud-bridge/sync}/cloud-client.d.ts +0 -0
  874. /package/dist/{cloud-sync.d.ts → walls/08-cloud-bridge/sync/cloud-sync.d.ts} +0 -0
@@ -43,8 +43,8 @@ const os = __importStar(require("os"));
43
43
  const chalk_1 = __importDefault(require("chalk"));
44
44
  const figlet_1 = __importDefault(require("figlet"));
45
45
  const gradient_string_1 = __importDefault(require("gradient-string"));
46
- const database_1 = require("./core/database");
47
- const layers_1 = require("./layers");
46
+ const database_1 = require("../../06-memory/database/database");
47
+ const layers_1 = require("../../05-community/stats/layers");
48
48
  const cli_repl_1 = require("./cli-repl");
49
49
  (0, database_1.initializeDatabase)();
50
50
  const C = {
@@ -88,6 +88,18 @@ function parseArgs(argv) {
88
88
  }
89
89
  const args = parseArgs(process.argv.slice(2));
90
90
  const cmd = args[0] || '';
91
+ // Module-level state for watch-editor (must be declared before switch)
92
+ let activeMonitor = null;
93
+ let monitorStateFile = null;
94
+ function isPidAlive(pid) {
95
+ try {
96
+ process.kill(pid, 0);
97
+ return true;
98
+ }
99
+ catch {
100
+ return false;
101
+ }
102
+ }
91
103
  switch (cmd) {
92
104
  case '--version':
93
105
  case '-v':
@@ -134,12 +146,49 @@ switch (cmd) {
134
146
  case 'blindspots':
135
147
  doBlindspots();
136
148
  break;
149
+ case 'doctor':
150
+ doDoctor().catch((e) => {
151
+ const msg = e instanceof Error ? e.message : String(e);
152
+ console.log(C.warn(' Doctor failed: ' + msg));
153
+ process.exit(1);
154
+ });
155
+ break;
137
156
  case 'context':
138
157
  doContext();
139
158
  break;
140
159
  case 'mcp-config':
141
160
  doMcpConfig();
142
161
  break;
162
+ case 'replay':
163
+ doReplay();
164
+ break;
165
+ case 'continue':
166
+ doContinue();
167
+ break;
168
+ case 'bridge':
169
+ doBridge();
170
+ break;
171
+ case 'watch-editor':
172
+ doWatchEditor();
173
+ break;
174
+ case 'switch-back':
175
+ doSwitchBack();
176
+ break;
177
+ case 'branches':
178
+ doBranches();
179
+ break;
180
+ case 'lessons':
181
+ doLessons();
182
+ break;
183
+ case 'evolution':
184
+ doEvolution();
185
+ break;
186
+ case 'focus':
187
+ doFocus();
188
+ break;
189
+ case 'why':
190
+ doWhy();
191
+ break;
143
192
  case 'repl':
144
193
  case '-i':
145
194
  case '--interactive':
@@ -167,7 +216,7 @@ function doStart() {
167
216
  console.log(C.dim(' Starting everything...\n'));
168
217
  // 0. First-run greeting
169
218
  try {
170
- const { firstRunGreeting } = require('./first-run');
219
+ const { firstRunGreeting } = require('../setup/first-run');
171
220
  firstRunGreeting();
172
221
  }
173
222
  catch { }
@@ -204,7 +253,7 @@ function doStart() {
204
253
  function startDaemon() {
205
254
  // 1. Kill any stale daemon (clean restart)
206
255
  try {
207
- const { stopDaemon } = require('./daemon/lifecycle');
256
+ const { stopDaemon } = require('../daemon/lifecycle');
208
257
  stopDaemon();
209
258
  // Wait for port to be released
210
259
  const { execSync } = require('child_process');
@@ -228,7 +277,7 @@ function startDaemon() {
228
277
  const pathMod = require('path');
229
278
  const fsMod = require('fs');
230
279
  const osMod = require('os');
231
- const serverPath = pathMod.join(__dirname, 'daemon', 'server.js');
280
+ const serverPath = pathMod.join(__dirname, '..', 'daemon', 'server.js');
232
281
  const logFile = pathMod.join(osMod.homedir(), '.fivo', 'cell', 'daemon.log');
233
282
  fsMod.mkdirSync(pathMod.dirname(logFile), { recursive: true });
234
283
  const out = fsMod.openSync(logFile, 'a');
@@ -256,7 +305,7 @@ function startDaemon() {
256
305
  }
257
306
  function printProjectStatusAndExit() {
258
307
  try {
259
- const { detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning } = require('./core/setup');
308
+ const { detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning } = require('../setup/setup');
260
309
  const httpMod = require('http');
261
310
  const project = detectProject(process.cwd());
262
311
  const scan = checkScanState(process.cwd());
@@ -290,7 +339,7 @@ function printProjectStatusAndExit() {
290
339
  function doStop() {
291
340
  console.log(C.dim(' Stopping Cell daemon...'));
292
341
  try {
293
- const { stopDaemon } = require('./daemon/lifecycle');
342
+ const { stopDaemon } = require('../daemon/lifecycle');
294
343
  const result = stopDaemon();
295
344
  console.log(result.success ? C.success(` ${result.message}`) : C.warn(` ${result.message}`));
296
345
  }
@@ -318,7 +367,7 @@ function doAnalyze() {
318
367
  process.stdin.on('end', () => {
319
368
  const content = Buffer.concat(chunks).toString().trim();
320
369
  if (content) {
321
- const { saveAIInsight } = require('./ai-bridge');
370
+ const { saveAIInsight } = require('../../03-knowledge/decisions/ai-bridge');
322
371
  saveAIInsight(project, category, content);
323
372
  console.log(C.success(` Insights saved: ${category}`));
324
373
  console.log(C.dim(` .cell/personal/insights/${category}.md`));
@@ -336,7 +385,7 @@ function doAnalyze() {
336
385
  }
337
386
  // ─── Show insights ─────────────────────────────────────────────────
338
387
  if (sub === '--show') {
339
- const { getAIInsights } = require('./ai-bridge');
388
+ const { getAIInsights } = require('../../03-knowledge/decisions/ai-bridge');
340
389
  const insights = getAIInsights(project);
341
390
  if (insights.length === 0) {
342
391
  console.log(C.dim(' No AI insights yet. Run: cell analyze'));
@@ -353,7 +402,7 @@ function doAnalyze() {
353
402
  return;
354
403
  }
355
404
  // ─── Default: Generate prompts ─────────────────────────────────────
356
- const { getAnalysisCommand } = require('./ai-bridge');
405
+ const { getAnalysisCommand } = require('../../03-knowledge/decisions/ai-bridge');
357
406
  const { intro, prompts } = getAnalysisCommand(process.cwd());
358
407
  console.log(C.dim(intro));
359
408
  console.log();
@@ -390,9 +439,14 @@ function doScan() {
390
439
  // path.basename(cwd) which is a *name*, not a directory path.
391
440
  const scanPathArg = args.find((a, i) => i >= 1 && !a.startsWith('--'));
392
441
  const scanCwd = scanPathArg ? path.resolve(scanPathArg) : process.cwd();
393
- const scanProject = path.basename(scanCwd);
442
+ let scanProject = path.basename(scanCwd);
394
443
  try {
395
- const { scanCodebase } = require('./code-scanner');
444
+ const { detectProject } = require('../setup/setup');
445
+ scanProject = detectProject(scanCwd).name;
446
+ }
447
+ catch { }
448
+ try {
449
+ const { scanCodebase } = require('../../02-scanner/blindspots/code-scanner');
396
450
  const result = scanCodebase(scanCwd, scanProject);
397
451
  console.log(C.success(` [1/2] Scanned ${result.filesScanned} files, ${result.totalLines.toLocaleString()} lines`));
398
452
  (0, layers_1.populateAllLayers)({
@@ -406,7 +460,7 @@ function doScan() {
406
460
  console.log(C.dim(' .cell/community/ — community patterns, trends'));
407
461
  // ─── AI rules files (AGENTS.md, .cursorrules) ─────────────────────────
408
462
  if (!noRules) {
409
- const { writeCellRules } = require('./core/agents-md');
463
+ const { writeCellRules } = require('../../01-context/context/agents-md');
410
464
  const rulesResult = writeCellRules(scanCwd, { overwrite: forceRules });
411
465
  const lines = [];
412
466
  if (rulesResult.agentsMd === 'written')
@@ -423,9 +477,43 @@ function doScan() {
423
477
  else {
424
478
  console.log(C.dim(' [3/3] AI rules: skipped (--no-rules)'));
425
479
  }
480
+ // ─── Top 5 fixes ────────────────────────────────────────────────────
481
+ try {
482
+ const { scanDirectoryForBlindSpots, getTopFixes, getCategorySummary } = require('../../../core/enhanced-blind-spots');
483
+ const spots = scanDirectoryForBlindSpots(scanCwd, 200);
484
+ const topFixes = getTopFixes(spots, 5);
485
+ if (topFixes.length > 0) {
486
+ console.log();
487
+ console.log(C.bold(' Top 5 fixes first:'));
488
+ for (let i = 0; i < topFixes.length; i++) {
489
+ const s = topFixes[i];
490
+ console.log(` ${C.num(String(i + 1))}. ${s.message}`);
491
+ console.log(` ${C.dim(s.filePath + ':' + s.lineNumber)}`);
492
+ }
493
+ }
494
+ const catSummary = getCategorySummary(spots);
495
+ if (catSummary.length > 0) {
496
+ console.log();
497
+ console.log(C.dim(' Category breakdown:'));
498
+ for (const c of catSummary.slice(0, 6)) {
499
+ console.log(C.dim(` ${c.category}: ${c.count} (${c.topSeverity})`));
500
+ }
501
+ }
502
+ }
503
+ catch { }
426
504
  console.log();
427
505
  console.log(C.dim(' Run: cell status'));
428
506
  console.log();
507
+ try {
508
+ const { markFirstScan } = require('../setup/cell-state');
509
+ markFirstScan();
510
+ }
511
+ catch { }
512
+ try {
513
+ const { captureCurrentBranchSnapshot } = require('../../03-knowledge/decisions/branch-snapshot');
514
+ captureCurrentBranchSnapshot(scanProject, scanCwd);
515
+ }
516
+ catch { }
429
517
  }
430
518
  catch (e) {
431
519
  console.log(C.warn(' Scan failed: ' + String(e)));
@@ -464,7 +552,7 @@ async function doSetup() {
464
552
  const dirIdx = args.indexOf('--dir');
465
553
  const dir = dirIdx > 0 ? args[dirIdx + 1] : undefined;
466
554
  try {
467
- const { runSetup, detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning, } = require('./core/setup');
555
+ const { runSetup, detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning, } = require('../setup/setup');
468
556
  const cwd = process.cwd();
469
557
  const project = detectProject(cwd, projectName);
470
558
  console.log(C.bold(` Project: ${C.num(project.name)}`));
@@ -539,13 +627,23 @@ async function doSetup() {
539
627
  const allGood = result.scan.done && result.watch.done && mcpOk && result.errors.length === 0;
540
628
  if (allGood) {
541
629
  console.log(C.success(` Setup complete in ${ms}ms. Cell is ready.`));
630
+ try {
631
+ const { markSetupCompleted } = require('../setup/cell-state');
632
+ markSetupCompleted();
633
+ }
634
+ catch { }
542
635
  }
543
636
  else {
544
637
  console.log(C.warn(` Setup finished in ${ms}ms with warnings (see above).`));
545
638
  }
546
639
  console.log();
547
- console.log(C.dim(' Run: cell status Check what Cell knows about you'));
548
- console.log(C.dim(' Run: cell context Inject @cell block into your AI prompt'));
640
+ console.log(C.bold(' Next commands:'));
641
+ console.log(` ${C.num('1.')} ${C.primary('cell context')} See what Cell knows about your project`);
642
+ console.log(` ${C.num('2.')} ${C.primary('cell blindspots --top')} See your top fixes`);
643
+ console.log(` ${C.primary('3.')} ${C.primary('cell bridge start')} Connect your IDE`);
644
+ console.log(` ${C.num('4.')} ${C.primary('cell continue')} Resume your last session`);
645
+ console.log();
646
+ console.log(C.dim(' Run cell doctor anytime to check health.'));
549
647
  console.log();
550
648
  }
551
649
  catch (e) {
@@ -567,7 +665,7 @@ function semiLabel(s) {
567
665
  }
568
666
  // ─── cell --version / -v / version ───────────────────────────────────────────
569
667
  function doVersion() {
570
- const pkg = require('../package.json');
668
+ const pkg = require('../../../../package.json');
571
669
  console.log(`${C.primary('cell')} v${C.num(pkg.version)}`);
572
670
  console.log(C.dim(` ${pkg.description}`));
573
671
  console.log();
@@ -629,7 +727,7 @@ function doStatus() {
629
727
  }
630
728
  }
631
729
  function showProjectStatus() {
632
- const { getDeveloperProfile } = require('./code-scanner');
730
+ const { getDeveloperProfile } = require('../../02-scanner/blindspots/code-scanner');
633
731
  const profile = getDeveloperProfile(project);
634
732
  if (!profile) {
635
733
  console.log(C.warn(`\n No profile for "${project}". Run: cell start`));
@@ -644,7 +742,7 @@ function showProjectStatus() {
644
742
  console.log(C.dim(' ─────────────────'));
645
743
  // Stack fingerprint (from stack-detector)
646
744
  try {
647
- const { detectProjectDNA } = require('./stack-detector');
745
+ const { detectProjectDNA } = require('../../02-scanner/stack/stack-detector');
648
746
  const dna = detectProjectDNA(process.cwd());
649
747
  if (dna && dna.stack.trustScore > 0) {
650
748
  const s = dna.stack;
@@ -677,7 +775,7 @@ function showProjectStatus() {
677
775
  }
678
776
  // Behavioral data
679
777
  try {
680
- const { getBehaviorSummary } = require('./behavioral-tracker');
778
+ const { getBehaviorSummary } = require('../../03-knowledge/decisions/behavioral-tracker');
681
779
  const b = getBehaviorSummary(project);
682
780
  if (b.totalErrors > 0 || b.totalDecisions > 0 || b.currentContext || b.stuckIssues.length > 0) {
683
781
  console.log(C.bold(' Behavior:'));
@@ -694,7 +792,7 @@ function showProjectStatus() {
694
792
  catch { }
695
793
  // ─── Git Intelligence ────────────────────────────────────────────────────
696
794
  try {
697
- const { buildDeveloperIntelligence } = require('./developer-intelligence');
795
+ const { buildDeveloperIntelligence } = require('../../02-scanner/profile/developer-intelligence');
698
796
  const gitIntel = buildDeveloperIntelligence(process.cwd());
699
797
  if (gitIntel) {
700
798
  console.log();
@@ -727,7 +825,7 @@ function showProjectStatus() {
727
825
  catch { }
728
826
  // ─── Predictions ─────────────────────────────────────────────────────────
729
827
  try {
730
- const { getQuickWarnings } = require('./predictive-engine');
828
+ const { getQuickWarnings } = require('../../03-knowledge/decisions/predictive-engine');
731
829
  const warnings = getQuickWarnings(project);
732
830
  if (warnings.length > 0) {
733
831
  console.log();
@@ -788,7 +886,7 @@ function doSession() {
788
886
  console.log(C.dim(' ───────────────────────────────'));
789
887
  console.log();
790
888
  try {
791
- const { getLastTouchedFile, getPatternCounts, getBehaviorSummary } = require('./behavioral-tracker');
889
+ const { getLastTouchedFile, getPatternCounts, getBehaviorSummary } = require('../../03-knowledge/decisions/behavioral-tracker');
792
890
  const last = getLastTouchedFile(project);
793
891
  const patterns = getPatternCounts(project);
794
892
  const behavior = getBehaviorSummary(project);
@@ -825,7 +923,7 @@ function doDecisions() {
825
923
  console.log(C.dim(' ─────────────────────────────────'));
826
924
  console.log();
827
925
  try {
828
- const { getRecentDecisionsWithAgo, getBehaviorSummary } = require('./behavioral-tracker');
926
+ const { getRecentDecisionsWithAgo, getBehaviorSummary } = require('../../03-knowledge/decisions/behavioral-tracker');
829
927
  const decisions = getRecentDecisionsWithAgo(project, 5);
830
928
  const behavior = getBehaviorSummary(project);
831
929
  if (decisions.length === 0) {
@@ -903,7 +1001,7 @@ function doTeam() {
903
1001
  // ─── team push ──────────────────────────────────────────────────────
904
1002
  if (sub === 'push') {
905
1003
  console.log(C.primary(' Pushing your patterns to team...'));
906
- const { teamPush } = require('./team-git');
1004
+ const { teamPush } = require('../../04-team/collab/team-git');
907
1005
  const name = args[2];
908
1006
  if (!name) {
909
1007
  console.log(C.warn(' Usage: cell team push <your-name> [role]'));
@@ -919,7 +1017,7 @@ function doTeam() {
919
1017
  // ─── team pull ──────────────────────────────────────────────────────
920
1018
  if (sub === 'pull') {
921
1019
  console.log(C.primary(' Pulling team data...'));
922
- const { teamPull } = require('./team-git');
1020
+ const { teamPull } = require('../../04-team/collab/team-git');
923
1021
  const result = teamPull();
924
1022
  if (result.success) {
925
1023
  console.log(C.success(` ${result.message}`));
@@ -936,7 +1034,7 @@ function doTeam() {
936
1034
  const newMember = args[2];
937
1035
  const teamPath = path.join(process.cwd(), '.cell', 'team');
938
1036
  console.log(C.primary(` Generating onboarding guide for ${newMember}...`));
939
- const { generateOnboardingGuide, formatOnboardingText } = require('./team-intel');
1037
+ const { generateOnboardingGuide, formatOnboardingText } = require('../../04-team/collab/team-intel');
940
1038
  const guide = generateOnboardingGuide(teamPath, newMember);
941
1039
  if (guide) {
942
1040
  console.log(formatOnboardingText(guide));
@@ -949,7 +1047,7 @@ function doTeam() {
949
1047
  }
950
1048
  // ─── team status ────────────────────────────────────────────────────
951
1049
  if (sub === 'status') {
952
- const { teamStatus } = require('./team-git');
1050
+ const { teamStatus } = require('../../04-team/collab/team-git');
953
1051
  const intel = teamStatus();
954
1052
  if (!intel) {
955
1053
  console.log(C.dim(' No team data. Run: cell team push <your-name>'));
@@ -990,7 +1088,7 @@ function doTeam() {
990
1088
  // Team pattern library
991
1089
  const teamPath = path.join(process.cwd(), '.cell', 'team');
992
1090
  try {
993
- const { buildTeamPatternLibrary } = require('./team-intel');
1091
+ const { buildTeamPatternLibrary } = require('../../04-team/collab/team-intel');
994
1092
  const rules = buildTeamPatternLibrary(teamPath);
995
1093
  if (rules.length > 0) {
996
1094
  console.log(C.bold(' 📋 Pattern Library:'));
@@ -1012,7 +1110,7 @@ function doTeam() {
1012
1110
  }
1013
1111
  // ─── team silos ─────────────────────────────────────────────────────
1014
1112
  if (sub === 'silos') {
1015
- const { detectKnowledgeSilos } = require('./team-collaboration');
1113
+ const { detectKnowledgeSilos } = require('../../04-team/collab/team-collaboration');
1016
1114
  const silos = detectKnowledgeSilos();
1017
1115
  console.log(C.bold(` Knowledge Silos: ${silos.length}`));
1018
1116
  console.log();
@@ -1031,7 +1129,7 @@ function doTeam() {
1031
1129
  }
1032
1130
  // ─── team bus-factor ───────────────────────────────────────────────
1033
1131
  if (sub === 'bus-factor') {
1034
- const { calculateBusFactor } = require('./team-collaboration');
1132
+ const { calculateBusFactor } = require('../../04-team/collab/team-collaboration');
1035
1133
  const report = calculateBusFactor();
1036
1134
  console.log(C.bold(` Bus Factor: ${report.overallScore}/100`));
1037
1135
  console.log();
@@ -1053,7 +1151,7 @@ function doTeam() {
1053
1151
  }
1054
1152
  // ─── team health ───────────────────────────────────────────────────
1055
1153
  if (sub === 'health') {
1056
- const { getTeamHealth } = require('./team-collaboration');
1154
+ const { getTeamHealth } = require('../../04-team/collab/team-collaboration');
1057
1155
  const health = getTeamHealth(args[2]);
1058
1156
  console.log(C.bold(` Team Health: ${health.score}/100`));
1059
1157
  console.log();
@@ -1080,7 +1178,7 @@ function doTeam() {
1080
1178
  if (sub === 'community' || sub === 'comm') {
1081
1179
  const csub = args[2];
1082
1180
  if (csub === 'stats') {
1083
- const { getCommunityStats } = require('./core/community-store');
1181
+ const { getCommunityStats } = require('../../06-memory/stores/community-store');
1084
1182
  const stats = getCommunityStats();
1085
1183
  console.log(C.bold(' Community Stats'));
1086
1184
  console.log(C.dim(` Patterns: ${stats.totalPatterns}, Insights: ${stats.totalInsights}, Benchmarks: ${stats.totalBenchmarks}`));
@@ -1095,7 +1193,7 @@ function doTeam() {
1095
1193
  return;
1096
1194
  }
1097
1195
  if (csub === 'share' && args[3]) {
1098
- const { shareCommunityPattern, validatePrivacy } = require('./core/community-store');
1196
+ const { shareCommunityPattern, validatePrivacy } = require('../../06-memory/stores/community-store');
1099
1197
  const rule = args[3];
1100
1198
  const category = args[4] || 'general';
1101
1199
  const language = args[5];
@@ -1118,7 +1216,7 @@ function doTeam() {
1118
1216
  return;
1119
1217
  }
1120
1218
  if (csub === 'trends') {
1121
- const { getTechEvolution } = require('./core/community-store');
1219
+ const { getTechEvolution } = require('../../06-memory/stores/community-store');
1122
1220
  const trends = getTechEvolution();
1123
1221
  console.log(C.bold(' Technology Trends'));
1124
1222
  for (const t of trends.slice(0, 10)) {
@@ -1134,7 +1232,7 @@ function doTeam() {
1134
1232
  }
1135
1233
  // ─── team usage (Phase 6) ──────────────────────────────────────────
1136
1234
  if (sub === 'usage') {
1137
- const { getUsageDashboard, getDecisionPatterns, detectRepeatMistakes, getBurnoutSignals } = require('./core/usage-intelligence-store');
1235
+ const { getUsageDashboard, getDecisionPatterns, detectRepeatMistakes, getBurnoutSignals } = require('../../06-memory/stores/usage-intelligence-store');
1138
1236
  const project = args[2] || 'Fivo-Cell';
1139
1237
  const dash = getUsageDashboard(project);
1140
1238
  console.log(C.bold(` Usage Dashboard — ${project}`));
@@ -1229,9 +1327,9 @@ function doWatch() {
1229
1327
  // cell watch events fivo-cell --type file_save
1230
1328
  // cell watch events --limit 5 --type file_create
1231
1329
  const watchArgs = args.slice(2);
1232
- const { positional } = require('./core/watch-cli').parseWatchFlags(watchArgs);
1233
- const watchLimit = require('./core/watch-cli').parseWatchLimit(watchArgs);
1234
- const watchEventType = require('./core/watch-cli').parseWatchEventType(watchArgs);
1330
+ const { positional } = require('../watcher/watch-cli').parseWatchFlags(watchArgs);
1331
+ const watchLimit = require('../watcher/watch-cli').parseWatchLimit(watchArgs);
1332
+ const watchEventType = require('../watcher/watch-cli').parseWatchEventType(watchArgs);
1235
1333
  const project = positional[0] || path.basename(process.cwd());
1236
1334
  const dir = positional[1] || process.cwd();
1237
1335
  // If invoked with no subcommand: run as a long-lived watcher daemon (for .bat auto-restart loop)
@@ -1240,7 +1338,7 @@ function doWatch() {
1240
1338
  return;
1241
1339
  }
1242
1340
  try {
1243
- const liveWatcher = require('./core/live-watcher');
1341
+ const liveWatcher = require('../watcher/live-watcher');
1244
1342
  const http = require('http');
1245
1343
  function callDaemon(toolName, toolArgs) {
1246
1344
  return new Promise((resolve, reject) => {
@@ -1281,7 +1379,7 @@ function doWatch() {
1281
1379
  return;
1282
1380
  }
1283
1381
  if (sub === 'events') {
1284
- const { isValidEventType } = require('./core/watch-cli');
1382
+ const { isValidEventType } = require('../watcher/watch-cli');
1285
1383
  const typeFilter = isValidEventType(watchEventType) ? watchEventType : undefined;
1286
1384
  const events = liveWatcher.getLiveEvents(project, watchLimit, typeFilter);
1287
1385
  if (events.length === 0) {
@@ -1343,20 +1441,41 @@ function doBlindspots() {
1343
1441
  console.log(C.bold(' Cell Blind Spots'));
1344
1442
  console.log(C.dim(' ────────────────'));
1345
1443
  console.log();
1346
- const dir = args[1] || process.cwd();
1347
- const maxFiles = parseInt(args[2] || '200', 10);
1444
+ const showTop = args.includes('--top');
1445
+ const topN = (() => {
1446
+ const idx = args.indexOf('--top');
1447
+ if (idx >= 0 && args[idx + 1] && /^\d+$/.test(args[idx + 1]))
1448
+ return parseInt(args[idx + 1], 10);
1449
+ return 5;
1450
+ })();
1451
+ const dirArg = args.find((a, i) => i >= 1 && !a.startsWith('--') && a !== String(topN));
1452
+ const dir = dirArg || process.cwd();
1453
+ const maxFiles = parseInt(args.find((a, i) => i >= 1 && !a.startsWith('--') && /^\d+$/.test(a) && a !== String(topN)) || '200', 10);
1348
1454
  try {
1349
- const { scanDirectoryForBlindSpots, formatBlindSpotReport, summarizeBlindSpots } = require('./core/enhanced-blind-spots');
1455
+ const { scanDirectoryForBlindSpots, formatBlindSpotReport, summarizeBlindSpots, getTopFixes, getCategorySummary } = require('../../../core/enhanced-blind-spots');
1350
1456
  console.log(C.dim(` Scanning ${dir} (max ${maxFiles} files)...`));
1351
1457
  const spots = scanDirectoryForBlindSpots(dir, maxFiles);
1352
1458
  console.log();
1353
- console.log(formatBlindSpotReport(spots));
1354
- const summary = summarizeBlindSpots(spots);
1355
- if (Object.keys(summary.byCategory).length > 0) {
1459
+ if (showTop) {
1460
+ const topFixes = getTopFixes(spots, topN);
1461
+ console.log(C.bold(` Top ${topFixes.length} fixes first:`));
1462
+ for (let i = 0; i < topFixes.length; i++) {
1463
+ const s = topFixes[i];
1464
+ const score = s.priorityScore ? ` (score ${s.priorityScore.toFixed(1)})` : '';
1465
+ console.log(` ${C.num(String(i + 1))}. ${s.message}${score}`);
1466
+ console.log(` ${C.dim(s.filePath + ':' + s.lineNumber)} → ${s.recommendation}`);
1467
+ }
1356
1468
  console.log();
1357
- console.log(C.dim(' By category:'));
1358
- for (const [cat, count] of Object.entries(summary.byCategory)) {
1359
- console.log(` ${C.num(String(count))} ${cat}`);
1469
+ }
1470
+ else {
1471
+ console.log(formatBlindSpotReport(spots));
1472
+ }
1473
+ const catSummary = getCategorySummary(spots);
1474
+ if (catSummary.length > 0) {
1475
+ console.log();
1476
+ console.log(C.bold(' By category:'));
1477
+ for (const c of catSummary) {
1478
+ console.log(` ${C.num(String(c.count))} ${c.category} (top: ${c.topSeverity})`);
1360
1479
  }
1361
1480
  }
1362
1481
  }
@@ -1366,10 +1485,207 @@ function doBlindspots() {
1366
1485
  }
1367
1486
  console.log();
1368
1487
  }
1488
+ // ─── cell doctor ─────────────────────────────────────────────────────────────
1489
+ async function doDoctor() {
1490
+ console.log();
1491
+ console.log(C.bold(' Cell Doctor — Health Check'));
1492
+ console.log(C.dim(' ─────────────────────────'));
1493
+ console.log();
1494
+ const { detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning, } = require('../setup/setup');
1495
+ const cwd = process.cwd();
1496
+ const project = detectProject(cwd);
1497
+ const issues = [];
1498
+ const passes = [];
1499
+ // 1. Git repo
1500
+ const gitDir = path.join(cwd, '.git');
1501
+ if (fs.existsSync(gitDir)) {
1502
+ console.log(` ${C.success('OK')} Git repo detected`);
1503
+ passes.push('git');
1504
+ }
1505
+ else {
1506
+ console.log(` ${C.warn('--')} Git repo not found (optional, but recommended)`);
1507
+ issues.push('git');
1508
+ }
1509
+ // 2. Node/TypeScript project
1510
+ const pkgJson = path.join(cwd, 'package.json');
1511
+ const tsconfig = path.join(cwd, 'tsconfig.json');
1512
+ if (fs.existsSync(pkgJson)) {
1513
+ console.log(` ${C.success('OK')} Node.js project detected (package.json)`);
1514
+ passes.push('node');
1515
+ }
1516
+ else {
1517
+ console.log(` ${C.warn('--')} No package.json found (non-Node project?)`);
1518
+ issues.push('node');
1519
+ }
1520
+ if (fs.existsSync(tsconfig)) {
1521
+ console.log(` ${C.success('OK')} TypeScript project detected (tsconfig.json)`);
1522
+ passes.push('typescript');
1523
+ }
1524
+ // 3. .cell folder
1525
+ const cellDir = path.join(cwd, '.cell');
1526
+ if (fs.existsSync(cellDir)) {
1527
+ const personalDir = path.join(cellDir, 'personal');
1528
+ const fileCount = fs.existsSync(personalDir) ? fs.readdirSync(personalDir).length : 0;
1529
+ console.log(` ${C.success('OK')} .cell/ folder exists (${fileCount} personal files)`);
1530
+ passes.push('cell-dir');
1531
+ }
1532
+ else {
1533
+ console.log(` ${C.warn('--')} No .cell/ folder found`);
1534
+ issues.push('cell-dir');
1535
+ }
1536
+ // 4. SQLite DB
1537
+ const dbPath = path.join(os.homedir(), '.fivo', 'cell', 'cell.db');
1538
+ if (fs.existsSync(dbPath)) {
1539
+ try {
1540
+ const stat = fs.statSync(dbPath);
1541
+ const sizeMB = (stat.size / 1024 / 1024).toFixed(1);
1542
+ console.log(` ${C.success('OK')} SQLite DB exists (${sizeMB} MB)`);
1543
+ passes.push('db');
1544
+ }
1545
+ catch {
1546
+ console.log(` ${C.warn('--')} SQLite DB exists but not readable`);
1547
+ issues.push('db');
1548
+ }
1549
+ }
1550
+ else {
1551
+ console.log(` ${C.warn('--')} No SQLite DB found`);
1552
+ issues.push('db');
1553
+ }
1554
+ // 5. Last scan
1555
+ const scan = checkScanState(cwd);
1556
+ if (scan.done) {
1557
+ console.log(` ${C.success('OK')} Scan completed (${scan.reason})`);
1558
+ passes.push('scan');
1559
+ }
1560
+ else {
1561
+ console.log(` ${C.warn('--')} No scan found (${scan.reason})`);
1562
+ issues.push('scan');
1563
+ }
1564
+ // 6. Daemon / bridge status
1565
+ const daemonUp = await isDaemonRunning();
1566
+ if (daemonUp) {
1567
+ console.log(` ${C.success('OK')} Daemon running on http://localhost:9876`);
1568
+ passes.push('daemon');
1569
+ }
1570
+ else {
1571
+ console.log(` ${C.warn('--')} Daemon not running`);
1572
+ issues.push('daemon');
1573
+ }
1574
+ // 7. Watcher status
1575
+ const watch = checkWatchState(project.name);
1576
+ if (watch.done) {
1577
+ console.log(` ${C.success('OK')} Watcher active (${watch.reason})`);
1578
+ passes.push('watcher');
1579
+ }
1580
+ else {
1581
+ console.log(` ${C.warn('--')} Watcher not active (${watch.reason})`);
1582
+ if (daemonUp)
1583
+ issues.push('watcher');
1584
+ }
1585
+ // 8. Bridge status
1586
+ try {
1587
+ const { discoverBridgePort } = require('../watcher/socket-bridge');
1588
+ const port = discoverBridgePort();
1589
+ if (port) {
1590
+ console.log(` ${C.success('OK')} Bridge reachable (port ${port})`);
1591
+ passes.push('bridge');
1592
+ }
1593
+ else {
1594
+ console.log(` ${C.warn('--')} Bridge not running`);
1595
+ issues.push('bridge');
1596
+ }
1597
+ }
1598
+ catch {
1599
+ console.log(` ${C.warn('--')} Bridge not running`);
1600
+ issues.push('bridge');
1601
+ }
1602
+ // 9. AGENTS.md / .cursorrules
1603
+ const agentsMd = path.join(cwd, 'AGENTS.md');
1604
+ const cursorRules = path.join(cwd, '.cursorrules');
1605
+ const rulesFound = [];
1606
+ if (fs.existsSync(agentsMd))
1607
+ rulesFound.push('AGENTS.md');
1608
+ if (fs.existsSync(cursorRules))
1609
+ rulesFound.push('.cursorrules');
1610
+ if (rulesFound.length > 0) {
1611
+ console.log(` ${C.success('OK')} AI rules: ${rulesFound.join(', ')}`);
1612
+ passes.push('rules');
1613
+ }
1614
+ else {
1615
+ console.log(` ${C.warn('--')} No AGENTS.md or .cursorrules found`);
1616
+ issues.push('rules');
1617
+ }
1618
+ // 10. MCP config
1619
+ const mcp = checkMcpState(os.homedir());
1620
+ if (mcp.done > 0) {
1621
+ console.log(` ${C.success('OK')} MCP config: ${mcp.done}/${mcp.total} IDEs wired`);
1622
+ passes.push('mcp');
1623
+ }
1624
+ else {
1625
+ console.log(` ${C.warn('--')} No MCP configs found (run: cell mcp-config)`);
1626
+ issues.push('mcp');
1627
+ }
1628
+ // 11. First-run state
1629
+ const firstRunFile = path.join(os.homedir(), '.fivo', 'cell', '.first-run-shown');
1630
+ const stateFile = path.join(os.homedir(), '.fivo', 'cell', 'cell-state.json');
1631
+ if (fs.existsSync(stateFile)) {
1632
+ try {
1633
+ const state = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
1634
+ console.log(` ${C.success('OK')} First-run state: setup at ${state.setup_completed || 'unknown'}`);
1635
+ passes.push('first-run');
1636
+ }
1637
+ catch {
1638
+ console.log(` ${C.dim('--')} First-run state file exists but unreadable`);
1639
+ }
1640
+ }
1641
+ else if (fs.existsSync(firstRunFile)) {
1642
+ console.log(` ${C.success('OK')} First-run greeting shown`);
1643
+ passes.push('first-run');
1644
+ }
1645
+ else {
1646
+ console.log(` ${C.dim('--')} First-run not completed yet`);
1647
+ issues.push('first-run');
1648
+ }
1649
+ // ─── Summary ──────────────────────────────────────────────────────────
1650
+ console.log();
1651
+ const total = passes.length + issues.length;
1652
+ if (issues.length === 0) {
1653
+ console.log(C.success(` All ${total} checks passed. Cell is fully healthy.`));
1654
+ }
1655
+ else {
1656
+ console.log(C.warn(` ${passes.length}/${total} checks passed, ${issues.length} need attention:`));
1657
+ console.log();
1658
+ const recovery = {
1659
+ 'cell-dir': 'cell scan',
1660
+ 'db': 'cell start',
1661
+ 'scan': 'cell scan',
1662
+ 'daemon': 'cell start',
1663
+ 'watcher': 'cell start (then: cell watch start)',
1664
+ 'bridge': 'cell bridge start',
1665
+ 'rules': 'cell scan (writes AGENTS.md + .cursorrules)',
1666
+ 'mcp': 'cell mcp-config',
1667
+ 'first-run': 'cell setup',
1668
+ 'git': 'git init',
1669
+ 'node': 'npm init -y',
1670
+ };
1671
+ for (const issue of issues) {
1672
+ const fix = recovery[issue];
1673
+ if (fix) {
1674
+ console.log(` ${C.warn('!')} ${issue}: Run ${C.primary(fix)}`);
1675
+ }
1676
+ }
1677
+ }
1678
+ console.log();
1679
+ try {
1680
+ const { markDoctorRun } = require('../setup/cell-state');
1681
+ markDoctorRun();
1682
+ }
1683
+ catch { }
1684
+ }
1369
1685
  // Long-lived watcher daemon — auto-attaches to current project, runs forever.
1370
1686
  // Used by fivo-cell-daemon.bat to keep a watcher alive in the background.
1371
1687
  function runWatchDaemon(project, dir) {
1372
- const liveWatcher = require('./core/live-watcher');
1688
+ const liveWatcher = require('../watcher/live-watcher');
1373
1689
  const result = liveWatcher.startWatcher(project, dir);
1374
1690
  if (!result.started) {
1375
1691
  // "already running" means the daemon process already has a watcher; keep this process alive anyway
@@ -1404,7 +1720,7 @@ function doCommunity() {
1404
1720
  const sub = args[1] || '';
1405
1721
  if (sub === 'share') {
1406
1722
  try {
1407
- const { sharePatterns } = require('./community-intel');
1723
+ const { sharePatterns } = require('../../05-community/stats/community-intel');
1408
1724
  const result = sharePatterns();
1409
1725
  console.log(result.success ? C.success(` ${result.message}`) : C.warn(` ${result.message}`));
1410
1726
  console.log(C.dim(' Anonymous — only pattern types shared, zero code.'));
@@ -1417,7 +1733,7 @@ function doCommunity() {
1417
1733
  }
1418
1734
  if (sub === 'browse' || sub === '') {
1419
1735
  try {
1420
- const { generateCommunityReport } = require('./community-intel');
1736
+ const { generateCommunityReport } = require('../../05-community/stats/community-intel');
1421
1737
  const report = generateCommunityReport();
1422
1738
  if (report.patterns.length > 0) {
1423
1739
  console.log(C.bold(` 📊 Top Patterns (${report.patterns.length} total):`));
@@ -1460,21 +1776,696 @@ function doCommunity() {
1460
1776
  }
1461
1777
  // ─── cell context ───────────────────────────────────────────────────────────
1462
1778
  function doContext() {
1463
- // args[0] is the project name (optional, defaults to cwd)
1464
- // args[1] is the tool name (optional, e.g. 'claude-code', 'cursor')
1779
+ const positionalArgs = args.slice(1).filter(a => !a.startsWith('--'));
1780
+ const projectArg = positionalArgs[0] || project;
1781
+ const toolArg = positionalArgs[1] || 'claude-code';
1782
+ let showLive = true;
1783
+ let asJson = false;
1784
+ let port = null;
1785
+ let host = '127.0.0.1';
1786
+ let shortMode = false;
1787
+ let fullMode = false;
1788
+ for (let i = 2; i < args.length; i++) {
1789
+ const a = args[i];
1790
+ if (a === '--no-live') {
1791
+ showLive = false;
1792
+ continue;
1793
+ }
1794
+ if (a === '--json') {
1795
+ asJson = true;
1796
+ continue;
1797
+ }
1798
+ if (a === '--short') {
1799
+ shortMode = true;
1800
+ continue;
1801
+ }
1802
+ if (a === '--full') {
1803
+ fullMode = true;
1804
+ continue;
1805
+ }
1806
+ if (typeof a === 'string' && a.startsWith('--port='))
1807
+ port = parseInt(a.split('=')[1], 10) || null;
1808
+ if (typeof a === 'string' && a.startsWith('--host='))
1809
+ host = a.split('=')[1] || '127.0.0.1';
1810
+ }
1811
+ // Try to discover bridge port from pid file if not specified
1812
+ if (port === null) {
1813
+ try {
1814
+ const { discoverBridgePort } = require('../watcher/socket-bridge');
1815
+ const discovered = discoverBridgePort();
1816
+ if (discovered)
1817
+ port = discovered;
1818
+ }
1819
+ catch { /* ignore */ }
1820
+ }
1821
+ if (port === null)
1822
+ port = 9877;
1823
+ // Async wrapper to print live state then static context (in order).
1824
+ const run = async () => {
1825
+ let liveStates = [];
1826
+ let liveError;
1827
+ if (showLive) {
1828
+ try {
1829
+ const { queryBridgeEditorStates } = require('../watcher/socket-bridge');
1830
+ const result = await queryBridgeEditorStates(projectArg, port, host);
1831
+ liveStates = result.states;
1832
+ liveError = result.error;
1833
+ }
1834
+ catch (e) {
1835
+ liveError = e?.message || String(e);
1836
+ }
1837
+ }
1838
+ if (asJson) {
1839
+ let ctx;
1840
+ try {
1841
+ const { buildContext } = require('../../01-context/context/prompt-builder');
1842
+ ctx = buildContext(projectArg, toolArg);
1843
+ }
1844
+ catch (e) {
1845
+ console.log(JSON.stringify({ error: e?.message || String(e) }));
1846
+ return;
1847
+ }
1848
+ console.log(JSON.stringify({
1849
+ ...ctx,
1850
+ liveEditorStates: liveStates,
1851
+ liveError: liveError,
1852
+ }, null, 2));
1853
+ return;
1854
+ }
1855
+ // Print live state at top
1856
+ if (showLive) {
1857
+ if (liveStates.length > 0) {
1858
+ console.log(C.bold(' ── Live Editor State (Feature #2) ──'));
1859
+ for (const s of liveStates) {
1860
+ const dirtyMark = s.isDirty ? C.warn(' [unsaved]') : '';
1861
+ console.log(` ${C.primary(s.editorName)}: ${s.filePath}:${s.line}:${s.column}${dirtyMark}`);
1862
+ if (s.language)
1863
+ console.log(C.dim(` language: ${s.language}`));
1864
+ if (s.unsavedBuffer) {
1865
+ const allLines = s.unsavedBuffer.split('\n');
1866
+ const head = allLines.slice(0, 5);
1867
+ console.log(C.dim(` unsaved (${s.unsavedLength || s.unsavedBuffer.length} chars):`));
1868
+ for (const line of head) {
1869
+ console.log(C.dim(` ${line.length > 80 ? line.slice(0, 77) + '...' : line}`));
1870
+ }
1871
+ if (allLines.length > 5) {
1872
+ console.log(C.dim(` ... ${allLines.length - 5} more lines`));
1873
+ }
1874
+ }
1875
+ }
1876
+ console.log('');
1877
+ }
1878
+ else if (liveError) {
1879
+ console.log(C.dim(' ── Live Editor State ──'));
1880
+ console.log(C.dim(` Bridge not reachable (${liveError}). Start with: cell bridge start`));
1881
+ console.log('');
1882
+ }
1883
+ else {
1884
+ console.log(C.dim(' ── Live Editor State ──'));
1885
+ console.log(C.dim(` No editors connected for "${projectArg}"`));
1886
+ console.log(C.dim(' Start an editor that pushes to the bridge (or run cell bridge status)'));
1887
+ console.log('');
1888
+ }
1889
+ }
1890
+ // Static project context
1891
+ try {
1892
+ const { buildContext, formatContextForTool } = require('../../01-context/context/prompt-builder');
1893
+ const ctx = buildContext(projectArg, toolArg);
1894
+ const text = formatContextForTool(ctx, toolArg, projectArg);
1895
+ if (shortMode) {
1896
+ const lines = text.split('\n');
1897
+ const shortLines = [];
1898
+ let inCore = false;
1899
+ let coreCount = 0;
1900
+ for (const line of lines) {
1901
+ if (line.startsWith('## ') || line.startsWith('# ')) {
1902
+ if (coreCount > 0)
1903
+ break;
1904
+ inCore = true;
1905
+ }
1906
+ if (inCore) {
1907
+ shortLines.push(line);
1908
+ if (line.trim() && !line.startsWith('#') && !line.startsWith('─'))
1909
+ coreCount++;
1910
+ }
1911
+ }
1912
+ if (shortLines.length === 0) {
1913
+ const first5 = lines.slice(0, 5);
1914
+ console.log(first5.join('\n'));
1915
+ console.log(C.dim(` ... (${lines.length} total lines. Use --full to see all)`));
1916
+ }
1917
+ else {
1918
+ console.log(shortLines.join('\n'));
1919
+ console.log(C.dim(` ... (${lines.length} total lines. Use --full or no flag for default)`));
1920
+ }
1921
+ }
1922
+ else if (fullMode) {
1923
+ console.log(text);
1924
+ }
1925
+ else {
1926
+ console.log(text);
1927
+ }
1928
+ try {
1929
+ const { markFirstContext } = require('../setup/cell-state');
1930
+ markFirstContext();
1931
+ }
1932
+ catch { }
1933
+ try {
1934
+ const { captureCurrentBranchSnapshot } = require('../../03-knowledge/decisions/branch-snapshot');
1935
+ captureCurrentBranchSnapshot(projectArg, process.cwd());
1936
+ }
1937
+ catch { }
1938
+ }
1939
+ catch (e) {
1940
+ console.log(C.warn(' No context available yet.'));
1941
+ console.log(C.dim(' Run these commands first:'));
1942
+ console.log(C.primary(' cell scan'));
1943
+ console.log(C.primary(' cell doctor'));
1944
+ }
1945
+ };
1946
+ run();
1947
+ }
1948
+ // ─── cell replay — show full session timeline ──────────────────────────────
1949
+ function doReplay() {
1950
+ // args[1] = project (optional, defaults to cwd)
1951
+ // args[2] = sessionId (optional)
1952
+ // --since <ISO>
1953
+ // --until <ISO>
1954
+ // --type file_save,cursor_move,...
1955
+ // --file <path>
1956
+ // --format text|json|markdown|compact
1957
+ // --group minute|hour|file|type
1958
+ // --limit <n>
1959
+ // --recent <n> (replay last N events, ignoring other filters)
1960
+ // --summary (just show session summary, no events)
1961
+ // --last (shorthand for --recent 50)
1465
1962
  const projectArg = args[1] || project;
1466
- const toolArg = args[2] || 'claude-code';
1467
- let ctx;
1963
+ let sessionId;
1964
+ let since;
1965
+ let until;
1966
+ let eventTypes;
1967
+ let filePath;
1968
+ let filePattern;
1969
+ let format = 'text';
1970
+ let groupBy = 'none';
1971
+ let limit;
1972
+ let recent;
1973
+ let summaryOnly = false;
1974
+ for (let i = 2; i < args.length; i++) {
1975
+ const a = args[i];
1976
+ if (a === '--since' && i + 1 < args.length) {
1977
+ since = args[++i];
1978
+ continue;
1979
+ }
1980
+ if (a.startsWith('--since=')) {
1981
+ since = a.slice('--since='.length);
1982
+ continue;
1983
+ }
1984
+ if (a === '--until' && i + 1 < args.length) {
1985
+ until = args[++i];
1986
+ continue;
1987
+ }
1988
+ if (a.startsWith('--until=')) {
1989
+ until = a.slice('--until='.length);
1990
+ continue;
1991
+ }
1992
+ if (a === '--type' && i + 1 < args.length) {
1993
+ eventTypes = args[++i].split(',');
1994
+ continue;
1995
+ }
1996
+ if (a.startsWith('--type=')) {
1997
+ eventTypes = a.slice('--type='.length).split(',');
1998
+ continue;
1999
+ }
2000
+ if (a === '--file' && i + 1 < args.length) {
2001
+ filePath = args[++i];
2002
+ continue;
2003
+ }
2004
+ if (a.startsWith('--file=')) {
2005
+ filePath = a.slice('--file='.length);
2006
+ continue;
2007
+ }
2008
+ if (a === '--pattern' && i + 1 < args.length) {
2009
+ filePattern = args[++i];
2010
+ continue;
2011
+ }
2012
+ if (a.startsWith('--pattern=')) {
2013
+ filePattern = a.slice('--pattern='.length);
2014
+ continue;
2015
+ }
2016
+ if (a === '--format' && i + 1 < args.length) {
2017
+ format = args[++i];
2018
+ continue;
2019
+ }
2020
+ if (a.startsWith('--format=')) {
2021
+ format = a.slice('--format='.length);
2022
+ continue;
2023
+ }
2024
+ if (a === '--group' && i + 1 < args.length) {
2025
+ groupBy = args[++i];
2026
+ continue;
2027
+ }
2028
+ if (a.startsWith('--group=')) {
2029
+ groupBy = a.slice('--group='.length);
2030
+ continue;
2031
+ }
2032
+ if (a === '--limit' && i + 1 < args.length) {
2033
+ limit = parseInt(args[++i], 10);
2034
+ continue;
2035
+ }
2036
+ if (a.startsWith('--limit=')) {
2037
+ limit = parseInt(a.slice('--limit='.length), 10);
2038
+ continue;
2039
+ }
2040
+ if (a === '--recent' && i + 1 < args.length) {
2041
+ recent = parseInt(args[++i], 10);
2042
+ continue;
2043
+ }
2044
+ if (a.startsWith('--recent=')) {
2045
+ recent = parseInt(a.slice('--recent='.length), 10);
2046
+ continue;
2047
+ }
2048
+ if (a === '--last') {
2049
+ recent = 50;
2050
+ continue;
2051
+ }
2052
+ if (a === '--summary') {
2053
+ summaryOnly = true;
2054
+ continue;
2055
+ }
2056
+ if (a === '--session' && i + 1 < args.length) {
2057
+ sessionId = parseInt(args[++i], 10);
2058
+ continue;
2059
+ }
2060
+ if (a.startsWith('--session=')) {
2061
+ sessionId = parseInt(a.slice('--session='.length), 10);
2062
+ continue;
2063
+ }
2064
+ if (/^\d+$/.test(a) && sessionId === undefined) {
2065
+ sessionId = parseInt(a, 10);
2066
+ continue;
2067
+ }
2068
+ }
2069
+ let result;
1468
2070
  try {
1469
- const { buildContext, formatContextForTool } = require('./core/prompt-builder');
1470
- ctx = buildContext(projectArg, toolArg);
1471
- const text = formatContextForTool(ctx, toolArg, projectArg);
1472
- console.log(text);
2071
+ const { replay, replayRecent, summarizeSession, renderSessionSummary } = require('../../01-context/sessions/replay');
2072
+ if (recent !== undefined) {
2073
+ result = replayRecent(projectArg, recent, format);
2074
+ }
2075
+ else {
2076
+ result = replay({
2077
+ project: projectArg,
2078
+ sessionId,
2079
+ eventTypes: eventTypes,
2080
+ since,
2081
+ until,
2082
+ filePath,
2083
+ filePattern,
2084
+ limit,
2085
+ format,
2086
+ groupBy,
2087
+ });
2088
+ }
2089
+ if (summaryOnly && sessionId !== undefined) {
2090
+ const summary = summarizeSession(projectArg, sessionId);
2091
+ if (!summary) {
2092
+ console.log(C.warn(` No session #${sessionId} found for project "${projectArg}".`));
2093
+ return;
2094
+ }
2095
+ console.log(renderSessionSummary(summary));
2096
+ return;
2097
+ }
2098
+ if (result.filteredCount === 0) {
2099
+ console.log(C.warn(` No${eventTypes ? ' ' + eventTypes.join(',') : ''} events to replay yet.`));
2100
+ console.log(C.dim(` Project: ${projectArg}`));
2101
+ console.log(C.dim(' Start capturing by running:'));
2102
+ console.log(C.primary(' cell scan'));
2103
+ console.log(C.primary(' cell session start --tool claude-code'));
2104
+ console.log(C.primary(' cell bridge start'));
2105
+ return;
2106
+ }
2107
+ console.log(result.formatted);
1473
2108
  }
1474
2109
  catch (e) {
1475
- console.log(C.warn(' No context available yet.'));
1476
- console.log(C.dim(' Run: cell scan first to populate context.'));
1477
- return;
2110
+ console.log(C.warn(' Replay failed: ' + (e?.message || String(e))));
2111
+ }
2112
+ }
2113
+ // ─── cell continue — resume last session with full context ────────────────
2114
+ function doContinue() {
2115
+ // args[1] = project (optional, defaults to cwd)
2116
+ // args[2] = tool (optional, e.g. 'cursor', 'claude-code')
2117
+ // --tool <name> tool to format context for
2118
+ // --no-snapshot skip writing the session-end snapshot
2119
+ const projectArg = args[1] || project;
2120
+ let toolArg = args[2] || 'claude-code';
2121
+ let writeSnapshot = true;
2122
+ for (let i = 2; i < args.length; i++) {
2123
+ const a = args[i];
2124
+ if (a === '--tool' && i + 1 < args.length) {
2125
+ toolArg = args[++i];
2126
+ continue;
2127
+ }
2128
+ if (a.startsWith('--tool=')) {
2129
+ toolArg = a.slice('--tool='.length);
2130
+ continue;
2131
+ }
2132
+ if (a === '--no-snapshot') {
2133
+ writeSnapshot = false;
2134
+ continue;
2135
+ }
2136
+ }
2137
+ try {
2138
+ const { SessionMemory } = require('../../01-context/sessions/session-memory');
2139
+ const { linkSessionToRecentEvents, recordSessionStart, recordSessionEnd, recordFileFocus } = require('../../01-context/sessions/event-capture');
2140
+ const { summarizeSession, renderSessionSummary } = require('../../01-context/sessions/replay');
2141
+ const { buildContext, formatContextForTool } = require('../../01-context/context/prompt-builder');
2142
+ const mem = new SessionMemory();
2143
+ // 1) Find the last session for this project
2144
+ const lastSession = mem.getLastSessionForProject(projectArg);
2145
+ if (!lastSession) {
2146
+ console.log(C.warn(' No previous session found for this project.'));
2147
+ console.log(C.dim(' Start one with:'));
2148
+ console.log(C.primary(' cell session start --tool claude-code'));
2149
+ console.log(C.dim(' Then: cell continue (resume anytime)'));
2150
+ return;
2151
+ }
2152
+ // 2) Show summary of the last session
2153
+ const summary = summarizeSession(projectArg, lastSession.id);
2154
+ if (summary) {
2155
+ console.log(C.bold(' ── Last Session ──'));
2156
+ console.log(renderSessionSummary(summary));
2157
+ console.log('');
2158
+ }
2159
+ // 3) Open a new session
2160
+ const newSessionId = mem.startSession(toolArg, projectArg);
2161
+ recordSessionStart({ project: projectArg, sessionId: newSessionId, toolName: toolArg });
2162
+ const linked = linkSessionToRecentEvents(projectArg, newSessionId, true);
2163
+ console.log(C.success(` ✓ New session #${newSessionId} started in ${toolArg}`));
2164
+ if (linked > 0) {
2165
+ console.log(C.dim(` Linked ${linked} recent events to this session`));
2166
+ }
2167
+ console.log('');
2168
+ // 4) Build and show the cross-tool context block
2169
+ try {
2170
+ const ctx = buildContext(projectArg, toolArg);
2171
+ const text = formatContextForTool(ctx, toolArg, projectArg);
2172
+ console.log(C.bold(' ── Context to inject ──'));
2173
+ console.log(text);
2174
+ }
2175
+ catch (e) {
2176
+ console.log(C.warn(' Could not build context (run cell scan first).'));
2177
+ }
2178
+ // 5) Print session ID for later use with `cell replay --session <id>`
2179
+ console.log('');
2180
+ console.log(C.dim(` To replay this session later: cell replay ${projectArg} ${newSessionId}`));
2181
+ console.log(C.dim(` To end this session: cell session end ${newSessionId} ${projectArg}`));
2182
+ }
2183
+ catch (e) {
2184
+ console.log(C.warn(' Continue failed: ' + (e?.message || String(e))));
2185
+ }
2186
+ }
2187
+ // ─── cell bridge — bidirectional editor↔daemon socket ────────────────────
2188
+ function doBridge() {
2189
+ // args[1] = subcommand: start | stop | status | kill (default: status)
2190
+ // --port <n> port to bind (default 9877)
2191
+ // --host <ip> host to bind (default 127.0.0.1)
2192
+ // --foreground don't detach (default for tests/debug)
2193
+ const sub = args[1] || 'status';
2194
+ let port = 9877;
2195
+ let host = '127.0.0.1';
2196
+ for (let i = 2; i < args.length; i++) {
2197
+ const a = args[i];
2198
+ if (a === '--port' && i + 1 < args.length) {
2199
+ port = parseInt(args[++i], 10);
2200
+ continue;
2201
+ }
2202
+ if (a.startsWith('--port=')) {
2203
+ port = parseInt(a.slice('--port='.length), 10);
2204
+ continue;
2205
+ }
2206
+ if (a === '--host' && i + 1 < args.length) {
2207
+ host = args[++i];
2208
+ continue;
2209
+ }
2210
+ if (a.startsWith('--host=')) {
2211
+ host = a.slice('--host='.length);
2212
+ continue;
2213
+ }
2214
+ }
2215
+ try {
2216
+ const { startBridge, stopBridge, getBridgeInfo, isBridgeRunning, killStaleBridge, discoverBridgePort, } = require('../watcher/socket-bridge');
2217
+ if (sub === 'start') {
2218
+ if (isBridgeRunning()) {
2219
+ const info = getBridgeInfo();
2220
+ console.log(C.warn(` Bridge already running on port ${info.port} (${info.clientCount} clients, ${info.totalEventsReceived} events received)`));
2221
+ return;
2222
+ }
2223
+ startBridge(port, host)
2224
+ .then((info) => {
2225
+ console.log(C.success(` ✓ Bridge started on ${info.host}:${info.port}`));
2226
+ console.log(C.dim(` Editors can connect to ws://${info.host}:${info.port} (newline-delimited JSON)`));
2227
+ console.log(C.dim(` To stop: cell bridge stop`));
2228
+ try {
2229
+ const { markBridgeStarted } = require('../setup/cell-state');
2230
+ markBridgeStarted();
2231
+ }
2232
+ catch { }
2233
+ })
2234
+ .catch((e) => {
2235
+ console.log(C.warn(' Bridge start failed: ' + e.message));
2236
+ });
2237
+ }
2238
+ else if (sub === 'stop') {
2239
+ const ok = stopBridge();
2240
+ if (ok) {
2241
+ console.log(C.success(' ✓ Bridge stopped'));
2242
+ }
2243
+ else {
2244
+ console.log(C.dim(' Bridge was not running'));
2245
+ }
2246
+ }
2247
+ else if (sub === 'kill') {
2248
+ const killed = killStaleBridge();
2249
+ if (killed) {
2250
+ console.log(C.success(' ✓ Killed stale bridge process'));
2251
+ }
2252
+ else {
2253
+ console.log(C.dim(' No stale bridge found'));
2254
+ }
2255
+ }
2256
+ else {
2257
+ // status
2258
+ const info = getBridgeInfo();
2259
+ const discovered = discoverBridgePort();
2260
+ const liveInfo = discovered && !info.running
2261
+ ? { running: true, port: discovered, host: host, startedAt: C.dim('(another process)'), clientCount: -1, totalEventsReceived: -1, clients: [] }
2262
+ : info;
2263
+ const i = liveInfo;
2264
+ console.log(C.bold(' Cell Bridge'));
2265
+ console.log(' ───────────');
2266
+ console.log(` Running: ${i.running ? C.success('yes') : C.dim('no')}`);
2267
+ console.log(` Port: ${i.port}`);
2268
+ console.log(` Host: ${i.host}`);
2269
+ console.log(` Started: ${i.startedAt || C.dim('(never)')}`);
2270
+ console.log(` Clients: ${i.clientCount >= 0 ? i.clientCount : '?'}`);
2271
+ console.log(` Events rx: ${i.totalEventsReceived >= 0 ? i.totalEventsReceived : '?'}`);
2272
+ if (i.clients && i.clients.length > 0) {
2273
+ console.log('');
2274
+ console.log(C.dim(' Connected clients:'));
2275
+ for (const c of i.clients) {
2276
+ console.log(C.dim(` #${c.id} ${c.remoteAddress}:${c.remotePort} project=${c.project} events=${c.eventsReceived}`));
2277
+ }
2278
+ }
2279
+ if (!info.running) {
2280
+ console.log('');
2281
+ console.log(C.dim(' To start: cell bridge start [--port 9877] [--host 127.0.0.1]'));
2282
+ }
2283
+ }
2284
+ }
2285
+ catch (e) {
2286
+ console.log(C.warn(' Bridge failed: ' + (e?.message || String(e))));
2287
+ }
2288
+ }
2289
+ // ─── cell watch-editor (Feature #2: push active editor state to bridge) ────
2290
+ function monitorStatePath(project) {
2291
+ const os = require('os');
2292
+ const path = require('path');
2293
+ const fs = require('fs');
2294
+ const dir = path.join(os.tmpdir(), 'fivo-cell');
2295
+ if (!fs.existsSync(dir))
2296
+ fs.mkdirSync(dir, { recursive: true });
2297
+ return path.join(dir, `watch-editor-${project}.json`);
2298
+ }
2299
+ function readMonitorState(project) {
2300
+ const fs = require('fs');
2301
+ const p = monitorStatePath(project);
2302
+ try {
2303
+ if (!fs.existsSync(p))
2304
+ return null;
2305
+ return JSON.parse(fs.readFileSync(p, 'utf8'));
2306
+ }
2307
+ catch {
2308
+ return null;
2309
+ }
2310
+ }
2311
+ function writeMonitorState(project, data) {
2312
+ const fs = require('fs');
2313
+ try {
2314
+ fs.writeFileSync(monitorStatePath(project), JSON.stringify(data, null, 2));
2315
+ }
2316
+ catch { /* ignore */ }
2317
+ }
2318
+ function clearMonitorState(project) {
2319
+ const fs = require('fs');
2320
+ try {
2321
+ fs.unlinkSync(monitorStatePath(project));
2322
+ }
2323
+ catch { /* ignore */ }
2324
+ }
2325
+ function doWatchEditor() {
2326
+ const sub = (args[1] || 'status').toString();
2327
+ // Find --project=... flag, or fall back to positional args[2] or cwd basename
2328
+ const projectFlag = args.find((a) => typeof a === 'string' && a.startsWith('--project='));
2329
+ const project = projectFlag ? projectFlag.split('=')[1] : ((args[2] && !String(args[2]).startsWith('--')) ? String(args[2]) : path.basename(process.cwd()));
2330
+ const intervalArg = args.find((a) => typeof a === 'string' && a.startsWith('--interval='));
2331
+ const portArg = args.find((a) => typeof a === 'string' && a.startsWith('--port='));
2332
+ const hostArg = args.find((a) => typeof a === 'string' && a.startsWith('--host='));
2333
+ const interval = parseInt(intervalArg ? intervalArg.split('=')[1] : '3000', 10);
2334
+ let port = portArg ? parseInt(portArg.split('=')[1], 10) : null;
2335
+ const host = (hostArg ? hostArg.split('=')[1] : '127.0.0.1') || '127.0.0.1';
2336
+ // Try to discover bridge port from pid file if not specified
2337
+ if (port === null) {
2338
+ try {
2339
+ const { discoverBridgePort } = require('../watcher/socket-bridge');
2340
+ const discovered = discoverBridgePort();
2341
+ if (discovered)
2342
+ port = discovered;
2343
+ }
2344
+ catch { /* ignore */ }
2345
+ }
2346
+ if (port === null)
2347
+ port = 9877;
2348
+ try {
2349
+ const { EditorMonitor, getActiveWindow, parseTitleToState } = require('../watcher/editor-monitor');
2350
+ if (sub === 'start') {
2351
+ if (activeMonitor) {
2352
+ console.log(C.warn(' Monitor already running in this process'));
2353
+ return;
2354
+ }
2355
+ const prev = readMonitorState(project);
2356
+ if (prev && prev.running) {
2357
+ console.log(C.warn(` Monitor for "${project}" already started at ${prev.startTime}`));
2358
+ console.log(C.dim(' Use `cell watch-editor stop --project ' + project + '` first'));
2359
+ return;
2360
+ }
2361
+ const monitor = new EditorMonitor({
2362
+ project,
2363
+ intervalMs: interval,
2364
+ bridgeHost: host,
2365
+ bridgePort: port,
2366
+ fileBaseDir: process.cwd(),
2367
+ watchFiles: true,
2368
+ onState: (s) => {
2369
+ if (process.env.CELL_VERBOSE) {
2370
+ console.log(C.dim(` [${new Date().toISOString()}] ${s.editorName}: ${s.filePath} [${s.isDirty ? 'unsaved' : 'clean'}]`));
2371
+ }
2372
+ },
2373
+ onError: (e) => {
2374
+ if (process.env.CELL_VERBOSE)
2375
+ console.error(C.warn(' ' + e.message));
2376
+ },
2377
+ onSkip: (reason) => {
2378
+ if (process.env.CELL_VERBOSE)
2379
+ console.log(C.dim(' skip: ' + reason));
2380
+ },
2381
+ });
2382
+ monitor.start();
2383
+ activeMonitor = monitor;
2384
+ monitorStateFile = project;
2385
+ writeMonitorState(project, { running: true, startTime: new Date().toISOString(), pid: process.pid, project, port, host, interval });
2386
+ console.log(C.success(` Watch-editor started for project "${project}"`));
2387
+ console.log(C.dim(` Bridge: ${host}:${port} | Interval: ${interval}ms`));
2388
+ console.log(C.dim(' State will appear in `cell context ' + project + '`'));
2389
+ console.log(C.dim(' Press Ctrl+C to stop'));
2390
+ // Keep the process alive
2391
+ process.on('SIGINT', () => {
2392
+ console.log(C.dim('\n Stopping watch-editor...'));
2393
+ if (activeMonitor)
2394
+ activeMonitor.stop();
2395
+ clearMonitorState(project);
2396
+ process.exit(0);
2397
+ });
2398
+ process.on('SIGTERM', () => {
2399
+ if (activeMonitor)
2400
+ activeMonitor.stop();
2401
+ clearMonitorState(project);
2402
+ process.exit(0);
2403
+ });
2404
+ }
2405
+ else if (sub === 'stop') {
2406
+ if (activeMonitor) {
2407
+ activeMonitor.stop();
2408
+ activeMonitor = null;
2409
+ }
2410
+ clearMonitorState(project);
2411
+ console.log(C.success(` Watch-editor stopped for "${project}"`));
2412
+ }
2413
+ else if (sub === 'status') {
2414
+ const local = activeMonitor ? activeMonitor.getInfo() : null;
2415
+ const saved = readMonitorState(project);
2416
+ if (local) {
2417
+ console.log(C.bold(` Watch-editor (in-process) — ${project}`));
2418
+ console.log(` Running: ${C.success('yes')}`);
2419
+ console.log(` Started: ${local.startTime}`);
2420
+ console.log(` Polls: ${local.pollsCompleted}`);
2421
+ console.log(` Detected: ${local.statesDetected}`);
2422
+ console.log(` Pushed: ${local.statesPushed}`);
2423
+ console.log(` Bridge: ${local.bridgeConnected ? C.success('connected') : C.warn('not connected')}`);
2424
+ if (local.lastState) {
2425
+ console.log(` Last: ${local.lastState.editorName} → ${local.lastState.filePath}${local.lastState.isDirty ? ' [unsaved]' : ''}`);
2426
+ }
2427
+ }
2428
+ else if (saved) {
2429
+ console.log(C.bold(` Watch-editor (saved state) — ${project}`));
2430
+ console.log(` Started: ${saved.startTime}`);
2431
+ console.log(` PID: ${saved.pid}${saved.pid && !isPidAlive(saved.pid) ? C.warn(' (not running)') : ''}`);
2432
+ console.log(` Bridge: ${saved.host}:${saved.port}`);
2433
+ console.log(` Interval: ${saved.interval}ms`);
2434
+ }
2435
+ else {
2436
+ console.log(C.dim(` No watch-editor session for "${project}"`));
2437
+ console.log(C.dim(' Start with: cell watch-editor start --project ' + project));
2438
+ }
2439
+ }
2440
+ else if (sub === 'check') {
2441
+ // One-shot check — useful for testing
2442
+ getActiveWindow().then((win) => {
2443
+ if (!win) {
2444
+ console.log(C.dim(' No active window detected'));
2445
+ return;
2446
+ }
2447
+ console.log(` Active: ${win.processName} (PID ${win.pid})`);
2448
+ console.log(` Title: ${win.title}`);
2449
+ const state = parseTitleToState(win.title, win.processName, project, process.cwd());
2450
+ if (state) {
2451
+ console.log(C.success(' Parsed:'));
2452
+ console.log(` editor: ${state.editorName}`);
2453
+ console.log(` file: ${state.filePath}`);
2454
+ console.log(` line: ${state.line}`);
2455
+ console.log(` dirty: ${state.isDirty}`);
2456
+ console.log(` lang: ${state.language || 'unknown'}`);
2457
+ }
2458
+ else {
2459
+ console.log(C.warn(' Could not parse title into editor state'));
2460
+ }
2461
+ });
2462
+ }
2463
+ else {
2464
+ console.log(C.dim(' Usage: cell watch-editor <start|stop|status|check> [--project NAME] [--interval 3000] [--port 9877] [--host 127.0.0.1]'));
2465
+ }
2466
+ }
2467
+ catch (e) {
2468
+ console.log(C.warn(' watch-editor failed: ' + (e?.message || String(e))));
1478
2469
  }
1479
2470
  }
1480
2471
  // ─── cell mcp-config (Pre-Launch: auto-register all IDEs) ────────────────────
@@ -1494,7 +2485,7 @@ function doMcpConfig() {
1494
2485
  console.log(C.bold(' Cell MCP Auto-Config'));
1495
2486
  console.log(C.dim(' ─────────────────────'));
1496
2487
  console.log();
1497
- const { writeMcpConfig, getMcpTargets } = require('./core/mcp-config');
2488
+ const { writeMcpConfig, getMcpTargets } = require('../../../core/mcp-config');
1498
2489
  const homedir = os.homedir();
1499
2490
  const targets = getMcpTargets(homedir);
1500
2491
  const result = writeMcpConfig(homedir);
@@ -1555,7 +2546,7 @@ function doRepl() {
1555
2546
  console.log();
1556
2547
  // First-run greeting
1557
2548
  try {
1558
- const { firstRunGreeting } = require('./first-run');
2549
+ const { firstRunGreeting } = require('../setup/first-run');
1559
2550
  firstRunGreeting();
1560
2551
  }
1561
2552
  catch { }
@@ -1614,7 +2605,7 @@ function doRepl() {
1614
2605
  // In-REPL version (avoid child spawn for trivial info)
1615
2606
  if (cmd === 'version' || cmd === '--version' || cmd === '-v') {
1616
2607
  try {
1617
- const pkg = require('../package.json');
2608
+ const pkg = require('../../../../package.json');
1618
2609
  console.log(`${C.primary('cell')} v${C.num(pkg.version)}`);
1619
2610
  }
1620
2611
  catch { }
@@ -1655,6 +2646,338 @@ function doRepl() {
1655
2646
  process.exit(0);
1656
2647
  });
1657
2648
  }
2649
+ // ─── cell switch-back ──────────────────────────────────────────────────────
2650
+ function doSwitchBack() {
2651
+ const switchArgs = process.argv.slice(3);
2652
+ const branch = switchArgs[0];
2653
+ if (!branch) {
2654
+ console.log();
2655
+ console.log(C.bold(' Branch Context Recovery'));
2656
+ console.log(C.dim(' ──────────────────────'));
2657
+ console.log();
2658
+ console.log(' Usage: cell switch-back <branch-name>');
2659
+ console.log();
2660
+ console.log(' Shows saved context for a branch (goal, files, errors, decisions).');
2661
+ console.log();
2662
+ console.log(' Examples:');
2663
+ console.log(' cell switch-back feature-auth');
2664
+ console.log(' cell switch-back fix/login-bug');
2665
+ console.log();
2666
+ return;
2667
+ }
2668
+ console.log();
2669
+ console.log(C.bold(` Branch: ${branch}`));
2670
+ console.log(C.dim(' ──────────────────────'));
2671
+ console.log();
2672
+ let project = path.basename(process.cwd());
2673
+ try {
2674
+ const { detectProject } = require('../setup/setup');
2675
+ const detected = detectProject(process.cwd());
2676
+ project = detected.name;
2677
+ }
2678
+ catch { }
2679
+ // Try real saved context first
2680
+ try {
2681
+ const { loadBranchSnapshot } = require('../../03-knowledge/decisions/branch-snapshot');
2682
+ const snapshot = loadBranchSnapshot(project, branch);
2683
+ if (snapshot) {
2684
+ if (snapshot.goal)
2685
+ console.log(` Goal: ${C.primary(snapshot.goal)}`);
2686
+ if (snapshot.filesTouched && snapshot.filesTouched.length > 0) {
2687
+ console.log(` Files: ${C.num(String(snapshot.filesTouched.length))} touched`);
2688
+ for (const f of snapshot.filesTouched.slice(0, 8)) {
2689
+ console.log(C.dim(` - ${f}`));
2690
+ }
2691
+ if (snapshot.filesTouched.length > 8) {
2692
+ console.log(C.dim(` ... ${snapshot.filesTouched.length - 8} more`));
2693
+ }
2694
+ }
2695
+ if (snapshot.pendingTasks && snapshot.pendingTasks.length > 0) {
2696
+ console.log(` Pending: ${snapshot.pendingTasks.length} task(s)`);
2697
+ for (const t of snapshot.pendingTasks.slice(0, 5)) {
2698
+ console.log(C.warn(` ! ${t}`));
2699
+ }
2700
+ }
2701
+ if (snapshot.recentErrors && snapshot.recentErrors.length > 0) {
2702
+ console.log(` Errors: ${snapshot.recentErrors.length} recent`);
2703
+ for (const e of snapshot.recentErrors.slice(0, 3)) {
2704
+ console.log(C.warn(` x ${e}`));
2705
+ }
2706
+ }
2707
+ if (snapshot.recentDecisions && snapshot.recentDecisions.length > 0) {
2708
+ console.log(` Recent commits:`);
2709
+ for (const d of snapshot.recentDecisions.slice(0, 5)) {
2710
+ console.log(C.dim(` - ${d}`));
2711
+ }
2712
+ }
2713
+ if (snapshot.lastActiveAt) {
2714
+ console.log(C.dim(` Last active: ${snapshot.lastActiveAt}`));
2715
+ }
2716
+ console.log();
2717
+ console.log(C.dim(' Restore context:'));
2718
+ console.log(' 1. git checkout ' + branch);
2719
+ console.log(' 2. cell context');
2720
+ console.log();
2721
+ return;
2722
+ }
2723
+ }
2724
+ catch { }
2725
+ // Fallback to name parser
2726
+ const { GitBranchPreGenerator } = require('../../03-knowledge/decisions/git-branch-pregenerator');
2727
+ const gen = new GitBranchPreGenerator();
2728
+ const summary = gen.getIntentSummary(branch);
2729
+ const parsed = gen.parseBranchName(branch);
2730
+ console.log(C.dim(' (No saved context for this branch — showing inferred intent)'));
2731
+ console.log();
2732
+ console.log(` Type: ${C.primary(parsed.type)}`);
2733
+ console.log(` Intent: ${parsed.intent}`);
2734
+ console.log(` Summary: ${summary}`);
2735
+ console.log();
2736
+ const patterns = gen.generateFiles(branch, [], 'typescript');
2737
+ if (patterns.length > 0) {
2738
+ console.log(C.dim(' Expected files:'));
2739
+ for (const f of patterns) {
2740
+ console.log(` ${C.primary(f.path)} (${f.type})`);
2741
+ }
2742
+ console.log();
2743
+ }
2744
+ console.log(C.dim(' Save real context by running:'));
2745
+ console.log(C.primary(' cell scan'));
2746
+ console.log(C.primary(' cell context'));
2747
+ console.log();
2748
+ console.log(C.dim(' Restore context:'));
2749
+ console.log(' 1. git checkout ' + branch);
2750
+ console.log(' 2. cell context');
2751
+ console.log();
2752
+ }
2753
+ // ─── cell branches ──────────────────────────────────────────────────────────
2754
+ function doBranches() {
2755
+ console.log();
2756
+ console.log(C.bold(' Known Branches'));
2757
+ console.log(C.dim(' ──────────────'));
2758
+ console.log();
2759
+ let project = path.basename(process.cwd());
2760
+ try {
2761
+ const { detectProject } = require('../setup/setup');
2762
+ const detected = detectProject(process.cwd());
2763
+ project = detected.name;
2764
+ }
2765
+ catch { }
2766
+ try {
2767
+ const { listBranchSnapshots } = require('../../03-knowledge/decisions/branch-snapshot');
2768
+ const snapshots = listBranchSnapshots(project);
2769
+ if (snapshots.length === 0) {
2770
+ console.log(C.dim(' No branch context saved yet.'));
2771
+ console.log();
2772
+ console.log(C.dim(' Save context by running cell scan or cell context on a branch.'));
2773
+ console.log();
2774
+ return;
2775
+ }
2776
+ for (const s of snapshots) {
2777
+ const active = s.lastActiveAt ? s.lastActiveAt.slice(0, 10) : 'unknown';
2778
+ const goalStr = s.goal ? ` — ${s.goal}` : '';
2779
+ const fileCount = s.filesTouched?.length || 0;
2780
+ console.log(` ${C.primary(s.branch)}${goalStr}`);
2781
+ console.log(C.dim(` Last active: ${active} | Files: ${fileCount} | Commits: ${s.recentDecisions?.length || 0}`));
2782
+ }
2783
+ console.log();
2784
+ console.log(C.dim(` ${snapshots.length} branch(es) tracked. Run cell switch-back <branch> for details.`));
2785
+ }
2786
+ catch (err) {
2787
+ const msg = err instanceof Error ? err.message : String(err);
2788
+ console.log(C.warn(` Branch list failed: ${msg}`));
2789
+ }
2790
+ // Also show git branches
2791
+ try {
2792
+ const { execSync } = require('child_process');
2793
+ const gitBranches = execSync('git branch --list', { encoding: 'utf8' }).trim();
2794
+ if (gitBranches) {
2795
+ console.log();
2796
+ console.log(C.dim(' Git branches:'));
2797
+ for (const line of gitBranches.split('\n').filter(Boolean)) {
2798
+ console.log(C.dim(` ${line}`));
2799
+ }
2800
+ }
2801
+ }
2802
+ catch { }
2803
+ console.log();
2804
+ }
2805
+ // ─── cell lessons ──────────────────────────────────────────────────────────
2806
+ function doLessons() {
2807
+ const { getAvoidSuggestions, getFailureStats, getAllFailureRecords } = require('../../03-knowledge/decisions/failure-memory');
2808
+ const lessonArgs = process.argv.slice(3);
2809
+ const topic = lessonArgs[0];
2810
+ let lessonProject = project;
2811
+ try {
2812
+ const { detectProject } = require('../setup/setup');
2813
+ lessonProject = detectProject().name;
2814
+ }
2815
+ catch { }
2816
+ console.log();
2817
+ console.log(C.bold(' Engineering Lessons'));
2818
+ console.log(C.dim(' ──────────────────'));
2819
+ console.log();
2820
+ const stats = getFailureStats(lessonProject);
2821
+ if (stats.totalTracked === 0) {
2822
+ console.log(C.warn(' No lessons recorded yet.'));
2823
+ console.log();
2824
+ console.log(C.dim(' Lessons are learned from pattern rejections during:'));
2825
+ console.log(C.dim(' - AI code suggestions'));
2826
+ console.log(C.dim(' - Code review feedback'));
2827
+ console.log(C.dim(' - Scanner repeat issues'));
2828
+ console.log();
2829
+ console.log(C.dim(' Start collecting:'));
2830
+ console.log(C.primary(' cell scan'));
2831
+ console.log(C.primary(' cell blindspots --top'));
2832
+ return;
2833
+ }
2834
+ console.log(` Tracked: ${stats.totalTracked} patterns`);
2835
+ console.log(` Critical: ${stats.criticalCount} | High: ${stats.highCount} | Medium: ${stats.mediumCount} | Low: ${stats.lowCount}`);
2836
+ console.log(` Avg failure rate: ${Math.round(stats.avgFailureRate * 100)}%`);
2837
+ console.log();
2838
+ const suggestions = getAvoidSuggestions(0.5, lessonProject);
2839
+ if (topic) {
2840
+ const filtered = suggestions.filter((s) => s.description.toLowerCase().includes(topic.toLowerCase()) ||
2841
+ s.patternId.toLowerCase().includes(topic.toLowerCase()));
2842
+ if (filtered.length === 0) {
2843
+ console.log(` No lessons found for "${topic}".`);
2844
+ }
2845
+ else {
2846
+ console.log(C.bold(` Lessons for "${topic}":`));
2847
+ console.log();
2848
+ for (const s of filtered.slice(0, 10)) {
2849
+ const icon = s.severity === 'critical' ? '!!!' : s.severity === 'high' ? '!!' : s.severity === 'medium' ? '!' : '-';
2850
+ console.log(` ${C.warn(icon)} ${s.description}`);
2851
+ console.log(` Failure rate: ${Math.round(s.failureRate * 100)}% (${s.severity})`);
2852
+ console.log(` ${s.alternativeDescription}`);
2853
+ console.log();
2854
+ }
2855
+ }
2856
+ }
2857
+ else {
2858
+ if (suggestions.length === 0) {
2859
+ console.log(' No lessons to show yet. Keep building!');
2860
+ }
2861
+ else {
2862
+ console.log(C.bold(' Top lessons (patterns to avoid):'));
2863
+ console.log();
2864
+ for (const s of suggestions.slice(0, 10)) {
2865
+ const icon = s.severity === 'critical' ? '!!!' : s.severity === 'high' ? '!!' : s.severity === 'medium' ? '!' : '-';
2866
+ console.log(` ${C.warn(icon)} ${s.description}`);
2867
+ console.log(` Failure rate: ${Math.round(s.failureRate * 100)}% (${s.severity})`);
2868
+ console.log(` ${s.alternativeDescription}`);
2869
+ console.log();
2870
+ }
2871
+ }
2872
+ }
2873
+ console.log(C.dim(' Use: cell lessons <topic> to filter by topic'));
2874
+ console.log();
2875
+ }
2876
+ // ─── cell evolution ────────────────────────────────────────────────────────
2877
+ function doEvolution() {
2878
+ const { buildJourneyReport, saveJourneyReport } = require('../../03-knowledge/decisions/journey-memory');
2879
+ const evoArgs = process.argv.slice(3);
2880
+ const dir = evoArgs[0] || process.cwd();
2881
+ const showStack = evoArgs.includes('--stack');
2882
+ let evoProject = project;
2883
+ try {
2884
+ const { detectProject } = require('../setup/setup');
2885
+ evoProject = detectProject(dir).name;
2886
+ }
2887
+ catch {
2888
+ try {
2889
+ const pkgPath = require('path').join(dir, 'package.json');
2890
+ const pkg = JSON.parse(require('fs').readFileSync(pkgPath, 'utf-8'));
2891
+ if (pkg.name)
2892
+ evoProject = pkg.name;
2893
+ }
2894
+ catch { }
2895
+ }
2896
+ console.log();
2897
+ console.log(C.bold(' Project Evolution Map'));
2898
+ console.log(C.dim(' ────────────────────'));
2899
+ console.log();
2900
+ if (showStack) {
2901
+ try {
2902
+ const rows = (0, database_1.getDb)().prepare(`SELECT stack_json, file_count, line_count, scanned_at FROM stack_history WHERE LOWER(project) = LOWER(?) ORDER BY scanned_at ASC`).all(evoProject);
2903
+ if (rows.length === 0) {
2904
+ console.log(C.dim(' No stack history yet. Run: cell scan'));
2905
+ }
2906
+ else {
2907
+ console.log(C.bold(' Stack Timeline:'));
2908
+ console.log();
2909
+ let prevStack = '';
2910
+ for (const row of rows) {
2911
+ const date = String(row.scanned_at).slice(0, 10);
2912
+ let langs = {};
2913
+ try {
2914
+ langs = JSON.parse(String(row.stack_json));
2915
+ }
2916
+ catch { }
2917
+ const langList = Object.entries(langs).sort((a, b) => b[1] - a[1]).slice(0, 5).map(([l, c]) => `${l}(${c})`).join(', ');
2918
+ const currentStack = Object.keys(langs).sort().join(',');
2919
+ const changed = prevStack && prevStack !== currentStack;
2920
+ const marker = changed ? C.warn('CHANGED') : C.dim('same');
2921
+ console.log(` ${date} ${langList || 'unknown'} ${row.file_count} files ${row.line_count} lines ${marker}`);
2922
+ prevStack = currentStack;
2923
+ }
2924
+ }
2925
+ }
2926
+ catch (e) {
2927
+ console.log(C.warn(` Stack history failed: ${e?.message || String(e)}`));
2928
+ }
2929
+ console.log();
2930
+ return;
2931
+ }
2932
+ console.log(' Building journey report...');
2933
+ try {
2934
+ const report = buildJourneyReport(dir);
2935
+ const savedPath = saveJourneyReport(report);
2936
+ console.log();
2937
+ console.log(C.bold(' Summary'));
2938
+ console.log(` Projects: ${report.summary.totalProjects}`);
2939
+ console.log(` Active since: ${report.summary.activeSince}`);
2940
+ console.log(` Languages: ${report.summary.languagesLearned}`);
2941
+ console.log(` Total commits: ${report.summary.totalCommits}`);
2942
+ console.log(` Top language: ${report.summary.mostUsedLanguage}`);
2943
+ console.log(` Top skill: ${report.summary.topSkill}`);
2944
+ console.log(` Growth: ${report.summary.growthRate}`);
2945
+ console.log();
2946
+ if (report.skills.length > 0) {
2947
+ console.log(C.bold(' Skill Progression'));
2948
+ console.log();
2949
+ for (const s of report.skills.slice(0, 8)) {
2950
+ const bar = '█'.repeat(Math.min(s.metrics.cleanFileRatio / 10, 10));
2951
+ console.log(` ${s.area.padEnd(15)} ${s.currentLevel.padEnd(14)} ${bar} ${s.metrics.cleanFileRatio}% clean`);
2952
+ }
2953
+ console.log();
2954
+ }
2955
+ if (report.chains.length > 0) {
2956
+ console.log(C.bold(' Reused Patterns'));
2957
+ console.log();
2958
+ for (const c of report.chains.slice(0, 5)) {
2959
+ console.log(` ${c.pattern} (${Math.round(c.successRate * 100)}% success)`);
2960
+ console.log(` Used in: ${c.firstUsed.project}${c.reusedIn.length > 0 ? ', ' + c.reusedIn.map((r) => r.project).join(', ') : ''}`);
2961
+ }
2962
+ console.log();
2963
+ }
2964
+ if (report.goals.recommendations.length > 0) {
2965
+ console.log(C.bold(' Recommendations'));
2966
+ console.log();
2967
+ for (const rec of report.goals.recommendations.slice(0, 5)) {
2968
+ console.log(` -> ${rec}`);
2969
+ }
2970
+ console.log();
2971
+ }
2972
+ console.log(C.dim(` Full report: ${savedPath}`));
2973
+ console.log(C.dim(' Also saved as: ~/.fivo/cell/journey.md'));
2974
+ console.log();
2975
+ }
2976
+ catch (e) {
2977
+ console.log(C.warn(` Failed to build evolution map: ${e instanceof Error ? e.message : String(e)}`));
2978
+ console.log();
2979
+ }
2980
+ }
1658
2981
  // ─── cell help ──────────────────────────────────────────────────────────────
1659
2982
  function doHelp() {
1660
2983
  console.log();
@@ -1664,6 +2987,7 @@ function doHelp() {
1664
2987
  console.log(` ${C.primary('cell start')} Start daemon + MCP (port 9876) — re-run safe`);
1665
2988
  console.log(` ${C.primary('cell stop')} Stop daemon`);
1666
2989
  console.log(` ${C.primary('cell setup')} One-time project setup: scan + watcher + MCP (idempotent)`);
2990
+ console.log(` ${C.primary('cell doctor')} Health check — diagnose what's missing and how to fix`);
1667
2991
  console.log(` ${C.primary('cell --version')} Print version + daemon status`);
1668
2992
  console.log(` ${C.primary('cell mcp-config')} Auto-register cell MCP in Cursor/Antigravity/Codex/OpenCode`);
1669
2993
  console.log(` ${C.primary('cell scan')} Scan codebase + build layers`);
@@ -1678,7 +3002,14 @@ function doHelp() {
1678
3002
  console.log(` ${C.primary('cell watch [start|stop|events|check|status] [proj] [dir]')} Live file watcher`);
1679
3003
  console.log(` ${C.primary('cell watch daemon [proj] [dir]')} Run as long-lived watcher (for .bat)`);
1680
3004
  console.log(` ${C.primary('cell blindspots [dir] [maxFiles]')} Scan for blind spots (15+ types)`);
1681
- console.log(` ${C.primary('cell context [project] [tool]')} Inject @cell context block`);
3005
+ console.log(` ${C.primary('cell blindspots --top [N]')} Show top N prioritized fixes (default 5)`);
3006
+ console.log(` ${C.primary('cell context [project] [tool] [--short|--full]')} Inject @cell context block`);
3007
+ console.log(` ${C.primary('cell switch-back <branch>')} Restore branch context`);
3008
+ console.log(` ${C.primary('cell branches')} List known branches with last context`);
3009
+ console.log(` ${C.primary('cell lessons [topic]')} Engineering lessons from failures`);
3010
+ console.log(` ${C.primary('cell evolution [dir] [--stack]')} Project evolution map + stack timeline`);
3011
+ console.log(` ${C.primary('cell focus [dir]')} Focus report — active/stalled/abandoned projects`);
3012
+ console.log(` ${C.primary('cell why <topic>')} Search decisions by topic`);
1682
3013
  console.log(` ${C.primary('cell repl')} Interactive REPL with / completion (or just run \`cell\` in a TTY)`);
1683
3014
  console.log(` ${C.primary('cell help')} Show this help`);
1684
3015
  console.log();
@@ -1686,5 +3017,167 @@ function doHelp() {
1686
3017
  console.log(C.dim(' Then: cell start'));
1687
3018
  console.log();
1688
3019
  }
3020
+ // ─── cell focus ────────────────────────────────────────────────────────────
3021
+ function doFocus() {
3022
+ const { buildFocusReport, renderFocusMd } = require('../../03-knowledge/decisions/focus-report');
3023
+ const focusArgs = process.argv.slice(3);
3024
+ const rootDir = focusArgs[0] || path.dirname(process.cwd());
3025
+ const asJson = focusArgs.includes('--json');
3026
+ console.log();
3027
+ console.log(C.bold(' Focus Report — Project Activity'));
3028
+ console.log(C.dim(' ───────────────────────────────'));
3029
+ console.log();
3030
+ try {
3031
+ const report = buildFocusReport(rootDir);
3032
+ if (asJson) {
3033
+ console.log(JSON.stringify(report, null, 2));
3034
+ return;
3035
+ }
3036
+ console.log(` Total: ${report.totalProjects} projects`);
3037
+ console.log(` Active: ${C.success(String(report.active))} | Stalled: ${C.warn(String(report.stalled))} | Abandoned: ${C.primary(String(report.abandoned))} | Fresh: ${report.fresh}`);
3038
+ console.log();
3039
+ if (report.topPicks.length > 0) {
3040
+ console.log(C.bold(' Keep doing this:'));
3041
+ for (const p of report.topPicks) {
3042
+ console.log(` ${C.success('>>')} ${p.name} — ${p.reason}`);
3043
+ }
3044
+ console.log();
3045
+ }
3046
+ if (report.shouldPause.length > 0) {
3047
+ console.log(C.bold(' Pause / Decide:'));
3048
+ for (const p of report.shouldPause) {
3049
+ console.log(` ${C.warn('??')} ${p.name} (${p.lastModifiedDays}d silent) — ${p.reason}`);
3050
+ }
3051
+ console.log();
3052
+ }
3053
+ if (report.shouldArchive.length > 0) {
3054
+ console.log(C.bold(' Archive:'));
3055
+ for (const p of report.shouldArchive) {
3056
+ console.log(` ${C.dim('..')} ${p.name} (${p.lastModifiedDays}d silent) — ${p.reason}`);
3057
+ }
3058
+ console.log();
3059
+ }
3060
+ if (report.shouldResurrect.length > 0) {
3061
+ console.log(C.bold(' Resurrect:'));
3062
+ for (const p of report.shouldResurrect) {
3063
+ console.log(` ${C.primary('!!')} ${p.name} (${p.lastModifiedDays}d silent) — ${p.reason}`);
3064
+ }
3065
+ console.log();
3066
+ }
3067
+ if (report.overallAdvice.length > 0) {
3068
+ console.log(C.bold(' Advice:'));
3069
+ for (const a of report.overallAdvice) {
3070
+ console.log(` ${C.dim('>')} ${a}`);
3071
+ }
3072
+ }
3073
+ }
3074
+ catch (e) {
3075
+ console.log(C.warn(` Focus report failed: ${e?.message || String(e)}`));
3076
+ console.log(C.dim(' Tip: run from a parent directory containing multiple projects'));
3077
+ }
3078
+ console.log();
3079
+ }
3080
+ // ─── cell why <topic> ──────────────────────────────────────────────────────
3081
+ function doWhy() {
3082
+ const whyArgs = process.argv.slice(3);
3083
+ const topic = whyArgs[0];
3084
+ if (!topic) {
3085
+ console.log();
3086
+ console.log(C.bold(' Cell Why — Decision Search'));
3087
+ console.log(C.dim(' ───────────────────────────'));
3088
+ console.log();
3089
+ console.log(C.dim(' Usage: cell why <topic>'));
3090
+ console.log(C.dim(' Example: cell why typescript'));
3091
+ console.log(C.dim(' Example: cell why testing'));
3092
+ console.log();
3093
+ return;
3094
+ }
3095
+ const db = (0, database_1.getDb)();
3096
+ console.log();
3097
+ console.log(C.bold(` Why — Decisions about "${topic}"`));
3098
+ console.log(C.dim(' ─────────────────────────────'));
3099
+ console.log();
3100
+ const likeTopic = `%${topic}%`;
3101
+ try {
3102
+ const decisionRows = db.prepare(`
3103
+ SELECT technology, reason, outcome, was_right, project, created_at
3104
+ FROM decisions
3105
+ WHERE technology LIKE ? OR reason LIKE ? OR outcome LIKE ?
3106
+ ORDER BY created_at DESC LIMIT 10
3107
+ `).all(likeTopic, likeTopic, likeTopic);
3108
+ const decisionOutcomeRows = db.prepare(`
3109
+ SELECT technology, reason, outcome, was_right, confidence, context, project, created_at
3110
+ FROM decision_outcomes
3111
+ WHERE technology LIKE ? OR reason LIKE ? OR outcome LIKE ? OR context LIKE ?
3112
+ ORDER BY created_at DESC LIMIT 10
3113
+ `).all(likeTopic, likeTopic, likeTopic, likeTopic);
3114
+ const logRows = db.prepare(`
3115
+ SELECT decision, approach, result, worked, file_path as file, decided_at
3116
+ FROM decision_log
3117
+ WHERE decision LIKE ? OR approach LIKE ? OR result LIKE ?
3118
+ ORDER BY decided_at DESC LIMIT 10
3119
+ `).all(likeTopic, likeTopic, likeTopic);
3120
+ let found = 0;
3121
+ if (decisionRows.length > 0) {
3122
+ console.log(C.bold(' Technology Decisions:'));
3123
+ for (const r of decisionRows) {
3124
+ const verdict = Number(r.was_right) ? C.success('Right') : C.warn('Wrong');
3125
+ console.log(` ${verdict} ${r.technology || r.reason}`);
3126
+ if (r.reason)
3127
+ console.log(C.dim(` Reason: ${r.reason}`));
3128
+ if (r.outcome)
3129
+ console.log(C.dim(` Outcome: ${r.outcome}`));
3130
+ if (r.project)
3131
+ console.log(C.dim(` Project: ${r.project}`));
3132
+ console.log();
3133
+ }
3134
+ found += decisionRows.length;
3135
+ }
3136
+ if (decisionOutcomeRows.length > 0) {
3137
+ console.log(C.bold(' Decision Outcomes:'));
3138
+ for (const r of decisionOutcomeRows) {
3139
+ const verdict = Number(r.was_right) ? C.success('Right') : C.warn('Wrong');
3140
+ console.log(` ${verdict} ${r.technology || r.reason}`);
3141
+ if (r.reason)
3142
+ console.log(C.dim(` Reason: ${r.reason}`));
3143
+ if (r.outcome)
3144
+ console.log(C.dim(` Outcome: ${r.outcome}`));
3145
+ if (r.context)
3146
+ console.log(C.dim(` Context: ${r.context}`));
3147
+ if (r.confidence)
3148
+ console.log(C.dim(` Confidence: ${r.confidence}%`));
3149
+ console.log();
3150
+ }
3151
+ found += decisionOutcomeRows.length;
3152
+ }
3153
+ if (logRows.length > 0) {
3154
+ console.log(C.bold(' Session Decisions:'));
3155
+ for (const r of logRows) {
3156
+ const verdict = Number(r.worked) ? C.success('Worked') : C.warn("Didn't");
3157
+ console.log(` ${verdict} ${r.decision}`);
3158
+ if (r.approach)
3159
+ console.log(C.dim(` Approach: ${r.approach}`));
3160
+ if (r.result)
3161
+ console.log(C.dim(` Result: ${r.result}`));
3162
+ if (r.file)
3163
+ console.log(C.dim(` File: ${r.file}`));
3164
+ console.log();
3165
+ }
3166
+ found += logRows.length;
3167
+ }
3168
+ if (found === 0) {
3169
+ console.log(C.dim(` No decisions found about "${topic}".`));
3170
+ console.log();
3171
+ console.log(C.dim(' Decisions are logged when you:'));
3172
+ console.log(C.dim(' - Accept/reject AI suggestions in your IDE'));
3173
+ console.log(C.dim(' - Run cell scan + cell setup'));
3174
+ console.log(C.dim(' - Use the decision MCP tool'));
3175
+ }
3176
+ }
3177
+ catch (e) {
3178
+ console.log(C.warn(` Search failed: ${e?.message || String(e)}`));
3179
+ }
3180
+ console.log();
3181
+ }
1689
3182
  // test touch 14:40:59
1690
3183
  //# sourceMappingURL=cli.js.map