@cleocode/cleo 2026.10.3 → 2026.10.5-rc.ci.672

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 (352) hide show
  1. package/README.md +7 -0
  2. package/bin/cleo.js +11 -1
  3. package/dist/cli/adapter-OUQRSFZL.js +159 -0
  4. package/dist/cli/add-4SRRJL4U.js +443 -0
  5. package/dist/cli/add-batch-TSWICA5J.js +164 -0
  6. package/dist/cli/admin-L3F6CDYH.js +1428 -0
  7. package/dist/cli/admin-YMU55YCU.js +341 -0
  8. package/dist/cli/adr-XESRMFMP.js +172 -0
  9. package/dist/cli/agent-TAFPIYUU.js +2404 -0
  10. package/dist/cli/agent-outputs-HVJJIPS4.js +84 -0
  11. package/dist/cli/analyze-YQ22QVGW.js +49 -0
  12. package/dist/cli/archive-W5XX6AH7.js +65 -0
  13. package/dist/cli/archive-stats-HP2KPAJU.js +101 -0
  14. package/dist/cli/attention-7JBDCRZX.js +124 -0
  15. package/dist/cli/attention-ZXZANHKC.js +168 -0
  16. package/dist/cli/audit-ICA2SEFN.js +122 -0
  17. package/dist/cli/auth-DXIG5OG7.js +491 -0
  18. package/dist/cli/backfill-LBSYBWLR.js +156 -0
  19. package/dist/cli/backup-NUGBZ7NA.js +588 -0
  20. package/dist/cli/backup-inspect-PDRXI45A.js +26 -0
  21. package/dist/cli/backup-recover-TVKAPERB.js +29 -0
  22. package/dist/cli/blockers-ZOPCGHDW.js +55 -0
  23. package/dist/cli/brain-EJOBKL4A.js +397 -0
  24. package/dist/cli/briefing-RDQJ6WHS.js +213 -0
  25. package/dist/cli/caamp-Z3XPKEHB.js +181 -0
  26. package/dist/cli/cancel-S7EHLCJN.js +85 -0
  27. package/dist/cli/canon-NPF5RODM.js +142 -0
  28. package/dist/cli/canon-docs-2GTOLF7Y.js +26 -0
  29. package/dist/cli/cant-CHNN6O57.js +239 -0
  30. package/dist/cli/changeset-RYPHPN2B.js +246 -0
  31. package/dist/cli/check-C67YAU7W.js +759 -0
  32. package/dist/cli/check-DHMURGHC.js +924 -0
  33. package/dist/cli/checkpoint-UWDFOGYQ.js +128 -0
  34. package/dist/cli/chunk-22YPFZYB.js +91 -0
  35. package/dist/cli/chunk-2MGFDMDF.js +272 -0
  36. package/dist/cli/chunk-47JYZAMS.js +30 -0
  37. package/dist/cli/chunk-4JYHPP4C.js +76 -0
  38. package/dist/cli/chunk-4PEODTHY.js +278 -0
  39. package/dist/cli/chunk-4RGSNUUP.js +950 -0
  40. package/dist/cli/chunk-4VASFLUW.js +35 -0
  41. package/dist/cli/chunk-5PNI276X.js +124 -0
  42. package/dist/cli/chunk-6JSJNYH2.js +114 -0
  43. package/dist/cli/chunk-6N6WGLXE.js +63 -0
  44. package/dist/cli/chunk-75UH3BLS.js +210 -0
  45. package/dist/cli/chunk-7ACK4EIN.js +92 -0
  46. package/dist/cli/chunk-7NMKLVMI.js +107 -0
  47. package/dist/cli/chunk-7SINJXB6.js +110 -0
  48. package/dist/cli/chunk-7UARFJYS.js +46 -0
  49. package/dist/cli/chunk-7ZYPQV4N.js +90 -0
  50. package/dist/cli/chunk-AQCYT3L4.js +72 -0
  51. package/dist/cli/chunk-BQK6XTOH.js +57 -0
  52. package/dist/cli/chunk-C3B7C43W.js +16 -0
  53. package/dist/cli/chunk-CAPAGD5E.js +98 -0
  54. package/dist/cli/chunk-CHGEDCKG.js +77 -0
  55. package/dist/cli/chunk-COXFJ3PT.js +74 -0
  56. package/dist/cli/chunk-D7BAQNV2.js +55 -0
  57. package/dist/cli/chunk-EIUXVHNF.js +258 -0
  58. package/dist/cli/chunk-EUGB6P5V.js +173 -0
  59. package/dist/cli/chunk-EW2CKNNZ.js +304 -0
  60. package/dist/cli/chunk-FSKN4DWC.js +108 -0
  61. package/dist/cli/chunk-FVKLULL7.js +48 -0
  62. package/dist/cli/chunk-GAGUBU4Z.js +280 -0
  63. package/dist/cli/chunk-GKRFH2YG.js +171 -0
  64. package/dist/cli/chunk-GRU74UE4.js +270 -0
  65. package/dist/cli/chunk-GZFVDR44.js +320 -0
  66. package/dist/cli/chunk-HFLLZE6A.js +83 -0
  67. package/dist/cli/chunk-HXRXT3XU.js +78 -0
  68. package/dist/cli/chunk-IIOGUY3B.js +258 -0
  69. package/dist/cli/chunk-ILWWL462.js +60 -0
  70. package/dist/cli/chunk-J5USPJKZ.js +48 -0
  71. package/dist/cli/chunk-KEQS36GD.js +88 -0
  72. package/dist/cli/chunk-L7ONYSV6.js +2497 -0
  73. package/dist/cli/chunk-LVGIFMCV.js +163 -0
  74. package/dist/cli/chunk-NEFMQYLE.js +656 -0
  75. package/dist/cli/chunk-NU6CQQVB.js +4501 -0
  76. package/dist/cli/chunk-OILHT47L.js +252 -0
  77. package/dist/cli/chunk-PKKZPOOP.js +352 -0
  78. package/dist/cli/chunk-PN4WW5VX.js +66 -0
  79. package/dist/cli/chunk-PSJ33WVO.js +56 -0
  80. package/dist/cli/chunk-QA6T2LQ5.js +71 -0
  81. package/dist/cli/chunk-QJJWWCIC.js +288 -0
  82. package/dist/cli/chunk-QKMBWYAS.js +93 -0
  83. package/dist/cli/chunk-QWNKLLLG.js +84 -0
  84. package/dist/cli/chunk-QWUFFDL3.js +85 -0
  85. package/dist/cli/chunk-QY76BRUZ.js +35 -0
  86. package/dist/cli/chunk-R45KVF5Y.js +117 -0
  87. package/dist/cli/chunk-RRKP7HLU.js +66 -0
  88. package/dist/cli/chunk-SXXOC6KZ.js +209 -0
  89. package/dist/cli/chunk-T6GZJYL3.js +108 -0
  90. package/dist/cli/chunk-TLQ37HRE.js +67 -0
  91. package/dist/cli/chunk-TPTNEJZJ.js +52 -0
  92. package/dist/cli/chunk-TYC7G5LF.js +100 -0
  93. package/dist/cli/chunk-UWCZY52R.js +766 -0
  94. package/dist/cli/chunk-VB3LDPL5.js +46 -0
  95. package/dist/cli/chunk-VLEYOOPH.js +31 -0
  96. package/dist/cli/chunk-W3JLYKKY.js +140 -0
  97. package/dist/cli/chunk-WWCYZYSN.js +56 -0
  98. package/dist/cli/chunk-XA5WISNV.js +52 -0
  99. package/dist/cli/chunk-XHRZ7OYZ.js +132 -0
  100. package/dist/cli/chunk-XLPMIGJJ.js +148 -0
  101. package/dist/cli/chunk-YY66LFZF.js +29 -0
  102. package/dist/cli/chunk-ZMGDZMSJ.js +210 -0
  103. package/dist/cli/claim-IGOG2QOC.js +97 -0
  104. package/dist/cli/classify-MG4N7GMQ.js +117 -0
  105. package/dist/cli/cli-A23Q335V.js +51 -0
  106. package/dist/cli/cloud-SILYJVKO.js +731 -0
  107. package/dist/cli/cockpit-RZKLGYPN.js +790 -0
  108. package/dist/cli/code-H2FQCVMW.js +178 -0
  109. package/dist/cli/complete-JLX7NBI4.js +35 -0
  110. package/dist/cli/complexity-OKV7PVZH.js +57 -0
  111. package/dist/cli/compliance-QMGZHJNQ.js +277 -0
  112. package/dist/cli/conduit-4H32UYEA.js +308 -0
  113. package/dist/cli/conduit-EY54WTZA.js +535 -0
  114. package/dist/cli/config-TDYOC7XO.js +519 -0
  115. package/dist/cli/consensus-4XCOFPPT.js +122 -0
  116. package/dist/cli/context-FN4YTGHD.js +142 -0
  117. package/dist/cli/contribution-7RWFBJLC.js +112 -0
  118. package/dist/cli/curator-HKZJCVRL.js +139 -0
  119. package/dist/cli/current-B2NU7V3G.js +43 -0
  120. package/dist/cli/daemon-GBD4TVCD.js +452 -0
  121. package/dist/cli/dash-IGDANIE5.js +71 -0
  122. package/dist/cli/decide-26SXC2V6.js +416 -0
  123. package/dist/cli/decompose-LQ76TEZG.js +78 -0
  124. package/dist/cli/decomposition-WFRWNUSJ.js +122 -0
  125. package/dist/cli/delete-T5DUQHOX.js +69 -0
  126. package/dist/cli/deps-UTPZJBXL.js +462 -0
  127. package/dist/cli/detect-FFZSMVDT.js +46 -0
  128. package/dist/cli/detect-drift-TVCJOFYJ.js +408 -0
  129. package/dist/cli/diagnostics-GN5CVD3N.js +93 -0
  130. package/dist/cli/diagnostics-ZNBKH6GX.js +133 -0
  131. package/dist/cli/docs-CLQKEEUK.js +1710 -0
  132. package/dist/cli/docs-DPPDFTWR.js +3098 -0
  133. package/dist/cli/doctor-GPENOP4N.js +1270 -0
  134. package/dist/cli/doctor-ac-bindings-S3IOEFP4.js +26 -0
  135. package/dist/cli/doctor-acceptance-drift-VNFKPBSQ.js +26 -0
  136. package/dist/cli/doctor-credentials-A5H4JMTF.js +26 -0
  137. package/dist/cli/doctor-db-substrate-FGCISE4Z.js +27 -0
  138. package/dist/cli/doctor-dep-cycles-BKKKHHYG.js +26 -0
  139. package/dist/cli/doctor-exodus-ND2DH2KP.js +26 -0
  140. package/dist/cli/doctor-exodus-residue-4EMRYMEQ.js +26 -0
  141. package/dist/cli/doctor-fk-check-VY3RIQV3.js +26 -0
  142. package/dist/cli/doctor-global-delivery-JN6IGHUL.js +26 -0
  143. package/dist/cli/doctor-heavy-command-hook-XSN44WXU.js +26 -0
  144. package/dist/cli/doctor-legacy-backups-QAG5NHYP.js +26 -0
  145. package/dist/cli/doctor-legacy-reaper-CIRGFE6R.js +26 -0
  146. package/dist/cli/doctor-malformed-ids-WL7HT4TB.js +26 -0
  147. package/dist/cli/doctor-manifest-rows-SMQCKJ2T.js +26 -0
  148. package/dist/cli/doctor-memory-guard-LJDOJG76.js +26 -0
  149. package/dist/cli/doctor-migrations-ETQPFNUP.js +26 -0
  150. package/dist/cli/doctor-nexus-residency-A4JMKBEJ.js +26 -0
  151. package/dist/cli/doctor-project-identity-FFQJ5LNX.js +26 -0
  152. package/dist/cli/doctor-projects-MFUTKRHP.js +30 -0
  153. package/dist/cli/doctor-projects-registry-76X6VTGM.js +26 -0
  154. package/dist/cli/doctor-release-readiness-QJCOPFTK.js +26 -0
  155. package/dist/cli/doctor-repair-AU76FIKY.js +26 -0
  156. package/dist/cli/doctor-row-identity-KW6JYZQE.js +26 -0
  157. package/dist/cli/doctor-skill-fixtures-G3T7JUHS.js +26 -0
  158. package/dist/cli/doctor-split-brain-FUW6L7FS.js +26 -0
  159. package/dist/cli/doctor-superseded-store-DUHGSBLC.js +26 -0
  160. package/dist/cli/doctor-sync-journal-SXMUIKF7.js +26 -0
  161. package/dist/cli/doctor-sync-triggers-6WNJZFRM.js +26 -0
  162. package/dist/cli/doctor-tool-locks-66LSLUBN.js +26 -0
  163. package/dist/cli/doctor-twin-collapse-AYBYBFC4.js +26 -0
  164. package/dist/cli/doctor-worktree-stores-C5XEH5OG.js +26 -0
  165. package/dist/cli/done-R64XRZ32.js +196 -0
  166. package/dist/cli/dynamic-RR4HB7BB.js +29 -0
  167. package/dist/cli/entities-3JIHDIOK.js +361 -0
  168. package/dist/cli/event-45KEWV5H.js +372 -0
  169. package/dist/cli/exists-BEDZS5RI.js +65 -0
  170. package/dist/cli/exodus-DUX62344.js +401 -0
  171. package/dist/cli/export-C5PQIQ5O.js +93 -0
  172. package/dist/cli/export-tasks-CUXDZPJB.js +97 -0
  173. package/dist/cli/federation-ESM35EGG.js +145 -0
  174. package/dist/cli/find-5EUZHHQJ.js +178 -0
  175. package/dist/cli/focus-6AH4KLRO.js +368 -0
  176. package/dist/cli/focus-ANKAIRO5.js +56 -0
  177. package/dist/cli/gateway-2GW2KTK3.js +77 -0
  178. package/dist/cli/gateway-auto-start-EDK7XI6E.js +36 -0
  179. package/dist/cli/gc-CTOQLUSA.js +291 -0
  180. package/dist/cli/go-YJPNHHYT.js +206 -0
  181. package/dist/cli/goal-4GW4G77D.js +213 -0
  182. package/dist/cli/grade-25WSZH4X.js +57 -0
  183. package/dist/cli/graph-JUO3TMF3.js +879 -0
  184. package/dist/cli/history-NACNUQTC.js +138 -0
  185. package/dist/cli/hook-UF7J7R6D.js +57 -0
  186. package/dist/cli/hook-entry.js +244 -19
  187. package/dist/cli/hygiene-3QZ2NI7P.js +55 -0
  188. package/dist/cli/import-7ESGL5SS.js +89 -0
  189. package/dist/cli/import-tasks-FLE2RPBR.js +109 -0
  190. package/dist/cli/index.js +601 -94637
  191. package/dist/cli/init-AN4DZ2XO.js +40 -0
  192. package/dist/cli/inject-HQWA5GWY.js +83 -0
  193. package/dist/cli/install-global-YQV4W5OG.js +95 -0
  194. package/dist/cli/intelligence-OFFNQGHE.js +238 -0
  195. package/dist/cli/intelligence-QIC4SN4X.js +182 -0
  196. package/dist/cli/issue-P5RNMRDG.js +159 -0
  197. package/dist/cli/janitor-ZNCFQ7E3.js +111 -0
  198. package/dist/cli/labels-ORBM3T57.js +88 -0
  199. package/dist/cli/lifecycle-MHR22TVI.js +273 -0
  200. package/dist/cli/list-LB6GCYYU.js +109 -0
  201. package/dist/cli/llm-H7LZWQKX.js +130 -0
  202. package/dist/cli/llm-OTJWPMGI.js +704 -0
  203. package/dist/cli/llm-cost-MLMXEAR4.js +25 -0
  204. package/dist/cli/llm-stream-AAEUNKRP.js +27 -0
  205. package/dist/cli/log-W2A5M2NA.js +76 -0
  206. package/dist/cli/login-SIXFFZSP.js +45 -0
  207. package/dist/cli/logout-G3KVLQQM.js +74 -0
  208. package/dist/cli/manifest-G4T6EBSI.js +354 -0
  209. package/dist/cli/map-VU5M72TK.js +53 -0
  210. package/dist/cli/memory-2E27G2G5.js +1952 -0
  211. package/dist/cli/memory-IAEYKXG6.js +1895 -0
  212. package/dist/cli/migrate-agents-v2-A52QIYNJ.js +33 -0
  213. package/dist/cli/migrate-claude-mem-TPDW3R4Z.js +206 -0
  214. package/dist/cli/next-SVH4LIDY.js +57 -0
  215. package/dist/cli/nexus-FPQV2EAF.js +1059 -0
  216. package/dist/cli/nexus-XSFXN5E6.js +2924 -0
  217. package/dist/cli/ops-K6LHY5J6.js +52 -0
  218. package/dist/cli/orchestrate-CZ2J6W3L.js +1650 -0
  219. package/dist/cli/orchestrate-HURUCQFT.js +950 -0
  220. package/dist/cli/otel-JCNPVJLZ.js +188 -0
  221. package/dist/cli/phase-VDFRASSO.js +221 -0
  222. package/dist/cli/pipeline-TCZPOEDR.js +697 -0
  223. package/dist/cli/pivot-V5MSQZ7L.js +88 -0
  224. package/dist/cli/plan-SQUGCKSM.js +49 -0
  225. package/dist/cli/playbook-L47GLDQD.js +230 -0
  226. package/dist/cli/playbook-NJVO4R6P.js +33 -0
  227. package/dist/cli/project-YZEC7GYF.js +331 -0
  228. package/dist/cli/promote-FINF4HVK.js +53 -0
  229. package/dist/cli/provenance-3TUWVBFR.js +141 -0
  230. package/dist/cli/provenance-YZG33JGM.js +129 -0
  231. package/dist/cli/provider-23JVLLG3.js +213 -0
  232. package/dist/cli/reason-FHN54O7O.js +138 -0
  233. package/dist/cli/reconcile-MOM5T4AX.js +128 -0
  234. package/dist/cli/refresh-memory-3OSTRAVK.js +45 -0
  235. package/dist/cli/relates-6FWUFUS2.js +260 -0
  236. package/dist/cli/release-G2DPSG5M.js +347 -0
  237. package/dist/cli/release-URX6JHZ2.js +525 -0
  238. package/dist/cli/remote-VIULU2T5.js +279 -0
  239. package/dist/cli/renderers-TGSW77J4.js +37 -0
  240. package/dist/cli/reorder-UIPN6TQY.js +87 -0
  241. package/dist/cli/reparent-ALOWWUIU.js +59 -0
  242. package/dist/cli/req-RH2Y3H7A.js +130 -0
  243. package/dist/cli/research-G2Y72HRC.js +366 -0
  244. package/dist/cli/restore-VBR5XNML.js +470 -0
  245. package/dist/cli/revert-32LDNSGP.js +240 -0
  246. package/dist/cli/roadmap-LFU3AG7D.js +62 -0
  247. package/dist/cli/run-HXRILSR7.js +245 -0
  248. package/dist/cli/safestop-Z5UC7NGQ.js +89 -0
  249. package/dist/cli/saga-Y6FZS6AM.js +286 -0
  250. package/dist/cli/schema-OOOKLWUE.js +195 -0
  251. package/dist/cli/self-update-26SOTJMH.js +504 -0
  252. package/dist/cli/selfimprove-4SMOCLUV.js +89 -0
  253. package/dist/cli/selfimprove-EB4RQLP4.js +139 -0
  254. package/dist/cli/sentient-QPETVE53.js +254 -0
  255. package/dist/cli/sentient-RGMWR4XJ.js +1088 -0
  256. package/dist/cli/sequence-H7DSAJPF.js +94 -0
  257. package/dist/cli/service-EK5MGB2D.js +156 -0
  258. package/dist/cli/service-GLOMZWPQ.js +437 -0
  259. package/dist/cli/session-HYUXAQGC.js +708 -0
  260. package/dist/cli/session-N5ISU56W.js +568 -0
  261. package/dist/cli/setup-L3YYV53D.js +323 -0
  262. package/dist/cli/show-364V3KY2.js +123 -0
  263. package/dist/cli/skill-F2KR6HW5.js +84 -0
  264. package/dist/cli/skills-FS3DCP6E.js +929 -0
  265. package/dist/cli/smoke-provider-SKUFMZXU.js +218 -0
  266. package/dist/cli/snapshot-EGXEQ5PR.js +120 -0
  267. package/dist/cli/src-LYLXHXHH.js +80 -0
  268. package/dist/cli/start-6DXOCCKL.js +68 -0
  269. package/dist/cli/stats-UVUQEGYC.js +96 -0
  270. package/dist/cli/status-XLKYLN42.js +157 -0
  271. package/dist/cli/sticky-VSTQ2I2O.js +264 -0
  272. package/dist/cli/sticky-XZXZDCFW.js +339 -0
  273. package/dist/cli/stop-VNOAFWNB.js +43 -0
  274. package/dist/cli/sync-YYPARW3A.js +155 -0
  275. package/dist/cli/tasks-C24KHTFF.js +1118 -0
  276. package/dist/cli/tasks-LBJC7CZV.js +175 -0
  277. package/dist/cli/telemetry-CU7W5WAY.js +120 -0
  278. package/dist/cli/templates-G42JBUY4.js +609 -0
  279. package/dist/cli/testing-HSRITHEY.js +147 -0
  280. package/dist/cli/token-J74E7TSU.js +221 -0
  281. package/dist/cli/tools-BI74W7VE.js +652 -0
  282. package/dist/cli/transcript-RGK7RSGQ.js +440 -0
  283. package/dist/cli/tui-BPUFHYKK.js +51 -0
  284. package/dist/cli/update-2KQWA27S.js +478 -0
  285. package/dist/cli/update-check-entry.js +124 -0
  286. package/dist/cli/update-notice-6SQ6WPQG.js +68 -0
  287. package/dist/cli/upgrade-E2MJAPC7.js +136 -0
  288. package/dist/cli/upgrade-XRSQ4RWH.js +243 -0
  289. package/dist/cli/verify-WASRGDBA.js +191 -0
  290. package/dist/cli/web-NJ3P67EU.js +275 -0
  291. package/dist/cli/workgraph-OHJ2VKJD.js +232 -0
  292. package/dist/cli/worktree-FVQLORFY.js +371 -0
  293. package/dist/cli/worktree-ZJ6JTQNG.js +287 -0
  294. package/package.json +13 -13
  295. package/studio-dist/client/_app/immutable/chunks/{DMj27Pxj.js → AH7dIemv.js} +1 -1
  296. package/studio-dist/client/_app/immutable/chunks/{Dc2owyvE.js → BDgH40i3.js} +1 -1
  297. package/studio-dist/client/_app/immutable/chunks/BXDCSJ7U.js +1 -0
  298. package/studio-dist/client/_app/immutable/chunks/{qq3pe1aT.js → Gg4iYl59.js} +1 -1
  299. package/studio-dist/client/_app/immutable/entry/{app.CHWXLeE9.js → app.DUDNK-37.js} +2 -2
  300. package/studio-dist/client/_app/immutable/entry/start.DNmZ0pA4.js +1 -0
  301. package/studio-dist/client/_app/immutable/nodes/{0.DmKQGvFh.js → 0.DWqP3ail.js} +1 -1
  302. package/studio-dist/client/_app/immutable/nodes/{1.DqJk_REO.js → 1.CZGVUP5B.js} +1 -1
  303. package/studio-dist/client/_app/immutable/nodes/{15.GUy6kdW1.js → 15.DGaflZRS.js} +1 -1
  304. package/studio-dist/client/_app/immutable/nodes/{16.CcnKZ8f9.js → 16.uYlarGXl.js} +1 -1
  305. package/studio-dist/client/_app/immutable/nodes/{17.DAlQF3lQ.js → 17.CZMR0E47.js} +1 -1
  306. package/studio-dist/client/_app/immutable/nodes/{18.vQFr-vFj.js → 18.CBC-AKH_.js} +1 -1
  307. package/studio-dist/client/_app/immutable/nodes/{20.GVOj5j_r.js → 20.BGi43MvQ.js} +1 -1
  308. package/studio-dist/client/_app/immutable/nodes/{24.2-wC6DOh.js → 24.Dv8ftCyR.js} +1 -1
  309. package/studio-dist/client/_app/immutable/nodes/25.DQPVlTDQ.js +39 -0
  310. package/studio-dist/client/_app/immutable/nodes/{26.C3rNqzZF.js → 26.Cl800304.js} +1 -1
  311. package/studio-dist/client/_app/immutable/nodes/{3.b-7pzc3M.js → 3.D_fQKj9f.js} +1 -1
  312. package/studio-dist/client/_app/version.json +1 -1
  313. package/studio-dist/server/chunks/{0-BaCce-O1.js → 0-BpOagOst.js} +3 -3
  314. package/studio-dist/server/chunks/1-D0oRGR-C.js +9 -0
  315. package/studio-dist/server/chunks/{15-DRMOSIC9.js → 15-BcjHz7Tv.js} +3 -3
  316. package/studio-dist/server/chunks/{16-BulXhoZZ.js → 16-CXm8TUk7.js} +3 -3
  317. package/studio-dist/server/chunks/{17-DUEOCM0H.js → 17-mSgUK-cp.js} +3 -3
  318. package/studio-dist/server/chunks/{18-DP7Q8zPs.js → 18-BtfnIw1d.js} +3 -3
  319. package/studio-dist/server/chunks/{20-9ta6MI7q.js → 20-By1e4QDS.js} +3 -3
  320. package/studio-dist/server/chunks/{24-DysdL1ab.js → 24-0i2YLVxG.js} +3 -3
  321. package/studio-dist/server/chunks/{dist-CdoCt9zT.js → 25-DPsrqbrh.js} +797 -10736
  322. package/studio-dist/server/chunks/{26-Df4YXgg0.js → 26-P0XkOibm.js} +3 -3
  323. package/studio-dist/server/chunks/{3-BEhOhYpL.js → 3-WudjUK7e.js} +3 -3
  324. package/studio-dist/server/chunks/{_layout.svelte-CnLcXYG-.js → _layout.svelte-D9m81Rle.js} +4 -4
  325. package/studio-dist/server/chunks/{_page.svelte-DGhXqeRc.js → _page.svelte-2PDLOF83.js} +3 -3
  326. package/studio-dist/server/chunks/{_page.svelte-Dv8tmDEC.js → _page.svelte-BjE3jm2K.js} +3 -3
  327. package/studio-dist/server/chunks/{_page.svelte-C0qgUvzA.js → _page.svelte-Clc0vmiZ.js} +4 -4
  328. package/studio-dist/server/chunks/{_page.svelte-ui7LnWkL.js → _page.svelte-DABdRT3h.js} +3 -3
  329. package/studio-dist/server/chunks/{_page.svelte-HUqTICJR.js → _page.svelte-DG3PjiHj.js} +3 -3
  330. package/studio-dist/server/chunks/{_page.svelte-DzcZljiy.js → _page.svelte-Edy9CaE8.js} +20 -7
  331. package/studio-dist/server/chunks/{_page.svelte-DOl0DGOO.js → _page.svelte-Hrf3-ZR8.js} +3 -3
  332. package/studio-dist/server/chunks/{_page.svelte-Da4q5l93.js → _page.svelte-VB4O4Nl5.js} +3 -3
  333. package/studio-dist/server/chunks/{_page.svelte-CbyEPj2j.js → _page.svelte-d3jEgjsI.js} +3 -3
  334. package/studio-dist/server/chunks/{_server.ts-P4wVVksg.js → _server.ts-BcRFsyo3.js} +4 -5
  335. package/studio-dist/server/chunks/{_server.ts-Cr57EKWf.js → _server.ts-CEWpIFrj.js} +6 -5
  336. package/studio-dist/server/chunks/{_server.ts-CnKVmf_s.js → _server.ts-CLVdVIF9.js} +2 -2
  337. package/studio-dist/server/chunks/{_server.ts-C0evMKCk.js → _server.ts-D_j7aSy5.js} +6 -5
  338. package/studio-dist/server/chunks/{_server.ts-2BazvYRP.js → _server.ts-QEZF8h2q.js} +4 -5
  339. package/studio-dist/server/chunks/{client-CPM4LrO2.js → client-Kp1dP1od.js} +2 -2
  340. package/studio-dist/server/chunks/{error.svelte-ShcZo43D.js → error.svelte-WOCioJVX.js} +3 -3
  341. package/studio-dist/server/chunks/{hooks.server-D2qbf3Zp.js → hooks.server-DH9zkIrJ.js} +3 -1
  342. package/studio-dist/server/chunks/{http-BiQjEmVU.js → http-DT5kxaWk.js} +5 -4
  343. package/studio-dist/server/chunks/{internal-Cgsrya1j.js → internal-z0vqd5_u.js} +3 -3
  344. package/studio-dist/server/chunks/operations-registry-DdzmYzqX.js +10584 -0
  345. package/studio-dist/server/chunks/{stores-BGrpEDMK.js → stores-s2kaL315.js} +2 -2
  346. package/studio-dist/server/index.js +1 -1
  347. package/studio-dist/server/manifest.js +17 -17
  348. package/studio-dist/client/_app/immutable/chunks/Bw6J8NDM.js +0 -1
  349. package/studio-dist/client/_app/immutable/entry/start.C9bwPpvc.js +0 -1
  350. package/studio-dist/client/_app/immutable/nodes/25.D1vYaH8g.js +0 -39
  351. package/studio-dist/server/chunks/1-CVo7Nk6d.js +0 -9
  352. package/studio-dist/server/chunks/25-CYsps38R.js +0 -366
