@shareai-lab/kode 2.0.1 → 2.0.3

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 (343) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +649 -25
  3. package/README.zh-CN.md +579 -0
  4. package/cli-acp.js +3 -17
  5. package/cli.js +5 -7
  6. package/dist/chunks/Doctor-M3J7GRTJ.js +12 -0
  7. package/dist/chunks/LogList-ISWZ6DDD.js +121 -0
  8. package/dist/chunks/LogList-ISWZ6DDD.js.map +7 -0
  9. package/dist/chunks/REPL-RQ6LO6S7.js +56 -0
  10. package/dist/chunks/ResumeConversation-6DMVBEGH.js +56 -0
  11. package/dist/chunks/agentLoader-FCRG3TFJ.js +31 -0
  12. package/dist/{agentsValidate-7LH4HTNR.js → chunks/agentsValidate-PEWMYN4Q.js} +97 -69
  13. package/dist/chunks/agentsValidate-PEWMYN4Q.js.map +7 -0
  14. package/dist/{ask-3NHFFUQG.js → chunks/ask-D7SOHJ6Z.js} +36 -44
  15. package/dist/chunks/ask-D7SOHJ6Z.js.map +7 -0
  16. package/dist/chunks/autoUpdater-CNESBOKO.js +19 -0
  17. package/dist/{chunk-AFFSCMYS.js → chunks/chunk-2JN5MY67.js} +12 -14
  18. package/dist/chunks/chunk-2JN5MY67.js.map +7 -0
  19. package/dist/chunks/chunk-2QONJ5MG.js +14 -0
  20. package/dist/chunks/chunk-2QONJ5MG.js.map +7 -0
  21. package/dist/chunks/chunk-2WEXPKHH.js +903 -0
  22. package/dist/chunks/chunk-2WEXPKHH.js.map +7 -0
  23. package/dist/{chunk-ARZSBOAO.js → chunks/chunk-3BYE3ME6.js} +717 -792
  24. package/dist/chunks/chunk-3BYE3ME6.js.map +7 -0
  25. package/dist/chunks/chunk-3JDNWX7W.js +1264 -0
  26. package/dist/chunks/chunk-3JDNWX7W.js.map +7 -0
  27. package/dist/chunks/chunk-3OEJVB5A.js +906 -0
  28. package/dist/chunks/chunk-3OEJVB5A.js.map +7 -0
  29. package/dist/chunks/chunk-3TNIOEBO.js +369 -0
  30. package/dist/chunks/chunk-3TNIOEBO.js.map +7 -0
  31. package/dist/chunks/chunk-4A46ZXMJ.js +67 -0
  32. package/dist/chunks/chunk-4A46ZXMJ.js.map +7 -0
  33. package/dist/{chunk-UHYRLID6.js → chunks/chunk-4ATBQOFO.js} +107 -55
  34. package/dist/chunks/chunk-4ATBQOFO.js.map +7 -0
  35. package/dist/chunks/chunk-4CRUCZR4.js +0 -0
  36. package/dist/{chunk-YC6LJCDE.js → chunks/chunk-4EO6SIQY.js} +32 -75
  37. package/dist/chunks/chunk-4EO6SIQY.js.map +7 -0
  38. package/dist/chunks/chunk-53M46S5I.js +64 -0
  39. package/dist/chunks/chunk-53M46S5I.js.map +7 -0
  40. package/dist/{chunk-JC6NCUG5.js → chunks/chunk-54KOYG5C.js} +0 -2
  41. package/dist/{chunk-EZXMVTDU.js → chunks/chunk-6BAS4WY6.js} +29 -45
  42. package/dist/chunks/chunk-6BAS4WY6.js.map +7 -0
  43. package/dist/{chunk-3IN27HA5.js → chunks/chunk-6KRRFSDN.js} +4 -6
  44. package/dist/chunks/chunk-6KRRFSDN.js.map +7 -0
  45. package/dist/chunks/chunk-6LJNZK4K.js +39 -0
  46. package/dist/chunks/chunk-6LJNZK4K.js.map +7 -0
  47. package/dist/chunks/chunk-6ZWEOSEI.js +666 -0
  48. package/dist/chunks/chunk-6ZWEOSEI.js.map +7 -0
  49. package/dist/chunks/chunk-77XDJMBP.js +3326 -0
  50. package/dist/chunks/chunk-77XDJMBP.js.map +7 -0
  51. package/dist/chunks/chunk-7RRW4NTB.js +6454 -0
  52. package/dist/chunks/chunk-7RRW4NTB.js.map +7 -0
  53. package/dist/chunks/chunk-7X3TW4JB.js +4520 -0
  54. package/dist/chunks/chunk-7X3TW4JB.js.map +7 -0
  55. package/dist/chunks/chunk-B3MW3YGY.js +1409 -0
  56. package/dist/chunks/chunk-B3MW3YGY.js.map +7 -0
  57. package/dist/chunks/chunk-BBJFHTBC.js +28 -0
  58. package/dist/chunks/chunk-BBJFHTBC.js.map +7 -0
  59. package/dist/chunks/chunk-BHDHXOXB.js +24 -0
  60. package/dist/chunks/chunk-BHDHXOXB.js.map +7 -0
  61. package/dist/{chunk-73WGVYLQ.js → chunks/chunk-BTA7SZ26.js} +152 -223
  62. package/dist/chunks/chunk-BTA7SZ26.js.map +7 -0
  63. package/dist/chunks/chunk-CDGRYGPZ.js +103 -0
  64. package/dist/chunks/chunk-CDGRYGPZ.js.map +7 -0
  65. package/dist/{chunk-S6HRABTA.js → chunks/chunk-CP6E5UG6.js} +1 -4
  66. package/dist/chunks/chunk-CP6E5UG6.js.map +7 -0
  67. package/dist/{chunk-QVLYOPO5.js → chunks/chunk-DQ4JHXMT.js} +462 -424
  68. package/dist/chunks/chunk-DQ4JHXMT.js.map +7 -0
  69. package/dist/chunks/chunk-DXD76CMV.js +208 -0
  70. package/dist/chunks/chunk-DXD76CMV.js.map +7 -0
  71. package/dist/chunks/chunk-GCQCAXJZ.js +0 -0
  72. package/dist/chunks/chunk-GELCZWMB.js +42 -0
  73. package/dist/chunks/chunk-GELCZWMB.js.map +7 -0
  74. package/dist/{chunk-K2CWOTI2.js → chunks/chunk-HJYOH4HC.js} +23 -18
  75. package/dist/chunks/chunk-HJYOH4HC.js.map +7 -0
  76. package/dist/chunks/chunk-HPYNW6TT.js +744 -0
  77. package/dist/chunks/chunk-HPYNW6TT.js.map +7 -0
  78. package/dist/{chunk-RZWOUA25.js → chunks/chunk-HRJ3ICQK.js} +59 -55
  79. package/dist/chunks/chunk-HRJ3ICQK.js.map +7 -0
  80. package/dist/{chunk-DZE5YA7L.js → chunks/chunk-IFCIADS3.js} +571 -573
  81. package/dist/chunks/chunk-IFCIADS3.js.map +7 -0
  82. package/dist/chunks/chunk-IN7XZ7BC.js +27 -0
  83. package/dist/chunks/chunk-IN7XZ7BC.js.map +7 -0
  84. package/dist/chunks/chunk-L7P4M4KW.js +193 -0
  85. package/dist/chunks/chunk-L7P4M4KW.js.map +7 -0
  86. package/dist/chunks/chunk-LB6TCPDI.js +0 -0
  87. package/dist/{chunk-3RUXVV4S.js → chunks/chunk-LOCXPQNJ.js} +1 -4
  88. package/dist/{chunk-3RUXVV4S.js.map → chunks/chunk-LOCXPQNJ.js.map} +2 -2
  89. package/dist/{chunk-7M2YN6TU.js → chunks/chunk-LOD5ZHCI.js} +213 -208
  90. package/dist/chunks/chunk-LOD5ZHCI.js.map +7 -0
  91. package/dist/{chunk-S3J2TLV6.js → chunks/chunk-M7P3QNRU.js} +1 -4
  92. package/dist/{chunk-S3J2TLV6.js.map → chunks/chunk-M7P3QNRU.js.map} +2 -2
  93. package/dist/chunks/chunk-PPHLQVL7.js +4234 -0
  94. package/dist/chunks/chunk-PPHLQVL7.js.map +7 -0
  95. package/dist/{chunk-ABLVTESJ.js → chunks/chunk-QAXE37B5.js} +1 -4
  96. package/dist/chunks/chunk-QAXE37B5.js.map +7 -0
  97. package/dist/chunks/chunk-QHQOBUF6.js +60 -0
  98. package/dist/chunks/chunk-QHQOBUF6.js.map +7 -0
  99. package/dist/{chunk-W7GRKO7Q.js → chunks/chunk-RPJXO7GG.js} +241 -214
  100. package/dist/chunks/chunk-RPJXO7GG.js.map +7 -0
  101. package/dist/{chunk-NPFOMITO.js → chunks/chunk-SWQV4KSY.js} +1 -4
  102. package/dist/{chunk-NPFOMITO.js.map → chunks/chunk-SWQV4KSY.js.map} +2 -2
  103. package/dist/chunks/chunk-SZLAPULP.js +28 -0
  104. package/dist/chunks/chunk-SZLAPULP.js.map +7 -0
  105. package/dist/{chunk-7U7L4NMD.js → chunks/chunk-T7RB5V5J.js} +23 -25
  106. package/dist/chunks/chunk-T7RB5V5J.js.map +7 -0
  107. package/dist/{chunk-HN4E4UUQ.js → chunks/chunk-TI2CTTMA.js} +25 -17
  108. package/dist/chunks/chunk-TI2CTTMA.js.map +7 -0
  109. package/dist/{chunk-ZVDRDPII.js → chunks/chunk-TNGVRTO5.js} +45 -20
  110. package/dist/chunks/chunk-TNGVRTO5.js.map +7 -0
  111. package/dist/chunks/chunk-TNWB3U5Y.js +2077 -0
  112. package/dist/chunks/chunk-TNWB3U5Y.js.map +7 -0
  113. package/dist/chunks/chunk-U2IHWPCU.js +12 -0
  114. package/dist/chunks/chunk-U2IHWPCU.js.map +7 -0
  115. package/dist/{chunk-KAA5BGMQ.js → chunks/chunk-UNOY3VJ2.js} +1 -4
  116. package/dist/{chunk-KAA5BGMQ.js.map → chunks/chunk-UNOY3VJ2.js.map} +2 -2
  117. package/dist/{chunk-MWRSY4X6.js → chunks/chunk-UVDJL6ZZ.js} +97 -58
  118. package/dist/chunks/chunk-UVDJL6ZZ.js.map +7 -0
  119. package/dist/chunks/chunk-VNCW4C2Z.js +13452 -0
  120. package/dist/chunks/chunk-VNCW4C2Z.js.map +7 -0
  121. package/dist/chunks/chunk-W5EGGA44.js +15 -0
  122. package/dist/chunks/chunk-W5EGGA44.js.map +7 -0
  123. package/dist/chunks/chunk-XR2W3MAM.js +1533 -0
  124. package/dist/chunks/chunk-XR2W3MAM.js.map +7 -0
  125. package/dist/{chunk-STSX7GIX.js → chunks/chunk-YIO5EBMQ.js} +423 -377
  126. package/dist/chunks/chunk-YIO5EBMQ.js.map +7 -0
  127. package/dist/chunks/chunk-ZBVLKZ5V.js +1062 -0
  128. package/dist/chunks/chunk-ZBVLKZ5V.js.map +7 -0
  129. package/dist/{chunk-E6YNABER.js → chunks/chunk-ZCLTZIVP.js} +1 -4
  130. package/dist/chunks/chunk-ZCLTZIVP.js.map +7 -0
  131. package/dist/chunks/client-SILZNM5N.js +42 -0
  132. package/dist/{config-RUSD6G5Y.js → chunks/config-25HRTPSP.js} +48 -10
  133. package/dist/chunks/cost-tracker-Z2UZT2J5.js +28 -0
  134. package/dist/{customCommands-TOIJFZAL.js → chunks/customCommands-TYMYZRG5.js} +11 -8
  135. package/dist/chunks/engine-MRVF6FK6.js +39 -0
  136. package/dist/{env-XGKBLU3D.js → chunks/env-TJ5NOBEB.js} +7 -5
  137. package/dist/{kodeAgentSessionId-X6XWQW7B.js → chunks/kodeAgentSessionId-VTNISJ2L.js} +2 -4
  138. package/dist/chunks/kodeAgentSessionLoad-YB2RKBGJ.js +15 -0
  139. package/dist/chunks/kodeAgentSessionResume-DZSIVKVA.js +13 -0
  140. package/dist/chunks/kodeAgentStreamJson-X5PLS2S6.js +11 -0
  141. package/dist/{kodeAgentStreamJsonSession-UGEZJJEB.js → chunks/kodeAgentStreamJsonSession-RDXM4XYF.js} +38 -24
  142. package/dist/chunks/kodeAgentStreamJsonSession-RDXM4XYF.js.map +7 -0
  143. package/dist/{chunk-4RTX4AG4.js → chunks/kodeAgentStructuredStdio-SVGDSB4P.js} +14 -9
  144. package/dist/chunks/kodeAgentStructuredStdio-SVGDSB4P.js.map +7 -0
  145. package/dist/{kodeHooks-QWM36A3D.js → chunks/kodeHooks-RVKYRJHG.js} +11 -9
  146. package/dist/{llm-ZUQC4WYM.js → chunks/llm-62N6T5ZT.js} +1734 -1526
  147. package/dist/chunks/llm-62N6T5ZT.js.map +7 -0
  148. package/dist/chunks/llmLazy-ZUSSE3ZA.js +13 -0
  149. package/dist/{mentionProcessor-EE3XFHCJ.js → chunks/mentionProcessor-RJW5UPJD.js} +46 -16
  150. package/dist/chunks/mentionProcessor-RJW5UPJD.js.map +7 -0
  151. package/dist/{messages-EOYQKPGM.js → chunks/messages-EEWWLPHN.js} +2 -6
  152. package/dist/chunks/model-5TIEKQPD.js +37 -0
  153. package/dist/{openai-RRCWW33N.js → chunks/openai-XXK3YZG4.js} +13 -10
  154. package/dist/{outputStyles-62Q3VH2J.js → chunks/outputStyles-FAJTXN2A.js} +6 -9
  155. package/dist/chunks/permissions-HO7INPWM.js +27 -0
  156. package/dist/{pluginRuntime-6ETCZ2LL.js → chunks/pluginRuntime-C7K5ULK2.js} +31 -48
  157. package/dist/chunks/pluginRuntime-C7K5ULK2.js.map +7 -0
  158. package/dist/chunks/pluginValidation-DAM7WRTC.js +20 -0
  159. package/dist/chunks/registry-XYJXMOA5.js +60 -0
  160. package/dist/chunks/responsesStreaming-JNGE2P3D.js +8 -0
  161. package/dist/chunks/runNonTextPrintMode-SVBLCZQX.js +577 -0
  162. package/dist/chunks/runNonTextPrintMode-SVBLCZQX.js.map +7 -0
  163. package/dist/chunks/server-REXXF5IK.js +46 -0
  164. package/dist/{skillMarketplace-3RXQBVOL.js → chunks/skillMarketplace-N4HVHNST.js} +8 -6
  165. package/dist/chunks/src-OROQIWP3.js +44 -0
  166. package/dist/chunks/src-QXLGGMUW.js +1647 -0
  167. package/dist/chunks/src-QXLGGMUW.js.map +7 -0
  168. package/dist/{cli-DOPVY2CW.js → chunks/src-SSDT6MVP.js} +2659 -3384
  169. package/dist/chunks/src-SSDT6MVP.js.map +7 -0
  170. package/dist/chunks/theme-YBJUIMWK.js +10 -0
  171. package/dist/{toolPermissionContext-65L65VEZ.js → chunks/toolPermissionContext-MOCTRR7N.js} +2 -4
  172. package/dist/chunks/toolPermissionSettings-EV2EJAXL.js +18 -0
  173. package/dist/chunks/toolPermissionSettings-EV2EJAXL.js.map +7 -0
  174. package/dist/chunks/uuid-6577SO6X.js +7 -0
  175. package/dist/chunks/uuid-6577SO6X.js.map +7 -0
  176. package/dist/chunks/webOnlyMode-ALXX7UQY.js +66 -0
  177. package/dist/chunks/webOnlyMode-ALXX7UQY.js.map +7 -0
  178. package/dist/entrypoints/cli.js +10 -0
  179. package/dist/entrypoints/cli.js.map +7 -0
  180. package/dist/entrypoints/daemon.js +10 -0
  181. package/dist/entrypoints/daemon.js.map +7 -0
  182. package/dist/entrypoints/mcp.js +71 -0
  183. package/dist/entrypoints/mcp.js.map +7 -0
  184. package/dist/index.js +6 -7
  185. package/dist/index.js.map +3 -3
  186. package/dist/sdk/client.cjs +391 -0
  187. package/dist/sdk/client.cjs.map +7 -0
  188. package/dist/sdk/client.js +364 -0
  189. package/dist/sdk/client.js.map +7 -0
  190. package/dist/sdk/core.cjs +19932 -0
  191. package/dist/sdk/core.cjs.map +7 -0
  192. package/dist/sdk/core.js +19893 -0
  193. package/dist/sdk/core.js.map +7 -0
  194. package/dist/sdk/daemon-client.cjs +257 -0
  195. package/dist/sdk/daemon-client.cjs.map +7 -0
  196. package/dist/sdk/daemon-client.js +221 -0
  197. package/dist/sdk/daemon-client.js.map +7 -0
  198. package/dist/sdk/protocol.cjs +170 -0
  199. package/dist/sdk/protocol.cjs.map +7 -0
  200. package/dist/sdk/protocol.js +140 -0
  201. package/dist/sdk/protocol.js.map +7 -0
  202. package/dist/sdk/runtime-node.cjs +236 -0
  203. package/dist/sdk/runtime-node.cjs.map +7 -0
  204. package/dist/sdk/runtime-node.js +222 -0
  205. package/dist/sdk/runtime-node.js.map +7 -0
  206. package/dist/sdk/runtime.cjs +17 -0
  207. package/dist/sdk/runtime.cjs.map +7 -0
  208. package/dist/sdk/runtime.js +0 -0
  209. package/dist/sdk/runtime.js.map +7 -0
  210. package/dist/sdk/tools.cjs +30300 -0
  211. package/dist/sdk/tools.cjs.map +7 -0
  212. package/dist/sdk/tools.js +30282 -0
  213. package/dist/sdk/tools.js.map +7 -0
  214. package/dist/webui/assets/index-5hlfByVS.css +1 -0
  215. package/dist/webui/assets/index-BR9lm1lA.js +82 -0
  216. package/dist/webui/index.html +28 -0
  217. package/package.json +93 -22
  218. package/scripts/binary-utils.cjs +12 -4
  219. package/scripts/cli-acp-wrapper.cjs +3 -17
  220. package/scripts/cli-wrapper.cjs +5 -7
  221. package/scripts/postinstall.js +8 -4
  222. package/dist/REPL-CW7AYLVL.js +0 -42
  223. package/dist/acp-VEPJ74LT.js +0 -1357
  224. package/dist/acp-VEPJ74LT.js.map +0 -7
  225. package/dist/agentsValidate-7LH4HTNR.js.map +0 -7
  226. package/dist/ask-3NHFFUQG.js.map +0 -7
  227. package/dist/autoUpdater-ITPIHCOI.js +0 -17
  228. package/dist/chunk-3IN27HA5.js.map +0 -7
  229. package/dist/chunk-4FX3IVPT.js +0 -164
  230. package/dist/chunk-4FX3IVPT.js.map +0 -7
  231. package/dist/chunk-4RTX4AG4.js.map +0 -7
  232. package/dist/chunk-5PDP7R6N.js +0 -515
  233. package/dist/chunk-5PDP7R6N.js.map +0 -7
  234. package/dist/chunk-73WGVYLQ.js.map +0 -7
  235. package/dist/chunk-7M2YN6TU.js.map +0 -7
  236. package/dist/chunk-7U7L4NMD.js.map +0 -7
  237. package/dist/chunk-ABLVTESJ.js.map +0 -7
  238. package/dist/chunk-AFFSCMYS.js.map +0 -7
  239. package/dist/chunk-ARZSBOAO.js.map +0 -7
  240. package/dist/chunk-CIG63V4E.js +0 -72
  241. package/dist/chunk-CIG63V4E.js.map +0 -7
  242. package/dist/chunk-CM3EGTG6.js +0 -1609
  243. package/dist/chunk-CM3EGTG6.js.map +0 -7
  244. package/dist/chunk-DZE5YA7L.js.map +0 -7
  245. package/dist/chunk-E6YNABER.js.map +0 -7
  246. package/dist/chunk-EZXMVTDU.js.map +0 -7
  247. package/dist/chunk-F2SJXUDI.js +0 -148
  248. package/dist/chunk-F2SJXUDI.js.map +0 -7
  249. package/dist/chunk-FC5ZCKBI.js +0 -30167
  250. package/dist/chunk-FC5ZCKBI.js.map +0 -7
  251. package/dist/chunk-HCBELH4J.js +0 -145
  252. package/dist/chunk-HCBELH4J.js.map +0 -7
  253. package/dist/chunk-HN4E4UUQ.js.map +0 -7
  254. package/dist/chunk-IZVMU4S2.js +0 -654
  255. package/dist/chunk-IZVMU4S2.js.map +0 -7
  256. package/dist/chunk-K2CWOTI2.js.map +0 -7
  257. package/dist/chunk-LC4TVOCZ.js +0 -835
  258. package/dist/chunk-LC4TVOCZ.js.map +0 -7
  259. package/dist/chunk-MIW7N2MY.js +0 -2613
  260. package/dist/chunk-MIW7N2MY.js.map +0 -7
  261. package/dist/chunk-MWRSY4X6.js.map +0 -7
  262. package/dist/chunk-ND3XWFO6.js +0 -34
  263. package/dist/chunk-ND3XWFO6.js.map +0 -7
  264. package/dist/chunk-QVLYOPO5.js.map +0 -7
  265. package/dist/chunk-RZWOUA25.js.map +0 -7
  266. package/dist/chunk-S6HRABTA.js.map +0 -7
  267. package/dist/chunk-STSX7GIX.js.map +0 -7
  268. package/dist/chunk-UHYRLID6.js.map +0 -7
  269. package/dist/chunk-UKHTVRJM.js +0 -47
  270. package/dist/chunk-UKHTVRJM.js.map +0 -7
  271. package/dist/chunk-UYXEDKOZ.js +0 -24
  272. package/dist/chunk-UYXEDKOZ.js.map +0 -7
  273. package/dist/chunk-W7GRKO7Q.js.map +0 -7
  274. package/dist/chunk-WVHORZQ5.js +0 -17
  275. package/dist/chunk-WVHORZQ5.js.map +0 -7
  276. package/dist/chunk-WWUWDNWW.js +0 -49
  277. package/dist/chunk-WWUWDNWW.js.map +0 -7
  278. package/dist/chunk-YC6LJCDE.js.map +0 -7
  279. package/dist/chunk-YXYYDIMI.js +0 -2931
  280. package/dist/chunk-YXYYDIMI.js.map +0 -7
  281. package/dist/chunk-ZVDRDPII.js.map +0 -7
  282. package/dist/cli-DOPVY2CW.js.map +0 -7
  283. package/dist/commands-2BF2CJ3A.js +0 -46
  284. package/dist/context-6FXPETYH.js +0 -30
  285. package/dist/costTracker-6SL26FDB.js +0 -19
  286. package/dist/kodeAgentSessionLoad-MITZADPB.js +0 -18
  287. package/dist/kodeAgentSessionResume-GVRWB4WO.js +0 -16
  288. package/dist/kodeAgentStreamJson-NXFN7TXH.js +0 -13
  289. package/dist/kodeAgentStreamJsonSession-UGEZJJEB.js.map +0 -7
  290. package/dist/kodeAgentStructuredStdio-HGWJT7CU.js +0 -10
  291. package/dist/llm-ZUQC4WYM.js.map +0 -7
  292. package/dist/llmLazy-54QQHA54.js +0 -15
  293. package/dist/loader-FYHJQES5.js +0 -28
  294. package/dist/mcp-J332IKT3.js +0 -49
  295. package/dist/mentionProcessor-EE3XFHCJ.js.map +0 -7
  296. package/dist/model-FV3JDJKH.js +0 -30
  297. package/dist/pluginRuntime-6ETCZ2LL.js.map +0 -7
  298. package/dist/pluginValidation-I4YKUWGS.js +0 -17
  299. package/dist/prompts-ZLEKDD77.js +0 -48
  300. package/dist/query-VFRJPBGD.js +0 -50
  301. package/dist/responsesStreaming-AW344PQO.js +0 -10
  302. package/dist/ripgrep-3NTIKQYW.js +0 -17
  303. package/dist/state-P5G6CO5V.js +0 -16
  304. package/dist/theme-3LWP3BG7.js +0 -14
  305. package/dist/toolPermissionSettings-3ROBVTUK.js +0 -18
  306. package/dist/tools-RO7HSSE5.js +0 -47
  307. package/dist/userInput-JSBJRFSK.js +0 -311
  308. package/dist/userInput-JSBJRFSK.js.map +0 -7
  309. package/dist/uuid-QN2CNKKN.js +0 -9
  310. /package/dist/{REPL-CW7AYLVL.js.map → chunks/Doctor-M3J7GRTJ.js.map} +0 -0
  311. /package/dist/{autoUpdater-ITPIHCOI.js.map → chunks/REPL-RQ6LO6S7.js.map} +0 -0
  312. /package/dist/{chunk-JC6NCUG5.js.map → chunks/ResumeConversation-6DMVBEGH.js.map} +0 -0
  313. /package/dist/{commands-2BF2CJ3A.js.map → chunks/agentLoader-FCRG3TFJ.js.map} +0 -0
  314. /package/dist/{config-RUSD6G5Y.js.map → chunks/autoUpdater-CNESBOKO.js.map} +0 -0
  315. /package/dist/{context-6FXPETYH.js.map → chunks/chunk-4CRUCZR4.js.map} +0 -0
  316. /package/dist/{costTracker-6SL26FDB.js.map → chunks/chunk-54KOYG5C.js.map} +0 -0
  317. /package/dist/{customCommands-TOIJFZAL.js.map → chunks/chunk-GCQCAXJZ.js.map} +0 -0
  318. /package/dist/{env-XGKBLU3D.js.map → chunks/chunk-LB6TCPDI.js.map} +0 -0
  319. /package/dist/{kodeAgentSessionId-X6XWQW7B.js.map → chunks/client-SILZNM5N.js.map} +0 -0
  320. /package/dist/{kodeAgentSessionLoad-MITZADPB.js.map → chunks/config-25HRTPSP.js.map} +0 -0
  321. /package/dist/{kodeAgentSessionResume-GVRWB4WO.js.map → chunks/cost-tracker-Z2UZT2J5.js.map} +0 -0
  322. /package/dist/{kodeAgentStreamJson-NXFN7TXH.js.map → chunks/customCommands-TYMYZRG5.js.map} +0 -0
  323. /package/dist/{kodeAgentStructuredStdio-HGWJT7CU.js.map → chunks/engine-MRVF6FK6.js.map} +0 -0
  324. /package/dist/{kodeHooks-QWM36A3D.js.map → chunks/env-TJ5NOBEB.js.map} +0 -0
  325. /package/dist/{llmLazy-54QQHA54.js.map → chunks/kodeAgentSessionId-VTNISJ2L.js.map} +0 -0
  326. /package/dist/{loader-FYHJQES5.js.map → chunks/kodeAgentSessionLoad-YB2RKBGJ.js.map} +0 -0
  327. /package/dist/{mcp-J332IKT3.js.map → chunks/kodeAgentSessionResume-DZSIVKVA.js.map} +0 -0
  328. /package/dist/{messages-EOYQKPGM.js.map → chunks/kodeAgentStreamJson-X5PLS2S6.js.map} +0 -0
  329. /package/dist/{model-FV3JDJKH.js.map → chunks/kodeHooks-RVKYRJHG.js.map} +0 -0
  330. /package/dist/{openai-RRCWW33N.js.map → chunks/llmLazy-ZUSSE3ZA.js.map} +0 -0
  331. /package/dist/{outputStyles-62Q3VH2J.js.map → chunks/messages-EEWWLPHN.js.map} +0 -0
  332. /package/dist/{pluginValidation-I4YKUWGS.js.map → chunks/model-5TIEKQPD.js.map} +0 -0
  333. /package/dist/{prompts-ZLEKDD77.js.map → chunks/openai-XXK3YZG4.js.map} +0 -0
  334. /package/dist/{query-VFRJPBGD.js.map → chunks/outputStyles-FAJTXN2A.js.map} +0 -0
  335. /package/dist/{responsesStreaming-AW344PQO.js.map → chunks/permissions-HO7INPWM.js.map} +0 -0
  336. /package/dist/{ripgrep-3NTIKQYW.js.map → chunks/pluginValidation-DAM7WRTC.js.map} +0 -0
  337. /package/dist/{skillMarketplace-3RXQBVOL.js.map → chunks/registry-XYJXMOA5.js.map} +0 -0
  338. /package/dist/{state-P5G6CO5V.js.map → chunks/responsesStreaming-JNGE2P3D.js.map} +0 -0
  339. /package/dist/{theme-3LWP3BG7.js.map → chunks/server-REXXF5IK.js.map} +0 -0
  340. /package/dist/{toolPermissionContext-65L65VEZ.js.map → chunks/skillMarketplace-N4HVHNST.js.map} +0 -0
  341. /package/dist/{toolPermissionSettings-3ROBVTUK.js.map → chunks/src-OROQIWP3.js.map} +0 -0
  342. /package/dist/{tools-RO7HSSE5.js.map → chunks/theme-YBJUIMWK.js.map} +0 -0
  343. /package/dist/{uuid-QN2CNKKN.js.map → chunks/toolPermissionContext-MOCTRR7N.js.map} +0 -0
