@readmagic/workmate 0.0.22 → 0.0.23

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 (394) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DWgTWJ7R.js → AddWorkspaceDirectory-OgcBcK5A.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-s0Orgord.js → AgentsMdExternalIncludesDialog-CNEifEyV.js} +1 -1
  4. package/dist/chunks/App-B-3tPQ3k.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-D2Gesf-u.js → BypassPermissionsModeDialog-bJek4siJ.js} +1 -1
  7. package/dist/chunks/CustomSelect-DoeEXOIP.js +1 -0
  8. package/dist/chunks/{DiffDialog-v2IiYyi3.js → DiffDialog-B3X9FMpO.js} +5 -5
  9. package/dist/chunks/Doctor-6PXyjIi6.js +3 -0
  10. package/dist/chunks/Doctor-DNgkgYhB.js +1 -0
  11. package/dist/chunks/{ExitFlow-BasHk1mk.js → ExitFlow-DgAZp_8U.js} +2 -2
  12. package/dist/chunks/Grove-CHatOzcE.js +11 -0
  13. package/dist/chunks/{InvalidConfigDialog-DYVQK5js.js → InvalidConfigDialog-DXL92MN9.js} +1 -1
  14. package/dist/chunks/{InvalidSettingsDialog-Dg6OiStR.js → InvalidSettingsDialog-Dtmpzeps.js} +1 -1
  15. package/dist/chunks/{KeybindingProviderSetup-Bn1jzN5F.js → KeybindingProviderSetup-DA37QUFs.js} +1 -1
  16. package/dist/chunks/MCPConnectionManager-thZd-xA_.js +1 -0
  17. package/dist/chunks/MCPToolListView-CpY-YJg4.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-DZejAh8b.js → McpParsingWarnings-JvChf3xr.js} +1 -1
  19. package/dist/chunks/MessageSelector-C0_iw7SI.js +3 -0
  20. package/dist/chunks/Messages-K4DDsDP9.js +10 -0
  21. package/dist/chunks/Onboarding-C1UdzM-1.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-lkr_A5jQ.js → PromptInputFooterSuggestions-AyLog8p7.js} +1 -1
  23. package/dist/chunks/{PromptInputHelpMenu-DaQKKyM5.js → PromptInputHelpMenu-oyic20ip.js} +1 -1
  24. package/dist/chunks/ProviderSetup-XcBHjUnd.js +1 -0
  25. package/dist/chunks/QueryEngine-DYxBjJ4i.js +1 -0
  26. package/dist/chunks/REPL-CQBJRrT0.js +124 -0
  27. package/dist/chunks/REPL-CrVuMQY2.js +1 -0
  28. package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +1 -0
  30. package/dist/chunks/{SelectMulti-CNE06VAN.js → SelectMulti-Bc6l11_K.js} +1 -1
  31. package/dist/chunks/Settings-TGp3fPrS.js +3 -0
  32. package/dist/chunks/Spinner-zYPFVFHN.js +1 -0
  33. package/dist/chunks/{SpinnerGlyph-A6G-gloN.js → SpinnerGlyph-CmkRUvHe.js} +1 -1
  34. package/dist/chunks/{TextInput-7uqPhq9T.js → TextInput-CD9iau2k.js} +5 -5
  35. package/dist/chunks/{ThemePicker-DT9zVy-0.js → ThemePicker-0F0hZYPX.js} +1 -1
  36. package/dist/chunks/TrustDialog-C76YiMKz.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-BLtP647v.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-4ff-vRlp.js +1 -0
  39. package/dist/chunks/add-dir-JMsRLGfx.js +1 -0
  40. package/dist/chunks/{agentDisplay-vLQHFrmq.js → agentDisplay-BReJUBWg.js} +1 -1
  41. package/dist/chunks/agents-9qQ8I6zW.js +101 -0
  42. package/dist/chunks/{agents-DLz0kfsr.js → agents-B3x8yJ_r.js} +1 -1
  43. package/dist/chunks/allErrors-DfWylHSw.js +1 -0
  44. package/dist/chunks/{appleTerminalBackup-BYKdf3of.js → appleTerminalBackup-BArZWB21.js} +1 -1
  45. package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +1 -0
  46. package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +17 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-C4TsMEkx.js +2 -0
  50. package/dist/chunks/{break-cache-BL2gnDLX.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-Dn1eYFAz.js +1 -0
  52. package/dist/chunks/caches-BGzKwpnc.js +1 -0
  53. package/dist/chunks/caches-DArHxBgL.js +1 -0
  54. package/dist/chunks/{claudeDesktop-D3PEgx3U.js → claudeDesktop-D8ml2767.js} +1 -1
  55. package/dist/chunks/{clear-CXfhVRp8.js → clear-Bdhb6b39.js} +1 -1
  56. package/dist/chunks/{client-DdenNfkQ.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/{client-DvhWKIOx.js → client-CpTCeWba.js} +1 -1
  60. package/dist/chunks/commands-QepeBbFn.js +1 -0
  61. package/dist/chunks/compact-Bu9BUpxV.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-D58C3_Lu.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-3s9wtn4L.js → context-CY_yfdYa.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BDDi3NLF.js +1 -0
  67. package/dist/chunks/{context-noninteractive-CJhUu_4y.js → context-noninteractive-Dd4xIoP1.js} +5 -5
  68. package/dist/chunks/conversation-B0wxBwzv.js +1 -0
  69. package/dist/chunks/conversation-DUu9qBnq.js +1 -0
  70. package/dist/chunks/conversationRecovery-2ft8sCPE.js +1 -0
  71. package/dist/chunks/crossProjectResume-6boHMUBx.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-v_mXWncN.js → datadog-BPuGcxxC.js} +1 -1
  75. package/dist/chunks/{debug-8DCufdSp.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/{detectRepository-DfX8xXw2.js → detectRepository-CfX8Lc0A.js} +1 -1
  77. package/dist/chunks/{diff-DJSt7QO6.js → diff-BOAElpfQ.js} +1 -1
  78. package/dist/chunks/{directoryCompletion-CT6YVeg7.js → directoryCompletion-D_Rtg-4j.js} +1 -1
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-CkLzqAMd.js +1 -0
  91. package/dist/chunks/{entry-ex0-RyYV.js → entry-TNOoyy7_.js} +4 -4
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-eTAUP-La.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-BsfuytkN.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-DXApFJIP.js +1 -0
  96. package/dist/chunks/extraUsage-CmQaLPV1.js +1 -0
  97. package/dist/chunks/extractMemories-xP63mv6R.js +1 -0
  98. package/dist/chunks/fast-C5nQH8rm.js +1 -0
  99. package/dist/chunks/fast-eGx2IxD7.js +1 -0
  100. package/dist/chunks/fetchModelList-CxLsVNsu.js +1 -0
  101. package/dist/chunks/fetchModelList-D24lRIgR.js +1 -0
  102. package/dist/chunks/{fileSuggestions-B-SLfb-o.js → fileSuggestions-DHxdwq28.js} +2 -2
  103. package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +1 -0
  104. package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +3 -0
  105. package/dist/chunks/{gemini-BC9kHhwe.js → gemini-D_ORb_L6.js} +2 -2
  106. package/dist/chunks/generateSessionName-BQoDduyA.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-BYi0OefF.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-D7c2mSds.js +3 -0
  109. package/dist/chunks/grok-B2-ZbUiR.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/{help-CK90i4hE.js → help-CZJdRviD.js} +1 -1
  112. package/dist/chunks/history-CQiUERTL.js +1 -0
  113. package/dist/chunks/hooks-BNuUlMzL.js +1 -0
  114. package/dist/chunks/{hooks-BRFDg9DV.js → hooks-DIvN6gdv.js} +3 -3
  115. package/dist/chunks/{install-ZMll-dAa.js → install-T_CV1Slu.js} +1 -1
  116. package/dist/chunks/instrumentation-BjqUZ383.js +21 -0
  117. package/dist/chunks/{job-G_ukhLc4.js → job-R6c4-3c8.js} +1 -1
  118. package/dist/chunks/keybindings-CLRaiL_Z.js +1 -0
  119. package/dist/chunks/{launchLocalMemory-BcRlXLm6.js → launchLocalMemory-DrbKrwXc.js} +2 -2
  120. package/dist/chunks/launchOnboarding-tqsMD8ni.js +8 -0
  121. package/dist/chunks/loadAgentsDir-CcmY8zCj.js +1 -0
  122. package/dist/chunks/{loadAgentsDir-C1LkW7gl.js → loadAgentsDir-DlPbtIsS.js} +540 -543
  123. package/dist/chunks/loadPluginHooks-C_msxVIc.js +1 -0
  124. package/dist/chunks/{loader-C61fB6vU.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DFo_WTMm.js → localSearch-CK-sFzPm.js} +1 -1
  126. package/dist/chunks/localSearch-DrUj0B-d.js +1 -0
  127. package/dist/chunks/{log-DaILwWJa.js → log-D2TIwHBV.js} +1 -1
  128. package/dist/chunks/logoUtils-x2pHV-Nl.js +1 -0
  129. package/dist/chunks/{magicDocs-DYc9TFmI.js → magicDocs-BEF8D3if.js} +3 -3
  130. package/dist/chunks/main-kOVUGxOS.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-BNd29r6p.js +6 -0
  134. package/dist/chunks/mcp-D0wAJrRT.js +1 -0
  135. package/dist/chunks/mcp-mgOlm1cY.js +2 -0
  136. package/dist/chunks/memory-DDLk9_LJ.js +1 -0
  137. package/dist/chunks/{mode-Pan-Q2c4.js → mode-CcNsWgK3.js} +2 -2
  138. package/dist/chunks/model-BwBG0V1u.js +1 -0
  139. package/dist/chunks/model-DzCP4K-9.js +1 -0
  140. package/dist/chunks/modelOptions-DRaG3bo0.js +1 -0
  141. package/dist/chunks/nativeInstaller-C3pVPqrZ.js +1 -0
  142. package/dist/chunks/notifications-4wP1Tx9Y.js +1 -0
  143. package/dist/chunks/onChangeAppState-BlaoFbYF.js +1 -0
  144. package/dist/chunks/openai-CDN71NdX.js +2 -0
  145. package/dist/chunks/{overlayContext-CMV7nYR9.js → overlayContext-BT2Lq8ei.js} +1 -1
  146. package/dist/chunks/{panel-D9fGQgln.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-D8slvrJP.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-CIl_ORUT.js +1 -0
  150. package/dist/chunks/{pasteStore-DNV1M5Xd.js → pasteStore-P0zP-ch0.js} +1 -1
  151. package/dist/chunks/permissions-zSNOZSwr.js +3 -0
  152. package/dist/chunks/pidLock-BTqO-h7Y.js +3 -0
  153. package/dist/chunks/{plan-CQLnPLuE.js → plan-Bs6em6lk.js} +1 -1
  154. package/dist/chunks/{platform-Dzff1WWw.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-DDDxjBa0.js +17 -0
  156. package/dist/chunks/{pluginAutoupdate-BJaAqwTH.js → pluginAutoupdate-8qugAFhb.js} +1 -1
  157. package/dist/chunks/pluginBlocklist-q01ackCf.js +1 -0
  158. package/dist/chunks/pluginCliCommands-DXZfCZsv.js +1 -0
  159. package/dist/chunks/{pluginFlagging-DQP8tBi2.js → pluginFlagging-BG2MHCQJ.js} +1 -1
  160. package/dist/chunks/pluginOperations-hXYLrzM2.js +2 -0
  161. package/dist/chunks/{pluginStartupCheck-CfRvCrFg.js → pluginStartupCheck-DTMa6TgL.js} +1 -1
  162. package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +1 -0
  163. package/dist/chunks/plugins-COoGBYk6.js +4 -0
  164. package/dist/chunks/{poorMode-J5SYJvoY.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-BASybEtO.js +13 -0
  167. package/dist/chunks/processBashCommand-DDi_Pymt.js +1 -0
  168. package/dist/chunks/processSlashCommand-Cq9kaoSF.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/{projectOnboardingState-CJycxw5P.js → projectOnboardingState-B5YATuc6.js} +1 -1
  172. package/dist/chunks/prompt-CHobfCB1.js +1 -0
  173. package/dist/chunks/prompt-CMm6RHHc.js +1 -0
  174. package/dist/chunks/{prompt-BGqgPgCU.js → prompt-mM79EGnT.js} +1 -1
  175. package/dist/chunks/{promptEditor-CmQ9p4oe.js → promptEditor-DLGN_eLu.js} +1 -1
  176. package/dist/chunks/{protocolHandler-CJo9-PfZ.js → protocolHandler-DjQALaU2.js} +1 -1
  177. package/dist/chunks/{proxy-CB17QimU.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-CeXqh95g.js +1 -0
  179. package/dist/chunks/refresh-Ce2yk28a.js +1 -0
  180. package/dist/chunks/{registerProtocol-CLIpzVwF.js → registerProtocol-CAsDme_E.js} +1 -1
  181. package/dist/chunks/reject-Bld5E-bn.js +1 -0
  182. package/dist/chunks/{reload-plugins-DjugL8jH.js → reload-plugins-C42xSB5l.js} +1 -1
  183. package/dist/chunks/rename-CtBghpxZ.js +1 -0
  184. package/dist/chunks/{renderOptions-Zqfm2U1y.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BWkaTDqd.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/{ripgrep-BuzOTf1S.js → ripgrep-Dl3y5r4m.js} +1 -1
  188. package/dist/chunks/{runtimeObserver-CK_iZ6OB.js → runtimeObserver-1wQO8HSZ.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CpP0L9T9.js → runtimeObserver-XQrOux41.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-8GO6eJxw.js +1 -0
  191. package/dist/chunks/{sandbox-toggle-KOHYvbQT.js → sandbox-toggle-Dir9Polo.js} +1 -1
  192. package/dist/chunks/searchExtraTools-BhDq8DTJ.js +1 -0
  193. package/dist/chunks/{select-C_KXmqbI.js → select-Bxf5-5sI.js} +1 -1
  194. package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +1 -0
  195. package/dist/chunks/sessionObserver-DGEQM4cO.js +1 -0
  196. package/dist/chunks/{sessionObserver-WOYv2n7C.js → sessionObserver-DS4G6mb9.js} +2 -2
  197. package/dist/chunks/sessionStorage-BcAscOGE.js +1 -0
  198. package/dist/chunks/sessionTracing-BoDDYLxW.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-BRypY6iT.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-Df-kZ_pK.js → shadowedRuleDetection-BRxZjobz.js} +1 -1
  203. package/dist/chunks/{sideQuestion-CMB8hfgX.js → sideQuestion-DLJxyrlp.js} +3 -3
  204. package/dist/chunks/sinks-CGdKmq_8.js +1 -0
  205. package/dist/chunks/sinks-Cz2HfgMU.js +1 -0
  206. package/dist/chunks/skillChangeDetector-xviGstqm.js +1 -0
  207. package/dist/chunks/{skillGapStore-CfmlO6pb.js → skillGapStore-CKN_d3pO.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-BQ2LMfMx.js → skillLifecycle-BMY2JGGG.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-BwYuwLFs.js → skillSearchPanel-D9trHULQ.js} +2 -2
  210. package/dist/chunks/{skills-BVHPQma0.js → skills-CX_AvwLG.js} +1 -1
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/{startupProfiler-DTs9w9EN.js → startupProfiler-CJdr3SxP.js} +2 -2
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Daaak6Bo.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +1 -0
  217. package/dist/chunks/{stringUtils-BQm3OfeJ.js → stringUtils-C718f5ey.js} +1 -1
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-BpgmH4AI.js +1 -0
  220. package/dist/chunks/{switcher-Bq1Ct_Sn.js → switcher-CAajZeNL.js} +1 -1
  221. package/dist/chunks/{tasks-0c8Uy04D.js → tasks-BWNQr2d3.js} +1 -1
  222. package/dist/chunks/{templateJobs-BdFzE9XG.js → templateJobs-gUET39Ho.js} +1 -1
  223. package/dist/chunks/{terminalSetup-Cf_r6pwK.js → terminalSetup-B_10N_gE.js} +3 -3
  224. package/dist/chunks/{terminalSetup-D7J6bxcn.js → terminalSetup-qc2PlvOm.js} +1 -1
  225. package/dist/chunks/{theme-Bby4fssR.js → theme-B7fKI6E5.js} +1 -1
  226. package/dist/chunks/tipRegistry-DamZr34w.js +2 -0
  227. package/dist/chunks/{toolEventObserver-CzFZUIsM.js → toolEventObserver-BL06sDI4.js} +1 -1
  228. package/dist/chunks/toolPool-CX5wDBi1.js +1 -0
  229. package/dist/chunks/{types-zk5Ltv5q.js → types-Dx7P7JLQ.js} +2 -2
  230. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  231. package/dist/chunks/{use-select-navigation-DMaC_3iw.js → use-select-navigation-BiUJdWai.js} +1 -1
  232. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CjW3gUOt.js → useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js} +1 -1
  233. package/dist/chunks/useMainLoopModel-DwjSVzzO.js +1 -0
  234. package/dist/chunks/useManagePlugins-BqfIVa6E.js +1 -0
  235. package/dist/chunks/{useMergedTools-DarmnCEw.js → useMergedTools-Bw8FchX8.js} +1 -1
  236. package/dist/chunks/{useSearchInput-C2JuUW3g.js → useSearchInput-B25K1RnK.js} +1 -1
  237. package/dist/chunks/useSettingsErrors-DYQ44kX4.js +1 -0
  238. package/dist/chunks/{util-Bq5l7FF5.js → util-CtlC2dsN.js} +1 -1
  239. package/dist/chunks/validatePlugin-D6tFo87L.js +1 -0
  240. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  241. package/dist/chunks/worktree-B8apCnVe.js +1 -0
  242. package/dist/cli.js +1 -1
  243. package/package.json +1 -5
  244. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +0 -1
  245. package/dist/chunks/App-BcEI6U5j.js +0 -1
  246. package/dist/chunks/ApproveApiKey-DegdTXZl.js +0 -1
  247. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +0 -1
  248. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +0 -2
  249. package/dist/chunks/CustomSelect-B46Eh0gU.js +0 -1
  250. package/dist/chunks/Doctor-BP0Rqraa.js +0 -1
  251. package/dist/chunks/Doctor-By_y3C2V.js +0 -3
  252. package/dist/chunks/Grove-C3mhgshv.js +0 -11
  253. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +0 -1
  254. package/dist/chunks/MCPToolListView-DLSrQHDc.js +0 -1
  255. package/dist/chunks/MessageSelector-CdDlJE48.js +0 -3
  256. package/dist/chunks/Messages-DuL_r1Or.js +0 -10
  257. package/dist/chunks/Onboarding-CE2GNA-h.js +0 -1
  258. package/dist/chunks/QueryEngine-DNNy1UCD.js +0 -1
  259. package/dist/chunks/REPL-CEhW-C41.js +0 -1
  260. package/dist/chunks/REPL-CkSL4C_8.js +0 -124
  261. package/dist/chunks/ResumeConversation-BMCO_3X7.js +0 -1
  262. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +0 -1
  263. package/dist/chunks/Settings-mDykHLok.js +0 -2
  264. package/dist/chunks/Spinner-DwsJJUtn.js +0 -1
  265. package/dist/chunks/TrustDialog-G4jM9IfM.js +0 -1
  266. package/dist/chunks/add-dir-7RfQAC3h.js +0 -1
  267. package/dist/chunks/agents-BNg_skSm.js +0 -101
  268. package/dist/chunks/allErrors-DaztSMrw.js +0 -1
  269. package/dist/chunks/auth-BTB00dq5.js +0 -10
  270. package/dist/chunks/auth-Bbc0Ny8i.js +0 -1
  271. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +0 -1
  272. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +0 -17
  273. package/dist/chunks/banner-mqZEluky.js +0 -2
  274. package/dist/chunks/branch-exFKkymg.js +0 -2
  275. package/dist/chunks/btw-3l78DYET.js +0 -1
  276. package/dist/chunks/caches-6Nx6tsk9.js +0 -1
  277. package/dist/chunks/caches-ouaWB9bY.js +0 -1
  278. package/dist/chunks/client-C01Bnxxv.js +0 -1
  279. package/dist/chunks/client-DYRgRQsr.js +0 -1
  280. package/dist/chunks/commands-BoxOw75F.js +0 -1
  281. package/dist/chunks/compact-BOYr105K.js +0 -2
  282. package/dist/chunks/config-BddEvZZl.js +0 -3
  283. package/dist/chunks/config-GEv9hUzz.js +0 -1
  284. package/dist/chunks/config-kw4xg7Nk.js +0 -1
  285. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +0 -1
  286. package/dist/chunks/conversation-CoGharlH.js +0 -1
  287. package/dist/chunks/conversation-MxEVm54C.js +0 -1
  288. package/dist/chunks/conversationRecovery-Da_8uldZ.js +0 -1
  289. package/dist/chunks/crossProjectResume-CzPCHq_K.js +0 -40
  290. package/dist/chunks/cwd-BcO6WHKo.js +0 -1
  291. package/dist/chunks/cwd-CDUelriw.js +0 -1
  292. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  293. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  294. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  295. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  296. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  297. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  298. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  299. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  300. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  301. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  302. package/dist/chunks/doctor-DWvioSU9.js +0 -1
  303. package/dist/chunks/esm-BQY8jJNR.js +0 -1
  304. package/dist/chunks/exit-BxC_ZEtO.js +0 -1
  305. package/dist/chunks/extraUsage-DYm33Occ.js +0 -1
  306. package/dist/chunks/extractMemories-CzN3Ax2B.js +0 -1
  307. package/dist/chunks/fast-DqUpl_Lr.js +0 -1
  308. package/dist/chunks/fast-NUdUyAaM.js +0 -1
  309. package/dist/chunks/fetchModelList-CqsTAWEN.js +0 -1
  310. package/dist/chunks/fetchModelList-DBMHE6Ng.js +0 -1
  311. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +0 -3
  312. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +0 -1
  313. package/dist/chunks/generateSessionName-ChvKBVxB.js +0 -1
  314. package/dist/chunks/goal-ByyimpVU.js +0 -3
  315. package/dist/chunks/grok-DenjixMl.js +0 -1
  316. package/dist/chunks/grove-Dq8QbQ9o.js +0 -7
  317. package/dist/chunks/history-CNQNd6hT.js +0 -1
  318. package/dist/chunks/hooks-BaYwmkxD.js +0 -1
  319. package/dist/chunks/instrumentation-BwVyvRfY.js +0 -21
  320. package/dist/chunks/keybindings-wNxBzDVQ.js +0 -1
  321. package/dist/chunks/launchOnboarding-CDjQ64RO.js +0 -8
  322. package/dist/chunks/loadAgentsDir-DKXap_Om.js +0 -1
  323. package/dist/chunks/loadPluginHooks-DtmHtEiS.js +0 -1
  324. package/dist/chunks/localSearch-BB9x5C2N.js +0 -1
  325. package/dist/chunks/logoUtils-Dj_2SWmO.js +0 -1
  326. package/dist/chunks/main-BRg8L_aw.js +0 -346
  327. package/dist/chunks/managedEnv-DsqAYOJ4.js +0 -1
  328. package/dist/chunks/managedEnv-lybrMred.js +0 -1
  329. package/dist/chunks/mcp-Bsw3cMiJ.js +0 -6
  330. package/dist/chunks/mcp-DDdud6Y7.js +0 -1
  331. package/dist/chunks/mcp-DbgTDUt7.js +0 -2
  332. package/dist/chunks/memory-CzwTzihf.js +0 -1
  333. package/dist/chunks/model-BYfmXKHf.js +0 -1
  334. package/dist/chunks/model-BwBE0Pt5.js +0 -1
  335. package/dist/chunks/modelOptions-DvNBapgG.js +0 -1
  336. package/dist/chunks/nativeInstaller-DnSNJWIi.js +0 -1
  337. package/dist/chunks/notifications-B0DTaYoy.js +0 -1
  338. package/dist/chunks/omit-Dl1Us_PY.js +0 -1
  339. package/dist/chunks/onChangeAppState-4KOJMN82.js +0 -1
  340. package/dist/chunks/openai-C_6C1_0N.js +0 -10
  341. package/dist/chunks/parser-BKAVMTyD.js +0 -1
  342. package/dist/chunks/partition-B504IgAa.js +0 -1
  343. package/dist/chunks/permissions-CLFMhdRk.js +0 -3
  344. package/dist/chunks/pidLock-D9do1Afy.js +0 -3
  345. package/dist/chunks/plugin-BYdF7uob.js +0 -17
  346. package/dist/chunks/pluginBlocklist-DKKmOnWM.js +0 -1
  347. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +0 -1
  348. package/dist/chunks/pluginOperations-BcfJCDco.js +0 -2
  349. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +0 -1
  350. package/dist/chunks/plugins-CTM8jpOw.js +0 -4
  351. package/dist/chunks/policyLimits-a7ix6GnU.js +0 -1
  352. package/dist/chunks/poorMode-C11JEH3d.js +0 -1
  353. package/dist/chunks/print-u6MzL5Cr.js +0 -13
  354. package/dist/chunks/processBashCommand-DIwrI2QC.js +0 -1
  355. package/dist/chunks/processSlashCommand-B-Gujpxm.js +0 -5
  356. package/dist/chunks/prompt-BPJDGlx5.js +0 -1
  357. package/dist/chunks/prompt-DEdZzkEz.js +0 -1
  358. package/dist/chunks/reconciler-DSKLuOS7.js +0 -1
  359. package/dist/chunks/refresh-BbZFCNpn.js +0 -1
  360. package/dist/chunks/rename-DOtCOtEr.js +0 -1
  361. package/dist/chunks/resume-BB4T4WIV.js +0 -2
  362. package/dist/chunks/ripgrep-CZ2CqaHb.js +0 -1
  363. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +0 -1
  364. package/dist/chunks/searchExtraTools-CdJghGkj.js +0 -1
  365. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +0 -1
  366. package/dist/chunks/sessionObserver-DB-sLv-X.js +0 -1
  367. package/dist/chunks/sessionStorage-sgOAbDn7.js +0 -1
  368. package/dist/chunks/sessionTracing-yBre24PH.js +0 -11
  369. package/dist/chunks/settings-C-KNkvsM.js +0 -1
  370. package/dist/chunks/settings-DKN4xSpQ.js +0 -24
  371. package/dist/chunks/setup-CN_Pk7AR.js +0 -3
  372. package/dist/chunks/sinks-BS17vtN0.js +0 -1
  373. package/dist/chunks/sinks-D1EjkHb4.js +0 -1
  374. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +0 -1
  375. package/dist/chunks/startupProfiler-B_U4QDtf.js +0 -1
  376. package/dist/chunks/state-BowF111d.js +0 -1
  377. package/dist/chunks/state-CGuyDES7.js +0 -1
  378. package/dist/chunks/status-BurdTfyz.js +0 -2
  379. package/dist/chunks/status-DMq1An5h.js +0 -1
  380. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +0 -1
  381. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  382. package/dist/chunks/switcher-DGD4ORVf.js +0 -1
  383. package/dist/chunks/tipRegistry-CyRXWWTz.js +0 -2
  384. package/dist/chunks/toolPool-CnrZcprA.js +0 -1
  385. package/dist/chunks/udsClient-ftP0yIpe.js +0 -1
  386. package/dist/chunks/useMainLoopModel-DWscpA9I.js +0 -1
  387. package/dist/chunks/useManagePlugins-CYXVcql2.js +0 -1
  388. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +0 -1
  389. package/dist/chunks/validatePlugin-DIdEydz_.js +0 -1
  390. package/dist/chunks/vim-D8prM2IH.js +0 -1
  391. package/dist/chunks/worktree-Caqt2WRZ.js +0 -1
  392. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  393. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  394. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -0,0 +1,345 @@
1
+ import{a as e,i as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./memoize-BK3gG5ob.js";import{a as o,d as s,l as c,o as l,s as u,u as d}from"./envUtils-DfkgIdYf.js";import{n as f,t as p}from"./defineProperty-C-QyHrDq.js";import{_t as m,dt as ee,ft as te,pt as ne}from"./esm-eTAUP-La.js";import{$_ as re,$m as ie,$r as ae,$s as oe,Ai as se,Ao as ce,Av as le,Bc as ue,Bi as h,CC as g,Cx as _,Ds as v,Dv as y,Ec as de,Es as fe,Ev as pe,Fa as me,Gl as he,Hg as ge,Id as _e,Ip as ve,Ja as ye,Jf as be,Js as xe,Jv as Se,Ka as b,Kv as Ce,La as we,Ld as Te,Ls as Ee,M as De,MC as Oe,Mh as ke,Mn as x,Mo as S,Ms as Ae,NC as je,Nh as C,Ni as w,Nn as Me,OC as T,Oi as Ne,On as Pe,Pp as Fe,Ps as Ie,QC as E,Q_ as Le,Qm as Re,S as ze,St as Be,Sv as Ve,T as He,Tc as Ue,Ts as We,Tt as Ge,Tv as Ke,Uh as qe,Wh as Je,Wu as Ye,Xm as Xe,Xv as D,Ya as Ze,Yf as Qe,Yi as O,Ys as $e,Yv as et,Zs as tt,__ as nt,_i as rt,_r as it,_w as at,ac as ot,au as st,av as ct,b as lt,bi as ut,bv as dt,ci as ft,cp as pt,cs as mt,cw as ht,dC as gt,dw as _t,eh as vt,ep as yt,et as bt,ev as xt,f as St,fw as k,gC as A,gi as Ct,gv as j,gw as M,hC as wt,h_ as Tt,hi as N,i as Et,ic as P,iu as F,iv as I,ja as Dt,jh as Ot,k as kt,kC as At,ks as jt,kv as Mt,lC as Nt,mC as Pt,md as Ft,mv as It,mw as Lt,mx as Rt,o as zt,or as Bt,ou as Vt,ov as Ht,ow as Ut,pC as Wt,pS as Gt,pd as Kt,pw as L,qC as R,qa as qt,ql as Jt,qu as Yt,qv as Xt,r as Zt,rp as Qt,s as $t,si as en,tp as tn,tt as nn,uC as rn,uS as an,up as on,ur as sn,us as cn,vv as ln,vx as un,wC as dn,x as fn,x_ as pn,xi as mn,xt as hn,xv as gn,xx as _n,yC as vn,y_ as yn,yi as bn,yt as xn,yv as Sn,zc as Cn,zg as wn,zi as Tn,zn as En}from"./loadAgentsDir-DlPbtIsS.js";import{B as Dn,D as On,I as kn,Lt as An,P as jn,R as Mn,T as Nn,ai as Pn,di as z,fi as Fn,rr as In,t as Ln,xr as Rn,y as zn}from"./src-DL3w8VPk.js";import{t as Bn}from"./jsx-runtime-Bb4Xn-E0.js";import{A as Vn,G as Hn,P as Un,Q as Wn,Y as Gn,Z as Kn,f as qn,j as Jn,l as Yn,o as Xn,s as Zn,x as Qn}from"./types-Dx7P7JLQ.js";import{$t as $n,Fn as er,I as tr,In as nr,It as rr,J as ir,Ln as ar,M as or,Nn as sr,Rn as cr,Sn as lr,W as ur,Yt as dr,Zt as fr,an as pr,at as mr,bn as hr,dn as gr,er as _r,ln as vr,ot as yr,tr as br,un as xr,xn as Sr,zn as Cr}from"./state-B4jiUise.js";import{n as wr,t as Tr}from"./cwd-Pa83R95t.js";import{$ as Er,C as Dr,I as Or,M as kr,N as Ar,O as jr,R as Mr,S as Nr,T as Pr,c as B,et as Fr,f as Ir,g as Lr,i as Rr,l as zr,u as Br,x as Vr}from"./debug-Bglx1aTu.js";import{Cr as Hr,D as Ur,Fr as Wr,Jt as Gr,Lr as Kr,Mr as qr,O as Jr,Tr as Yr,Xr as V,Yr as Xr,Yt as Zr,Z as Qr,b as H,d as $r,dn as ei,h as U,jt as ti,l as ni,ln as ri,m as ii,q as ai,r as oi,s as si,t as ci,w as li,x as ui,zt as di}from"./settings-B2jvL8Dp.js";import{A as fi,O as pi,T as mi,_ as W,g as hi,h as gi,m as _i,n as vi,o as yi,p as G,r as bi,s as K}from"./config-C-Y2qtB2.js";import{a as xi,n as Si,r as Ci}from"./process-gEbdy6uY.js";import{a as wi,s as Ti}from"./execFileNoThrow-BTachNBI.js";import{d as Ei,f as Di,o as Oi,s as q}from"./log-D2TIwHBV.js";import{_ as ki,h as Ai,l as ji,m as Mi,o as Ni,v as Pi}from"./stringUtils-C718f5ey.js";import{i as Fi,o as Ii}from"./platform-BacQ6ACS.js";import{n as J,r as Y}from"./analytics-DJobLaWP.js";import{i as Li,n as Ri,r as X}from"./startupProfiler-CJdr3SxP.js";import{Ct as zi,G as Bi,H as Vi,St as Hi,Yt as Ui,Zt as Wi,_ as Gi,bt as Ki,d as qi,et as Ji,f as Yi,g as Xi,ht as Zi,m as Qi,n as $i,nt as ea,u as ta,z as na}from"./model-BwBG0V1u.js";import{Ft as ra,Kt as ia,Nt as aa,Pt as oa,at as sa,it as ca,kt as la,ot as ua,qt as da}from"./prompt-mM79EGnT.js";import{c as fa,d as pa,m as ma,n as ha}from"./proxy-CDBfZjO7.js";import{n as ga,t as _a}from"./partition-CIl_ORUT.js";import{a as va,n as ya}from"./ripgrep-Dl3y5r4m.js";import{n as ba,r as xa}from"./loader-CICGtLp2.js";import{d as Sa,f as Ca,l as wa,u as Ta}from"./firstPartyEventLogger-M6UMli2c.js";import{D as Ea,O as Da}from"./sessionTracing-BoDDYLxW.js";import{n as Oa,t as ka}from"./worktreeModeEnabled-BFOYTTTr.js";import{s as Aa,t as ja}from"./history-CQiUERTL.js";import{n as Ma,t as Na}from"./SelectMulti-Bc6l11_K.js";import{t as Pa}from"./KeybindingProviderSetup-DA37QUFs.js";import{n as Fa,t as Ia}from"./exit-s9XGerrH.js";import{n as La,s as Ra,t as za}from"./pluginOperations-hXYLrzM2.js";import"./pluginCliCommands-DXZfCZsv.js";import{n as Ba}from"./conversationRecovery-2ft8sCPE.js";import{t as Va}from"./select-Bxf5-5sI.js";import{a as Ha}from"./grove-O6qp7ITR.js";import{i as Ua,t as Wa}from"./skillChangeDetector-xviGstqm.js";import{n as Ga,t as Ka}from"./tempfile-CHO5wXsV.js";import{n as qa,r as Ja}from"./detectRepository-CfX8Lc0A.js";import{n as Ya,t as Xa}from"./allErrors-DfWylHSw.js";import{t as Za}from"./CustomSelect-DoeEXOIP.js";import{r as Qa,t as $a}from"./onChangeAppState-BlaoFbYF.js";import{n as eo,r as to,t as no}from"./managedEnv-OPlzUPbJ.js";import{t as ro}from"./renderOptions-DV0dn0IW.js";import{i as io,l as ao,o as oo,t as so,u as co}from"./tipRegistry-DamZr34w.js";import{i as lo,n as uo}from"./earlyInput-IghoCjG5.js";import{a as fo,t as po}from"./banner-Cu2-XUek.js";import{posix as mo,resolve as ho,win32 as go}from"path";import{appendFileSync as _o,readFileSync as vo}from"fs";import{execFile as yo}from"child_process";a(),f(),_r(),rr(),Er(),Or(),Vr(),Ir(),Si(),Rr(),J(),Ri(),Ur(),l(),et();var bo=1e4,xo=null;function So(e){return new Promise(t=>{yo(`security`,[`find-generic-password`,`-a`,Se(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:bo},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function Co(){if(process.platform!==`darwin`||xo||u())return;let e=So(Xt(Ce));xo=Promise.all([e]).then(([e])=>{e.timedOut||D(e.stdout)})}async function wo(){xo&&await xo}var To=r((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Eo=r((e=>{var{InvalidArgumentError:t}=To(),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})),Do=r((e=>{var{humanReadableArgName:t}=Eo(),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})),Oo=r((e=>{var{InvalidArgumentError:t}=To(),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})),ko=r((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),Ao=r((e=>{var n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=Eo(),{CommanderError:l}=To(),{Help:u,stripColor:d}=Do(),{Option:f,DualOptions:p}=Oo(),{suggestSimilar:m}=ko(),ee=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>ne()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>ne()??(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=te(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=te(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 te(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 ne(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=ee,e.useColor=ne})),jo=r((e=>{var{Argument:t}=Eo(),{Command:n}=Ao(),{CommanderError:r,InvalidArgumentError:i}=To(),{Help:a}=Do(),{Option:o}=Oo();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})),Mo=r(((e,t)=>{var n=jo();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)}));Zr();var{program:No,createCommand:Po,createArgument:Fo,createOption:Io,CommanderError:Lo,InvalidArgumentError:Ro,InvalidOptionArgumentError:zo,Command:Bo,Argument:Vo,Option:Z,Help:Ho}=n(Mo(),1).default;Fn();var Uo=n(Pn(),1),Q=Bn();Ln(),Qn(),wr(),Xr(),Ti(),Oi(),ki(),Kr(),Ii(),Hr(),Yn(),ri(),li(),U(),pi(),G(),Oe(),T(),yn(),C(),yt(),_e(),$e(),O(),Tn(),w(),mn(),rt(),it(),x(),l(),Ei();var Wo=!1;function Go(){if(Wo||(Wo=!0,Di())||c(process.env.CLAUDE_CODE_USE_BEDROCK)||c(process.env.CLAUDE_CODE_USE_VERTEX)||c(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||Gr().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}function Ko(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=qo();e&&(process.env.NODE_EXTRA_CA_CERTS=e,B(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function qo(){try{let e=K()?.env,t=si(`userSettings`)?.env;B(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&B(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){B(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}G(),Rr(),Ja(),te(),l(),to(),ma(),fa(),Da(),Ta();var Jo=!1,Yo=i(async()=>{let e=Date.now();V(`info`,`init_started`),X(`init_function_start`);try{let t=Date.now();bi(),Dn({loadTheme:()=>K().theme,saveTheme:e=>W(t=>({...t,theme:e}))}),V(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),X(`init_configs_enabled`);let n=Date.now();eo();try{let{restoreActiveProvider:e}=await import(`./switcher-BpgmH4AI.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)B(`[init] ${e}`)}catch(e){B(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}Ko(),V(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),X(`init_safe_env_vars_applied`),bn(),X(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-BVAogAX8.js`).then(e=>{e.initialize1PEventLogging()}),X(`init_after_1p_event_logging`),import(`./poller-CpLBoB-N.js`).then(e=>e.startBalancePolling()),X(`init_after_balance_polling`),ee(),X(`init_after_jetbrains_detection`),qa(),ao(),X(`init_after_remote_settings_check`),gi();let r=Date.now();B(`[init] configureGlobalMTLS starting`),pa(),V(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),B(`[init] configureGlobalMTLS complete`);let i=Date.now();if(B(`[init] configureGlobalAgents starting`),ha(),V(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),B(`[init] configureGlobalAgents complete`),X(`init_network_configured`),await wa(),Go(),Yr(),Fr(Qt),Me()){let e=Date.now();await Pe(),V(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-DLs8MraF.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{B(`[init] ripgrep status check skipped`)}V(`info`,`init_completed`,{duration_ms:Date.now()-e}),X(`init_function_end`)}catch(e){if(e instanceof jr){if(tr()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),Ct(1);return}return import(`./InvalidConfigDialog-DXL92MN9.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function Xo(){Zo().catch(e=>{B(`[3P telemetry] Telemetry init failed: ${kr(e)}`,{level:`error`})})}async function Zo(){if(!Jo){if(!c(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)){Jo=!0,B(`[3P telemetry] Skipped — CLAUDE_CODE_ENABLE_TELEMETRY not set`);return}Jo=!0;try{await Qo()}catch(e){throw Jo=!1,e}}}async function Qo(){let{initializeTelemetry:e}=await import(`./instrumentation-BjqUZ383.js`),t=await e();t&&(lr(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Ea(),...t};r?.add(e,n)}}}),yr()?.add(1))}ba(),Aa();async function $o(e,t,n,r){let{App:i}=await import(`./App-B-3tPQ3k.js`),{REPL:a}=await import(`./REPL-CrVuMQY2.js`);await r(e,(0,Q.jsx)(i,{...t,children:(0,Q.jsx)(a,{...n})}))}Xn(),Mi(),Ni(),Wi(),Hi(),Ki(),ea(),Vi(),qi(),g(),m(),gt(),sa(),ka(),de(),Rr(),l();var es=new Map;function ts(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;Fi()===`windows`&&(e=e.split(go.sep).join(mo.sep),t=t.split(go.sep).join(mo.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 ns=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function rs(e){let t=`${e.name}: ${e.message}`;return ns.some(e=>e.test(t))}var is=null;function as(){let e=process.listeners(`warning`);is&&e.includes(is)||(ts()||process.removeAllListeners(`warning`),is=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=es.get(t)||0;(es.has(t)||es.size<1e3)&&es.set(t,n+1);let r=rs(e);Y(`tengu_node_warning`,{is_internal:+!!r,occurrence_count:n+1,classname:e.name}),c(process.env.CLAUDE_DEBUG)&&B(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,is))}Sa(),Ma(),Za(),Ln();function os(){return(0,Q.jsxs)(jn,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Q.jsx)(An,{url:`https://code.workmate.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}J(),U(),Ln();function ss({serverName:e,onDone:t}){function n(n){switch(Y(`tengu_mcp_dialog_choice`,{choice:n}),n){case`yes`:case`yes_all`:{let r=($r()||{}).enabledMcpjsonServers||[];r.includes(e)||H(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&H(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=($r()||{}).disabledMcpjsonServers||[];n.includes(e)||H(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Q.jsxs)(zn,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Q.jsx)(os,{}),(0,Q.jsx)(Va,{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`)})]})}_a(),J(),Ln(),U(),Ft();function cs({serverNames:e,onDone:t}){function n(n){let r=$r()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=ga(e,e=>n.includes(e));Y(`tengu_mcp_multidialog_choice`,{approved:o.length,rejected:s.length}),o.length>0&&H(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&H(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,Uo.useCallback)(()=>{let n=($r()||{}).disabledMcpjsonServers||[];H(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(zn,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,Q.jsx)(os,{}),(0,Q.jsx)(Na,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Q.jsx)(kn,{paddingX:1,children:(0,Q.jsx)(jn,{dimColor:!0,italic:!0,children:(0,Q.jsxs)(Nn,{children:[(0,Q.jsx)(On,{shortcut:`Space`,action:`select`}),(0,Q.jsx)(On,{shortcut:`Enter`,action:`confirm`}),(0,Q.jsx)(Kt,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}ve(),y(),j();async function ls(e){let{servers:t}=Ke(`project`),n=Object.keys(t).filter(e=>It(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,Q.jsx)(Fe,{children:(0,Q.jsx)(Pa,{children:(0,Q.jsx)(ss,{serverName:t,onDone:r})})}))}else e.render((0,Q.jsx)(Fe,{children:(0,Q.jsx)(Pa,{children:(0,Q.jsx)(cs,{serverNames:n,onDone:r})})}))})}ti(),Qr(),_(),wn(),Je(),on(),Ye(),Ee(),jt(),v(),ye(),qt(),me(),lt(),G(),Rr();var us={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function ds(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=us[e.toLowerCase()];t&&K().deepLinkTerminal!==t&&(W(e=>({...e,deepLinkTerminal:t})),B(`Stored deep link terminal preference: ${t}`))}var fs=class{constructor(){p(this,`frameDurations`,[]),p(this,`firstRenderTime`,void 0),p(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};J(),rt(),rr(),Ln(),ve(),G(),l(),to(),Ya(),U();function ps(){W(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.23`}))}function ms(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function hs(e,t,n){return gs(e,t,{color:`error`,beforeExit:n})}async function gs(e,t,n){let{Text:r}=await import(`./src-9vmGsuSI.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Q.jsx)(r,{color:i,children:t}):(0,Q.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function $(e,t,n){return ms(e,e=>(0,Q.jsx)(Mn,{initialState:K().theme,onThemeSave:e=>W(t=>({...t,theme:e})),children:(0,Q.jsx)(Fe,{onChangeAppState:n?.onChangeAppState,children:(0,Q.jsx)(Pa,{children:t(e)})})}))}async function _s(e,t){e.render(t),bc(),await e.waitUntilExit(),await N(0)}async function vs(e,t,n,r){if(c(!1)||process.env.IS_DEMO)return!1;let i=K(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-C1UdzM-1.js`);await $(e,e=>(0,Q.jsx)(t,{onDone:()=>{ps(),e()}}),{onChangeAppState:$a})}if(xa().length===0){let{ProviderSetup:t}=await import(`./ProviderSetup-XcBHjUnd.js`);await $(e,e=>(0,Q.jsx)(t,{onDone:e}),{onChangeAppState:$a})}if(!c(process.env.CLAUBBIT)){if(!vi()){let{TrustDialog:t}=await import(`./TrustDialog-C76YiMKz.js`);await $(e,e=>(0,Q.jsx)(t,{commands:r,onDone:e}))}cr(!0),Ot();let{errors:t}=Xa();if(t.length===0&&await ls(e),await pn()){let t=Tt(await nt(!0)),{AgentsMdExternalIncludesDialog:n}=await import(`./AgentsMdExternalIncludesDialog-CDNd5-7E.js`);await $(e,e=>(0,Q.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(fo(),ds(),no(),setImmediate(()=>Xo()),await Ha()){let{GroveDialog:t}=await import(`./Grove-CHatOzcE.js`);if(await $(e,e=>(0,Q.jsx)(t,{showIfAlreadyViewed:!1,location:a?`onboarding`:`policy_update_modal`,onDone:e}))===`escape`)return Y(`tengu_grove_policy_exited`,{}),Ct(0),!1}if((t===`bypassPermissions`||n)&&!ii()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-bJek4siJ.js`);await $(e,e=>(0,Q.jsx)(t,{onAccept:e}))}return a}function ys(e){let t=0,n=ro(e);n.stdin&&Y(`tengu_stdin_interactive`,{});let r=new fs,i=Qa();Cr(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()})}\n`;_o(a,t)}if(!In())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&Y(`tengu_flicker`,{desiredHeight:n.desiredHeight,actualHeight:n.availableHeight,reason:n.reason}),t=e}}}}}async function bs(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-Dtmpzeps.js`);return $(e,e=>(0,Q.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function xs(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-Dl8H9Gfy.js`),import(`./App-B-3tPQ3k.js`)]);await _s(e,(0,Q.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Q.jsx)(Pa,{children:(0,Q.jsx)(a,{...r,worktreePaths:i})})}))}re(),aa(),ra(),da();var Ss=5,Cs=30,ws="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 Ts(e){return`# Batch: Parallel Work Orchestration
20
+
21
+ You are orchestrating a large, parallelizable change across this codebase.
22
+
23
+ ## User Instruction
24
+
25
+ ${e}
26
+
27
+ ## Phase 1: Research and Plan (Plan Mode)
28
+
29
+ Call the \`${oa}\` tool now to enter plan mode, then:
30
+
31
+ 1. **Understand the scope.** Launch one or more subagents (in the foreground — you need their results) to deeply research what this instruction touches. Find all the files, patterns, and call sites that need to change. Understand the existing conventions so the migration is consistent.
32
+
33
+ 2. **Decompose into independent units.** Break the work into ${Ss}–${Cs} self-contained units. Each unit must:
34
+ - Be independently implementable in an isolated git worktree (no shared state with sibling units)
35
+ - Be mergeable on its own without depending on another unit's PR landing first
36
+ - Be roughly uniform in size (split large units, merge trivial ones)
37
+
38
+ Scale the count to the actual work: few files → closer to ${Ss}; hundreds of files → closer to ${Cs}. Prefer per-directory or per-module slicing over arbitrary file lists.
39
+
40
+ 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:
41
+ - A \`claude-in-chrome\` skill or browser-automation tool (for UI changes: click through the affected flow, screenshot the result)
42
+ - A \`tmux\` or CLI-verifier skill (for CLI changes: launch the app interactively, exercise the changed behavior)
43
+ - A dev-server + curl pattern (for API changes: start the server, hit the affected endpoints)
44
+ - An existing e2e/integration test suite the worker can run
45
+
46
+ If you cannot find a concrete e2e path, use the \`${la}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
47
+
48
+ Write the recipe as a short, concrete set of steps that a worker can execute autonomously. Include any setup (start a dev server, build first) and the exact command/interaction to verify.
49
+
50
+ 4. **Write the plan.** In your plan file, include:
51
+ - A summary of what you found during research
52
+ - 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
53
+ - The e2e test recipe (or "skip e2e because …" if the user chose that)
54
+ - The exact worker instructions you will give each agent (the shared template)
55
+
56
+ 5. Call \`${ia}\` to present the plan for approval.
57
+
58
+ ## Phase 2: Spawn Workers (After Plan Approval)
59
+
60
+ Once the plan is approved, spawn one background agent per work unit using the \`${ai}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
61
+
62
+ For each agent, the prompt must be fully self-contained. Include:
63
+ - The overall goal (the user's instruction)
64
+ - This unit's specific task (title, file list, change description — copied verbatim from your plan)
65
+ - Any codebase conventions you discovered that the worker needs to follow
66
+ - The e2e test recipe from your plan (or "skip e2e because …")
67
+ - The worker instructions below, copied verbatim:
68
+
69
+ \`\`\`
70
+ ${ws}
71
+ \`\`\`
72
+
73
+ Use \`subagent_type: "general-purpose"\` unless a more specific agent type fits.
74
+
75
+ ## Phase 3: Track Progress
76
+
77
+ After launching all workers, render an initial status table:
78
+
79
+ | # | Unit | Status | PR |
80
+ |---|------|--------|----|
81
+ | 1 | <title> | running | — |
82
+ | 2 | <title> | running | — |
83
+
84
+ 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.
85
+
86
+ When all agents have reported, render the final table and a one-line summary (e.g., "22/24 units landed as PRs").
87
+ `}var Es="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.",Ds=`Provide an instruction describing the batch change you want to make.
88
+
89
+ Examples:
90
+ /batch migrate from react to vue
91
+ /batch replace all uses of lodash with native equivalents
92
+ /batch add type annotations to all untyped function parameters`;function Os(){h({name:`batch`,description:`调研并规划一次大规模改动,然后并行投放到 5–30 个相互隔离的 worktree 智能体中执行,每个智能体各自开一个 PR。`,whenToUse:`当用户想对大量文件做横向的机械式改动(迁移、重构、批量改名),且这些改动可拆解为互不依赖的并行单元时使用。`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await qr()?[{type:`text`,text:Ts(t)}]:[{type:`text`,text:Es}]:[{type:`text`,text:Ds}]}})}at(),Lt(),Ut();var ks=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],As={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`},js=`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(`.`),Ms=Zn(()=>Hn({context:Vn(ks).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:Gn(Kn().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),Wn([Vn(js),Kn().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),Jn().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`));Zn(()=>Hn({$schema:Kn().optional().describe(`JSON Schema URL for editor validation`),$docs:Kn().optional().describe(`Documentation URL`),bindings:Un(Ms()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),Tn();function Ns(){return Xs([`Context`,`Description`],ks.map(e=>[`\`${e}\``,As[e]]))}function Ps(){let e={};for(let t of M)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return Xs([`Action`,`Default Key(s)`,`Context`],js.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:Fs(t);return[`\`${t}\``,r,i]}))}function Fs(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 Is(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of k)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of L)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 _t)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
93
+ `)}var Ls={$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.workmate.com/docs/en/keybindings`,bindings:[{context:`Chat`,bindings:{"ctrl+e":`chat:externalEditor`}}]},Rs={context:`Chat`,bindings:{"ctrl+s":null}},zs={context:`Chat`,bindings:{"ctrl+g":null,"ctrl+e":`chat:externalEditor`}},Bs={context:`Global`,bindings:{"ctrl+k ctrl+t":`app:toggleTodos`}},Vs=[`# Keybindings Skill`,``,"Create or modify `~/.workmate/keybindings.json` to customize keyboard shortcuts.",``,`## CRITICAL: Read Before Write`,``,"**Always read `~/.workmate/keybindings.json` first** (it may not exist yet). Merge changes with existing bindings — never replace the entire file.",``,`- Use **Edit** tool for modifications to existing files`,`- Use **Write** tool only if the file does not exist yet`].join(`
94
+ `),Hs=[`## File Format`,``,"```json",Dr(Ls,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
95
+ `),Us=[`## Keystroke Syntax`,``,"**Modifiers** (combine with `+`):","- `ctrl` (alias: `control`)","- `alt` (aliases: `opt`, `option`) — note: `alt` and `meta` are identical in terminals","- `shift`","- `meta` (aliases: `cmd`, `command`)",``,"**Special keys**: `escape`/`esc`, `enter`/`return`, `tab`, `space`, `backspace`, `delete`, `up`, `down`, `left`, `right`",``,"**Chords**: Space-separated keystrokes, e.g. `ctrl+k ctrl+s` (1-second timeout between keystrokes)",``,"**Examples**: `ctrl+shift+p`, `alt+enter`, `ctrl+k ctrl+n`"].join(`
96
+ `),Ws=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",Dr(Rs,null,2),"```"].join(`
97
+ `),Gs=[`## How User Bindings Interact with Defaults`,``,`- User bindings are **additive** — they are appended after the default bindings`,"- To **move** a binding to a different key: unbind the old key (`null`) AND add the new binding",`- A context only needs to appear in the user's file if they want to change something in that context`].join(`
98
+ `),Ks=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",Dr(zs,null,2),"```",``,`### Add a chord binding`,"```json",Dr(Bs,null,2),"```"].join(`
99
+ `),qs=[`## Behavioral Rules`,``,`1. Only include contexts the user wants to change (minimal overrides)`,`2. Validate that actions and contexts are from the known lists below`,"3. Warn the user proactively if they choose a key that conflicts with reserved shortcuts or common tools like tmux (`ctrl+b`) and screen (`ctrl+a`)",`4. When adding a new binding for an existing action, the new binding is additive (existing default still works unless explicitly unbound)`,`5. To fully replace a default binding, unbind the old key AND add the new one`].join(`
100
+ `),Js=[`## Validation with /doctor`,``,'The `/doctor` command includes a "Keybinding Configuration Issues" section that validates `~/.workmate/keybindings.json`.',``,`### Common Issues and Fixes`,``,Xs([`Issue`,`Cause`,`Fix`],[['`keybindings.json must have a "bindings" array`',`Missing wrapper object`,'Wrap bindings in `{ "bindings": [...] }`'],['`"bindings" must be an array`',"`bindings` is not an array",'Set `"bindings"` to an array: `[{ context: ..., bindings: ... }]`'],['`Unknown context "X"`',`Typo or invalid context name`,`Use exact context names from the Available Contexts table`],['`Duplicate key "X" in Y bindings`',`Same key defined twice in one context`,`Remove the duplicate; JSON uses only the last value`],['`"X" may not work: ...`',`Key conflicts with terminal/OS reserved shortcut`,`Choose a different key (see Reserved Shortcuts section)`],['`Could not parse keystroke "X"`',`Invalid key syntax`,"Check syntax: use `+` between modifiers, valid key names"],['`Invalid action for "X"`',`Action value is not a string or null`,'Actions must be strings like `"app:help"` or `null` to unbind']]),``,`### Example /doctor Output`,``,"```",`Keybinding Configuration Issues`,`Location: ~/.workmate/keybindings.json`,` └ [Error] Unknown context "chat"`,` → Valid contexts: Global, Chat, Autocomplete, ...`,` └ [Warning] "ctrl+c" may not work: Terminal interrupt (SIGINT)`,"```",``,`**Errors** prevent bindings from working and must be fixed. **Warnings** indicate potential conflicts but the binding may still work.`].join(`
101
+ `);function Ys(){h({name:`keybindings-help`,description:`当用户想自定义键盘快捷键、重新绑定按键、添加组合键(chord),或修改 ~/.workmate/keybindings.json 时使用。例如:"rebind ctrl+s"、"add a chord shortcut"、"change the submit key"、"customize keybindings"。`,allowedTools:[`Read`],userInvocable:!1,isEnabled:ht,async getPromptForCommand(e){let t=Ns(),n=Ps(),r=[Vs,Hs,Us,Ws,Gs,Ks,qs,Js,`## Reserved Shortcuts\n\n${Is()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
102
+
103
+ `)}]}})}function Xs(e,t){let n=e.map(()=>`---`);return[`| ${e.join(` | `)} |`,`| ${n.join(` | `)} |`,...t.map(e=>`| ${e.join(` | `)} |`)].join(`
104
+ `)}Tn();var Zs=`# /ultracode — Workflow Orchestration Playbook
105
+
106
+ Execute a workflow script that orchestrates multiple subagents deterministically. Workflows run in the background — this tool returns immediately with a task ID, and a \`<task-notification>\` arrives when the workflow completes.
107
+
108
+ 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.
109
+
110
+ 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:
111
+
112
+ - The user included the keyword "ultracode" in their prompt (you'll see a system-reminder confirming it).
113
+ - Ultracode is on for the session (a system-reminder confirms it) — see **Ultracode** below.
114
+ - 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.
115
+ - The user invoked a skill or slash command whose instructions tell you to call Workflow.
116
+ - The user asked you to run a specific named or saved workflow.
117
+
118
+ 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.
119
+
120
+ 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*.
121
+
122
+ Common single-phase workflows you can chain across turns:
123
+
124
+ - **Understand** — parallel readers over relevant subsystems → structured map
125
+ - **Design** — judge panel of N independent approaches → scored synthesis
126
+ - **Review** — dimensions → find → adversarially verify (example below)
127
+ - **Research** — multi-modal sweep → deep-read → synthesize
128
+ - **Migrate** — discover sites → transform each (worktree isolation) → verify
129
+
130
+ 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.
131
+
132
+ **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.
133
+
134
+ **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.
135
+
136
+ 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.
137
+
138
+ Every script must begin with \`export const meta = {...}\`:
139
+
140
+ \`\`\`js
141
+ export const meta = {
142
+ name: 'find-flaky-tests',
143
+ description: 'Find flaky tests and propose fixes', // one-line, shown in permission dialog
144
+ phases: [ // one entry per phase() call
145
+ { title: 'Scan', detail: 'grep test logs for retries' },
146
+ { title: 'Fix', detail: 'one agent per flaky test' },
147
+ ],
148
+ }
149
+ // script body starts here — use agent()/parallel()/pipeline()/phase()/log()
150
+ phase('Scan')
151
+ const flaky = await agent('grep CI logs for retry markers', {schema: FLAKY_SCHEMA})
152
+ ...
153
+ \`\`\`
154
+
155
+ 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.
156
+
157
+ Script body hooks:
158
+
159
+ - \`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).
160
+ - \`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.
161
+ - \`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.
162
+ - \`log(message: string): void\` — emit a progress message to the user (shown as a narrator line above the progress tree)
163
+ - \`phase(title: string): void\` — start a new phase; subsequent agent() calls are grouped under this title in the progress display
164
+ - \`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.
165
+ - \`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\`.
166
+ - \`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.
167
+
168
+ 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.
169
+
170
+ 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:
171
+
172
+ - '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.
173
+ - '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.
174
+ - '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.
175
+ - 'best' — provider's "best available" (currently opus-tier). Use when you want max intelligence and don't care about cost or pinning a tier.
176
+
177
+ 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.
178
+
179
+ 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.
180
+
181
+ 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.
182
+
183
+ 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.
184
+
185
+ DEFAULT TO pipeline(). Only reach for a barrier (parallel between stages) when you genuinely need ALL prior-stage results together.
186
+
187
+ A barrier is correct ONLY when stage N needs cross-item context from all of stage N-1:
188
+
189
+ - Dedup/merge across the full result set before expensive downstream work
190
+ - Early-exit if the total count is zero ("0 bugs found → skip verification entirely")
191
+ - Stage N's prompt references "the other findings" for comparison
192
+
193
+ A barrier is NOT justified by:
194
+
195
+ - "I need to flatten/map/filter first" — do it inside a pipeline stage: \`pipeline(items, stageA, r => transform([r]).flat(), stageB)\`
196
+ - "The stages are conceptually separate" — that's what pipeline() models. Separate stages ≠ synchronized stages.
197
+ - "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.
198
+
199
+ Smell test: if you wrote
200
+
201
+ \`\`\`js
202
+ const a = await parallel(...)
203
+ const b = transform(a) // flatten, map, filter — no cross-item dependency
204
+ const c = await parallel(b.map(...))
205
+ \`\`\`
206
+
207
+ that middle transform doesn't need the barrier. Rewrite as a pipeline with the transform inside a stage. When in doubt: pipeline.
208
+
209
+ The canonical multi-stage pattern — pipeline by default, each dimension verifies as soon as its review completes:
210
+
211
+ \`\`\`js
212
+ export const meta = {
213
+ name: 'review-changes',
214
+ description: 'Review changed files across dimensions, verify each finding',
215
+ phases: [{ title: 'Review' }, { title: 'Verify' }],
216
+ }
217
+ const DIMENSIONS = [{key: 'bugs', prompt: '...'}, {key: 'perf', prompt: '...'}]
218
+ const results = await pipeline(
219
+ DIMENSIONS,
220
+ d => agent(d.prompt, {label: \`review:\${d.key}\`, phase: 'Review', schema: FINDINGS_SCHEMA}),
221
+ review => parallel(review.findings.map(f => () =>
222
+ agent(\`Adversarially verify: \${f.title}\`, {label: \`verify:\${f.file}\`, phase: 'Verify', schema: VERDICT_SCHEMA})
223
+ .then(v => ({...f, verdict: v}))
224
+ ))
225
+ )
226
+ const confirmed = results.flat().filter(Boolean).filter(f => f.verdict?.isReal)
227
+ return { confirmed }
228
+ // Dimension 'bugs' findings verify while dimension 'perf' is still reviewing. No wasted wall-clock.
229
+ \`\`\`
230
+
231
+ When a barrier IS correct — dedup across all findings before expensive verification:
232
+
233
+ \`\`\`js
234
+ const all = await parallel(DIMENSIONS.map(d => () => agent(d.prompt, {schema: FINDINGS_SCHEMA})))
235
+ const deduped = dedupeByFileAndLine(all.filter(Boolean).flatMap(r => r.findings)) // <-- genuinely needs ALL at once
236
+ const verified = await parallel(deduped.map(f => () => agent(verifyPrompt(f), {schema: VERDICT_SCHEMA})))
237
+ \`\`\`
238
+
239
+ Loop-until-count pattern — accumulate to a target:
240
+
241
+ \`\`\`js
242
+ const bugs = []
243
+ while (bugs.length < 10) {
244
+ const result = await agent("Find bugs in this codebase.", {schema: BUGS_SCHEMA})
245
+ bugs.push(...result.bugs)
246
+ log(\`\${bugs.length}/10 found\`)
247
+ }
248
+ \`\`\`
249
+
250
+ 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.
251
+
252
+ \`\`\`js
253
+ const bugs = []
254
+ while (budget.total && budget.remaining() > 50_000) {
255
+ const result = await agent("Find bugs in this codebase.", {schema: BUGS_SCHEMA})
256
+ bugs.push(...result.bugs)
257
+ log(\`\${bugs.length} found, \${Math.round(budget.remaining()/1000)}k remaining\`)
258
+ }
259
+ \`\`\`
260
+
261
+ Composing patterns — exhaustive review (find → dedup vs seen → diverse-lens panel → loop-until-dry):
262
+
263
+ \`\`\`js
264
+ const seen = new Set(), confirmed = []
265
+ let dry = 0
266
+ while (dry < 2) { // loop-until-dry
267
+ const found = (await parallel(FINDERS.map(f => () => // barrier: collect all finders this round
268
+ agent(f.prompt, {phase: 'Find', schema: BUGS})))).filter(Boolean).flatMap(r => r.bugs)
269
+ const fresh = found.filter(b => !seen.has(key(b))) // dedup vs ALL seen — plain code, not an agent
270
+ if (!fresh.length) { dry++; continue }
271
+ dry = 0; fresh.forEach(b => seen.add(key(b)))
272
+ const judged = await parallel(fresh.map(b => () => // every fresh bug judged concurrently...
273
+ parallel(['correctness','security','repro'].map(lens => () => // ...each by 3 distinct lenses
274
+ agent(\`Judge "\${b.desc}" via the \${lens} lens — real?\`, {phase: 'Verify', schema: VERDICT})))
275
+ .then(vs => ({ b, real: vs.filter(Boolean).filter(v => v.real).length >= 2 }))))
276
+ confirmed.push(...judged.filter(v => v.real).map(v => v.b))
277
+ }
278
+ return confirmed
279
+ // dedup vs \`seen\`, NOT \`confirmed\` — else judge-rejected findings reappear every round and it never converges.
280
+ \`\`\`
281
+
282
+ Quality patterns — common shapes; pick by task and compose freely:
283
+
284
+ - Adversarial verify: spawn N independent skeptics per finding, each prompted to REFUTE. Kill if ≥majority refute. Prevents plausible-but-wrong findings from surviving.
285
+
286
+ \`\`\`js
287
+ const votes = await parallel(Array.from({length: 3}, () => () =>
288
+ agent(\`Try to refute: \${claim}. Default to refuted=true if uncertain.\`, {schema: VERDICT})))
289
+ const survives = votes.filter(Boolean).filter(v => !v.refuted).length >= 2
290
+ \`\`\`
291
+
292
+ - 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.
293
+ - 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.
294
+ - 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.
295
+ - 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.
296
+ - 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.
297
+ - 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.
298
+
299
+ 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.
300
+
301
+ These patterns aren't exhaustive — compose novel harnesses when the task calls for it (tournament brackets, self-repair loops, staged escalation, whatever fits).
302
+
303
+ Use this tool for multi-step orchestration where control flow should be deterministic (loops, conditionals, fan-out) rather than model-driven.
304
+
305
+ ## Resume
306
+
307
+ The tool result includes a runId. To resume after a pause, kill, or script edit, relaunch with \`Workflow({scriptPath, resumeFromRunId})\` — the longest unchanged prefix of agent() calls returns cached results instantly; the first edited/new call and everything after it runs live. Same script + same args → 100% cache hit. Date.now()/Math.random()/new Date() are unavailable in scripts (they would break this) — stamp results after the workflow returns, or pass timestamps via args. Fallback when no journal is available: Read agent-<id>.jsonl files in the transcript directory and hand-author a continuation script.
308
+ `;function Qs(){h({name:`ultracode`,description:`进入多智能体 workflow 编排模式:何时使用 Workflow 工具、脚本原语、质量模式、确定性约束、resume/预算、以及文件和命令。`,whenToUse:`当任务可拆解或可并行、需要多视角置信度(如先查找再对抗式验证)、超出单一上下文容量(大迁移、广审计、长尾枚举)或需要可恢复/可审计时——用 Workflow 工具编排多个子智能体。`,userInvocable:!0,async getPromptForCommand(e){let t=Zs;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}Tn();function $s(){h({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.`}]}})}ot(),he(),rr(),Tn();var ec=`# Dream: Memory Consolidation (manual run)
309
+
310
+ You are performing a manual dream — a reflective pass over your memory files. Unlike the automatic background dream, this run has full tool permissions and the user is watching. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
311
+
312
+ `;function tc(){h({name:`dream`,description:`手动触发记忆整合——回顾、整理并修剪自动记忆文件。`,whenToUse:`当用户输入 /dream 或想手动整合记忆、整理记忆文件、清理过期条目时使用。`,userInvocable:!0,isEnabled:()=>fi(),async getPromptForCommand(e){let t=mi(),n=Bt(ir());await Jt();let r=ec+P(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}function nc(){Ys(),Os(),Qs(),$s(),tc()}zt();async function rc(){if(!await Pi(`gh`))return`not_installed`;let{exitCode:e}=await wi(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}va(),Re(),Qe(),F(),S(),J(),un();async function ic(e,t){let n=await se(e),r=Rt(t);for(let e of n)e.type===`prompt`&&Y(`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}})}Ga(),J(),y(),j(),l(),Vr();function ac(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
313
+
314
+ Examples:
315
+ # Add HTTP server:
316
+ claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
317
+
318
+ # Add HTTP server with headers:
319
+ claude mcp add --transport http corridor https://app.corridor.dev/api/mcp --header "Authorization: Bearer ..."
320
+
321
+ # Add stdio server with environment variables:
322
+ claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
323
+
324
+ # Add stdio server with subprocess flags:
325
+ claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).helpOption(`-h, --help`,`Display help for command`).action(async(e,t,n,r)=>{let i=t,a=n;e?i||Ia(`Error: Command is required when server name is provided.
326
+ Usage: claude mcp add <name> <command> [args...]`):Ia(`Error: Server name is required.
327
+ Usage: claude mcp add <name> <command> [args...]`);try{let t=ct(r.scope),n=Ht(r.transport),o=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(Y(`tengu_mcp_add`,{type:n,scope:t,source:`command`,transport:n,transportExplicit:o,looksLikeUrl:c}),n===`sse`){i||Ia(`Error: URL is required for SSE transport.`);let n=r.header?ln(r.header):void 0;await Sn(e,{type:`sse`,url:i,headers:n},t),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Dr(n,null,2)}\n`)}else if(n===`http`){i||Ia(`Error: URL is required for HTTP transport.`);let n=r.header?ln(r.header):void 0;await Sn(e,{type:`http`,url:i,headers:n},t),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Dr(n,null,2)}\n`)}else!o&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await Sn(e,{type:`stdio`,command:i,args:a,env:s(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);Fa(`File modified: ${I(t)}`)}catch(e){Ia(e.message)}})}Xe(),bt();function oc(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]}}mt(),J(),G(),U();function sc(){if(K().bypassPermissionsModeAccepted)try{ii()||H(`userSettings`,{skipDangerousModePermissionPrompt:!0}),Y(`tengu_migrate_bypass_permissions_accepted`,{}),W(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){q(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}J(),G(),Oi(),U();function cc(){let e=yi(),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=si(`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&&H(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&hi(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),Y(`tengu_migrate_mcp_approval_fields_success`,{migratedCount:o.length})}catch(e){q(e),Y(`tengu_migrate_mcp_approval_fields_error`,{})}}J(),G(),U();function lc(){if(Ui()!==`firstParty`||!Yi())return;let e=si(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(H(`userSettings`,{model:`opus`}),W(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})),Y(`tengu_legacy_opus_migration`,{from_model:e}))}J(),qi();function uc(){Qi()&&Y(`tengu_opus_to_opus1m_migration`,{skipped:!0})}rr(),G(),U();function dc(){K().sonnet1m45MigrationComplete||(si(`userSettings`)?.model===`sonnet[1m]`&&H(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),ur()===`sonnet[1m]`&&hr(`sonnet-4-5-20250929[1m]`),W(e=>({...e,sonnet1m45MigrationComplete:!0})))}G(),Oi(),U(),G();function fc(){K().opusProMigrationComplete||W(e=>({...e,opusProMigrationComplete:!0}))}Ri(),C(),G(),to(),Ii(),Vr(),J(),rr(),w(),Ln(),Ra(),l(),Kr(),Oi(),qi(),lt(),it(),U(),y(),Er(),Rr(),Or(),rt(),yt(),Xr(),vn(),Ta(),hn(),X(`main_tsx_entry`),Jr(),Co(),X(`main_tsx_imports_loaded`);function pc(){try{let e=si(`policySettings`);if(e){let t=oi(e);Y(`tengu_managed_settings_loaded`,{keyCount:t.length,keys:t.join(`,`)})}}catch{}}function mc(){let e=Gi(or()??$i());ic(Tr(),Zi(e,mr())),we().then(({enabled:e,errors:t})=>{let n=b();Vt(e,n,_n()),st(t,n)}).catch(e=>q(e))}function hc(){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),o(`--use-system-ca`)&&(e.has_use_system_ca=!0),o(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function gc(){if(Ca())return;let[e,t,n]=await Promise.all([qr(),Wr(),rc()]);Y(`tengu_startup_telemetry`,{is_git:e,worktree_count:t,gh_auth_status:n,sandbox_enabled:A.isSandboxingEnabled(),are_unsandboxed_commands_allowed:A.areUnsandboxedCommandsAllowed(),is_auto_bash_allowed_if_sandbox_enabled:A.isAutoAllowBashIfSandboxedEnabled(),auto_updater_disabled:_i(),prefers_reduced_motion:ci().prefersReducedMotion??!1,...hc()})}var _c=11;function vc(){K().migrationVersion!==_c&&(sc(),cc(),fc(),dc(),lc(),uc(),W(e=>e.migrationVersion===_c?e:{...e,migrationVersion:_c}))}function yc(){if(tr()){V(`info`,`prefetch_system_context_non_interactive`),Ot();return}vi()?(V(`info`,`prefetch_system_context_has_trust`),Ot()):V(`info`,`prefetch_system_context_skipped_no_trust`)}function bc(){c(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)||u()||(ke(),yc(),so(),ya(Tr(),AbortSignal.timeout(3e3),[]),zi(),dn.initialize(),u()||Wa.initialize())}function xc(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)qn(t)||(process.stderr.write(z.red(`Error: Invalid JSON provided to --settings
328
+ `)),process.exit(1)),r=Ka(`claude-settings`,`.json`,{contentHash:t}),Pr(r,t,`utf8`);else{let{resolvedPath:t}=Lr(Br(),e);try{vo(t,`utf8`)}catch(e){throw Mr(e)&&(process.stderr.write(z.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}pr(r),br()}catch(e){e instanceof Error&&q(e),process.stderr.write(z.red(`Error processing settings: ${kr(e)}\n`)),process.exit(1)}}function Sc(e){try{fr(ei(e)),br()}catch(e){e instanceof Error&&q(e),process.stderr.write(z.red(`Error processing --setting-sources: ${kr(e)}\n`)),process.exit(1)}}function Cc(){X(`eagerLoadSettings_start`);let e=oc(`--settings`);e&&xc(e);let t=oc(`--setting-sources`);t!==void 0&&Sc(t),X(`eagerLoadSettings_end`)}function wc(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(c(process.env.CLAUDE_CODE_ACTION)){process.env.CLAUDE_CODE_ENTRYPOINT=`claude-code-github-action`;return}process.env.CLAUDE_CODE_ENTRYPOINT=e?`sdk-cli`:`cli`}async function Tc(){X(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,as(),process.on(`exit`,()=>{Ac();try{let{peekWorkflowService:t}=(Cn(),e(ue));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),X(`main_warning_handler_initialized`);{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-DD8fCYXn.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-DjQALaU2.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-DD8fCYXn.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-DjQALaU2.js`),n=await t();process.exit(n??1)}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=c(process.env.CLAUDE_CODE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&lo(),gr(!o),wc(o);let s=c(process.env.GITHUB_ACTIONS)?`github-action`:process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-ts`?`sdk-typescript`:process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-py`?`sdk-python`:process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-cli`?`sdk-cli`:process.env.CLAUDE_CODE_ENTRYPOINT===`claude-vscode`?`claude-vscode`:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`?`local-agent`:process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`?`claude-desktop`:`cli`;$n(s);let l=process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;l===`markdown`||l===`html`?sr(l):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&sr(`markdown`),X(`main_client_type_determined`),Cc(),X(`main_before_run`),await Dc(),X(`main_after_run`)}async function Ec(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 Ci(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
329
+ `),[e,n].filter(Boolean).join(`
330
+ `)}return e}async function Dc(){X(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new Bo().configureHelp(e()).enablePositionalOptions();X(`run_commander_initialized`),t.hook(`preAction`,async e=>{X(`preAction_start`),await Promise.all([ui(),wo()]),X(`preAction_after_mdm`),await Yo(),X(`preAction_after_init`),c(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)||(process.title=`workMate`);let{initSinks:t}=await import(`./sinks-CGdKmq_8.js`);t(),X(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(xr(n),Dt(`preAction: --plugin-dir inline plugins`)),vc(),X(`preAction_after_migrations`),co(),X(`preAction_after_policy_limits`)}),t.name(`wm`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new Z(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Work Mate is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and AGENTS.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (AGENTS.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new Z(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new Z(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new Z(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new Z(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new Z(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new Z(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new Z(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new Z(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new Z(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new Z(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new Z(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new Z(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new Z(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new Z(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new Z(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new Z(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new Z(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(di)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new Z(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new Z(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new Z(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new Z(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new Z(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new Z(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new Z(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--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(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{X(`action_handler_start`),t.bare&&(process.env.CLAUDE_CODE_SIMPLE=`1`),e===`code`&&(Y(`tengu_code_prompt_ignored`,{}),console.warn(z.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&Y(`tengu_single_word_prompt`,{length:e.length});let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:l=[],mcpConfig:d=[],permissionMode:f,addDir:p=[],fallbackModel:m,betas:ee=[],ide:te=!1,sessionId:re,includeHookEvents:se,includePartialMessages:ue}=t;t.prefill&&uo(t.prefill);let h=t.agents,g=t.agent;g&&(process.env.CLAUDE_CODE_AGENT=g);let _=t.outputFormat,v=t.inputFormat,y=t.verbose??K().verbose,de=t.print,me=t.init??!1,he=t.initOnly??!1,_e=t.maintenance??!1,ve=t.disableSlashCommands||!1,ye=Oa()?t.worktree:void 0,Se=typeof ye==`string`?ye:void 0,b=ye!==void 0,Ce;if(Se){let e=Ge(Se);e!==null&&(Ce=e,Se=void 0)}let we=Oa()&&t.tmux===!0;we&&(b||(process.stderr.write(z.red(`Error: --tmux requires --worktree
331
+ `)),process.exit(1)),Fi()===`windows`&&(process.stderr.write(z.red(`Error: --tmux is not supported on Windows
332
+ `)),process.exit(1)),await Be()||(process.stderr.write(z.red(`Error: tmux is not installed.\n${xn()}\n`)),process.exit(1)));let Ee=t.sdkUrl??void 0,Oe=ue||c(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);if(se&&cn(!0),Ee&&(v||(v=`stream-json`),_||(_=`stream-json`),t.verbose===void 0&&(y=!0),t.print||(de=!0)),re&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(z.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
333
+ `)),process.exit(1)),!Ee)){let e=Te(re);e||(process.stderr.write(z.red(`Error: Invalid session ID. Must be a valid UUID.
334
+ `)),process.exit(1)),ft(e)&&(process.stderr.write(z.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let x=tr();m&&t.model&&m===t.model&&(process.stderr.write(z.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
335
+ `)),process.exit(1));let S=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(z.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
336
+ `)),process.exit(1));try{S=vo(ho(t.systemPromptFile),`utf8`)}catch(e){Ar(e)===`ENOENT`&&(process.stderr.write(z.red(`Error: System prompt file not found: ${ho(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(z.red(`Error reading system prompt file: ${kr(e)}\n`)),process.exit(1)}}let C=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(z.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
337
+ `)),process.exit(1));try{C=vo(ho(t.appendSystemPromptFile),`utf8`)}catch(e){Ar(e)===`ENOENT`&&(process.stderr.write(z.red(`Error: Append system prompt file not found: ${ho(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(z.red(`Error reading append system prompt file: ${kr(e)}\n`)),process.exit(1)}}let{mode:w,notification:Me}=fn({permissionModeCli:f,dangerouslySkipPermissions:i});nr(w===`bypassPermissions`),(t.enableAutoMode||f===`auto`||w===`auto`||!f&&He())&&ge(!0);let T={};if(d&&d.length>0){let e=d.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=qn(r);if(a){let t=Mt({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=le({filePath:ho(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?`${e.path}: `:``}${e.message}`).join(`
338
+ `);B(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=Ve(je(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${ji(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),T={...T,...e}}}let Pe=t.strictMcpConfig||!1;gn()&&(Pe&&(process.stderr.write(z.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),T&&!dt(T)&&(process.stderr.write(z.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),dr(p);let Fe=await ze({allowedToolsCli:s,disallowedToolsCli:l,baseToolsCli:o,permissionMode:w,allowDangerouslySkipPermissions:a,addDirs:p}),E=Fe.toolPermissionContext,{warnings:Re,dangerousPermissions:Ke}=Fe;Ke.length>0&&(E=kt(E)),Re.forEach(e=>{console.error(e)}),B(`[STARTUP] Loading MCP configs...`);let Je=Date.now(),Ye,Xe=(Pe||u()?Promise.resolve({servers:{}}):pe(T)).then(e=>(Ye=Date.now()-Je,e));v&&v!==`text`&&v!==`stream-json`&&(console.error(`Error: Invalid input format "${v}".`),process.exit(1)),v===`stream-json`&&_!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),Ee&&(v!==`stream-json`||_!==`stream-json`)&&(console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),t.replayUserMessages&&(v!==`stream-json`||_!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),Oe&&(!x||_!==`stream-json`)&&(xi(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!x&&(xi(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let D=await Ec(e||``,v??`text`);X(`action_after_input_prompt`),kc(t);let Qe=Ue(E);X(`action_tools_loaded`);let O;if(ua({isNonInteractiveSession:x})&&t.jsonSchema&&(O=Nr(t.jsonSchema)),O){let e=ca(O);`tool`in e?(Qe=[...Qe,e.tool],Y(`tengu_structured_output_enabled`,{schema_property_count:Object.keys(O.properties||{}).length,has_required_fields:!!O.required})):Y(`tengu_structured_output_failure`,{error:`Invalid JSON schema`})}X(`action_before_setup`),B(`[STARTUP] Running setup()...`);let $e=Date.now(),{setup:et}=await import(`./setup-BRypY6iT.js`),nt=Tr();process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&nc();let rt=et(nt,w,a,b,Se,we,re?Te(re):void 0,Ce),it=b?null:Ne(nt),at=b?null:Et(nt);it?.catch(()=>{}),at?.catch(()=>{}),await rt,B(`[STARTUP] setup() completed in ${Date.now()-$e}ms`),X(`action_after_setup`);let ot=!!t.replayUserMessages;tr()&&(no(),Ot(),ke(),Ji());let st=t.name?.trim();st&&En(st);let ct=t.model==="default"?$i():t.model,lt=m==="default"?$i():m,mt=b?Tr():nt;B(`[STARTUP] Loading commands and agents...`);let ht=Date.now(),[gt,_t]=await Promise.all([it??Ne(mt),at??Et(mt)]);B(`[STARTUP] Commands and agents loaded in ${Date.now()-ht}ms`),X(`action_commands_loaded`);let yt=[];if(h)try{let e=qn(h);e&&(yt=St(e,`flagSettings`))}catch(e){q(e)}let bt=[..._t.allAgents,...yt],k={..._t,allAgents:bt,activeAgents:Zt(bt)},A=g??ci().agent,j;if(A&&(j=k.activeAgents.find(e=>e.agentType===A),j||B(`Warning: agent "${A}" not found. Available agents: ${k.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),Sr(j?.agentType),j&&Y(`tengu_agent_flag`,{agentType:$t(j)?j.agentType:`custom`,...g&&{source:`cli`}}),j?.agentType&&ae(j.agentType),x&&j&&!S&&!$t(j)){let e=j.getSystemPrompt();e&&(S=e)}j?.initialPrompt&&(typeof D==`string`?D=D?`${j.initialPrompt}\n\n${D}`:j.initialPrompt:D||(D=j.initialPrompt));let M=ct;!M&&j?.model&&j.model!==`inherit`&&(M=Gi(j.model)),hr(M),vr(ta()||null);let Tt=or(),N=Gi(Tt??$i()),P;if(Wt()){let e=Nt()?t.advisor:void 0;e&&(B(`[AdvisorTool] --advisor ${e}`),wt(N)||(process.stderr.write(z.red(`Error: The model "${N}" does not support the advisor tool.\n`)),process.exit(1)),Pt(Xi(Gi(e)))||(process.stderr.write(z.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),P=Nt()?e??rn():e,P&&B(`[AdvisorTool] Advisor model: ${P}`)}if(t.proactive||c(process.env.CLAUDE_CODE_PROACTIVE)){let e=`
339
+ # Proactive Mode
340
+
341
+ You are in proactive mode. Take initiative — explore, act, and make progress without waiting for instructions.
342
+
343
+ Start by briefly greeting the user.
344
+
345
+ You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;C=C?`${C}\n\n${e}`:e}let F,I,Dt;if(!x){let e=ys(!1);I=e.getFpsMetrics,Dt=e.stats;let{createRoot:t}=await import(`./src-9vmGsuSI.js`);F=await t(e.renderOptions),Y(`tengu_timer`,{event:`startup`,durationMs:Math.round(process.uptime()*1e3)}),B(`[STARTUP] Running showSetupScreens()...`);let n=Date.now();await vs(F,w,a,gt),B(`[STARTUP] showSetupScreens() completed in ${Date.now()-n}ms`)}if(process.exitCode!==void 0){B(`Graceful shutdown initiated, skipping further initialization`);return}if(tn(),!x){let{errors:e}=ni(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await bs(F,{settingsErrors:t,onExit:()=>Ct(1)})}let jt=K().startupPrefetchedAt??0;u()?B(`Skipping startup prefetches, last ran ${Math.round((Date.now()-jt)/1e3)}s ago`):(B(`Starting background startup prefetches${jt>0?` last ran ${Math.round((Date.now()-jt)/1e3)}s ago`:``}`),Ie().catch(e=>q(e))),x||oo();let{servers:Ft}=await Xe;B(`[STARTUP] MCP configs resolved in ${Ye}ms (awaited at +${Date.now()-Je}ms)`);let It={...Ft,...T},Lt={},Rt={};for(let[e,t]of Object.entries(It)){let n=t;n.type===`sdk`?Lt[e]=n:Rt[e]=n}X(`action_mcp_configs_loaded`);let zt=(x||Pe?Promise.resolve({clients:[],tools:[],commands:[]}):xt(Rt)).then(e=>({clients:e.clients,tools:At(e.tools,`name`),commands:At(e.commands,`name`)})),Bt=he||me||_e||x||t.continue||t.resume?null:ie(`startup`,{agentType:j?.agentType,model:N}),Vt=[];zt.catch(()=>{});let Ht=[],Ut=[],Kt=[],L=Yt(),R=L===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)L=!0,R={type:`adaptive`};else if(t.thinking===`disabled`)L=!1,R={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(L=!0,R={type:`enabled`,budgetTokens:e}):e===0&&(L=!1,R={type:`disabled`}))}V(`info`,`started`,{version:`0.0.23`,is_native_binary:Ai()}),Fr(async()=>{V(`info`,`exited`)}),Oc({hasInitialPrompt:!!e,hasStdin:!!D,verbose:y,debug:n,debugToStderr:r,print:de??!1,outputFormat:_??`text`,inputFormat:v??`text`,numAllowedTools:s.length,numDisallowedTools:l.length,mcpClientCount:Object.keys(It).length,worktreeEnabled:b,skipWebFetchPreflight:ci().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:w,modeIsBypass:w===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:S?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:C?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:R,assistantActivationPath:void 0}),nn(Rt,E),pc(),tt().then(e=>{e&&(st&&oe(st),xe().then(e=>{e>=2&&Y(`tengu_concurrent_sessions`,{num_sessions:e})}))}),u()||(x?(await Ze(),X(`action_after_plugins_init`),ce().then(()=>be())):Ze().then(async()=>{X(`action_after_plugins_init`),await ce(),be()}));let qt=he||me?`init`:_e?`maintenance`:null;if(he){no(),await vt(`init`,{forceSyncExecution:!0}),await ie(`startup`,{forceSyncExecution:!0}),Ct(0);return}if(x){(_===`stream-json`||_===`json`)&&zr(!0),no(),Xo();let e=t.continue||t.resume||qt?void 0:ie(`startup`);e?.catch(()=>{});let n=ve?[]:gt.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),r=fe(),i=qe({...r,mcp:{...r.mcp,clients:Ht,commands:Kt,tools:Ut},toolPermissionContext:E,...Bi()&&{fastMode:na(M??null)},...Wt()&&P&&{advisorModel:P}},$a);De(E,i.getState().fastMode).then(({updateContext:e})=>{i.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&ar(!0),er(ne(ee)),X(`before_connectMcp`),await((e,t)=>Object.keys(e).length===0?Promise.resolve():(i.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),Le(({client:e,tools:t,commands:n})=>{i.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:At([...r.mcp.tools,...t],`name`),commands:At([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>B(`[MCP] ${t} connect error: ${e}`))))(Rt,`regular`),X(`after_connectMcp`),u()||(bc(),import(`./backgroundHousekeeping-BGxHB_OX.js`).then(e=>e.startBackgroundHousekeeping())),mc(),X(`before_print_import`);let{runHeadless:a}=await import(`./print-BASybEtO.js`);X(`after_print_import`),a(D,()=>i.getState(),i.setState,n,Qe,Lt,k.activeAgents,{continue:t.continue,resume:t.resume,verbose:y,outputFormat:_,jsonSchema:O,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:R,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:S,appendSystemPrompt:C,userSpecifiedModel:M,fallbackModel:lt,sdkUrl:Ee,replayUserMessages:ot,includePartialMessages:Oe,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,agent:g,workload:t.workload,setupTrigger:qt??void 0,sessionStartHooksPromise:e});return}Y(`tengu_startup_manual_model_config`,{cli_flag:t.model,env_var:process.env.ANTHROPIC_MODEL,settings_file:ci()?.model,agent:A});let Jt=io(N),Xt=[];Me&&Xt.push({key:`permission-mode-notification`,text:Me,priority:`high`}),Jt&&Xt.push({key:`model-deprecation-warning`,text:Jt,color:`warning`,priority:`high`});let Qt={...E},on={settings:ci(),tasks:{},agentNameRegistry:new Map,verbose:y??K().verbose??!1,mainLoopModel:Tt,mainLoopModelForSession:null,expandedView:K().showExpandedTodos?`tasks`:`none`,selectedIPAgentIndex:-1,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:Qt,agent:j?.agentType,agentDefinitions:k,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,notifications:{current:null,queue:Xt},elicitation:{queue:[]},todos:{},fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:pt(),thinkingEnabled:L,promptSuggestionEnabled:Ae(),sessionHooks:new Map,inbox:{messages:[]},promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:We,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},initialMessage:D?{message:Gt({content:String(D)})}:null,activeOverlays:new Set,fastMode:na(N),...Wt()&&P&&{advisorModel:P}};D&&ja(String(D));let ln=Ut;W(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{gc(),mc()});let un={debug:n||r,commands:[...gt,...Kt],initialTools:ln,mcpClients:Ht,autoConnectIdeFlag:te,mainThreadAgentDefinition:j,disableSlashCommands:ve,dynamicMcpConfig:T,strictMcpConfig:Pe,systemPrompt:S,appendSystemPrompt:C,thinkingConfig:R},dn={mainThreadAgentDefinition:j,agentDefinitions:k,currentCwd:mt,cliAgents:yt,initialState:on};if(t.continue){let e=!1;try{let n=performance.now(),{clearSessionCaches:r}=await import(`./caches-BGzKwpnc.js`);r();let i=await Ba(void 0,void 0);if(!i)return Y(`tengu_continue`,{success:!1}),await hs(F,`No conversation found to continue`);let a=await Ua(i,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:i.fullPath},dn);a.restoredAgentDef&&(j=a.restoredAgentDef),kc(t),Y(`tengu_continue`,{success:!0,resume_duration_ms:Math.round(performance.now()-n)}),e=!0,await $o(F,{getFpsMetrics:I,stats:Dt,initialState:a.initialState},{...un,mainThreadAgentDefinition:a.restoredAgentDef??j,initialMessages:a.messages,initialFileHistorySnapshots:a.fileHistorySnapshots,initialContentReplacements:a.contentReplacements,initialAgentName:a.agentName,initialAgentColor:a.agentColor},_s)}catch(t){e||Y(`tengu_continue`,{success:!1}),q(t),process.exit(1)}}else if(t.resume||t.fromPr){let{clearSessionCaches:e}=await import(`./caches-BGzKwpnc.js`);e();let n,r=Te(t.resume),i,a=null,o;if(t.fromPr&&(t.fromPr===!0?o=!0:typeof t.fromPr==`string`&&(o=t.fromPr)),t.resume&&typeof t.resume==`string`&&!r){let e=t.resume.trim();if(e){let t=await en(e,{exact:!0});t.length===1?(a=t[0],r=sn(a)??null):i=e}}if(r){let e=r;try{let r=performance.now(),i=await Ba(a??e,void 0);if(!i)return Y(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),await hs(F,`No conversation found with session ID: ${e}`);let o=a?.fullPath??i.fullPath;n=await Ua(i,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:o},dn),n.restoredAgentDef&&(j=n.restoredAgentDef),Y(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!0,resume_duration_ms:Math.round(performance.now()-r)})}catch(t){Y(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),q(t),await hs(F,`Failed to resume session ${e}`)}}let s=n??(Array.isArray(null)?{messages:null,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:j,initialState:on,contentReplacements:void 0}:void 0);s?(kc(t),await $o(F,{getFpsMetrics:I,stats:Dt,initialState:s.initialState},{...un,mainThreadAgentDefinition:s.restoredAgentDef??j,initialMessages:s.messages,initialFileHistorySnapshots:s.fileHistorySnapshots,initialContentReplacements:s.contentReplacements,initialAgentName:s.agentName,initialAgentColor:s.agentColor},_s)):await xs(F,{getFpsMetrics:I,stats:Dt,initialState:on},ut(ir()),{...un,initialSearchQuery:i,forkSession:t.forkSession,filterByPr:o})}else{let e=Bt&&Vt.length===0?Bt:void 0;X(`action_after_hooks`),kc(t);let n=null;t.deepLinkOrigin?(Y(`tengu_deep_link_opened`,{has_prefill:!!t.prefill,has_repo:!!t.deepLinkRepo}),n=an(po({cwd:Tr(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=an(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...Vt]:Vt.length>0?Vt:void 0;await $o(F,{getFpsMetrics:I,stats:Dt,initialState:on},{...un,initialMessages:r,pendingHookMessages:e},_s)}}).version(`0.0.23 (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.`),Nt()&&t.addOption(new Z(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new Z(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new Z(`--proactive`,`Start in proactive autonomous mode`)),X(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return X(`run_before_parse`),await t.parseAsync(process.argv),X(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-BNd29r6p.js`);await n({debug:e,verbose:t})}),ac(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-BNd29r6p.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-BNd29r6p.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-BNd29r6p.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-BNd29r6p.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Work Mate Desktop (Mac and WSL only)`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async e=>{let{mcpAddFromDesktopHandler:t}=await import(`./mcp-BNd29r6p.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-BNd29r6p.js`);await e()});let a=()=>new Z(`--cowork`,`Use cowork_plugins directory`).hideHelp(),o=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());o.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(a()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),o.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(a()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-COoGBYk6.js`);await t(e)});let s=o.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());return s.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(a()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),s.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(a()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-COoGBYk6.js`);await t(e)}),s.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(a()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),s.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(a()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),o.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(a()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),o.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.workmate/plugins/data/{id}/)`).addOption(a()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),o.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${za.join(`, `)} (default: auto-detect)`).addOption(a()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),o.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${za.join(`, `)} (default: auto-detect)`).addOption(a()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),o.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${La.join(`, `)} (default: user)`).addOption(a()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-COoGBYk6.js`);await n(e,t)}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-B3x8yJ_r.js`);await e(),process.exit(0)}),t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-CtlC2dsN.js`),import(`./src-9vmGsuSI.js`)]);await e(await t(ro(!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-CtlC2dsN.js`);await n(e,t)}),X(`run_before_parse`),await t.parseAsync(process.argv),X(`run_after_parse`),X(`main_after_run`),Li(),t}async function Oc({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:f,worktreeEnabled:p,skipWebFetchPreflight:m,githubActionInputs:ee,dangerouslySkipPermissionsPassed:te,permissionMode:ne,modeIsBypass:re,allowDangerouslySkipPermissionsPassed:ie,systemPromptFlag:ae,appendSystemPromptFlag:oe,thinkingConfig:se,assistantActivationPath:ce}){try{Y(`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:f,worktree:p,skipWebFetchPreflight:m,...ee&&{githubActionInputs:ee},dangerouslySkipPermissionsPassed:te,permissionMode:ne,modeIsBypass:re,inProtectedNamespace:d(),allowDangerouslySkipPermissionsPassed:ie,thinkingType:se.type,...se.type===`enabled`&&{thinkingBudgetTokens:se.budgetTokens},...ae&&{systemPromptFlag:ae},...oe&&{appendSystemPromptFlag:oe},is_simple:u()||void 0,...ce&&{assistantActivationPath:ce},autoUpdatesChannel:ci().autoUpdatesChannel??`latest`})}catch(e){q(e)}}function kc(t){if(t.proactive||c(process.env.CLAUDE_CODE_PROACTIVE)){let t=(R(),e(E));t.isProactiveActive()||t.activateProactive(`command`)}}function Ac(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(Rn)}export{Tc as main};