@namzu/cli 35.0.0 → 36.1.0

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 (1309) hide show
  1. package/CHANGELOG.md +764 -0
  2. package/README.md +160 -394
  3. package/assets/pal-blender-mcp.py +123 -0
  4. package/assets/pal-godot-mcp-pin.json +135 -0
  5. package/assets/pal-godot-mcp.cjs +418 -0
  6. package/dist/bin-main.d.ts +3 -0
  7. package/dist/bin-main.d.ts.map +1 -0
  8. package/dist/bin.d.ts +2 -1
  9. package/dist/bin.d.ts.map +1 -1
  10. package/dist/bin.js +85 -23
  11. package/dist/bin.js.map +6 -1
  12. package/dist/boot-narrative.d.ts +16 -0
  13. package/dist/boot-narrative.d.ts.map +1 -0
  14. package/dist/checkpoints/manifest.d.ts +107 -0
  15. package/dist/checkpoints/manifest.d.ts.map +1 -0
  16. package/dist/checkpoints/store.d.ts +280 -40
  17. package/dist/checkpoints/store.d.ts.map +1 -1
  18. package/dist/checkpoints/undo-plan.d.ts +83 -0
  19. package/dist/checkpoints/undo-plan.d.ts.map +1 -0
  20. package/dist/checkpoints/wrap.d.ts +4 -0
  21. package/dist/checkpoints/wrap.d.ts.map +1 -1
  22. package/dist/chunks/acp-5CWS2GLJ.js +13448 -0
  23. package/dist/chunks/acp-5CWS2GLJ.js.map +6 -0
  24. package/dist/chunks/activity-command-HK7YJTXV.js +262 -0
  25. package/dist/chunks/activity-command-HK7YJTXV.js.map +6 -0
  26. package/dist/chunks/add-ULH5DUNX.js +712 -0
  27. package/dist/chunks/add-ULH5DUNX.js.map +6 -0
  28. package/dist/chunks/agent-UEK2U3RE.js +87 -0
  29. package/dist/chunks/agent-UEK2U3RE.js.map +6 -0
  30. package/dist/chunks/agent-session-V7JRTODS.js +46 -0
  31. package/dist/chunks/agent-session-V7JRTODS.js.map +6 -0
  32. package/dist/chunks/archive-C4A3HPLF.js +84 -0
  33. package/dist/chunks/archive-C4A3HPLF.js.map +6 -0
  34. package/dist/chunks/bin-main-EEJHRDIC.js +126 -0
  35. package/dist/chunks/bin-main-EEJHRDIC.js.map +6 -0
  36. package/dist/chunks/browser-CRX4HM4C.js +31 -0
  37. package/dist/chunks/browser-CRX4HM4C.js.map +6 -0
  38. package/dist/chunks/chat-FVBATC4E.js +101 -0
  39. package/dist/chunks/chat-FVBATC4E.js.map +6 -0
  40. package/dist/chunks/chunk-2A37JQKY.js +1355 -0
  41. package/dist/chunks/chunk-2A37JQKY.js.map +6 -0
  42. package/dist/chunks/chunk-2NJ2XUXJ.js +283 -0
  43. package/dist/chunks/chunk-2NJ2XUXJ.js.map +6 -0
  44. package/dist/chunks/chunk-4HAE7PYX.js +74 -0
  45. package/dist/chunks/chunk-4HAE7PYX.js.map +6 -0
  46. package/dist/chunks/chunk-5GRV6P5C.js +69 -0
  47. package/dist/chunks/chunk-5GRV6P5C.js.map +6 -0
  48. package/dist/chunks/chunk-5PQVJBIO.js +168 -0
  49. package/dist/chunks/chunk-5PQVJBIO.js.map +6 -0
  50. package/dist/chunks/chunk-62I7HLAP.js +1142 -0
  51. package/dist/chunks/chunk-62I7HLAP.js.map +6 -0
  52. package/dist/chunks/chunk-63CGV3XY.js +161 -0
  53. package/dist/chunks/chunk-63CGV3XY.js.map +6 -0
  54. package/dist/chunks/chunk-6LLJQ3KY.js +225 -0
  55. package/dist/chunks/chunk-6LLJQ3KY.js.map +6 -0
  56. package/dist/chunks/chunk-6YG7D7U4.js +159 -0
  57. package/dist/chunks/chunk-6YG7D7U4.js.map +6 -0
  58. package/dist/chunks/chunk-76FLAFCG.js +51 -0
  59. package/dist/chunks/chunk-76FLAFCG.js.map +6 -0
  60. package/dist/chunks/chunk-7WJOQ6EA.js +106 -0
  61. package/dist/chunks/chunk-7WJOQ6EA.js.map +6 -0
  62. package/dist/chunks/chunk-A22MBIYU.js +42 -0
  63. package/dist/chunks/chunk-A22MBIYU.js.map +6 -0
  64. package/dist/chunks/chunk-A5DWGNGR.js +73 -0
  65. package/dist/chunks/chunk-A5DWGNGR.js.map +6 -0
  66. package/dist/chunks/chunk-A5UXODFL.js +76 -0
  67. package/dist/chunks/chunk-A5UXODFL.js.map +6 -0
  68. package/dist/chunks/chunk-AHIDYIRB.js +329 -0
  69. package/dist/chunks/chunk-AHIDYIRB.js.map +6 -0
  70. package/dist/chunks/chunk-AIY4PCDR.js +164 -0
  71. package/dist/chunks/chunk-AIY4PCDR.js.map +6 -0
  72. package/dist/chunks/chunk-AK2U3N2A.js +31 -0
  73. package/dist/chunks/chunk-AK2U3N2A.js.map +6 -0
  74. package/dist/chunks/chunk-AN7FO7NS.js +247 -0
  75. package/dist/chunks/chunk-AN7FO7NS.js.map +6 -0
  76. package/dist/chunks/chunk-AXIGFKJF.js +34 -0
  77. package/dist/chunks/chunk-AXIGFKJF.js.map +6 -0
  78. package/dist/chunks/chunk-C5WBEO3X.js +46 -0
  79. package/dist/chunks/chunk-C5WBEO3X.js.map +6 -0
  80. package/dist/chunks/chunk-C5XYHYMX.js +675 -0
  81. package/dist/chunks/chunk-C5XYHYMX.js.map +6 -0
  82. package/dist/chunks/chunk-CG65NUSJ.js +115 -0
  83. package/dist/chunks/chunk-CG65NUSJ.js.map +6 -0
  84. package/dist/chunks/chunk-CHIEVVQ2.js +32 -0
  85. package/dist/chunks/chunk-CHIEVVQ2.js.map +6 -0
  86. package/dist/chunks/chunk-E5VLANCO.js +101 -0
  87. package/dist/chunks/chunk-E5VLANCO.js.map +6 -0
  88. package/dist/chunks/chunk-EBOHVFOB.js +648 -0
  89. package/dist/chunks/chunk-EBOHVFOB.js.map +6 -0
  90. package/dist/chunks/chunk-EEDZOGV4.js +47 -0
  91. package/dist/chunks/chunk-EEDZOGV4.js.map +6 -0
  92. package/dist/chunks/chunk-EIYM6TY7.js +1479 -0
  93. package/dist/chunks/chunk-EIYM6TY7.js.map +6 -0
  94. package/dist/chunks/chunk-EWKJGHRO.js +82559 -0
  95. package/dist/chunks/chunk-EWKJGHRO.js.map +6 -0
  96. package/dist/chunks/chunk-EY7UNVER.js +311 -0
  97. package/dist/chunks/chunk-EY7UNVER.js.map +6 -0
  98. package/dist/chunks/chunk-FTMTO72X.js +95 -0
  99. package/dist/chunks/chunk-FTMTO72X.js.map +6 -0
  100. package/dist/chunks/chunk-FXS3AG6B.js +25326 -0
  101. package/dist/chunks/chunk-FXS3AG6B.js.map +6 -0
  102. package/dist/chunks/chunk-GIXSS6KW.js +2228 -0
  103. package/dist/chunks/chunk-GIXSS6KW.js.map +6 -0
  104. package/dist/chunks/chunk-GMCOZ3CU.js +245 -0
  105. package/dist/chunks/chunk-GMCOZ3CU.js.map +6 -0
  106. package/dist/chunks/chunk-GNBMKISG.js +19 -0
  107. package/dist/chunks/chunk-GNBMKISG.js.map +6 -0
  108. package/dist/chunks/chunk-GWQEMJFS.js +28 -0
  109. package/dist/chunks/chunk-GWQEMJFS.js.map +6 -0
  110. package/dist/chunks/chunk-H6B6AROX.js +151 -0
  111. package/dist/chunks/chunk-H6B6AROX.js.map +6 -0
  112. package/dist/chunks/chunk-HBBB2CAC.js +75 -0
  113. package/dist/chunks/chunk-HBBB2CAC.js.map +6 -0
  114. package/dist/chunks/chunk-HE7WUOX2.js +26 -0
  115. package/dist/chunks/chunk-HE7WUOX2.js.map +6 -0
  116. package/dist/chunks/chunk-HFJHHCTY.js +303 -0
  117. package/dist/chunks/chunk-HFJHHCTY.js.map +6 -0
  118. package/dist/chunks/chunk-HPMWYIBY.js +773 -0
  119. package/dist/chunks/chunk-HPMWYIBY.js.map +6 -0
  120. package/dist/chunks/chunk-HQM2WSQT.js +106 -0
  121. package/dist/chunks/chunk-HQM2WSQT.js.map +6 -0
  122. package/dist/chunks/chunk-ITZK4B66.js +787 -0
  123. package/dist/chunks/chunk-ITZK4B66.js.map +6 -0
  124. package/dist/chunks/chunk-J72CRUNX.js +154 -0
  125. package/dist/chunks/chunk-J72CRUNX.js.map +6 -0
  126. package/dist/chunks/chunk-JORONMD3.js +18 -0
  127. package/dist/chunks/chunk-JORONMD3.js.map +6 -0
  128. package/dist/chunks/chunk-JPPC4LJF.js +271 -0
  129. package/dist/chunks/chunk-JPPC4LJF.js.map +6 -0
  130. package/dist/chunks/chunk-JV3LONAU.js +76 -0
  131. package/dist/chunks/chunk-JV3LONAU.js.map +6 -0
  132. package/dist/chunks/chunk-K76WV7TN.js +71 -0
  133. package/dist/chunks/chunk-K76WV7TN.js.map +6 -0
  134. package/dist/chunks/chunk-KCWUQRZV.js +828 -0
  135. package/dist/chunks/chunk-KCWUQRZV.js.map +6 -0
  136. package/dist/chunks/chunk-KONYGNG6.js +7661 -0
  137. package/dist/chunks/chunk-KONYGNG6.js.map +6 -0
  138. package/dist/chunks/chunk-KU3W6IHV.js +109 -0
  139. package/dist/chunks/chunk-KU3W6IHV.js.map +6 -0
  140. package/dist/chunks/chunk-LQMHASKR.js +171 -0
  141. package/dist/chunks/chunk-LQMHASKR.js.map +6 -0
  142. package/dist/chunks/chunk-LXB3S4IC.js +19 -0
  143. package/dist/chunks/chunk-LXB3S4IC.js.map +6 -0
  144. package/dist/chunks/chunk-MZP6SH3M.js +3497 -0
  145. package/dist/chunks/chunk-MZP6SH3M.js.map +6 -0
  146. package/dist/chunks/chunk-N5IF64K3.js +1858 -0
  147. package/dist/chunks/chunk-N5IF64K3.js.map +6 -0
  148. package/dist/chunks/chunk-NADQQMMG.js +46 -0
  149. package/dist/chunks/chunk-NADQQMMG.js.map +6 -0
  150. package/dist/chunks/chunk-NQY5P2EB.js +20 -0
  151. package/dist/chunks/chunk-NQY5P2EB.js.map +6 -0
  152. package/dist/chunks/chunk-NUGPLXVK.js +228 -0
  153. package/dist/chunks/chunk-NUGPLXVK.js.map +6 -0
  154. package/dist/chunks/chunk-O7DBCVNY.js +110 -0
  155. package/dist/chunks/chunk-O7DBCVNY.js.map +6 -0
  156. package/dist/chunks/chunk-OEW7CJKK.js +140 -0
  157. package/dist/chunks/chunk-OEW7CJKK.js.map +6 -0
  158. package/dist/chunks/chunk-OH6TB27S.js +111 -0
  159. package/dist/chunks/chunk-OH6TB27S.js.map +6 -0
  160. package/dist/chunks/chunk-OLPOM3DR.js +127 -0
  161. package/dist/chunks/chunk-OLPOM3DR.js.map +6 -0
  162. package/dist/chunks/chunk-PYG7DZ2D.js +380 -0
  163. package/dist/chunks/chunk-PYG7DZ2D.js.map +6 -0
  164. package/dist/chunks/chunk-Q24K7536.js +661 -0
  165. package/dist/chunks/chunk-Q24K7536.js.map +6 -0
  166. package/dist/chunks/chunk-Q5YM2GCX.js +283 -0
  167. package/dist/chunks/chunk-Q5YM2GCX.js.map +6 -0
  168. package/dist/chunks/chunk-R7DCDBRN.js +106 -0
  169. package/dist/chunks/chunk-R7DCDBRN.js.map +6 -0
  170. package/dist/chunks/chunk-RC6X3ZY6.js +1439 -0
  171. package/dist/chunks/chunk-RC6X3ZY6.js.map +6 -0
  172. package/dist/chunks/chunk-SGS435PR.js +11111 -0
  173. package/dist/chunks/chunk-SGS435PR.js.map +6 -0
  174. package/dist/chunks/chunk-SKKWMMFP.js +474 -0
  175. package/dist/chunks/chunk-SKKWMMFP.js.map +6 -0
  176. package/dist/chunks/chunk-SRU3MDHZ.js +75 -0
  177. package/dist/chunks/chunk-SRU3MDHZ.js.map +6 -0
  178. package/dist/chunks/chunk-TBIX6JRE.js +24 -0
  179. package/dist/chunks/chunk-TBIX6JRE.js.map +6 -0
  180. package/dist/chunks/chunk-THNCQJ33.js +11265 -0
  181. package/dist/chunks/chunk-THNCQJ33.js.map +6 -0
  182. package/dist/chunks/chunk-THZXXVHM.js +2953 -0
  183. package/dist/chunks/chunk-THZXXVHM.js.map +6 -0
  184. package/dist/chunks/chunk-TIGWWAJI.js +765 -0
  185. package/dist/chunks/chunk-TIGWWAJI.js.map +6 -0
  186. package/dist/chunks/chunk-UDBEU2FR.js +97 -0
  187. package/dist/chunks/chunk-UDBEU2FR.js.map +6 -0
  188. package/dist/chunks/chunk-UOOQPODR.js +257 -0
  189. package/dist/chunks/chunk-UOOQPODR.js.map +6 -0
  190. package/dist/chunks/chunk-US5ZFPAU.js +400 -0
  191. package/dist/chunks/chunk-US5ZFPAU.js.map +6 -0
  192. package/dist/chunks/chunk-UWWGSDZ5.js +134 -0
  193. package/dist/chunks/chunk-UWWGSDZ5.js.map +6 -0
  194. package/dist/chunks/chunk-UXVYJWN5.js +1373 -0
  195. package/dist/chunks/chunk-UXVYJWN5.js.map +6 -0
  196. package/dist/chunks/chunk-V7TQR6AR.js +818 -0
  197. package/dist/chunks/chunk-V7TQR6AR.js.map +6 -0
  198. package/dist/chunks/chunk-VRL2WNQN.js +7534 -0
  199. package/dist/chunks/chunk-VRL2WNQN.js.map +6 -0
  200. package/dist/chunks/chunk-WATMFOHB.js +319 -0
  201. package/dist/chunks/chunk-WATMFOHB.js.map +6 -0
  202. package/dist/chunks/chunk-WHODOMXA.js +132 -0
  203. package/dist/chunks/chunk-WHODOMXA.js.map +6 -0
  204. package/dist/chunks/chunk-WM2JEUGV.js +207 -0
  205. package/dist/chunks/chunk-WM2JEUGV.js.map +6 -0
  206. package/dist/chunks/chunk-XEUQN4JC.js +54 -0
  207. package/dist/chunks/chunk-XEUQN4JC.js.map +6 -0
  208. package/dist/chunks/chunk-XHOD3RDN.js +517 -0
  209. package/dist/chunks/chunk-XHOD3RDN.js.map +6 -0
  210. package/dist/chunks/chunk-Y7B67G22.js +26 -0
  211. package/dist/chunks/chunk-Y7B67G22.js.map +6 -0
  212. package/dist/chunks/chunk-ZKEWE6K4.js +399 -0
  213. package/dist/chunks/chunk-ZKEWE6K4.js.map +6 -0
  214. package/dist/chunks/chunk-ZPR4IMRT.js +36 -0
  215. package/dist/chunks/chunk-ZPR4IMRT.js.map +6 -0
  216. package/dist/chunks/chunk-ZWA2JRJV.js +45 -0
  217. package/dist/chunks/chunk-ZWA2JRJV.js.map +6 -0
  218. package/dist/chunks/cli-runtime-7YAOEJGS.js +129 -0
  219. package/dist/chunks/cli-runtime-7YAOEJGS.js.map +6 -0
  220. package/dist/chunks/commands-QPVRB3RK.js +21 -0
  221. package/dist/chunks/commands-QPVRB3RK.js.map +6 -0
  222. package/dist/chunks/computer-GXDY4H35.js +493 -0
  223. package/dist/chunks/computer-GXDY4H35.js.map +6 -0
  224. package/dist/chunks/crash-report-S3BTEPYR.js +21 -0
  225. package/dist/chunks/crash-report-S3BTEPYR.js.map +6 -0
  226. package/dist/chunks/devtools-LBE4PAQN.js +3851 -0
  227. package/dist/chunks/devtools-LBE4PAQN.js.map +6 -0
  228. package/dist/chunks/dist-3GJFRS2X.js +520 -0
  229. package/dist/chunks/dist-3GJFRS2X.js.map +6 -0
  230. package/dist/chunks/dist-BFC7XUCT.js +555 -0
  231. package/dist/chunks/dist-BFC7XUCT.js.map +6 -0
  232. package/dist/chunks/dist-ERN5DRKK.js +1415 -0
  233. package/dist/chunks/dist-ERN5DRKK.js.map +6 -0
  234. package/dist/chunks/dist-EY3OJBQH.js +1339 -0
  235. package/dist/chunks/dist-EY3OJBQH.js.map +6 -0
  236. package/dist/chunks/dist-G42HPNIE.js +514 -0
  237. package/dist/chunks/dist-G42HPNIE.js.map +6 -0
  238. package/dist/chunks/dist-SKRHHPUR.js +1018 -0
  239. package/dist/chunks/dist-SKRHHPUR.js.map +6 -0
  240. package/dist/chunks/dist-Z47L7ZAJ.js +40654 -0
  241. package/dist/chunks/dist-Z47L7ZAJ.js.map +6 -0
  242. package/dist/chunks/doctor-IE3PLXZK.js +28 -0
  243. package/dist/chunks/doctor-IE3PLXZK.js.map +6 -0
  244. package/dist/chunks/drain-ESXUKOE6.js +471 -0
  245. package/dist/chunks/drain-ESXUKOE6.js.map +6 -0
  246. package/dist/chunks/endpoint-M2DDENPP.js +15 -0
  247. package/dist/chunks/endpoint-M2DDENPP.js.map +6 -0
  248. package/dist/chunks/eval-53UONRWR.js +187 -0
  249. package/dist/chunks/eval-53UONRWR.js.map +6 -0
  250. package/dist/chunks/exec-COV235L5.js +1284 -0
  251. package/dist/chunks/exec-COV235L5.js.map +6 -0
  252. package/dist/chunks/home-QS7RBP34.js +16 -0
  253. package/dist/chunks/home-QS7RBP34.js.map +6 -0
  254. package/dist/chunks/host-queries-LDEBHKBX.js +152 -0
  255. package/dist/chunks/host-queries-LDEBHKBX.js.map +6 -0
  256. package/dist/chunks/lib-KXZZJJG2.js +2657 -0
  257. package/dist/chunks/lib-KXZZJJG2.js.map +6 -0
  258. package/dist/chunks/lifecycle-6NF6NJNV.js +63 -0
  259. package/dist/chunks/lifecycle-6NF6NJNV.js.map +6 -0
  260. package/dist/chunks/list-DQZU7NEF.js +293 -0
  261. package/dist/chunks/list-DQZU7NEF.js.map +6 -0
  262. package/dist/chunks/login-IQGNP5XY.js +29 -0
  263. package/dist/chunks/login-IQGNP5XY.js.map +6 -0
  264. package/dist/chunks/logs-KSG7SFAB.js +116 -0
  265. package/dist/chunks/logs-KSG7SFAB.js.map +6 -0
  266. package/dist/chunks/mcp-WFXKXGNM.js +763 -0
  267. package/dist/chunks/mcp-WFXKXGNM.js.map +6 -0
  268. package/dist/chunks/message-command-O7ZH4I4C.js +170 -0
  269. package/dist/chunks/message-command-O7ZH4I4C.js.map +6 -0
  270. package/dist/chunks/node-QB2FA2ZB.js +916 -0
  271. package/dist/chunks/node-QB2FA2ZB.js.map +6 -0
  272. package/dist/chunks/operator-tools-LTPV3CH5.js +115 -0
  273. package/dist/chunks/operator-tools-LTPV3CH5.js.map +6 -0
  274. package/dist/chunks/output-schema-UM3P5AOR.js +11 -0
  275. package/dist/chunks/output-schema-UM3P5AOR.js.map +6 -0
  276. package/dist/chunks/pal-GBYJHBP3.js +200 -0
  277. package/dist/chunks/pal-GBYJHBP3.js.map +6 -0
  278. package/dist/chunks/paths-DXYFKIJU.js +10 -0
  279. package/dist/chunks/paths-DXYFKIJU.js.map +6 -0
  280. package/dist/chunks/pica-WNHDDIFX.js +1736 -0
  281. package/dist/chunks/pica-WNHDDIFX.js.map +6 -0
  282. package/dist/chunks/providers-J42J2PDA.js +160 -0
  283. package/dist/chunks/providers-J42J2PDA.js.map +6 -0
  284. package/dist/chunks/resident-7D6IM5LP.js +1314 -0
  285. package/dist/chunks/resident-7D6IM5LP.js.map +6 -0
  286. package/dist/chunks/resume-command-XZWGUXRK.js +22 -0
  287. package/dist/chunks/resume-command-XZWGUXRK.js.map +6 -0
  288. package/dist/chunks/schedule-JLIOF3MS.js +143 -0
  289. package/dist/chunks/schedule-JLIOF3MS.js.map +6 -0
  290. package/dist/chunks/serve-S7UWNIR3.js +21 -0
  291. package/dist/chunks/serve-S7UWNIR3.js.map +6 -0
  292. package/dist/chunks/service-YBU5VTKQ.js +1633 -0
  293. package/dist/chunks/service-YBU5VTKQ.js.map +6 -0
  294. package/dist/chunks/session-step-2HJSIJNN.js +26 -0
  295. package/dist/chunks/session-step-2HJSIJNN.js.map +6 -0
  296. package/dist/chunks/skills-HV2MOBEW.js +282 -0
  297. package/dist/chunks/skills-HV2MOBEW.js.map +6 -0
  298. package/dist/chunks/state-6HV3D3O4.js +717 -0
  299. package/dist/chunks/state-6HV3D3O4.js.map +6 -0
  300. package/dist/chunks/store-6J2MUGON.js +82 -0
  301. package/dist/chunks/store-6J2MUGON.js.map +6 -0
  302. package/dist/chunks/store-GDP2EW27.js +34 -0
  303. package/dist/chunks/store-GDP2EW27.js.map +6 -0
  304. package/dist/chunks/store-VXNKMMNW.js +42 -0
  305. package/dist/chunks/store-VXNKMMNW.js.map +6 -0
  306. package/dist/chunks/tui-DDWX2WYH.js +56903 -0
  307. package/dist/chunks/tui-DDWX2WYH.js.map +6 -0
  308. package/dist/chunks/upgrade-MC5JB7DK.js +315 -0
  309. package/dist/chunks/upgrade-MC5JB7DK.js.map +6 -0
  310. package/dist/chunks/webapi-6HUHZUAH.js +2715 -0
  311. package/dist/chunks/webapi-6HUHZUAH.js.map +6 -0
  312. package/dist/chunks/worktree-6YPRX6SU.js +116 -0
  313. package/dist/chunks/worktree-6YPRX6SU.js.map +6 -0
  314. package/dist/cli-runtime.d.ts +19 -0
  315. package/dist/cli-runtime.d.ts.map +1 -0
  316. package/dist/cli.d.ts +0 -15
  317. package/dist/cli.d.ts.map +1 -1
  318. package/dist/commands/acp-harness.d.ts +64 -0
  319. package/dist/commands/acp-harness.d.ts.map +1 -0
  320. package/dist/commands/acp-provider-retry.d.ts +27 -0
  321. package/dist/commands/acp-provider-retry.d.ts.map +1 -0
  322. package/dist/commands/acp.d.ts +134 -3
  323. package/dist/commands/acp.d.ts.map +1 -1
  324. package/dist/commands/computer.d.ts +3 -0
  325. package/dist/commands/computer.d.ts.map +1 -0
  326. package/dist/commands/desktop-host-changes.d.ts +65 -0
  327. package/dist/commands/desktop-host-changes.d.ts.map +1 -0
  328. package/dist/commands/desktop-host-header.d.ts +30 -0
  329. package/dist/commands/desktop-host-header.d.ts.map +1 -0
  330. package/dist/commands/desktop-host.d.ts +354 -0
  331. package/dist/commands/desktop-host.d.ts.map +1 -0
  332. package/dist/commands/desktop-model-catalogue.d.ts +25 -0
  333. package/dist/commands/desktop-model-catalogue.d.ts.map +1 -0
  334. package/dist/commands/effort-levels.d.ts +3 -0
  335. package/dist/commands/effort-levels.d.ts.map +1 -0
  336. package/dist/commands/exec-flags.d.ts +4 -0
  337. package/dist/commands/exec-flags.d.ts.map +1 -1
  338. package/dist/commands/exec.d.ts.map +1 -1
  339. package/dist/commands/lazy.d.ts +20 -0
  340. package/dist/commands/lazy.d.ts.map +1 -0
  341. package/dist/commands/manifest.d.ts +33 -0
  342. package/dist/commands/manifest.d.ts.map +1 -0
  343. package/dist/commands/pal.d.ts +5 -0
  344. package/dist/commands/pal.d.ts.map +1 -0
  345. package/dist/commands/permission-preview.d.ts +38 -0
  346. package/dist/commands/permission-preview.d.ts.map +1 -0
  347. package/dist/commands/registry.d.ts +10 -0
  348. package/dist/commands/registry.d.ts.map +1 -1
  349. package/dist/commands/serve.d.ts +1 -12
  350. package/dist/commands/serve.d.ts.map +1 -1
  351. package/dist/commands/stdin.d.ts.map +1 -1
  352. package/dist/commands/upgrade.d.ts +14 -0
  353. package/dist/commands/upgrade.d.ts.map +1 -1
  354. package/dist/compile-cache-enable.d.ts +2 -0
  355. package/dist/compile-cache-enable.d.ts.map +1 -0
  356. package/dist/compile-cache.d.ts +53 -0
  357. package/dist/compile-cache.d.ts.map +1 -0
  358. package/dist/computer/bundle.d.ts +18 -0
  359. package/dist/computer/bundle.d.ts.map +1 -0
  360. package/dist/computer/run.d.ts +26 -0
  361. package/dist/computer/run.d.ts.map +1 -0
  362. package/dist/computer/sentences.d.ts +30 -0
  363. package/dist/computer/sentences.d.ts.map +1 -0
  364. package/dist/config/load.d.ts +10 -1
  365. package/dist/config/load.d.ts.map +1 -1
  366. package/dist/context/capabilities.d.ts +25 -2
  367. package/dist/context/capabilities.d.ts.map +1 -1
  368. package/dist/context/runtime-message.d.ts.map +1 -1
  369. package/dist/crash-report.d.ts +22 -0
  370. package/dist/crash-report.d.ts.map +1 -0
  371. package/dist/debug-requested.d.ts +7 -0
  372. package/dist/debug-requested.d.ts.map +1 -0
  373. package/dist/doctor/checks/credentials.d.ts.map +1 -1
  374. package/dist/exit-codes.d.ts +9 -1
  375. package/dist/exit-codes.d.ts.map +1 -1
  376. package/dist/index.js +105 -17
  377. package/dist/index.js.map +6 -1
  378. package/dist/integrations/harness/claude-adapter.d.ts +20 -0
  379. package/dist/integrations/harness/claude-adapter.d.ts.map +1 -0
  380. package/dist/integrations/harness/claude-protocol.d.ts +67 -0
  381. package/dist/integrations/harness/claude-protocol.d.ts.map +1 -0
  382. package/dist/integrations/harness/codex-adapter.d.ts +80 -0
  383. package/dist/integrations/harness/codex-adapter.d.ts.map +1 -0
  384. package/dist/integrations/harness/codex-protocol.d.ts +22 -0
  385. package/dist/integrations/harness/codex-protocol.d.ts.map +1 -0
  386. package/dist/integrations/harness/model-cache.d.ts +16 -0
  387. package/dist/integrations/harness/model-cache.d.ts.map +1 -0
  388. package/dist/integrations/harness/native-executable.d.ts +8 -0
  389. package/dist/integrations/harness/native-executable.d.ts.map +1 -0
  390. package/dist/integrations/harness/process.d.ts +25 -0
  391. package/dist/integrations/harness/process.d.ts.map +1 -0
  392. package/dist/integrations/peers/runtime.d.ts +64 -0
  393. package/dist/integrations/peers/runtime.d.ts.map +1 -0
  394. package/dist/integrations/plugins/inventory.d.ts +27 -0
  395. package/dist/integrations/plugins/inventory.d.ts.map +1 -0
  396. package/dist/integrations/providers/composer-settings.d.ts +33 -0
  397. package/dist/integrations/providers/composer-settings.d.ts.map +1 -0
  398. package/dist/integrations/providers/connections.d.ts +37 -0
  399. package/dist/integrations/providers/connections.d.ts.map +1 -0
  400. package/dist/integrations/providers/credential-store.d.ts +35 -0
  401. package/dist/integrations/providers/credential-store.d.ts.map +1 -1
  402. package/dist/integrations/providers/discover.d.ts +27 -1
  403. package/dist/integrations/providers/discover.d.ts.map +1 -1
  404. package/dist/integrations/providers/index.d.ts +2 -2
  405. package/dist/integrations/providers/index.d.ts.map +1 -1
  406. package/dist/integrations/providers/picker-operation.d.ts +6 -0
  407. package/dist/integrations/providers/picker-operation.d.ts.map +1 -0
  408. package/dist/integrations/providers/setup.d.ts +16 -1
  409. package/dist/integrations/providers/setup.d.ts.map +1 -1
  410. package/dist/integrations/resident/runner-worker.js +190 -161
  411. package/dist/integrations/resident/runner-worker.js.map +6 -1
  412. package/dist/integrations/sessions/display-title.d.ts +8 -0
  413. package/dist/integrations/sessions/display-title.d.ts.map +1 -1
  414. package/dist/integrations/sessions/store.d.ts +23 -9
  415. package/dist/integrations/sessions/store.d.ts.map +1 -1
  416. package/dist/integrations/sessions/task-context.d.ts +1 -1
  417. package/dist/integrations/sessions/task-context.d.ts.map +1 -1
  418. package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
  419. package/dist/integrations/subagents/activity.d.ts +9 -6
  420. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  421. package/dist/integrations/subagents/operator-journal.d.ts +20 -0
  422. package/dist/integrations/subagents/operator-journal.d.ts.map +1 -0
  423. package/dist/integrations/subagents/runtime.d.ts +11 -0
  424. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  425. package/dist/integrations/trust/store.d.ts +14 -0
  426. package/dist/integrations/trust/store.d.ts.map +1 -1
  427. package/dist/integrations/web/search.d.ts +1 -1
  428. package/dist/pals/actions.d.ts +57 -0
  429. package/dist/pals/actions.d.ts.map +1 -0
  430. package/dist/pals/activity-command.d.ts +3 -0
  431. package/dist/pals/activity-command.d.ts.map +1 -0
  432. package/dist/pals/activity.d.ts +18 -0
  433. package/dist/pals/activity.d.ts.map +1 -0
  434. package/dist/pals/agent-session.d.ts +19 -0
  435. package/dist/pals/agent-session.d.ts.map +1 -0
  436. package/dist/pals/channel-actions.d.ts +5 -0
  437. package/dist/pals/channel-actions.d.ts.map +1 -0
  438. package/dist/pals/channel-local.d.ts +7 -0
  439. package/dist/pals/channel-local.d.ts.map +1 -0
  440. package/dist/pals/channel.d.ts +20 -0
  441. package/dist/pals/channel.d.ts.map +1 -0
  442. package/dist/pals/chat.d.ts +6 -0
  443. package/dist/pals/chat.d.ts.map +1 -0
  444. package/dist/pals/communication.d.ts +47 -0
  445. package/dist/pals/communication.d.ts.map +1 -0
  446. package/dist/pals/conversations.d.ts +26 -0
  447. package/dist/pals/conversations.d.ts.map +1 -0
  448. package/dist/pals/desktop-communication.d.ts +111 -0
  449. package/dist/pals/desktop-communication.d.ts.map +1 -0
  450. package/dist/pals/dispatch.d.ts +13 -0
  451. package/dist/pals/dispatch.d.ts.map +1 -0
  452. package/dist/pals/environment.d.ts +103 -0
  453. package/dist/pals/environment.d.ts.map +1 -0
  454. package/dist/pals/guest-mcp-transport.d.ts +28 -0
  455. package/dist/pals/guest-mcp-transport.d.ts.map +1 -0
  456. package/dist/pals/guest-mcp.d.ts +22 -0
  457. package/dist/pals/guest-mcp.d.ts.map +1 -0
  458. package/dist/pals/inbox-start.d.ts +35 -0
  459. package/dist/pals/inbox-start.d.ts.map +1 -0
  460. package/dist/pals/message-command.d.ts +3 -0
  461. package/dist/pals/message-command.d.ts.map +1 -0
  462. package/dist/pals/operator-tools.d.ts +23 -0
  463. package/dist/pals/operator-tools.d.ts.map +1 -0
  464. package/dist/pals/public-transcript.d.ts +4 -0
  465. package/dist/pals/public-transcript.d.ts.map +1 -0
  466. package/dist/pals/review.d.ts +16 -0
  467. package/dist/pals/review.d.ts.map +1 -0
  468. package/dist/pals/store.d.ts +16 -0
  469. package/dist/pals/store.d.ts.map +1 -0
  470. package/dist/pals/tui-session.d.ts +11 -0
  471. package/dist/pals/tui-session.d.ts.map +1 -0
  472. package/dist/permissions/mode-names.d.ts +2 -0
  473. package/dist/permissions/mode-names.d.ts.map +1 -0
  474. package/dist/resume-invocation.d.ts +1 -1
  475. package/dist/resume-invocation.d.ts.map +1 -1
  476. package/dist/resume-shell.d.ts +8 -0
  477. package/dist/resume-shell.d.ts.map +1 -0
  478. package/dist/schedule/build.d.ts +12 -3
  479. package/dist/schedule/build.d.ts.map +1 -1
  480. package/dist/schedule/commands/add.d.ts +1 -1
  481. package/dist/schedule/commands/add.d.ts.map +1 -1
  482. package/dist/schedule/commands/lifecycle.d.ts.map +1 -1
  483. package/dist/schedule/commands/list.d.ts +3 -1
  484. package/dist/schedule/commands/list.d.ts.map +1 -1
  485. package/dist/schedule/daemon/daemon.d.ts +2 -0
  486. package/dist/schedule/daemon/daemon.d.ts.map +1 -1
  487. package/dist/schedule/delivery.d.ts +66 -0
  488. package/dist/schedule/delivery.d.ts.map +1 -0
  489. package/dist/schedule/fire/fire.d.ts +1 -1
  490. package/dist/schedule/fire/fire.d.ts.map +1 -1
  491. package/dist/schedule/fire/run-script.d.ts +2 -2
  492. package/dist/schedule/fire/run-script.d.ts.map +1 -1
  493. package/dist/schedule/fire/script-report.d.ts +31 -0
  494. package/dist/schedule/fire/script-report.d.ts.map +1 -0
  495. package/dist/schedule/floor.d.ts +1 -1
  496. package/dist/schedule/floor.d.ts.map +1 -1
  497. package/dist/schedule/folder.d.ts +6 -0
  498. package/dist/schedule/folder.d.ts.map +1 -1
  499. package/dist/schedule/resume-command.d.ts +3 -3
  500. package/dist/schedule/resume-command.d.ts.map +1 -1
  501. package/dist/schedule/store/history.d.ts.map +1 -1
  502. package/dist/schedule/store/jobs.d.ts +6 -6
  503. package/dist/schedule/store/jobs.d.ts.map +1 -1
  504. package/dist/schedule/store/script-state.d.ts +31 -0
  505. package/dist/schedule/store/script-state.d.ts.map +1 -0
  506. package/dist/schedule/store/state.d.ts +4 -2
  507. package/dist/schedule/store/state.d.ts.map +1 -1
  508. package/dist/schedule/types.d.ts +61 -16
  509. package/dist/schedule/types.d.ts.map +1 -1
  510. package/dist/skills/store.d.ts.map +1 -1
  511. package/dist/terminal/host.d.ts +22 -0
  512. package/dist/terminal/host.d.ts.map +1 -0
  513. package/dist/terminal/manager.d.ts +124 -0
  514. package/dist/terminal/manager.d.ts.map +1 -0
  515. package/dist/terminal/protocol.d.ts +162 -0
  516. package/dist/terminal/protocol.d.ts.map +1 -0
  517. package/dist/terminal/pty.d.ts +85 -0
  518. package/dist/terminal/pty.d.ts.map +1 -0
  519. package/dist/terminal/ring.d.ts +23 -0
  520. package/dist/terminal/ring.d.ts.map +1 -0
  521. package/dist/terminal/screen.d.ts +31 -0
  522. package/dist/terminal/screen.d.ts.map +1 -0
  523. package/dist/termination-state.d.ts +19 -0
  524. package/dist/termination-state.d.ts.map +1 -0
  525. package/dist/termination.d.ts +2 -9
  526. package/dist/termination.d.ts.map +1 -1
  527. package/dist/tui/AgentExplorer.d.ts +4 -1
  528. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  529. package/dist/tui/App.d.ts.map +1 -1
  530. package/dist/tui/BackgroundJobsPanel.d.ts.map +1 -1
  531. package/dist/tui/BrandHeader.d.ts.map +1 -1
  532. package/dist/tui/ChildComposer.d.ts +22 -0
  533. package/dist/tui/ChildComposer.d.ts.map +1 -0
  534. package/dist/tui/ChoicePicker.d.ts.map +1 -1
  535. package/dist/tui/Composer.d.ts +21 -3
  536. package/dist/tui/Composer.d.ts.map +1 -1
  537. package/dist/tui/ComposerFrame.d.ts.map +1 -1
  538. package/dist/tui/CopyPicker.d.ts.map +1 -1
  539. package/dist/tui/EditPromptPicker.d.ts.map +1 -1
  540. package/dist/tui/EffortSlider.d.ts.map +1 -1
  541. package/dist/tui/LiveActivity.d.ts +7 -1
  542. package/dist/tui/LiveActivity.d.ts.map +1 -1
  543. package/dist/tui/Markdown.d.ts.map +1 -1
  544. package/dist/tui/PendingInputPanel.d.ts.map +1 -1
  545. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  546. package/dist/tui/Picker.d.ts.map +1 -1
  547. package/dist/tui/ProviderSetup.d.ts.map +1 -1
  548. package/dist/tui/ResumePicker.d.ts.map +1 -1
  549. package/dist/tui/SaveSkillOverlay.d.ts.map +1 -1
  550. package/dist/tui/ScheduleReviewOverlay.d.ts +1 -1
  551. package/dist/tui/ScheduleReviewOverlay.d.ts.map +1 -1
  552. package/dist/tui/StatusBar.d.ts +7 -1
  553. package/dist/tui/StatusBar.d.ts.map +1 -1
  554. package/dist/tui/StatusPanel.d.ts.map +1 -1
  555. package/dist/tui/TextPrompt.d.ts.map +1 -1
  556. package/dist/tui/ToolOutputViewer.d.ts.map +1 -1
  557. package/dist/tui/Transcript.d.ts +3 -0
  558. package/dist/tui/Transcript.d.ts.map +1 -1
  559. package/dist/tui/TranscriptScrollView.d.ts +23 -0
  560. package/dist/tui/TranscriptScrollView.d.ts.map +1 -0
  561. package/dist/tui/TrustPrompt.d.ts +8 -0
  562. package/dist/tui/TrustPrompt.d.ts.map +1 -1
  563. package/dist/tui/agent.d.ts +125 -3
  564. package/dist/tui/agent.d.ts.map +1 -1
  565. package/dist/tui/browser-notices.d.ts.map +1 -1
  566. package/dist/tui/capability-notice.d.ts +38 -0
  567. package/dist/tui/capability-notice.d.ts.map +1 -0
  568. package/dist/tui/console-input.d.ts +31 -0
  569. package/dist/tui/console-input.d.ts.map +1 -0
  570. package/dist/tui/conversation-evidence-view.d.ts.map +1 -1
  571. package/dist/tui/credential-entry.d.ts.map +1 -1
  572. package/dist/tui/exit-summary.d.ts +9 -1
  573. package/dist/tui/exit-summary.d.ts.map +1 -1
  574. package/dist/tui/external-editor.d.ts.map +1 -1
  575. package/dist/tui/index.d.ts.map +1 -1
  576. package/dist/tui/key-hints.d.ts +51 -0
  577. package/dist/tui/key-hints.d.ts.map +1 -0
  578. package/dist/tui/launch-settings.d.ts +34 -0
  579. package/dist/tui/launch-settings.d.ts.map +1 -0
  580. package/dist/tui/log-pane.d.ts.map +1 -1
  581. package/dist/tui/model-choices.d.ts +39 -1
  582. package/dist/tui/model-choices.d.ts.map +1 -1
  583. package/dist/tui/model-search.d.ts +4 -1
  584. package/dist/tui/model-search.d.ts.map +1 -1
  585. package/dist/tui/output-size-watch.d.ts +32 -0
  586. package/dist/tui/output-size-watch.d.ts.map +1 -0
  587. package/dist/tui/permission-review.d.ts.map +1 -1
  588. package/dist/tui/person-terms.d.ts +58 -0
  589. package/dist/tui/person-terms.d.ts.map +1 -0
  590. package/dist/tui/plain-failure.d.ts +27 -0
  591. package/dist/tui/plain-failure.d.ts.map +1 -0
  592. package/dist/tui/plain-interruption.d.ts +46 -0
  593. package/dist/tui/plain-interruption.d.ts.map +1 -0
  594. package/dist/tui/provider-list.d.ts.map +1 -1
  595. package/dist/tui/render-mode.d.ts +19 -0
  596. package/dist/tui/render-mode.d.ts.map +1 -0
  597. package/dist/tui/schedule/host-commands.d.ts +2 -9
  598. package/dist/tui/schedule/host-commands.d.ts.map +1 -1
  599. package/dist/tui/schedule/integration.d.ts +8 -0
  600. package/dist/tui/schedule/integration.d.ts.map +1 -1
  601. package/dist/tui/schedule/source-deliveries.d.ts +37 -0
  602. package/dist/tui/schedule/source-deliveries.d.ts.map +1 -0
  603. package/dist/tui/schedule/startup.d.ts.map +1 -1
  604. package/dist/tui/schedule/tool-host.d.ts +3 -1
  605. package/dist/tui/schedule/tool-host.d.ts.map +1 -1
  606. package/dist/tui/setup-text.d.ts +14 -0
  607. package/dist/tui/setup-text.d.ts.map +1 -0
  608. package/dist/tui/shell-escape.d.ts.map +1 -1
  609. package/dist/tui/skills/suggest-setting.d.ts.map +1 -1
  610. package/dist/tui/slashCommands.d.ts +4 -1
  611. package/dist/tui/slashCommands.d.ts.map +1 -1
  612. package/dist/tui/terminal-choice-text.d.ts +7 -0
  613. package/dist/tui/terminal-choice-text.d.ts.map +1 -1
  614. package/dist/tui/tidy-tool-output.d.ts +83 -0
  615. package/dist/tui/tidy-tool-output.d.ts.map +1 -0
  616. package/dist/tui/tool-presentation.d.ts +6 -0
  617. package/dist/tui/tool-presentation.d.ts.map +1 -0
  618. package/dist/tui/transcript-scroll.d.ts +73 -0
  619. package/dist/tui/transcript-scroll.d.ts.map +1 -0
  620. package/dist/tui/triggers/copy.d.ts.map +1 -1
  621. package/dist/tui/triggers/setting.d.ts.map +1 -1
  622. package/dist/tui/turn-interruption.d.ts +1 -1
  623. package/dist/tui/turn-interruption.d.ts.map +1 -1
  624. package/dist/tui/turn-limits-settings.d.ts +4 -4
  625. package/dist/tui/turn-limits-settings.d.ts.map +1 -1
  626. package/dist/tui/types.d.ts +10 -0
  627. package/dist/tui/types.d.ts.map +1 -1
  628. package/dist/tui/web-activity.d.ts +3 -2
  629. package/dist/tui/web-activity.d.ts.map +1 -1
  630. package/dist/tui/zen-free-refusal.d.ts +17 -0
  631. package/dist/tui/zen-free-refusal.d.ts.map +1 -0
  632. package/dist/usage-error.d.ts +15 -0
  633. package/dist/usage-error.d.ts.map +1 -0
  634. package/dist/warning-filter.d.ts +30 -0
  635. package/dist/warning-filter.d.ts.map +1 -0
  636. package/package.json +21 -10
  637. package/skills/schedule-task/SKILL.md +74 -20
  638. package/dist/browser/commands.js +0 -365
  639. package/dist/browser/commands.js.map +0 -1
  640. package/dist/browser/control.js +0 -140
  641. package/dist/browser/control.js.map +0 -1
  642. package/dist/browser/describe.js +0 -27
  643. package/dist/browser/describe.js.map +0 -1
  644. package/dist/checkpoints/store.js +0 -192
  645. package/dist/checkpoints/store.js.map +0 -1
  646. package/dist/checkpoints/wrap.js +0 -37
  647. package/dist/checkpoints/wrap.js.map +0 -1
  648. package/dist/cli.js +0 -602
  649. package/dist/cli.js.map +0 -1
  650. package/dist/commands/acp.js +0 -388
  651. package/dist/commands/acp.js.map +0 -1
  652. package/dist/commands/archive.js +0 -65
  653. package/dist/commands/archive.js.map +0 -1
  654. package/dist/commands/browser.js +0 -16
  655. package/dist/commands/browser.js.map +0 -1
  656. package/dist/commands/doctor.js +0 -267
  657. package/dist/commands/doctor.js.map +0 -1
  658. package/dist/commands/drain.js +0 -498
  659. package/dist/commands/drain.js.map +0 -1
  660. package/dist/commands/eval.js +0 -237
  661. package/dist/commands/eval.js.map +0 -1
  662. package/dist/commands/exec-flags.js +0 -334
  663. package/dist/commands/exec-flags.js.map +0 -1
  664. package/dist/commands/exec-json.js +0 -497
  665. package/dist/commands/exec-json.js.map +0 -1
  666. package/dist/commands/exec.js +0 -688
  667. package/dist/commands/exec.js.map +0 -1
  668. package/dist/commands/host-queries.js +0 -156
  669. package/dist/commands/host-queries.js.map +0 -1
  670. package/dist/commands/login.js +0 -315
  671. package/dist/commands/login.js.map +0 -1
  672. package/dist/commands/mcp-oauth-login.js +0 -213
  673. package/dist/commands/mcp-oauth-login.js.map +0 -1
  674. package/dist/commands/mcp.js +0 -461
  675. package/dist/commands/mcp.js.map +0 -1
  676. package/dist/commands/prior-messages.js +0 -329
  677. package/dist/commands/prior-messages.js.map +0 -1
  678. package/dist/commands/provider-wait.js +0 -65
  679. package/dist/commands/provider-wait.js.map +0 -1
  680. package/dist/commands/registry.js +0 -40
  681. package/dist/commands/registry.js.map +0 -1
  682. package/dist/commands/resident-flags.js +0 -193
  683. package/dist/commands/resident-flags.js.map +0 -1
  684. package/dist/commands/resident-learning.js +0 -293
  685. package/dist/commands/resident-learning.js.map +0 -1
  686. package/dist/commands/resident.js +0 -419
  687. package/dist/commands/resident.js.map +0 -1
  688. package/dist/commands/resume.js +0 -109
  689. package/dist/commands/resume.js.map +0 -1
  690. package/dist/commands/schedule.js +0 -131
  691. package/dist/commands/schedule.js.map +0 -1
  692. package/dist/commands/serve.js +0 -21
  693. package/dist/commands/serve.js.map +0 -1
  694. package/dist/commands/skills.js +0 -178
  695. package/dist/commands/skills.js.map +0 -1
  696. package/dist/commands/state.js +0 -110
  697. package/dist/commands/state.js.map +0 -1
  698. package/dist/commands/stdin.js +0 -69
  699. package/dist/commands/stdin.js.map +0 -1
  700. package/dist/commands/types.js +0 -2
  701. package/dist/commands/types.js.map +0 -1
  702. package/dist/commands/upgrade-progress.js +0 -54
  703. package/dist/commands/upgrade-progress.js.map +0 -1
  704. package/dist/commands/upgrade.js +0 -232
  705. package/dist/commands/upgrade.js.map +0 -1
  706. package/dist/commands/worktree.js +0 -86
  707. package/dist/commands/worktree.js.map +0 -1
  708. package/dist/config/composer-triggers.js +0 -80
  709. package/dist/config/composer-triggers.js.map +0 -1
  710. package/dist/config/debug.js +0 -126
  711. package/dist/config/debug.js.map +0 -1
  712. package/dist/config/load.js +0 -1208
  713. package/dist/config/load.js.map +0 -1
  714. package/dist/config/schema.js +0 -13
  715. package/dist/config/schema.js.map +0 -1
  716. package/dist/config/tool-result-screens.js +0 -104
  717. package/dist/config/tool-result-screens.js.map +0 -1
  718. package/dist/config/trusted-project-context.js +0 -28
  719. package/dist/config/trusted-project-context.js.map +0 -1
  720. package/dist/config/turn-guards.js +0 -46
  721. package/dist/config/turn-guards.js.map +0 -1
  722. package/dist/config/user-config.js +0 -118
  723. package/dist/config/user-config.js.map +0 -1
  724. package/dist/context/capabilities.js +0 -164
  725. package/dist/context/capabilities.js.map +0 -1
  726. package/dist/context/directories.js +0 -69
  727. package/dist/context/directories.js.map +0 -1
  728. package/dist/context/doctrine.js +0 -24
  729. package/dist/context/doctrine.js.map +0 -1
  730. package/dist/context/environment.js +0 -255
  731. package/dist/context/environment.js.map +0 -1
  732. package/dist/context/project-path.js +0 -16
  733. package/dist/context/project-path.js.map +0 -1
  734. package/dist/context/project-tracker.js +0 -217
  735. package/dist/context/project-tracker.js.map +0 -1
  736. package/dist/context/project.js +0 -256
  737. package/dist/context/project.js.map +0 -1
  738. package/dist/context/runtime-message.js +0 -30
  739. package/dist/context/runtime-message.js.map +0 -1
  740. package/dist/context/sandbox.js +0 -114
  741. package/dist/context/sandbox.js.map +0 -1
  742. package/dist/context/turn-snapshot.js +0 -122
  743. package/dist/context/turn-snapshot.js.map +0 -1
  744. package/dist/doctor/checks/browser.js +0 -63
  745. package/dist/doctor/checks/browser.js.map +0 -1
  746. package/dist/doctor/checks/chain.js +0 -211
  747. package/dist/doctor/checks/chain.js.map +0 -1
  748. package/dist/doctor/checks/credentials.js +0 -98
  749. package/dist/doctor/checks/credentials.js.map +0 -1
  750. package/dist/doctor/checks/index.js +0 -72
  751. package/dist/doctor/checks/index.js.map +0 -1
  752. package/dist/doctor/checks/invariants.js +0 -79
  753. package/dist/doctor/checks/invariants.js.map +0 -1
  754. package/dist/doctor/checks/logging.js +0 -69
  755. package/dist/doctor/checks/logging.js.map +0 -1
  756. package/dist/doctor/checks/providers.js +0 -30
  757. package/dist/doctor/checks/providers.js.map +0 -1
  758. package/dist/doctor/checks/runtime.js +0 -40
  759. package/dist/doctor/checks/runtime.js.map +0 -1
  760. package/dist/doctor/checks/sandbox.js +0 -76
  761. package/dist/doctor/checks/sandbox.js.map +0 -1
  762. package/dist/doctor/checks/scheduler.js +0 -74
  763. package/dist/doctor/checks/scheduler.js.map +0 -1
  764. package/dist/doctor/checks/session-export.js +0 -62
  765. package/dist/doctor/checks/session-export.js.map +0 -1
  766. package/dist/doctor/checks/telemetry.js +0 -58
  767. package/dist/doctor/checks/telemetry.js.map +0 -1
  768. package/dist/doctor/checks/vault.js +0 -67
  769. package/dist/doctor/checks/vault.js.map +0 -1
  770. package/dist/doctor/index.js +0 -3
  771. package/dist/doctor/index.js.map +0 -1
  772. package/dist/doctor/registry.js +0 -230
  773. package/dist/doctor/registry.js.map +0 -1
  774. package/dist/exit-codes.js +0 -62
  775. package/dist/exit-codes.js.map +0 -1
  776. package/dist/installation.js +0 -48
  777. package/dist/installation.js.map +0 -1
  778. package/dist/integrations/clipboard/image.js +0 -119
  779. package/dist/integrations/clipboard/image.js.map +0 -1
  780. package/dist/integrations/clipboard/text.js +0 -43
  781. package/dist/integrations/clipboard/text.js.map +0 -1
  782. package/dist/integrations/files/attachment-store.js +0 -86
  783. package/dist/integrations/files/attachment-store.js.map +0 -1
  784. package/dist/integrations/mcp/oauth-store.js +0 -549
  785. package/dist/integrations/mcp/oauth-store.js.map +0 -1
  786. package/dist/integrations/mcp/servers.js +0 -611
  787. package/dist/integrations/mcp/servers.js.map +0 -1
  788. package/dist/integrations/mcp/user-config.js +0 -92
  789. package/dist/integrations/mcp/user-config.js.map +0 -1
  790. package/dist/integrations/notifications/desktop/freedesktop.js +0 -33
  791. package/dist/integrations/notifications/desktop/freedesktop.js.map +0 -1
  792. package/dist/integrations/notifications/desktop/macos.js +0 -17
  793. package/dist/integrations/notifications/desktop/macos.js.map +0 -1
  794. package/dist/integrations/notifications/desktop/sanitize.js +0 -49
  795. package/dist/integrations/notifications/desktop/sanitize.js.map +0 -1
  796. package/dist/integrations/notifications/desktop/throttle.js +0 -39
  797. package/dist/integrations/notifications/desktop/throttle.js.map +0 -1
  798. package/dist/integrations/notifications/desktop/windows-toast.js +0 -56
  799. package/dist/integrations/notifications/desktop/windows-toast.js.map +0 -1
  800. package/dist/integrations/notifications/desktop.js +0 -199
  801. package/dist/integrations/notifications/desktop.js.map +0 -1
  802. package/dist/integrations/notifications/terminal.js +0 -46
  803. package/dist/integrations/notifications/terminal.js.map +0 -1
  804. package/dist/integrations/npm-invocation.js +0 -23
  805. package/dist/integrations/npm-invocation.js.map +0 -1
  806. package/dist/integrations/plugins/runtime.js +0 -189
  807. package/dist/integrations/plugins/runtime.js.map +0 -1
  808. package/dist/integrations/plugins/settings.js +0 -106
  809. package/dist/integrations/plugins/settings.js.map +0 -1
  810. package/dist/integrations/providers/access.js +0 -23
  811. package/dist/integrations/providers/access.js.map +0 -1
  812. package/dist/integrations/providers/chain-capabilities.js +0 -211
  813. package/dist/integrations/providers/chain-capabilities.js.map +0 -1
  814. package/dist/integrations/providers/codex-device-login.js +0 -195
  815. package/dist/integrations/providers/codex-device-login.js.map +0 -1
  816. package/dist/integrations/providers/codex-oauth.js +0 -95
  817. package/dist/integrations/providers/codex-oauth.js.map +0 -1
  818. package/dist/integrations/providers/credential-provider.js +0 -74
  819. package/dist/integrations/providers/credential-provider.js.map +0 -1
  820. package/dist/integrations/providers/credential-store.js +0 -657
  821. package/dist/integrations/providers/credential-store.js.map +0 -1
  822. package/dist/integrations/providers/current-credential.js +0 -45
  823. package/dist/integrations/providers/current-credential.js.map +0 -1
  824. package/dist/integrations/providers/discover.js +0 -313
  825. package/dist/integrations/providers/discover.js.map +0 -1
  826. package/dist/integrations/providers/gemini-credentials.js +0 -148
  827. package/dist/integrations/providers/gemini-credentials.js.map +0 -1
  828. package/dist/integrations/providers/harness-credentials.js +0 -344
  829. package/dist/integrations/providers/harness-credentials.js.map +0 -1
  830. package/dist/integrations/providers/identity.js +0 -64
  831. package/dist/integrations/providers/identity.js.map +0 -1
  832. package/dist/integrations/providers/index.js +0 -14
  833. package/dist/integrations/providers/index.js.map +0 -1
  834. package/dist/integrations/providers/keychain.js +0 -78
  835. package/dist/integrations/providers/keychain.js.map +0 -1
  836. package/dist/integrations/providers/model-reasoning.js +0 -51
  837. package/dist/integrations/providers/model-reasoning.js.map +0 -1
  838. package/dist/integrations/providers/oauth.js +0 -302
  839. package/dist/integrations/providers/oauth.js.map +0 -1
  840. package/dist/integrations/providers/preferences.js +0 -287
  841. package/dist/integrations/providers/preferences.js.map +0 -1
  842. package/dist/integrations/providers/register.js +0 -154
  843. package/dist/integrations/providers/register.js.map +0 -1
  844. package/dist/integrations/providers/registry.js +0 -289
  845. package/dist/integrations/providers/registry.js.map +0 -1
  846. package/dist/integrations/providers/setup.js +0 -158
  847. package/dist/integrations/providers/setup.js.map +0 -1
  848. package/dist/integrations/providers/subscription-login.js +0 -328
  849. package/dist/integrations/providers/subscription-login.js.map +0 -1
  850. package/dist/integrations/providers/zen-catalogue.js +0 -196
  851. package/dist/integrations/providers/zen-catalogue.js.map +0 -1
  852. package/dist/integrations/resident/foreground.js +0 -95
  853. package/dist/integrations/resident/foreground.js.map +0 -1
  854. package/dist/integrations/resident/inspection.js +0 -282
  855. package/dist/integrations/resident/inspection.js.map +0 -1
  856. package/dist/integrations/resident/learning-sources.js +0 -79
  857. package/dist/integrations/resident/learning-sources.js.map +0 -1
  858. package/dist/integrations/resident/learning-storage.js +0 -55
  859. package/dist/integrations/resident/learning-storage.js.map +0 -1
  860. package/dist/integrations/resident/lifecycle-errors.js +0 -15
  861. package/dist/integrations/resident/lifecycle-errors.js.map +0 -1
  862. package/dist/integrations/resident/owned-runner.js +0 -91
  863. package/dist/integrations/resident/owned-runner.js.map +0 -1
  864. package/dist/integrations/resident/runner-control.js +0 -238
  865. package/dist/integrations/resident/runner-control.js.map +0 -1
  866. package/dist/integrations/resident/runner-launch.js +0 -142
  867. package/dist/integrations/resident/runner-launch.js.map +0 -1
  868. package/dist/integrations/resident/runner-store.js +0 -284
  869. package/dist/integrations/resident/runner-store.js.map +0 -1
  870. package/dist/integrations/resident/session-log-reads.js +0 -125
  871. package/dist/integrations/resident/session-log-reads.js.map +0 -1
  872. package/dist/integrations/resident/session-step.js +0 -476
  873. package/dist/integrations/resident/session-step.js.map +0 -1
  874. package/dist/integrations/resident/storage.js +0 -183
  875. package/dist/integrations/resident/storage.js.map +0 -1
  876. package/dist/integrations/resident/tool-evidence.js +0 -123
  877. package/dist/integrations/resident/tool-evidence.js.map +0 -1
  878. package/dist/integrations/resident/verification.js +0 -109
  879. package/dist/integrations/resident/verification.js.map +0 -1
  880. package/dist/integrations/sessions/checkpoint-view.js +0 -48
  881. package/dist/integrations/sessions/checkpoint-view.js.map +0 -1
  882. package/dist/integrations/sessions/context-inventory.js +0 -44
  883. package/dist/integrations/sessions/context-inventory.js.map +0 -1
  884. package/dist/integrations/sessions/conversation-search.js +0 -572
  885. package/dist/integrations/sessions/conversation-search.js.map +0 -1
  886. package/dist/integrations/sessions/display-title.js +0 -5
  887. package/dist/integrations/sessions/display-title.js.map +0 -1
  888. package/dist/integrations/sessions/evidence-page-validation.js +0 -74
  889. package/dist/integrations/sessions/evidence-page-validation.js.map +0 -1
  890. package/dist/integrations/sessions/evidence-recall.js +0 -117
  891. package/dist/integrations/sessions/evidence-recall.js.map +0 -1
  892. package/dist/integrations/sessions/store.js +0 -780
  893. package/dist/integrations/sessions/store.js.map +0 -1
  894. package/dist/integrations/sessions/task-context.js +0 -96
  895. package/dist/integrations/sessions/task-context.js.map +0 -1
  896. package/dist/integrations/sessions/transcript-export.js +0 -342
  897. package/dist/integrations/sessions/transcript-export.js.map +0 -1
  898. package/dist/integrations/state/home.js +0 -17
  899. package/dist/integrations/state/home.js.map +0 -1
  900. package/dist/integrations/state/identity.js +0 -49
  901. package/dist/integrations/state/identity.js.map +0 -1
  902. package/dist/integrations/state/immutable-json.js +0 -38
  903. package/dist/integrations/state/immutable-json.js.map +0 -1
  904. package/dist/integrations/state/private-directory.js +0 -43
  905. package/dist/integrations/state/private-directory.js.map +0 -1
  906. package/dist/integrations/state/project.js +0 -13
  907. package/dist/integrations/state/project.js.map +0 -1
  908. package/dist/integrations/state/report.js +0 -626
  909. package/dist/integrations/state/report.js.map +0 -1
  910. package/dist/integrations/state/retention.js +0 -18
  911. package/dist/integrations/state/retention.js.map +0 -1
  912. package/dist/integrations/subagents/NamzuCliAgent.js +0 -9
  913. package/dist/integrations/subagents/NamzuCliAgent.js.map +0 -1
  914. package/dist/integrations/subagents/activity.js +0 -759
  915. package/dist/integrations/subagents/activity.js.map +0 -1
  916. package/dist/integrations/subagents/batches.js +0 -172
  917. package/dist/integrations/subagents/batches.js.map +0 -1
  918. package/dist/integrations/subagents/definitions.js +0 -26
  919. package/dist/integrations/subagents/definitions.js.map +0 -1
  920. package/dist/integrations/subagents/model-effort.js +0 -12
  921. package/dist/integrations/subagents/model-effort.js.map +0 -1
  922. package/dist/integrations/subagents/parent.js +0 -47
  923. package/dist/integrations/subagents/parent.js.map +0 -1
  924. package/dist/integrations/subagents/policy.js +0 -3
  925. package/dist/integrations/subagents/policy.js.map +0 -1
  926. package/dist/integrations/subagents/replay.js +0 -295
  927. package/dist/integrations/subagents/replay.js.map +0 -1
  928. package/dist/integrations/subagents/runtime.js +0 -1317
  929. package/dist/integrations/subagents/runtime.js.map +0 -1
  930. package/dist/integrations/subagents/saved-agents.js +0 -102
  931. package/dist/integrations/subagents/saved-agents.js.map +0 -1
  932. package/dist/integrations/subagents/slash.js +0 -45
  933. package/dist/integrations/subagents/slash.js.map +0 -1
  934. package/dist/integrations/subagents/worktree-driver.js +0 -72
  935. package/dist/integrations/subagents/worktree-driver.js.map +0 -1
  936. package/dist/integrations/telemetry/session-export.js +0 -119
  937. package/dist/integrations/telemetry/session-export.js.map +0 -1
  938. package/dist/integrations/trust/store.js +0 -73
  939. package/dist/integrations/trust/store.js.map +0 -1
  940. package/dist/integrations/updates.js +0 -115
  941. package/dist/integrations/updates.js.map +0 -1
  942. package/dist/integrations/web/exa-search.js +0 -154
  943. package/dist/integrations/web/exa-search.js.map +0 -1
  944. package/dist/integrations/web/open-url.js +0 -73
  945. package/dist/integrations/web/open-url.js.map +0 -1
  946. package/dist/integrations/web/search.js +0 -68
  947. package/dist/integrations/web/search.js.map +0 -1
  948. package/dist/integrations/worktrees/managed.js +0 -231
  949. package/dist/integrations/worktrees/managed.js.map +0 -1
  950. package/dist/logging.js +0 -115
  951. package/dist/logging.js.map +0 -1
  952. package/dist/memory/io.js +0 -177
  953. package/dist/memory/io.js.map +0 -1
  954. package/dist/memory/presentation.js +0 -76
  955. package/dist/memory/presentation.js.map +0 -1
  956. package/dist/memory/store.js +0 -180
  957. package/dist/memory/store.js.map +0 -1
  958. package/dist/memory/typed.js +0 -336
  959. package/dist/memory/typed.js.map +0 -1
  960. package/dist/output/formatter.js +0 -16
  961. package/dist/output/formatter.js.map +0 -1
  962. package/dist/output/index.js +0 -22
  963. package/dist/output/index.js.map +0 -1
  964. package/dist/output/json.js +0 -51
  965. package/dist/output/json.js.map +0 -1
  966. package/dist/output/text.js +0 -50
  967. package/dist/output/text.js.map +0 -1
  968. package/dist/output/yaml.js +0 -26
  969. package/dist/output/yaml.js.map +0 -1
  970. package/dist/output-schema.js +0 -18
  971. package/dist/output-schema.js.map +0 -1
  972. package/dist/permissions/browser-sites.js +0 -270
  973. package/dist/permissions/browser-sites.js.map +0 -1
  974. package/dist/permissions/canonical-project.js +0 -13
  975. package/dist/permissions/canonical-project.js.map +0 -1
  976. package/dist/permissions/checks.js +0 -128
  977. package/dist/permissions/checks.js.map +0 -1
  978. package/dist/permissions/headless-trust.js +0 -86
  979. package/dist/permissions/headless-trust.js.map +0 -1
  980. package/dist/permissions/live-mode.js +0 -62
  981. package/dist/permissions/live-mode.js.map +0 -1
  982. package/dist/permissions/mode.js +0 -65
  983. package/dist/permissions/mode.js.map +0 -1
  984. package/dist/permissions/rules.js +0 -358
  985. package/dist/permissions/rules.js.map +0 -1
  986. package/dist/release-notes.js +0 -64
  987. package/dist/release-notes.js.map +0 -1
  988. package/dist/resume-invocation.js +0 -24
  989. package/dist/resume-invocation.js.map +0 -1
  990. package/dist/schedule/build.js +0 -374
  991. package/dist/schedule/build.js.map +0 -1
  992. package/dist/schedule/changes.js +0 -78
  993. package/dist/schedule/changes.js.map +0 -1
  994. package/dist/schedule/commands/add.js +0 -603
  995. package/dist/schedule/commands/add.js.map +0 -1
  996. package/dist/schedule/commands/args.js +0 -80
  997. package/dist/schedule/commands/args.js.map +0 -1
  998. package/dist/schedule/commands/confirm-prompt.js +0 -21
  999. package/dist/schedule/commands/confirm-prompt.js.map +0 -1
  1000. package/dist/schedule/commands/lifecycle.js +0 -586
  1001. package/dist/schedule/commands/lifecycle.js.map +0 -1
  1002. package/dist/schedule/commands/list.js +0 -260
  1003. package/dist/schedule/commands/list.js.map +0 -1
  1004. package/dist/schedule/commands/logs.js +0 -106
  1005. package/dist/schedule/commands/logs.js.map +0 -1
  1006. package/dist/schedule/commands/service.js +0 -458
  1007. package/dist/schedule/commands/service.js.map +0 -1
  1008. package/dist/schedule/daemon/daemon.js +0 -1265
  1009. package/dist/schedule/daemon/daemon.js.map +0 -1
  1010. package/dist/schedule/daemon/endpoint.js +0 -158
  1011. package/dist/schedule/daemon/endpoint.js.map +0 -1
  1012. package/dist/schedule/daemon/exit.js +0 -8
  1013. package/dist/schedule/daemon/exit.js.map +0 -1
  1014. package/dist/schedule/daemon/log.js +0 -53
  1015. package/dist/schedule/daemon/log.js.map +0 -1
  1016. package/dist/schedule/daemon/notify.js +0 -158
  1017. package/dist/schedule/daemon/notify.js.map +0 -1
  1018. package/dist/schedule/daemon/retention.js +0 -46
  1019. package/dist/schedule/daemon/retention.js.map +0 -1
  1020. package/dist/schedule/daemon/sessions.js +0 -52
  1021. package/dist/schedule/daemon/sessions.js.map +0 -1
  1022. package/dist/schedule/env.js +0 -106
  1023. package/dist/schedule/env.js.map +0 -1
  1024. package/dist/schedule/fire/browser-preflight.js +0 -73
  1025. package/dist/schedule/fire/browser-preflight.js.map +0 -1
  1026. package/dist/schedule/fire/calls.js +0 -114
  1027. package/dist/schedule/fire/calls.js.map +0 -1
  1028. package/dist/schedule/fire/fire.js +0 -681
  1029. package/dist/schedule/fire/fire.js.map +0 -1
  1030. package/dist/schedule/fire/result.js +0 -19
  1031. package/dist/schedule/fire/result.js.map +0 -1
  1032. package/dist/schedule/fire/run-script.js +0 -81
  1033. package/dist/schedule/fire/run-script.js.map +0 -1
  1034. package/dist/schedule/fire/unattended-note.js +0 -51
  1035. package/dist/schedule/fire/unattended-note.js.map +0 -1
  1036. package/dist/schedule/fire/wake-gate.js +0 -90
  1037. package/dist/schedule/fire/wake-gate.js.map +0 -1
  1038. package/dist/schedule/floor.js +0 -1561
  1039. package/dist/schedule/floor.js.map +0 -1
  1040. package/dist/schedule/folder.js +0 -84
  1041. package/dist/schedule/folder.js.map +0 -1
  1042. package/dist/schedule/paths.js +0 -53
  1043. package/dist/schedule/paths.js.map +0 -1
  1044. package/dist/schedule/policy.js +0 -414
  1045. package/dist/schedule/policy.js.map +0 -1
  1046. package/dist/schedule/resume-command.js +0 -72
  1047. package/dist/schedule/resume-command.js.map +0 -1
  1048. package/dist/schedule/script-check.js +0 -146
  1049. package/dist/schedule/script-check.js.map +0 -1
  1050. package/dist/schedule/script-shell.js +0 -5
  1051. package/dist/schedule/script-shell.js.map +0 -1
  1052. package/dist/schedule/service/detect.js +0 -29
  1053. package/dist/schedule/service/detect.js.map +0 -1
  1054. package/dist/schedule/service/index.js +0 -361
  1055. package/dist/schedule/service/index.js.map +0 -1
  1056. package/dist/schedule/service/launchd.js +0 -84
  1057. package/dist/schedule/service/launchd.js.map +0 -1
  1058. package/dist/schedule/service/manifest.js +0 -16
  1059. package/dist/schedule/service/manifest.js.map +0 -1
  1060. package/dist/schedule/service/names.js +0 -22
  1061. package/dist/schedule/service/names.js.map +0 -1
  1062. package/dist/schedule/service/quote.js +0 -64
  1063. package/dist/schedule/service/quote.js.map +0 -1
  1064. package/dist/schedule/service/runner.js +0 -31
  1065. package/dist/schedule/service/runner.js.map +0 -1
  1066. package/dist/schedule/service/systemd.js +0 -96
  1067. package/dist/schedule/service/systemd.js.map +0 -1
  1068. package/dist/schedule/service/windows-task.js +0 -199
  1069. package/dist/schedule/service/windows-task.js.map +0 -1
  1070. package/dist/schedule/service/wsl.js +0 -121
  1071. package/dist/schedule/service/wsl.js.map +0 -1
  1072. package/dist/schedule/store/atomic.js +0 -138
  1073. package/dist/schedule/store/atomic.js.map +0 -1
  1074. package/dist/schedule/store/claims.js +0 -57
  1075. package/dist/schedule/store/claims.js.map +0 -1
  1076. package/dist/schedule/store/digest.js +0 -139
  1077. package/dist/schedule/store/digest.js.map +0 -1
  1078. package/dist/schedule/store/history.js +0 -117
  1079. package/dist/schedule/store/history.js.map +0 -1
  1080. package/dist/schedule/store/jobs.js +0 -277
  1081. package/dist/schedule/store/jobs.js.map +0 -1
  1082. package/dist/schedule/store/state.js +0 -38
  1083. package/dist/schedule/store/state.js.map +0 -1
  1084. package/dist/schedule/types.js +0 -33
  1085. package/dist/schedule/types.js.map +0 -1
  1086. package/dist/schedule/visible-source.js +0 -59
  1087. package/dist/schedule/visible-source.js.map +0 -1
  1088. package/dist/skills/audit.js +0 -75
  1089. package/dist/skills/audit.js.map +0 -1
  1090. package/dist/skills/catalog.js +0 -226
  1091. package/dist/skills/catalog.js.map +0 -1
  1092. package/dist/skills/directory.js +0 -51
  1093. package/dist/skills/directory.js.map +0 -1
  1094. package/dist/skills/save.js +0 -344
  1095. package/dist/skills/save.js.map +0 -1
  1096. package/dist/skills/store.js +0 -351
  1097. package/dist/skills/store.js.map +0 -1
  1098. package/dist/termination.js +0 -143
  1099. package/dist/termination.js.map +0 -1
  1100. package/dist/test-support/toolset.js +0 -27
  1101. package/dist/test-support/toolset.js.map +0 -1
  1102. package/dist/tui/AgentExplorer.js +0 -789
  1103. package/dist/tui/AgentExplorer.js.map +0 -1
  1104. package/dist/tui/App.js +0 -8499
  1105. package/dist/tui/App.js.map +0 -1
  1106. package/dist/tui/BackgroundJobsPanel.js +0 -129
  1107. package/dist/tui/BackgroundJobsPanel.js.map +0 -1
  1108. package/dist/tui/BrandHeader.js +0 -14
  1109. package/dist/tui/BrandHeader.js.map +0 -1
  1110. package/dist/tui/Checklist.js +0 -90
  1111. package/dist/tui/Checklist.js.map +0 -1
  1112. package/dist/tui/ChoicePicker.js +0 -64
  1113. package/dist/tui/ChoicePicker.js.map +0 -1
  1114. package/dist/tui/Composer.js +0 -939
  1115. package/dist/tui/Composer.js.map +0 -1
  1116. package/dist/tui/ComposerFrame.js +0 -79
  1117. package/dist/tui/ComposerFrame.js.map +0 -1
  1118. package/dist/tui/CopyPicker.js +0 -19
  1119. package/dist/tui/CopyPicker.js.map +0 -1
  1120. package/dist/tui/EditPromptPicker.js +0 -17
  1121. package/dist/tui/EditPromptPicker.js.map +0 -1
  1122. package/dist/tui/EffortSlider.js +0 -134
  1123. package/dist/tui/EffortSlider.js.map +0 -1
  1124. package/dist/tui/LiveActivity.js +0 -89
  1125. package/dist/tui/LiveActivity.js.map +0 -1
  1126. package/dist/tui/Markdown.js +0 -137
  1127. package/dist/tui/Markdown.js.map +0 -1
  1128. package/dist/tui/PendingInputPanel.js +0 -108
  1129. package/dist/tui/PendingInputPanel.js.map +0 -1
  1130. package/dist/tui/PermissionOverlay.js +0 -278
  1131. package/dist/tui/PermissionOverlay.js.map +0 -1
  1132. package/dist/tui/Picker.js +0 -1310
  1133. package/dist/tui/Picker.js.map +0 -1
  1134. package/dist/tui/ProviderSetup.js +0 -125
  1135. package/dist/tui/ProviderSetup.js.map +0 -1
  1136. package/dist/tui/ResumePicker.js +0 -34
  1137. package/dist/tui/ResumePicker.js.map +0 -1
  1138. package/dist/tui/SaveSkillOverlay.js +0 -118
  1139. package/dist/tui/SaveSkillOverlay.js.map +0 -1
  1140. package/dist/tui/ScheduleReviewOverlay.js +0 -166
  1141. package/dist/tui/ScheduleReviewOverlay.js.map +0 -1
  1142. package/dist/tui/StatusBar.js +0 -182
  1143. package/dist/tui/StatusBar.js.map +0 -1
  1144. package/dist/tui/StatusPanel.js +0 -11
  1145. package/dist/tui/StatusPanel.js.map +0 -1
  1146. package/dist/tui/TaskList.js +0 -43
  1147. package/dist/tui/TaskList.js.map +0 -1
  1148. package/dist/tui/TextPrompt.js +0 -185
  1149. package/dist/tui/TextPrompt.js.map +0 -1
  1150. package/dist/tui/ToolOutputViewer.js +0 -39
  1151. package/dist/tui/ToolOutputViewer.js.map +0 -1
  1152. package/dist/tui/Transcript.js +0 -235
  1153. package/dist/tui/Transcript.js.map +0 -1
  1154. package/dist/tui/TrustPrompt.js +0 -13
  1155. package/dist/tui/TrustPrompt.js.map +0 -1
  1156. package/dist/tui/ViewportBound.js +0 -55
  1157. package/dist/tui/ViewportBound.js.map +0 -1
  1158. package/dist/tui/agent-transcript-rows.js +0 -115
  1159. package/dist/tui/agent-transcript-rows.js.map +0 -1
  1160. package/dist/tui/agent.js +0 -4301
  1161. package/dist/tui/agent.js.map +0 -1
  1162. package/dist/tui/browser-notices.js +0 -107
  1163. package/dist/tui/browser-notices.js.map +0 -1
  1164. package/dist/tui/choice-selection.js +0 -38
  1165. package/dist/tui/choice-selection.js.map +0 -1
  1166. package/dist/tui/compact-transcript.js +0 -46
  1167. package/dist/tui/compact-transcript.js.map +0 -1
  1168. package/dist/tui/consent-timing.js +0 -48
  1169. package/dist/tui/consent-timing.js.map +0 -1
  1170. package/dist/tui/conversation-evidence-view.js +0 -96
  1171. package/dist/tui/conversation-evidence-view.js.map +0 -1
  1172. package/dist/tui/conversation-history.js +0 -33
  1173. package/dist/tui/conversation-history.js.map +0 -1
  1174. package/dist/tui/copy-targets.js +0 -189
  1175. package/dist/tui/copy-targets.js.map +0 -1
  1176. package/dist/tui/credential-entry.js +0 -134
  1177. package/dist/tui/credential-entry.js.map +0 -1
  1178. package/dist/tui/edit-prompts.js +0 -35
  1179. package/dist/tui/edit-prompts.js.map +0 -1
  1180. package/dist/tui/exit-summary.js +0 -30
  1181. package/dist/tui/exit-summary.js.map +0 -1
  1182. package/dist/tui/external-editor.js +0 -169
  1183. package/dist/tui/external-editor.js.map +0 -1
  1184. package/dist/tui/hypermode.js +0 -58
  1185. package/dist/tui/hypermode.js.map +0 -1
  1186. package/dist/tui/index.js +0 -81
  1187. package/dist/tui/index.js.map +0 -1
  1188. package/dist/tui/live-window.js +0 -281
  1189. package/dist/tui/live-window.js.map +0 -1
  1190. package/dist/tui/log-pane.js +0 -100
  1191. package/dist/tui/log-pane.js.map +0 -1
  1192. package/dist/tui/login-prompt.js +0 -105
  1193. package/dist/tui/login-prompt.js.map +0 -1
  1194. package/dist/tui/logo.js +0 -9
  1195. package/dist/tui/logo.js.map +0 -1
  1196. package/dist/tui/markdown-block-cache.js +0 -76
  1197. package/dist/tui/markdown-block-cache.js.map +0 -1
  1198. package/dist/tui/markdown-table.js +0 -175
  1199. package/dist/tui/markdown-table.js.map +0 -1
  1200. package/dist/tui/markdown-wrap.js +0 -189
  1201. package/dist/tui/markdown-wrap.js.map +0 -1
  1202. package/dist/tui/markdownParser.js +0 -237
  1203. package/dist/tui/markdownParser.js.map +0 -1
  1204. package/dist/tui/mentions.js +0 -150
  1205. package/dist/tui/mentions.js.map +0 -1
  1206. package/dist/tui/model-catalogue-view.js +0 -75
  1207. package/dist/tui/model-catalogue-view.js.map +0 -1
  1208. package/dist/tui/model-choices.js +0 -157
  1209. package/dist/tui/model-choices.js.map +0 -1
  1210. package/dist/tui/model-search.js +0 -28
  1211. package/dist/tui/model-search.js.map +0 -1
  1212. package/dist/tui/model-selection-intent.js +0 -96
  1213. package/dist/tui/model-selection-intent.js.map +0 -1
  1214. package/dist/tui/model-switch-tool.js +0 -74
  1215. package/dist/tui/model-switch-tool.js.map +0 -1
  1216. package/dist/tui/model-switch.js +0 -106
  1217. package/dist/tui/model-switch.js.map +0 -1
  1218. package/dist/tui/notices.js +0 -27
  1219. package/dist/tui/notices.js.map +0 -1
  1220. package/dist/tui/open-browser.js +0 -147
  1221. package/dist/tui/open-browser.js.map +0 -1
  1222. package/dist/tui/permission-review.js +0 -858
  1223. package/dist/tui/permission-review.js.map +0 -1
  1224. package/dist/tui/plugin-view.js +0 -59
  1225. package/dist/tui/plugin-view.js.map +0 -1
  1226. package/dist/tui/provider-list.js +0 -327
  1227. package/dist/tui/provider-list.js.map +0 -1
  1228. package/dist/tui/provider-selection.js +0 -16
  1229. package/dist/tui/provider-selection.js.map +0 -1
  1230. package/dist/tui/schedule/host-commands.js +0 -428
  1231. package/dist/tui/schedule/host-commands.js.map +0 -1
  1232. package/dist/tui/schedule/integration.js +0 -150
  1233. package/dist/tui/schedule/integration.js.map +0 -1
  1234. package/dist/tui/schedule/loop-host.js +0 -153
  1235. package/dist/tui/schedule/loop-host.js.map +0 -1
  1236. package/dist/tui/schedule/resume.js +0 -333
  1237. package/dist/tui/schedule/resume.js.map +0 -1
  1238. package/dist/tui/schedule/startup.js +0 -121
  1239. package/dist/tui/schedule/startup.js.map +0 -1
  1240. package/dist/tui/schedule/tool-host.js +0 -619
  1241. package/dist/tui/schedule/tool-host.js.map +0 -1
  1242. package/dist/tui/selection-window.js +0 -37
  1243. package/dist/tui/selection-window.js.map +0 -1
  1244. package/dist/tui/shell-escape.js +0 -110
  1245. package/dist/tui/shell-escape.js.map +0 -1
  1246. package/dist/tui/skills/learning.js +0 -131
  1247. package/dist/tui/skills/learning.js.map +0 -1
  1248. package/dist/tui/skills/suggest-setting.js +0 -55
  1249. package/dist/tui/skills/suggest-setting.js.map +0 -1
  1250. package/dist/tui/skills/suggestion-ledger.js +0 -52
  1251. package/dist/tui/skills/suggestion-ledger.js.map +0 -1
  1252. package/dist/tui/slashCommands.js +0 -1588
  1253. package/dist/tui/slashCommands.js.map +0 -1
  1254. package/dist/tui/status-card.js +0 -30
  1255. package/dist/tui/status-card.js.map +0 -1
  1256. package/dist/tui/status-panel-layout.js +0 -42
  1257. package/dist/tui/status-panel-layout.js.map +0 -1
  1258. package/dist/tui/stream-blocks.js +0 -187
  1259. package/dist/tui/stream-blocks.js.map +0 -1
  1260. package/dist/tui/task-activity.js +0 -157
  1261. package/dist/tui/task-activity.js.map +0 -1
  1262. package/dist/tui/terminal-choice-text.js +0 -118
  1263. package/dist/tui/terminal-choice-text.js.map +0 -1
  1264. package/dist/tui/terminal-display.js +0 -65
  1265. package/dist/tui/terminal-display.js.map +0 -1
  1266. package/dist/tui/terminal-hyperlinks.js +0 -70
  1267. package/dist/tui/terminal-hyperlinks.js.map +0 -1
  1268. package/dist/tui/theme.js +0 -34
  1269. package/dist/tui/theme.js.map +0 -1
  1270. package/dist/tui/triggers/analyze.js +0 -221
  1271. package/dist/tui/triggers/analyze.js.map +0 -1
  1272. package/dist/tui/triggers/context-text.js +0 -44
  1273. package/dist/tui/triggers/context-text.js.map +0 -1
  1274. package/dist/tui/triggers/copy.js +0 -163
  1275. package/dist/tui/triggers/copy.js.map +0 -1
  1276. package/dist/tui/triggers/detect.js +0 -295
  1277. package/dist/tui/triggers/detect.js.map +0 -1
  1278. package/dist/tui/triggers/fold.js +0 -44
  1279. package/dist/tui/triggers/fold.js.map +0 -1
  1280. package/dist/tui/triggers/pattern.js +0 -243
  1281. package/dist/tui/triggers/pattern.js.map +0 -1
  1282. package/dist/tui/triggers/provenance.js +0 -98
  1283. package/dist/tui/triggers/provenance.js.map +0 -1
  1284. package/dist/tui/triggers/registry.js +0 -164
  1285. package/dist/tui/triggers/registry.js.map +0 -1
  1286. package/dist/tui/triggers/setting.js +0 -61
  1287. package/dist/tui/triggers/setting.js.map +0 -1
  1288. package/dist/tui/triggers/verbs.js +0 -140
  1289. package/dist/tui/triggers/verbs.js.map +0 -1
  1290. package/dist/tui/turn-interruption.js +0 -160
  1291. package/dist/tui/turn-interruption.js.map +0 -1
  1292. package/dist/tui/turn-limits-settings.js +0 -88
  1293. package/dist/tui/turn-limits-settings.js.map +0 -1
  1294. package/dist/tui/types.js +0 -7
  1295. package/dist/tui/types.js.map +0 -1
  1296. package/dist/tui/units.js +0 -20
  1297. package/dist/tui/units.js.map +0 -1
  1298. package/dist/tui/use-selection-index.js +0 -13
  1299. package/dist/tui/use-selection-index.js.map +0 -1
  1300. package/dist/tui/web-activity.js +0 -105
  1301. package/dist/tui/web-activity.js.map +0 -1
  1302. package/dist/tui/workspace-diff.js +0 -101
  1303. package/dist/tui/workspace-diff.js.map +0 -1
  1304. package/dist/tui/workspace-review.js +0 -67
  1305. package/dist/tui/workspace-review.js.map +0 -1
  1306. package/dist/user-commands/store.js +0 -235
  1307. package/dist/user-commands/store.js.map +0 -1
  1308. package/dist/version.js +0 -23
  1309. package/dist/version.js.map +0 -1