@@ -1,30 +1,13 @@
1
- import { createRequire as __kodeCreateRequire } from "node:module";
2
- const require = __kodeCreateRequire(import.meta.url);
3
1
  import {
4
2
  CONFIG_BASE_DIR,
5
- getCwd,
6
3
  getKodeBaseDir
7
- } from "./chunk-YXYYDIMI.js";
8
-
9
- // src/services/plugins/skillMarketplace.ts
4
+ } from "./chunk-3OEJVB5A.js";
10
5
  import {
11
- copyFileSync,
12
- existsSync,
13
- lstatSync,
14
- mkdirSync,
15
- readFileSync,
16
- readdirSync,
17
- renameSync,
18
- rmSync,
19
- writeFileSync
20
- } from "node:fs";
21
- import { randomUUID } from "node:crypto";
22
- import { basename, dirname, join, resolve, sep } from "node:path";
23
- import { unzipSync } from "fflate";
6
+ getCwd
7
+ } from "./chunk-BBJFHTBC.js";
8
+
9
+ // apps/cli/src/services/skillMarketplace/schema.ts
24
10
  import { z } from "zod";
25
- var KNOWN_MARKETPLACES_FILE = "known_marketplaces.json";
26
- var MARKETPLACES_CACHE_DIR = "marketplaces";
27
- var INSTALLED_SKILL_PLUGINS_FILE = "installed-skill-plugins.json";
28
11
  var MarketplaceSourceSchema = z.discriminatedUnion("source", [
29
12
  z.strictObject({
30
13
  source: z.literal("github"),
@@ -88,6 +71,62 @@ var KnownMarketplacesSchema = z.record(
88
71
  autoUpdate: z.boolean().optional()
89
72
  })
90
73
  );
74
+
75
+ // apps/cli/src/services/skillMarketplace/marketplaces.ts
76
+ import { existsSync as existsSync5, renameSync, rmSync as rmSync2 } from "node:fs";
77
+ import { randomUUID } from "node:crypto";
78
+ import { join as join4 } from "node:path";
79
+
80
+ // apps/cli/src/services/skillMarketplace/fsUtils.ts
81
+ import {
82
+ copyFileSync,
83
+ existsSync,
84
+ mkdirSync,
85
+ readdirSync,
86
+ rmSync
87
+ } from "node:fs";
88
+ import { dirname, join, resolve, sep } from "node:path";
89
+ function ensureDir(path) {
90
+ mkdirSync(path, { recursive: true });
91
+ }
92
+ function ensureEmptyDir(path) {
93
+ if (existsSync(path)) rmSync(path, { recursive: true, force: true });
94
+ ensureDir(path);
95
+ }
96
+ function safeJoinWithin(baseDir, relativePath) {
97
+ const normalized = relativePath.replace(/\\/g, "/");
98
+ if (!normalized || normalized.startsWith("/") || normalized.includes("..")) {
99
+ throw new Error(`Unsafe path in archive: ${relativePath}`);
100
+ }
101
+ const joined = resolve(baseDir, normalized.split("/").join(sep));
102
+ const resolvedBase = resolve(baseDir);
103
+ if (!joined.startsWith(resolvedBase + sep) && joined !== resolvedBase) {
104
+ throw new Error(`Path traversal detected: ${relativePath}`);
105
+ }
106
+ return joined;
107
+ }
108
+ function safeCopyDirectory(srcDir, destDir) {
109
+ ensureDir(destDir);
110
+ const entries = readdirSync(srcDir, { withFileTypes: true });
111
+ for (const entry of entries) {
112
+ const srcPath = join(srcDir, entry.name);
113
+ const destPath = join(destDir, entry.name);
114
+ if (entry.isDirectory()) {
115
+ safeCopyDirectory(srcPath, destPath);
116
+ continue;
117
+ }
118
+ if (entry.isFile()) {
119
+ ensureDir(dirname(destPath));
120
+ copyFileSync(srcPath, destPath);
121
+ }
122
+ }
123
+ }
124
+
125
+ // apps/cli/src/services/skillMarketplace/paths.ts
126
+ import { join as join2 } from "node:path";
127
+ var KNOWN_MARKETPLACES_FILE = "known_marketplaces.json";
128
+ var MARKETPLACES_CACHE_DIR = "marketplaces";
129
+ var INSTALLED_SKILL_PLUGINS_FILE = "installed-skill-plugins.json";
91
130
  function userKodeDir() {
92
131
  return getKodeBaseDir();
93
132
  }
@@ -100,38 +139,43 @@ function normalizePluginScope(options) {
100
139
  }
101
140
  function scopeBaseDir(scope) {
102
141
  if (scope === "user") return userKodeDir();
103
- return join(getCwd(), CONFIG_BASE_DIR);
142
+ return join2(getCwd(), CONFIG_BASE_DIR);
104
143
  }
105
144
  function scopeSkillsDir(scope) {
106
- return join(scopeBaseDir(scope), "skills");
145
+ return join2(scopeBaseDir(scope), "skills");
107
146
  }
108
147
  function scopeCommandsDir(scope) {
109
- return join(scopeBaseDir(scope), "commands");
148
+ return join2(scopeBaseDir(scope), "commands");
110
149
  }
111
150
  function scopeInstalledPluginsDir(scope) {
112
- return join(scopeBaseDir(scope), "plugins", "installed");
151
+ return join2(scopeBaseDir(scope), "plugins", "installed");
113
152
  }
114
153
  function scopeInstalledPluginRoot(scope, plugin, marketplace) {
115
- return join(scopeInstalledPluginsDir(scope), plugin, marketplace);
154
+ return join2(scopeInstalledPluginsDir(scope), plugin, marketplace);
116
155
  }
117
156
  function pluginsDir() {
118
- return join(userKodeDir(), "plugins");
157
+ return join2(userKodeDir(), "plugins");
119
158
  }
120
159
  function knownMarketplacesConfigPath() {
121
- return join(pluginsDir(), KNOWN_MARKETPLACES_FILE);
160
+ return join2(pluginsDir(), KNOWN_MARKETPLACES_FILE);
122
161
  }
123
162
  function marketplaceCacheBaseDir() {
124
- return join(pluginsDir(), MARKETPLACES_CACHE_DIR);
163
+ return join2(pluginsDir(), MARKETPLACES_CACHE_DIR);
125
164
  }
126
165
  function installedSkillPluginsPath() {
127
- return join(userKodeDir(), INSTALLED_SKILL_PLUGINS_FILE);
128
- }
129
- function ensureDir(path) {
130
- mkdirSync(path, { recursive: true });
166
+ return join2(userKodeDir(), INSTALLED_SKILL_PLUGINS_FILE);
131
167
  }
168
+
169
+ // apps/cli/src/services/skillMarketplace/store.ts
170
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
171
+ import { resolve as resolve2 } from "node:path";
172
+
173
+ // apps/cli/src/services/skillMarketplace/json.ts
174
+ import { existsSync as existsSync2, readFileSync, writeFileSync } from "node:fs";
175
+ import { dirname as dirname2 } from "node:path";
132
176
  function readJsonFile(path, fallback) {
133
177
  try {
134
- if (!existsSync(path)) return fallback;
178
+ if (!existsSync2(path)) return fallback;
135
179
  const raw = readFileSync(path, "utf8");
136
180
  return JSON.parse(raw);
137
181
  } catch {
@@ -139,70 +183,47 @@ function readJsonFile(path, fallback) {
139
183
  }
140
184
  }
141
185
  function writeJsonFile(path, value) {
142
- ensureDir(dirname(path));
186
+ ensureDir(dirname2(path));
143
187
  writeFileSync(path, `${JSON.stringify(value, null, 2)}
144
188
  `, "utf8");
145
189
  }
146
- function normalizeMarketplaceSubPath(path) {
147
- if (!path) return null;
148
- const trimmed = path.trim().replace(/^\.?\//, "").replace(/^\/+/, "");
149
- if (!trimmed) return null;
150
- if (trimmed.includes("..")) {
151
- throw new Error(`Marketplace path contains '..': ${path}`);
152
- }
153
- return trimmed.replace(/\\/g, "/").replace(/\/+$/, "");
154
- }
155
- function safeJoinWithin(baseDir, relativePath) {
156
- const normalized = relativePath.replace(/\\/g, "/");
157
- if (!normalized || normalized.startsWith("/") || normalized.includes("..")) {
158
- throw new Error(`Unsafe path in archive: ${relativePath}`);
159
- }
160
- const joined = resolve(baseDir, normalized.split("/").join(sep));
161
- const resolvedBase = resolve(baseDir);
162
- if (!joined.startsWith(resolvedBase + sep) && joined !== resolvedBase) {
163
- throw new Error(`Path traversal detected: ${relativePath}`);
190
+
191
+ // apps/cli/src/services/skillMarketplace/store.ts
192
+ function loadKnownMarketplaces() {
193
+ const raw = readJsonFile(knownMarketplacesConfigPath(), {});
194
+ const parsed = KnownMarketplacesSchema.safeParse(raw);
195
+ if (!parsed.success) {
196
+ throw new Error(
197
+ `Marketplace configuration is corrupted: ${parsed.error.issues.map((i) => i.message).join("; ")}`
198
+ );
164
199
  }
165
- return joined;
166
- }
167
- function ensureEmptyDir(path) {
168
- if (existsSync(path)) rmSync(path, { recursive: true, force: true });
169
- ensureDir(path);
200
+ return parsed.data;
170
201
  }
171
- function safeCopyDirectory(srcDir, destDir) {
172
- ensureDir(destDir);
173
- const entries = readdirSync(srcDir, { withFileTypes: true });
174
- for (const entry of entries) {
175
- const srcPath = join(srcDir, entry.name);
176
- const destPath = join(destDir, entry.name);
177
- if (entry.isDirectory()) {
178
- safeCopyDirectory(srcPath, destPath);
179
- continue;
180
- }
181
- if (entry.isFile()) {
182
- ensureDir(dirname(destPath));
183
- copyFileSync(srcPath, destPath);
184
- continue;
185
- }
202
+ function saveKnownMarketplaces(config) {
203
+ const parsed = KnownMarketplacesSchema.safeParse(config);
204
+ if (!parsed.success) {
205
+ throw new Error(`Invalid marketplace config: ${parsed.error.message}`);
186
206
  }
207
+ writeJsonFile(knownMarketplacesConfigPath(), parsed.data);
187
208
  }
188
209
  function readMarketplaceFromDirectory(rootDir) {
189
- const primaryMarketplaceFile = resolve(
210
+ const primaryMarketplaceFile = resolve2(
190
211
  rootDir,
191
212
  ".kode-plugin",
192
213
  "marketplace.json"
193
214
  );
194
- const legacyMarketplaceFile = resolve(
215
+ const legacyMarketplaceFile = resolve2(
195
216
  rootDir,
196
217
  ".claude-plugin",
197
218
  "marketplace.json"
198
219
  );
199
- const marketplaceFile = existsSync(primaryMarketplaceFile) ? primaryMarketplaceFile : legacyMarketplaceFile;
200
- if (!existsSync(marketplaceFile)) {
220
+ const marketplaceFile = existsSync3(primaryMarketplaceFile) ? primaryMarketplaceFile : legacyMarketplaceFile;
221
+ if (!existsSync3(marketplaceFile)) {
201
222
  throw new Error(
202
- `Marketplace file not found (expected .kode-plugin/marketplace.json or .claude-plugin/marketplace.json)`
223
+ "Marketplace file not found (expected .kode-plugin/marketplace.json or .claude-plugin/marketplace.json)"
203
224
  );
204
225
  }
205
- const raw = readFileSync(marketplaceFile, "utf8");
226
+ const raw = readFileSync2(marketplaceFile, "utf8");
206
227
  const parsed = MarketplaceManifestSchema.safeParse(JSON.parse(raw));
207
228
  if (!parsed.success) {
208
229
  throw new Error(
@@ -211,92 +232,11 @@ function readMarketplaceFromDirectory(rootDir) {
211
232
  }
212
233
  return parsed.data;
213
234
  }
214
- function parsePluginSpec(spec) {
215
- const trimmed = spec.trim();
216
- const parts = trimmed.split("@");
217
- if (parts.length !== 2) {
218
- throw new Error(
219
- `Invalid plugin spec: ${spec}. Expected format: <plugin>@<marketplace>`
220
- );
221
- }
222
- const plugin = parts[0].trim();
223
- const marketplace = parts[1].trim();
224
- if (!plugin || !marketplace) {
225
- throw new Error(
226
- `Invalid plugin spec: ${spec}. Expected format: <plugin>@<marketplace>`
227
- );
228
- }
229
- return { plugin, marketplace };
230
- }
231
- function resolvePluginForInstall(pluginInput) {
232
- const trimmed = pluginInput.trim();
233
- if (!trimmed) throw new Error("Plugin is required");
234
- if (trimmed.includes("@")) {
235
- const resolved = parsePluginSpec(trimmed);
236
- return {
237
- ...resolved,
238
- pluginSpec: `${resolved.plugin}@${resolved.marketplace}`
239
- };
240
- }
241
- const config = loadKnownMarketplaces();
242
- const matches = [];
243
- for (const [marketplace, entry] of Object.entries(config)) {
244
- try {
245
- const manifest = readMarketplaceFromDirectory(entry.installLocation);
246
- const found = manifest.plugins.find((p) => p.name === trimmed);
247
- if (found) matches.push({ marketplace, entry: found });
248
- } catch {
249
- }
250
- }
251
- if (matches.length === 0) {
252
- const availableMarketplaces = Object.keys(config).sort().join(", ");
253
- throw new Error(
254
- `Plugin '${trimmed}' not found in any marketplace. Available marketplaces: ${availableMarketplaces || "(none)"}`
255
- );
256
- }
257
- if (matches.length > 1) {
258
- const options = matches.map((m) => `${trimmed}@${m.marketplace}`).sort().join(", ");
259
- throw new Error(
260
- `Plugin '${trimmed}' is available in multiple marketplaces. Use an explicit spec: ${options}`
261
- );
262
- }
263
- return {
264
- plugin: trimmed,
265
- marketplace: matches[0].marketplace,
266
- pluginSpec: `${trimmed}@${matches[0].marketplace}`
267
- };
268
- }
269
- function resolveInstalledPluginSpec(pluginInput, state) {
270
- const trimmed = pluginInput.trim();
271
- if (!trimmed) throw new Error("Plugin is required");
272
- if (trimmed.includes("@")) {
273
- parsePluginSpec(trimmed);
274
- return trimmed;
275
- }
276
- const matches = Object.entries(state).filter(
277
- ([, record]) => record?.plugin === trimmed
278
- );
279
- if (matches.length === 0) {
280
- throw new Error(`Plugin '${trimmed}' is not installed`);
281
- }
282
- if (matches.length > 1) {
283
- const options = matches.map(([spec]) => spec).sort().join(", ");
284
- throw new Error(
285
- `Plugin '${trimmed}' is installed from multiple marketplaces. Use an explicit spec: ${options}`
286
- );
287
- }
288
- return matches[0][0];
289
- }
290
- function baseDirForInstallRecord(record) {
291
- if (record.scope === "user") return userKodeDir();
292
- const projectPath = typeof record.projectPath === "string" ? record.projectPath.trim() : "";
293
- if (!projectPath) {
294
- throw new Error(
295
- `Installed plugin '${record.plugin}@${record.marketplace}' is missing projectPath for scope=${record.scope}`
296
- );
297
- }
298
- return join(projectPath, CONFIG_BASE_DIR);
299
- }
235
+
236
+ // apps/cli/src/services/skillMarketplace/sources.ts
237
+ import { copyFileSync as copyFileSync2, existsSync as existsSync4, lstatSync, writeFileSync as writeFileSync2 } from "node:fs";
238
+ import { dirname as dirname3, join as join3, resolve as resolve3 } from "node:path";
239
+ import { unzipSync } from "fflate";
300
240
  function githubRepoFromUrl(input) {
301
241
  const ssh = input.match(/^git@github\.com:([^/]+\/[^/]+?)(?:\.git)?$/);
302
242
  if (ssh?.[1]) return ssh[1];
@@ -315,6 +255,15 @@ function parseRefAndPath(input) {
315
255
  path: hashPart?.trim() || void 0
316
256
  };
317
257
  }
258
+ function normalizeMarketplaceSubPath(path) {
259
+ if (!path) return null;
260
+ const trimmed = path.trim().replace(/^\.?\//, "").replace(/^\/+/, "");
261
+ if (!trimmed) return null;
262
+ if (trimmed.includes("..")) {
263
+ throw new Error(`Marketplace path contains '..': ${path}`);
264
+ }
265
+ return trimmed.replace(/\\/g, "/").replace(/\/+$/, "");
266
+ }
318
267
  function parseMarketplaceSourceInput(sourceInput) {
319
268
  const raw = sourceInput.trim();
320
269
  if (!raw) throw new Error("Marketplace source is required");
@@ -354,22 +303,14 @@ function parseMarketplaceSourceInput(sourceInput) {
354
303
  ...parsed2.path ? { path: parsed2.path } : {}
355
304
  };
356
305
  }
357
- if (prefix === "url:") {
358
- return { source: "url", url: rest };
359
- }
360
- if (prefix === "npm:") {
361
- return { source: "npm", package: rest };
362
- }
363
- if (prefix === "file:") {
364
- return { source: "file", path: rest };
365
- }
366
- if (prefix === "dir:") {
367
- return { source: "directory", path: rest };
368
- }
306
+ if (prefix === "url:") return { source: "url", url: rest };
307
+ if (prefix === "npm:") return { source: "npm", package: rest };
308
+ if (prefix === "file:") return { source: "file", path: rest };
309
+ if (prefix === "dir:") return { source: "directory", path: rest };
369
310
  }
370
311
  }
371
- const resolved = resolve(raw);
372
- if (existsSync(resolved)) {
312
+ const resolved = resolve3(raw);
313
+ if (existsSync4(resolved)) {
373
314
  const stat = lstatSync(resolved);
374
315
  if (stat.isDirectory()) return { source: "directory", path: resolved };
375
316
  if (stat.isFile()) return { source: "file", path: resolved };
@@ -428,21 +369,21 @@ async function tryDownloadGithubZip(repo, ref) {
428
369
  async function cacheMarketplaceToTempDir(source, tempDir) {
429
370
  ensureEmptyDir(tempDir);
430
371
  if (source.source === "directory") {
431
- const root = resolve(source.path);
432
- if (!existsSync(root) || !lstatSync(root).isDirectory()) {
372
+ const root = resolve3(source.path);
373
+ if (!existsSync4(root) || !lstatSync(root).isDirectory()) {
433
374
  throw new Error(`Directory not found: ${source.path}`);
434
375
  }
435
376
  safeCopyDirectory(root, tempDir);
436
377
  return;
437
378
  }
438
379
  if (source.source === "file") {
439
- const file = resolve(source.path);
440
- if (!existsSync(file) || !lstatSync(file).isFile()) {
380
+ const file = resolve3(source.path);
381
+ if (!existsSync4(file) || !lstatSync(file).isFile()) {
441
382
  throw new Error(`File not found: ${source.path}`);
442
383
  }
443
- const out = join(tempDir, ".kode-plugin");
384
+ const out = join3(tempDir, ".kode-plugin");
444
385
  ensureDir(out);
445
- copyFileSync(file, join(out, "marketplace.json"));
386
+ copyFileSync2(file, join3(out, "marketplace.json"));
446
387
  return;
447
388
  }
448
389
  if (source.source === "github") {
@@ -461,8 +402,9 @@ async function cacheMarketplaceToTempDir(source, tempDir) {
461
402
  lastError = err instanceof Error ? err : Error(String(err));
462
403
  }
463
404
  }
464
- if (!zip)
405
+ if (!zip) {
465
406
  throw lastError ?? new Error(`Failed to download GitHub repo ${source.repo}`);
407
+ }
466
408
  const files = unzipSync(zip);
467
409
  const names = Object.keys(files).filter(Boolean);
468
410
  const topDir = names.length > 0 ? names[0].split("/")[0] : "";
@@ -477,8 +419,8 @@ async function cacheMarketplaceToTempDir(source, tempDir) {
477
419
  continue;
478
420
  }
479
421
  const dest = safeJoinWithin(tempDir, rel);
480
- ensureDir(dirname(dest));
481
- writeFileSync(dest, data);
422
+ ensureDir(dirname3(dest));
423
+ writeFileSync2(dest, data);
482
424
  extractedCount++;
483
425
  }
484
426
  if (extractedCount === 0) {
@@ -492,9 +434,9 @@ async function cacheMarketplaceToTempDir(source, tempDir) {
492
434
  const url = source.url;
493
435
  if (url.toLowerCase().endsWith(".json")) {
494
436
  const data = await fetchBinary(url);
495
- const out = join(tempDir, ".kode-plugin");
437
+ const out = join3(tempDir, ".kode-plugin");
496
438
  ensureDir(out);
497
- writeFileSync(join(out, "marketplace.json"), Buffer.from(data));
439
+ writeFileSync2(join3(out, "marketplace.json"), Buffer.from(data));
498
440
  return;
499
441
  }
500
442
  if (url.toLowerCase().endsWith(".zip")) {
@@ -503,8 +445,8 @@ async function cacheMarketplaceToTempDir(source, tempDir) {
503
445
  for (const [name, data] of Object.entries(files)) {
504
446
  if (!name || name.endsWith("/")) continue;
505
447
  const dest = safeJoinWithin(tempDir, name);
506
- ensureDir(dirname(dest));
507
- writeFileSync(dest, data);
448
+ ensureDir(dirname3(dest));
449
+ writeFileSync2(dest, data);
508
450
  }
509
451
  return;
510
452
  }
@@ -536,23 +478,8 @@ async function cacheMarketplaceToTempDir(source, tempDir) {
536
478
  );
537
479
  }
538
480
  }
539
- function loadKnownMarketplaces() {
540
- const raw = readJsonFile(knownMarketplacesConfigPath(), {});
541
- const parsed = KnownMarketplacesSchema.safeParse(raw);
542
- if (!parsed.success) {
543
- throw new Error(
544
- `Marketplace configuration is corrupted: ${parsed.error.issues.map((i) => i.message).join("; ")}`
545
- );
546
- }
547
- return parsed.data;
548
- }
549
- function saveKnownMarketplaces(config) {
550
- const parsed = KnownMarketplacesSchema.safeParse(config);
551
- if (!parsed.success) {
552
- throw new Error(`Invalid marketplace config: ${parsed.error.message}`);
553
- }
554
- writeJsonFile(knownMarketplacesConfigPath(), parsed.data);
555
- }
481
+
482
+ // apps/cli/src/services/skillMarketplace/marketplaces.ts
556
483
  function listMarketplaces() {
557
484
  return loadKnownMarketplaces();
558
485
  }
@@ -567,7 +494,7 @@ async function addMarketplace(sourceInput) {
567
494
  const config = loadKnownMarketplaces();
568
495
  const cacheBase = marketplaceCacheBaseDir();
569
496
  ensureDir(cacheBase);
570
- const tempDir = join(cacheBase, `tmp-${randomUUID()}`);
497
+ const tempDir = join4(cacheBase, `tmp-${randomUUID()}`);
571
498
  try {
572
499
  await cacheMarketplaceToTempDir(validatedSource.data, tempDir);
573
500
  const manifest = readMarketplaceFromDirectory(tempDir);
@@ -577,8 +504,8 @@ async function addMarketplace(sourceInput) {
577
504
  `Marketplace '${marketplaceName}' is already installed. Remove it first to re-add.`
578
505
  );
579
506
  }
580
- const installLocation = join(cacheBase, marketplaceName);
581
- if (existsSync(installLocation)) {
507
+ const installLocation = join4(cacheBase, marketplaceName);
508
+ if (existsSync5(installLocation)) {
582
509
  throw new Error(
583
510
  `Marketplace cache directory already exists: ${installLocation}`
584
511
  );
@@ -592,7 +519,7 @@ async function addMarketplace(sourceInput) {
592
519
  saveKnownMarketplaces(config);
593
520
  return { name: marketplaceName };
594
521
  } catch (error) {
595
- if (existsSync(tempDir)) rmSync(tempDir, { recursive: true, force: true });
522
+ if (existsSync5(tempDir)) rmSync2(tempDir, { recursive: true, force: true });
596
523
  throw error;
597
524
  }
598
525
  }
@@ -605,8 +532,8 @@ function removeMarketplace(name) {
605
532
  delete config[trimmed];
606
533
  saveKnownMarketplaces(config);
607
534
  try {
608
- if (existsSync(entry.installLocation)) {
609
- rmSync(entry.installLocation, { recursive: true, force: true });
535
+ if (existsSync5(entry.installLocation)) {
536
+ rmSync2(entry.installLocation, { recursive: true, force: true });
610
537
  }
611
538
  } catch {
612
539
  }
@@ -619,7 +546,7 @@ async function refreshMarketplaceAsync(name) {
619
546
  if (!entry) throw new Error(`Marketplace '${trimmed}' not found`);
620
547
  const cacheBase = marketplaceCacheBaseDir();
621
548
  ensureDir(cacheBase);
622
- const tempDir = join(cacheBase, `tmp-${randomUUID()}`);
549
+ const tempDir = join4(cacheBase, `tmp-${randomUUID()}`);
623
550
  try {
624
551
  await cacheMarketplaceToTempDir(entry.source, tempDir);
625
552
  const manifest = readMarketplaceFromDirectory(tempDir);
@@ -628,8 +555,8 @@ async function refreshMarketplaceAsync(name) {
628
555
  `Marketplace name mismatch on refresh: expected ${trimmed}, got ${manifest.name}`
629
556
  );
630
557
  }
631
- if (existsSync(entry.installLocation)) {
632
- rmSync(entry.installLocation, { recursive: true, force: true });
558
+ if (existsSync5(entry.installLocation)) {
559
+ rmSync2(entry.installLocation, { recursive: true, force: true });
633
560
  }
634
561
  renameSync(tempDir, entry.installLocation);
635
562
  config[trimmed] = {
@@ -638,7 +565,7 @@ async function refreshMarketplaceAsync(name) {
638
565
  };
639
566
  saveKnownMarketplaces(config);
640
567
  } catch (error) {
641
- if (existsSync(tempDir)) rmSync(tempDir, { recursive: true, force: true });
568
+ if (existsSync5(tempDir)) rmSync2(tempDir, { recursive: true, force: true });
642
569
  throw error;
643
570
  }
644
571
  }
@@ -672,6 +599,8 @@ function getMarketplaceManifest(marketplaceName) {
672
599
  const manifest = readMarketplaceFromDirectory(entry.installLocation);
673
600
  return { manifest, rootDir: entry.installLocation, source: entry.source };
674
601
  }
602
+
603
+ // apps/cli/src/services/skillMarketplace/pluginState.ts
675
604
  function ensurePluginInstallState() {
676
605
  ensureDir(userKodeDir());
677
606
  const state = readJsonFile(
@@ -693,19 +622,267 @@ function ensurePluginInstallState() {
693
622
  function savePluginInstallState(state) {
694
623
  writeJsonFile(installedSkillPluginsPath(), state);
695
624
  }
696
- function installSkillPlugin(pluginInput, options) {
697
- const scope = normalizePluginScope(options);
698
- const { plugin, marketplace, pluginSpec } = resolvePluginForInstall(pluginInput);
699
- const { manifest, rootDir, source } = getMarketplaceManifest(marketplace);
700
- const entry = manifest.plugins.find((p) => p.name === plugin);
701
- if (!entry) {
702
- const available = manifest.plugins.map((p) => p.name).sort().join(", ");
625
+ function listInstalledSkillPlugins() {
626
+ return ensurePluginInstallState();
627
+ }
628
+
629
+ // apps/cli/src/services/skillMarketplace/plugins/resolve.ts
630
+ import { join as join5 } from "node:path";
631
+ function parsePluginSpec(spec) {
632
+ const trimmed = spec.trim();
633
+ const parts = trimmed.split("@");
634
+ if (parts.length !== 2) {
703
635
  throw new Error(
704
- `Plugin '${plugin}' not found in marketplace '${marketplace}'. Available plugins: ${available || "(none)"}`
636
+ `Invalid plugin spec: ${spec}. Expected format: <plugin>@<marketplace>`
705
637
  );
706
638
  }
707
- const installState = ensurePluginInstallState();
708
- const existing = installState[pluginSpec];
639
+ const plugin = parts[0].trim();
640
+ const marketplace = parts[1].trim();
641
+ if (!plugin || !marketplace) {
642
+ throw new Error(
643
+ `Invalid plugin spec: ${spec}. Expected format: <plugin>@<marketplace>`
644
+ );
645
+ }
646
+ return { plugin, marketplace };
647
+ }
648
+ function resolvePluginForInstall(pluginInput) {
649
+ const trimmed = pluginInput.trim();
650
+ if (!trimmed) throw new Error("Plugin is required");
651
+ if (trimmed.includes("@")) {
652
+ const resolved = parsePluginSpec(trimmed);
653
+ return {
654
+ ...resolved,
655
+ pluginSpec: `${resolved.plugin}@${resolved.marketplace}`
656
+ };
657
+ }
658
+ const config = loadKnownMarketplaces();
659
+ const matches = [];
660
+ for (const [marketplace, entry] of Object.entries(config)) {
661
+ try {
662
+ const manifest = readMarketplaceFromDirectory(entry.installLocation);
663
+ const found = manifest.plugins.find((p) => p.name === trimmed);
664
+ if (found) matches.push({ marketplace, entry: found });
665
+ } catch {
666
+ }
667
+ }
668
+ if (matches.length === 0) {
669
+ const availableMarketplaces = Object.keys(config).sort().join(", ");
670
+ throw new Error(
671
+ `Plugin '${trimmed}' not found in any marketplace. Available marketplaces: ${availableMarketplaces || "(none)"}`
672
+ );
673
+ }
674
+ if (matches.length > 1) {
675
+ const options = matches.map((m) => `${trimmed}@${m.marketplace}`).sort().join(", ");
676
+ throw new Error(
677
+ `Plugin '${trimmed}' is available in multiple marketplaces. Use an explicit spec: ${options}`
678
+ );
679
+ }
680
+ return {
681
+ plugin: trimmed,
682
+ marketplace: matches[0].marketplace,
683
+ pluginSpec: `${trimmed}@${matches[0].marketplace}`
684
+ };
685
+ }
686
+ function resolveInstalledPluginSpec(pluginInput, state) {
687
+ const trimmed = pluginInput.trim();
688
+ if (!trimmed) throw new Error("Plugin is required");
689
+ if (trimmed.includes("@")) {
690
+ parsePluginSpec(trimmed);
691
+ return trimmed;
692
+ }
693
+ const matches = Object.entries(state).filter(
694
+ ([, record]) => record?.plugin === trimmed
695
+ );
696
+ if (matches.length === 0) {
697
+ throw new Error(`Plugin '${trimmed}' is not installed`);
698
+ }
699
+ if (matches.length > 1) {
700
+ const options = matches.map(([spec]) => spec).sort().join(", ");
701
+ throw new Error(
702
+ `Plugin '${trimmed}' is installed from multiple marketplaces. Use an explicit spec: ${options}`
703
+ );
704
+ }
705
+ return matches[0][0];
706
+ }
707
+ function baseDirForInstallRecord(record) {
708
+ if (record.scope === "user") return userKodeDir();
709
+ const projectPath = typeof record.projectPath === "string" ? record.projectPath.trim() : "";
710
+ if (!projectPath) {
711
+ throw new Error(
712
+ `Installed plugin '${record.plugin}@${record.marketplace}' is missing projectPath for scope=${record.scope}`
713
+ );
714
+ }
715
+ return join5(projectPath, CONFIG_BASE_DIR);
716
+ }
717
+
718
+ // apps/cli/src/services/skillMarketplace/plugins/toggle.ts
719
+ import { existsSync as existsSync6, renameSync as renameSync2, rmSync as rmSync3 } from "node:fs";
720
+ import { dirname as dirname4, join as join6 } from "node:path";
721
+ function disableSkillPlugin(pluginInput, options) {
722
+ const requestedScope = normalizePluginScope(options);
723
+ const state = ensurePluginInstallState();
724
+ const pluginSpec = resolveInstalledPluginSpec(pluginInput, state);
725
+ const record = state[pluginSpec];
726
+ if (!record) throw new Error(`Plugin '${pluginSpec}' is not installed`);
727
+ if (record.scope !== requestedScope) {
728
+ throw new Error(
729
+ `Plugin '${pluginSpec}' is installed with scope=${record.scope}. Re-run with --scope ${record.scope}.`
730
+ );
731
+ }
732
+ if (record.scope !== "user") {
733
+ const projectPath = record.projectPath?.trim() || "";
734
+ const cwd = getCwd();
735
+ if (!projectPath || projectPath !== cwd) {
736
+ throw new Error(
737
+ `Plugin '${pluginSpec}' is installed for a different directory. Expected cwd=${projectPath || "(missing)"}, got cwd=${cwd}`
738
+ );
739
+ }
740
+ }
741
+ if (record.isEnabled === false) {
742
+ return { pluginSpec, disabledSkills: [], disabledCommands: [] };
743
+ }
744
+ if (record.kind === "plugin-pack") {
745
+ record.isEnabled = false;
746
+ state[pluginSpec] = record;
747
+ savePluginInstallState(state);
748
+ return { pluginSpec, disabledSkills: [], disabledCommands: [] };
749
+ }
750
+ const baseDir = baseDirForInstallRecord(record);
751
+ const skillsDir = join6(baseDir, "skills");
752
+ const commandsDir = join6(
753
+ baseDir,
754
+ "commands",
755
+ record.plugin,
756
+ record.marketplace
757
+ );
758
+ const disabledSkillsBase = join6(
759
+ baseDir,
760
+ "skills.disabled",
761
+ record.plugin,
762
+ record.marketplace
763
+ );
764
+ const disabledCommandsDir = join6(
765
+ baseDir,
766
+ "commands.disabled",
767
+ record.plugin,
768
+ record.marketplace
769
+ );
770
+ const disabledSkills = [];
771
+ for (const skillName of record.skills) {
772
+ const src = join6(skillsDir, skillName);
773
+ if (!existsSync6(src)) continue;
774
+ const dest = join6(disabledSkillsBase, skillName);
775
+ ensureDir(dirname4(dest));
776
+ if (existsSync6(dest)) rmSync3(dest, { recursive: true, force: true });
777
+ renameSync2(src, dest);
778
+ disabledSkills.push(skillName);
779
+ }
780
+ const disabledCommands = [];
781
+ if (existsSync6(commandsDir)) {
782
+ ensureDir(dirname4(disabledCommandsDir));
783
+ if (existsSync6(disabledCommandsDir)) {
784
+ rmSync3(disabledCommandsDir, { recursive: true, force: true });
785
+ }
786
+ renameSync2(commandsDir, disabledCommandsDir);
787
+ disabledCommands.push(disabledCommandsDir);
788
+ }
789
+ record.isEnabled = false;
790
+ state[pluginSpec] = record;
791
+ savePluginInstallState(state);
792
+ return { pluginSpec, disabledSkills, disabledCommands };
793
+ }
794
+ function enableSkillPlugin(pluginInput, options) {
795
+ const requestedScope = normalizePluginScope(options);
796
+ const state = ensurePluginInstallState();
797
+ const pluginSpec = resolveInstalledPluginSpec(pluginInput, state);
798
+ const record = state[pluginSpec];
799
+ if (!record) throw new Error(`Plugin '${pluginSpec}' is not installed`);
800
+ if (record.scope !== requestedScope) {
801
+ throw new Error(
802
+ `Plugin '${pluginSpec}' is installed with scope=${record.scope}. Re-run with --scope ${record.scope}.`
803
+ );
804
+ }
805
+ if (record.scope !== "user") {
806
+ const projectPath = record.projectPath?.trim() || "";
807
+ const cwd = getCwd();
808
+ if (!projectPath || projectPath !== cwd) {
809
+ throw new Error(
810
+ `Plugin '${pluginSpec}' is installed for a different directory. Expected cwd=${projectPath || "(missing)"}, got cwd=${cwd}`
811
+ );
812
+ }
813
+ }
814
+ if (record.isEnabled !== false) {
815
+ return { pluginSpec, enabledSkills: [], enabledCommands: [] };
816
+ }
817
+ if (record.kind === "plugin-pack") {
818
+ record.isEnabled = true;
819
+ state[pluginSpec] = record;
820
+ savePluginInstallState(state);
821
+ return { pluginSpec, enabledSkills: [], enabledCommands: [] };
822
+ }
823
+ const baseDir = baseDirForInstallRecord(record);
824
+ const skillsDir = join6(baseDir, "skills");
825
+ const commandsDir = join6(
826
+ baseDir,
827
+ "commands",
828
+ record.plugin,
829
+ record.marketplace
830
+ );
831
+ const disabledSkillsBase = join6(
832
+ baseDir,
833
+ "skills.disabled",
834
+ record.plugin,
835
+ record.marketplace
836
+ );
837
+ const disabledCommandsDir = join6(
838
+ baseDir,
839
+ "commands.disabled",
840
+ record.plugin,
841
+ record.marketplace
842
+ );
843
+ const enabledSkills = [];
844
+ for (const skillName of record.skills) {
845
+ const src = join6(disabledSkillsBase, skillName);
846
+ if (!existsSync6(src)) continue;
847
+ const dest = join6(skillsDir, skillName);
848
+ ensureDir(dirname4(dest));
849
+ if (existsSync6(dest)) {
850
+ throw new Error(`Destination already exists: ${dest}`);
851
+ }
852
+ renameSync2(src, dest);
853
+ enabledSkills.push(skillName);
854
+ }
855
+ const enabledCommands = [];
856
+ if (existsSync6(disabledCommandsDir)) {
857
+ ensureDir(dirname4(commandsDir));
858
+ if (existsSync6(commandsDir)) {
859
+ throw new Error(`Destination already exists: ${commandsDir}`);
860
+ }
861
+ renameSync2(disabledCommandsDir, commandsDir);
862
+ enabledCommands.push(commandsDir);
863
+ }
864
+ record.isEnabled = true;
865
+ state[pluginSpec] = record;
866
+ savePluginInstallState(state);
867
+ return { pluginSpec, enabledSkills, enabledCommands };
868
+ }
869
+
870
+ // apps/cli/src/services/skillMarketplace/plugins/install.ts
871
+ import { basename, dirname as dirname5, join as join7, resolve as resolve4 } from "node:path";
872
+ import { copyFileSync as copyFileSync3, existsSync as existsSync7, lstatSync as lstatSync2 } from "node:fs";
873
+ function installSkillPlugin(pluginInput, options) {
874
+ const scope = normalizePluginScope(options);
875
+ const { plugin, marketplace, pluginSpec } = resolvePluginForInstall(pluginInput);
876
+ const { manifest, rootDir, source } = getMarketplaceManifest(marketplace);
877
+ const entry = manifest.plugins.find((p) => p.name === plugin);
878
+ if (!entry) {
879
+ const available = manifest.plugins.map((p) => p.name).sort().join(", ");
880
+ throw new Error(
881
+ `Plugin '${plugin}' not found in marketplace '${marketplace}'. Available plugins: ${available || "(none)"}`
882
+ );
883
+ }
884
+ const installState = ensurePluginInstallState();
885
+ const existing = installState[pluginSpec];
709
886
  if (existing && existing.scope !== scope && options?.force !== true) {
710
887
  throw new Error(
711
888
  `Plugin '${pluginSpec}' is already installed with scope=${existing.scope}. Uninstall it first to install with scope=${scope}.`
@@ -716,21 +893,21 @@ function installSkillPlugin(pluginInput, options) {
716
893
  `Plugin '${pluginSpec}' is already installed. Re-run with --force to reinstall.`
717
894
  );
718
895
  }
719
- const entrySourceBase = resolve(rootDir, entry.source ?? "./");
720
- const primaryManifestPath = join(
896
+ const entrySourceBase = resolve4(rootDir, entry.source ?? "./");
897
+ const primaryManifestPath = join7(
721
898
  entrySourceBase,
722
899
  ".kode-plugin",
723
900
  "plugin.json"
724
901
  );
725
- const legacyManifestPath = join(
902
+ const legacyManifestPath = join7(
726
903
  entrySourceBase,
727
904
  ".claude-plugin",
728
905
  "plugin.json"
729
906
  );
730
- const pluginManifestPath = existsSync(primaryManifestPath) ? primaryManifestPath : legacyManifestPath;
731
- if (existsSync(pluginManifestPath) && lstatSync(pluginManifestPath).isFile()) {
907
+ const pluginManifestPath = existsSync7(primaryManifestPath) ? primaryManifestPath : legacyManifestPath;
908
+ if (existsSync7(pluginManifestPath) && lstatSync2(pluginManifestPath).isFile()) {
732
909
  const pluginRoot = scopeInstalledPluginRoot(scope, plugin, marketplace);
733
- if (existsSync(pluginRoot) && options?.force !== true) {
910
+ if (existsSync7(pluginRoot) && options?.force !== true) {
734
911
  throw new Error(`Destination already exists: ${pluginRoot}`);
735
912
  }
736
913
  ensureEmptyDir(pluginRoot);
@@ -746,13 +923,13 @@ function installSkillPlugin(pluginInput, options) {
746
923
  installedAt: (/* @__PURE__ */ new Date()).toISOString(),
747
924
  skills: [],
748
925
  commands: [],
749
- sourceMarketplacePath: source.source === "file" || source.source === "directory" ? source.path : source.source === "github" ? `github:${source.repo}` : source.source === "url" ? source.url : source.source === "git" ? source.url : `npm:${source.package}`
926
+ sourceMarketplacePath: sourcePathForRecord(source)
750
927
  };
751
928
  savePluginInstallState(installState);
752
929
  return { pluginSpec, installedSkills: [], installedCommands: [] };
753
930
  }
754
931
  const skillsDestBase = scopeSkillsDir(scope);
755
- const commandsDestBase = join(scopeCommandsDir(scope), plugin, marketplace);
932
+ const commandsDestBase = join7(scopeCommandsDir(scope), plugin, marketplace);
756
933
  ensureDir(skillsDestBase);
757
934
  ensureDir(commandsDestBase);
758
935
  const installedSkills = [];
@@ -760,12 +937,12 @@ function installSkillPlugin(pluginInput, options) {
760
937
  const skillPaths = entry.skills ?? [];
761
938
  for (const rel of skillPaths) {
762
939
  const src = safeJoinWithin(entrySourceBase, rel);
763
- if (!existsSync(src) || !lstatSync(src).isDirectory()) {
940
+ if (!existsSync7(src) || !lstatSync2(src).isDirectory()) {
764
941
  throw new Error(`Skill path not found or not a directory: ${src}`);
765
942
  }
766
943
  const skillName = basename(src);
767
- const dest = join(skillsDestBase, skillName);
768
- if (existsSync(dest) && options?.force !== true) {
944
+ const dest = join7(skillsDestBase, skillName);
945
+ if (existsSync7(dest) && options?.force !== true) {
769
946
  throw new Error(`Destination already exists: ${dest}`);
770
947
  }
771
948
  ensureEmptyDir(dest);
@@ -775,13 +952,13 @@ function installSkillPlugin(pluginInput, options) {
775
952
  const commandPaths = entry.commands ?? [];
776
953
  for (const rel of commandPaths) {
777
954
  const src = safeJoinWithin(entrySourceBase, rel);
778
- if (!existsSync(src)) {
955
+ if (!existsSync7(src)) {
779
956
  throw new Error(`Command path not found: ${src}`);
780
957
  }
781
- const stat = lstatSync(src);
958
+ const stat = lstatSync2(src);
782
959
  if (stat.isDirectory()) {
783
- const dest = join(commandsDestBase, basename(src));
784
- if (existsSync(dest) && options?.force !== true) {
960
+ const dest = join7(commandsDestBase, basename(src));
961
+ if (existsSync7(dest) && options?.force !== true) {
785
962
  throw new Error(`Destination already exists: ${dest}`);
786
963
  }
787
964
  ensureEmptyDir(dest);
@@ -790,14 +967,13 @@ function installSkillPlugin(pluginInput, options) {
790
967
  continue;
791
968
  }
792
969
  if (stat.isFile()) {
793
- const dest = join(commandsDestBase, basename(src));
794
- ensureDir(dirname(dest));
795
- if (existsSync(dest) && options?.force !== true) {
970
+ const dest = join7(commandsDestBase, basename(src));
971
+ ensureDir(dirname5(dest));
972
+ if (existsSync7(dest) && options?.force !== true) {
796
973
  throw new Error(`Destination already exists: ${dest}`);
797
974
  }
798
- copyFileSync(src, dest);
975
+ copyFileSync3(src, dest);
799
976
  installedCommands.push(dest);
800
- continue;
801
977
  }
802
978
  }
803
979
  installState[pluginSpec] = {
@@ -810,11 +986,18 @@ function installSkillPlugin(pluginInput, options) {
810
986
  installedAt: (/* @__PURE__ */ new Date()).toISOString(),
811
987
  skills: installedSkills,
812
988
  commands: installedCommands,
813
- sourceMarketplacePath: source.source === "file" || source.source === "directory" ? source.path : source.source === "github" ? `github:${source.repo}` : source.source === "url" ? source.url : source.source === "git" ? source.url : `npm:${source.package}`
989
+ sourceMarketplacePath: sourcePathForRecord(source)
814
990
  };
815
991
  savePluginInstallState(installState);
816
992
  return { pluginSpec, installedSkills, installedCommands };
817
993
  }
994
+ function sourcePathForRecord(source) {
995
+ return source.source === "file" || source.source === "directory" ? source.path : source.source === "github" ? `github:${source.repo}` : source.source === "url" ? source.url : source.source === "git" ? source.url : `npm:${source.package}`;
996
+ }
997
+
998
+ // apps/cli/src/services/skillMarketplace/plugins/uninstall.ts
999
+ import { existsSync as existsSync8, rmSync as rmSync4 } from "node:fs";
1000
+ import { join as join8 } from "node:path";
818
1001
  function uninstallSkillPlugin(pluginInput, options) {
819
1002
  const requestedScope = normalizePluginScope(options);
820
1003
  const state = ensurePluginInstallState();
@@ -839,7 +1022,7 @@ function uninstallSkillPlugin(pluginInput, options) {
839
1022
  }
840
1023
  if (record.kind === "plugin-pack") {
841
1024
  const baseDir2 = baseDirForInstallRecord(record);
842
- const pluginRoot = typeof record.pluginRoot === "string" && record.pluginRoot.trim() ? record.pluginRoot : join(
1025
+ const pluginRoot = typeof record.pluginRoot === "string" && record.pluginRoot.trim() ? record.pluginRoot : join8(
843
1026
  baseDir2,
844
1027
  "plugins",
845
1028
  "installed",
@@ -847,8 +1030,8 @@ function uninstallSkillPlugin(pluginInput, options) {
847
1030
  record.marketplace
848
1031
  );
849
1032
  const removedCommands2 = [];
850
- if (existsSync(pluginRoot)) {
851
- rmSync(pluginRoot, { recursive: true, force: true });
1033
+ if (existsSync8(pluginRoot)) {
1034
+ rmSync4(pluginRoot, { recursive: true, force: true });
852
1035
  removedCommands2.push(pluginRoot);
853
1036
  }
854
1037
  delete state[pluginSpec];
@@ -856,20 +1039,20 @@ function uninstallSkillPlugin(pluginInput, options) {
856
1039
  return { pluginSpec, removedSkills: [], removedCommands: removedCommands2 };
857
1040
  }
858
1041
  const baseDir = baseDirForInstallRecord(record);
859
- const skillsDestBase = join(baseDir, "skills");
860
- const commandsDestBase = join(
1042
+ const skillsDestBase = join8(baseDir, "skills");
1043
+ const commandsDestBase = join8(
861
1044
  baseDir,
862
1045
  "commands",
863
1046
  record.plugin,
864
1047
  record.marketplace
865
1048
  );
866
- const disabledSkillsBase = join(
1049
+ const disabledSkillsBase = join8(
867
1050
  baseDir,
868
1051
  "skills.disabled",
869
1052
  record.plugin,
870
1053
  record.marketplace
871
1054
  );
872
- const disabledCommandsBase = join(
1055
+ const disabledCommandsBase = join8(
873
1056
  baseDir,
874
1057
  "commands.disabled",
875
1058
  record.plugin,
@@ -877,177 +1060,31 @@ function uninstallSkillPlugin(pluginInput, options) {
877
1060
  );
878
1061
  const removedSkills = [];
879
1062
  for (const skillName of record.skills) {
880
- const dest = join(skillsDestBase, skillName);
881
- if (existsSync(dest)) rmSync(dest, { recursive: true, force: true });
882
- const disabledDest = join(disabledSkillsBase, skillName);
883
- if (existsSync(disabledDest))
884
- rmSync(disabledDest, { recursive: true, force: true });
1063
+ const dest = join8(skillsDestBase, skillName);
1064
+ if (existsSync8(dest)) rmSync4(dest, { recursive: true, force: true });
1065
+ const disabledDest = join8(disabledSkillsBase, skillName);
1066
+ if (existsSync8(disabledDest)) {
1067
+ rmSync4(disabledDest, { recursive: true, force: true });
1068
+ }
885
1069
  removedSkills.push(skillName);
886
1070
  }
887
1071
  const removedCommands = [];
888
- if (existsSync(commandsDestBase)) {
889
- rmSync(commandsDestBase, { recursive: true, force: true });
1072
+ if (existsSync8(commandsDestBase)) {
1073
+ rmSync4(commandsDestBase, { recursive: true, force: true });
890
1074
  removedCommands.push(commandsDestBase);
891
1075
  }
892
- if (existsSync(disabledCommandsBase)) {
893
- rmSync(disabledCommandsBase, { recursive: true, force: true });
1076
+ if (existsSync8(disabledCommandsBase)) {
1077
+ rmSync4(disabledCommandsBase, { recursive: true, force: true });
894
1078
  removedCommands.push(disabledCommandsBase);
895
1079
  }
896
1080
  delete state[pluginSpec];
897
1081
  savePluginInstallState(state);
898
1082
  return { pluginSpec, removedSkills, removedCommands };
899
1083
  }
900
- function disableSkillPlugin(pluginInput, options) {
901
- const requestedScope = normalizePluginScope(options);
902
- const state = ensurePluginInstallState();
903
- const pluginSpec = resolveInstalledPluginSpec(pluginInput, state);
904
- const record = state[pluginSpec];
905
- if (!record) throw new Error(`Plugin '${pluginSpec}' is not installed`);
906
- if (record.scope !== requestedScope) {
907
- throw new Error(
908
- `Plugin '${pluginSpec}' is installed with scope=${record.scope}. Re-run with --scope ${record.scope}.`
909
- );
910
- }
911
- if (record.scope !== "user") {
912
- const projectPath = record.projectPath?.trim() || "";
913
- const cwd = getCwd();
914
- if (!projectPath || projectPath !== cwd) {
915
- throw new Error(
916
- `Plugin '${pluginSpec}' is installed for a different directory. Expected cwd=${projectPath || "(missing)"}, got cwd=${cwd}`
917
- );
918
- }
919
- }
920
- if (record.isEnabled === false) {
921
- return { pluginSpec, disabledSkills: [], disabledCommands: [] };
922
- }
923
- if (record.kind === "plugin-pack") {
924
- record.isEnabled = false;
925
- state[pluginSpec] = record;
926
- savePluginInstallState(state);
927
- return { pluginSpec, disabledSkills: [], disabledCommands: [] };
928
- }
929
- const baseDir = baseDirForInstallRecord(record);
930
- const skillsDir = join(baseDir, "skills");
931
- const commandsDir = join(
932
- baseDir,
933
- "commands",
934
- record.plugin,
935
- record.marketplace
936
- );
937
- const disabledSkillsBase = join(
938
- baseDir,
939
- "skills.disabled",
940
- record.plugin,
941
- record.marketplace
942
- );
943
- const disabledCommandsDir = join(
944
- baseDir,
945
- "commands.disabled",
946
- record.plugin,
947
- record.marketplace
948
- );
949
- const disabledSkills = [];
950
- for (const skillName of record.skills) {
951
- const src = join(skillsDir, skillName);
952
- if (!existsSync(src)) continue;
953
- const dest = join(disabledSkillsBase, skillName);
954
- ensureDir(dirname(dest));
955
- if (existsSync(dest)) rmSync(dest, { recursive: true, force: true });
956
- renameSync(src, dest);
957
- disabledSkills.push(skillName);
958
- }
959
- const disabledCommands = [];
960
- if (existsSync(commandsDir)) {
961
- ensureDir(dirname(disabledCommandsDir));
962
- if (existsSync(disabledCommandsDir)) {
963
- rmSync(disabledCommandsDir, { recursive: true, force: true });
964
- }
965
- renameSync(commandsDir, disabledCommandsDir);
966
- disabledCommands.push(disabledCommandsDir);
967
- }
968
- record.isEnabled = false;
969
- state[pluginSpec] = record;
970
- savePluginInstallState(state);
971
- return { pluginSpec, disabledSkills, disabledCommands };
972
- }
973
- function enableSkillPlugin(pluginInput, options) {
974
- const requestedScope = normalizePluginScope(options);
975
- const state = ensurePluginInstallState();
976
- const pluginSpec = resolveInstalledPluginSpec(pluginInput, state);
977
- const record = state[pluginSpec];
978
- if (!record) throw new Error(`Plugin '${pluginSpec}' is not installed`);
979
- if (record.scope !== requestedScope) {
980
- throw new Error(
981
- `Plugin '${pluginSpec}' is installed with scope=${record.scope}. Re-run with --scope ${record.scope}.`
982
- );
983
- }
984
- if (record.scope !== "user") {
985
- const projectPath = record.projectPath?.trim() || "";
986
- const cwd = getCwd();
987
- if (!projectPath || projectPath !== cwd) {
988
- throw new Error(
989
- `Plugin '${pluginSpec}' is installed for a different directory. Expected cwd=${projectPath || "(missing)"}, got cwd=${cwd}`
990
- );
991
- }
992
- }
993
- if (record.isEnabled !== false) {
994
- return { pluginSpec, enabledSkills: [], enabledCommands: [] };
995
- }
996
- if (record.kind === "plugin-pack") {
997
- record.isEnabled = true;
998
- state[pluginSpec] = record;
999
- savePluginInstallState(state);
1000
- return { pluginSpec, enabledSkills: [], enabledCommands: [] };
1001
- }
1002
- const baseDir = baseDirForInstallRecord(record);
1003
- const skillsDir = join(baseDir, "skills");
1004
- const commandsDir = join(
1005
- baseDir,
1006
- "commands",
1007
- record.plugin,
1008
- record.marketplace
1009
- );
1010
- const disabledSkillsBase = join(
1011
- baseDir,
1012
- "skills.disabled",
1013
- record.plugin,
1014
- record.marketplace
1015
- );
1016
- const disabledCommandsDir = join(
1017
- baseDir,
1018
- "commands.disabled",
1019
- record.plugin,
1020
- record.marketplace
1021
- );
1022
- const enabledSkills = [];
1023
- for (const skillName of record.skills) {
1024
- const src = join(disabledSkillsBase, skillName);
1025
- if (!existsSync(src)) continue;
1026
- const dest = join(skillsDir, skillName);
1027
- ensureDir(dirname(dest));
1028
- if (existsSync(dest)) {
1029
- throw new Error(`Destination already exists: ${dest}`);
1030
- }
1031
- renameSync(src, dest);
1032
- enabledSkills.push(skillName);
1033
- }
1034
- const enabledCommands = [];
1035
- if (existsSync(disabledCommandsDir)) {
1036
- ensureDir(dirname(commandsDir));
1037
- if (existsSync(commandsDir)) {
1038
- throw new Error(`Destination already exists: ${commandsDir}`);
1039
- }
1040
- renameSync(disabledCommandsDir, commandsDir);
1041
- enabledCommands.push(commandsDir);
1042
- }
1043
- record.isEnabled = true;
1044
- state[pluginSpec] = record;
1045
- savePluginInstallState(state);
1046
- return { pluginSpec, enabledSkills, enabledCommands };
1047
- }
1048
- function listInstalledSkillPlugins() {
1049
- return ensurePluginInstallState();
1050
- }
1084
+
1085
+ // apps/cli/src/services/skillMarketplace/plugins/list.ts
1086
+ import { existsSync as existsSync9, lstatSync as lstatSync3 } from "node:fs";
1087
+ import { join as join9 } from "node:path";
1051
1088
  function listEnabledInstalledPluginPackRoots() {
1052
1089
  const state = ensurePluginInstallState();
1053
1090
  const cwd = getCwd();
@@ -1061,7 +1098,7 @@ function listEnabledInstalledPluginPackRoots() {
1061
1098
  if (!projectPath || projectPath !== cwd) continue;
1062
1099
  }
1063
1100
  const baseDir = baseDirForInstallRecord(record);
1064
- const pluginRoot = typeof record.pluginRoot === "string" && record.pluginRoot.trim() ? record.pluginRoot : join(
1101
+ const pluginRoot = typeof record.pluginRoot === "string" && record.pluginRoot.trim() ? record.pluginRoot : join9(
1065
1102
  baseDir,
1066
1103
  "plugins",
1067
1104
  "installed",
@@ -1069,8 +1106,9 @@ function listEnabledInstalledPluginPackRoots() {
1069
1106
  record.marketplace
1070
1107
  );
1071
1108
  try {
1072
- if (!existsSync(pluginRoot) || !lstatSync(pluginRoot).isDirectory())
1109
+ if (!existsSync9(pluginRoot) || !lstatSync3(pluginRoot).isDirectory()) {
1073
1110
  continue;
1111
+ }
1074
1112
  roots.push(pluginRoot);
1075
1113
  } catch {
1076
1114
  continue;
@@ -1081,17 +1119,17 @@ function listEnabledInstalledPluginPackRoots() {
1081
1119
 
1082
1120
  export {
1083
1121
  MarketplaceManifestSchema,
1084
- parsePluginSpec,
1085
1122
  listMarketplaces,
1086
1123
  addMarketplace,
1087
1124
  removeMarketplace,
1088
1125
  refreshMarketplaceAsync,
1089
1126
  refreshAllMarketplacesAsync,
1090
1127
  getMarketplaceManifest,
1091
- installSkillPlugin,
1092
- uninstallSkillPlugin,
1128
+ listInstalledSkillPlugins,
1129
+ parsePluginSpec,
1093
1130
  disableSkillPlugin,
1094
1131
  enableSkillPlugin,
1095
- listInstalledSkillPlugins,
1132
+ installSkillPlugin,
1133
+ uninstallSkillPlugin,
1096
1134
  listEnabledInstalledPluginPackRoots
1097
1135
  };