@readmagic/workmate 0.0.11 → 0.0.12

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 (405) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-ag2JTpmU.js → AddWorkspaceDirectory-CtRxzRny.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-_bI4jo_P.js +1 -0
  3. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CSywJdVL.js → AgentsMdExternalIncludesDialog-_yJJ0wqu.js} +1 -1
  4. package/dist/chunks/{App-BuKmqFPm.js → App-DoAZ7CYS.js} +1 -1
  5. package/dist/chunks/{ApproveApiKey-M6U-NafA.js → ApproveApiKey-C8LwmDM2.js} +1 -1
  6. package/dist/chunks/ApproveApiKey-DQP3qmb0.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-CDA2noEk.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-B05t83wa.js → BypassPermissionsModeDialog-COI_V57z.js} +1 -1
  9. package/dist/chunks/ConsoleOAuthFlow-Dn8fO-o_.js +1 -0
  10. package/dist/chunks/{DiffDialog-DUbFrzKu.js → DiffDialog-CRWtQ1R5.js} +3 -3
  11. package/dist/chunks/Doctor-CZ513Df9.js +3 -0
  12. package/dist/chunks/Doctor-CzPvNZzF.js +1 -0
  13. package/dist/chunks/ExitFlow-BFeftDv0.js +2 -0
  14. package/dist/chunks/{Grove-BDoVj02t.js → Grove-DRZrhbF0.js} +1 -1
  15. package/dist/chunks/{HybridTransport-C_U0IJfz.js → HybridTransport-BadJQe6u.js} +2 -2
  16. package/dist/chunks/{InvalidConfigDialog-bih293Xt.js → InvalidConfigDialog-DQaT6aen.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-Br8kQOHz.js → InvalidSettingsDialog-ISzcIGPU.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-BpjC7CEo.js +1 -0
  19. package/dist/chunks/MCPToolListView-Rb1Q--jG.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-COa71S9q.js → McpParsingWarnings-xv0RZCSL.js} +1 -1
  21. package/dist/chunks/MessageSelector-BHB55sZb.js +3 -0
  22. package/dist/chunks/Messages-CPX-nIdA.js +11 -0
  23. package/dist/chunks/Onboarding-CymgipoF.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-to5eYBvI.js → PromptInputFooterSuggestions-8-awCxOn.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-BP3UgCdi.js +1 -0
  26. package/dist/chunks/QueryEngine-HkswHUNv.js +1 -0
  27. package/dist/chunks/REPL-CZfg65kg.js +133 -0
  28. package/dist/chunks/REPL-eZsYNBfl.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-B4jqKVd3.js +2 -0
  30. package/dist/chunks/ResumeConversation-B03XN_SP.js +1 -0
  31. package/dist/chunks/{SSETransport-DN4tCDEh.js → SSETransport-je346ofV.js} +1 -1
  32. package/dist/chunks/SearchExtraToolsTool-C85Sanww.js +1 -0
  33. package/dist/chunks/Settings-C8GKWod1.js +2 -0
  34. package/dist/chunks/{TeleportProgress-C2LQVLav.js → TeleportProgress-zmdAsogZ.js} +1 -1
  35. package/dist/chunks/{TeleportRepoMismatchDialog-BZL8Zblz.js → TeleportRepoMismatchDialog-CG32I4cO.js} +1 -1
  36. package/dist/chunks/{TeleportResumeWrapper-wPiIs8xg.js → TeleportResumeWrapper-2Yjr74Lq.js} +1 -1
  37. package/dist/chunks/{ThemePicker-BT_NaRQC.js → ThemePicker-p7_hHk1V.js} +1 -1
  38. package/dist/chunks/TrustDialog-BVcny9vs.js +1 -0
  39. package/dist/chunks/{ValidationErrorsList-C-hWdy_8.js → ValidationErrorsList-DSSUWdgd.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-ZQRKlcT4.js → WelcomeV2-BnSYhyfu.js} +1 -1
  41. package/dist/chunks/add-dir-Bd7pilVx.js +1 -0
  42. package/dist/chunks/{agentDisplay-CuSHqgZc.js → agentDisplay-CfMLGPGH.js} +1 -1
  43. package/dist/chunks/{agents-CMC0iQP4.js → agents-BT82hwBN.js} +1 -1
  44. package/dist/chunks/agents-qR6r94-F.js +103 -0
  45. package/dist/chunks/allErrors-CS77lRvU.js +1 -0
  46. package/dist/chunks/api-C4VflFau.js +1 -0
  47. package/dist/chunks/{api-BbJfMXRS.js → api-DAubp5q9.js} +1 -1
  48. package/dist/chunks/auth-CNCehj7y.js +1 -0
  49. package/dist/chunks/auth-DrD9DW6X.js +1 -0
  50. package/dist/chunks/{auth-7mJGtlZp.js → auth-yDsvFcM7.js} +1 -1
  51. package/dist/chunks/{autoMode-CBtY7ACs.js → autoMode-C2lnBot9.js} +5 -5
  52. package/dist/chunks/backgroundHousekeeping-DbpTGbwl.js +1 -0
  53. package/dist/chunks/backgroundHousekeeping-SpTxViUq.js +17 -0
  54. package/dist/chunks/{banner-1Wyeyawe.js → banner-BcAM7iSx.js} +1 -1
  55. package/dist/chunks/bg-Ci7pG4eo.js +9 -0
  56. package/dist/chunks/{branch-k3kirqbA.js → branch-DJiMa8td.js} +1 -1
  57. package/dist/chunks/{break-cache-CAoZ9b72.js → break-cache-4rlQORVk.js} +2 -2
  58. package/dist/chunks/{bridgeConfig-UgaUfuP6.js → bridgeConfig-BB6Hgali.js} +1 -1
  59. package/dist/chunks/bridgeConfig-Ccm79Jze.js +1 -0
  60. package/dist/chunks/{bridgeMessaging-Ci5H68MX.js → bridgeMessaging-C9D0Lly2.js} +1 -1
  61. package/dist/chunks/{bridgePointer-BL8-lGvN.js → bridgePointer-DHWK3LEe.js} +1 -1
  62. package/dist/chunks/{bridgeStatusUtil-C36w15ge.js → bridgeStatusUtil-D8UbcVrZ.js} +1 -1
  63. package/dist/chunks/btw-BO2B23f-.js +1 -0
  64. package/dist/chunks/caches-BQmbXerw.js +1 -0
  65. package/dist/chunks/caches-Dtjmjm6G.js +1 -0
  66. package/dist/chunks/{capacityWake-BOySRJUJ.js → capacityWake-ByL6fM6I.js} +1 -1
  67. package/dist/chunks/{ccrClient-Br4LAofR.js → ccrClient-BG9HU_fW.js} +1 -1
  68. package/dist/chunks/{claudeDesktop-Bgds1-YT.js → claudeDesktop-Ct_hyICL.js} +1 -1
  69. package/dist/chunks/{clear-C4Vtnbye.js → clear-B4XN2fib.js} +1 -1
  70. package/dist/chunks/cliLaunch-OPOtzhvA.js +1 -0
  71. package/dist/chunks/client-7lIxWcaM.js +1 -0
  72. package/dist/chunks/client-B-2ccQZk.js +1 -0
  73. package/dist/chunks/{client-B9404qIP.js → client-BMA05FW8.js} +1 -1
  74. package/dist/chunks/commands-D_-v6_A0.js +1 -0
  75. package/dist/chunks/compact-kM0ETtB2.js +2 -0
  76. package/dist/chunks/config-9rLTDOYW.js +3 -0
  77. package/dist/chunks/config-Crf6Mzu3.js +1 -0
  78. package/dist/chunks/{config-kB2eazPX.js → config-DMKtiMzJ.js} +1 -1
  79. package/dist/chunks/{context-BN7DEjoH.js → context-BY5oO5is.js} +1 -1
  80. package/dist/chunks/{context-noninteractive-D91W2B8e.js → context-noninteractive-mAQt1p9l.js} +2 -2
  81. package/dist/chunks/context-noninteractive-tc4KTYfI.js +1 -0
  82. package/dist/chunks/conversation-CFIn-KsW.js +1 -0
  83. package/dist/chunks/conversation-DPI7VKBL.js +1 -0
  84. package/dist/chunks/createSSHSession-DjLSGm-0.js +6 -0
  85. package/dist/chunks/{createSession-DRqkLZWt.js → createSession-CftIZ3aq.js} +1 -1
  86. package/dist/chunks/createSession-CjdLcRec.js +1 -0
  87. package/dist/chunks/crossProjectResume-BJqXBzkf.js +40 -0
  88. package/dist/chunks/{cwd-Cfdf7z7s.js → cwd-Besi3Os3.js} +1 -1
  89. package/dist/chunks/cwd-DpqwaYHw.js +1 -0
  90. package/dist/chunks/datadog-BGati3aQ.js +1 -0
  91. package/dist/chunks/{debug-BecbSVoN.js → debug-Dr1SjdXn.js} +2 -2
  92. package/dist/chunks/{debugUtils-CmJfIUxW.js → debugUtils-cK-iOsEV.js} +1 -1
  93. package/dist/chunks/detached-CqfQYVOi.js +5 -0
  94. package/dist/chunks/detectRepository-BsKZDRoI.js +1 -0
  95. package/dist/chunks/{detectRepository-C15umvKN.js → detectRepository-CMEkS5_2.js} +1 -1
  96. package/dist/chunks/{diff-DeK4bwjw.js → diff-1HsxKGBh.js} +1 -1
  97. package/dist/chunks/{directoryCompletion-BJCu19HJ.js → directoryCompletion-ByBTSuLu.js} +1 -1
  98. package/dist/chunks/doctor-CJfvt9zR.js +1 -0
  99. package/dist/chunks/entry-CrZCZQQC.js +14 -0
  100. package/dist/chunks/{envUtils-BDhHQY0-.js → envUtils-DcaKZlRU.js} +1 -1
  101. package/dist/chunks/{esm-Ka3lhafK.js → esm-BkOWaWVb.js} +1 -1
  102. package/dist/chunks/{execFileNoThrow-DHyW8FMX.js → execFileNoThrow-mXq4K0rl.js} +1 -1
  103. package/dist/chunks/{execSyncWrapper-CDzB0BM1.js → execSyncWrapper-Ne33rRiD.js} +1 -1
  104. package/dist/chunks/exit-B8MA4Ltm.js +1 -0
  105. package/dist/chunks/{extraUsage-BrKbpBK-.js → extraUsage-0pUcYexI.js} +1 -1
  106. package/dist/chunks/extractMemories-DqhN0lba.js +1 -0
  107. package/dist/chunks/fast-DT5WDe3L.js +1 -0
  108. package/dist/chunks/{fast-DWn40OcQ.js → fast-VOu2FUlV.js} +1 -1
  109. package/dist/chunks/{fileSuggestions-C7Pwq2yj.js → fileSuggestions-Be-pyLLq.js} +1 -1
  110. package/dist/chunks/firstPartyEventLogger-B8RVGBQB.js +1 -0
  111. package/dist/chunks/{firstPartyEventLogger-BHjBQH0J.js → firstPartyEventLogger-aFhcruXA.js} +2 -2
  112. package/dist/chunks/{flushGate-DdJjxCes.js → flushGate-BUSrMj_6.js} +1 -1
  113. package/dist/chunks/{gemini-DHv2iVfy.js → gemini-DB4M-MYv.js} +1 -1
  114. package/dist/chunks/{generateSessionName-DhS_6oHd.js → generateSessionName-DhCypqJ_.js} +1 -1
  115. package/dist/chunks/{genericProcessUtils-B2HcDYhg.js → genericProcessUtils-Dc1pfb7J.js} +1 -1
  116. package/dist/chunks/git-Bs1vtuvX.js +1 -0
  117. package/dist/chunks/{git-DBlOv64X.js → git-CoQQ6YEf.js} +1 -1
  118. package/dist/chunks/{githubRepoPathMapping-CK56bUDe.js → githubRepoPathMapping-CmpEaQoo.js} +1 -1
  119. package/dist/chunks/goal-TxXtfkQ6.js +3 -0
  120. package/dist/chunks/{grok-BS57ZhyW.js → grok-D2a_J5wE.js} +1 -1
  121. package/dist/chunks/{grove-_zlQ83yR.js → grove-BnzBbGsX.js} +2 -2
  122. package/dist/chunks/{help-C_2tdXHC.js → help-C5ankDi4.js} +1 -1
  123. package/dist/chunks/{hooks-C7Bn7MBe.js → hooks-BZS105Rd.js} +3 -3
  124. package/dist/chunks/hooks-D-twhU_z.js +1 -0
  125. package/dist/chunks/{initReplBridge-NkZRcM77.js → initReplBridge-DL4klK0C.js} +1 -1
  126. package/dist/chunks/{install-Du-DSVzj.js → install-NZvHd_40.js} +1 -1
  127. package/dist/chunks/{instrumentation-DMs3b82f.js → instrumentation-CjBlVlFq.js} +4 -4
  128. package/dist/chunks/{job-rbX1VZmp.js → job-D502Zf8J.js} +1 -1
  129. package/dist/chunks/{jwtUtils-OzxN2zts.js → jwtUtils-FQWtM6iM.js} +1 -1
  130. package/dist/chunks/keybindings-D9Boc8FD.js +2 -0
  131. package/dist/chunks/{launchLocalMemory-BLRCK1_o.js → launchLocalMemory-DxC3LojF.js} +2 -2
  132. package/dist/chunks/{launchOnboarding-Al_X75Vz.js → launchOnboarding-BLp5k_H4.js} +1 -1
  133. package/dist/chunks/{loadAgentsDir-BL93ulMm.js → loadAgentsDir-BXtV2jiO.js} +597 -604
  134. package/dist/chunks/loadAgentsDir-BjsAQWqt.js +1 -0
  135. package/dist/chunks/{loadPluginHooks-B0au35a4.js → loadPluginHooks-Dt3XQ-3N.js} +1 -1
  136. package/dist/chunks/{localSearch-C5ipegd9.js → localSearch-CeP4ef0a.js} +1 -1
  137. package/dist/chunks/localSearch-Cz8Ot7k2.js +1 -0
  138. package/dist/chunks/{log-Dauqle-Z.js → log-27kCA_9u.js} +1 -1
  139. package/dist/chunks/{logoV2Utils-CkvOihX7.js → logoV2Utils-CEnU8qad.js} +1 -1
  140. package/dist/chunks/{magicDocs-DLav5QK0.js → magicDocs-YtfrqVC6.js} +3 -3
  141. package/dist/chunks/main-CGLCy2pM.js +31 -0
  142. package/dist/chunks/{main-CVNWNAoh.js → main-CkjTzYj1.js} +42 -42
  143. package/dist/chunks/{managedEnv-DJSCuqCb.js → managedEnv-B-BNY0xC.js} +1 -1
  144. package/dist/chunks/managedEnv-K9Si1UuL.js +1 -0
  145. package/dist/chunks/{mappers-DQxMcezy.js → mappers-IuJeXgvr.js} +1 -1
  146. package/dist/chunks/mcp-DMBoeQzm.js +6 -0
  147. package/dist/chunks/mcp-TMOPfLcW.js +1 -0
  148. package/dist/chunks/mcp-x5rgv-uv.js +2 -0
  149. package/dist/chunks/{memoize-FeyE7JEh.js → memoize-Co4vS6UF.js} +1 -1
  150. package/dist/chunks/memory-DDUoR63T.js +1 -0
  151. package/dist/chunks/{mode-Bl2RZC8M.js → mode-GzBwK--u.js} +2 -2
  152. package/dist/chunks/model-BydaMaPr.js +1 -0
  153. package/dist/chunks/model-CDnVaVDR.js +1 -0
  154. package/dist/chunks/model-CIvbC7rW.js +1 -0
  155. package/dist/chunks/{modelOptions-BtEZe5BB.js → modelOptions-ut0xePEe.js} +1 -1
  156. package/dist/chunks/{nativeInstaller-BEwayifa.js → nativeInstaller-fgCMR_c0.js} +1 -1
  157. package/dist/chunks/oauth-D38aRTUb.js +1 -0
  158. package/dist/chunks/oauth-U649LV5H.js +1 -0
  159. package/dist/chunks/{observationStore-BpjlK0pG.js → observationStore-D0rm3GhP.js} +1 -1
  160. package/dist/chunks/omit-D4Udf-p-.js +1 -0
  161. package/dist/chunks/{onChangeAppState-ZdwI7boX.js → onChangeAppState-WbvtqDtk.js} +1 -1
  162. package/dist/chunks/{openai-DWs4D-nQ.js → openai-DaVFXyBB.js} +3 -3
  163. package/dist/chunks/{panel-CoNfXy3K.js → panel-CoF2a-h4.js} +1 -1
  164. package/dist/chunks/parser-B2PlJg4C.js +1 -0
  165. package/dist/chunks/{parser-BH4u7QiV.js → parser-CUUiH40T.js} +1 -1
  166. package/dist/chunks/partition-CzW_31Y1.js +1 -0
  167. package/dist/chunks/permissions-BT3lxYBM.js +3 -0
  168. package/dist/chunks/{pidLock-DgOBc1Xo.js → pidLock-d1VPd6CG.js} +2 -2
  169. package/dist/chunks/{plan-BNYDTnQd.js → plan-M9DG3AqN.js} +1 -1
  170. package/dist/chunks/{platform-B0uTQc9P.js → platform-Dg1c9F_1.js} +1 -1
  171. package/dist/chunks/plugin-BiNHuq3h.js +17 -0
  172. package/dist/chunks/{pluginAutoupdate-BBU9Jn4p.js → pluginAutoupdate-B5lel6s5.js} +1 -1
  173. package/dist/chunks/{pluginBlocklist-DXQlbG0P.js → pluginBlocklist-CNGmIlwU.js} +1 -1
  174. package/dist/chunks/pluginCliCommands-WLOEhb2M.js +1 -0
  175. package/dist/chunks/{pluginFlagging-DcJ_FQuv.js → pluginFlagging-CXSSOj4J.js} +1 -1
  176. package/dist/chunks/pluginOperations-BFbty6WT.js +2 -0
  177. package/dist/chunks/{pluginStartupCheck-CKBFaMFr.js → pluginStartupCheck-BEd0VeQC.js} +1 -1
  178. package/dist/chunks/pluginStartupCheck-Bcdxg484.js +1 -0
  179. package/dist/chunks/{plugins-CBW7kPyp.js → plugins-BMZ3aYKP.js} +4 -4
  180. package/dist/chunks/poorMode-Djw0P9Gu.js +1 -0
  181. package/dist/chunks/{poorMode-B_xEvuEV.js → poorMode-DxgO_bUb.js} +1 -1
  182. package/dist/chunks/print-DmoLcwVq.js +26 -0
  183. package/dist/chunks/processBashCommand-B-VqME9O.js +1 -0
  184. package/dist/chunks/processSlashCommand-D6zEooTy.js +5 -0
  185. package/dist/chunks/{projectContext-CIxul6vA.js → projectContext-BN2ZWzOG.js} +1 -1
  186. package/dist/chunks/{projectContext-RUMJB798.js → projectContext-Bw3o5BrN.js} +1 -1
  187. package/dist/chunks/prompt-C3RRe4kW.js +1 -0
  188. package/dist/chunks/{prompt-Dx7IWhBt.js → prompt-CRc2QEZ5.js} +4 -4
  189. package/dist/chunks/prompt-EtAanewG.js +1 -0
  190. package/dist/chunks/{promptEditor-WCkmpejM.js → promptEditor-Bo1d8ZLq.js} +2 -2
  191. package/dist/chunks/{protocolHandler-BiVWrpHi.js → protocolHandler-B83fCYI4.js} +1 -1
  192. package/dist/chunks/{proxy-CVn7o19p.js → proxy-BEKNaTXI.js} +1 -1
  193. package/dist/chunks/rcDebugLog-DSchf3Hs.js +1 -0
  194. package/dist/chunks/{reconciler-C2Nd_e4n.js → reconciler-BGav_ezX.js} +1 -1
  195. package/dist/chunks/refresh-DumNiLvM.js +1 -0
  196. package/dist/chunks/{registerProtocol-E0Iu5hEx.js → registerProtocol-DduKPsn_.js} +1 -1
  197. package/dist/chunks/{reload-plugins-D-3AUT9g.js → reload-plugins-DNEgQ5vo.js} +1 -1
  198. package/dist/chunks/{remoteBridgeCore-CV6we3ZA.js → remoteBridgeCore-BGOqHADF.js} +1 -1
  199. package/dist/chunks/{remoteManagedSettings-D26Q09-7.js → remoteManagedSettings-26nhzuca.js} +1 -1
  200. package/dist/chunks/{rename-CSavuBIE.js → rename-BPknfVGF.js} +1 -1
  201. package/dist/chunks/{renderOptions-DDLbSMQU.js → renderOptions-45A-EdsK.js} +1 -1
  202. package/dist/chunks/resume-DGz04xDh.js +2 -0
  203. package/dist/chunks/ripgrep-BLQnqPnE.js +1 -0
  204. package/dist/chunks/{ripgrep-C1ydIMzT.js → ripgrep-DQ_ILUJV.js} +1 -1
  205. package/dist/chunks/{runtimeObserver-L7pSIWBT.js → runtimeObserver-BZrF3GnQ.js} +4 -4
  206. package/dist/chunks/{runtimeObserver-OU8KrZQG.js → runtimeObserver-CBV-7-w7.js} +1 -1
  207. package/dist/chunks/sandbox-adapter-DUqeqkQD.js +1 -0
  208. package/dist/chunks/sandbox-toggle-D61gVqcT.js +1 -0
  209. package/dist/chunks/searchExtraTools-CgsV6kb1.js +1 -0
  210. package/dist/chunks/{session-DUYsfPy_.js → session-Dy-_R7KP.js} +2 -2
  211. package/dist/chunks/sessionFileAccessHooks-BJlrZaRD.js +1 -0
  212. package/dist/chunks/sessionObserver-BGYoLRGx.js +1 -0
  213. package/dist/chunks/{sessionObserver-Dv3Ba8eA.js → sessionObserver-CyLpHSkw.js} +2 -2
  214. package/dist/chunks/{sessionState-D-SaBzWD.js → sessionState-DSWN4tMV.js} +1 -1
  215. package/dist/chunks/sessionStorage-zJ1esSCE.js +1 -0
  216. package/dist/chunks/{sessionStoragePortable-JZnGwqUM.js → sessionStoragePortable-BhkGMZWp.js} +1 -1
  217. package/dist/chunks/{sessionTitle-uCuYaNif.js → sessionTitle-L5tyJgdU.js} +2 -2
  218. package/dist/chunks/{sessionTracing-Bqb3vJTt.js → sessionTracing-DpHGGIZm.js} +1 -1
  219. package/dist/chunks/settings-3ionQKNv.js +1 -0
  220. package/dist/chunks/settings-DiBMs2gM.js +20 -0
  221. package/dist/chunks/settingsSync-dBqlrbcU.js +1 -0
  222. package/dist/chunks/setup-zf3v3ICe.js +3 -0
  223. package/dist/chunks/{shadowedRuleDetection-BzAZ57p2.js → shadowedRuleDetection-DZ0AA2Rw.js} +1 -1
  224. package/dist/chunks/{shellQuote-DS6WrivY.js → shellQuote-C_I6DHLV.js} +1 -1
  225. package/dist/chunks/{sideQuestion-CvMBBjI8.js → sideQuestion-BYT8FdPF.js} +1 -1
  226. package/dist/chunks/sinks-DppGvgz1.js +1 -0
  227. package/dist/chunks/{sinks-f7qYjbKJ.js → sinks-mFsijQ_S.js} +2 -2
  228. package/dist/chunks/skillChangeDetector-D-iq09Xs.js +1 -0
  229. package/dist/chunks/{skillGapStore-CqaT8c0C.js → skillGapStore-DQXHqoP7.js} +2 -2
  230. package/dist/chunks/{skillLifecycle-CnR8IqJM.js → skillLifecycle-BG_RnGSh.js} +2 -2
  231. package/dist/chunks/{skillSearchPanel-D9qrOXpI.js → skillSearchPanel-DxYP4Q6R.js} +5 -5
  232. package/dist/chunks/skills-BD-2ofXA.js +1 -0
  233. package/dist/chunks/startupProfiler-CUlV07MD.js +1 -0
  234. package/dist/chunks/{startupProfiler-CmH_aVy2.js → startupProfiler-Dc5r6LgE.js} +2 -2
  235. package/dist/chunks/{state-BemZdQIl.js → state-BPFYBqm1.js} +1 -1
  236. package/dist/chunks/state-CsdHk8n-.js +1 -0
  237. package/dist/chunks/{stats-B8uQ-UDi.js → stats-BkadEKa-.js} +1 -1
  238. package/dist/chunks/{status-D6KlRJmR.js → status-BmHu-c7I.js} +2 -2
  239. package/dist/chunks/{status-BekdWoIj.js → status-CrmnCDIE.js} +1 -1
  240. package/dist/chunks/{statusNoticeHelpers-BMM8_uJ1.js → statusNoticeHelpers-DakAVtQO.js} +1 -1
  241. package/dist/chunks/{stringUtils-C8PaYpQF.js → stringUtils-Df-Lnjxd.js} +1 -1
  242. package/dist/chunks/{subprocessEnv-Ci8VV_bi.js → subprocessEnv-CNBOhlDV.js} +1 -1
  243. package/dist/chunks/subprocessEnv-DtBCqQIo.js +1 -0
  244. package/dist/chunks/switcher-Dm646gO5.js +1 -0
  245. package/dist/chunks/switcher-sYTxnJQA.js +1 -0
  246. package/dist/chunks/{syncCache-ClP9aBqK.js → syncCache-BofuFJEe.js} +1 -1
  247. package/dist/chunks/{tasks-Dmh6qikm.js → tasks-NpI1iEem.js} +1 -1
  248. package/dist/chunks/teleport-Bs3kEipi.js +1 -0
  249. package/dist/chunks/{templateJobs-CxqU-s5i.js → templateJobs-C94jEE6O.js} +2 -2
  250. package/dist/chunks/{terminalSetup-BKGcmlWp.js → terminalSetup-CbXKCpWM.js} +1 -1
  251. package/dist/chunks/{terminalSetup-Cy19F1Js.js → terminalSetup-fwhFTxGi.js} +1 -1
  252. package/dist/chunks/{theme-U7lMFHQ0.js → theme-CEi3b_8f.js} +1 -1
  253. package/dist/chunks/tmux-d3cNCIZA.js +1 -0
  254. package/dist/chunks/{toolEventObserver-D9qjoVl5.js → toolEventObserver-DlL9CHmI.js} +1 -1
  255. package/dist/chunks/toolPool-DIT_uhtD.js +1 -0
  256. package/dist/chunks/trustedDevice-BokywSKL.js +1 -0
  257. package/dist/chunks/{trustedDevice-DL0pWP4_.js → trustedDevice-Bzz03jCy.js} +1 -1
  258. package/dist/chunks/{types-DafcFtmb.js → types-BJ7qTz75.js} +1 -1
  259. package/dist/chunks/{udsClient-CWnfsgFP.js → udsClient-CF8BmZgN.js} +1 -1
  260. package/dist/chunks/{updateCCB-C6XftzIG.js → updateCCB-CzBxsuJe.js} +6 -6
  261. package/dist/chunks/{upstreamproxy-CXmjxHpl.js → upstreamproxy-BuBFDFAD.js} +1 -1
  262. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DEEJhm_W.js → useExitOnCtrlCDWithKeybindings-BHQfwlAl.js} +1 -1
  263. package/dist/chunks/useMainLoopModel-BkyIIW9t.js +1 -0
  264. package/dist/chunks/useManagePlugins-BWROoGDs.js +1 -0
  265. package/dist/chunks/{useMergedTools-DbhqKk1-.js → useMergedTools-CHxnwR7R.js} +1 -1
  266. package/dist/chunks/{useSearchInput-gUDbkLaC.js → useSearchInput-q2CFPU4W.js} +1 -1
  267. package/dist/chunks/useSettingsErrors-CPVQbsqq.js +1 -0
  268. package/dist/chunks/{userAgent-CU7Ndh79.js → userAgent-B7WkjI6I.js} +1 -1
  269. package/dist/chunks/util-BfqXOA-P.js +1 -0
  270. package/dist/chunks/{validatePlugin-y_O_tCEL.js → validatePlugin-jrcrYEIu.js} +1 -1
  271. package/dist/chunks/{vim-w37BfGZ5.js → vim-C4Hs5U2h.js} +1 -1
  272. package/dist/chunks/{which-BRWBO7Gu.js → which-mplwBbc0.js} +1 -1
  273. package/dist/chunks/windowsPaths-B8p9tFRF.js +1 -0
  274. package/dist/chunks/{windowsPaths-DtWHLjmE.js → windowsPaths-C7Mdo9aU.js} +1 -1
  275. package/dist/chunks/{workSecret-BEhXgH2M.js → workSecret-XLodD7tw.js} +1 -1
  276. package/dist/chunks/workerRegistry-Cfo7bKlm.js +6 -0
  277. package/dist/chunks/worktree-D0k_pCEz.js +1 -0
  278. package/dist/cli.js +1 -1
  279. package/package.json +1 -1
  280. package/dist/chunks/ApproveApiKey-CIWOi_7v.js +0 -1
  281. package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +0 -2
  282. package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +0 -1
  283. package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +0 -1
  284. package/dist/chunks/Doctor-BcnUfJ4I.js +0 -1
  285. package/dist/chunks/Doctor-Dz4TuYas.js +0 -3
  286. package/dist/chunks/ExitFlow-BwyAtIHx.js +0 -2
  287. package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +0 -1
  288. package/dist/chunks/MCPToolListView-DJ06N1DG.js +0 -1
  289. package/dist/chunks/MessageSelector-o4ULADFg.js +0 -3
  290. package/dist/chunks/Messages-qqwHuAW5.js +0 -11
  291. package/dist/chunks/Onboarding-BzuQjney.js +0 -1
  292. package/dist/chunks/PromptInputHelpMenu-CfMFx-TF.js +0 -1
  293. package/dist/chunks/QueryEngine-Dt0BKUeF.js +0 -1
  294. package/dist/chunks/REPL-CUbEDqEl.js +0 -133
  295. package/dist/chunks/REPL-DMaKNhTa.js +0 -1
  296. package/dist/chunks/RemoteSessionManager-Bf44A0Ol.js +0 -2
  297. package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +0 -1
  298. package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +0 -1
  299. package/dist/chunks/Settings-DfdcmvOV.js +0 -2
  300. package/dist/chunks/TrustDialog-ACaJ_m7A.js +0 -1
  301. package/dist/chunks/add-dir-SAKTkw0S.js +0 -1
  302. package/dist/chunks/agents-ZgRKpjHv.js +0 -103
  303. package/dist/chunks/allErrors-_cOQksHC.js +0 -1
  304. package/dist/chunks/api-DS1MiW01.js +0 -1
  305. package/dist/chunks/auth-DGZzCbU0.js +0 -1
  306. package/dist/chunks/auth-DN1MUpB8.js +0 -1
  307. package/dist/chunks/autonomy-DuQmYhq6.js +0 -15
  308. package/dist/chunks/autonomy-lJV7yWUl.js +0 -1
  309. package/dist/chunks/autonomyPanel-DAQm6lDz.js +0 -1
  310. package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +0 -1
  311. package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +0 -17
  312. package/dist/chunks/bg-CJ0YWFli.js +0 -9
  313. package/dist/chunks/bg-CeUrRz_7.js +0 -1
  314. package/dist/chunks/bridgeConfig-CzRUPn-D.js +0 -1
  315. package/dist/chunks/btw-nVoVuIae.js +0 -1
  316. package/dist/chunks/caches-B8sM3Zys.js +0 -1
  317. package/dist/chunks/caches-Bp9MZ7IE.js +0 -1
  318. package/dist/chunks/cliLaunch-BTpfAGGI.js +0 -1
  319. package/dist/chunks/client-BCAbKdNz.js +0 -1
  320. package/dist/chunks/client-CJE6gEvU.js +0 -1
  321. package/dist/chunks/commands-DL-BzoMQ.js +0 -1
  322. package/dist/chunks/compact-Cx7BPXLU.js +0 -2
  323. package/dist/chunks/config-S5OW4Xqr.js +0 -1
  324. package/dist/chunks/config-aRiTrtCv.js +0 -3
  325. package/dist/chunks/context-noninteractive-DPacEFJ1.js +0 -1
  326. package/dist/chunks/conversation-D5Nbu9eT.js +0 -1
  327. package/dist/chunks/conversation-hcUx9e-C.js +0 -1
  328. package/dist/chunks/createSSHSession-DecOR6M5.js +0 -6
  329. package/dist/chunks/createSession-D27zvmOs.js +0 -1
  330. package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +0 -40
  331. package/dist/chunks/cwd-ClLru_7T.js +0 -1
  332. package/dist/chunks/datadog-bm551AVV.js +0 -1
  333. package/dist/chunks/detached-CIyF0M5O.js +0 -5
  334. package/dist/chunks/detectRepository-DDfLfKcM.js +0 -1
  335. package/dist/chunks/doctor-BJORBomU.js +0 -1
  336. package/dist/chunks/entry-mdegyj8z.js +0 -14
  337. package/dist/chunks/exit-CF3KBl-S.js +0 -1
  338. package/dist/chunks/extractMemories-4lBn134y.js +0 -1
  339. package/dist/chunks/fast-0Vi354KI.js +0 -1
  340. package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +0 -1
  341. package/dist/chunks/git-DF4RFFaT.js +0 -1
  342. package/dist/chunks/goal-BZG4gtnb.js +0 -3
  343. package/dist/chunks/hooks-DT80Arzc.js +0 -1
  344. package/dist/chunks/keybindings-CwdC_8S0.js +0 -2
  345. package/dist/chunks/loadAgentsDir-eVKq8efm.js +0 -1
  346. package/dist/chunks/localSearch-CZlFfR_X.js +0 -1
  347. package/dist/chunks/main-LMyE3jXY.js +0 -31
  348. package/dist/chunks/managedEnv-CYepSnm8.js +0 -1
  349. package/dist/chunks/mcp-BAbbEaBA.js +0 -1
  350. package/dist/chunks/mcp-Ct4Sum6A.js +0 -6
  351. package/dist/chunks/mcp-D5HkCqUh.js +0 -2
  352. package/dist/chunks/memory-COa7aUbx.js +0 -1
  353. package/dist/chunks/model-B7rtZ7KV.js +0 -1
  354. package/dist/chunks/model-Bgh_r4lg.js +0 -1
  355. package/dist/chunks/model-DiuEAv6h.js +0 -1
  356. package/dist/chunks/oauth-BN2I0_jl.js +0 -1
  357. package/dist/chunks/oauth-C9VBDB0Y.js +0 -1
  358. package/dist/chunks/omit--yH_T4rf.js +0 -1
  359. package/dist/chunks/parser-BMIaRErw.js +0 -1
  360. package/dist/chunks/partition-DLcW5Oo_.js +0 -1
  361. package/dist/chunks/permissions-CaucYK3s.js +0 -3
  362. package/dist/chunks/plugin-BN-of1_H.js +0 -17
  363. package/dist/chunks/pluginCliCommands-CfdVNs8D.js +0 -1
  364. package/dist/chunks/pluginOperations-DnhzFbYI.js +0 -2
  365. package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +0 -1
  366. package/dist/chunks/poorMode-yH1o41cQ.js +0 -1
  367. package/dist/chunks/print-BZOx09SU.js +0 -26
  368. package/dist/chunks/processBashCommand-dcCNCiBp.js +0 -1
  369. package/dist/chunks/processSlashCommand-YDiM63Qr.js +0 -5
  370. package/dist/chunks/prompt-CXGy0llt.js +0 -1
  371. package/dist/chunks/prompt-DovNDmcx.js +0 -1
  372. package/dist/chunks/rcDebugLog-CARUIORE.js +0 -1
  373. package/dist/chunks/refresh-B84H2Ezd.js +0 -1
  374. package/dist/chunks/resume-CROylN3J.js +0 -2
  375. package/dist/chunks/ripgrep-2M1GkXqJ.js +0 -1
  376. package/dist/chunks/sandbox-adapter-6UwMLh6e.js +0 -1
  377. package/dist/chunks/sandbox-toggle-YrQNWGsr.js +0 -1
  378. package/dist/chunks/searchExtraTools-Bdv5HJ74.js +0 -1
  379. package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +0 -1
  380. package/dist/chunks/sessionObserver-B0zucj_c.js +0 -1
  381. package/dist/chunks/sessionStorage-BM1x51Z7.js +0 -1
  382. package/dist/chunks/settings-BG15IFYx.js +0 -1
  383. package/dist/chunks/settings-D4CpDv2y.js +0 -20
  384. package/dist/chunks/settingsSync-BSrpnyqo.js +0 -1
  385. package/dist/chunks/setup-C62oq4AZ.js +0 -3
  386. package/dist/chunks/sinks-WJ7nzLQs.js +0 -1
  387. package/dist/chunks/skillChangeDetector-U5kRU5nd.js +0 -1
  388. package/dist/chunks/skills-BgcFh0vy.js +0 -1
  389. package/dist/chunks/startupProfiler-B4HBBbHN.js +0 -1
  390. package/dist/chunks/state-BAGmpVBn.js +0 -1
  391. package/dist/chunks/state-D_lk6z-C.js +0 -1
  392. package/dist/chunks/subprocessEnv-CZkA9Cdp.js +0 -1
  393. package/dist/chunks/switcher-Ck9CrXrr.js +0 -1
  394. package/dist/chunks/switcher-DnAhkyIn.js +0 -1
  395. package/dist/chunks/teleport-DH3IuAUQ.js +0 -1
  396. package/dist/chunks/tmux-D5EvHWi3.js +0 -1
  397. package/dist/chunks/toolPool-69mfSPAs.js +0 -1
  398. package/dist/chunks/trustedDevice-B6AKlsl_.js +0 -1
  399. package/dist/chunks/useMainLoopModel-6w7mhwhU.js +0 -1
  400. package/dist/chunks/useManagePlugins-CjnsO-Of.js +0 -1
  401. package/dist/chunks/useSettingsErrors-CgPad-H0.js +0 -1
  402. package/dist/chunks/util-B4oMhJKh.js +0 -1
  403. package/dist/chunks/windowsPaths-BY-IVNwQ.js +0 -1
  404. package/dist/chunks/workerRegistry-Bq9bS5pw.js +0 -6
  405. package/dist/chunks/worktree-4SUJ4dtz.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DaDcL9Zw.js";import{n as o,t as s}from"./memoize-BK3gG5ob.js";import{a as c,d as l,f as u,l as d,o as f,s as p,u as m}from"./envUtils-BDhHQY0-.js";import{n as h,t as g}from"./defineProperty-C-QyHrDq.js";import{n as _,t as ee}from"./axios-DaWTGg7G.js";import{$T as te,$d as v,$s as ne,$u as re,$x as ie,AT as ae,Au as y,Ax as b,B_ as oe,Ba as se,Bi as ce,Bw as le,C as ue,Cc as de,Co as fe,Cr as pe,Ct as me,Cu as he,Du as ge,Ei as _e,Et as ve,Eu as ye,Ex as be,F as xe,FT as Se,Fi as Ce,Fp as we,Fx as Te,Gx as Ee,HS as x,HT as De,Hx as Oe,In as ke,Is as Ae,Ix as je,JT as Me,Ji as S,Kl as Ne,L_ as Pe,Ld as Fe,Li as Ie,Ln as Le,Lx as Re,M as ze,MT as Be,Mf as Ve,Mh as He,Mn as C,Mv as Ue,Mx as We,NT as Ge,Nc as Ke,Nf as qe,Nh as Je,Nx as Ye,O as Xe,OT as Ze,Ox as w,PT as Qe,Pc as $e,Pf as et,Pp as tt,Px as nt,RT as rt,Rh as it,Rs as at,Rx as ot,SE as st,Sa as ct,Sb as lt,So as ut,Su as dt,T as ft,Ta as pt,Ti as mt,To as ht,Tt as gt,UT as _t,Un as vt,Ux as yt,VS as bt,V_ as xt,Vh as St,Vx as Ct,Ww as wt,Wx as Tt,Yh as Et,Yw as Dt,Zx as Ot,_E as kt,_c as At,_p as jt,_u as Mt,aS as Nt,af as T,at as Pt,bb as Ft,bc as It,bg as Lt,bl as E,bu as D,bv as Rt,cS as zt,c_ as O,cf as k,cs as A,cx as Bt,dS as Vt,df as Ht,do as Ut,dr as Wt,du as Gt,dw as Kt,eE as qt,ec as Jt,ed as Yt,ef as Xt,el as Zt,ex as Qt,f as $t,fS as en,ff as tn,gE as nn,gf as rn,gi as an,hS as on,hf as sn,hi as cn,hl as ln,hr as un,i as dn,iS as fn,if as pn,it as mn,jd as hn,ji as gn,ju as _n,jv as vn,jx as yn,kT as bn,kt as xn,kx as Sn,ly as Cn,mE as j,mS as wn,mf as Tn,ml as En,mp as Dn,nS as On,nd as kn,o as M,oS as An,oc as jn,of as Mn,om as Nn,os as Pn,ox as Fn,oy as In,pE as Ln,pf as Rn,po as zn,pu as Bn,qT as Vn,qh as Hn,qi as Un,ql as Wn,qw as Gn,r as Kn,rS as qn,rc as Jn,rd as Yn,rf as Xn,s as Zn,s_ as Qn,sf as $n,si as er,sm as tr,so as nr,sx as rr,tS as ir,tc as ar,tf as or,tl as sr,uS as cr,uf as lr,uu as ur,uw as dr,v as fr,vE as pr,vb as mr,vc as hr,vu as gr,w as _r,wb as vr,wo as yr,wu as br,wx as xr,xE as Sr,xS as Cr,xf as wr,xg as Tr,xl as Er,xu as Dr,xv as Or,y as kr,yE as Ar,yS as jr,yf as Mr,yu as Nr,yv as Pr,z_ as Fr,zh as Ir,zx as Lr}from"./loadAgentsDir-BL93ulMm.js";import{B as Rr,D as zr,I as Br,Lt as Vr,P as Hr,R as Ur,T as Wr,di as Gr,fi as Kr,rr as qr,t as Jr,ui as N,xr as Yr,y as Xr}from"./src-P_wYS_NJ2.js";import{t as Zr}from"./jsx-runtime-Bb4Xn-E0.js";import{A as P,M as Qr,O as $r,j as ei,l as ti,p as ni,u as ri,w as ii}from"./external-CEp-aPkt.js";import{n as ai,r as oi,t as si}from"./lazySchema-B4D4qJVE.js";import{$n as ci,Bn as li,Cn as ui,F as di,J as fi,Jn as pi,Kn as mi,Mn as hi,Nn as gi,Pn as _i,Qn as vi,Sn as yi,Wt as bi,Yn as xi,Zn as Si,_r as Ci,bn as wi,dn as Ti,dt as Ei,er as Di,et as Oi,fn as ki,ft as Ai,gn as ji,gr as Mi,in as Ni,ln as Pi,nr as Fi,on as Ii,or as Li,pt as Ri,xn as zi,z as Bi}from"./state-BemZdQIl.js";import{n as Vi,t as Hi}from"./cwd-Cfdf7z7s.js";import{B as Ui,C as Wi,F as Gi,M as Ki,O as qi,P as F,R as Ji,S as Yi,T as Xi,U as Zi,c as I,f as Qi,g as $i,i as ea,l as ta,nt as na,tt as ra,u as ia,x as aa}from"./debug-BecbSVoN.js";import{Bt as oa,J as sa,Ln as ca,Mt as la,O as ua,Q as da,Rn as fa,S as pa,T as ma,c as ha,dn as ga,f as _a,g as L,h as va,i as ya,k as ba,ln as xa,n as Sa,u as Ca,x as R}from"./settings-D4CpDv2y.js";import{M as wa,P as Ta,T as Ea,_ as Da,c as z,g as Oa,h as B,k as ka,n as Aa,o as ja,p as Ma,r as Na,s as Pa,v as Fa,w as Ia,y as V}from"./config-aRiTrtCv.js";import{a as La,n as Ra,r as za}from"./process-gEbdy6uY.js";import{O as Ba,f as Va,i as Ha,k as H,l as Ua,m as Wa,u as Ga}from"./git-DBlOv64X.js";import{c as Ka,o as qa}from"./execFileNoThrow-DHyW8FMX.js";import{d as Ja,f as Ya,o as Xa,s as U}from"./log-Dauqle-Z.js";import{n as Za,t as Qa}from"./which-BRWBO7Gu.js";import{i as $a,o as eo}from"./platform-B0uTQc9P.js";import{i as to,o as no}from"./windowsPaths-DtWHLjmE.js";import{s as ro,u as io}from"./types-DafcFtmb.js";import{n as W,r as G}from"./analytics-DJobLaWP.js";import{i as ao,n as oo,r as K}from"./startupProfiler-CmH_aVy2.js";import{l as so,s as co,u as lo}from"./oauth-C9VBDB0Y.js";import{n as uo,t as fo}from"./bundledMode--fG1S62b.js";import{l as po,o as mo}from"./stringUtils-C8PaYpQF.js";import{$t as ho,Bt as go,C as _o,Dn as vo,Fr as yo,Ft as bo,Gr as xo,Jn as So,Kn as Co,Ot as wo,Rr as To,S as Eo,Sr as Do,Vn as Oo,Xt as ko,Yn as Ao,Z as jo,_ as Mo,ai as No,an as Po,ar as Fo,b as Io,bn as Lo,en as Ro,et as zo,g as Bo,in as Vo,ir as Ho,jn as Uo,lt as Wo,nr as Go,o as Ko,pn as qo,qr as Jo,rr as Yo,rt as Xo,si as Zo,ut as Qo,v as $o,xn as es,xr as ts,xt as ns,yn as rs,zt as is}from"./model-Bgh_r4lg.js";import{Dt as as,Mt as os,Nt as ss,Yt as cs,at as ls,jt as us,ot as ds,qt as fs,st as ps}from"./prompt-Dx7IWhBt.js";import{f as ms,h as hs,l as gs,n as _s}from"./proxy-CVn7o19p.js";import{n as vs,t as ys}from"./userAgent-CU7Ndh79.js";import{A as bs,_ as xs,k as Ss,x as Cs}from"./sessionState-D-SaBzWD.js";import{n as ws,t as Ts}from"./partition-DLcW5Oo_.js";import{a as Es,n as Ds}from"./ripgrep-C1ydIMzT.js";import{c as Os}from"./switcher-DnAhkyIn.js";import{dt as ks,ft as As}from"./esm-Ka3lhafK.js";import{C as js,D as Ms,O as Ns,S as Ps}from"./sessionTracing-Bqb3vJTt.js";import{i as Fs,n as Is,o as Ls,r as Rs}from"./detectRepository-C15umvKN.js";import{c as zs,o as Bs,r as Vs}from"./api-BbJfMXRS.js";import{d as Hs,f as Us,l as Ws,p as Gs,u as Ks}from"./firstPartyEventLogger-BHjBQH0J.js";import{n as qs,t as Js}from"./worktreeModeEnabled-BFOYTTTr.js";import{a as Ys}from"./grove-_zlQ83yR.js";import{a as Xs,i as Zs,n as Qs,o as $s,r as ec}from"./remoteManagedSettings-D26Q09-7.js";import{n as tc,t as nc}from"./allErrors-_cOQksHC.js";import{n as rc,t as q}from"./exit-BOhGfSlm.js";import{n as ic,s as ac,t as oc}from"./pluginOperations-DnhzFbYI.js";import"./pluginCliCommands-CfdVNs8D.js";import{n as sc,r as cc,t as lc}from"./managedEnv-DJSCuqCb.js";import{n as uc}from"./onChangeAppState-ZdwI7boX.js";import{i as dc,t as fc}from"./skillChangeDetector-U5kRU5nd.js";import{n as pc}from"./stats-B8uQ-UDi.js";import{t as mc}from"./renderOptions-DDLbSMQU.js";import{i as hc,n as gc,t as _c}from"./githubRepoPathMapping-CK56bUDe.js";import{i as vc,n as yc}from"./earlyInput-IghoCjG5.js";import{t as bc}from"./banner-1Wyeyawe.js";import{c as xc,n as Sc,o as Cc,r as wc}from"./RemoteSessionManager-Bf44A0Ol.js";import{posix as Tc,resolve as Ec,win32 as Dc}from"path";import{appendFileSync as Oc,readFileSync as kc}from"fs";var Ac=a((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),jc=a((e=>{var{InvalidArgumentError:t}=Ac(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Mc=a((e=>{var{humanReadableArgName:t}=jc(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DaDcL9Zw.js";import{n as o,t as s}from"./memoize-BK3gG5ob.js";import{a as c,d as l,f as u,l as d,o as f,s as p,u as m}from"./envUtils-DcaKZlRU.js";import{n as ee,t as h}from"./defineProperty-C-QyHrDq.js";import{n as g,t as te}from"./axios-DaWTGg7G.js";import{$T as ne,$s as re,$u as ie,$x as ae,Af as oe,Ax as se,Ba as ce,Bi as _,Bx as v,C as le,CT as ue,Cc as de,Ch as fe,Co as pe,Cr as me,Ct as he,Cu as ge,Cx as _e,DS as ve,DT as ye,Du as be,Dx as xe,ES as Se,E_ as Ce,Eh as we,Ei as Te,Et as Ee,Ex as y,F as De,Fi as Oe,Gb as ke,Gv as Ae,Gx as je,Hx as Me,In as Ne,Is as Pe,Ix as Fe,Ji as Ie,Jv as Le,Jx as b,Kb as Re,Kg as ze,Li as Be,Ln as Ve,M as He,MT as Ue,Mh as We,Mn as Ge,Mp as Ke,Mw as qe,NT as Je,Nc as Ye,O as Xe,OT as Ze,Od as Qe,Ou as $e,Ox as et,Pc as tt,Pd as nt,Ph as rt,Pw as x,QT as it,Qd as S,RT as at,Rs as ot,Rx as st,S_ as ct,Sa as lt,So as ut,Sx as dt,T as ft,T_ as pt,Ta as mt,Ti as ht,To as gt,Tt as _t,Tw as vt,Ul as yt,Un as bt,Ux as xt,Vx as St,Wl as Ct,Wx as wt,XC as Tt,Xd as C,Xu as Et,Xx as Dt,YC as Ot,Yx as kt,Zd as At,Zu as jt,Zx as Mt,_T as Nt,_c as Pt,_h as Ft,_u as It,_v as Lt,_x as Rt,ab as zt,af as w,ag as Bt,at as Vt,av as Ht,bT as Ut,bc as Wt,bl as T,bu as E,bx as D,cf as O,cs as k,cu as Gt,df as Kt,do as qt,dp as Jt,dr as Yt,dx as Xt,eS as Zt,ec as Qt,ed as $t,ef as en,el as tn,f as nn,ff as rn,gf as an,gi as on,gu as sn,gv as cn,gx as ln,hT as un,hi as dn,hl as fn,hr as pn,hu as mn,hx as hn,i as gn,iE as _n,iS as vn,if as A,im as yn,it as bn,iv as xn,jf as Sn,ji as Cn,jp as wn,kf as Tn,kt as En,kw as Dn,kx as On,lb as j,lf as kn,lx as An,mT as jn,ml as Mn,mp as Nn,mu as Pn,mx as Fn,nE as In,nf as Ln,o as Rn,oE as zn,oS as Bn,oc as Vn,og as Hn,os as Un,ov as Wn,pT as Gn,pf as Kn,po as qn,px as Jn,qb as Yn,qg as Xn,qi as Zn,r as Qn,rE as $n,rb as er,rc as tr,rf as nr,rm as rr,s as ir,sE as ar,sb as or,sf as sr,si as cr,so as lr,su as ur,tE as dr,tc as fr,tf as pr,tl as mr,uf as hr,uu as gr,v as _r,vT as vr,vc as yr,vf as br,vh as xr,vu as Sr,vx as Cr,w as wr,w_ as Tr,wh as Er,wo as Dr,wu as Or,wx as kr,xl as Ar,xu as jr,xx as Mr,y as Nr,yT as Pr,yu as Fr,yx as Ir,zT as Lr,zb as Rr}from"./loadAgentsDir-BXtV2jiO.js";import{B as zr,D as Br,I as Vr,Lt as Hr,P as Ur,R as Wr,T as Gr,di as Kr,fi as qr,rr as Jr,t as Yr,ui as M,xr as Xr,y as Zr}from"./src-P_wYS_NJ2.js";import{t as Qr}from"./jsx-runtime-Bb4Xn-E0.js";import{A as N,M as $r,O as ei,j as ti,l as ni,p as ri,u as ii,w as ai}from"./external-CEp-aPkt.js";import{n as oi,r as si,t as ci}from"./lazySchema-B4D4qJVE.js";import{$n as li,Bn as ui,Cn as di,F as fi,J as pi,Jn as mi,Kn as hi,Mn as gi,Nn as _i,Pn as vi,Qn as yi,Sn as bi,Wt as xi,Yn as Si,Zn as Ci,_r as wi,bn as Ti,dn as Ei,dt as Di,er as Oi,et as ki,fn as Ai,ft as ji,gn as Mi,gr as Ni,in as Pi,ln as Fi,nr as Ii,on as Li,or as Ri,pt as zi,xn as Bi,z as Vi}from"./state-BPFYBqm1.js";import{n as Hi,t as Ui}from"./cwd-Besi3Os3.js";import{B as Wi,C as P,F as Gi,M as Ki,O as qi,P as F,R as Ji,S as Yi,T as Xi,U as Zi,c as I,f as Qi,g as $i,i as ea,l as ta,nt as na,tt as ra,u as ia,x as aa}from"./debug-Dr1SjdXn.js";import{Bt as oa,J as sa,Ln as ca,Mt as la,O as ua,Q as da,Rn as fa,S as pa,T as ma,c as ha,dn as ga,f as _a,g as L,h as va,i as ya,k as ba,ln as xa,n as Sa,u as Ca,x as R}from"./settings-DiBMs2gM.js";import{M as wa,P as Ta,T as Ea,_ as Da,c as z,g as Oa,h as B,k as ka,n as Aa,o as ja,p as Ma,r as Na,s as Pa,v as Fa,w as Ia,y as V}from"./config-9rLTDOYW.js";import{a as La,n as Ra,r as za}from"./process-gEbdy6uY.js";import{O as Ba,f as Va,i as Ha,k as H,l as Ua,m as Wa,u as Ga}from"./git-CoQQ6YEf.js";import{c as Ka,o as qa}from"./execFileNoThrow-mXq4K0rl.js";import{d as Ja,f as Ya,o as Xa,s as U}from"./log-27kCA_9u.js";import{n as Za,t as Qa}from"./which-mplwBbc0.js";import{i as $a,o as eo}from"./platform-Dg1c9F_1.js";import{i as to,o as no}from"./windowsPaths-C7Mdo9aU.js";import{s as ro,u as io}from"./types-BJ7qTz75.js";import{n as W,r as G}from"./analytics-DJobLaWP.js";import{i as ao,n as oo,r as K}from"./startupProfiler-Dc5r6LgE.js";import{l as so,s as co,u as lo}from"./oauth-D38aRTUb.js";import{n as uo,t as fo}from"./bundledMode--fG1S62b.js";import{l as po,o as mo}from"./stringUtils-Df-Lnjxd.js";import{$t as ho,Bt as go,C as _o,Dn as vo,Fr as yo,Ft as bo,Gr as xo,Jn as So,Kn as Co,Ot as wo,Rr as To,S as Eo,Sr as Do,Vn as Oo,Xt as ko,Yn as Ao,Z as jo,_ as Mo,ai as No,an as Po,ar as Fo,b as Io,bn as Lo,en as Ro,et as zo,g as Bo,in as Vo,ir as Ho,jn as Uo,lt as Wo,nr as Go,o as Ko,pn as qo,qr as Jo,rr as Yo,rt as Xo,si as Zo,ut as Qo,v as $o,xn as es,xr as ts,xt as ns,yn as rs,zt as is}from"./model-CDnVaVDR.js";import{Dt as as,Mt as os,Nt as ss,Yt as cs,at as ls,jt as us,ot as ds,qt as fs,st as ps}from"./prompt-CRc2QEZ5.js";import{f as ms,h as hs,l as gs,n as _s}from"./proxy-BEKNaTXI.js";import{n as vs,t as ys}from"./userAgent-B7WkjI6I.js";import{A as bs,_ as xs,k as Ss,x as Cs}from"./sessionState-DSWN4tMV.js";import{n as ws,t as Ts}from"./partition-CzW_31Y1.js";import{a as Es,n as Ds}from"./ripgrep-DQ_ILUJV.js";import{c as Os}from"./switcher-sYTxnJQA.js";import{dt as ks,ft as As}from"./esm-BkOWaWVb.js";import{C as js,D as Ms,O as Ns,S as Ps}from"./sessionTracing-DpHGGIZm.js";import{i as Fs,n as Is,o as Ls,r as Rs}from"./detectRepository-CMEkS5_2.js";import{c as zs,o as Bs,r as Vs}from"./api-DAubp5q9.js";import{d as Hs,f as Us,l as Ws,p as Gs,u as Ks}from"./firstPartyEventLogger-aFhcruXA.js";import{n as qs,t as Js}from"./worktreeModeEnabled-BFOYTTTr.js";import{a as Ys}from"./grove-BnzBbGsX.js";import{a as Xs,i as Zs,n as Qs,o as $s,r as ec}from"./remoteManagedSettings-26nhzuca.js";import{n as tc,t as nc}from"./allErrors-CS77lRvU.js";import{n as rc,t as q}from"./exit-BOhGfSlm.js";import{n as ic,s as ac,t as oc}from"./pluginOperations-BFbty6WT.js";import"./pluginCliCommands-WLOEhb2M.js";import{n as sc,r as cc,t as lc}from"./managedEnv-B-BNY0xC.js";import{n as uc}from"./onChangeAppState-WbvtqDtk.js";import{i as dc,t as fc}from"./skillChangeDetector-D-iq09Xs.js";import{n as pc}from"./stats-BkadEKa-.js";import{t as mc}from"./renderOptions-45A-EdsK.js";import{i as hc,n as gc,t as _c}from"./githubRepoPathMapping-CmpEaQoo.js";import{i as vc,n as yc}from"./earlyInput-IghoCjG5.js";import{t as bc}from"./banner-BcAM7iSx.js";import{c as xc,n as Sc,o as Cc,r as wc}from"./RemoteSessionManager-B4jqKVd3.js";import{posix as Tc,resolve as Ec,win32 as Dc}from"path";import{appendFileSync as Oc,readFileSync as kc}from"fs";var Ac=a((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),jc=a((e=>{var{InvalidArgumentError:t}=Ac(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Mc=a((e=>{var{humanReadableArgName:t}=jc(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
4
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),Nc=a((e=>{var{InvalidArgumentError:t}=Ac(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -7,17 +7,17 @@ import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DaDcL9Zw.js"
7
7
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
8
8
  - too many short flags`):i.test(t)?Error(`${n}
9
9
  - too many long flags`):Error(`${n}
10
- - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),Pc=a((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),Fc=a((e=>{var n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=jc(),{CommanderError:l}=Ac(),{Help:u,stripColor:d}=Mc(),{Option:f,DualOptions:p}=Nc(),{suggestSimilar:m}=Pc(),h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i=i||{};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
10
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),Pc=a((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),Fc=a((e=>{var n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=jc(),{CommanderError:l}=Ac(),{Help:u,stripColor:d}=Mc(),{Option:f,DualOptions:p}=Nc(),{suggestSimilar:m}=Pc(),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:()=>g()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>g()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i=i||{};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
11
11
  - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new s(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
12
12
  Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new l(e,t,n)),o.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new f(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
13
13
  - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0||e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??(t=e.negate?!1:e.isBoolean()||e.optional?!0:``),this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{let n=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,n,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{let n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,n,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof f)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t=t||{},e===void 0&&t.from===void 0){o.versions?.electron&&(t.from=`electron`);let e=o.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=o.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:o.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
14
14
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(a.existsSync(e))return;let r=`'${e}' does not exist
15
15
  - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e=e??1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
17
+ - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=h(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e=e??1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
18
18
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||`-V, --version`,n=n||`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e=e||{};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
19
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_})),Ic=a((e=>{var{Argument:t}=jc(),{Command:n}=Fc(),{CommanderError:r,InvalidArgumentError:i}=Ac(),{Help:a}=Mc(),{Option:o}=Nc();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),Lc=a(((e,t)=>{var n=Ic();e=t.exports={},e.program=new n.Command,e.Argument=n.Argument,e.Command=n.Command,e.CommanderError=n.CommanderError,e.Help=n.Help,e.InvalidArgumentError=n.InvalidArgumentError,e.InvalidOptionArgumentError=n.InvalidArgumentError,e.Option=n.Option,e.createCommand=e=>new n.Command(e),e.createOption=(e,t)=>new n.Option(e,t),e.createArgument=(e,t)=>new n.Argument(e,t)}));s(),f(),h(),Mi(),bi(),ra(),Ji(),aa(),Qi(),Ra(),ea(),W(),oo(),ua(),Lo();var{program:Rc,createCommand:zc,createArgument:Bc,createOption:Vc,CommanderError:Hc,InvalidArgumentError:Uc,InvalidOptionArgumentError:Wc,Command:Gc,Argument:Kc,Option:J,Help:qc}=r(Lc(),1).default;ee();var Jc=r(Kr(),1);Gr();var Y=Zr();Jr(),oi(),Vi(),Ba(),Ka(),Xa(),Qa(),Wa(),eo(),to(),fa(),ro(),xa(),si(),fo(),da(),mo(),ma(),L(),wa(),Zo(),Ia(),B(),hs(),gs(),Jo(),yo(),ts(),Ho(),vs(),Go(),So(),Co(),Uo(),go(),Mo(),cs(),te(),Vn(),Es(),ae(),Dt(),x(),Cr(),en(),ie(),Te(),xr(),bs(),rr(),lt(),us(),ds(),Or(),O(),it(),Nn(),lr(),Us(),or(),Js(),sr(),hr(),yr(),fe(),Ut(),se(),Un(),ce(),_e(),pe(),ke(),mn(),lo(),Ja();var Yc=!1;function Xc(){if(Yc||(Yc=!0,Ya())||d(process.env.CLAUDE_CODE_USE_BEDROCK)||d(process.env.CLAUDE_CODE_USE_VERTEX)||d(process.env.CLAUDE_CODE_USE_FOUNDRY)||process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.CLAUDE_CODE_CLIENT_CERT||process.env.CLAUDE_CODE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||so().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}function Zc(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=Qc();e&&(process.env.NODE_EXTRA_CA_CERTS=e,I(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function Qc(){try{let e=z()?.env,t=ha(`userSettings`)?.env;I(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&I(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){I(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}B(),ea(),Fs(),As(),f(),cc(),Ps(),Ns(),Ks();var $c=!1,el=o(async()=>{let e=Date.now();H(`info`,`init_started`),K(`init_function_start`);try{let t=Date.now();Na(),Rr({loadTheme:()=>z().theme,saveTheme:e=>V(t=>({...t,theme:e}))}),H(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),K(`init_configs_enabled`);let n=Date.now();sc();try{let{restoreActiveProvider:e}=await import(`./switcher-Ck9CrXrr.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)I(`[init] ${e}`)}catch(e){I(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}Zc(),H(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),K(`init_safe_env_vars_applied`),Xn(),K(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-BNBnLYPK.js`).then(e=>{e.initialize1PEventLogging()}),K(`init_after_1p_event_logging`),import(`./poller-CpLBoB-N.js`).then(e=>e.startBalancePolling()),K(`init_after_balance_polling`),To(),K(`init_after_oauth_populate`),ks(),K(`init_after_jetbrains_detection`),Is(),ec()&&Qs(),Rn()&&Ht(),K(`init_after_remote_settings_check`),Da();let r=Date.now();I(`[init] configureGlobalMTLS starting`),ms(),H(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),I(`[init] configureGlobalMTLS complete`);let i=Date.now();if(I(`[init] configureGlobalAgents starting`),_s(),H(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),I(`[init] configureGlobalAgents complete`),K(`init_network_configured`),await Ws(),Xc(),d(process.env.CLAUDE_CODE_REMOTE))try{let{initUpstreamProxy:e,getUpstreamProxyEnv:t}=await import(`./upstreamproxy-CXmjxHpl.js`),{registerUpstreamProxyEnvFn:n}=await import(`./subprocessEnv-CZkA9Cdp.js`);n(t),await e()}catch(e){I(`[init] upstreamproxy init failed: ${e instanceof Error?e.message:String(e)}; continuing without proxy`,{level:`warn`})}if(no(),na(St),Le()){let e=Date.now();await C(),H(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-2M1GkXqJ.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{I(`[init] ripgrep status check skipped`)}H(`info`,`init_completed`,{duration_ms:Date.now()-e}),K(`init_function_end`)}catch(e){if(e instanceof qi){if(Bi()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),Xt(1);return}return import(`./InvalidConfigDialog-bih293Xt.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function tl(){ec()?(Bi()&&js()&&nl().catch(e=>{I(`[3P telemetry] Eager telemetry init failed (beta tracing): ${F(e)}`,{level:`error`})}),I(`[3P telemetry] Waiting for remote managed settings before telemetry init`),$s().then(async()=>{I(`[3P telemetry] Remote managed settings loaded, initializing telemetry`),lc(),await nl()}).catch(e=>{I(`[3P telemetry] Telemetry init failed (remote settings path): ${F(e)}`,{level:`error`})})):nl().catch(e=>{I(`[3P telemetry] Telemetry init failed: ${F(e)}`,{level:`error`})})}async function nl(){if(!$c){if(!d(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)){$c=!0,I(`[3P telemetry] Skipped — CLAUDE_CODE_ENABLE_TELEMETRY not set`);return}$c=!0;try{await rl()}catch(e){throw $c=!1,e}}}async function rl(){let{initializeTelemetry:e}=await import(`./instrumentation-DMs3b82f.js`),t=await e();t&&(_i(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Ms(),...t};r?.add(e,n)}}}),Ai()?.add(1))}Fe();async function il(e,t,n,r){let{App:i}=await import(`./App-BuKmqFPm.js`),{REPL:a}=await import(`./REPL-DMaKNhTa.js`);await r(e,(0,Y.jsx)(i,{...t,children:(0,Y.jsx)(a,{...n})}))}Os(),lo(),B(),ea(),Ja();var al=ai(()=>ii({client_data:$r(P(),Qr()).nullish(),additional_model_options:ni(ii({model:P(),name:P(),description:P()}).transform(({model:e,name:t,description:n})=>({value:e,label:t,description:n}))).nullish()}));async function ol(){if(Ya())return I(`[Bootstrap] Skipped: Nonessential traffic disabled`),null;if(No()!==`firstParty`)return I(`[Bootstrap] Skipped: 3P provider`),null;let e=ns();if(!(wo()?.accessToken&&is())&&!e)return I(`[Bootstrap] Skipped: no usable OAuth or API key`),null;let t=`${so().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await Yo(async()=>{let n=wo()?.accessToken,r;if(n&&is())r={Authorization:`Bearer ${n}`,"anthropic-beta":co};else if(e)r={"x-api-key":e};else return I(`[Bootstrap] No auth available on retry, aborting`),null;I(`[Bootstrap] Fetching`);let i=await _.get(t,{headers:{"Content-Type":`application/json`,"User-Agent":ys(),...r},timeout:5e3}),a=al().safeParse(i.data);return a.success?(I(`[Bootstrap] Fetch ok`),a.data):(I(`[Bootstrap] Response failed validation: ${a.error.message}`),null)})}catch(e){throw I(`[Bootstrap] Fetch failed: ${_.isAxiosError(e)?e.response?.status??e.code:`unknown`}`),e}}async function sl(){try{let e=await ol();if(!e)return;let t=e.client_data??null,n=e.additional_model_options??[],r=z();if(Fo(r.clientDataCache,t)&&Fo(r.additionalModelOptionsCache,n)){I(`[Bootstrap] Cache unchanged, skipping write`);return}I(`[Bootstrap] Cache updated, persisting to disk`),V(e=>({...e,clientDataCache:t,additionalModelOptionsCache:n}))}catch(e){U(e)}}zo(),De(),he(),ea(),f();var cl=new Map;function ll(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;$a()===`windows`&&(e=e.split(Dc.sep).join(Tc.sep),t=t.split(Dc.sep).join(Tc.sep));let n=[e,t],r=[`/build-ant/`,`/build-external/`,`/build-external-native/`,`/build-ant-native/`];return n.some(e=>r.some(t=>e.includes(t)))}var ul=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function dl(e){let t=`${e.name}: ${e.message}`;return ul.some(e=>e.test(t))}var fl=null;function pl(){let e=process.listeners(`warning`);fl&&e.includes(fl)||(ll()||process.removeAllListeners(`warning`),fl=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=cl.get(t)||0;(cl.has(t)||cl.size<1e3)&&cl.set(t,n+1);let r=dl(e);G(`tengu_node_warning`,{is_internal:+!!r,occurrence_count:n+1,classname:e.name}),d(process.env.CLAUDE_DEBUG)&&I(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,fl))}st(),Ln(),Yn(),re(),_n(),Jr();function ml(){return(0,Y.jsxs)(Hr,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Y.jsx)(Vr,{url:`https://code.claude.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}W(),L(),Jr();function hl({serverName:e,onDone:t}){function n(n){switch(G(`tengu_mcp_dialog_choice`,{choice:n}),n){case`yes`:case`yes_all`:{let r=(_a()||{}).enabledMcpjsonServers||[];r.includes(e)||R(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&R(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(_a()||{}).disabledMcpjsonServers||[];n.includes(e)||R(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Y.jsxs)(Xr,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Y.jsx)(ml,{}),(0,Y.jsx)(Yt,{options:[{label:`Use this and all future MCP servers in this project`,value:`yes_all`},{label:`Use this MCP server`,value:`yes`},{label:`Continue without using this MCP server`,value:`no`}],onChange:e=>n(e),onCancel:()=>n(`no`)})]})}Ts(),W(),Jr(),L(),we();function gl({serverNames:e,onDone:t}){function n(n){let r=_a()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=ws(e,e=>n.includes(e));G(`tengu_mcp_multidialog_choice`,{approved:o.length,rejected:s.length}),o.length>0&&R(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&R(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,Jc.useCallback)(()=>{let n=(_a()||{}).disabledMcpjsonServers||[];R(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Xr,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,Y.jsx)(ml,{}),(0,Y.jsx)(kn,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Y.jsx)(Br,{paddingX:1,children:(0,Y.jsx)(Hr,{dimColor:!0,italic:!0,children:(0,Y.jsxs)(Wr,{children:[(0,Y.jsx)(zr,{shortcut:`Space`,action:`select`}),(0,Y.jsx)(zr,{shortcut:`Enter`,action:`confirm`}),(0,Y.jsx)(tt,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}Tr();async function _l(e){let{servers:t}=cr(`project`),n=Object.keys(t).filter(e=>Ot(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,Y.jsx)(Lt,{children:(0,Y.jsx)(y,{children:(0,Y.jsx)(hl,{serverName:t,onDone:r})})}))}else e.render((0,Y.jsx)(Lt,{children:(0,Y.jsx)(y,{children:(0,Y.jsx)(gl,{serverNames:n,onDone:r})})}))})}la(),Cn(),Ue(),Et(),Dn(),Jn(),ar(),ue(),B(),ea();var vl={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function yl(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=vl[e.toLowerCase()];t&&z().deepLinkTerminal!==t&&(V(e=>({...e,deepLinkTerminal:t})),I(`Stored deep link terminal preference: ${t}`))}var bl=class{constructor(){g(this,`frameDurations`,[]),g(this,`firstRenderTime`,void 0),g(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};W(),or(),bi(),Jr(),_n(),Tr(),B(),f(),cc(),tc(),L();function xl(){V(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.11`}))}function Sl(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function X(e,t,n){return Cl(e,t,{color:`error`,beforeExit:n})}async function Cl(e,t,n){let{Text:r}=await import(`./src-r6ZFgWPx2.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Y.jsx)(r,{color:i,children:t}):(0,Y.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function Z(e,t,n){return Sl(e,e=>(0,Y.jsx)(Ur,{initialState:z().theme,onThemeSave:e=>V(t=>({...t,theme:e})),children:(0,Y.jsx)(Lt,{onChangeAppState:n?.onChangeAppState,children:(0,Y.jsx)(y,{children:t(e)})})}))}async function wl(e,t){e.render(t),Yu(),await e.waitUntilExit(),await v(0)}async function Tl(e,t,n,r){if(d(!1)||process.env.IS_DEMO)return!1;let i=z(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-BzuQjney.js`);await Z(e,e=>(0,Y.jsx)(t,{onDone:()=>{xl(),e()}}),{onChangeAppState:uc})}if(!d(process.env.CLAUBBIT)){if(!Aa()){let{TrustDialog:t}=await import(`./TrustDialog-ACaJ_m7A.js`);await Z(e,e=>(0,Y.jsx)(t,{commands:r,onDone:e}))}ci(!0),Pr();let{errors:t}=nc();if(t.length===0&&await _l(e),await vr()){let t=mr(await Ft(!0)),{ClaudeMdExternalIncludesDialog:n}=await import(`./ClaudeMdExternalIncludesDialog-D-w166RC.js`);await Z(e,e=>(0,Y.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(hc(),yl(),lc(),setImmediate(()=>tl()),await Ys()){let{GroveDialog:t}=await import(`./Grove-BDoVj02t.js`);if(await Z(e,e=>(0,Y.jsx)(t,{showIfAlreadyViewed:!1,location:a?`onboarding`:`policy_update_modal`,onDone:e}))===`escape`)return G(`tengu_grove_policy_exited`,{}),Xt(0),!1}if(process.env.ANTHROPIC_API_KEY&&!l()){let t=Do(process.env.ANTHROPIC_API_KEY);if(Pa(t)===`new`){let{ApproveApiKey:n}=await import(`./ApproveApiKey-CIWOi_7v.js`);await Z(e,e=>(0,Y.jsx)(n,{customApiKeyTruncated:t,onDone:e}),{onChangeAppState:uc})}}if((t===`bypassPermissions`||n)&&!va()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-B05t83wa.js`);await Z(e,e=>(0,Y.jsx)(t,{onAccept:e}))}return a}function El(e){let t=0,n=mc(e);n.stdin&&G(`tengu_stdin_interactive`,{});let r=new bl,i=pc();Di(i);let a=process.env.CLAUDE_CODE_FRAME_TIMING_LOG;return{getFpsMetrics:()=>r.getMetrics(),stats:i,renderOptions:{...n,onFrame:e=>{if(r.record(e.durationMs),i.observe(`frame_duration_ms`,e.durationMs),a&&e.phases){let t=JSON.stringify({total:e.durationMs,...e.phases,rss:process.memoryUsage.rss(),cpu:process.cpuUsage()})+`
20
- `;Oc(a,t)}if(!qr())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&G(`tengu_flicker`,{desiredHeight:n.desiredHeight,actualHeight:n.availableHeight,reason:n.reason}),t=e}}}}}_n();async function Dl(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-Br8kQOHz.js`);return Z(e,e=>(0,Y.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function Ol(e){let{TeleportResumeWrapper:t}=await import(`./TeleportResumeWrapper-wPiIs8xg.js`);return Z(e,e=>(0,Y.jsx)(t,{onComplete:e,onCancel:()=>e(null),source:`cliArg`}))}async function kl(e,t){let{TeleportRepoMismatchDialog:n}=await import(`./TeleportRepoMismatchDialog-BZL8Zblz.js`);return Z(e,e=>(0,Y.jsx)(n,{targetRepo:t.targetRepo,initialPaths:t.initialPaths,onSelectPath:e,onCancel:()=>e(null)}))}async function Al(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-Ctw5Q1g9.js`),import(`./App-BuKmqFPm.js`)]);await wl(e,(0,Y.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Y.jsx)(y,{children:(0,Y.jsx)(a,{...r,worktreePaths:i})})}))}ss();var jl=5,Ml=30,Nl="After you finish implementing the change:\n1. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like `npm test`, `bun test`, `pytest`, `go test`). If tests fail, fix them.\n2. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.\n3. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with `gh pr create`. Use a descriptive title. If `gh` is not available or the push fails, note it in your final message.\n4. **Report** — End with a single line: `PR: <url>` so the coordinator can track it. If no PR was created, end with `PR: none — <reason>`.";function Pl(e){return`# Batch: Parallel Work Orchestration
19
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){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=g})),Ic=a((e=>{var{Argument:t}=jc(),{Command:n}=Fc(),{CommanderError:r,InvalidArgumentError:i}=Ac(),{Help:a}=Mc(),{Option:o}=Nc();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),Lc=a(((e,t)=>{var n=Ic();e=t.exports={},e.program=new n.Command,e.Argument=n.Argument,e.Command=n.Command,e.CommanderError=n.CommanderError,e.Help=n.Help,e.InvalidArgumentError=n.InvalidArgumentError,e.InvalidOptionArgumentError=n.InvalidArgumentError,e.Option=n.Option,e.createCommand=e=>new n.Command(e),e.createOption=(e,t)=>new n.Option(e,t),e.createArgument=(e,t)=>new n.Argument(e,t)}));s(),f(),ee(),Ni(),xi(),ra(),Ji(),aa(),Qi(),Ra(),ea(),W(),oo(),ua(),Lo();var{program:Rc,createCommand:zc,createArgument:Bc,createOption:Vc,CommanderError:Hc,InvalidArgumentError:Uc,InvalidOptionArgumentError:Wc,Command:Gc,Argument:Kc,Option:J,Help:qc}=r(Lc(),1).default;te();var Jc=r(qr(),1);Kr();var Y=Qr();Yr(),si(),Hi(),Ba(),Ka(),Xa(),Qa(),Wa(),eo(),to(),fa(),ro(),xa(),ci(),fo(),da(),mo(),ma(),L(),wa(),Zo(),Ia(),B(),hs(),gs(),Jo(),yo(),ts(),Ho(),vs(),Go(),So(),Co(),Uo(),go(),Mo(),cs(),at(),Ue(),Es(),un(),x(),ve(),Bn(),Mt(),st(),D(),An(),bs(),Re(),or(),us(),ds(),Wn(),Xn(),fe(),rr(),sr(),Us(),S(),Js(),mr(),yr(),Dr(),pe(),qt(),ce(),Zn(),_(),Te(),me(),Ne(),bn(),lo(),Ja();var Yc=!1;function Xc(){if(Yc||(Yc=!0,Ya())||d(process.env.CLAUDE_CODE_USE_BEDROCK)||d(process.env.CLAUDE_CODE_USE_VERTEX)||d(process.env.CLAUDE_CODE_USE_FOUNDRY)||process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.CLAUDE_CODE_CLIENT_CERT||process.env.CLAUDE_CODE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||so().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}function Zc(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=Qc();e&&(process.env.NODE_EXTRA_CA_CERTS=e,I(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function Qc(){try{let e=z()?.env,t=ha(`userSettings`)?.env;I(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&I(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){I(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}B(),ea(),Fs(),As(),f(),cc(),Ps(),Ns(),Ks();var $c=!1,el=o(async()=>{let e=Date.now();H(`info`,`init_started`),K(`init_function_start`);try{let t=Date.now();Na(),zr({loadTheme:()=>z().theme,saveTheme:e=>V(t=>({...t,theme:e}))}),H(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),K(`init_configs_enabled`);let n=Date.now();sc();try{let{restoreActiveProvider:e}=await import(`./switcher-Dm646gO5.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)I(`[init] ${e}`)}catch(e){I(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}Zc(),H(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),K(`init_safe_env_vars_applied`),en(),K(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-B8RVGBQB.js`).then(e=>{e.initialize1PEventLogging()}),K(`init_after_1p_event_logging`),import(`./poller-CpLBoB-N.js`).then(e=>e.startBalancePolling()),K(`init_after_balance_polling`),To(),K(`init_after_oauth_populate`),ks(),K(`init_after_jetbrains_detection`),Is(),ec()&&Qs(),hr()&&O(),K(`init_after_remote_settings_check`),Da();let r=Date.now();I(`[init] configureGlobalMTLS starting`),ms(),H(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),I(`[init] configureGlobalMTLS complete`);let i=Date.now();if(I(`[init] configureGlobalAgents starting`),_s(),H(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),I(`[init] configureGlobalAgents complete`),K(`init_network_configured`),await Ws(),Xc(),d(process.env.CLAUDE_CODE_REMOTE))try{let{initUpstreamProxy:e,getUpstreamProxyEnv:t}=await import(`./upstreamproxy-BuBFDFAD.js`),{registerUpstreamProxyEnvFn:n}=await import(`./subprocessEnv-DtBCqQIo.js`);n(t),await e()}catch(e){I(`[init] upstreamproxy init failed: ${e instanceof Error?e.message:String(e)}; continuing without proxy`,{level:`warn`})}if(no(),na(we),Ve()){let e=Date.now();await Ge(),H(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-BLQnqPnE.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{I(`[init] ripgrep status check skipped`)}H(`info`,`init_completed`,{duration_ms:Date.now()-e}),K(`init_function_end`)}catch(e){if(e instanceof qi){if(Vi()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),At(1);return}return import(`./InvalidConfigDialog-DQaT6aen.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function tl(){ec()?(Vi()&&js()&&nl().catch(e=>{I(`[3P telemetry] Eager telemetry init failed (beta tracing): ${F(e)}`,{level:`error`})}),I(`[3P telemetry] Waiting for remote managed settings before telemetry init`),$s().then(async()=>{I(`[3P telemetry] Remote managed settings loaded, initializing telemetry`),lc(),await nl()}).catch(e=>{I(`[3P telemetry] Telemetry init failed (remote settings path): ${F(e)}`,{level:`error`})})):nl().catch(e=>{I(`[3P telemetry] Telemetry init failed: ${F(e)}`,{level:`error`})})}async function nl(){if(!$c){if(!d(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)){$c=!0,I(`[3P telemetry] Skipped — CLAUDE_CODE_ENABLE_TELEMETRY not set`);return}$c=!0;try{await rl()}catch(e){throw $c=!1,e}}}async function rl(){let{initializeTelemetry:e}=await import(`./instrumentation-CjBlVlFq.js`),t=await e();t&&(vi(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Ms(),...t};r?.add(e,n)}}}),ji()?.add(1))}nt();async function il(e,t,n,r){let{App:i}=await import(`./App-DoAZ7CYS.js`),{REPL:a}=await import(`./REPL-eZsYNBfl.js`);await r(e,(0,Y.jsx)(i,{...t,children:(0,Y.jsx)(a,{...n})}))}Os(),lo(),B(),ea(),Ja();var al=oi(()=>ai({client_data:ei(N(),$r()).nullish(),additional_model_options:ri(ai({model:N(),name:N(),description:N()}).transform(({model:e,name:t,description:n})=>({value:e,label:t,description:n}))).nullish()}));async function ol(){if(Ya())return I(`[Bootstrap] Skipped: Nonessential traffic disabled`),null;if(No()!==`firstParty`)return I(`[Bootstrap] Skipped: 3P provider`),null;let e=ns();if(!(wo()?.accessToken&&is())&&!e)return I(`[Bootstrap] Skipped: no usable OAuth or API key`),null;let t=`${so().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await Yo(async()=>{let n=wo()?.accessToken,r;if(n&&is())r={Authorization:`Bearer ${n}`,"anthropic-beta":co};else if(e)r={"x-api-key":e};else return I(`[Bootstrap] No auth available on retry, aborting`),null;I(`[Bootstrap] Fetching`);let i=await g.get(t,{headers:{"Content-Type":`application/json`,"User-Agent":ys(),...r},timeout:5e3}),a=al().safeParse(i.data);return a.success?(I(`[Bootstrap] Fetch ok`),a.data):(I(`[Bootstrap] Response failed validation: ${a.error.message}`),null)})}catch(e){throw I(`[Bootstrap] Fetch failed: ${g.isAxiosError(e)?e.response?.status??e.code:`unknown`}`),e}}async function sl(){try{let e=await ol();if(!e)return;let t=e.client_data??null,n=e.additional_model_options??[],r=z();if(Fo(r.clientDataCache,t)&&Fo(r.additionalModelOptionsCache,n)){I(`[Bootstrap] Cache unchanged, skipping write`);return}I(`[Bootstrap] Cache updated, persisting to disk`),V(e=>({...e,clientDataCache:t,additionalModelOptionsCache:n}))}catch(e){U(e)}}zo(),ye(),E(),ea(),f();var cl=new Map;function ll(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;$a()===`windows`&&(e=e.split(Dc.sep).join(Tc.sep),t=t.split(Dc.sep).join(Tc.sep));let n=[e,t],r=[`/build-ant/`,`/build-external/`,`/build-external-native/`,`/build-ant-native/`];return n.some(e=>r.some(t=>e.includes(t)))}var ul=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function dl(e){let t=`${e.name}: ${e.message}`;return ul.some(e=>e.test(t))}var fl=null;function pl(){let e=process.listeners(`warning`);fl&&e.includes(fl)||(ll()||process.removeAllListeners(`warning`),fl=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=cl.get(t)||0;(cl.has(t)||cl.size<1e3)&&cl.set(t,n+1);let r=dl(e);G(`tengu_node_warning`,{is_internal:+!!r,occurrence_count:n+1,classname:e.name}),d(process.env.CLAUDE_DEBUG)&&I(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,fl))}ar(),it(),$t(),Et(),$e(),Yr();function ml(){return(0,Y.jsxs)(Ur,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Y.jsx)(Hr,{url:`https://code.workmate.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}W(),L(),Yr();function hl({serverName:e,onDone:t}){function n(n){switch(G(`tengu_mcp_dialog_choice`,{choice:n}),n){case`yes`:case`yes_all`:{let r=(_a()||{}).enabledMcpjsonServers||[];r.includes(e)||R(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&R(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(_a()||{}).disabledMcpjsonServers||[];n.includes(e)||R(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Y.jsxs)(Zr,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Y.jsx)(ml,{}),(0,Y.jsx)(jt,{options:[{label:`Use this and all future MCP servers in this project`,value:`yes_all`},{label:`Use this MCP server`,value:`yes`},{label:`Continue without using this MCP server`,value:`no`}],onChange:e=>n(e),onCancel:()=>n(`no`)})]})}Ts(),W(),Yr(),L(),Ke();function gl({serverNames:e,onDone:t}){function n(n){let r=_a()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=ws(e,e=>n.includes(e));G(`tengu_mcp_multidialog_choice`,{approved:o.length,rejected:s.length}),o.length>0&&R(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&R(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,Jc.useCallback)(()=>{let n=(_a()||{}).disabledMcpjsonServers||[];R(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Zr,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,Y.jsx)(ml,{}),(0,Y.jsx)(ie,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Y.jsx)(Vr,{paddingX:1,children:(0,Y.jsx)(Ur,{dimColor:!0,italic:!0,children:(0,Y.jsxs)(Gr,{children:[(0,Y.jsx)(Br,{shortcut:`Space`,action:`select`}),(0,Y.jsx)(Br,{shortcut:`Enter`,action:`confirm`}),(0,Y.jsx)(wn,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}Hn();async function _l(e){let{servers:t}=b(`project`),n=Object.keys(t).filter(e=>Fe(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,Y.jsx)(Bt,{children:(0,Y.jsx)(be,{children:(0,Y.jsx)(hl,{serverName:t,onDone:r})})}))}else e.render((0,Y.jsx)(Bt,{children:(0,Y.jsx)(be,{children:(0,Y.jsx)(gl,{serverNames:n,onDone:r})})}))})}la(),Le(),Lt(),rt(),Jt(),tr(),fr(),le(),B(),ea();var vl={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function yl(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=vl[e.toLowerCase()];t&&z().deepLinkTerminal!==t&&(V(e=>({...e,deepLinkTerminal:t})),I(`Stored deep link terminal preference: ${t}`))}var bl=class{constructor(){h(this,`frameDurations`,[]),h(this,`firstRenderTime`,void 0),h(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};W(),S(),xi(),Yr(),$e(),Hn(),B(),f(),cc(),tc(),L();function xl(){V(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.12`}))}function Sl(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function X(e,t,n){return Cl(e,t,{color:`error`,beforeExit:n})}async function Cl(e,t,n){let{Text:r}=await import(`./src-r6ZFgWPx2.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Y.jsx)(r,{color:i,children:t}):(0,Y.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function Z(e,t,n){return Sl(e,e=>(0,Y.jsx)(Wr,{initialState:z().theme,onThemeSave:e=>V(t=>({...t,theme:e})),children:(0,Y.jsx)(Bt,{onChangeAppState:n?.onChangeAppState,children:(0,Y.jsx)(be,{children:t(e)})})}))}async function wl(e,t){e.render(t),Yu(),await e.waitUntilExit(),await C(0)}async function Tl(e,t,n,r){if(d(!1)||process.env.IS_DEMO)return!1;let i=z(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-CymgipoF.js`);await Z(e,e=>(0,Y.jsx)(t,{onDone:()=>{xl(),e()}}),{onChangeAppState:uc})}if(!d(process.env.CLAUBBIT)){if(!Aa()){let{TrustDialog:t}=await import(`./TrustDialog-BVcny9vs.js`);await Z(e,e=>(0,Y.jsx)(t,{commands:r,onDone:e}))}li(!0),xn();let{errors:t}=nc();if(t.length===0&&await _l(e),await j()){let t=er(await zt(!0)),{AgentsMdExternalIncludesDialog:n}=await import(`./AgentsMdExternalIncludesDialog-_bI4jo_P.js`);await Z(e,e=>(0,Y.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(hc(),yl(),lc(),setImmediate(()=>tl()),await Ys()){let{GroveDialog:t}=await import(`./Grove-DRZrhbF0.js`);if(await Z(e,e=>(0,Y.jsx)(t,{showIfAlreadyViewed:!1,location:a?`onboarding`:`policy_update_modal`,onDone:e}))===`escape`)return G(`tengu_grove_policy_exited`,{}),At(0),!1}if(process.env.ANTHROPIC_API_KEY&&!l()){let t=Do(process.env.ANTHROPIC_API_KEY);if(Pa(t)===`new`){let{ApproveApiKey:n}=await import(`./ApproveApiKey-DQP3qmb0.js`);await Z(e,e=>(0,Y.jsx)(n,{customApiKeyTruncated:t,onDone:e}),{onChangeAppState:uc})}}if((t===`bypassPermissions`||n)&&!va()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-COI_V57z.js`);await Z(e,e=>(0,Y.jsx)(t,{onAccept:e}))}return a}function El(e){let t=0,n=mc(e);n.stdin&&G(`tengu_stdin_interactive`,{});let r=new bl,i=pc();Oi(i);let a=process.env.CLAUDE_CODE_FRAME_TIMING_LOG;return{getFpsMetrics:()=>r.getMetrics(),stats:i,renderOptions:{...n,onFrame:e=>{if(r.record(e.durationMs),i.observe(`frame_duration_ms`,e.durationMs),a&&e.phases){let t=JSON.stringify({total:e.durationMs,...e.phases,rss:process.memoryUsage.rss(),cpu:process.cpuUsage()})+`
20
+ `;Oc(a,t)}if(!Jr())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&G(`tengu_flicker`,{desiredHeight:n.desiredHeight,actualHeight:n.availableHeight,reason:n.reason}),t=e}}}}}$e();async function Dl(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-ISzcIGPU.js`);return Z(e,e=>(0,Y.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function Ol(e){let{TeleportResumeWrapper:t}=await import(`./TeleportResumeWrapper-2Yjr74Lq.js`);return Z(e,e=>(0,Y.jsx)(t,{onComplete:e,onCancel:()=>e(null),source:`cliArg`}))}async function kl(e,t){let{TeleportRepoMismatchDialog:n}=await import(`./TeleportRepoMismatchDialog-CG32I4cO.js`);return Z(e,e=>(0,Y.jsx)(n,{targetRepo:t.targetRepo,initialPaths:t.initialPaths,onSelectPath:e,onCancel:()=>e(null)}))}async function Al(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-B03XN_SP.js`),import(`./App-DoAZ7CYS.js`)]);await wl(e,(0,Y.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Y.jsx)(be,{children:(0,Y.jsx)(a,{...r,worktreePaths:i})})}))}ss();var jl=5,Ml=30,Nl="After you finish implementing the change:\n1. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like `npm test`, `bun test`, `pytest`, `go test`). If tests fail, fix them.\n2. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.\n3. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with `gh pr create`. Use a descriptive title. If `gh` is not available or the push fails, note it in your final message.\n4. **Report** — End with a single line: `PR: <url>` so the coordinator can track it. If no PR was created, end with `PR: none — <reason>`.";function Pl(e){return`# Batch: Parallel Work Orchestration
21
21
 
22
22
  You are orchestrating a large, parallelizable change across this codebase.
23
23
 
@@ -90,19 +90,19 @@ When all agents have reported, render the final table and a one-line summary (e.
90
90
  Examples:
91
91
  /batch migrate from react to vue
92
92
  /batch replace all uses of lodash with native equivalents
93
- /batch add type annotations to all untyped function parameters`;function Ll(){S({name:`batch`,description:`调研并规划一次大规模改动,然后并行投放到 5–30 个相互隔离的 worktree 智能体中执行,每个智能体各自开一个 PR。`,whenToUse:`当用户想对大量文件做横向的机械式改动(迁移、重构、批量改名),且这些改动可拆解为互不依赖的并行单元时使用。`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await Ua()?[{type:`text`,text:Pl(t)}]:[{type:`text`,text:Fl}]:[{type:`text`,text:Il}]}})}Ar(),si();var Rl=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],zl={Global:`Active everywhere, regardless of focus`,Chat:`When the chat input is focused`,Autocomplete:`When autocomplete menu is visible`,Confirmation:`When a confirmation/permission dialog is shown`,Help:`When the help overlay is open`,Transcript:`When viewing the transcript`,HistorySearch:`When searching command history (ctrl+r)`,Task:`When a task/agent is running in the foreground`,ThemePicker:`When the theme picker is open`,Settings:`When the settings menu is open`,Tabs:`When tab navigation is active`,Attachments:`When navigating image attachments in a select dialog`,Footer:`When footer indicators are focused`,MessageSelector:`When the message selector (rewind) is open`,DiffDialog:`When the diff dialog is open`,ModelPicker:`When the model picker is open`,Select:`When a select/list component is focused`,Plugin:`When the plugin dialog is open`},Bl=`app:interrupt.app:exit.app:toggleTodos.app:toggleTranscript.app:toggleTeammatePreview.app:toggleTerminal.app:redraw.app:globalSearch.app:quickOpen.history:search.history:previous.history:next.chat:cancel.chat:killAgents.chat:cycleMode.chat:modelPicker.chat:fastMode.chat:thinkingToggle.chat:submit.chat:newline.chat:undo.chat:externalEditor.chat:stash.chat:imagePaste.chat:messageActions.autocomplete:accept.autocomplete:dismiss.autocomplete:previous.autocomplete:next.confirm:yes.confirm:no.confirm:previous.confirm:next.confirm:nextField.confirm:previousField.confirm:cycleMode.confirm:toggle.confirm:toggleExplanation.tabs:next.tabs:previous.transcript:toggleShowAll.transcript:exit.historySearch:next.historySearch:accept.historySearch:cancel.historySearch:execute.task:background.theme:toggleSyntaxHighlighting.help:dismiss.attachments:next.attachments:previous.attachments:remove.attachments:exit.footer:up.footer:down.footer:next.footer:previous.footer:openSelected.footer:clearSelection.footer:close.messageSelector:up.messageSelector:down.messageSelector:top.messageSelector:bottom.messageSelector:select.diff:dismiss.diff:previousSource.diff:nextSource.diff:back.diff:viewDetails.diff:previousFile.diff:nextFile.modelPicker:toggle1M.select:next.select:previous.select:accept.select:cancel.plugin:toggle.plugin:install.permission:toggleDebug.settings:search.settings:retry.settings:close.select:previousValue.select:nextValue`.split(`.`),Vl=ai(()=>ii({context:ti(Rl).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:$r(P().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),ei([ti(Bl),P().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),ri().describe(`Set to null to unbind a default shortcut`)]).describe(`Action to trigger, command to invoke, or null to unbind`)).describe(`Map of keystroke patterns to actions`)}).describe(`A block of keybindings for a specific context`));ai(()=>ii({$schema:P().optional().describe(`JSON Schema URL for editor validation`),$docs:P().optional().describe(`Documentation URL`),bindings:ni(Vl()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),Un();function Hl(){return au([`Context`,`Description`],Rl.map(e=>[`\`${e}\``,zl[e]]))}function Ul(){let e={};for(let t of Sr)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return au([`Action`,`Default Key(s)`,`Context`],Bl.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:Wl(t);return[`\`${t}\``,r,i]}))}function Wl(e){return{app:`Global`,history:`Global or Chat`,chat:`Chat`,autocomplete:`Autocomplete`,confirm:`Confirmation`,tabs:`Tabs`,transcript:`Transcript`,historySearch:`HistorySearch`,task:`Task`,theme:`ThemePicker`,help:`Help`,attachments:`Attachments`,footer:`Footer`,messageSelector:`MessageSelector`,diff:`DiffDialog`,modelPicker:`ModelPicker`,select:`Select`,permission:`Confirmation`}[e.split(`:`)[0]??``]??`Unknown`}function Gl(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of kt)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of pr)e.push(`- \`${t.key}\` — ${t.reason} (${t.severity===`error`?`will not work`:`may conflict`})`);e.push(``),e.push(`### macOS reserved (errors)`);for(let t of nn)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
94
- `)}var Kl={$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.claude.com/docs/en/keybindings`,bindings:[{context:`Chat`,bindings:{"ctrl+e":`chat:externalEditor`}}]},ql={context:`Chat`,bindings:{"ctrl+s":null}},Jl={context:`Chat`,bindings:{"ctrl+g":null,"ctrl+e":`chat:externalEditor`}},Yl={context:`Global`,bindings:{"ctrl+k ctrl+t":`app:toggleTodos`}},Xl=[`# Keybindings Skill`,``,"Create or modify `~/.claude/keybindings.json` to customize keyboard shortcuts.",``,`## CRITICAL: Read Before Write`,``,"**Always read `~/.claude/keybindings.json` first** (it may not exist yet). Merge changes with existing bindings — never replace the entire file.",``,`- Use **Edit** tool for modifications to existing files`,`- Use **Write** tool only if the file does not exist yet`].join(`
95
- `),Zl=[`## File Format`,``,"```json",Wi(Kl,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
93
+ /batch add type annotations to all untyped function parameters`;function Ll(){Ie({name:`batch`,description:`调研并规划一次大规模改动,然后并行投放到 5–30 个相互隔离的 worktree 智能体中执行,每个智能体各自开一个 PR。`,whenToUse:`当用户想对大量文件做横向的机械式改动(迁移、重构、批量改名),且这些改动可拆解为互不依赖的并行单元时使用。`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await Ua()?[{type:`text`,text:Pl(t)}]:[{type:`text`,text:Fl}]:[{type:`text`,text:Il}]}})}_n(),ci();var Rl=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],zl={Global:`Active everywhere, regardless of focus`,Chat:`When the chat input is focused`,Autocomplete:`When autocomplete menu is visible`,Confirmation:`When a confirmation/permission dialog is shown`,Help:`When the help overlay is open`,Transcript:`When viewing the transcript`,HistorySearch:`When searching command history (ctrl+r)`,Task:`When a task/agent is running in the foreground`,ThemePicker:`When the theme picker is open`,Settings:`When the settings menu is open`,Tabs:`When tab navigation is active`,Attachments:`When navigating image attachments in a select dialog`,Footer:`When footer indicators are focused`,MessageSelector:`When the message selector (rewind) is open`,DiffDialog:`When the diff dialog is open`,ModelPicker:`When the model picker is open`,Select:`When a select/list component is focused`,Plugin:`When the plugin dialog is open`},Bl=`app:interrupt.app:exit.app:toggleTodos.app:toggleTranscript.app:toggleTeammatePreview.app:toggleTerminal.app:redraw.app:globalSearch.app:quickOpen.history:search.history:previous.history:next.chat:cancel.chat:killAgents.chat:cycleMode.chat:modelPicker.chat:fastMode.chat:thinkingToggle.chat:submit.chat:newline.chat:undo.chat:externalEditor.chat:stash.chat:imagePaste.chat:messageActions.autocomplete:accept.autocomplete:dismiss.autocomplete:previous.autocomplete:next.confirm:yes.confirm:no.confirm:previous.confirm:next.confirm:nextField.confirm:previousField.confirm:cycleMode.confirm:toggle.confirm:toggleExplanation.tabs:next.tabs:previous.transcript:toggleShowAll.transcript:exit.historySearch:next.historySearch:accept.historySearch:cancel.historySearch:execute.task:background.theme:toggleSyntaxHighlighting.help:dismiss.attachments:next.attachments:previous.attachments:remove.attachments:exit.footer:up.footer:down.footer:next.footer:previous.footer:openSelected.footer:clearSelection.footer:close.messageSelector:up.messageSelector:down.messageSelector:top.messageSelector:bottom.messageSelector:select.diff:dismiss.diff:previousSource.diff:nextSource.diff:back.diff:viewDetails.diff:previousFile.diff:nextFile.modelPicker:toggle1M.select:next.select:previous.select:accept.select:cancel.plugin:toggle.plugin:install.permission:toggleDebug.settings:search.settings:retry.settings:close.select:previousValue.select:nextValue`.split(`.`),Vl=oi(()=>ai({context:ni(Rl).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:ei(N().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),ti([ni(Bl),N().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),ii().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`));oi(()=>ai({$schema:N().optional().describe(`JSON Schema URL for editor validation`),$docs:N().optional().describe(`Documentation URL`),bindings:ri(Vl()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),Zn();function Hl(){return au([`Context`,`Description`],Rl.map(e=>[`\`${e}\``,zl[e]]))}function Ul(){let e={};for(let t of zn)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return au([`Action`,`Default Key(s)`,`Context`],Bl.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:Wl(t);return[`\`${t}\``,r,i]}))}function Wl(e){return{app:`Global`,history:`Global or Chat`,chat:`Chat`,autocomplete:`Autocomplete`,confirm:`Confirmation`,tabs:`Tabs`,transcript:`Transcript`,historySearch:`HistorySearch`,task:`Task`,theme:`ThemePicker`,help:`Help`,attachments:`Attachments`,footer:`Footer`,messageSelector:`MessageSelector`,diff:`DiffDialog`,modelPicker:`ModelPicker`,select:`Select`,permission:`Confirmation`}[e.split(`:`)[0]??``]??`Unknown`}function Gl(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of In)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of $n)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 dr)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
94
+ `)}var Kl={$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`}}]},ql={context:`Chat`,bindings:{"ctrl+s":null}},Jl={context:`Chat`,bindings:{"ctrl+g":null,"ctrl+e":`chat:externalEditor`}},Yl={context:`Global`,bindings:{"ctrl+k ctrl+t":`app:toggleTodos`}},Xl=[`# Keybindings Skill`,``,"Create or modify `~/.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(`
95
+ `),Zl=[`## File Format`,``,"```json",P(Kl,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
96
96
  `),Ql=[`## Keystroke Syntax`,``,"**Modifiers** (combine with `+`):","- `ctrl` (alias: `control`)","- `alt` (aliases: `opt`, `option`) — note: `alt` and `meta` are identical in terminals","- `shift`","- `meta` (aliases: `cmd`, `command`)",``,"**Special keys**: `escape`/`esc`, `enter`/`return`, `tab`, `space`, `backspace`, `delete`, `up`, `down`, `left`, `right`",``,"**Chords**: Space-separated keystrokes, e.g. `ctrl+k ctrl+s` (1-second timeout between keystrokes)",``,"**Examples**: `ctrl+shift+p`, `alt+enter`, `ctrl+k ctrl+n`"].join(`
97
- `),$l=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",Wi(ql,null,2),"```"].join(`
97
+ `),$l=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",P(ql,null,2),"```"].join(`
98
98
  `),eu=[`## How User Bindings Interact with Defaults`,``,`- User bindings are **additive** — they are appended after the default bindings`,"- To **move** a binding to a different key: unbind the old key (`null`) AND add the new binding",`- A context only needs to appear in the user's file if they want to change something in that context`].join(`
99
- `),tu=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",Wi(Jl,null,2),"```",``,`### Add a chord binding`,"```json",Wi(Yl,null,2),"```"].join(`
99
+ `),tu=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",P(Jl,null,2),"```",``,`### Add a chord binding`,"```json",P(Yl,null,2),"```"].join(`
100
100
  `),nu=[`## Behavioral Rules`,``,`1. Only include contexts the user wants to change (minimal overrides)`,`2. Validate that actions and contexts are from the known lists below`,"3. Warn the user proactively if they choose a key that conflicts with reserved shortcuts or common tools like tmux (`ctrl+b`) and screen (`ctrl+a`)",`4. When adding a new binding for an existing action, the new binding is additive (existing default still works unless explicitly unbound)`,`5. To fully replace a default binding, unbind the old key AND add the new one`].join(`
101
- `),ru=[`## Validation with /doctor`,``,'The `/doctor` command includes a "Keybinding Configuration Issues" section that validates `~/.claude/keybindings.json`.',``,`### Common Issues and Fixes`,``,au([`Issue`,`Cause`,`Fix`],[['`keybindings.json must have a "bindings" array`',`Missing wrapper object`,'Wrap bindings in `{ "bindings": [...] }`'],['`"bindings" must be an array`',"`bindings` is not an array",'Set `"bindings"` to an array: `[{ context: ..., bindings: ... }]`'],['`Unknown context "X"`',`Typo or invalid context name`,`Use exact context names from the Available Contexts table`],['`Duplicate key "X" in Y bindings`',`Same key defined twice in one context`,`Remove the duplicate; JSON uses only the last value`],['`"X" may not work: ...`',`Key conflicts with terminal/OS reserved shortcut`,`Choose a different key (see Reserved Shortcuts section)`],['`Could not parse keystroke "X"`',`Invalid key syntax`,"Check syntax: use `+` between modifiers, valid key names"],['`Invalid action for "X"`',`Action value is not a string or null`,'Actions must be strings like `"app:help"` or `null` to unbind']]),``,`### Example /doctor Output`,``,"```",`Keybinding Configuration Issues`,`Location: ~/.claude/keybindings.json`,` └ [Error] Unknown context "chat"`,` → Valid contexts: Global, Chat, Autocomplete, ...`,` └ [Warning] "ctrl+c" may not work: Terminal interrupt (SIGINT)`,"```",``,`**Errors** prevent bindings from working and must be fixed. **Warnings** indicate potential conflicts but the binding may still work.`].join(`
102
- `);function iu(){S({name:`keybindings-help`,description:`当用户想自定义键盘快捷键、重新绑定按键、添加组合键(chord),或修改 ~/.claude/keybindings.json 时使用。例如:"rebind ctrl+s"、"add a chord shortcut"、"change the submit key"、"customize keybindings"。`,allowedTools:[`Read`],userInvocable:!1,isEnabled:j,async getPromptForCommand(e){let t=Hl(),n=Ul(),r=[Xl,Zl,Ql,$l,eu,tu,nu,ru,`## Reserved Shortcuts\n\n${Gl()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
101
+ `),ru=[`## Validation with /doctor`,``,'The `/doctor` command includes a "Keybinding Configuration Issues" section that validates `~/.workmate/keybindings.json`.',``,`### Common Issues and Fixes`,``,au([`Issue`,`Cause`,`Fix`],[['`keybindings.json must have a "bindings" array`',`Missing wrapper object`,'Wrap bindings in `{ "bindings": [...] }`'],['`"bindings" must be an array`',"`bindings` is not an array",'Set `"bindings"` to an array: `[{ context: ..., bindings: ... }]`'],['`Unknown context "X"`',`Typo or invalid context name`,`Use exact context names from the Available Contexts table`],['`Duplicate key "X" in Y bindings`',`Same key defined twice in one context`,`Remove the duplicate; JSON uses only the last value`],['`"X" may not work: ...`',`Key conflicts with terminal/OS reserved shortcut`,`Choose a different key (see Reserved Shortcuts section)`],['`Could not parse keystroke "X"`',`Invalid key syntax`,"Check syntax: use `+` between modifiers, valid key names"],['`Invalid action for "X"`',`Action value is not a string or null`,'Actions must be strings like `"app:help"` or `null` to unbind']]),``,`### Example /doctor Output`,``,"```",`Keybinding Configuration Issues`,`Location: ~/.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(`
102
+ `);function iu(){Ie({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:ne,async getPromptForCommand(e){let t=Hl(),n=Ul(),r=[Xl,Zl,Ql,$l,eu,tu,nu,ru,`## Reserved Shortcuts\n\n${Gl()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
103
103
 
104
104
  `)}]}})}function au(e,t){let n=e.map(()=>`---`);return[`| ${e.join(` | `)} |`,`| ${n.join(` | `)} |`,...t.map(e=>`| ${e.join(` | `)} |`)].join(`
105
- `)}Un();var ou=`# /ultracode — Workflow Orchestration Playbook
105
+ `)}Zn();var ou=`# /ultracode — Workflow Orchestration Playbook
106
106
 
107
107
  Execute a workflow script that orchestrates multiple subagents deterministically. Workflows run in the background — this tool returns immediately with a task ID, and a \`<task-notification>\` arrives when the workflow completes.
108
108
 
@@ -306,11 +306,11 @@ Use this tool for multi-step orchestration where control flow should be determin
306
306
  ## Resume
307
307
 
308
308
  The tool result includes a runId. To resume after a pause, kill, or script edit, relaunch with \`Workflow({scriptPath, resumeFromRunId})\` — the longest unchanged prefix of agent() calls returns cached results instantly; the first edited/new call and everything after it runs live. Same script + same args → 100% cache hit. Date.now()/Math.random()/new Date() are unavailable in scripts (they would break this) — stamp results after the workflow returns, or pass timestamps via args. Fallback when no journal is available: Read agent-<id>.jsonl files in the transcript directory and hand-author a continuation script.
309
- `;function su(){S({name:`ultracode`,description:`进入多智能体 workflow 编排模式:何时使用 Workflow 工具、脚本原语、质量模式、确定性约束、resume/预算、以及文件和命令。`,whenToUse:`当任务可拆解或可并行、需要多视角置信度(如先查找再对抗式验证)、超出单一上下文容量(大迁移、广审计、长尾枚举)或需要可恢复/可审计时——用 Workflow 工具编排多个子智能体。`,userInvocable:!0,async getPromptForCommand(e){let t=ou;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}Un();function cu(){S({name:`loop`,description:`在固定时间间隔循环运行某条 prompt 或 slash command(例如 /loop 5m /foo,默认 10m)`,whenToUse:`当用户想设置一个周期性任务、轮询状态,或按固定间隔重复运行某个内容时使用(例如"每 5 分钟检查一次部署状态"、"持续运行 /babysit-prs")。一次性任务不要用本命令。`,argumentHint:`[interval] <prompt>`,userInvocable:!1,isEnabled:()=>!1,async getPromptForCommand(){return[{type:`text`,text:`The /loop command is no longer available.`}]}})}$e(),Mr(),bi(),Un();var lu=`# Dream: Memory Consolidation (manual run)
309
+ `;function su(){Ie({name:`ultracode`,description:`进入多智能体 workflow 编排模式:何时使用 Workflow 工具、脚本原语、质量模式、确定性约束、resume/预算、以及文件和命令。`,whenToUse:`当任务可拆解或可并行、需要多视角置信度(如先查找再对抗式验证)、超出单一上下文容量(大迁移、广审计、长尾枚举)或需要可恢复/可审计时——用 Workflow 工具编排多个子智能体。`,userInvocable:!0,async getPromptForCommand(e){let t=ou;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}Zn();function cu(){Ie({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.`}]}})}tt(),an(),xi(),Zn();var lu=`# Dream: Memory Consolidation (manual run)
310
310
 
311
311
  You are performing a manual dream — a reflective pass over your memory files. Unlike the automatic background dream, this run has full tool permissions and the user is watching. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
312
312
 
313
- `;function uu(){S({name:`dream`,description:`手动触发记忆整合——回顾、整理并修剪自动记忆文件。`,whenToUse:`当用户输入 /dream 或想手动整合记忆、整理记忆文件、清理过期条目时使用。`,userInvocable:!0,isEnabled:()=>Ta(),async getPromptForCommand(e){let t=ka(),n=Wt(Oi());await wr();let r=lu+Ke(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}var du=i({registerScheduleRemoteAgentsSkill:()=>yu});function fu(e){if(!e.startsWith(`mcpsrv_`))return null;let t=e.slice(7).slice(2),n=0n;for(let e of t){let t=bu.indexOf(e);if(t===-1)return null;n=n*58n+BigInt(t)}let r=n.toString(16).padStart(32,`0`);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function pu(e){let t=[];for(let n of e){if(n.type!==`connected`||n.config.type!==`claudeai-proxy`)continue;let e=fu(n.config.id);e&&t.push({uuid:e,name:n.name,url:n.config.url})}return t}function mu(e){return e.replace(/^claude[.\s-]ai[.\s-]/i,``).replace(/[^a-zA-Z0-9_-]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function hu(e){if(e.length===0)return`No connected MCP connectors found. The user may need to connect servers at https://claude.ai/settings/connectors`;let t=[`Connected connectors (available for triggers):`];for(let n of e){let e=mu(n.name);t.push(`- ${n.name} (connector_uuid: ${n.uuid}, name: ${e}, url: ${n.url})`)}return t.join(`
313
+ `;function uu(){Ie({name:`dream`,description:`手动触发记忆整合——回顾、整理并修剪自动记忆文件。`,whenToUse:`当用户输入 /dream 或想手动整合记忆、整理记忆文件、清理过期条目时使用。`,userInvocable:!0,isEnabled:()=>Ta(),async getPromptForCommand(e){let t=ka(),n=Yt(ki());await br();let r=lu+Ye(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}var du=i({registerScheduleRemoteAgentsSkill:()=>yu});function fu(e){if(!e.startsWith(`mcpsrv_`))return null;let t=e.slice(7).slice(2),n=0n;for(let e of t){let t=bu.indexOf(e);if(t===-1)return null;n=n*58n+BigInt(t)}let r=n.toString(16).padStart(32,`0`);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function pu(e){let t=[];for(let n of e){if(n.type!==`connected`||n.config.type!==`claudeai-proxy`)continue;let e=fu(n.config.id);e&&t.push({uuid:e,name:n.name,url:n.config.url})}return t}function mu(e){return e.replace(/^claude[.\s-]ai[.\s-]/i,``).replace(/[^a-zA-Z0-9_-]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function hu(e){if(e.length===0)return`No connected MCP connectors found. The user may need to connect servers at https://claude.ai/settings/connectors`;let t=[`Connected connectors (available for triggers):`];for(let n of e){let e=mu(n.name);t.push(`- ${n.name} (connector_uuid: ${n.uuid}, name: ${e}, url: ${n.url})`)}return t.join(`
314
314
  `)}function gu(e){return`⚠ Heads-up:\n${e.map(e=>`- ${e}`).join(`
315
315
  `)}`}async function _u(){let e=await Ga();if(!e)return null;let t=Ls(e);return t?`https://${t.host}/${t.owner}/${t.name}`:null}function vu(e){let{userTimezone:t,connectorsInfo:n,gitRepoUrl:r,environmentsInfo:i,createdEnvironment:a,setupNotes:o,needsGitHubAccessReminder:s,userArgs:c}=e,l=c&&o.length>0?`\n## Setup Notes\n\n${gu(o)}\n`:``,u=o.length>0?`${gu(o)}\n\n${xu}`:xu;return`# Schedule Remote Agents
316
316
 
@@ -320,14 +320,14 @@ You are helping the user schedule, update, list, or run **remote** Work Mate age
320
320
 
321
321
  ${c?`The user has already told you what they want (see User Request at the bottom). Skip the initial question and go directly to the matching workflow.`:`Your FIRST action must be a single ${as} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it:
322
322
 
323
- ${Wi(u)}
323
+ ${P(u)}
324
324
 
325
325
  Set \`header: "Action"\` and offer the four actions (create/list/update/run) as options. After the user picks, follow the matching workflow below.`}
326
326
  ${l}
327
327
 
328
328
  ## What You Can Do
329
329
 
330
- Use the \`${E}\` tool (load it first with \`SearchExtraTools select:${E}\`; auth is handled in-process — do not use curl):
330
+ Use the \`${T}\` tool (load it first with \`SearchExtraTools select:${T}\`; auth is handled in-process — do not use curl):
331
331
 
332
332
  - \`{action: "list"}\` — list all triggers
333
333
  - \`{action: "get", trigger_id: "..."}\` — fetch one trigger
@@ -434,7 +434,7 @@ Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
434
434
  4. **Choose the model** — Default to \`claude-sonnet-4-6\`. Tell the user which model you're defaulting to and ask if they want a different one.
435
435
  5. **Validate connections** — Infer what services the agent will need from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack MCP connectors. Cross-reference with the connectors list above. If any are missing, warn the user and link them to https://claude.ai/settings/connectors to connect first.${r?` The default git repo is already set to \`${r}\`. Ask the user if this is the right repo or if they need a different one.`:` Ask which git repos the remote agent needs cloned into its environment.`}
436
436
  6. **Review and confirm** — Show the full configuration before creating. Let them adjust.
437
- 7. **Create it** \u2014 Call \`${E}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
437
+ 7. **Create it** \u2014 Call \`${T}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
438
438
 
439
439
  ### UPDATE a trigger:
440
440
 
@@ -463,8 +463,8 @@ Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
463
463
  - The prompt is the most important part — spend time getting it right. The remote agent starts with zero context, so the prompt must be self-contained.
464
464
  - To delete a trigger, direct users to https://claude.ai/code/scheduled
465
465
  ${s?`- If the user's request seems to require GitHub repo access (e.g. cloning a repo, opening PRs, reading code), remind them that they need the Claude GitHub App installed on the repo — otherwise the remote agent won't be able to access it.`:``}
466
- ${c?`\n## User Request\n\nThe user said: "${c}"\n\nStart by understanding their intent and working through the appropriate workflow above.`:``}`}function yu(){S({name:`schedule`,description:`创建、更新、列出或运行按 cron 定时调度的远程智能体(trigger)。`,whenToUse:`当用户想安排一个周期性远程智能体、配置自动化任务、为 Work Mate 创建 cron 任务,或管理其定时智能体/trigger 时使用。`,userInvocable:!0,isEnabled:()=>!1,allowedTools:[E,as],async getPromptForCommand(e,t){if(!wo()?.accessToken)return[{type:`text`,text:`You need to authenticate with a claude.ai account first. API accounts are not supported.`}];let n;try{n=await $n()}catch(e){return I(`[schedule] Failed to fetch environments: ${e}`,{level:`warn`}),[{type:`text`,text:`We're having trouble connecting with your remote claude.ai account to set up a scheduled task. Please try /schedule again in a few minutes.`}]}let r=null;if(n.length===0)try{r=await Mn(`claude-code-default`),n=[r]}catch(e){return I(`[schedule] Failed to create environment: ${e}`,{level:`warn`}),[{type:`text`,text:`No remote environments found, and we could not create one automatically. Visit https://claude.ai/code to set one up, then run /schedule again.`}]}let i=[],a=!1,o=await Rs();if(o===null)i.push(`Not in a git repo — you'll need to specify a repo URL manually (or skip repos entirely).`);else if(o.host===`github.com`){let{hasAccess:e}=await pn(o.owner,o.name);if(!e){a=!0;let e=`Claude GitHub App not installed on ${o.owner}/${o.name} \u2014 install at https://claude.ai/code/onboarding?magic=github-app-setup if your trigger needs this repo.`;i.push(e)}}let s=pu(t.options.mcpClients);s.length===0&&i.push(`No MCP connectors — connect at https://claude.ai/settings/connectors if needed.`);let c=Intl.DateTimeFormat().resolvedOptions().timeZone,l=hu(s),u=await _u(),d=[`Available environments:`];for(let e of n)d.push(`- ${e.name} (id: ${e.environment_id}, kind: ${e.kind})`);return[{type:`text`,text:vu({userTimezone:c,connectorsInfo:l,gitRepoUrl:u,environmentsInfo:d.join(`
467
- `),createdEnvironment:r,setupNotes:i,needsGitHubAccessReminder:a,userArgs:e})}]}})}var bu,xu,Su=n((()=>{lr(),us(),Er(),go(),T(),ea(),Fs(),Wa(),aa(),k(),Un(),bu=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,xu=`What would you like to do with scheduled remote agents?`}));function Cu(){iu(),Ll(),su(),cu(),uu();{let{registerScheduleRemoteAgentsSkill:t}=(Su(),e(du));t()}}Fr(),ye(),M();async function wu(){if(!await Za(`gh`))return`not_installed`;let{exitCode:e}=await qa(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}Je(),Ve(),A(),W(),wt();async function Tu(e,t){let n=await Ie(e),r=le(t);for(let e of n)e.type===`prompt`&&G(`tengu_skill_loaded`,{_PROTO_skill_name:e.name,skill_source:e.source,skill_loaded_from:e.loadedFrom,skill_budget:r,...e.kind&&{skill_kind:e.kind}})}Dr(),W(),en(),ie(),f(),aa();function Eu(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
466
+ ${c?`\n## User Request\n\nThe user said: "${c}"\n\nStart by understanding their intent and working through the appropriate workflow above.`:``}`}function yu(){Ie({name:`schedule`,description:`创建、更新、列出或运行按 cron 定时调度的远程智能体(trigger)。`,whenToUse:`当用户想安排一个周期性远程智能体、配置自动化任务、为 Work Mate 创建 cron 任务,或管理其定时智能体/trigger 时使用。`,userInvocable:!0,isEnabled:()=>!1,allowedTools:[T,as],async getPromptForCommand(e,t){if(!wo()?.accessToken)return[{type:`text`,text:`You need to authenticate with a claude.ai account first. API accounts are not supported.`}];let n;try{n=await A()}catch(e){return I(`[schedule] Failed to fetch environments: ${e}`,{level:`warn`}),[{type:`text`,text:`We're having trouble connecting with your remote claude.ai account to set up a scheduled task. Please try /schedule again in a few minutes.`}]}let r=null;if(n.length===0)try{r=await nr(`claude-code-default`),n=[r]}catch(e){return I(`[schedule] Failed to create environment: ${e}`,{level:`warn`}),[{type:`text`,text:`No remote environments found, and we could not create one automatically. Visit https://claude.ai/code to set one up, then run /schedule again.`}]}let i=[],a=!1,o=await Rs();if(o===null)i.push(`Not in a git repo — you'll need to specify a repo URL manually (or skip repos entirely).`);else if(o.host===`github.com`){let{hasAccess:e}=await pr(o.owner,o.name);if(!e){a=!0;let e=`Claude GitHub App not installed on ${o.owner}/${o.name} \u2014 install at https://claude.ai/code/onboarding?magic=github-app-setup if your trigger needs this repo.`;i.push(e)}}let s=pu(t.options.mcpClients);s.length===0&&i.push(`No MCP connectors — connect at https://claude.ai/settings/connectors if needed.`);let c=Intl.DateTimeFormat().resolvedOptions().timeZone,l=hu(s),u=await _u(),d=[`Available environments:`];for(let e of n)d.push(`- ${e.name} (id: ${e.environment_id}, kind: ${e.kind})`);return[{type:`text`,text:vu({userTimezone:c,connectorsInfo:l,gitRepoUrl:u,environmentsInfo:d.join(`
467
+ `),createdEnvironment:r,setupNotes:i,needsGitHubAccessReminder:a,userArgs:e})}]}})}var bu,xu,Su=n((()=>{sr(),us(),Ar(),go(),Ln(),ea(),Fs(),Wa(),aa(),w(),Zn(),bu=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,xu=`What would you like to do with scheduled remote agents?`}));function Cu(){iu(),Ll(),su(),cu(),uu();{let{registerScheduleRemoteAgentsSkill:t}=(Su(),e(du));t()}}Tr(),ge(),Rn();async function wu(){if(!await Za(`gh`))return`not_installed`;let{exitCode:e}=await qa(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}xr(),Tn(),k(),W(),Dn();async function Tu(e,t){let n=await Be(e),r=vt(t);for(let e of n)e.type===`prompt`&&G(`tengu_skill_loaded`,{_PROTO_skill_name:e.name,skill_source:e.source,skill_loaded_from:e.loadedFrom,skill_budget:r,...e.kind&&{skill_kind:e.kind}})}Sr(),W(),Mt(),st(),f(),aa();function Eu(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
468
468
 
469
469
  Examples:
470
470
  # Add HTTP server:
@@ -477,37 +477,37 @@ Examples:
477
477
  claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
478
478
 
479
479
  # Add stdio server with subprocess flags:
480
- claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).option(`--client-id <clientId>`,`OAuth client ID for HTTP/SSE servers`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).option(`--callback-port <port>`,`Fixed port for OAuth callback (for servers requiring pre-registered redirect URIs)`).helpOption(`-h, --help`,`Display help for command`).addOption(new J(`--xaa`,`Enable XAA (SEP-990) for this server. Requires 'claude mcp xaa setup' first. Also requires --client-id and --client-secret (for the MCP server's AS).`).hideHelp(!je())).action(async(e,t,n,r)=>{let i=t,a=n;e?i||q(`Error: Command is required when server name is provided.
480
+ claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).option(`--client-id <clientId>`,`OAuth client ID for HTTP/SSE servers`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).option(`--callback-port <port>`,`Fixed port for OAuth callback (for servers requiring pre-registered redirect URIs)`).helpOption(`-h, --help`,`Display help for command`).addOption(new J(`--xaa`,`Enable XAA (SEP-990) for this server. Requires 'claude mcp xaa setup' first. Also requires --client-id and --client-secret (for the MCP server's AS).`).hideHelp(!Mr())).action(async(e,t,n,r)=>{let i=t,a=n;e?i||q(`Error: Command is required when server name is provided.
481
481
  Usage: claude mcp add <name> <command> [args...]`):q(`Error: Server name is required.
482
- Usage: claude mcp add <name> <command> [args...]`);try{let t=Oe(r.scope),n=yt(r.transport);r.xaa&&!je()&&q(`Error: --xaa requires CLAUDE_CODE_ENABLE_XAA=1 in your environment`);let o=!!r.xaa;if(o){let e=[];r.clientId||e.push(`--client-id`),r.clientSecret||e.push(`--client-secret`),nt()||e.push(`'claude mcp xaa setup' (settings.xaaIdp not configured)`),e.length&&q(`Error: --xaa requires: ${e.join(`, `)}`)}let s=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(G(`tengu_mcp_add`,{type:n,scope:t,source:`command`,transport:n,transportExplicit:s,looksLikeUrl:c}),n===`sse`){i||q(`Error: URL is required for SSE transport.`);let n=r.header?ir(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await be():void 0,l={type:`sse`,url:i,headers:n,oauth:s};await On(e,l,t),c&&w(e,l,c),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Wi(n,null,2)}\n`)}else if(n===`http`){i||q(`Error: URL is required for HTTP transport.`);let n=r.header?ir(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await be():void 0,l={type:`http`,url:i,headers:n,oauth:s};await On(e,l,t),c&&w(e,l,c),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${Wi(n,null,2)}\n`)}else(r.clientId||r.clientSecret||r.callbackPort||r.xaa)&&process.stderr.write(`Warning: --client-id, --client-secret, --callback-port, and --xaa are only supported for HTTP/SSE transports and will be ignored for stdio.
483
- `),!s&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await On(e,{type:`stdio`,command:i,args:a,env:u(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);rc(`File modified: ${Ct(t)}`)}catch(e){q(e.message)}})}Te(),Ji(),L();function Du(e){let t=e.command(`xaa`).description(`Manage the XAA (SEP-990) IdP connection`);t.command(`setup`).description(`Configure the IdP connection (one-time setup for all XAA-enabled servers)`).requiredOption(`--issuer <url>`,`IdP issuer URL (OIDC discovery)`).requiredOption(`--client-id <id>`,`Work Mate's client_id at the IdP`).option(`--client-secret`,`Read IdP client secret from MCP_XAA_IDP_CLIENT_SECRET env var`).option(`--callback-port <port>`,`Fixed loopback callback port (only if IdP does not honor RFC 8252 port-any matching)`).action(e=>{let t;try{t=new URL(e.issuer)}catch{return q(`Error: --issuer must be a valid URL (got "${e.issuer}")`)}if(t.protocol!==`https:`&&!(t.protocol===`http:`&&(t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`)))return q(`Error: --issuer must use https:// (got "${t.protocol}//${t.host}")`);let n=e.callbackPort?parseInt(e.callbackPort,10):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<=0))return q(`Error: --callback-port must be a positive integer`);let r=e.clientSecret?process.env.MCP_XAA_IDP_CLIENT_SECRET:void 0;if(e.clientSecret&&!r)return q(`Error: --client-secret requires MCP_XAA_IDP_CLIENT_SECRET env var`);let i=nt(),a=i?.issuer,o=i?.clientId,{error:s}=R(`userSettings`,{xaaIdp:{issuer:e.issuer,clientId:e.clientId,callbackPort:n}});if(s)return q(`Error writing settings: ${s.message}`);if(a&&(Re(a)===Re(e.issuer)?o!==e.clientId&&(yn(a),b(a)):(yn(a),b(a))),r){let{success:t,warning:n}=ot(e.issuer,r);if(!t)return q(`Error: settings written but keychain save failed${n?` — ${n}`:``}. Re-run with --client-secret once keychain is available.`)}rc(`XAA IdP connection configured for ${e.issuer}`)}),t.command(`login`).description(`Cache an IdP id_token so XAA-enabled MCP servers authenticate silently. Default: run the OIDC browser login. With --id-token: write a pre-obtained JWT directly (used by conformance/e2e tests where the mock IdP does not serve /authorize).`).option(`--force`,`Ignore any cached id_token and re-login (useful after IdP-side revocation)`).option(`--id-token <jwt>`,`Write this pre-obtained id_token directly to cache, skipping the OIDC browser login`).action(async e=>{let t=nt();if(!t)return q(`Error: no XAA IdP connection. Run 'claude mcp xaa setup' first.`);if(e.idToken){let n=Lr(t.issuer,e.idToken);return rc(`id_token cached for ${t.issuer} (expires ${new Date(n).toISOString()})`)}if(e.force&&yn(t.issuer),We(t.issuer)!==void 0)return rc(`Already logged in to ${t.issuer} (cached id_token still valid). Use --force to re-login.`);process.stdout.write(`Opening browser for IdP login at ${t.issuer}…\n`);try{await Sn({idpIssuer:t.issuer,idpClientId:t.clientId,idpClientSecret:Ye(t.issuer),callbackPort:t.callbackPort,onAuthorizationUrl:e=>{process.stdout.write(`If the browser did not open, visit:\n ${e}\n`)}}),rc(`Logged in. MCP servers with --xaa will now authenticate silently.`)}catch(e){q(`IdP login failed: ${F(e)}`)}}),t.command(`show`).description(`Show the current IdP connection config`).action(()=>{let e=nt();if(!e)return rc(`No XAA IdP connection configured.`);let t=Ye(e.issuer)!==void 0,n=We(e.issuer)!==void 0;process.stdout.write(`Issuer: ${e.issuer}\n`),process.stdout.write(`Client ID: ${e.clientId}\n`),e.callbackPort!==void 0&&process.stdout.write(`Callback port: ${e.callbackPort}\n`),process.stdout.write(`Client secret: ${t?`(stored in keychain)`:`(not set — PKCE-only)`}\n`),process.stdout.write(`Logged in: ${n?`yes (id_token cached)`:`no — run 'claude mcp xaa login'`}\n`),rc()}),t.command(`clear`).description(`Clear the IdP connection config and cached id_token`).action(()=>{let e=nt(),{error:t}=R(`userSettings`,{xaaIdp:void 0});if(t)return q(`Error writing settings: ${t.message}`);e&&(yn(e.issuer),b(e.issuer)),rc(`XAA IdP connection cleared`)})}Pe();function Ou(e,t=process.argv){for(let n=0;n<t.length;n++){let r=t[n];if(r?.startsWith(`${e}=`))return r.slice(e.length+1);if(r===e&&n+1<t.length)return t[n+1]}}rt(),dr(),Ae(),W(),B(),Xa(),L();function ku(){if(z().bypassPermissionsModeAccepted)try{va()||R(`userSettings`,{skipDangerousModePermissionPrompt:!0}),G(`tengu_migrate_bypass_permissions_accepted`,{}),V(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){U(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}W(),B(),Xa(),L();function Au(){let e=ja(),t=e.enableAllProjectMcpServers!==void 0,n=e.enabledMcpjsonServers&&e.enabledMcpjsonServers.length>0,r=e.disabledMcpjsonServers&&e.disabledMcpjsonServers.length>0;if(!(!t&&!n&&!r))try{let i=ha(`localSettings`)||{},a={},o=[];if(t&&i.enableAllProjectMcpServers===void 0?(a.enableAllProjectMcpServers=e.enableAllProjectMcpServers,o.push(`enableAllProjectMcpServers`)):t&&o.push(`enableAllProjectMcpServers`),n&&e.enabledMcpjsonServers){let t=i.enabledMcpjsonServers||[];a.enabledMcpjsonServers=[...new Set([...t,...e.enabledMcpjsonServers])],o.push(`enabledMcpjsonServers`)}if(r&&e.disabledMcpjsonServers){let t=i.disabledMcpjsonServers||[];a.disabledMcpjsonServers=[...new Set([...t,...e.disabledMcpjsonServers])],o.push(`disabledMcpjsonServers`)}Object.keys(a).length>0&&R(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&Fa(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),G(`tengu_migrate_mcp_approval_fields_success`,{migratedCount:o.length})}catch(e){U(e),G(`tengu_migrate_mcp_approval_fields_error`,{})}}W(),B(),Zo(),L();function ju(){if(No()!==`firstParty`||!$o())return;let e=ha(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(R(`userSettings`,{model:`opus`}),V(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})),G(`tengu_legacy_opus_migration`,{from_model:e}))}W(),Mo();function Mu(){Io()&&G(`tengu_opus_to_opus1m_migration`,{skipped:!0})}B();function Nu(){V(e=>{let t=e.replBridgeEnabled;if(t===void 0||e.remoteControlAtStartup!==void 0)return e;let n={...e,remoteControlAtStartup:!!t};return delete n.replBridgeEnabled,n})}bi(),B(),L();function Pu(){z().sonnet1m45MigrationComplete||(ha(`userSettings`)?.model===`sonnet[1m]`&&R(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),fi()===`sonnet[1m]`&&hi(`sonnet-4-5-20250929[1m]`),V(e=>({...e,sonnet1m45MigrationComplete:!0})))}W(),go(),B(),Zo(),L();function Fu(){if(No()!==`firstParty`||!ho()&&!ko()&&!Ro())return;let e=ha(`userSettings`)?.model;if(e!==`claude-sonnet-4-5-20250929`&&e!==`claude-sonnet-4-5-20250929[1m]`&&e!==`sonnet-4-5-20250929`&&e!==`sonnet-4-5-20250929[1m]`)return;let t=e.endsWith(`[1m]`);R(`userSettings`,{model:t?`sonnet[1m]`:`sonnet`}),z().numStartups>1&&V(e=>({...e,sonnet45To46MigrationTimestamp:Date.now()})),G(`tengu_sonnet45_to_46_migration`,{from_model:e,has_1m:t})}W(),B(),Xa(),L();function Iu(){if(!z().hasResetAutoModeOptInForDefaultOffer&&fr()===`enabled`)try{let e=ha(`userSettings`);e?.skipAutoPermissionPrompt&&e?.permissions?.defaultMode!==`auto`&&(R(`userSettings`,{skipAutoPermissionPrompt:void 0}),G(`tengu_migrate_reset_auto_opt_in_for_default_offer`,{})),V(e=>e.hasResetAutoModeOptInForDefaultOffer?e:{...e,hasResetAutoModeOptInForDefaultOffer:!0})}catch(e){U(Error(`Failed to reset auto mode opt-in: ${e}`))}}W(),go(),B(),Zo(),L();function Lu(){if(!z().opusProMigrationComplete){if(No()!==`firstParty`||!ho()){V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!0});return}if(_a()?.model===void 0){let e=Date.now();V(t=>({...t,opusProMigrationComplete:!0,opusProMigrationTimestamp:e})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!1})}else V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!0})}}oi(),si();var Ru=ai(()=>ii({session_id:P(),ws_url:P(),work_dir:P().optional()}));Ji(),aa();var zu=class extends Error{constructor(e){super(e),this.name=`DirectConnectError`}};async function Bu({serverUrl:e,authToken:t,cwd:n,dangerouslySkipPermissions:r}){let i={"content-type":`application/json`};t&&(i.authorization=`Bearer ${t}`);let a;try{a=await fetch(`${e}/sessions`,{method:`POST`,headers:i,body:Wi({cwd:n,...r&&{dangerously_skip_permissions:!0}})})}catch(t){throw new zu(`Failed to connect to server at ${e}: ${F(t)}`)}if(!a.ok)throw new zu(`Failed to create session: ${a.status} ${a.statusText}`);let o=Ru().safeParse(await a.json());if(!o.success)throw new zu(`Invalid session response: ${o.error.message}`);let s=o.data;return{config:{serverUrl:e,sessionId:s.session_id,wsUrl:s.ws_url,authToken:t},workDir:s.work_dir}}oo(),lo(),Or(),lr(),go(),B(),cc(),eo(),aa(),W(),bi(),ce(),Jr(),ac(),f(),Wa(),Xa(),Mo(),ue(),pe(),L(),en(),ie(),Te(),ra(),ea(),Ji(),or(),it(),Ba(),Bs(),Gt(),Ks(),gt(),K(`main_tsx_entry`),ba(),es();var Vu=(Wn(),e(Ne));K(`main_tsx_imports_loaded`);function Hu(){try{let e=ha(`policySettings`);if(e){let t=ya(e);G(`tengu_managed_settings_loaded`,{keyCount:t.length,keys:t.join(`,`)})}}catch{}}function Uu(){let e=_o(di()??Ko());Tu(Hi(),Oo(e,Ei())),zn().then(({enabled:e,errors:t})=>{let n=ut();et(e,n,Gn()),qe(t,n)}).catch(e=>U(e))}function Wu(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.CLAUDE_CODE_CLIENT_CERT&&(e.has_client_cert=!0),c(`--use-system-ca`)&&(e.has_use_system_ca=!0),c(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function Gu(){if(Gs())return;let[e,t,n]=await Promise.all([Ua(),Va(),wu()]);G(`tengu_startup_telemetry`,{is_git:e,worktree_count:t,gh_auth_status:n,sandbox_enabled:Se.isSandboxingEnabled(),are_unsandboxed_commands_allowed:Se.areUnsandboxedCommandsAllowed(),is_auto_bash_allowed_if_sandbox_enabled:Se.isAutoAllowBashIfSandboxedEnabled(),auto_updater_disabled:Oa(),prefers_reduced_motion:Sa().prefersReducedMotion??!1,...Wu()})}var Ku=11;function qu(){z().migrationVersion!==Ku&&(ku(),Au(),Lu(),Pu(),ju(),Fu(),Mu(),Nu(),Iu(),V(e=>e.migrationVersion===Ku?e:{...e,migrationVersion:Ku}))}function Ju(){if(Bi()){H(`info`,`prefetch_system_context_non_interactive`),Pr();return}Aa()?(H(`info`,`prefetch_system_context_has_trust`),Pr()):H(`info`,`prefetch_system_context_skipped_no_trust`)}function Yu(){d(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)||p()||(Ws(),Rt(),Ju(),wc(),d(process.env.CLAUDE_CODE_USE_BEDROCK)&&!d(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&Vo(),d(process.env.CLAUDE_CODE_USE_VERTEX)&&!d(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&Po(),Ds(Hi(),AbortSignal.timeout(3e3),[]),Ao(),_t.initialize(),p()||fc.initialize())}function Xu(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)io(t)||(process.stderr.write(N.red(`Error: Invalid JSON provided to --settings
484
- `)),process.exit(1)),r=D(`claude-settings`,`.json`,{contentHash:t}),Xi(r,t,`utf8`);else{let{resolvedPath:t}=$i(ia(),e);try{kc(t,`utf8`)}catch(e){throw Ui(e)&&(process.stderr.write(N.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}ji(r),Ci()}catch(e){e instanceof Error&&U(e),process.stderr.write(N.red(`Error processing settings: ${F(e)}\n`)),process.exit(1)}}function Zu(e){try{Ii(ga(e)),Ci()}catch(e){e instanceof Error&&U(e),process.stderr.write(N.red(`Error processing --setting-sources: ${F(e)}\n`)),process.exit(1)}}function Qu(){K(`eagerLoadSettings_start`);let e=Ou(`--settings`);e&&Xu(e);let t=Ou(`--setting-sources`);t!==void 0&&Zu(t),K(`eagerLoadSettings_end`)}function $u(e){if(process.env.CLAUDE_CODE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.CLAUDE_CODE_ENTRYPOINT=`mcp`;return}if(d(process.env.CLAUDE_CODE_ACTION)){process.env.CLAUDE_CODE_ENTRYPOINT=`claude-code-github-action`;return}process.env.CLAUDE_CODE_ENTRYPOINT=e?`sdk-cli`:`cli`}var Q={url:void 0,authToken:void 0,dangerouslySkipPermissions:!1},$={host:void 0,cwd:void 0,permissionMode:void 0,dangerouslySkipPermissions:!1,local:!1,extraCliArgs:[],remoteBin:void 0};async function ed(){K(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,pl(),process.on(`exit`,()=>{ad();try{let{peekWorkflowService:t}=(En(),e(ln));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),K(`main_warning_handler_initialized`);{let e=process.argv.slice(2),t=e.findIndex(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(t!==-1&&Q){let n=e[t],{parseConnectUrl:r}=await import(`./parseConnectUrl-BiyKR5-x.js`),i=r(n);if(Q.dangerouslySkipPermissions=e.includes(`--dangerously-skip-permissions`),e.includes(`-p`)||e.includes(`--print`)){let r=e.filter((e,n)=>n!==t),i=r.indexOf(`--dangerously-skip-permissions`);i!==-1&&r.splice(i,1),process.argv=[process.argv[0],process.argv[1],`open`,n,...r]}else{Q.url=i.serverUrl,Q.authToken=i.authToken;let n=e.filter((e,n)=>n!==t),r=n.indexOf(`--dangerously-skip-permissions`);r!==-1&&n.splice(r,1),process.argv=[process.argv[0],process.argv[1],...n]}}}{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-kB2eazPX.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-BiVWrpHi.js`),i=await r(n);process.exit(i)}if(process.platform===`darwin`&&process.env.__CFBundleIdentifier===`com.anthropic.claude-code-url-handler`){let{enableConfigs:e}=await import(`./config-kB2eazPX.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-BiVWrpHi.js`),n=await t();process.exit(n??1)}}if($){let e=process.argv.slice(2);if(e[0]===`ssh`){let t=e.indexOf(`--local`);t!==-1&&($.local=!0,e.splice(t,1));let n=e.indexOf(`--dangerously-skip-permissions`);n!==-1&&($.dangerouslySkipPermissions=!0,e.splice(n,1));let r=e.indexOf(`--permission-mode`);r!==-1&&e[r+1]&&!e[r+1].startsWith(`-`)&&($.permissionMode=e[r+1],e.splice(r,2));let i=e.findIndex(e=>e.startsWith(`--permission-mode=`));i!==-1&&($.permissionMode=e[i].split(`=`)[1],e.splice(i,1));let a=(t,n={})=>{let r=e.indexOf(t);if(r!==-1){$.extraCliArgs.push(n.as??t);let i=e[r+1];n.hasValue&&i&&!i.startsWith(`-`)?($.extraCliArgs.push(i),e.splice(r,2)):e.splice(r,1)}let i=e.findIndex(e=>e.startsWith(`${t}=`));i!==-1&&($.extraCliArgs.push(n.as??t,e[i].slice(t.length+1)),e.splice(i,1))},o=e.indexOf(`--remote-bin`);o!==-1&&e[o+1]&&!e[o+1].startsWith(`-`)&&($.remoteBin=e[o+1],e.splice(o,2));let s=e.findIndex(e=>e.startsWith(`--remote-bin=`));s!==-1&&($.remoteBin=e[s].split(`=`).slice(1).join(`=`),e.splice(s,1)),a(`-c`,{as:`--continue`}),a(`--continue`),a(`--resume`,{hasValue:!0}),a(`--model`,{hasValue:!0})}if(e[0]===`ssh`&&e[1]&&!e[1].startsWith(`-`)){$.host=e[1];let t=2;e[2]&&!e[2].startsWith(`-`)&&($.cwd=e[2],t=3);let n=e.slice(t);if(n.includes(`-p`)||n.includes(`--print`)){process.stderr.write(`Error: headless (-p/--print) mode is not supported with claude ssh
485
- `),Xt(1);return}process.argv=[process.argv[0],process.argv[1],...n]}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=d(process.env.CLAUDE_CODE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&vc(),yi(!o),$u(o);let s=(()=>{if(d(process.env.GITHUB_ACTIONS))return`github-action`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-ts`)return`sdk-typescript`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-py`)return`sdk-python`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-cli`)return`sdk-cli`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-vscode`)return`claude-vscode`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`)return`local-agent`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`)return`claude-desktop`;let e=process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;return process.env.CLAUDE_CODE_ENTRYPOINT===`remote`||e?`remote`:`cli`})();Pi(s);let c=process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;c===`markdown`||c===`html`?mi(c):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&s!==`remote`&&mi(`markdown`),process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`&&vi(`remote-control`),K(`main_client_type_determined`),Qu(),K(`main_before_run`),await nd(),K(`main_after_run`)}async function td(e,t){if(!process.stdin.isTTY&&!process.argv.includes(`mcp`)){if(t===`stream-json`)return process.stdin;process.stdin.setEncoding(`utf8`);let n=``,r=e=>{n+=e};process.stdin.on(`data`,r);let i=await za(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
482
+ Usage: claude mcp add <name> <command> [args...]`);try{let t=xe(r.scope),n=et(r.transport);r.xaa&&!Mr()&&q(`Error: --xaa requires CLAUDE_CODE_ENABLE_XAA=1 in your environment`);let o=!!r.xaa;if(o){let e=[];r.clientId||e.push(`--client-id`),r.clientSecret||e.push(`--client-secret`),Ir()||e.push(`'claude mcp xaa setup' (settings.xaaIdp not configured)`),e.length&&q(`Error: --xaa requires: ${e.join(`, `)}`)}let s=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(G(`tengu_mcp_add`,{type:n,scope:t,source:`command`,transport:n,transportExplicit:s,looksLikeUrl:c}),n===`sse`){i||q(`Error: URL is required for SSE transport.`);let n=r.header?v(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await Xt():void 0,l={type:`sse`,url:i,headers:n,oauth:s};await St(e,l,t),c&&Jn(e,l,c),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${P(n,null,2)}\n`)}else if(n===`http`){i||q(`Error: URL is required for HTTP transport.`);let n=r.header?v(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await Xt():void 0,l={type:`http`,url:i,headers:n,oauth:s};await St(e,l,t),c&&Jn(e,l,c),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${P(n,null,2)}\n`)}else(r.clientId||r.clientSecret||r.callbackPort||r.xaa)&&process.stderr.write(`Warning: --client-id, --client-secret, --callback-port, and --xaa are only supported for HTTP/SSE transports and will be ignored for stdio.
483
+ `),!s&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await St(e,{type:`stdio`,command:i,args:a,env:u(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);rc(`File modified: ${y(t)}`)}catch(e){q(e.message)}})}D(),Ji(),L();function Du(e){let t=e.command(`xaa`).description(`Manage the XAA (SEP-990) IdP connection`);t.command(`setup`).description(`Configure the IdP connection (one-time setup for all XAA-enabled servers)`).requiredOption(`--issuer <url>`,`IdP issuer URL (OIDC discovery)`).requiredOption(`--client-id <id>`,`Work Mate's client_id at the IdP`).option(`--client-secret`,`Read IdP client secret from MCP_XAA_IDP_CLIENT_SECRET env var`).option(`--callback-port <port>`,`Fixed loopback callback port (only if IdP does not honor RFC 8252 port-any matching)`).action(e=>{let t;try{t=new URL(e.issuer)}catch{return q(`Error: --issuer must be a valid URL (got "${e.issuer}")`)}if(t.protocol!==`https:`&&!(t.protocol===`http:`&&(t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`)))return q(`Error: --issuer must use https:// (got "${t.protocol}//${t.host}")`);let n=e.callbackPort?parseInt(e.callbackPort,10):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<=0))return q(`Error: --callback-port must be a positive integer`);let r=e.clientSecret?process.env.MCP_XAA_IDP_CLIENT_SECRET:void 0;if(e.clientSecret&&!r)return q(`Error: --client-secret requires MCP_XAA_IDP_CLIENT_SECRET env var`);let i=Ir(),a=i?.issuer,o=i?.clientId,{error:s}=R(`userSettings`,{xaaIdp:{issuer:e.issuer,clientId:e.clientId,callbackPort:n}});if(s)return q(`Error writing settings: ${s.message}`);if(a&&(dt(a)===dt(e.issuer)?o!==e.clientId&&(ln(a),hn(a)):(ln(a),hn(a))),r){let{success:t,warning:n}=_e(e.issuer,r);if(!t)return q(`Error: settings written but keychain save failed${n?` — ${n}`:``}. Re-run with --client-secret once keychain is available.`)}rc(`XAA IdP connection configured for ${e.issuer}`)}),t.command(`login`).description(`Cache an IdP id_token so XAA-enabled MCP servers authenticate silently. Default: run the OIDC browser login. With --id-token: write a pre-obtained JWT directly (used by conformance/e2e tests where the mock IdP does not serve /authorize).`).option(`--force`,`Ignore any cached id_token and re-login (useful after IdP-side revocation)`).option(`--id-token <jwt>`,`Write this pre-obtained id_token directly to cache, skipping the OIDC browser login`).action(async e=>{let t=Ir();if(!t)return q(`Error: no XAA IdP connection. Run 'claude mcp xaa setup' first.`);if(e.idToken){let n=kr(t.issuer,e.idToken);return rc(`id_token cached for ${t.issuer} (expires ${new Date(n).toISOString()})`)}if(e.force&&ln(t.issuer),Rt(t.issuer)!==void 0)return rc(`Already logged in to ${t.issuer} (cached id_token still valid). Use --force to re-login.`);process.stdout.write(`Opening browser for IdP login at ${t.issuer}…\n`);try{await Fn({idpIssuer:t.issuer,idpClientId:t.clientId,idpClientSecret:Cr(t.issuer),callbackPort:t.callbackPort,onAuthorizationUrl:e=>{process.stdout.write(`If the browser did not open, visit:\n ${e}\n`)}}),rc(`Logged in. MCP servers with --xaa will now authenticate silently.`)}catch(e){q(`IdP login failed: ${F(e)}`)}}),t.command(`show`).description(`Show the current IdP connection config`).action(()=>{let e=Ir();if(!e)return rc(`No XAA IdP connection configured.`);let t=Cr(e.issuer)!==void 0,n=Rt(e.issuer)!==void 0;process.stdout.write(`Issuer: ${e.issuer}\n`),process.stdout.write(`Client ID: ${e.clientId}\n`),e.callbackPort!==void 0&&process.stdout.write(`Callback port: ${e.callbackPort}\n`),process.stdout.write(`Client secret: ${t?`(stored in keychain)`:`(not set — PKCE-only)`}\n`),process.stdout.write(`Logged in: ${n?`yes (id_token cached)`:`no — run 'claude mcp xaa login'`}\n`),rc()}),t.command(`clear`).description(`Clear the IdP connection config and cached id_token`).action(()=>{let e=Ir(),{error:t}=R(`userSettings`,{xaaIdp:void 0});if(t)return q(`Error writing settings: ${t.message}`);e&&(ln(e.issuer),hn(e.issuer)),rc(`XAA IdP connection cleared`)})}ct();function Ou(e,t=process.argv){for(let n=0;n<t.length;n++){let r=t[n];if(r?.startsWith(`${e}=`))return r.slice(e.length+1);if(r===e&&n+1<t.length)return t[n+1]}}ue(),Ot(),Pe(),W(),B(),Xa(),L();function ku(){if(z().bypassPermissionsModeAccepted)try{va()||R(`userSettings`,{skipDangerousModePermissionPrompt:!0}),G(`tengu_migrate_bypass_permissions_accepted`,{}),V(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){U(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}W(),B(),Xa(),L();function Au(){let e=ja(),t=e.enableAllProjectMcpServers!==void 0,n=e.enabledMcpjsonServers&&e.enabledMcpjsonServers.length>0,r=e.disabledMcpjsonServers&&e.disabledMcpjsonServers.length>0;if(!(!t&&!n&&!r))try{let i=ha(`localSettings`)||{},a={},o=[];if(t&&i.enableAllProjectMcpServers===void 0?(a.enableAllProjectMcpServers=e.enableAllProjectMcpServers,o.push(`enableAllProjectMcpServers`)):t&&o.push(`enableAllProjectMcpServers`),n&&e.enabledMcpjsonServers){let t=i.enabledMcpjsonServers||[];a.enabledMcpjsonServers=[...new Set([...t,...e.enabledMcpjsonServers])],o.push(`enabledMcpjsonServers`)}if(r&&e.disabledMcpjsonServers){let t=i.disabledMcpjsonServers||[];a.disabledMcpjsonServers=[...new Set([...t,...e.disabledMcpjsonServers])],o.push(`disabledMcpjsonServers`)}Object.keys(a).length>0&&R(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&Fa(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),G(`tengu_migrate_mcp_approval_fields_success`,{migratedCount:o.length})}catch(e){U(e),G(`tengu_migrate_mcp_approval_fields_error`,{})}}W(),B(),Zo(),L();function ju(){if(No()!==`firstParty`||!$o())return;let e=ha(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(R(`userSettings`,{model:`opus`}),V(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})),G(`tengu_legacy_opus_migration`,{from_model:e}))}W(),Mo();function Mu(){Io()&&G(`tengu_opus_to_opus1m_migration`,{skipped:!0})}B();function Nu(){V(e=>{let t=e.replBridgeEnabled;if(t===void 0||e.remoteControlAtStartup!==void 0)return e;let n={...e,remoteControlAtStartup:!!t};return delete n.replBridgeEnabled,n})}xi(),B(),L();function Pu(){z().sonnet1m45MigrationComplete||(ha(`userSettings`)?.model===`sonnet[1m]`&&R(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),pi()===`sonnet[1m]`&&gi(`sonnet-4-5-20250929[1m]`),V(e=>({...e,sonnet1m45MigrationComplete:!0})))}W(),go(),B(),Zo(),L();function Fu(){if(No()!==`firstParty`||!ho()&&!ko()&&!Ro())return;let e=ha(`userSettings`)?.model;if(e!==`claude-sonnet-4-5-20250929`&&e!==`claude-sonnet-4-5-20250929[1m]`&&e!==`sonnet-4-5-20250929`&&e!==`sonnet-4-5-20250929[1m]`)return;let t=e.endsWith(`[1m]`);R(`userSettings`,{model:t?`sonnet[1m]`:`sonnet`}),z().numStartups>1&&V(e=>({...e,sonnet45To46MigrationTimestamp:Date.now()})),G(`tengu_sonnet45_to_46_migration`,{from_model:e,has_1m:t})}W(),B(),Xa(),L();function Iu(){if(!z().hasResetAutoModeOptInForDefaultOffer&&_r()===`enabled`)try{let e=ha(`userSettings`);e?.skipAutoPermissionPrompt&&e?.permissions?.defaultMode!==`auto`&&(R(`userSettings`,{skipAutoPermissionPrompt:void 0}),G(`tengu_migrate_reset_auto_opt_in_for_default_offer`,{})),V(e=>e.hasResetAutoModeOptInForDefaultOffer?e:{...e,hasResetAutoModeOptInForDefaultOffer:!0})}catch(e){U(Error(`Failed to reset auto mode opt-in: ${e}`))}}W(),go(),B(),Zo(),L();function Lu(){if(!z().opusProMigrationComplete){if(No()!==`firstParty`||!ho()){V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!0});return}if(_a()?.model===void 0){let e=Date.now();V(t=>({...t,opusProMigrationComplete:!0,opusProMigrationTimestamp:e})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!1})}else V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!0})}}si(),ci();var Ru=oi(()=>ai({session_id:N(),ws_url:N(),work_dir:N().optional()}));Ji(),aa();var zu=class extends Error{constructor(e){super(e),this.name=`DirectConnectError`}};async function Bu({serverUrl:e,authToken:t,cwd:n,dangerouslySkipPermissions:r}){let i={"content-type":`application/json`};t&&(i.authorization=`Bearer ${t}`);let a;try{a=await fetch(`${e}/sessions`,{method:`POST`,headers:i,body:P({cwd:n,...r&&{dangerously_skip_permissions:!0}})})}catch(t){throw new zu(`Failed to connect to server at ${e}: ${F(t)}`)}if(!a.ok)throw new zu(`Failed to create session: ${a.status} ${a.statusText}`);let o=Ru().safeParse(await a.json());if(!o.success)throw new zu(`Invalid session response: ${o.error.message}`);let s=o.data;return{config:{serverUrl:e,sessionId:s.session_id,wsUrl:s.ws_url,authToken:t},workDir:s.work_dir}}oo(),lo(),Wn(),sr(),go(),B(),cc(),eo(),aa(),W(),xi(),_(),Yr(),ac(),f(),Wa(),Xa(),Mo(),le(),me(),L(),Mt(),st(),D(),ra(),ea(),Ji(),S(),fe(),Ba(),Bs(),Gt(),Ks(),_t(),K(`main_tsx_entry`),ba(),es();var Vu=(Ct(),e(yt));K(`main_tsx_imports_loaded`);function Hu(){try{let e=ha(`policySettings`);if(e){let t=ya(e);G(`tengu_managed_settings_loaded`,{keyCount:t.length,keys:t.join(`,`)})}}catch{}}function Uu(){let e=_o(fi()??Ko());Tu(Ui(),Oo(e,Di())),qn().then(({enabled:e,errors:t})=>{let n=ut();Sn(e,n,qe()),oe(t,n)}).catch(e=>U(e))}function Wu(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.CLAUDE_CODE_CLIENT_CERT&&(e.has_client_cert=!0),c(`--use-system-ca`)&&(e.has_use_system_ca=!0),c(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function Gu(){if(Gs())return;let[e,t,n]=await Promise.all([Ua(),Va(),wu()]);G(`tengu_startup_telemetry`,{is_git:e,worktree_count:t,gh_auth_status:n,sandbox_enabled:Ut.isSandboxingEnabled(),are_unsandboxed_commands_allowed:Ut.areUnsandboxedCommandsAllowed(),is_auto_bash_allowed_if_sandbox_enabled:Ut.isAutoAllowBashIfSandboxedEnabled(),auto_updater_disabled:Oa(),prefers_reduced_motion:Sa().prefersReducedMotion??!1,...Wu()})}var Ku=11;function qu(){z().migrationVersion!==Ku&&(ku(),Au(),Lu(),Pu(),ju(),Fu(),Mu(),Nu(),Iu(),V(e=>e.migrationVersion===Ku?e:{...e,migrationVersion:Ku}))}function Ju(){if(Vi()){H(`info`,`prefetch_system_context_non_interactive`),xn();return}Aa()?(H(`info`,`prefetch_system_context_has_trust`),xn()):H(`info`,`prefetch_system_context_skipped_no_trust`)}function Yu(){d(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)||p()||(Ws(),Ht(),Ju(),wc(),d(process.env.CLAUDE_CODE_USE_BEDROCK)&&!d(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&Vo(),d(process.env.CLAUDE_CODE_USE_VERTEX)&&!d(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&Po(),Ds(Ui(),AbortSignal.timeout(3e3),[]),Ao(),Ze.initialize(),p()||fc.initialize())}function Xu(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)io(t)||(process.stderr.write(M.red(`Error: Invalid JSON provided to --settings
484
+ `)),process.exit(1)),r=It(`claude-settings`,`.json`,{contentHash:t}),Xi(r,t,`utf8`);else{let{resolvedPath:t}=$i(ia(),e);try{kc(t,`utf8`)}catch(e){throw Wi(e)&&(process.stderr.write(M.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}Mi(r),wi()}catch(e){e instanceof Error&&U(e),process.stderr.write(M.red(`Error processing settings: ${F(e)}\n`)),process.exit(1)}}function Zu(e){try{Li(ga(e)),wi()}catch(e){e instanceof Error&&U(e),process.stderr.write(M.red(`Error processing --setting-sources: ${F(e)}\n`)),process.exit(1)}}function Qu(){K(`eagerLoadSettings_start`);let e=Ou(`--settings`);e&&Xu(e);let t=Ou(`--setting-sources`);t!==void 0&&Zu(t),K(`eagerLoadSettings_end`)}function $u(e){if(process.env.CLAUDE_CODE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.CLAUDE_CODE_ENTRYPOINT=`mcp`;return}if(d(process.env.CLAUDE_CODE_ACTION)){process.env.CLAUDE_CODE_ENTRYPOINT=`claude-code-github-action`;return}process.env.CLAUDE_CODE_ENTRYPOINT=e?`sdk-cli`:`cli`}var Q={url:void 0,authToken:void 0,dangerouslySkipPermissions:!1},$={host:void 0,cwd:void 0,permissionMode:void 0,dangerouslySkipPermissions:!1,local:!1,extraCliArgs:[],remoteBin:void 0};async function ed(){K(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,pl(),process.on(`exit`,()=>{ad();try{let{peekWorkflowService:t}=(Mn(),e(fn));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),K(`main_warning_handler_initialized`);{let e=process.argv.slice(2),t=e.findIndex(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(t!==-1&&Q){let n=e[t],{parseConnectUrl:r}=await import(`./parseConnectUrl-BiyKR5-x.js`),i=r(n);if(Q.dangerouslySkipPermissions=e.includes(`--dangerously-skip-permissions`),e.includes(`-p`)||e.includes(`--print`)){let r=e.filter((e,n)=>n!==t),i=r.indexOf(`--dangerously-skip-permissions`);i!==-1&&r.splice(i,1),process.argv=[process.argv[0],process.argv[1],`open`,n,...r]}else{Q.url=i.serverUrl,Q.authToken=i.authToken;let n=e.filter((e,n)=>n!==t),r=n.indexOf(`--dangerously-skip-permissions`);r!==-1&&n.splice(r,1),process.argv=[process.argv[0],process.argv[1],...n]}}}{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-DMKtiMzJ.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-B83fCYI4.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-DMKtiMzJ.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-B83fCYI4.js`),n=await t();process.exit(n??1)}}if($){let e=process.argv.slice(2);if(e[0]===`ssh`){let t=e.indexOf(`--local`);t!==-1&&($.local=!0,e.splice(t,1));let n=e.indexOf(`--dangerously-skip-permissions`);n!==-1&&($.dangerouslySkipPermissions=!0,e.splice(n,1));let r=e.indexOf(`--permission-mode`);r!==-1&&e[r+1]&&!e[r+1].startsWith(`-`)&&($.permissionMode=e[r+1],e.splice(r,2));let i=e.findIndex(e=>e.startsWith(`--permission-mode=`));i!==-1&&($.permissionMode=e[i].split(`=`)[1],e.splice(i,1));let a=(t,n={})=>{let r=e.indexOf(t);if(r!==-1){$.extraCliArgs.push(n.as??t);let i=e[r+1];n.hasValue&&i&&!i.startsWith(`-`)?($.extraCliArgs.push(i),e.splice(r,2)):e.splice(r,1)}let i=e.findIndex(e=>e.startsWith(`${t}=`));i!==-1&&($.extraCliArgs.push(n.as??t,e[i].slice(t.length+1)),e.splice(i,1))},o=e.indexOf(`--remote-bin`);o!==-1&&e[o+1]&&!e[o+1].startsWith(`-`)&&($.remoteBin=e[o+1],e.splice(o,2));let s=e.findIndex(e=>e.startsWith(`--remote-bin=`));s!==-1&&($.remoteBin=e[s].split(`=`).slice(1).join(`=`),e.splice(s,1)),a(`-c`,{as:`--continue`}),a(`--continue`),a(`--resume`,{hasValue:!0}),a(`--model`,{hasValue:!0})}if(e[0]===`ssh`&&e[1]&&!e[1].startsWith(`-`)){$.host=e[1];let t=2;e[2]&&!e[2].startsWith(`-`)&&($.cwd=e[2],t=3);let n=e.slice(t);if(n.includes(`-p`)||n.includes(`--print`)){process.stderr.write(`Error: headless (-p/--print) mode is not supported with claude ssh
485
+ `),At(1);return}process.argv=[process.argv[0],process.argv[1],...n]}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=d(process.env.CLAUDE_CODE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&vc(),bi(!o),$u(o);let s=(()=>{if(d(process.env.GITHUB_ACTIONS))return`github-action`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-ts`)return`sdk-typescript`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-py`)return`sdk-python`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-cli`)return`sdk-cli`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-vscode`)return`claude-vscode`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`)return`local-agent`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`)return`claude-desktop`;let e=process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;return process.env.CLAUDE_CODE_ENTRYPOINT===`remote`||e?`remote`:`cli`})();Fi(s);let c=process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;c===`markdown`||c===`html`?hi(c):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&s!==`remote`&&hi(`markdown`),process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`&&yi(`remote-control`),K(`main_client_type_determined`),Qu(),K(`main_before_run`),await nd(),K(`main_after_run`)}async function td(e,t){if(!process.stdin.isTTY&&!process.argv.includes(`mcp`)){if(t===`stream-json`)return process.stdin;process.stdin.setEncoding(`utf8`);let n=``,r=e=>{n+=e};process.stdin.on(`data`,r);let i=await za(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
486
486
  `),[e,n].filter(Boolean).join(`
487
- `)}return e}async function nd(){K(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new Gc().configureHelp(e()).enablePositionalOptions();K(`run_commander_initialized`),t.hook(`preAction`,async e=>{K(`preAction_start`),await Promise.all([pa(),rs()]),K(`preAction_after_mdm`),await el(),K(`preAction_after_init`),d(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)||(process.title=`claude`);let{initSinks:t}=await import(`./sinks-WJ7nzLQs.js`);t(),K(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(zi(n),nr(`preAction: --plugin-dir inline plugins`)),qu(),K(`preAction_after_migrations`),Zs(),Tn(),K(`preAction_after_remote_settings`),K(`preAction_after_settings_sync`)}),t.name(`claude`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new J(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new J(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new J(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new J(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new J(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new J(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new J(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new J(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new J(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new J(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).addOption(new J(`--enable-auth-status`,`Enable auth status messages in SDK mode`).default(!1).hideHelp()).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new J(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new J(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new J(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new J(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new J(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new J(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(oa)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new J(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new J(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new J(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new J(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new J(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new J(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new J(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--ide`,`Automatically connect to IDE on startup if exactly one valid IDE is available`,()=>!0).option(`--strict-mcp-config`,`Only use MCP servers from --mcp-config, ignoring all other MCP configurations`,()=>!0).option(`--session-id <uuid>`,`Use a specific session ID for the conversation (must be a valid UUID)`).option(`-n, --name <name>`,`Set a display name for this session (shown in /resume and terminal title)`).option(`--agents <json>`,`JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).option(`--plugin-dir <path>`,`Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)`,(e,t)=>[...t,e],[]).option(`--disable-slash-commands`,`Disable all skills`,()=>!0).option(`--chrome`,`Enable Claude in Chrome integration`).option(`--no-chrome`,`Disable Claude in Chrome integration`).option(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{K(`action_handler_start`),t.bare&&(process.env.CLAUDE_CODE_SIMPLE=`1`),e===`code`&&(G(`tengu_code_prompt_ignored`,{}),console.warn(N.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&G(`tengu_single_word_prompt`,{length:e.length});let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:c=[],mcpConfig:l=[],permissionMode:u,addDir:f=[],fallbackModel:m,betas:h=[],ide:g=!1,sessionId:_,includeHookEvents:ee,includePartialMessages:te}=t;t.prefill&&yc(t.prefill);let re,ie=t.agents,ae=t.agent;ae&&(process.env.CLAUDE_CODE_AGENT=ae);let y=t.outputFormat,b=t.inputFormat,se=t.verbose??z().verbose,ce=t.print,le=t.init??!1,ue=t.initOnly??!1,fe=t.maintenance??!1,pe=t.disableSlashCommands||!1,he=qs()?t.worktree:void 0,_e=typeof he==`string`?he:void 0,ye=he!==void 0,be;if(_e){let e=xn(_e);e!==null&&(be=e,_e=void 0)}let Se=qs()&&t.tmux===!0;Se&&(ye||(process.stderr.write(N.red(`Error: --tmux requires --worktree
488
- `)),process.exit(1)),$a()===`windows`&&(process.stderr.write(N.red(`Error: --tmux is not supported on Windows
489
- `)),process.exit(1)),await ve()||(process.stderr.write(N.red(`Error: tmux is not installed.\n${me()}\n`)),process.exit(1)));let we=t.sdkUrl??void 0,Te=te||d(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);(ee||d(process.env.CLAUDE_CODE_REMOTE))&&at(!0),we&&(b||(b=`stream-json`),y||(y=`stream-json`),t.verbose===void 0&&(se=!0),t.print||(ce=!0));let x=t.teleport??null,De=t.remote,Oe=De===!0?``:De??null,ke=t.remoteControl??t.rc,Ae=typeof ke==`string`&&ke.length>0?ke:void 0;if(_&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(N.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
490
- `)),process.exit(1)),!we)){let e=tr(_);e||(process.stderr.write(N.red(`Error: Invalid session ID. Must be a valid UUID.
491
- `)),process.exit(1)),an(e)&&(process.stderr.write(N.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let je=t.file;if(je&&je.length>0){let e=Ss();e||(process.stderr.write(N.red(`Error: Session token required for file downloads. CLAUDE_CODE_SESSION_ACCESS_TOKEN must be set.
492
- `)),process.exit(1));let t=process.env.CLAUDE_CODE_REMOTE_SESSION_ID||Ri(),n=br(je);n.length>0&&(re=dt(n,{baseUrl:process.env.ANTHROPIC_BASE_URL||so().BASE_API_URL,oauthToken:e,sessionId:t}))}let S=Bi();m&&t.model&&m===t.model&&(process.stderr.write(N.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
493
- `)),process.exit(1));let Ne=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(N.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
494
- `)),process.exit(1));try{Ne=kc(Ec(t.systemPromptFile),`utf8`)}catch(e){Gi(e)===`ENOENT`&&(process.stderr.write(N.red(`Error: System prompt file not found: ${Ec(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(N.red(`Error reading system prompt file: ${F(e)}\n`)),process.exit(1)}}let Pe=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(N.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
495
- `)),process.exit(1));try{Pe=kc(Ec(t.appendSystemPromptFile),`utf8`)}catch(e){Gi(e)===`ENOENT`&&(process.stderr.write(N.red(`Error: Append system prompt file not found: ${Ec(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(N.red(`Error reading append system prompt file: ${F(e)}\n`)),process.exit(1)}}let{mode:Fe,notification:Ie}=_r({permissionModeCli:u,dangerouslySkipPermissions:i});xi(Fe===`bypassPermissions`),(t.enableAutoMode||u===`auto`||Fe===`auto`||!u&&Xe())&&Vu?.setAutoModeFlagCli(!0);let Le={};if(l&&l.length>0){let e=l.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=io(r);if(a){let t=wn({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=on({filePath:Ec(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?e.path+`: `:``}${e.message}`).join(`
496
- `);I(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=An(qt(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${po(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),Le={...Le,...e}}}let Re=t.strictMcpConfig||!1;Nt()&&(Re&&(process.stderr.write(N.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),Le&&!qn(Le)&&(process.stderr.write(N.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),Ni(f);let Ve=await ft({allowedToolsCli:s,disallowedToolsCli:c,baseToolsCli:o,permissionMode:Fe,allowDangerouslySkipPermissions:a,addDirs:f}),C=Ve.toolPermissionContext,{warnings:Ue,dangerousPermissions:We}=Ve;We.length>0&&(C=ze(C)),Ue.forEach(e=>{console.error(e)});let Ke=S&&!Re&&!Nt()&&!p()?jr().then(e=>{let{allowed:t,blocked:n}=An(e);return n.length>0&&process.stderr.write(`Warning: claude.ai MCP ${po(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),t}):Promise.resolve({});I(`[STARTUP] Loading MCP configs...`);let qe=Date.now(),Je,Ye=(Re||p()?Promise.resolve({servers:{}}):zt(Le)).then(e=>(Je=Date.now()-qe,e));b&&b!==`text`&&b!==`stream-json`&&(console.error(`Error: Invalid input format "${b}".`),process.exit(1)),b===`stream-json`&&y!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),we&&(b!==`stream-json`||y!==`stream-json`)&&(console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),t.replayUserMessages&&(b!==`stream-json`||y!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),Te&&(!S||y!==`stream-json`)&&(La(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!S&&(La(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let w=await td(e||``,b??`text`);K(`action_after_input_prompt`),id(t);let $e=Zt(C);K(`action_tools_loaded`);let et;if(ps({isNonInteractiveSession:S})&&t.jsonSchema&&(et=Yi(t.jsonSchema)),et){let e=ls(et);`tool`in e?($e=[...$e,e.tool],G(`tengu_structured_output_enabled`,{schema_property_count:Object.keys(et.properties||{}).length,has_required_fields:!!et.required})):G(`tengu_structured_output_failure`,{error:`Invalid JSON schema`})}K(`action_before_setup`),I(`[STARTUP] Running setup()...`);let tt=Date.now(),{setup:nt}=await import(`./setup-C62oq4AZ.js`),rt=Hi();process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&Cu();let it=nt(rt,Fe,a,ye,_e,Se,_?tr(_):void 0,be,void 0),ot=ye?null:Ce(rt),st=ye?null:dn(rt);ot?.catch(()=>{}),st?.catch(()=>{}),await it,I(`[STARTUP] setup() completed in ${Date.now()-tt}ms`),K(`action_after_setup`);let lt=!!t.replayUserMessages;Bi()&&(lc(),Pr(),Rt(),xo());let ut=t.name?.trim();ut&&vt(ut);let gt=t.model==="default"?Ko():t.model,_t=m==="default"?Ko():m,yt=ye?Hi():rt;I(`[STARTUP] Loading commands and agents...`);let St=Date.now(),[Ct,wt]=await Promise.all([ot??Ce(yt),st??dn(yt)]);I(`[STARTUP] Commands and agents loaded in ${Date.now()-St}ms`),K(`action_commands_loaded`);let Et=[];if(ie)try{let e=io(ie);e&&(Et=$t(e,`flagSettings`))}catch(e){U(e)}let Dt=[...wt.allAgents,...Et],Ot={...wt,allAgents:Dt,activeAgents:Kn(Dt)},kt=ae??Sa().agent,T;if(kt&&(T=Ot.activeAgents.find(e=>e.agentType===kt),T||I(`Warning: agent "${kt}" not found. Available agents: ${Ot.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),gi(T?.agentType),T&&G(`tengu_agent_flag`,{agentType:Zn(T)?T.agentType:`custom`,...ae&&{source:`cli`}}),T?.agentType&&er(T.agentType),S&&T&&!Ne&&!Zn(T)){let e=T.getSystemPrompt();e&&(Ne=e)}T?.initialPrompt&&(typeof w==`string`?w=w?`${T.initialPrompt}\n\n${w}`:T.initialPrompt:w||(w=T.initialPrompt));let Ft=gt;!Ft&&T?.model&&T.model!==`inherit`&&(Ft=_o(T.model)),hi(Ft),wi(Bo()||null);let Lt=di(),E=_o(Lt??Ko()),D;if(Be()){let e=Ze()?t.advisor:void 0;e&&(I(`[AdvisorTool] --advisor ${e}`),Qe(E)||(process.stderr.write(N.red(`Error: The model "${E}" does not support the advisor tool.\n`)),process.exit(1)),Ge(Eo(_o(e)))||(process.stderr.write(N.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),D=Ze()?e??bn():e,D&&I(`[AdvisorTool] Advisor model: ${D}`)}if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let e=`
487
+ `)}return e}async function nd(){K(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new Gc().configureHelp(e()).enablePositionalOptions();K(`run_commander_initialized`),t.hook(`preAction`,async e=>{K(`preAction_start`),await Promise.all([pa(),rs()]),K(`preAction_after_mdm`),await el(),K(`preAction_after_init`),d(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)||(process.title=`claude`);let{initSinks:t}=await import(`./sinks-DppGvgz1.js`);t(),K(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(Bi(n),lr(`preAction: --plugin-dir inline plugins`)),qu(),K(`preAction_after_migrations`),Zs(),Kt(),K(`preAction_after_remote_settings`),K(`preAction_after_settings_sync`)}),t.name(`claude`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new J(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and AGENTS.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (AGENTS.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new J(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new J(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new J(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new J(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new J(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new J(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new J(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new J(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new J(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).addOption(new J(`--enable-auth-status`,`Enable auth status messages in SDK mode`).default(!1).hideHelp()).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new J(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new J(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new J(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new J(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new J(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new J(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(oa)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new J(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new J(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new J(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new J(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new J(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new J(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new J(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--ide`,`Automatically connect to IDE on startup if exactly one valid IDE is available`,()=>!0).option(`--strict-mcp-config`,`Only use MCP servers from --mcp-config, ignoring all other MCP configurations`,()=>!0).option(`--session-id <uuid>`,`Use a specific session ID for the conversation (must be a valid UUID)`).option(`-n, --name <name>`,`Set a display name for this session (shown in /resume and terminal title)`).option(`--agents <json>`,`JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).option(`--plugin-dir <path>`,`Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)`,(e,t)=>[...t,e],[]).option(`--disable-slash-commands`,`Disable all skills`,()=>!0).option(`--chrome`,`Enable Claude in Chrome integration`).option(`--no-chrome`,`Disable Claude in Chrome integration`).option(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{K(`action_handler_start`),t.bare&&(process.env.CLAUDE_CODE_SIMPLE=`1`),e===`code`&&(G(`tengu_code_prompt_ignored`,{}),console.warn(M.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&G(`tengu_single_word_prompt`,{length:e.length});let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:c=[],mcpConfig:l=[],permissionMode:u,addDir:f=[],fallbackModel:m,betas:ee=[],ide:h=!1,sessionId:g,includeHookEvents:te,includePartialMessages:ne}=t;t.prefill&&yc(t.prefill);let ie,oe=t.agents,ce=t.agent;ce&&(process.env.CLAUDE_CODE_AGENT=ce);let _=t.outputFormat,v=t.inputFormat,le=t.verbose??z().verbose,ue=t.print,fe=t.init??!1,pe=t.initOnly??!1,me=t.maintenance??!1,ge=t.disableSlashCommands||!1,_e=qs()?t.worktree:void 0,ve=typeof _e==`string`?_e:void 0,ye=_e!==void 0,be;if(ve){let e=En(ve);e!==null&&(be=e,ve=void 0)}let xe=qs()&&t.tmux===!0;xe&&(ye||(process.stderr.write(M.red(`Error: --tmux requires --worktree
488
+ `)),process.exit(1)),$a()===`windows`&&(process.stderr.write(M.red(`Error: --tmux is not supported on Windows
489
+ `)),process.exit(1)),await Ee()||(process.stderr.write(M.red(`Error: tmux is not installed.\n${he()}\n`)),process.exit(1)));let we=t.sdkUrl??void 0,Te=ne||d(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);(te||d(process.env.CLAUDE_CODE_REMOTE))&&ot(!0),we&&(v||(v=`stream-json`),_||(_=`stream-json`),t.verbose===void 0&&(le=!0),t.print||(ue=!0));let y=t.teleport??null,Ne=t.remote,Pe=Ne===!0?``:Ne??null,Fe=t.remoteControl??t.rc,Ie=typeof Fe==`string`&&Fe.length>0?Fe:void 0;if(g&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(M.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
490
+ `)),process.exit(1)),!we)){let e=yn(g);e||(process.stderr.write(M.red(`Error: Invalid session ID. Must be a valid UUID.
491
+ `)),process.exit(1)),on(e)&&(process.stderr.write(M.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let Le=t.file;if(Le&&Le.length>0){let e=Ss();e||(process.stderr.write(M.red(`Error: Session token required for file downloads. CLAUDE_CODE_SESSION_ACCESS_TOKEN must be set.
492
+ `)),process.exit(1));let t=process.env.CLAUDE_CODE_REMOTE_SESSION_ID||zi(),n=jr(Le);n.length>0&&(ie=Fr(n,{baseUrl:process.env.ANTHROPIC_BASE_URL||so().BASE_API_URL,oauthToken:e,sessionId:t}))}let b=Vi();m&&t.model&&m===t.model&&(process.stderr.write(M.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
493
+ `)),process.exit(1));let Re=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(M.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
494
+ `)),process.exit(1));try{Re=kc(Ec(t.systemPromptFile),`utf8`)}catch(e){Gi(e)===`ENOENT`&&(process.stderr.write(M.red(`Error: System prompt file not found: ${Ec(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(M.red(`Error reading system prompt file: ${F(e)}\n`)),process.exit(1)}}let Be=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(M.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
495
+ `)),process.exit(1));try{Be=kc(Ec(t.appendSystemPromptFile),`utf8`)}catch(e){Gi(e)===`ENOENT`&&(process.stderr.write(M.red(`Error: Append system prompt file not found: ${Ec(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(M.red(`Error reading append system prompt file: ${F(e)}\n`)),process.exit(1)}}let{mode:Ve,notification:Ue}=wr({permissionModeCli:u,dangerouslySkipPermissions:i});Si(Ve===`bypassPermissions`),(t.enableAutoMode||u===`auto`||Ve===`auto`||!u&&Xe())&&Vu?.setAutoModeFlagCli(!0);let Ge={};if(l&&l.length>0){let e=l.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=io(r);if(a){let t=ae({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=Zt({filePath:Ec(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?e.path+`: `:``}${e.message}`).join(`
496
+ `);I(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=je(Lr(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${po(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),Ge={...Ge,...e}}}let Ke=t.strictMcpConfig||!1;wt()&&(Ke&&(process.stderr.write(M.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),Ge&&!Me(Ge)&&(process.stderr.write(M.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),Pi(f);let qe=await ft({allowedToolsCli:s,disallowedToolsCli:c,baseToolsCli:o,permissionMode:Ve,allowDangerouslySkipPermissions:a,addDirs:f}),Ye=qe.toolPermissionContext,{warnings:Ze,dangerousPermissions:$e}=qe;$e.length>0&&(Ye=He(Ye)),Ze.forEach(e=>{console.error(e)});let et=b&&!Ke&&!wt()&&!p()?vn().then(e=>{let{allowed:t,blocked:n}=je(e);return n.length>0&&process.stderr.write(`Warning: claude.ai MCP ${po(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),t}):Promise.resolve({});I(`[STARTUP] Loading MCP configs...`);let tt=Date.now(),nt,rt=(Ke||p()?Promise.resolve({servers:{}}):Dt(Ge)).then(e=>(nt=Date.now()-tt,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)),we&&(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)),Te&&(!b||_!==`stream-json`)&&(La(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!b&&(La(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let x=await td(e||``,v??`text`);K(`action_after_input_prompt`),id(t);let it=tn(Ye);K(`action_tools_loaded`);let S;if(ps({isNonInteractiveSession:b})&&t.jsonSchema&&(S=Yi(t.jsonSchema)),S){let e=ls(S);`tool`in e?(it=[...it,e.tool],G(`tengu_structured_output_enabled`,{schema_property_count:Object.keys(S.properties||{}).length,has_required_fields:!!S.required})):G(`tengu_structured_output_failure`,{error:`Invalid JSON schema`})}K(`action_before_setup`),I(`[STARTUP] Running setup()...`);let at=Date.now(),{setup:st}=await import(`./setup-zf3v3ICe.js`),ct=Ui();process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&Cu();let ut=st(ct,Ve,a,ye,ve,xe,g?yn(g):void 0,be,void 0),dt=ye?null:Oe(ct),_t=ye?null:gn(ct);dt?.catch(()=>{}),_t?.catch(()=>{}),await ut,I(`[STARTUP] setup() completed in ${Date.now()-at}ms`),K(`action_after_setup`);let vt=!!t.replayUserMessages;Vi()&&(lc(),xn(),Ht(),xo());let yt=t.name?.trim();yt&&bt(yt);let St=t.model==="default"?Ko():t.model,Ct=m==="default"?Ko():m,Et=ye?Ui():ct;I(`[STARTUP] Loading commands and agents...`);let Ot=Date.now(),[jt,Mt]=await Promise.all([dt??Oe(Et),_t??gn(Et)]);I(`[STARTUP] Commands and agents loaded in ${Date.now()-Ot}ms`),K(`action_commands_loaded`);let It=[];if(oe)try{let e=io(oe);e&&(It=nn(e,`flagSettings`))}catch(e){U(e)}let Lt=[...Mt.allAgents,...It],Rt={...Mt,allAgents:Lt,activeAgents:Qn(Lt)},zt=ce??Sa().agent,w;if(zt&&(w=Rt.activeAgents.find(e=>e.agentType===zt),w||I(`Warning: agent "${zt}" not found. Available agents: ${Rt.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),_i(w?.agentType),w&&G(`tengu_agent_flag`,{agentType:ir(w)?w.agentType:`custom`,...ce&&{source:`cli`}}),w?.agentType&&cr(w.agentType),b&&w&&!Re&&!ir(w)){let e=w.getSystemPrompt();e&&(Re=e)}w?.initialPrompt&&(typeof x==`string`?x=x?`${w.initialPrompt}\n\n${x}`:w.initialPrompt:x||(x=w.initialPrompt));let Bt=St;!Bt&&w?.model&&w.model!==`inherit`&&(Bt=_o(w.model)),gi(Bt),Ti(Bo()||null);let Ut=fi(),T=_o(Ut??Ko()),E;if(Nt()){let e=Gn()?t.advisor:void 0;e&&(I(`[AdvisorTool] --advisor ${e}`),Pr(T)||(process.stderr.write(M.red(`Error: The model "${T}" does not support the advisor tool.\n`)),process.exit(1)),vr(Eo(_o(e)))||(process.stderr.write(M.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),E=Gn()?e??jn():e,E&&I(`[AdvisorTool] Advisor model: ${E}`)}if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let e=`
497
497
  # Proactive Mode
498
498
 
499
499
  You are in proactive mode. Take initiative — explore, act, and make progress without waiting for instructions.
500
500
 
501
501
  Start by briefly greeting the user.
502
502
 
503
- You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;Pe=Pe?`${Pe}\n\n${e}`:e}let O,k,A;if(!S){let t=El(!1);k=t.getFpsMetrics,A=t.stats;let{createRoot:n}=await import(`./src-r6ZFgWPx2.js`);O=await n(t.renderOptions),G(`tengu_timer`,{event:`startup`,durationMs:Math.round(process.uptime()*1e3)}),I(`[STARTUP] Running showSetupScreens()...`);let r=Date.now(),i=await Tl(O,Fe,a,Ct);I(`[STARTUP] showSetupScreens() completed in ${Date.now()-r}ms`),i&&e?.trim().toLowerCase()===`/login`&&(e=``),i&&(Xs(),sn(),Hs(),import(`./trustedDevice-B6AKlsl_.js`).then(e=>(e.clearTrustedDeviceToken(),e.enrollTrustedDevice())));let o=await qo();o.valid||await X(O,o.message)}if(process.exitCode!==void 0){I(`Graceful shutdown initiated, skipping further initialization`);return}if(Ir(),!S){let{errors:e}=Ca(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await Dl(O,{settingsErrors:t,onExit:()=>Xt(1)})}let Ht=z().startupPrefetchedAt??0;p()?(I(`Skipping startup prefetches, last ran ${Math.round((Date.now()-Ht)/1e3)}s ago`),Qo()):(I(`Starting background startup prefetches${Ht>0?` last ran ${Math.round((Date.now()-Ht)/1e3)}s ago`:``}`),In().catch(e=>U(e)),sl(),Wo()),S||xc();let{servers:Ut}=await Ye;I(`[STARTUP] MCP configs resolved in ${Je}ms (awaited at +${Date.now()-qe}ms)`);let Wt={...Ut,...Le},Gt={},Yt={};for(let[e,t]of Object.entries(Wt)){let n=t;n.type===`sdk`?Gt[e]=n:Yt[e]=n}K(`action_mcp_configs_loaded`);let en=S?Promise.resolve({clients:[],tools:[],commands:[]}):Bt(Yt),nn=S?Promise.resolve({clients:[],tools:[],commands:[]}):Ke.then(e=>Object.keys(e).length>0?Bt(e):{clients:[],tools:[],commands:[]}),ln=Promise.all([en,nn]).then(([e,t])=>({clients:[...e.clients,...t.clients],tools:Me([...e.tools,...t.tools],`name`),commands:Me([...e.commands,...t.commands],`name`)})),pn=ue||le||fe||S||t.continue||t.resume?null:oe(`startup`,{agentType:T?.agentType,model:E}),mn=[];ln.catch(()=>{});let _n=[],yn=[],Sn=[],Cn=jt(),j=Cn===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)Cn=!0,j={type:`adaptive`};else if(t.thinking===`disabled`)Cn=!1,j={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(Cn=!0,j={type:`enabled`,budgetTokens:e}):e===0&&(Cn=!1,j={type:`disabled`}))}H(`info`,`started`,{version:`0.0.11`,is_native_binary:uo()}),na(async()=>{H(`info`,`exited`)}),rd({hasInitialPrompt:!!e,hasStdin:!!w,verbose:se,debug:n,debugToStderr:r,print:ce??!1,outputFormat:y??`text`,inputFormat:b??`text`,numAllowedTools:s.length,numDisallowedTools:c.length,mcpClientCount:Object.keys(Wt).length,worktreeEnabled:ye,skipWebFetchPreflight:Sa().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:Fe,modeIsBypass:Fe===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:Ne?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:Pe?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:j,assistantActivationPath:void 0}),Pt(Yt,C),Hu(),It().then(e=>{e&&(ut&&de(ut),At().then(e=>{e>=2&&G(`tengu_concurrent_sessions`,{num_sessions:e})}))}),p()||(S?(await ht(),K(`action_after_plugins_init`),Pn().then(()=>He())):ht().then(async()=>{K(`action_after_plugins_init`),await Pn(),He()}));let Tn=ue||le?`init`:fe?`maintenance`:null;if(ue){lc(),await xt(`init`,{forceSyncExecution:!0}),await oe(`startup`,{forceSyncExecution:!0}),Xt(0);return}if(S){(y===`stream-json`||y===`json`)&&ta(!0),lc(),tl();let e=t.continue||t.resume||x||Tn?void 0:oe(`startup`);e?.catch(()=>{}),K(`before_validateForceLoginOrg`);let n=await qo();n.valid||(process.stderr.write(n.message+`
504
- `),process.exit(1));let r=pe?[]:Ct.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),i=Jt(),a=vn({...i,mcp:{...i.mcp,clients:_n,commands:Sn,tools:yn},toolPermissionContext:C,...Xo()&&{fastMode:jo(Ft??null)},...Be()&&D&&{advisorModel:D}},uc);xe(C,a.getState().fastMode).then(({updateContext:e})=>{a.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&Si(!0),pi(vo(h));let o=(e,t)=>Object.keys(e).length===0?Promise.resolve():(a.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),Fn(({client:e,tools:t,commands:n})=>{a.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:Me([...r.mcp.tools,...t],`name`),commands:Me([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>I(`[MCP] ${t} connect error: ${e}`)));K(`before_connectMcp`),await o(Yt,`regular`),K(`after_connectMcp`);let c=5e3,l=Ke.then(e=>{if(Object.keys(e).length>0){let t=new Set;for(let n of Object.values(e)){let e=Vt(n);e&&t.add(e)}let n=new Set;for(let[e,r]of Object.entries(Yt)){if(!e.startsWith(`plugin:`))continue;let i=Vt(r);i&&t.has(i)&&n.add(e)}if(n.size>0){I(`[MCP] Lazy dedup: suppressing ${n.size} plugin server(s) that duplicate claude.ai connectors: ${[...n].join(`, `)}`);for(let e of a.getState().mcp.clients)!n.has(e.name)||e.type!==`connected`||(e.client.onclose=void 0,Qt(e.name,e.config).catch(()=>{}));a.setState(e=>{let{clients:t,tools:r,commands:i,resources:a}=e.mcp;t=t.filter(e=>!n.has(e.name)),r=r.filter(e=>!e.mcpInfo||!n.has(e.mcpInfo.serverName));for(let e of n)i=Tt(i,e),a=Ee(a,e);return{...e,mcp:{...e.mcp,clients:t,tools:r,commands:i,resources:a}}})}}let{servers:t}=fn(e,Ea(Yt,(e,t)=>!t.startsWith(`plugin:`)));return o(t,`claudeai`)}),u,d=await Promise.race([l.then(()=>!1),new Promise(e=>{u=setTimeout(e=>e(!0),c,e)})]);u&&clearTimeout(u),d&&I(`[MCP] claude.ai connectors not ready after ${c}ms — proceeding; background connection continues`),K(`after_connectMcp_claudeai`),p()||(Yu(),import(`./backgroundHousekeeping-BTy71bcY.js`).then(e=>e.startBackgroundHousekeeping())),Uu(),K(`before_print_import`);let{runHeadless:f}=await import(`./print-BZOx09SU.js`);K(`after_print_import`),f(w,()=>a.getState(),a.setState,r,$e,Gt,Ot.activeAgents,{continue:t.continue,resume:t.resume,verbose:se,outputFormat:y,jsonSchema:et,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:j,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:Ne,appendSystemPrompt:Pe,userSpecifiedModel:Ft,fallbackModel:_t,teleport:x,sdkUrl:we,replayUserMessages:lt,includePartialMessages:Te,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,enableAuthStatus:t.enableAuthStatus,agent:ae,workload:t.workload,setupTrigger:Tn??void 0,sessionStartHooksPromise:e});return}G(`tengu_startup_manual_model_config`,{cli_flag:t.model,env_var:process.env.ANTHROPIC_MODEL,settings_file:(Sa()||{}).model,subscriptionType:bo(),agent:kt});let En=Cc(E),Dn=[];Ie&&Dn.push({key:`permission-mode-notification`,text:Ie,priority:`high`}),En&&Dn.push({key:`model-deprecation-warning`,text:En,color:`warning`,priority:`high`});let On={...C},kn=Ma(),M={settings:Sa(),tasks:{},agentNameRegistry:new Map,verbose:se??z().verbose??!1,mainLoopModel:Lt,mainLoopModelForSession:null,expandedView:z().showExpandedTodos?`tasks`:`none`,selectedIPAgentIndex:-1,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:On,agent:T?.agentType,agentDefinitions:Ot,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,remoteSessionUrl:void 0,remoteConnectionStatus:`connecting`,remoteBackgroundTaskCount:0,replBridgeEnabled:kn||!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:Ae,showRemoteCallout:!1,notifications:{current:null,queue:Dn},elicitation:{queue:[]},todos:{},remoteAgentTaskSuggestions:[],fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:Hn(),thinkingEnabled:Cn,promptSuggestionEnabled:jn(),sessionHooks:new Map,inbox:{messages:[]},promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:ne,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:w?{message:pt({content:String(w)})}:null,activeOverlays:new Set,fastMode:jo(E),...Be()&&D&&{advisorModel:D}};w&&hn(String(w));let Mn=yn;V(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{Gu(),Uu()});let Nn={debug:n||r,commands:[...Ct,...Sn],initialTools:Mn,mcpClients:_n,autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,dynamicMcpConfig:Le,strictMcpConfig:Re,systemPrompt:Ne,appendSystemPrompt:Pe,thinkingConfig:j},Ln={mainThreadAgentDefinition:T,agentDefinitions:Ot,currentCwd:yt,cliAgents:Et,initialState:M};if(t.continue){let e=!1;try{let n=performance.now(),{clearSessionCaches:r}=await import(`./caches-B8sM3Zys.js`);r();let i=await ge(void 0,void 0);if(!i)return G(`tengu_continue`,{success:!1}),await X(O,`No conversation found to continue`);let a=await dc(i,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:i.fullPath},Ln);a.restoredAgentDef&&(T=a.restoredAgentDef),id(t),G(`tengu_continue`,{success:!0,resume_duration_ms:Math.round(performance.now()-n)}),e=!0,await il(O,{getFpsMetrics:k,stats:A,initialState:a.initialState},{...Nn,mainThreadAgentDefinition:a.restoredAgentDef??T,initialMessages:a.messages,initialFileHistorySnapshots:a.fileHistorySnapshots,initialContentReplacements:a.contentReplacements,initialAgentName:a.agentName,initialAgentColor:a.agentColor},wl)}catch(t){e||G(`tengu_continue`,{success:!1}),U(t),process.exit(1)}}else if(Q?.url){let e;try{let t=await Bu({serverUrl:Q.url,authToken:Q.authToken,cwd:Oi(),dangerouslySkipPermissions:Q.dangerouslySkipPermissions});t.workDir&&(li(t.workDir),Ti(t.workDir)),ki(Q.url),e=t.config}catch(e){return await X(O,e instanceof zu?e.message:String(e),()=>v(1))}let t=ct(`Connected to server at ${Q.url}\nSession: ${e.sessionId}`,`info`);await il(O,{getFpsMetrics:k,stats:A,initialState:M},{debug:n||r,commands:Ct,initialTools:[],initialMessages:[t],mcpClients:[],autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,directConnectConfig:e,thinkingConfig:j},wl);return}else if($?.host){let{createSSHSession:e,createLocalSSHSession:t,SSHSessionError:i}=await import(`./createSSHSession-DecOR6M5.js`),a;try{if($.local)process.stderr.write(`Starting local ssh-proxy test session...
505
- `),a=await t({cwd:$.cwd,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions});else{process.stderr.write(`Connecting to ${$.host}…\n`);let t=process.stderr.isTTY,n=!1;a=await e({host:$.host,cwd:$.cwd,localVersion:`0.0.11`,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions,extraCliArgs:$.extraCliArgs,remoteBin:$.remoteBin},t?{onProgress:e=>{n=!0,process.stderr.write(`\r ${e}\x1b[K`)}}:{}),n&&process.stderr.write(`
506
- `)}li(a.remoteCwd),Ti(a.remoteCwd),ki($.local?`local`:$.host)}catch(e){return await X(O,e instanceof i?e.message:String(e),()=>v(1))}let o=ct($.local?`Local ssh-proxy test session\ncwd: ${a.remoteCwd}\nAuth: unix socket → local proxy`:`SSH session to ${$.host}\nRemote cwd: ${a.remoteCwd}\nAuth: unix socket -R → local proxy`,`info`);await il(O,{getFpsMetrics:k,stats:A,initialState:M},{debug:n||r,commands:Ct,initialTools:[],initialMessages:[o],mcpClients:[],autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,sshSession:a,thinkingConfig:j},wl);return}else if(t.resume||t.fromPr||x||Oe!==null){let{clearSessionCaches:e}=await import(`./caches-B8sM3Zys.js`);e();let i=null,a,o=tr(t.resume),s,c=null,l;if(t.fromPr&&(t.fromPr===!0?l=!0:typeof t.fromPr==`string`&&(l=t.fromPr)),t.resume&&typeof t.resume==`string`&&!o){let e=t.resume.trim();if(e){let t=await cn(e,{exact:!0});t.length===1?(c=t[0],o=un(c)??null):s=e}}if((Oe!==null||x)&&(await rn(),!tn(`allow_remote_sessions`)))return await X(O,`Error: Remote sessions are disabled by your organization's policy.`,()=>v(1));if(Oe!==null){let e=Oe.length>0;if(!e)return await X(O,`Error: --remote requires a description.
507
- Usage: claude --remote "your task description"`,()=>v(1));G(`tengu_remote_create_session`,{has_initial_prompt:String(e)});let t=await Ha(),i=await Mt(O,e?Oe:null,new AbortController().signal,t||void 0);if(!i)return G(`tengu_remote_create_session_error`,{error:`unable_to_create_session`}),await X(O,`Error: Unable to create remote session`,()=>v(1));G(`tengu_remote_create_session_success`,{session_id:i.id}),process.stdout.write(`Created remote session: ${i.title}\n`),process.stdout.write(`View: ${bt(i.id)}?m=0\n`),process.stdout.write(`Resume with: claude --teleport ${i.id}\n`),await v(0),process.exit(0),ui(!0),Li(Qn(i.id));let a;try{a=await zs()}catch(e){return U(Zi(e)),await X(O,`Error: ${F(e)||`Failed to authenticate`}`,()=>v(1))}let{getClaudeAIOAuthTokens:o}=await import(`./auth-DN1MUpB8.js`),s=Sc(i.id,()=>o()?.accessToken??a.accessToken,a.orgUUID,e),c=`${bt(i.id)}?m=0`,l=ct(`/remote-control is active. Code in CLI or at ${c}`,`info`),u=e?pt({content:Oe}):null,d={...M,remoteSessionUrl:c},f=gn(Ct);await il(O,{getFpsMetrics:k,stats:A,initialState:d},{debug:n||r,commands:f,initialTools:[],initialMessages:u?[l,u]:[l],mcpClients:[],autoConnectIdeFlag:g,mainThreadAgentDefinition:T,disableSlashCommands:pe,remoteSessionConfig:s,thinkingConfig:j},wl);return}else if(x){if(x===!0||x===``){G(`tengu_teleport_interactive_mode`,{}),I(`selectAndResumeTeleportTask: Starting teleport flow...`);let e=await Ol(O);e||(await v(0),process.exit(0));let{branchError:t}=await ur(e.branch);i=Bn(e.log,t)}else if(typeof x==`string`){G(`tengu_teleport_resume_session`,{mode:`direct`});try{let e=await Nr(await Vs(x));if(e.status===`mismatch`||e.status===`not_in_repo`){let t=e.sessionRepo;if(t){let e=await _c(gc(t));if(e.length>0){let n=await kl(O,{targetRepo:t,initialPaths:e});n?(process.chdir(n),Kt(n),li(n)):await v(0)}else throw new Ki(`You must run claude --teleport ${x} from a checkout of ${t}.`,N.red(`You must run claude --teleport ${x} from a checkout of ${N.bold(t)}.\n`))}}else if(e.status===`error`)throw new Ki(e.errorMessage||`Failed to validate session`,N.red(`Error: ${e.errorMessage||`Failed to validate session`}\n`));await gr();let{teleportWithProgress:t}=await import(`./TeleportProgress-C2LQVLav.js`),n=await t(O,x);Fi({sessionId:x}),i=n.messages}catch(e){e instanceof Ki?process.stderr.write(e.formattedMessage+`
508
- `):(U(e),process.stderr.write(N.red(`Error: ${F(e)}\n`))),await v(1)}}}if(o){let e=o;try{let n=performance.now(),r=await ge(c??e,void 0);if(!r)return G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),await X(O,`No conversation found with session ID: ${e}`);let i=c?.fullPath??r.fullPath;a=await dc(r,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:i},Ln),a.restoredAgentDef&&(T=a.restoredAgentDef),G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!0,resume_duration_ms:Math.round(performance.now()-n)})}catch(t){G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),U(t),await X(O,`Failed to resume session ${e}`)}}if(re)try{let e=await re,t=ca(e,e=>!e.success);t>0&&process.stderr.write(N.yellow(`Warning: ${t}/${e.length} file(s) failed to download.\n`))}catch(e){return await X(O,`Error downloading files: ${F(e)}`)}let u=a??(Array.isArray(i)?{messages:i,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:T,initialState:M,contentReplacements:void 0}:void 0);u?(id(t),await il(O,{getFpsMetrics:k,stats:A,initialState:u.initialState},{...Nn,mainThreadAgentDefinition:u.restoredAgentDef??T,initialMessages:u.messages,initialFileHistorySnapshots:u.fileHistorySnapshots,initialContentReplacements:u.contentReplacements,initialAgentName:u.agentName,initialAgentColor:u.agentColor},wl)):await Al(O,{getFpsMetrics:k,stats:A,initialState:M},mt(Oi()),{...Nn,initialSearchQuery:s,forkSession:t.forkSession,filterByPr:l})}else{let e=pn&&mn.length===0?pn:void 0;K(`action_after_hooks`),id(t);let n=null;t.deepLinkOrigin?(G(`tengu_deep_link_opened`,{has_prefill:!!t.prefill,has_repo:!!t.deepLinkRepo}),n=ct(bc({cwd:Hi(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=ct(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...mn]:mn.length>0?mn:void 0;await il(O,{getFpsMetrics:k,stats:A,initialState:M},{...Nn,initialMessages:r,pendingHookMessages:e},wl)}}).version(`0.0.11 (Work Mate)`,`-v, --version`,`Output the version number`),t.option(`-w, --worktree [name]`,`Create a new git worktree for this session (optionally specify a name)`),t.option(`--tmux`,`Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.`),Ze()&&t.addOption(new J(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new J(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new J(`--proactive`,`Start in proactive autonomous mode`)),t.addOption(new J(`--sdk-url <url>`,`Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)`).hideHelp()),t.addOption(new J(`--teleport [session]`,`Resume a teleport session, optionally specify session ID`).hideHelp()),t.addOption(new J(`--remote [description]`,`Create a remote session with the given description`).hideHelp()),K(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-Ct4Sum6A.js`);await n({debug:e,verbose:t})}),Eu(i),je()&&Du(i),i.command(`remove <name>`).description(`Remove an MCP server`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in`).action(async(e,t)=>{let{mcpRemoveHandler:n}=await import(`./mcp-Ct4Sum6A.js`);await n(e,t)}),i.command(`list`).description(`List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let{mcpListHandler:e}=await import(`./mcp-Ct4Sum6A.js`);await e()}),i.command(`get <name>`).description(`Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async e=>{let{mcpGetHandler:t}=await import(`./mcp-Ct4Sum6A.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-Ct4Sum6A.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Claude Desktop (Mac and WSL only)`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async e=>{let{mcpAddFromDesktopHandler:t}=await import(`./mcp-Ct4Sum6A.js`);await t(e)}),i.command(`reset-project-choices`).description(`Reset all approved and rejected project-scoped (.mcp.json) servers within this project`).action(async()=>{let{mcpResetChoicesHandler:e}=await import(`./mcp-Ct4Sum6A.js`);await e()}),t.command(`server`).description(`Start a Work Mate session server`).option(`--port <number>`,`HTTP port`,`0`).option(`--host <string>`,`Bind address`,`0.0.0.0`).option(`--auth-token <token>`,`Bearer token for auth`).option(`--unix <path>`,`Listen on a unix domain socket`).option(`--workspace <dir>`,`Default working directory for sessions that do not specify cwd`).option(`--idle-timeout <ms>`,`Idle timeout for detached sessions in ms (0 = never expire)`,`600000`).option(`--max-sessions <n>`,`Maximum concurrent sessions (0 = unlimited)`,`32`).action(async e=>{let{randomBytes:t}=await import(`crypto`),{startServer:n}=await import(`./server-LdbAb0sV.js`),{SessionManager:r}=await import(`./sessionManager-CPa049BO.js`),{DangerousBackend:i}=await import(`./dangerousBackend-DwcP0P08.js`),{printBanner:a}=await import(`./serverBanner-BdExKFHT.js`),{createServerLogger:o}=await import(`./serverLog-BFmvyJ93.js`),{writeServerLock:s,removeServerLock:c,probeRunningServer:l}=await import(`./lockfile-D5-j7HOZ.js`),u=await l();u&&(process.stderr.write(`A claude server is already running (pid ${u.pid}) at ${u.httpUrl}\n`),process.exit(1));let d=e.authToken??`sk-ant-cc-${t(16).toString(`base64url`)}`,f={port:parseInt(e.port,10),host:e.host,authToken:d,unix:e.unix,workspace:e.workspace,idleTimeoutMs:parseInt(e.idleTimeout,10),maxSessions:parseInt(e.maxSessions,10)},p=new r(new i,{idleTimeoutMs:f.idleTimeoutMs,maxSessions:f.maxSessions}),m=n(f,p,o()),h=m.port??f.port;a(f,d,h),await s({pid:process.pid,port:h,host:f.host,httpUrl:f.unix?`unix:${f.unix}`:`http://${f.host}:${h}`,startedAt:Date.now()});let g=!1,_=async()=>{g||(g=!0,m.stop(!0),await p.destroyAll(),await c(),process.exit(0))};process.once(`SIGINT`,()=>void _()),process.once(`SIGTERM`,()=>void _())}),t.command(`ssh <host> [dir]`).description(`Run Work Mate on a remote host over SSH. Deploys the binary and tunnels API auth back through your local machine — no remote setup needed.`).option(`--permission-mode <mode>`,`Permission mode for the remote session`).option(`--dangerously-skip-permissions`,`Skip all permission prompts on the remote (dangerous)`).option(`--remote-bin <command>`,`Custom remote binary command (skips probe/deploy). Example: --remote-bin 'bun /path/to/project/dist/cli.js'`).option(`--local`,`e2e test mode — spawn the child CLI locally (skip ssh/deploy). Exercises the auth proxy and unix-socket plumbing without a remote host.`).action(async()=>{process.stderr.write(`Usage: claude ssh <user@host | ssh-config-alias> [dir]
503
+ You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;Be=Be?`${Be}\n\n${e}`:e}let D,O,k;if(!b){let t=El(!1);O=t.getFpsMetrics,k=t.stats;let{createRoot:n}=await import(`./src-r6ZFgWPx2.js`);D=await n(t.renderOptions),G(`tengu_timer`,{event:`startup`,durationMs:Math.round(process.uptime()*1e3)}),I(`[STARTUP] Running showSetupScreens()...`);let r=Date.now(),i=await Tl(D,Ve,a,jt);I(`[STARTUP] showSetupScreens() completed in ${Date.now()-r}ms`),i&&e?.trim().toLowerCase()===`/login`&&(e=``),i&&(Xs(),rn(),Hs(),import(`./trustedDevice-BokywSKL.js`).then(e=>(e.clearTrustedDeviceToken(),e.enrollTrustedDevice())));let o=await qo();o.valid||await X(D,o.message)}if(process.exitCode!==void 0){I(`Graceful shutdown initiated, skipping further initialization`);return}if(Er(),!b){let{errors:e}=Ca(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await Dl(D,{settingsErrors:t,onExit:()=>At(1)})}let Gt=z().startupPrefetchedAt??0;p()?(I(`Skipping startup prefetches, last ran ${Math.round((Date.now()-Gt)/1e3)}s ago`),Qo()):(I(`Starting background startup prefetches${Gt>0?` last ran ${Math.round((Date.now()-Gt)/1e3)}s ago`:``}`),Ae().catch(e=>U(e)),sl(),Wo()),b||xc();let{servers:Kt}=await rt;I(`[STARTUP] MCP configs resolved in ${nt}ms (awaited at +${Date.now()-tt}ms)`);let qt={...Kt,...Ge},Jt={},Yt={};for(let[e,t]of Object.entries(qt)){let n=t;n.type===`sdk`?Jt[e]=n:Yt[e]=n}K(`action_mcp_configs_loaded`);let Xt=b?Promise.resolve({clients:[],tools:[],commands:[]}):Yn(Yt),$t=b?Promise.resolve({clients:[],tools:[],commands:[]}):et.then(e=>Object.keys(e).length>0?Yn(e):{clients:[],tools:[],commands:[]}),en=Promise.all([Xt,$t]).then(([e,t])=>({clients:[...e.clients,...t.clients],tools:Je([...e.tools,...t.tools],`name`),commands:Je([...e.commands,...t.commands],`name`)})),an=pe||fe||me||b||t.continue||t.resume?null:pt(`startup`,{agentType:w?.agentType,model:T}),ln=[];en.catch(()=>{});let un=[],fn=[],hn=[],_n=Nn(),A=_n===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)_n=!0,A={type:`adaptive`};else if(t.thinking===`disabled`)_n=!1,A={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(_n=!0,A={type:`enabled`,budgetTokens:e}):e===0&&(_n=!1,A={type:`disabled`}))}H(`info`,`started`,{version:`0.0.12`,is_native_binary:uo()}),na(async()=>{H(`info`,`exited`)}),rd({hasInitialPrompt:!!e,hasStdin:!!x,verbose:le,debug:n,debugToStderr:r,print:ue??!1,outputFormat:_??`text`,inputFormat:v??`text`,numAllowedTools:s.length,numDisallowedTools:c.length,mcpClientCount:Object.keys(qt).length,worktreeEnabled:ye,skipWebFetchPreflight:Sa().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:Ve,modeIsBypass:Ve===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:Re?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:Be?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:A,assistantActivationPath:void 0}),Vt(Yt,Ye),Hu(),Wt().then(e=>{e&&(yt&&de(yt),Pt().then(e=>{e>=2&&G(`tengu_concurrent_sessions`,{num_sessions:e})}))}),p()||(b?(await gt(),K(`action_after_plugins_init`),Un().then(()=>Ft())):gt().then(async()=>{K(`action_after_plugins_init`),await Un(),Ft()}));let bn=pe||fe?`init`:me?`maintenance`:null;if(pe){lc(),await Ce(`init`,{forceSyncExecution:!0}),await pt(`startup`,{forceSyncExecution:!0}),At(0);return}if(b){(_===`stream-json`||_===`json`)&&ta(!0),lc(),tl();let e=t.continue||t.resume||y||bn?void 0:pt(`startup`);e?.catch(()=>{}),K(`before_validateForceLoginOrg`);let n=await qo();n.valid||(process.stderr.write(n.message+`
504
+ `),process.exit(1));let r=ge?[]:jt.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),i=Qt(),a=cn({...i,mcp:{...i.mcp,clients:un,commands:hn,tools:fn},toolPermissionContext:Ye,...Xo()&&{fastMode:jo(Bt??null)},...Nt()&&E&&{advisorModel:E}},uc);De(Ye,a.getState().fastMode).then(({updateContext:e})=>{a.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&Ci(!0),mi(vo(ee));let o=(e,t)=>Object.keys(e).length===0?Promise.resolve():(a.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),ke(({client:e,tools:t,commands:n})=>{a.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:Je([...r.mcp.tools,...t],`name`),commands:Je([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>I(`[MCP] ${t} connect error: ${e}`)));K(`before_connectMcp`),await o(Yt,`regular`),K(`after_connectMcp`);let c=5e3,l=et.then(e=>{if(Object.keys(e).length>0){let t=new Set;for(let n of Object.values(e)){let e=kt(n);e&&t.add(e)}let n=new Set;for(let[e,r]of Object.entries(Yt)){if(!e.startsWith(`plugin:`))continue;let i=kt(r);i&&t.has(i)&&n.add(e)}if(n.size>0){I(`[MCP] Lazy dedup: suppressing ${n.size} plugin server(s) that duplicate claude.ai connectors: ${[...n].join(`, `)}`);for(let e of a.getState().mcp.clients)!n.has(e.name)||e.type!==`connected`||(e.client.onclose=void 0,Rr(e.name,e.config).catch(()=>{}));a.setState(e=>{let{clients:t,tools:r,commands:i,resources:a}=e.mcp;t=t.filter(e=>!n.has(e.name)),r=r.filter(e=>!e.mcpInfo||!n.has(e.mcpInfo.serverName));for(let e of n)i=On(i,e),a=se(a,e);return{...e,mcp:{...e.mcp,clients:t,tools:r,commands:i,resources:a}}})}}let{servers:t}=xt(e,Ea(Yt,(e,t)=>!t.startsWith(`plugin:`)));return o(t,`claudeai`)}),u,d=await Promise.race([l.then(()=>!1),new Promise(e=>{u=setTimeout(e=>e(!0),c,e)})]);u&&clearTimeout(u),d&&I(`[MCP] claude.ai connectors not ready after ${c}ms — proceeding; background connection continues`),K(`after_connectMcp_claudeai`),p()||(Yu(),import(`./backgroundHousekeeping-DbpTGbwl.js`).then(e=>e.startBackgroundHousekeeping())),Uu(),K(`before_print_import`);let{runHeadless:f}=await import(`./print-DmoLcwVq.js`);K(`after_print_import`),f(x,()=>a.getState(),a.setState,r,it,Jt,Rt.activeAgents,{continue:t.continue,resume:t.resume,verbose:le,outputFormat:_,jsonSchema:S,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:A,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:Re,appendSystemPrompt:Be,userSpecifiedModel:Bt,fallbackModel:Ct,teleport:y,sdkUrl:we,replayUserMessages:vt,includePartialMessages:Te,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,enableAuthStatus:t.enableAuthStatus,agent:ce,workload:t.workload,setupTrigger:bn??void 0,sessionStartHooksPromise:e});return}G(`tengu_startup_manual_model_config`,{cli_flag:t.model,env_var:process.env.ANTHROPIC_MODEL,settings_file:(Sa()||{}).model,subscriptionType:bo(),agent:zt});let Sn=Cc(T),wn=[];Ue&&wn.push({key:`permission-mode-notification`,text:Ue,priority:`high`}),Sn&&wn.push({key:`model-deprecation-warning`,text:Sn,color:`warning`,priority:`high`});let Tn={...Ye},Dn=Ma(),j={settings:Sa(),tasks:{},agentNameRegistry:new Map,verbose:le??z().verbose??!1,mainLoopModel:Ut,mainLoopModelForSession:null,expandedView:z().showExpandedTodos?`tasks`:`none`,selectedIPAgentIndex:-1,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:Tn,agent:w?.agentType,agentDefinitions:Rt,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,remoteSessionUrl:void 0,remoteConnectionStatus:`connecting`,remoteBackgroundTaskCount:0,replBridgeEnabled:Dn||!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:Ie,showRemoteCallout:!1,notifications:{current:null,queue:wn},elicitation:{queue:[]},todos:{},remoteAgentTaskSuggestions:[],fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:We(),thinkingEnabled:_n,promptSuggestionEnabled:Vn(),sessionHooks:new Map,inbox:{messages:[]},promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:re,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:x?{message:mt({content:String(x)})}:null,activeOverlays:new Set,fastMode:jo(T),...Nt()&&E&&{advisorModel:E}};x&&Qe(String(x));let An=fn;V(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{Gu(),Uu()});let Mn={debug:n||r,commands:[...jt,...hn],initialTools:An,mcpClients:un,autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:ge,dynamicMcpConfig:Ge,strictMcpConfig:Ke,systemPrompt:Re,appendSystemPrompt:Be,thinkingConfig:A},Fn={mainThreadAgentDefinition:w,agentDefinitions:Rt,currentCwd:Et,cliAgents:It,initialState:j};if(t.continue){let e=!1;try{let n=performance.now(),{clearSessionCaches:r}=await import(`./caches-Dtjmjm6G.js`);r();let i=await Or(void 0,void 0);if(!i)return G(`tengu_continue`,{success:!1}),await X(D,`No conversation found to continue`);let a=await dc(i,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:i.fullPath},Fn);a.restoredAgentDef&&(w=a.restoredAgentDef),id(t),G(`tengu_continue`,{success:!0,resume_duration_ms:Math.round(performance.now()-n)}),e=!0,await il(D,{getFpsMetrics:O,stats:k,initialState:a.initialState},{...Mn,mainThreadAgentDefinition:a.restoredAgentDef??w,initialMessages:a.messages,initialFileHistorySnapshots:a.fileHistorySnapshots,initialContentReplacements:a.contentReplacements,initialAgentName:a.agentName,initialAgentColor:a.agentColor},wl)}catch(t){e||G(`tengu_continue`,{success:!1}),U(t),process.exit(1)}}else if(Q?.url){let e;try{let t=await Bu({serverUrl:Q.url,authToken:Q.authToken,cwd:ki(),dangerouslySkipPermissions:Q.dangerouslySkipPermissions});t.workDir&&(ui(t.workDir),Ei(t.workDir)),Ai(Q.url),e=t.config}catch(e){return await X(D,e instanceof zu?e.message:String(e),()=>C(1))}let t=lt(`Connected to server at ${Q.url}\nSession: ${e.sessionId}`,`info`);await il(D,{getFpsMetrics:O,stats:k,initialState:j},{debug:n||r,commands:jt,initialTools:[],initialMessages:[t],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:ge,directConnectConfig:e,thinkingConfig:A},wl);return}else if($?.host){let{createSSHSession:e,createLocalSSHSession:t,SSHSessionError:i}=await import(`./createSSHSession-DjLSGm-0.js`),a;try{if($.local)process.stderr.write(`Starting local ssh-proxy test session...
505
+ `),a=await t({cwd:$.cwd,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions});else{process.stderr.write(`Connecting to ${$.host}…\n`);let t=process.stderr.isTTY,n=!1;a=await e({host:$.host,cwd:$.cwd,localVersion:`0.0.12`,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions,extraCliArgs:$.extraCliArgs,remoteBin:$.remoteBin},t?{onProgress:e=>{n=!0,process.stderr.write(`\r ${e}\x1b[K`)}}:{}),n&&process.stderr.write(`
506
+ `)}ui(a.remoteCwd),Ei(a.remoteCwd),Ai($.local?`local`:$.host)}catch(e){return await X(D,e instanceof i?e.message:String(e),()=>C(1))}let o=lt($.local?`Local ssh-proxy test session\ncwd: ${a.remoteCwd}\nAuth: unix socket → local proxy`:`SSH session to ${$.host}\nRemote cwd: ${a.remoteCwd}\nAuth: unix socket -R → local proxy`,`info`);await il(D,{getFpsMetrics:O,stats:k,initialState:j},{debug:n||r,commands:jt,initialTools:[],initialMessages:[o],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:ge,sshSession:a,thinkingConfig:A},wl);return}else if(t.resume||t.fromPr||y||Pe!==null){let{clearSessionCaches:e}=await import(`./caches-Dtjmjm6G.js`);e();let i=null,a,o=yn(t.resume),s,c=null,l;if(t.fromPr&&(t.fromPr===!0?l=!0:typeof t.fromPr==`string`&&(l=t.fromPr)),t.resume&&typeof t.resume==`string`&&!o){let e=t.resume.trim();if(e){let t=await dn(e,{exact:!0});t.length===1?(c=t[0],o=pn(c)??null):s=e}}if((Pe!==null||y)&&(await Kn(),!kn(`allow_remote_sessions`)))return await X(D,`Error: Remote sessions are disabled by your organization's policy.`,()=>C(1));if(Pe!==null){let e=Pe.length>0;if(!e)return await X(D,`Error: --remote requires a description.
507
+ Usage: claude --remote "your task description"`,()=>C(1));G(`tengu_remote_create_session`,{has_initial_prompt:String(e)});let t=await Ha(),i=await Pn(D,e?Pe:null,new AbortController().signal,t||void 0);if(!i)return G(`tengu_remote_create_session_error`,{error:`unable_to_create_session`}),await X(D,`Error: Unable to create remote session`,()=>C(1));G(`tengu_remote_create_session_success`,{session_id:i.id}),process.stdout.write(`Created remote session: ${i.title}\n`),process.stdout.write(`View: ${Se(i.id)}?m=0\n`),process.stdout.write(`Resume with: claude --teleport ${i.id}\n`),await C(0),process.exit(0),di(!0),Ri(ze(i.id));let a;try{a=await zs()}catch(e){return U(Zi(e)),await X(D,`Error: ${F(e)||`Failed to authenticate`}`,()=>C(1))}let{getClaudeAIOAuthTokens:o}=await import(`./auth-DrD9DW6X.js`),s=Sc(i.id,()=>o()?.accessToken??a.accessToken,a.orgUUID,e),c=`${Se(i.id)}?m=0`,l=lt(`/remote-control is active. Code in CLI or at ${c}`,`info`),u=e?mt({content:Pe}):null,d={...j,remoteSessionUrl:c},f=Cn(jt);await il(D,{getFpsMetrics:O,stats:k,initialState:d},{debug:n||r,commands:f,initialTools:[],initialMessages:u?[l,u]:[l],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:ge,remoteSessionConfig:s,thinkingConfig:A},wl);return}else if(y){if(y===!0||y===``){G(`tengu_teleport_interactive_mode`,{}),I(`selectAndResumeTeleportTask: Starting teleport flow...`);let e=await Ol(D);e||(await C(0),process.exit(0));let{branchError:t}=await ur(e.branch);i=gr(e.log,t)}else if(typeof y==`string`){G(`tengu_teleport_resume_session`,{mode:`direct`});try{let e=await sn(await Vs(y));if(e.status===`mismatch`||e.status===`not_in_repo`){let t=e.sessionRepo;if(t){let e=await _c(gc(t));if(e.length>0){let n=await kl(D,{targetRepo:t,initialPaths:e});n?(process.chdir(n),Tt(n),ui(n)):await C(0)}else throw new Ki(`You must run claude --teleport ${y} from a checkout of ${t}.`,M.red(`You must run claude --teleport ${y} from a checkout of ${M.bold(t)}.\n`))}}else if(e.status===`error`)throw new Ki(e.errorMessage||`Failed to validate session`,M.red(`Error: ${e.errorMessage||`Failed to validate session`}\n`));await mn();let{teleportWithProgress:t}=await import(`./TeleportProgress-zmdAsogZ.js`),n=await t(D,y);Ii({sessionId:y}),i=n.messages}catch(e){e instanceof Ki?process.stderr.write(e.formattedMessage+`
508
+ `):(U(e),process.stderr.write(M.red(`Error: ${F(e)}\n`))),await C(1)}}}if(o){let e=o;try{let n=performance.now(),r=await Or(c??e,void 0);if(!r)return G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),await X(D,`No conversation found with session ID: ${e}`);let i=c?.fullPath??r.fullPath;a=await dc(r,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:i},Fn),a.restoredAgentDef&&(w=a.restoredAgentDef),G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!0,resume_duration_ms:Math.round(performance.now()-n)})}catch(t){G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),U(t),await X(D,`Failed to resume session ${e}`)}}if(ie)try{let e=await ie,t=ca(e,e=>!e.success);t>0&&process.stderr.write(M.yellow(`Warning: ${t}/${e.length} file(s) failed to download.\n`))}catch(e){return await X(D,`Error downloading files: ${F(e)}`)}let u=a??(Array.isArray(i)?{messages:i,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:w,initialState:j,contentReplacements:void 0}:void 0);u?(id(t),await il(D,{getFpsMetrics:O,stats:k,initialState:u.initialState},{...Mn,mainThreadAgentDefinition:u.restoredAgentDef??w,initialMessages:u.messages,initialFileHistorySnapshots:u.fileHistorySnapshots,initialContentReplacements:u.contentReplacements,initialAgentName:u.agentName,initialAgentColor:u.agentColor},wl)):await Al(D,{getFpsMetrics:O,stats:k,initialState:j},ht(ki()),{...Mn,initialSearchQuery:s,forkSession:t.forkSession,filterByPr:l})}else{let e=an&&ln.length===0?an:void 0;K(`action_after_hooks`),id(t);let n=null;t.deepLinkOrigin?(G(`tengu_deep_link_opened`,{has_prefill:!!t.prefill,has_repo:!!t.deepLinkRepo}),n=lt(bc({cwd:Ui(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=lt(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...ln]:ln.length>0?ln:void 0;await il(D,{getFpsMetrics:O,stats:k,initialState:j},{...Mn,initialMessages:r,pendingHookMessages:e},wl)}}).version(`0.0.12 (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.`),Gn()&&t.addOption(new J(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new J(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new J(`--proactive`,`Start in proactive autonomous mode`)),t.addOption(new J(`--sdk-url <url>`,`Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)`).hideHelp()),t.addOption(new J(`--teleport [session]`,`Resume a teleport session, optionally specify session ID`).hideHelp()),t.addOption(new J(`--remote [description]`,`Create a remote session with the given description`).hideHelp()),K(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-DMBoeQzm.js`);await n({debug:e,verbose:t})}),Eu(i),Mr()&&Du(i),i.command(`remove <name>`).description(`Remove an MCP server`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in`).action(async(e,t)=>{let{mcpRemoveHandler:n}=await import(`./mcp-DMBoeQzm.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-DMBoeQzm.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-DMBoeQzm.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-DMBoeQzm.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Claude Desktop (Mac and WSL only)`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async e=>{let{mcpAddFromDesktopHandler:t}=await import(`./mcp-DMBoeQzm.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-DMBoeQzm.js`);await e()}),t.command(`server`).description(`Start a Work Mate session server`).option(`--port <number>`,`HTTP port`,`0`).option(`--host <string>`,`Bind address`,`0.0.0.0`).option(`--auth-token <token>`,`Bearer token for auth`).option(`--unix <path>`,`Listen on a unix domain socket`).option(`--workspace <dir>`,`Default working directory for sessions that do not specify cwd`).option(`--idle-timeout <ms>`,`Idle timeout for detached sessions in ms (0 = never expire)`,`600000`).option(`--max-sessions <n>`,`Maximum concurrent sessions (0 = unlimited)`,`32`).action(async e=>{let{randomBytes:t}=await import(`crypto`),{startServer:n}=await import(`./server-LdbAb0sV.js`),{SessionManager:r}=await import(`./sessionManager-CPa049BO.js`),{DangerousBackend:i}=await import(`./dangerousBackend-DwcP0P08.js`),{printBanner:a}=await import(`./serverBanner-BdExKFHT.js`),{createServerLogger:o}=await import(`./serverLog-BFmvyJ93.js`),{writeServerLock:s,removeServerLock:c,probeRunningServer:l}=await import(`./lockfile-D5-j7HOZ.js`),u=await l();u&&(process.stderr.write(`A claude server is already running (pid ${u.pid}) at ${u.httpUrl}\n`),process.exit(1));let d=e.authToken??`sk-ant-cc-${t(16).toString(`base64url`)}`,f={port:parseInt(e.port,10),host:e.host,authToken:d,unix:e.unix,workspace:e.workspace,idleTimeoutMs:parseInt(e.idleTimeout,10),maxSessions:parseInt(e.maxSessions,10)},p=new r(new i,{idleTimeoutMs:f.idleTimeoutMs,maxSessions:f.maxSessions}),m=n(f,p,o()),ee=m.port??f.port;a(f,d,ee),await s({pid:process.pid,port:ee,host:f.host,httpUrl:f.unix?`unix:${f.unix}`:`http://${f.host}:${ee}`,startedAt:Date.now()});let h=!1,g=async()=>{h||(h=!0,m.stop(!0),await p.destroyAll(),await c(),process.exit(0))};process.once(`SIGINT`,()=>void g()),process.once(`SIGTERM`,()=>void g())}),t.command(`ssh <host> [dir]`).description(`Run Work Mate on a remote host over SSH. Deploys the binary and tunnels API auth back through your local machine — no remote setup needed.`).option(`--permission-mode <mode>`,`Permission mode for the remote session`).option(`--dangerously-skip-permissions`,`Skip all permission prompts on the remote (dangerous)`).option(`--remote-bin <command>`,`Custom remote binary command (skips probe/deploy). Example: --remote-bin 'bun /path/to/project/dist/cli.js'`).option(`--local`,`e2e test mode — spawn the child CLI locally (skip ssh/deploy). Exercises the auth proxy and unix-socket plumbing without a remote host.`).action(async()=>{process.stderr.write(`Usage: claude ssh <user@host | ssh-config-alias> [dir]
509
509
 
510
510
  Runs Work Mate on a remote Linux host. You don't need to install
511
511
  anything on the remote — the binary is
512
512
  deployed over SSH and API auth tunnels back through your local machine.
513
- `),process.exit(1)}),t.command(`open <cc-url>`).description(`Connect to a Work Mate server (internal — use cc:// URLs)`).option(`-p, --print [prompt]`,`Print mode (headless)`).option(`--output-format <format>`,`Output format: text, json, stream-json`,`text`).action(async(e,t)=>{let{parseConnectUrl:n}=await import(`./parseConnectUrl-BiyKR5-x.js`),{serverUrl:r,authToken:i}=n(e),a;try{let e=await Bu({serverUrl:r,authToken:i,cwd:Oi(),dangerouslySkipPermissions:Q?.dangerouslySkipPermissions});e.workDir&&(li(e.workDir),Ti(e.workDir)),ki(r),a=e.config}catch(e){console.error(e instanceof zu?e.message:String(e)),process.exit(1)}let{runConnectHeadless:o}=await import(`./connectHeadless-CqRoEtrg.js`),s=typeof t.print==`string`?t.print:``,c=t.print===!0;await o(a,s,t.outputFormat,c)});let a=t.command(`auth`).description(`Manage authentication`).configureHelp(e());a.command(`login`).description(`Sign in`).option(`--email <email>`,`Pre-populate email address on the login page`).option(`--sso`,`Force SSO login flow`).option(`--console`,`Use Console (API usage billing) instead of Claude subscription`).option(`--claudeai`,`Use Claude subscription (default)`).action(async({email:e,sso:t,console:n,claudeai:r})=>{let{authLogin:i}=await import(`./auth-DGZzCbU0.js`);await i({email:e,sso:t,console:n,claudeai:r})}),a.command(`status`).description(`Show authentication status`).option(`--json`,`Output as JSON (default)`).option(`--text`,`Output as human-readable text`).action(async e=>{let{authStatus:t}=await import(`./auth-DGZzCbU0.js`);await t(e)});let o=()=>new J(`--cowork`,`Use cowork_plugins directory`).hideHelp(),s=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());s.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(o()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(o()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-CBW7kPyp.js`);await t(e)});let c=s.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());if(c.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(o()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),c.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(o()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-CBW7kPyp.js`);await t(e)}),c.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(o()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),c.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(o()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(o()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.claude/plugins/data/{id}/)`).addOption(o()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${oc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${oc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),s.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${ic.join(`, `)} (default: user)`).addOption(o()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-CBW7kPyp.js`);await n(e,t)}),t.command(`setup-token`).description(`Set up a long-lived authentication token (requires Claude subscription)`).action(async()=>{let[{setupTokenHandler:e},{createRoot:t}]=await Promise.all([import(`./util-B4oMhJKh.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(mc(!1)))}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-CMC0iQP4.js`);await e(),process.exit(0)}),kr()!==`disabled`){let e=t.command(`auto-mode`).description(`Inspect auto mode classifier configuration`);e.command(`defaults`).description(`Print the default auto mode environment, allow, and deny rules as JSON`).action(async()=>{let{autoModeDefaultsHandler:e}=await import(`./autoMode-CBtY7ACs.js`);e(),process.exit(0)}),e.command(`config`).description(`Print the effective auto mode config as JSON: your settings where set, defaults otherwise`).action(async()=>{let{autoModeConfigHandler:e}=await import(`./autoMode-CBtY7ACs.js`);e(),process.exit(0)}),e.command(`critique`).description(`Get AI feedback on your custom auto mode rules`).option(`--model <model>`,`Override which model is used`).action(async e=>{let{autoModeCritiqueHandler:t}=await import(`./autoMode-CBtY7ACs.js`);await t(e),process.exit()})}{let e=t.command(`autonomy`).description(`Inspect and manage automatic autonomy runs and flows`);e.command(`status`).description(`Print autonomy run, flow, team, pipe, and remote-control status`).option(`--deep`,`Include teams, pipes, daemon, and remote-control sections`).action(async e=>{let{autonomyStatusHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)}),e.command(`runs [limit]`).description(`List recent autonomy runs`).action(async e=>{let{autonomyRunsHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)}),e.command(`flows [limit]`).description(`List recent autonomy flows`).action(async e=>{let{autonomyFlowsHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)});let n=e.command(`flow <flowId>`).description(`Inspect a single autonomy flow`).action(async e=>{let{autonomyFlowHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)});n.command(`cancel <flowId>`).description(`Cancel a queued, waiting, or running autonomy flow`).action(async e=>{let{autonomyFlowCancelHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)}),n.command(`resume <flowId>`).description(`Resume a waiting autonomy flow`).action(async e=>{let{autonomyFlowResumeHandler:t}=await import(`./autonomy-lJV7yWUl.js`);await t(e),process.exit(0)})}return t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-B4oMhJKh.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(mc(!1)))}),t.command(`install [target]`).description(`Install Work Mate native build. Use [target] to specify version (stable, latest, or specific version)`).option(`--force`,`Force installation even if already installed`).action(async(e,t)=>{let{installHandler:n}=await import(`./util-B4oMhJKh.js`);await n(e,t)}),t.command(`update`).description(`Update workmate to the latest version`).action(async()=>{let{updateCCB:e}=await import(`./updateCCB-C6XftzIG.js`);await e()}),K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),K(`main_after_run`),ao(),t}async function rd({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktreeEnabled:d,skipWebFetchPreflight:f,githubActionInputs:h,dangerouslySkipPermissionsPassed:g,permissionMode:_,modeIsBypass:ee,allowDangerouslySkipPermissionsPassed:te,systemPromptFlag:v,appendSystemPromptFlag:ne,thinkingConfig:re,assistantActivationPath:ie}){try{G(`tengu_init`,{entrypoint:`claude`,hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktree:d,skipWebFetchPreflight:f,...h&&{githubActionInputs:h},dangerouslySkipPermissionsPassed:g,permissionMode:_,modeIsBypass:ee,inProtectedNamespace:m(),allowDangerouslySkipPermissionsPassed:te,thinkingType:re.type,...re.type===`enabled`&&{thinkingBudgetTokens:re.budgetTokens},...v&&{systemPromptFlag:v},...ne&&{appendSystemPromptFlag:ne},is_simple:p()||void 0,...ie&&{assistantActivationPath:ie},autoUpdatesChannel:Sa().autoUpdatesChannel??`latest`})}catch(e){U(e)}}function id(t){if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let t=(xs(),e(Cs));t.isProactiveActive()||t.activateProactive(`command`)}}function ad(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(Yr)}export{ed as main};
513
+ `),process.exit(1)}),t.command(`open <cc-url>`).description(`Connect to a Work Mate server (internal — use cc:// URLs)`).option(`-p, --print [prompt]`,`Print mode (headless)`).option(`--output-format <format>`,`Output format: text, json, stream-json`,`text`).action(async(e,t)=>{let{parseConnectUrl:n}=await import(`./parseConnectUrl-BiyKR5-x.js`),{serverUrl:r,authToken:i}=n(e),a;try{let e=await Bu({serverUrl:r,authToken:i,cwd:ki(),dangerouslySkipPermissions:Q?.dangerouslySkipPermissions});e.workDir&&(ui(e.workDir),Ei(e.workDir)),Ai(r),a=e.config}catch(e){console.error(e instanceof zu?e.message:String(e)),process.exit(1)}let{runConnectHeadless:o}=await import(`./connectHeadless-CqRoEtrg.js`),s=typeof t.print==`string`?t.print:``,c=t.print===!0;await o(a,s,t.outputFormat,c)});let a=t.command(`auth`).description(`Manage authentication`).configureHelp(e());a.command(`login`).description(`Sign in`).option(`--email <email>`,`Pre-populate email address on the login page`).option(`--sso`,`Force SSO login flow`).option(`--console`,`Use Console (API usage billing) instead of Claude subscription`).option(`--claudeai`,`Use Claude subscription (default)`).action(async({email:e,sso:t,console:n,claudeai:r})=>{let{authLogin:i}=await import(`./auth-CNCehj7y.js`);await i({email:e,sso:t,console:n,claudeai:r})}),a.command(`status`).description(`Show authentication status`).option(`--json`,`Output as JSON (default)`).option(`--text`,`Output as human-readable text`).action(async e=>{let{authStatus:t}=await import(`./auth-CNCehj7y.js`);await t(e)});let o=()=>new J(`--cowork`,`Use cowork_plugins directory`).hideHelp(),s=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());s.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(o()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),s.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(o()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-BMZ3aYKP.js`);await t(e)});let c=s.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());if(c.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(o()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),c.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(o()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-BMZ3aYKP.js`);await t(e)}),c.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(o()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),c.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(o()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),s.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(o()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),s.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.workmate/plugins/data/{id}/)`).addOption(o()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),s.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${oc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),s.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${oc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),s.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${ic.join(`, `)} (default: user)`).addOption(o()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-BMZ3aYKP.js`);await n(e,t)}),t.command(`setup-token`).description(`Set up a long-lived authentication token (requires Claude subscription)`).action(async()=>{let[{setupTokenHandler:e},{createRoot:t}]=await Promise.all([import(`./util-BfqXOA-P.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(mc(!1)))}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-BT82hwBN.js`);await e(),process.exit(0)}),Nr()!==`disabled`){let e=t.command(`auto-mode`).description(`Inspect auto mode classifier configuration`);e.command(`defaults`).description(`Print the default auto mode environment, allow, and deny rules as JSON`).action(async()=>{let{autoModeDefaultsHandler:e}=await import(`./autoMode-C2lnBot9.js`);e(),process.exit(0)}),e.command(`config`).description(`Print the effective auto mode config as JSON: your settings where set, defaults otherwise`).action(async()=>{let{autoModeConfigHandler:e}=await import(`./autoMode-C2lnBot9.js`);e(),process.exit(0)}),e.command(`critique`).description(`Get AI feedback on your custom auto mode rules`).option(`--model <model>`,`Override which model is used`).action(async e=>{let{autoModeCritiqueHandler:t}=await import(`./autoMode-C2lnBot9.js`);await t(e),process.exit()})}return t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-BfqXOA-P.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(mc(!1)))}),t.command(`install [target]`).description(`Install Work Mate native build. Use [target] to specify version (stable, latest, or specific version)`).option(`--force`,`Force installation even if already installed`).action(async(e,t)=>{let{installHandler:n}=await import(`./util-BfqXOA-P.js`);await n(e,t)}),t.command(`update`).description(`Update workmate to the latest version`).action(async()=>{let{updateCCB:e}=await import(`./updateCCB-CzBxsuJe.js`);await e()}),K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),K(`main_after_run`),ao(),t}async function rd({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktreeEnabled:d,skipWebFetchPreflight:f,githubActionInputs:ee,dangerouslySkipPermissionsPassed:h,permissionMode:g,modeIsBypass:te,allowDangerouslySkipPermissionsPassed:ne,systemPromptFlag:re,appendSystemPromptFlag:ie,thinkingConfig:ae,assistantActivationPath:oe}){try{G(`tengu_init`,{entrypoint:`claude`,hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktree:d,skipWebFetchPreflight:f,...ee&&{githubActionInputs:ee},dangerouslySkipPermissionsPassed:h,permissionMode:g,modeIsBypass:te,inProtectedNamespace:m(),allowDangerouslySkipPermissionsPassed:ne,thinkingType:ae.type,...ae.type===`enabled`&&{thinkingBudgetTokens:ae.budgetTokens},...re&&{systemPromptFlag:re},...ie&&{appendSystemPromptFlag:ie},is_simple:p()||void 0,...oe&&{assistantActivationPath:oe},autoUpdatesChannel:Sa().autoUpdatesChannel??`latest`})}catch(e){U(e)}}function id(t){if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let t=(xs(),e(Cs));t.isProactiveActive()||t.activateProactive(`command`)}}function ad(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(Xr)}export{ed as main};