@cleocode/cleo 2026.5.4 → 2026.5.5

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 (857) hide show
  1. package/dist/cli/index.js +61 -87
  2. package/dist/cli/index.js.map +3 -3
  3. package/package.json +9 -9
  4. package/dist/backfill/audit-columns.d.ts +0 -105
  5. package/dist/backfill/audit-columns.d.ts.map +0 -1
  6. package/dist/backfill/audit-columns.js +0 -258
  7. package/dist/backfill/audit-columns.js.map +0 -1
  8. package/dist/cli/commands/adapter.d.ts +0 -28
  9. package/dist/cli/commands/adapter.d.ts.map +0 -1
  10. package/dist/cli/commands/adapter.js +0 -119
  11. package/dist/cli/commands/adapter.js.map +0 -1
  12. package/dist/cli/commands/add-batch.d.ts +0 -33
  13. package/dist/cli/commands/add-batch.d.ts.map +0 -1
  14. package/dist/cli/commands/add-batch.js +0 -148
  15. package/dist/cli/commands/add-batch.js.map +0 -1
  16. package/dist/cli/commands/add.d.ts +0 -162
  17. package/dist/cli/commands/add.d.ts.map +0 -1
  18. package/dist/cli/commands/add.js +0 -279
  19. package/dist/cli/commands/add.js.map +0 -1
  20. package/dist/cli/commands/admin.d.ts +0 -24
  21. package/dist/cli/commands/admin.d.ts.map +0 -1
  22. package/dist/cli/commands/admin.js +0 -283
  23. package/dist/cli/commands/admin.js.map +0 -1
  24. package/dist/cli/commands/adr.d.ts +0 -33
  25. package/dist/cli/commands/adr.d.ts.map +0 -1
  26. package/dist/cli/commands/adr.js +0 -147
  27. package/dist/cli/commands/adr.js.map +0 -1
  28. package/dist/cli/commands/agent-profile-status.d.ts +0 -98
  29. package/dist/cli/commands/agent-profile-status.d.ts.map +0 -1
  30. package/dist/cli/commands/agent-profile-status.js +0 -71
  31. package/dist/cli/commands/agent-profile-status.js.map +0 -1
  32. package/dist/cli/commands/agent.d.ts +0 -47
  33. package/dist/cli/commands/agent.d.ts.map +0 -1
  34. package/dist/cli/commands/agent.js +0 -2976
  35. package/dist/cli/commands/agent.js.map +0 -1
  36. package/dist/cli/commands/analyze.d.ts +0 -21
  37. package/dist/cli/commands/analyze.d.ts.map +0 -1
  38. package/dist/cli/commands/analyze.js +0 -32
  39. package/dist/cli/commands/analyze.js.map +0 -1
  40. package/dist/cli/commands/archive-stats.d.ts +0 -66
  41. package/dist/cli/commands/archive-stats.d.ts.map +0 -1
  42. package/dist/cli/commands/archive-stats.js +0 -93
  43. package/dist/cli/commands/archive-stats.js.map +0 -1
  44. package/dist/cli/commands/archive.d.ts +0 -42
  45. package/dist/cli/commands/archive.d.ts.map +0 -1
  46. package/dist/cli/commands/archive.js +0 -59
  47. package/dist/cli/commands/archive.js.map +0 -1
  48. package/dist/cli/commands/audit.d.ts +0 -22
  49. package/dist/cli/commands/audit.d.ts.map +0 -1
  50. package/dist/cli/commands/audit.js +0 -137
  51. package/dist/cli/commands/audit.js.map +0 -1
  52. package/dist/cli/commands/backfill.d.ts +0 -56
  53. package/dist/cli/commands/backfill.d.ts.map +0 -1
  54. package/dist/cli/commands/backfill.js +0 -161
  55. package/dist/cli/commands/backfill.js.map +0 -1
  56. package/dist/cli/commands/backup-inspect.d.ts +0 -33
  57. package/dist/cli/commands/backup-inspect.d.ts.map +0 -1
  58. package/dist/cli/commands/backup-inspect.js +0 -430
  59. package/dist/cli/commands/backup-inspect.js.map +0 -1
  60. package/dist/cli/commands/backup.d.ts +0 -23
  61. package/dist/cli/commands/backup.d.ts.map +0 -1
  62. package/dist/cli/commands/backup.js +0 -564
  63. package/dist/cli/commands/backup.js.map +0 -1
  64. package/dist/cli/commands/blockers.d.ts +0 -20
  65. package/dist/cli/commands/blockers.d.ts.map +0 -1
  66. package/dist/cli/commands/blockers.js +0 -31
  67. package/dist/cli/commands/blockers.js.map +0 -1
  68. package/dist/cli/commands/brain.d.ts +0 -37
  69. package/dist/cli/commands/brain.d.ts.map +0 -1
  70. package/dist/cli/commands/brain.js +0 -445
  71. package/dist/cli/commands/brain.js.map +0 -1
  72. package/dist/cli/commands/briefing.d.ts +0 -52
  73. package/dist/cli/commands/briefing.d.ts.map +0 -1
  74. package/dist/cli/commands/briefing.js +0 -69
  75. package/dist/cli/commands/briefing.js.map +0 -1
  76. package/dist/cli/commands/bug.d.ts +0 -61
  77. package/dist/cli/commands/bug.d.ts.map +0 -1
  78. package/dist/cli/commands/bug.js +0 -198
  79. package/dist/cli/commands/bug.js.map +0 -1
  80. package/dist/cli/commands/cancel.d.ts +0 -26
  81. package/dist/cli/commands/cancel.d.ts.map +0 -1
  82. package/dist/cli/commands/cancel.js +0 -40
  83. package/dist/cli/commands/cancel.js.map +0 -1
  84. package/dist/cli/commands/cant.d.ts +0 -13
  85. package/dist/cli/commands/cant.d.ts.map +0 -1
  86. package/dist/cli/commands/cant.js +0 -245
  87. package/dist/cli/commands/cant.js.map +0 -1
  88. package/dist/cli/commands/chain.d.ts +0 -24
  89. package/dist/cli/commands/chain.d.ts.map +0 -1
  90. package/dist/cli/commands/chain.js +0 -116
  91. package/dist/cli/commands/chain.js.map +0 -1
  92. package/dist/cli/commands/check.d.ts +0 -18
  93. package/dist/cli/commands/check.d.ts.map +0 -1
  94. package/dist/cli/commands/check.js +0 -280
  95. package/dist/cli/commands/check.js.map +0 -1
  96. package/dist/cli/commands/checkpoint.d.ts +0 -27
  97. package/dist/cli/commands/checkpoint.d.ts.map +0 -1
  98. package/dist/cli/commands/checkpoint.js +0 -105
  99. package/dist/cli/commands/checkpoint.js.map +0 -1
  100. package/dist/cli/commands/claim.d.ts +0 -35
  101. package/dist/cli/commands/claim.d.ts.map +0 -1
  102. package/dist/cli/commands/claim.js +0 -35
  103. package/dist/cli/commands/claim.js.map +0 -1
  104. package/dist/cli/commands/code.d.ts +0 -22
  105. package/dist/cli/commands/code.d.ts.map +0 -1
  106. package/dist/cli/commands/code.js +0 -161
  107. package/dist/cli/commands/code.js.map +0 -1
  108. package/dist/cli/commands/complete.d.ts +0 -58
  109. package/dist/cli/commands/complete.d.ts.map +0 -1
  110. package/dist/cli/commands/complete.js +0 -83
  111. package/dist/cli/commands/complete.js.map +0 -1
  112. package/dist/cli/commands/complexity.d.ts +0 -13
  113. package/dist/cli/commands/complexity.d.ts.map +0 -1
  114. package/dist/cli/commands/complexity.js +0 -32
  115. package/dist/cli/commands/complexity.js.map +0 -1
  116. package/dist/cli/commands/compliance.d.ts +0 -27
  117. package/dist/cli/commands/compliance.d.ts.map +0 -1
  118. package/dist/cli/commands/compliance.js +0 -233
  119. package/dist/cli/commands/compliance.js.map +0 -1
  120. package/dist/cli/commands/conduit.d.ts +0 -28
  121. package/dist/cli/commands/conduit.d.ts.map +0 -1
  122. package/dist/cli/commands/conduit.js +0 -279
  123. package/dist/cli/commands/conduit.js.map +0 -1
  124. package/dist/cli/commands/config.d.ts +0 -25
  125. package/dist/cli/commands/config.d.ts.map +0 -1
  126. package/dist/cli/commands/config.js +0 -132
  127. package/dist/cli/commands/config.js.map +0 -1
  128. package/dist/cli/commands/consensus.d.ts +0 -21
  129. package/dist/cli/commands/consensus.d.ts.map +0 -1
  130. package/dist/cli/commands/consensus.js +0 -100
  131. package/dist/cli/commands/consensus.js.map +0 -1
  132. package/dist/cli/commands/context.d.ts +0 -19
  133. package/dist/cli/commands/context.d.ts.map +0 -1
  134. package/dist/cli/commands/context.js +0 -111
  135. package/dist/cli/commands/context.js.map +0 -1
  136. package/dist/cli/commands/contribution.d.ts +0 -21
  137. package/dist/cli/commands/contribution.d.ts.map +0 -1
  138. package/dist/cli/commands/contribution.js +0 -90
  139. package/dist/cli/commands/contribution.js.map +0 -1
  140. package/dist/cli/commands/current.d.ts +0 -18
  141. package/dist/cli/commands/current.d.ts.map +0 -1
  142. package/dist/cli/commands/current.js +0 -28
  143. package/dist/cli/commands/current.js.map +0 -1
  144. package/dist/cli/commands/daemon.d.ts +0 -36
  145. package/dist/cli/commands/daemon.d.ts.map +0 -1
  146. package/dist/cli/commands/daemon.js +0 -223
  147. package/dist/cli/commands/daemon.js.map +0 -1
  148. package/dist/cli/commands/dash.d.ts +0 -23
  149. package/dist/cli/commands/dash.d.ts.map +0 -1
  150. package/dist/cli/commands/dash.js +0 -38
  151. package/dist/cli/commands/dash.js.map +0 -1
  152. package/dist/cli/commands/decomposition.d.ts +0 -13
  153. package/dist/cli/commands/decomposition.d.ts.map +0 -1
  154. package/dist/cli/commands/decomposition.js +0 -92
  155. package/dist/cli/commands/decomposition.js.map +0 -1
  156. package/dist/cli/commands/delete.d.ts +0 -29
  157. package/dist/cli/commands/delete.d.ts.map +0 -1
  158. package/dist/cli/commands/delete.js +0 -55
  159. package/dist/cli/commands/delete.js.map +0 -1
  160. package/dist/cli/commands/deps.d.ts +0 -45
  161. package/dist/cli/commands/deps.d.ts.map +0 -1
  162. package/dist/cli/commands/deps.js +0 -170
  163. package/dist/cli/commands/deps.js.map +0 -1
  164. package/dist/cli/commands/detect-drift.d.ts +0 -23
  165. package/dist/cli/commands/detect-drift.d.ts.map +0 -1
  166. package/dist/cli/commands/detect-drift.js +0 -440
  167. package/dist/cli/commands/detect-drift.js.map +0 -1
  168. package/dist/cli/commands/detect.d.ts +0 -3
  169. package/dist/cli/commands/detect.d.ts.map +0 -1
  170. package/dist/cli/commands/detect.js +0 -14
  171. package/dist/cli/commands/detect.js.map +0 -1
  172. package/dist/cli/commands/diagnostics.d.ts +0 -19
  173. package/dist/cli/commands/diagnostics.d.ts.map +0 -1
  174. package/dist/cli/commands/diagnostics.js +0 -109
  175. package/dist/cli/commands/diagnostics.js.map +0 -1
  176. package/dist/cli/commands/docs.d.ts +0 -25
  177. package/dist/cli/commands/docs.d.ts.map +0 -1
  178. package/dist/cli/commands/docs.js +0 -798
  179. package/dist/cli/commands/docs.js.map +0 -1
  180. package/dist/cli/commands/doctor-projects.d.ts +0 -101
  181. package/dist/cli/commands/doctor-projects.d.ts.map +0 -1
  182. package/dist/cli/commands/doctor-projects.js +0 -188
  183. package/dist/cli/commands/doctor-projects.js.map +0 -1
  184. package/dist/cli/commands/doctor.d.ts +0 -66
  185. package/dist/cli/commands/doctor.d.ts.map +0 -1
  186. package/dist/cli/commands/doctor.js +0 -178
  187. package/dist/cli/commands/doctor.js.map +0 -1
  188. package/dist/cli/commands/dynamic.d.ts +0 -15
  189. package/dist/cli/commands/dynamic.d.ts.map +0 -1
  190. package/dist/cli/commands/dynamic.js +0 -21
  191. package/dist/cli/commands/dynamic.js.map +0 -1
  192. package/dist/cli/commands/exists.d.ts +0 -13
  193. package/dist/cli/commands/exists.d.ts.map +0 -1
  194. package/dist/cli/commands/exists.js +0 -40
  195. package/dist/cli/commands/exists.js.map +0 -1
  196. package/dist/cli/commands/export-tasks.d.ts +0 -46
  197. package/dist/cli/commands/export-tasks.d.ts.map +0 -1
  198. package/dist/cli/commands/export-tasks.js +0 -81
  199. package/dist/cli/commands/export-tasks.js.map +0 -1
  200. package/dist/cli/commands/export.d.ts +0 -35
  201. package/dist/cli/commands/export.d.ts.map +0 -1
  202. package/dist/cli/commands/export.js +0 -68
  203. package/dist/cli/commands/export.js.map +0 -1
  204. package/dist/cli/commands/find.d.ts +0 -54
  205. package/dist/cli/commands/find.d.ts.map +0 -1
  206. package/dist/cli/commands/find.js +0 -92
  207. package/dist/cli/commands/find.js.map +0 -1
  208. package/dist/cli/commands/gc.d.ts +0 -25
  209. package/dist/cli/commands/gc.d.ts.map +0 -1
  210. package/dist/cli/commands/gc.js +0 -165
  211. package/dist/cli/commands/gc.js.map +0 -1
  212. package/dist/cli/commands/generate-changelog.d.ts +0 -30
  213. package/dist/cli/commands/generate-changelog.d.ts.map +0 -1
  214. package/dist/cli/commands/generate-changelog.js +0 -270
  215. package/dist/cli/commands/generate-changelog.js.map +0 -1
  216. package/dist/cli/commands/grade.d.ts +0 -13
  217. package/dist/cli/commands/grade.d.ts.map +0 -1
  218. package/dist/cli/commands/grade.js +0 -27
  219. package/dist/cli/commands/grade.js.map +0 -1
  220. package/dist/cli/commands/history.d.ts +0 -13
  221. package/dist/cli/commands/history.d.ts.map +0 -1
  222. package/dist/cli/commands/history.js +0 -65
  223. package/dist/cli/commands/history.js.map +0 -1
  224. package/dist/cli/commands/import-tasks.d.ts +0 -60
  225. package/dist/cli/commands/import-tasks.d.ts.map +0 -1
  226. package/dist/cli/commands/import-tasks.js +0 -83
  227. package/dist/cli/commands/import-tasks.js.map +0 -1
  228. package/dist/cli/commands/import.d.ts +0 -42
  229. package/dist/cli/commands/import.d.ts.map +0 -1
  230. package/dist/cli/commands/import.js +0 -64
  231. package/dist/cli/commands/import.js.map +0 -1
  232. package/dist/cli/commands/init.d.ts +0 -65
  233. package/dist/cli/commands/init.d.ts.map +0 -1
  234. package/dist/cli/commands/init.js +0 -122
  235. package/dist/cli/commands/init.js.map +0 -1
  236. package/dist/cli/commands/inject.d.ts +0 -41
  237. package/dist/cli/commands/inject.d.ts.map +0 -1
  238. package/dist/cli/commands/inject.js +0 -56
  239. package/dist/cli/commands/inject.js.map +0 -1
  240. package/dist/cli/commands/install-global.d.ts +0 -48
  241. package/dist/cli/commands/install-global.d.ts.map +0 -1
  242. package/dist/cli/commands/install-global.js +0 -104
  243. package/dist/cli/commands/install-global.js.map +0 -1
  244. package/dist/cli/commands/intelligence.d.ts +0 -21
  245. package/dist/cli/commands/intelligence.d.ts.map +0 -1
  246. package/dist/cli/commands/intelligence.js +0 -145
  247. package/dist/cli/commands/intelligence.js.map +0 -1
  248. package/dist/cli/commands/issue.d.ts +0 -23
  249. package/dist/cli/commands/issue.d.ts.map +0 -1
  250. package/dist/cli/commands/issue.js +0 -152
  251. package/dist/cli/commands/issue.js.map +0 -1
  252. package/dist/cli/commands/labels.d.ts +0 -21
  253. package/dist/cli/commands/labels.d.ts.map +0 -1
  254. package/dist/cli/commands/labels.js +0 -65
  255. package/dist/cli/commands/labels.js.map +0 -1
  256. package/dist/cli/commands/lifecycle.d.ts +0 -25
  257. package/dist/cli/commands/lifecycle.d.ts.map +0 -1
  258. package/dist/cli/commands/lifecycle.js +0 -221
  259. package/dist/cli/commands/lifecycle.js.map +0 -1
  260. package/dist/cli/commands/list.d.ts +0 -28
  261. package/dist/cli/commands/list.d.ts.map +0 -1
  262. package/dist/cli/commands/list.js +0 -81
  263. package/dist/cli/commands/list.js.map +0 -1
  264. package/dist/cli/commands/log.d.ts +0 -36
  265. package/dist/cli/commands/log.d.ts.map +0 -1
  266. package/dist/cli/commands/log.js +0 -50
  267. package/dist/cli/commands/log.js.map +0 -1
  268. package/dist/cli/commands/manifest.d.ts +0 -15
  269. package/dist/cli/commands/manifest.d.ts.map +0 -1
  270. package/dist/cli/commands/manifest.js +0 -334
  271. package/dist/cli/commands/manifest.js.map +0 -1
  272. package/dist/cli/commands/map.d.ts +0 -25
  273. package/dist/cli/commands/map.d.ts.map +0 -1
  274. package/dist/cli/commands/map.js +0 -37
  275. package/dist/cli/commands/map.js.map +0 -1
  276. package/dist/cli/commands/memory.d.ts +0 -48
  277. package/dist/cli/commands/memory.d.ts.map +0 -1
  278. package/dist/cli/commands/memory.js +0 -2439
  279. package/dist/cli/commands/memory.js.map +0 -1
  280. package/dist/cli/commands/migrate-claude-mem.d.ts +0 -23
  281. package/dist/cli/commands/migrate-claude-mem.d.ts.map +0 -1
  282. package/dist/cli/commands/migrate-claude-mem.js +0 -181
  283. package/dist/cli/commands/migrate-claude-mem.js.map +0 -1
  284. package/dist/cli/commands/next.d.ts +0 -27
  285. package/dist/cli/commands/next.d.ts.map +0 -1
  286. package/dist/cli/commands/next.js +0 -40
  287. package/dist/cli/commands/next.js.map +0 -1
  288. package/dist/cli/commands/nexus.d.ts +0 -15
  289. package/dist/cli/commands/nexus.d.ts.map +0 -1
  290. package/dist/cli/commands/nexus.js +0 -3377
  291. package/dist/cli/commands/nexus.js.map +0 -1
  292. package/dist/cli/commands/ops.d.ts +0 -23
  293. package/dist/cli/commands/ops.d.ts.map +0 -1
  294. package/dist/cli/commands/ops.js +0 -35
  295. package/dist/cli/commands/ops.js.map +0 -1
  296. package/dist/cli/commands/orchestrate.d.ts +0 -48
  297. package/dist/cli/commands/orchestrate.d.ts.map +0 -1
  298. package/dist/cli/commands/orchestrate.js +0 -774
  299. package/dist/cli/commands/orchestrate.js.map +0 -1
  300. package/dist/cli/commands/otel.d.ts +0 -30
  301. package/dist/cli/commands/otel.d.ts.map +0 -1
  302. package/dist/cli/commands/otel.js +0 -193
  303. package/dist/cli/commands/otel.js.map +0 -1
  304. package/dist/cli/commands/phase.d.ts +0 -29
  305. package/dist/cli/commands/phase.d.ts.map +0 -1
  306. package/dist/cli/commands/phase.js +0 -189
  307. package/dist/cli/commands/phase.js.map +0 -1
  308. package/dist/cli/commands/pivot.d.ts +0 -34
  309. package/dist/cli/commands/pivot.d.ts.map +0 -1
  310. package/dist/cli/commands/pivot.js +0 -50
  311. package/dist/cli/commands/pivot.js.map +0 -1
  312. package/dist/cli/commands/plan.d.ts +0 -17
  313. package/dist/cli/commands/plan.d.ts.map +0 -1
  314. package/dist/cli/commands/plan.js +0 -27
  315. package/dist/cli/commands/plan.js.map +0 -1
  316. package/dist/cli/commands/playbook.d.ts +0 -26
  317. package/dist/cli/commands/playbook.d.ts.map +0 -1
  318. package/dist/cli/commands/playbook.js +0 -220
  319. package/dist/cli/commands/playbook.js.map +0 -1
  320. package/dist/cli/commands/promote.d.ts +0 -19
  321. package/dist/cli/commands/promote.d.ts.map +0 -1
  322. package/dist/cli/commands/promote.js +0 -27
  323. package/dist/cli/commands/promote.js.map +0 -1
  324. package/dist/cli/commands/provider.d.ts +0 -23
  325. package/dist/cli/commands/provider.d.ts.map +0 -1
  326. package/dist/cli/commands/provider.js +0 -168
  327. package/dist/cli/commands/provider.js.map +0 -1
  328. package/dist/cli/commands/reason.d.ts +0 -18
  329. package/dist/cli/commands/reason.d.ts.map +0 -1
  330. package/dist/cli/commands/reason.js +0 -102
  331. package/dist/cli/commands/reason.js.map +0 -1
  332. package/dist/cli/commands/reconcile.d.ts +0 -35
  333. package/dist/cli/commands/reconcile.d.ts.map +0 -1
  334. package/dist/cli/commands/reconcile.js +0 -102
  335. package/dist/cli/commands/reconcile.js.map +0 -1
  336. package/dist/cli/commands/refresh-memory.d.ts +0 -16
  337. package/dist/cli/commands/refresh-memory.d.ts.map +0 -1
  338. package/dist/cli/commands/refresh-memory.js +0 -34
  339. package/dist/cli/commands/refresh-memory.js.map +0 -1
  340. package/dist/cli/commands/relates.d.ts +0 -19
  341. package/dist/cli/commands/relates.d.ts.map +0 -1
  342. package/dist/cli/commands/relates.js +0 -129
  343. package/dist/cli/commands/relates.js.map +0 -1
  344. package/dist/cli/commands/release.d.ts +0 -27
  345. package/dist/cli/commands/release.d.ts.map +0 -1
  346. package/dist/cli/commands/release.js +0 -300
  347. package/dist/cli/commands/release.js.map +0 -1
  348. package/dist/cli/commands/remote.d.ts +0 -49
  349. package/dist/cli/commands/remote.d.ts.map +0 -1
  350. package/dist/cli/commands/remote.js +0 -265
  351. package/dist/cli/commands/remote.js.map +0 -1
  352. package/dist/cli/commands/reorder.d.ts +0 -31
  353. package/dist/cli/commands/reorder.d.ts.map +0 -1
  354. package/dist/cli/commands/reorder.js +0 -57
  355. package/dist/cli/commands/reorder.js.map +0 -1
  356. package/dist/cli/commands/reparent.d.ts +0 -27
  357. package/dist/cli/commands/reparent.d.ts.map +0 -1
  358. package/dist/cli/commands/reparent.js +0 -36
  359. package/dist/cli/commands/reparent.js.map +0 -1
  360. package/dist/cli/commands/req.d.ts +0 -37
  361. package/dist/cli/commands/req.d.ts.map +0 -1
  362. package/dist/cli/commands/req.js +0 -121
  363. package/dist/cli/commands/req.js.map +0 -1
  364. package/dist/cli/commands/research.d.ts +0 -25
  365. package/dist/cli/commands/research.d.ts.map +0 -1
  366. package/dist/cli/commands/research.js +0 -327
  367. package/dist/cli/commands/research.js.map +0 -1
  368. package/dist/cli/commands/restore.d.ts +0 -64
  369. package/dist/cli/commands/restore.d.ts.map +0 -1
  370. package/dist/cli/commands/restore.js +0 -539
  371. package/dist/cli/commands/restore.js.map +0 -1
  372. package/dist/cli/commands/revert.d.ts +0 -79
  373. package/dist/cli/commands/revert.d.ts.map +0 -1
  374. package/dist/cli/commands/revert.js +0 -300
  375. package/dist/cli/commands/revert.js.map +0 -1
  376. package/dist/cli/commands/roadmap.d.ts +0 -29
  377. package/dist/cli/commands/roadmap.d.ts.map +0 -1
  378. package/dist/cli/commands/roadmap.js +0 -43
  379. package/dist/cli/commands/roadmap.js.map +0 -1
  380. package/dist/cli/commands/safestop.d.ts +0 -41
  381. package/dist/cli/commands/safestop.d.ts.map +0 -1
  382. package/dist/cli/commands/safestop.js +0 -62
  383. package/dist/cli/commands/safestop.js.map +0 -1
  384. package/dist/cli/commands/schema.d.ts +0 -44
  385. package/dist/cli/commands/schema.d.ts.map +0 -1
  386. package/dist/cli/commands/schema.js +0 -177
  387. package/dist/cli/commands/schema.js.map +0 -1
  388. package/dist/cli/commands/self-update.d.ts +0 -81
  389. package/dist/cli/commands/self-update.d.ts.map +0 -1
  390. package/dist/cli/commands/self-update.js +0 -483
  391. package/dist/cli/commands/self-update.js.map +0 -1
  392. package/dist/cli/commands/sentient.d.ts +0 -44
  393. package/dist/cli/commands/sentient.d.ts.map +0 -1
  394. package/dist/cli/commands/sentient.js +0 -687
  395. package/dist/cli/commands/sentient.js.map +0 -1
  396. package/dist/cli/commands/sequence.d.ts +0 -15
  397. package/dist/cli/commands/sequence.d.ts.map +0 -1
  398. package/dist/cli/commands/sequence.js +0 -68
  399. package/dist/cli/commands/sequence.js.map +0 -1
  400. package/dist/cli/commands/session.d.ts +0 -32
  401. package/dist/cli/commands/session.d.ts.map +0 -1
  402. package/dist/cli/commands/session.js +0 -583
  403. package/dist/cli/commands/session.js.map +0 -1
  404. package/dist/cli/commands/show.d.ts +0 -21
  405. package/dist/cli/commands/show.d.ts.map +0 -1
  406. package/dist/cli/commands/show.js +0 -37
  407. package/dist/cli/commands/show.js.map +0 -1
  408. package/dist/cli/commands/skills.d.ts +0 -31
  409. package/dist/cli/commands/skills.d.ts.map +0 -1
  410. package/dist/cli/commands/skills.js +0 -303
  411. package/dist/cli/commands/skills.js.map +0 -1
  412. package/dist/cli/commands/snapshot.d.ts +0 -17
  413. package/dist/cli/commands/snapshot.d.ts.map +0 -1
  414. package/dist/cli/commands/snapshot.js +0 -95
  415. package/dist/cli/commands/snapshot.js.map +0 -1
  416. package/dist/cli/commands/start.d.ts +0 -21
  417. package/dist/cli/commands/start.d.ts.map +0 -1
  418. package/dist/cli/commands/start.js +0 -32
  419. package/dist/cli/commands/start.js.map +0 -1
  420. package/dist/cli/commands/stats.d.ts +0 -30
  421. package/dist/cli/commands/stats.d.ts.map +0 -1
  422. package/dist/cli/commands/stats.js +0 -71
  423. package/dist/cli/commands/stats.js.map +0 -1
  424. package/dist/cli/commands/sticky.d.ts +0 -23
  425. package/dist/cli/commands/sticky.d.ts.map +0 -1
  426. package/dist/cli/commands/sticky.js +0 -315
  427. package/dist/cli/commands/sticky.js.map +0 -1
  428. package/dist/cli/commands/stop.d.ts +0 -15
  429. package/dist/cli/commands/stop.d.ts.map +0 -1
  430. package/dist/cli/commands/stop.js +0 -25
  431. package/dist/cli/commands/stop.js.map +0 -1
  432. package/dist/cli/commands/sync.d.ts +0 -25
  433. package/dist/cli/commands/sync.d.ts.map +0 -1
  434. package/dist/cli/commands/sync.js +0 -125
  435. package/dist/cli/commands/sync.js.map +0 -1
  436. package/dist/cli/commands/testing.d.ts +0 -22
  437. package/dist/cli/commands/testing.d.ts.map +0 -1
  438. package/dist/cli/commands/testing.js +0 -111
  439. package/dist/cli/commands/testing.js.map +0 -1
  440. package/dist/cli/commands/token.d.ts +0 -22
  441. package/dist/cli/commands/token.d.ts.map +0 -1
  442. package/dist/cli/commands/token.js +0 -197
  443. package/dist/cli/commands/token.js.map +0 -1
  444. package/dist/cli/commands/transcript.d.ts +0 -32
  445. package/dist/cli/commands/transcript.d.ts.map +0 -1
  446. package/dist/cli/commands/transcript.js +0 -526
  447. package/dist/cli/commands/transcript.js.map +0 -1
  448. package/dist/cli/commands/update.d.ts +0 -164
  449. package/dist/cli/commands/update.d.ts.map +0 -1
  450. package/dist/cli/commands/update.js +0 -234
  451. package/dist/cli/commands/update.js.map +0 -1
  452. package/dist/cli/commands/upgrade.d.ts +0 -76
  453. package/dist/cli/commands/upgrade.d.ts.map +0 -1
  454. package/dist/cli/commands/upgrade.js +0 -154
  455. package/dist/cli/commands/upgrade.js.map +0 -1
  456. package/dist/cli/commands/verify.d.ts +0 -83
  457. package/dist/cli/commands/verify.d.ts.map +0 -1
  458. package/dist/cli/commands/verify.js +0 -108
  459. package/dist/cli/commands/verify.js.map +0 -1
  460. package/dist/cli/commands/web.d.ts +0 -27
  461. package/dist/cli/commands/web.d.ts.map +0 -1
  462. package/dist/cli/commands/web.js +0 -414
  463. package/dist/cli/commands/web.js.map +0 -1
  464. package/dist/cli/field-context.d.ts +0 -32
  465. package/dist/cli/field-context.d.ts.map +0 -1
  466. package/dist/cli/field-context.js +0 -47
  467. package/dist/cli/field-context.js.map +0 -1
  468. package/dist/cli/format-context.d.ts +0 -32
  469. package/dist/cli/format-context.d.ts.map +0 -1
  470. package/dist/cli/format-context.js +0 -50
  471. package/dist/cli/format-context.js.map +0 -1
  472. package/dist/cli/help-renderer.d.ts +0 -40
  473. package/dist/cli/help-renderer.d.ts.map +0 -1
  474. package/dist/cli/help-renderer.js +0 -325
  475. package/dist/cli/help-renderer.js.map +0 -1
  476. package/dist/cli/index.d.ts +0 -14
  477. package/dist/cli/index.d.ts.map +0 -1
  478. package/dist/cli/infer-files-via-gitnexus.d.ts +0 -12
  479. package/dist/cli/infer-files-via-gitnexus.d.ts.map +0 -1
  480. package/dist/cli/infer-files-via-gitnexus.js +0 -12
  481. package/dist/cli/infer-files-via-gitnexus.js.map +0 -1
  482. package/dist/cli/lib/did-you-mean.d.ts +0 -30
  483. package/dist/cli/lib/did-you-mean.d.ts.map +0 -1
  484. package/dist/cli/lib/did-you-mean.js +0 -63
  485. package/dist/cli/lib/did-you-mean.js.map +0 -1
  486. package/dist/cli/lib/registry-args.d.ts +0 -36
  487. package/dist/cli/lib/registry-args.d.ts.map +0 -1
  488. package/dist/cli/lib/registry-args.js +0 -37
  489. package/dist/cli/lib/registry-args.js.map +0 -1
  490. package/dist/cli/lib/subcommand-guard.d.ts +0 -45
  491. package/dist/cli/lib/subcommand-guard.d.ts.map +0 -1
  492. package/dist/cli/lib/subcommand-guard.js +0 -55
  493. package/dist/cli/lib/subcommand-guard.js.map +0 -1
  494. package/dist/cli/logger-bootstrap.d.ts +0 -6
  495. package/dist/cli/logger-bootstrap.d.ts.map +0 -1
  496. package/dist/cli/logger-bootstrap.js +0 -10
  497. package/dist/cli/logger-bootstrap.js.map +0 -1
  498. package/dist/cli/middleware/output-format.d.ts +0 -30
  499. package/dist/cli/middleware/output-format.d.ts.map +0 -1
  500. package/dist/cli/middleware/output-format.js +0 -35
  501. package/dist/cli/middleware/output-format.js.map +0 -1
  502. package/dist/cli/paths.d.ts +0 -85
  503. package/dist/cli/paths.d.ts.map +0 -1
  504. package/dist/cli/paths.js +0 -108
  505. package/dist/cli/paths.js.map +0 -1
  506. package/dist/cli/progress.d.ts +0 -89
  507. package/dist/cli/progress.d.ts.map +0 -1
  508. package/dist/cli/progress.js +0 -185
  509. package/dist/cli/progress.js.map +0 -1
  510. package/dist/cli/renderers/colors.d.ts +0 -32
  511. package/dist/cli/renderers/colors.d.ts.map +0 -1
  512. package/dist/cli/renderers/colors.js +0 -141
  513. package/dist/cli/renderers/colors.js.map +0 -1
  514. package/dist/cli/renderers/error.d.ts +0 -13
  515. package/dist/cli/renderers/error.d.ts.map +0 -1
  516. package/dist/cli/renderers/error.js +0 -42
  517. package/dist/cli/renderers/error.js.map +0 -1
  518. package/dist/cli/renderers/index.d.ts +0 -90
  519. package/dist/cli/renderers/index.d.ts.map +0 -1
  520. package/dist/cli/renderers/index.js +0 -268
  521. package/dist/cli/renderers/index.js.map +0 -1
  522. package/dist/cli/renderers/lafs-validator.d.ts +0 -91
  523. package/dist/cli/renderers/lafs-validator.d.ts.map +0 -1
  524. package/dist/cli/renderers/lafs-validator.js +0 -176
  525. package/dist/cli/renderers/lafs-validator.js.map +0 -1
  526. package/dist/cli/renderers/normalizer.d.ts +0 -21
  527. package/dist/cli/renderers/normalizer.d.ts.map +0 -1
  528. package/dist/cli/renderers/normalizer.js +0 -106
  529. package/dist/cli/renderers/normalizer.js.map +0 -1
  530. package/dist/cli/renderers/system.d.ts +0 -110
  531. package/dist/cli/renderers/system.d.ts.map +0 -1
  532. package/dist/cli/renderers/system.js +0 -662
  533. package/dist/cli/renderers/system.js.map +0 -1
  534. package/dist/cli/renderers/tasks.d.ts +0 -28
  535. package/dist/cli/renderers/tasks.d.ts.map +0 -1
  536. package/dist/cli/renderers/tasks.js +0 -306
  537. package/dist/cli/renderers/tasks.js.map +0 -1
  538. package/dist/cli/tree-context.d.ts +0 -53
  539. package/dist/cli/tree-context.d.ts.map +0 -1
  540. package/dist/cli/tree-context.js +0 -43
  541. package/dist/cli/tree-context.js.map +0 -1
  542. package/dist/dispatch/adapters/cli.d.ts +0 -67
  543. package/dist/dispatch/adapters/cli.d.ts.map +0 -1
  544. package/dist/dispatch/adapters/cli.js +0 -331
  545. package/dist/dispatch/adapters/cli.js.map +0 -1
  546. package/dist/dispatch/adapters/typed.d.ts +0 -362
  547. package/dist/dispatch/adapters/typed.d.ts.map +0 -1
  548. package/dist/dispatch/adapters/typed.js +0 -278
  549. package/dist/dispatch/adapters/typed.js.map +0 -1
  550. package/dist/dispatch/context/session-context.d.ts +0 -108
  551. package/dist/dispatch/context/session-context.d.ts.map +0 -1
  552. package/dist/dispatch/context/session-context.js +0 -111
  553. package/dist/dispatch/context/session-context.js.map +0 -1
  554. package/dist/dispatch/dispatcher.d.ts +0 -37
  555. package/dist/dispatch/dispatcher.d.ts.map +0 -1
  556. package/dist/dispatch/dispatcher.js +0 -172
  557. package/dist/dispatch/dispatcher.js.map +0 -1
  558. package/dist/dispatch/domains/_base.d.ts +0 -104
  559. package/dist/dispatch/domains/_base.d.ts.map +0 -1
  560. package/dist/dispatch/domains/_base.js +0 -147
  561. package/dist/dispatch/domains/_base.js.map +0 -1
  562. package/dist/dispatch/domains/_meta.d.ts +0 -23
  563. package/dist/dispatch/domains/_meta.d.ts.map +0 -1
  564. package/dist/dispatch/domains/_meta.js +0 -25
  565. package/dist/dispatch/domains/_meta.js.map +0 -1
  566. package/dist/dispatch/domains/_routing.d.ts +0 -8
  567. package/dist/dispatch/domains/_routing.d.ts.map +0 -1
  568. package/dist/dispatch/domains/_routing.js +0 -20
  569. package/dist/dispatch/domains/_routing.js.map +0 -1
  570. package/dist/dispatch/domains/admin/smoke-provider.d.ts +0 -54
  571. package/dist/dispatch/domains/admin/smoke-provider.d.ts.map +0 -1
  572. package/dist/dispatch/domains/admin/smoke-provider.js +0 -309
  573. package/dist/dispatch/domains/admin/smoke-provider.js.map +0 -1
  574. package/dist/dispatch/domains/admin.d.ts +0 -51
  575. package/dist/dispatch/domains/admin.d.ts.map +0 -1
  576. package/dist/dispatch/domains/admin.js +0 -1163
  577. package/dist/dispatch/domains/admin.js.map +0 -1
  578. package/dist/dispatch/domains/check/canon.d.ts +0 -65
  579. package/dist/dispatch/domains/check/canon.d.ts.map +0 -1
  580. package/dist/dispatch/domains/check/canon.js +0 -193
  581. package/dist/dispatch/domains/check/canon.js.map +0 -1
  582. package/dist/dispatch/domains/check.d.ts +0 -37
  583. package/dist/dispatch/domains/check.d.ts.map +0 -1
  584. package/dist/dispatch/domains/check.js +0 -562
  585. package/dist/dispatch/domains/check.js.map +0 -1
  586. package/dist/dispatch/domains/conduit.d.ts +0 -61
  587. package/dist/dispatch/domains/conduit.d.ts.map +0 -1
  588. package/dist/dispatch/domains/conduit.js +0 -609
  589. package/dist/dispatch/domains/conduit.js.map +0 -1
  590. package/dist/dispatch/domains/diagnostics.d.ts +0 -25
  591. package/dist/dispatch/domains/diagnostics.d.ts.map +0 -1
  592. package/dist/dispatch/domains/diagnostics.js +0 -82
  593. package/dist/dispatch/domains/diagnostics.js.map +0 -1
  594. package/dist/dispatch/domains/docs.d.ts +0 -63
  595. package/dist/dispatch/domains/docs.d.ts.map +0 -1
  596. package/dist/dispatch/domains/docs.js +0 -539
  597. package/dist/dispatch/domains/docs.js.map +0 -1
  598. package/dist/dispatch/domains/index.d.ts +0 -33
  599. package/dist/dispatch/domains/index.d.ts.map +0 -1
  600. package/dist/dispatch/domains/index.js +0 -58
  601. package/dist/dispatch/domains/index.js.map +0 -1
  602. package/dist/dispatch/domains/intelligence.d.ts +0 -26
  603. package/dist/dispatch/domains/intelligence.d.ts.map +0 -1
  604. package/dist/dispatch/domains/intelligence.js +0 -154
  605. package/dist/dispatch/domains/intelligence.js.map +0 -1
  606. package/dist/dispatch/domains/ivtr.d.ts +0 -182
  607. package/dist/dispatch/domains/ivtr.d.ts.map +0 -1
  608. package/dist/dispatch/domains/ivtr.js +0 -430
  609. package/dist/dispatch/domains/ivtr.js.map +0 -1
  610. package/dist/dispatch/domains/memory.d.ts +0 -22
  611. package/dist/dispatch/domains/memory.d.ts.map +0 -1
  612. package/dist/dispatch/domains/memory.js +0 -1281
  613. package/dist/dispatch/domains/memory.js.map +0 -1
  614. package/dist/dispatch/domains/nexus.d.ts +0 -78
  615. package/dist/dispatch/domains/nexus.d.ts.map +0 -1
  616. package/dist/dispatch/domains/nexus.js +0 -938
  617. package/dist/dispatch/domains/nexus.js.map +0 -1
  618. package/dist/dispatch/domains/orchestrate.d.ts +0 -307
  619. package/dist/dispatch/domains/orchestrate.d.ts.map +0 -1
  620. package/dist/dispatch/domains/orchestrate.js +0 -986
  621. package/dist/dispatch/domains/orchestrate.js.map +0 -1
  622. package/dist/dispatch/domains/pipeline.d.ts +0 -276
  623. package/dist/dispatch/domains/pipeline.d.ts.map +0 -1
  624. package/dist/dispatch/domains/pipeline.js +0 -689
  625. package/dist/dispatch/domains/pipeline.js.map +0 -1
  626. package/dist/dispatch/domains/playbook.d.ts +0 -131
  627. package/dist/dispatch/domains/playbook.d.ts.map +0 -1
  628. package/dist/dispatch/domains/playbook.js +0 -633
  629. package/dist/dispatch/domains/playbook.js.map +0 -1
  630. package/dist/dispatch/domains/release.d.ts +0 -97
  631. package/dist/dispatch/domains/release.d.ts.map +0 -1
  632. package/dist/dispatch/domains/release.js +0 -177
  633. package/dist/dispatch/domains/release.js.map +0 -1
  634. package/dist/dispatch/domains/sentient.d.ts +0 -60
  635. package/dist/dispatch/domains/sentient.d.ts.map +0 -1
  636. package/dist/dispatch/domains/sentient.js +0 -270
  637. package/dist/dispatch/domains/sentient.js.map +0 -1
  638. package/dist/dispatch/domains/session.d.ts +0 -49
  639. package/dist/dispatch/domains/session.d.ts.map +0 -1
  640. package/dist/dispatch/domains/session.js +0 -459
  641. package/dist/dispatch/domains/session.js.map +0 -1
  642. package/dist/dispatch/domains/sticky.d.ts +0 -82
  643. package/dist/dispatch/domains/sticky.d.ts.map +0 -1
  644. package/dist/dispatch/domains/sticky.js +0 -287
  645. package/dist/dispatch/domains/sticky.js.map +0 -1
  646. package/dist/dispatch/domains/tasks.d.ts +0 -58
  647. package/dist/dispatch/domains/tasks.d.ts.map +0 -1
  648. package/dist/dispatch/domains/tasks.js +0 -497
  649. package/dist/dispatch/domains/tasks.js.map +0 -1
  650. package/dist/dispatch/domains/tools.d.ts +0 -37
  651. package/dist/dispatch/domains/tools.d.ts.map +0 -1
  652. package/dist/dispatch/domains/tools.js +0 -481
  653. package/dist/dispatch/domains/tools.js.map +0 -1
  654. package/dist/dispatch/engines/_error.d.ts +0 -114
  655. package/dist/dispatch/engines/_error.d.ts.map +0 -1
  656. package/dist/dispatch/engines/_error.js +0 -290
  657. package/dist/dispatch/engines/_error.js.map +0 -1
  658. package/dist/dispatch/engines/admin-engine.d.ts +0 -386
  659. package/dist/dispatch/engines/admin-engine.d.ts.map +0 -1
  660. package/dist/dispatch/engines/admin-engine.js +0 -270
  661. package/dist/dispatch/engines/admin-engine.js.map +0 -1
  662. package/dist/dispatch/engines/code-engine.d.ts +0 -14
  663. package/dist/dispatch/engines/code-engine.d.ts.map +0 -1
  664. package/dist/dispatch/engines/code-engine.js +0 -14
  665. package/dist/dispatch/engines/code-engine.js.map +0 -1
  666. package/dist/dispatch/engines/codebase-map-engine.d.ts +0 -31
  667. package/dist/dispatch/engines/codebase-map-engine.d.ts.map +0 -1
  668. package/dist/dispatch/engines/codebase-map-engine.js +0 -43
  669. package/dist/dispatch/engines/codebase-map-engine.js.map +0 -1
  670. package/dist/dispatch/engines/config-engine.d.ts +0 -14
  671. package/dist/dispatch/engines/config-engine.d.ts.map +0 -1
  672. package/dist/dispatch/engines/config-engine.js +0 -14
  673. package/dist/dispatch/engines/config-engine.js.map +0 -1
  674. package/dist/dispatch/engines/diagnostics-engine.d.ts +0 -13
  675. package/dist/dispatch/engines/diagnostics-engine.d.ts.map +0 -1
  676. package/dist/dispatch/engines/diagnostics-engine.js +0 -12
  677. package/dist/dispatch/engines/diagnostics-engine.js.map +0 -1
  678. package/dist/dispatch/engines/hooks-engine.d.ts +0 -13
  679. package/dist/dispatch/engines/hooks-engine.d.ts.map +0 -1
  680. package/dist/dispatch/engines/hooks-engine.js +0 -12
  681. package/dist/dispatch/engines/hooks-engine.js.map +0 -1
  682. package/dist/dispatch/engines/init-engine.d.ts +0 -14
  683. package/dist/dispatch/engines/init-engine.d.ts.map +0 -1
  684. package/dist/dispatch/engines/init-engine.js +0 -14
  685. package/dist/dispatch/engines/init-engine.js.map +0 -1
  686. package/dist/dispatch/engines/lifecycle-engine.d.ts +0 -13
  687. package/dist/dispatch/engines/lifecycle-engine.d.ts.map +0 -1
  688. package/dist/dispatch/engines/lifecycle-engine.js +0 -12
  689. package/dist/dispatch/engines/lifecycle-engine.js.map +0 -1
  690. package/dist/dispatch/engines/memory-engine.d.ts +0 -10
  691. package/dist/dispatch/engines/memory-engine.d.ts.map +0 -1
  692. package/dist/dispatch/engines/memory-engine.js +0 -10
  693. package/dist/dispatch/engines/memory-engine.js.map +0 -1
  694. package/dist/dispatch/engines/nexus-engine.d.ts +0 -603
  695. package/dist/dispatch/engines/nexus-engine.d.ts.map +0 -1
  696. package/dist/dispatch/engines/nexus-engine.js +0 -1438
  697. package/dist/dispatch/engines/nexus-engine.js.map +0 -1
  698. package/dist/dispatch/engines/orchestrate-engine.d.ts +0 -252
  699. package/dist/dispatch/engines/orchestrate-engine.d.ts.map +0 -1
  700. package/dist/dispatch/engines/orchestrate-engine.js +0 -1526
  701. package/dist/dispatch/engines/orchestrate-engine.js.map +0 -1
  702. package/dist/dispatch/engines/pipeline-engine.d.ts +0 -13
  703. package/dist/dispatch/engines/pipeline-engine.d.ts.map +0 -1
  704. package/dist/dispatch/engines/pipeline-engine.js +0 -12
  705. package/dist/dispatch/engines/pipeline-engine.js.map +0 -1
  706. package/dist/dispatch/engines/release-engine.d.ts +0 -13
  707. package/dist/dispatch/engines/release-engine.d.ts.map +0 -1
  708. package/dist/dispatch/engines/release-engine.js +0 -13
  709. package/dist/dispatch/engines/release-engine.js.map +0 -1
  710. package/dist/dispatch/engines/session-engine.d.ts +0 -15
  711. package/dist/dispatch/engines/session-engine.d.ts.map +0 -1
  712. package/dist/dispatch/engines/session-engine.js +0 -12
  713. package/dist/dispatch/engines/session-engine.js.map +0 -1
  714. package/dist/dispatch/engines/sticky-engine.d.ts +0 -13
  715. package/dist/dispatch/engines/sticky-engine.d.ts.map +0 -1
  716. package/dist/dispatch/engines/sticky-engine.js +0 -12
  717. package/dist/dispatch/engines/sticky-engine.js.map +0 -1
  718. package/dist/dispatch/engines/system-engine.d.ts +0 -543
  719. package/dist/dispatch/engines/system-engine.d.ts.map +0 -1
  720. package/dist/dispatch/engines/system-engine.js +0 -1278
  721. package/dist/dispatch/engines/system-engine.js.map +0 -1
  722. package/dist/dispatch/engines/task-engine.d.ts +0 -1161
  723. package/dist/dispatch/engines/task-engine.d.ts.map +0 -1
  724. package/dist/dispatch/engines/task-engine.js +0 -1599
  725. package/dist/dispatch/engines/task-engine.js.map +0 -1
  726. package/dist/dispatch/engines/template-parser.d.ts +0 -85
  727. package/dist/dispatch/engines/template-parser.d.ts.map +0 -1
  728. package/dist/dispatch/engines/template-parser.js +0 -114
  729. package/dist/dispatch/engines/template-parser.js.map +0 -1
  730. package/dist/dispatch/engines/tools-engine.d.ts +0 -13
  731. package/dist/dispatch/engines/tools-engine.d.ts.map +0 -1
  732. package/dist/dispatch/engines/tools-engine.js +0 -12
  733. package/dist/dispatch/engines/tools-engine.js.map +0 -1
  734. package/dist/dispatch/engines/validate-engine.d.ts +0 -13
  735. package/dist/dispatch/engines/validate-engine.d.ts.map +0 -1
  736. package/dist/dispatch/engines/validate-engine.js +0 -13
  737. package/dist/dispatch/engines/validate-engine.js.map +0 -1
  738. package/dist/dispatch/index.d.ts +0 -20
  739. package/dist/dispatch/index.d.ts.map +0 -1
  740. package/dist/dispatch/index.js +0 -19
  741. package/dist/dispatch/index.js.map +0 -1
  742. package/dist/dispatch/lib/background-jobs.d.ts +0 -162
  743. package/dist/dispatch/lib/background-jobs.d.ts.map +0 -1
  744. package/dist/dispatch/lib/background-jobs.js +0 -360
  745. package/dist/dispatch/lib/background-jobs.js.map +0 -1
  746. package/dist/dispatch/lib/budget.d.ts +0 -36
  747. package/dist/dispatch/lib/budget.d.ts.map +0 -1
  748. package/dist/dispatch/lib/budget.js +0 -109
  749. package/dist/dispatch/lib/budget.js.map +0 -1
  750. package/dist/dispatch/lib/capability-matrix.d.ts +0 -11
  751. package/dist/dispatch/lib/capability-matrix.d.ts.map +0 -1
  752. package/dist/dispatch/lib/capability-matrix.js +0 -10
  753. package/dist/dispatch/lib/capability-matrix.js.map +0 -1
  754. package/dist/dispatch/lib/config-loader.d.ts +0 -42
  755. package/dist/dispatch/lib/config-loader.d.ts.map +0 -1
  756. package/dist/dispatch/lib/config-loader.js +0 -218
  757. package/dist/dispatch/lib/config-loader.js.map +0 -1
  758. package/dist/dispatch/lib/config.d.ts +0 -11
  759. package/dist/dispatch/lib/config.d.ts.map +0 -1
  760. package/dist/dispatch/lib/config.js +0 -10
  761. package/dist/dispatch/lib/config.js.map +0 -1
  762. package/dist/dispatch/lib/defaults.d.ts +0 -115
  763. package/dist/dispatch/lib/defaults.d.ts.map +0 -1
  764. package/dist/dispatch/lib/defaults.js +0 -61
  765. package/dist/dispatch/lib/defaults.js.map +0 -1
  766. package/dist/dispatch/lib/engine.d.ts +0 -17
  767. package/dist/dispatch/lib/engine.d.ts.map +0 -1
  768. package/dist/dispatch/lib/engine.js +0 -36
  769. package/dist/dispatch/lib/engine.js.map +0 -1
  770. package/dist/dispatch/lib/exit-codes.d.ts +0 -35
  771. package/dist/dispatch/lib/exit-codes.d.ts.map +0 -1
  772. package/dist/dispatch/lib/exit-codes.js +0 -60
  773. package/dist/dispatch/lib/exit-codes.js.map +0 -1
  774. package/dist/dispatch/lib/gateway-meta.d.ts +0 -37
  775. package/dist/dispatch/lib/gateway-meta.d.ts.map +0 -1
  776. package/dist/dispatch/lib/gateway-meta.js +0 -50
  777. package/dist/dispatch/lib/gateway-meta.js.map +0 -1
  778. package/dist/dispatch/lib/job-manager-accessor.d.ts +0 -9
  779. package/dist/dispatch/lib/job-manager-accessor.d.ts.map +0 -1
  780. package/dist/dispatch/lib/job-manager-accessor.js +0 -13
  781. package/dist/dispatch/lib/job-manager-accessor.js.map +0 -1
  782. package/dist/dispatch/lib/meta.d.ts +0 -26
  783. package/dist/dispatch/lib/meta.d.ts.map +0 -1
  784. package/dist/dispatch/lib/meta.js +0 -37
  785. package/dist/dispatch/lib/meta.js.map +0 -1
  786. package/dist/dispatch/lib/param-utils.d.ts +0 -11
  787. package/dist/dispatch/lib/param-utils.d.ts.map +0 -1
  788. package/dist/dispatch/lib/param-utils.js +0 -10
  789. package/dist/dispatch/lib/param-utils.js.map +0 -1
  790. package/dist/dispatch/lib/projections.d.ts +0 -56
  791. package/dist/dispatch/lib/projections.d.ts.map +0 -1
  792. package/dist/dispatch/lib/projections.js +0 -65
  793. package/dist/dispatch/lib/projections.js.map +0 -1
  794. package/dist/dispatch/lib/proto-envelope.d.ts +0 -56
  795. package/dist/dispatch/lib/proto-envelope.d.ts.map +0 -1
  796. package/dist/dispatch/lib/proto-envelope.js +0 -17
  797. package/dist/dispatch/lib/proto-envelope.js.map +0 -1
  798. package/dist/dispatch/lib/schema-utils.d.ts +0 -39
  799. package/dist/dispatch/lib/schema-utils.d.ts.map +0 -1
  800. package/dist/dispatch/lib/schema-utils.js +0 -88
  801. package/dist/dispatch/lib/schema-utils.js.map +0 -1
  802. package/dist/dispatch/lib/security.d.ts +0 -11
  803. package/dist/dispatch/lib/security.d.ts.map +0 -1
  804. package/dist/dispatch/lib/security.js +0 -10
  805. package/dist/dispatch/lib/security.js.map +0 -1
  806. package/dist/dispatch/middleware/audit.d.ts +0 -23
  807. package/dist/dispatch/middleware/audit.d.ts.map +0 -1
  808. package/dist/dispatch/middleware/audit.js +0 -169
  809. package/dist/dispatch/middleware/audit.js.map +0 -1
  810. package/dist/dispatch/middleware/field-filter.d.ts +0 -25
  811. package/dist/dispatch/middleware/field-filter.d.ts.map +0 -1
  812. package/dist/dispatch/middleware/field-filter.js +0 -70
  813. package/dist/dispatch/middleware/field-filter.js.map +0 -1
  814. package/dist/dispatch/middleware/pipeline.d.ts +0 -33
  815. package/dist/dispatch/middleware/pipeline.d.ts.map +0 -1
  816. package/dist/dispatch/middleware/pipeline.js +0 -60
  817. package/dist/dispatch/middleware/pipeline.js.map +0 -1
  818. package/dist/dispatch/middleware/projection.d.ts +0 -35
  819. package/dist/dispatch/middleware/projection.d.ts.map +0 -1
  820. package/dist/dispatch/middleware/projection.js +0 -146
  821. package/dist/dispatch/middleware/projection.js.map +0 -1
  822. package/dist/dispatch/middleware/protocol-enforcement.d.ts +0 -30
  823. package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +0 -1
  824. package/dist/dispatch/middleware/protocol-enforcement.js +0 -56
  825. package/dist/dispatch/middleware/protocol-enforcement.js.map +0 -1
  826. package/dist/dispatch/middleware/rate-limiter.d.ts +0 -72
  827. package/dist/dispatch/middleware/rate-limiter.d.ts.map +0 -1
  828. package/dist/dispatch/middleware/rate-limiter.js +0 -127
  829. package/dist/dispatch/middleware/rate-limiter.js.map +0 -1
  830. package/dist/dispatch/middleware/sanitizer.d.ts +0 -24
  831. package/dist/dispatch/middleware/sanitizer.d.ts.map +0 -1
  832. package/dist/dispatch/middleware/sanitizer.js +0 -56
  833. package/dist/dispatch/middleware/sanitizer.js.map +0 -1
  834. package/dist/dispatch/middleware/session-resolver.d.ts +0 -26
  835. package/dist/dispatch/middleware/session-resolver.d.ts.map +0 -1
  836. package/dist/dispatch/middleware/session-resolver.js +0 -65
  837. package/dist/dispatch/middleware/session-resolver.js.map +0 -1
  838. package/dist/dispatch/middleware/telemetry.d.ts +0 -21
  839. package/dist/dispatch/middleware/telemetry.d.ts.map +0 -1
  840. package/dist/dispatch/middleware/telemetry.js +0 -50
  841. package/dist/dispatch/middleware/telemetry.js.map +0 -1
  842. package/dist/dispatch/middleware/verification-gates.d.ts +0 -22
  843. package/dist/dispatch/middleware/verification-gates.d.ts.map +0 -1
  844. package/dist/dispatch/middleware/verification-gates.js +0 -59
  845. package/dist/dispatch/middleware/verification-gates.js.map +0 -1
  846. package/dist/dispatch/registry.d.ts +0 -91
  847. package/dist/dispatch/registry.d.ts.map +0 -1
  848. package/dist/dispatch/registry.js +0 -6430
  849. package/dist/dispatch/registry.js.map +0 -1
  850. package/dist/dispatch/types.d.ts +0 -150
  851. package/dist/dispatch/types.d.ts.map +0 -1
  852. package/dist/dispatch/types.js +0 -38
  853. package/dist/dispatch/types.js.map +0 -1
  854. package/dist/migrations/2026-04-25-t991-parent-link-repair.d.ts +0 -88
  855. package/dist/migrations/2026-04-25-t991-parent-link-repair.d.ts.map +0 -1
  856. package/dist/migrations/2026-04-25-t991-parent-link-repair.js +0 -76
  857. package/dist/migrations/2026-04-25-t991-parent-link-repair.js.map +0 -1
