tenjin-cli 0.1.0-alpha.30 → 0.1.0-alpha.32

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 (280) hide show
  1. package/README.md +65 -116
  2. package/dist/{_esm-CE7KNONL.js → _esm-RLLC72MS.js} +127 -131
  3. package/dist/alive-MROUMFH3.js +38 -0
  4. package/dist/auto-update-OPWMRZLS.js +22 -0
  5. package/dist/{ccip-7RMRLAGV.js → ccip-DHDFKTQV.js} +2 -2
  6. package/dist/chunk-2GNOFONN.js +560 -0
  7. package/dist/chunk-2GNOFONN.js.map +1 -0
  8. package/dist/{chunk-TTNESUPQ.js → chunk-2GP3HRYK.js} +2120 -193
  9. package/dist/chunk-2GP3HRYK.js.map +1 -0
  10. package/dist/chunk-3623BLPV.js +184 -0
  11. package/dist/chunk-3623BLPV.js.map +1 -0
  12. package/dist/chunk-3AIHRXKO.js +72 -0
  13. package/dist/chunk-3AIHRXKO.js.map +1 -0
  14. package/dist/chunk-3DIL66VX.js +120 -0
  15. package/dist/chunk-3DIL66VX.js.map +1 -0
  16. package/dist/{chunk-S4SAZ7OD.js → chunk-3FMZGI7I.js} +12 -2
  17. package/dist/{chunk-S4SAZ7OD.js.map → chunk-3FMZGI7I.js.map} +1 -1
  18. package/dist/chunk-3UCIG4TG.js +65 -0
  19. package/dist/chunk-3UCIG4TG.js.map +1 -0
  20. package/dist/{chunk-LFZJM56J.js → chunk-445VQTVM.js} +3 -3
  21. package/dist/{chunk-A36LQPHV.js → chunk-4LMUQMBH.js} +1 -1
  22. package/dist/{chunk-A36LQPHV.js.map → chunk-4LMUQMBH.js.map} +1 -1
  23. package/dist/{chunk-RAULEAZ6.js → chunk-4USCZ2NI.js} +3 -3
  24. package/dist/chunk-62KNUYWD.js +111 -0
  25. package/dist/chunk-62KNUYWD.js.map +1 -0
  26. package/dist/{chunk-POUWHWID.js → chunk-6CMM6YCB.js} +3 -3
  27. package/dist/{chunk-POUWHWID.js.map → chunk-6CMM6YCB.js.map} +1 -1
  28. package/dist/chunk-7WEQQJLG.js +68 -0
  29. package/dist/chunk-7WEQQJLG.js.map +1 -0
  30. package/dist/{chunk-3O2BQIF6.js → chunk-AD226HDR.js} +344 -534
  31. package/dist/chunk-AD226HDR.js.map +1 -0
  32. package/dist/chunk-ADV4LDTB.js +106 -0
  33. package/dist/chunk-ADV4LDTB.js.map +1 -0
  34. package/dist/{chunk-AWFUPKTM.js → chunk-AV5NZMYO.js} +15 -7
  35. package/dist/{chunk-AWFUPKTM.js.map → chunk-AV5NZMYO.js.map} +1 -1
  36. package/dist/chunk-B7EM4GGF.js +198 -0
  37. package/dist/chunk-B7EM4GGF.js.map +1 -0
  38. package/dist/chunk-BFDQ4WNW.js +119 -0
  39. package/dist/chunk-BFDQ4WNW.js.map +1 -0
  40. package/dist/{chunk-OSYTBCUC.js → chunk-BI673VEJ.js} +531 -503
  41. package/dist/chunk-BI673VEJ.js.map +1 -0
  42. package/dist/chunk-CEXSOI5R.js +808 -0
  43. package/dist/chunk-CEXSOI5R.js.map +1 -0
  44. package/dist/{chunk-OK2TDZQU.js → chunk-CISYM4EO.js} +9 -7
  45. package/dist/chunk-CISYM4EO.js.map +1 -0
  46. package/dist/{chunk-VFMQTSXG.js → chunk-D3ZURCG7.js} +3 -3
  47. package/dist/chunk-D5TOQSO4.js +474 -0
  48. package/dist/chunk-D5TOQSO4.js.map +1 -0
  49. package/dist/{chunk-P7LABKCW.js → chunk-DOQGNFHM.js} +33 -2
  50. package/dist/{chunk-P7LABKCW.js.map → chunk-DOQGNFHM.js.map} +1 -1
  51. package/dist/{chunk-QUVVWYJW.js → chunk-DRDUIZIA.js} +11 -9
  52. package/dist/{chunk-QUVVWYJW.js.map → chunk-DRDUIZIA.js.map} +1 -1
  53. package/dist/{chunk-O2FRQ2L2.js → chunk-DW4YTVR3.js} +5 -65
  54. package/dist/chunk-DW4YTVR3.js.map +1 -0
  55. package/dist/chunk-E7LGOMH6.js +449 -0
  56. package/dist/chunk-E7LGOMH6.js.map +1 -0
  57. package/dist/chunk-E7SW44LM.js +138 -0
  58. package/dist/chunk-E7SW44LM.js.map +1 -0
  59. package/dist/chunk-EDJWHDDL.js +33 -0
  60. package/dist/chunk-EDJWHDDL.js.map +1 -0
  61. package/dist/chunk-F3ED5WTR.js +13 -0
  62. package/dist/chunk-F3ED5WTR.js.map +1 -0
  63. package/dist/chunk-G75OPGAK.js +111 -0
  64. package/dist/chunk-G75OPGAK.js.map +1 -0
  65. package/dist/{chunk-YFQOA5AU.js → chunk-GAKUQHKA.js} +13 -17
  66. package/dist/{chunk-YFQOA5AU.js.map → chunk-GAKUQHKA.js.map} +1 -1
  67. package/dist/{chunk-PAYV4XUA.js → chunk-HDPUXS3Z.js} +20 -49
  68. package/dist/chunk-HDPUXS3Z.js.map +1 -0
  69. package/dist/{chunk-ORWL5BSN.js → chunk-HGZEPQUT.js} +2 -2
  70. package/dist/{chunk-HPWO4O6S.js → chunk-HREHWL32.js} +4 -4
  71. package/dist/{chunk-HPWO4O6S.js.map → chunk-HREHWL32.js.map} +1 -1
  72. package/dist/{chunk-VZGAONSJ.js → chunk-I5TDIUKM.js} +16 -35
  73. package/dist/chunk-I5TDIUKM.js.map +1 -0
  74. package/dist/{chunk-7QKHZQKW.js → chunk-IADZOXKN.js} +39 -6
  75. package/dist/chunk-IADZOXKN.js.map +1 -0
  76. package/dist/{chunk-U6YQ6FRI.js → chunk-IDTRSAHE.js} +32 -12
  77. package/dist/chunk-IDTRSAHE.js.map +1 -0
  78. package/dist/{chunk-SPAVAYSW.js → chunk-JEVQ5LKO.js} +7 -5
  79. package/dist/{chunk-SPAVAYSW.js.map → chunk-JEVQ5LKO.js.map} +1 -1
  80. package/dist/{chunk-EBVIKMCH.js → chunk-JKKAIPTU.js} +2 -2
  81. package/dist/chunk-JNJWBTU2.js +3497 -0
  82. package/dist/chunk-JNJWBTU2.js.map +1 -0
  83. package/dist/{chunk-TTBKWWTV.js → chunk-JRZBBPO6.js} +390 -146
  84. package/dist/chunk-JRZBBPO6.js.map +1 -0
  85. package/dist/{chunk-WVUSXNIE.js → chunk-MPZUYCAP.js} +9 -2
  86. package/dist/{chunk-WVUSXNIE.js.map → chunk-MPZUYCAP.js.map} +1 -1
  87. package/dist/{chunk-SJLTEINJ.js → chunk-OJNTCYQQ.js} +17 -1
  88. package/dist/chunk-OJNTCYQQ.js.map +1 -0
  89. package/dist/{chunk-IOODYAXL.js → chunk-OTWLERSW.js} +25 -6
  90. package/dist/chunk-OTWLERSW.js.map +1 -0
  91. package/dist/{chunk-AWQPGIR6.js → chunk-PJNENX2A.js} +1535 -422
  92. package/dist/chunk-PJNENX2A.js.map +1 -0
  93. package/dist/{chunk-KHE6L6TD.js → chunk-PKHI276N.js} +97 -11
  94. package/dist/chunk-PKHI276N.js.map +1 -0
  95. package/dist/{chunk-YHKXNYTB.js → chunk-QF3LSMGS.js} +2 -2
  96. package/dist/chunk-QXP3Z3JN.js +131 -0
  97. package/dist/chunk-QXP3Z3JN.js.map +1 -0
  98. package/dist/{chunk-XZKD7DIF.js → chunk-RL5UUDT4.js} +3 -3
  99. package/dist/{chunk-XZKD7DIF.js.map → chunk-RL5UUDT4.js.map} +1 -1
  100. package/dist/chunk-SFASB5FL.js +69 -0
  101. package/dist/chunk-SFASB5FL.js.map +1 -0
  102. package/dist/{chunk-WO5BJNIB.js → chunk-SNNSAGMT.js} +7273 -2741
  103. package/dist/chunk-SNNSAGMT.js.map +1 -0
  104. package/dist/{chunk-NZIP4PA2.js → chunk-SO3XRZPX.js} +3 -3
  105. package/dist/chunk-SYOS5CAC.js +176 -0
  106. package/dist/chunk-SYOS5CAC.js.map +1 -0
  107. package/dist/chunk-TAW4UFFF.js +293 -0
  108. package/dist/chunk-TAW4UFFF.js.map +1 -0
  109. package/dist/chunk-TF5HCP33.js +271 -0
  110. package/dist/chunk-TF5HCP33.js.map +1 -0
  111. package/dist/{chunk-AKWGE6JQ.js → chunk-UUGOUOVT.js} +37 -2
  112. package/dist/chunk-UUGOUOVT.js.map +1 -0
  113. package/dist/{chunk-AEG2PXBP.js → chunk-V2LQLN5H.js} +7 -7
  114. package/dist/{chunk-KYFZTGMC.js → chunk-VJUVFZ2D.js} +5 -3
  115. package/dist/{chunk-KYFZTGMC.js.map → chunk-VJUVFZ2D.js.map} +1 -1
  116. package/dist/{chunk-JMM6YE7J.js → chunk-VOZA6O7K.js} +708 -709
  117. package/dist/chunk-VOZA6O7K.js.map +1 -0
  118. package/dist/{chunk-5LJCEMFD.js → chunk-VUGQTZ2L.js} +209 -77
  119. package/dist/chunk-VUGQTZ2L.js.map +1 -0
  120. package/dist/chunk-WOM257PW.js +393 -0
  121. package/dist/chunk-WOM257PW.js.map +1 -0
  122. package/dist/chunk-WYXUQGOL.js +191 -0
  123. package/dist/chunk-WYXUQGOL.js.map +1 -0
  124. package/dist/chunk-X5ZBP3IY.js +97 -0
  125. package/dist/chunk-X5ZBP3IY.js.map +1 -0
  126. package/dist/chunk-XQJXNMSB.js +23 -0
  127. package/dist/chunk-XQJXNMSB.js.map +1 -0
  128. package/dist/chunk-Y527D4TV.js +56 -0
  129. package/dist/chunk-Y527D4TV.js.map +1 -0
  130. package/dist/{chunk-VUFAK2LW.js → chunk-YUY4SAGM.js} +17 -2
  131. package/dist/chunk-YUY4SAGM.js.map +1 -0
  132. package/dist/clack-EZ7TDWQU.js +19 -0
  133. package/dist/claude-cli-2YKABJJZ.js +31 -0
  134. package/dist/{cli-O5SN7ZJ4.js → cli-FB4LOA5A.js} +221 -68
  135. package/dist/{cli-O5SN7ZJ4.js.map → cli-FB4LOA5A.js.map} +1 -1
  136. package/dist/codex-event-TYVES3UX.js +16 -0
  137. package/dist/codex-host-WW4H2SKT.js +29 -0
  138. package/dist/codex-install-2C623HPW.js +393 -0
  139. package/dist/codex-install-2C623HPW.js.map +1 -0
  140. package/dist/{config-OJQI27LT.js → config-HOVJFEKD.js} +25 -15
  141. package/dist/doctor-NKU4V5OV.js +1312 -0
  142. package/dist/doctor-NKU4V5OV.js.map +1 -0
  143. package/dist/{env-proxy-XL4P73MZ.js → env-proxy-R6ZMLQTT.js} +6 -2
  144. package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js → ethersCompat-Df4a6QIZ-X6YZWAML.js} +3 -3
  145. package/dist/{fund-WEV6DMTD.js → fund-WEBHTZGN.js} +38 -30
  146. package/dist/{fund-WEV6DMTD.js.map → fund-WEBHTZGN.js.map} +1 -1
  147. package/dist/hook-command-ZA2PNKS6.js +44 -0
  148. package/dist/hosts/claude/.claude-plugin/marketplace.json +2 -2
  149. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +3 -2
  150. package/dist/hosts/claude/tenjin/hooks/hooks.json +4 -1
  151. package/dist/hosts/claude/tenjin/hooks/register.tsx +589 -0
  152. package/dist/hosts/claude/tenjin/skills/tenjin-pay/SKILL.md +82 -0
  153. package/dist/hosts/claude/tenjin/types/index.d.ts +41 -0
  154. package/dist/hosts/codex/.agents/plugins/marketplace.json +20 -0
  155. package/dist/hosts/codex/tenjin/.codex-plugin/plugin.json +16 -0
  156. package/dist/hosts/codex/tenjin/.mcp.json +15 -0
  157. package/dist/hosts/codex/tenjin/hooks/hooks.json +98 -0
  158. package/dist/hosts-AV5MHBAU.js +38 -0
  159. package/dist/index.js +28 -8
  160. package/dist/index.js.map +1 -1
  161. package/dist/install-PT4EZS4R.js +100 -0
  162. package/dist/{install-identity-WHPNMNMQ.js → install-identity-5A4OE6YC.js} +13 -8
  163. package/dist/install-wallet-SAAPKB73.js +281 -0
  164. package/dist/install-wallet-SAAPKB73.js.map +1 -0
  165. package/dist/{mcp-QML7ZMPH.js → mcp-HAWKCTPQ.js} +909 -208
  166. package/dist/mcp-HAWKCTPQ.js.map +1 -0
  167. package/dist/{mine.wasm-6PIT3DK6.js → mine.wasm-QFAHIFPY.js} +2 -2
  168. package/dist/{mine.wasm-6PIT3DK6.js.map → mine.wasm-QFAHIFPY.js.map} +1 -1
  169. package/dist/{package-LGKYOEPV.js → package-SR2WB6MK.js} +4 -2
  170. package/dist/passphrase-IFTDS3CU.js +44 -0
  171. package/dist/{paths-POPTXJO6.js → paths-XCSAKISU.js} +10 -2
  172. package/dist/pay-OXC3WKYV.js +55 -0
  173. package/dist/pay-OXC3WKYV.js.map +1 -0
  174. package/dist/{payments-C44QUFXU.js → payments-3KHMP2MG.js} +18 -13
  175. package/dist/{payments-C44QUFXU.js.map → payments-3KHMP2MG.js.map} +1 -1
  176. package/dist/plugin-registration-N3GRIZVM.js +67 -0
  177. package/dist/plugin-registration-N3GRIZVM.js.map +1 -0
  178. package/dist/{redact-6W23GGJC.js → redact-D7ASVWKL.js} +2 -2
  179. package/dist/redact-D7ASVWKL.js.map +1 -0
  180. package/dist/runtime-UVNUA3AS.js +1203 -0
  181. package/dist/runtime-UVNUA3AS.js.map +1 -0
  182. package/dist/runtime-fetch-EKFRNR6Z.js +20 -0
  183. package/dist/runtime-fetch-EKFRNR6Z.js.map +1 -0
  184. package/dist/runtime-layout-BDWZG2TQ.js +25 -0
  185. package/dist/runtime-layout-BDWZG2TQ.js.map +1 -0
  186. package/dist/{send-KVJX4XIR.js → send-HMKJLT34.js} +26 -18
  187. package/dist/{send-KVJX4XIR.js.map → send-HMKJLT34.js.map} +1 -1
  188. package/dist/{status-S7C3WMSH.js → status-RWXIIWYS.js} +57 -22
  189. package/dist/status-RWXIIWYS.js.map +1 -0
  190. package/dist/{status-line-YR2T5HC4.js → status-line-77XYZP7E.js} +13 -8
  191. package/dist/{status-line-YR2T5HC4.js.map → status-line-77XYZP7E.js.map} +1 -1
  192. package/dist/uninstall-D5G67UJH.js +480 -0
  193. package/dist/uninstall-D5G67UJH.js.map +1 -0
  194. package/dist/update-LRNOEGSB.js +53 -0
  195. package/dist/update-LRNOEGSB.js.map +1 -0
  196. package/dist/{usdc-JK4RRFFQ.js → usdc-D6X7EIQ2.js} +7 -8
  197. package/dist/usdc-D6X7EIQ2.js.map +1 -0
  198. package/dist/{viemAdapter-By13KInL-X2VY6CY3.js → viemAdapter-By13KInL-RL742ETX.js} +3 -3
  199. package/dist/viemAdapter-By13KInL-RL742ETX.js.map +1 -0
  200. package/dist/wallet-XFYC27BR.js +55 -0
  201. package/dist/wallet-XFYC27BR.js.map +1 -0
  202. package/dist/wallet-kdf-worker.mjs +8 -8
  203. package/docs/agent-permissions.md +56 -22
  204. package/docs/safety-model.md +1 -1
  205. package/docs/troubleshooting.md +72 -1
  206. package/package.json +14 -1
  207. package/dist/alive-3J3CHOQP.js +0 -21
  208. package/dist/ccip-NLCSCHKI.js +0 -19
  209. package/dist/chunk-3O2BQIF6.js.map +0 -1
  210. package/dist/chunk-5IEP5EGE.js +0 -5332
  211. package/dist/chunk-5IEP5EGE.js.map +0 -1
  212. package/dist/chunk-5LJCEMFD.js.map +0 -1
  213. package/dist/chunk-6W5GYG3W.js +0 -128
  214. package/dist/chunk-6W5GYG3W.js.map +0 -1
  215. package/dist/chunk-7EKYXMUO.js +0 -7536
  216. package/dist/chunk-7EKYXMUO.js.map +0 -1
  217. package/dist/chunk-7QKHZQKW.js.map +0 -1
  218. package/dist/chunk-AKWGE6JQ.js.map +0 -1
  219. package/dist/chunk-AWQPGIR6.js.map +0 -1
  220. package/dist/chunk-EGELTSPU.js +0 -2865
  221. package/dist/chunk-EGELTSPU.js.map +0 -1
  222. package/dist/chunk-EL56RW2J.js +0 -7611
  223. package/dist/chunk-EL56RW2J.js.map +0 -1
  224. package/dist/chunk-HE2MS4QO.js +0 -256
  225. package/dist/chunk-HE2MS4QO.js.map +0 -1
  226. package/dist/chunk-IOODYAXL.js.map +0 -1
  227. package/dist/chunk-JMM6YE7J.js.map +0 -1
  228. package/dist/chunk-KHE6L6TD.js.map +0 -1
  229. package/dist/chunk-N35E6CM2.js +0 -1185
  230. package/dist/chunk-N35E6CM2.js.map +0 -1
  231. package/dist/chunk-O2FRQ2L2.js.map +0 -1
  232. package/dist/chunk-OK2TDZQU.js.map +0 -1
  233. package/dist/chunk-OSYTBCUC.js.map +0 -1
  234. package/dist/chunk-PAYV4XUA.js.map +0 -1
  235. package/dist/chunk-SJLTEINJ.js.map +0 -1
  236. package/dist/chunk-TTBKWWTV.js.map +0 -1
  237. package/dist/chunk-TTNESUPQ.js.map +0 -1
  238. package/dist/chunk-U6YQ6FRI.js.map +0 -1
  239. package/dist/chunk-VUFAK2LW.js.map +0 -1
  240. package/dist/chunk-VZGAONSJ.js.map +0 -1
  241. package/dist/chunk-WO5BJNIB.js.map +0 -1
  242. package/dist/doctor-IQQJHGGM.js +0 -590
  243. package/dist/doctor-IQQJHGGM.js.map +0 -1
  244. package/dist/hook-command-D2P3ILRV.js +0 -32
  245. package/dist/install-TUCRF32I.js +0 -60
  246. package/dist/install-wallet-MA27FTQ5.js +0 -113
  247. package/dist/install-wallet-MA27FTQ5.js.map +0 -1
  248. package/dist/mcp-QML7ZMPH.js.map +0 -1
  249. package/dist/pay-2C2UBBXJ.js +0 -51
  250. package/dist/status-S7C3WMSH.js.map +0 -1
  251. package/dist/uninstall-HY6LKIIT.js +0 -149
  252. package/dist/uninstall-HY6LKIIT.js.map +0 -1
  253. package/dist/update-OJV22LR3.js +0 -36
  254. package/dist/wallet-PD2IMZDU.js +0 -39
  255. /package/dist/{_esm-CE7KNONL.js.map → _esm-RLLC72MS.js.map} +0 -0
  256. /package/dist/{alive-3J3CHOQP.js.map → alive-MROUMFH3.js.map} +0 -0
  257. /package/dist/{ccip-7RMRLAGV.js.map → auto-update-OPWMRZLS.js.map} +0 -0
  258. /package/dist/{ccip-NLCSCHKI.js.map → ccip-DHDFKTQV.js.map} +0 -0
  259. /package/dist/{chunk-LFZJM56J.js.map → chunk-445VQTVM.js.map} +0 -0
  260. /package/dist/{chunk-RAULEAZ6.js.map → chunk-4USCZ2NI.js.map} +0 -0
  261. /package/dist/{chunk-VFMQTSXG.js.map → chunk-D3ZURCG7.js.map} +0 -0
  262. /package/dist/{chunk-ORWL5BSN.js.map → chunk-HGZEPQUT.js.map} +0 -0
  263. /package/dist/{chunk-EBVIKMCH.js.map → chunk-JKKAIPTU.js.map} +0 -0
  264. /package/dist/{chunk-YHKXNYTB.js.map → chunk-QF3LSMGS.js.map} +0 -0
  265. /package/dist/{chunk-NZIP4PA2.js.map → chunk-SO3XRZPX.js.map} +0 -0
  266. /package/dist/{chunk-AEG2PXBP.js.map → chunk-V2LQLN5H.js.map} +0 -0
  267. /package/dist/{config-OJQI27LT.js.map → clack-EZ7TDWQU.js.map} +0 -0
  268. /package/dist/{env-proxy-XL4P73MZ.js.map → claude-cli-2YKABJJZ.js.map} +0 -0
  269. /package/dist/{ethersCompat-Df4a6QIZ-THAVUGIJ.js.map → codex-event-TYVES3UX.js.map} +0 -0
  270. /package/dist/{hook-command-D2P3ILRV.js.map → codex-host-WW4H2SKT.js.map} +0 -0
  271. /package/dist/{install-TUCRF32I.js.map → config-HOVJFEKD.js.map} +0 -0
  272. /package/dist/{install-identity-WHPNMNMQ.js.map → env-proxy-R6ZMLQTT.js.map} +0 -0
  273. /package/dist/{package-LGKYOEPV.js.map → ethersCompat-Df4a6QIZ-X6YZWAML.js.map} +0 -0
  274. /package/dist/{paths-POPTXJO6.js.map → hook-command-ZA2PNKS6.js.map} +0 -0
  275. /package/dist/{pay-2C2UBBXJ.js.map → hosts-AV5MHBAU.js.map} +0 -0
  276. /package/dist/{redact-6W23GGJC.js.map → install-PT4EZS4R.js.map} +0 -0
  277. /package/dist/{update-OJV22LR3.js.map → install-identity-5A4OE6YC.js.map} +0 -0
  278. /package/dist/{usdc-JK4RRFFQ.js.map → package-SR2WB6MK.js.map} +0 -0
  279. /package/dist/{viemAdapter-By13KInL-X2VY6CY3.js.map → passphrase-IFTDS3CU.js.map} +0 -0
  280. /package/dist/{wallet-PD2IMZDU.js.map → paths-XCSAKISU.js.map} +0 -0
