svamp-cli 0.1.50 → 0.1.52

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 (311) hide show
  1. package/dist/cli.mjs +25 -22
  2. package/dist/{commands-D-nIO_Sf.mjs → commands-1tmye7o_.mjs} +7 -3
  3. package/dist/{commands-D1brd9fB.mjs → commands-CI_BVphs.mjs} +7 -3
  4. package/dist/{commands-DHnFOhQC.mjs → commands-DcFOU9nW.mjs} +7 -3
  5. package/dist/commands-DwY2B7KW.mjs +562 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/{package-BLDik3NY.mjs → package-BRivSAkK.mjs} +1 -1
  8. package/dist/{package-BYUO-39f.mjs → package-D7EUXtnk.mjs} +1 -1
  9. package/dist/{run-BE_AIJ7z.mjs → run-BYJX5syg.mjs} +1 -1
  10. package/dist/{run-CE4H8ZiN.mjs → run-BnnUavlu.mjs} +199 -65
  11. package/dist/{run-BG3279Kg.mjs → run-Bw6aGHLA.mjs} +1 -1
  12. package/dist/{run-4li60ojK.mjs → run-DOwarObi.mjs} +1 -1
  13. package/dist/{run-C0ecvcRP.mjs → run-DxISzP_V.mjs} +63 -8
  14. package/dist/{run-Bc83CRUn.mjs → run-eYBOEaWw.mjs} +22 -7
  15. package/dist/tunnel-C2_V6y3d.mjs +299 -0
  16. package/package.json +1 -1
  17. package/dist/commands-4_MiOQVp.mjs +0 -1217
  18. package/dist/commands-8UAWGJrC.mjs +0 -1208
  19. package/dist/commands-8Wmq0uak.mjs +0 -1407
  20. package/dist/commands-8Xn02pQg.mjs +0 -1217
  21. package/dist/commands-9DPsh6ku.mjs +0 -1217
  22. package/dist/commands-9rMB13FP.mjs +0 -1214
  23. package/dist/commands-B-XaqFDB.mjs +0 -1407
  24. package/dist/commands-B53zuBHB.mjs +0 -1217
  25. package/dist/commands-B7yLt11i.mjs +0 -1217
  26. package/dist/commands-BDVAO_N2.mjs +0 -1217
  27. package/dist/commands-BD_NjWJL.mjs +0 -1217
  28. package/dist/commands-BEhSQqTp.mjs +0 -507
  29. package/dist/commands-BIFQZZGw.mjs +0 -1375
  30. package/dist/commands-BImRR1Wr.mjs +0 -1217
  31. package/dist/commands-BLmRIMdf.mjs +0 -1217
  32. package/dist/commands-BOYo9cdy.mjs +0 -1741
  33. package/dist/commands-BQ_347V_.mjs +0 -1374
  34. package/dist/commands-BTEmyf2m.mjs +0 -1407
  35. package/dist/commands-BVjcCbWS.mjs +0 -1375
  36. package/dist/commands-BVsLRttq.mjs +0 -1217
  37. package/dist/commands-BVuE0VQU.mjs +0 -507
  38. package/dist/commands-BY09VTpk.mjs +0 -1375
  39. package/dist/commands-Bcdp0X-o.mjs +0 -1217
  40. package/dist/commands-BdnG1cqQ.mjs +0 -1217
  41. package/dist/commands-BdvvRQIo.mjs +0 -1415
  42. package/dist/commands-Bgg_dvDw.mjs +0 -1683
  43. package/dist/commands-Bi0zYJvj.mjs +0 -1407
  44. package/dist/commands-BmirUCVt.mjs +0 -1208
  45. package/dist/commands-BpSUbvmr.mjs +0 -1217
  46. package/dist/commands-BuJ6xTfc.mjs +0 -1217
  47. package/dist/commands-BzbYPx0f.mjs +0 -1208
  48. package/dist/commands-C-RtFjJl.mjs +0 -1217
  49. package/dist/commands-C20_f6oo.mjs +0 -1217
  50. package/dist/commands-C6KDr9Yp.mjs +0 -1407
  51. package/dist/commands-C9TOoTCv.mjs +0 -1395
  52. package/dist/commands-C9TdN_El.mjs +0 -1683
  53. package/dist/commands-CFv6lO0D.mjs +0 -1217
  54. package/dist/commands-CJ2n5jS2.mjs +0 -1375
  55. package/dist/commands-CKEKQ_5B.mjs +0 -1217
  56. package/dist/commands-CQz67Rm1.mjs +0 -1395
  57. package/dist/commands-CRZbJjqN.mjs +0 -1375
  58. package/dist/commands-CToIvBFX.mjs +0 -1375
  59. package/dist/commands-CWsfciHn.mjs +0 -1217
  60. package/dist/commands-CYMSyqYC.mjs +0 -1395
  61. package/dist/commands-CZ7KPLLJ.mjs +0 -1217
  62. package/dist/commands-Cc73uUnP.mjs +0 -1375
  63. package/dist/commands-CdMsAD1-.mjs +0 -1217
  64. package/dist/commands-CdyCWC3y.mjs +0 -1395
  65. package/dist/commands-ClVCprrK.mjs +0 -1217
  66. package/dist/commands-Cnmf8znA.mjs +0 -1196
  67. package/dist/commands-CorUNLRF.mjs +0 -1375
  68. package/dist/commands-Cq0oj5_v.mjs +0 -1217
  69. package/dist/commands-CrdvbXPI.mjs +0 -1395
  70. package/dist/commands-Cw2Od6mc.mjs +0 -1683
  71. package/dist/commands-CwC2aVzu.mjs +0 -1217
  72. package/dist/commands-CxSCUJCB.mjs +0 -1217
  73. package/dist/commands-D-PTwdZz.mjs +0 -1217
  74. package/dist/commands-D7-NHH5q.mjs +0 -1407
  75. package/dist/commands-D7kH-7Vn.mjs +0 -1217
  76. package/dist/commands-DBv6A3aJ.mjs +0 -507
  77. package/dist/commands-DD3HXakm.mjs +0 -1217
  78. package/dist/commands-DLoe6FyK.mjs +0 -1375
  79. package/dist/commands-DPbH8KF0.mjs +0 -1217
  80. package/dist/commands-DUAQ9MZM.mjs +0 -1217
  81. package/dist/commands-DVw-P6-0.mjs +0 -1407
  82. package/dist/commands-DVygnMsh.mjs +0 -1217
  83. package/dist/commands-DWira-Cz.mjs +0 -1741
  84. package/dist/commands-DYTdUlul.mjs +0 -1217
  85. package/dist/commands-DZfaDmsk.mjs +0 -1374
  86. package/dist/commands-Dd8cn8mW.mjs +0 -1217
  87. package/dist/commands-DsIoygTL.mjs +0 -1395
  88. package/dist/commands-Du-fdLLu.mjs +0 -969
  89. package/dist/commands-DuJGOq1y.mjs +0 -1217
  90. package/dist/commands-DwBr3sBn.mjs +0 -1217
  91. package/dist/commands-DwveR96q.mjs +0 -1683
  92. package/dist/commands-DypTF36z.mjs +0 -506
  93. package/dist/commands-EUMJqBCs.mjs +0 -1407
  94. package/dist/commands-HLu7P96l.mjs +0 -1214
  95. package/dist/commands-HrBaGV-C.mjs +0 -1683
  96. package/dist/commands-Jk5no-DX.mjs +0 -1407
  97. package/dist/commands-KH5dj9dv.mjs +0 -1214
  98. package/dist/commands-LaNHVHjc.mjs +0 -1217
  99. package/dist/commands-O1Q9g00y.mjs +0 -1395
  100. package/dist/commands-OwMfbBrU.mjs +0 -1395
  101. package/dist/commands-SQ0Wp_kD.mjs +0 -1217
  102. package/dist/commands-S_MFQ9n1.mjs +0 -354
  103. package/dist/commands-T3q8VKCY.mjs +0 -1407
  104. package/dist/commands-Ugz9TtRu.mjs +0 -1420
  105. package/dist/commands-Wng0OuNY.mjs +0 -1683
  106. package/dist/commands-YBW5jFpy.mjs +0 -1217
  107. package/dist/commands-Z-CbuF8E.mjs +0 -1217
  108. package/dist/commands-fSZOP80Z.mjs +0 -1217
  109. package/dist/commands-fqBuJe1b.mjs +0 -1217
  110. package/dist/commands-g-1n3_Rp.mjs +0 -1395
  111. package/dist/commands-mC0oe0lj.mjs +0 -1217
  112. package/dist/commands-od2hOku5.mjs +0 -1217
  113. package/dist/commands-otgzprjb.mjs +0 -1375
  114. package/dist/commands-rhHI6Wb2.mjs +0 -1420
  115. package/dist/commands-zGHnUXh5.mjs +0 -1217
  116. package/dist/package-BMCjXPI9.mjs +0 -58
  117. package/dist/package-BPMWPlS0.mjs +0 -57
  118. package/dist/package-BaGfG8vL.mjs +0 -58
  119. package/dist/package-BkBE6ZdN.mjs +0 -57
  120. package/dist/package-BufekbY1.mjs +0 -57
  121. package/dist/package-C1hpYMj4.mjs +0 -57
  122. package/dist/package-CmIBOZtY.mjs +0 -57
  123. package/dist/package-CmVt1kdw.mjs +0 -58
  124. package/dist/package-Cn6Ya4A0.mjs +0 -57
  125. package/dist/package-Csd530Ym.mjs +0 -57
  126. package/dist/package-D6mNQtUs.mjs +0 -57
  127. package/dist/package-DG0AkZdm.mjs +0 -58
  128. package/dist/package-DRO1LpXW.mjs +0 -58
  129. package/dist/package-Dav8qh6X.mjs +0 -57
  130. package/dist/package-DiA55dzE.mjs +0 -57
  131. package/dist/package-UwLIU765.mjs +0 -58
  132. package/dist/package-k3XsdP9k.mjs +0 -58
  133. package/dist/package-rasGC9_z.mjs +0 -58
  134. package/dist/run-4B1XZQB8.mjs +0 -5426
  135. package/dist/run-4eArMb_9.mjs +0 -1050
  136. package/dist/run-67wfoMuo.mjs +0 -5383
  137. package/dist/run-6N2IdEX7.mjs +0 -5410
  138. package/dist/run-6dwQnoBL.mjs +0 -1051
  139. package/dist/run-7iQKryzo.mjs +0 -5383
  140. package/dist/run-7s8lOXqB.mjs +0 -1050
  141. package/dist/run-8kKykzTs.mjs +0 -5367
  142. package/dist/run-8mLZV2lg.mjs +0 -1050
  143. package/dist/run-9x7I9Ck-.mjs +0 -5264
  144. package/dist/run-B-PWtXF-.mjs +0 -5894
  145. package/dist/run-B1ivovUl.mjs +0 -5964
  146. package/dist/run-B1l9Ed8k.mjs +0 -5403
  147. package/dist/run-B2zRMxE0.mjs +0 -5508
  148. package/dist/run-B31biy0V.mjs +0 -1050
  149. package/dist/run-B5o5fMMd.mjs +0 -5369
  150. package/dist/run-B7V-xXM7.mjs +0 -5775
  151. package/dist/run-B9ND6srh.mjs +0 -6154
  152. package/dist/run-BHZNzX1F.mjs +0 -5235
  153. package/dist/run-BKdOv7gX.mjs +0 -1050
  154. package/dist/run-BLySdZ1K.mjs +0 -5251
  155. package/dist/run-BOVkQfM-.mjs +0 -1050
  156. package/dist/run-BQ0lIare.mjs +0 -1050
  157. package/dist/run-BREPr7Yc.mjs +0 -5508
  158. package/dist/run-BTwshVk1.mjs +0 -5728
  159. package/dist/run-BUL3eAqT.mjs +0 -1050
  160. package/dist/run-BVcPemGr.mjs +0 -5947
  161. package/dist/run-BWqEmIiz.mjs +0 -5964
  162. package/dist/run-BWsDPiNe.mjs +0 -1050
  163. package/dist/run-BX4iy6k8.mjs +0 -1050
  164. package/dist/run-BXYfq8mK.mjs +0 -5836
  165. package/dist/run-BY12Ataq.mjs +0 -5732
  166. package/dist/run-BYDOX4yk.mjs +0 -5402
  167. package/dist/run-Bd-t6s63.mjs +0 -5373
  168. package/dist/run-BenYqfwQ.mjs +0 -5273
  169. package/dist/run-BfF4bgA3.mjs +0 -5403
  170. package/dist/run-Bhh05yic.mjs +0 -5369
  171. package/dist/run-BicITYWX.mjs +0 -6138
  172. package/dist/run-BieEN0Pg.mjs +0 -5761
  173. package/dist/run-BjEQi6PN.mjs +0 -1050
  174. package/dist/run-BjZ6SyFy.mjs +0 -1051
  175. package/dist/run-Bl8OkKyC.mjs +0 -5969
  176. package/dist/run-BlEFlhfn.mjs +0 -5510
  177. package/dist/run-BmL1m0Bk.mjs +0 -1050
  178. package/dist/run-Bmx5wEBF.mjs +0 -1051
  179. package/dist/run-BnX5Rw8x.mjs +0 -5403
  180. package/dist/run-BpjmHeht.mjs +0 -1050
  181. package/dist/run-BxTdRjCG.mjs +0 -1051
  182. package/dist/run-ByOVDgvx.mjs +0 -6115
  183. package/dist/run-BzRP6Q5t.mjs +0 -1051
  184. package/dist/run-C0dyMP62.mjs +0 -1051
  185. package/dist/run-C1lS3SwN.mjs +0 -5733
  186. package/dist/run-C3PAp02X.mjs +0 -5252
  187. package/dist/run-C3eaYQub.mjs +0 -1050
  188. package/dist/run-C4pdX4sY.mjs +0 -1051
  189. package/dist/run-C676pHe-.mjs +0 -5423
  190. package/dist/run-C8GkzcfP.mjs +0 -1050
  191. package/dist/run-C9Hrqjy_.mjs +0 -1050
  192. package/dist/run-CC2C8P-U.mjs +0 -6031
  193. package/dist/run-CCcW4asS.mjs +0 -1050
  194. package/dist/run-CDBKhQ1Z.mjs +0 -1051
  195. package/dist/run-CEB6sYzn.mjs +0 -5962
  196. package/dist/run-CF6aXLmA.mjs +0 -5445
  197. package/dist/run-CHyN5U0t.mjs +0 -1050
  198. package/dist/run-CIFezmkC.mjs +0 -5949
  199. package/dist/run-CLA9zw7J.mjs +0 -5907
  200. package/dist/run-COWb9ovq.mjs +0 -1050
  201. package/dist/run-CSUAy5T5.mjs +0 -1051
  202. package/dist/run-CSk7i0Hq.mjs +0 -1050
  203. package/dist/run-CUtqSGWJ.mjs +0 -1050
  204. package/dist/run-CXrEt0TM.mjs +0 -5008
  205. package/dist/run-CY8Y0JPW.mjs +0 -5287
  206. package/dist/run-CZCKBcQ-.mjs +0 -5244
  207. package/dist/run-CZj0sRCs.mjs +0 -1050
  208. package/dist/run-C_1x2cNU.mjs +0 -5381
  209. package/dist/run-C_8iOjO1.mjs +0 -5892
  210. package/dist/run-C_KIew8H.mjs +0 -1051
  211. package/dist/run-CajRcN3C.mjs +0 -1050
  212. package/dist/run-CbzXO7fw.mjs +0 -1050
  213. package/dist/run-CcSr4x2f.mjs +0 -1050
  214. package/dist/run-CcYaXgCy.mjs +0 -6091
  215. package/dist/run-CdihMx0V.mjs +0 -1051
  216. package/dist/run-Cf2Dl_ck.mjs +0 -1051
  217. package/dist/run-CjH1H4vq.mjs +0 -1050
  218. package/dist/run-CkbDK6jA.mjs +0 -1051
  219. package/dist/run-Ckh6JE9F.mjs +0 -1050
  220. package/dist/run-Ckyg9-fm.mjs +0 -6079
  221. package/dist/run-CqL3ZWdr.mjs +0 -5381
  222. package/dist/run-Csj7sJAh.mjs +0 -1050
  223. package/dist/run-Ct--DWF1.mjs +0 -1051
  224. package/dist/run-CtJRxaFC.mjs +0 -1051
  225. package/dist/run-CuIMdkKF.mjs +0 -6099
  226. package/dist/run-CuckJGM-.mjs +0 -1050
  227. package/dist/run-CxGAa9MH.mjs +0 -1050
  228. package/dist/run-CyU4-O-e.mjs +0 -5411
  229. package/dist/run-CymDyu2b.mjs +0 -5389
  230. package/dist/run-CzIY4_RE.mjs +0 -6093
  231. package/dist/run-D0Ha4aWt.mjs +0 -1050
  232. package/dist/run-D0ow-xms.mjs +0 -5905
  233. package/dist/run-D1PFrNZB.mjs +0 -6273
  234. package/dist/run-D2X3jEqg.mjs +0 -1051
  235. package/dist/run-D39C7Ta3.mjs +0 -1050
  236. package/dist/run-D3Lqxasl.mjs +0 -1051
  237. package/dist/run-D3bhRCCb.mjs +0 -1051
  238. package/dist/run-D5N42sVA.mjs +0 -1050
  239. package/dist/run-D691XPXy.mjs +0 -6031
  240. package/dist/run-D7dLDpq3.mjs +0 -5403
  241. package/dist/run-D8mQ_fL5.mjs +0 -1050
  242. package/dist/run-DA-YBjNw.mjs +0 -6018
  243. package/dist/run-DByI8mI0.mjs +0 -1051
  244. package/dist/run-DCINWip4.mjs +0 -1050
  245. package/dist/run-DCrZ3vke.mjs +0 -5406
  246. package/dist/run-DDF-tRbn.mjs +0 -5954
  247. package/dist/run-DGSgljJE.mjs +0 -5421
  248. package/dist/run-DGsXW19O.mjs +0 -5541
  249. package/dist/run-DHrF2xpW.mjs +0 -5776
  250. package/dist/run-DIB0W42M.mjs +0 -1050
  251. package/dist/run-DJ4k0WzZ.mjs +0 -1051
  252. package/dist/run-DMI83W7i.mjs +0 -5434
  253. package/dist/run-DNX3djCI.mjs +0 -1050
  254. package/dist/run-DOPaGRT2.mjs +0 -6027
  255. package/dist/run-DP7KSZqR.mjs +0 -1051
  256. package/dist/run-DQ0yljWr.mjs +0 -1050
  257. package/dist/run-DTkldU6a.mjs +0 -1050
  258. package/dist/run-DU10B3gK.mjs +0 -5728
  259. package/dist/run-DV86VJNG.mjs +0 -5386
  260. package/dist/run-DVZGKdKO.mjs +0 -1050
  261. package/dist/run-DWdtp6VD.mjs +0 -6136
  262. package/dist/run-DWzA1gZ-.mjs +0 -1050
  263. package/dist/run-DXJ2M19k.mjs +0 -1050
  264. package/dist/run-DZOeccNu.mjs +0 -5484
  265. package/dist/run-D_W5YF0D.mjs +0 -6046
  266. package/dist/run-DaReJPf8.mjs +0 -1051
  267. package/dist/run-DaYrEeQ9.mjs +0 -5400
  268. package/dist/run-DbC9-WM4.mjs +0 -1050
  269. package/dist/run-Dd9XkswU.mjs +0 -1051
  270. package/dist/run-De-wkVl3.mjs +0 -5487
  271. package/dist/run-DfU2luyX.mjs +0 -1050
  272. package/dist/run-Dfl3Ze2L.mjs +0 -5541
  273. package/dist/run-DfuHUDIJ.mjs +0 -1051
  274. package/dist/run-DfwfyFqj.mjs +0 -5975
  275. package/dist/run-DgUDGHZy.mjs +0 -1051
  276. package/dist/run-Dge2K7h1.mjs +0 -1050
  277. package/dist/run-Di3I0USw.mjs +0 -1050
  278. package/dist/run-Dm3U4FB5.mjs +0 -6018
  279. package/dist/run-Du0YOs48.mjs +0 -5446
  280. package/dist/run-DuaIQAE4.mjs +0 -5392
  281. package/dist/run-Dwm19YhI.mjs +0 -1050
  282. package/dist/run-DxM7xaBa.mjs +0 -1050
  283. package/dist/run-DysN-cGm.mjs +0 -1050
  284. package/dist/run-DzXohf8-.mjs +0 -1051
  285. package/dist/run-E_MwVOtN.mjs +0 -5272
  286. package/dist/run-FPoL2-FD.mjs +0 -5381
  287. package/dist/run-HU4XjZfs.mjs +0 -6023
  288. package/dist/run-HhiYlJuS.mjs +0 -5414
  289. package/dist/run-JXLlRLFb.mjs +0 -1050
  290. package/dist/run-K-_jahIg.mjs +0 -1051
  291. package/dist/run-K_S7pfZ-.mjs +0 -1050
  292. package/dist/run-LDiT4WF-.mjs +0 -1050
  293. package/dist/run-NToLJWx-.mjs +0 -5442
  294. package/dist/run-RBufRqbs.mjs +0 -1050
  295. package/dist/run-YFYpyThQ.mjs +0 -1051
  296. package/dist/run-YG1Pb9dY.mjs +0 -5385
  297. package/dist/run-ZDa17iLg.mjs +0 -6060
  298. package/dist/run-ZN0qMdS_.mjs +0 -1051
  299. package/dist/run-azpFWM6w.mjs +0 -1050
  300. package/dist/run-coIDvBK_.mjs +0 -6127
  301. package/dist/run-jLp4pbTE.mjs +0 -1050
  302. package/dist/run-m3oAuSg0.mjs +0 -1050
  303. package/dist/run-r9CAcL_U.mjs +0 -5403
  304. package/dist/run-v32uF2bP.mjs +0 -5378
  305. package/dist/run-vTsskoZc.mjs +0 -5340
  306. package/dist/run-vt26p5D7.mjs +0 -1050
  307. package/dist/run-vvQiCHpi.mjs +0 -5427
  308. package/dist/run-w-HVv5py.mjs +0 -5410
  309. package/dist/run-wpUutZ9C.mjs +0 -1051
  310. package/dist/run-yTjJ7noq.mjs +0 -1051
  311. package/dist/run-zo5GSoVC.mjs +0 -1050
