@readmagic/workmate 0.0.10 → 0.0.11

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 (399) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Vmmm7p1c.js → AddWorkspaceDirectory-ag2JTpmU.js} +1 -1
  2. package/dist/chunks/App-BuKmqFPm.js +1 -0
  3. package/dist/chunks/ApproveApiKey-CIWOi_7v.js +1 -0
  4. package/dist/chunks/ApproveApiKey-M6U-NafA.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-CLSACUmo.js → BypassPermissionsModeDialog-B05t83wa.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BqNxQOXJ.js → ClaudeMdExternalIncludesDialog-CSywJdVL.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +1 -0
  10. package/dist/chunks/{DiffDialog-9AYwtupw.js → DiffDialog-DUbFrzKu.js} +2 -2
  11. package/dist/chunks/Doctor-BcnUfJ4I.js +1 -0
  12. package/dist/chunks/Doctor-Dz4TuYas.js +3 -0
  13. package/dist/chunks/ExitFlow-BwyAtIHx.js +2 -0
  14. package/dist/chunks/{Grove-B9-hhkZA.js → Grove-BDoVj02t.js} +2 -2
  15. package/dist/chunks/{HybridTransport-MxJ_W_np.js → HybridTransport-C_U0IJfz.js} +4 -4
  16. package/dist/chunks/InvalidConfigDialog-bih293Xt.js +1 -0
  17. package/dist/chunks/{InvalidSettingsDialog-YyQcHocx.js → InvalidSettingsDialog-Br8kQOHz.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +1 -0
  19. package/dist/chunks/MCPToolListView-DJ06N1DG.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-BCpfHaBK.js → McpParsingWarnings-COa71S9q.js} +1 -1
  21. package/dist/chunks/MessageSelector-o4ULADFg.js +3 -0
  22. package/dist/chunks/Messages-qqwHuAW5.js +11 -0
  23. package/dist/chunks/{Onboarding-ClwHS5rh.js → Onboarding-BzuQjney.js} +1 -1
  24. package/dist/chunks/{PromptInputFooterSuggestions-BSA9NrZc.js → PromptInputFooterSuggestions-to5eYBvI.js} +1 -1
  25. package/dist/chunks/{PromptInputHelpMenu-Bb4KdIX_.js → PromptInputHelpMenu-CfMFx-TF.js} +1 -1
  26. package/dist/chunks/QueryEngine-Dt0BKUeF.js +1 -0
  27. package/dist/chunks/REPL-CUbEDqEl.js +133 -0
  28. package/dist/chunks/REPL-DMaKNhTa.js +1 -0
  29. package/dist/chunks/{RemoteSessionManager-CS6mywIn.js → RemoteSessionManager-Bf44A0Ol.js} +2 -2
  30. package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +1 -0
  31. package/dist/chunks/{SSETransport-CoxQ8YpH.js → SSETransport-DN4tCDEh.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +1 -0
  33. package/dist/chunks/Settings-DfdcmvOV.js +2 -0
  34. package/dist/chunks/{TeleportProgress-Doucj-50.js → TeleportProgress-C2LQVLav.js} +1 -1
  35. package/dist/chunks/TeleportRepoMismatchDialog-BZL8Zblz.js +1 -0
  36. package/dist/chunks/{TeleportResumeWrapper-D6kpr2c6.js → TeleportResumeWrapper-wPiIs8xg.js} +1 -1
  37. package/dist/chunks/{ThemePicker-DrC8tlp0.js → ThemePicker-BT_NaRQC.js} +1 -1
  38. package/dist/chunks/{TrustDialog-Fk4m_Sy4.js → TrustDialog-ACaJ_m7A.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-D_OUa4RT.js → ValidationErrorsList-C-hWdy_8.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-DvfQHnZY.js → WelcomeV2-ZQRKlcT4.js} +1 -1
  41. package/dist/chunks/add-dir-SAKTkw0S.js +1 -0
  42. package/dist/chunks/{agentDisplay-B755vMZE.js → agentDisplay-CuSHqgZc.js} +1 -1
  43. package/dist/chunks/{agents-CIvP8l0s.js → agents-CMC0iQP4.js} +1 -1
  44. package/dist/chunks/agents-ZgRKpjHv.js +103 -0
  45. package/dist/chunks/allErrors-_cOQksHC.js +1 -0
  46. package/dist/chunks/{api-nSHc_GIQ.js → api-BbJfMXRS.js} +1 -1
  47. package/dist/chunks/api-DS1MiW01.js +1 -0
  48. package/dist/chunks/{auth-5QB6tsfB.js → auth-7mJGtlZp.js} +2 -2
  49. package/dist/chunks/auth-DGZzCbU0.js +1 -0
  50. package/dist/chunks/auth-DN1MUpB8.js +1 -0
  51. package/dist/chunks/{autoMode-BnUiK9Cu.js → autoMode-CBtY7ACs.js} +6 -6
  52. package/dist/chunks/{autonomy-Src6sKCp.js → autonomy-DuQmYhq6.js} +9 -9
  53. package/dist/chunks/{autonomy-C1aSgWPQ.js → autonomy-lJV7yWUl.js} +1 -1
  54. package/dist/chunks/autonomyPanel-DAQm6lDz.js +1 -0
  55. package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +1 -0
  56. package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +17 -0
  57. package/dist/chunks/{banner-D0P7wXdw.js → banner-1Wyeyawe.js} +1 -1
  58. package/dist/chunks/{bg-DAPORXF3.js → bg-CJ0YWFli.js} +2 -2
  59. package/dist/chunks/bg-CeUrRz_7.js +1 -0
  60. package/dist/chunks/{branch-DFWa4Oxo.js → branch-k3kirqbA.js} +2 -2
  61. package/dist/chunks/{break-cache-Chj9i9MP.js → break-cache-CAoZ9b72.js} +1 -1
  62. package/dist/chunks/bridgeConfig-CzRUPn-D.js +1 -0
  63. package/dist/chunks/{bridgeConfig-Bb6URf4Q.js → bridgeConfig-UgaUfuP6.js} +1 -1
  64. package/dist/chunks/{bridgeMessaging-C3huGcR3.js → bridgeMessaging-Ci5H68MX.js} +1 -1
  65. package/dist/chunks/{bridgePointer-DLYyvRKb.js → bridgePointer-BL8-lGvN.js} +1 -1
  66. package/dist/chunks/{bridgeStatusUtil-DFMftajD.js → bridgeStatusUtil-C36w15ge.js} +1 -1
  67. package/dist/chunks/btw-nVoVuIae.js +1 -0
  68. package/dist/chunks/caches-B8sM3Zys.js +1 -0
  69. package/dist/chunks/caches-Bp9MZ7IE.js +1 -0
  70. package/dist/chunks/{capacityWake-amzeeBz0.js → capacityWake-BOySRJUJ.js} +1 -1
  71. package/dist/chunks/ccrClient-Br4LAofR.js +1 -0
  72. package/dist/chunks/{claudeDesktop-CsJfF1b-.js → claudeDesktop-Bgds1-YT.js} +1 -1
  73. package/dist/chunks/{clear-ClFDpWVJ.js → clear-C4Vtnbye.js} +1 -1
  74. package/dist/chunks/{cliLaunch-BWcoyZDP.js → cliLaunch-BTpfAGGI.js} +1 -1
  75. package/dist/chunks/{client-DFlE4fYh.js → client-B9404qIP.js} +1 -1
  76. package/dist/chunks/client-BCAbKdNz.js +1 -0
  77. package/dist/chunks/client-CJE6gEvU.js +1 -0
  78. package/dist/chunks/commands-DL-BzoMQ.js +1 -0
  79. package/dist/chunks/compact-Cx7BPXLU.js +2 -0
  80. package/dist/chunks/config-S5OW4Xqr.js +1 -0
  81. package/dist/chunks/{config-Do1870_d.js → config-aRiTrtCv.js} +2 -2
  82. package/dist/chunks/{config-CVHMRMwd.js → config-kB2eazPX.js} +1 -1
  83. package/dist/chunks/context-BN7DEjoH.js +1 -0
  84. package/dist/chunks/{context-noninteractive-D5iQhasu.js → context-noninteractive-D91W2B8e.js} +5 -5
  85. package/dist/chunks/context-noninteractive-DPacEFJ1.js +1 -0
  86. package/dist/chunks/conversation-D5Nbu9eT.js +1 -0
  87. package/dist/chunks/conversation-hcUx9e-C.js +1 -0
  88. package/dist/chunks/{createSSHSession-CJtzNQdZ.js → createSSHSession-DecOR6M5.js} +6 -6
  89. package/dist/chunks/createSession-D27zvmOs.js +1 -0
  90. package/dist/chunks/createSession-DRqkLZWt.js +1 -0
  91. package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +40 -0
  92. package/dist/chunks/{datadog-DjeJThpV.js → datadog-bm551AVV.js} +1 -1
  93. package/dist/chunks/debug-BecbSVoN.js +39 -0
  94. package/dist/chunks/{debugUtils-DX0KAXNK.js → debugUtils-CmJfIUxW.js} +1 -1
  95. package/dist/chunks/{detached-X_yjYR7x.js → detached-CIyF0M5O.js} +1 -1
  96. package/dist/chunks/detectRepository-C15umvKN.js +1 -0
  97. package/dist/chunks/detectRepository-DDfLfKcM.js +1 -0
  98. package/dist/chunks/{diff-jEJJe58I.js → diff-DeK4bwjw.js} +1 -1
  99. package/dist/chunks/{directoryCompletion-BbXR2bfy.js → directoryCompletion-BJCu19HJ.js} +1 -1
  100. package/dist/chunks/doctor-BJORBomU.js +1 -0
  101. package/dist/chunks/{entry-oIqjxIjQ.js → entry-mdegyj8z.js} +3 -3
  102. package/dist/chunks/{esm-Cf4nSRjF.js → esm-Ka3lhafK.js} +1 -1
  103. package/dist/chunks/{execFileNoThrow-Dwu6psHW.js → execFileNoThrow-DHyW8FMX.js} +2 -2
  104. package/dist/chunks/execSyncWrapper-CDzB0BM1.js +1 -0
  105. package/dist/chunks/exit-CF3KBl-S.js +1 -0
  106. package/dist/chunks/{extraUsage-Mi66JwFZ.js → extraUsage-BrKbpBK-.js} +1 -1
  107. package/dist/chunks/extractMemories-4lBn134y.js +1 -0
  108. package/dist/chunks/fast-0Vi354KI.js +1 -0
  109. package/dist/chunks/{fast-BU4iUZ8E.js → fast-DWn40OcQ.js} +1 -1
  110. package/dist/chunks/{fileSuggestions-BMfQIDdW.js → fileSuggestions-C7Pwq2yj.js} +3 -3
  111. package/dist/chunks/{firstPartyEventLogger-B3cXgR67.js → firstPartyEventLogger-BHjBQH0J.js} +2 -2
  112. package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +1 -0
  113. package/dist/chunks/{flushGate-DgSDVGKZ.js → flushGate-DdJjxCes.js} +1 -1
  114. package/dist/chunks/gemini-DHv2iVfy.js +1 -0
  115. package/dist/chunks/generateSessionName-DhS_6oHd.js +1 -0
  116. package/dist/chunks/{genericProcessUtils-CmsUPyRz.js → genericProcessUtils-B2HcDYhg.js} +1 -1
  117. package/dist/chunks/git-DBlOv64X.js +6 -0
  118. package/dist/chunks/git-DF4RFFaT.js +1 -0
  119. package/dist/chunks/githubRepoPathMapping-CK56bUDe.js +1 -0
  120. package/dist/chunks/{goal-ZmSRBx4q.js → goal-BZG4gtnb.js} +3 -3
  121. package/dist/chunks/{grok-BXMvezWb.js → grok-BS57ZhyW.js} +1 -1
  122. package/dist/chunks/{grove-CeOjTaY6.js → grove-_zlQ83yR.js} +2 -2
  123. package/dist/chunks/{help-5DNZO6_H.js → help-C_2tdXHC.js} +1 -1
  124. package/dist/chunks/{hooks-C637tFtd.js → hooks-C7Bn7MBe.js} +2 -2
  125. package/dist/chunks/hooks-DT80Arzc.js +1 -0
  126. package/dist/chunks/{initReplBridge-D1h10vQ9.js → initReplBridge-NkZRcM77.js} +1 -1
  127. package/dist/chunks/{install-C-6ItpH0.js → install-Du-DSVzj.js} +1 -1
  128. package/dist/chunks/{instrumentation-DaiPDUst.js → instrumentation-DMs3b82f.js} +5 -5
  129. package/dist/chunks/{job-BeYzQUiR.js → job-rbX1VZmp.js} +1 -1
  130. package/dist/chunks/jwtUtils-OzxN2zts.js +1 -0
  131. package/dist/chunks/keybindings-CwdC_8S0.js +2 -0
  132. package/dist/chunks/{launchLocalMemory-CE4J98xO.js → launchLocalMemory-BLRCK1_o.js} +2 -2
  133. package/dist/chunks/{launchOnboarding-BfTdC6vp.js → launchOnboarding-Al_X75Vz.js} +1 -1
  134. package/dist/chunks/{loadAgentsDir-C7lOqvfh.js → loadAgentsDir-BL93ulMm.js} +619 -619
  135. package/dist/chunks/loadAgentsDir-eVKq8efm.js +1 -0
  136. package/dist/chunks/loadPluginHooks-B0au35a4.js +1 -0
  137. package/dist/chunks/{localSearch-BKrznW5x.js → localSearch-C5ipegd9.js} +1 -1
  138. package/dist/chunks/localSearch-CZlFfR_X.js +1 -0
  139. package/dist/chunks/{log-CezCRpAN.js → log-Dauqle-Z.js} +1 -1
  140. package/dist/chunks/{logoV2Utils-BkQfyQ1-.js → logoV2Utils-CkvOihX7.js} +1 -1
  141. package/dist/chunks/{magicDocs-BpVcON9o.js → magicDocs-DLav5QK0.js} +3 -3
  142. package/dist/chunks/main-CVNWNAoh.js +513 -0
  143. package/dist/chunks/{main-CvOv59-7.js → main-LMyE3jXY.js} +2 -2
  144. package/dist/chunks/managedEnv-CYepSnm8.js +1 -0
  145. package/dist/chunks/{managedEnv-DhWRJ5DK.js → managedEnv-DJSCuqCb.js} +1 -1
  146. package/dist/chunks/{mappers-bOab8ipV.js → mappers-DQxMcezy.js} +1 -1
  147. package/dist/chunks/mcp-BAbbEaBA.js +1 -0
  148. package/dist/chunks/mcp-Ct4Sum6A.js +6 -0
  149. package/dist/chunks/{mcp-VcGPYCkW.js → mcp-D5HkCqUh.js} +2 -2
  150. package/dist/chunks/{memoize-DsqYrbeR.js → memoize-FeyE7JEh.js} +1 -1
  151. package/dist/chunks/memory-COa7aUbx.js +1 -0
  152. package/dist/chunks/{mode-DlKnUM8l.js → mode-Bl2RZC8M.js} +2 -2
  153. package/dist/chunks/model-B7rtZ7KV.js +1 -0
  154. package/dist/chunks/{model-BsZ4sP_H.js → model-Bgh_r4lg.js} +1 -1
  155. package/dist/chunks/model-DiuEAv6h.js +1 -0
  156. package/dist/chunks/{modelOptions-CxP067Qv.js → modelOptions-BtEZe5BB.js} +1 -1
  157. package/dist/chunks/nativeInstaller-BEwayifa.js +1 -0
  158. package/dist/chunks/omit--yH_T4rf.js +1 -0
  159. package/dist/chunks/onChangeAppState-ZdwI7boX.js +1 -0
  160. package/dist/chunks/{openai-B9C2XN5Q.js → openai-DWs4D-nQ.js} +3 -3
  161. package/dist/chunks/panel-CoNfXy3K.js +1 -0
  162. package/dist/chunks/{parser-BwPXQomy.js → parser-BH4u7QiV.js} +1 -1
  163. package/dist/chunks/parser-BMIaRErw.js +1 -0
  164. package/dist/chunks/{partition-D-UhsUCx.js → partition-DLcW5Oo_.js} +1 -1
  165. package/dist/chunks/permissions-CaucYK3s.js +3 -0
  166. package/dist/chunks/pidLock-DgOBc1Xo.js +3 -0
  167. package/dist/chunks/{plan-CyU2zrCK.js → plan-BNYDTnQd.js} +1 -1
  168. package/dist/chunks/{platform-BMPbglug.js → platform-B0uTQc9P.js} +1 -1
  169. package/dist/chunks/plugin-BN-of1_H.js +17 -0
  170. package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +1 -0
  171. package/dist/chunks/pluginBlocklist-DXQlbG0P.js +1 -0
  172. package/dist/chunks/pluginCliCommands-CfdVNs8D.js +1 -0
  173. package/dist/chunks/pluginFlagging-DcJ_FQuv.js +1 -0
  174. package/dist/chunks/pluginOperations-DnhzFbYI.js +2 -0
  175. package/dist/chunks/pluginStartupCheck-CKBFaMFr.js +1 -0
  176. package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +1 -0
  177. package/dist/chunks/plugins-CBW7kPyp.js +4 -0
  178. package/dist/chunks/{poorMode-DEwQOAJt.js → poorMode-B_xEvuEV.js} +1 -1
  179. package/dist/chunks/poorMode-yH1o41cQ.js +1 -0
  180. package/dist/chunks/{print-eCRv_Li-.js → print-BZOx09SU.js} +16 -16
  181. package/dist/chunks/processBashCommand-dcCNCiBp.js +1 -0
  182. package/dist/chunks/processSlashCommand-YDiM63Qr.js +5 -0
  183. package/dist/chunks/prompt-CXGy0llt.js +1 -0
  184. package/dist/chunks/prompt-DovNDmcx.js +1 -0
  185. package/dist/chunks/{prompt-M2lu8_Oa.js → prompt-Dx7IWhBt.js} +2 -2
  186. package/dist/chunks/{promptEditor-DhcZY-iu.js → promptEditor-WCkmpejM.js} +2 -2
  187. package/dist/chunks/{protocolHandler-CkFaJKKo.js → protocolHandler-BiVWrpHi.js} +4 -4
  188. package/dist/chunks/{proxy-CuMaO_YV.js → proxy-CVn7o19p.js} +3 -3
  189. package/dist/chunks/reconciler-C2Nd_e4n.js +1 -0
  190. package/dist/chunks/refresh-B84H2Ezd.js +1 -0
  191. package/dist/chunks/{registerProtocol-CsNYRZKr.js → registerProtocol-E0Iu5hEx.js} +2 -2
  192. package/dist/chunks/{reload-plugins-B7JAE3b4.js → reload-plugins-D-3AUT9g.js} +1 -1
  193. package/dist/chunks/{remoteBridgeCore-CFLJhsB6.js → remoteBridgeCore-CV6we3ZA.js} +1 -1
  194. package/dist/chunks/remoteManagedSettings-D26Q09-7.js +1 -0
  195. package/dist/chunks/{rename-BCp2Vtqu.js → rename-CSavuBIE.js} +1 -1
  196. package/dist/chunks/{renderOptions-Q5oCLFIC.js → renderOptions-DDLbSMQU.js} +1 -1
  197. package/dist/chunks/resume-CROylN3J.js +2 -0
  198. package/dist/chunks/ripgrep-2M1GkXqJ.js +1 -0
  199. package/dist/chunks/{ripgrep-DvOOsDMv.js → ripgrep-C1ydIMzT.js} +5 -5
  200. package/dist/chunks/{runtimeObserver-CS_3BDNo.js → runtimeObserver-L7pSIWBT.js} +2 -2
  201. package/dist/chunks/{runtimeObserver-DYUva6g-.js → runtimeObserver-OU8KrZQG.js} +1 -1
  202. package/dist/chunks/sandbox-adapter-6UwMLh6e.js +1 -0
  203. package/dist/chunks/{sandbox-toggle--zNSKce_.js → sandbox-toggle-YrQNWGsr.js} +1 -1
  204. package/dist/chunks/searchExtraTools-Bdv5HJ74.js +1 -0
  205. package/dist/chunks/{session-CO3gEqQP.js → session-DUYsfPy_.js} +2 -2
  206. package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +1 -0
  207. package/dist/chunks/sessionObserver-B0zucj_c.js +1 -0
  208. package/dist/chunks/{sessionObserver-YkRHC-Aa.js → sessionObserver-Dv3Ba8eA.js} +2 -2
  209. package/dist/chunks/{sessionState-Bifmu95-.js → sessionState-D-SaBzWD.js} +2 -2
  210. package/dist/chunks/sessionStorage-BM1x51Z7.js +1 -0
  211. package/dist/chunks/{sessionTitle-COBSgSXS.js → sessionTitle-uCuYaNif.js} +2 -2
  212. package/dist/chunks/{sessionTracing-BrNx1k2V.js → sessionTracing-Bqb3vJTt.js} +3 -3
  213. package/dist/chunks/settings-BG15IFYx.js +1 -0
  214. package/dist/chunks/settings-D4CpDv2y.js +20 -0
  215. package/dist/chunks/settingsSync-BSrpnyqo.js +1 -0
  216. package/dist/chunks/setup-C62oq4AZ.js +3 -0
  217. package/dist/chunks/{shadowedRuleDetection-DEaw-X5j.js → shadowedRuleDetection-BzAZ57p2.js} +1 -1
  218. package/dist/chunks/{shellQuote-BYeOv3Ip.js → shellQuote-DS6WrivY.js} +2 -2
  219. package/dist/chunks/{sideQuestion-D0OKljee.js → sideQuestion-CvMBBjI8.js} +2 -2
  220. package/dist/chunks/sinks-WJ7nzLQs.js +1 -0
  221. package/dist/chunks/sinks-f7qYjbKJ.js +2 -0
  222. package/dist/chunks/skillChangeDetector-U5kRU5nd.js +1 -0
  223. package/dist/chunks/{skillGapStore-N_kmvXML.js → skillGapStore-CqaT8c0C.js} +2 -2
  224. package/dist/chunks/{skillLifecycle-C4F5RXuh.js → skillLifecycle-CnR8IqJM.js} +2 -2
  225. package/dist/chunks/skillSearchPanel-D9qrOXpI.js +21 -0
  226. package/dist/chunks/{skills-C4CTRN9o.js → skills-BgcFh0vy.js} +1 -1
  227. package/dist/chunks/startupProfiler-B4HBBbHN.js +1 -0
  228. package/dist/chunks/{startupProfiler-L_UWZ03w.js → startupProfiler-CmH_aVy2.js} +2 -2
  229. package/dist/chunks/{stats-IzV0_vEc.js → stats-B8uQ-UDi.js} +1 -1
  230. package/dist/chunks/{status-CeVP_uDT.js → status-BekdWoIj.js} +1 -1
  231. package/dist/chunks/status-D6KlRJmR.js +2 -0
  232. package/dist/chunks/{statusNoticeHelpers-Bb9gxdSt.js → statusNoticeHelpers-BMM8_uJ1.js} +1 -1
  233. package/dist/chunks/{stringUtils-C84IJ91d.js → stringUtils-C8PaYpQF.js} +1 -1
  234. package/dist/chunks/switcher-Ck9CrXrr.js +1 -0
  235. package/dist/chunks/{switcher-CCs9xl1z.js → switcher-DnAhkyIn.js} +1 -1
  236. package/dist/chunks/syncCache-ClP9aBqK.js +1 -0
  237. package/dist/chunks/{tasks-DZDhgx0w.js → tasks-Dmh6qikm.js} +1 -1
  238. package/dist/chunks/teleport-DH3IuAUQ.js +1 -0
  239. package/dist/chunks/{templateJobs-CrNPEKkh.js → templateJobs-CxqU-s5i.js} +1 -1
  240. package/dist/chunks/{terminalSetup-CBqcwQll.js → terminalSetup-BKGcmlWp.js} +1 -1
  241. package/dist/chunks/{terminalSetup-D-N8YPiQ.js → terminalSetup-Cy19F1Js.js} +4 -4
  242. package/dist/chunks/{theme-Dazsirbw.js → theme-U7lMFHQ0.js} +1 -1
  243. package/dist/chunks/{tmux-DewYVEBm.js → tmux-D5EvHWi3.js} +1 -1
  244. package/dist/chunks/{toolEventObserver-lnHJ9fLQ.js → toolEventObserver-D9qjoVl5.js} +1 -1
  245. package/dist/chunks/toolPool-69mfSPAs.js +1 -0
  246. package/dist/chunks/trustedDevice-B6AKlsl_.js +1 -0
  247. package/dist/chunks/trustedDevice-DL0pWP4_.js +1 -0
  248. package/dist/chunks/{types-3j8PS-Du.js → types-DafcFtmb.js} +2 -2
  249. package/dist/chunks/udsClient-CWnfsgFP.js +1 -0
  250. package/dist/chunks/{updateCCB-BPe9_FW6.js → updateCCB-C6XftzIG.js} +6 -6
  251. package/dist/chunks/{upstreamproxy-DF00RzGG.js → upstreamproxy-CXmjxHpl.js} +2 -2
  252. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js → useExitOnCtrlCDWithKeybindings-DEEJhm_W.js} +1 -1
  253. package/dist/chunks/useMainLoopModel-6w7mhwhU.js +1 -0
  254. package/dist/chunks/useManagePlugins-CjnsO-Of.js +1 -0
  255. package/dist/chunks/{useMergedTools-Dk5cPqLc.js → useMergedTools-DbhqKk1-.js} +1 -1
  256. package/dist/chunks/{useSearchInput-C7Y1I9P9.js → useSearchInput-gUDbkLaC.js} +1 -1
  257. package/dist/chunks/{useSettingsErrors-DAEO7AyB.js → useSettingsErrors-CgPad-H0.js} +1 -1
  258. package/dist/chunks/{userAgent-CIq27vUR.js → userAgent-CU7Ndh79.js} +1 -1
  259. package/dist/chunks/util-B4oMhJKh.js +1 -0
  260. package/dist/chunks/validatePlugin-y_O_tCEL.js +1 -0
  261. package/dist/chunks/{vim-EYQn94Kx.js → vim-w37BfGZ5.js} +1 -1
  262. package/dist/chunks/{which-DzFN5TNM.js → which-BRWBO7Gu.js} +1 -1
  263. package/dist/chunks/windowsPaths-BY-IVNwQ.js +1 -0
  264. package/dist/chunks/windowsPaths-DtWHLjmE.js +1 -0
  265. package/dist/chunks/{workSecret-DUqdPy44.js → workSecret-BEhXgH2M.js} +1 -1
  266. package/dist/chunks/{workerRegistry-C07BcZIw.js → workerRegistry-Bq9bS5pw.js} +5 -5
  267. package/dist/chunks/worktree-4SUJ4dtz.js +1 -0
  268. package/dist/cli.js +1 -1
  269. package/package.json +2 -3
  270. package/dist/chunks/App-C2yQjBgY.js +0 -1
  271. package/dist/chunks/ApproveApiKey-CKbv5C1x.js +0 -1
  272. package/dist/chunks/ApproveApiKey-MscC-ssL.js +0 -1
  273. package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +0 -2
  274. package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +0 -1
  275. package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +0 -1
  276. package/dist/chunks/Doctor-DmgAwce2.js +0 -1
  277. package/dist/chunks/Doctor-jEs9chPk.js +0 -3
  278. package/dist/chunks/ExitFlow-DVKxFdpX.js +0 -2
  279. package/dist/chunks/InvalidConfigDialog-o9DF1REI.js +0 -1
  280. package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +0 -1
  281. package/dist/chunks/MCPToolListView-CvqB4nCw.js +0 -1
  282. package/dist/chunks/MessageSelector-BLzw172f.js +0 -3
  283. package/dist/chunks/Messages-4K5sLmNh.js +0 -11
  284. package/dist/chunks/QueryEngine-DPHLSsax.js +0 -1
  285. package/dist/chunks/REPL-Bf46iQCN.js +0 -1
  286. package/dist/chunks/REPL-DIaAo9M9.js +0 -133
  287. package/dist/chunks/ResumeConversation-Br2KsBoe.js +0 -1
  288. package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +0 -1
  289. package/dist/chunks/Settings-BMXysXIx.js +0 -2
  290. package/dist/chunks/TeleportRepoMismatchDialog-B5I73j7Y.js +0 -1
  291. package/dist/chunks/add-dir-CZ6Clvq8.js +0 -1
  292. package/dist/chunks/agents-DHnNg4h6.js +0 -103
  293. package/dist/chunks/allErrors-CU89tF-z.js +0 -1
  294. package/dist/chunks/api-BSeE6MwB.js +0 -1
  295. package/dist/chunks/auth-BIGJth5U.js +0 -1
  296. package/dist/chunks/auth-CDQMhIZP.js +0 -1
  297. package/dist/chunks/autonomyPanel-DnHpuiy4.js +0 -1
  298. package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +0 -17
  299. package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +0 -1
  300. package/dist/chunks/bg-50rllUNh.js +0 -1
  301. package/dist/chunks/bridgeConfig-BeqChxJC.js +0 -1
  302. package/dist/chunks/btw-DSK9R2C8.js +0 -1
  303. package/dist/chunks/caches-BTQAW9zc.js +0 -1
  304. package/dist/chunks/caches-BVtSCnV1.js +0 -1
  305. package/dist/chunks/ccrClient-Bu7Tf1Z5.js +0 -1
  306. package/dist/chunks/client-BWQ4-rN7.js +0 -1
  307. package/dist/chunks/client-c-3-PW1F.js +0 -1
  308. package/dist/chunks/commands-Bi7k3Wg-.js +0 -1
  309. package/dist/chunks/compact-J-h0Yf4b.js +0 -2
  310. package/dist/chunks/config-yyFe87vW.js +0 -1
  311. package/dist/chunks/context-Tb1Ca2Q-.js +0 -1
  312. package/dist/chunks/context-noninteractive-soPYKAc9.js +0 -1
  313. package/dist/chunks/conversation-CSEtUxOY.js +0 -1
  314. package/dist/chunks/conversation-Dk1WDQuN.js +0 -1
  315. package/dist/chunks/createSession-DkT1GL8y.js +0 -1
  316. package/dist/chunks/createSession-eE8mswkv.js +0 -1
  317. package/dist/chunks/crossProjectResume-04n3Ppy9.js +0 -40
  318. package/dist/chunks/debug-RAynG_nM.js +0 -39
  319. package/dist/chunks/detectRepository-DgpNd87p.js +0 -1
  320. package/dist/chunks/detectRepository-ctF9KDbb.js +0 -1
  321. package/dist/chunks/doctor-B-Wag4C1.js +0 -1
  322. package/dist/chunks/execSyncWrapper-BTZJjCuv.js +0 -1
  323. package/dist/chunks/exit-BtW7LfRX.js +0 -1
  324. package/dist/chunks/extractMemories-CUrdiNcr.js +0 -1
  325. package/dist/chunks/fast-C60p6AqJ.js +0 -1
  326. package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +0 -1
  327. package/dist/chunks/gemini-BwvSxGgn.js +0 -1
  328. package/dist/chunks/generateSessionName-DlrdedOk.js +0 -1
  329. package/dist/chunks/git-2c7WlGDL.js +0 -6
  330. package/dist/chunks/git-XtKbtJMc.js +0 -1
  331. package/dist/chunks/githubRepoPathMapping-DbWG4hFQ.js +0 -1
  332. package/dist/chunks/hooks-DWg07LmS.js +0 -1
  333. package/dist/chunks/jwtUtils-CUPXdX3W.js +0 -1
  334. package/dist/chunks/keybindings-DgIPdBy9.js +0 -2
  335. package/dist/chunks/loadAgentsDir-zikjxLvn.js +0 -1
  336. package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +0 -1
  337. package/dist/chunks/localSearch-ZFyFy5FN.js +0 -1
  338. package/dist/chunks/main-9r5gLzUW.js +0 -605
  339. package/dist/chunks/managedEnv-B61yLpwp.js +0 -1
  340. package/dist/chunks/mcp-BckPBjaM.js +0 -6
  341. package/dist/chunks/mcp-CS1DA3JL.js +0 -1
  342. package/dist/chunks/memory-C5ohwh-T.js +0 -1
  343. package/dist/chunks/model-BGu1AGq0.js +0 -1
  344. package/dist/chunks/model-D19IIcll.js +0 -1
  345. package/dist/chunks/nativeInstaller-QB8cEJ18.js +0 -1
  346. package/dist/chunks/omit-DDUIPHnl.js +0 -1
  347. package/dist/chunks/onChangeAppState-RBl6H7ho.js +0 -1
  348. package/dist/chunks/panel-KW-wmEvU.js +0 -1
  349. package/dist/chunks/parser-xSBaQRLH.js +0 -1
  350. package/dist/chunks/permissions-BoLXYN1j.js +0 -3
  351. package/dist/chunks/pidLock-nJHbufJN.js +0 -3
  352. package/dist/chunks/plugin-C6-GQke5.js +0 -17
  353. package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +0 -1
  354. package/dist/chunks/pluginBlocklist-n6Imlh3y.js +0 -1
  355. package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +0 -1
  356. package/dist/chunks/pluginFlagging-DZaYzecY.js +0 -1
  357. package/dist/chunks/pluginOperations-D90IRawu.js +0 -2
  358. package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +0 -1
  359. package/dist/chunks/pluginStartupCheck-CB2q2dLv.js +0 -1
  360. package/dist/chunks/plugins-B9eSjLSA.js +0 -4
  361. package/dist/chunks/poorMode-BAnubpn1.js +0 -1
  362. package/dist/chunks/processBashCommand-B5F2Cl7K.js +0 -1
  363. package/dist/chunks/processSlashCommand-BC_D3cH5.js +0 -5
  364. package/dist/chunks/prompt-C1JPqinc.js +0 -1
  365. package/dist/chunks/prompt-DZhBz_Vu.js +0 -1
  366. package/dist/chunks/reconciler-B4GDm_iC.js +0 -1
  367. package/dist/chunks/refresh-DBVizOzg.js +0 -1
  368. package/dist/chunks/remoteManagedSettings-xh_MViZH.js +0 -1
  369. package/dist/chunks/resume-DVCSzKvv.js +0 -2
  370. package/dist/chunks/ripgrep-e-iewvTf.js +0 -1
  371. package/dist/chunks/sandbox-adapter-BFZFHplu.js +0 -1
  372. package/dist/chunks/searchExtraTools-ui5y2VSE.js +0 -1
  373. package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +0 -1
  374. package/dist/chunks/sessionObserver-Ba7um95p.js +0 -1
  375. package/dist/chunks/sessionStorage-CedwLLQs.js +0 -1
  376. package/dist/chunks/settings-DkDH7WQT.js +0 -1
  377. package/dist/chunks/settings-DnptdP79.js +0 -20
  378. package/dist/chunks/settingsSync-PmU7SmkU.js +0 -1
  379. package/dist/chunks/setup-BEsBuzsk.js +0 -3
  380. package/dist/chunks/sinks-BJHgxz6Y.js +0 -1
  381. package/dist/chunks/sinks-D5-yhcgU.js +0 -2
  382. package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +0 -1
  383. package/dist/chunks/skillSearchPanel-CftorvAM.js +0 -21
  384. package/dist/chunks/startupProfiler-D4FBdEQr.js +0 -1
  385. package/dist/chunks/status-Dzuw3hBv.js +0 -2
  386. package/dist/chunks/switcher-4KzBvuKH.js +0 -1
  387. package/dist/chunks/syncCache-CBRiRU5x.js +0 -1
  388. package/dist/chunks/teleport-Bw0jSxe9.js +0 -1
  389. package/dist/chunks/toolPool-CkXFlqsn.js +0 -1
  390. package/dist/chunks/trustedDevice-CFf5yaG-.js +0 -1
  391. package/dist/chunks/trustedDevice-CuwSv8dG.js +0 -1
  392. package/dist/chunks/udsClient-e9dIkwVA.js +0 -1
  393. package/dist/chunks/useMainLoopModel-2-eujv0n.js +0 -1
  394. package/dist/chunks/useManagePlugins-CYBIkaB1.js +0 -1
  395. package/dist/chunks/util-VO98TdOz.js +0 -1
  396. package/dist/chunks/validatePlugin-Kk6pxnO2.js +0 -1
  397. package/dist/chunks/windowsPaths-BU3yQWTB.js +0 -1
  398. package/dist/chunks/windowsPaths-DgZ3YY4a.js +0 -1
  399. package/dist/chunks/worktree-dFUkhVE_.js +0 -1