@@ -0,0 +1,3497 @@
1
+ import { createRequire as __namzuCreateRequire } from 'node:module';
2
+ const require = __namzuCreateRequire(import.meta.url);
3
+ import {
4
+ __commonJS,
5
+ __name,
6
+ __require,
7
+ __toESM
8
+ } from "./chunk-76FLAFCG.js";
9
+
10
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
11
+ var require_error = __commonJS({
12
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js"(exports) {
13
+ "use strict";
14
+ var CommanderError2 = class extends Error {
15
+ static {
16
+ __name(this, "CommanderError");
17
+ }
18
+ /**
19
+ * Constructs the CommanderError class
20
+ * @param {number} exitCode suggested exit code which could be used with process.exit
21
+ * @param {string} code an id string representing the error
22
+ * @param {string} message human-readable description of the error
23
+ */
24
+ constructor(exitCode, code, message) {
25
+ super(message);
26
+ Error.captureStackTrace(this, this.constructor);
27
+ this.name = this.constructor.name;
28
+ this.code = code;
29
+ this.exitCode = exitCode;
30
+ this.nestedError = void 0;
31
+ }
32
+ };
33
+ var InvalidArgumentError2 = class extends CommanderError2 {
34
+ static {
35
+ __name(this, "InvalidArgumentError");
36
+ }
37
+ /**
38
+ * Constructs the InvalidArgumentError class
39
+ * @param {string} [message] explanation of why argument is invalid
40
+ */
41
+ constructor(message) {
42
+ super(1, "commander.invalidArgument", message);
43
+ Error.captureStackTrace(this, this.constructor);
44
+ this.name = this.constructor.name;
45
+ }
46
+ };
47
+ exports.CommanderError = CommanderError2;
48
+ exports.InvalidArgumentError = InvalidArgumentError2;
49
+ }
50
+ });
51
+
52
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/argument.js
53
+ var require_argument = __commonJS({
54
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/argument.js"(exports) {
55
+ "use strict";
56
+ var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
57
+ var Argument2 = class {
58
+ static {
59
+ __name(this, "Argument");
60
+ }
61
+ /**
62
+ * Initialize a new command argument with the given name and description.
63
+ * The default is that the argument is required, and you can explicitly
64
+ * indicate this with <> around the name. Put [] around the name for an optional argument.
65
+ *
66
+ * @param {string} name
67
+ * @param {string} [description]
68
+ */
69
+ constructor(name, description) {
70
+ this.description = description || "";
71
+ this.variadic = false;
72
+ this.parseArg = void 0;
73
+ this.defaultValue = void 0;
74
+ this.defaultValueDescription = void 0;
75
+ this.argChoices = void 0;
76
+ switch (name[0]) {
77
+ case "<":
78
+ this.required = true;
79
+ this._name = name.slice(1, -1);
80
+ break;
81
+ case "[":
82
+ this.required = false;
83
+ this._name = name.slice(1, -1);
84
+ break;
85
+ default:
86
+ this.required = true;
87
+ this._name = name;
88
+ break;
89
+ }
90
+ if (this._name.endsWith("...")) {
91
+ this.variadic = true;
92
+ this._name = this._name.slice(0, -3);
93
+ }
94
+ }
95
+ /**
96
+ * Return argument name.
97
+ *
98
+ * @return {string}
99
+ */
100
+ name() {
101
+ return this._name;
102
+ }
103
+ /**
104
+ * @package
105
+ */
106
+ _collectValue(value, previous) {
107
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
108
+ return [value];
109
+ }
110
+ previous.push(value);
111
+ return previous;
112
+ }
113
+ /**
114
+ * Set the default value, and optionally supply the description to be displayed in the help.
115
+ *
116
+ * @param {*} value
117
+ * @param {string} [description]
118
+ * @return {Argument}
119
+ */
120
+ default(value, description) {
121
+ this.defaultValue = value;
122
+ this.defaultValueDescription = description;
123
+ return this;
124
+ }
125
+ /**
126
+ * Set the custom handler for processing CLI command arguments into argument values.
127
+ *
128
+ * @param {Function} [fn]
129
+ * @return {Argument}
130
+ */
131
+ argParser(fn) {
132
+ this.parseArg = fn;
133
+ return this;
134
+ }
135
+ /**
136
+ * Only allow argument value to be one of choices.
137
+ *
138
+ * @param {string[]} values
139
+ * @return {Argument}
140
+ */
141
+ choices(values) {
142
+ this.argChoices = values.slice();
143
+ this.parseArg = (arg, previous) => {
144
+ if (!this.argChoices.includes(arg)) {
145
+ throw new InvalidArgumentError2(
146
+ `Allowed choices are ${this.argChoices.join(", ")}.`
147
+ );
148
+ }
149
+ if (this.variadic) {
150
+ return this._collectValue(arg, previous);
151
+ }
152
+ return arg;
153
+ };
154
+ return this;
155
+ }
156
+ /**
157
+ * Make argument required.
158
+ *
159
+ * @returns {Argument}
160
+ */
161
+ argRequired() {
162
+ this.required = true;
163
+ return this;
164
+ }
165
+ /**
166
+ * Make argument optional.
167
+ *
168
+ * @returns {Argument}
169
+ */
170
+ argOptional() {
171
+ this.required = false;
172
+ return this;
173
+ }
174
+ };
175
+ function humanReadableArgName(arg) {
176
+ const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
177
+ return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
178
+ }
179
+ __name(humanReadableArgName, "humanReadableArgName");
180
+ exports.Argument = Argument2;
181
+ exports.humanReadableArgName = humanReadableArgName;
182
+ }
183
+ });
184
+
185
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/help.js
186
+ var require_help = __commonJS({
187
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/help.js"(exports) {
188
+ "use strict";
189
+ var { humanReadableArgName } = require_argument();
190
+ var Help2 = class {
191
+ static {
192
+ __name(this, "Help");
193
+ }
194
+ constructor() {
195
+ this.helpWidth = void 0;
196
+ this.minWidthToWrap = 40;
197
+ this.sortSubcommands = false;
198
+ this.sortOptions = false;
199
+ this.showGlobalOptions = false;
200
+ }
201
+ /**
202
+ * prepareContext is called by Commander after applying overrides from `Command.configureHelp()`
203
+ * and just before calling `formatHelp()`.
204
+ *
205
+ * Commander just uses the helpWidth and the rest is provided for optional use by more complex subclasses.
206
+ *
207
+ * @param {{ error?: boolean, helpWidth?: number, outputHasColors?: boolean }} contextOptions
208
+ */
209
+ prepareContext(contextOptions) {
210
+ this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
211
+ }
212
+ /**
213
+ * Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.
214
+ *
215
+ * @param {Command} cmd
216
+ * @returns {Command[]}
217
+ */
218
+ visibleCommands(cmd) {
219
+ const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
220
+ const helpCommand = cmd._getHelpCommand();
221
+ if (helpCommand && !helpCommand._hidden) {
222
+ visibleCommands.push(helpCommand);
223
+ }
224
+ if (this.sortSubcommands) {
225
+ visibleCommands.sort((a, b) => {
226
+ return a.name().localeCompare(b.name());
227
+ });
228
+ }
229
+ return visibleCommands;
230
+ }
231
+ /**
232
+ * Compare options for sort.
233
+ *
234
+ * @param {Option} a
235
+ * @param {Option} b
236
+ * @returns {number}
237
+ */
238
+ compareOptions(a, b) {
239
+ const getSortKey = /* @__PURE__ */ __name((option) => {
240
+ return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
241
+ }, "getSortKey");
242
+ return getSortKey(a).localeCompare(getSortKey(b));
243
+ }
244
+ /**
245
+ * Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
246
+ *
247
+ * @param {Command} cmd
248
+ * @returns {Option[]}
249
+ */
250
+ visibleOptions(cmd) {
251
+ const visibleOptions = cmd.options.filter((option) => !option.hidden);
252
+ const helpOption = cmd._getHelpOption();
253
+ if (helpOption && !helpOption.hidden) {
254
+ const removeShort = helpOption.short && cmd._findOption(helpOption.short);
255
+ const removeLong = helpOption.long && cmd._findOption(helpOption.long);
256
+ if (!removeShort && !removeLong) {
257
+ visibleOptions.push(helpOption);
258
+ } else if (helpOption.long && !removeLong) {
259
+ visibleOptions.push(
260
+ cmd.createOption(helpOption.long, helpOption.description)
261
+ );
262
+ } else if (helpOption.short && !removeShort) {
263
+ visibleOptions.push(
264
+ cmd.createOption(helpOption.short, helpOption.description)
265
+ );
266
+ }
267
+ }
268
+ if (this.sortOptions) {
269
+ visibleOptions.sort(this.compareOptions);
270
+ }
271
+ return visibleOptions;
272
+ }
273
+ /**
274
+ * Get an array of the visible global options. (Not including help.)
275
+ *
276
+ * @param {Command} cmd
277
+ * @returns {Option[]}
278
+ */
279
+ visibleGlobalOptions(cmd) {
280
+ if (!this.showGlobalOptions) return [];
281
+ const globalOptions = [];
282
+ for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
283
+ const visibleOptions = ancestorCmd.options.filter(
284
+ (option) => !option.hidden
285
+ );
286
+ globalOptions.push(...visibleOptions);
287
+ }
288
+ if (this.sortOptions) {
289
+ globalOptions.sort(this.compareOptions);
290
+ }
291
+ return globalOptions;
292
+ }
293
+ /**
294
+ * Get an array of the arguments if any have a description.
295
+ *
296
+ * @param {Command} cmd
297
+ * @returns {Argument[]}
298
+ */
299
+ visibleArguments(cmd) {
300
+ if (cmd._argsDescription) {
301
+ cmd.registeredArguments.forEach((argument) => {
302
+ argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
303
+ });
304
+ }
305
+ if (cmd.registeredArguments.find((argument) => argument.description)) {
306
+ return cmd.registeredArguments;
307
+ }
308
+ return [];
309
+ }
310
+ /**
311
+ * Get the command term to show in the list of subcommands.
312
+ *
313
+ * @param {Command} cmd
314
+ * @returns {string}
315
+ */
316
+ subcommandTerm(cmd) {
317
+ const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
318
+ return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + // simplistic check for non-help option
319
+ (args ? " " + args : "");
320
+ }
321
+ /**
322
+ * Get the option term to show in the list of options.
323
+ *
324
+ * @param {Option} option
325
+ * @returns {string}
326
+ */
327
+ optionTerm(option) {
328
+ return option.flags;
329
+ }
330
+ /**
331
+ * Get the argument term to show in the list of arguments.
332
+ *
333
+ * @param {Argument} argument
334
+ * @returns {string}
335
+ */
336
+ argumentTerm(argument) {
337
+ return argument.name();
338
+ }
339
+ /**
340
+ * Get the longest command term length.
341
+ *
342
+ * @param {Command} cmd
343
+ * @param {Help} helper
344
+ * @returns {number}
345
+ */
346
+ longestSubcommandTermLength(cmd, helper) {
347
+ return helper.visibleCommands(cmd).reduce((max, command) => {
348
+ return Math.max(
349
+ max,
350
+ this.displayWidth(
351
+ helper.styleSubcommandTerm(helper.subcommandTerm(command))
352
+ )
353
+ );
354
+ }, 0);
355
+ }
356
+ /**
357
+ * Get the longest option term length.
358
+ *
359
+ * @param {Command} cmd
360
+ * @param {Help} helper
361
+ * @returns {number}
362
+ */
363
+ longestOptionTermLength(cmd, helper) {
364
+ return helper.visibleOptions(cmd).reduce((max, option) => {
365
+ return Math.max(
366
+ max,
367
+ this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option)))
368
+ );
369
+ }, 0);
370
+ }
371
+ /**
372
+ * Get the longest global option term length.
373
+ *
374
+ * @param {Command} cmd
375
+ * @param {Help} helper
376
+ * @returns {number}
377
+ */
378
+ longestGlobalOptionTermLength(cmd, helper) {
379
+ return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
380
+ return Math.max(
381
+ max,
382
+ this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option)))
383
+ );
384
+ }, 0);
385
+ }
386
+ /**
387
+ * Get the longest argument term length.
388
+ *
389
+ * @param {Command} cmd
390
+ * @param {Help} helper
391
+ * @returns {number}
392
+ */
393
+ longestArgumentTermLength(cmd, helper) {
394
+ return helper.visibleArguments(cmd).reduce((max, argument) => {
395
+ return Math.max(
396
+ max,
397
+ this.displayWidth(
398
+ helper.styleArgumentTerm(helper.argumentTerm(argument))
399
+ )
400
+ );
401
+ }, 0);
402
+ }
403
+ /**
404
+ * Get the command usage to be displayed at the top of the built-in help.
405
+ *
406
+ * @param {Command} cmd
407
+ * @returns {string}
408
+ */
409
+ commandUsage(cmd) {
410
+ let cmdName = cmd._name;
411
+ if (cmd._aliases[0]) {
412
+ cmdName = cmdName + "|" + cmd._aliases[0];
413
+ }
414
+ let ancestorCmdNames = "";
415
+ for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
416
+ ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
417
+ }
418
+ return ancestorCmdNames + cmdName + " " + cmd.usage();
419
+ }
420
+ /**
421
+ * Get the description for the command.
422
+ *
423
+ * @param {Command} cmd
424
+ * @returns {string}
425
+ */
426
+ commandDescription(cmd) {
427
+ return cmd.description();
428
+ }
429
+ /**
430
+ * Get the subcommand summary to show in the list of subcommands.
431
+ * (Fallback to description for backwards compatibility.)
432
+ *
433
+ * @param {Command} cmd
434
+ * @returns {string}
435
+ */
436
+ subcommandDescription(cmd) {
437
+ return cmd.summary() || cmd.description();
438
+ }
439
+ /**
440
+ * Get the option description to show in the list of options.
441
+ *
442
+ * @param {Option} option
443
+ * @return {string}
444
+ */
445
+ optionDescription(option) {
446
+ const extraInfo = [];
447
+ if (option.argChoices) {
448
+ extraInfo.push(
449
+ // use stringify to match the display of the default value
450
+ `choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`
451
+ );
452
+ }
453
+ if (option.defaultValue !== void 0) {
454
+ const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
455
+ if (showDefault) {
456
+ extraInfo.push(
457
+ `default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`
458
+ );
459
+ }
460
+ }
461
+ if (option.presetArg !== void 0 && option.optional) {
462
+ extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
463
+ }
464
+ if (option.envVar !== void 0) {
465
+ extraInfo.push(`env: ${option.envVar}`);
466
+ }
467
+ if (extraInfo.length > 0) {
468
+ const extraDescription = `(${extraInfo.join(", ")})`;
469
+ if (option.description) {
470
+ return `${option.description} ${extraDescription}`;
471
+ }
472
+ return extraDescription;
473
+ }
474
+ return option.description;
475
+ }
476
+ /**
477
+ * Get the argument description to show in the list of arguments.
478
+ *
479
+ * @param {Argument} argument
480
+ * @return {string}
481
+ */
482
+ argumentDescription(argument) {
483
+ const extraInfo = [];
484
+ if (argument.argChoices) {
485
+ extraInfo.push(
486
+ // use stringify to match the display of the default value
487
+ `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`
488
+ );
489
+ }
490
+ if (argument.defaultValue !== void 0) {
491
+ extraInfo.push(
492
+ `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`
493
+ );
494
+ }
495
+ if (extraInfo.length > 0) {
496
+ const extraDescription = `(${extraInfo.join(", ")})`;
497
+ if (argument.description) {
498
+ return `${argument.description} ${extraDescription}`;
499
+ }
500
+ return extraDescription;
501
+ }
502
+ return argument.description;
503
+ }
504
+ /**
505
+ * Format a list of items, given a heading and an array of formatted items.
506
+ *
507
+ * @param {string} heading
508
+ * @param {string[]} items
509
+ * @param {Help} helper
510
+ * @returns string[]
511
+ */
512
+ formatItemList(heading, items, helper) {
513
+ if (items.length === 0) return [];
514
+ return [helper.styleTitle(heading), ...items, ""];
515
+ }
516
+ /**
517
+ * Group items by their help group heading.
518
+ *
519
+ * @param {Command[] | Option[]} unsortedItems
520
+ * @param {Command[] | Option[]} visibleItems
521
+ * @param {Function} getGroup
522
+ * @returns {Map<string, Command[] | Option[]>}
523
+ */
524
+ groupItems(unsortedItems, visibleItems, getGroup) {
525
+ const result = /* @__PURE__ */ new Map();
526
+ unsortedItems.forEach((item) => {
527
+ const group = getGroup(item);
528
+ if (!result.has(group)) result.set(group, []);
529
+ });
530
+ visibleItems.forEach((item) => {
531
+ const group = getGroup(item);
532
+ if (!result.has(group)) {
533
+ result.set(group, []);
534
+ }
535
+ result.get(group).push(item);
536
+ });
537
+ return result;
538
+ }
539
+ /**
540
+ * Generate the built-in help text.
541
+ *
542
+ * @param {Command} cmd
543
+ * @param {Help} helper
544
+ * @returns {string}
545
+ */
546
+ formatHelp(cmd, helper) {
547
+ const termWidth = helper.padWidth(cmd, helper);
548
+ const helpWidth = helper.helpWidth ?? 80;
549
+ function callFormatItem(term, description) {
550
+ return helper.formatItem(term, termWidth, description, helper);
551
+ }
552
+ __name(callFormatItem, "callFormatItem");
553
+ let output = [
554
+ `${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
555
+ ""
556
+ ];
557
+ const commandDescription = helper.commandDescription(cmd);
558
+ if (commandDescription.length > 0) {
559
+ output = output.concat([
560
+ helper.boxWrap(
561
+ helper.styleCommandDescription(commandDescription),
562
+ helpWidth
563
+ ),
564
+ ""
565
+ ]);
566
+ }
567
+ const argumentList = helper.visibleArguments(cmd).map((argument) => {
568
+ return callFormatItem(
569
+ helper.styleArgumentTerm(helper.argumentTerm(argument)),
570
+ helper.styleArgumentDescription(helper.argumentDescription(argument))
571
+ );
572
+ });
573
+ output = output.concat(
574
+ this.formatItemList("Arguments:", argumentList, helper)
575
+ );
576
+ const optionGroups = this.groupItems(
577
+ cmd.options,
578
+ helper.visibleOptions(cmd),
579
+ (option) => option.helpGroupHeading ?? "Options:"
580
+ );
581
+ optionGroups.forEach((options, group) => {
582
+ const optionList = options.map((option) => {
583
+ return callFormatItem(
584
+ helper.styleOptionTerm(helper.optionTerm(option)),
585
+ helper.styleOptionDescription(helper.optionDescription(option))
586
+ );
587
+ });
588
+ output = output.concat(this.formatItemList(group, optionList, helper));
589
+ });
590
+ if (helper.showGlobalOptions) {
591
+ const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
592
+ return callFormatItem(
593
+ helper.styleOptionTerm(helper.optionTerm(option)),
594
+ helper.styleOptionDescription(helper.optionDescription(option))
595
+ );
596
+ });
597
+ output = output.concat(
598
+ this.formatItemList("Global Options:", globalOptionList, helper)
599
+ );
600
+ }
601
+ const commandGroups = this.groupItems(
602
+ cmd.commands,
603
+ helper.visibleCommands(cmd),
604
+ (sub) => sub.helpGroup() || "Commands:"
605
+ );
606
+ commandGroups.forEach((commands, group) => {
607
+ const commandList = commands.map((sub) => {
608
+ return callFormatItem(
609
+ helper.styleSubcommandTerm(helper.subcommandTerm(sub)),
610
+ helper.styleSubcommandDescription(helper.subcommandDescription(sub))
611
+ );
612
+ });
613
+ output = output.concat(this.formatItemList(group, commandList, helper));
614
+ });
615
+ return output.join("\n");
616
+ }
617
+ /**
618
+ * Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations.
619
+ *
620
+ * @param {string} str
621
+ * @returns {number}
622
+ */
623
+ displayWidth(str) {
624
+ return stripColor(str).length;
625
+ }
626
+ /**
627
+ * Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.
628
+ *
629
+ * @param {string} str
630
+ * @returns {string}
631
+ */
632
+ styleTitle(str) {
633
+ return str;
634
+ }
635
+ styleUsage(str) {
636
+ return str.split(" ").map((word) => {
637
+ if (word === "[options]") return this.styleOptionText(word);
638
+ if (word === "[command]") return this.styleSubcommandText(word);
639
+ if (word[0] === "[" || word[0] === "<")
640
+ return this.styleArgumentText(word);
641
+ return this.styleCommandText(word);
642
+ }).join(" ");
643
+ }
644
+ styleCommandDescription(str) {
645
+ return this.styleDescriptionText(str);
646
+ }
647
+ styleOptionDescription(str) {
648
+ return this.styleDescriptionText(str);
649
+ }
650
+ styleSubcommandDescription(str) {
651
+ return this.styleDescriptionText(str);
652
+ }
653
+ styleArgumentDescription(str) {
654
+ return this.styleDescriptionText(str);
655
+ }
656
+ styleDescriptionText(str) {
657
+ return str;
658
+ }
659
+ styleOptionTerm(str) {
660
+ return this.styleOptionText(str);
661
+ }
662
+ styleSubcommandTerm(str) {
663
+ return str.split(" ").map((word) => {
664
+ if (word === "[options]") return this.styleOptionText(word);
665
+ if (word[0] === "[" || word[0] === "<")
666
+ return this.styleArgumentText(word);
667
+ return this.styleSubcommandText(word);
668
+ }).join(" ");
669
+ }
670
+ styleArgumentTerm(str) {
671
+ return this.styleArgumentText(str);
672
+ }
673
+ styleOptionText(str) {
674
+ return str;
675
+ }
676
+ styleArgumentText(str) {
677
+ return str;
678
+ }
679
+ styleSubcommandText(str) {
680
+ return str;
681
+ }
682
+ styleCommandText(str) {
683
+ return str;
684
+ }
685
+ /**
686
+ * Calculate the pad width from the maximum term length.
687
+ *
688
+ * @param {Command} cmd
689
+ * @param {Help} helper
690
+ * @returns {number}
691
+ */
692
+ padWidth(cmd, helper) {
693
+ return Math.max(
694
+ helper.longestOptionTermLength(cmd, helper),
695
+ helper.longestGlobalOptionTermLength(cmd, helper),
696
+ helper.longestSubcommandTermLength(cmd, helper),
697
+ helper.longestArgumentTermLength(cmd, helper)
698
+ );
699
+ }
700
+ /**
701
+ * Detect manually wrapped and indented strings by checking for line break followed by whitespace.
702
+ *
703
+ * @param {string} str
704
+ * @returns {boolean}
705
+ */
706
+ preformatted(str) {
707
+ return /\n[^\S\r\n]/.test(str);
708
+ }
709
+ /**
710
+ * Format the "item", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.
711
+ *
712
+ * So "TTT", 5, "DDD DDDD DD DDD" might be formatted for this.helpWidth=17 like so:
713
+ * TTT DDD DDDD
714
+ * DD DDD
715
+ *
716
+ * @param {string} term
717
+ * @param {number} termWidth
718
+ * @param {string} description
719
+ * @param {Help} helper
720
+ * @returns {string}
721
+ */
722
+ formatItem(term, termWidth, description, helper) {
723
+ const itemIndent = 2;
724
+ const itemIndentStr = " ".repeat(itemIndent);
725
+ if (!description) return itemIndentStr + term;
726
+ const paddedTerm = term.padEnd(
727
+ termWidth + term.length - helper.displayWidth(term)
728
+ );
729
+ const spacerWidth = 2;
730
+ const helpWidth = this.helpWidth ?? 80;
731
+ const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
732
+ let formattedDescription;
733
+ if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
734
+ formattedDescription = description;
735
+ } else {
736
+ const wrappedDescription = helper.boxWrap(description, remainingWidth);
737
+ formattedDescription = wrappedDescription.replace(
738
+ /\n/g,
739
+ "\n" + " ".repeat(termWidth + spacerWidth)
740
+ );
741
+ }
742
+ return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
743
+ ${itemIndentStr}`);
744
+ }
745
+ /**
746
+ * Wrap a string at whitespace, preserving existing line breaks.
747
+ * Wrapping is skipped if the width is less than `minWidthToWrap`.
748
+ *
749
+ * @param {string} str
750
+ * @param {number} width
751
+ * @returns {string}
752
+ */
753
+ boxWrap(str, width) {
754
+ if (width < this.minWidthToWrap) return str;
755
+ const rawLines = str.split(/\r\n|\n/);
756
+ const chunkPattern = /[\s]*[^\s]+/g;
757
+ const wrappedLines = [];
758
+ rawLines.forEach((line) => {
759
+ const chunks = line.match(chunkPattern);
760
+ if (chunks === null) {
761
+ wrappedLines.push("");
762
+ return;
763
+ }
764
+ let sumChunks = [chunks.shift()];
765
+ let sumWidth = this.displayWidth(sumChunks[0]);
766
+ chunks.forEach((chunk) => {
767
+ const visibleWidth = this.displayWidth(chunk);
768
+ if (sumWidth + visibleWidth <= width) {
769
+ sumChunks.push(chunk);
770
+ sumWidth += visibleWidth;
771
+ return;
772
+ }
773
+ wrappedLines.push(sumChunks.join(""));
774
+ const nextChunk = chunk.trimStart();
775
+ sumChunks = [nextChunk];
776
+ sumWidth = this.displayWidth(nextChunk);
777
+ });
778
+ wrappedLines.push(sumChunks.join(""));
779
+ });
780
+ return wrappedLines.join("\n");
781
+ }
782
+ };
783
+ function stripColor(str) {
784
+ const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
785
+ return str.replace(sgrPattern, "");
786
+ }
787
+ __name(stripColor, "stripColor");
788
+ exports.Help = Help2;
789
+ exports.stripColor = stripColor;
790
+ }
791
+ });
792
+
793
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/option.js
794
+ var require_option = __commonJS({
795
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/option.js"(exports) {
796
+ "use strict";
797
+ var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
798
+ var Option2 = class {
799
+ static {
800
+ __name(this, "Option");
801
+ }
802
+ /**
803
+ * Initialize a new `Option` with the given `flags` and `description`.
804
+ *
805
+ * @param {string} flags
806
+ * @param {string} [description]
807
+ */
808
+ constructor(flags, description) {
809
+ this.flags = flags;
810
+ this.description = description || "";
811
+ this.required = flags.includes("<");
812
+ this.optional = flags.includes("[");
813
+ this.variadic = /\w\.\.\.[>\]]$/.test(flags);
814
+ this.mandatory = false;
815
+ const optionFlags = splitOptionFlags(flags);
816
+ this.short = optionFlags.shortFlag;
817
+ this.long = optionFlags.longFlag;
818
+ this.negate = false;
819
+ if (this.long) {
820
+ this.negate = this.long.startsWith("--no-");
821
+ }
822
+ this.defaultValue = void 0;
823
+ this.defaultValueDescription = void 0;
824
+ this.presetArg = void 0;
825
+ this.envVar = void 0;
826
+ this.parseArg = void 0;
827
+ this.hidden = false;
828
+ this.argChoices = void 0;
829
+ this.conflictsWith = [];
830
+ this.implied = void 0;
831
+ this.helpGroupHeading = void 0;
832
+ }
833
+ /**
834
+ * Set the default value, and optionally supply the description to be displayed in the help.
835
+ *
836
+ * @param {*} value
837
+ * @param {string} [description]
838
+ * @return {Option}
839
+ */
840
+ default(value, description) {
841
+ this.defaultValue = value;
842
+ this.defaultValueDescription = description;
843
+ return this;
844
+ }
845
+ /**
846
+ * Preset to use when option used without option-argument, especially optional but also boolean and negated.
847
+ * The custom processing (parseArg) is called.
848
+ *
849
+ * @example
850
+ * new Option('--color').default('GREYSCALE').preset('RGB');
851
+ * new Option('--donate [amount]').preset('20').argParser(parseFloat);
852
+ *
853
+ * @param {*} arg
854
+ * @return {Option}
855
+ */
856
+ preset(arg) {
857
+ this.presetArg = arg;
858
+ return this;
859
+ }
860
+ /**
861
+ * Add option name(s) that conflict with this option.
862
+ * An error will be displayed if conflicting options are found during parsing.
863
+ *
864
+ * @example
865
+ * new Option('--rgb').conflicts('cmyk');
866
+ * new Option('--js').conflicts(['ts', 'jsx']);
867
+ *
868
+ * @param {(string | string[])} names
869
+ * @return {Option}
870
+ */
871
+ conflicts(names) {
872
+ this.conflictsWith = this.conflictsWith.concat(names);
873
+ return this;
874
+ }
875
+ /**
876
+ * Specify implied option values for when this option is set and the implied options are not.
877
+ *
878
+ * The custom processing (parseArg) is not called on the implied values.
879
+ *
880
+ * @example
881
+ * program
882
+ * .addOption(new Option('--log', 'write logging information to file'))
883
+ * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));
884
+ *
885
+ * @param {object} impliedOptionValues
886
+ * @return {Option}
887
+ */
888
+ implies(impliedOptionValues) {
889
+ let newImplied = impliedOptionValues;
890
+ if (typeof impliedOptionValues === "string") {
891
+ newImplied = { [impliedOptionValues]: true };
892
+ }
893
+ this.implied = Object.assign(this.implied || {}, newImplied);
894
+ return this;
895
+ }
896
+ /**
897
+ * Set environment variable to check for option value.
898
+ *
899
+ * An environment variable is only used if when processed the current option value is
900
+ * undefined, or the source of the current value is 'default' or 'config' or 'env'.
901
+ *
902
+ * @param {string} name
903
+ * @return {Option}
904
+ */
905
+ env(name) {
906
+ this.envVar = name;
907
+ return this;
908
+ }
909
+ /**
910
+ * Set the custom handler for processing CLI option arguments into option values.
911
+ *
912
+ * @param {Function} [fn]
913
+ * @return {Option}
914
+ */
915
+ argParser(fn) {
916
+ this.parseArg = fn;
917
+ return this;
918
+ }
919
+ /**
920
+ * Whether the option is mandatory and must have a value after parsing.
921
+ *
922
+ * @param {boolean} [mandatory=true]
923
+ * @return {Option}
924
+ */
925
+ makeOptionMandatory(mandatory = true) {
926
+ this.mandatory = !!mandatory;
927
+ return this;
928
+ }
929
+ /**
930
+ * Hide option in help.
931
+ *
932
+ * @param {boolean} [hide=true]
933
+ * @return {Option}
934
+ */
935
+ hideHelp(hide = true) {
936
+ this.hidden = !!hide;
937
+ return this;
938
+ }
939
+ /**
940
+ * @package
941
+ */
942
+ _collectValue(value, previous) {
943
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
944
+ return [value];
945
+ }
946
+ previous.push(value);
947
+ return previous;
948
+ }
949
+ /**
950
+ * Only allow option value to be one of choices.
951
+ *
952
+ * @param {string[]} values
953
+ * @return {Option}
954
+ */
955
+ choices(values) {
956
+ this.argChoices = values.slice();
957
+ this.parseArg = (arg, previous) => {
958
+ if (!this.argChoices.includes(arg)) {
959
+ throw new InvalidArgumentError2(
960
+ `Allowed choices are ${this.argChoices.join(", ")}.`
961
+ );
962
+ }
963
+ if (this.variadic) {
964
+ return this._collectValue(arg, previous);
965
+ }
966
+ return arg;
967
+ };
968
+ return this;
969
+ }
970
+ /**
971
+ * Return option name.
972
+ *
973
+ * @return {string}
974
+ */
975
+ name() {
976
+ if (this.long) {
977
+ return this.long.replace(/^--/, "");
978
+ }
979
+ return this.short.replace(/^-/, "");
980
+ }
981
+ /**
982
+ * Return option name, in a camelcase format that can be used
983
+ * as an object attribute key.
984
+ *
985
+ * @return {string}
986
+ */
987
+ attributeName() {
988
+ if (this.negate) {
989
+ return camelcase(this.name().replace(/^no-/, ""));
990
+ }
991
+ return camelcase(this.name());
992
+ }
993
+ /**
994
+ * Set the help group heading.
995
+ *
996
+ * @param {string} heading
997
+ * @return {Option}
998
+ */
999
+ helpGroup(heading) {
1000
+ this.helpGroupHeading = heading;
1001
+ return this;
1002
+ }
1003
+ /**
1004
+ * Check if `arg` matches the short or long flag.
1005
+ *
1006
+ * @param {string} arg
1007
+ * @return {boolean}
1008
+ * @package
1009
+ */
1010
+ is(arg) {
1011
+ return this.short === arg || this.long === arg;
1012
+ }
1013
+ /**
1014
+ * Return whether a boolean option.
1015
+ *
1016
+ * Options are one of boolean, negated, required argument, or optional argument.
1017
+ *
1018
+ * @return {boolean}
1019
+ * @package
1020
+ */
1021
+ isBoolean() {
1022
+ return !this.required && !this.optional && !this.negate;
1023
+ }
1024
+ };
1025
+ var DualOptions = class {
1026
+ static {
1027
+ __name(this, "DualOptions");
1028
+ }
1029
+ /**
1030
+ * @param {Option[]} options
1031
+ */
1032
+ constructor(options) {
1033
+ this.positiveOptions = /* @__PURE__ */ new Map();
1034
+ this.negativeOptions = /* @__PURE__ */ new Map();
1035
+ this.dualOptions = /* @__PURE__ */ new Set();
1036
+ options.forEach((option) => {
1037
+ if (option.negate) {
1038
+ this.negativeOptions.set(option.attributeName(), option);
1039
+ } else {
1040
+ this.positiveOptions.set(option.attributeName(), option);
1041
+ }
1042
+ });
1043
+ this.negativeOptions.forEach((value, key) => {
1044
+ if (this.positiveOptions.has(key)) {
1045
+ this.dualOptions.add(key);
1046
+ }
1047
+ });
1048
+ }
1049
+ /**
1050
+ * Did the value come from the option, and not from possible matching dual option?
1051
+ *
1052
+ * @param {*} value
1053
+ * @param {Option} option
1054
+ * @returns {boolean}
1055
+ */
1056
+ valueFromOption(value, option) {
1057
+ const optionKey = option.attributeName();
1058
+ if (!this.dualOptions.has(optionKey)) return true;
1059
+ const preset = this.negativeOptions.get(optionKey).presetArg;
1060
+ const negativeValue = preset !== void 0 ? preset : false;
1061
+ return option.negate === (negativeValue === value);
1062
+ }
1063
+ };
1064
+ function camelcase(str) {
1065
+ return str.split("-").reduce((str2, word) => {
1066
+ return str2 + word[0].toUpperCase() + word.slice(1);
1067
+ });
1068
+ }
1069
+ __name(camelcase, "camelcase");
1070
+ function splitOptionFlags(flags) {
1071
+ let shortFlag;
1072
+ let longFlag;
1073
+ const shortFlagExp = /^-[^-]$/;
1074
+ const longFlagExp = /^--[^-]/;
1075
+ const flagParts = flags.split(/[ |,]+/).concat("guard");
1076
+ if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();
1077
+ if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();
1078
+ if (!shortFlag && shortFlagExp.test(flagParts[0]))
1079
+ shortFlag = flagParts.shift();
1080
+ if (!shortFlag && longFlagExp.test(flagParts[0])) {
1081
+ shortFlag = longFlag;
1082
+ longFlag = flagParts.shift();
1083
+ }
1084
+ if (flagParts[0].startsWith("-")) {
1085
+ const unsupportedFlag = flagParts[0];
1086
+ const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
1087
+ if (/^-[^-][^-]/.test(unsupportedFlag))
1088
+ throw new Error(
1089
+ `${baseError}
1090
+ - a short flag is a single dash and a single character
1091
+ - either use a single dash and a single character (for a short flag)
1092
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`
1093
+ );
1094
+ if (shortFlagExp.test(unsupportedFlag))
1095
+ throw new Error(`${baseError}
1096
+ - too many short flags`);
1097
+ if (longFlagExp.test(unsupportedFlag))
1098
+ throw new Error(`${baseError}
1099
+ - too many long flags`);
1100
+ throw new Error(`${baseError}
1101
+ - unrecognised flag format`);
1102
+ }
1103
+ if (shortFlag === void 0 && longFlag === void 0)
1104
+ throw new Error(
1105
+ `option creation failed due to no flags found in '${flags}'.`
1106
+ );
1107
+ return { shortFlag, longFlag };
1108
+ }
1109
+ __name(splitOptionFlags, "splitOptionFlags");
1110
+ exports.Option = Option2;
1111
+ exports.DualOptions = DualOptions;
1112
+ }
1113
+ });
1114
+
1115
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/suggestSimilar.js
1116
+ var require_suggestSimilar = __commonJS({
1117
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/suggestSimilar.js"(exports) {
1118
+ "use strict";
1119
+ var maxDistance = 3;
1120
+ function editDistance(a, b) {
1121
+ if (Math.abs(a.length - b.length) > maxDistance)
1122
+ return Math.max(a.length, b.length);
1123
+ const d = [];
1124
+ for (let i = 0; i <= a.length; i++) {
1125
+ d[i] = [i];
1126
+ }
1127
+ for (let j = 0; j <= b.length; j++) {
1128
+ d[0][j] = j;
1129
+ }
1130
+ for (let j = 1; j <= b.length; j++) {
1131
+ for (let i = 1; i <= a.length; i++) {
1132
+ let cost = 1;
1133
+ if (a[i - 1] === b[j - 1]) {
1134
+ cost = 0;
1135
+ } else {
1136
+ cost = 1;
1137
+ }
1138
+ d[i][j] = Math.min(
1139
+ d[i - 1][j] + 1,
1140
+ // deletion
1141
+ d[i][j - 1] + 1,
1142
+ // insertion
1143
+ d[i - 1][j - 1] + cost
1144
+ // substitution
1145
+ );
1146
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
1147
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
1148
+ }
1149
+ }
1150
+ }
1151
+ return d[a.length][b.length];
1152
+ }
1153
+ __name(editDistance, "editDistance");
1154
+ function suggestSimilar(word, candidates) {
1155
+ if (!candidates || candidates.length === 0) return "";
1156
+ candidates = Array.from(new Set(candidates));
1157
+ const searchingOptions = word.startsWith("--");
1158
+ if (searchingOptions) {
1159
+ word = word.slice(2);
1160
+ candidates = candidates.map((candidate) => candidate.slice(2));
1161
+ }
1162
+ let similar = [];
1163
+ let bestDistance = maxDistance;
1164
+ const minSimilarity = 0.4;
1165
+ candidates.forEach((candidate) => {
1166
+ if (candidate.length <= 1) return;
1167
+ const distance = editDistance(word, candidate);
1168
+ const length = Math.max(word.length, candidate.length);
1169
+ const similarity = (length - distance) / length;
1170
+ if (similarity > minSimilarity) {
1171
+ if (distance < bestDistance) {
1172
+ bestDistance = distance;
1173
+ similar = [candidate];
1174
+ } else if (distance === bestDistance) {
1175
+ similar.push(candidate);
1176
+ }
1177
+ }
1178
+ });
1179
+ similar.sort((a, b) => a.localeCompare(b));
1180
+ if (searchingOptions) {
1181
+ similar = similar.map((candidate) => `--${candidate}`);
1182
+ }
1183
+ if (similar.length > 1) {
1184
+ return `
1185
+ (Did you mean one of ${similar.join(", ")}?)`;
1186
+ }
1187
+ if (similar.length === 1) {
1188
+ return `
1189
+ (Did you mean ${similar[0]}?)`;
1190
+ }
1191
+ return "";
1192
+ }
1193
+ __name(suggestSimilar, "suggestSimilar");
1194
+ exports.suggestSimilar = suggestSimilar;
1195
+ }
1196
+ });
1197
+
1198
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js
1199
+ var require_command = __commonJS({
1200
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
1201
+ "use strict";
1202
+ var EventEmitter = __require("node:events").EventEmitter;
1203
+ var childProcess = __require("node:child_process");
1204
+ var path = __require("node:path");
1205
+ var fs = __require("node:fs");
1206
+ var process = __require("node:process");
1207
+ var { Argument: Argument2, humanReadableArgName } = require_argument();
1208
+ var { CommanderError: CommanderError2 } = require_error();
1209
+ var { Help: Help2, stripColor } = require_help();
1210
+ var { Option: Option2, DualOptions } = require_option();
1211
+ var { suggestSimilar } = require_suggestSimilar();
1212
+ var Command2 = class _Command extends EventEmitter {
1213
+ static {
1214
+ __name(this, "Command");
1215
+ }
1216
+ /**
1217
+ * Initialize a new `Command`.
1218
+ *
1219
+ * @param {string} [name]
1220
+ */
1221
+ constructor(name) {
1222
+ super();
1223
+ this.commands = [];
1224
+ this.options = [];
1225
+ this.parent = null;
1226
+ this._allowUnknownOption = false;
1227
+ this._allowExcessArguments = false;
1228
+ this.registeredArguments = [];
1229
+ this._args = this.registeredArguments;
1230
+ this.args = [];
1231
+ this.rawArgs = [];
1232
+ this.processedArgs = [];
1233
+ this._scriptPath = null;
1234
+ this._name = name || "";
1235
+ this._optionValues = {};
1236
+ this._optionValueSources = {};
1237
+ this._storeOptionsAsProperties = false;
1238
+ this._actionHandler = null;
1239
+ this._executableHandler = false;
1240
+ this._executableFile = null;
1241
+ this._executableDir = null;
1242
+ this._defaultCommandName = null;
1243
+ this._exitCallback = null;
1244
+ this._aliases = [];
1245
+ this._combineFlagAndOptionalValue = true;
1246
+ this._description = "";
1247
+ this._summary = "";
1248
+ this._argsDescription = void 0;
1249
+ this._enablePositionalOptions = false;
1250
+ this._passThroughOptions = false;
1251
+ this._lifeCycleHooks = {};
1252
+ this._showHelpAfterError = false;
1253
+ this._showSuggestionAfterError = true;
1254
+ this._savedState = null;
1255
+ this._outputConfiguration = {
1256
+ writeOut: /* @__PURE__ */ __name((str) => process.stdout.write(str), "writeOut"),
1257
+ writeErr: /* @__PURE__ */ __name((str) => process.stderr.write(str), "writeErr"),
1258
+ outputError: /* @__PURE__ */ __name((str, write) => write(str), "outputError"),
1259
+ getOutHelpWidth: /* @__PURE__ */ __name(() => process.stdout.isTTY ? process.stdout.columns : void 0, "getOutHelpWidth"),
1260
+ getErrHelpWidth: /* @__PURE__ */ __name(() => process.stderr.isTTY ? process.stderr.columns : void 0, "getErrHelpWidth"),
1261
+ getOutHasColors: /* @__PURE__ */ __name(() => useColor() ?? (process.stdout.isTTY && process.stdout.hasColors?.()), "getOutHasColors"),
1262
+ getErrHasColors: /* @__PURE__ */ __name(() => useColor() ?? (process.stderr.isTTY && process.stderr.hasColors?.()), "getErrHasColors"),
1263
+ stripColor: /* @__PURE__ */ __name((str) => stripColor(str), "stripColor")
1264
+ };
1265
+ this._hidden = false;
1266
+ this._helpOption = void 0;
1267
+ this._addImplicitHelpCommand = void 0;
1268
+ this._helpCommand = void 0;
1269
+ this._helpConfiguration = {};
1270
+ this._helpGroupHeading = void 0;
1271
+ this._defaultCommandGroup = void 0;
1272
+ this._defaultOptionGroup = void 0;
1273
+ }
1274
+ /**
1275
+ * Copy settings that are useful to have in common across root command and subcommands.
1276
+ *
1277
+ * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)
1278
+ *
1279
+ * @param {Command} sourceCommand
1280
+ * @return {Command} `this` command for chaining
1281
+ */
1282
+ copyInheritedSettings(sourceCommand) {
1283
+ this._outputConfiguration = sourceCommand._outputConfiguration;
1284
+ this._helpOption = sourceCommand._helpOption;
1285
+ this._helpCommand = sourceCommand._helpCommand;
1286
+ this._helpConfiguration = sourceCommand._helpConfiguration;
1287
+ this._exitCallback = sourceCommand._exitCallback;
1288
+ this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
1289
+ this._combineFlagAndOptionalValue = sourceCommand._combineFlagAndOptionalValue;
1290
+ this._allowExcessArguments = sourceCommand._allowExcessArguments;
1291
+ this._enablePositionalOptions = sourceCommand._enablePositionalOptions;
1292
+ this._showHelpAfterError = sourceCommand._showHelpAfterError;
1293
+ this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;
1294
+ return this;
1295
+ }
1296
+ /**
1297
+ * @returns {Command[]}
1298
+ * @private
1299
+ */
1300
+ _getCommandAndAncestors() {
1301
+ const result = [];
1302
+ for (let command = this; command; command = command.parent) {
1303
+ result.push(command);
1304
+ }
1305
+ return result;
1306
+ }
1307
+ /**
1308
+ * Define a command.
1309
+ *
1310
+ * There are two styles of command: pay attention to where to put the description.
1311
+ *
1312
+ * @example
1313
+ * // Command implemented using action handler (description is supplied separately to `.command`)
1314
+ * program
1315
+ * .command('clone <source> [destination]')
1316
+ * .description('clone a repository into a newly created directory')
1317
+ * .action((source, destination) => {
1318
+ * console.log('clone command called');
1319
+ * });
1320
+ *
1321
+ * // Command implemented using separate executable file (description is second parameter to `.command`)
1322
+ * program
1323
+ * .command('start <service>', 'start named service')
1324
+ * .command('stop [service]', 'stop named service, or all if no name supplied');
1325
+ *
1326
+ * @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
1327
+ * @param {(object | string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
1328
+ * @param {object} [execOpts] - configuration options (for executable)
1329
+ * @return {Command} returns new command for action handler, or `this` for executable command
1330
+ */
1331
+ command(nameAndArgs, actionOptsOrExecDesc, execOpts) {
1332
+ let desc = actionOptsOrExecDesc;
1333
+ let opts = execOpts;
1334
+ if (typeof desc === "object" && desc !== null) {
1335
+ opts = desc;
1336
+ desc = null;
1337
+ }
1338
+ opts = opts || {};
1339
+ const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
1340
+ const cmd = this.createCommand(name);
1341
+ if (desc) {
1342
+ cmd.description(desc);
1343
+ cmd._executableHandler = true;
1344
+ }
1345
+ if (opts.isDefault) this._defaultCommandName = cmd._name;
1346
+ cmd._hidden = !!(opts.noHelp || opts.hidden);
1347
+ cmd._executableFile = opts.executableFile || null;
1348
+ if (args) cmd.arguments(args);
1349
+ this._registerCommand(cmd);
1350
+ cmd.parent = this;
1351
+ cmd.copyInheritedSettings(this);
1352
+ if (desc) return this;
1353
+ return cmd;
1354
+ }
1355
+ /**
1356
+ * Factory routine to create a new unattached command.
1357
+ *
1358
+ * See .command() for creating an attached subcommand, which uses this routine to
1359
+ * create the command. You can override createCommand to customise subcommands.
1360
+ *
1361
+ * @param {string} [name]
1362
+ * @return {Command} new command
1363
+ */
1364
+ createCommand(name) {
1365
+ return new _Command(name);
1366
+ }
1367
+ /**
1368
+ * You can customise the help with a subclass of Help by overriding createHelp,
1369
+ * or by overriding Help properties using configureHelp().
1370
+ *
1371
+ * @return {Help}
1372
+ */
1373
+ createHelp() {
1374
+ return Object.assign(new Help2(), this.configureHelp());
1375
+ }
1376
+ /**
1377
+ * You can customise the help by overriding Help properties using configureHelp(),
1378
+ * or with a subclass of Help by overriding createHelp().
1379
+ *
1380
+ * @param {object} [configuration] - configuration options
1381
+ * @return {(Command | object)} `this` command for chaining, or stored configuration
1382
+ */
1383
+ configureHelp(configuration) {
1384
+ if (configuration === void 0) return this._helpConfiguration;
1385
+ this._helpConfiguration = configuration;
1386
+ return this;
1387
+ }
1388
+ /**
1389
+ * The default output goes to stdout and stderr. You can customise this for special
1390
+ * applications. You can also customise the display of errors by overriding outputError.
1391
+ *
1392
+ * The configuration properties are all functions:
1393
+ *
1394
+ * // change how output being written, defaults to stdout and stderr
1395
+ * writeOut(str)
1396
+ * writeErr(str)
1397
+ * // change how output being written for errors, defaults to writeErr
1398
+ * outputError(str, write) // used for displaying errors and not used for displaying help
1399
+ * // specify width for wrapping help
1400
+ * getOutHelpWidth()
1401
+ * getErrHelpWidth()
1402
+ * // color support, currently only used with Help
1403
+ * getOutHasColors()
1404
+ * getErrHasColors()
1405
+ * stripColor() // used to remove ANSI escape codes if output does not have colors
1406
+ *
1407
+ * @param {object} [configuration] - configuration options
1408
+ * @return {(Command | object)} `this` command for chaining, or stored configuration
1409
+ */
1410
+ configureOutput(configuration) {
1411
+ if (configuration === void 0) return this._outputConfiguration;
1412
+ this._outputConfiguration = {
1413
+ ...this._outputConfiguration,
1414
+ ...configuration
1415
+ };
1416
+ return this;
1417
+ }
1418
+ /**
1419
+ * Display the help or a custom message after an error occurs.
1420
+ *
1421
+ * @param {(boolean|string)} [displayHelp]
1422
+ * @return {Command} `this` command for chaining
1423
+ */
1424
+ showHelpAfterError(displayHelp = true) {
1425
+ if (typeof displayHelp !== "string") displayHelp = !!displayHelp;
1426
+ this._showHelpAfterError = displayHelp;
1427
+ return this;
1428
+ }
1429
+ /**
1430
+ * Display suggestion of similar commands for unknown commands, or options for unknown options.
1431
+ *
1432
+ * @param {boolean} [displaySuggestion]
1433
+ * @return {Command} `this` command for chaining
1434
+ */
1435
+ showSuggestionAfterError(displaySuggestion = true) {
1436
+ this._showSuggestionAfterError = !!displaySuggestion;
1437
+ return this;
1438
+ }
1439
+ /**
1440
+ * Add a prepared subcommand.
1441
+ *
1442
+ * See .command() for creating an attached subcommand which inherits settings from its parent.
1443
+ *
1444
+ * @param {Command} cmd - new subcommand
1445
+ * @param {object} [opts] - configuration options
1446
+ * @return {Command} `this` command for chaining
1447
+ */
1448
+ addCommand(cmd, opts) {
1449
+ if (!cmd._name) {
1450
+ throw new Error(`Command passed to .addCommand() must have a name
1451
+ - specify the name in Command constructor or using .name()`);
1452
+ }
1453
+ opts = opts || {};
1454
+ if (opts.isDefault) this._defaultCommandName = cmd._name;
1455
+ if (opts.noHelp || opts.hidden) cmd._hidden = true;
1456
+ this._registerCommand(cmd);
1457
+ cmd.parent = this;
1458
+ cmd._checkForBrokenPassThrough();
1459
+ return this;
1460
+ }
1461
+ /**
1462
+ * Factory routine to create a new unattached argument.
1463
+ *
1464
+ * See .argument() for creating an attached argument, which uses this routine to
1465
+ * create the argument. You can override createArgument to return a custom argument.
1466
+ *
1467
+ * @param {string} name
1468
+ * @param {string} [description]
1469
+ * @return {Argument} new argument
1470
+ */
1471
+ createArgument(name, description) {
1472
+ return new Argument2(name, description);
1473
+ }
1474
+ /**
1475
+ * Define argument syntax for command.
1476
+ *
1477
+ * The default is that the argument is required, and you can explicitly
1478
+ * indicate this with <> around the name. Put [] around the name for an optional argument.
1479
+ *
1480
+ * @example
1481
+ * program.argument('<input-file>');
1482
+ * program.argument('[output-file]');
1483
+ *
1484
+ * @param {string} name
1485
+ * @param {string} [description]
1486
+ * @param {(Function|*)} [parseArg] - custom argument processing function or default value
1487
+ * @param {*} [defaultValue]
1488
+ * @return {Command} `this` command for chaining
1489
+ */
1490
+ argument(name, description, parseArg, defaultValue) {
1491
+ const argument = this.createArgument(name, description);
1492
+ if (typeof parseArg === "function") {
1493
+ argument.default(defaultValue).argParser(parseArg);
1494
+ } else {
1495
+ argument.default(parseArg);
1496
+ }
1497
+ this.addArgument(argument);
1498
+ return this;
1499
+ }
1500
+ /**
1501
+ * Define argument syntax for command, adding multiple at once (without descriptions).
1502
+ *
1503
+ * See also .argument().
1504
+ *
1505
+ * @example
1506
+ * program.arguments('<cmd> [env]');
1507
+ *
1508
+ * @param {string} names
1509
+ * @return {Command} `this` command for chaining
1510
+ */
1511
+ arguments(names) {
1512
+ names.trim().split(/ +/).forEach((detail) => {
1513
+ this.argument(detail);
1514
+ });
1515
+ return this;
1516
+ }
1517
+ /**
1518
+ * Define argument syntax for command, adding a prepared argument.
1519
+ *
1520
+ * @param {Argument} argument
1521
+ * @return {Command} `this` command for chaining
1522
+ */
1523
+ addArgument(argument) {
1524
+ const previousArgument = this.registeredArguments.slice(-1)[0];
1525
+ if (previousArgument?.variadic) {
1526
+ throw new Error(
1527
+ `only the last argument can be variadic '${previousArgument.name()}'`
1528
+ );
1529
+ }
1530
+ if (argument.required && argument.defaultValue !== void 0 && argument.parseArg === void 0) {
1531
+ throw new Error(
1532
+ `a default value for a required argument is never used: '${argument.name()}'`
1533
+ );
1534
+ }
1535
+ this.registeredArguments.push(argument);
1536
+ return this;
1537
+ }
1538
+ /**
1539
+ * Customise or override default help command. By default a help command is automatically added if your command has subcommands.
1540
+ *
1541
+ * @example
1542
+ * program.helpCommand('help [cmd]');
1543
+ * program.helpCommand('help [cmd]', 'show help');
1544
+ * program.helpCommand(false); // suppress default help command
1545
+ * program.helpCommand(true); // add help command even if no subcommands
1546
+ *
1547
+ * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added
1548
+ * @param {string} [description] - custom description
1549
+ * @return {Command} `this` command for chaining
1550
+ */
1551
+ helpCommand(enableOrNameAndArgs, description) {
1552
+ if (typeof enableOrNameAndArgs === "boolean") {
1553
+ this._addImplicitHelpCommand = enableOrNameAndArgs;
1554
+ if (enableOrNameAndArgs && this._defaultCommandGroup) {
1555
+ this._initCommandGroup(this._getHelpCommand());
1556
+ }
1557
+ return this;
1558
+ }
1559
+ const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
1560
+ const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
1561
+ const helpDescription = description ?? "display help for command";
1562
+ const helpCommand = this.createCommand(helpName);
1563
+ helpCommand.helpOption(false);
1564
+ if (helpArgs) helpCommand.arguments(helpArgs);
1565
+ if (helpDescription) helpCommand.description(helpDescription);
1566
+ this._addImplicitHelpCommand = true;
1567
+ this._helpCommand = helpCommand;
1568
+ if (enableOrNameAndArgs || description) this._initCommandGroup(helpCommand);
1569
+ return this;
1570
+ }
1571
+ /**
1572
+ * Add prepared custom help command.
1573
+ *
1574
+ * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()`
1575
+ * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only
1576
+ * @return {Command} `this` command for chaining
1577
+ */
1578
+ addHelpCommand(helpCommand, deprecatedDescription) {
1579
+ if (typeof helpCommand !== "object") {
1580
+ this.helpCommand(helpCommand, deprecatedDescription);
1581
+ return this;
1582
+ }
1583
+ this._addImplicitHelpCommand = true;
1584
+ this._helpCommand = helpCommand;
1585
+ this._initCommandGroup(helpCommand);
1586
+ return this;
1587
+ }
1588
+ /**
1589
+ * Lazy create help command.
1590
+ *
1591
+ * @return {(Command|null)}
1592
+ * @package
1593
+ */
1594
+ _getHelpCommand() {
1595
+ const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? (this.commands.length && !this._actionHandler && !this._findCommand("help"));
1596
+ if (hasImplicitHelpCommand) {
1597
+ if (this._helpCommand === void 0) {
1598
+ this.helpCommand(void 0, void 0);
1599
+ }
1600
+ return this._helpCommand;
1601
+ }
1602
+ return null;
1603
+ }
1604
+ /**
1605
+ * Add hook for life cycle event.
1606
+ *
1607
+ * @param {string} event
1608
+ * @param {Function} listener
1609
+ * @return {Command} `this` command for chaining
1610
+ */
1611
+ hook(event, listener) {
1612
+ const allowedValues = ["preSubcommand", "preAction", "postAction"];
1613
+ if (!allowedValues.includes(event)) {
1614
+ throw new Error(`Unexpected value for event passed to hook : '${event}'.
1615
+ Expecting one of '${allowedValues.join("', '")}'`);
1616
+ }
1617
+ if (this._lifeCycleHooks[event]) {
1618
+ this._lifeCycleHooks[event].push(listener);
1619
+ } else {
1620
+ this._lifeCycleHooks[event] = [listener];
1621
+ }
1622
+ return this;
1623
+ }
1624
+ /**
1625
+ * Register callback to use as replacement for calling process.exit.
1626
+ *
1627
+ * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing
1628
+ * @return {Command} `this` command for chaining
1629
+ */
1630
+ exitOverride(fn) {
1631
+ if (fn) {
1632
+ this._exitCallback = fn;
1633
+ } else {
1634
+ this._exitCallback = (err) => {
1635
+ if (err.code !== "commander.executeSubCommandAsync") {
1636
+ throw err;
1637
+ } else {
1638
+ }
1639
+ };
1640
+ }
1641
+ return this;
1642
+ }
1643
+ /**
1644
+ * Call process.exit, and _exitCallback if defined.
1645
+ *
1646
+ * @param {number} exitCode exit code for using with process.exit
1647
+ * @param {string} code an id string representing the error
1648
+ * @param {string} message human-readable description of the error
1649
+ * @return never
1650
+ * @private
1651
+ */
1652
+ _exit(exitCode, code, message) {
1653
+ if (this._exitCallback) {
1654
+ this._exitCallback(new CommanderError2(exitCode, code, message));
1655
+ }
1656
+ process.exit(exitCode);
1657
+ }
1658
+ /**
1659
+ * Register callback `fn` for the command.
1660
+ *
1661
+ * @example
1662
+ * program
1663
+ * .command('serve')
1664
+ * .description('start service')
1665
+ * .action(function() {
1666
+ * // do work here
1667
+ * });
1668
+ *
1669
+ * @param {Function} fn
1670
+ * @return {Command} `this` command for chaining
1671
+ */
1672
+ action(fn) {
1673
+ const listener = /* @__PURE__ */ __name((args) => {
1674
+ const expectedArgsCount = this.registeredArguments.length;
1675
+ const actionArgs = args.slice(0, expectedArgsCount);
1676
+ if (this._storeOptionsAsProperties) {
1677
+ actionArgs[expectedArgsCount] = this;
1678
+ } else {
1679
+ actionArgs[expectedArgsCount] = this.opts();
1680
+ }
1681
+ actionArgs.push(this);
1682
+ return fn.apply(this, actionArgs);
1683
+ }, "listener");
1684
+ this._actionHandler = listener;
1685
+ return this;
1686
+ }
1687
+ /**
1688
+ * Factory routine to create a new unattached option.
1689
+ *
1690
+ * See .option() for creating an attached option, which uses this routine to
1691
+ * create the option. You can override createOption to return a custom option.
1692
+ *
1693
+ * @param {string} flags
1694
+ * @param {string} [description]
1695
+ * @return {Option} new option
1696
+ */
1697
+ createOption(flags, description) {
1698
+ return new Option2(flags, description);
1699
+ }
1700
+ /**
1701
+ * Wrap parseArgs to catch 'commander.invalidArgument'.
1702
+ *
1703
+ * @param {(Option | Argument)} target
1704
+ * @param {string} value
1705
+ * @param {*} previous
1706
+ * @param {string} invalidArgumentMessage
1707
+ * @private
1708
+ */
1709
+ _callParseArg(target, value, previous, invalidArgumentMessage) {
1710
+ try {
1711
+ return target.parseArg(value, previous);
1712
+ } catch (err) {
1713
+ if (err.code === "commander.invalidArgument") {
1714
+ const message = `${invalidArgumentMessage} ${err.message}`;
1715
+ this.error(message, { exitCode: err.exitCode, code: err.code });
1716
+ }
1717
+ throw err;
1718
+ }
1719
+ }
1720
+ /**
1721
+ * Check for option flag conflicts.
1722
+ * Register option if no conflicts found, or throw on conflict.
1723
+ *
1724
+ * @param {Option} option
1725
+ * @private
1726
+ */
1727
+ _registerOption(option) {
1728
+ const matchingOption = option.short && this._findOption(option.short) || option.long && this._findOption(option.long);
1729
+ if (matchingOption) {
1730
+ const matchingFlag = option.long && this._findOption(option.long) ? option.long : option.short;
1731
+ throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
1732
+ - already used by option '${matchingOption.flags}'`);
1733
+ }
1734
+ this._initOptionGroup(option);
1735
+ this.options.push(option);
1736
+ }
1737
+ /**
1738
+ * Check for command name and alias conflicts with existing commands.
1739
+ * Register command if no conflicts found, or throw on conflict.
1740
+ *
1741
+ * @param {Command} command
1742
+ * @private
1743
+ */
1744
+ _registerCommand(command) {
1745
+ const knownBy = /* @__PURE__ */ __name((cmd) => {
1746
+ return [cmd.name()].concat(cmd.aliases());
1747
+ }, "knownBy");
1748
+ const alreadyUsed = knownBy(command).find(
1749
+ (name) => this._findCommand(name)
1750
+ );
1751
+ if (alreadyUsed) {
1752
+ const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
1753
+ const newCmd = knownBy(command).join("|");
1754
+ throw new Error(
1755
+ `cannot add command '${newCmd}' as already have command '${existingCmd}'`
1756
+ );
1757
+ }
1758
+ this._initCommandGroup(command);
1759
+ this.commands.push(command);
1760
+ }
1761
+ /**
1762
+ * Add an option.
1763
+ *
1764
+ * @param {Option} option
1765
+ * @return {Command} `this` command for chaining
1766
+ */
1767
+ addOption(option) {
1768
+ this._registerOption(option);
1769
+ const oname = option.name();
1770
+ const name = option.attributeName();
1771
+ if (option.negate) {
1772
+ const positiveLongFlag = option.long.replace(/^--no-/, "--");
1773
+ if (!this._findOption(positiveLongFlag)) {
1774
+ this.setOptionValueWithSource(
1775
+ name,
1776
+ option.defaultValue === void 0 ? true : option.defaultValue,
1777
+ "default"
1778
+ );
1779
+ }
1780
+ } else if (option.defaultValue !== void 0) {
1781
+ this.setOptionValueWithSource(name, option.defaultValue, "default");
1782
+ }
1783
+ const handleOptionValue = /* @__PURE__ */ __name((val, invalidValueMessage, valueSource) => {
1784
+ if (val == null && option.presetArg !== void 0) {
1785
+ val = option.presetArg;
1786
+ }
1787
+ const oldValue = this.getOptionValue(name);
1788
+ if (val !== null && option.parseArg) {
1789
+ val = this._callParseArg(option, val, oldValue, invalidValueMessage);
1790
+ } else if (val !== null && option.variadic) {
1791
+ val = option._collectValue(val, oldValue);
1792
+ }
1793
+ if (val == null) {
1794
+ if (option.negate) {
1795
+ val = false;
1796
+ } else if (option.isBoolean() || option.optional) {
1797
+ val = true;
1798
+ } else {
1799
+ val = "";
1800
+ }
1801
+ }
1802
+ this.setOptionValueWithSource(name, val, valueSource);
1803
+ }, "handleOptionValue");
1804
+ this.on("option:" + oname, (val) => {
1805
+ const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
1806
+ handleOptionValue(val, invalidValueMessage, "cli");
1807
+ });
1808
+ if (option.envVar) {
1809
+ this.on("optionEnv:" + oname, (val) => {
1810
+ const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
1811
+ handleOptionValue(val, invalidValueMessage, "env");
1812
+ });
1813
+ }
1814
+ return this;
1815
+ }
1816
+ /**
1817
+ * Internal implementation shared by .option() and .requiredOption()
1818
+ *
1819
+ * @return {Command} `this` command for chaining
1820
+ * @private
1821
+ */
1822
+ _optionEx(config, flags, description, fn, defaultValue) {
1823
+ if (typeof flags === "object" && flags instanceof Option2) {
1824
+ throw new Error(
1825
+ "To add an Option object use addOption() instead of option() or requiredOption()"
1826
+ );
1827
+ }
1828
+ const option = this.createOption(flags, description);
1829
+ option.makeOptionMandatory(!!config.mandatory);
1830
+ if (typeof fn === "function") {
1831
+ option.default(defaultValue).argParser(fn);
1832
+ } else if (fn instanceof RegExp) {
1833
+ const regex = fn;
1834
+ fn = /* @__PURE__ */ __name((val, def) => {
1835
+ const m = regex.exec(val);
1836
+ return m ? m[0] : def;
1837
+ }, "fn");
1838
+ option.default(defaultValue).argParser(fn);
1839
+ } else {
1840
+ option.default(fn);
1841
+ }
1842
+ return this.addOption(option);
1843
+ }
1844
+ /**
1845
+ * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.
1846
+ *
1847
+ * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space. A required
1848
+ * option-argument is indicated by `<>` and an optional option-argument by `[]`.
1849
+ *
1850
+ * See the README for more details, and see also addOption() and requiredOption().
1851
+ *
1852
+ * @example
1853
+ * program
1854
+ * .option('-p, --pepper', 'add pepper')
1855
+ * .option('--pt, --pizza-type <TYPE>', 'type of pizza') // required option-argument
1856
+ * .option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default
1857
+ * .option('-t, --tip <VALUE>', 'add tip to purchase cost', parseFloat) // custom parse function
1858
+ *
1859
+ * @param {string} flags
1860
+ * @param {string} [description]
1861
+ * @param {(Function|*)} [parseArg] - custom option processing function or default value
1862
+ * @param {*} [defaultValue]
1863
+ * @return {Command} `this` command for chaining
1864
+ */
1865
+ option(flags, description, parseArg, defaultValue) {
1866
+ return this._optionEx({}, flags, description, parseArg, defaultValue);
1867
+ }
1868
+ /**
1869
+ * Add a required option which must have a value after parsing. This usually means
1870
+ * the option must be specified on the command line. (Otherwise the same as .option().)
1871
+ *
1872
+ * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.
1873
+ *
1874
+ * @param {string} flags
1875
+ * @param {string} [description]
1876
+ * @param {(Function|*)} [parseArg] - custom option processing function or default value
1877
+ * @param {*} [defaultValue]
1878
+ * @return {Command} `this` command for chaining
1879
+ */
1880
+ requiredOption(flags, description, parseArg, defaultValue) {
1881
+ return this._optionEx(
1882
+ { mandatory: true },
1883
+ flags,
1884
+ description,
1885
+ parseArg,
1886
+ defaultValue
1887
+ );
1888
+ }
1889
+ /**
1890
+ * Alter parsing of short flags with optional values.
1891
+ *
1892
+ * @example
1893
+ * // for `.option('-f,--flag [value]'):
1894
+ * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour
1895
+ * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
1896
+ *
1897
+ * @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.
1898
+ * @return {Command} `this` command for chaining
1899
+ */
1900
+ combineFlagAndOptionalValue(combine = true) {
1901
+ this._combineFlagAndOptionalValue = !!combine;
1902
+ return this;
1903
+ }
1904
+ /**
1905
+ * Allow unknown options on the command line.
1906
+ *
1907
+ * @param {boolean} [allowUnknown] - if `true` or omitted, no error will be thrown for unknown options.
1908
+ * @return {Command} `this` command for chaining
1909
+ */
1910
+ allowUnknownOption(allowUnknown = true) {
1911
+ this._allowUnknownOption = !!allowUnknown;
1912
+ return this;
1913
+ }
1914
+ /**
1915
+ * Allow excess command-arguments on the command line. Pass false to make excess arguments an error.
1916
+ *
1917
+ * @param {boolean} [allowExcess] - if `true` or omitted, no error will be thrown for excess arguments.
1918
+ * @return {Command} `this` command for chaining
1919
+ */
1920
+ allowExcessArguments(allowExcess = true) {
1921
+ this._allowExcessArguments = !!allowExcess;
1922
+ return this;
1923
+ }
1924
+ /**
1925
+ * Enable positional options. Positional means global options are specified before subcommands which lets
1926
+ * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.
1927
+ * The default behaviour is non-positional and global options may appear anywhere on the command line.
1928
+ *
1929
+ * @param {boolean} [positional]
1930
+ * @return {Command} `this` command for chaining
1931
+ */
1932
+ enablePositionalOptions(positional = true) {
1933
+ this._enablePositionalOptions = !!positional;
1934
+ return this;
1935
+ }
1936
+ /**
1937
+ * Pass through options that come after command-arguments rather than treat them as command-options,
1938
+ * so actual command-options come before command-arguments. Turning this on for a subcommand requires
1939
+ * positional options to have been enabled on the program (parent commands).
1940
+ * The default behaviour is non-positional and options may appear before or after command-arguments.
1941
+ *
1942
+ * @param {boolean} [passThrough] for unknown options.
1943
+ * @return {Command} `this` command for chaining
1944
+ */
1945
+ passThroughOptions(passThrough = true) {
1946
+ this._passThroughOptions = !!passThrough;
1947
+ this._checkForBrokenPassThrough();
1948
+ return this;
1949
+ }
1950
+ /**
1951
+ * @private
1952
+ */
1953
+ _checkForBrokenPassThrough() {
1954
+ if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {
1955
+ throw new Error(
1956
+ `passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`
1957
+ );
1958
+ }
1959
+ }
1960
+ /**
1961
+ * Whether to store option values as properties on command object,
1962
+ * or store separately (specify false). In both cases the option values can be accessed using .opts().
1963
+ *
1964
+ * @param {boolean} [storeAsProperties=true]
1965
+ * @return {Command} `this` command for chaining
1966
+ */
1967
+ storeOptionsAsProperties(storeAsProperties = true) {
1968
+ if (this.options.length) {
1969
+ throw new Error("call .storeOptionsAsProperties() before adding options");
1970
+ }
1971
+ if (Object.keys(this._optionValues).length) {
1972
+ throw new Error(
1973
+ "call .storeOptionsAsProperties() before setting option values"
1974
+ );
1975
+ }
1976
+ this._storeOptionsAsProperties = !!storeAsProperties;
1977
+ return this;
1978
+ }
1979
+ /**
1980
+ * Retrieve option value.
1981
+ *
1982
+ * @param {string} key
1983
+ * @return {object} value
1984
+ */
1985
+ getOptionValue(key) {
1986
+ if (this._storeOptionsAsProperties) {
1987
+ return this[key];
1988
+ }
1989
+ return this._optionValues[key];
1990
+ }
1991
+ /**
1992
+ * Store option value.
1993
+ *
1994
+ * @param {string} key
1995
+ * @param {object} value
1996
+ * @return {Command} `this` command for chaining
1997
+ */
1998
+ setOptionValue(key, value) {
1999
+ return this.setOptionValueWithSource(key, value, void 0);
2000
+ }
2001
+ /**
2002
+ * Store option value and where the value came from.
2003
+ *
2004
+ * @param {string} key
2005
+ * @param {object} value
2006
+ * @param {string} source - expected values are default/config/env/cli/implied
2007
+ * @return {Command} `this` command for chaining
2008
+ */
2009
+ setOptionValueWithSource(key, value, source) {
2010
+ if (this._storeOptionsAsProperties) {
2011
+ this[key] = value;
2012
+ } else {
2013
+ this._optionValues[key] = value;
2014
+ }
2015
+ this._optionValueSources[key] = source;
2016
+ return this;
2017
+ }
2018
+ /**
2019
+ * Get source of option value.
2020
+ * Expected values are default | config | env | cli | implied
2021
+ *
2022
+ * @param {string} key
2023
+ * @return {string}
2024
+ */
2025
+ getOptionValueSource(key) {
2026
+ return this._optionValueSources[key];
2027
+ }
2028
+ /**
2029
+ * Get source of option value. See also .optsWithGlobals().
2030
+ * Expected values are default | config | env | cli | implied
2031
+ *
2032
+ * @param {string} key
2033
+ * @return {string}
2034
+ */
2035
+ getOptionValueSourceWithGlobals(key) {
2036
+ let source;
2037
+ this._getCommandAndAncestors().forEach((cmd) => {
2038
+ if (cmd.getOptionValueSource(key) !== void 0) {
2039
+ source = cmd.getOptionValueSource(key);
2040
+ }
2041
+ });
2042
+ return source;
2043
+ }
2044
+ /**
2045
+ * Get user arguments from implied or explicit arguments.
2046
+ * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches.
2047
+ *
2048
+ * @private
2049
+ */
2050
+ _prepareUserArgs(argv, parseOptions) {
2051
+ if (argv !== void 0 && !Array.isArray(argv)) {
2052
+ throw new Error("first parameter to parse must be array or undefined");
2053
+ }
2054
+ parseOptions = parseOptions || {};
2055
+ if (argv === void 0 && parseOptions.from === void 0) {
2056
+ if (process.versions?.electron) {
2057
+ parseOptions.from = "electron";
2058
+ }
2059
+ const execArgv = process.execArgv ?? [];
2060
+ if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
2061
+ parseOptions.from = "eval";
2062
+ }
2063
+ }
2064
+ if (argv === void 0) {
2065
+ argv = process.argv;
2066
+ }
2067
+ this.rawArgs = argv.slice();
2068
+ let userArgs;
2069
+ switch (parseOptions.from) {
2070
+ case void 0:
2071
+ case "node":
2072
+ this._scriptPath = argv[1];
2073
+ userArgs = argv.slice(2);
2074
+ break;
2075
+ case "electron":
2076
+ if (process.defaultApp) {
2077
+ this._scriptPath = argv[1];
2078
+ userArgs = argv.slice(2);
2079
+ } else {
2080
+ userArgs = argv.slice(1);
2081
+ }
2082
+ break;
2083
+ case "user":
2084
+ userArgs = argv.slice(0);
2085
+ break;
2086
+ case "eval":
2087
+ userArgs = argv.slice(1);
2088
+ break;
2089
+ default:
2090
+ throw new Error(
2091
+ `unexpected parse option { from: '${parseOptions.from}' }`
2092
+ );
2093
+ }
2094
+ if (!this._name && this._scriptPath)
2095
+ this.nameFromFilename(this._scriptPath);
2096
+ this._name = this._name || "program";
2097
+ return userArgs;
2098
+ }
2099
+ /**
2100
+ * Parse `argv`, setting options and invoking commands when defined.
2101
+ *
2102
+ * Use parseAsync instead of parse if any of your action handlers are async.
2103
+ *
2104
+ * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!
2105
+ *
2106
+ * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:
2107
+ * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that
2108
+ * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged
2109
+ * - `'user'`: just user arguments
2110
+ *
2111
+ * @example
2112
+ * program.parse(); // parse process.argv and auto-detect electron and special node flags
2113
+ * program.parse(process.argv); // assume argv[0] is app and argv[1] is script
2114
+ * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
2115
+ *
2116
+ * @param {string[]} [argv] - optional, defaults to process.argv
2117
+ * @param {object} [parseOptions] - optionally specify style of options with from: node/user/electron
2118
+ * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'
2119
+ * @return {Command} `this` command for chaining
2120
+ */
2121
+ parse(argv, parseOptions) {
2122
+ this._prepareForParse();
2123
+ const userArgs = this._prepareUserArgs(argv, parseOptions);
2124
+ this._parseCommand([], userArgs);
2125
+ return this;
2126
+ }
2127
+ /**
2128
+ * Parse `argv`, setting options and invoking commands when defined.
2129
+ *
2130
+ * Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!
2131
+ *
2132
+ * Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:
2133
+ * - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that
2134
+ * - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged
2135
+ * - `'user'`: just user arguments
2136
+ *
2137
+ * @example
2138
+ * await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags
2139
+ * await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script
2140
+ * await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
2141
+ *
2142
+ * @param {string[]} [argv]
2143
+ * @param {object} [parseOptions]
2144
+ * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'
2145
+ * @return {Promise}
2146
+ */
2147
+ async parseAsync(argv, parseOptions) {
2148
+ this._prepareForParse();
2149
+ const userArgs = this._prepareUserArgs(argv, parseOptions);
2150
+ await this._parseCommand([], userArgs);
2151
+ return this;
2152
+ }
2153
+ _prepareForParse() {
2154
+ if (this._savedState === null) {
2155
+ this.saveStateBeforeParse();
2156
+ } else {
2157
+ this.restoreStateBeforeParse();
2158
+ }
2159
+ }
2160
+ /**
2161
+ * Called the first time parse is called to save state and allow a restore before subsequent calls to parse.
2162
+ * Not usually called directly, but available for subclasses to save their custom state.
2163
+ *
2164
+ * This is called in a lazy way. Only commands used in parsing chain will have state saved.
2165
+ */
2166
+ saveStateBeforeParse() {
2167
+ this._savedState = {
2168
+ // name is stable if supplied by author, but may be unspecified for root command and deduced during parsing
2169
+ _name: this._name,
2170
+ // option values before parse have default values (including false for negated options)
2171
+ // shallow clones
2172
+ _optionValues: { ...this._optionValues },
2173
+ _optionValueSources: { ...this._optionValueSources }
2174
+ };
2175
+ }
2176
+ /**
2177
+ * Restore state before parse for calls after the first.
2178
+ * Not usually called directly, but available for subclasses to save their custom state.
2179
+ *
2180
+ * This is called in a lazy way. Only commands used in parsing chain will have state restored.
2181
+ */
2182
+ restoreStateBeforeParse() {
2183
+ if (this._storeOptionsAsProperties)
2184
+ throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
2185
+ - either make a new Command for each call to parse, or stop storing options as properties`);
2186
+ this._name = this._savedState._name;
2187
+ this._scriptPath = null;
2188
+ this.rawArgs = [];
2189
+ this._optionValues = { ...this._savedState._optionValues };
2190
+ this._optionValueSources = { ...this._savedState._optionValueSources };
2191
+ this.args = [];
2192
+ this.processedArgs = [];
2193
+ }
2194
+ /**
2195
+ * Throw if expected executable is missing. Add lots of help for author.
2196
+ *
2197
+ * @param {string} executableFile
2198
+ * @param {string} executableDir
2199
+ * @param {string} subcommandName
2200
+ */
2201
+ _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
2202
+ if (fs.existsSync(executableFile)) return;
2203
+ const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
2204
+ const executableMissing = `'${executableFile}' does not exist
2205
+ - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
2206
+ - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
2207
+ - ${executableDirMessage}`;
2208
+ throw new Error(executableMissing);
2209
+ }
2210
+ /**
2211
+ * Execute a sub-command executable.
2212
+ *
2213
+ * @private
2214
+ */
2215
+ _executeSubCommand(subcommand, args) {
2216
+ args = args.slice();
2217
+ let launchWithNode = false;
2218
+ const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2219
+ function findFile(baseDir, baseName) {
2220
+ const localBin = path.resolve(baseDir, baseName);
2221
+ if (fs.existsSync(localBin)) return localBin;
2222
+ if (sourceExt.includes(path.extname(baseName))) return void 0;
2223
+ const foundExt = sourceExt.find(
2224
+ (ext) => fs.existsSync(`${localBin}${ext}`)
2225
+ );
2226
+ if (foundExt) return `${localBin}${foundExt}`;
2227
+ return void 0;
2228
+ }
2229
+ __name(findFile, "findFile");
2230
+ this._checkForMissingMandatoryOptions();
2231
+ this._checkForConflictingOptions();
2232
+ let executableFile = subcommand._executableFile || `${this._name}-${subcommand._name}`;
2233
+ let executableDir = this._executableDir || "";
2234
+ if (this._scriptPath) {
2235
+ let resolvedScriptPath;
2236
+ try {
2237
+ resolvedScriptPath = fs.realpathSync(this._scriptPath);
2238
+ } catch {
2239
+ resolvedScriptPath = this._scriptPath;
2240
+ }
2241
+ executableDir = path.resolve(
2242
+ path.dirname(resolvedScriptPath),
2243
+ executableDir
2244
+ );
2245
+ }
2246
+ if (executableDir) {
2247
+ let localFile = findFile(executableDir, executableFile);
2248
+ if (!localFile && !subcommand._executableFile && this._scriptPath) {
2249
+ const legacyName = path.basename(
2250
+ this._scriptPath,
2251
+ path.extname(this._scriptPath)
2252
+ );
2253
+ if (legacyName !== this._name) {
2254
+ localFile = findFile(
2255
+ executableDir,
2256
+ `${legacyName}-${subcommand._name}`
2257
+ );
2258
+ }
2259
+ }
2260
+ executableFile = localFile || executableFile;
2261
+ }
2262
+ launchWithNode = sourceExt.includes(path.extname(executableFile));
2263
+ let proc;
2264
+ if (process.platform !== "win32") {
2265
+ if (launchWithNode) {
2266
+ args.unshift(executableFile);
2267
+ args = incrementNodeInspectorPort(process.execArgv).concat(args);
2268
+ proc = childProcess.spawn(process.argv[0], args, { stdio: "inherit" });
2269
+ } else {
2270
+ proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
2271
+ }
2272
+ } else {
2273
+ this._checkForMissingExecutable(
2274
+ executableFile,
2275
+ executableDir,
2276
+ subcommand._name
2277
+ );
2278
+ args.unshift(executableFile);
2279
+ args = incrementNodeInspectorPort(process.execArgv).concat(args);
2280
+ proc = childProcess.spawn(process.execPath, args, { stdio: "inherit" });
2281
+ }
2282
+ if (!proc.killed) {
2283
+ const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
2284
+ signals.forEach((signal) => {
2285
+ process.on(signal, () => {
2286
+ if (proc.killed === false && proc.exitCode === null) {
2287
+ proc.kill(signal);
2288
+ }
2289
+ });
2290
+ });
2291
+ }
2292
+ const exitCallback = this._exitCallback;
2293
+ proc.on("close", (code) => {
2294
+ code = code ?? 1;
2295
+ if (!exitCallback) {
2296
+ process.exit(code);
2297
+ } else {
2298
+ exitCallback(
2299
+ new CommanderError2(
2300
+ code,
2301
+ "commander.executeSubCommandAsync",
2302
+ "(close)"
2303
+ )
2304
+ );
2305
+ }
2306
+ });
2307
+ proc.on("error", (err) => {
2308
+ if (err.code === "ENOENT") {
2309
+ this._checkForMissingExecutable(
2310
+ executableFile,
2311
+ executableDir,
2312
+ subcommand._name
2313
+ );
2314
+ } else if (err.code === "EACCES") {
2315
+ throw new Error(`'${executableFile}' not executable`);
2316
+ }
2317
+ if (!exitCallback) {
2318
+ process.exit(1);
2319
+ } else {
2320
+ const wrappedError = new CommanderError2(
2321
+ 1,
2322
+ "commander.executeSubCommandAsync",
2323
+ "(error)"
2324
+ );
2325
+ wrappedError.nestedError = err;
2326
+ exitCallback(wrappedError);
2327
+ }
2328
+ });
2329
+ this.runningCommand = proc;
2330
+ }
2331
+ /**
2332
+ * @private
2333
+ */
2334
+ _dispatchSubcommand(commandName, operands, unknown) {
2335
+ const subCommand = this._findCommand(commandName);
2336
+ if (!subCommand) this.help({ error: true });
2337
+ subCommand._prepareForParse();
2338
+ let promiseChain;
2339
+ promiseChain = this._chainOrCallSubCommandHook(
2340
+ promiseChain,
2341
+ subCommand,
2342
+ "preSubcommand"
2343
+ );
2344
+ promiseChain = this._chainOrCall(promiseChain, () => {
2345
+ if (subCommand._executableHandler) {
2346
+ this._executeSubCommand(subCommand, operands.concat(unknown));
2347
+ } else {
2348
+ return subCommand._parseCommand(operands, unknown);
2349
+ }
2350
+ });
2351
+ return promiseChain;
2352
+ }
2353
+ /**
2354
+ * Invoke help directly if possible, or dispatch if necessary.
2355
+ * e.g. help foo
2356
+ *
2357
+ * @private
2358
+ */
2359
+ _dispatchHelpCommand(subcommandName) {
2360
+ if (!subcommandName) {
2361
+ this.help();
2362
+ }
2363
+ const subCommand = this._findCommand(subcommandName);
2364
+ if (subCommand && !subCommand._executableHandler) {
2365
+ subCommand.help();
2366
+ }
2367
+ return this._dispatchSubcommand(
2368
+ subcommandName,
2369
+ [],
2370
+ [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]
2371
+ );
2372
+ }
2373
+ /**
2374
+ * Check this.args against expected this.registeredArguments.
2375
+ *
2376
+ * @private
2377
+ */
2378
+ _checkNumberOfArguments() {
2379
+ this.registeredArguments.forEach((arg, i) => {
2380
+ if (arg.required && this.args[i] == null) {
2381
+ this.missingArgument(arg.name());
2382
+ }
2383
+ });
2384
+ if (this.registeredArguments.length > 0 && this.registeredArguments[this.registeredArguments.length - 1].variadic) {
2385
+ return;
2386
+ }
2387
+ if (this.args.length > this.registeredArguments.length) {
2388
+ this._excessArguments(this.args);
2389
+ }
2390
+ }
2391
+ /**
2392
+ * Process this.args using this.registeredArguments and save as this.processedArgs!
2393
+ *
2394
+ * @private
2395
+ */
2396
+ _processArguments() {
2397
+ const myParseArg = /* @__PURE__ */ __name((argument, value, previous) => {
2398
+ let parsedValue = value;
2399
+ if (value !== null && argument.parseArg) {
2400
+ const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;
2401
+ parsedValue = this._callParseArg(
2402
+ argument,
2403
+ value,
2404
+ previous,
2405
+ invalidValueMessage
2406
+ );
2407
+ }
2408
+ return parsedValue;
2409
+ }, "myParseArg");
2410
+ this._checkNumberOfArguments();
2411
+ const processedArgs = [];
2412
+ this.registeredArguments.forEach((declaredArg, index) => {
2413
+ let value = declaredArg.defaultValue;
2414
+ if (declaredArg.variadic) {
2415
+ if (index < this.args.length) {
2416
+ value = this.args.slice(index);
2417
+ if (declaredArg.parseArg) {
2418
+ value = value.reduce((processed, v) => {
2419
+ return myParseArg(declaredArg, v, processed);
2420
+ }, declaredArg.defaultValue);
2421
+ }
2422
+ } else if (value === void 0) {
2423
+ value = [];
2424
+ }
2425
+ } else if (index < this.args.length) {
2426
+ value = this.args[index];
2427
+ if (declaredArg.parseArg) {
2428
+ value = myParseArg(declaredArg, value, declaredArg.defaultValue);
2429
+ }
2430
+ }
2431
+ processedArgs[index] = value;
2432
+ });
2433
+ this.processedArgs = processedArgs;
2434
+ }
2435
+ /**
2436
+ * Once we have a promise we chain, but call synchronously until then.
2437
+ *
2438
+ * @param {(Promise|undefined)} promise
2439
+ * @param {Function} fn
2440
+ * @return {(Promise|undefined)}
2441
+ * @private
2442
+ */
2443
+ _chainOrCall(promise, fn) {
2444
+ if (promise?.then && typeof promise.then === "function") {
2445
+ return promise.then(() => fn());
2446
+ }
2447
+ return fn();
2448
+ }
2449
+ /**
2450
+ *
2451
+ * @param {(Promise|undefined)} promise
2452
+ * @param {string} event
2453
+ * @return {(Promise|undefined)}
2454
+ * @private
2455
+ */
2456
+ _chainOrCallHooks(promise, event) {
2457
+ let result = promise;
2458
+ const hooks = [];
2459
+ this._getCommandAndAncestors().reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== void 0).forEach((hookedCommand) => {
2460
+ hookedCommand._lifeCycleHooks[event].forEach((callback) => {
2461
+ hooks.push({ hookedCommand, callback });
2462
+ });
2463
+ });
2464
+ if (event === "postAction") {
2465
+ hooks.reverse();
2466
+ }
2467
+ hooks.forEach((hookDetail) => {
2468
+ result = this._chainOrCall(result, () => {
2469
+ return hookDetail.callback(hookDetail.hookedCommand, this);
2470
+ });
2471
+ });
2472
+ return result;
2473
+ }
2474
+ /**
2475
+ *
2476
+ * @param {(Promise|undefined)} promise
2477
+ * @param {Command} subCommand
2478
+ * @param {string} event
2479
+ * @return {(Promise|undefined)}
2480
+ * @private
2481
+ */
2482
+ _chainOrCallSubCommandHook(promise, subCommand, event) {
2483
+ let result = promise;
2484
+ if (this._lifeCycleHooks[event] !== void 0) {
2485
+ this._lifeCycleHooks[event].forEach((hook) => {
2486
+ result = this._chainOrCall(result, () => {
2487
+ return hook(this, subCommand);
2488
+ });
2489
+ });
2490
+ }
2491
+ return result;
2492
+ }
2493
+ /**
2494
+ * Process arguments in context of this command.
2495
+ * Returns action result, in case it is a promise.
2496
+ *
2497
+ * @private
2498
+ */
2499
+ _parseCommand(operands, unknown) {
2500
+ const parsed = this.parseOptions(unknown);
2501
+ this._parseOptionsEnv();
2502
+ this._parseOptionsImplied();
2503
+ operands = operands.concat(parsed.operands);
2504
+ unknown = parsed.unknown;
2505
+ this.args = operands.concat(unknown);
2506
+ if (operands && this._findCommand(operands[0])) {
2507
+ return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);
2508
+ }
2509
+ if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) {
2510
+ return this._dispatchHelpCommand(operands[1]);
2511
+ }
2512
+ if (this._defaultCommandName) {
2513
+ this._outputHelpIfRequested(unknown);
2514
+ return this._dispatchSubcommand(
2515
+ this._defaultCommandName,
2516
+ operands,
2517
+ unknown
2518
+ );
2519
+ }
2520
+ if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
2521
+ this.help({ error: true });
2522
+ }
2523
+ this._outputHelpIfRequested(parsed.unknown);
2524
+ this._checkForMissingMandatoryOptions();
2525
+ this._checkForConflictingOptions();
2526
+ const checkForUnknownOptions = /* @__PURE__ */ __name(() => {
2527
+ if (parsed.unknown.length > 0) {
2528
+ this.unknownOption(parsed.unknown[0]);
2529
+ }
2530
+ }, "checkForUnknownOptions");
2531
+ const commandEvent = `command:${this.name()}`;
2532
+ if (this._actionHandler) {
2533
+ checkForUnknownOptions();
2534
+ this._processArguments();
2535
+ let promiseChain;
2536
+ promiseChain = this._chainOrCallHooks(promiseChain, "preAction");
2537
+ promiseChain = this._chainOrCall(
2538
+ promiseChain,
2539
+ () => this._actionHandler(this.processedArgs)
2540
+ );
2541
+ if (this.parent) {
2542
+ promiseChain = this._chainOrCall(promiseChain, () => {
2543
+ this.parent.emit(commandEvent, operands, unknown);
2544
+ });
2545
+ }
2546
+ promiseChain = this._chainOrCallHooks(promiseChain, "postAction");
2547
+ return promiseChain;
2548
+ }
2549
+ if (this.parent?.listenerCount(commandEvent)) {
2550
+ checkForUnknownOptions();
2551
+ this._processArguments();
2552
+ this.parent.emit(commandEvent, operands, unknown);
2553
+ } else if (operands.length) {
2554
+ if (this._findCommand("*")) {
2555
+ return this._dispatchSubcommand("*", operands, unknown);
2556
+ }
2557
+ if (this.listenerCount("command:*")) {
2558
+ this.emit("command:*", operands, unknown);
2559
+ } else if (this.commands.length) {
2560
+ this.unknownCommand();
2561
+ } else {
2562
+ checkForUnknownOptions();
2563
+ this._processArguments();
2564
+ }
2565
+ } else if (this.commands.length) {
2566
+ checkForUnknownOptions();
2567
+ this.help({ error: true });
2568
+ } else {
2569
+ checkForUnknownOptions();
2570
+ this._processArguments();
2571
+ }
2572
+ }
2573
+ /**
2574
+ * Find matching command.
2575
+ *
2576
+ * @private
2577
+ * @return {Command | undefined}
2578
+ */
2579
+ _findCommand(name) {
2580
+ if (!name) return void 0;
2581
+ return this.commands.find(
2582
+ (cmd) => cmd._name === name || cmd._aliases.includes(name)
2583
+ );
2584
+ }
2585
+ /**
2586
+ * Return an option matching `arg` if any.
2587
+ *
2588
+ * @param {string} arg
2589
+ * @return {Option}
2590
+ * @package
2591
+ */
2592
+ _findOption(arg) {
2593
+ return this.options.find((option) => option.is(arg));
2594
+ }
2595
+ /**
2596
+ * Display an error message if a mandatory option does not have a value.
2597
+ * Called after checking for help flags in leaf subcommand.
2598
+ *
2599
+ * @private
2600
+ */
2601
+ _checkForMissingMandatoryOptions() {
2602
+ this._getCommandAndAncestors().forEach((cmd) => {
2603
+ cmd.options.forEach((anOption) => {
2604
+ if (anOption.mandatory && cmd.getOptionValue(anOption.attributeName()) === void 0) {
2605
+ cmd.missingMandatoryOptionValue(anOption);
2606
+ }
2607
+ });
2608
+ });
2609
+ }
2610
+ /**
2611
+ * Display an error message if conflicting options are used together in this.
2612
+ *
2613
+ * @private
2614
+ */
2615
+ _checkForConflictingLocalOptions() {
2616
+ const definedNonDefaultOptions = this.options.filter((option) => {
2617
+ const optionKey = option.attributeName();
2618
+ if (this.getOptionValue(optionKey) === void 0) {
2619
+ return false;
2620
+ }
2621
+ return this.getOptionValueSource(optionKey) !== "default";
2622
+ });
2623
+ const optionsWithConflicting = definedNonDefaultOptions.filter(
2624
+ (option) => option.conflictsWith.length > 0
2625
+ );
2626
+ optionsWithConflicting.forEach((option) => {
2627
+ const conflictingAndDefined = definedNonDefaultOptions.find(
2628
+ (defined) => option.conflictsWith.includes(defined.attributeName())
2629
+ );
2630
+ if (conflictingAndDefined) {
2631
+ this._conflictingOption(option, conflictingAndDefined);
2632
+ }
2633
+ });
2634
+ }
2635
+ /**
2636
+ * Display an error message if conflicting options are used together.
2637
+ * Called after checking for help flags in leaf subcommand.
2638
+ *
2639
+ * @private
2640
+ */
2641
+ _checkForConflictingOptions() {
2642
+ this._getCommandAndAncestors().forEach((cmd) => {
2643
+ cmd._checkForConflictingLocalOptions();
2644
+ });
2645
+ }
2646
+ /**
2647
+ * Parse options from `argv` removing known options,
2648
+ * and return argv split into operands and unknown arguments.
2649
+ *
2650
+ * Side effects: modifies command by storing options. Does not reset state if called again.
2651
+ *
2652
+ * Examples:
2653
+ *
2654
+ * argv => operands, unknown
2655
+ * --known kkk op => [op], []
2656
+ * op --known kkk => [op], []
2657
+ * sub --unknown uuu op => [sub], [--unknown uuu op]
2658
+ * sub -- --unknown uuu op => [sub --unknown uuu op], []
2659
+ *
2660
+ * @param {string[]} args
2661
+ * @return {{operands: string[], unknown: string[]}}
2662
+ */
2663
+ parseOptions(args) {
2664
+ const operands = [];
2665
+ const unknown = [];
2666
+ let dest = operands;
2667
+ function maybeOption(arg) {
2668
+ return arg.length > 1 && arg[0] === "-";
2669
+ }
2670
+ __name(maybeOption, "maybeOption");
2671
+ const negativeNumberArg = /* @__PURE__ */ __name((arg) => {
2672
+ if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
2673
+ return !this._getCommandAndAncestors().some(
2674
+ (cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short))
2675
+ );
2676
+ }, "negativeNumberArg");
2677
+ let activeVariadicOption = null;
2678
+ let activeGroup = null;
2679
+ let i = 0;
2680
+ while (i < args.length || activeGroup) {
2681
+ const arg = activeGroup ?? args[i++];
2682
+ activeGroup = null;
2683
+ if (arg === "--") {
2684
+ if (dest === unknown) dest.push(arg);
2685
+ dest.push(...args.slice(i));
2686
+ break;
2687
+ }
2688
+ if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
2689
+ this.emit(`option:${activeVariadicOption.name()}`, arg);
2690
+ continue;
2691
+ }
2692
+ activeVariadicOption = null;
2693
+ if (maybeOption(arg)) {
2694
+ const option = this._findOption(arg);
2695
+ if (option) {
2696
+ if (option.required) {
2697
+ const value = args[i++];
2698
+ if (value === void 0) this.optionMissingArgument(option);
2699
+ this.emit(`option:${option.name()}`, value);
2700
+ } else if (option.optional) {
2701
+ let value = null;
2702
+ if (i < args.length && (!maybeOption(args[i]) || negativeNumberArg(args[i]))) {
2703
+ value = args[i++];
2704
+ }
2705
+ this.emit(`option:${option.name()}`, value);
2706
+ } else {
2707
+ this.emit(`option:${option.name()}`);
2708
+ }
2709
+ activeVariadicOption = option.variadic ? option : null;
2710
+ continue;
2711
+ }
2712
+ }
2713
+ if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
2714
+ const option = this._findOption(`-${arg[1]}`);
2715
+ if (option) {
2716
+ if (option.required || option.optional && this._combineFlagAndOptionalValue) {
2717
+ this.emit(`option:${option.name()}`, arg.slice(2));
2718
+ } else {
2719
+ this.emit(`option:${option.name()}`);
2720
+ activeGroup = `-${arg.slice(2)}`;
2721
+ }
2722
+ continue;
2723
+ }
2724
+ }
2725
+ if (/^--[^=]+=/.test(arg)) {
2726
+ const index = arg.indexOf("=");
2727
+ const option = this._findOption(arg.slice(0, index));
2728
+ if (option && (option.required || option.optional)) {
2729
+ this.emit(`option:${option.name()}`, arg.slice(index + 1));
2730
+ continue;
2731
+ }
2732
+ }
2733
+ if (dest === operands && maybeOption(arg) && !(this.commands.length === 0 && negativeNumberArg(arg))) {
2734
+ dest = unknown;
2735
+ }
2736
+ if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
2737
+ if (this._findCommand(arg)) {
2738
+ operands.push(arg);
2739
+ unknown.push(...args.slice(i));
2740
+ break;
2741
+ } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
2742
+ operands.push(arg, ...args.slice(i));
2743
+ break;
2744
+ } else if (this._defaultCommandName) {
2745
+ unknown.push(arg, ...args.slice(i));
2746
+ break;
2747
+ }
2748
+ }
2749
+ if (this._passThroughOptions) {
2750
+ dest.push(arg, ...args.slice(i));
2751
+ break;
2752
+ }
2753
+ dest.push(arg);
2754
+ }
2755
+ return { operands, unknown };
2756
+ }
2757
+ /**
2758
+ * Return an object containing local option values as key-value pairs.
2759
+ *
2760
+ * @return {object}
2761
+ */
2762
+ opts() {
2763
+ if (this._storeOptionsAsProperties) {
2764
+ const result = {};
2765
+ const len = this.options.length;
2766
+ for (let i = 0; i < len; i++) {
2767
+ const key = this.options[i].attributeName();
2768
+ result[key] = key === this._versionOptionName ? this._version : this[key];
2769
+ }
2770
+ return result;
2771
+ }
2772
+ return this._optionValues;
2773
+ }
2774
+ /**
2775
+ * Return an object containing merged local and global option values as key-value pairs.
2776
+ *
2777
+ * @return {object}
2778
+ */
2779
+ optsWithGlobals() {
2780
+ return this._getCommandAndAncestors().reduce(
2781
+ (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),
2782
+ {}
2783
+ );
2784
+ }
2785
+ /**
2786
+ * Display error message and exit (or call exitOverride).
2787
+ *
2788
+ * @param {string} message
2789
+ * @param {object} [errorOptions]
2790
+ * @param {string} [errorOptions.code] - an id string representing the error
2791
+ * @param {number} [errorOptions.exitCode] - used with process.exit
2792
+ */
2793
+ error(message, errorOptions) {
2794
+ this._outputConfiguration.outputError(
2795
+ `${message}
2796
+ `,
2797
+ this._outputConfiguration.writeErr
2798
+ );
2799
+ if (typeof this._showHelpAfterError === "string") {
2800
+ this._outputConfiguration.writeErr(`${this._showHelpAfterError}
2801
+ `);
2802
+ } else if (this._showHelpAfterError) {
2803
+ this._outputConfiguration.writeErr("\n");
2804
+ this.outputHelp({ error: true });
2805
+ }
2806
+ const config = errorOptions || {};
2807
+ const exitCode = config.exitCode || 1;
2808
+ const code = config.code || "commander.error";
2809
+ this._exit(exitCode, code, message);
2810
+ }
2811
+ /**
2812
+ * Apply any option related environment variables, if option does
2813
+ * not have a value from cli or client code.
2814
+ *
2815
+ * @private
2816
+ */
2817
+ _parseOptionsEnv() {
2818
+ this.options.forEach((option) => {
2819
+ if (option.envVar && option.envVar in process.env) {
2820
+ const optionKey = option.attributeName();
2821
+ if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
2822
+ this.getOptionValueSource(optionKey)
2823
+ )) {
2824
+ if (option.required || option.optional) {
2825
+ this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);
2826
+ } else {
2827
+ this.emit(`optionEnv:${option.name()}`);
2828
+ }
2829
+ }
2830
+ }
2831
+ });
2832
+ }
2833
+ /**
2834
+ * Apply any implied option values, if option is undefined or default value.
2835
+ *
2836
+ * @private
2837
+ */
2838
+ _parseOptionsImplied() {
2839
+ const dualHelper = new DualOptions(this.options);
2840
+ const hasCustomOptionValue = /* @__PURE__ */ __name((optionKey) => {
2841
+ return this.getOptionValue(optionKey) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(optionKey));
2842
+ }, "hasCustomOptionValue");
2843
+ this.options.filter(
2844
+ (option) => option.implied !== void 0 && hasCustomOptionValue(option.attributeName()) && dualHelper.valueFromOption(
2845
+ this.getOptionValue(option.attributeName()),
2846
+ option
2847
+ )
2848
+ ).forEach((option) => {
2849
+ Object.keys(option.implied).filter((impliedKey) => !hasCustomOptionValue(impliedKey)).forEach((impliedKey) => {
2850
+ this.setOptionValueWithSource(
2851
+ impliedKey,
2852
+ option.implied[impliedKey],
2853
+ "implied"
2854
+ );
2855
+ });
2856
+ });
2857
+ }
2858
+ /**
2859
+ * Argument `name` is missing.
2860
+ *
2861
+ * @param {string} name
2862
+ * @private
2863
+ */
2864
+ missingArgument(name) {
2865
+ const message = `error: missing required argument '${name}'`;
2866
+ this.error(message, { code: "commander.missingArgument" });
2867
+ }
2868
+ /**
2869
+ * `Option` is missing an argument.
2870
+ *
2871
+ * @param {Option} option
2872
+ * @private
2873
+ */
2874
+ optionMissingArgument(option) {
2875
+ const message = `error: option '${option.flags}' argument missing`;
2876
+ this.error(message, { code: "commander.optionMissingArgument" });
2877
+ }
2878
+ /**
2879
+ * `Option` does not have a value, and is a mandatory option.
2880
+ *
2881
+ * @param {Option} option
2882
+ * @private
2883
+ */
2884
+ missingMandatoryOptionValue(option) {
2885
+ const message = `error: required option '${option.flags}' not specified`;
2886
+ this.error(message, { code: "commander.missingMandatoryOptionValue" });
2887
+ }
2888
+ /**
2889
+ * `Option` conflicts with another option.
2890
+ *
2891
+ * @param {Option} option
2892
+ * @param {Option} conflictingOption
2893
+ * @private
2894
+ */
2895
+ _conflictingOption(option, conflictingOption) {
2896
+ const findBestOptionFromValue = /* @__PURE__ */ __name((option2) => {
2897
+ const optionKey = option2.attributeName();
2898
+ const optionValue = this.getOptionValue(optionKey);
2899
+ const negativeOption = this.options.find(
2900
+ (target) => target.negate && optionKey === target.attributeName()
2901
+ );
2902
+ const positiveOption = this.options.find(
2903
+ (target) => !target.negate && optionKey === target.attributeName()
2904
+ );
2905
+ if (negativeOption && (negativeOption.presetArg === void 0 && optionValue === false || negativeOption.presetArg !== void 0 && optionValue === negativeOption.presetArg)) {
2906
+ return negativeOption;
2907
+ }
2908
+ return positiveOption || option2;
2909
+ }, "findBestOptionFromValue");
2910
+ const getErrorMessage = /* @__PURE__ */ __name((option2) => {
2911
+ const bestOption = findBestOptionFromValue(option2);
2912
+ const optionKey = bestOption.attributeName();
2913
+ const source = this.getOptionValueSource(optionKey);
2914
+ if (source === "env") {
2915
+ return `environment variable '${bestOption.envVar}'`;
2916
+ }
2917
+ return `option '${bestOption.flags}'`;
2918
+ }, "getErrorMessage");
2919
+ const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
2920
+ this.error(message, { code: "commander.conflictingOption" });
2921
+ }
2922
+ /**
2923
+ * Unknown option `flag`.
2924
+ *
2925
+ * @param {string} flag
2926
+ * @private
2927
+ */
2928
+ unknownOption(flag) {
2929
+ if (this._allowUnknownOption) return;
2930
+ let suggestion = "";
2931
+ if (flag.startsWith("--") && this._showSuggestionAfterError) {
2932
+ let candidateFlags = [];
2933
+ let command = this;
2934
+ do {
2935
+ const moreFlags = command.createHelp().visibleOptions(command).filter((option) => option.long).map((option) => option.long);
2936
+ candidateFlags = candidateFlags.concat(moreFlags);
2937
+ command = command.parent;
2938
+ } while (command && !command._enablePositionalOptions);
2939
+ suggestion = suggestSimilar(flag, candidateFlags);
2940
+ }
2941
+ const message = `error: unknown option '${flag}'${suggestion}`;
2942
+ this.error(message, { code: "commander.unknownOption" });
2943
+ }
2944
+ /**
2945
+ * Excess arguments, more than expected.
2946
+ *
2947
+ * @param {string[]} receivedArgs
2948
+ * @private
2949
+ */
2950
+ _excessArguments(receivedArgs) {
2951
+ if (this._allowExcessArguments) return;
2952
+ const expected = this.registeredArguments.length;
2953
+ const s = expected === 1 ? "" : "s";
2954
+ const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
2955
+ const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;
2956
+ this.error(message, { code: "commander.excessArguments" });
2957
+ }
2958
+ /**
2959
+ * Unknown command.
2960
+ *
2961
+ * @private
2962
+ */
2963
+ unknownCommand() {
2964
+ const unknownName = this.args[0];
2965
+ let suggestion = "";
2966
+ if (this._showSuggestionAfterError) {
2967
+ const candidateNames = [];
2968
+ this.createHelp().visibleCommands(this).forEach((command) => {
2969
+ candidateNames.push(command.name());
2970
+ if (command.alias()) candidateNames.push(command.alias());
2971
+ });
2972
+ suggestion = suggestSimilar(unknownName, candidateNames);
2973
+ }
2974
+ const message = `error: unknown command '${unknownName}'${suggestion}`;
2975
+ this.error(message, { code: "commander.unknownCommand" });
2976
+ }
2977
+ /**
2978
+ * Get or set the program version.
2979
+ *
2980
+ * This method auto-registers the "-V, --version" option which will print the version number.
2981
+ *
2982
+ * You can optionally supply the flags and description to override the defaults.
2983
+ *
2984
+ * @param {string} [str]
2985
+ * @param {string} [flags]
2986
+ * @param {string} [description]
2987
+ * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments
2988
+ */
2989
+ version(str, flags, description) {
2990
+ if (str === void 0) return this._version;
2991
+ this._version = str;
2992
+ flags = flags || "-V, --version";
2993
+ description = description || "output the version number";
2994
+ const versionOption = this.createOption(flags, description);
2995
+ this._versionOptionName = versionOption.attributeName();
2996
+ this._registerOption(versionOption);
2997
+ this.on("option:" + versionOption.name(), () => {
2998
+ this._outputConfiguration.writeOut(`${str}
2999
+ `);
3000
+ this._exit(0, "commander.version", str);
3001
+ });
3002
+ return this;
3003
+ }
3004
+ /**
3005
+ * Set the description.
3006
+ *
3007
+ * @param {string} [str]
3008
+ * @param {object} [argsDescription]
3009
+ * @return {(string|Command)}
3010
+ */
3011
+ description(str, argsDescription) {
3012
+ if (str === void 0 && argsDescription === void 0)
3013
+ return this._description;
3014
+ this._description = str;
3015
+ if (argsDescription) {
3016
+ this._argsDescription = argsDescription;
3017
+ }
3018
+ return this;
3019
+ }
3020
+ /**
3021
+ * Set the summary. Used when listed as subcommand of parent.
3022
+ *
3023
+ * @param {string} [str]
3024
+ * @return {(string|Command)}
3025
+ */
3026
+ summary(str) {
3027
+ if (str === void 0) return this._summary;
3028
+ this._summary = str;
3029
+ return this;
3030
+ }
3031
+ /**
3032
+ * Set an alias for the command.
3033
+ *
3034
+ * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
3035
+ *
3036
+ * @param {string} [alias]
3037
+ * @return {(string|Command)}
3038
+ */
3039
+ alias(alias) {
3040
+ if (alias === void 0) return this._aliases[0];
3041
+ let command = this;
3042
+ if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
3043
+ command = this.commands[this.commands.length - 1];
3044
+ }
3045
+ if (alias === command._name)
3046
+ throw new Error("Command alias can't be the same as its name");
3047
+ const matchingCommand = this.parent?._findCommand(alias);
3048
+ if (matchingCommand) {
3049
+ const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
3050
+ throw new Error(
3051
+ `cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`
3052
+ );
3053
+ }
3054
+ command._aliases.push(alias);
3055
+ return this;
3056
+ }
3057
+ /**
3058
+ * Set aliases for the command.
3059
+ *
3060
+ * Only the first alias is shown in the auto-generated help.
3061
+ *
3062
+ * @param {string[]} [aliases]
3063
+ * @return {(string[]|Command)}
3064
+ */
3065
+ aliases(aliases) {
3066
+ if (aliases === void 0) return this._aliases;
3067
+ aliases.forEach((alias) => this.alias(alias));
3068
+ return this;
3069
+ }
3070
+ /**
3071
+ * Set / get the command usage `str`.
3072
+ *
3073
+ * @param {string} [str]
3074
+ * @return {(string|Command)}
3075
+ */
3076
+ usage(str) {
3077
+ if (str === void 0) {
3078
+ if (this._usage) return this._usage;
3079
+ const args = this.registeredArguments.map((arg) => {
3080
+ return humanReadableArgName(arg);
3081
+ });
3082
+ return [].concat(
3083
+ this.options.length || this._helpOption !== null ? "[options]" : [],
3084
+ this.commands.length ? "[command]" : [],
3085
+ this.registeredArguments.length ? args : []
3086
+ ).join(" ");
3087
+ }
3088
+ this._usage = str;
3089
+ return this;
3090
+ }
3091
+ /**
3092
+ * Get or set the name of the command.
3093
+ *
3094
+ * @param {string} [str]
3095
+ * @return {(string|Command)}
3096
+ */
3097
+ name(str) {
3098
+ if (str === void 0) return this._name;
3099
+ this._name = str;
3100
+ return this;
3101
+ }
3102
+ /**
3103
+ * Set/get the help group heading for this subcommand in parent command's help.
3104
+ *
3105
+ * @param {string} [heading]
3106
+ * @return {Command | string}
3107
+ */
3108
+ helpGroup(heading) {
3109
+ if (heading === void 0) return this._helpGroupHeading ?? "";
3110
+ this._helpGroupHeading = heading;
3111
+ return this;
3112
+ }
3113
+ /**
3114
+ * Set/get the default help group heading for subcommands added to this command.
3115
+ * (This does not override a group set directly on the subcommand using .helpGroup().)
3116
+ *
3117
+ * @example
3118
+ * program.commandsGroup('Development Commands:);
3119
+ * program.command('watch')...
3120
+ * program.command('lint')...
3121
+ * ...
3122
+ *
3123
+ * @param {string} [heading]
3124
+ * @returns {Command | string}
3125
+ */
3126
+ commandsGroup(heading) {
3127
+ if (heading === void 0) return this._defaultCommandGroup ?? "";
3128
+ this._defaultCommandGroup = heading;
3129
+ return this;
3130
+ }
3131
+ /**
3132
+ * Set/get the default help group heading for options added to this command.
3133
+ * (This does not override a group set directly on the option using .helpGroup().)
3134
+ *
3135
+ * @example
3136
+ * program
3137
+ * .optionsGroup('Development Options:')
3138
+ * .option('-d, --debug', 'output extra debugging')
3139
+ * .option('-p, --profile', 'output profiling information')
3140
+ *
3141
+ * @param {string} [heading]
3142
+ * @returns {Command | string}
3143
+ */
3144
+ optionsGroup(heading) {
3145
+ if (heading === void 0) return this._defaultOptionGroup ?? "";
3146
+ this._defaultOptionGroup = heading;
3147
+ return this;
3148
+ }
3149
+ /**
3150
+ * @param {Option} option
3151
+ * @private
3152
+ */
3153
+ _initOptionGroup(option) {
3154
+ if (this._defaultOptionGroup && !option.helpGroupHeading)
3155
+ option.helpGroup(this._defaultOptionGroup);
3156
+ }
3157
+ /**
3158
+ * @param {Command} cmd
3159
+ * @private
3160
+ */
3161
+ _initCommandGroup(cmd) {
3162
+ if (this._defaultCommandGroup && !cmd.helpGroup())
3163
+ cmd.helpGroup(this._defaultCommandGroup);
3164
+ }
3165
+ /**
3166
+ * Set the name of the command from script filename, such as process.argv[1],
3167
+ * or require.main.filename, or __filename.
3168
+ *
3169
+ * (Used internally and public although not documented in README.)
3170
+ *
3171
+ * @example
3172
+ * program.nameFromFilename(require.main.filename);
3173
+ *
3174
+ * @param {string} filename
3175
+ * @return {Command}
3176
+ */
3177
+ nameFromFilename(filename) {
3178
+ this._name = path.basename(filename, path.extname(filename));
3179
+ return this;
3180
+ }
3181
+ /**
3182
+ * Get or set the directory for searching for executable subcommands of this command.
3183
+ *
3184
+ * @example
3185
+ * program.executableDir(__dirname);
3186
+ * // or
3187
+ * program.executableDir('subcommands');
3188
+ *
3189
+ * @param {string} [path]
3190
+ * @return {(string|null|Command)}
3191
+ */
3192
+ executableDir(path2) {
3193
+ if (path2 === void 0) return this._executableDir;
3194
+ this._executableDir = path2;
3195
+ return this;
3196
+ }
3197
+ /**
3198
+ * Return program help documentation.
3199
+ *
3200
+ * @param {{ error: boolean }} [contextOptions] - pass {error:true} to wrap for stderr instead of stdout
3201
+ * @return {string}
3202
+ */
3203
+ helpInformation(contextOptions) {
3204
+ const helper = this.createHelp();
3205
+ const context = this._getOutputContext(contextOptions);
3206
+ helper.prepareContext({
3207
+ error: context.error,
3208
+ helpWidth: context.helpWidth,
3209
+ outputHasColors: context.hasColors
3210
+ });
3211
+ const text = helper.formatHelp(this, helper);
3212
+ if (context.hasColors) return text;
3213
+ return this._outputConfiguration.stripColor(text);
3214
+ }
3215
+ /**
3216
+ * @typedef HelpContext
3217
+ * @type {object}
3218
+ * @property {boolean} error
3219
+ * @property {number} helpWidth
3220
+ * @property {boolean} hasColors
3221
+ * @property {function} write - includes stripColor if needed
3222
+ *
3223
+ * @returns {HelpContext}
3224
+ * @private
3225
+ */
3226
+ _getOutputContext(contextOptions) {
3227
+ contextOptions = contextOptions || {};
3228
+ const error = !!contextOptions.error;
3229
+ let baseWrite;
3230
+ let hasColors;
3231
+ let helpWidth;
3232
+ if (error) {
3233
+ baseWrite = /* @__PURE__ */ __name((str) => this._outputConfiguration.writeErr(str), "baseWrite");
3234
+ hasColors = this._outputConfiguration.getErrHasColors();
3235
+ helpWidth = this._outputConfiguration.getErrHelpWidth();
3236
+ } else {
3237
+ baseWrite = /* @__PURE__ */ __name((str) => this._outputConfiguration.writeOut(str), "baseWrite");
3238
+ hasColors = this._outputConfiguration.getOutHasColors();
3239
+ helpWidth = this._outputConfiguration.getOutHelpWidth();
3240
+ }
3241
+ const write = /* @__PURE__ */ __name((str) => {
3242
+ if (!hasColors) str = this._outputConfiguration.stripColor(str);
3243
+ return baseWrite(str);
3244
+ }, "write");
3245
+ return { error, write, hasColors, helpWidth };
3246
+ }
3247
+ /**
3248
+ * Output help information for this command.
3249
+ *
3250
+ * Outputs built-in help, and custom text added using `.addHelpText()`.
3251
+ *
3252
+ * @param {{ error: boolean } | Function} [contextOptions] - pass {error:true} to write to stderr instead of stdout
3253
+ */
3254
+ outputHelp(contextOptions) {
3255
+ let deprecatedCallback;
3256
+ if (typeof contextOptions === "function") {
3257
+ deprecatedCallback = contextOptions;
3258
+ contextOptions = void 0;
3259
+ }
3260
+ const outputContext = this._getOutputContext(contextOptions);
3261
+ const eventContext = {
3262
+ error: outputContext.error,
3263
+ write: outputContext.write,
3264
+ command: this
3265
+ };
3266
+ this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
3267
+ this.emit("beforeHelp", eventContext);
3268
+ let helpInformation = this.helpInformation({ error: outputContext.error });
3269
+ if (deprecatedCallback) {
3270
+ helpInformation = deprecatedCallback(helpInformation);
3271
+ if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
3272
+ throw new Error("outputHelp callback must return a string or a Buffer");
3273
+ }
3274
+ }
3275
+ outputContext.write(helpInformation);
3276
+ if (this._getHelpOption()?.long) {
3277
+ this.emit(this._getHelpOption().long);
3278
+ }
3279
+ this.emit("afterHelp", eventContext);
3280
+ this._getCommandAndAncestors().forEach(
3281
+ (command) => command.emit("afterAllHelp", eventContext)
3282
+ );
3283
+ }
3284
+ /**
3285
+ * You can pass in flags and a description to customise the built-in help option.
3286
+ * Pass in false to disable the built-in help option.
3287
+ *
3288
+ * @example
3289
+ * program.helpOption('-?, --help' 'show help'); // customise
3290
+ * program.helpOption(false); // disable
3291
+ *
3292
+ * @param {(string | boolean)} flags
3293
+ * @param {string} [description]
3294
+ * @return {Command} `this` command for chaining
3295
+ */
3296
+ helpOption(flags, description) {
3297
+ if (typeof flags === "boolean") {
3298
+ if (flags) {
3299
+ if (this._helpOption === null) this._helpOption = void 0;
3300
+ if (this._defaultOptionGroup) {
3301
+ this._initOptionGroup(this._getHelpOption());
3302
+ }
3303
+ } else {
3304
+ this._helpOption = null;
3305
+ }
3306
+ return this;
3307
+ }
3308
+ this._helpOption = this.createOption(
3309
+ flags ?? "-h, --help",
3310
+ description ?? "display help for command"
3311
+ );
3312
+ if (flags || description) this._initOptionGroup(this._helpOption);
3313
+ return this;
3314
+ }
3315
+ /**
3316
+ * Lazy create help option.
3317
+ * Returns null if has been disabled with .helpOption(false).
3318
+ *
3319
+ * @returns {(Option | null)} the help option
3320
+ * @package
3321
+ */
3322
+ _getHelpOption() {
3323
+ if (this._helpOption === void 0) {
3324
+ this.helpOption(void 0, void 0);
3325
+ }
3326
+ return this._helpOption;
3327
+ }
3328
+ /**
3329
+ * Supply your own option to use for the built-in help option.
3330
+ * This is an alternative to using helpOption() to customise the flags and description etc.
3331
+ *
3332
+ * @param {Option} option
3333
+ * @return {Command} `this` command for chaining
3334
+ */
3335
+ addHelpOption(option) {
3336
+ this._helpOption = option;
3337
+ this._initOptionGroup(option);
3338
+ return this;
3339
+ }
3340
+ /**
3341
+ * Output help information and exit.
3342
+ *
3343
+ * Outputs built-in help, and custom text added using `.addHelpText()`.
3344
+ *
3345
+ * @param {{ error: boolean }} [contextOptions] - pass {error:true} to write to stderr instead of stdout
3346
+ */
3347
+ help(contextOptions) {
3348
+ this.outputHelp(contextOptions);
3349
+ let exitCode = Number(process.exitCode ?? 0);
3350
+ if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
3351
+ exitCode = 1;
3352
+ }
3353
+ this._exit(exitCode, "commander.help", "(outputHelp)");
3354
+ }
3355
+ /**
3356
+ * // Do a little typing to coordinate emit and listener for the help text events.
3357
+ * @typedef HelpTextEventContext
3358
+ * @type {object}
3359
+ * @property {boolean} error
3360
+ * @property {Command} command
3361
+ * @property {function} write
3362
+ */
3363
+ /**
3364
+ * Add additional text to be displayed with the built-in help.
3365
+ *
3366
+ * Position is 'before' or 'after' to affect just this command,
3367
+ * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.
3368
+ *
3369
+ * @param {string} position - before or after built-in help
3370
+ * @param {(string | Function)} text - string to add, or a function returning a string
3371
+ * @return {Command} `this` command for chaining
3372
+ */
3373
+ addHelpText(position, text) {
3374
+ const allowedValues = ["beforeAll", "before", "after", "afterAll"];
3375
+ if (!allowedValues.includes(position)) {
3376
+ throw new Error(`Unexpected value for position to addHelpText.
3377
+ Expecting one of '${allowedValues.join("', '")}'`);
3378
+ }
3379
+ const helpEvent = `${position}Help`;
3380
+ this.on(helpEvent, (context) => {
3381
+ let helpStr;
3382
+ if (typeof text === "function") {
3383
+ helpStr = text({ error: context.error, command: context.command });
3384
+ } else {
3385
+ helpStr = text;
3386
+ }
3387
+ if (helpStr) {
3388
+ context.write(`${helpStr}
3389
+ `);
3390
+ }
3391
+ });
3392
+ return this;
3393
+ }
3394
+ /**
3395
+ * Output help information if help flags specified
3396
+ *
3397
+ * @param {Array} args - array of options to search for help flags
3398
+ * @private
3399
+ */
3400
+ _outputHelpIfRequested(args) {
3401
+ const helpOption = this._getHelpOption();
3402
+ const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
3403
+ if (helpRequested) {
3404
+ this.outputHelp();
3405
+ this._exit(0, "commander.helpDisplayed", "(outputHelp)");
3406
+ }
3407
+ }
3408
+ };
3409
+ function incrementNodeInspectorPort(args) {
3410
+ return args.map((arg) => {
3411
+ if (!arg.startsWith("--inspect")) {
3412
+ return arg;
3413
+ }
3414
+ let debugOption;
3415
+ let debugHost = "127.0.0.1";
3416
+ let debugPort = "9229";
3417
+ let match;
3418
+ if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
3419
+ debugOption = match[1];
3420
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
3421
+ debugOption = match[1];
3422
+ if (/^\d+$/.test(match[3])) {
3423
+ debugPort = match[3];
3424
+ } else {
3425
+ debugHost = match[3];
3426
+ }
3427
+ } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
3428
+ debugOption = match[1];
3429
+ debugHost = match[3];
3430
+ debugPort = match[4];
3431
+ }
3432
+ if (debugOption && debugPort !== "0") {
3433
+ return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
3434
+ }
3435
+ return arg;
3436
+ });
3437
+ }
3438
+ __name(incrementNodeInspectorPort, "incrementNodeInspectorPort");
3439
+ function useColor() {
3440
+ if (process.env.NO_COLOR || process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false")
3441
+ return false;
3442
+ if (process.env.FORCE_COLOR || process.env.CLICOLOR_FORCE !== void 0)
3443
+ return true;
3444
+ return void 0;
3445
+ }
3446
+ __name(useColor, "useColor");
3447
+ exports.Command = Command2;
3448
+ exports.useColor = useColor;
3449
+ }
3450
+ });
3451
+
3452
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/index.js
3453
+ var require_commander = __commonJS({
3454
+ "../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/index.js"(exports) {
3455
+ "use strict";
3456
+ var { Argument: Argument2 } = require_argument();
3457
+ var { Command: Command2 } = require_command();
3458
+ var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
3459
+ var { Help: Help2 } = require_help();
3460
+ var { Option: Option2 } = require_option();
3461
+ exports.program = new Command2();
3462
+ exports.createCommand = (name) => new Command2(name);
3463
+ exports.createOption = (flags, description) => new Option2(flags, description);
3464
+ exports.createArgument = (name, description) => new Argument2(name, description);
3465
+ exports.Command = Command2;
3466
+ exports.Option = Option2;
3467
+ exports.Argument = Argument2;
3468
+ exports.Help = Help2;
3469
+ exports.CommanderError = CommanderError2;
3470
+ exports.InvalidArgumentError = InvalidArgumentError2;
3471
+ exports.InvalidOptionArgumentError = InvalidArgumentError2;
3472
+ }
3473
+ });
3474
+
3475
+ // ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/esm.mjs
3476
+ var import_index = __toESM(require_commander(), 1);
3477
+ var {
3478
+ program,
3479
+ createCommand,
3480
+ createArgument,
3481
+ createOption,
3482
+ CommanderError,
3483
+ InvalidArgumentError,
3484
+ InvalidOptionArgumentError,
3485
+ // deprecated old name
3486
+ Command,
3487
+ Argument,
3488
+ Option,
3489
+ Help
3490
+ } = import_index.default;
3491
+
3492
+ export {
3493
+ CommanderError,
3494
+ Command,
3495
+ Option
3496
+ };
3497
+ //# sourceMappingURL=chunk-MZP6SH3M.js.map