@@ -1,21 +1,26 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
3
  renderProgress
4
- } from "./chunk-U6YQ6FRI.js";
4
+ } from "./chunk-IDTRSAHE.js";
5
5
  import {
6
6
  routerSettings
7
- } from "./chunk-SPAVAYSW.js";
8
- import "./chunk-AWFUPKTM.js";
9
- import "./chunk-WO5BJNIB.js";
10
- import "./chunk-O2FRQ2L2.js";
11
- import "./chunk-SJLTEINJ.js";
7
+ } from "./chunk-JEVQ5LKO.js";
8
+ import "./chunk-AV5NZMYO.js";
9
+ import "./chunk-Y527D4TV.js";
10
+ import "./chunk-2GNOFONN.js";
11
+ import "./chunk-DW4YTVR3.js";
12
+ import "./chunk-XQJXNMSB.js";
13
+ import "./chunk-SNNSAGMT.js";
14
+ import "./chunk-7WEQQJLG.js";
15
+ import "./chunk-3UCIG4TG.js";
16
+ import "./chunk-OJNTCYQQ.js";
12
17
  import "./chunk-ZXTAQYNA.js";
13
18
 
14
19
  // src/router/status-line.ts
15
20
  var MAX_EVENT_BYTES = 64e3;
16
21
  var STDIN_TIMEOUT_MS = 1e3;