@@ -0,0 +1,513 @@
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DaDcL9Zw.js";import{n as o,t as s}from"./memoize-BK3gG5ob.js";import{a as c,d as l,f as u,l as d,o as f,s as p,u as m}from"./envUtils-BDhHQY0-.js";import{n as h,t as g}from"./defineProperty-C-QyHrDq.js";import{n as _,t as ee}from"./axios-DaWTGg7G.js";import{$T as te,$d as v,$s as ne,$u as re,$x as ie,AT as ae,Au as y,Ax as b,B_ as oe,Ba as se,Bi as ce,Bw as le,C as ue,Cc as de,Co as fe,Cr as pe,Ct as me,Cu as he,Du as ge,Ei as _e,Et as ve,Eu as ye,Ex as be,F as xe,FT as Se,Fi as Ce,Fp as we,Fx as Te,Gx as Ee,HS as x,HT as De,Hx as Oe,In as ke,Is as Ae,Ix as je,JT as Me,Ji as S,Kl as Ne,L_ as Pe,Ld as Fe,Li as Ie,Ln as Le,Lx as Re,M as ze,MT as Be,Mf as Ve,Mh as He,Mn as C,Mv as Ue,Mx as We,NT as Ge,Nc as Ke,Nf as qe,Nh as Je,Nx as Ye,O as Xe,OT as Ze,Ox as w,PT as Qe,Pc as $e,Pf as et,Pp as tt,Px as nt,RT as rt,Rh as it,Rs as at,Rx as ot,SE as st,Sa as ct,Sb as lt,So as ut,Su as dt,T as ft,Ta as pt,Ti as mt,To as ht,Tt as gt,UT as _t,Un as vt,Ux as yt,VS as bt,V_ as xt,Vh as St,Vx as Ct,Ww as wt,Wx as Tt,Yh as Et,Yw as Dt,Zx as Ot,_E as kt,_c as At,_p as jt,_u as Mt,aS as Nt,af as T,at as Pt,bb as Ft,bc as It,bg as Lt,bl as E,bu as D,bv as Rt,cS as zt,c_ as O,cf as k,cs as A,cx as Bt,dS as Vt,df as Ht,do as Ut,dr as Wt,du as Gt,dw as Kt,eE as qt,ec as Jt,ed as Yt,ef as Xt,el as Zt,ex as Qt,f as $t,fS as en,ff as tn,gE as nn,gf as rn,gi as an,hS as on,hf as sn,hi as cn,hl as ln,hr as un,i as dn,iS as fn,if as pn,it as mn,jd as hn,ji as gn,ju as _n,jv as vn,jx as yn,kT as bn,kt as xn,kx as Sn,ly as Cn,mE as j,mS as wn,mf as Tn,ml as En,mp as Dn,nS as On,nd as kn,o as M,oS as An,oc as jn,of as Mn,om as Nn,os as Pn,ox as Fn,oy as In,pE as Ln,pf as Rn,po as zn,pu as Bn,qT as Vn,qh as Hn,qi as Un,ql as Wn,qw as Gn,r as Kn,rS as qn,rc as Jn,rd as Yn,rf as Xn,s as Zn,s_ as Qn,sf as $n,si as er,sm as tr,so as nr,sx as rr,tS as ir,tc as ar,tf as or,tl as sr,uS as cr,uf as lr,uu as ur,uw as dr,v as fr,vE as pr,vb as mr,vc as hr,vu as gr,w as _r,wb as vr,wo as yr,wu as br,wx as xr,xE as Sr,xS as Cr,xf as wr,xg as Tr,xl as Er,xu as Dr,xv as Or,y as kr,yE as Ar,yS as jr,yf as Mr,yu as Nr,yv as Pr,z_ as Fr,zh as Ir,zx as Lr}from"./loadAgentsDir-BL93ulMm.js";import{B as Rr,D as zr,I as Br,Lt as Vr,P as Hr,R as Ur,T as Wr,di as Gr,fi as Kr,rr as qr,t as Jr,ui as N,xr as Yr,y as Xr}from"./src-P_wYS_NJ2.js";import{t as Zr}from"./jsx-runtime-Bb4Xn-E0.js";import{A as P,M as Qr,O as $r,j as ei,l as ti,p as ni,u as ri,w as ii}from"./external-CEp-aPkt.js";import{n as ai,r as oi,t as si}from"./lazySchema-B4D4qJVE.js";import{$n as ci,Bn as li,Cn as ui,F as di,J as fi,Jn as pi,Kn as mi,Mn as hi,Nn as gi,Pn as _i,Qn as vi,Sn as yi,Wt as bi,Yn as xi,Zn as Si,_r as Ci,bn as wi,dn as Ti,dt as Ei,er as Di,et as Oi,fn as ki,ft as Ai,gn as ji,gr as Mi,in as Ni,ln as Pi,nr as Fi,on as Ii,or as Li,pt as Ri,xn as zi,z as Bi}from"./state-BemZdQIl.js";import{n as Vi,t as Hi}from"./cwd-Cfdf7z7s.js";import{B as Ui,C as Wi,F as Gi,M as Ki,O as qi,P as F,R as Ji,S as Yi,T as Xi,U as Zi,c as I,f as Qi,g as $i,i as ea,l as ta,nt as na,tt as ra,u as ia,x as aa}from"./debug-BecbSVoN.js";import{Bt as oa,J as sa,Ln as ca,Mt as la,O as ua,Q as da,Rn as fa,S as pa,T as ma,c as ha,dn as ga,f as _a,g as L,h as va,i as ya,k as ba,ln as xa,n as Sa,u as Ca,x as R}from"./settings-D4CpDv2y.js";import{M as wa,P as Ta,T as Ea,_ as Da,c as z,g as Oa,h as B,k as ka,n as Aa,o as ja,p as Ma,r as Na,s as Pa,v as Fa,w as Ia,y as V}from"./config-aRiTrtCv.js";import{a as La,n as Ra,r as za}from"./process-gEbdy6uY.js";import{O as Ba,f as Va,i as Ha,k as H,l as Ua,m as Wa,u as Ga}from"./git-DBlOv64X.js";import{c as Ka,o as qa}from"./execFileNoThrow-DHyW8FMX.js";import{d as Ja,f as Ya,o as Xa,s as U}from"./log-Dauqle-Z.js";import{n as Za,t as Qa}from"./which-BRWBO7Gu.js";import{i as $a,o as eo}from"./platform-B0uTQc9P.js";import{i as to,o as no}from"./windowsPaths-DtWHLjmE.js";import{s as ro,u as io}from"./types-DafcFtmb.js";import{n as W,r as G}from"./analytics-DJobLaWP.js";import{i as ao,n as oo,r as K}from"./startupProfiler-CmH_aVy2.js";import{l as so,s as co,u as lo}from"./oauth-C9VBDB0Y.js";import{n as uo,t as fo}from"./bundledMode--fG1S62b.js";import{l as po,o as mo}from"./stringUtils-C8PaYpQF.js";import{$t as ho,Bt as go,C as _o,Dn as vo,Fr as yo,Ft as bo,Gr as xo,Jn as So,Kn as Co,Ot as wo,Rr as To,S as Eo,Sr as Do,Vn as Oo,Xt as ko,Yn as Ao,Z as jo,_ as Mo,ai as No,an as Po,ar as Fo,b as Io,bn as Lo,en as Ro,et as zo,g as Bo,in as Vo,ir as Ho,jn as Uo,lt as Wo,nr as Go,o as Ko,pn as qo,qr as Jo,rr as Yo,rt as Xo,si as Zo,ut as Qo,v as $o,xn as es,xr as ts,xt as ns,yn as rs,zt as is}from"./model-Bgh_r4lg.js";import{Dt as as,Mt as os,Nt as ss,Yt as cs,at as ls,jt as us,ot as ds,qt as fs,st as ps}from"./prompt-Dx7IWhBt.js";import{f as ms,h as hs,l as gs,n as _s}from"./proxy-CVn7o19p.js";import{n as vs,t as ys}from"./userAgent-CU7Ndh79.js";import{A as bs,_ as xs,k as Ss,x as Cs}from"./sessionState-D-SaBzWD.js";import{n as ws,t as Ts}from"./partition-DLcW5Oo_.js";import{a as Es,n as Ds}from"./ripgrep-C1ydIMzT.js";import{c as Os}from"./switcher-DnAhkyIn.js";import{dt as ks,ft as As}from"./esm-Ka3lhafK.js";import{C as js,D as Ms,O as Ns,S as Ps}from"./sessionTracing-Bqb3vJTt.js";import{i as Fs,n as Is,o as Ls,r as Rs}from"./detectRepository-C15umvKN.js";import{c as zs,o as Bs,r as Vs}from"./api-BbJfMXRS.js";import{d as Hs,f as Us,l as Ws,p as Gs,u as Ks}from"./firstPartyEventLogger-BHjBQH0J.js";import{n as qs,t as Js}from"./worktreeModeEnabled-BFOYTTTr.js";import{a as Ys}from"./grove-_zlQ83yR.js";import{a as Xs,i as Zs,n as Qs,o as $s,r as ec}from"./remoteManagedSettings-D26Q09-7.js";import{n as tc,t as nc}from"./allErrors-_cOQksHC.js";import{n as rc,t as q}from"./exit-BOhGfSlm.js";import{n as ic,s as ac,t as oc}from"./pluginOperations-DnhzFbYI.js";import"./pluginCliCommands-CfdVNs8D.js";import{n as sc,r as cc,t as lc}from"./managedEnv-DJSCuqCb.js";import{n as uc}from"./onChangeAppState-ZdwI7boX.js";import{i as dc,t as fc}from"./skillChangeDetector-U5kRU5nd.js";import{n as pc}from"./stats-B8uQ-UDi.js";import{t as mc}from"./renderOptions-DDLbSMQU.js";import{i as hc,n as gc,t as _c}from"./githubRepoPathMapping-CK56bUDe.js";import{i as vc,n as yc}from"./earlyInput-IghoCjG5.js";import{t as bc}from"./banner-1Wyeyawe.js";import{c as xc,n as Sc,o as Cc,r as wc}from"./RemoteSessionManager-Bf44A0Ol.js";import{posix as Tc,resolve as Ec,win32 as Dc}from"path";import{appendFileSync as Oc,readFileSync as kc}from"fs";var Ac=a((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})),jc=a((e=>{var{InvalidArgumentError:t}=Ac(),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})),Mc=a((e=>{var{humanReadableArgName:t}=jc(),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
+ `)}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
+ `+` `.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})),Nc=a((e=>{var{InvalidArgumentError:t}=Ac(),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
+ - a short flag is a single dash and a single character
6
+ - either use a single dash and a single character (for a short flag)
7
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
8
+ - too many short flags`):i.test(t)?Error(`${n}
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})),Pc=a((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})),Fc=a((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}=jc(),{CommanderError:l}=Ac(),{Help:u,stripColor:d}=Mc(),{Option:f,DualOptions:p}=Nc(),{suggestSimilar:m}=Pc(),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:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(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
+ - 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
+ 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
+ - 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
+ - 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
+ - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
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=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
+ `),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 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 _(){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=_})),Ic=a((e=>{var{Argument:t}=jc(),{Command:n}=Fc(),{CommanderError:r,InvalidArgumentError:i}=Ac(),{Help:a}=Mc(),{Option:o}=Nc();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})),Lc=a(((e,t)=>{var n=Ic();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)}));s(),f(),h(),Mi(),bi(),ra(),Ji(),aa(),Qi(),Ra(),ea(),W(),oo(),ua(),Lo();var{program:Rc,createCommand:zc,createArgument:Bc,createOption:Vc,CommanderError:Hc,InvalidArgumentError:Uc,InvalidOptionArgumentError:Wc,Command:Gc,Argument:Kc,Option:J,Help:qc}=r(Lc(),1).default;ee();var Jc=r(Kr(),1);Gr();var Y=Zr();Jr(),oi(),Vi(),Ba(),Ka(),Xa(),Qa(),Wa(),eo(),to(),fa(),ro(),xa(),si(),fo(),da(),mo(),ma(),L(),wa(),Zo(),Ia(),B(),hs(),gs(),Jo(),yo(),ts(),Ho(),vs(),Go(),So(),Co(),Uo(),go(),Mo(),cs(),te(),Vn(),Es(),ae(),Dt(),x(),Cr(),en(),ie(),Te(),xr(),bs(),rr(),lt(),us(),ds(),Or(),O(),it(),Nn(),lr(),Us(),or(),Js(),sr(),hr(),yr(),fe(),Ut(),se(),Un(),ce(),_e(),pe(),ke(),mn(),lo(),Ja();var Yc=!1;function Xc(){if(Yc||(Yc=!0,Ya())||d(process.env.CLAUDE_CODE_USE_BEDROCK)||d(process.env.CLAUDE_CODE_USE_VERTEX)||d(process.env.CLAUDE_CODE_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.CLAUDE_CODE_CLIENT_CERT||process.env.CLAUDE_CODE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||so().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}function Zc(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=Qc();e&&(process.env.NODE_EXTRA_CA_CERTS=e,I(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function Qc(){try{let e=z()?.env,t=ha(`userSettings`)?.env;I(`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&&I(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){I(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}B(),ea(),Fs(),As(),f(),cc(),Ps(),Ns(),Ks();var $c=!1,el=o(async()=>{let e=Date.now();H(`info`,`init_started`),K(`init_function_start`);try{let t=Date.now();Na(),Rr({loadTheme:()=>z().theme,saveTheme:e=>V(t=>({...t,theme:e}))}),H(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),K(`init_configs_enabled`);let n=Date.now();sc();try{let{restoreActiveProvider:e}=await import(`./switcher-Ck9CrXrr.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)I(`[init] ${e}`)}catch(e){I(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}Zc(),H(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),K(`init_safe_env_vars_applied`),Xn(),K(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-BNBnLYPK.js`).then(e=>{e.initialize1PEventLogging()}),K(`init_after_1p_event_logging`),import(`./poller-CpLBoB-N.js`).then(e=>e.startBalancePolling()),K(`init_after_balance_polling`),To(),K(`init_after_oauth_populate`),ks(),K(`init_after_jetbrains_detection`),Is(),ec()&&Qs(),Rn()&&Ht(),K(`init_after_remote_settings_check`),Da();let r=Date.now();I(`[init] configureGlobalMTLS starting`),ms(),H(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),I(`[init] configureGlobalMTLS complete`);let i=Date.now();if(I(`[init] configureGlobalAgents starting`),_s(),H(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),I(`[init] configureGlobalAgents complete`),K(`init_network_configured`),await Ws(),Xc(),d(process.env.CLAUDE_CODE_REMOTE))try{let{initUpstreamProxy:e,getUpstreamProxyEnv:t}=await import(`./upstreamproxy-CXmjxHpl.js`),{registerUpstreamProxyEnvFn:n}=await import(`./subprocessEnv-CZkA9Cdp.js`);n(t),await e()}catch(e){I(`[init] upstreamproxy init failed: ${e instanceof Error?e.message:String(e)}; continuing without proxy`,{level:`warn`})}if(no(),na(St),Le()){let e=Date.now();await C(),H(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-2M1GkXqJ.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{I(`[init] ripgrep status check skipped`)}H(`info`,`init_completed`,{duration_ms:Date.now()-e}),K(`init_function_end`)}catch(e){if(e instanceof qi){if(Bi()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),Xt(1);return}return import(`./InvalidConfigDialog-bih293Xt.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function tl(){ec()?(Bi()&&js()&&nl().catch(e=>{I(`[3P telemetry] Eager telemetry init failed (beta tracing): ${F(e)}`,{level:`error`})}),I(`[3P telemetry] Waiting for remote managed settings before telemetry init`),$s().then(async()=>{I(`[3P telemetry] Remote managed settings loaded, initializing telemetry`),lc(),await nl()}).catch(e=>{I(`[3P telemetry] Telemetry init failed (remote settings path): ${F(e)}`,{level:`error`})})):nl().catch(e=>{I(`[3P telemetry] Telemetry init failed: ${F(e)}`,{level:`error`})})}async function nl(){if(!$c){if(!d(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)){$c=!0,I(`[3P telemetry] Skipped — CLAUDE_CODE_ENABLE_TELEMETRY not set`);return}$c=!0;try{await rl()}catch(e){throw $c=!1,e}}}async function rl(){let{initializeTelemetry:e}=await import(`./instrumentation-DMs3b82f.js`),t=await e();t&&(_i(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Ms(),...t};r?.add(e,n)}}}),Ai()?.add(1))}Fe();async function il(e,t,n,r){let{App:i}=await import(`./App-BuKmqFPm.js`),{REPL:a}=await import(`./REPL-DMaKNhTa.js`);await r(e,(0,Y.jsx)(i,{...t,children:(0,Y.jsx)(a,{...n})}))}Os(),lo(),B(),ea(),Ja();var al=ai(()=>ii({client_data:$r(P(),Qr()).nullish(),additional_model_options:ni(ii({model:P(),name:P(),description:P()}).transform(({model:e,name:t,description:n})=>({value:e,label:t,description:n}))).nullish()}));async function ol(){if(Ya())return I(`[Bootstrap] Skipped: Nonessential traffic disabled`),null;if(No()!==`firstParty`)return I(`[Bootstrap] Skipped: 3P provider`),null;let e=ns();if(!(wo()?.accessToken&&is())&&!e)return I(`[Bootstrap] Skipped: no usable OAuth or API key`),null;let t=`${so().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await Yo(async()=>{let n=wo()?.accessToken,r;if(n&&is())r={Authorization:`Bearer ${n}`,"anthropic-beta":co};else if(e)r={"x-api-key":e};else return I(`[Bootstrap] No auth available on retry, aborting`),null;I(`[Bootstrap] Fetching`);let i=await _.get(t,{headers:{"Content-Type":`application/json`,"User-Agent":ys(),...r},timeout:5e3}),a=al().safeParse(i.data);return a.success?(I(`[Bootstrap] Fetch ok`),a.data):(I(`[Bootstrap] Response failed validation: ${a.error.message}`),null)})}catch(e){throw I(`[Bootstrap] Fetch failed: ${_.isAxiosError(e)?e.response?.status??e.code:`unknown`}`),e}}async function sl(){try{let e=await ol();if(!e)return;let t=e.client_data??null,n=e.additional_model_options??[],r=z();if(Fo(r.clientDataCache,t)&&Fo(r.additionalModelOptionsCache,n)){I(`[Bootstrap] Cache unchanged, skipping write`);return}I(`[Bootstrap] Cache updated, persisting to disk`),V(e=>({...e,clientDataCache:t,additionalModelOptionsCache:n}))}catch(e){U(e)}}zo(),De(),he(),ea(),f();var cl=new Map;function ll(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;$a()===`windows`&&(e=e.split(Dc.sep).join(Tc.sep),t=t.split(Dc.sep).join(Tc.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 ul=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function dl(e){let t=`${e.name}: ${e.message}`;return ul.some(e=>e.test(t))}var fl=null;function pl(){let e=process.listeners(`warning`);fl&&e.includes(fl)||(ll()||process.removeAllListeners(`warning`),fl=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=cl.get(t)||0;(cl.has(t)||cl.size<1e3)&&cl.set(t,n+1);let r=dl(e);G(`tengu_node_warning`,{is_internal:+!!r,occurrence_count:n+1,classname:e.name}),d(process.env.CLAUDE_DEBUG)&&I(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,fl))}st(),Ln(),Yn(),re(),_n(),Jr();function ml(){return(0,Y.jsxs)(Hr,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Y.jsx)(Vr,{url:`https://code.claude.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}W(),L(),Jr();function hl({serverName:e,onDone:t}){function n(n){switch(G(`tengu_mcp_dialog_choice`,{choice:n}),n){case`yes`:case`yes_all`:{let r=(_a()||{}).enabledMcpjsonServers||[];r.includes(e)||R(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&R(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(_a()||{}).disabledMcpjsonServers||[];n.includes(e)||R(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Y.jsxs)(Xr,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Y.jsx)(ml,{}),(0,Y.jsx)(Yt,{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`)})]})}Ts(),W(),Jr(),L(),we();function gl({serverNames:e,onDone:t}){function n(n){let r=_a()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=ws(e,e=>n.includes(e));G(`tengu_mcp_multidialog_choice`,{approved:o.length,rejected:s.length}),o.length>0&&R(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&R(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,Jc.useCallback)(()=>{let n=(_a()||{}).disabledMcpjsonServers||[];R(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Xr,{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,Y.jsx)(ml,{}),(0,Y.jsx)(kn,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Y.jsx)(Br,{paddingX:1,children:(0,Y.jsx)(Hr,{dimColor:!0,italic:!0,children:(0,Y.jsxs)(Wr,{children:[(0,Y.jsx)(zr,{shortcut:`Space`,action:`select`}),(0,Y.jsx)(zr,{shortcut:`Enter`,action:`confirm`}),(0,Y.jsx)(tt,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}Tr();async function _l(e){let{servers:t}=cr(`project`),n=Object.keys(t).filter(e=>Ot(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,Y.jsx)(Lt,{children:(0,Y.jsx)(y,{children:(0,Y.jsx)(hl,{serverName:t,onDone:r})})}))}else e.render((0,Y.jsx)(Lt,{children:(0,Y.jsx)(y,{children:(0,Y.jsx)(gl,{serverNames:n,onDone:r})})}))})}la(),Cn(),Ue(),Et(),Dn(),Jn(),ar(),ue(),B(),ea();var vl={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function yl(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=vl[e.toLowerCase()];t&&z().deepLinkTerminal!==t&&(V(e=>({...e,deepLinkTerminal:t})),I(`Stored deep link terminal preference: ${t}`))}var bl=class{constructor(){g(this,`frameDurations`,[]),g(this,`firstRenderTime`,void 0),g(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}}};W(),or(),bi(),Jr(),_n(),Tr(),B(),f(),cc(),tc(),L();function xl(){V(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.11`}))}function Sl(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function X(e,t,n){return Cl(e,t,{color:`error`,beforeExit:n})}async function Cl(e,t,n){let{Text:r}=await import(`./src-r6ZFgWPx2.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Y.jsx)(r,{color:i,children:t}):(0,Y.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function Z(e,t,n){return Sl(e,e=>(0,Y.jsx)(Ur,{initialState:z().theme,onThemeSave:e=>V(t=>({...t,theme:e})),children:(0,Y.jsx)(Lt,{onChangeAppState:n?.onChangeAppState,children:(0,Y.jsx)(y,{children:t(e)})})}))}async function wl(e,t){e.render(t),Yu(),await e.waitUntilExit(),await v(0)}async function Tl(e,t,n,r){if(d(!1)||process.env.IS_DEMO)return!1;let i=z(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-BzuQjney.js`);await Z(e,e=>(0,Y.jsx)(t,{onDone:()=>{xl(),e()}}),{onChangeAppState:uc})}if(!d(process.env.CLAUBBIT)){if(!Aa()){let{TrustDialog:t}=await import(`./TrustDialog-ACaJ_m7A.js`);await Z(e,e=>(0,Y.jsx)(t,{commands:r,onDone:e}))}ci(!0),Pr();let{errors:t}=nc();if(t.length===0&&await _l(e),await vr()){let t=mr(await Ft(!0)),{ClaudeMdExternalIncludesDialog:n}=await import(`./ClaudeMdExternalIncludesDialog-D-w166RC.js`);await Z(e,e=>(0,Y.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(hc(),yl(),lc(),setImmediate(()=>tl()),await Ys()){let{GroveDialog:t}=await import(`./Grove-BDoVj02t.js`);if(await Z(e,e=>(0,Y.jsx)(t,{showIfAlreadyViewed:!1,location:a?`onboarding`:`policy_update_modal`,onDone:e}))===`escape`)return G(`tengu_grove_policy_exited`,{}),Xt(0),!1}if(process.env.ANTHROPIC_API_KEY&&!l()){let t=Do(process.env.ANTHROPIC_API_KEY);if(Pa(t)===`new`){let{ApproveApiKey:n}=await import(`./ApproveApiKey-CIWOi_7v.js`);await Z(e,e=>(0,Y.jsx)(n,{customApiKeyTruncated:t,onDone:e}),{onChangeAppState:uc})}}if((t===`bypassPermissions`||n)&&!va()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-B05t83wa.js`);await Z(e,e=>(0,Y.jsx)(t,{onAccept:e}))}return a}function El(e){let t=0,n=mc(e);n.stdin&&G(`tengu_stdin_interactive`,{});let r=new bl,i=pc();Di(i);let a=process.env.CLAUDE_CODE_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()})+`
20
+ `;Oc(a,t)}if(!qr())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&G(`tengu_flicker`,{desiredHeight:n.desiredHeight,actualHeight:n.availableHeight,reason:n.reason}),t=e}}}}}_n();async function Dl(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-Br8kQOHz.js`);return Z(e,e=>(0,Y.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function Ol(e){let{TeleportResumeWrapper:t}=await import(`./TeleportResumeWrapper-wPiIs8xg.js`);return Z(e,e=>(0,Y.jsx)(t,{onComplete:e,onCancel:()=>e(null),source:`cliArg`}))}async function kl(e,t){let{TeleportRepoMismatchDialog:n}=await import(`./TeleportRepoMismatchDialog-BZL8Zblz.js`);return Z(e,e=>(0,Y.jsx)(n,{targetRepo:t.targetRepo,initialPaths:t.initialPaths,onSelectPath:e,onCancel:()=>e(null)}))}async function Al(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-Ctw5Q1g9.js`),import(`./App-BuKmqFPm.js`)]);await wl(e,(0,Y.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Y.jsx)(y,{children:(0,Y.jsx)(a,{...r,worktreePaths:i})})}))}ss();var jl=5,Ml=30,Nl="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 Pl(e){return`# Batch: Parallel Work Orchestration
21
+
22
+ You are orchestrating a large, parallelizable change across this codebase.
23
+
24
+ ## User Instruction
25
+
26
+ ${e}
27
+
28
+ ## Phase 1: Research and Plan (Plan Mode)
29
+
30
+ Call the \`${os}\` tool now to enter plan mode, then:
31
+
32
+ 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.
33
+
34
+ 2. **Decompose into independent units.** Break the work into ${jl}–${Ml} self-contained units. Each unit must:
35
+ - Be independently implementable in an isolated git worktree (no shared state with sibling units)
36
+ - Be mergeable on its own without depending on another unit's PR landing first
37
+ - Be roughly uniform in size (split large units, merge trivial ones)
38
+
39
+ Scale the count to the actual work: few files → closer to ${jl}; hundreds of files → closer to ${Ml}. Prefer per-directory or per-module slicing over arbitrary file lists.
40
+
41
+ 3. **Determine the e2e test recipe.** Figure out how a worker can verify its change actually works end-to-end — not just that unit tests pass. Look for:
42
+ - A \`claude-in-chrome\` skill or browser-automation tool (for UI changes: click through the affected flow, screenshot the result)
43
+ - A \`tmux\` or CLI-verifier skill (for CLI changes: launch the app interactively, exercise the changed behavior)
44
+ - A dev-server + curl pattern (for API changes: start the server, hit the affected endpoints)
45
+ - An existing e2e/integration test suite the worker can run
46
+
47
+ If you cannot find a concrete e2e path, use the \`${as}\` 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.
48
+
49
+ 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.
50
+
51
+ 4. **Write the plan.** In your plan file, include:
52
+ - A summary of what you found during research
53
+ - A numbered list of work units — for each: a short title, the list of files/directories it covers, and a one-line description of the change
54
+ - The e2e test recipe (or "skip e2e because …" if the user chose that)
55
+ - The exact worker instructions you will give each agent (the shared template)
56
+
57
+ 5. Call \`${fs}\` to present the plan for approval.
58
+
59
+ ## Phase 2: Spawn Workers (After Plan Approval)
60
+
61
+ Once the plan is approved, spawn one background agent per work unit using the \`${sa}\` 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.
62
+
63
+ For each agent, the prompt must be fully self-contained. Include:
64
+ - The overall goal (the user's instruction)
65
+ - This unit's specific task (title, file list, change description — copied verbatim from your plan)
66
+ - Any codebase conventions you discovered that the worker needs to follow
67
+ - The e2e test recipe from your plan (or "skip e2e because …")
68
+ - The worker instructions below, copied verbatim:
69
+
70
+ \`\`\`
71
+ ${Nl}
72
+ \`\`\`
73
+
74
+ Use \`subagent_type: "general-purpose"\` unless a more specific agent type fits.
75
+
76
+ ## Phase 3: Track Progress
77
+
78
+ After launching all workers, render an initial status table:
79
+
80
+ | # | Unit | Status | PR |
81
+ |---|------|--------|----|
82
+ | 1 | <title> | running | — |
83
+ | 2 | <title> | running | — |
84
+
85
+ As background-agent completion notifications arrive, parse the \`PR: <url>\` line from each agent's result and re-render the table with updated status (\`done\` / \`failed\`) and PR links. Keep a brief failure note for any agent that did not produce a PR.
86
+
87
+ When all agents have reported, render the final table and a one-line summary (e.g., "22/24 units landed as PRs").
88
+ `}var Fl="This is not a git repository. The `/batch` command requires a git repo because it spawns agents in isolated git worktrees and creates PRs from each. Initialize a repo first, or run this from inside an existing one.",Il=`Provide an instruction describing the batch change you want to make.
89
+
90
+ Examples:
91
+ /batch migrate from react to vue
92
+ /batch replace all uses of lodash with native equivalents
93
+ /batch add type annotations to all untyped function parameters`;function Ll(){S({name:`batch`,description:`调研并规划一次大规模改动,然后并行投放到 5–30 个相互隔离的 worktree 智能体中执行,每个智能体各自开一个 PR。`,whenToUse:`当用户想对大量文件做横向的机械式改动(迁移、重构、批量改名),且这些改动可拆解为互不依赖的并行单元时使用。`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await Ua()?[{type:`text`,text:Pl(t)}]:[{type:`text`,text:Fl}]:[{type:`text`,text:Il}]}})}Ar(),si();var Rl=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],zl={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`},Bl=`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(`.`),Vl=ai(()=>ii({context:ti(Rl).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:$r(P().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),ei([ti(Bl),P().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),ri().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`));ai(()=>ii({$schema:P().optional().describe(`JSON Schema URL for editor validation`),$docs:P().optional().describe(`Documentation URL`),bindings:ni(Vl()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),Un();function Hl(){return au([`Context`,`Description`],Rl.map(e=>[`\`${e}\``,zl[e]]))}function Ul(){let e={};for(let t of Sr)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return au([`Action`,`Default Key(s)`,`Context`],Bl.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:Wl(t);return[`\`${t}\``,r,i]}))}function Wl(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 Gl(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of kt)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of pr)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 nn)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
94
+ `)}var Kl={$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.claude.com/docs/en/keybindings`,bindings:[{context:`Chat`,bindings:{"ctrl+e":`chat:externalEditor`}}]},ql={context:`Chat`,bindings:{"ctrl+s":null}},Jl={context:`Chat`,bindings:{"ctrl+g":null,"ctrl+e":`chat:externalEditor`}},Yl={context:`Global`,bindings:{"ctrl+k ctrl+t":`app:toggleTodos`}},Xl=[`# Keybindings Skill`,``,"Create or modify `~/.claude/keybindings.json` to customize keyboard shortcuts.",``,`## CRITICAL: Read Before Write`,``,"**Always read `~/.claude/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(`
95
+ `),Zl=[`## File Format`,``,"```json",Wi(Kl,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
96
+ `),Ql=[`## 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(`
97
+ `),$l=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",Wi(ql,null,2),"```"].join(`
98
+ `),eu=[`## 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(`
99
+ `),tu=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",Wi(Jl,null,2),"```",``,`### Add a chord binding`,"```json",Wi(Yl,null,2),"```"].join(`
100
+ `),nu=[`## 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(`
101
+ `),ru=[`## Validation with /doctor`,``,'The `/doctor` command includes a "Keybinding Configuration Issues" section that validates `~/.claude/keybindings.json`.',``,`### Common Issues and Fixes`,``,au([`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: ~/.claude/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(`
102
+ `);function iu(){S({name:`keybindings-help`,description:`当用户想自定义键盘快捷键、重新绑定按键、添加组合键(chord),或修改 ~/.claude/keybindings.json 时使用。例如:"rebind ctrl+s"、"add a chord shortcut"、"change the submit key"、"customize keybindings"。`,allowedTools:[`Read`],userInvocable:!1,isEnabled:j,async getPromptForCommand(e){let t=Hl(),n=Ul(),r=[Xl,Zl,Ql,$l,eu,tu,nu,ru,`## Reserved Shortcuts\n\n${Gl()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
103
+
104
+ `)}]}})}function au(e,t){let n=e.map(()=>`---`);return[`| ${e.join(` | `)} |`,`| ${n.join(` | `)} |`,...t.map(e=>`| ${e.join(` | `)} |`)].join(`
105
+ `)}Un();var ou=`# /ultracode — Workflow Orchestration Playbook
106
+
107
+ 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.
108
+
109
+ A workflow structures work across many agents — to be comprehensive (decompose and cover in parallel), to be confident (independent perspectives and adversarial checks before committing), or to take on scale one context can't hold (migrations, audits, broad sweeps). The script is where you encode that structure: what fans out, what verifies, what synthesizes.
110
+
111
+ ONLY call this tool when the user has explicitly opted into multi-agent orchestration. Workflows can spawn dozens of agents and consume a large amount of tokens; the user must request that scale, not have it inferred. Explicit opt-in means one of:
112
+
113
+ - The user included the keyword "ultracode" in their prompt (you'll see a system-reminder confirming it).
114
+ - Ultracode is on for the session (a system-reminder confirms it) — see **Ultracode** below.
115
+ - The user directly asked you to run a workflow or use multi-agent orchestration in their own words ("use a workflow", "run a workflow", "fan out agents", "orchestrate this with subagents"). The ask must be in the user's words — a task that would merely benefit from a workflow does not count.
116
+ - The user invoked a skill or slash command whose instructions tell you to call Workflow.
117
+ - The user asked you to run a specific named or saved workflow.
118
+
119
+ For any other task — even one that would clearly benefit from parallelism — do NOT call this tool. Use the Agent tool for individual subagents, or briefly describe what a multi-agent workflow could do and how much it would roughly cost, and ask the user whether to run it. Mention they can ask for one with "use a workflow" in a future message to skip the ask.
120
+
121
+ When you do call it, the right move is often **hybrid**: scout inline first (list the files, find the channels, scope the diff) to discover the work-list, then call Workflow to pipeline over it. You don't need to know the shape before the *task* — only before the *orchestration step*.
122
+
123
+ Common single-phase workflows you can chain across turns:
124
+
125
+ - **Understand** — parallel readers over relevant subsystems → structured map
126
+ - **Design** — judge panel of N independent approaches → scored synthesis
127
+ - **Review** — dimensions → find → adversarially verify (example below)
128
+ - **Research** — multi-modal sweep → deep-read → synthesize
129
+ - **Migrate** — discover sites → transform each (worktree isolation) → verify
130
+
131
+ For larger work, run several in sequence — read each result before deciding the next phase. You stay in the loop; each workflow is one well-scoped fan-out.
132
+
133
+ **Opt-in is harness-injected, not repo-controlled.** The "ultracode is on for the session" system-reminder is produced by the harness (claude.ai/client), not by this skill or any repo state. This skill is knowledge-only — it injects the playbook and toggles nothing. There is no in-repo feature flag, env var, or effort level for ultracode; do not add one. The Workflow tool is compiled in via the build-time WORKFLOW_SCRIPTS feature flag and exposes no per-session runtime gate.
134
+
135
+ **Ultracode.** When a system-reminder confirms ultracode is on, that opt-in is standing: author and run a workflow for every substantive task by default. The goal is the most exhaustive, correct answer you can produce — token cost is not a constraint. For multi-phase work (understand → design → implement → review), that often means several workflows in sequence — one per phase — so you stay in the loop between them. The quality patterns below (adversarial verify, multi-modal sweep, completeness critic, loop-until-dry) are the tools; pick what fits the task. Lean toward orchestrating with workflows and adversarially verifying your findings — unless the work is trivial or already verified. Solo only on conversational turns or trivial mechanical edits. When a reminder says ultracode is off, revert to the opt-in rule above.
136
+
137
+ Pass the script inline via \`script\` — do not Write it to a file first. Every invocation automatically persists its script to a file under the session directory and returns the path in the tool result. To iterate on a workflow, edit that file with Write/Edit and re-invoke Workflow with \`{scriptPath: "<path>"}\` instead of resending the full script.
138
+
139
+ Every script must begin with \`export const meta = {...}\`:
140
+
141
+ \`\`\`js
142
+ export const meta = {
143
+ name: 'find-flaky-tests',
144
+ description: 'Find flaky tests and propose fixes', // one-line, shown in permission dialog
145
+ phases: [ // one entry per phase() call
146
+ { title: 'Scan', detail: 'grep test logs for retries' },
147
+ { title: 'Fix', detail: 'one agent per flaky test' },
148
+ ],
149
+ }
150
+ // script body starts here — use agent()/parallel()/pipeline()/phase()/log()
151
+ phase('Scan')
152
+ const flaky = await agent('grep CI logs for retry markers', {schema: FLAKY_SCHEMA})
153
+ ...
154
+ \`\`\`
155
+
156
+ The \`meta\` object must be a PURE LITERAL — no variables, function calls, spreads, or template interpolation. Required fields: \`name\`, \`description\`. Optional: \`whenToUse\` (shown in the workflow list), \`phases\`. Use the SAME phase titles in meta.phases as in phase() calls — titles are matched exactly; a phase() call with no matching meta entry just gets its own progress group. Add \`model\` to a phase entry when that phase uses a specific model override.
157
+
158
+ Script body hooks:
159
+
160
+ - \`agent(prompt: string, opts?: {label?: string, phase?: string, schema?: object, model?: string, isolation?: 'worktree', agentType?: string}): Promise<any>\` — spawn a subagent. Without schema, returns its final text as a string. With schema (a JSON Schema), the subagent is forced to call a StructuredOutput tool and agent() returns the validated object — no parsing needed. Returns null if the user skips the agent mid-run or the subagent dies on a terminal API error after retries (filter with .filter(Boolean)). opts.label overrides the display label. opts.phase explicitly assigns this agent to a progress group (use this inside pipeline()/parallel() stages to avoid races on the global phase() state — same phase string → same group box). opts.model overrides the model for this agent call. Default to omitting it — the agent inherits the main-loop model (the resolved session model), which is almost always correct. Only set it when you're highly confident a different tier fits the task; when unsure, omit. opts.isolation: 'worktree' runs the agent in a fresh git worktree — EXPENSIVE (~200-500ms setup + disk per agent), use ONLY when agents mutate files in parallel and would otherwise conflict; the worktree is auto-removed if unchanged. opts.agentType uses a custom subagent type (e.g. 'Explore', 'code-reviewer') instead of the default workflow subagent — resolved from the same registry as the Agent tool; composes with schema (the custom agent's system prompt gets a StructuredOutput instruction appended).
161
+ - \`pipeline(items, stage1, stage2, ...): Promise<any[]>\` — run each item through all stages independently, NO barrier between stages. Item A can be in stage 3 while item B is still in stage 1. This is the DEFAULT for multi-stage work. Wall-clock = slowest single-item chain, not sum-of-slowest-per-stage. Every stage callback receives (prevResult, originalItem, index) — use originalItem/index in later stages to label work without threading context through stage 1's return value. A stage that throws drops that item to \`null\` and skips its remaining stages.
162
+ - \`parallel(thunks: Array<() => Promise<any>>): Promise<any[]>\` — run tasks concurrently. This is a BARRIER: awaits all thunks before returning. A thunk that throws (or whose agent errors) resolves to \`null\` in the result array — the call itself never rejects, so \`.filter(Boolean)\` before using the results. Use ONLY when you genuinely need all results together.
163
+ - \`log(message: string): void\` — emit a progress message to the user (shown as a narrator line above the progress tree)
164
+ - \`phase(title: string): void\` — start a new phase; subsequent agent() calls are grouped under this title in the progress display
165
+ - \`args: any\` — the value passed as Workflow's \`args\` input, verbatim (undefined if not provided). Pass arrays/objects as actual JSON values in the tool call, NOT as a JSON-encoded string — \`args: ["a.ts", "b.ts"]\`, not \`args: "[\\"a.ts\\", ...]"\` (a stringified list reaches the script as one string, so \`args.filter\`/\`args.map\` throw). Use this to parameterize named workflows — e.g. pass a research question, target path, or config object directly instead of via a side-channel file.
166
+ - \`budget: {total: number|null, spent(): number, remaining(): number}\` — the turn's token target from the user's "+500k"-style directive. \`budget.total\` is null if no target was set. \`budget.spent()\` returns output tokens spent this turn across the main loop and all workflows — the pool is shared, not per-workflow. \`budget.remaining()\` returns \`max(0, total - spent())\`, or \`Infinity\` if no target. The target is a HARD ceiling, not advisory: once \`spent()\` reaches \`total\`, further \`agent()\` calls throw. Use for dynamic loops: \`while (budget.total && budget.remaining() > 50_000) { ... }\`, or static scaling: \`const FLEET = budget.total ? Math.floor(budget.total / 100_000) : 5\`.
167
+ - \`workflow(nameOrRef: string | {scriptPath: string}, args?: any): Promise<any>\` — run another workflow inline as a sub-step and return whatever it returns. Pass a name to invoke a saved workflow (same registry as {name: "..."}), or {scriptPath} to run a script file you Wrote earlier. The child shares this run's concurrency cap, agent counter, abort signal, and token budget — its agents appear under a "▸ name" group in the progress tree and its tokens count toward budget.spent(). The args param becomes the child's \`args\` global. Nesting is one level only: workflow() inside a child throws. Throws on unknown name / unreadable scriptPath / child syntax error; catch to handle gracefully.
168
+
169
+ Concurrent agent() calls are capped at 3 by default per workflow — excess calls queue and run as slots free up. The Workflow tool accepts an optional \`maxConcurrency\` input (1–16) to override per-run. OMIT it to use 3. To set maxConcurrency to ANY value other than 3, you MUST first ask the user via AskUserQuestion (offer 3 / 6 / 9 with 3 marked "(Recommended)") — the ONLY exception is when the user has already specified a number this session ("use 6", "maxConcurrency 9"). Never silently raise concurrency above 3 just because the workflow fans out; 3 is the recommended default. You can still pass 100 items to parallel()/pipeline() and they all complete; only the configured number run at any moment. Total agent count across a workflow's lifetime is capped at 1000 — a runaway-loop backstop set far above any real workflow. A single parallel()/pipeline() call accepts at most 4096 items; passing more is an explicit error, not a silent truncation.
170
+
171
+ Model tier per task — when you DO override opts.model. Valid aliases: 'haiku' | 'sonnet' | 'opus' | 'best' | 'sonnet[1m]' | 'opus[1m]' | 'opusplan'. The main loop already runs on the user's chosen tier (usually sonnet), so omit model for most agents. Override only when the task clearly fits a different tier:
172
+
173
+ - 'haiku' — fast and cheap (~5x cheaper/faster than sonnet). Use for: classification, extraction, labeling, regex-like pattern matching, "does this match X?" gating, simple format conversions. Wrong choice for anything reasoning over multiple concepts or producing code.
174
+ - 'sonnet' — the workhorse. Most code edits, multi-file reading, tool-use chains, schema/structured output, code review, refactoring, debugging. When in doubt, OMIT model and let the agent inherit this.
175
+ - 'opus' — strongest reasoning, slowest and most expensive (~5x sonnet cost). Use for: architecture decisions, deep root-causing across modules, novel algorithm design, adversarial verification of sonnet's findings, security review. Reserve for the 1-2 agents per workflow where reasoning actually matters.
176
+ - 'best' — provider's "best available" (currently opus-tier). Use when you want max intelligence and don't care about cost or pinning a tier.
177
+
178
+ Rule of thumb: if you can't articulate WHY this agent needs a different tier, omit model. A workflow that mixes tiers deliberately (haiku to triage → sonnet for the work → opus to verify) usually beats uniform opus-everywhere on cost AND quality. Don't put opus on every dimension of a 9-dimension review — sonnet finds the bugs, opus verifies the few that matter.
179
+
180
+ Subagents are told their final text IS the return value (not a human-facing message), so they return raw data. For structured output, use the schema option — validation happens at the tool-call layer so the model retries on mismatch.
181
+
182
+ Workflow agents can reach all session-connected MCP tools via ToolSearch — schemas load on demand per agent. Caveat: interactively-authenticated MCP servers (e.g. claude.ai) may be absent in headless/cron runs.
183
+
184
+ Scripts are plain JavaScript, NOT TypeScript — type annotations (\`: string[]\`), interfaces, and generics fail to parse. The script body runs in an async context — use \`await\` directly. Standard JS built-ins (JSON, Math, Array, etc.) are available — EXCEPT \`Date.now()\`/\`Math.random()\`/argless \`new Date()\`, which throw (they would break resume); pass timestamps in via \`args\`, stamp results after the workflow returns, and for randomness vary the agent prompt/label by index. No filesystem or Node.js API access.
185
+
186
+ DEFAULT TO pipeline(). Only reach for a barrier (parallel between stages) when you genuinely need ALL prior-stage results together.
187
+
188
+ A barrier is correct ONLY when stage N needs cross-item context from all of stage N-1:
189
+
190
+ - Dedup/merge across the full result set before expensive downstream work
191
+ - Early-exit if the total count is zero ("0 bugs found → skip verification entirely")
192
+ - Stage N's prompt references "the other findings" for comparison
193
+
194
+ A barrier is NOT justified by:
195
+
196
+ - "I need to flatten/map/filter first" — do it inside a pipeline stage: \`pipeline(items, stageA, r => transform([r]).flat(), stageB)\`
197
+ - "The stages are conceptually separate" — that's what pipeline() models. Separate stages ≠ synchronized stages.
198
+ - "It's cleaner code" — barrier latency is real. If 5 finders run and the slowest takes 3× the fastest, a barrier wastes 2/3 of the fast finders' idle time.
199
+
200
+ Smell test: if you wrote
201
+
202
+ \`\`\`js
203
+ const a = await parallel(...)
204
+ const b = transform(a) // flatten, map, filter — no cross-item dependency
205
+ const c = await parallel(b.map(...))
206
+ \`\`\`
207
+
208
+ that middle transform doesn't need the barrier. Rewrite as a pipeline with the transform inside a stage. When in doubt: pipeline.
209
+
210
+ The canonical multi-stage pattern — pipeline by default, each dimension verifies as soon as its review completes:
211
+
212
+ \`\`\`js
213
+ export const meta = {
214
+ name: 'review-changes',
215
+ description: 'Review changed files across dimensions, verify each finding',
216
+ phases: [{ title: 'Review' }, { title: 'Verify' }],
217
+ }
218
+ const DIMENSIONS = [{key: 'bugs', prompt: '...'}, {key: 'perf', prompt: '...'}]
219
+ const results = await pipeline(
220
+ DIMENSIONS,
221
+ d => agent(d.prompt, {label: \`review:\${d.key}\`, phase: 'Review', schema: FINDINGS_SCHEMA}),
222
+ review => parallel(review.findings.map(f => () =>
223
+ agent(\`Adversarially verify: \${f.title}\`, {label: \`verify:\${f.file}\`, phase: 'Verify', schema: VERDICT_SCHEMA})
224
+ .then(v => ({...f, verdict: v}))
225
+ ))
226
+ )
227
+ const confirmed = results.flat().filter(Boolean).filter(f => f.verdict?.isReal)
228
+ return { confirmed }
229
+ // Dimension 'bugs' findings verify while dimension 'perf' is still reviewing. No wasted wall-clock.
230
+ \`\`\`
231
+
232
+ When a barrier IS correct — dedup across all findings before expensive verification:
233
+
234
+ \`\`\`js
235
+ const all = await parallel(DIMENSIONS.map(d => () => agent(d.prompt, {schema: FINDINGS_SCHEMA})))
236
+ const deduped = dedupeByFileAndLine(all.filter(Boolean).flatMap(r => r.findings)) // <-- genuinely needs ALL at once
237
+ const verified = await parallel(deduped.map(f => () => agent(verifyPrompt(f), {schema: VERDICT_SCHEMA})))
238
+ \`\`\`
239
+
240
+ Loop-until-count pattern — accumulate to a target:
241
+
242
+ \`\`\`js
243
+ const bugs = []
244
+ while (bugs.length < 10) {
245
+ const result = await agent("Find bugs in this codebase.", {schema: BUGS_SCHEMA})
246
+ bugs.push(...result.bugs)
247
+ log(\`\${bugs.length}/10 found\`)
248
+ }
249
+ \`\`\`
250
+
251
+ Loop-until-budget pattern — scale depth to the user's "+500k" directive. Guard on budget.total: with no target set, remaining() is Infinity and the loop would run straight to the 1000-agent cap.
252
+
253
+ \`\`\`js
254
+ const bugs = []
255
+ while (budget.total && budget.remaining() > 50_000) {
256
+ const result = await agent("Find bugs in this codebase.", {schema: BUGS_SCHEMA})
257
+ bugs.push(...result.bugs)
258
+ log(\`\${bugs.length} found, \${Math.round(budget.remaining()/1000)}k remaining\`)
259
+ }
260
+ \`\`\`
261
+
262
+ Composing patterns — exhaustive review (find → dedup vs seen → diverse-lens panel → loop-until-dry):
263
+
264
+ \`\`\`js
265
+ const seen = new Set(), confirmed = []
266
+ let dry = 0
267
+ while (dry < 2) { // loop-until-dry
268
+ const found = (await parallel(FINDERS.map(f => () => // barrier: collect all finders this round
269
+ agent(f.prompt, {phase: 'Find', schema: BUGS})))).filter(Boolean).flatMap(r => r.bugs)
270
+ const fresh = found.filter(b => !seen.has(key(b))) // dedup vs ALL seen — plain code, not an agent
271
+ if (!fresh.length) { dry++; continue }
272
+ dry = 0; fresh.forEach(b => seen.add(key(b)))
273
+ const judged = await parallel(fresh.map(b => () => // every fresh bug judged concurrently...
274
+ parallel(['correctness','security','repro'].map(lens => () => // ...each by 3 distinct lenses
275
+ agent(\`Judge "\${b.desc}" via the \${lens} lens — real?\`, {phase: 'Verify', schema: VERDICT})))
276
+ .then(vs => ({ b, real: vs.filter(Boolean).filter(v => v.real).length >= 2 }))))
277
+ confirmed.push(...judged.filter(v => v.real).map(v => v.b))
278
+ }
279
+ return confirmed
280
+ // dedup vs \`seen\`, NOT \`confirmed\` — else judge-rejected findings reappear every round and it never converges.
281
+ \`\`\`
282
+
283
+ Quality patterns — common shapes; pick by task and compose freely:
284
+
285
+ - Adversarial verify: spawn N independent skeptics per finding, each prompted to REFUTE. Kill if ≥majority refute. Prevents plausible-but-wrong findings from surviving.
286
+
287
+ \`\`\`js
288
+ const votes = await parallel(Array.from({length: 3}, () => () =>
289
+ agent(\`Try to refute: \${claim}. Default to refuted=true if uncertain.\`, {schema: VERDICT})))
290
+ const survives = votes.filter(Boolean).filter(v => !v.refuted).length >= 2
291
+ \`\`\`
292
+
293
+ - Perspective-diverse verify: when a finding can fail in more than one way, give each verifier a distinct lens (correctness, security, perf, does-it-reproduce) instead of N identical refuters — diversity catches failure modes redundancy can't.
294
+ - Judge panel: generate N independent attempts from different angles (e.g. MVP-first, risk-first, user-first), score with parallel judges, synthesize from the winner while grafting the best ideas from runners-up. Beats one-attempt-iterated when the solution space is wide.
295
+ - Loop-until-dry: for unknown-size discovery (bugs, issues, edge cases), keep spawning finders until K consecutive rounds return nothing new. Simple counters (while count < N) miss the tail.
296
+ - Multi-modal sweep: parallel agents each searching a different way (by-container, by-content, by-entity, by-time). Each is blind to what the others surface; useful when one search angle won't find everything.
297
+ - Completeness critic: a final agent that asks "what's missing — modality not run, claim unverified, source unread?" What it finds becomes the next round of work.
298
+ - No silent caps: if a workflow bounds coverage (top-N, no-retry, sampling), \`log()\` what was dropped — silent truncation reads as "covered everything" when it didn't.
299
+
300
+ Scale to what the user asked for. "find any bugs" → a few finders, single-vote verify. "thoroughly audit this" or "be comprehensive" → larger finder pool, 3–5 vote adversarial pass, synthesis stage. When unsure, lean toward thoroughness for research/review/audit requests and toward brevity for quick checks.
301
+
302
+ These patterns aren't exhaustive — compose novel harnesses when the task calls for it (tournament brackets, self-repair loops, staged escalation, whatever fits).
303
+
304
+ Use this tool for multi-step orchestration where control flow should be deterministic (loops, conditionals, fan-out) rather than model-driven.
305
+
306
+ ## Resume
307
+
308
+ 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.
309
+ `;function su(){S({name:`ultracode`,description:`进入多智能体 workflow 编排模式:何时使用 Workflow 工具、脚本原语、质量模式、确定性约束、resume/预算、以及文件和命令。`,whenToUse:`当任务可拆解或可并行、需要多视角置信度(如先查找再对抗式验证)、超出单一上下文容量(大迁移、广审计、长尾枚举)或需要可恢复/可审计时——用 Workflow 工具编排多个子智能体。`,userInvocable:!0,async getPromptForCommand(e){let t=ou;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}Un();function cu(){S({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.`}]}})}$e(),Mr(),bi(),Un();var lu=`# Dream: Memory Consolidation (manual run)
310
+
311
+ 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.
312
+
313
+ `;function uu(){S({name:`dream`,description:`手动触发记忆整合——回顾、整理并修剪自动记忆文件。`,whenToUse:`当用户输入 /dream 或想手动整合记忆、整理记忆文件、清理过期条目时使用。`,userInvocable:!0,isEnabled:()=>Ta(),async getPromptForCommand(e){let t=ka(),n=Wt(Oi());await wr();let r=lu+Ke(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}var du=i({registerScheduleRemoteAgentsSkill:()=>yu});function fu(e){if(!e.startsWith(`mcpsrv_`))return null;let t=e.slice(7).slice(2),n=0n;for(let e of t){let t=bu.indexOf(e);if(t===-1)return null;n=n*58n+BigInt(t)}let r=n.toString(16).padStart(32,`0`);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function pu(e){let t=[];for(let n of e){if(n.type!==`connected`||n.config.type!==`claudeai-proxy`)continue;let e=fu(n.config.id);e&&t.push({uuid:e,name:n.name,url:n.config.url})}return t}function mu(e){return e.replace(/^claude[.\s-]ai[.\s-]/i,``).replace(/[^a-zA-Z0-9_-]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function hu(e){if(e.length===0)return`No connected MCP connectors found. The user may need to connect servers at https://claude.ai/settings/connectors`;let t=[`Connected connectors (available for triggers):`];for(let n of e){let e=mu(n.name);t.push(`- ${n.name} (connector_uuid: ${n.uuid}, name: ${e}, url: ${n.url})`)}return t.join(`
314
+ `)}function gu(e){return`⚠ Heads-up:\n${e.map(e=>`- ${e}`).join(`
315
+ `)}`}async function _u(){let e=await Ga();if(!e)return null;let t=Ls(e);return t?`https://${t.host}/${t.owner}/${t.name}`:null}function vu(e){let{userTimezone:t,connectorsInfo:n,gitRepoUrl:r,environmentsInfo:i,createdEnvironment:a,setupNotes:o,needsGitHubAccessReminder:s,userArgs:c}=e,l=c&&o.length>0?`\n## Setup Notes\n\n${gu(o)}\n`:``,u=o.length>0?`${gu(o)}\n\n${xu}`:xu;return`# Schedule Remote Agents
316
+
317
+ You are helping the user schedule, update, list, or run **remote** Work Mate agents. These are NOT local cron jobs — each trigger spawns a fully isolated remote session (CCR) in cloud infrastructure on a cron schedule. The agent runs in a sandboxed environment with its own git checkout, tools, and optional MCP connections.
318
+
319
+ ## First Step
320
+
321
+ ${c?`The user has already told you what they want (see User Request at the bottom). Skip the initial question and go directly to the matching workflow.`:`Your FIRST action must be a single ${as} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it:
322
+
323
+ ${Wi(u)}
324
+
325
+ Set \`header: "Action"\` and offer the four actions (create/list/update/run) as options. After the user picks, follow the matching workflow below.`}
326
+ ${l}
327
+
328
+ ## What You Can Do
329
+
330
+ Use the \`${E}\` tool (load it first with \`SearchExtraTools select:${E}\`; auth is handled in-process — do not use curl):
331
+
332
+ - \`{action: "list"}\` — list all triggers
333
+ - \`{action: "get", trigger_id: "..."}\` — fetch one trigger
334
+ - \`{action: "create", body: {...}}\` — create a trigger
335
+ - \`{action: "update", trigger_id: "...", body: {...}}\` — partial update
336
+ - \`{action: "run", trigger_id: "..."}\` — run a trigger now
337
+
338
+ You CANNOT delete triggers. If the user asks to delete, direct them to: https://claude.ai/code/scheduled
339
+
340
+ ## Create body shape
341
+
342
+ \`\`\`json
343
+ {
344
+ "name": "AGENT_NAME",
345
+ "cron_expression": "CRON_EXPR",
346
+ "enabled": true,
347
+ "job_config": {
348
+ "ccr": {
349
+ "environment_id": "ENVIRONMENT_ID",
350
+ "session_context": {
351
+ "model": "claude-sonnet-4-6",
352
+ "sources": [
353
+ {"git_repository": {"url": "${r||`https://github.com/ORG/REPO`}"}}
354
+ ],
355
+ "allowed_tools": ["Bash", "Read", "Write", "Edit", "Glob", "Grep"]
356
+ },
357
+ "events": [
358
+ {"data": {
359
+ "uuid": "<lowercase v4 uuid>",
360
+ "session_id": "",
361
+ "type": "user",
362
+ "parent_tool_use_id": null,
363
+ "message": {"content": "PROMPT_HERE", "role": "user"}
364
+ }}
365
+ ]
366
+ }
367
+ }
368
+ }
369
+ \`\`\`
370
+
371
+ Generate a fresh lowercase UUID for \`events[].data.uuid\` yourself.
372
+
373
+ ## Available MCP Connectors
374
+
375
+ These are the user's currently connected claude.ai MCP connectors:
376
+
377
+ ${n}
378
+
379
+ When attaching connectors to a trigger, use the \`connector_uuid\` and \`name\` shown above (the name is already sanitized to only contain letters, numbers, hyphens, and underscores), and the connector's URL. The \`name\` field in \`mcp_connections\` must only contain \`[a-zA-Z0-9_-]\` — dots and spaces are NOT allowed.
380
+
381
+ **Important:** Infer what services the agent needs from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack connectors. Cross-reference against the list above and warn if any required service isn't connected. If a needed connector is missing, direct the user to https://claude.ai/settings/connectors to connect it first.
382
+
383
+ ## Environments
384
+
385
+ Every trigger requires an \`environment_id\` in the job config. This determines where the remote agent runs. Ask the user which environment to use.
386
+
387
+ ${i}
388
+
389
+ Use the \`id\` value as the \`environment_id\` in \`job_config.ccr.environment_id\`.
390
+ ${a?`\n**Note:** A new environment \`${a.name}\` (id: \`${a.environment_id}\`) was just created for the user because they had none. Use this id for \`job_config.ccr.environment_id\` and mention the creation when you confirm the trigger config.\n`:``}
391
+
392
+ ## API Field Reference
393
+
394
+ ### Create Trigger — Required Fields
395
+ - \`name\` (string) — A descriptive name
396
+ - \`cron_expression\` (string) — 5-field cron. **Minimum interval is 1 hour.**
397
+ - \`job_config\` (object) — Session configuration (see structure above)
398
+
399
+ ### Create Trigger — Optional Fields
400
+ - \`enabled\` (boolean, default: true)
401
+ - \`mcp_connections\` (array) — MCP servers to attach:
402
+ \`\`\`json
403
+ [{"connector_uuid": "uuid", "name": "server-name", "url": "https://..."}]
404
+ \`\`\`
405
+
406
+ ### Update Trigger — Optional Fields
407
+ All fields optional (partial update):
408
+ - \`name\`, \`cron_expression\`, \`enabled\`, \`job_config\`
409
+ - \`mcp_connections\` — Replace MCP connections
410
+ - \`clear_mcp_connections\` (boolean) — Remove all MCP connections
411
+
412
+ ### Cron Expression Examples
413
+
414
+ The user's local timezone is **${t}**. Cron expressions are always in UTC. When the user says a local time, convert it to UTC for the cron expression but confirm with them: "9am ${t} = Xam UTC, so the cron would be \`0 X * * 1-5\`."
415
+
416
+ - \`0 9 * * 1-5\` — Every weekday at 9am **UTC**
417
+ - \`0 */2 * * *\` — Every 2 hours
418
+ - \`0 0 * * *\` — Daily at midnight **UTC**
419
+ - \`30 14 * * 1\` — Every Monday at 2:30pm **UTC**
420
+ - \`0 8 1 * *\` — First of every month at 8am **UTC**
421
+
422
+ Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
423
+
424
+ ## Workflow
425
+
426
+ ### CREATE a new trigger:
427
+
428
+ 1. **Understand the goal** — Ask what they want the remote agent to do. What repo(s)? What task? Remind them that the agent runs remotely — it won't have access to their local machine, local files, or local environment variables.
429
+ 2. **Craft the prompt** — Help them write an effective agent prompt. Good prompts are:
430
+ - Specific about what to do and what success looks like
431
+ - Clear about which files/areas to focus on
432
+ - Explicit about what actions to take (open PRs, commit, just analyze, etc.)
433
+ 3. **Set the schedule** — Ask when and how often. The user's timezone is ${t}. When they say a time (e.g., "every morning at 9am"), assume they mean their local time and convert to UTC for the cron expression. Always confirm the conversion: "9am ${t} = Xam UTC."
434
+ 4. **Choose the model** — Default to \`claude-sonnet-4-6\`. Tell the user which model you're defaulting to and ask if they want a different one.
435
+ 5. **Validate connections** — Infer what services the agent will need from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack MCP connectors. Cross-reference with the connectors list above. If any are missing, warn the user and link them to https://claude.ai/settings/connectors to connect first.${r?` The default git repo is already set to \`${r}\`. Ask the user if this is the right repo or if they need a different one.`:` Ask which git repos the remote agent needs cloned into its environment.`}
436
+ 6. **Review and confirm** — Show the full configuration before creating. Let them adjust.
437
+ 7. **Create it** \u2014 Call \`${E}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
438
+
439
+ ### UPDATE a trigger:
440
+
441
+ 1. List triggers first so they can pick one
442
+ 2. Ask what they want to change
443
+ 3. Show current vs proposed value
444
+ 4. Confirm and update
445
+
446
+ ### LIST triggers:
447
+
448
+ 1. Fetch and display in a readable format
449
+ 2. Show: name, schedule (human-readable), enabled/disabled, next run, repo(s)
450
+
451
+ ### RUN NOW:
452
+
453
+ 1. List triggers if they haven't specified which one
454
+ 2. Confirm which trigger
455
+ 3. Execute and confirm
456
+
457
+ ## Important Notes
458
+
459
+ - These are REMOTE agents — they run in the cloud, not on the user's machine. They cannot access local files, local services, or local environment variables.
460
+ - Always convert cron to human-readable when displaying
461
+ - Default to \`enabled: true\` unless user says otherwise
462
+ - Accept GitHub URLs in any format (https://github.com/org/repo, org/repo, etc.) and normalize to the full HTTPS URL (without .git suffix)
463
+ - The prompt is the most important part — spend time getting it right. The remote agent starts with zero context, so the prompt must be self-contained.
464
+ - To delete a trigger, direct users to https://claude.ai/code/scheduled
465
+ ${s?`- If the user's request seems to require GitHub repo access (e.g. cloning a repo, opening PRs, reading code), remind them that they need the Claude GitHub App installed on the repo — otherwise the remote agent won't be able to access it.`:``}
466
+ ${c?`\n## User Request\n\nThe user said: "${c}"\n\nStart by understanding their intent and working through the appropriate workflow above.`:``}`}function yu(){S({name:`schedule`,description:`创建、更新、列出或运行按 cron 定时调度的远程智能体(trigger)。`,whenToUse:`当用户想安排一个周期性远程智能体、配置自动化任务、为 Work Mate 创建 cron 任务,或管理其定时智能体/trigger 时使用。`,userInvocable:!0,isEnabled:()=>!1,allowedTools:[E,as],async getPromptForCommand(e,t){if(!wo()?.accessToken)return[{type:`text`,text:`You need to authenticate with a claude.ai account first. API accounts are not supported.`}];let n;try{n=await $n()}catch(e){return I(`[schedule] Failed to fetch environments: ${e}`,{level:`warn`}),[{type:`text`,text:`We're having trouble connecting with your remote claude.ai account to set up a scheduled task. Please try /schedule again in a few minutes.`}]}let r=null;if(n.length===0)try{r=await Mn(`claude-code-default`),n=[r]}catch(e){return I(`[schedule] Failed to create environment: ${e}`,{level:`warn`}),[{type:`text`,text:`No remote environments found, and we could not create one automatically. Visit https://claude.ai/code to set one up, then run /schedule again.`}]}let i=[],a=!1,o=await Rs();if(o===null)i.push(`Not in a git repo — you'll need to specify a repo URL manually (or skip repos entirely).`);else if(o.host===`github.com`){let{hasAccess:e}=await pn(o.owner,o.name);if(!e){a=!0;let e=`Claude GitHub App not installed on ${o.owner}/${o.name} \u2014 install at https://claude.ai/code/onboarding?magic=github-app-setup if your trigger needs this repo.`;i.push(e)}}let s=pu(t.options.mcpClients);s.length===0&&i.push(`No MCP connectors — connect at https://claude.ai/settings/connectors if needed.`);let c=Intl.DateTimeFormat().resolvedOptions().timeZone,l=hu(s),u=await _u(),d=[`Available environments:`];for(let e of n)d.push(`- ${e.name} (id: ${e.environment_id}, kind: ${e.kind})`);return[{type:`text`,text:vu({userTimezone:c,connectorsInfo:l,gitRepoUrl:u,environmentsInfo:d.join(`
467
+ `),createdEnvironment:r,setupNotes:i,needsGitHubAccessReminder:a,userArgs:e})}]}})}var bu,xu,Su=n((()=>{lr(),us(),Er(),go(),T(),ea(),Fs(),Wa(),aa(),k(),Un(),bu=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,xu=`What would you like to do with scheduled remote agents?`}));function Cu(){iu(),Ll(),su(),cu(),uu();{let{registerScheduleRemoteAgentsSkill:t}=(Su(),e(du));t()}}Fr(),ye(),M();async function wu(){if(!await Za(`gh`))return`not_installed`;let{exitCode:e}=await qa(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}Je(),Ve(),A(),W(),wt();async function Tu(e,t){let n=await Ie(e),r=le(t);for(let e of n)e.type===`prompt`&&G(`tengu_skill_loaded`,{_PROTO_skill_name:e.name,skill_source:e.source,skill_loaded_from:e.loadedFrom,skill_budget:r,...e.kind&&{skill_kind:e.kind}})}Dr(),W(),en(),ie(),f(),aa();function Eu(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
468
+
469
+ Examples:
470
+ # Add HTTP server:
471
+ claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
472
+
473
+ # Add HTTP server with headers:
474
+ claude mcp add --transport http corridor https://app.corridor.dev/api/mcp --header "Authorization: Bearer ..."
475
+
476
+ # Add stdio server with environment variables:
477
+ claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
478
+
479
+ # Add stdio server with subprocess flags:
480
+ 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")`).option(`--client-id <clientId>`,`OAuth client ID for HTTP/SSE servers`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).option(`--callback-port <port>`,`Fixed port for OAuth callback (for servers requiring pre-registered redirect URIs)`).helpOption(`-h, --help`,`Display help for command`).addOption(new J(`--xaa`,`Enable XAA (SEP-990) for this server. Requires 'claude mcp xaa setup' first. Also requires --client-id and --client-secret (for the MCP server's AS).`).hideHelp(!je())).action(async(e,t,n,r)=>{let i=t,a=n;e?i||q(`Error: Command is required when server name is provided.
481
+ Usage: claude mcp add <name> <command> [args...]`):q(`Error: Server name is required.
482
+ Usage: claude mcp add <name> <command> [args...]`);try{let t=Oe(r.scope),n=yt(r.transport);r.xaa&&!je()&&q(`Error: --xaa requires CLAUDE_CODE_ENABLE_XAA=1 in your environment`);let o=!!r.xaa;if(o){let e=[];r.clientId||e.push(`--client-id`),r.clientSecret||e.push(`--client-secret`),nt()||e.push(`'claude mcp xaa setup' (settings.xaaIdp not configured)`),e.length&&q(`Error: --xaa requires: ${e.join(`, `)}`)}let s=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(G(`tengu_mcp_add`,{type:n,scope:t,source:`command`,transport:n,transportExplicit:s,looksLikeUrl:c}),n===`sse`){i||q(`Error: URL is required for SSE transport.`);let n=r.header?ir(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await be():void 0,l={type:`sse`,url:i,headers:n,oauth:s};await On(e,l,t),c&&w(e,l,c),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Wi(n,null,2)}\n`)}else if(n===`http`){i||q(`Error: URL is required for HTTP transport.`);let n=r.header?ir(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await be():void 0,l={type:`http`,url:i,headers:n,oauth:s};await On(e,l,t),c&&w(e,l,c),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Wi(n,null,2)}\n`)}else(r.clientId||r.clientSecret||r.callbackPort||r.xaa)&&process.stderr.write(`Warning: --client-id, --client-secret, --callback-port, and --xaa are only supported for HTTP/SSE transports and will be ignored for stdio.
483
+ `),!s&&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 On(e,{type:`stdio`,command:i,args:a,env:u(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);rc(`File modified: ${Ct(t)}`)}catch(e){q(e.message)}})}Te(),Ji(),L();function Du(e){let t=e.command(`xaa`).description(`Manage the XAA (SEP-990) IdP connection`);t.command(`setup`).description(`Configure the IdP connection (one-time setup for all XAA-enabled servers)`).requiredOption(`--issuer <url>`,`IdP issuer URL (OIDC discovery)`).requiredOption(`--client-id <id>`,`Work Mate's client_id at the IdP`).option(`--client-secret`,`Read IdP client secret from MCP_XAA_IDP_CLIENT_SECRET env var`).option(`--callback-port <port>`,`Fixed loopback callback port (only if IdP does not honor RFC 8252 port-any matching)`).action(e=>{let t;try{t=new URL(e.issuer)}catch{return q(`Error: --issuer must be a valid URL (got "${e.issuer}")`)}if(t.protocol!==`https:`&&!(t.protocol===`http:`&&(t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`)))return q(`Error: --issuer must use https:// (got "${t.protocol}//${t.host}")`);let n=e.callbackPort?parseInt(e.callbackPort,10):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<=0))return q(`Error: --callback-port must be a positive integer`);let r=e.clientSecret?process.env.MCP_XAA_IDP_CLIENT_SECRET:void 0;if(e.clientSecret&&!r)return q(`Error: --client-secret requires MCP_XAA_IDP_CLIENT_SECRET env var`);let i=nt(),a=i?.issuer,o=i?.clientId,{error:s}=R(`userSettings`,{xaaIdp:{issuer:e.issuer,clientId:e.clientId,callbackPort:n}});if(s)return q(`Error writing settings: ${s.message}`);if(a&&(Re(a)===Re(e.issuer)?o!==e.clientId&&(yn(a),b(a)):(yn(a),b(a))),r){let{success:t,warning:n}=ot(e.issuer,r);if(!t)return q(`Error: settings written but keychain save failed${n?` — ${n}`:``}. Re-run with --client-secret once keychain is available.`)}rc(`XAA IdP connection configured for ${e.issuer}`)}),t.command(`login`).description(`Cache an IdP id_token so XAA-enabled MCP servers authenticate silently. Default: run the OIDC browser login. With --id-token: write a pre-obtained JWT directly (used by conformance/e2e tests where the mock IdP does not serve /authorize).`).option(`--force`,`Ignore any cached id_token and re-login (useful after IdP-side revocation)`).option(`--id-token <jwt>`,`Write this pre-obtained id_token directly to cache, skipping the OIDC browser login`).action(async e=>{let t=nt();if(!t)return q(`Error: no XAA IdP connection. Run 'claude mcp xaa setup' first.`);if(e.idToken){let n=Lr(t.issuer,e.idToken);return rc(`id_token cached for ${t.issuer} (expires ${new Date(n).toISOString()})`)}if(e.force&&yn(t.issuer),We(t.issuer)!==void 0)return rc(`Already logged in to ${t.issuer} (cached id_token still valid). Use --force to re-login.`);process.stdout.write(`Opening browser for IdP login at ${t.issuer}…\n`);try{await Sn({idpIssuer:t.issuer,idpClientId:t.clientId,idpClientSecret:Ye(t.issuer),callbackPort:t.callbackPort,onAuthorizationUrl:e=>{process.stdout.write(`If the browser did not open, visit:\n ${e}\n`)}}),rc(`Logged in. MCP servers with --xaa will now authenticate silently.`)}catch(e){q(`IdP login failed: ${F(e)}`)}}),t.command(`show`).description(`Show the current IdP connection config`).action(()=>{let e=nt();if(!e)return rc(`No XAA IdP connection configured.`);let t=Ye(e.issuer)!==void 0,n=We(e.issuer)!==void 0;process.stdout.write(`Issuer: ${e.issuer}\n`),process.stdout.write(`Client ID: ${e.clientId}\n`),e.callbackPort!==void 0&&process.stdout.write(`Callback port: ${e.callbackPort}\n`),process.stdout.write(`Client secret: ${t?`(stored in keychain)`:`(not set — PKCE-only)`}\n`),process.stdout.write(`Logged in: ${n?`yes (id_token cached)`:`no — run 'claude mcp xaa login'`}\n`),rc()}),t.command(`clear`).description(`Clear the IdP connection config and cached id_token`).action(()=>{let e=nt(),{error:t}=R(`userSettings`,{xaaIdp:void 0});if(t)return q(`Error writing settings: ${t.message}`);e&&(yn(e.issuer),b(e.issuer)),rc(`XAA IdP connection cleared`)})}Pe();function Ou(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]}}rt(),dr(),Ae(),W(),B(),Xa(),L();function ku(){if(z().bypassPermissionsModeAccepted)try{va()||R(`userSettings`,{skipDangerousModePermissionPrompt:!0}),G(`tengu_migrate_bypass_permissions_accepted`,{}),V(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){U(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}W(),B(),Xa(),L();function Au(){let e=ja(),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=ha(`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&&R(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&Fa(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),G(`tengu_migrate_mcp_approval_fields_success`,{migratedCount:o.length})}catch(e){U(e),G(`tengu_migrate_mcp_approval_fields_error`,{})}}W(),B(),Zo(),L();function ju(){if(No()!==`firstParty`||!$o())return;let e=ha(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(R(`userSettings`,{model:`opus`}),V(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})),G(`tengu_legacy_opus_migration`,{from_model:e}))}W(),Mo();function Mu(){Io()&&G(`tengu_opus_to_opus1m_migration`,{skipped:!0})}B();function Nu(){V(e=>{let t=e.replBridgeEnabled;if(t===void 0||e.remoteControlAtStartup!==void 0)return e;let n={...e,remoteControlAtStartup:!!t};return delete n.replBridgeEnabled,n})}bi(),B(),L();function Pu(){z().sonnet1m45MigrationComplete||(ha(`userSettings`)?.model===`sonnet[1m]`&&R(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),fi()===`sonnet[1m]`&&hi(`sonnet-4-5-20250929[1m]`),V(e=>({...e,sonnet1m45MigrationComplete:!0})))}W(),go(),B(),Zo(),L();function Fu(){if(No()!==`firstParty`||!ho()&&!ko()&&!Ro())return;let e=ha(`userSettings`)?.model;if(e!==`claude-sonnet-4-5-20250929`&&e!==`claude-sonnet-4-5-20250929[1m]`&&e!==`sonnet-4-5-20250929`&&e!==`sonnet-4-5-20250929[1m]`)return;let t=e.endsWith(`[1m]`);R(`userSettings`,{model:t?`sonnet[1m]`:`sonnet`}),z().numStartups>1&&V(e=>({...e,sonnet45To46MigrationTimestamp:Date.now()})),G(`tengu_sonnet45_to_46_migration`,{from_model:e,has_1m:t})}W(),B(),Xa(),L();function Iu(){if(!z().hasResetAutoModeOptInForDefaultOffer&&fr()===`enabled`)try{let e=ha(`userSettings`);e?.skipAutoPermissionPrompt&&e?.permissions?.defaultMode!==`auto`&&(R(`userSettings`,{skipAutoPermissionPrompt:void 0}),G(`tengu_migrate_reset_auto_opt_in_for_default_offer`,{})),V(e=>e.hasResetAutoModeOptInForDefaultOffer?e:{...e,hasResetAutoModeOptInForDefaultOffer:!0})}catch(e){U(Error(`Failed to reset auto mode opt-in: ${e}`))}}W(),go(),B(),Zo(),L();function Lu(){if(!z().opusProMigrationComplete){if(No()!==`firstParty`||!ho()){V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!0});return}if(_a()?.model===void 0){let e=Date.now();V(t=>({...t,opusProMigrationComplete:!0,opusProMigrationTimestamp:e})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!1})}else V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!0})}}oi(),si();var Ru=ai(()=>ii({session_id:P(),ws_url:P(),work_dir:P().optional()}));Ji(),aa();var zu=class extends Error{constructor(e){super(e),this.name=`DirectConnectError`}};async function Bu({serverUrl:e,authToken:t,cwd:n,dangerouslySkipPermissions:r}){let i={"content-type":`application/json`};t&&(i.authorization=`Bearer ${t}`);let a;try{a=await fetch(`${e}/sessions`,{method:`POST`,headers:i,body:Wi({cwd:n,...r&&{dangerously_skip_permissions:!0}})})}catch(t){throw new zu(`Failed to connect to server at ${e}: ${F(t)}`)}if(!a.ok)throw new zu(`Failed to create session: ${a.status} ${a.statusText}`);let o=Ru().safeParse(await a.json());if(!o.success)throw new zu(`Invalid session response: ${o.error.message}`);let s=o.data;return{config:{serverUrl:e,sessionId:s.session_id,wsUrl:s.ws_url,authToken:t},workDir:s.work_dir}}oo(),lo(),Or(),lr(),go(),B(),cc(),eo(),aa(),W(),bi(),ce(),Jr(),ac(),f(),Wa(),Xa(),Mo(),ue(),pe(),L(),en(),ie(),Te(),ra(),ea(),Ji(),or(),it(),Ba(),Bs(),Gt(),Ks(),gt(),K(`main_tsx_entry`),ba(),es();var Vu=(Wn(),e(Ne));K(`main_tsx_imports_loaded`);function Hu(){try{let e=ha(`policySettings`);if(e){let t=ya(e);G(`tengu_managed_settings_loaded`,{keyCount:t.length,keys:t.join(`,`)})}}catch{}}function Uu(){let e=_o(di()??Ko());Tu(Hi(),Oo(e,Ei())),zn().then(({enabled:e,errors:t})=>{let n=ut();et(e,n,Gn()),qe(t,n)}).catch(e=>U(e))}function Wu(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.CLAUDE_CODE_CLIENT_CERT&&(e.has_client_cert=!0),c(`--use-system-ca`)&&(e.has_use_system_ca=!0),c(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function Gu(){if(Gs())return;let[e,t,n]=await Promise.all([Ua(),Va(),wu()]);G(`tengu_startup_telemetry`,{is_git:e,worktree_count:t,gh_auth_status:n,sandbox_enabled:Se.isSandboxingEnabled(),are_unsandboxed_commands_allowed:Se.areUnsandboxedCommandsAllowed(),is_auto_bash_allowed_if_sandbox_enabled:Se.isAutoAllowBashIfSandboxedEnabled(),auto_updater_disabled:Oa(),prefers_reduced_motion:Sa().prefersReducedMotion??!1,...Wu()})}var Ku=11;function qu(){z().migrationVersion!==Ku&&(ku(),Au(),Lu(),Pu(),ju(),Fu(),Mu(),Nu(),Iu(),V(e=>e.migrationVersion===Ku?e:{...e,migrationVersion:Ku}))}function Ju(){if(Bi()){H(`info`,`prefetch_system_context_non_interactive`),Pr();return}Aa()?(H(`info`,`prefetch_system_context_has_trust`),Pr()):H(`info`,`prefetch_system_context_skipped_no_trust`)}function Yu(){d(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)||p()||(Ws(),Rt(),Ju(),wc(),d(process.env.CLAUDE_CODE_USE_BEDROCK)&&!d(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&Vo(),d(process.env.CLAUDE_CODE_USE_VERTEX)&&!d(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&Po(),Ds(Hi(),AbortSignal.timeout(3e3),[]),Ao(),_t.initialize(),p()||fc.initialize())}function Xu(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)io(t)||(process.stderr.write(N.red(`Error: Invalid JSON provided to --settings
484
+ `)),process.exit(1)),r=D(`claude-settings`,`.json`,{contentHash:t}),Xi(r,t,`utf8`);else{let{resolvedPath:t}=$i(ia(),e);try{kc(t,`utf8`)}catch(e){throw Ui(e)&&(process.stderr.write(N.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}ji(r),Ci()}catch(e){e instanceof Error&&U(e),process.stderr.write(N.red(`Error processing settings: ${F(e)}\n`)),process.exit(1)}}function Zu(e){try{Ii(ga(e)),Ci()}catch(e){e instanceof Error&&U(e),process.stderr.write(N.red(`Error processing --setting-sources: ${F(e)}\n`)),process.exit(1)}}function Qu(){K(`eagerLoadSettings_start`);let e=Ou(`--settings`);e&&Xu(e);let t=Ou(`--setting-sources`);t!==void 0&&Zu(t),K(`eagerLoadSettings_end`)}function $u(e){if(process.env.CLAUDE_CODE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.CLAUDE_CODE_ENTRYPOINT=`mcp`;return}if(d(process.env.CLAUDE_CODE_ACTION)){process.env.CLAUDE_CODE_ENTRYPOINT=`claude-code-github-action`;return}process.env.CLAUDE_CODE_ENTRYPOINT=e?`sdk-cli`:`cli`}var Q={url:void 0,authToken:void 0,dangerouslySkipPermissions:!1},$={host:void 0,cwd:void 0,permissionMode:void 0,dangerouslySkipPermissions:!1,local:!1,extraCliArgs:[],remoteBin:void 0};async function ed(){K(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,pl(),process.on(`exit`,()=>{ad();try{let{peekWorkflowService:t}=(En(),e(ln));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),K(`main_warning_handler_initialized`);{let e=process.argv.slice(2),t=e.findIndex(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(t!==-1&&Q){let n=e[t],{parseConnectUrl:r}=await import(`./parseConnectUrl-BiyKR5-x.js`),i=r(n);if(Q.dangerouslySkipPermissions=e.includes(`--dangerously-skip-permissions`),e.includes(`-p`)||e.includes(`--print`)){let r=e.filter((e,n)=>n!==t),i=r.indexOf(`--dangerously-skip-permissions`);i!==-1&&r.splice(i,1),process.argv=[process.argv[0],process.argv[1],`open`,n,...r]}else{Q.url=i.serverUrl,Q.authToken=i.authToken;let n=e.filter((e,n)=>n!==t),r=n.indexOf(`--dangerously-skip-permissions`);r!==-1&&n.splice(r,1),process.argv=[process.argv[0],process.argv[1],...n]}}}{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-kB2eazPX.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-BiVWrpHi.js`),i=await r(n);process.exit(i)}if(process.platform===`darwin`&&process.env.__CFBundleIdentifier===`com.anthropic.claude-code-url-handler`){let{enableConfigs:e}=await import(`./config-kB2eazPX.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-BiVWrpHi.js`),n=await t();process.exit(n??1)}}if($){let e=process.argv.slice(2);if(e[0]===`ssh`){let t=e.indexOf(`--local`);t!==-1&&($.local=!0,e.splice(t,1));let n=e.indexOf(`--dangerously-skip-permissions`);n!==-1&&($.dangerouslySkipPermissions=!0,e.splice(n,1));let r=e.indexOf(`--permission-mode`);r!==-1&&e[r+1]&&!e[r+1].startsWith(`-`)&&($.permissionMode=e[r+1],e.splice(r,2));let i=e.findIndex(e=>e.startsWith(`--permission-mode=`));i!==-1&&($.permissionMode=e[i].split(`=`)[1],e.splice(i,1));let a=(t,n={})=>{let r=e.indexOf(t);if(r!==-1){$.extraCliArgs.push(n.as??t);let i=e[r+1];n.hasValue&&i&&!i.startsWith(`-`)?($.extraCliArgs.push(i),e.splice(r,2)):e.splice(r,1)}let i=e.findIndex(e=>e.startsWith(`${t}=`));i!==-1&&($.extraCliArgs.push(n.as??t,e[i].slice(t.length+1)),e.splice(i,1))},o=e.indexOf(`--remote-bin`);o!==-1&&e[o+1]&&!e[o+1].startsWith(`-`)&&($.remoteBin=e[o+1],e.splice(o,2));let s=e.findIndex(e=>e.startsWith(`--remote-bin=`));s!==-1&&($.remoteBin=e[s].split(`=`).slice(1).join(`=`),e.splice(s,1)),a(`-c`,{as:`--continue`}),a(`--continue`),a(`--resume`,{hasValue:!0}),a(`--model`,{hasValue:!0})}if(e[0]===`ssh`&&e[1]&&!e[1].startsWith(`-`)){$.host=e[1];let t=2;e[2]&&!e[2].startsWith(`-`)&&($.cwd=e[2],t=3);let n=e.slice(t);if(n.includes(`-p`)||n.includes(`--print`)){process.stderr.write(`Error: headless (-p/--print) mode is not supported with claude ssh
485
+ `),Xt(1);return}process.argv=[process.argv[0],process.argv[1],...n]}}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=d(process.env.CLAUDE_CODE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&vc(),yi(!o),$u(o);let s=(()=>{if(d(process.env.GITHUB_ACTIONS))return`github-action`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-ts`)return`sdk-typescript`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-py`)return`sdk-python`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-cli`)return`sdk-cli`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-vscode`)return`claude-vscode`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`)return`local-agent`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`)return`claude-desktop`;let e=process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;return process.env.CLAUDE_CODE_ENTRYPOINT===`remote`||e?`remote`:`cli`})();Pi(s);let c=process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;c===`markdown`||c===`html`?mi(c):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&s!==`remote`&&mi(`markdown`),process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`&&vi(`remote-control`),K(`main_client_type_determined`),Qu(),K(`main_before_run`),await nd(),K(`main_after_run`)}async function td(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 za(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.
486
+ `),[e,n].filter(Boolean).join(`
487
+ `)}return e}async function nd(){K(`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 Gc().configureHelp(e()).enablePositionalOptions();K(`run_commander_initialized`),t.hook(`preAction`,async e=>{K(`preAction_start`),await Promise.all([pa(),rs()]),K(`preAction_after_mdm`),await el(),K(`preAction_after_init`),d(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)||(process.title=`claude`);let{initSinks:t}=await import(`./sinks-WJ7nzLQs.js`);t(),K(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(zi(n),nr(`preAction: --plugin-dir inline plugins`)),qu(),K(`preAction_after_migrations`),Zs(),Tn(),K(`preAction_after_remote_settings`),K(`preAction_after_settings_sync`)}),t.name(`claude`).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 J(`--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 Claude 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 CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new J(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new J(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new J(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new J(`--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 J(`--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 J(`--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 J(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new J(`--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 J(`--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 J(`--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 J(`--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).addOption(new J(`--enable-auth-status`,`Enable auth status messages in SDK mode`).default(!1).hideHelp()).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 J(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new J(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new J(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new J(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new J(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new J(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(oa)).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 J(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new J(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new J(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new J(`--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 J(`--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 J(`--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 J(`--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(`--ide`,`Automatically connect to IDE on startup if exactly one valid IDE is available`,()=>!0).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(`--chrome`,`Enable Claude in Chrome integration`).option(`--no-chrome`,`Disable Claude in Chrome integration`).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)=>{K(`action_handler_start`),t.bare&&(process.env.CLAUDE_CODE_SIMPLE=`1`),e===`code`&&(G(`tengu_code_prompt_ignored`,{}),console.warn(N.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&G(`tengu_single_word_prompt`,{length:e.length});let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:c=[],mcpConfig:l=[],permissionMode:u,addDir:f=[],fallbackModel:m,betas:h=[],ide:g=!1,sessionId:_,includeHookEvents:ee,includePartialMessages:te}=t;t.prefill&&yc(t.prefill);let re,ie=t.agents,ae=t.agent;ae&&(process.env.CLAUDE_CODE_AGENT=ae);let y=t.outputFormat,b=t.inputFormat,se=t.verbose??z().verbose,ce=t.print,le=t.init??!1,ue=t.initOnly??!1,fe=t.maintenance??!1,pe=t.disableSlashCommands||!1,he=qs()?t.worktree:void 0,_e=typeof he==`string`?he:void 0,ye=he!==void 0,be;if(_e){let e=xn(_e);e!==null&&(be=e,_e=void 0)}let Se=qs()&&t.tmux===!0;Se&&(ye||(process.stderr.write(N.red(`Error: --tmux requires --worktree
488
+ `)),process.exit(1)),$a()===`windows`&&(process.stderr.write(N.red(`Error: --tmux is not supported on Windows
489
+ `)),process.exit(1)),await ve()||(process.stderr.write(N.red(`Error: tmux is not installed.\n${me()}\n`)),process.exit(1)));let we=t.sdkUrl??void 0,Te=te||d(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);(ee||d(process.env.CLAUDE_CODE_REMOTE))&&at(!0),we&&(b||(b=`stream-json`),y||(y=`stream-json`),t.verbose===void 0&&(se=!0),t.print||(ce=!0));let x=t.teleport??null,De=t.remote,Oe=De===!0?``:De??null,ke=t.remoteControl??t.rc,Ae=typeof ke==`string`&&ke.length>0?ke:void 0;if(_&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(N.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
490
+ `)),process.exit(1)),!we)){let e=tr(_);e||(process.stderr.write(N.red(`Error: Invalid session ID. Must be a valid UUID.
491
+ `)),process.exit(1)),an(e)&&(process.stderr.write(N.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let je=t.file;if(je&&je.length>0){let e=Ss();e||(process.stderr.write(N.red(`Error: Session token required for file downloads. CLAUDE_CODE_SESSION_ACCESS_TOKEN must be set.
492
+ `)),process.exit(1));let t=process.env.CLAUDE_CODE_REMOTE_SESSION_ID||Ri(),n=br(je);n.length>0&&(re=dt(n,{baseUrl:process.env.ANTHROPIC_BASE_URL||so().BASE_API_URL,oauthToken:e,sessionId:t}))}let S=Bi();m&&t.model&&m===t.model&&(process.stderr.write(N.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
493
+ `)),process.exit(1));let Ne=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(N.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
494
+ `)),process.exit(1));try{Ne=kc(Ec(t.systemPromptFile),`utf8`)}catch(e){Gi(e)===`ENOENT`&&(process.stderr.write(N.red(`Error: System prompt file not found: ${Ec(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(N.red(`Error reading system prompt file: ${F(e)}\n`)),process.exit(1)}}let Pe=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(N.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
495
+ `)),process.exit(1));try{Pe=kc(Ec(t.appendSystemPromptFile),`utf8`)}catch(e){Gi(e)===`ENOENT`&&(process.stderr.write(N.red(`Error: Append system prompt file not found: ${Ec(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(N.red(`Error reading append system prompt file: ${F(e)}\n`)),process.exit(1)}}let{mode:Fe,notification:Ie}=_r({permissionModeCli:u,dangerouslySkipPermissions:i});xi(Fe===`bypassPermissions`),(t.enableAutoMode||u===`auto`||Fe===`auto`||!u&&Xe())&&Vu?.setAutoModeFlagCli(!0);let Le={};if(l&&l.length>0){let e=l.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=io(r);if(a){let t=wn({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=on({filePath:Ec(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(`
496
+ `);I(`--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}=An(qt(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${po(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),Le={...Le,...e}}}let Re=t.strictMcpConfig||!1;Nt()&&(Re&&(process.stderr.write(N.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),Le&&!qn(Le)&&(process.stderr.write(N.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),Ni(f);let Ve=await ft({allowedToolsCli:s,disallowedToolsCli:c,baseToolsCli:o,permissionMode:Fe,allowDangerouslySkipPermissions:a,addDirs:f}),C=Ve.toolPermissionContext,{warnings:Ue,dangerousPermissions:We}=Ve;We.length>0&&(C=ze(C)),Ue.forEach(e=>{console.error(e)});let Ke=S&&!Re&&!Nt()&&!p()?jr().then(e=>{let{allowed:t,blocked:n}=An(e);return n.length>0&&process.stderr.write(`Warning: claude.ai MCP ${po(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),t}):Promise.resolve({});I(`[STARTUP] Loading MCP configs...`);let qe=Date.now(),Je,Ye=(Re||p()?Promise.resolve({servers:{}}):zt(Le)).then(e=>(Je=Date.now()-qe,e));b&&b!==`text`&&b!==`stream-json`&&(console.error(`Error: Invalid input format "${b}".`),process.exit(1)),b===`stream-json`&&y!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),we&&(b!==`stream-json`||y!==`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`||y!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),Te&&(!S||y!==`stream-json`)&&(La(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!S&&(La(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let w=await td(e||``,b??`text`);K(`action_after_input_prompt`),id(t);let $e=Zt(C);K(`action_tools_loaded`);let et;if(ps({isNonInteractiveSession:S})&&t.jsonSchema&&(et=Yi(t.jsonSchema)),et){let e=ls(et);`tool`in e?($e=[...$e,e.tool],G(`tengu_structured_output_enabled`,{schema_property_count:Object.keys(et.properties||{}).length,has_required_fields:!!et.required})):G(`tengu_structured_output_failure`,{error:`Invalid JSON schema`})}K(`action_before_setup`),I(`[STARTUP] Running setup()...`);let tt=Date.now(),{setup:nt}=await import(`./setup-C62oq4AZ.js`),rt=Hi();process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&Cu();let it=nt(rt,Fe,a,ye,_e,Se,_?tr(_):void 0,be,void 0),ot=ye?null:Ce(rt),st=ye?null:dn(rt);ot?.catch(()=>{}),st?.catch(()=>{}),await it,I(`[STARTUP] setup() completed in ${Date.now()-tt}ms`),K(`action_after_setup`);let lt=!!t.replayUserMessages;Bi()&&(lc(),Pr(),Rt(),xo());let ut=t.name?.trim();ut&&vt(ut);let gt=t.model==="default"?Ko():t.model,_t=m==="default"?Ko():m,yt=ye?Hi():rt;I(`[STARTUP] Loading commands and agents...`);let St=Date.now(),[Ct,wt]=await Promise.all([ot??Ce(yt),st??dn(yt)]);I(`[STARTUP] Commands and agents loaded in ${Date.now()-St}ms`),K(`action_commands_loaded`);let Et=[];if(ie)try{let e=io(ie);e&&(Et=$t(e,`flagSettings`))}catch(e){U(e)}let Dt=[...wt.allAgents,...Et],Ot={...wt,allAgents:Dt,activeAgents:Kn(Dt)},kt=ae??Sa().agent,T;if(kt&&(T=Ot.activeAgents.find(e=>e.agentType===kt),T||I(`Warning: agent "${kt}" not found. Available agents: ${Ot.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),gi(T?.agentType),T&&G(`tengu_agent_flag`,{agentType:Zn(T)?T.agentType:`custom`,...ae&&{source:`cli`}}),T?.agentType&&er(T.agentType),S&&T&&!Ne&&!Zn(T)){let e=T.getSystemPrompt();e&&(Ne=e)}T?.initialPrompt&&(typeof w==`string`?w=w?`${T.initialPrompt}\n\n${w}`:T.initialPrompt:w||(w=T.initialPrompt));let Ft=gt;!Ft&&T?.model&&T.model!==`inherit`&&(Ft=_o(T.model)),hi(Ft),wi(Bo()||null);let Lt=di(),E=_o(Lt??Ko()),D;if(Be()){let e=Ze()?t.advisor:void 0;e&&(I(`[AdvisorTool] --advisor ${e}`),Qe(E)||(process.stderr.write(N.red(`Error: The model "${E}" does not support the advisor tool.\n`)),process.exit(1)),Ge(Eo(_o(e)))||(process.stderr.write(N.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),D=Ze()?e??bn():e,D&&I(`[AdvisorTool] Advisor model: ${D}`)}if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let e=`
497
+ # Proactive Mode
498
+
499
+ You are in proactive mode. Take initiative — explore, act, and make progress without waiting for instructions.
500
+
501
+ Start by briefly greeting the user.
502
+
503
+ 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.`;Pe=Pe?`${Pe}\n\n${e}`:e}let O,k,A;if(!S){let t=El(!1);k=t.getFpsMetrics,A=t.stats;let{createRoot:n}=await import(`./src-r6ZFgWPx2.js`);O=await n(t.renderOptions),G(`tengu_timer`,{event:`startup`,durationMs:Math.round(process.uptime()*1e3)}),I(`[STARTUP] Running showSetupScreens()...`);let r=Date.now(),i=await Tl(O,Fe,a,Ct);I(`[STARTUP] showSetupScreens() completed in ${Date.now()-r}ms`),i&&e?.trim().toLowerCase()===`/login`&&(e=``),i&&(Xs(),sn(),Hs(),import(`./trustedDevice-B6AKlsl_.js`).then(e=>(e.clearTrustedDeviceToken(),e.enrollTrustedDevice())));let o=await qo();o.valid||await X(O,o.message)}if(process.exitCode!==void 0){I(`Graceful shutdown initiated, skipping further initialization`);return}if(Ir(),!S){let{errors:e}=Ca(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await Dl(O,{settingsErrors:t,onExit:()=>Xt(1)})}let Ht=z().startupPrefetchedAt??0;p()?(I(`Skipping startup prefetches, last ran ${Math.round((Date.now()-Ht)/1e3)}s ago`),Qo()):(I(`Starting background startup prefetches${Ht>0?` last ran ${Math.round((Date.now()-Ht)/1e3)}s ago`:``}`),In().catch(e=>U(e)),sl(),Wo()),S||xc();let{servers:Ut}=await Ye;I(`[STARTUP] MCP configs resolved in ${Je}ms (awaited at +${Date.now()-qe}ms)`);let Wt={...Ut,...Le},Gt={},Yt={};for(let[e,t]of Object.entries(Wt)){let n=t;n.type===`sdk`?Gt[e]=n:Yt[e]=n}K(`action_mcp_configs_loaded`);let en=S?Promise.resolve({clients:[],tools:[],commands:[]}):Bt(Yt),nn=S?Promise.resolve({clients:[],tools:[],commands:[]}):Ke.then(e=>Object.keys(e).length>0?Bt(e):{clients:[],tools:[],commands:[]}),ln=Promise.all([en,nn]).then(([e,t])=>({clients:[...e.clients,...t.clients],tools:Me([...e.tools,...t.tools],`name`),commands:Me([...e.commands,...t.commands],`name`)})),pn=ue||le||fe||S||t.continue||t.resume?null:oe(`startup`,{agentType:T?.agentType,model:E}),mn=[];ln.catch(()=>{});let _n=[],yn=[],Sn=[],Cn=jt(),j=Cn===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)Cn=!0,j={type:`adaptive`};else if(t.thinking===`disabled`)Cn=!1,j={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(Cn=!0,j={type:`enabled`,budgetTokens:e}):e===0&&(Cn=!1,j={type:`disabled`}))}H(`info`,`started`,{version:`0.0.11`,is_native_binary:uo()}),na(async()=>{H(`info`,`exited`)}),rd({hasInitialPrompt:!!e,hasStdin:!!w,verbose:se,debug:n,debugToStderr:r,print:ce??!1,outputFormat:y??`text`,inputFormat:b??`text`,numAllowedTools:s.length,numDisallowedTools:c.length,mcpClientCount:Object.keys(Wt).length,worktreeEnabled:ye,skipWebFetchPreflight:Sa().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:Fe,modeIsBypass:Fe===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:Ne?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:Pe?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:j,assistantActivationPath:void 0}),Pt(Yt,C),Hu(),It().then(e=>{e&&(ut&&de(ut),At().then(e=>{e>=2&&G(`tengu_concurrent_sessions`,{num_sessions:e})}))}),p()||(S?(await ht(),K(`action_after_plugins_init`),Pn().then(()=>He())):ht().then(async()=>{K(`action_after_plugins_init`),await Pn(),He()}));let Tn=ue||le?`init`:fe?`maintenance`:null;if(ue){lc(),await xt(`init`,{forceSyncExecution:!0}),await oe(`startup`,{forceSyncExecution:!0}),Xt(0);return}if(S){(y===`stream-json`||y===`json`)&&ta(!0),lc(),tl();let e=t.continue||t.resume||x||Tn?void 0:oe(`startup`);e?.catch(()=>{}),K(`before_validateForceLoginOrg`);let n=await qo();n.valid||(process.stderr.write(n.message+`
504
+ `),process.exit(1));let r=pe?[]:Ct.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),i=Jt(),a=vn({...i,mcp:{...i.mcp,clients:_n,commands:Sn,tools:yn},toolPermissionContext:C,...Xo()&&{fastMode:jo(Ft??null)},...Be()&&D&&{advisorModel:D}},uc);xe(C,a.getState().fastMode).then(({updateContext:e})=>{a.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&Si(!0),pi(vo(h));let o=(e,t)=>Object.keys(e).length===0?Promise.resolve():(a.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),Fn(({client:e,tools:t,commands:n})=>{a.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:Me([...r.mcp.tools,...t],`name`),commands:Me([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>I(`[MCP] ${t} connect error: ${e}`)));K(`before_connectMcp`),await o(Yt,`regular`),K(`after_connectMcp`);let c=5e3,l=Ke.then(e=>{if(Object.keys(e).length>0){let t=new Set;for(let n of Object.values(e)){let e=Vt(n);e&&t.add(e)}let n=new Set;for(let[e,r]of Object.entries(Yt)){if(!e.startsWith(`plugin:`))continue;let i=Vt(r);i&&t.has(i)&&n.add(e)}if(n.size>0){I(`[MCP] Lazy dedup: suppressing ${n.size} plugin server(s) that duplicate claude.ai connectors: ${[...n].join(`, `)}`);for(let e of a.getState().mcp.clients)!n.has(e.name)||e.type!==`connected`||(e.client.onclose=void 0,Qt(e.name,e.config).catch(()=>{}));a.setState(e=>{let{clients:t,tools:r,commands:i,resources:a}=e.mcp;t=t.filter(e=>!n.has(e.name)),r=r.filter(e=>!e.mcpInfo||!n.has(e.mcpInfo.serverName));for(let e of n)i=Tt(i,e),a=Ee(a,e);return{...e,mcp:{...e.mcp,clients:t,tools:r,commands:i,resources:a}}})}}let{servers:t}=fn(e,Ea(Yt,(e,t)=>!t.startsWith(`plugin:`)));return o(t,`claudeai`)}),u,d=await Promise.race([l.then(()=>!1),new Promise(e=>{u=setTimeout(e=>e(!0),c,e)})]);u&&clearTimeout(u),d&&I(`[MCP] claude.ai connectors not ready after ${c}ms — proceeding; background connection continues`),K(`after_connectMcp_claudeai`),p()||(Yu(),import(`./backgroundHousekeeping-BTy71bcY.js`).then(e=>e.startBackgroundHousekeeping())),Uu(),K(`before_print_import`);let{runHeadless:f}=await import(`./print-BZOx09SU.js`);K(`after_print_import`),f(w,()=>a.getState(),a.setState,r,$e,Gt,Ot.activeAgents,{continue:t.continue,resume:t.resume,verbose:se,outputFormat:y,jsonSchema:et,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:j,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:Ne,appendSystemPrompt:Pe,userSpecifiedModel:Ft,fallbackModel:_t,teleport:x,sdkUrl:we,replayUserMessages:lt,includePartialMessages:Te,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,enableAuthStatus:t.enableAuthStatus,agent:ae,workload:t.workload,setupTrigger:Tn??void 0,sessionStartHooksPromise:e});return}G(`tengu_startup_manual_model_config`,{cli_flag:t.model,env_var:process.env.ANTHROPIC_MODEL,settings_file:(Sa()||{}).model,subscriptionType:bo(),agent:kt});let En=Cc(E),Dn=[];Ie&&Dn.push({key:`permission-mode-notification`,text:Ie,priority:`high`}),En&&Dn.push({key:`model-deprecation-warning`,text:En,color:`warning`,priority:`high`});let On={...C},kn=Ma(),M={settings:Sa(),tasks:{},agentNameRegistry:new Map,verbose:se??z().verbose??!1,mainLoopModel:Lt,mainLoopModelForSession:null,expandedView:z().showExpandedTodos?`tasks`:`none`,selectedIPAgentIndex:-1,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:On,agent:T?.agentType,agentDefinitions:Ot,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,remoteSessionUrl:void 0,remoteConnectionStatus:`connecting`,remoteBackgroundTaskCount:0,replBridgeEnabled:kn||!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:Ae,showRemoteCallout:!1,notifications:{current:null,queue:Dn},elicitation:{queue:[]},todos:{},remoteAgentTaskSuggestions:[],fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:Hn(),thinkingEnabled:Cn,promptSuggestionEnabled:jn(),sessionHooks:new Map,inbox:{messages:[]},promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:ne,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:w?{message:pt({content:String(w)})}:null,activeOverlays:new Set,fastMode:jo(E),...Be()&&D&&{advisorModel:D}};w&&hn(String(w));let Mn=yn;V(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{Gu(),Uu()});let Nn={debug:n||r,commands:[...Ct,...Sn],initialTools:Mn,mcpClients:_n,autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,dynamicMcpConfig:Le,strictMcpConfig:Re,systemPrompt:Ne,appendSystemPrompt:Pe,thinkingConfig:j},Ln={mainThreadAgentDefinition:T,agentDefinitions:Ot,currentCwd:yt,cliAgents:Et,initialState:M};if(t.continue){let e=!1;try{let n=performance.now(),{clearSessionCaches:r}=await import(`./caches-B8sM3Zys.js`);r();let i=await ge(void 0,void 0);if(!i)return G(`tengu_continue`,{success:!1}),await X(O,`No conversation found to continue`);let a=await dc(i,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:i.fullPath},Ln);a.restoredAgentDef&&(T=a.restoredAgentDef),id(t),G(`tengu_continue`,{success:!0,resume_duration_ms:Math.round(performance.now()-n)}),e=!0,await il(O,{getFpsMetrics:k,stats:A,initialState:a.initialState},{...Nn,mainThreadAgentDefinition:a.restoredAgentDef??T,initialMessages:a.messages,initialFileHistorySnapshots:a.fileHistorySnapshots,initialContentReplacements:a.contentReplacements,initialAgentName:a.agentName,initialAgentColor:a.agentColor},wl)}catch(t){e||G(`tengu_continue`,{success:!1}),U(t),process.exit(1)}}else if(Q?.url){let e;try{let t=await Bu({serverUrl:Q.url,authToken:Q.authToken,cwd:Oi(),dangerouslySkipPermissions:Q.dangerouslySkipPermissions});t.workDir&&(li(t.workDir),Ti(t.workDir)),ki(Q.url),e=t.config}catch(e){return await X(O,e instanceof zu?e.message:String(e),()=>v(1))}let t=ct(`Connected to server at ${Q.url}\nSession: ${e.sessionId}`,`info`);await il(O,{getFpsMetrics:k,stats:A,initialState:M},{debug:n||r,commands:Ct,initialTools:[],initialMessages:[t],mcpClients:[],autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,directConnectConfig:e,thinkingConfig:j},wl);return}else if($?.host){let{createSSHSession:e,createLocalSSHSession:t,SSHSessionError:i}=await import(`./createSSHSession-DecOR6M5.js`),a;try{if($.local)process.stderr.write(`Starting local ssh-proxy test session...
505
+ `),a=await t({cwd:$.cwd,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions});else{process.stderr.write(`Connecting to ${$.host}…\n`);let t=process.stderr.isTTY,n=!1;a=await e({host:$.host,cwd:$.cwd,localVersion:`0.0.11`,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions,extraCliArgs:$.extraCliArgs,remoteBin:$.remoteBin},t?{onProgress:e=>{n=!0,process.stderr.write(`\r ${e}\x1b[K`)}}:{}),n&&process.stderr.write(`
506
+ `)}li(a.remoteCwd),Ti(a.remoteCwd),ki($.local?`local`:$.host)}catch(e){return await X(O,e instanceof i?e.message:String(e),()=>v(1))}let o=ct($.local?`Local ssh-proxy test session\ncwd: ${a.remoteCwd}\nAuth: unix socket → local proxy`:`SSH session to ${$.host}\nRemote cwd: ${a.remoteCwd}\nAuth: unix socket -R → local proxy`,`info`);await il(O,{getFpsMetrics:k,stats:A,initialState:M},{debug:n||r,commands:Ct,initialTools:[],initialMessages:[o],mcpClients:[],autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,sshSession:a,thinkingConfig:j},wl);return}else if(t.resume||t.fromPr||x||Oe!==null){let{clearSessionCaches:e}=await import(`./caches-B8sM3Zys.js`);e();let i=null,a,o=tr(t.resume),s,c=null,l;if(t.fromPr&&(t.fromPr===!0?l=!0:typeof t.fromPr==`string`&&(l=t.fromPr)),t.resume&&typeof t.resume==`string`&&!o){let e=t.resume.trim();if(e){let t=await cn(e,{exact:!0});t.length===1?(c=t[0],o=un(c)??null):s=e}}if((Oe!==null||x)&&(await rn(),!tn(`allow_remote_sessions`)))return await X(O,`Error: Remote sessions are disabled by your organization's policy.`,()=>v(1));if(Oe!==null){let e=Oe.length>0;if(!e)return await X(O,`Error: --remote requires a description.
507
+ Usage: claude --remote "your task description"`,()=>v(1));G(`tengu_remote_create_session`,{has_initial_prompt:String(e)});let t=await Ha(),i=await Mt(O,e?Oe:null,new AbortController().signal,t||void 0);if(!i)return G(`tengu_remote_create_session_error`,{error:`unable_to_create_session`}),await X(O,`Error: Unable to create remote session`,()=>v(1));G(`tengu_remote_create_session_success`,{session_id:i.id}),process.stdout.write(`Created remote session: ${i.title}\n`),process.stdout.write(`View: ${bt(i.id)}?m=0\n`),process.stdout.write(`Resume with: claude --teleport ${i.id}\n`),await v(0),process.exit(0),ui(!0),Li(Qn(i.id));let a;try{a=await zs()}catch(e){return U(Zi(e)),await X(O,`Error: ${F(e)||`Failed to authenticate`}`,()=>v(1))}let{getClaudeAIOAuthTokens:o}=await import(`./auth-DN1MUpB8.js`),s=Sc(i.id,()=>o()?.accessToken??a.accessToken,a.orgUUID,e),c=`${bt(i.id)}?m=0`,l=ct(`/remote-control is active. Code in CLI or at ${c}`,`info`),u=e?pt({content:Oe}):null,d={...M,remoteSessionUrl:c},f=gn(Ct);await il(O,{getFpsMetrics:k,stats:A,initialState:d},{debug:n||r,commands:f,initialTools:[],initialMessages:u?[l,u]:[l],mcpClients:[],autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,remoteSessionConfig:s,thinkingConfig:j},wl);return}else if(x){if(x===!0||x===``){G(`tengu_teleport_interactive_mode`,{}),I(`selectAndResumeTeleportTask: Starting teleport flow...`);let e=await Ol(O);e||(await v(0),process.exit(0));let{branchError:t}=await ur(e.branch);i=Bn(e.log,t)}else if(typeof x==`string`){G(`tengu_teleport_resume_session`,{mode:`direct`});try{let e=await Nr(await Vs(x));if(e.status===`mismatch`||e.status===`not_in_repo`){let t=e.sessionRepo;if(t){let e=await _c(gc(t));if(e.length>0){let n=await kl(O,{targetRepo:t,initialPaths:e});n?(process.chdir(n),Kt(n),li(n)):await v(0)}else throw new Ki(`You must run claude --teleport ${x} from a checkout of ${t}.`,N.red(`You must run claude --teleport ${x} from a checkout of ${N.bold(t)}.\n`))}}else if(e.status===`error`)throw new Ki(e.errorMessage||`Failed to validate session`,N.red(`Error: ${e.errorMessage||`Failed to validate session`}\n`));await gr();let{teleportWithProgress:t}=await import(`./TeleportProgress-C2LQVLav.js`),n=await t(O,x);Fi({sessionId:x}),i=n.messages}catch(e){e instanceof Ki?process.stderr.write(e.formattedMessage+`
508
+ `):(U(e),process.stderr.write(N.red(`Error: ${F(e)}\n`))),await v(1)}}}if(o){let e=o;try{let n=performance.now(),r=await ge(c??e,void 0);if(!r)return G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),await X(O,`No conversation found with session ID: ${e}`);let i=c?.fullPath??r.fullPath;a=await dc(r,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:i},Ln),a.restoredAgentDef&&(T=a.restoredAgentDef),G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!0,resume_duration_ms:Math.round(performance.now()-n)})}catch(t){G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),U(t),await X(O,`Failed to resume session ${e}`)}}if(re)try{let e=await re,t=ca(e,e=>!e.success);t>0&&process.stderr.write(N.yellow(`Warning: ${t}/${e.length} file(s) failed to download.\n`))}catch(e){return await X(O,`Error downloading files: ${F(e)}`)}let u=a??(Array.isArray(i)?{messages:i,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:T,initialState:M,contentReplacements:void 0}:void 0);u?(id(t),await il(O,{getFpsMetrics:k,stats:A,initialState:u.initialState},{...Nn,mainThreadAgentDefinition:u.restoredAgentDef??T,initialMessages:u.messages,initialFileHistorySnapshots:u.fileHistorySnapshots,initialContentReplacements:u.contentReplacements,initialAgentName:u.agentName,initialAgentColor:u.agentColor},wl)):await Al(O,{getFpsMetrics:k,stats:A,initialState:M},mt(Oi()),{...Nn,initialSearchQuery:s,forkSession:t.forkSession,filterByPr:l})}else{let e=pn&&mn.length===0?pn:void 0;K(`action_after_hooks`),id(t);let n=null;t.deepLinkOrigin?(G(`tengu_deep_link_opened`,{has_prefill:!!t.prefill,has_repo:!!t.deepLinkRepo}),n=ct(bc({cwd:Hi(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=ct(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...mn]:mn.length>0?mn:void 0;await il(O,{getFpsMetrics:k,stats:A,initialState:M},{...Nn,initialMessages:r,pendingHookMessages:e},wl)}}).version(`0.0.11 (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.`),Ze()&&t.addOption(new J(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new J(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new J(`--proactive`,`Start in proactive autonomous mode`)),t.addOption(new J(`--sdk-url <url>`,`Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)`).hideHelp()),t.addOption(new J(`--teleport [session]`,`Resume a teleport session, optionally specify session ID`).hideHelp()),t.addOption(new J(`--remote [description]`,`Create a remote session with the given description`).hideHelp()),K(`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 K(`run_before_parse`),await t.parseAsync(process.argv),K(`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-Ct4Sum6A.js`);await n({debug:e,verbose:t})}),Eu(i),je()&&Du(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-Ct4Sum6A.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-Ct4Sum6A.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-Ct4Sum6A.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`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-Ct4Sum6A.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Claude 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-Ct4Sum6A.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-Ct4Sum6A.js`);await e()}),t.command(`server`).description(`Start a Work Mate session server`).option(`--port <number>`,`HTTP port`,`0`).option(`--host <string>`,`Bind address`,`0.0.0.0`).option(`--auth-token <token>`,`Bearer token for auth`).option(`--unix <path>`,`Listen on a unix domain socket`).option(`--workspace <dir>`,`Default working directory for sessions that do not specify cwd`).option(`--idle-timeout <ms>`,`Idle timeout for detached sessions in ms (0 = never expire)`,`600000`).option(`--max-sessions <n>`,`Maximum concurrent sessions (0 = unlimited)`,`32`).action(async e=>{let{randomBytes:t}=await import(`crypto`),{startServer:n}=await import(`./server-LdbAb0sV.js`),{SessionManager:r}=await import(`./sessionManager-CPa049BO.js`),{DangerousBackend:i}=await import(`./dangerousBackend-DwcP0P08.js`),{printBanner:a}=await import(`./serverBanner-BdExKFHT.js`),{createServerLogger:o}=await import(`./serverLog-BFmvyJ93.js`),{writeServerLock:s,removeServerLock:c,probeRunningServer:l}=await import(`./lockfile-D5-j7HOZ.js`),u=await l();u&&(process.stderr.write(`A claude server is already running (pid ${u.pid}) at ${u.httpUrl}\n`),process.exit(1));let d=e.authToken??`sk-ant-cc-${t(16).toString(`base64url`)}`,f={port:parseInt(e.port,10),host:e.host,authToken:d,unix:e.unix,workspace:e.workspace,idleTimeoutMs:parseInt(e.idleTimeout,10),maxSessions:parseInt(e.maxSessions,10)},p=new r(new i,{idleTimeoutMs:f.idleTimeoutMs,maxSessions:f.maxSessions}),m=n(f,p,o()),h=m.port??f.port;a(f,d,h),await s({pid:process.pid,port:h,host:f.host,httpUrl:f.unix?`unix:${f.unix}`:`http://${f.host}:${h}`,startedAt:Date.now()});let g=!1,_=async()=>{g||(g=!0,m.stop(!0),await p.destroyAll(),await c(),process.exit(0))};process.once(`SIGINT`,()=>void _()),process.once(`SIGTERM`,()=>void _())}),t.command(`ssh <host> [dir]`).description(`Run Work Mate on a remote host over SSH. Deploys the binary and tunnels API auth back through your local machine — no remote setup needed.`).option(`--permission-mode <mode>`,`Permission mode for the remote session`).option(`--dangerously-skip-permissions`,`Skip all permission prompts on the remote (dangerous)`).option(`--remote-bin <command>`,`Custom remote binary command (skips probe/deploy). Example: --remote-bin 'bun /path/to/project/dist/cli.js'`).option(`--local`,`e2e test mode — spawn the child CLI locally (skip ssh/deploy). Exercises the auth proxy and unix-socket plumbing without a remote host.`).action(async()=>{process.stderr.write(`Usage: claude ssh <user@host | ssh-config-alias> [dir]
509
+
510
+ Runs Work Mate on a remote Linux host. You don't need to install
511
+ anything on the remote — the binary is
512
+ deployed over SSH and API auth tunnels back through your local machine.
513
+ `),process.exit(1)}),t.command(`open <cc-url>`).description(`Connect to a Work Mate server (internal — use cc:// URLs)`).option(`-p, --print [prompt]`,`Print mode (headless)`).option(`--output-format <format>`,`Output format: text, json, stream-json`,`text`).action(async(e,t)=>{let{parseConnectUrl:n}=await import(`./parseConnectUrl-BiyKR5-x.js`),{serverUrl:r,authToken:i}=n(e),a;try{let e=await Bu({serverUrl:r,authToken:i,cwd:Oi(),dangerouslySkipPermissions:Q?.dangerouslySkipPermissions});e.workDir&&(li(e.workDir),Ti(e.workDir)),ki(r),a=e.config}catch(e){console.error(e instanceof zu?e.message:String(e)),process.exit(1)}let{runConnectHeadless:o}=await import(`./connectHeadless-CqRoEtrg.js`),s=typeof t.print==`string`?t.print:``,c=t.print===!0;await o(a,s,t.outputFormat,c)});let a=t.command(`auth`).description(`Manage authentication`).configureHelp(e());a.command(`login`).description(`Sign in`).option(`--email <email>`,`Pre-populate email address on the login page`).option(`--sso`,`Force SSO login flow`).option(`--console`,`Use Console (API usage billing) instead of Claude subscription`).option(`--claudeai`,`Use Claude subscription (default)`).action(async({email:e,sso:t,console:n,claudeai:r})=>{let{authLogin:i}=await import(`./auth-DGZzCbU0.js`);await i({email:e,sso:t,console:n,claudeai:r})}),a.command(`status`).description(`Show authentication status`).option(`--json`,`Output as JSON (default)`).option(`--text`,`Output as human-readable text`).action(async e=>{let{authStatus:t}=await import(`./auth-DGZzCbU0.js`);await t(e)});let o=()=>new J(`--cowork`,`Use cowork_plugins directory`).hideHelp(),s=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());s.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(o()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(o()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-CBW7kPyp.js`);await t(e)});let c=s.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());if(c.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(o()).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-CBW7kPyp.js`);await n(e,t)}),c.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(o()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-CBW7kPyp.js`);await t(e)}),c.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(o()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),c.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(o()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.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(o()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.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 (~/.claude/plugins/data/{id}/)`).addOption(o()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${oc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${oc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${ic.join(`, `)} (default: user)`).addOption(o()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),t.command(`setup-token`).description(`Set up a long-lived authentication token (requires Claude subscription)`).action(async()=>{let[{setupTokenHandler:e},{createRoot:t}]=await Promise.all([import(`./util-B4oMhJKh.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(mc(!1)))}),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-CMC0iQP4.js`);await e(),process.exit(0)}),kr()!==`disabled`){let e=t.command(`auto-mode`).description(`Inspect auto mode classifier configuration`);e.command(`defaults`).description(`Print the default auto mode environment, allow, and deny rules as JSON`).action(async()=>{let{autoModeDefaultsHandler:e}=await import(`./autoMode-CBtY7ACs.js`);e(),process.exit(0)}),e.command(`config`).description(`Print the effective auto mode config as JSON: your settings where set, defaults otherwise`).action(async()=>{let{autoModeConfigHandler:e}=await import(`./autoMode-CBtY7ACs.js`);e(),process.exit(0)}),e.command(`critique`).description(`Get AI feedback on your custom auto mode rules`).option(`--model <model>`,`Override which model is used`).action(async e=>{let{autoModeCritiqueHandler:t}=await import(`./autoMode-CBtY7ACs.js`);await t(e),process.exit()})}{let e=t.command(`autonomy`).description(`Inspect and manage automatic autonomy runs and flows`);e.command(`status`).description(`Print autonomy run, flow, team, pipe, and remote-control status`).option(`--deep`,`Include teams, pipes, daemon, and remote-control sections`).action(async e=>{let{autonomyStatusHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)}),e.command(`runs [limit]`).description(`List recent autonomy runs`).action(async e=>{let{autonomyRunsHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)}),e.command(`flows [limit]`).description(`List recent autonomy flows`).action(async e=>{let{autonomyFlowsHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)});let n=e.command(`flow <flowId>`).description(`Inspect a single autonomy flow`).action(async e=>{let{autonomyFlowHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)});n.command(`cancel <flowId>`).description(`Cancel a queued, waiting, or running autonomy flow`).action(async e=>{let{autonomyFlowCancelHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)}),n.command(`resume <flowId>`).description(`Resume a waiting autonomy flow`).action(async e=>{let{autonomyFlowResumeHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)})}return 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-B4oMhJKh.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(mc(!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-B4oMhJKh.js`);await n(e,t)}),t.command(`update`).description(`Update workmate to the latest version`).action(async()=>{let{updateCCB:e}=await import(`./updateCCB-C6XftzIG.js`);await e()}),K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),K(`main_after_run`),ao(),t}async function rd({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktreeEnabled:d,skipWebFetchPreflight:f,githubActionInputs:h,dangerouslySkipPermissionsPassed:g,permissionMode:_,modeIsBypass:ee,allowDangerouslySkipPermissionsPassed:te,systemPromptFlag:v,appendSystemPromptFlag:ne,thinkingConfig:re,assistantActivationPath:ie}){try{G(`tengu_init`,{entrypoint:`claude`,hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktree:d,skipWebFetchPreflight:f,...h&&{githubActionInputs:h},dangerouslySkipPermissionsPassed:g,permissionMode:_,modeIsBypass:ee,inProtectedNamespace:m(),allowDangerouslySkipPermissionsPassed:te,thinkingType:re.type,...re.type===`enabled`&&{thinkingBudgetTokens:re.budgetTokens},...v&&{systemPromptFlag:v},...ne&&{appendSystemPromptFlag:ne},is_simple:p()||void 0,...ie&&{assistantActivationPath:ie},autoUpdatesChannel:Sa().autoUpdatesChannel??`latest`})}catch(e){U(e)}}function id(t){if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let t=(xs(),e(Cs));t.isProactiveActive()||t.activateProactive(`command`)}}function ad(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(Yr)}export{ed as main};