@readmagic/workmate 0.0.26 → 0.0.27

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 (335) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-mS8iUoWY.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-BHBkysy0.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
  4. package/dist/chunks/{App-D--vtCyq.js → App-DzRQpRKr.js} +1 -1
  5. package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DyqI98d2.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
  7. package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
  8. package/dist/chunks/{DiffDialog-BQAU2pJx.js → DiffDialog-CTUIAcEE.js} +6 -6
  9. package/dist/chunks/{Doctor-DJOMbSDE.js → Doctor-CLOYkPRR.js} +2 -2
  10. package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
  11. package/dist/chunks/{ExitFlow-xBOnvhiW.js → ExitFlow-CATwJC4c.js} +1 -1
  12. package/dist/chunks/{InvalidConfigDialog-NiuhcaG5.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-DrromC1I.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
  16. package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-BYG2yqjO.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
  18. package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
  19. package/dist/chunks/Messages-RBfRELKn.js +10 -0
  20. package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
  21. package/dist/chunks/{PermissionDialog-tEMMa5-a.js → PermissionDialog-DjCRuzSm.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-CPOaYnym.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CwqAsTI2.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
  25. package/dist/chunks/{ProviderSetup-J6Ty-Wj8.js → ProviderSetup-BEV95bnz.js} +1 -1
  26. package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
  27. package/dist/chunks/REPL-BDnZnm__.js +124 -0
  28. package/dist/chunks/REPL-BHk0vZDf.js +1 -0
  29. package/dist/chunks/{ResumeConversation-Cmsbo5m7.js → ResumeConversation-BuSqBrm1.js} +1 -1
  30. package/dist/chunks/{SearchBox-DQBLKyzJ.js → SearchBox-zA5QwIpO.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
  32. package/dist/chunks/Settings-DYKmPdbd.js +2 -0
  33. package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
  34. package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
  35. package/dist/chunks/{TextInput-BboKIug2.js → TextInput-ZKU-x_FD.js} +7 -7
  36. package/dist/chunks/{ThemePicker-DTpXbEY0.js → ThemePicker-B69oDgXN.js} +1 -1
  37. package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-C_gDQfm1.js → ValidationErrorsList-BUYHEft4.js} +1 -1
  39. package/dist/chunks/{_baseEach-DGbaIpJA.js → _baseEach-P0u1zIx6.js} +1 -1
  40. package/dist/chunks/{add-dir-B576wzi9.js → add-dir-C8RmmyQK.js} +1 -1
  41. package/dist/chunks/{agentDisplay-ZuFoBZYu.js → agentDisplay-np7CH47m.js} +1 -1
  42. package/dist/chunks/{agents-Dy4_hDic.js → agents-DRQlR5M1.js} +1 -1
  43. package/dist/chunks/agents-DedoH0Q4.js +101 -0
  44. package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
  45. package/dist/chunks/{appleTerminalBackup-C9kjzdM9.js → appleTerminalBackup-Bemd4RXh.js} +1 -1
  46. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
  47. package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
  48. package/dist/chunks/banner-CuoceXzz.js +2 -0
  49. package/dist/chunks/branch-ClhlS7f8.js +2 -0
  50. package/dist/chunks/{break-cache-DL95nKZl.js → break-cache-B1nuWtD_.js} +2 -2
  51. package/dist/chunks/{btw-Y44ctueB.js → btw-B-FLxlx-.js} +1 -1
  52. package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
  53. package/dist/chunks/caches-D7arwhaa.js +1 -0
  54. package/dist/chunks/caches-Dn8yrJmL.js +1 -0
  55. package/dist/chunks/{clear-DtTkA707.js → clear-BnWv0i65.js} +1 -1
  56. package/dist/chunks/{client-aJ2Nr_sh.js → client-2w-g5kMx.js} +1 -1
  57. package/dist/chunks/client-B0ngS4Uu.js +1 -0
  58. package/dist/chunks/client-BP4DOH3K.js +1 -0
  59. package/dist/chunks/{client-Bw_L3lSc.js → client-pA7fKk0-.js} +1 -1
  60. package/dist/chunks/commands-AcfFLgl5.js +1 -0
  61. package/dist/chunks/{compact-CvNOtu7J.js → compact-Banc-SNk.js} +1 -1
  62. package/dist/chunks/config-BDn2YIjC.js +3 -0
  63. package/dist/chunks/config-BhBcadjZ.js +1 -0
  64. package/dist/chunks/config-Bm5pVdCq.js +1 -0
  65. package/dist/chunks/{context-Opu4E8dL.js → context-BvDBAyJ9.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
  67. package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js} +9 -9
  68. package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
  69. package/dist/chunks/{conversation-CG_z7TLE.js → conversation-Cjaftrrw.js} +1 -1
  70. package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
  71. package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
  72. package/dist/chunks/{debug-kBjDaVkQ.js → debug-2pVES-2G.js} +1 -1
  73. package/dist/chunks/detectRepository--luIRv5H.js +1 -0
  74. package/dist/chunks/{diff-Cv7tX2-P.js → diff--6gQCx_x.js} +1 -1
  75. package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
  76. package/dist/chunks/doctor-CQf8xPZH.js +1 -0
  77. package/dist/chunks/entry-DWYOrkFS.js +13 -0
  78. package/dist/chunks/{envUtils-DZ_SvEVz.js → envUtils-QyzA_cFM.js} +1 -1
  79. package/dist/chunks/{execFileNoThrow-BfZFnCGa.js → execFileNoThrow-DXSEj8ZO.js} +1 -1
  80. package/dist/chunks/{exit-OKEV_ddw.js → exit-uKtXb5U3.js} +1 -1
  81. package/dist/chunks/{extraUsage-BlRL3yeb.js → extraUsage-Dr0YXm1w.js} +1 -1
  82. package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
  83. package/dist/chunks/fast-C5-lNCQi.js +1 -0
  84. package/dist/chunks/fast-aNkj6WvB.js +1 -0
  85. package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
  86. package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
  87. package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
  88. package/dist/chunks/{fpsMetrics-Ixd0J4CH.js → fpsMetrics-DIpm2-xw.js} +1 -1
  89. package/dist/chunks/{gemini-BfVyavwQ.js → gemini-BNBptTET.js} +1 -1
  90. package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
  91. package/dist/chunks/{genericProcessUtils-CVtQOTO2.js → genericProcessUtils-GqURdVAv.js} +1 -1
  92. package/dist/chunks/{goal-BidR-GFa.js → goal-j0wdadwM.js} +1 -1
  93. package/dist/chunks/{grok-DLcuI-U7.js → grok-BpO1ZwK_.js} +1 -1
  94. package/dist/chunks/{help-CZuvYhXj.js → help-DwhA0qQ6.js} +1 -1
  95. package/dist/chunks/{history-BxPGftQw.js → history-CUrqO9rV.js} +1 -1
  96. package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
  97. package/dist/chunks/{hooks-ehqfAM5F.js → hooks-DG4_WdZ2.js} +2 -2
  98. package/dist/chunks/install-BbmCNCuM.js +1 -0
  99. package/dist/chunks/{instrumentation-B9bfF2mA.js → instrumentation-DpPmDyNF.js} +4 -4
  100. package/dist/chunks/{job-Coztdn6A.js → job-GcmX1ALd.js} +1 -1
  101. package/dist/chunks/{keybindings-DwSdLpaE.js → keybindings-CxgQqQJe.js} +1 -1
  102. package/dist/chunks/{launchLocalMemory-DRzfpIOB.js → launchLocalMemory-CDgT5lst.js} +1 -1
  103. package/dist/chunks/{launchOnboarding-D2zFCJf-.js → launchOnboarding-uQ_ux9sS.js} +1 -1
  104. package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
  105. package/dist/chunks/{loadAgentsDir-DR5PVAc3.js → loadAgentsDir-uuZYOgKn.js} +392 -392
  106. package/dist/chunks/{loadPluginHooks-BiQgGfUJ.js → loadPluginHooks-QoVXsBjy.js} +1 -1
  107. package/dist/chunks/loader-BMAtuwRa.js +1 -0
  108. package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
  109. package/dist/chunks/{localSearch-CzkxDuOR.js → localSearch-yVCDrVrf.js} +1 -1
  110. package/dist/chunks/{log-DWZny1vM.js → log-L1kqxa_P.js} +1 -1
  111. package/dist/chunks/{logoUtils-DR5T0pr3.js → logoUtils-B4wCDKs9.js} +1 -1
  112. package/dist/chunks/{magicDocs-BwBxjfLo.js → magicDocs-D53lV8b5.js} +2 -2
  113. package/dist/chunks/{main-Ryi27wYq.js → main-fy_XSXGj.js} +34 -34
  114. package/dist/chunks/{managedEnv-Do9fgLpk.js → managedEnv-B8YWmM4A.js} +1 -1
  115. package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
  116. package/dist/chunks/{managedEnvConstants-CWcT7nYr.js → managedEnvConstants-BPY8yF1A.js} +1 -1
  117. package/dist/chunks/{mcp-BCpnF6wD.js → mcp--LmEVBRg.js} +1 -1
  118. package/dist/chunks/mcp-CZUVaPb3.js +5 -0
  119. package/dist/chunks/{mcp-CZBTxbhu.js → mcp-DCl-Tz-C.js} +1 -1
  120. package/dist/chunks/memory-Bu5ku7y9.js +1 -0
  121. package/dist/chunks/{modalContext-CBE8xuck.js → modalContext-sU2lfR08.js} +1 -1
  122. package/dist/chunks/{mode-wq70cR44.js → mode-Bteqe2QG.js} +1 -1
  123. package/dist/chunks/{model-DVk9-2dk.js → model-CHDU5yqH.js} +1 -1
  124. package/dist/chunks/model-CcHyMyBv.js +1 -0
  125. package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
  126. package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
  127. package/dist/chunks/{notifications-dGBuNvFj.js → notifications-GLnjirCl.js} +1 -1
  128. package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
  129. package/dist/chunks/{onChangeAppState-B4K-rSaF.js → onChangeAppState-CxGW2d-l.js} +1 -1
  130. package/dist/chunks/{openai-DAwnAV9K.js → openai-BpGQT2Iv.js} +1 -1
  131. package/dist/chunks/{overlayContext-B6i_6y_0.js → overlayContext-7wgLio1O.js} +1 -1
  132. package/dist/chunks/{panel-C0CF3noE.js → panel-DNiXDhBX.js} +1 -1
  133. package/dist/chunks/{parser-DThLwgdM.js → parser-CTnaXFVJ.js} +1 -1
  134. package/dist/chunks/parser-Diihup2V.js +1 -0
  135. package/dist/chunks/{partition-BRQHofxD.js → partition-djFY9gGI.js} +1 -1
  136. package/dist/chunks/{pasteStore-BmehVo5j.js → pasteStore-njJCBMKr.js} +1 -1
  137. package/dist/chunks/permissions-DNedQyLg.js +3 -0
  138. package/dist/chunks/pidLock-CFUBtZck.js +3 -0
  139. package/dist/chunks/{plan-B6U3ioer.js → plan-DI0n7LIV.js} +1 -1
  140. package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
  141. package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
  142. package/dist/chunks/{pluginBlocklist-DAoUENwc.js → pluginBlocklist-CKCsgWdY.js} +1 -1
  143. package/dist/chunks/{pluginCliCommands-CaHnj0C_.js → pluginCliCommands-CACeyIwz.js} +1 -1
  144. package/dist/chunks/{pluginFlagging-BCj9LJP3.js → pluginFlagging-CUvkKGOB.js} +1 -1
  145. package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
  146. package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
  147. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
  148. package/dist/chunks/{plugins-D7zyI9c4.js → plugins-Divl-P-X.js} +1 -1
  149. package/dist/chunks/{poorMode-Ocff_UT1.js → poorMode-CG2JNTD0.js} +1 -1
  150. package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
  151. package/dist/chunks/print-DSHypGJa.js +13 -0
  152. package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
  153. package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
  154. package/dist/chunks/{projectContext-QN5U3Ggr.js → projectContext-BFfHgAMh.js} +1 -1
  155. package/dist/chunks/{projectContext-COeHKDrk.js → projectContext-DnJHynXv.js} +1 -1
  156. package/dist/chunks/{projectOnboardingState-KqcpRXls.js → projectOnboardingState-nTCycGCD.js} +1 -1
  157. package/dist/chunks/prompt-BZmu5CeK.js +1 -0
  158. package/dist/chunks/{prompt-CTByhpUI.js → prompt-BfXryFt-.js} +8 -8
  159. package/dist/chunks/prompt-Cogr_WZr.js +1 -0
  160. package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
  161. package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
  162. package/dist/chunks/{proxy-BtWuysHM.js → proxy--_NfbJhm.js} +1 -1
  163. package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
  164. package/dist/chunks/{refresh-B4pqFp12.js → refresh-CBHbWTGg.js} +1 -1
  165. package/dist/chunks/reject-CBxnwckZ.js +1 -0
  166. package/dist/chunks/{reload-plugins-DXQqk7q6.js → reload-plugins-5eFWrQlL.js} +1 -1
  167. package/dist/chunks/{rename-D4XBmTBI.js → rename-Cw7cMerG.js} +1 -1
  168. package/dist/chunks/{renderOptions-DkP98P_d.js → renderOptions-B0RFpjRI.js} +1 -1
  169. package/dist/chunks/{resume-DzIev0JI.js → resume-U2D0ybfU.js} +1 -1
  170. package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
  171. package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
  172. package/dist/chunks/{runtimeObserver-BPqlbu0B.js → runtimeObserver-CWaYMJG8.js} +2 -2
  173. package/dist/chunks/{runtimeObserver-BUHs3qjs.js → runtimeObserver-DOYlxx9H.js} +1 -1
  174. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
  175. package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
  176. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
  177. package/dist/chunks/select-BuTJbu_Q.js +1 -0
  178. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
  179. package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
  180. package/dist/chunks/{sessionObserver-B6xzxckA.js → sessionObserver-cfwD8pV8.js} +1 -1
  181. package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
  182. package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
  183. package/dist/chunks/settings-D4M13toi.js +104 -0
  184. package/dist/chunks/settings-Dfit5gGT.js +1 -0
  185. package/dist/chunks/setup-DR-KEmxL.js +3 -0
  186. package/dist/chunks/{shadowedRuleDetection-D6R2OeoH.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
  187. package/dist/chunks/{sideQuestion-5jcbOMsR.js → sideQuestion-CdgUarC2.js} +1 -1
  188. package/dist/chunks/{sinks-B-kFqjjd.js → sinks-Cy3NqVbk.js} +1 -1
  189. package/dist/chunks/sinks-D41OiGE4.js +1 -0
  190. package/dist/chunks/{skillChangeDetector-103-nEle.js → skillChangeDetector-CVFCJcG7.js} +1 -1
  191. package/dist/chunks/{skillGapStore-DOz1KCqo.js → skillGapStore-BJV8ZIB1.js} +2 -2
  192. package/dist/chunks/{skillLifecycle-D9NkIwFQ.js → skillLifecycle-iO_3s9Ff.js} +2 -2
  193. package/dist/chunks/{skillSearchPanel-DFiSZaJ4.js → skillSearchPanel-BL5gXTHU.js} +2 -2
  194. package/dist/chunks/skills-BEp3_RyT.js +1 -0
  195. package/dist/chunks/sleep-xKMbXTJe.js +1 -0
  196. package/dist/chunks/{src-WZ94ZKI3.js → src-BX54x08P.js} +1 -1
  197. package/dist/chunks/{src-Cy5_qH26.js → src-HB5wLari.js} +1 -1
  198. package/dist/chunks/{startupProfiler-DIM_Ihyp.js → startupProfiler-B9Qv2QGH.js} +1 -1
  199. package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
  200. package/dist/chunks/{staticRender-RHUIg5ln.js → staticRender-Bt82RvGc.js} +1 -1
  201. package/dist/chunks/status-6JMz8jmM.js +1 -0
  202. package/dist/chunks/{statusNoticeHelpers-DI45AH-c.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
  203. package/dist/chunks/{stringUtils-D_xPrwGQ.js → stringUtils-Cs6E5f-B.js} +1 -1
  204. package/dist/chunks/switcher-95d4TrQH.js +1 -0
  205. package/dist/chunks/{switcher-DhZCaAun.js → switcher-DSt2cVjA.js} +1 -1
  206. package/dist/chunks/{tasks-6suPhqsK.js → tasks-DyBUXnQb.js} +1 -1
  207. package/dist/chunks/{templateJobs-BKVEWCsb.js → templateJobs-BBnReWWj.js} +7 -7
  208. package/dist/chunks/{terminalSetup-7PUR4hfo.js → terminalSetup-CDpFfqqV.js} +1 -1
  209. package/dist/chunks/{terminalSetup-Cqy5_PhJ.js → terminalSetup-DedaY1P7.js} +4 -4
  210. package/dist/chunks/{theme-B-HG2PUs.js → theme-BZOy9Iqh.js} +1 -1
  211. package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
  212. package/dist/chunks/{toolEventObserver-BY3QVnr6.js → toolEventObserver-ClwWmVbH.js} +1 -1
  213. package/dist/chunks/{toolPool-BcwIF8Q_.js → toolPool-DSTbgGmX.js} +1 -1
  214. package/dist/chunks/{udsClient-CCxgLiZy.js → udsClient-CWeoNrm3.js} +1 -1
  215. package/dist/chunks/{useDoublePress-DQBLKyzJ.js → useDoublePress-zA5QwIpO.js} +1 -1
  216. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BgJrnuDl.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
  217. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
  218. package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
  219. package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
  220. package/dist/chunks/{useSearchInput-BITV_Txn.js → useSearchInput-BIQN_-Hm.js} +1 -1
  221. package/dist/chunks/{useSettingsErrors-CO0fTNzn.js → useSettingsErrors-BDJCLei_.js} +1 -1
  222. package/dist/chunks/util-BHr5l6Bx.js +1 -0
  223. package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
  224. package/dist/chunks/{vim-qgMS88ss.js → vim-CYjMtnwH.js} +1 -1
  225. package/dist/chunks/worktree-CGu_58ue.js +1 -0
  226. package/dist/cli.js +1 -1
  227. package/package.json +2 -2
  228. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +0 -1
  229. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +0 -2
  230. package/dist/chunks/CustomSelect-CpMbxYbt.js +0 -1
  231. package/dist/chunks/Doctor-BU69VQzw.js +0 -1
  232. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +0 -1
  233. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +0 -1
  234. package/dist/chunks/MCPToolListView-BRxjOaOL.js +0 -1
  235. package/dist/chunks/MessageSelector-B7xAQqZI.js +0 -3
  236. package/dist/chunks/Messages-CxMsfjOa.js +0 -10
  237. package/dist/chunks/Onboarding-CkATe87e.js +0 -1
  238. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +0 -1
  239. package/dist/chunks/QueryEngine-Mdi_kUaL.js +0 -1
  240. package/dist/chunks/REPL-BgzQtSFF.js +0 -1
  241. package/dist/chunks/REPL-rirm6s_7.js +0 -124
  242. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +0 -1
  243. package/dist/chunks/SelectMulti-BpAjjhsn.js +0 -1
  244. package/dist/chunks/Settings-B6DImvca.js +0 -2
  245. package/dist/chunks/Spinner-DhhSOFcN.js +0 -1
  246. package/dist/chunks/SpinnerGlyph-CmVXC-_9.js +0 -1
  247. package/dist/chunks/TrustDialog-CZ8JpySm.js +0 -1
  248. package/dist/chunks/agents-HIOBiw4w.js +0 -101
  249. package/dist/chunks/allErrors-CxPNR2WN.js +0 -1
  250. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +0 -1
  251. package/dist/chunks/banner-DqFectPg.js +0 -2
  252. package/dist/chunks/branch-B_BL5N9N.js +0 -2
  253. package/dist/chunks/bundledMode-BxyD5cqq.js +0 -1
  254. package/dist/chunks/caches-5xZ4dSXt.js +0 -1
  255. package/dist/chunks/caches-Be9saXxV.js +0 -1
  256. package/dist/chunks/claudeDesktop-g8eUUY2E.js +0 -1
  257. package/dist/chunks/client-mnUISv_N.js +0 -1
  258. package/dist/chunks/client-wPqIdEVm.js +0 -1
  259. package/dist/chunks/commands-wfE12a4L.js +0 -1
  260. package/dist/chunks/config-D3K87Mm1.js +0 -3
  261. package/dist/chunks/config-DTga6Ku8.js +0 -1
  262. package/dist/chunks/config-DtmqWusU.js +0 -1
  263. package/dist/chunks/context-noninteractive-eIlneYiL.js +0 -1
  264. package/dist/chunks/conversation-CHesBfFZ.js +0 -1
  265. package/dist/chunks/conversationRecovery-OhitW-7g.js +0 -1
  266. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +0 -40
  267. package/dist/chunks/detectRepository-M6K2wc7h.js +0 -1
  268. package/dist/chunks/directoryCompletion-BHyjyKAM.js +0 -1
  269. package/dist/chunks/doctor-DeBG5SL5.js +0 -1
  270. package/dist/chunks/entry-CbhyIWgj.js +0 -13
  271. package/dist/chunks/extractMemories-jnsv-_n_.js +0 -1
  272. package/dist/chunks/fast-4I_qPJCd.js +0 -1
  273. package/dist/chunks/fast-DiolM1M7.js +0 -1
  274. package/dist/chunks/fetchModelList-BRFTQim4.js +0 -1
  275. package/dist/chunks/fetchModelList-qPKAuu4m.js +0 -1
  276. package/dist/chunks/fileSuggestions-iWVXvvLB.js +0 -3
  277. package/dist/chunks/generateSessionName-CGaTTXCA.js +0 -1
  278. package/dist/chunks/hooks-Bg9WIjZQ.js +0 -1
  279. package/dist/chunks/install-ACGY0vhM.js +0 -1
  280. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +0 -1
  281. package/dist/chunks/loader-6MqzNGmV.js +0 -1
  282. package/dist/chunks/localSearch-DW3JT2MA.js +0 -1
  283. package/dist/chunks/managedEnv-DCEJh3z3.js +0 -1
  284. package/dist/chunks/mcp-CJ6SDJEK.js +0 -6
  285. package/dist/chunks/memory-BQO6Y0ak.js +0 -1
  286. package/dist/chunks/model-D42epddJ.js +0 -1
  287. package/dist/chunks/modelOptions-beLgXORr.js +0 -1
  288. package/dist/chunks/nativeInstaller-ChGSz1lb.js +0 -1
  289. package/dist/chunks/parser-BZt0VFd_.js +0 -1
  290. package/dist/chunks/permissions-DkfWKN-B.js +0 -3
  291. package/dist/chunks/pidLock-YvAaIrIY.js +0 -3
  292. package/dist/chunks/platform-Vl9IynC3.js +0 -2
  293. package/dist/chunks/plugin-CTA2_-F7.js +0 -17
  294. package/dist/chunks/pluginAutoupdate-Dy5W3HWE.js +0 -1
  295. package/dist/chunks/pluginOperations-ClXNOOG6.js +0 -2
  296. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +0 -1
  297. package/dist/chunks/pluginStartupCheck-U8_xk25t.js +0 -1
  298. package/dist/chunks/poorMode-DtzWNhsY.js +0 -1
  299. package/dist/chunks/print-BzljdXem.js +0 -13
  300. package/dist/chunks/processBashCommand-RUkmyAl4.js +0 -1
  301. package/dist/chunks/processSlashCommand-DRLO-jNV.js +0 -5
  302. package/dist/chunks/prompt-DTpfW6yP.js +0 -1
  303. package/dist/chunks/prompt-D__eHY_5.js +0 -1
  304. package/dist/chunks/promptEditor-CpUFgGzc.js +0 -4
  305. package/dist/chunks/protocolHandler-BQSLVGnG.js +0 -13
  306. package/dist/chunks/reconciler-D6BUq8WB.js +0 -1
  307. package/dist/chunks/reject-C6IvUvBt.js +0 -1
  308. package/dist/chunks/ripgrep-CYP26Fhg.js +0 -1
  309. package/dist/chunks/ripgrep-D1f1pbCz.js +0 -5
  310. package/dist/chunks/sandbox-adapter-CumL75tU.js +0 -1
  311. package/dist/chunks/sandbox-toggle-CTtET6Xq.js +0 -1
  312. package/dist/chunks/searchExtraTools-BMCU2zEf.js +0 -1
  313. package/dist/chunks/select-FrwoTzuc.js +0 -1
  314. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +0 -1
  315. package/dist/chunks/sessionObserver-CBrM4opL.js +0 -1
  316. package/dist/chunks/sessionStorage-C1EAxDWG.js +0 -1
  317. package/dist/chunks/sessionTracing-UFK96PxT.js +0 -11
  318. package/dist/chunks/settings-BK6gCko-.js +0 -1
  319. package/dist/chunks/settings-YIDksG5Z.js +0 -24
  320. package/dist/chunks/setup-BBvZyrfz.js +0 -3
  321. package/dist/chunks/sinks-DB_D4lmu.js +0 -1
  322. package/dist/chunks/skills-DgeLr52a.js +0 -1
  323. package/dist/chunks/sleep-BbWr_FL1.js +0 -1
  324. package/dist/chunks/startupProfiler-FpGsKWYk.js +0 -1
  325. package/dist/chunks/status-CKLecQZV.js +0 -1
  326. package/dist/chunks/switcher-D2Z2ZNQ0.js +0 -1
  327. package/dist/chunks/tipRegistry-BR_lSGRw.js +0 -2
  328. package/dist/chunks/types-CD25a50S.js +0 -81
  329. package/dist/chunks/use-select-navigation-CW5alA9r.js +0 -1
  330. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +0 -1
  331. package/dist/chunks/useManagePlugins-CrWjzESW.js +0 -1
  332. package/dist/chunks/useMergedTools-r6GQq5mI.js +0 -1
  333. package/dist/chunks/util-_zo3I1y8.js +0 -1
  334. package/dist/chunks/validatePlugin-DFGdRhA-.js +0 -1
  335. package/dist/chunks/worktree-CR_M6Qfy.js +0 -1
@@ -1,22 +1,22 @@
1
- import{a as e,i as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./memoize-BK3gG5ob.js";import{a as o,d as s,l as c,o as l,s as u,u as d}from"./envUtils-DZ_SvEVz.js";import{n as f,t as p}from"./defineProperty-C-QyHrDq.js";import{B as m,D as ee,I as h,Lt as te,P as ne,R as re,T as g,ai as _,di as v,fi as y,rr as ie,t as b,xr as ae,y as oe}from"./src-WZ94ZKI3.js";import{t as se}from"./jsx-runtime-Bb4Xn-E0.js";import{A as ce,J as le,N as ue,W as x,X as S,Z as de,b as fe,d as pe,k as me,l as C,o as w,s as T}from"./types-CD25a50S.js";import{$n as E,F as he,Fn as ge,In as _e,Ln as D,Nn as ve,Pn as ye,Pt as O,Qn as be,U as k,Yt as xe,Zt as Se,bn as Ce,cn as we,it as Te,j as Ee,jn as A,ln as De,q as Oe,qt as ke,rn as j,rt as Ae,sn as je,vn as Me,yn as Ne}from"./state-CXY-q5gr.js";import{$S as Pe,$d as Fe,$g as Ie,$x as Le,AC as Re,Aa as ze,As as Be,Bc as Ve,Ct as He,Dc as Ue,Di as We,Dn as Ge,Ds as Ke,Dy as qe,Ec as Je,Ep as Ye,Es as Xe,Et as Ze,F_ as Qe,Fd as $e,Fs as et,Gm as tt,Gu as nt,Hd as rt,Hm as it,I_ as at,Ia as ot,Id as st,Im as ct,Ja as lt,Ji as M,Jl as N,Ju as ut,K_ as dt,Kl as ft,Ld as pt,Lh as P,Lm as F,M as mt,Mi as I,Mn as ht,NC as gt,No as _t,Ns as vt,Os as yt,P_ as bt,Pa as xt,Qr as St,Qs as Ct,Ri as L,Rn as wt,Rs as Tt,S as Et,St as Dt,T as Ot,Tp as kt,Ty as At,Ud as jt,Um as Mt,Vc as Nt,Vd as Pt,WC as Ft,XS as It,Xa as Lt,Xs as R,Xv as Rt,Xx as zt,YC as z,YS as Bt,Ya as Vt,Ys as Ht,ZS as Ut,Zd as Wt,aC as Gt,ac as Kt,af as qt,ah as Jt,ar as Yt,at as Xt,au as Zt,b as Qt,bi as $t,bt as en,cf as tn,ch as nn,dC as rn,dh as an,ds as on,eC as sn,ec as cn,et as ln,ex as un,f as dn,fC as fn,ff as pn,gC as mn,gi as hn,gr as gn,hC as _n,hd as vn,hi as yn,i as bn,if as xn,ih as Sn,it as Cn,ix as wn,jn as Tn,jo as En,jy as Dn,k as On,kC as kn,ki as An,ky as jn,lC as Mn,lf as Nn,lr as Pn,ls as Fn,lx as In,md as Ln,mi as Rn,nC as zn,n_ as Bn,nf as Vn,o as Hn,oc as Un,oh as Wn,oi as Gn,ou as Kn,pf as qn,ph as Jn,q_ as Yn,qa as Xn,qv as Zn,r as Qn,rC as $n,r_ as er,rf as tr,s as nr,sC as rr,sh as ir,si as ar,su as or,sx as sr,tC as cr,t_ as lr,tf as ur,tt as dr,uC as fr,uf as pr,vi as mr,x as hr,yi as gr,zh as _r,zi as vr}from"./loadAgentsDir-DR5PVAc3.js";import{n as yr,t as br}from"./cwd-DrEEb4f5.js";import{$ as xr,C as Sr,I as Cr,M as wr,N as Tr,O as Er,R as Dr,S as Or,T as kr,c as B,et as Ar,f as jr,g as Mr,i as Nr,l as Pr,u as Fr,x as Ir}from"./debug-kBjDaVkQ.js";import{Ar as Lr,At as Rr,C as zr,Cr as Br,D as Vr,E as Hr,Jt as Ur,K as Wr,Kr as Gr,Mr as Kr,Pr as qr,Rt as Jr,X as Yr,b as Xr,cn as Zr,d as Qr,l as $r,m as V,p as ei,qr as H,qt as ti,r as ni,s as ri,t as U,un as ii,xr as ai,y as W}from"./settings-YIDksG5Z.js";import{C as oi,T as si,a as ci,b as li,d as G,f as ui,h as K,m as di,n as fi,o as q,p as pi,t as mi}from"./config-D3K87Mm1.js";import{a as hi,n as gi,r as _i}from"./process-gEbdy6uY.js";import{r as vi,t as yi}from"./execa-CBhG1doD.js";import{d as bi,f as xi,o as Si,s as J}from"./log-DWZny1vM.js";import{a as Ci,i as wi,n as Ti,t as Ei}from"./bundledMode-BxyD5cqq.js";import{i as Di,n as Oi}from"./platform-Vl9IynC3.js";import{n as Y}from"./analytics-COpjZpvd.js";import{i as ki,n as Ai,r as X}from"./startupProfiler-DIM_Ihyp.js";import{l as ji,o as Mi}from"./stringUtils-D_xPrwGQ.js";import{D as Ni,Mt as Pi,Pt as Fi,_ as Ii,at as Li,ct as Ri,d as zi,et as Bi,f as Vi,h as Hi,k as Ui,p as Wi,r as Gi,st as Ki,v as qi}from"./model-D42epddJ.js";import{Ft as Ji,It as Yi,Kt as Xi,Lt as Zi,at as Qi,it as $i,jt as ea,ot as ta,qt as na}from"./prompt-CTByhpUI.js";import{c as ra,d as ia,m as aa,n as oa}from"./proxy-BtWuysHM.js";import{_ as sa,a as ca,d as la,f as ua,g as da,m as fa,p as pa,s as ma}from"./sleep-BbWr_FL1.js";import{n as ha,t as ga}from"./partition-BRQHofxD.js";import{a as _a,n as va}from"./ripgrep-D1f1pbCz.js";import{n as ya,r as ba}from"./loader-6MqzNGmV.js";import{A as xa,D as Sa,O as Ca,j as wa}from"./sessionTracing-UFK96PxT.js";import{n as Ta,t as Ea}from"./worktreeModeEnabled-BFOYTTTr.js";import{s as Da,t as Oa}from"./history-BxPGftQw.js";import{n as ka,t as Aa}from"./SelectMulti-BpAjjhsn.js";import{t as ja}from"./KeybindingProviderSetup-CSUkJHTT.js";import{n as Ma,t as Na}from"./exit-s9XGerrH.js";import{n as Pa,s as Fa,t as Ia}from"./pluginOperations-ClXNOOG6.js";import"./pluginCliCommands-CaHnj0C_.js";import{n as La}from"./conversationRecovery-OhitW-7g.js";import{t as Ra}from"./select-FrwoTzuc.js";import{i as za,t as Ba}from"./skillChangeDetector-103-nEle.js";import{n as Va,t as Ha}from"./tempfile-CHO5wXsV.js";import{n as Ua,r as Wa}from"./detectRepository-M6K2wc7h.js";import{n as Ga,t as Ka}from"./allErrors-CxPNR2WN.js";import{t as qa}from"./CustomSelect-CpMbxYbt.js";import{r as Ja,t as Ya}from"./onChangeAppState-B4K-rSaF.js";import{n as Xa,r as Za,t as Qa}from"./managedEnv-Do9fgLpk.js";import{t as $a}from"./renderOptions-DkP98P_d.js";import{i as eo,o as to,s as no,t as ro}from"./tipRegistry-BR_lSGRw.js";import{i as io,n as ao}from"./earlyInput-IghoCjG5.js";import{a as oo,t as so}from"./banner-DqFectPg.js";import{posix as co,resolve as lo,win32 as uo}from"path";import{appendFileSync as fo,readFileSync as po}from"fs";import{execFile as mo}from"child_process";a(),f(),be(),O(),xr(),Cr(),Ir(),jr(),gi(),Nr(),Y(),Ai(),Hr(),l(),ir();var ho=1e4,go=null;function _o(e){return new Promise(t=>{mo(`security`,[`find-generic-password`,`-a`,Wn(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:ho},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function vo(){if(process.platform!==`darwin`||go||u())return;let e=_o(Jt(Sn));go=Promise.all([e]).then(([e])=>{e.timedOut||nn(e.stdout)})}async function yo(){go&&await go}var bo=r((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),xo=r((e=>{var{InvalidArgumentError:t}=bo(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),So=r((e=>{var{humanReadableArgName:t}=xo(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{a as e,i as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./memoize-BK3gG5ob.js";import{a as o,d as s,l as c,o as l,s as u,u as d}from"./envUtils-QyzA_cFM.js";import{n as f,t as p}from"./defineProperty-C-QyHrDq.js";import{B as m,D as h,I as g,Lt as ee,P as te,R as ne,T as _,ai as v,di as y,fi as b,rr as re,t as x,xr as ie,y as ae}from"./src-BX54x08P.js";import{t as oe}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as se,C as ce,D as le,E as S,Gr as ue,Hi as de,Ht as fe,Ir as pe,K as C,Ni as w,Pr as T,Pt as E,Qt as me,Ur as D,Vi as he,Wi as ge,X as O,Zt as _e,b as ve,bn as ye,d as be,di as k,en as xe,gn as Se,ia as A,l as Ce,m as j,mn as M,oa as we,p as Te,qr as Ee,r as De,s as N,sa as Oe,t as ke,ta as Ae,ui as je,vn as Me,y as P}from"./settings-D4M13toi.js";import{$n as Ne,F as Pe,Fn as Fe,In as Ie,Ln as Le,Nn as Re,Pn as ze,Pt as F,Qn as Be,U as Ve,Yt as He,Zt as Ue,bn as I,cn as We,it as Ge,j as Ke,jn as L,ln as R,q as qe,qt as Je,rn as z,rt as B,sn as Ye,vn as Xe,yn as Ze}from"./state-CXY-q5gr.js";import{$S as Qe,$d as V,$g as $e,$x as et,AC as tt,Aa as nt,As as rt,Bc as it,Ct as at,Dc as ot,Di as st,Dn as ct,Ds as lt,Dy as ut,Ec as dt,Ep as ft,Es as pt,Et as mt,F_ as ht,Fd as gt,Fs as _t,Gm as vt,Gu as yt,Hd as bt,Hm as H,I_ as U,Ia as xt,Id as St,Im as Ct,Ja as wt,Ji as Tt,Jl as Et,Ju as Dt,K_ as Ot,Kl as kt,Ld as At,Lh as W,Lm as jt,M as Mt,Mi as Nt,Mn as Pt,NC as Ft,No as It,Ns as Lt,Os as Rt,P_ as zt,Pa as Bt,Qr as Vt,Qs as Ht,Ri as Ut,Rn as Wt,Rs as Gt,S as Kt,St as qt,T as Jt,Tp as Yt,Ty as Xt,Ud as Zt,Um as Qt,Vc as $t,Vd as en,WC as tn,XS as nn,Xa as rn,Xs as an,Xv as on,Xx as sn,YC as cn,YS as ln,Ya as un,Ys as dn,ZS as fn,Zd as pn,aC as mn,ac as hn,af as gn,ah as _n,ar as vn,at as yn,au as bn,b as xn,bi as Sn,bt as Cn,cf as wn,ch as Tn,dC as En,dh as Dn,ds as On,eC as kn,ec as An,et as jn,ex as Mn,f as Nn,fC as Pn,ff as Fn,gC as In,gi as Ln,gr as Rn,hC as zn,hd as Bn,hi as Vn,i as Hn,if as Un,ih as Wn,it as Gn,ix as Kn,jn as qn,jo as Jn,jy as Yn,k as Xn,kC as Zn,ki as Qn,ky as $n,lC as er,lf as tr,lr as nr,ls as rr,lx as ir,md as ar,mi as or,nC as sr,n_ as cr,nf as lr,o as ur,oc as dr,oh as fr,oi as pr,ou as mr,pf as hr,ph as gr,q_ as _r,qa as vr,qv as yr,r as br,rC as xr,r_ as Sr,rf as Cr,s as wr,sC as Tr,sh as Er,si as Dr,su as Or,sx as kr,tC as Ar,t_ as jr,tf as Mr,tt as Nr,uC as Pr,uf as Fr,vi as Ir,x as Lr,yi as Rr,zh as zr,zi as Br}from"./loadAgentsDir-uuZYOgKn.js";import{n as Vr,t as Hr}from"./cwd-DrEEb4f5.js";import{$ as Ur,C as Wr,I as Gr,M as Kr,N as qr,O as Jr,R as Yr,S as Xr,T as Zr,c as G,et as Qr,f as $r,g as ei,i as ti,l as ni,u as ri,x as ii}from"./debug-2pVES-2G.js";import{C as ai,T as oi,a as si,b as ci,d as K,f as li,h as q,m as ui,n as di,o as J,p as fi,t as pi}from"./config-BDn2YIjC.js";import{a as mi,n as hi,r as gi}from"./process-gEbdy6uY.js";import{r as _i,t as vi}from"./execa-CBhG1doD.js";import{d as yi,f as bi,o as xi,s as Y}from"./log-L1kqxa_P.js";import{c as Si,i as Ci,n as wi,o as Ti,s as Ei,t as Di}from"./bundledMode-D9omqD3L.js";import{n as X}from"./analytics-COpjZpvd.js";import{i as Oi,n as ki,r as Z}from"./startupProfiler-B9Qv2QGH.js";import{l as Ai,o as ji}from"./stringUtils-Cs6E5f-B.js";import{D as Mi,Mt as Ni,Pt as Pi,_ as Fi,at as Ii,ct as Li,d as Ri,et as zi,f as Bi,h as Vi,k as Hi,p as Ui,r as Wi,st as Gi,v as Ki}from"./model-CcHyMyBv.js";import{Ft as qi,It as Ji,Kt as Yi,Lt as Xi,at as Zi,it as Qi,jt as $i,ot as ea,qt as ta}from"./prompt-BfXryFt-.js";import{c as na,d as ra,m as ia,n as aa}from"./proxy--_NfbJhm.js";import{_ as oa,a as sa,d as ca,f as la,g as ua,m as da,p as fa,s as pa}from"./sleep-xKMbXTJe.js";import{n as ma,t as ha}from"./partition-djFY9gGI.js";import{a as ga,n as _a}from"./ripgrep-67m14ImZ.js";import{n as va,r as ya}from"./loader-BMAtuwRa.js";import{A as ba,D as xa,O as Sa,j as Ca}from"./sessionTracing-DsdcOqvc.js";import{n as wa,t as Ta}from"./worktreeModeEnabled-BFOYTTTr.js";import{n as Ea,t as Da}from"./exit-s9XGerrH.js";import{n as Oa,s as ka,t as Aa}from"./pluginOperations-Ca_T-HYn.js";import"./pluginCliCommands-CACeyIwz.js";import{t as ja}from"./KeybindingProviderSetup-Dzg77_Xn.js";import{n as Ma}from"./conversationRecovery-NL05oJb1.js";import{t as Na}from"./select-BuTJbu_Q.js";import{s as Pa,t as Fa}from"./history-CUrqO9rV.js";import{i as Ia,t as La}from"./skillChangeDetector-CVFCJcG7.js";import{n as Ra,t as za}from"./tempfile-CHO5wXsV.js";import{n as Ba,r as Va}from"./detectRepository--luIRv5H.js";import{n as Ha,t as Ua}from"./allErrors-DvcU0w0F.js";import{n as Wa,r as Ga,t as Ka}from"./CustomSelect-CYmc4vRh.js";import{r as qa,t as Ja}from"./onChangeAppState-CxGW2d-l.js";import{n as Ya,r as Xa,t as Za}from"./managedEnv-B8YWmM4A.js";import{t as Qa}from"./renderOptions-B0RFpjRI.js";import{i as $a,o as eo,s as to,t as no}from"./tipRegistry-Cl5sdLRX.js";import{i as ro,n as io}from"./earlyInput-IghoCjG5.js";import{a as ao,t as oo}from"./banner-CuoceXzz.js";import{posix as so,resolve as co,win32 as lo}from"path";import{appendFileSync as uo,readFileSync as fo}from"fs";import{execFile as po}from"child_process";a(),f(),Be(),F(),Ur(),Gr(),ii(),$r(),hi(),ti(),X(),ki(),S(),l(),Er();var mo=1e4,ho=null;function go(e){return new Promise(t=>{po(`security`,[`find-generic-password`,`-a`,fr(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:mo},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function _o(){if(process.platform!==`darwin`||ho||u())return;let e=go(_n(Wn));ho=Promise.all([e]).then(([e])=>{e.timedOut||Tn(e.stdout)})}async function vo(){ho&&await ho}var yo=r((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),bo=r((e=>{var{InvalidArgumentError:t}=yo(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),xo=r((e=>{var{humanReadableArgName:t}=bo(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
- `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),Co=r((e=>{var{InvalidArgumentError:t}=bo(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
4
+ `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),So=r((e=>{var{InvalidArgumentError:t}=yo(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
5
5
  - a short flag is a single dash and a single character
6
6
  - either use a single dash and a single character (for a short flag)
7
7
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
8
8
  - too many short flags`):i.test(t)?Error(`${n}
9
9
  - too many long flags`):Error(`${n}
10
- - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),wo=r((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),To=r((e=>{var n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=xo(),{CommanderError:l}=bo(),{Help:u,stripColor:d}=So(),{Option:f,DualOptions:p}=Co(),{suggestSimilar:m}=wo(),ee=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>te()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>te()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i=i||{};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
10
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),Co=r((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),wo=r((e=>{var n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=bo(),{CommanderError:l}=yo(),{Help:u,stripColor:d}=xo(),{Option:f,DualOptions:p}=So(),{suggestSimilar:m}=Co(),h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>ee()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>ee()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i=i||{};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
11
11
  - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new s(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
12
12
  Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new l(e,t,n)),o.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new f(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
13
13
  - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0||e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??(t=e.negate?!1:e.isBoolean()||e.optional?!0:``),this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{let n=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,n,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{let n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,n,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof f)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t=t||{},e===void 0&&t.from===void 0){o.versions?.electron&&(t.from=`electron`);let e=o.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=o.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:o.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
14
14
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(a.existsSync(e))return;let r=`'${e}' does not exist
15
15
  - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=h(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e=e??1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
17
+ - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e=e??1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
18
18
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||`-V, --version`,n=n||`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e=e||{};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
19
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function te(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=ee,e.useColor=te})),Eo=r((e=>{var{Argument:t}=xo(),{Command:n}=To(),{CommanderError:r,InvalidArgumentError:i}=bo(),{Help:a}=So(),{Option:o}=Co();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),Do=r(((e,t)=>{var n=Eo();e=t.exports={},e.program=new n.Command,e.Argument=n.Argument,e.Command=n.Command,e.CommanderError=n.CommanderError,e.Help=n.Help,e.InvalidArgumentError=n.InvalidArgumentError,e.InvalidOptionArgumentError=n.InvalidArgumentError,e.Option=n.Option,e.createCommand=e=>new n.Command(e),e.createOption=(e,t)=>new n.Option(e,t),e.createArgument=(e,t)=>new n.Argument(e,t)}));Ur();var{program:Oo,createCommand:ko,createArgument:Ao,createOption:jo,CommanderError:Mo,InvalidArgumentError:No,InvalidOptionArgumentError:Po,Command:Fo,Argument:Io,Option:Z,Help:Lo}=n(Do(),1).default;y();var Ro=n(_(),1),Q=se();b(),fe(),yr(),Gr(),vi(),Si(),wi(),qr(),Di(),ai(),C(),Zr(),zr(),V(),oi(),G(),_n(),rn(),jn(),at(),it(),kt(),R(),M(),L(),I(),$t(),hn(),gn(),Tn();function zo(){return!1}async function Bo(){zo()&&B(`Policy limits: skipping load — no auth available`)}l(),bi();var Vo=!1;function Ho(){if(Vo||(Vo=!0,xi())||c(process.env.WORKMATE_USE_BEDROCK)||c(process.env.WORKMATE_USE_VERTEX)||c(process.env.WORKMATE_USE_FOUNDRY)||process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.WORKMATE_CLIENT_CERT||process.env.WORKMATE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||ti().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}Nr();function Uo(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=Wo();e&&(process.env.NODE_EXTRA_CA_CERTS=e,B(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function Wo(){try{let e=q()?.env,t=ri(`userSettings`)?.env;B(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&B(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){B(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}G(),Nr(),Wa(),wa(),l(),Za(),aa(),ra(),Ca();var Go=!1,Ko=i(async()=>{let e=Date.now();H(`info`,`init_started`),X(`init_function_start`);try{let t=Date.now();fi(),m({loadTheme:()=>q().theme,saveTheme:e=>K(t=>({...t,theme:e}))}),H(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),X(`init_configs_enabled`);let n=Date.now();Xa();try{let{restoreActiveProvider:e}=await import(`./switcher-D2Z2ZNQ0.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)B(`[init] ${e}`)}catch(e){B(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}Uo(),H(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),X(`init_safe_env_vars_applied`),mr(),X(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-CN9UOmEC.js`).then(e=>{e.initialize1PEventLogging()}),X(`init_after_1p_event_logging`),import(`./poller-BeyVwHAf.js`).then(e=>e.startBalancePolling()),X(`init_after_balance_polling`),xa(),X(`init_after_jetbrains_detection`),Ua(),X(`init_after_remote_settings_check`),pi();let r=Date.now();B(`[init] configureGlobalMTLS starting`),ia(),H(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),B(`[init] configureGlobalMTLS complete`);let i=Date.now();if(B(`[init] configureGlobalAgents starting`),oa(),H(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),B(`[init] configureGlobalAgents complete`),X(`init_network_configured`),await no(),Ho(),Br(),Ar(tt),ht()){let e=Date.now();await Ge(),H(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-CYP26Fhg.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{B(`[init] ripgrep status check skipped`)}H(`info`,`init_completed`,{duration_ms:Date.now()-e}),X(`init_function_end`)}catch(e){if(e instanceof Er){if(he()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),yn(1);return}return import(`./InvalidConfigDialog-NiuhcaG5.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function qo(){Jo().catch(e=>{B(`[3P telemetry] Telemetry init failed: ${wr(e)}`,{level:`error`})})}async function Jo(){if(!Go){if(!c(process.env.WORKMATE_ENABLE_TELEMETRY)){Go=!0,B(`[3P telemetry] Skipped — WORKMATE_ENABLE_TELEMETRY not set`);return}Go=!0;try{await Yo()}catch(e){throw Go=!1,e}}}async function Yo(){let{initializeTelemetry:e}=await import(`./instrumentation-B9bfF2mA.js`),t=await e();t&&(Ce(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Sa(),...t};r?.add(e,n)}}}),Te()?.add(1))}ya(),Da();async function Xo(e,t,n,r){let{App:i}=await import(`./App-D--vtCyq.js`),{REPL:a}=await import(`./REPL-BgzQtSFF.js`);await r(e,(0,Q.jsx)(i,{...t,children:(0,Q.jsx)(a,{...n})}))}w(),Ei(),Mi(),Fi(),Ki(),Li(),Ui(),Vi(),Re(),Mn(),$n(),Ut(),Qi(),Ea(),Ue(),Nr(),l();var Zo=new Map;function Qo(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;Oi()===`windows`&&(e=e.split(uo.sep).join(co.sep),t=t.split(uo.sep).join(co.sep));let n=[e,t],r=[`/build-ant/`,`/build-external/`,`/build-external-native/`,`/build-ant-native/`];return n.some(e=>r.some(t=>e.includes(t)))}var $o=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function es(e){let t=`${e.name}: ${e.message}`;return $o.some(e=>e.test(t))}var ts=null;function ns(){let e=process.listeners(`warning`);ts&&e.includes(ts)||(Qo()||process.removeAllListeners(`warning`),ts=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=Zo.get(t)||0;(Zo.has(t)||Zo.size<1e3)&&Zo.set(t,n+1);let r=es(e);n+1,e.name,c(process.env.CLAUDE_DEBUG)&&B(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,ts))}Cn(),ka(),qa(),b();function rs(){return(0,Q.jsxs)(ne,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Q.jsx)(te,{url:`https://code.workmate.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}Y(),V(),b();function is({serverName:e,onDone:t}){function n(n){switch(n){case`yes`:case`yes_all`:{let r=(Qr()||{}).enabledMcpjsonServers||[];r.includes(e)||W(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&W(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(Qr()||{}).disabledMcpjsonServers||[];n.includes(e)||W(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Q.jsxs)(oe,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Q.jsx)(rs,{}),(0,Q.jsx)(Ra,{options:[{label:`Use this and all future MCP servers in this project`,value:`yes_all`},{label:`Use this MCP server`,value:`yes`},{label:`Continue without using this MCP server`,value:`no`}],onChange:e=>n(e),onCancel:()=>n(`no`)})]})}ga(),Y(),b(),V(),vn();function as({serverNames:e,onDone:t}){function n(n){let r=Qr()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=ha(e,e=>n.includes(e));o.length,s.length,o.length>0&&W(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&W(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,Ro.useCallback)(()=>{let n=(Qr()||{}).disabledMcpjsonServers||[];W(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(oe,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,Q.jsx)(rs,{}),(0,Q.jsx)(Aa,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Q.jsx)(h,{paddingX:1,children:(0,Q.jsx)(ne,{dimColor:!0,italic:!0,children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(ee,{shortcut:`Space`,action:`select`}),(0,Q.jsx)(ee,{shortcut:`Enter`,action:`confirm`}),(0,Q.jsx)(Ln,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}_r(),pr(),Fe();async function os(e){let{servers:t}=tn(`project`),n=Object.keys(t).filter(e=>Wt(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,Q.jsx)(P,{children:(0,Q.jsx)(ja,{children:(0,Q.jsx)(is,{serverName:t,onDone:r})})}))}else e.render((0,Q.jsx)(P,{children:(0,Q.jsx)(ja,{children:(0,Q.jsx)(as,{serverNames:n,onDone:r})})}))})}Rr(),Yr(),In(),Zn(),Yn(),Jn(),nt(),Tt(),Be(),yt(),Vt(),lt(),xt(),Qt(),G(),Nr();var ss={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function cs(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=ss[e.toLowerCase()];t&&q().deepLinkTerminal!==t&&(K(e=>({...e,deepLinkTerminal:t})),B(`Stored deep link terminal preference: ${t}`))}var ls=class{constructor(){p(this,`frameDurations`,[]),p(this,`firstRenderTime`,void 0),p(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};Y(),hn(),O(),b(),_r(),G(),l(),Za(),Ga(),V();function us(){K(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.26`}))}function ds(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function fs(e,t,n){return ps(e,t,{color:`error`,beforeExit:n})}async function ps(e,t,n){let{Text:r}=await import(`./src-Cy5_qH26.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Q.jsx)(r,{color:i,children:t}):(0,Q.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function $(e,t,n){return ds(e,e=>(0,Q.jsx)(re,{initialState:q().theme,onThemeSave:e=>K(t=>({...t,theme:e})),children:(0,Q.jsx)(P,{onChangeAppState:n?.onChangeAppState,children:(0,Q.jsx)(ja,{children:t(e)})})}))}async function ms(e,t){e.render(t),_c(),await e.waitUntilExit(),await Rn(0)}async function hs(e,t,n,r){if(c(!1)||process.env.IS_DEMO)return!1;let i=q(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-CkATe87e.js`);await $(e,e=>(0,Q.jsx)(t,{onDone:()=>{us(),e()}}),{onChangeAppState:Ya})}if(ba().length===0){let{ProviderSetup:t}=await import(`./ProviderSetup-J6Ty-Wj8.js`);await $(e,e=>(0,Q.jsx)(t,{onDone:e}),{onChangeAppState:Ya})}if(!c(process.env.CLAUBBIT)){if(!mi()){let{TrustDialog:t}=await import(`./TrustDialog-CZ8JpySm.js`);await $(e,e=>(0,Q.jsx)(t,{commands:r,onDone:e}))}_e(!0),bt();let{errors:t}=Ka();if(t.length===0&&await os(e),await Dn()){let t=At(await qe(!0)),{AgentsMdExternalIncludesDialog:n}=await import(`./AgentsMdExternalIncludesDialog-DuStmCjj.js`);await $(e,e=>(0,Q.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(oo(),cs(),Qa(),setImmediate(()=>qo()),(t===`bypassPermissions`||n)&&!ei()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-DyqI98d2.js`);await $(e,e=>(0,Q.jsx)(t,{onAccept:e}))}return a}function gs(e){let t=0,n=$a(e);n.stdin;let r=new ls,i=Ja();D(i);let a=process.env.WORKMATE_FRAME_TIMING_LOG;return{getFpsMetrics:()=>r.getMetrics(),stats:i,renderOptions:{...n,onFrame:e=>{if(r.record(e.durationMs),i.observe(`frame_duration_ms`,e.durationMs),a&&e.phases){let t=`${JSON.stringify({total:e.durationMs,...e.phases,rss:process.memoryUsage.rss(),cpu:process.cpuUsage()})}\n`;fo(a,t)}if(!ie())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&(n.desiredHeight,n.availableHeight,n.reason),t=e}}}}}async function _s(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-DrromC1I.js`);return $(e,e=>(0,Q.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function vs(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-Cmsbo5m7.js`),import(`./App-D--vtCyq.js`)]);await ms(e,(0,Q.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Q.jsx)(ja,{children:(0,Q.jsx)(a,{...r,worktreePaths:i})})}))}st(),Ji(),Zi(),na();var ys=5,bs=30,xs="After you finish implementing the change:\n1. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like `npm test`, `bun test`, `pytest`, `go test`). If tests fail, fix them.\n2. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.\n3. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with `gh pr create`. Use a descriptive title. If `gh` is not available or the push fails, note it in your final message.\n4. **Report** — End with a single line: `PR: <url>` so the coordinator can track it. If no PR was created, end with `PR: none — <reason>`.";function Ss(e){return`# Batch: Parallel Work Orchestration
19
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function ee(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=ee})),To=r((e=>{var{Argument:t}=bo(),{Command:n}=wo(),{CommanderError:r,InvalidArgumentError:i}=yo(),{Help:a}=xo(),{Option:o}=So();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),Eo=r(((e,t)=>{var n=To();e=t.exports={},e.program=new n.Command,e.Argument=n.Argument,e.Command=n.Command,e.CommanderError=n.CommanderError,e.Help=n.Help,e.InvalidArgumentError=n.InvalidArgumentError,e.InvalidOptionArgumentError=n.InvalidArgumentError,e.Option=n.Option,e.createCommand=e=>new n.Command(e),e.createOption=(e,t)=>new n.Option(e,t),e.createArgument=(e,t)=>new n.Argument(e,t)}));me();var{program:Do,createCommand:Oo,createArgument:ko,createOption:Ao,CommanderError:jo,InvalidArgumentError:Mo,InvalidOptionArgumentError:No,Command:Po,Argument:Fo,Option:Q,Help:Io}=n(Eo(),1).default;b();var Lo=n(v(),1),$=oe();x(),w(),Vr(),je(),_i(),xi(),Ei(),Ee(),Ti(),T(),Me(),M(),ce(),j(),ai(),K(),zn(),En(),$n(),U(),H(),Yt(),an(),Tt(),Ut(),Nt(),Sn(),Ln(),Rn(),qn();function Ro(){return!1}async function zo(){Ro()&&G(`Policy limits: skipping load — no auth available`)}l(),yi();var Bo=!1;function Vo(){if(Bo||(Bo=!0,bi())||c(process.env.WORKMATE_USE_BEDROCK)||c(process.env.WORKMATE_USE_VERTEX)||c(process.env.WORKMATE_USE_FOUNDRY)||process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.WORKMATE_CLIENT_CERT||process.env.WORKMATE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||_e().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}ti();function Ho(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=Uo();e&&(process.env.NODE_EXTRA_CA_CERTS=e,G(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function Uo(){try{let e=J()?.env,t=N(`userSettings`)?.env;G(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&G(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){G(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}K(),ti(),Va(),Ca(),l(),Xa(),ia(),na(),Sa();var Wo=!1,Go=i(async()=>{let e=Date.now();k(`info`,`init_started`),Z(`init_function_start`);try{let t=Date.now();di(),m({loadTheme:()=>J().theme,saveTheme:e=>q(t=>({...t,theme:e}))}),k(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),Z(`init_configs_enabled`);let n=Date.now();Ya();try{let{restoreActiveProvider:e}=await import(`./switcher-95d4TrQH.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)G(`[init] ${e}`)}catch(e){G(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}Ho(),k(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),Z(`init_safe_env_vars_applied`),Ir(),Z(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-CN9UOmEC.js`).then(e=>{e.initialize1PEventLogging()}),Z(`init_after_1p_event_logging`),import(`./poller-BeyVwHAf.js`).then(e=>e.startBalancePolling()),Z(`init_after_balance_polling`),ba(),Z(`init_after_jetbrains_detection`),Ba(),Z(`init_after_remote_settings_check`),fi();let r=Date.now();G(`[init] configureGlobalMTLS starting`),ra(),k(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),G(`[init] configureGlobalMTLS complete`);let i=Date.now();if(G(`[init] configureGlobalAgents starting`),aa(),k(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),G(`[init] configureGlobalAgents complete`),Z(`init_network_configured`),await to(),Vo(),pe(),Qr(vt),Pt()){let e=Date.now();await ct(),k(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-DB7KB8RZ.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{G(`[init] ripgrep status check skipped`)}k(`info`,`init_completed`,{duration_ms:Date.now()-e}),Z(`init_function_end`)}catch(e){if(e instanceof Jr){if(Pe()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),Vn(1);return}return import(`./InvalidConfigDialog-B-9Z58oD.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function Ko(){qo().catch(e=>{G(`[3P telemetry] Telemetry init failed: ${Kr(e)}`,{level:`error`})})}async function qo(){if(!Wo){if(!c(process.env.WORKMATE_ENABLE_TELEMETRY)){Wo=!0,G(`[3P telemetry] Skipped — WORKMATE_ENABLE_TELEMETRY not set`);return}Wo=!0;try{await Jo()}catch(e){throw Wo=!1,e}}}async function Jo(){let{initializeTelemetry:e}=await import(`./instrumentation-DpPmDyNF.js`),t=await e();t&&(I(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...xa(),...t};r?.add(e,n)}}}),Ge()?.add(1))}va(),Pa();async function Yo(e,t,n,r){let{App:i}=await import(`./App-DzRQpRKr.js`),{REPL:a}=await import(`./REPL-BHk0vZDf.js`);await r(e,(0,$.jsx)(i,{...t,children:(0,$.jsx)(a,{...n})}))}se(),Di(),ji(),Pi(),Gi(),Ii(),Hi(),Bi(),tt(),er(),xr(),fn(),Zi(),Ta(),ot(),ti(),l();var Xo=new Map;function Zo(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;Ci()===`windows`&&(e=e.split(lo.sep).join(so.sep),t=t.split(lo.sep).join(so.sep));let n=[e,t],r=[`/build-ant/`,`/build-external/`,`/build-external-native/`,`/build-ant-native/`];return n.some(e=>r.some(t=>e.includes(t)))}var Qo=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function $o(e){let t=`${e.name}: ${e.message}`;return Qo.some(e=>e.test(t))}var es=null;function ts(){let e=process.listeners(`warning`);es&&e.includes(es)||(Zo()||process.removeAllListeners(`warning`),es=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=Xo.get(t)||0;(Xo.has(t)||Xo.size<1e3)&&Xo.set(t,n+1);let r=$o(e);n+1,e.name,c(process.env.WORKMATE_DEBUG)&&G(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,es))}Gn(),Ga(),Ka(),x();function ns(){return(0,$.jsxs)(te,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,$.jsx)(ee,{url:`https://code.workmate.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}X(),j(),x();function rs({serverName:e,onDone:t}){function n(n){switch(n){case`yes`:case`yes_all`:{let r=(be()||{}).enabledMcpjsonServers||[];r.includes(e)||P(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&P(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(be()||{}).disabledMcpjsonServers||[];n.includes(e)||P(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,$.jsxs)(ae,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,$.jsx)(ns,{}),(0,$.jsx)(Na,{options:[{label:`Use this and all future MCP servers in this project`,value:`yes_all`},{label:`Use this MCP server`,value:`yes`},{label:`Continue without using this MCP server`,value:`no`}],onChange:e=>n(e),onCancel:()=>n(`no`)})]})}ha(),X(),x(),j(),Bn();function is({serverNames:e,onDone:t}){function n(n){let r=be()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=ma(e,e=>n.includes(e));o.length,s.length,o.length>0&&P(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&P(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,Lo.useCallback)(()=>{let n=(be()||{}).disabledMcpjsonServers||[];P(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ae,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,$.jsx)(ns,{}),(0,$.jsx)(Wa,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,$.jsx)(g,{paddingX:1,children:(0,$.jsx)(te,{dimColor:!0,italic:!0,children:(0,$.jsxs)(_,{children:[(0,$.jsx)(h,{shortcut:`Space`,action:`select`}),(0,$.jsx)(h,{shortcut:`Enter`,action:`confirm`}),(0,$.jsx)(ar,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}zr(),Fr(),V();async function as(e){let{servers:t}=wn(`project`),n=Object.keys(t).filter(e=>pn(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,$.jsx)(W,{children:(0,$.jsx)(ja,{children:(0,$.jsx)(rs,{serverName:t,onDone:r})})}))}else e.render((0,$.jsx)(W,{children:(0,$.jsx)(ja,{children:(0,$.jsx)(is,{serverNames:n,onDone:r})})}))})}E(),O(),ir(),yr(),_r(),gr(),yt(),Gt(),rt(),Rt(),un(),wt(),Bt(),xn(),K(),ti();var os={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function ss(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=os[e.toLowerCase()];t&&J().deepLinkTerminal!==t&&(q(e=>({...e,deepLinkTerminal:t})),G(`Stored deep link terminal preference: ${t}`))}var cs=class{constructor(){p(this,`frameDurations`,[]),p(this,`firstRenderTime`,void 0),p(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};X(),Ln(),F(),x(),zr(),K(),l(),Xa(),Ha(),j();function ls(){q(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.27`}))}function us(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function ds(e,t,n){return fs(e,t,{color:`error`,beforeExit:n})}async function fs(e,t,n){let{Text:r}=await import(`./src-HB5wLari.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,$.jsx)(r,{color:i,children:t}):(0,$.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function ps(e,t,n){return us(e,e=>(0,$.jsx)(ne,{initialState:J().theme,onThemeSave:e=>q(t=>({...t,theme:e})),children:(0,$.jsx)(W,{onChangeAppState:n?.onChangeAppState,children:(0,$.jsx)(ja,{children:t(e)})})}))}async function ms(e,t){e.render(t),_c(),await e.waitUntilExit(),await or(0)}async function hs(e,t,n,r){if(c(!1)||process.env.IS_DEMO)return!1;let i=J(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-BRSXxc2E.js`);await ps(e,e=>(0,$.jsx)(t,{onDone:()=>{ls(),e()}}),{onChangeAppState:Ja})}if(ya().length===0){let{ProviderSetup:t}=await import(`./ProviderSetup-BEV95bnz.js`);await ps(e,e=>(0,$.jsx)(t,{onDone:e}),{onChangeAppState:Ja})}if(!c(process.env.CLAUBBIT)){if(!pi()){let{TrustDialog:t}=await import(`./TrustDialog-BSG8Ibh8.js`);await ps(e,e=>(0,$.jsx)(t,{commands:r,onDone:e}))}Ie(!0),zt();let{errors:t}=Ua();if(t.length===0&&await as(e),await Yn()){let t=Xt(await ut(!0)),{AgentsMdExternalIncludesDialog:n}=await import(`./AgentsMdExternalIncludesDialog-CgSethgo.js`);await ps(e,e=>(0,$.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(ao(),ss(),Za(),setImmediate(()=>Ko()),(t===`bypassPermissions`||n)&&!Te()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-zz-lnmJt.js`);await ps(e,e=>(0,$.jsx)(t,{onAccept:e}))}return a}function gs(e){let t=0,n=Qa(e);n.stdin;let r=new cs,i=qa();Le(i);let a=process.env.WORKMATE_FRAME_TIMING_LOG;return{getFpsMetrics:()=>r.getMetrics(),stats:i,renderOptions:{...n,onFrame:e=>{if(r.record(e.durationMs),i.observe(`frame_duration_ms`,e.durationMs),a&&e.phases){let t=`${JSON.stringify({total:e.durationMs,...e.phases,rss:process.memoryUsage.rss(),cpu:process.cpuUsage()})}\n`;uo(a,t)}if(!re())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&(n.desiredHeight,n.availableHeight,n.reason),t=e}}}}}async function _s(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-B4EWjbp7.js`);return ps(e,e=>(0,$.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function vs(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-BuSqBrm1.js`),import(`./App-DzRQpRKr.js`)]);await ms(e,(0,$.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,$.jsx)(ja,{children:(0,$.jsx)(a,{...r,worktreePaths:i})})}))}St(),qi(),Xi(),ta();var ys=5,bs=30,xs="After you finish implementing the change:\n1. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like `npm test`, `bun test`, `pytest`, `go test`). If tests fail, fix them.\n2. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.\n3. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with `gh pr create`. Use a descriptive title. If `gh` is not available or the push fails, note it in your final message.\n4. **Report** — End with a single line: `PR: <url>` so the coordinator can track it. If no PR was created, end with `PR: none — <reason>`.";function Ss(e){return`# Batch: Parallel Work Orchestration
20
20
 
21
21
  You are orchestrating a large, parallelizable change across this codebase.
22
22
 
@@ -26,7 +26,7 @@ ${e}
26
26
 
27
27
  ## Phase 1: Research and Plan (Plan Mode)
28
28
 
29
- Call the \`${Yi}\` tool now to enter plan mode, then:
29
+ Call the \`${Ji}\` tool now to enter plan mode, then:
30
30
 
31
31
  1. **Understand the scope.** Launch one or more subagents (in the foreground — you need their results) to deeply research what this instruction touches. Find all the files, patterns, and call sites that need to change. Understand the existing conventions so the migration is consistent.
32
32
 
@@ -43,7 +43,7 @@ Call the \`${Yi}\` tool now to enter plan mode, then:
43
43
  - A dev-server + curl pattern (for API changes: start the server, hit the affected endpoints)
44
44
  - An existing e2e/integration test suite the worker can run
45
45
 
46
- If you cannot find a concrete e2e path, use the \`${ea}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
46
+ If you cannot find a concrete e2e path, use the \`${$i}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
47
47
 
48
48
  Write the recipe as a short, concrete set of steps that a worker can execute autonomously. Include any setup (start a dev server, build first) and the exact command/interaction to verify.
49
49
 
@@ -53,11 +53,11 @@ Call the \`${Yi}\` tool now to enter plan mode, then:
53
53
  - The e2e test recipe (or "skip e2e because …" if the user chose that)
54
54
  - The exact worker instructions you will give each agent (the shared template)
55
55
 
56
- 5. Call \`${Xi}\` to present the plan for approval.
56
+ 5. Call \`${Yi}\` to present the plan for approval.
57
57
 
58
58
  ## Phase 2: Spawn Workers (After Plan Approval)
59
59
 
60
- Once the plan is approved, spawn one background agent per work unit using the \`${Wr}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
60
+ Once the plan is approved, spawn one background agent per work unit using the \`${C}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
61
61
 
62
62
  For each agent, the prompt must be fully self-contained. Include:
63
63
  - The overall goal (the user's instruction)
@@ -89,19 +89,19 @@ When all agents have reported, render the final table and a one-line summary (e.
89
89
  Examples:
90
90
  /batch migrate from react to vue
91
91
  /batch replace all uses of lodash with native equivalents
92
- /batch add type annotations to all untyped function parameters`;function Ts(){vr({name:`batch`,description:`调研并规划一次大规模改动,然后并行投放到 5–30 个相互隔离的 worktree 智能体中执行,每个智能体各自开一个 PR。`,whenToUse:`当用户想对大量文件做横向的机械式改动(迁移、重构、批量改名),且这些改动可拆解为互不依赖的并行单元时使用。`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await Lr()?[{type:`text`,text:Ss(t)}]:[{type:`text`,text:Cs}]:[{type:`text`,text:ws}]}})}sa(),fa(),ca();var Es=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],Ds={Global:`Active everywhere, regardless of focus`,Chat:`When the chat input is focused`,Autocomplete:`When autocomplete menu is visible`,Confirmation:`When a confirmation/permission dialog is shown`,Help:`When the help overlay is open`,Transcript:`When viewing the transcript`,HistorySearch:`When searching command history (ctrl+r)`,Task:`When a task/agent is running in the foreground`,ThemePicker:`When the theme picker is open`,Settings:`When the settings menu is open`,Tabs:`When tab navigation is active`,Attachments:`When navigating image attachments in a select dialog`,Footer:`When footer indicators are focused`,MessageSelector:`When the message selector (rewind) is open`,DiffDialog:`When the diff dialog is open`,ModelPicker:`When the model picker is open`,Select:`When a select/list component is focused`,Plugin:`When the plugin dialog is open`},Os=`app:interrupt.app:exit.app:toggleTodos.app:toggleTranscript.app:toggleTeammatePreview.app:toggleTerminal.app:redraw.app:globalSearch.app:quickOpen.history:search.history:previous.history:next.chat:cancel.chat:killAgents.chat:cycleMode.chat:modelPicker.chat:fastMode.chat:thinkingToggle.chat:submit.chat:newline.chat:undo.chat:externalEditor.chat:stash.chat:imagePaste.chat:messageActions.autocomplete:accept.autocomplete:dismiss.autocomplete:previous.autocomplete:next.confirm:yes.confirm:no.confirm:previous.confirm:next.confirm:nextField.confirm:previousField.confirm:cycleMode.confirm:toggle.confirm:toggleExplanation.tabs:next.tabs:previous.transcript:toggleShowAll.transcript:exit.historySearch:next.historySearch:accept.historySearch:cancel.historySearch:execute.task:background.theme:toggleSyntaxHighlighting.help:dismiss.attachments:next.attachments:previous.attachments:remove.attachments:exit.footer:up.footer:down.footer:next.footer:previous.footer:openSelected.footer:clearSelection.footer:close.messageSelector:up.messageSelector:down.messageSelector:top.messageSelector:bottom.messageSelector:select.diff:dismiss.diff:previousSource.diff:nextSource.diff:back.diff:viewDetails.diff:previousFile.diff:nextFile.modelPicker:toggle1M.select:next.select:previous.select:accept.select:cancel.plugin:toggle.plugin:install.permission:toggleDebug.settings:search.settings:retry.settings:close.select:previousValue.select:nextValue`.split(`.`),ks=T(()=>x({context:me(Es).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:le(S().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),de([me(Os),S().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),ce().describe(`Set to null to unbind a default shortcut`)]).describe(`Action to trigger, command to invoke, or null to unbind`)).describe(`Map of keystroke patterns to actions`)}).describe(`A block of keybindings for a specific context`));T(()=>x({$schema:S().optional().describe(`JSON Schema URL for editor validation`),$docs:S().optional().describe(`Documentation URL`),bindings:ue(ks()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),L();function As(){return qs([`Context`,`Description`],Es.map(e=>[`\`${e}\``,Ds[e]]))}function js(){let e={};for(let t of da)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return qs([`Action`,`Default Key(s)`,`Context`],Os.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:Ms(t);return[`\`${t}\``,r,i]}))}function Ms(e){return{app:`Global`,history:`Global or Chat`,chat:`Chat`,autocomplete:`Autocomplete`,confirm:`Confirmation`,tabs:`Tabs`,transcript:`Transcript`,historySearch:`HistorySearch`,task:`Task`,theme:`ThemePicker`,help:`Help`,attachments:`Attachments`,footer:`Footer`,messageSelector:`MessageSelector`,diff:`DiffDialog`,modelPicker:`ModelPicker`,select:`Select`,permission:`Confirmation`}[e.split(`:`)[0]??``]??`Unknown`}function Ns(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of ua)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of pa)e.push(`- \`${t.key}\` — ${t.reason} (${t.severity===`error`?`will not work`:`may conflict`})`);e.push(``),e.push(`### macOS reserved (errors)`);for(let t of la)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
92
+ /batch add type annotations to all untyped function parameters`;function Ts(){Br({name:`batch`,description:`调研并规划一次大规模改动,然后并行投放到 5–30 个相互隔离的 worktree 智能体中执行,每个智能体各自开一个 PR。`,whenToUse:`当用户想对大量文件做横向的机械式改动(迁移、重构、批量改名),且这些改动可拆解为互不依赖的并行单元时使用。`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await D()?[{type:`text`,text:Ss(t)}]:[{type:`text`,text:Cs}]:[{type:`text`,text:ws}]}})}oa(),da(),sa();var Es=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],Ds={Global:`Active everywhere, regardless of focus`,Chat:`When the chat input is focused`,Autocomplete:`When autocomplete menu is visible`,Confirmation:`When a confirmation/permission dialog is shown`,Help:`When the help overlay is open`,Transcript:`When viewing the transcript`,HistorySearch:`When searching command history (ctrl+r)`,Task:`When a task/agent is running in the foreground`,ThemePicker:`When the theme picker is open`,Settings:`When the settings menu is open`,Tabs:`When tab navigation is active`,Attachments:`When navigating image attachments in a select dialog`,Footer:`When footer indicators are focused`,MessageSelector:`When the message selector (rewind) is open`,DiffDialog:`When the diff dialog is open`,ModelPicker:`When the model picker is open`,Select:`When a select/list component is focused`,Plugin:`When the plugin dialog is open`},Os=`app:interrupt.app:exit.app:toggleTodos.app:toggleTranscript.app:toggleTeammatePreview.app:toggleTerminal.app:redraw.app:globalSearch.app:quickOpen.history:search.history:previous.history:next.chat:cancel.chat:killAgents.chat:cycleMode.chat:modelPicker.chat:fastMode.chat:thinkingToggle.chat:submit.chat:newline.chat:undo.chat:externalEditor.chat:stash.chat:imagePaste.chat:messageActions.autocomplete:accept.autocomplete:dismiss.autocomplete:previous.autocomplete:next.confirm:yes.confirm:no.confirm:previous.confirm:next.confirm:nextField.confirm:previousField.confirm:cycleMode.confirm:toggle.confirm:toggleExplanation.tabs:next.tabs:previous.transcript:toggleShowAll.transcript:exit.historySearch:next.historySearch:accept.historySearch:cancel.historySearch:execute.task:background.theme:toggleSyntaxHighlighting.help:dismiss.attachments:next.attachments:previous.attachments:remove.attachments:exit.footer:up.footer:down.footer:next.footer:previous.footer:openSelected.footer:clearSelection.footer:close.messageSelector:up.messageSelector:down.messageSelector:top.messageSelector:bottom.messageSelector:select.diff:dismiss.diff:previousSource.diff:nextSource.diff:back.diff:viewDetails.diff:previousFile.diff:nextFile.modelPicker:toggle1M.select:next.select:previous.select:accept.select:cancel.plugin:toggle.plugin:install.permission:toggleDebug.settings:search.settings:retry.settings:close.select:previousValue.select:nextValue`.split(`.`),ks=xe(()=>Ae({context:he(Es).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:A(we().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),Oe([he(Os),we().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),de().describe(`Set to null to unbind a default shortcut`)]).describe(`Action to trigger, command to invoke, or null to unbind`)).describe(`Map of keystroke patterns to actions`)}).describe(`A block of keybindings for a specific context`));xe(()=>Ae({$schema:we().optional().describe(`JSON Schema URL for editor validation`),$docs:we().optional().describe(`Documentation URL`),bindings:ge(ks()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),Ut();function As(){return qs([`Context`,`Description`],Es.map(e=>[`\`${e}\``,Ds[e]]))}function js(){let e={};for(let t of ua)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return qs([`Action`,`Default Key(s)`,`Context`],Os.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:Ms(t);return[`\`${t}\``,r,i]}))}function Ms(e){return{app:`Global`,history:`Global or Chat`,chat:`Chat`,autocomplete:`Autocomplete`,confirm:`Confirmation`,tabs:`Tabs`,transcript:`Transcript`,historySearch:`HistorySearch`,task:`Task`,theme:`ThemePicker`,help:`Help`,attachments:`Attachments`,footer:`Footer`,messageSelector:`MessageSelector`,diff:`DiffDialog`,modelPicker:`ModelPicker`,select:`Select`,permission:`Confirmation`}[e.split(`:`)[0]??``]??`Unknown`}function Ns(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of la)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of fa)e.push(`- \`${t.key}\` — ${t.reason} (${t.severity===`error`?`will not work`:`may conflict`})`);e.push(``),e.push(`### macOS reserved (errors)`);for(let t of ca)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
93
93
  `)}var Ps={$schema:`https://www.schemastore.org/workmate-keybindings.json`,$docs:`https://code.workmate.com/docs/en/keybindings`,bindings:[{context:`Chat`,bindings:{"ctrl+e":`chat:externalEditor`}}]},Fs={context:`Chat`,bindings:{"ctrl+s":null}},Is={context:`Chat`,bindings:{"ctrl+g":null,"ctrl+e":`chat:externalEditor`}},Ls={context:`Global`,bindings:{"ctrl+k ctrl+t":`app:toggleTodos`}},Rs=[`# Keybindings Skill`,``,"Create or modify `~/.workmate/keybindings.json` to customize keyboard shortcuts.",``,`## CRITICAL: Read Before Write`,``,"**Always read `~/.workmate/keybindings.json` first** (it may not exist yet). Merge changes with existing bindings — never replace the entire file.",``,`- Use **Edit** tool for modifications to existing files`,`- Use **Write** tool only if the file does not exist yet`].join(`
94
- `),zs=[`## File Format`,``,"```json",Sr(Ps,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
94
+ `),zs=[`## File Format`,``,"```json",Wr(Ps,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
95
95
  `),Bs=[`## Keystroke Syntax`,``,"**Modifiers** (combine with `+`):","- `ctrl` (alias: `control`)","- `alt` (aliases: `opt`, `option`) — note: `alt` and `meta` are identical in terminals","- `shift`","- `meta` (aliases: `cmd`, `command`)",``,"**Special keys**: `escape`/`esc`, `enter`/`return`, `tab`, `space`, `backspace`, `delete`, `up`, `down`, `left`, `right`",``,"**Chords**: Space-separated keystrokes, e.g. `ctrl+k ctrl+s` (1-second timeout between keystrokes)",``,"**Examples**: `ctrl+shift+p`, `alt+enter`, `ctrl+k ctrl+n`"].join(`
96
- `),Vs=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",Sr(Fs,null,2),"```"].join(`
96
+ `),Vs=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",Wr(Fs,null,2),"```"].join(`
97
97
  `),Hs=[`## How User Bindings Interact with Defaults`,``,`- User bindings are **additive** — they are appended after the default bindings`,"- To **move** a binding to a different key: unbind the old key (`null`) AND add the new binding",`- A context only needs to appear in the user's file if they want to change something in that context`].join(`
98
- `),Us=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",Sr(Is,null,2),"```",``,`### Add a chord binding`,"```json",Sr(Ls,null,2),"```"].join(`
98
+ `),Us=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",Wr(Is,null,2),"```",``,`### Add a chord binding`,"```json",Wr(Ls,null,2),"```"].join(`
99
99
  `),Ws=[`## Behavioral Rules`,``,`1. Only include contexts the user wants to change (minimal overrides)`,`2. Validate that actions and contexts are from the known lists below`,"3. Warn the user proactively if they choose a key that conflicts with reserved shortcuts or common tools like tmux (`ctrl+b`) and screen (`ctrl+a`)",`4. When adding a new binding for an existing action, the new binding is additive (existing default still works unless explicitly unbound)`,`5. To fully replace a default binding, unbind the old key AND add the new one`].join(`
100
100
  `),Gs=[`## Validation with /doctor`,``,'The `/doctor` command includes a "Keybinding Configuration Issues" section that validates `~/.workmate/keybindings.json`.',``,`### Common Issues and Fixes`,``,qs([`Issue`,`Cause`,`Fix`],[['`keybindings.json must have a "bindings" array`',`Missing wrapper object`,'Wrap bindings in `{ "bindings": [...] }`'],['`"bindings" must be an array`',"`bindings` is not an array",'Set `"bindings"` to an array: `[{ context: ..., bindings: ... }]`'],['`Unknown context "X"`',`Typo or invalid context name`,`Use exact context names from the Available Contexts table`],['`Duplicate key "X" in Y bindings`',`Same key defined twice in one context`,`Remove the duplicate; JSON uses only the last value`],['`"X" may not work: ...`',`Key conflicts with terminal/OS reserved shortcut`,`Choose a different key (see Reserved Shortcuts section)`],['`Could not parse keystroke "X"`',`Invalid key syntax`,"Check syntax: use `+` between modifiers, valid key names"],['`Invalid action for "X"`',`Action value is not a string or null`,'Actions must be strings like `"app:help"` or `null` to unbind']]),``,`### Example /doctor Output`,``,"```",`Keybinding Configuration Issues`,`Location: ~/.workmate/keybindings.json`,` └ [Error] Unknown context "chat"`,` → Valid contexts: Global, Chat, Autocomplete, ...`,` └ [Warning] "ctrl+c" may not work: Terminal interrupt (SIGINT)`,"```",``,`**Errors** prevent bindings from working and must be fixed. **Warnings** indicate potential conflicts but the binding may still work.`].join(`
101
- `);function Ks(){vr({name:`keybindings-help`,description:`当用户想自定义键盘快捷键、重新绑定按键、添加组合键(chord),或修改 ~/.workmate/keybindings.json 时使用。例如:"rebind ctrl+s"、"add a chord shortcut"、"change the submit key"、"customize keybindings"。`,allowedTools:[`Read`],userInvocable:!1,isEnabled:ma,async getPromptForCommand(e){let t=As(),n=js(),r=[Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,`## Reserved Shortcuts\n\n${Ns()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
101
+ `);function Ks(){Br({name:`keybindings-help`,description:`当用户想自定义键盘快捷键、重新绑定按键、添加组合键(chord),或修改 ~/.workmate/keybindings.json 时使用。例如:"rebind ctrl+s"、"add a chord shortcut"、"change the submit key"、"customize keybindings"。`,allowedTools:[`Read`],userInvocable:!1,isEnabled:pa,async getPromptForCommand(e){let t=As(),n=js(),r=[Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,`## Reserved Shortcuts\n\n${Ns()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
102
102
 
103
103
  `)}]}})}function qs(e,t){let n=e.map(()=>`---`);return[`| ${e.join(` | `)} |`,`| ${n.join(` | `)} |`,...t.map(e=>`| ${e.join(` | `)} |`)].join(`
104
- `)}L();var Js=`# /ultracode — Workflow Orchestration Playbook
104
+ `)}Ut();var Js=`# /ultracode — Workflow Orchestration Playbook
105
105
 
106
106
  Execute a workflow script that orchestrates multiple subagents deterministically. Workflows run in the background — this tool returns immediately with a task ID, and a \`<task-notification>\` arrives when the workflow completes.
107
107
 
@@ -146,7 +146,7 @@ export const meta = {
146
146
  { title: 'Fix', detail: 'one agent per flaky test' },
147
147
  ],
148
148
  }
149
- // script body starts here use agent()/parallel()/pipeline()/phase()/log()
149
+ // 脚本主体从此开始 agent()/parallel()/pipeline()/phase()/log()
150
150
  phase('Scan')
151
151
  const flaky = await agent('grep CI logs for retry markers', {schema: FLAKY_SCHEMA})
152
152
  ...
@@ -225,7 +225,7 @@ const results = await pipeline(
225
225
  )
226
226
  const confirmed = results.flat().filter(Boolean).filter(f => f.verdict?.isReal)
227
227
  return { confirmed }
228
- // Dimension 'bugs' findings verify while dimension 'perf' is still reviewing. No wasted wall-clock.
228
+ // 'bugs' 维度的 finding 在验证时 'perf' 维度仍在审查。不浪费 wall-clock
229
229
  \`\`\`
230
230
 
231
231
  When a barrier IS correct — dedup across all findings before expensive verification:
@@ -276,7 +276,7 @@ while (dry < 2) { // loop-until-dry
276
276
  confirmed.push(...judged.filter(v => v.real).map(v => v.b))
277
277
  }
278
278
  return confirmed
279
- // dedup vs \`seen\`, NOT \`confirmed\` — else judge-rejected findings reappear every round and it never converges.
279
+ // \`seen\` 去重,而非 \`confirmed\` — 否则被 judge 拒绝的 finding 每轮重现,永不收敛。
280
280
  \`\`\`
281
281
 
282
282
  Quality patterns — common shapes; pick by task and compose freely:
@@ -305,11 +305,11 @@ Use this tool for multi-step orchestration where control flow should be determin
305
305
  ## Resume
306
306
 
307
307
  The tool result includes a runId. To resume after a pause, kill, or script edit, relaunch with \`Workflow({scriptPath, resumeFromRunId})\` — the longest unchanged prefix of agent() calls returns cached results instantly; the first edited/new call and everything after it runs live. Same script + same args → 100% cache hit. Date.now()/Math.random()/new Date() are unavailable in scripts (they would break this) — stamp results after the workflow returns, or pass timestamps via args. Fallback when no journal is available: Read agent-<id>.jsonl files in the transcript directory and hand-author a continuation script.
308
- `;function Ys(){vr({name:`ultracode`,description:`进入多智能体 workflow 编排模式:何时使用 Workflow 工具、脚本原语、质量模式、确定性约束、resume/预算、以及文件和命令。`,whenToUse:`当任务可拆解或可并行、需要多视角置信度(如先查找再对抗式验证)、超出单一上下文容量(大迁移、广审计、长尾枚举)或需要可恢复/可审计时——用 Workflow 工具编排多个子智能体。`,userInvocable:!0,async getPromptForCommand(e){let t=Js;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}L();function Xs(){vr({name:`loop`,description:`在固定时间间隔循环运行某条 prompt 或 slash command(例如 /loop 5m /foo,默认 10m)`,whenToUse:`当用户想设置一个周期性任务、轮询状态,或按固定间隔重复运行某个内容时使用(例如"每 5 分钟检查一次部署状态"、"持续运行 /babysit-prs")。一次性任务不要用本命令。`,argumentHint:`[interval] <prompt>`,userInvocable:!1,isEnabled:()=>!1,async getPromptForCommand(){return[{type:`text`,text:`The /loop command is no longer available.`}]}})}Un(),ft(),O(),L();var Zs=`# Dream: Memory Consolidation (manual run)
308
+ `;function Ys(){Br({name:`ultracode`,description:`进入多智能体 workflow 编排模式:何时使用 Workflow 工具、脚本原语、质量模式、确定性约束、resume/预算、以及文件和命令。`,whenToUse:`当任务可拆解或可并行、需要多视角置信度(如先查找再对抗式验证)、超出单一上下文容量(大迁移、广审计、长尾枚举)或需要可恢复/可审计时——用 Workflow 工具编排多个子智能体。`,userInvocable:!0,async getPromptForCommand(e){let t=Js;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}Ut();function Xs(){Br({name:`loop`,description:`在固定时间间隔循环运行某条 prompt 或 slash command(例如 /loop 5m /foo,默认 10m)`,whenToUse:`当用户想设置一个周期性任务、轮询状态,或按固定间隔重复运行某个内容时使用(例如"每 5 分钟检查一次部署状态"、"持续运行 /babysit-prs")。一次性任务不要用本命令。`,argumentHint:`[interval] <prompt>`,userInvocable:!1,isEnabled:()=>!1,async getPromptForCommand(){return[{type:`text`,text:`The /loop command is no longer available.`}]}})}dr(),kt(),F(),Ut();var Zs=`# Dream: Memory Consolidation (manual run)
309
309
 
310
310
  You are performing a manual dream — a reflective pass over your memory files. Unlike the automatic background dream, this run has full tool permissions and the user is watching. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
311
311
 
312
- `;function Qs(){vr({name:`dream`,description:`手动触发记忆整合——回顾、整理并修剪自动记忆文件。`,whenToUse:`当用户输入 /dream 或想手动整合记忆、整理记忆文件、清理过期条目时使用。`,userInvocable:!0,isEnabled:()=>si(),async getPromptForCommand(e){let t=li(),n=Yt(Oe());await N();let r=Zs+Kt(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}function $s(){Ks(),Ts(),Ys(),Xs(),Qs()}Hn();async function ec(){if(!await Ci(`gh`))return`not_installed`;let{exitCode:e}=await yi(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}_a(),lr(),F(),Zt(),_t(),Y(),wn();async function tc(e,t){let n=await An(e);un(t);for(let e of n)e.type===`prompt`&&(e.name,e.source,e.loadedFrom,{...e.kind&&{skill_kind:e.kind}})}Va(),Y(),pr(),Fe(),l(),Ir();function nc(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
312
+ `;function Qs(){Br({name:`dream`,description:`手动触发记忆整合——回顾、整理并修剪自动记忆文件。`,whenToUse:`当用户输入 /dream 或想手动整合记忆、整理记忆文件、清理过期条目时使用。`,userInvocable:!0,isEnabled:()=>oi(),async getPromptForCommand(e){let t=ci(),n=vn(qe());await Et();let r=Zs+hn(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}function $s(){Ks(),Ts(),Ys(),Xs(),Qs()}ur();async function ec(){if(!await Si(`gh`))return`not_installed`;let{exitCode:e}=await vi(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}ga(),jr(),jt(),bn(),It(),X(),Kn();async function tc(e,t){let n=await Qn(e);Mn(t);for(let e of n)e.type===`prompt`&&(e.name,e.source,e.loadedFrom,{...e.kind&&{skill_kind:e.kind}})}Ra(),X(),Fr(),V(),l(),ii();function nc(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
313
313
 
314
314
  Examples:
315
315
  # Add HTTP server:
@@ -322,24 +322,24 @@ Examples:
322
322
  claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
323
323
 
324
324
  # Add stdio server with subprocess flags:
325
- claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).helpOption(`-h, --help`,`Display help for command`).action(async(e,t,n,r)=>{let i=t,a=n;e?i||Na(`Error: Command is required when server name is provided.
326
- Usage: claude mcp add <name> <command> [args...]`):Na(`Error: Server name is required.
327
- Usage: claude mcp add <name> <command> [args...]`);try{let t=rt(r.scope),n=jt(r.transport),o=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(n===`sse`){i||Na(`Error: URL is required for SSE transport.`);let n=r.header?ur(r.header):void 0;await Vn(e,{type:`sse`,url:i,headers:n},t),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Sr(n,null,2)}\n`)}else if(n===`http`){i||Na(`Error: URL is required for HTTP transport.`);let n=r.header?ur(r.header):void 0;await Vn(e,{type:`http`,url:i,headers:n},t),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Sr(n,null,2)}\n`)}else!o&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await Vn(e,{type:`stdio`,command:i,args:a,env:s(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);Ma(`File modified: ${Pt(t)}`)}catch(e){Na(e.message)}})}Ie(),ln();function rc(e,t=process.argv){for(let n=0;n<t.length;n++){let r=t[n];if(r?.startsWith(`${e}=`))return r.slice(e.length+1);if(r===e&&n+1<t.length)return t[n+1]}}Fn(),Y(),G(),V();function ic(){if(q().bypassPermissionsModeAccepted)try{ei()||W(`userSettings`,{skipDangerousModePermissionPrompt:!0}),K(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){J(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}Y(),G(),Si(),V();function ac(){let e=ci(),t=e.enableAllProjectMcpServers!==void 0,n=e.enabledMcpjsonServers&&e.enabledMcpjsonServers.length>0,r=e.disabledMcpjsonServers&&e.disabledMcpjsonServers.length>0;if(!(!t&&!n&&!r))try{let i=ri(`localSettings`)||{},a={},o=[];if(t&&i.enableAllProjectMcpServers===void 0?(a.enableAllProjectMcpServers=e.enableAllProjectMcpServers,o.push(`enableAllProjectMcpServers`)):t&&o.push(`enableAllProjectMcpServers`),n&&e.enabledMcpjsonServers){let t=i.enabledMcpjsonServers||[];a.enabledMcpjsonServers=[...new Set([...t,...e.enabledMcpjsonServers])],o.push(`enabledMcpjsonServers`)}if(r&&e.disabledMcpjsonServers){let t=i.disabledMcpjsonServers||[];a.disabledMcpjsonServers=[...new Set([...t,...e.disabledMcpjsonServers])],o.push(`disabledMcpjsonServers`)}Object.keys(a).length>0&&W(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&di(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),o.length}catch(e){J(e)}}Y(),G(),V();function oc(){if(Pi()!==`firstParty`||!Wi())return;let e=ri(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(W(`userSettings`,{model:`opus`}),K(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})))}Y(),Vi();function sc(){Hi()}O(),G(),V();function cc(){q().sonnet1m45MigrationComplete||(ri(`userSettings`)?.model===`sonnet[1m]`&&W(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),k()===`sonnet[1m]`&&Me(`sonnet-4-5-20250929[1m]`),K(e=>({...e,sonnet1m45MigrationComplete:!0})))}G();function lc(){q().opusProMigrationComplete||K(e=>({...e,opusProMigrationComplete:!0}))}Ai(),at(),G(),Za(),Di(),Ir(),Y(),O(),I(),b(),Fa(),l(),qr(),Si(),Vi(),gn(),V(),pr(),xr(),Nr(),Cr(),hn(),it(),Gr(),rr(),Dt(),X(`main_tsx_entry`),Vr(),vo(),X(`main_tsx_imports_loaded`);function uc(){try{let e=ri(`policySettings`);if(e){let t=ni(e);t.length,t.join(`,`)}}catch{}}function dc(){let e=qi(Ee()??Gi());tc(br(),Bi(e,Ae())),ot().then(({enabled:e,errors:t})=>{let n=Xn();or(e,n,sr()),Kn(t,n)}).catch(e=>J(e))}function fc(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.WORKMATE_CLIENT_CERT&&(e.has_client_cert=!0),o(`--use-system-ca`)&&(e.has_use_system_ca=!0),o(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function pc(){if(Xt())return;let[e,t,n]=await Promise.all([Lr(),Kr(),ec()]);Gt.isSandboxingEnabled(),Gt.areUnsandboxedCommandsAllowed(),Gt.isAutoAllowBashIfSandboxedEnabled(),ui(),U().prefersReducedMotion,{...fc()}}var mc=11;function hc(){q().migrationVersion!==mc&&(ic(),ac(),lc(),cc(),oc(),sc(),K(e=>e.migrationVersion===mc?e:{...e,migrationVersion:mc}))}function gc(){if(he()){H(`info`,`prefetch_system_context_non_interactive`),bt();return}mi()?(H(`info`,`prefetch_system_context_has_trust`),bt()):H(`info`,`prefetch_system_context_skipped_no_trust`)}function _c(){c(process.env.WORKMATE_EXIT_AFTER_FIRST_RENDER)||u()||(Qe(),gc(),ro(),va(br(),AbortSignal.timeout(3e3),[]),Ri(),fr.initialize(),u()||Ba.initialize())}function vc(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)pe(t)||(process.stderr.write(v.red(`Error: Invalid JSON provided to --settings
328
- `)),process.exit(1)),r=Ha(`claude-settings`,`.json`,{contentHash:t}),kr(r,t,`utf8`);else{let{resolvedPath:t}=Mr(Fr(),e);try{po(t,`utf8`)}catch(e){throw Dr(e)&&(process.stderr.write(v.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}j(r),E()}catch(e){e instanceof Error&&J(e),process.stderr.write(v.red(`Error processing settings: ${wr(e)}\n`)),process.exit(1)}}function yc(e){try{xe(ii(e)),E()}catch(e){e instanceof Error&&J(e),process.stderr.write(v.red(`Error processing --setting-sources: ${wr(e)}\n`)),process.exit(1)}}function bc(){X(`eagerLoadSettings_start`);let e=rc(`--settings`);e&&vc(e);let t=rc(`--setting-sources`);t!==void 0&&yc(t),X(`eagerLoadSettings_end`)}function xc(e){if(process.env.WORKMATE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.WORKMATE_ENTRYPOINT=`mcp`;return}if(c(process.env.WORKMATE_ACTION)){process.env.WORKMATE_ENTRYPOINT=`workmate-github-action`;return}process.env.WORKMATE_ENTRYPOINT=e?`sdk-cli`:`cli`}async function Sc(){X(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,ns(),process.on(`exit`,()=>{Dc();try{let{peekWorkflowService:t}=(Ve(),e(Nt));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),X(`main_warning_handler_initialized`);{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-DtmqWusU.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-BQSLVGnG.js`),i=await r(n);process.exit(i)}if(process.platform===`darwin`&&process.env.__CFBundleIdentifier===`com.workmate.url-handler`){let{enableConfigs:e}=await import(`./config-DtmqWusU.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-BQSLVGnG.js`),n=await t();process.exit(n??1)}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=c(process.env.WORKMATE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&io(),De(!o),xc(o);let s=c(process.env.GITHUB_ACTIONS)?`github-action`:process.env.WORKMATE_ENTRYPOINT===`sdk-ts`?`sdk-typescript`:process.env.WORKMATE_ENTRYPOINT===`sdk-py`?`sdk-python`:process.env.WORKMATE_ENTRYPOINT===`sdk-cli`?`sdk-cli`:process.env.WORKMATE_ENTRYPOINT===`claude-vscode`?`claude-vscode`:process.env.WORKMATE_ENTRYPOINT===`local-agent`?`local-agent`:process.env.WORKMATE_ENTRYPOINT===`claude-desktop`?`claude-desktop`:`cli`;Se(s);let l=process.env.WORKMATE_QUESTION_PREVIEW_FORMAT;l===`markdown`||l===`html`?A(l):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&A(`markdown`),X(`main_client_type_determined`),bc(),X(`main_before_run`),await wc(),X(`main_after_run`)}async function Cc(e,t){if(!process.stdin.isTTY&&!process.argv.includes(`mcp`)){if(t===`stream-json`)return process.stdin;process.stdin.setEncoding(`utf8`);let n=``,r=e=>{n+=e};process.stdin.on(`data`,r);let i=await _i(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
325
+ claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).helpOption(`-h, --help`,`Display help for command`).action(async(e,t,n,r)=>{let i=t,a=n;e?i||Da(`Error: Command is required when server name is provided.
326
+ Usage: claude mcp add <name> <command> [args...]`):Da(`Error: Server name is required.
327
+ Usage: claude mcp add <name> <command> [args...]`);try{let t=bt(r.scope),n=Zt(r.transport),o=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(n===`sse`){i||Da(`Error: URL is required for SSE transport.`);let n=r.header?Mr(r.header):void 0;await lr(e,{type:`sse`,url:i,headers:n},t),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Wr(n,null,2)}\n`)}else if(n===`http`){i||Da(`Error: URL is required for HTTP transport.`);let n=r.header?Mr(r.header):void 0;await lr(e,{type:`http`,url:i,headers:n},t),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Wr(n,null,2)}\n`)}else!o&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await lr(e,{type:`stdio`,command:i,args:a,env:s(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);Ea(`File modified: ${en(t)}`)}catch(e){Da(e.message)}})}$e(),jn();function rc(e,t=process.argv){for(let n=0;n<t.length;n++){let r=t[n];if(r?.startsWith(`${e}=`))return r.slice(e.length+1);if(r===e&&n+1<t.length)return t[n+1]}}rr(),X(),K(),j();function ic(){if(J().bypassPermissionsModeAccepted)try{Te()||P(`userSettings`,{skipDangerousModePermissionPrompt:!0}),q(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){Y(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}X(),K(),xi(),j();function ac(){let e=si(),t=e.enableAllProjectMcpServers!==void 0,n=e.enabledMcpjsonServers&&e.enabledMcpjsonServers.length>0,r=e.disabledMcpjsonServers&&e.disabledMcpjsonServers.length>0;if(!(!t&&!n&&!r))try{let i=N(`localSettings`)||{},a={},o=[];if(t&&i.enableAllProjectMcpServers===void 0?(a.enableAllProjectMcpServers=e.enableAllProjectMcpServers,o.push(`enableAllProjectMcpServers`)):t&&o.push(`enableAllProjectMcpServers`),n&&e.enabledMcpjsonServers){let t=i.enabledMcpjsonServers||[];a.enabledMcpjsonServers=[...new Set([...t,...e.enabledMcpjsonServers])],o.push(`enabledMcpjsonServers`)}if(r&&e.disabledMcpjsonServers){let t=i.disabledMcpjsonServers||[];a.disabledMcpjsonServers=[...new Set([...t,...e.disabledMcpjsonServers])],o.push(`disabledMcpjsonServers`)}Object.keys(a).length>0&&P(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&ui(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),o.length}catch(e){Y(e)}}X(),K(),j();function oc(){if(Ni()!==`firstParty`||!Ui())return;let e=N(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(P(`userSettings`,{model:`opus`}),q(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})))}X(),Bi();function sc(){Vi()}F(),K(),j();function cc(){J().sonnet1m45MigrationComplete||(N(`userSettings`)?.model===`sonnet[1m]`&&P(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),Ve()===`sonnet[1m]`&&Xe(`sonnet-4-5-20250929[1m]`),q(e=>({...e,sonnet1m45MigrationComplete:!0})))}K();function lc(){J().opusProMigrationComplete||q(e=>({...e,opusProMigrationComplete:!0}))}ki(),U(),K(),Xa(),Ti(),ii(),X(),F(),Nt(),x(),ka(),l(),Ee(),xi(),Bi(),Rn(),j(),Fr(),Ur(),ti(),Gr(),Ln(),H(),je(),Tr(),qt(),Z(`main_tsx_entry`),le(),_o(),Z(`main_tsx_imports_loaded`);function uc(){try{let e=N(`policySettings`);if(e){let t=De(e);t.length,t.join(`,`)}}catch{}}function dc(){let e=Ki(Ke()??Wi());tc(Hr(),zi(e,B())),xt().then(({enabled:e,errors:t})=>{let n=vr();Or(e,n,kr()),mr(t,n)}).catch(e=>Y(e))}function fc(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.WORKMATE_CLIENT_CERT&&(e.has_client_cert=!0),o(`--use-system-ca`)&&(e.has_use_system_ca=!0),o(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function pc(){if(yn())return;let[e,t,n]=await Promise.all([D(),ue(),ec()]);mn.isSandboxingEnabled(),mn.areUnsandboxedCommandsAllowed(),mn.isAutoAllowBashIfSandboxedEnabled(),li(),ke().prefersReducedMotion,{...fc()}}var mc=11;function hc(){J().migrationVersion!==mc&&(ic(),ac(),lc(),cc(),oc(),sc(),q(e=>e.migrationVersion===mc?e:{...e,migrationVersion:mc}))}function gc(){if(Pe()){k(`info`,`prefetch_system_context_non_interactive`),zt();return}pi()?(k(`info`,`prefetch_system_context_has_trust`),zt()):k(`info`,`prefetch_system_context_skipped_no_trust`)}function _c(){c(process.env.WORKMATE_EXIT_AFTER_FIRST_RENDER)||u()||(ht(),gc(),no(),_a(Hr(),AbortSignal.timeout(3e3),[]),Li(),Pr.initialize(),u()||La.initialize())}function vc(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)ye(t)||(process.stderr.write(y.red(`Error: Invalid JSON provided to --settings
328
+ `)),process.exit(1)),r=za(`claude-settings`,`.json`,{contentHash:t}),Zr(r,t,`utf8`);else{let{resolvedPath:t}=ei(ri(),e);try{fo(t,`utf8`)}catch(e){throw Yr(e)&&(process.stderr.write(y.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}z(r),Ne()}catch(e){e instanceof Error&&Y(e),process.stderr.write(y.red(`Error processing settings: ${Kr(e)}\n`)),process.exit(1)}}function yc(e){try{He(Se(e)),Ne()}catch(e){e instanceof Error&&Y(e),process.stderr.write(y.red(`Error processing --setting-sources: ${Kr(e)}\n`)),process.exit(1)}}function bc(){Z(`eagerLoadSettings_start`);let e=rc(`--settings`);e&&vc(e);let t=rc(`--setting-sources`);t!==void 0&&yc(t),Z(`eagerLoadSettings_end`)}function xc(e){if(process.env.WORKMATE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.WORKMATE_ENTRYPOINT=`mcp`;return}if(c(process.env.WORKMATE_ACTION)){process.env.WORKMATE_ENTRYPOINT=`workmate-github-action`;return}process.env.WORKMATE_ENTRYPOINT=e?`sdk-cli`:`cli`}async function Sc(){Z(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,ts(),process.on(`exit`,()=>{Dc();try{let{peekWorkflowService:t}=(it(),e($t));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),Z(`main_warning_handler_initialized`);{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-Bm5pVdCq.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-VigBkAQQ.js`),i=await r(n);process.exit(i)}if(process.platform===`darwin`&&process.env.__CFBundleIdentifier===`com.workmate.url-handler`){let{enableConfigs:e}=await import(`./config-Bm5pVdCq.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-VigBkAQQ.js`),n=await t();process.exit(n??1)}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=c(process.env.WORKMATE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&ro(),R(!o),xc(o);let s=c(process.env.GITHUB_ACTIONS)?`github-action`:process.env.WORKMATE_ENTRYPOINT===`sdk-ts`?`sdk-typescript`:process.env.WORKMATE_ENTRYPOINT===`sdk-py`?`sdk-python`:process.env.WORKMATE_ENTRYPOINT===`sdk-cli`?`sdk-cli`:process.env.WORKMATE_ENTRYPOINT===`claude-vscode`?`claude-vscode`:process.env.WORKMATE_ENTRYPOINT===`local-agent`?`local-agent`:process.env.WORKMATE_ENTRYPOINT===`claude-desktop`?`claude-desktop`:`cli`;Ue(s);let l=process.env.WORKMATE_QUESTION_PREVIEW_FORMAT;l===`markdown`||l===`html`?L(l):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&L(`markdown`),Z(`main_client_type_determined`),bc(),Z(`main_before_run`),await wc(),Z(`main_after_run`)}async function Cc(e,t){if(!process.stdin.isTTY&&!process.argv.includes(`mcp`)){if(t===`stream-json`)return process.stdin;process.stdin.setEncoding(`utf8`);let n=``,r=e=>{n+=e};process.stdin.on(`data`,r);let i=await gi(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
329
329
  `),[e,n].filter(Boolean).join(`
330
- `)}return e}async function wc(){X(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new Fo().configureHelp(e()).enablePositionalOptions();X(`run_commander_initialized`),t.hook(`preAction`,async e=>{X(`preAction_start`),await Promise.all([Xr(),yo()]),X(`preAction_after_mdm`),await Ko(),X(`preAction_after_init`),c(process.env.WORKMATE_DISABLE_TERMINAL_TITLE)||(process.title=`workMate`);let{initSinks:t}=await import(`./sinks-DB_D4lmu.js`);t(),X(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(we(n),ze(`preAction: --plugin-dir inline plugins`)),hc(),X(`preAction_after_migrations`),Bo(),X(`preAction_after_policy_limits`)}),t.name(`wm`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new Z(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Work Mate is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and AGENTS.md auto-discovery. Sets WORKMATE_SIMPLE=1. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (AGENTS.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new Z(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new Z(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new Z(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new Z(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new Z(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new Z(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new Z(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new Z(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new Z(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new Z(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new Z(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new Z(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new Z(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new Z(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new Z(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new Z(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new Z(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(Jr)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new Z(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new Z(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new Z(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new Z(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new Z(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new Z(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new Z(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--strict-mcp-config`,`Only use MCP servers from --mcp-config, ignoring all other MCP configurations`,()=>!0).option(`--session-id <uuid>`,`Use a specific session ID for the conversation (must be a valid UUID)`).option(`-n, --name <name>`,`Set a display name for this session (shown in /resume and terminal title)`).option(`--agents <json>`,`JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).option(`--plugin-dir <path>`,`Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)`,(e,t)=>[...t,e],[]).option(`--disable-slash-commands`,`Disable all skills`,()=>!0).option(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{X(`action_handler_start`),t.bare&&(process.env.WORKMATE_SIMPLE=`1`),e===`code`&&(console.warn(v.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&e.length;let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:l=[],mcpConfig:d=[],permissionMode:f,addDir:p=[],fallbackModel:m,betas:ee=[],sessionId:h,includeHookEvents:te,includePartialMessages:ne}=t;t.prefill&&ao(t.prefill);let re=t.agents,g=t.agent;g&&(process.env.WORKMATE_AGENT=g);let _=t.outputFormat,y=t.inputFormat,ie=t.verbose??q().verbose,b=t.print,ae=t.init??!1,oe=t.initOnly??!1,se=t.maintenance??!1,ce=t.disableSlashCommands||!1,le=Ta()?t.worktree:void 0,ue=typeof le==`string`?le:void 0,x=le!==void 0,S;if(ue){let e=Ze(ue);e!==null&&(S=e,ue=void 0)}let de=Ta()&&t.tmux===!0;de&&(x||(process.stderr.write(v.red(`Error: --tmux requires --worktree
331
- `)),process.exit(1)),Oi()===`windows`&&(process.stderr.write(v.red(`Error: --tmux is not supported on Windows
332
- `)),process.exit(1)),await He()||(process.stderr.write(v.red(`Error: tmux is not installed.\n${en()}\n`)),process.exit(1)));let fe=t.sdkUrl??void 0,me=ne||c(process.env.WORKMATE_INCLUDE_PARTIAL_MESSAGES);if(te&&on(!0),fe&&(y||(y=`stream-json`),_||(_=`stream-json`),t.verbose===void 0&&(ie=!0),t.print||(b=!0)),h&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(v.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
333
- `)),process.exit(1)),!fe)){let e=Ye(h);e||(process.stderr.write(v.red(`Error: Invalid session ID. Must be a valid UUID.
334
- `)),process.exit(1)),ar(e)&&(process.stderr.write(v.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let C=he();m&&t.model&&m===t.model&&(process.stderr.write(v.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
335
- `)),process.exit(1));let w=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(v.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
336
- `)),process.exit(1));try{w=po(lo(t.systemPromptFile),`utf8`)}catch(e){Tr(e)===`ENOENT`&&(process.stderr.write(v.red(`Error: System prompt file not found: ${lo(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(v.red(`Error reading system prompt file: ${wr(e)}\n`)),process.exit(1)}}let T=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(v.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
337
- `)),process.exit(1));try{T=po(lo(t.appendSystemPromptFile),`utf8`)}catch(e){Tr(e)===`ENOENT`&&(process.stderr.write(v.red(`Error: Append system prompt file not found: ${lo(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(v.red(`Error reading append system prompt file: ${wr(e)}\n`)),process.exit(1)}}let{mode:E,notification:_e}=hr({permissionModeCli:f,dangerouslySkipPermissions:i});ye(E===`bypassPermissions`),(t.enableAutoMode||f===`auto`||E===`auto`||!f&&Ot())&&Rt(!0);let D={};if(d&&d.length>0){let e=d.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=pe(r);if(a){let t=pn({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=qn({filePath:lo(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?`${e.path}: `:``}${e.message}`).join(`
338
- `);B(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=qt(mn(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${ji(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),D={...D,...e}}}let O=t.strictMcpConfig||!1;xn()&&(O&&(process.stderr.write(v.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),D&&!tr(D)&&(process.stderr.write(v.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),ke(p);let be=await Et({allowedToolsCli:s,disallowedToolsCli:l,baseToolsCli:o,permissionMode:E,allowDangerouslySkipPermissions:a,addDirs:p}),k=be.toolPermissionContext,{warnings:xe,dangerousPermissions:Se}=be;Se.length>0&&(k=On(k)),xe.forEach(e=>{console.error(e)}),B(`[STARTUP] Loading MCP configs...`);let Ce=Date.now(),we,Te=(O||u()?Promise.resolve({servers:{}}):Nn(D)).then(e=>(we=Date.now()-Ce,e));y&&y!==`text`&&y!==`stream-json`&&(console.error(`Error: Invalid input format "${y}".`),process.exit(1)),y===`stream-json`&&_!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),fe&&(y!==`stream-json`||_!==`stream-json`)&&(console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),t.replayUserMessages&&(y!==`stream-json`||_!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),me&&(!C||_!==`stream-json`)&&(hi(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!C&&(hi(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let A=await Cc(e||``,y??`text`);X(`action_after_input_prompt`),Ec(t);let De=Je(k);X(`action_tools_loaded`);let j;if(ta({isNonInteractiveSession:C})&&t.jsonSchema&&(j=Or(t.jsonSchema)),j){let e=$i(j);`tool`in e&&(De=[...De,e.tool],Object.keys(j.properties||{}).length,j.required)}X(`action_before_setup`),B(`[STARTUP] Running setup()...`);let Ae=Date.now(),{setup:Fe}=await import(`./setup-BBvZyrfz.js`),Ie=br();process.env.WORKMATE_ENTRYPOINT!==`local-agent`&&$s();let Re=Fe(Ie,E,a,x,ue,de,h?Ye(h):void 0,S),ze=x?null:We(Ie),Be=x?null:bn(Ie);ze?.catch(()=>{}),Be?.catch(()=>{}),await Re,B(`[STARTUP] setup() completed in ${Date.now()-Ae}ms`),X(`action_after_setup`);let Ve=!!t.replayUserMessages;he()&&(Qa(),bt(),Qe(),Ni());let Ue=t.name?.trim();Ue&&wt(Ue);let Ge=t.model==="default"?Gi():t.model,qe=m==="default"?Gi():m,tt=x?br():Ie;B(`[STARTUP] Loading commands and agents...`);let nt=Date.now(),[rt,it]=await Promise.all([ze??We(tt),Be??bn(tt)]);B(`[STARTUP] Commands and agents loaded in ${Date.now()-nt}ms`),X(`action_commands_loaded`);let at=[];if(re)try{let e=pe(re);e&&(at=dn(e,`flagSettings`))}catch(e){J(e)}let ot=[...it.allAgents,...at],st={...it,allAgents:ot,activeAgents:Qn(ot)},lt=g??U().agent,M;if(lt&&(M=st.activeAgents.find(e=>e.agentType===lt),M||B(`Warning: agent "${lt}" not found. Available agents: ${st.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),Ne(M?.agentType),M&&(nr(M)&&M.agentType,{...g&&{source:`cli`}}),M?.agentType&&St(M.agentType),C&&M&&!w&&!nr(M)){let e=M.getSystemPrompt();e&&(w=e)}M?.initialPrompt&&(typeof A==`string`?A=A?`${M.initialPrompt}\n\n${A}`:M.initialPrompt:A||(A=M.initialPrompt));let N=Ge;!N&&M?.model&&M.model!==`inherit`&&(N=qi(M.model)),Me(N),je(zi()||null);let ft=Ee(),P=qi(ft??Gi()),F;if(Pe()){let e=Bt()?t.advisor:void 0;e&&(B(`[AdvisorTool] --advisor ${e}`),cr(P)||(process.stderr.write(v.red(`Error: The model "${P}" does not support the advisor tool.\n`)),process.exit(1)),sn(Ii(qi(e)))||(process.stderr.write(v.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),F=Bt()?e??It():e,F&&B(`[AdvisorTool] Advisor model: ${F}`)}if(t.proactive||c(process.env.WORKMATE_PROACTIVE)){let e=`
330
+ `)}return e}async function wc(){Z(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new Po().configureHelp(e()).enablePositionalOptions();Z(`run_commander_initialized`),t.hook(`preAction`,async e=>{Z(`preAction_start`),await Promise.all([ve(),vo()]),Z(`preAction_after_mdm`),await Go(),Z(`preAction_after_init`),c(process.env.WORKMATE_DISABLE_TERMINAL_TITLE)||(process.title=`workMate`);let{initSinks:t}=await import(`./sinks-D41OiGE4.js`);t(),Z(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(We(n),nt(`preAction: --plugin-dir inline plugins`)),hc(),Z(`preAction_after_migrations`),zo(),Z(`preAction_after_policy_limits`)}),t.name(`wm`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new Q(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Work Mate is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and AGENTS.md auto-discovery. Sets WORKMATE_SIMPLE=1. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (AGENTS.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new Q(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new Q(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new Q(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new Q(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new Q(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new Q(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new Q(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new Q(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new Q(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new Q(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new Q(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new Q(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new Q(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new Q(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new Q(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new Q(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new Q(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(fe)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new Q(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new Q(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new Q(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new Q(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new Q(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new Q(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new Q(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--strict-mcp-config`,`Only use MCP servers from --mcp-config, ignoring all other MCP configurations`,()=>!0).option(`--session-id <uuid>`,`Use a specific session ID for the conversation (must be a valid UUID)`).option(`-n, --name <name>`,`Set a display name for this session (shown in /resume and terminal title)`).option(`--agents <json>`,`JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).option(`--plugin-dir <path>`,`Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)`,(e,t)=>[...t,e],[]).option(`--disable-slash-commands`,`Disable all skills`,()=>!0).option(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{Z(`action_handler_start`),t.bare&&(process.env.WORKMATE_SIMPLE=`1`),e===`code`&&(console.warn(y.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&e.length;let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:l=[],mcpConfig:d=[],permissionMode:f,addDir:p=[],fallbackModel:m,betas:h=[],sessionId:g,includeHookEvents:ee,includePartialMessages:te}=t;t.prefill&&io(t.prefill);let ne=t.agents,_=t.agent;_&&(process.env.WORKMATE_AGENT=_);let v=t.outputFormat,b=t.inputFormat,re=t.verbose??J().verbose,x=t.print,ie=t.init??!1,ae=t.initOnly??!1,oe=t.maintenance??!1,se=t.disableSlashCommands||!1,ce=wa()?t.worktree:void 0,le=typeof ce==`string`?ce:void 0,S=ce!==void 0,ue;if(le){let e=mt(le);e!==null&&(ue=e,le=void 0)}let de=wa()&&t.tmux===!0;de&&(S||(process.stderr.write(y.red(`Error: --tmux requires --worktree
331
+ `)),process.exit(1)),Ci()===`windows`&&(process.stderr.write(y.red(`Error: --tmux is not supported on Windows
332
+ `)),process.exit(1)),await at()||(process.stderr.write(y.red(`Error: tmux is not installed.\n${Cn()}\n`)),process.exit(1)));let fe=t.sdkUrl??void 0,pe=te||c(process.env.WORKMATE_INCLUDE_PARTIAL_MESSAGES);if(ee&&On(!0),fe&&(b||(b=`stream-json`),v||(v=`stream-json`),t.verbose===void 0&&(re=!0),t.print||(x=!0)),g&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(y.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
333
+ `)),process.exit(1)),!fe)){let e=ft(g);e||(process.stderr.write(y.red(`Error: Invalid session ID. Must be a valid UUID.
334
+ `)),process.exit(1)),Dr(e)&&(process.stderr.write(y.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let C=Pe();m&&t.model&&m===t.model&&(process.stderr.write(y.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
335
+ `)),process.exit(1));let w=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(y.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
336
+ `)),process.exit(1));try{w=fo(co(t.systemPromptFile),`utf8`)}catch(e){qr(e)===`ENOENT`&&(process.stderr.write(y.red(`Error: System prompt file not found: ${co(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(y.red(`Error reading system prompt file: ${Kr(e)}\n`)),process.exit(1)}}let T=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(y.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
337
+ `)),process.exit(1));try{T=fo(co(t.appendSystemPromptFile),`utf8`)}catch(e){qr(e)===`ENOENT`&&(process.stderr.write(y.red(`Error: Append system prompt file not found: ${co(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(y.red(`Error reading append system prompt file: ${Kr(e)}\n`)),process.exit(1)}}let{mode:E,notification:me}=Lr({permissionModeCli:f,dangerouslySkipPermissions:i});ze(E===`bypassPermissions`),(t.enableAutoMode||f===`auto`||E===`auto`||!f&&Jt())&&on(!0);let D={};if(d&&d.length>0){let e=d.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=ye(r);if(a){let t=Fn({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=hr({filePath:co(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?`${e.path}: `:``}${e.message}`).join(`
338
+ `);G(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=gn(In(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${Ai(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),D={...D,...e}}}let he=t.strictMcpConfig||!1;Un()&&(he&&(process.stderr.write(y.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),D&&!Cr(D)&&(process.stderr.write(y.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),Je(p);let ge=await Kt({allowedToolsCli:s,disallowedToolsCli:l,baseToolsCli:o,permissionMode:E,allowDangerouslySkipPermissions:a,addDirs:p}),O=ge.toolPermissionContext,{warnings:_e,dangerousPermissions:ve}=ge;ve.length>0&&(O=Xn(O)),_e.forEach(e=>{console.error(e)}),G(`[STARTUP] Loading MCP configs...`);let be=Date.now(),xe,Se=(he||u()?Promise.resolve({servers:{}}):tr(D)).then(e=>(xe=Date.now()-be,e));b&&b!==`text`&&b!==`stream-json`&&(console.error(`Error: Invalid input format "${b}".`),process.exit(1)),b===`stream-json`&&v!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),fe&&(b!==`stream-json`||v!==`stream-json`)&&(console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),t.replayUserMessages&&(b!==`stream-json`||v!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),pe&&(!C||v!==`stream-json`)&&(mi(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!C&&(mi(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let A=await Cc(e||``,b??`text`);Z(`action_after_input_prompt`),Ec(t);let j=dt(O);Z(`action_tools_loaded`);let M;if(ea({isNonInteractiveSession:C})&&t.jsonSchema&&(M=Xr(t.jsonSchema)),M){let e=Qi(M);`tool`in e&&(j=[...j,e.tool],Object.keys(M.properties||{}).length,M.required)}Z(`action_before_setup`),G(`[STARTUP] Running setup()...`);let we=Date.now(),{setup:Te}=await import(`./setup-DR-KEmxL.js`),Ee=Hr();process.env.WORKMATE_ENTRYPOINT!==`local-agent`&&$s();let De=Te(Ee,E,a,S,le,de,g?ft(g):void 0,ue),N=S?null:st(Ee),Oe=S?null:Hn(Ee);N?.catch(()=>{}),Oe?.catch(()=>{}),await De,G(`[STARTUP] setup() completed in ${Date.now()-we}ms`),Z(`action_after_setup`);let Ae=!!t.replayUserMessages;Pe()&&(Za(),zt(),ht(),Mi());let je=t.name?.trim();je&&Wt(je);let Me=t.model==="default"?Wi():t.model,P=m==="default"?Wi():m,Ne=S?Hr():Ee;G(`[STARTUP] Loading commands and agents...`);let Ie=Date.now(),[Le,F]=await Promise.all([N??st(Ne),Oe??Hn(Ne)]);G(`[STARTUP] Commands and agents loaded in ${Date.now()-Ie}ms`),Z(`action_commands_loaded`);let Be=[];if(ne)try{let e=ye(ne);e&&(Be=Nn(e,`flagSettings`))}catch(e){Y(e)}let Ve=[...F.allAgents,...Be],He={...F,allAgents:Ve,activeAgents:br(Ve)},Ue=_??ke().agent,I;if(Ue&&(I=He.activeAgents.find(e=>e.agentType===Ue),I||G(`Warning: agent "${Ue}" not found. Available agents: ${He.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),Ze(I?.agentType),I&&(wr(I)&&I.agentType,{..._&&{source:`cli`}}),I?.agentType&&Vt(I.agentType),C&&I&&!w&&!wr(I)){let e=I.getSystemPrompt();e&&(w=e)}I?.initialPrompt&&(typeof A==`string`?A=A?`${I.initialPrompt}\n\n${A}`:I.initialPrompt:A||(A=I.initialPrompt));let We=Me;!We&&I?.model&&I.model!==`inherit`&&(We=Ki(I.model)),Xe(We),Ye(Ri()||null);let Ge=Ke(),L=Ki(Ge??Wi()),R;if(Qe()){let e=ln()?t.advisor:void 0;e&&(G(`[AdvisorTool] --advisor ${e}`),Ar(L)||(process.stderr.write(y.red(`Error: The model "${L}" does not support the advisor tool.\n`)),process.exit(1)),kn(Fi(Ki(e)))||(process.stderr.write(y.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),R=ln()?e??nn():e,R&&G(`[AdvisorTool] Advisor model: ${R}`)}if(t.proactive||c(process.env.WORKMATE_PROACTIVE)){let e=`
339
339
  # Proactive Mode
340
340
 
341
341
  You are in proactive mode. Take initiative — explore, act, and make progress without waiting for instructions.
342
342
 
343
343
  Start by briefly greeting the user.
344
344
 
345
- You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;T=T?`${T}\n\n${e}`:e}let I,ht,_t;if(!C){let e=gs(!1);ht=e.getFpsMetrics,_t=e.stats;let{createRoot:t}=await import(`./src-Cy5_qH26.js`);I=await t(e.renderOptions),Math.round(process.uptime()*1e3),B(`[STARTUP] Running showSetupScreens()...`);let n=Date.now();await hs(I,E,a,rt),B(`[STARTUP] showSetupScreens() completed in ${Date.now()-n}ms`)}if(process.exitCode!==void 0){B(`Graceful shutdown initiated, skipping further initialization`);return}if(Mt(),!C){let{errors:e}=$r(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await _s(I,{settingsErrors:t,onExit:()=>yn(1)})}let yt=q().startupPrefetchedAt??0;u()?B(`Skipping startup prefetches, last ran ${Math.round((Date.now()-yt)/1e3)}s ago`):(B(`Starting background startup prefetches${yt>0?` last ran ${Math.round((Date.now()-yt)/1e3)}s ago`:``}`),et().catch(e=>J(e))),C||to();let{servers:xt}=await Te;B(`[STARTUP] MCP configs resolved in ${we}ms (awaited at +${Date.now()-Ce}ms)`);let L={...xt,...D},Tt={},Dt={};for(let[e,t]of Object.entries(L)){let n=t;n.type===`sdk`?Tt[e]=n:Dt[e]=n}X(`action_mcp_configs_loaded`);let kt=(C||O?Promise.resolve({clients:[],tools:[],commands:[]}):pt(Dt)).then(e=>({clients:e.clients,tools:fn(e.tools,`name`),commands:fn(e.commands,`name`)})),At=oe||ae||se||C||t.continue||t.resume?null:Bn(`startup`,{agentType:M?.agentType,model:P}),jt=[];kt.catch(()=>{});let Nt=[],Pt=[],Ft=[],R=ut(),z=R===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)R=!0,z={type:`adaptive`};else if(t.thinking===`disabled`)R=!1,z={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(R=!0,z={type:`enabled`,budgetTokens:e}):e===0&&(R=!1,z={type:`disabled`}))}H(`info`,`started`,{version:`0.0.26`,is_native_binary:Ti()}),Ar(async()=>{H(`info`,`exited`)}),Tc({hasInitialPrompt:!!e,hasStdin:!!A,verbose:ie,debug:n,debugToStderr:r,print:b??!1,outputFormat:_??`text`,inputFormat:y??`text`,numAllowedTools:s.length,numDisallowedTools:l.length,mcpClientCount:Object.keys(L).length,worktreeEnabled:x,skipWebFetchPreflight:U().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:E,modeIsBypass:E===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:w?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:T?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:z,assistantActivationPath:void 0}),dr(Dt,k),uc(),Ct().then(e=>{e&&(Ue&&cn(Ue),Ht().then(e=>{}))}),u()||(C?(await Lt(),X(`action_after_plugins_init`),En().then(()=>ct())):Lt().then(async()=>{X(`action_after_plugins_init`),await En(),ct()}));let Vt=oe||ae?`init`:se?`maintenance`:null;if(oe){Qa(),await er(`init`,{forceSyncExecution:!0}),await Bn(`startup`,{forceSyncExecution:!0}),yn(0);return}if(C){(_===`stream-json`||_===`json`)&&Pr(!0),Qa(),qo();let e=t.continue||t.resume||Vt?void 0:Bn(`startup`);e?.catch(()=>{});let n=ce?[]:rt.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),r=Ke(),i=dt({...r,mcp:{...r.mcp,clients:Nt,commands:Ft,tools:Pt},toolPermissionContext:k,...gt()&&{fastMode:kn(N??null)},...Pe()&&F&&{advisorModel:F}},Ya);mt(k,i.getState().fastMode).then(({updateContext:e})=>{i.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&ge(!0),ve(zn(ee)),X(`before_connectMcp`),await((e,t)=>Object.keys(e).length===0?Promise.resolve():(i.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),$e(({client:e,tools:t,commands:n})=>{i.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:fn([...r.mcp.tools,...t],`name`),commands:fn([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>B(`[MCP] ${t} connect error: ${e}`))))(Dt,`regular`),X(`after_connectMcp`),u()||(_c(),import(`./backgroundHousekeeping-ZCMPmQuU.js`).then(e=>e.startBackgroundHousekeeping())),dc(),X(`before_print_import`);let{runHeadless:a}=await import(`./print-BzljdXem.js`);X(`after_print_import`),a(A,()=>i.getState(),i.setState,n,De,Tt,st.activeAgents,{continue:t.continue,resume:t.resume,verbose:ie,outputFormat:_,jsonSchema:j,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:z,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:w,appendSystemPrompt:T,userSpecifiedModel:N,fallbackModel:qe,sdkUrl:fe,replayUserMessages:Ve,includePartialMessages:me,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,agent:g,workload:t.workload,setupTrigger:Vt??void 0,sessionStartHooksPromise:e});return}t.model,process.env.ANTHROPIC_MODEL,U()?.model;let Ut=eo(P),Wt=[];_e&&Wt.push({key:`permission-mode-notification`,text:_e,priority:`high`}),Ut&&Wt.push({key:`model-deprecation-warning`,text:Ut,color:`warning`,priority:`high`});let Gt={...k},Kt={settings:U(),tasks:{},agentNameRegistry:new Map,verbose:ie??q().verbose??!1,mainLoopModel:ft,mainLoopModelForSession:null,expandedView:q().showExpandedTodos?`tasks`:`none`,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:Gt,agent:M?.agentType,agentDefinitions:st,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,notifications:{current:null,queue:Wt},elicitation:{queue:[]},todos:{},fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:an(),thinkingEnabled:R,promptSuggestionEnabled:vt(),sessionHooks:new Map,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:Xe,speculationSessionTimeSavedMs:0,initialMessage:A?{message:Le({content:String(A)})}:null,activeOverlays:new Set,fastMode:kn(P),...Pe()&&F&&{advisorModel:F}};A&&Oa(String(A));let Jt=Pt;K(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{pc(),dc()});let Yt={debug:n||r,commands:[...rt,...Ft],initialTools:Jt,mcpClients:Nt,mainThreadAgentDefinition:M,disableSlashCommands:ce,dynamicMcpConfig:D,strictMcpConfig:O,systemPrompt:w,appendSystemPrompt:T,thinkingConfig:z},Xt={mainThreadAgentDefinition:M,agentDefinitions:st,currentCwd:tt,cliAgents:at,initialState:Kt};if(t.continue)try{let e=performance.now(),{clearSessionCaches:n}=await import(`./caches-Be9saXxV.js`);n();let r=await La(void 0,void 0);if(!r)return await fs(I,`No conversation found to continue`);let i=await za(r,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:r.fullPath},Xt);i.restoredAgentDef&&(M=i.restoredAgentDef),Ec(t),Math.round(performance.now()-e),await Xo(I,{getFpsMetrics:ht,stats:_t,initialState:i.initialState},{...Yt,mainThreadAgentDefinition:i.restoredAgentDef??M,initialMessages:i.messages,initialFileHistorySnapshots:i.fileHistorySnapshots,initialContentReplacements:i.contentReplacements,initialAgentName:i.agentName,initialAgentColor:i.agentColor},ms)}catch(e){J(e),process.exit(1)}else if(t.resume||t.fromPr){let{clearSessionCaches:e}=await import(`./caches-Be9saXxV.js`);e();let n,r=Ye(t.resume),i,a=null,o;if(t.fromPr&&(t.fromPr===!0?o=!0:typeof t.fromPr==`string`&&(o=t.fromPr)),t.resume&&typeof t.resume==`string`&&!r){let e=t.resume.trim();if(e){let t=await Gn(e,{exact:!0});t.length===1?(a=t[0],r=Pn(a)??null):i=e}}if(r){let e=r;try{let r=performance.now(),i=await La(a??e,void 0);if(!i)return await fs(I,`No conversation found with session ID: ${e}`);let o=a?.fullPath??i.fullPath;n=await za(i,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:o},Xt),n.restoredAgentDef&&(M=n.restoredAgentDef),Math.round(performance.now()-r)}catch(t){J(t),await fs(I,`Failed to resume session ${e}`)}}let s=n??(Array.isArray(null)?{messages:null,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:M,initialState:Kt,contentReplacements:void 0}:void 0);s?(Ec(t),await Xo(I,{getFpsMetrics:ht,stats:_t,initialState:s.initialState},{...Yt,mainThreadAgentDefinition:s.restoredAgentDef??M,initialMessages:s.messages,initialFileHistorySnapshots:s.fileHistorySnapshots,initialContentReplacements:s.contentReplacements,initialAgentName:s.agentName,initialAgentColor:s.agentColor},ms)):await vs(I,{getFpsMetrics:ht,stats:_t,initialState:Kt},gr(Oe()),{...Yt,initialSearchQuery:i,forkSession:t.forkSession,filterByPr:o})}else{let e=At&&jt.length===0?At:void 0;X(`action_after_hooks`),Ec(t);let n=null;t.deepLinkOrigin?(t.prefill,t.deepLinkRepo,n=zt(so({cwd:br(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=zt(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...jt]:jt.length>0?jt:void 0;await Xo(I,{getFpsMetrics:ht,stats:_t,initialState:Kt},{...Yt,initialMessages:r,pendingHookMessages:e},ms)}}).version(`0.0.26 (Work Mate)`,`-v, --version`,`Output the version number`),t.option(`-w, --worktree [name]`,`Create a new git worktree for this session (optionally specify a name)`),t.option(`--tmux`,`Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.`),Bt()&&t.addOption(new Z(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new Z(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new Z(`--proactive`,`Start in proactive autonomous mode`)),X(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return X(`run_before_parse`),await t.parseAsync(process.argv),X(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-CJ6SDJEK.js`);await n({debug:e,verbose:t})}),nc(i),i.command(`remove <name>`).description(`Remove an MCP server`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in`).action(async(e,t)=>{let{mcpRemoveHandler:n}=await import(`./mcp-CJ6SDJEK.js`);await n(e,t)}),i.command(`list`).description(`List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let{mcpListHandler:e}=await import(`./mcp-CJ6SDJEK.js`);await e()}),i.command(`get <name>`).description(`Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async e=>{let{mcpGetHandler:t}=await import(`./mcp-CJ6SDJEK.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-CJ6SDJEK.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Work Mate Desktop (Mac and WSL only)`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async e=>{let{mcpAddFromDesktopHandler:t}=await import(`./mcp-CJ6SDJEK.js`);await t(e)}),i.command(`reset-project-choices`).description(`Reset all approved and rejected project-scoped (.mcp.json) servers within this project`).action(async()=>{let{mcpResetChoicesHandler:e}=await import(`./mcp-CJ6SDJEK.js`);await e()});let a=()=>new Z(`--cowork`,`Use cowork_plugins directory`).hideHelp(),o=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());o.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(a()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),o.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(a()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-D7zyI9c4.js`);await t(e)});let s=o.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());return s.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(a()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),s.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(a()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-D7zyI9c4.js`);await t(e)}),s.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(a()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),s.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(a()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),o.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(a()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),o.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.workmate/plugins/data/{id}/)`).addOption(a()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),o.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${Ia.join(`, `)} (default: auto-detect)`).addOption(a()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),o.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${Ia.join(`, `)} (default: auto-detect)`).addOption(a()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),o.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${Pa.join(`, `)} (default: user)`).addOption(a()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-D7zyI9c4.js`);await n(e,t)}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-Dy4_hDic.js`);await e(),process.exit(0)}),t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-_zo3I1y8.js`),import(`./src-Cy5_qH26.js`)]);await e(await t($a(!1)))}),t.command(`install [target]`).description(`Install Work Mate native build. Use [target] to specify version (stable, latest, or specific version)`).option(`--force`,`Force installation even if already installed`).action(async(e,t)=>{let{installHandler:n}=await import(`./util-_zo3I1y8.js`);await n(e,t)}),X(`run_before_parse`),await t.parseAsync(process.argv),X(`run_after_parse`),X(`main_after_run`),ki(),t}async function Tc({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:f,worktreeEnabled:p,skipWebFetchPreflight:m,githubActionInputs:ee,dangerouslySkipPermissionsPassed:h,permissionMode:te,modeIsBypass:ne,allowDangerouslySkipPermissionsPassed:re,systemPromptFlag:g,appendSystemPromptFlag:_,thinkingConfig:v,assistantActivationPath:y}){try{({...ee&&{githubActionInputs:ee}}),d(),v.type,{...v.type===`enabled`&&{thinkingBudgetTokens:v.budgetTokens},...g&&{systemPromptFlag:g},..._&&{appendSystemPromptFlag:_}},u(),{...y&&{assistantActivationPath:y}},U().autoUpdatesChannel}catch(e){J(e)}}function Ec(t){if(t.proactive||c(process.env.WORKMATE_PROACTIVE)){let t=(Ft(),e(z));t.isProactiveActive()||t.activateProactive(`command`)}}function Dc(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(ae)}export{Sc as main};
345
+ You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;T=T?`${T}\n\n${e}`:e}let z,B,V;if(!C){let e=gs(!1);B=e.getFpsMetrics,V=e.stats;let{createRoot:t}=await import(`./src-HB5wLari.js`);z=await t(e.renderOptions),Math.round(process.uptime()*1e3),G(`[STARTUP] Running showSetupScreens()...`);let n=Date.now();await hs(z,E,a,Le),G(`[STARTUP] showSetupScreens() completed in ${Date.now()-n}ms`)}if(process.exitCode!==void 0){G(`Graceful shutdown initiated, skipping further initialization`);return}if(Qt(),!C){let{errors:e}=Ce(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await _s(z,{settingsErrors:t,onExit:()=>Vn(1)})}let $e=J().startupPrefetchedAt??0;u()?G(`Skipping startup prefetches, last ran ${Math.round((Date.now()-$e)/1e3)}s ago`):(G(`Starting background startup prefetches${$e>0?` last ran ${Math.round((Date.now()-$e)/1e3)}s ago`:``}`),_t().catch(e=>Y(e))),C||eo();let{servers:tt}=await Se;G(`[STARTUP] MCP configs resolved in ${xe}ms (awaited at +${Date.now()-be}ms)`);let nt={...tt,...D},rt={},it={};for(let[e,t]of Object.entries(nt)){let n=t;n.type===`sdk`?rt[e]=n:it[e]=n}Z(`action_mcp_configs_loaded`);let ot=(C||he?Promise.resolve({clients:[],tools:[],commands:[]}):At(it)).then(e=>({clients:e.clients,tools:Pn(e.tools,`name`),commands:Pn(e.commands,`name`)})),ct=ae||ie||oe||C||t.continue||t.resume?null:cr(`startup`,{agentType:I?.agentType,model:L}),ut=[];ot.catch(()=>{});let vt=[],yt=[],bt=[],H=Dt(),U=H===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)H=!0,U={type:`adaptive`};else if(t.thinking===`disabled`)H=!1,U={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(H=!0,U={type:`enabled`,budgetTokens:e}):e===0&&(H=!1,U={type:`disabled`}))}k(`info`,`started`,{version:`0.0.27`,is_native_binary:wi()}),Qr(async()=>{k(`info`,`exited`)}),Tc({hasInitialPrompt:!!e,hasStdin:!!A,verbose:re,debug:n,debugToStderr:r,print:x??!1,outputFormat:v??`text`,inputFormat:b??`text`,numAllowedTools:s.length,numDisallowedTools:l.length,mcpClientCount:Object.keys(nt).length,worktreeEnabled:S,skipWebFetchPreflight:ke().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:E,modeIsBypass:E===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:w?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:T?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:U,assistantActivationPath:void 0}),Nr(it,O),uc(),Ht().then(e=>{e&&(je&&An(je),dn().then(e=>{}))}),u()||(C?(await rn(),Z(`action_after_plugins_init`),Jn().then(()=>Ct())):rn().then(async()=>{Z(`action_after_plugins_init`),await Jn(),Ct()}));let xt=ae||ie?`init`:oe?`maintenance`:null;if(ae){Za(),await Sr(`init`,{forceSyncExecution:!0}),await cr(`startup`,{forceSyncExecution:!0}),Vn(0);return}if(C){(v===`stream-json`||v===`json`)&&ni(!0),Za(),Ko();let e=t.continue||t.resume||xt?void 0:cr(`startup`);e?.catch(()=>{});let n=se?[]:Le.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),r=lt(),i=Ot({...r,mcp:{...r.mcp,clients:vt,commands:bt,tools:yt},toolPermissionContext:O,...Ft()&&{fastMode:Zn(We??null)},...Qe()&&R&&{advisorModel:R}},Ja);Mt(O,i.getState().fastMode).then(({updateContext:e})=>{i.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&Fe(!0),Re(sr(h)),Z(`before_connectMcp`),await((e,t)=>Object.keys(e).length===0?Promise.resolve():(i.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),gt(({client:e,tools:t,commands:n})=>{i.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:Pn([...r.mcp.tools,...t],`name`),commands:Pn([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>G(`[MCP] ${t} connect error: ${e}`))))(it,`regular`),Z(`after_connectMcp`),u()||(_c(),import(`./backgroundHousekeeping-B56nFTzq.js`).then(e=>e.startBackgroundHousekeeping())),dc(),Z(`before_print_import`);let{runHeadless:a}=await import(`./print-DSHypGJa.js`);Z(`after_print_import`),a(A,()=>i.getState(),i.setState,n,j,rt,He.activeAgents,{continue:t.continue,resume:t.resume,verbose:re,outputFormat:v,jsonSchema:M,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:U,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:w,appendSystemPrompt:T,userSpecifiedModel:We,fallbackModel:P,sdkUrl:fe,replayUserMessages:Ae,includePartialMessages:pe,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,agent:_,workload:t.workload,setupTrigger:xt??void 0,sessionStartHooksPromise:e});return}t.model,process.env.ANTHROPIC_MODEL,ke()?.model;let St=$a(L),wt=[];me&&wt.push({key:`permission-mode-notification`,text:me,priority:`high`}),St&&wt.push({key:`model-deprecation-warning`,text:St,color:`warning`,priority:`high`});let Tt={...O},Et={settings:ke(),tasks:{},agentNameRegistry:new Map,verbose:re??J().verbose??!1,mainLoopModel:Ge,mainLoopModelForSession:null,expandedView:J().showExpandedTodos?`tasks`:`none`,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:Tt,agent:I?.agentType,agentDefinitions:He,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,notifications:{current:null,queue:wt},elicitation:{queue:[]},todos:{},fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:Dn(),thinkingEnabled:H,promptSuggestionEnabled:Lt(),sessionHooks:new Map,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:pt,speculationSessionTimeSavedMs:0,initialMessage:A?{message:et({content:String(A)})}:null,activeOverlays:new Set,fastMode:Zn(L),...Qe()&&R&&{advisorModel:R}};A&&Fa(String(A));let kt=yt;q(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{pc(),dc()});let W={debug:n||r,commands:[...Le,...bt],initialTools:kt,mcpClients:vt,mainThreadAgentDefinition:I,disableSlashCommands:se,dynamicMcpConfig:D,strictMcpConfig:he,systemPrompt:w,appendSystemPrompt:T,thinkingConfig:U},jt={mainThreadAgentDefinition:I,agentDefinitions:He,currentCwd:Ne,cliAgents:Be,initialState:Et};if(t.continue)try{let e=performance.now(),{clearSessionCaches:n}=await import(`./caches-D7arwhaa.js`);n();let r=await Ma(void 0,void 0);if(!r)return await ds(z,`No conversation found to continue`);let i=await Ia(r,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:r.fullPath},jt);i.restoredAgentDef&&(I=i.restoredAgentDef),Ec(t),Math.round(performance.now()-e),await Yo(z,{getFpsMetrics:B,stats:V,initialState:i.initialState},{...W,mainThreadAgentDefinition:i.restoredAgentDef??I,initialMessages:i.messages,initialFileHistorySnapshots:i.fileHistorySnapshots,initialContentReplacements:i.contentReplacements,initialAgentName:i.agentName,initialAgentColor:i.agentColor},ms)}catch(e){Y(e),process.exit(1)}else if(t.resume||t.fromPr){let{clearSessionCaches:e}=await import(`./caches-D7arwhaa.js`);e();let n,r=ft(t.resume),i,a=null,o;if(t.fromPr&&(t.fromPr===!0?o=!0:typeof t.fromPr==`string`&&(o=t.fromPr)),t.resume&&typeof t.resume==`string`&&!r){let e=t.resume.trim();if(e){let t=await pr(e,{exact:!0});t.length===1?(a=t[0],r=nr(a)??null):i=e}}if(r){let e=r;try{let r=performance.now(),i=await Ma(a??e,void 0);if(!i)return await ds(z,`No conversation found with session ID: ${e}`);let o=a?.fullPath??i.fullPath;n=await Ia(i,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:o},jt),n.restoredAgentDef&&(I=n.restoredAgentDef),Math.round(performance.now()-r)}catch(t){Y(t),await ds(z,`Failed to resume session ${e}`)}}let s=n??(Array.isArray(null)?{messages:null,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:I,initialState:Et,contentReplacements:void 0}:void 0);s?(Ec(t),await Yo(z,{getFpsMetrics:B,stats:V,initialState:s.initialState},{...W,mainThreadAgentDefinition:s.restoredAgentDef??I,initialMessages:s.messages,initialFileHistorySnapshots:s.fileHistorySnapshots,initialContentReplacements:s.contentReplacements,initialAgentName:s.agentName,initialAgentColor:s.agentColor},ms)):await vs(z,{getFpsMetrics:B,stats:V,initialState:Et},Rr(qe()),{...W,initialSearchQuery:i,forkSession:t.forkSession,filterByPr:o})}else{let e=ct&&ut.length===0?ct:void 0;Z(`action_after_hooks`),Ec(t);let n=null;t.deepLinkOrigin?(t.prefill,t.deepLinkRepo,n=sn(oo({cwd:Hr(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=sn(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...ut]:ut.length>0?ut:void 0;await Yo(z,{getFpsMetrics:B,stats:V,initialState:Et},{...W,initialMessages:r,pendingHookMessages:e},ms)}}).version(`0.0.27 (Work Mate)`,`-v, --version`,`Output the version number`),t.option(`-w, --worktree [name]`,`Create a new git worktree for this session (optionally specify a name)`),t.option(`--tmux`,`Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.`),ln()&&t.addOption(new Q(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new Q(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new Q(`--proactive`,`Start in proactive autonomous mode`)),Z(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return Z(`run_before_parse`),await t.parseAsync(process.argv),Z(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-CZUVaPb3.js`);await n({debug:e,verbose:t})}),nc(i),i.command(`remove <name>`).description(`Remove an MCP server`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in`).action(async(e,t)=>{let{mcpRemoveHandler:n}=await import(`./mcp-CZUVaPb3.js`);await n(e,t)}),i.command(`list`).description(`List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let{mcpListHandler:e}=await import(`./mcp-CZUVaPb3.js`);await e()}),i.command(`get <name>`).description(`Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async e=>{let{mcpGetHandler:t}=await import(`./mcp-CZUVaPb3.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-CZUVaPb3.js`);await r(e,t,n)}),i.command(`reset-project-choices`).description(`Reset all approved and rejected project-scoped (.mcp.json) servers within this project`).action(async()=>{let{mcpResetChoicesHandler:e}=await import(`./mcp-CZUVaPb3.js`);await e()});let a=()=>new Q(`--cowork`,`Use cowork_plugins directory`).hideHelp(),o=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());o.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(a()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),o.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(a()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-Divl-P-X.js`);await t(e)});let s=o.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());return s.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(a()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),s.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(a()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-Divl-P-X.js`);await t(e)}),s.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(a()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),s.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(a()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),o.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(a()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),o.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.workmate/plugins/data/{id}/)`).addOption(a()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),o.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${Aa.join(`, `)} (default: auto-detect)`).addOption(a()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),o.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${Aa.join(`, `)} (default: auto-detect)`).addOption(a()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),o.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${Oa.join(`, `)} (default: user)`).addOption(a()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-Divl-P-X.js`);await n(e,t)}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-DRQlR5M1.js`);await e(),process.exit(0)}),t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-BHr5l6Bx.js`),import(`./src-HB5wLari.js`)]);await e(await t(Qa(!1)))}),t.command(`install [target]`).description(`Install Work Mate native build. Use [target] to specify version (stable, latest, or specific version)`).option(`--force`,`Force installation even if already installed`).action(async(e,t)=>{let{installHandler:n}=await import(`./util-BHr5l6Bx.js`);await n(e,t)}),Z(`run_before_parse`),await t.parseAsync(process.argv),Z(`run_after_parse`),Z(`main_after_run`),Oi(),t}async function Tc({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:f,worktreeEnabled:p,skipWebFetchPreflight:m,githubActionInputs:h,dangerouslySkipPermissionsPassed:g,permissionMode:ee,modeIsBypass:te,allowDangerouslySkipPermissionsPassed:ne,systemPromptFlag:_,appendSystemPromptFlag:v,thinkingConfig:y,assistantActivationPath:b}){try{({...h&&{githubActionInputs:h}}),d(),y.type,{...y.type===`enabled`&&{thinkingBudgetTokens:y.budgetTokens},..._&&{systemPromptFlag:_},...v&&{appendSystemPromptFlag:v}},u(),{...b&&{assistantActivationPath:b}},ke().autoUpdatesChannel}catch(e){Y(e)}}function Ec(t){if(t.proactive||c(process.env.WORKMATE_PROACTIVE)){let t=(tn(),e(cn));t.isProactiveActive()||t.activateProactive(`command`)}}function Dc(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(ie)}export{Sc as main};