17
22
  async function statusLineMain() {
18
- const { dataDir } = await import("./paths-POPTXJO6.js");
23
+ const { dataDir } = await import("./paths-XCSAKISU.js");
19
24
  await runStatusLine(
20
25
  { stdout: process.stdout, stderr: process.stderr, isTTY: false },
21
26
  { dataDir: dataDir(process.env) }
@@ -83,4 +88,4 @@ export {
83
88
  runStatusLine,
84
89
  statusLineMain
85
90
  };
86
- //# sourceMappingURL=status-line-YR2T5HC4.js.map
91
+ //# sourceMappingURL=status-line-77XYZP7E.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/router/status-line.ts"],"sourcesContent":["import { renderProgress } from './progress';\nimport { routerSettings } from './settings';\nimport type { Io } from '../lib/output';\n\n/**\n * `tenjin status-line`: the live footer Claude Code runs on its own refresh.\n *\n * CHEAP AND READ-ONLY. One JSON event on stdin for the session identity, the\n * router's own switch for its directory, one read of that session's progress\n * directory, one line out. No network call, no wallet, no write: it runs once a\n * second for as long as a session is open, so anything it touched would be\n * touched 3,600 times an hour.\n *\n * IT CANNOT FAIL LOUDLY either. Every error path writes nothing and returns, so\n * the command exits 0 with empty output and the harness shows no footer.\n */\n\n/** Claude Code's status event is small; anything larger is not one. */\nconst MAX_EVENT_BYTES = 64_000;\n/** The harness writes the event immediately, so this is a liveness check. */\nexport const STDIN_TIMEOUT_MS = 1_000;\n\nexport interface StatusLineDeps {\n dataDir: string;\n /** Test seam for the harness event; production reads stdin. */\n readEvent?: () => Promise<string>;\n env?: NodeJS.ProcessEnv;\n now?: () => number;\n}\n\n/**\n * The bin entry's fast path for a bare `tenjin status-line`, which runs on a\n * one-second timer: commander and the command tree cost about 120 ms of parse\n * per tick over this path. It does load zod, for the router's own switch\n * through the one config parser, about 17 ms a tick. `dist-chunks.test.ts`\n * pins what it may load.\n */\nexport async function statusLineMain(): Promise<void> {\n const { dataDir } = await import('../lib/paths');\n await runStatusLine(\n { stdout: process.stdout, stderr: process.stderr, isTTY: false },\n { dataDir: dataDir(process.env) },\n );\n}\n\nexport async function runStatusLine(io: Io, deps: StatusLineDeps): Promise<void> {\n let rendered: string;\n try {\n const raw = await (deps.readEvent ?? readStdin)();\n const event: unknown = JSON.parse(raw);\n const sessionId = sessionIdOf(event);\n if (sessionId === null) return;\n // Off here means no footer: the router is not running in this directory.\n const router = await routerSettings(\n { cwd: cwdOf(event) ?? process.cwd(), dataDir: deps.dataDir },\n { warn: () => undefined },\n );\n if (!router.enabled.value) return;\n const columns = Number((deps.env ?? process.env).COLUMNS);\n rendered = await renderProgress(deps.dataDir, sessionId, {\n ...(Number.isFinite(columns) && columns > 0 ? { columns } : {}),\n ...(deps.now !== undefined ? { now: deps.now() } : {}),\n });\n } catch {\n return;\n }\n if (rendered.length > 0) io.stdout.write(`${rendered}\\n`);\n}\n\n/**\n * The session identity, and nothing else off the event. A footer that showed\n * the wrong session's lookups would be a leak between two terminals, so an\n * event without a plain, bounded `session_id` renders nothing at all.\n */\nfunction sessionIdOf(event: unknown): string | null {\n if (event === null || typeof event !== 'object' || Array.isArray(event)) return null;\n const value = (event as { session_id?: unknown }).session_id;\n if (typeof value !== 'string' || value.length === 0 || value.length > 200) return null;\n return value;\n}\n\n/** The session's working directory, which `router.*` resolves from. */\nfunction cwdOf(event: unknown): string | null {\n const value = (event as { cwd?: unknown }).cwd;\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\nasync function readStdin(): Promise<string> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const timer = setTimeout(() => reject(new Error('no harness event')), STDIN_TIMEOUT_MS);\n process.stdin.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_EVENT_BYTES) {\n clearTimeout(timer);\n reject(new Error('harness event too large'));\n return;\n }\n chunks.push(chunk);\n });\n process.stdin.once('end', () => {\n clearTimeout(timer);\n resolve(Buffer.concat(chunks).toString('utf8'));\n });\n process.stdin.once('error', () => {\n clearTimeout(timer);\n reject(new Error('harness event unreadable'));\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,IAAM,kBAAkB;AAEjB,IAAM,mBAAmB;AAiBhC,eAAsB,iBAAgC;AACpD,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,qBAAc;AAC/C,QAAM;AAAA,IACJ,EAAE,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,OAAO,MAAM;AAAA,IAC/D,EAAE,SAAS,QAAQ,QAAQ,GAAG,EAAE;AAAA,EAClC;AACF;AAEA,eAAsB,cAAc,IAAQ,MAAqC;AAC/E,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,OAAO,KAAK,aAAa,WAAW;AAChD,UAAM,QAAiB,KAAK,MAAM,GAAG;AACrC,UAAM,YAAY,YAAY,KAAK;AACnC,QAAI,cAAc,KAAM;AAExB,UAAM,SAAS,MAAM;AAAA,MACnB,EAAE,KAAK,MAAM,KAAK,KAAK,QAAQ,IAAI,GAAG,SAAS,KAAK,QAAQ;AAAA,MAC5D,EAAE,MAAM,MAAM,OAAU;AAAA,IAC1B;AACA,QAAI,CAAC,OAAO,QAAQ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;AAAA,IAChD,CAAC;AACD,YAAQ,MAAM,KAAK,SAAS,MAAM;AAChC,mBAAa,KAAK;AAClB,aAAO,IAAI,MAAM,0BAA0B,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/router/status-line.ts"],"sourcesContent":["import { renderProgress } from './progress';\nimport { routerSettings } from './settings';\nimport type { Io } from '../lib/output';\n\n/**\n * `tenjin status-line`: the live footer Claude Code runs on its own refresh.\n *\n * CHEAP AND READ-ONLY. One JSON event on stdin for the session identity, the\n * router's own switch for its directory, one read of that session's progress\n * directory, one line out. No network call, no wallet, no write: it runs once a\n * second for as long as a session is open, so anything it touched would be\n * touched 3,600 times an hour.\n *\n * IT CANNOT FAIL LOUDLY either. Every error path writes nothing and returns, so\n * the command exits 0 with empty output and the harness shows no footer.\n */\n\n/** Claude Code's status event is small; anything larger is not one. */\nconst MAX_EVENT_BYTES = 64_000;\n/** The harness writes the event immediately, so this is a liveness check. */\nexport const STDIN_TIMEOUT_MS = 1_000;\n\nexport interface StatusLineDeps {\n dataDir: string;\n /** Test seam for the harness event; production reads stdin. */\n readEvent?: () => Promise<string>;\n env?: NodeJS.ProcessEnv;\n now?: () => number;\n}\n\n/**\n * The bin entry's fast path for a bare `tenjin status-line`, which runs on a\n * one-second timer: commander and the command tree cost about 120 ms of parse\n * per tick over this path. It does load zod, for the router's own switch\n * through the one config parser, about 17 ms a tick. `dist-chunks.test.ts`\n * pins what it may load.\n */\nexport async function statusLineMain(): Promise<void> {\n const { dataDir } = await import('../lib/paths');\n await runStatusLine(\n { stdout: process.stdout, stderr: process.stderr, isTTY: false },\n { dataDir: dataDir(process.env) },\n );\n}\n\nexport async function runStatusLine(io: Io, deps: StatusLineDeps): Promise<void> {\n let rendered: string;\n try {\n const raw = await (deps.readEvent ?? readStdin)();\n const event: unknown = JSON.parse(raw);\n const sessionId = sessionIdOf(event);\n if (sessionId === null) return;\n // Off here means no footer: the router is not running in this directory.\n const router = await routerSettings(\n { cwd: cwdOf(event) ?? process.cwd(), dataDir: deps.dataDir },\n { warn: () => undefined },\n );\n if (!router.enabled.value) return;\n const columns = Number((deps.env ?? process.env).COLUMNS);\n rendered = await renderProgress(deps.dataDir, sessionId, {\n ...(Number.isFinite(columns) && columns > 0 ? { columns } : {}),\n ...(deps.now !== undefined ? { now: deps.now() } : {}),\n });\n } catch {\n return;\n }\n if (rendered.length > 0) io.stdout.write(`${rendered}\\n`);\n}\n\n/**\n * The session identity, and nothing else off the event. A footer that showed\n * the wrong session's lookups would be a leak between two terminals, so an\n * event without a plain, bounded `session_id` renders nothing at all.\n */\nfunction sessionIdOf(event: unknown): string | null {\n if (event === null || typeof event !== 'object' || Array.isArray(event)) return null;\n const value = (event as { session_id?: unknown }).session_id;\n if (typeof value !== 'string' || value.length === 0 || value.length > 200) return null;\n return value;\n}\n\n/** The session's working directory, which `router.*` resolves from. */\nfunction cwdOf(event: unknown): string | null {\n const value = (event as { cwd?: unknown }).cwd;\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\nasync function readStdin(): Promise<string> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n const timer = setTimeout(() => reject(new Error('no harness event')), STDIN_TIMEOUT_MS);\n process.stdin.on('data', (chunk: Buffer) => {\n size += chunk.length;\n if (size > MAX_EVENT_BYTES) {\n clearTimeout(timer);\n reject(new Error('harness event too large'));\n return;\n }\n chunks.push(chunk);\n });\n process.stdin.once('end', () => {\n clearTimeout(timer);\n resolve(Buffer.concat(chunks).toString('utf8'));\n });\n process.stdin.once('error', () => {\n clearTimeout(timer);\n reject(new Error('harness event unreadable'));\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAM,kBAAkB;AAEjB,IAAM,mBAAmB;AAiBhC,eAAsB,iBAAgC;AACpD,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,qBAAc;AAC/C,QAAM;AAAA,IACJ,EAAE,QAAQ,QA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6B;AAC1C,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAmB,CAAC;AAC1B,QAAI,OAAO;AACX,UAAM,QAAQ,WAAW,MAAM,OAAO,IAAI,MAAM,kBAAkB,CAAC,GAAG,gBAAgB;AACtF,YAAQ,MAAM,GAAG,QAAQ,CAAC,UAAkB;AAC1C,cAAQ,MAAM;AACd,UAAI,OAAO,iBAAiB;AAC1B,qBAAa,KAAK;AAClB,eAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C;AAAA,MACF;AACA,aAAO,KAAK,KAAK;AAAA,IACnB,CAAC;AACD,YAAQ,MAAM,KAAK,OAAO,MAAM;AAC9B,mBAAa,KAAK;AAClB,cAAQ,OAAO,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC;AAAA,IAChD,CAAC;AACD,YAAQ,MAAM,KAAK,SAAS,MAAM;AAChC,mBAAa,KAAK;AAClB,aAAO,IAAI,MAAM,0BAA0B,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
@@ -0,0 +1,480 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ folderFor,
4
+ folderState,
5
+ inspectLegacyInstall,
6
+ ownMarketplace,
7
+ projectInstallAt,
8
+ recordedInstalls,
9
+ removeLegacyInstall,
10
+ settingsInstallPaths
11
+ } from "./chunk-VOZA6O7K.js";
12
+ import "./chunk-I5TDIUKM.js";
13
+ import "./chunk-KOGZDMHO.js";
14
+ import "./chunk-PKHI276N.js";
15
+ import "./chunk-B7EM4GGF.js";
16
+ import {
17
+ persistRouterProject
18
+ } from "./chunk-AD226HDR.js";
19
+ import "./chunk-4LMUQMBH.js";
20
+ import "./chunk-3623BLPV.js";
21
+ import "./chunk-XKESD27X.js";
22
+ import "./chunk-VJUVFZ2D.js";
23
+ import "./chunk-HDPUXS3Z.js";
24
+ import "./chunk-2SNUOHAT.js";
25
+ import "./chunk-E7SW44LM.js";
26
+ import "./chunk-F3ED5WTR.js";
27
+ import "./chunk-DOQGNFHM.js";
28
+ import {
29
+ removePluginFolder
30
+ } from "./chunk-TAW4UFFF.js";
31
+ import "./chunk-E7LGOMH6.js";
32
+ import "./chunk-MEFB5KHA.js";
33
+ import "./chunk-UUGOUOVT.js";
34
+ import {
35
+ MARKETPLACE_NAME,
36
+ PLUGIN_ID
37
+ } from "./chunk-MPZUYCAP.js";
38
+ import "./chunk-3FMZGI7I.js";
39
+ import "./chunk-OTWLERSW.js";
40
+ import {
41
+ findClaudeBinary,
42
+ jsonList,
43
+ jsonResult,
44
+ runClaude
45
+ } from "./chunk-QXP3Z3JN.js";
46
+ import "./chunk-YUY4SAGM.js";
47
+ import "./chunk-JEVQ5LKO.js";
48
+ import "./chunk-AV5NZMYO.js";
49
+ import "./chunk-Y527D4TV.js";
50
+ import {
51
+ readWalletFacts,
52
+ removeAliveState
53
+ } from "./chunk-WOM257PW.js";
54
+ import "./chunk-BFDQ4WNW.js";
55
+ import "./chunk-3AIHRXKO.js";
56
+ import "./chunk-X5ZBP3IY.js";
57
+ import "./chunk-2I4QTOLB.js";
58
+ import {
59
+ loadRawConfig
60
+ } from "./chunk-2GNOFONN.js";
61
+ import "./chunk-DW4YTVR3.js";
62
+ import "./chunk-XQJXNMSB.js";
63
+ import "./chunk-SNNSAGMT.js";
64
+ import "./chunk-7WEQQJLG.js";
65
+ import {
66
+ CliError
67
+ } from "./chunk-3UCIG4TG.js";
68
+ import {
69
+ runtimeStatePath
70
+ } from "./chunk-G75OPGAK.js";
71
+ import "./chunk-EDJWHDDL.js";
72
+ import {
73
+ defaultDataDir,
74
+ runtimeDir
75
+ } from "./chunk-OJNTCYQQ.js";
76
+ import "./chunk-ZXTAQYNA.js";
77
+
78
+ // src/router/uninstall.ts
79
+ import { existsSync } from "node:fs";
80
+ import { realpath, stat } from "node:fs/promises";
81
+ import { homedir } from "node:os";
82
+ import { isAbsolute, resolve, sep } from "node:path";
83
+ var USER = "user";
84
+ var real = (path) => realpath(path).catch(() => resolve(path));
85
+ var isDir = async (path) => (await stat(path).catch(() => null))?.isDirectory() === true;
86
+ function within(dir, parent) {
87
+ return dir === parent || dir.startsWith(parent.endsWith(sep) ? parent : `${parent}${sep}`);
88
+ }
89
+ function uncheckable() {
90
+ return new CliError("REFUSED", "Tenjin's plugin could not be checked, so nothing was removed", {
91
+ fix: `Run \`tenjin uninstall\` from a terminal where \`claude\` runs, or type /plugin uninstall ${PLUGIN_ID} in Claude Code.`
92
+ });
93
+ }
94
+ async function installRecords(dataDir, env, home) {
95
+ const claude = await recordedInstalls(env, home);
96
+ if (claude === null) throw uncheckable();
97
+ const listed = (await loadRawConfig(dataDir).catch(() => null))?.install?.routerProjects ?? [];
98
+ const records = [];
99
+ const seen = /* @__PURE__ */ new Set();
100
+ for (const r of claude) {
101
+ const key = r.projectPath === null ? USER : await real(r.projectPath);
102
+ if (seen.has(key)) continue;
103
+ seen.add(key);
104
+ records.push(r.projectPath === null ? r : { scope: "local", projectPath: key });
105
+ }
106
+ const recorded = records.length;
107
+ for (const dir of listed) {
108
+ const key = await real(dir);
109
+ if (seen.has(key) || !await projectInstallAt(key, home, env)) continue;
110
+ seen.add(key);
111
+ records.push({ scope: "local", projectPath: key });
112
+ }
113
+ return Object.assign(records, { recorded });
114
+ }
115
+ async function nearestProject(records, dir, home) {
116
+ const homeReal = await real(home);
117
+ return records.filter(
118
+ (r) => r.projectPath !== null && within(dir, r.projectPath) && (r.projectPath !== homeReal || dir === homeReal)
119
+ ).sort((a, b) => b.projectPath.length - a.projectPath.length)[0];
120
+ }
121
+ async function resolveUninstallTarget(o, ctx, deps = {}) {
122
+ if (o.all === true) return { kind: "all" };
123
+ const env = deps.env ?? process.env;
124
+ const home = deps.homeDir ?? homedir();
125
+ const cwd = deps.cwd ?? process.cwd();
126
+ const records = await installRecords(ctx.dataDir, env, home);
127
+ if (o.project !== void 0) {
128
+ const dir = await real(o.project === true ? cwd : resolve(cwd, o.project));
129
+ return {
130
+ kind: "project",
131
+ path: (await nearestProject(records, dir, home))?.projectPath ?? dir
132
+ };
133
+ }
134
+ const here = await nearestProject(records, await real(cwd), home);
135
+ return here !== void 0 ? { kind: "project", path: here.projectPath } : { kind: "user" };
136
+ }
137
+ async function runRouterUninstall(o, ctx, deps = {}) {
138
+ const env = deps.env ?? process.env;
139
+ const home = deps.homeDir ?? homedir();
140
+ if (!isAbsolute(home)) throw new Error("The home directory is not an absolute path.");
141
+ const cwd = deps.cwd ?? process.cwd();
142
+ const binary = (deps.findClaude ?? findClaudeBinary)(env);
143
+ const run = (args, at) => (deps.runClaude ?? runClaude)(binary, args, { env, cwd: at });
144
+ const records = await installRecords(ctx.dataDir, env, home);
145
+ if (binary === null && records.recorded > 0) throw uncheckable();
146
+ const { target } = o;
147
+ let targets = records.filter(
148
+ (r) => target.kind === "all" ? true : target.kind === "user" ? r.projectPath === null : r.projectPath === target.path
149
+ );
150
+ const userUnrecorded = !records.some((r) => r.projectPath === null) && await leftHere({ scope: "user", projectPath: null }, env, home);
151
+ if (target.kind === "all" && userUnrecorded && targets.length > 0) {
152
+ targets = [{ scope: "user", projectPath: null }, ...targets];
153
+ }
154
+ const others = records.filter((r) => !targets.includes(r));
155
+ if (targets.length === 0) {
156
+ const fallback = target.kind === "project" ? { scope: "local", projectPath: target.path } : { scope: "user", projectPath: null };
157
+ const live = await liveOthers(others);
158
+ if (live.length > 0 && !await leftHere(fallback, env, home)) {
159
+ return nothingHere(target, await real(cwd), live.map(labelOf), ctx.dataDir, env, home);
160
+ }
161
+ targets = [fallback];
162
+ }
163
+ const removals = [];
164
+ for (const r of targets) {
165
+ if (r.projectPath !== null && !await isDir(r.projectPath)) {
166
+ removals.push({ ...r, state: "skipped", reason: `${r.projectPath} no longer exists` });
167
+ continue;
168
+ }
169
+ if (binary === null) {
170
+ removals.push({ ...r, state: "absent" });
171
+ continue;
172
+ }
173
+ const out = await run(
174
+ ["plugin", "uninstall", PLUGIN_ID, "--scope", r.scope, "--json"],
175
+ r.projectPath ?? home
176
+ );
177
+ const result = jsonResult(out.stdout);
178
+ if (out.code === 0) removals.push({ ...r, state: "removed" });
179
+ else if (result?.failureCode === "not_installed") removals.push({ ...r, state: "absent" });
180
+ else {
181
+ const message = typeof result?.message === "string" ? result.message : out.stderr.trim().slice(0, 200);
182
+ removals.push({ ...r, state: "failed", reason: `claude plugin uninstall: ${message}` });
183
+ }
184
+ }
185
+ const after = await recordedInstalls(env, home) ?? [];
186
+ const afterKeys = new Set(
187
+ await Promise.all(after.map((r) => r.projectPath === null ? USER : real(r.projectPath)))
188
+ );
189
+ const left = removals.filter(
190
+ (r) => r.state === "failed" || r.state !== "skipped" && afterKeys.has(r.projectPath === null ? USER : r.projectPath)
191
+ );
192
+ const gone = removals.filter((r) => !left.includes(r) && r.state !== "skipped");
193
+ const userKept = userUnrecorded && !targets.some((r) => r.projectPath === null);
194
+ const remaining = left.length > 0 ? [] : [...userKept ? [USER] : [], ...(await liveOthers(others)).map(keyOf)];
195
+ const folders = [];
196
+ const settings = [];
197
+ const cleanUp = async () => {
198
+ for (const r of gone) {
199
+ const at = r.projectPath ?? home;
200
+ folders.push(await removePluginFolder(folderFor(r.scope, env, home, at)));
201
+ const paths = settingsInstallPaths(r.projectPath !== null, env, home, at);
202
+ const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);
203
+ settings.push({
204
+ path: paths.settingsPath,
205
+ found: legacy.present,
206
+ removed: legacy.present ? await removeLegacyInstall(legacy, { binary, env, cwd: at, mcpScope: paths.mcpScope }) : null
207
+ });
208
+ }
209
+ for (const r of removals) {
210
+ if (r.projectPath !== null && !left.includes(r)) {
211
+ await persistRouterProject(ctx.dataDir, r.projectPath, false).catch(() => void 0);
212
+ }
213
+ }
214
+ };
215
+ const named = (list) => list.map(labelOf).join(", ") || "nothing";
216
+ if (left.length > 0) {
217
+ await cleanUp();
218
+ throw new CliError(
219
+ "REFUSED",
220
+ `${left.length} Tenjin install${left.length === 1 ? "" : "s"} could not be removed: ${left.map((r) => `${labelOf(r)}${r.reason !== void 0 ? ` (${r.reason})` : ""}`).join(", ")}. Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,
221
+ {
222
+ details: { removed: gone.map(keyOf), left: left.map(keyOf), removals },
223
+ fix: retryFix(target, left)
224
+ }
225
+ );
226
+ }
227
+ let marketplace = "kept";
228
+ let marketplaceWhy;
229
+ if (remaining.length > 0) {
230
+ marketplaceWhy = `Kept ${sharedParts(ctx.dataDir, home)}: still used by ${remaining.map(nameOf).join(", ")}.`;
231
+ } else if (binary === null) {
232
+ marketplaceWhy = `the ${MARKETPLACE_NAME} marketplace was not checked: no claude binary on PATH or in CLAUDE_CODE_EXECPATH`;
233
+ } else {
234
+ const listing = await run(["plugin", "marketplace", "list", "--json"], home);
235
+ const listed = jsonList(listing.stdout);
236
+ if (listed === null) {
237
+ await cleanUp();
238
+ const again = againCommand(target);
239
+ throw new CliError(
240
+ "REFUSED",
241
+ `The ${MARKETPLACE_NAME} marketplace could not be checked (claude plugin marketplace list${listing.stderr.trim() !== "" ? `: ${listing.stderr.trim().slice(0, 200)}` : ""}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,
242
+ {
243
+ details: {
244
+ removed: gone.map(keyOf),
245
+ left: [`${MARKETPLACE_NAME} marketplace`],
246
+ removals
247
+ },
248
+ fix: `Run \`${again}\` again.`
249
+ }
250
+ );
251
+ }
252
+ const row = listed.find((m) => m.name === MARKETPLACE_NAME);
253
+ if (row === void 0) marketplace = "absent";
254
+ else if (!await ownMarketplace(row)) {
255
+ marketplaceWhy = `kept the ${MARKETPLACE_NAME} marketplace: it is not one \`tenjin install\` added`;
256
+ } else {
257
+ const removed = await run(
258
+ ["plugin", "marketplace", "remove", MARKETPLACE_NAME, "--json"],
259
+ home
260
+ );
261
+ if (removed.code !== 0) {
262
+ await cleanUp();
263
+ const result = jsonResult(removed.stdout);
264
+ const why = typeof result?.message === "string" ? result.message : removed.stderr.trim().slice(0, 200);
265
+ const again = againCommand(target);
266
+ throw new CliError(
267
+ "REFUSED",
268
+ `The ${MARKETPLACE_NAME} marketplace could not be removed (claude plugin marketplace remove${why !== "" ? `: ${why}` : ""}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,
269
+ {
270
+ details: {
271
+ removed: gone.map(keyOf),
272
+ left: [`${MARKETPLACE_NAME} marketplace`],
273
+ removals
274
+ },
275
+ fix: `Run \`${again}\` again; if it still fails, run \`claude plugin marketplace remove ${MARKETPLACE_NAME}\`, then \`${again}\`.`
276
+ }
277
+ );
278
+ }
279
+ marketplace = "removed";
280
+ }
281
+ }
282
+ await cleanUp();
283
+ const aliveRemoved = remaining.length === 0 ? await removeAliveState(ctx.dataDir) : false;
284
+ const kept = await keptBlock(ctx.dataDir, env, home);
285
+ const data = {
286
+ target,
287
+ removals,
288
+ remaining,
289
+ marketplace,
290
+ ...remaining.length > 0 ? { marketplaceKeptFor: remaining } : {},
291
+ folders,
292
+ settings,
293
+ aliveRemoved,
294
+ kept: kept.data
295
+ };
296
+ const lines = [
297
+ ...removals.map(removalLine),
298
+ ...marketplace === "removed" ? [`removed the ${MARKETPLACE_NAME} marketplace`] : [],
299
+ ...marketplaceWhy !== void 0 ? [marketplaceWhy] : [],
300
+ ...folders.flatMap(folderLines),
301
+ ...settings.flatMap((s) => settingsLines(s.path, s.removed)),
302
+ ...kept.lines
303
+ ];
304
+ return { data, humanLines: lines };
305
+ }
306
+ function retryFix(target, left) {
307
+ const again = againCommand(target);
308
+ const projects = left.flatMap((r) => r.projectPath !== null ? [r.projectPath] : []);
309
+ const where = projects.length === 0 ? "a Claude Code session" : `a Claude Code session started in ${projects.join(", ")}${projects.length < left.length ? " (any session for your user install)" : ""}`;
310
+ return `Run \`${again}\` again; if it still fails, type /plugin uninstall ${PLUGIN_ID} in ${where}.`;
311
+ }
312
+ function againCommand(target) {
313
+ return target.kind === "all" ? "tenjin uninstall --all" : target.kind === "project" ? `tenjin uninstall --project ${shellWord(target.path)}` : "tenjin uninstall";
314
+ }
315
+ function shellWord(path) {
316
+ return /^[\w@%+=:,./~-]+$/.test(path) ? path : `'${path.replace(/'/g, "'\\''")}'`;
317
+ }
318
+ async function liveOthers(others) {
319
+ const live = [];
320
+ for (const r of others) if (r.projectPath === null || await isDir(r.projectPath)) live.push(r);
321
+ return live;
322
+ }
323
+ async function leftHere(r, env, home) {
324
+ if (r.projectPath !== null) return projectInstallAt(r.projectPath, home, env);
325
+ if ((await folderState("user", env, home, home)).state === "ours") return true;
326
+ const paths = settingsInstallPaths(false, env, home, home);
327
+ return (await inspectLegacyInstall(paths.settingsPath, paths.mcpFile)).present;
328
+ }
329
+ var keyOf = (r) => r.projectPath ?? USER;
330
+ var nameOf = (key) => key === USER ? "your user install" : key;
331
+ var labelOf = (r) => nameOf(keyOf(r));
332
+ async function claudeInstallsLeft(ctx, deps = {}) {
333
+ const env = deps.env ?? process.env;
334
+ const home = deps.homeDir ?? homedir();
335
+ try {
336
+ const records = await installRecords(ctx.dataDir, env, home);
337
+ if ((await liveOthers(records)).length > 0) return true;
338
+ return await leftHere({ scope: "user", projectPath: null }, env, home);
339
+ } catch {
340
+ return true;
341
+ }
342
+ }
343
+ function runtimeKeptFor(dataDir, home, users) {
344
+ if (!hasRuntime(dataDir, home)) return null;
345
+ return `Kept Tenjin's runtime and its launcher: still used by ${users.join(", ")}.`;
346
+ }
347
+ function sharedParts(dataDir, home) {
348
+ return hasRuntime(dataDir, home) ? `the ${MARKETPLACE_NAME} marketplace, Tenjin's runtime and its launcher` : `the ${MARKETPLACE_NAME} marketplace`;
349
+ }
350
+ function hasRuntime(dataDir, home) {
351
+ return isDefaultDataDir(dataDir, home) && existsSync(runtimeStatePath(runtimeDir(dataDir)));
352
+ }
353
+ function isDefaultDataDir(dataDir, home) {
354
+ return resolve(dataDir) === resolve(defaultDataDir(home));
355
+ }
356
+ async function nothingHere(target, cwd, installed, dataDir, env, home) {
357
+ const whose = target.kind !== "project" ? "your user" : target.path === cwd ? "this folder's project" : target.path;
358
+ const kept = await keptBlock(dataDir, env, home);
359
+ return {
360
+ data: {
361
+ target,
362
+ removals: [],
363
+ remaining: installed,
364
+ marketplace: "kept",
365
+ marketplaceKeptFor: installed,
366
+ folders: [],
367
+ settings: [],
368
+ aliveRemoved: false,
369
+ kept: kept.data
370
+ },
371
+ humanLines: [
372
+ `No Tenjin install for ${whose}, so nothing was removed. Still installed: ${installed.join(", ")}. Run \`tenjin uninstall --project <path>\` for one of them, or \`tenjin uninstall --all\`.`
373
+ ]
374
+ };
375
+ }
376
+ function removalLine(r) {
377
+ const which = r.projectPath === null ? "your user install" : `the install for ${r.projectPath}`;
378
+ switch (r.state) {
379
+ case "removed":
380
+ return `removed the ${PLUGIN_ID} plugin (${which})`;
381
+ case "absent":
382
+ return `plugin: ${PLUGIN_ID} was not installed (${which})`;
383
+ case "skipped":
384
+ return `skipped ${which}: ${r.reason ?? "its folder no longer exists"}`;
385
+ case "failed":
386
+ return `plugin: ${r.reason ?? "left in place"} (${which})`;
387
+ }
388
+ }
389
+ function folderLines(folder) {
390
+ if (folder.removed) {
391
+ return [
392
+ folder.left.length === 0 ? `removed the plugin folder ${folder.path}` : `removed the plugin's files from ${folder.path}; kept what is not Tenjin's: ${folder.left.join(", ")}`
393
+ ];
394
+ }
395
+ return folder.reason !== void 0 ? [`folder: ${folder.reason}`] : [];
396
+ }
397
+ function settingsLines(settingsPath, settings) {
398
+ if (settings === null) return [];
399
+ const lines = [];
400
+ const parts = [
401
+ ...settings.events.length > 0 ? [`hook entries (${settings.events.join(", ")})`] : [],
402
+ ...settings.allowRule || settings.denyRule ? ["the permission rules"] : [],
403
+ ...settings.statusLine !== "kept" ? ["the status line"] : [],
404
+ ...settings.mcp === "removed" ? ["the x402 MCP server"] : []
405
+ ];
406
+ if (parts.length > 0) {
407
+ lines.push(`removed the settings install's ${parts.join(", ")} from ${settingsPath}`);
408
+ }
409
+ lines.push(...settings.warnings.map((w) => `settings: ${w}`));
410
+ return lines;
411
+ }
412
+ function tilde(path, home) {
413
+ return path === home || path.startsWith(`${home}${sep}`) ? `~${path.slice(home.length)}` : path;
414
+ }
415
+ async function keptBlock(dataDir, env, home) {
416
+ const facts = await readWalletFacts(dataDir, env);
417
+ const wallet = facts.address;
418
+ let store = null;
419
+ if (wallet !== null && facts.passphraseStore !== null) {
420
+ const { describeStoreLocation } = await import("./passphrase-IFTDS3CU.js");
421
+ store = describeStoreLocation(facts.passphraseStore, wallet.toLowerCase(), dataDir);
422
+ }
423
+ const lines = [
424
+ wallet !== null ? `Kept ${tilde(dataDir, home)}: your wallet ${wallet} (it may hold funds; move them with \`tenjin wallet send\` before you delete it), the spend ledger and the config.` : `Kept ${tilde(dataDir, home)}: the spend ledger and the config.`,
425
+ ...store !== null ? [`The wallet passphrase stays in ${store}.`] : [],
426
+ ...facts.envPassphraseSet ? [
427
+ "TENJIN_WALLET_PASSPHRASE is set in this shell; remove its export line from your shell startup file if you added one."
428
+ ] : []
429
+ ];
430
+ return { data: { dataDir, wallet, passphraseStore: store }, lines };
431
+ }
432
+ async function removeRuntimeAndLaunchers(dataDir, home, deps = {}) {
433
+ if (!isDefaultDataDir(dataDir, home)) {
434
+ return { data: { runtime: null, launcher: null }, humanLines: [] };
435
+ }
436
+ const lib = deps.removeLaunchers !== void 0 && deps.removeRuntime !== void 0 ? null : await import("./runtime-UVNUA3AS.js");
437
+ const removeLaunchers = deps.removeLaunchers ?? lib.removeLaunchers;
438
+ const removeRuntime = deps.removeRuntime ?? lib.removeRuntime;
439
+ const root = runtimeDir(dataDir);
440
+ const launcher = await removeLaunchers(home, deps.platform ?? process.platform).catch(() => ({
441
+ removed: [],
442
+ left: []
443
+ }));
444
+ const runtime = await removeRuntime(root).then(
445
+ (r) => ({ ...r, error: null }),
446
+ (err) => ({
447
+ removed: false,
448
+ left: [],
449
+ error: err instanceof Error ? err.message : String(err)
450
+ })
451
+ );
452
+ const lines = [
453
+ ...launcher.removed.map((p) => `removed the launcher ${tilde(p, home)}`),
454
+ ...launcher.left.map((p) => `left ${tilde(p, home)}: it is not a launcher Tenjin wrote`)
455
+ ];
456
+ if (runtime.error !== null) {
457
+ lines.push(`kept Tenjin's runtime ${tilde(root, home)}: ${runtime.error}`);
458
+ } else if (runtime.removed || runtime.left.length > 0) {
459
+ lines.push(
460
+ runtime.left.length === 0 ? `removed Tenjin's runtime ${tilde(root, home)}` : `removed Tenjin's runtime ${tilde(root, home)}, except what is still running:`,
461
+ ...runtime.left.map((p) => ` delete ${p} after this exits`),
462
+ "To remove the CLI too, run `npm uninstall -g tenjin-cli` now: always after `tenjin uninstall`, never before."
463
+ );
464
+ }
465
+ return {
466
+ data: {
467
+ runtime: { root, removed: runtime.removed, left: runtime.left },
468
+ launcher: { removed: launcher.removed, left: launcher.left }
469
+ },
470
+ humanLines: lines
471
+ };
472
+ }
473
+ export {
474
+ claudeInstallsLeft,
475
+ removeRuntimeAndLaunchers,
476
+ resolveUninstallTarget,
477
+ runRouterUninstall,
478
+ runtimeKeptFor
479
+ };
480
+ //# sourceMappingURL=uninstall-D5G67UJH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/router/uninstall.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { realpath, stat } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { isAbsolute, resolve, sep } from 'node:path';\nimport { persistRouterProject } from '../commands/config';\nimport type { CommandContext, CommandResult } from '../context';\nimport { loadRawConfig } from '../lib/config';\nimport { CliError } from '../lib/errors';\nimport { defaultDataDir, runtimeDir } from '../lib/paths';\nimport { runtimeStatePath } from '../lib/runtime-layout';\nimport { readWalletFacts } from '../lib/wallet-facts';\nimport { removeAliveState } from './alive';\nimport { findClaudeBinary, jsonList, jsonResult, runClaude, type ClaudeBinary } from './claude-cli';\nimport { projectInstallAt, settingsInstallPaths } from './install';\nimport { inspectLegacyInstall, removeLegacyInstall, type LegacyRemoval } from './legacy-install';\nimport { MARKETPLACE_NAME, PLUGIN_ID } from './names';\nimport { removePluginFolder, type FolderRemoval } from './plugin-folder';\nimport {\n folderFor,\n folderState,\n ownMarketplace,\n recordedInstalls,\n type InstallRecord,\n} from './plugin-registration';\n\n/**\n * `tenjin uninstall`: take out the install for where you are, and the shared\n * parts once no install is left anywhere.\n *\n * WHICH INSTALL. Claude Code records every `tenjin@tenjin` install, in any\n * scope or project, in its own `installed_plugins.json`; `install.routerProjects`\n * adds the projects `install --project` wired. A bare run takes the project\n * install whose folder is the cwd or the nearest one above it, else the user\n * install; `--project <path>` takes that project's, and `--all` every one. Each\n * goes through `claude plugin uninstall` run in exactly its own folder, the\n * only cwd Claude Code accepts for a local install.\n *\n * ALL OR NOTHING FOR THE SHARED PARTS. The marketplace (and, through `finish`\n * in `hosts.ts`, Tenjin's runtime and its launcher) go only when no install is\n * left anywhere and every removal this run asked for succeeded. A removal that\n * fails refuses, naming what was removed and what is left; so does a\n * marketplace Claude Code would not remove, which keeps the runtime its folder\n * lives in, and the launcher that retries.\n *\n * THE WALLET AND `spend.json` STAY. Removing an integration is not a reason to\n * destroy a key that holds funds or a ledger that records what was spent; both\n * are the user's, and the receipt says where they are.\n */\n\nexport type UninstallTarget =\n { kind: 'all' } | { kind: 'user' } | { kind: 'project'; path: string };\n\nexport interface RouterUninstallDeps {\n homeDir?: string;\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n findClaude?: (env: NodeJS.ProcessEnv) => ClaudeBinary | null;\n /** Runs one `claude` command; tests inject one that records its cwd. */\n runClaude?: typeof runClaude;\n}\n\n/** One install this run went after, and what became of it. */\nexport interface Removal {\n scope: InstallRecord['scope'];\n projectPath: string | null;\n /** `skipped`: the project folder is gone, so `claude` cannot be run there. */\n state: 'removed' | 'absent' | 'skipped' | 'failed';\n reason?: string;\n}\n\n/** `remaining`'s name for the user install; a project is its folder. */\nconst USER = 'user';\n\nconst real = (path: string): Promise<string> => realpath(path).catch(() => resolve(path));\nconst isDir = async (path: string): Promise<boolean> =>\n (await stat(path).catch(() => null))?.isDirectory() === true;\n\n/** Is `dir` the folder `parent`, or inside it? */\nfunction within(dir: string, parent: string): boolean {\n return dir === parent || dir.startsWith(parent.endsWith(sep) ? parent : `${parent}${sep}`);\n}\n\nfunction uncheckable(): CliError {\n return new CliError('REFUSED', \"Tenjin's plugin could not be checked, so nothing was removed\", {\n fix: `Run \\`tenjin uninstall\\` from a terminal where \\`claude\\` runs, or type /plugin uninstall ${PLUGIN_ID} in Claude Code.`,\n });\n}\n\n/**\n * EVERY INSTALL ON THIS MACHINE: Claude Code's record, plus each project in\n * `install.routerProjects` that still holds an install of ours, by realpath.\n * A project only that list names, and that holds nothing any more, is stale\n * and does not keep the shared parts. Throws when Claude Code's record is\n * there and cannot be read: what it holds is unknown, so nothing may go.\n * `recorded` counts the installs Claude Code itself records: only those need\n * `claude` to remove; a project only the list names is a folder install.\n */\nasync function installRecords(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<InstallRecord[] & { recorded: number }> {\n const claude = await recordedInstalls(env, home);\n if (claude === null) throw uncheckable();\n const listed = (await loadRawConfig(dataDir).catch(() => null))?.install?.routerProjects ?? [];\n const records: InstallRecord[] = [];\n const seen = new Set<string>();\n for (const r of claude) {\n const key = r.projectPath === null ? USER : await real(r.projectPath);\n if (seen.has(key)) continue;\n seen.add(key);\n records.push(r.projectPath === null ? r : { scope: 'local', projectPath: key });\n }\n const recorded = records.length;\n for (const dir of listed) {\n const key = await real(dir);\n if (seen.has(key) || !(await projectInstallAt(key, home, env))) continue;\n seen.add(key);\n records.push({ scope: 'local', projectPath: key });\n }\n return Object.assign(records, { recorded });\n}\n\n/**\n * The project install for `dir`: the record whose folder is `dir` or the\n * nearest one above it. One at home counts only from home itself, or every\n * folder under home would read as inside that project.\n */\nasync function nearestProject(\n records: InstallRecord[],\n dir: string,\n home: string,\n): Promise<(InstallRecord & { projectPath: string }) | undefined> {\n const homeReal = await real(home);\n return records\n .filter(\n (r): r is InstallRecord & { projectPath: string } =>\n r.projectPath !== null &&\n within(dir, r.projectPath) &&\n (r.projectPath !== homeReal || dir === homeReal),\n )\n .sort((a, b) => b.projectPath.length - a.projectPath.length)[0];\n}\n\n/**\n * Which install a run removes, decided before the hosts are picked: `--all`,\n * the project `--project` names (this folder's when it names none), or for a\n * bare run the project install here, else the user install.\n */\nexport async function resolveUninstallTarget(\n o: { all?: boolean; project?: string | true },\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<UninstallTarget> {\n if (o.all === true) return { kind: 'all' };\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n const cwd = deps.cwd ?? process.cwd();\n const records = await installRecords(ctx.dataDir, env, home);\n if (o.project !== undefined) {\n const dir = await real(o.project === true ? cwd : resolve(cwd, o.project));\n return {\n kind: 'project',\n path: (await nearestProject(records, dir, home))?.projectPath ?? dir,\n };\n }\n const here = await nearestProject(records, await real(cwd), home);\n return here !== undefined ? { kind: 'project', path: here.projectPath } : { kind: 'user' };\n}\n\nexport async function runRouterUninstall(\n o: { target: UninstallTarget },\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<CommandResult> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n if (!isAbsolute(home)) throw new Error('The home directory is not an absolute path.');\n const cwd = deps.cwd ?? process.cwd();\n const binary = (deps.findClaude ?? findClaudeBinary)(env);\n const run = (args: string[], at: string) =>\n (deps.runClaude ?? runClaude)(binary!, args, { env, cwd: at });\n\n const records = await installRecords(ctx.dataDir, env, home);\n // Only what Claude Code records needs `claude` to remove. A project only\n // `routerProjects` names is the folder a run with no `claude` wrote: it is\n // `absent` below, and its folder goes in cleanUp.\n if (binary === null && records.recorded > 0) throw uncheckable();\n const { target } = o;\n let targets = records.filter((r) =>\n target.kind === 'all'\n ? true\n : target.kind === 'user'\n ? r.projectPath === null\n : r.projectPath === target.path,\n );\n // A USER INSTALL CLAUDE CODE DOES NOT RECORD (the folder a run with no\n // `claude` wrote, which starts the runtime's own Node and entry) is one\n // `--all` removes too, and one any other run leaves in use.\n const userUnrecorded =\n !records.some((r) => r.projectPath === null) &&\n (await leftHere({ scope: 'user', projectPath: null }, env, home));\n if (target.kind === 'all' && userUnrecorded && targets.length > 0) {\n targets = [{ scope: 'user', projectPath: null }, ...targets];\n }\n const others = records.filter((r) => !targets.includes(r));\n if (targets.length === 0) {\n // NOTHING CLAUDE CODE RECORDS FOR THE TARGET. A folder or settings install\n // of ours is still one; with other installs left and neither, there is\n // nothing here to remove. With nothing left anywhere, the run goes on, so\n // a marketplace or runtime that outlived its plugin is cleared.\n const fallback: InstallRecord =\n target.kind === 'project'\n ? { scope: 'local', projectPath: target.path }\n : { scope: 'user', projectPath: null };\n const live = await liveOthers(others);\n if (live.length > 0 && !(await leftHere(fallback, env, home))) {\n return nothingHere(target, await real(cwd), live.map(labelOf), ctx.dataDir, env, home);\n }\n targets = [fallback];\n }\n\n const removals: Removal[] = [];\n for (const r of targets) {\n if (r.projectPath !== null && !(await isDir(r.projectPath))) {\n removals.push({ ...r, state: 'skipped', reason: `${r.projectPath} no longer exists` });\n continue;\n }\n // No binary and no record: Claude Code holds no install to remove.\n if (binary === null) {\n removals.push({ ...r, state: 'absent' });\n continue;\n }\n const out = await run(\n ['plugin', 'uninstall', PLUGIN_ID, '--scope', r.scope, '--json'],\n r.projectPath ?? home,\n );\n const result = jsonResult(out.stdout);\n if (out.code === 0) removals.push({ ...r, state: 'removed' });\n else if (result?.failureCode === 'not_installed') removals.push({ ...r, state: 'absent' });\n else {\n const message =\n typeof result?.message === 'string' ? result.message : out.stderr.trim().slice(0, 200);\n removals.push({ ...r, state: 'failed', reason: `claude plugin uninstall: ${message}` });\n }\n }\n\n // WHAT CLAUDE CODE STILL RECORDS decides, not the exit codes alone.\n const after = (await recordedInstalls(env, home)) ?? [];\n const afterKeys = new Set(\n await Promise.all(after.map((r) => (r.projectPath === null ? USER : real(r.projectPath)))),\n );\n const left = removals.filter(\n (r) =>\n r.state === 'failed' ||\n (r.state !== 'skipped' && afterKeys.has(r.projectPath === null ? USER : r.projectPath)),\n );\n const gone = removals.filter((r) => !left.includes(r) && r.state !== 'skipped');\n const userKept = userUnrecorded && !targets.some((r) => r.projectPath === null);\n const remaining =\n left.length > 0 ? [] : [...(userKept ? [USER] : []), ...(await liveOthers(others)).map(keyOf)];\n\n // THE INSTALLS THAT WENT leave their plugin folders and settings installs\n // too, and are forgotten, so a later `tenjin update` does not go looking for\n // a project this machine no longer wires. Done before a refusal as well.\n const folders: FolderRemoval[] = [];\n const settings: { path: string; found: boolean; removed: LegacyRemoval | null }[] = [];\n const cleanUp = async (): Promise<void> => {\n for (const r of gone) {\n const at = r.projectPath ?? home;\n folders.push(await removePluginFolder(folderFor(r.scope, env, home, at)));\n const paths = settingsInstallPaths(r.projectPath !== null, env, home, at);\n const legacy = await inspectLegacyInstall(paths.settingsPath, paths.mcpFile);\n settings.push({\n path: paths.settingsPath,\n found: legacy.present,\n removed: legacy.present\n ? await removeLegacyInstall(legacy, { binary, env, cwd: at, mcpScope: paths.mcpScope })\n : null,\n });\n }\n for (const r of removals) {\n if (r.projectPath !== null && !left.includes(r)) {\n await persistRouterProject(ctx.dataDir, r.projectPath, false).catch(() => undefined);\n }\n }\n };\n\n const named = (list: Removal[]) => list.map(labelOf).join(', ') || 'nothing';\n if (left.length > 0) {\n await cleanUp();\n throw new CliError(\n 'REFUSED',\n `${left.length} Tenjin install${left.length === 1 ? '' : 's'} could not be removed: ${left.map((r) => `${labelOf(r)}${r.reason !== undefined ? ` (${r.reason})` : ''}`).join(', ')}. Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: { removed: gone.map(keyOf), left: left.map(keyOf), removals },\n fix: retryFix(target, left),\n },\n );\n }\n\n let marketplace: 'removed' | 'absent' | 'kept' = 'kept';\n let marketplaceWhy: string | undefined;\n if (remaining.length > 0) {\n marketplaceWhy = `Kept ${sharedParts(ctx.dataDir, home)}: still used by ${remaining.map(nameOf).join(', ')}.`;\n } else if (binary === null) {\n marketplaceWhy = `the ${MARKETPLACE_NAME} marketplace was not checked: no claude binary on PATH or in CLAUDE_CODE_EXECPATH`;\n } else {\n // THE MARKETPLACE GOES ONLY WHEN IT IS THE ONE `install` ADDED, and\n // unscoped from home: that clears every scope's record of it.\n const listing = await run(['plugin', 'marketplace', 'list', '--json'], home);\n const listed = jsonList(listing.stdout);\n if (listed === null) {\n // A LIST THAT DID NOT ANSWER IS NOT AN ABSENT MARKETPLACE: it may still be\n // registered on the runtime's folder, so the shared parts stay with it.\n await cleanUp();\n const again = againCommand(target);\n throw new CliError(\n 'REFUSED',\n `The ${MARKETPLACE_NAME} marketplace could not be checked (claude plugin marketplace list${listing.stderr.trim() !== '' ? `: ${listing.stderr.trim().slice(0, 200)}` : ''}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: {\n removed: gone.map(keyOf),\n left: [`${MARKETPLACE_NAME} marketplace`],\n removals,\n },\n fix: `Run \\`${again}\\` again.`,\n },\n );\n }\n const row = listed.find((m) => m.name === MARKETPLACE_NAME);\n if (row === undefined) marketplace = 'absent';\n else if (!(await ownMarketplace(row))) {\n marketplaceWhy = `kept the ${MARKETPLACE_NAME} marketplace: it is not one \\`tenjin install\\` added`;\n } else {\n const removed = await run(\n ['plugin', 'marketplace', 'remove', MARKETPLACE_NAME, '--json'],\n home,\n );\n if (removed.code !== 0) {\n // A MARKETPLACE STILL REGISTERED KEEPS ITS FOLDER: it is the runtime's\n // `claude` folder, so the runtime and the launcher a retry runs must\n // stay with it. A refusal keeps `uninstallEach` from removing them.\n await cleanUp();\n const result = jsonResult(removed.stdout);\n const why =\n typeof result?.message === 'string'\n ? result.message\n : removed.stderr.trim().slice(0, 200);\n const again = againCommand(target);\n throw new CliError(\n 'REFUSED',\n `The ${MARKETPLACE_NAME} marketplace could not be removed (claude plugin marketplace remove${why !== '' ? `: ${why}` : ''}). Removed: ${named(gone)}. Kept ${sharedParts(ctx.dataDir, home)}.`,\n {\n details: {\n removed: gone.map(keyOf),\n left: [`${MARKETPLACE_NAME} marketplace`],\n removals,\n },\n fix: `Run \\`${again}\\` again; if it still fails, run \\`claude plugin marketplace remove ${MARKETPLACE_NAME}\\`, then \\`${again}\\`.`,\n },\n );\n }\n marketplace = 'removed';\n }\n }\n await cleanUp();\n const aliveRemoved = remaining.length === 0 ? await removeAliveState(ctx.dataDir) : false;\n const kept = await keptBlock(ctx.dataDir, env, home);\n\n const data = {\n target,\n removals,\n remaining,\n marketplace,\n ...(remaining.length > 0 ? { marketplaceKeptFor: remaining } : {}),\n folders,\n settings,\n aliveRemoved,\n kept: kept.data,\n };\n const lines = [\n ...removals.map(removalLine),\n ...(marketplace === 'removed' ? [`removed the ${MARKETPLACE_NAME} marketplace`] : []),\n ...(marketplaceWhy !== undefined ? [marketplaceWhy] : []),\n ...folders.flatMap(folderLines),\n ...settings.flatMap((s) => settingsLines(s.path, s.removed)),\n ...kept.lines,\n ];\n return { data, humanLines: lines };\n}\n\n/**\n * The way back after a removal that failed: this run's own target again (a\n * bare run here finds the same install; from elsewhere it would not), then\n * Claude Code's own command, in each project's folder where one is left.\n */\nfunction retryFix(target: UninstallTarget, left: Removal[]): string {\n const again = againCommand(target);\n const projects = left.flatMap((r) => (r.projectPath !== null ? [r.projectPath] : []));\n const where =\n projects.length === 0\n ? 'a Claude Code session'\n : `a Claude Code session started in ${projects.join(', ')}${projects.length < left.length ? ' (any session for your user install)' : ''}`;\n return `Run \\`${again}\\` again; if it still fails, type /plugin uninstall ${PLUGIN_ID} in ${where}.`;\n}\n\n/** This run's own target as a command: a bare run here finds the same install; from elsewhere it would not. */\nfunction againCommand(target: UninstallTarget): string {\n return target.kind === 'all'\n ? 'tenjin uninstall --all'\n : target.kind === 'project'\n ? `tenjin uninstall --project ${shellWord(target.path)}`\n : 'tenjin uninstall';\n}\n\n/** `path` as one shell word: quoted only when it needs to be. */\nfunction shellWord(path: string): string {\n return /^[\\w@%+=:,./~-]+$/.test(path) ? path : `'${path.replace(/'/g, \"'\\\\''\")}'`;\n}\n\n/** The other installs that can still be used: the user's, and projects still on disk. */\nasync function liveOthers(others: InstallRecord[]): Promise<InstallRecord[]> {\n const live: InstallRecord[] = [];\n for (const r of others) if (r.projectPath === null || (await isDir(r.projectPath))) live.push(r);\n return live;\n}\n\n/** An install of ours Claude Code does not record: a plugin folder, or a settings install. */\nasync function leftHere(r: InstallRecord, env: NodeJS.ProcessEnv, home: string): Promise<boolean> {\n if (r.projectPath !== null) return projectInstallAt(r.projectPath, home, env);\n if ((await folderState('user', env, home, home)).state === 'ours') return true;\n const paths = settingsInstallPaths(false, env, home, home);\n return (await inspectLegacyInstall(paths.settingsPath, paths.mcpFile)).present;\n}\n\nconst keyOf = (r: Pick<InstallRecord, 'projectPath'>): string => r.projectPath ?? USER;\nconst nameOf = (key: string): string => (key === USER ? 'your user install' : key);\nconst labelOf = (r: Pick<InstallRecord, 'projectPath'>): string => nameOf(keyOf(r));\n\n/**\n * Does Claude Code hold any Tenjin install still, in any scope or project?\n * Asked by an uninstall Claude Code was not part of (Codex removed last), so\n * the runtime goes only once nothing at all can use it. A record that cannot\n * be read counts as one.\n */\nexport async function claudeInstallsLeft(\n ctx: CommandContext,\n deps: RouterUninstallDeps = {},\n): Promise<boolean> {\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n try {\n const records = await installRecords(ctx.dataDir, env, home);\n if ((await liveOthers(records)).length > 0) return true;\n return await leftHere({ scope: 'user', projectPath: null }, env, home);\n } catch {\n return true;\n }\n}\n\n/** The line for a runtime kept because another recorded host still runs it; none where there is no runtime. */\nexport function runtimeKeptFor(dataDir: string, home: string, users: string[]): string | null {\n if (!hasRuntime(dataDir, home)) return null;\n return `Kept Tenjin's runtime and its launcher: still used by ${users.join(', ')}.`;\n}\n\n/** The parts every install shares, as the \"kept\" lines name them: the runtime only where there is one. */\nfunction sharedParts(dataDir: string, home: string): string {\n return hasRuntime(dataDir, home)\n ? `the ${MARKETPLACE_NAME} marketplace, Tenjin's runtime and its launcher`\n : `the ${MARKETPLACE_NAME} marketplace`;\n}\n\n/**\n * Is there a runtime to keep? Only the default data dir has one, and only once\n * an install set it up: a platform Tenjin pins no Node for, or an install that\n * fell back, has none.\n */\nfunction hasRuntime(dataDir: string, home: string): boolean {\n return isDefaultDataDir(dataDir, home) && existsSync(runtimeStatePath(runtimeDir(dataDir)));\n}\n\nfunction isDefaultDataDir(dataDir: string, home: string): boolean {\n return resolve(dataDir) === resolve(defaultDataDir(home));\n}\n\nasync function nothingHere(\n target: UninstallTarget,\n cwd: string,\n installed: string[],\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<CommandResult> {\n const whose =\n target.kind !== 'project'\n ? 'your user'\n : target.path === cwd\n ? \"this folder's project\"\n : target.path;\n const kept = await keptBlock(dataDir, env, home);\n return {\n data: {\n target,\n removals: [],\n remaining: installed,\n marketplace: 'kept',\n marketplaceKeptFor: installed,\n folders: [],\n settings: [],\n aliveRemoved: false,\n kept: kept.data,\n },\n humanLines: [\n `No Tenjin install for ${whose}, so nothing was removed. Still installed: ${installed.join(', ')}. Run \\`tenjin uninstall --project <path>\\` for one of them, or \\`tenjin uninstall --all\\`.`,\n ],\n };\n}\n\nfunction removalLine(r: Removal): string {\n const which = r.projectPath === null ? 'your user install' : `the install for ${r.projectPath}`;\n switch (r.state) {\n case 'removed':\n return `removed the ${PLUGIN_ID} plugin (${which})`;\n case 'absent':\n return `plugin: ${PLUGIN_ID} was not installed (${which})`;\n case 'skipped':\n return `skipped ${which}: ${r.reason ?? 'its folder no longer exists'}`;\n case 'failed':\n return `plugin: ${r.reason ?? 'left in place'} (${which})`;\n }\n}\n\nfunction folderLines(folder: FolderRemoval): string[] {\n if (folder.removed) {\n return [\n folder.left.length === 0\n ? `removed the plugin folder ${folder.path}`\n : `removed the plugin's files from ${folder.path}; kept what is not Tenjin's: ${folder.left.join(', ')}`,\n ];\n }\n return folder.reason !== undefined ? [`folder: ${folder.reason}`] : [];\n}\n\nfunction settingsLines(settingsPath: string, settings: LegacyRemoval | null): string[] {\n if (settings === null) return [];\n const lines: string[] = [];\n const parts = [\n ...(settings.events.length > 0 ? [`hook entries (${settings.events.join(', ')})`] : []),\n ...(settings.allowRule || settings.denyRule ? ['the permission rules'] : []),\n ...(settings.statusLine !== 'kept' ? ['the status line'] : []),\n ...(settings.mcp === 'removed' ? ['the x402 MCP server'] : []),\n ];\n if (parts.length > 0) {\n lines.push(`removed the settings install's ${parts.join(', ')} from ${settingsPath}`);\n }\n lines.push(...settings.warnings.map((w) => `settings: ${w}`));\n return lines;\n}\n\n/** `path` with the home folder written as `~`. */\nfunction tilde(path: string, home: string): string {\n return path === home || path.startsWith(`${home}${sep}`) ? `~${path.slice(home.length)}` : path;\n}\n\n/**\n * WHAT STAYS, said last: the data dir with the wallet (named, since it may\n * hold funds), and where its passphrase is kept. Read through the hook-safe\n * facts: nothing is unlocked to name them.\n */\nasync function keptBlock(\n dataDir: string,\n env: NodeJS.ProcessEnv,\n home: string,\n): Promise<{\n data: { dataDir: string; wallet: string | null; passphraseStore: string | null };\n lines: string[];\n}> {\n const facts = await readWalletFacts(dataDir, env);\n const wallet = facts.address;\n let store: string | null = null;\n if (wallet !== null && facts.passphraseStore !== null) {\n const { describeStoreLocation } = await import('../lib/wallet/passphrase');\n store = describeStoreLocation(facts.passphraseStore, wallet.toLowerCase(), dataDir);\n }\n const lines = [\n wallet !== null\n ? `Kept ${tilde(dataDir, home)}: your wallet ${wallet} (it may hold funds; move them with \\`tenjin wallet send\\` before you delete it), the spend ledger and the config.`\n : `Kept ${tilde(dataDir, home)}: the spend ledger and the config.`,\n ...(store !== null ? [`The wallet passphrase stays in ${store}.`] : []),\n ...(facts.envPassphraseSet\n ? [\n 'TENJIN_WALLET_PASSPHRASE is set in this shell; remove its export line from your shell startup file if you added one.',\n ]\n : []),\n ];\n return { data: { dataDir, wallet, passphraseStore: store }, lines };\n}\n\nexport interface RuntimeRemovalDeps {\n platform?: NodeJS.Platform;\n /** Tests inject these; the defaults are `runtime.ts`'s own. */\n removeLaunchers?: (\n home: string,\n platform?: NodeJS.Platform,\n ) => Promise<{ removed: string[]; left: string[] }>;\n removeRuntime?: (root: string) => Promise<{ removed: boolean; left: string[] }>;\n}\n\n/**\n * UNINSTALL'S LAST STEP, run by `hosts.uninstallEach` only once no install is\n * left anywhere: the launchers, then Tenjin's runtime. Nothing under a\n * non-default data dir, whose installs never had either.\n *\n * NOTHING IS IMPORTED AFTER THE REMOVAL. When this build runs from the\n * runtime, its own files are gone once it returns, so `runtime.ts` is loaded\n * first and every line after is plain string work. On Windows a running\n * `node.exe` keeps its folder; it is named, to delete once this exits.\n */\nexport async function removeRuntimeAndLaunchers(\n dataDir: string,\n home: string,\n deps: RuntimeRemovalDeps = {},\n): Promise<CommandResult> {\n if (!isDefaultDataDir(dataDir, home)) {\n return { data: { runtime: null, launcher: null }, humanLines: [] };\n }\n const lib =\n deps.removeLaunchers !== undefined && deps.removeRuntime !== undefined\n ? null\n : await import('../lib/runtime');\n const removeLaunchers = deps.removeLaunchers ?? lib!.removeLaunchers;\n const removeRuntime = deps.removeRuntime ?? lib!.removeRuntime;\n const root = runtimeDir(dataDir);\n const launcher = await removeLaunchers(home, deps.platform ?? process.platform).catch(() => ({\n removed: [] as string[],\n left: [] as string[],\n }));\n const runtime = await removeRuntime(root).then(\n (r) => ({ ...r, error: null as string | null }),\n (err: unknown) => ({\n removed: false,\n left: [] as string[],\n error: err instanceof Error ? err.message : String(err),\n }),\n );\n const lines = [\n ...launcher.removed.map((p) => `removed the launcher ${tilde(p, home)}`),\n ...launcher.left.map((p) => `left ${tilde(p, home)}: it is not a launcher Tenjin wrote`),\n ];\n if (runtime.error !== null) {\n lines.push(`kept Tenjin's runtime ${tilde(root, home)}: ${runtime.error}`);\n } else if (runtime.removed || runtime.left.length > 0) {\n lines.push(\n runtime.left.length === 0\n ? `removed Tenjin's runtime ${tilde(root, home)}`\n : `removed Tenjin's runtime ${tilde(root, home)}, except what is still running:`,\n ...runtime.left.map((p) => ` delete ${p} after this exits`),\n 'To remove the CLI too, run `npm uninstall -g tenjin-cli` now: always after `tenjin uninstall`, never before.',\n );\n }\n return {\n data: {\n runtime: { root, removed: runtime.removed, left: runtime.left },\n launcher: { removed: launcher.removed, left: launcher.left },\n },\n humanLines: lines,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe;AACxB,SAAS,YAAY,SAAS,WAAW;AAoEzC,IAAM,OAAO;AAEb,IAAM,OAAO,CAAC,SAAkC,SAAS,IAAI,EAAE,MAAM,MAAM,QAAQ,IAAI,CAAC;AACxF,IAAM,QAAQ,OAAO,UAClB,MAAM,KAAK,IAAI,EAAE,MAAM,MAAM,IAAI,IAAI,YAAY,MAAM;AAG1D,SAAS,OAAO,KAAa,QAAyB;AACpD,SAAO,QAAQ,UAAU,IAAI,WAAW,OAAO,SAAS,GAAG,IAAI,SAAS,GAAG,MAAM,GAAG,GAAG,EAAE;AAC3F;AAEA,SAAS,cAAwB;AAC/B,SAAO,IAAI,SAAS,WAAW,gEAAgE;AAAA,IAC7F,KAAK,6FAA6F,SAAS;AAAA,EAC7G,CAAC;AACH;AAWA,eAAe,eACb,SACA,KACA,MACiD;AACjD,QAAM,SAAS,MAAM,iBAAiB,KAAK,IAAI;AAC/C,MAAI,WAAW,KAAM,OAAM,YAAY;AACvC,QAAM,UAAU,MAAM,cAAc,OAAO,EAAE,MAAM,MAAM,IAAI,IAAI,SAAS,kBAAkB,CAAC;AAC7F,QAAM,UAA2B,CAAC;AAClC,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,KAAK,QAAQ;AACtB,UAAM,MAAM,EAAE,gBAAgB,OAAO,OAAO,MAAM,KAAK,EAAE,WAAW;AACpE,QAAI,KAAK,IAAI,GAAG,EAAG;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