@@ -1,506 +0,0 @@
1
- import os from 'os';
2
- import fs from 'fs';
3
- import { join, resolve, relative } from 'path';
4
-
5
- const SKILLS_SERVER = process.env.HYPHA_SKILLS_SERVER || "https://hypha.aicell.io";
6
- const SKILLS_WORKSPACE = process.env.HYPHA_SKILLS_WORKSPACE || "hypha-cloud";
7
- const SKILLS_COLLECTION = process.env.HYPHA_SKILLS_COLLECTION || "marketplace";
8
- const SKILLS_DIR = join(os.homedir(), ".claude", "skills");
9
- function getArtifactBaseUrl() {
10
- return `${SKILLS_SERVER}/${SKILLS_WORKSPACE}/artifacts`;
11
- }
12
- function parseFrontmatter(content) {
13
- const match = content.match(/^---\s*\n([\s\S]*?)\n---/);
14
- if (!match) return null;
15
- const yaml = match[1];
16
- const result = {};
17
- let currentKey = null;
18
- let nestedObj = null;
19
- for (const line of yaml.split("\n")) {
20
- if (!line.trim() || line.trim().startsWith("#")) continue;
21
- const indentMatch = line.match(/^(\s*)/);
22
- const indent = indentMatch ? indentMatch[1].length : 0;
23
- if (indent > 0 && currentKey && nestedObj !== null) {
24
- const kvMatch2 = line.trim().match(/^([^:]+):\s*(.*)$/);
25
- if (kvMatch2) {
26
- nestedObj[kvMatch2[1].trim()] = kvMatch2[2].trim().replace(/^["']|["']$/g, "");
27
- }
28
- continue;
29
- }
30
- if (nestedObj !== null && currentKey) {
31
- result[currentKey] = nestedObj;
32
- nestedObj = null;
33
- currentKey = null;
34
- }
35
- const kvMatch = line.match(/^([^:]+):\s*(.*)$/);
36
- if (!kvMatch) continue;
37
- const key = kvMatch[1].trim();
38
- const value = kvMatch[2].trim();
39
- if (!value) {
40
- currentKey = key;
41
- nestedObj = {};
42
- } else {
43
- result[key] = value.replace(/^["']|["']$/g, "");
44
- }
45
- }
46
- if (nestedObj !== null && currentKey) {
47
- result[currentKey] = nestedObj;
48
- }
49
- if (!result.name || !result.description) return null;
50
- return result;
51
- }
52
- async function searchSkills(query) {
53
- const base = getArtifactBaseUrl();
54
- const filters = encodeURIComponent(JSON.stringify({ type: "skill" }));
55
- const url = `${base}/${SKILLS_COLLECTION}/children?keywords=${encodeURIComponent(query)}&filters=${filters}&limit=50`;
56
- const resp = await fetch(url);
57
- if (!resp.ok) {
58
- if (resp.status === 404) return [];
59
- throw new Error(`Search failed: ${resp.status} ${resp.statusText}`);
60
- }
61
- const data = await resp.json();
62
- return normalizeSkillList(Array.isArray(data) ? data : data.items || []);
63
- }
64
- async function getSkillInfo(skillAlias) {
65
- const base = getArtifactBaseUrl();
66
- const url = `${base}/${skillAlias}`;
67
- const resp = await fetch(url);
68
- if (!resp.ok) {
69
- if (resp.status === 404) return null;
70
- throw new Error(`Get skill failed: ${resp.status} ${resp.statusText}`);
71
- }
72
- const data = await resp.json();
73
- return normalizeSkill(data);
74
- }
75
- async function listSkillFiles(skillAlias, dir = "") {
76
- const base = getArtifactBaseUrl();
77
- const pathPart = dir ? `/${dir}` : "";
78
- const url = `${base}/${skillAlias}/files${pathPart}`;
79
- const resp = await fetch(url);
80
- if (!resp.ok) {
81
- throw new Error(`List files failed: ${resp.status} ${resp.statusText}`);
82
- }
83
- const data = await resp.json();
84
- return Array.isArray(data) ? data : [];
85
- }
86
- async function downloadSkillFile(skillAlias, filePath) {
87
- const base = getArtifactBaseUrl();
88
- const url = `${base}/${skillAlias}/files/${filePath}`;
89
- const resp = await fetch(url, { redirect: "follow" });
90
- if (!resp.ok) {
91
- throw new Error(`Download failed for ${filePath}: ${resp.status} ${resp.statusText}`);
92
- }
93
- return await resp.text();
94
- }
95
- function normalizeSkillList(items) {
96
- return items.map(normalizeSkill).filter((s) => s !== null);
97
- }
98
- function normalizeSkill(item) {
99
- if (!item) return null;
100
- const manifest = item.manifest || {};
101
- return {
102
- alias: item.alias || manifest.name || item.id || "unknown",
103
- name: manifest.name || item.alias || "unknown",
104
- description: manifest.description || "",
105
- author: manifest.metadata?.author || manifest.author,
106
- version: manifest.metadata?.version || manifest.version,
107
- tags: manifest.tags,
108
- created_at: item.created_at,
109
- last_modified: item.last_modified,
110
- versions: item.versions,
111
- git_url: item.git_url
112
- };
113
- }
114
-
115
- const SVAMP_HOME = process.env.SVAMP_HOME || join(os.homedir(), ".svamp");
116
- const ENV_FILE = join(SVAMP_HOME, ".env");
117
- function loadDotEnv() {
118
- if (!fs.existsSync(ENV_FILE)) return;
119
- const lines = fs.readFileSync(ENV_FILE, "utf-8").split("\n");
120
- for (const line of lines) {
121
- const trimmed = line.trim();
122
- if (!trimmed || trimmed.startsWith("#")) continue;
123
- const eqIdx = trimmed.indexOf("=");
124
- if (eqIdx === -1) continue;
125
- const key = trimmed.slice(0, eqIdx).trim();
126
- const value = trimmed.slice(eqIdx + 1).trim().replace(/^["']|["']$/g, "");
127
- if (!process.env[key]) {
128
- process.env[key] = value;
129
- }
130
- }
131
- }
132
- function ensureSkillsDir() {
133
- fs.mkdirSync(SKILLS_DIR, { recursive: true });
134
- }
135
- function formatTable(rows, widths) {
136
- if (rows.length === 0) return "";
137
- const cols = rows[0].length;
138
- const w = widths || Array.from(
139
- { length: cols },
140
- (_, i) => Math.min(Math.max(...rows.map((r) => (r[i] || "").length), 4), 50)
141
- );
142
- return rows.map(
143
- (row) => row.map((cell, i) => (cell || "").padEnd(w[i])).join(" ")
144
- ).join("\n");
145
- }
146
- function isValidSkillName(name) {
147
- return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name) && !name.includes("--") && name.length <= 64;
148
- }
149
- async function skillsFind(query, opts) {
150
- let results;
151
- try {
152
- results = await searchSkills(query);
153
- } catch (err) {
154
- console.error(`Failed to search skills: ${err.message}`);
155
- process.exit(1);
156
- }
157
- if (results.length === 0) {
158
- console.log(`No skills found matching "${query}".`);
159
- return;
160
- }
161
- if (opts?.json) {
162
- console.log(JSON.stringify(results, null, 2));
163
- return;
164
- }
165
- const header = ["NAME", "DESCRIPTION", "AUTHOR", "VERSION"];
166
- const rows = results.map((s) => [
167
- s.alias,
168
- s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description,
169
- s.author || "-",
170
- s.version || "-"
171
- ]);
172
- console.log(formatTable([header, ...rows], [25, 50, 20, 10]));
173
- }
174
- async function skillsInstall(skillName, opts) {
175
- if (!isValidSkillName(skillName)) {
176
- console.error(`Invalid skill name "${skillName}". Must be lowercase alphanumeric with hyphens, no consecutive hyphens, max 64 chars.`);
177
- process.exit(1);
178
- }
179
- const targetDir = join(SKILLS_DIR, skillName);
180
- if (fs.existsSync(targetDir) && !opts?.force) {
181
- console.error(`Skill "${skillName}" is already installed at ${targetDir}`);
182
- console.error("Use --force to overwrite.");
183
- process.exit(1);
184
- }
185
- let info;
186
- try {
187
- info = await getSkillInfo(skillName);
188
- } catch (err) {
189
- console.error(`Failed to fetch skill info: ${err.message}`);
190
- process.exit(1);
191
- }
192
- if (!info) {
193
- console.error(`Skill "${skillName}" not found in the marketplace.`);
194
- process.exit(1);
195
- }
196
- console.log(`Installing skill "${info.name}"...`);
197
- let files;
198
- try {
199
- files = await collectAllFiles(skillName);
200
- } catch (err) {
201
- console.error(`Failed to list skill files: ${err.message}`);
202
- process.exit(1);
203
- }
204
- if (files.length === 0) {
205
- console.error("Skill has no files.");
206
- process.exit(1);
207
- }
208
- if (!files.includes("SKILL.md")) {
209
- console.error("Skill is missing a SKILL.md file. The skill may be malformed.");
210
- process.exit(1);
211
- }
212
- ensureSkillsDir();
213
- if (fs.existsSync(targetDir) && opts?.force) {
214
- fs.rmSync(targetDir, { recursive: true, force: true });
215
- }
216
- fs.mkdirSync(targetDir, { recursive: true });
217
- let downloaded = 0;
218
- const errors = [];
219
- for (const filePath of files) {
220
- try {
221
- const content = await downloadSkillFile(skillName, filePath);
222
- const localPath = join(targetDir, filePath);
223
- fs.mkdirSync(join(localPath, ".."), { recursive: true });
224
- fs.writeFileSync(localPath, content, "utf-8");
225
- downloaded++;
226
- } catch (err) {
227
- errors.push(` ${filePath}: ${err.message}`);
228
- }
229
- }
230
- if (errors.length > 0) {
231
- console.error(`Warning: ${errors.length} file(s) failed to download:`);
232
- errors.forEach((e) => console.error(e));
233
- }
234
- if (downloaded === 0) {
235
- fs.rmSync(targetDir, { recursive: true, force: true });
236
- console.error("Failed to download any files. Installation aborted.");
237
- process.exit(1);
238
- }
239
- const skillMdPath = join(targetDir, "SKILL.md");
240
- if (fs.existsSync(skillMdPath)) {
241
- const content = fs.readFileSync(skillMdPath, "utf-8");
242
- const fm = parseFrontmatter(content);
243
- if (!fm) {
244
- console.error("Warning: Installed SKILL.md has invalid or missing frontmatter (name/description).");
245
- }
246
- }
247
- console.log(`Installed ${downloaded} file(s) to ${targetDir}`);
248
- if (info.git_url) {
249
- console.log(` Git: ${info.git_url}`);
250
- }
251
- }
252
- async function collectAllFiles(skillAlias, dir = "") {
253
- const entries = await listSkillFiles(skillAlias, dir);
254
- const result = [];
255
- for (const entry of entries) {
256
- const entryPath = dir ? `${dir}/${entry.name}` : entry.name;
257
- if (entry.type === "directory") {
258
- const sub = await collectAllFiles(skillAlias, entryPath);
259
- result.push(...sub);
260
- } else {
261
- result.push(entryPath);
262
- }
263
- }
264
- return result;
265
- }
266
- async function skillsList() {
267
- ensureSkillsDir();
268
- const entries = fs.readdirSync(SKILLS_DIR, { withFileTypes: true }).filter((e) => e.isDirectory());
269
- if (entries.length === 0) {
270
- console.log("No skills installed.");
271
- console.log(`Install one with: svamp skills install <name>`);
272
- return;
273
- }
274
- const header = ["NAME", "DESCRIPTION", "STATUS"];
275
- const rows = [];
276
- for (const entry of entries) {
277
- const skillDir = join(SKILLS_DIR, entry.name);
278
- const skillMd = join(skillDir, "SKILL.md");
279
- let description = "-";
280
- let status = "ok";
281
- if (!fs.existsSync(skillMd)) {
282
- status = "missing SKILL.md";
283
- } else {
284
- try {
285
- const content = fs.readFileSync(skillMd, "utf-8");
286
- const fm = parseFrontmatter(content);
287
- if (fm) {
288
- description = fm.description.length > 45 ? fm.description.slice(0, 42) + "..." : fm.description;
289
- } else {
290
- status = "invalid frontmatter";
291
- }
292
- } catch (err) {
293
- status = "read error";
294
- }
295
- }
296
- rows.push([entry.name, description, status]);
297
- }
298
- console.log(formatTable([header, ...rows], [25, 45, 20]));
299
- }
300
- async function skillsRemove(name) {
301
- if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
302
- console.error(`Invalid skill name "${name}".`);
303
- process.exit(1);
304
- }
305
- const targetDir = join(SKILLS_DIR, name);
306
- if (!fs.existsSync(targetDir)) {
307
- console.error(`Skill "${name}" is not installed.`);
308
- process.exit(1);
309
- }
310
- if (!fs.statSync(targetDir).isDirectory()) {
311
- console.error(`"${name}" is not a skill directory.`);
312
- process.exit(1);
313
- }
314
- fs.rmSync(targetDir, { recursive: true, force: true });
315
- console.log(`Removed skill "${name}" from ${targetDir}`);
316
- }
317
- async function skillsPublish(skillPath, opts) {
318
- const absPath = resolve(skillPath);
319
- if (!fs.existsSync(absPath)) {
320
- console.error(`Path does not exist: ${absPath}`);
321
- process.exit(1);
322
- }
323
- if (!fs.statSync(absPath).isDirectory()) {
324
- console.error(`Not a directory: ${absPath}`);
325
- process.exit(1);
326
- }
327
- const skillMdPath = join(absPath, "SKILL.md");
328
- if (!fs.existsSync(skillMdPath)) {
329
- console.error(`No SKILL.md found in ${absPath}`);
330
- console.error("A valid skill must contain a SKILL.md file with name and description frontmatter.");
331
- process.exit(1);
332
- }
333
- const skillMdContent = fs.readFileSync(skillMdPath, "utf-8");
334
- const manifest = parseFrontmatter(skillMdContent);
335
- if (!manifest) {
336
- console.error('SKILL.md must have YAML frontmatter with "name" and "description" fields.');
337
- process.exit(1);
338
- }
339
- if (!isValidSkillName(manifest.name)) {
340
- console.error(`Invalid skill name "${manifest.name}".`);
341
- console.error("Must be lowercase alphanumeric with hyphens, no consecutive hyphens, 1-64 chars.");
342
- process.exit(1);
343
- }
344
- if (!manifest.description.trim()) {
345
- console.error("SKILL.md description cannot be empty.");
346
- process.exit(1);
347
- }
348
- const filesToUpload = collectLocalFiles(absPath);
349
- if (filesToUpload.length === 0) {
350
- console.error("No files to upload.");
351
- process.exit(1);
352
- }
353
- const versionTag = opts?.version || null;
354
- console.log(`Publishing skill "${manifest.name}"${versionTag ? ` (version: ${versionTag})` : ""}...`);
355
- loadDotEnv();
356
- const token = process.env.HYPHA_TOKEN;
357
- if (!token) {
358
- console.error('Not logged in. Run "svamp login <url>" first.');
359
- process.exit(1);
360
- }
361
- const serverUrl = process.env.HYPHA_SERVER_URL || SKILLS_SERVER;
362
- let server;
363
- try {
364
- const mod = await import('hypha-rpc');
365
- const connectToServer = mod.connectToServer || mod.default?.connectToServer;
366
- server = await connectToServer({
367
- server_url: serverUrl,
368
- token,
369
- workspace: SKILLS_WORKSPACE
370
- });
371
- } catch (err) {
372
- console.error(`Failed to connect to Hypha: ${err.message}`);
373
- process.exit(1);
374
- }
375
- let am;
376
- try {
377
- am = await server.getService("public/artifact-manager");
378
- } catch (err) {
379
- console.error(`Failed to get artifact-manager service: ${err.message}`);
380
- await server.disconnect();
381
- process.exit(1);
382
- }
383
- let artifactId;
384
- let isUpdate = false;
385
- try {
386
- const existing = await am.read({
387
- artifact_id: `${SKILLS_WORKSPACE}/${manifest.name}`,
388
- _rkwargs: true
389
- });
390
- artifactId = existing.id;
391
- isUpdate = true;
392
- console.log(`Updating existing skill "${manifest.name}"...`);
393
- await am.edit({
394
- artifact_id: artifactId,
395
- manifest: {
396
- name: manifest.name,
397
- description: manifest.description,
398
- ...manifest.metadata && { metadata: manifest.metadata }
399
- },
400
- version: "stage",
401
- _rkwargs: true
402
- });
403
- } catch {
404
- try {
405
- const created = await am.create({
406
- alias: manifest.name,
407
- type: "skill",
408
- parent_id: `${SKILLS_WORKSPACE}/${SKILLS_COLLECTION}`,
409
- manifest: {
410
- name: manifest.name,
411
- description: manifest.description,
412
- ...manifest.metadata && { metadata: manifest.metadata }
413
- },
414
- config: {
415
- storage: "git"
416
- },
417
- version: "stage",
418
- _rkwargs: true
419
- });
420
- artifactId = created.id;
421
- console.log(`Created new skill artifact with git storage.`);
422
- } catch (err) {
423
- console.error(`Failed to create skill artifact: ${err.message}`);
424
- await server.disconnect();
425
- process.exit(1);
426
- }
427
- }
428
- let uploaded = 0;
429
- const uploadErrors = [];
430
- for (const relPath of filesToUpload) {
431
- try {
432
- const fullPath = join(absPath, relPath);
433
- const content = fs.readFileSync(fullPath);
434
- const putUrl = await am.put_file({
435
- artifact_id: artifactId,
436
- file_path: relPath,
437
- _rkwargs: true
438
- });
439
- if (!putUrl || typeof putUrl !== "string") {
440
- uploadErrors.push(`${relPath}: failed to get upload URL`);
441
- continue;
442
- }
443
- const resp = await fetch(putUrl, {
444
- method: "PUT",
445
- body: content,
446
- headers: { "Content-Type": "application/octet-stream" }
447
- });
448
- if (!resp.ok) {
449
- uploadErrors.push(`${relPath}: upload returned ${resp.status}`);
450
- continue;
451
- }
452
- uploaded++;
453
- } catch (err) {
454
- uploadErrors.push(`${relPath}: ${err.message}`);
455
- }
456
- }
457
- if (uploadErrors.length > 0) {
458
- console.error(`Warning: ${uploadErrors.length} file(s) failed to upload:`);
459
- uploadErrors.forEach((e) => console.error(` ${e}`));
460
- }
461
- if (uploaded === 0) {
462
- console.error("No files were uploaded. Publish aborted.");
463
- await server.disconnect();
464
- process.exit(1);
465
- }
466
- try {
467
- const commitOpts = {
468
- artifact_id: artifactId,
469
- _rkwargs: true
470
- };
471
- if (versionTag) {
472
- commitOpts.version = versionTag;
473
- commitOpts.comment = `Release ${versionTag}`;
474
- }
475
- await am.commit(commitOpts);
476
- } catch (err) {
477
- console.error(`Failed to commit: ${err.message}`);
478
- await server.disconnect();
479
- process.exit(1);
480
- }
481
- console.log(`Published "${manifest.name}" (${uploaded} files)${versionTag ? ` as ${versionTag}` : ""}`);
482
- console.log(` View: ${SKILLS_SERVER}/${SKILLS_WORKSPACE}/artifacts/${manifest.name}`);
483
- const gitUrl = `${SKILLS_SERVER}/${SKILLS_WORKSPACE}/git/${manifest.name}`;
484
- console.log(` Git: ${gitUrl}`);
485
- if (isUpdate) {
486
- console.log(` Tip: Use --version <tag> to publish a named version.`);
487
- }
488
- await server.disconnect();
489
- }
490
- function collectLocalFiles(dir, base) {
491
- const root = base || dir;
492
- const result = [];
493
- const entries = fs.readdirSync(dir, { withFileTypes: true });
494
- for (const entry of entries) {
495
- const fullPath = join(dir, entry.name);
496
- if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
497
- if (entry.isDirectory()) {
498
- result.push(...collectLocalFiles(fullPath, root));
499
- } else {
500
- result.push(relative(root, fullPath));
501
- }
502
- }
503
- return result;
504
- }
505
-
506
- export { skillsFind, skillsInstall, skillsList, skillsPublish, skillsRemove };