@@ -0,0 +1,371 @@
1
+ (() => {
2
+ const _installed = Symbol.for('cleocode.cli.sqliteWarningFilter');
3
+ if (globalThis[_installed]) return;
4
+ globalThis[_installed] = true;
5
+ const _origEmitWarning = process.emitWarning;
6
+ process.emitWarning = function(warning, type, code, ctor) {
7
+ if (typeof warning === 'object' && warning.name === 'ExperimentalWarning' && typeof warning.message === 'string' && /SQLite is an experimental feature/i.test(warning.message)) {
8
+ return;
9
+ }
10
+ if (typeof warning === 'string' && /SQLite is an experimental feature/i.test(warning)) {
11
+ return;
12
+ }
13
+ return _origEmitWarning.call(process, warning, type, code, ctor);
14
+ };
15
+ })();
16
+ import {
17
+ dispatchFromCli
18
+ } from "./chunk-L7ONYSV6.js";
19
+ import "./chunk-6N6WGLXE.js";
20
+ import "./chunk-4VASFLUW.js";
21
+ import {
22
+ defineCommand,
23
+ showUsage
24
+ } from "./chunk-PKKZPOOP.js";
25
+ import "./chunk-QKMBWYAS.js";
26
+ import {
27
+ cliError,
28
+ cliOutput
29
+ } from "./chunk-4RGSNUUP.js";
30
+ import "./chunk-6JSJNYH2.js";
31
+ import "./chunk-D7BAQNV2.js";
32
+ import "./chunk-TYC7G5LF.js";
33
+
34
+ // packages/cleo/src/cli/commands/worktree.ts
35
+ import readline from "node:readline";
36
+ import { getProjectRoot, listWorktrees } from "@cleocode/core/internal";
37
+ var VALID_STATUS_VALUES = ["active", "stale", "merged", "orphan", "locked"];
38
+ var listCommand = defineCommand({
39
+ meta: {
40
+ name: "list",
41
+ description: "List worktrees attached to this project with status classification (active|stale|merged|orphan|locked)."
42
+ },
43
+ args: {
44
+ status: {
45
+ type: "string",
46
+ description: `Filter by status category (single value or comma-separated list of ${VALID_STATUS_VALUES.join("|")}).`
47
+ },
48
+ days: {
49
+ type: "string",
50
+ description: "Staleness threshold in days for the isStale classifier (default: 7)."
51
+ }
52
+ },
53
+ async run({ args }) {
54
+ const statusFilter = typeof args["status"] === "string" && args["status"].length > 0 ? args["status"] : void 0;
55
+ const staleDaysRaw = typeof args["days"] === "string" ? args["days"] : void 0;
56
+ const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
57
+ await dispatchFromCli(
58
+ "query",
59
+ "worktree",
60
+ "list",
61
+ {
62
+ ...statusFilter !== void 0 ? { statusFilter } : {},
63
+ ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
64
+ },
65
+ { command: "worktree-list", operation: "worktree.list" }
66
+ );
67
+ }
68
+ });
69
+ async function promptYesNo(question) {
70
+ return new Promise((resolve) => {
71
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
72
+ rl.question(`${question} [y/N]: `, (answer) => {
73
+ rl.close();
74
+ const trimmed = answer.trim().toLowerCase();
75
+ resolve(trimmed === "y" || trimmed === "yes");
76
+ });
77
+ });
78
+ }
79
+ function renderOrphanPreamble(wt) {
80
+ return [
81
+ "Orphaned worktree found:",
82
+ ` Path: ${wt.path}`,
83
+ ` Branch: ${wt.branch}${wt.isMerged ? " (merged to main)" : ""}`,
84
+ ` Task status: ${wt.owningTaskStatus ?? "(missing)"}`,
85
+ ` Last activity: ${wt.lastActivity}`,
86
+ ""
87
+ ].join("\n");
88
+ }
89
+ var pruneCommand = defineCommand({
90
+ meta: {
91
+ name: "prune",
92
+ description: "Remove orphan/merged worktrees with per-orphan Y/N confirmation."
93
+ },
94
+ args: {
95
+ orphaned: {
96
+ type: "boolean",
97
+ description: "Prune worktrees classified as orphan or merged (required).",
98
+ default: false
99
+ },
100
+ yes: {
101
+ type: "boolean",
102
+ description: "Skip per-orphan confirmation. Required on non-TTY (CI / pipe) input.",
103
+ default: false
104
+ },
105
+ "dry-run": {
106
+ type: "boolean",
107
+ description: "Show what would be pruned without acting. No audit-log entries written.",
108
+ default: false
109
+ },
110
+ days: {
111
+ type: "string",
112
+ description: "Override staleness threshold passed through to the listing (default: 7)."
113
+ },
114
+ "idle-days": {
115
+ type: "string",
116
+ description: "Abandonment-timeout threshold in days (T9805 AC2). Worktrees whose last commit is older than this value AND have no open PR are also pruned."
117
+ }
118
+ },
119
+ async run({ args }) {
120
+ if (args["orphaned"] !== true) {
121
+ cliError(
122
+ "cleo worktree prune requires --orphaned (other categories are reserved for future flags).",
123
+ 2
124
+ );
125
+ process.exit(2);
126
+ return;
127
+ }
128
+ const dryRun = args["dry-run"] === true;
129
+ const yes = args["yes"] === true;
130
+ const staleDaysRaw = typeof args["days"] === "string" ? args["days"] : void 0;
131
+ const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
132
+ const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
133
+ const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
134
+ const projectRoot = getProjectRoot();
135
+ const listResult = await listWorktrees({
136
+ projectRoot,
137
+ ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
138
+ });
139
+ if (!listResult.success) {
140
+ cliError(`Failed to enumerate worktrees: ${listResult.error.message}`, 1);
141
+ process.exit(1);
142
+ return;
143
+ }
144
+ const candidates = listResult.data.worktrees.filter(
145
+ (w) => w.statusCategory === "orphan" || w.statusCategory === "merged"
146
+ );
147
+ if (candidates.length === 0) {
148
+ cliOutput(
149
+ {
150
+ prunedCount: 0,
151
+ skippedCount: 0,
152
+ outcomes: [],
153
+ errors: [],
154
+ dryRun,
155
+ message: "No orphan or merged worktrees found."
156
+ },
157
+ { command: "worktree-prune", operation: "worktree.prune" }
158
+ );
159
+ return;
160
+ }
161
+ const isTty = process.stdin.isTTY === true;
162
+ if (!isTty && !yes && !dryRun) {
163
+ cliError(
164
+ "cleo worktree prune is interactive \u2014 re-run with --yes or --dry-run on non-TTY input.",
165
+ 2
166
+ );
167
+ process.exit(2);
168
+ return;
169
+ }
170
+ let confirmedPaths;
171
+ let skippedByUser = 0;
172
+ if (dryRun || yes) {
173
+ confirmedPaths = candidates.map((w) => w.path);
174
+ } else {
175
+ confirmedPaths = [];
176
+ for (const wt of candidates) {
177
+ process.stdout.write(renderOrphanPreamble(wt));
178
+ const accepted = await promptYesNo("Prune this worktree?");
179
+ if (accepted) {
180
+ confirmedPaths.push(wt.path);
181
+ } else {
182
+ skippedByUser += 1;
183
+ }
184
+ }
185
+ }
186
+ if (confirmedPaths.length === 0) {
187
+ cliOutput(
188
+ {
189
+ prunedCount: 0,
190
+ skippedCount: skippedByUser,
191
+ outcomes: [],
192
+ errors: [],
193
+ dryRun,
194
+ message: skippedByUser > 0 ? `Skipped ${skippedByUser} orphan(s) on user request.` : "No-op."
195
+ },
196
+ { command: "worktree-prune", operation: "worktree.prune" }
197
+ );
198
+ return;
199
+ }
200
+ await dispatchFromCli(
201
+ "mutate",
202
+ "worktree",
203
+ "prune",
204
+ {
205
+ dryRun,
206
+ paths: confirmedPaths,
207
+ ...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {},
208
+ ...idleDays !== void 0 && !Number.isNaN(idleDays) ? { idleDays } : {}
209
+ },
210
+ { command: "worktree-prune", operation: "worktree.prune" }
211
+ );
212
+ }
213
+ });
214
+ var destroyCommand = defineCommand({
215
+ meta: {
216
+ name: "destroy",
217
+ description: "Destroy the XDG worktree for a task, update audit log and sentinel index (T9805)."
218
+ },
219
+ args: {
220
+ taskId: {
221
+ type: "positional",
222
+ description: "The task ID whose worktree to destroy (e.g. T9805).",
223
+ required: true
224
+ },
225
+ force: {
226
+ type: "boolean",
227
+ description: "Force removal even when the worktree has uncommitted changes.",
228
+ default: false
229
+ },
230
+ reason: {
231
+ type: "string",
232
+ description: "Reason string recorded in the audit log (e.g. pr-merged, manual, idle-timeout)."
233
+ },
234
+ "keep-branch": {
235
+ type: "boolean",
236
+ description: "Do not delete the task branch after removing the worktree.",
237
+ default: false
238
+ }
239
+ },
240
+ async run({ args }) {
241
+ const rawTaskId = typeof args["taskId"] === "string" ? args["taskId"] : "";
242
+ if (rawTaskId.length === 0) {
243
+ cliError("Missing required positional: <taskId>.", 2);
244
+ process.exit(2);
245
+ return;
246
+ }
247
+ const reason = typeof args["reason"] === "string" && args["reason"].length > 0 ? args["reason"] : "manual";
248
+ await dispatchFromCli(
249
+ "mutate",
250
+ "worktree",
251
+ "destroy",
252
+ {
253
+ taskId: rawTaskId,
254
+ force: args["force"] === true,
255
+ deleteBranch: args["keep-branch"] !== true,
256
+ reason
257
+ },
258
+ { command: "worktree-destroy", operation: "worktree.destroy" }
259
+ );
260
+ }
261
+ });
262
+ var forceUnlockCommand = defineCommand({
263
+ meta: {
264
+ name: "force-unlock",
265
+ description: "Clear wedged lock state (.git/index.lock + git worktree unlock) for a task."
266
+ },
267
+ args: {
268
+ taskId: {
269
+ type: "positional",
270
+ description: "The task ID whose worktree should be force-unlocked (e.g. T9547).",
271
+ required: true
272
+ }
273
+ },
274
+ async run({ args }) {
275
+ const rawTaskId = typeof args["taskId"] === "string" ? args["taskId"] : "";
276
+ if (rawTaskId.length === 0) {
277
+ cliError("Missing required positional: <taskId>.", 2);
278
+ process.exit(2);
279
+ return;
280
+ }
281
+ await dispatchFromCli(
282
+ "mutate",
283
+ "worktree",
284
+ "forceUnlock",
285
+ { taskId: rawTaskId },
286
+ { command: "worktree-force-unlock", operation: "worktree.forceUnlock" }
287
+ );
288
+ }
289
+ });
290
+ var VALID_ADOPT_SOURCES = ["claude-agent", "manual", "adopted"];
291
+ var adoptCommand = defineCommand({
292
+ meta: {
293
+ name: "adopt",
294
+ description: "Register an externally-created worktree (e.g. Claude Code Agent isolation:worktree) in the CLEO SSoT so it surfaces in `cleo worktree list`."
295
+ },
296
+ args: {
297
+ path: {
298
+ type: "positional",
299
+ description: "Absolute or relative path to the worktree directory to adopt. For Claude Code Agent worktrees this is typically `.claude/worktrees/<sessionId>/`.",
300
+ required: true
301
+ },
302
+ source: {
303
+ type: "string",
304
+ description: `Source classification for this worktree (${VALID_ADOPT_SOURCES.join("|")}). Defaults to \`claude-agent\` for paths under \`.claude/worktrees/\`, else \`manual\`.`
305
+ },
306
+ "task-id": {
307
+ type: "string",
308
+ description: "Optional task ID to associate with this worktree. When omitted the command attempts to extract it from the branch name."
309
+ },
310
+ actor: {
311
+ type: "string",
312
+ description: "Override actor name written to the audit log."
313
+ },
314
+ recover: {
315
+ type: "boolean",
316
+ description: "After adopting, recover a partial ETIMEDOUT worktree by running pnpm install and clearing stale git locks.",
317
+ default: false
318
+ }
319
+ },
320
+ async run({ args }) {
321
+ const rawPath = typeof args["path"] === "string" ? args["path"] : "";
322
+ if (rawPath.length === 0) {
323
+ cliError("Missing required positional: <path>.", 2);
324
+ process.exit(2);
325
+ return;
326
+ }
327
+ const rawSource = typeof args["source"] === "string" ? args["source"] : void 0;
328
+ const source = rawSource !== void 0 && VALID_ADOPT_SOURCES.includes(rawSource) ? rawSource : void 0;
329
+ const rawTaskId = typeof args["task-id"] === "string" ? args["task-id"] : void 0;
330
+ const rawActor = typeof args["actor"] === "string" ? args["actor"] : void 0;
331
+ await dispatchFromCli(
332
+ "mutate",
333
+ "worktree",
334
+ "adopt",
335
+ {
336
+ worktreePath: rawPath,
337
+ ...source !== void 0 ? { source } : {},
338
+ ...rawTaskId !== void 0 ? { taskId: rawTaskId } : {},
339
+ ...rawActor !== void 0 ? { actor: rawActor } : {},
340
+ recover: args["recover"] === true
341
+ },
342
+ { command: "worktree-adopt", operation: "worktree.adopt" }
343
+ );
344
+ }
345
+ });
346
+ var worktreeCommand = defineCommand({
347
+ meta: {
348
+ name: "worktree",
349
+ description: "Inspect and manage CLEO-attached git worktrees. See `cleo worktree <subcommand> --help` for details."
350
+ },
351
+ subCommands: {
352
+ list: listCommand,
353
+ adopt: adoptCommand,
354
+ prune: pruneCommand,
355
+ destroy: destroyCommand,
356
+ "force-unlock": forceUnlockCommand
357
+ },
358
+ // Early-return when a subcommand was matched; citty still invokes the
359
+ // parent run() after the subcommand finishes which would otherwise
360
+ // append the help text to the subcommand's JSON envelope output
361
+ // (T9686-A bug A4).
362
+ async run({ cmd, rawArgs }) {
363
+ const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
364
+ if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
365
+ await showUsage(cmd);
366
+ }
367
+ });
368
+ export {
369
+ worktreeCommand
370
+ };
371
+ //# sourceMappingURL=worktree-FVQLORFY.js.map
@@ -0,0 +1,287 @@
1
+ (() => {
2
+ const _installed = Symbol.for('cleocode.cli.sqliteWarningFilter');
3
+ if (globalThis[_installed]) return;
4
+ globalThis[_installed] = true;
5
+ const _origEmitWarning = process.emitWarning;
6
+ process.emitWarning = function(warning, type, code, ctor) {
7
+ if (typeof warning === 'object' && warning.name === 'ExperimentalWarning' && typeof warning.message === 'string' && /SQLite is an experimental feature/i.test(warning.message)) {
8
+ return;
9
+ }
10
+ if (typeof warning === 'string' && /SQLite is an experimental feature/i.test(warning)) {
11
+ return;
12
+ }
13
+ return _origEmitWarning.call(process, warning, type, code, ctor);
14
+ };
15
+ })();
16
+ import {
17
+ errorResult,
18
+ handleErrorResult,
19
+ unsupportedOp,
20
+ wrapResult
21
+ } from "./chunk-XHRZ7OYZ.js";
22
+
23
+ // packages/cleo/src/dispatch/domains/worktree.ts
24
+ import {
25
+ adoptWorktree,
26
+ destroyWorktree,
27
+ forceUnlockWorktree,
28
+ getLogger,
29
+ getProjectRoot,
30
+ listWorktrees,
31
+ pruneOrphanedWorktreesByStatus,
32
+ recoverPartialWorktree
33
+ } from "@cleocode/core/internal";
34
+ var log = getLogger("domain:worktree");
35
+ var ALL_CATEGORIES = [
36
+ "active",
37
+ "stale",
38
+ "merged",
39
+ "orphan",
40
+ "locked"
41
+ ];
42
+ function coerceStatusFilter(value) {
43
+ if (value === void 0 || value === null) return void 0;
44
+ const raw = Array.isArray(value) ? value.filter((v) => typeof v === "string") : typeof value === "string" ? value.split(",").map((s) => s.trim()) : [];
45
+ const out = raw.filter(
46
+ (s) => ALL_CATEGORIES.includes(s)
47
+ );
48
+ return out.length > 0 ? out : void 0;
49
+ }
50
+ function coerceStringList(value) {
51
+ if (value === void 0 || value === null) return void 0;
52
+ if (Array.isArray(value)) {
53
+ const out = value.filter((v) => typeof v === "string");
54
+ return out.length > 0 ? out : void 0;
55
+ }
56
+ if (typeof value === "string") {
57
+ const parts = value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
58
+ return parts.length > 0 ? parts : void 0;
59
+ }
60
+ return void 0;
61
+ }
62
+ var WorktreeHandler = class {
63
+ /**
64
+ * Handle read-only worktree queries.
65
+ *
66
+ * Supported operations:
67
+ * - `list` — return a structured listing of every worktree with status
68
+ * classification. Params: `{ statusFilter?, staleDays? }`.
69
+ */
70
+ async query(operation, params) {
71
+ const startTime = Date.now();
72
+ try {
73
+ switch (operation) {
74
+ case "list": {
75
+ const opts = {
76
+ projectRoot: getProjectRoot(),
77
+ statusFilter: coerceStatusFilter(params?.["statusFilter"]),
78
+ staleDays: typeof params?.["staleDays"] === "number" ? params["staleDays"] : void 0
79
+ };
80
+ const result = await listWorktrees(opts);
81
+ return wrapResult(
82
+ result,
83
+ "query",
84
+ "worktree",
85
+ operation,
86
+ startTime
87
+ );
88
+ }
89
+ default:
90
+ return unsupportedOp("query", "worktree", operation, startTime);
91
+ }
92
+ } catch (err) {
93
+ log.error({ err, operation }, "WorktreeHandler query error");
94
+ return handleErrorResult("query", "worktree", operation, err, startTime);
95
+ }
96
+ }
97
+ /**
98
+ * Handle worktree mutations.
99
+ *
100
+ * Supported operations:
101
+ * - `adopt` — register an externally-created worktree in the SSoT. Params:
102
+ * `{ worktreePath, source?, taskId?, actor?, recover? }`. Returns an
103
+ * {@link AdoptWorktreeResult} envelope. (T9804)
104
+ * - `destroy` — explicitly destroy a single agent worktree. Params:
105
+ * `{ taskId, force?, deleteBranch?, reason? }`. Returns a
106
+ * {@link DestroyWorktreeResult} envelope (T9805).
107
+ * - `prune` — remove orphan/merged worktrees. Params:
108
+ * `{ dryRun?, staleDays?, idleDays?, paths?, actor? }`. Returns a
109
+ * {@link PruneOrphanedWorktreesResult} envelope.
110
+ * - `forceUnlock` — clear wedge state for a single worktree. Params:
111
+ * `{ taskId, actor? }`. Returns a {@link ForceUnlockWorktreeResult}.
112
+ *
113
+ * @task T9547
114
+ * @task T9804
115
+ * @task T9805
116
+ */
117
+ async mutate(operation, params) {
118
+ const startTime = Date.now();
119
+ try {
120
+ switch (operation) {
121
+ case "adopt": {
122
+ const worktreePath = params?.["worktreePath"];
123
+ if (typeof worktreePath !== "string" || worktreePath.length === 0) {
124
+ return errorResult(
125
+ "mutate",
126
+ "worktree",
127
+ operation,
128
+ "E_VALIDATION",
129
+ "Missing required param: worktreePath (pass the path to the worktree directory).",
130
+ startTime
131
+ );
132
+ }
133
+ const rawSource = params?.["source"];
134
+ const validSources = ["claude-agent", "manual", "adopted"];
135
+ const source = typeof rawSource === "string" && validSources.includes(rawSource) ? rawSource : void 0;
136
+ const rawTaskId = params?.["taskId"];
137
+ const taskId = rawTaskId === null ? null : typeof rawTaskId === "string" && rawTaskId.length > 0 ? rawTaskId : void 0;
138
+ const projectRoot = getProjectRoot();
139
+ const opts = {
140
+ projectRoot,
141
+ worktreePath,
142
+ ...source !== void 0 ? { source } : {},
143
+ ...taskId !== void 0 ? { taskId } : {},
144
+ ...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
145
+ };
146
+ const result = await adoptWorktree(opts);
147
+ if (result.success && params?.["recover"] === true) {
148
+ const recovery = recoverPartialWorktree(
149
+ projectRoot,
150
+ worktreePath,
151
+ result.data.taskId ?? taskId ?? "unknown"
152
+ );
153
+ const recoveredResult = recovery.success ? {
154
+ success: true,
155
+ data: {
156
+ ...result.data,
157
+ recovery
158
+ }
159
+ } : {
160
+ success: false,
161
+ error: {
162
+ code: "E_WORKTREE_RECOVERY_FAILED",
163
+ message: recovery.error ?? "Partial worktree recovery failed.",
164
+ fix: "Inspect the worktree, then rerun `cleo worktree adopt <path> --recover` after resolving the reported recovery error.",
165
+ details: { adopt: result.data, recovery }
166
+ }
167
+ };
168
+ return wrapResult(
169
+ recoveredResult,
170
+ "mutate",
171
+ "worktree",
172
+ operation,
173
+ startTime
174
+ );
175
+ }
176
+ return wrapResult(
177
+ result,
178
+ "mutate",
179
+ "worktree",
180
+ operation,
181
+ startTime
182
+ );
183
+ }
184
+ case "destroy": {
185
+ const taskId = params?.["taskId"];
186
+ if (typeof taskId !== "string" || taskId.length === 0) {
187
+ return errorResult(
188
+ "mutate",
189
+ "worktree",
190
+ operation,
191
+ "E_VALIDATION",
192
+ "Missing required param: taskId (e.g. T9805).",
193
+ startTime
194
+ );
195
+ }
196
+ const opts = {
197
+ taskId,
198
+ force: params?.["force"] === true,
199
+ deleteBranch: params?.["deleteBranch"] !== false,
200
+ ...typeof params?.["reason"] === "string" && params["reason"].length > 0 ? { reason: params["reason"] } : {}
201
+ };
202
+ const result = await destroyWorktree(getProjectRoot(), opts);
203
+ const engineResult = result.error !== void 0 ? {
204
+ success: false,
205
+ error: {
206
+ code: "E_DESTROY_FAILED",
207
+ message: result.error,
208
+ fix: "Check worktree state with `cleo worktree list`."
209
+ }
210
+ } : { success: true, data: result };
211
+ return wrapResult(
212
+ engineResult,
213
+ "mutate",
214
+ "worktree",
215
+ operation,
216
+ startTime
217
+ );
218
+ }
219
+ case "prune": {
220
+ const opts = {
221
+ projectRoot: getProjectRoot(),
222
+ dryRun: params?.["dryRun"] === true,
223
+ ...typeof params?.["staleDays"] === "number" ? { staleDays: params["staleDays"] } : {},
224
+ ...typeof params?.["idleDays"] === "number" ? { staleDays: params["idleDays"] } : {},
225
+ ...coerceStringList(params?.["paths"]) !== void 0 ? { paths: coerceStringList(params?.["paths"]) } : {},
226
+ ...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
227
+ };
228
+ const result = await pruneOrphanedWorktreesByStatus(opts);
229
+ return wrapResult(
230
+ result,
231
+ "mutate",
232
+ "worktree",
233
+ operation,
234
+ startTime
235
+ );
236
+ }
237
+ case "forceUnlock": {
238
+ const taskId = params?.["taskId"];
239
+ if (typeof taskId !== "string" || taskId.length === 0) {
240
+ return errorResult(
241
+ "mutate",
242
+ "worktree",
243
+ operation,
244
+ "E_VALIDATION",
245
+ "Missing required param: taskId (pass --task-id T####).",
246
+ startTime
247
+ );
248
+ }
249
+ const opts = {
250
+ projectRoot: getProjectRoot(),
251
+ taskId,
252
+ ...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
253
+ };
254
+ const result = await forceUnlockWorktree(opts);
255
+ return wrapResult(
256
+ result,
257
+ "mutate",
258
+ "worktree",
259
+ operation,
260
+ startTime
261
+ );
262
+ }
263
+ default:
264
+ return unsupportedOp("mutate", "worktree", operation, startTime);
265
+ }
266
+ } catch (err) {
267
+ log.error({ err, operation }, "WorktreeHandler mutate error");
268
+ return handleErrorResult("mutate", "worktree", operation, err, startTime);
269
+ }
270
+ }
271
+ /**
272
+ * Declare the operations this domain supports — feeds dispatch introspection
273
+ * and the `cleo --help` rendering pipeline.
274
+ *
275
+ * @returns Query/mutate operation lists.
276
+ */
277
+ getSupportedOperations() {
278
+ return {
279
+ query: ["list"],
280
+ mutate: ["adopt", "destroy", "prune", "forceUnlock"]
281
+ };
282
+ }
283
+ };
284
+ export {
285
+ WorktreeHandler
286
+ };
287
+ //# sourceMappingURL=worktree-ZJ6JTQNG.js.map