@@ -1,1278 +0,0 @@
1
- /**
2
- * System Engine
3
- *
4
- * Thin wrapper layer that delegates to core modules.
5
- * All business logic lives in src/core/.
6
- *
7
- * Read-only queries: dash, stats, labels, archive-stats, log, context, sequence,
8
- * metrics, health, diagnostics, help, roadmap, compliance
9
- * Mutate operations: inject.generate, backup, restore, migrate, cleanup, audit,
10
- * sync, safestop, uncancel
11
- *
12
- * @task T4631
13
- * @task T4783
14
- */
15
- import { existsSync, readdirSync, readFileSync } from 'node:fs';
16
- import { basename, join } from 'node:path';
17
- import { analyzeArchive, auditData, cleanupSystem, systemCreateBackup as createBackup, ensureCleoOsHub, generateInjection, getAccessor, getArchiveStats, getCleoCantWorkflowsDir, getCleoConfigDir, getCleoGlobalAgentsDir, getCleoGlobalJustfilePath, getCleoGlobalRecipesDir, getCleoHome, getCleoPiExtensionsDir, getDashboard, getLabels, getMigrationStatus, getProjectStats, getRoadmap, getRuntimeDiagnostics, getSystemDiagnostics, getSystemHealth, getSystemMetrics, listSystemBackups, repairSequence, restoreBackup, safestop, uncancelTask, } from '@cleocode/core/internal';
18
- import { CLEO_DIR_NAME, COMPLIANCE_JSONL, METRICS_SUBDIR, TASKS_DB_FILENAME, } from '../../cli/paths.js';
19
- import { cleoErrorToEngineError, engineError } from './_error.js';
20
- // ===== Help topics (static data, stays in engine) =====
21
- const HELP_TOPICS = {
22
- session: {
23
- topic: 'session',
24
- content: [
25
- 'Session Management',
26
- '',
27
- ' cleosession list - List all sessions',
28
- ' cleosession start --scope epic:T001 - Start session',
29
- ' cleosession end --note "Progress" - End session',
30
- ' cleosession resume <id> - Resume session',
31
- ].join('\n'),
32
- relatedCommands: ['cleo session list', 'cleo session start', 'cleo session end'],
33
- },
34
- tasks: {
35
- topic: 'tasks',
36
- content: [
37
- 'Task Operations',
38
- '',
39
- ' cleoadd "Title" --desc "Description" - Create task',
40
- ' cleoupdate T1234 --status active - Update task',
41
- ' cleocomplete T1234 - Complete task',
42
- ' cleofind "query" - Search tasks',
43
- ' cleoshow T1234 - Show task details',
44
- ].join('\n'),
45
- relatedCommands: ['cleo add', 'cleo update', 'cleo complete', 'cleo find', 'cleo show'],
46
- },
47
- focus: {
48
- topic: 'focus',
49
- content: [
50
- 'Task Work Management',
51
- '',
52
- ' cleostart T1234 - Start working on task',
53
- ' cleocurrent - Show current task',
54
- ' cleostop - Stop working on current task',
55
- ].join('\n'),
56
- relatedCommands: ['cleo start', 'cleo current', 'cleo stop'],
57
- },
58
- labels: {
59
- topic: 'labels',
60
- content: [
61
- 'Label Operations',
62
- '',
63
- ' cleolabels - List all labels',
64
- ' cleolabels show <name> - Show tasks with label',
65
- ].join('\n'),
66
- relatedCommands: ['cleo labels'],
67
- },
68
- compliance: {
69
- topic: 'compliance',
70
- content: [
71
- 'Compliance Monitoring',
72
- '',
73
- ' cleocompliance summary - Compliance overview',
74
- ' cleocompliance violations - List violations',
75
- ' cleocompliance trend - Compliance trend',
76
- ].join('\n'),
77
- relatedCommands: ['cleo compliance summary', 'cleo compliance violations'],
78
- },
79
- };
80
- // ===== Dashboard =====
81
- /**
82
- * Project dashboard: task counts by status, active session info,
83
- * current focus, recent completions.
84
- *
85
- * @remarks
86
- * This is the primary overview endpoint for the CLEO CLI `dash` command.
87
- * It aggregates task counts, current session/focus state, high-priority tasks,
88
- * blocked tasks, and recent completions into a single response.
89
- *
90
- * @param projectRoot - Absolute path to the project root
91
- * @param params - Optional parameters to control blocked tasks display limit
92
- * @returns EngineResult with comprehensive dashboard data
93
- *
94
- * @example
95
- * ```typescript
96
- * const result = await systemDash('/project', { blockedTasksLimit: 5 });
97
- * ```
98
- */
99
- export async function systemDash(projectRoot, params) {
100
- try {
101
- const accessor = await getAccessor(projectRoot);
102
- const result = await getDashboard({ cwd: projectRoot, blockedTasksLimit: params?.blockedTasksLimit }, accessor);
103
- // Add missing fields that core doesn't produce
104
- const data = result;
105
- const summary = data.summary;
106
- return {
107
- success: true,
108
- data: {
109
- project: data.project,
110
- currentPhase: data.currentPhase,
111
- summary: {
112
- pending: summary.pending,
113
- active: summary.active,
114
- blocked: summary.blocked,
115
- done: summary.done,
116
- cancelled: summary.cancelled ?? 0,
117
- total: summary.total,
118
- archived: summary.archived ?? 0,
119
- grandTotal: summary.grandTotal ?? summary.total,
120
- },
121
- taskWork: (data.focus ?? data.taskWork),
122
- activeSession: data.activeSession ?? null,
123
- highPriority: data.highPriority,
124
- blockedTasks: data.blockedTasks,
125
- recentCompletions: (data.recentCompletions ?? []),
126
- topLabels: data.topLabels,
127
- },
128
- };
129
- }
130
- catch (err) {
131
- return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'System not initialized');
132
- }
133
- }
134
- // ===== Stats =====
135
- /**
136
- * Detailed statistics: tasks by status/priority/type/phase,
137
- * completion rate, average cycle time.
138
- */
139
- export async function systemStats(projectRoot, params) {
140
- try {
141
- const accessor = await getAccessor(projectRoot);
142
- const result = await getProjectStats({ period: String(params?.period ?? 30), cwd: projectRoot }, accessor);
143
- // Core stats lacks byPriority, byType, byPhase, cycleTimes — fill from accessor
144
- const queryResult = await accessor.queryTasks({});
145
- const tasks = queryResult?.tasks ?? [];
146
- // Distribution breakdowns: active tasks only (exclude cancelled — not actionable work)
147
- const activeTasks = tasks.filter((t) => t.status !== 'cancelled');
148
- const byPriority = {};
149
- for (const t of activeTasks) {
150
- byPriority[t.priority] = (byPriority[t.priority] ?? 0) + 1;
151
- }
152
- const byType = {};
153
- for (const t of activeTasks) {
154
- const type = t.type || 'task';
155
- byType[type] = (byType[type] ?? 0) + 1;
156
- }
157
- // byPhase tracks RCASD-IVTR+C pipeline stages (pipelineStage), not project phases (phase).
158
- // t.phase is a legacy project-phase field (e.g. "Phase 1"); t.pipelineStage is RCASD.
159
- const byPhase = {};
160
- for (const t of activeTasks) {
161
- const phase = t.pipelineStage || 'unassigned';
162
- byPhase[phase] = (byPhase[phase] ?? 0) + 1;
163
- }
164
- // Cycle times
165
- const completedTasks = tasks.filter((t) => t.status === 'done' && t.completedAt && t.createdAt);
166
- let totalCycleDays = 0;
167
- let samples = 0;
168
- for (const t of completedTasks) {
169
- const created = new Date(t.createdAt).getTime();
170
- const completed = new Date(t.completedAt).getTime();
171
- if (completed > created) {
172
- totalCycleDays += (completed - created) / 86400000;
173
- samples++;
174
- }
175
- }
176
- const averageDays = samples > 0 ? Math.round((totalCycleDays / samples) * 100) / 100 : null;
177
- const coreData = result;
178
- const currentState = coreData.currentState;
179
- const completionMetrics = coreData.completionMetrics;
180
- const activityMetrics = coreData.activityMetrics;
181
- const allTime = coreData.allTime;
182
- return {
183
- success: true,
184
- data: {
185
- currentState: {
186
- pending: currentState.pending,
187
- active: currentState.active,
188
- done: currentState.done,
189
- blocked: currentState.blocked,
190
- cancelled: tasks.filter((t) => t.status === 'cancelled').length,
191
- totalActive: currentState.totalActive,
192
- archived: currentState.archived ?? 0,
193
- grandTotal: currentState.grandTotal ?? currentState.totalActive,
194
- },
195
- byPriority,
196
- byType,
197
- byPhase,
198
- completionMetrics: completionMetrics,
199
- activityMetrics: activityMetrics,
200
- allTime: allTime,
201
- cycleTimes: { averageDays, samples },
202
- },
203
- };
204
- }
205
- catch (err) {
206
- return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to get stats');
207
- }
208
- }
209
- // ===== Labels =====
210
- /**
211
- * List all unique labels across tasks with counts and task IDs per label.
212
- */
213
- export async function systemLabels(projectRoot) {
214
- try {
215
- const accessor = await getAccessor(projectRoot);
216
- const result = await getLabels(projectRoot, accessor);
217
- return { success: true, data: result };
218
- }
219
- catch (err) {
220
- return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to get labels');
221
- }
222
- }
223
- // ===== Archive Stats =====
224
- /**
225
- * Archive metrics: total archived, by reason, average cycle time, archive rate.
226
- * When a report type is specified, delegates to analyzeArchive for detailed analytics.
227
- */
228
- export async function systemArchiveStats(projectRoot, params) {
229
- try {
230
- const accessor = await getAccessor(projectRoot);
231
- // If a non-default report type is requested, use the full analytics engine
232
- if (params?.report && params.report !== 'summary') {
233
- const result = await analyzeArchive({
234
- report: params.report,
235
- since: params.since,
236
- until: params.until,
237
- cwd: projectRoot,
238
- }, accessor);
239
- return { success: true, data: result };
240
- }
241
- const result = await getArchiveStats({ period: params?.period, cwd: projectRoot }, accessor);
242
- return { success: true, data: result };
243
- }
244
- catch (err) {
245
- return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to get archive stats');
246
- }
247
- }
248
- // ===== Log =====
249
- /**
250
- * Query audit log with optional filters.
251
- * Reads from SQLite audit_log table.
252
- *
253
- * @task T4837
254
- */
255
- export async function systemLog(projectRoot, filters) {
256
- try {
257
- // Canonical path: SQLite audit_log table.
258
- const entries = await queryAuditLogSqlite(projectRoot, filters);
259
- return { success: true, data: entries };
260
- }
261
- catch (err) {
262
- return cleoErrorToEngineError(err, 'E_FILE_ERROR', 'Failed to read audit log');
263
- }
264
- }
265
- /**
266
- * Query audit_log from SQLite.
267
- * Includes dispatch-level fields (domain, requestId, durationMs, success,
268
- * source, gateway, errorMessage) when present (T4844).
269
- *
270
- * @task T4837
271
- * @task T4844
272
- */
273
- async function queryAuditLogSqlite(projectRoot, filters) {
274
- try {
275
- const { join } = await import('node:path');
276
- const { existsSync } = await import('node:fs');
277
- const dbPath = join(projectRoot, CLEO_DIR_NAME, TASKS_DB_FILENAME);
278
- if (!existsSync(dbPath)) {
279
- const offset = filters?.offset ?? 0;
280
- const limit = filters?.limit ?? 20;
281
- return {
282
- entries: [],
283
- pagination: { total: 0, offset, limit, hasMore: false },
284
- };
285
- }
286
- const { getDb } = await import('@cleocode/core/internal');
287
- const { auditLog } = await import('@cleocode/core/internal');
288
- const { sql } = await import('drizzle-orm');
289
- const db = await getDb(projectRoot);
290
- // Check if audit_log table exists and has data
291
- try {
292
- // Build dynamic WHERE conditions
293
- const conditions = [];
294
- if (filters?.operation) {
295
- // Match against both legacy 'action' column and new 'operation' column
296
- conditions.push(sql `(${auditLog.action} = ${filters.operation} OR ${auditLog.operation} = ${filters.operation})`);
297
- }
298
- if (filters?.taskId) {
299
- conditions.push(sql `${auditLog.taskId} = ${filters.taskId}`);
300
- }
301
- if (filters?.since) {
302
- conditions.push(sql `${auditLog.timestamp} >= ${filters.since}`);
303
- }
304
- if (filters?.until) {
305
- conditions.push(sql `${auditLog.timestamp} <= ${filters.until}`);
306
- }
307
- const whereClause = conditions.length > 0 ? sql.join(conditions, sql ` AND `) : sql `1=1`;
308
- // Count total matching entries
309
- const countResult = await db.all(sql `SELECT count(*) as cnt FROM ${auditLog} WHERE ${whereClause}`);
310
- const total = countResult[0]?.cnt ?? 0;
311
- if (total === 0) {
312
- return {
313
- entries: [],
314
- pagination: {
315
- total: 0,
316
- offset: filters?.offset ?? 0,
317
- limit: filters?.limit ?? 20,
318
- hasMore: false,
319
- },
320
- };
321
- }
322
- const offset = filters?.offset ?? 0;
323
- const limit = filters?.limit ?? 20;
324
- // Fetch paginated results (includes dispatch-level columns)
325
- const rows = await db.all(sql `SELECT * FROM ${auditLog}
326
- WHERE ${whereClause}
327
- ORDER BY ${auditLog.timestamp} DESC
328
- LIMIT ${limit} OFFSET ${offset}`);
329
- const entries = rows.map((row) => ({
330
- operation: row.operation ?? row.action,
331
- taskId: row.task_id,
332
- timestamp: row.timestamp,
333
- actor: row.actor,
334
- details: row.details_json ? JSON.parse(row.details_json) : {},
335
- before: row.before_json ? JSON.parse(row.before_json) : undefined,
336
- after: row.after_json ? JSON.parse(row.after_json) : undefined,
337
- // Dispatch-level fields (may be null for legacy task-only entries)
338
- ...(row.domain != null && {
339
- domain: row.domain,
340
- sessionId: row.session_id,
341
- requestId: row.request_id,
342
- durationMs: row.duration_ms,
343
- success: row.success === 1,
344
- source: row.source,
345
- gateway: row.gateway,
346
- error: row.error_message,
347
- }),
348
- }));
349
- return {
350
- entries,
351
- pagination: { total, offset, limit, hasMore: offset + limit < total },
352
- };
353
- }
354
- catch {
355
- const offset = filters?.offset ?? 0;
356
- const limit = filters?.limit ?? 20;
357
- return {
358
- entries: [],
359
- pagination: { total: 0, offset, limit, hasMore: false },
360
- };
361
- }
362
- }
363
- catch {
364
- const offset = filters?.offset ?? 0;
365
- const limit = filters?.limit ?? 20;
366
- return {
367
- entries: [],
368
- pagination: { total: 0, offset, limit, hasMore: false },
369
- };
370
- }
371
- }
372
- // ===== Context =====
373
- /**
374
- * Context window tracking: estimate token usage from current session/state.
375
- */
376
- export function systemContext(projectRoot, params) {
377
- try {
378
- const cleoDir = join(projectRoot, CLEO_DIR_NAME);
379
- // Resolve state file
380
- let stateFile;
381
- if (params?.session) {
382
- const sessionFile = join(cleoDir, 'context-states', `context-state-${params.session}.json`);
383
- stateFile = existsSync(sessionFile) ? sessionFile : join(cleoDir, '.context-state.json');
384
- }
385
- else {
386
- const currentSessionPath = join(cleoDir, '.current-session');
387
- if (existsSync(currentSessionPath)) {
388
- const currentSession = readFileSync(currentSessionPath, 'utf-8').trim();
389
- if (currentSession) {
390
- const sessionFile = join(cleoDir, 'context-states', `context-state-${currentSession}.json`);
391
- stateFile = existsSync(sessionFile) ? sessionFile : join(cleoDir, '.context-state.json');
392
- }
393
- else {
394
- stateFile = join(cleoDir, '.context-state.json');
395
- }
396
- }
397
- else {
398
- stateFile = join(cleoDir, '.context-state.json');
399
- }
400
- }
401
- // Collect session files
402
- const sessions = [];
403
- const statesDir = join(cleoDir, 'context-states');
404
- if (existsSync(statesDir)) {
405
- for (const file of readdirSync(statesDir)) {
406
- if (file.startsWith('context-state-') && file.endsWith('.json')) {
407
- try {
408
- const state = JSON.parse(readFileSync(join(statesDir, file), 'utf-8'));
409
- sessions.push({
410
- file: basename(file),
411
- sessionId: state.sessionId ?? null,
412
- percentage: state.contextWindow?.percentage ?? 0,
413
- status: state.status ?? 'unknown',
414
- timestamp: state.timestamp,
415
- });
416
- }
417
- catch {
418
- // skip invalid files
419
- }
420
- }
421
- }
422
- }
423
- const singletonFile = join(cleoDir, '.context-state.json');
424
- if (existsSync(singletonFile)) {
425
- try {
426
- const state = JSON.parse(readFileSync(singletonFile, 'utf-8'));
427
- sessions.push({
428
- file: '.context-state.json',
429
- sessionId: state.sessionId ?? 'global',
430
- percentage: state.contextWindow?.percentage ?? 0,
431
- status: state.status ?? 'unknown',
432
- timestamp: state.timestamp,
433
- });
434
- }
435
- catch {
436
- // skip
437
- }
438
- }
439
- if (!existsSync(stateFile)) {
440
- return {
441
- success: true,
442
- data: {
443
- available: false,
444
- status: 'unavailable',
445
- percentage: 0,
446
- currentTokens: 0,
447
- maxTokens: 0,
448
- timestamp: null,
449
- stale: true,
450
- sessions,
451
- },
452
- };
453
- }
454
- try {
455
- const state = JSON.parse(readFileSync(stateFile, 'utf-8'));
456
- const timestamp = state.timestamp;
457
- const staleMs = state.staleAfterMs ?? 5000;
458
- const percentage = state.contextWindow?.percentage ?? 0;
459
- const current = state.contextWindow?.currentTokens ?? 0;
460
- const max = state.contextWindow?.maxTokens ?? 0;
461
- let status = state.status ?? 'unknown';
462
- const fileTime = new Date(timestamp).getTime();
463
- if (Date.now() - fileTime > staleMs) {
464
- status = 'stale';
465
- }
466
- return {
467
- success: true,
468
- data: {
469
- available: true,
470
- status,
471
- percentage,
472
- currentTokens: current,
473
- maxTokens: max,
474
- timestamp,
475
- stale: status === 'stale',
476
- sessions,
477
- },
478
- };
479
- }
480
- catch {
481
- return {
482
- success: true,
483
- data: {
484
- available: false,
485
- status: 'error',
486
- percentage: 0,
487
- currentTokens: 0,
488
- maxTokens: 0,
489
- timestamp: null,
490
- stale: true,
491
- sessions,
492
- },
493
- };
494
- }
495
- }
496
- catch (err) {
497
- return cleoErrorToEngineError(err, 'E_GENERAL', 'System operation failed');
498
- }
499
- }
500
- // ===== Sequence =====
501
- /**
502
- * Read task ID sequence state from canonical SQLite metadata.
503
- * Supports 'show' and 'check' actions.
504
- * @task T4815
505
- */
506
- export async function systemSequence(projectRoot, params) {
507
- const { showSequence, checkSequence } = await import('@cleocode/core/internal');
508
- try {
509
- const action = params?.action ?? 'show';
510
- if (action === 'check') {
511
- const check = await checkSequence(projectRoot);
512
- return { success: true, data: check };
513
- }
514
- const seq = await showSequence(projectRoot);
515
- return {
516
- success: true,
517
- data: {
518
- counter: Number(seq.counter ?? 0),
519
- lastId: String(seq.lastId ?? ''),
520
- checksum: String(seq.checksum ?? ''),
521
- nextId: String(seq.nextId ?? ''),
522
- },
523
- };
524
- }
525
- catch (err) {
526
- return cleoErrorToEngineError(err, 'E_NOT_FOUND', 'Sequence not found');
527
- }
528
- }
529
- // ===== Inject Generate (MVI) =====
530
- /**
531
- * Generate Minimum Viable Injection (MVI).
532
- */
533
- export async function systemInjectGenerate(projectRoot) {
534
- try {
535
- const root = projectRoot || process.cwd();
536
- const accessor = await getAccessor(root);
537
- const result = await generateInjection(root, accessor);
538
- return { success: true, data: result };
539
- }
540
- catch (err) {
541
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to generate injection');
542
- }
543
- }
544
- // ===== Metrics =====
545
- /**
546
- * System metrics: token usage, compliance summary, session counts.
547
- * @task T4631
548
- */
549
- export async function systemMetrics(projectRoot, params) {
550
- try {
551
- const accessor = await getAccessor(projectRoot);
552
- const result = await getSystemMetrics(projectRoot, params, accessor);
553
- return { success: true, data: result };
554
- }
555
- catch (err) {
556
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to get metrics');
557
- }
558
- }
559
- // ===== Health =====
560
- /**
561
- * System health check: verify core data files exist and are valid.
562
- * @task T4631
563
- */
564
- export async function systemHealth(projectRoot, params) {
565
- try {
566
- const result = await getSystemHealth(projectRoot, params);
567
- return { success: true, data: result };
568
- }
569
- catch (err) {
570
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to get health');
571
- }
572
- }
573
- // ===== Diagnostics =====
574
- /**
575
- * System diagnostics: extended health checks with fix suggestions.
576
- * @task T4631
577
- */
578
- export async function systemDiagnostics(projectRoot, params) {
579
- try {
580
- const result = await getSystemDiagnostics(projectRoot, params);
581
- return { success: true, data: result };
582
- }
583
- catch (err) {
584
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to get diagnostics');
585
- }
586
- }
587
- // ===== Help =====
588
- /**
589
- * Return help text for the system.
590
- * @task T4631
591
- */
592
- export function systemHelp(_projectRoot, params) {
593
- const topic = params?.topic;
594
- if (topic) {
595
- const topicHelp = HELP_TOPICS[topic];
596
- if (topicHelp) {
597
- return { success: true, data: topicHelp };
598
- }
599
- return engineError('E_NOT_FOUND', `Unknown help topic: ${topic}. Available topics: ${Object.keys(HELP_TOPICS).join(', ')}`);
600
- }
601
- return {
602
- success: true,
603
- data: {
604
- content: [
605
- 'CLEO Task Management System',
606
- '',
607
- 'Essential Commands:',
608
- ' cleofind "query" - Fuzzy search tasks',
609
- ' cleoshow T1234 - Full task details',
610
- ' cleoadd "Task" - Create task',
611
- ' cleodone <id> - Complete task',
612
- ' cleostart <id> - Start working on task',
613
- ' cleodash - Project overview',
614
- ' cleosession list - List sessions',
615
- '',
616
- 'Help Topics: session, tasks, focus, labels, compliance',
617
- ].join('\n'),
618
- relatedCommands: ['cleo find', 'cleo show', 'cleo add', 'cleo done', 'cleo dash'],
619
- },
620
- };
621
- }
622
- // ===== Roadmap =====
623
- /**
624
- * Generate roadmap from pending epics and optional CHANGELOG history.
625
- * @task T4631
626
- */
627
- export async function systemRoadmap(projectRoot, params) {
628
- try {
629
- const accessor = await getAccessor(projectRoot);
630
- const result = await getRoadmap({
631
- includeHistory: params?.includeHistory,
632
- upcomingOnly: params?.upcomingOnly,
633
- cwd: projectRoot,
634
- }, accessor);
635
- return { success: true, data: result };
636
- }
637
- catch (err) {
638
- return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'System not initialized');
639
- }
640
- }
641
- // ===== Compliance =====
642
- /**
643
- * System compliance report from COMPLIANCE.jsonl.
644
- * @task T4631
645
- */
646
- export function systemCompliance(projectRoot, params) {
647
- try {
648
- if (params?.subcommand === 'trend') {
649
- const compliancePath = join(projectRoot, CLEO_DIR_NAME, METRICS_SUBDIR, COMPLIANCE_JSONL);
650
- let entries = [];
651
- if (existsSync(compliancePath)) {
652
- const content = readFileSync(compliancePath, 'utf-8').trim();
653
- if (content) {
654
- entries = content
655
- .split('\n')
656
- .filter((l) => l.trim())
657
- .map((l) => JSON.parse(l));
658
- }
659
- }
660
- if (params.epic) {
661
- entries = entries.filter((e) => {
662
- const ctx = (e._context ?? {});
663
- return ctx.epic_id === params.epic || ctx.task_id === params.epic;
664
- });
665
- }
666
- if (params.days) {
667
- const cutoff = new Date(Date.now() - params.days * 86400000).toISOString();
668
- entries = entries.filter((e) => e.timestamp >= cutoff);
669
- }
670
- const totalEntries = entries.length;
671
- const compliance = entries.map((e) => (e.compliance ?? {}));
672
- const avgPassRate = totalEntries > 0
673
- ? Math.round((compliance.reduce((sum, c) => sum + (c.compliance_pass_rate ?? 0), 0) /
674
- totalEntries) *
675
- 1000) / 1000
676
- : 0;
677
- const avgAdherence = totalEntries > 0
678
- ? Math.round((compliance.reduce((sum, c) => sum + (c.rule_adherence_score ?? 0), 0) /
679
- totalEntries) *
680
- 1000) / 1000
681
- : 0;
682
- const totalViolations = compliance.reduce((sum, c) => sum + (c.violation_count ?? 0), 0);
683
- const byDate = {};
684
- for (const e of entries) {
685
- const date = e.timestamp.split('T')[0];
686
- if (!byDate[date])
687
- byDate[date] = [];
688
- byDate[date].push(e);
689
- }
690
- const dataPoints = Object.entries(byDate)
691
- .sort(([a], [b]) => a.localeCompare(b))
692
- .map(([date, dayEntries]) => {
693
- const dayCompliance = dayEntries.map((de) => (de.compliance ?? {}));
694
- return {
695
- date,
696
- entries: dayEntries.length,
697
- avgPassRate: dayCompliance.reduce((s, c) => s + (c.compliance_pass_rate ?? 0), 0) /
698
- dayEntries.length,
699
- violations: dayCompliance.reduce((s, c) => s + (c.violation_count ?? 0), 0),
700
- };
701
- });
702
- let trend;
703
- if (dataPoints.length >= 2) {
704
- const first = dataPoints[0].avgPassRate;
705
- const last = dataPoints[dataPoints.length - 1].avgPassRate;
706
- trend = last > first ? 'improving' : last < first ? 'declining' : 'stable';
707
- }
708
- else {
709
- trend = 'insufficient_data';
710
- }
711
- return {
712
- success: true,
713
- data: {
714
- totalEntries,
715
- averagePassRate: avgPassRate,
716
- averageAdherence: avgAdherence,
717
- totalViolations,
718
- trend,
719
- dataPoints,
720
- },
721
- };
722
- }
723
- // Default: summary (possibly filtered by epic/days)
724
- const compliancePath = join(projectRoot, '.cleo', 'metrics', 'COMPLIANCE.jsonl');
725
- let entries = [];
726
- if (existsSync(compliancePath)) {
727
- const content = readFileSync(compliancePath, 'utf-8').trim();
728
- if (content) {
729
- entries = content
730
- .split('\n')
731
- .filter((l) => l.trim())
732
- .map((l) => JSON.parse(l));
733
- }
734
- }
735
- if (params?.epic) {
736
- entries = entries.filter((e) => {
737
- const ctx = (e._context ?? {});
738
- return ctx.epic_id === params.epic || ctx.task_id === params.epic;
739
- });
740
- }
741
- if (params?.days) {
742
- const cutoff = new Date(Date.now() - params.days * 86400000).toISOString();
743
- entries = entries.filter((e) => e.timestamp >= cutoff);
744
- }
745
- const totalEntries = entries.length;
746
- const compliance = entries.map((e) => (e.compliance ?? {}));
747
- const avgPassRate = totalEntries > 0
748
- ? Math.round((compliance.reduce((sum, c) => sum + (c.compliance_pass_rate ?? 0), 0) /
749
- totalEntries) *
750
- 1000) / 1000
751
- : 0;
752
- const avgAdherence = totalEntries > 0
753
- ? Math.round((compliance.reduce((sum, c) => sum + (c.rule_adherence_score ?? 0), 0) /
754
- totalEntries) *
755
- 1000) / 1000
756
- : 0;
757
- const totalViolations = compliance.reduce((sum, c) => sum + (c.violation_count ?? 0), 0);
758
- return {
759
- success: true,
760
- data: {
761
- totalEntries,
762
- averagePassRate: avgPassRate,
763
- averageAdherence: avgAdherence,
764
- totalViolations,
765
- },
766
- };
767
- }
768
- catch (err) {
769
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to get roadmap');
770
- }
771
- }
772
- // ===== Backup =====
773
- /**
774
- * Create a backup of CLEO data files.
775
- *
776
- * Async because `createBackup` (T5158) now opens tasks.db + brain.db via
777
- * their drizzle accessors before snapshotting so both databases are
778
- * captured even when the current CLI command path hasn't already opened
779
- * them (e.g. `cleo backup add` in a fresh process).
780
- *
781
- * @task T4631
782
- * @task T5158
783
- */
784
- export async function systemBackup(projectRoot, params) {
785
- try {
786
- const result = await createBackup(projectRoot, params);
787
- return { success: true, data: result };
788
- }
789
- catch (err) {
790
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to create backup');
791
- }
792
- }
793
- /**
794
- * List available system backups (read-only).
795
- * @task T4783
796
- */
797
- export function systemListBackups(projectRoot) {
798
- try {
799
- const result = listSystemBackups(projectRoot);
800
- return { success: true, data: result };
801
- }
802
- catch (err) {
803
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to list backups');
804
- }
805
- }
806
- // ===== Restore =====
807
- /**
808
- * Restore from a backup.
809
- * @task T4631
810
- */
811
- export function systemRestore(projectRoot, params) {
812
- try {
813
- const result = restoreBackup(projectRoot, params);
814
- return { success: true, data: result };
815
- }
816
- catch (err) {
817
- return cleoErrorToEngineError(err, 'E_RESTORE_FAILED', 'Failed to restore');
818
- }
819
- }
820
- /**
821
- * Restore an individual file from backup.
822
- * @task T5329
823
- */
824
- export async function backupRestore(projectRoot, fileName, options) {
825
- try {
826
- const { getBackupDir, getTaskPath, getConfigPath } = await import('@cleocode/core/internal');
827
- const { restoreFromBackup, listBackups } = await import('@cleocode/core/internal');
828
- const backupDir = getBackupDir(projectRoot);
829
- const targetPathMap = {
830
- 'tasks.db': getTaskPath,
831
- 'config.json': getConfigPath,
832
- };
833
- const pathGetter = targetPathMap[fileName];
834
- if (!pathGetter) {
835
- return engineError('E_INVALID_INPUT', `Unknown file: ${fileName}. Valid files: tasks.db, config.json`);
836
- }
837
- const targetPath = pathGetter();
838
- const backups = await listBackups(fileName, backupDir);
839
- if (backups.length === 0) {
840
- return engineError('E_NOT_FOUND', `No backups found for ${fileName}`);
841
- }
842
- if (options?.dryRun) {
843
- return {
844
- success: true,
845
- data: {
846
- restored: false,
847
- file: fileName,
848
- from: backups[0],
849
- targetPath,
850
- dryRun: true,
851
- },
852
- };
853
- }
854
- const restoredFrom = await restoreFromBackup(fileName, backupDir, targetPath);
855
- return {
856
- success: true,
857
- data: {
858
- restored: true,
859
- file: fileName,
860
- from: restoredFrom,
861
- targetPath,
862
- },
863
- };
864
- }
865
- catch (err) {
866
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Backup restore failed');
867
- }
868
- }
869
- // ===== Migrate =====
870
- /**
871
- * Check/run schema migrations.
872
- * @task T4631
873
- */
874
- export async function systemMigrate(projectRoot, params) {
875
- try {
876
- const result = await getMigrationStatus(projectRoot, params);
877
- return { success: true, data: result };
878
- }
879
- catch (err) {
880
- return cleoErrorToEngineError(err, 'E_MIGRATE_FAILED', 'Failed to migrate');
881
- }
882
- }
883
- // ===== Cleanup =====
884
- /**
885
- * Cleanup stale data (sessions, backups, logs).
886
- * @task T4631
887
- */
888
- export async function systemCleanup(projectRoot, params) {
889
- try {
890
- const result = await cleanupSystem(projectRoot, params);
891
- return { success: true, data: result };
892
- }
893
- catch (err) {
894
- return cleoErrorToEngineError(err, 'E_CLEANUP_FAILED', 'Failed to cleanup');
895
- }
896
- }
897
- // ===== Audit =====
898
- /**
899
- * Audit data integrity.
900
- * @task T4631
901
- */
902
- export async function systemAudit(projectRoot, params) {
903
- try {
904
- const result = await auditData(projectRoot, params);
905
- return { success: true, data: result };
906
- }
907
- catch (err) {
908
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to audit');
909
- }
910
- }
911
- /**
912
- * Sync check (no external sync targets in native mode).
913
- * @task T4631
914
- */
915
- export function systemSync(_projectRoot, params) {
916
- return {
917
- success: true,
918
- data: {
919
- direction: params?.direction ?? 'up',
920
- synced: 0,
921
- conflicts: 0,
922
- message: 'Sync is a no-op in native mode (no external sync targets configured)',
923
- },
924
- };
925
- }
926
- // ===== Safestop =====
927
- /**
928
- * Safe stop: signal clean shutdown for agents.
929
- * @task T4631
930
- */
931
- export async function systemSafestop(projectRoot, params) {
932
- try {
933
- const result = await safestop(projectRoot, params);
934
- return { success: true, data: result };
935
- }
936
- catch (err) {
937
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Sync failed');
938
- }
939
- }
940
- // ===== Uncancel =====
941
- /**
942
- * Uncancel a cancelled task (restore to pending).
943
- * @task T4631
944
- */
945
- export async function systemUncancel(projectRoot, params) {
946
- try {
947
- const result = await uncancelTask(projectRoot, params);
948
- return { success: true, data: result };
949
- }
950
- catch (err) {
951
- return cleoErrorToEngineError(err, 'E_UNCANCEL_FAILED', 'Failed to uncancel');
952
- }
953
- }
954
- // ===== Doctor Report =====
955
- /**
956
- * Run comprehensive doctor diagnostics.
957
- * @task T4795
958
- */
959
- export async function systemDoctor(projectRoot) {
960
- const { coreDoctorReport } = await import('@cleocode/core/internal');
961
- try {
962
- const result = await coreDoctorReport(projectRoot);
963
- return { success: true, data: result };
964
- }
965
- catch (err) {
966
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Doctor check failed');
967
- }
968
- }
969
- // ===== Doctor Fix =====
970
- /**
971
- * Run auto-fix for failed doctor checks.
972
- * @task T4795
973
- */
974
- export async function systemFix(projectRoot) {
975
- const { runDoctorFixes } = await import('@cleocode/core/internal');
976
- try {
977
- const result = await runDoctorFixes(projectRoot);
978
- return { success: true, data: result };
979
- }
980
- catch (err) {
981
- return cleoErrorToEngineError(err, 'E_GENERAL', 'Doctor fix failed');
982
- }
983
- }
984
- /**
985
- * Runtime/channel diagnostics for CLI installation mode checks.
986
- * @task T4815
987
- */
988
- export async function systemRuntime(_projectRoot, params) {
989
- try {
990
- const data = await getRuntimeDiagnostics({ detailed: params?.detailed ?? false });
991
- return { success: true, data };
992
- }
993
- catch (err) {
994
- return cleoErrorToEngineError(err, 'E_RUNTIME_ERROR', 'Runtime check failed');
995
- }
996
- }
997
- /**
998
- * Report all resolved CleoOS paths (project + global hub).
999
- *
1000
- * Backs the `cleo admin paths` CLI command. Read-only: reports current state
1001
- * without mutating the filesystem. Use `systemScaffoldHub()` to create
1002
- * missing hub directories and seed the starter justfile.
1003
- *
1004
- * @task Phase 1 — XDG Foundation + Justfile Hub Skeleton
1005
- */
1006
- export async function systemPaths(projectRoot) {
1007
- try {
1008
- const cleoHome = getCleoHome();
1009
- const configDir = getCleoConfigDir();
1010
- const globalRecipes = getCleoGlobalRecipesDir();
1011
- const globalJustfile = getCleoGlobalJustfilePath();
1012
- const piExtensions = getCleoPiExtensionsDir();
1013
- const cantWorkflows = getCleoCantWorkflowsDir();
1014
- const globalAgents = getCleoGlobalAgentsDir();
1015
- return {
1016
- success: true,
1017
- data: {
1018
- projectCleoDir: join(projectRoot, CLEO_DIR_NAME),
1019
- cleoHome,
1020
- configDir,
1021
- hub: {
1022
- globalRecipes,
1023
- globalJustfile,
1024
- piExtensions,
1025
- cantWorkflows,
1026
- globalAgents,
1027
- },
1028
- scaffolded: {
1029
- globalRecipes: existsSync(globalRecipes),
1030
- globalJustfile: existsSync(globalJustfile),
1031
- piExtensions: existsSync(piExtensions),
1032
- cantWorkflows: existsSync(cantWorkflows),
1033
- globalAgents: existsSync(globalAgents),
1034
- },
1035
- },
1036
- };
1037
- }
1038
- catch (err) {
1039
- return cleoErrorToEngineError(err, 'E_PATHS_RESOLVE_FAILED', 'Failed to resolve paths');
1040
- }
1041
- }
1042
- /**
1043
- * Create the CleoOS Hub directories and seed the starter justfile if absent.
1044
- *
1045
- * Idempotent: safe to call repeatedly. Never overwrites existing user-edited
1046
- * justfile or README content. Backs the `cleo admin scaffold-hub` CLI
1047
- * command and is invoked automatically by `cleo init` (Phase 5).
1048
- *
1049
- * @task Phase 1 — XDG Foundation + Justfile Hub Skeleton
1050
- */
1051
- export async function systemScaffoldHub() {
1052
- try {
1053
- const result = await ensureCleoOsHub();
1054
- return { success: true, data: result };
1055
- }
1056
- catch (err) {
1057
- return cleoErrorToEngineError(err, 'E_SCAFFOLD_HUB_FAILED', 'Failed to scaffold hub');
1058
- }
1059
- }
1060
- /**
1061
- * Repair task ID sequence using canonical core implementation.
1062
- * @task T4815
1063
- */
1064
- export async function systemSequenceRepair(projectRoot) {
1065
- try {
1066
- const repair = await repairSequence(projectRoot);
1067
- return {
1068
- success: true,
1069
- data: {
1070
- repaired: repair.repaired,
1071
- message: repair.message,
1072
- counter: repair.counter,
1073
- oldCounter: repair.oldCounter,
1074
- newCounter: repair.newCounter,
1075
- },
1076
- };
1077
- }
1078
- catch (err) {
1079
- return cleoErrorToEngineError(err, 'E_SEQUENCE_REPAIR_FAILED', 'Failed to repair sequence');
1080
- }
1081
- }
1082
- /**
1083
- * Smoke-test definitions: one lightweight read-only query per domain.
1084
- * Each probe exercises the full dispatch pipeline (middleware, handler, engine, core).
1085
- *
1086
- * T511: includes an `adapter` probe so adapter health is covered by smoke tests,
1087
- * consistent with its inclusion in the doctor report via `checkAdapterHealth()`.
1088
- */
1089
- const SMOKE_PROBES = [
1090
- { domain: 'admin', operation: 'version' },
1091
- { domain: 'tasks', operation: 'find', params: { query: '__smoke_probe__', limit: 1 } },
1092
- { domain: 'session', operation: 'status' },
1093
- { domain: 'memory', operation: 'find', params: { query: '__smoke_probe__' } },
1094
- { domain: 'pipeline', operation: 'list' },
1095
- { domain: 'check', operation: 'schema' },
1096
- { domain: 'tools', operation: 'list', params: { limit: 1 } },
1097
- { domain: 'sticky', operation: 'list', params: { limit: 1 } },
1098
- { domain: 'nexus', operation: 'status' },
1099
- { domain: 'orchestrate', operation: 'status' },
1100
- { domain: 'adapter', operation: 'list' },
1101
- ];
1102
- /**
1103
- * Run operational smoke tests across all domains.
1104
- *
1105
- * Dispatches one read-only query per domain through the full CLI dispatch
1106
- * pipeline and reports pass/fail with timing. Catches crashes (TypeError,
1107
- * ReferenceError, etc.) not just structured error responses.
1108
- *
1109
- * @task T130
1110
- */
1111
- export async function systemSmoke() {
1112
- const { dispatchRaw } = await import('../adapters/cli.js');
1113
- const totalStart = Date.now();
1114
- const probes = [];
1115
- for (const probe of SMOKE_PROBES) {
1116
- const start = Date.now();
1117
- try {
1118
- const response = await dispatchRaw('query', probe.domain, probe.operation, probe.params);
1119
- const elapsed = Date.now() - start;
1120
- if (response.success) {
1121
- probes.push({
1122
- domain: probe.domain,
1123
- operation: probe.operation,
1124
- status: 'pass',
1125
- timeMs: elapsed,
1126
- });
1127
- }
1128
- else {
1129
- // Structured error responses that are domain-specific (like "no session") are still valid
1130
- // operational results — the dispatch pipeline worked. Only treat E_INTERNAL / E_NO_HANDLER as failures.
1131
- const code = response.error?.code ?? '';
1132
- const isCrash = code === 'E_INTERNAL' || code === 'E_NO_HANDLER';
1133
- probes.push({
1134
- domain: probe.domain,
1135
- operation: probe.operation,
1136
- status: isCrash ? 'fail' : 'pass',
1137
- timeMs: elapsed,
1138
- ...(isCrash ? { error: response.error?.message } : {}),
1139
- });
1140
- }
1141
- }
1142
- catch (err) {
1143
- const elapsed = Date.now() - start;
1144
- probes.push({
1145
- domain: probe.domain,
1146
- operation: probe.operation,
1147
- status: 'fail',
1148
- timeMs: elapsed,
1149
- error: err instanceof Error ? `${err.constructor.name}: ${err.message}` : String(err),
1150
- });
1151
- }
1152
- }
1153
- // --- DB connectivity and migration state checks ---
1154
- const dbChecks = [];
1155
- // tasks.db connectivity + integrity
1156
- {
1157
- const start = Date.now();
1158
- try {
1159
- const { getDb, getNativeDb } = await import('@cleocode/core/internal');
1160
- const projectRoot = (await import('@cleocode/core/internal')).getProjectRoot();
1161
- await getDb(projectRoot);
1162
- const nativeDb = getNativeDb();
1163
- if (nativeDb) {
1164
- const result = nativeDb.prepare('PRAGMA integrity_check').get();
1165
- const ok = result?.integrity_check === 'ok';
1166
- dbChecks.push({
1167
- domain: 'db',
1168
- operation: 'tasks.db',
1169
- status: ok ? 'pass' : 'fail',
1170
- timeMs: Date.now() - start,
1171
- ...(!ok ? { error: 'SQLite integrity check failed' } : {}),
1172
- });
1173
- }
1174
- else {
1175
- dbChecks.push({
1176
- domain: 'db',
1177
- operation: 'tasks.db',
1178
- status: 'fail',
1179
- timeMs: Date.now() - start,
1180
- error: 'Native DB handle unavailable',
1181
- });
1182
- }
1183
- }
1184
- catch (err) {
1185
- dbChecks.push({
1186
- domain: 'db',
1187
- operation: 'tasks.db',
1188
- status: 'fail',
1189
- timeMs: Date.now() - start,
1190
- error: err instanceof Error ? err.message : String(err),
1191
- });
1192
- }
1193
- }
1194
- // brain.db connectivity
1195
- {
1196
- const start = Date.now();
1197
- try {
1198
- const { getBrainDb } = await import('@cleocode/core/internal');
1199
- const projectRoot = (await import('@cleocode/core/internal')).getProjectRoot();
1200
- const brainDb = await getBrainDb(projectRoot);
1201
- if (brainDb) {
1202
- dbChecks.push({
1203
- domain: 'db',
1204
- operation: 'brain.db',
1205
- status: 'pass',
1206
- timeMs: Date.now() - start,
1207
- });
1208
- }
1209
- else {
1210
- dbChecks.push({
1211
- domain: 'db',
1212
- operation: 'brain.db',
1213
- status: 'fail',
1214
- timeMs: Date.now() - start,
1215
- error: 'brain.db not initialized',
1216
- });
1217
- }
1218
- }
1219
- catch (err) {
1220
- dbChecks.push({
1221
- domain: 'db',
1222
- operation: 'brain.db',
1223
- status: 'fail',
1224
- timeMs: Date.now() - start,
1225
- error: err instanceof Error ? err.message : String(err),
1226
- });
1227
- }
1228
- }
1229
- // Migration state validation (detect stale journals)
1230
- {
1231
- const start = Date.now();
1232
- try {
1233
- const migrationStatus = await getMigrationStatus((await import('@cleocode/core/internal')).getProjectRoot());
1234
- const hasPending = migrationStatus.migrations.some((m) => !m.applied);
1235
- dbChecks.push({
1236
- domain: 'db',
1237
- operation: 'migrations',
1238
- status: hasPending ? 'fail' : 'pass',
1239
- timeMs: Date.now() - start,
1240
- ...(hasPending
1241
- ? {
1242
- error: `Unapplied migrations detected (${migrationStatus.from} → ${migrationStatus.to}). Run: cleo upgrade`,
1243
- }
1244
- : {}),
1245
- });
1246
- }
1247
- catch (err) {
1248
- dbChecks.push({
1249
- domain: 'db',
1250
- operation: 'migrations',
1251
- status: 'fail',
1252
- timeMs: Date.now() - start,
1253
- error: err instanceof Error ? err.message : String(err),
1254
- });
1255
- }
1256
- }
1257
- const allProbes = [...probes, ...dbChecks];
1258
- const totalMs = Date.now() - totalStart;
1259
- const passed = allProbes.filter((p) => p.status === 'pass').length;
1260
- const failed = allProbes.filter((p) => p.status === 'fail').length;
1261
- const skipped = allProbes.filter((p) => p.status === 'skip').length;
1262
- if (failed === 0) {
1263
- return {
1264
- success: true,
1265
- data: { probes, dbChecks, passed, failed, skipped, totalMs },
1266
- };
1267
- }
1268
- return {
1269
- success: false,
1270
- error: {
1271
- code: 'E_SMOKE_FAILURES',
1272
- message: `${failed} probe(s) failed smoke test`,
1273
- exitCode: 1,
1274
- details: { probes, dbChecks, passed, failed, skipped, totalMs },
1275
- },
1276
- };
1277
- }
1278
- //# sourceMappingURL=system-engine.js.map