harnesstap 1.3.2 → 1.6.0

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 (245) hide show
  1. package/README.md +4 -0
  2. package/dist/apply-FTAIL3X3.js +50 -0
  3. package/dist/{approve-L7IFSYBO.js → approve-R6AWQB3I.js} +12 -16
  4. package/dist/{approve-L7IFSYBO.js.map → approve-R6AWQB3I.js.map} +1 -1
  5. package/dist/{audit-PBJDK7A4.js → audit-2HNKFPSU.js} +26 -39
  6. package/dist/{audit-PBJDK7A4.js.map → audit-2HNKFPSU.js.map} +1 -1
  7. package/dist/{auth-OM73RLNS.js → auth-C54KRLNF.js} +17 -21
  8. package/dist/{auth-OM73RLNS.js.map → auth-C54KRLNF.js.map} +1 -1
  9. package/dist/bin.js +13 -34
  10. package/dist/bin.js.map +1 -1
  11. package/dist/{chunk-R4PTE774.js → chunk-2XDYQXP2.js} +34 -41
  12. package/dist/chunk-2XDYQXP2.js.map +1 -0
  13. package/dist/{chunk-G5RWVZZ7.js → chunk-3277RVZT.js} +5 -7
  14. package/dist/{chunk-G5RWVZZ7.js.map → chunk-3277RVZT.js.map} +1 -1
  15. package/dist/{chunk-6JMVGKMD.js → chunk-3Q72LZPJ.js} +936 -528
  16. package/dist/chunk-3Q72LZPJ.js.map +1 -0
  17. package/dist/{chunk-U472S6IB.js → chunk-42E2MPES.js} +19 -27
  18. package/dist/chunk-42E2MPES.js.map +1 -0
  19. package/dist/{chunk-CZ4T75PP.js → chunk-5HACBPK2.js} +622 -252
  20. package/dist/chunk-5HACBPK2.js.map +1 -0
  21. package/dist/{chunk-IHW4PCDT.js → chunk-6FXJIKEG.js} +6 -6
  22. package/dist/{chunk-OPVIX7E4.js → chunk-A3TZT4WT.js} +6 -2
  23. package/dist/chunk-A3TZT4WT.js.map +1 -0
  24. package/dist/chunk-BUA7WFI4.js +39327 -0
  25. package/dist/chunk-BUA7WFI4.js.map +1 -0
  26. package/dist/{chunk-IAZNF35S.js → chunk-CBSDMRMY.js} +2 -2
  27. package/dist/{chunk-YVJQ2QDG.js → chunk-CR2TYMKC.js} +65 -55
  28. package/dist/chunk-CR2TYMKC.js.map +1 -0
  29. package/dist/{chunk-VQVUJYYY.js → chunk-CWXCZBJR.js} +76 -6
  30. package/dist/chunk-CWXCZBJR.js.map +1 -0
  31. package/dist/{chunk-AVZOFMJX.js → chunk-D7R577XZ.js} +381 -138
  32. package/dist/chunk-D7R577XZ.js.map +1 -0
  33. package/dist/{chunk-3EGM4IUI.js → chunk-EPXAOEBB.js} +6 -6
  34. package/dist/{chunk-64R32MG2.js → chunk-GZU4LVFF.js} +179 -26
  35. package/dist/chunk-GZU4LVFF.js.map +1 -0
  36. package/dist/chunk-HV3ENT2F.js +61 -0
  37. package/dist/chunk-HV3ENT2F.js.map +1 -0
  38. package/dist/{chunk-XCPWLGPB.js → chunk-K4UDZUJ2.js} +2 -2
  39. package/dist/{chunk-OQ4KBUN2.js → chunk-L6BJCRBU.js} +13 -16
  40. package/dist/chunk-L6BJCRBU.js.map +1 -0
  41. package/dist/{chunk-AFKCNFPP.js → chunk-M6FEDSHY.js} +16 -15
  42. package/dist/chunk-M6FEDSHY.js.map +1 -0
  43. package/dist/chunk-M7PHQ3UC.js +31491 -0
  44. package/dist/chunk-M7PHQ3UC.js.map +1 -0
  45. package/dist/{chunk-FBYAIBHP.js → chunk-MHLAIGIM.js} +2 -2
  46. package/dist/{chunk-ENHDEB7Z.js → chunk-MHMFF6A5.js} +5 -7
  47. package/dist/{chunk-ENHDEB7Z.js.map → chunk-MHMFF6A5.js.map} +1 -1
  48. package/dist/chunk-MKLJBW5N.js +14 -0
  49. package/dist/{chunk-XRXFJTAT.js → chunk-MQCAPCAF.js} +17 -26
  50. package/dist/chunk-MQCAPCAF.js.map +1 -0
  51. package/dist/{chunk-UEHDEADL.js → chunk-MQCH3YZ5.js} +15 -13
  52. package/dist/chunk-MQCH3YZ5.js.map +1 -0
  53. package/dist/chunk-OHZNDV4A.js +1707 -0
  54. package/dist/chunk-OHZNDV4A.js.map +1 -0
  55. package/dist/{chunk-LGWUTV5Q.js → chunk-OWE3OSX6.js} +11 -13
  56. package/dist/{chunk-LGWUTV5Q.js.map → chunk-OWE3OSX6.js.map} +1 -1
  57. package/dist/{chunk-EY4ES5MG.js → chunk-PCNHBMBU.js} +3 -5
  58. package/dist/{chunk-EY4ES5MG.js.map → chunk-PCNHBMBU.js.map} +1 -1
  59. package/dist/{chunk-YRGM7RAD.js → chunk-QGTDQNVV.js} +7 -11
  60. package/dist/{chunk-YRGM7RAD.js.map → chunk-QGTDQNVV.js.map} +1 -1
  61. package/dist/{chunk-BXSS2S4W.js → chunk-R27VZIF6.js} +2 -2
  62. package/dist/{chunk-TQ2NA4Z4.js → chunk-R4NV3Q7G.js} +8 -2
  63. package/dist/chunk-R4NV3Q7G.js.map +1 -0
  64. package/dist/{chunk-FUV7QYBS.js → chunk-R6VFJKZB.js} +86 -319
  65. package/dist/chunk-R6VFJKZB.js.map +1 -0
  66. package/dist/{chunk-QNAIDM6W.js → chunk-RQLVXJH2.js} +132 -4
  67. package/dist/chunk-RQLVXJH2.js.map +1 -0
  68. package/dist/{chunk-JQOKQKQT.js → chunk-S2D5PWAO.js} +2 -2
  69. package/dist/{chunk-JJJJ2RAD.js → chunk-T4EKNX2Q.js} +71 -11
  70. package/dist/chunk-T4EKNX2Q.js.map +1 -0
  71. package/dist/{chunk-GWQVYGRD.js → chunk-TERYL7JH.js} +118 -78
  72. package/dist/chunk-TERYL7JH.js.map +1 -0
  73. package/dist/chunk-UC27MQ3T.js +1920 -0
  74. package/dist/chunk-UC27MQ3T.js.map +1 -0
  75. package/dist/chunk-UEA4NCY2.js +106 -0
  76. package/dist/chunk-UEA4NCY2.js.map +1 -0
  77. package/dist/{chunk-WXRPQICX.js → chunk-UK2IV2ZQ.js} +2 -2
  78. package/dist/{chunk-MFCZN253.js → chunk-UZCAYOIQ.js} +8 -10
  79. package/dist/{chunk-MFCZN253.js.map → chunk-UZCAYOIQ.js.map} +1 -1
  80. package/dist/{chunk-IKAGGJEO.js → chunk-V4UNYSZO.js} +558 -18
  81. package/dist/chunk-V4UNYSZO.js.map +1 -0
  82. package/dist/chunk-VAPCU2FX.js +70 -0
  83. package/dist/chunk-VAPCU2FX.js.map +1 -0
  84. package/dist/{chunk-Y2JGMICO.js → chunk-WGVU3LA5.js} +25 -33
  85. package/dist/chunk-WGVU3LA5.js.map +1 -0
  86. package/dist/{chunk-UNRR4KH5.js → chunk-WQ3F4O7U.js} +20 -14
  87. package/dist/chunk-WQ3F4O7U.js.map +1 -0
  88. package/dist/chunk-XNS4I3W6.js +102 -0
  89. package/dist/chunk-XNS4I3W6.js.map +1 -0
  90. package/dist/{chunk-LDVXYN6F.js → chunk-Y4I7ZCAE.js} +178 -135
  91. package/dist/chunk-Y4I7ZCAE.js.map +1 -0
  92. package/dist/{chunk-6I3RY6R5.js → chunk-ZKMSHLXP.js} +11 -15
  93. package/dist/{chunk-6I3RY6R5.js.map → chunk-ZKMSHLXP.js.map} +1 -1
  94. package/dist/{compile-SDOASKGL.js → compile-B2QG6BAQ.js} +37 -54
  95. package/dist/{compile-SDOASKGL.js.map → compile-B2QG6BAQ.js.map} +1 -1
  96. package/dist/{config-4VZTVZKF.js → config-D3F6ICZ2.js} +21 -39
  97. package/dist/{config-4VZTVZKF.js.map → config-D3F6ICZ2.js.map} +1 -1
  98. package/dist/cursor-local-install-4HDIBX22.js +94 -0
  99. package/dist/cursor-local-install-4HDIBX22.js.map +1 -0
  100. package/dist/cursor-local-install-LL367GZY.js +94 -0
  101. package/dist/cursor-local-install-LL367GZY.js.map +1 -0
  102. package/dist/{doctor-HH6CFBRQ.js → doctor-QSGETVDE.js} +19 -23
  103. package/dist/doctor-QSGETVDE.js.map +1 -0
  104. package/dist/{environment-K7YMJJYN.js → environment-2JS4RWQA.js} +69 -88
  105. package/dist/environment-2JS4RWQA.js.map +1 -0
  106. package/dist/{github-A6TYG7WS.js → github-JXSTHLY2.js} +14 -15
  107. package/dist/{github-A6TYG7WS.js.map → github-JXSTHLY2.js.map} +1 -1
  108. package/dist/{harness-772XBFZQ.js → harness-GBI3AMLH.js} +48 -65
  109. package/dist/{harness-772XBFZQ.js.map → harness-GBI3AMLH.js.map} +1 -1
  110. package/dist/{help-QR4VTJZU.js → help-EC52ERIE.js} +43 -52
  111. package/dist/help-EC52ERIE.js.map +1 -0
  112. package/dist/{help-TLHNRJJ6.js → help-VIRMBOPJ.js} +73 -551
  113. package/dist/help-VIRMBOPJ.js.map +1 -0
  114. package/dist/host-plugin-view-kept-XKHD6NGU.js +139 -0
  115. package/dist/host-plugin-view-kept-XKHD6NGU.js.map +1 -0
  116. package/dist/index.d.ts +7 -0
  117. package/dist/index.js +10 -22
  118. package/dist/{init-AOKFPZHG.js → init-OK3K6ILG.js} +49 -70
  119. package/dist/init-OK3K6ILG.js.map +1 -0
  120. package/dist/live-read-cache-ESQQJBNS.js +13 -0
  121. package/dist/live-read-cache-WPUFHVMZ.js +12 -0
  122. package/dist/{lock-INAXNLMC.js → lock-AA2F4I3K.js} +13 -16
  123. package/dist/{lock-INAXNLMC.js.map → lock-AA2F4I3K.js.map} +1 -1
  124. package/dist/{marketplace-TUVLLPBG.js → marketplace-QUYCV23F.js} +75 -94
  125. package/dist/marketplace-QUYCV23F.js.map +1 -0
  126. package/dist/{mcp-MMWGRASN.js → mcp-CIHSR4DD.js} +35 -52
  127. package/dist/{mcp-MMWGRASN.js.map → mcp-CIHSR4DD.js.map} +1 -1
  128. package/dist/{migrate-55S4XODX.js → migrate-TQPEZYS5.js} +148 -74
  129. package/dist/migrate-TQPEZYS5.js.map +1 -0
  130. package/dist/notifications-TAELTPDW.js +154 -0
  131. package/dist/notifications-TAELTPDW.js.map +1 -0
  132. package/dist/open-D3GWGDSQ.js +20 -0
  133. package/dist/{pack-VZIBS42E.js → pack-VUO4UBWL.js} +12 -22
  134. package/dist/{pack-VZIBS42E.js.map → pack-VUO4UBWL.js.map} +1 -1
  135. package/dist/plugin-L3466DHK.js +47 -0
  136. package/dist/plugin-from-project-U5UGKTJH.js +15 -0
  137. package/dist/plugin-from-project-U5UGKTJH.js.map +1 -0
  138. package/dist/{policy-P3HGLEZS.js → policy-Z5TL4N3V.js} +11 -15
  139. package/dist/{policy-P3HGLEZS.js.map → policy-Z5TL4N3V.js.map} +1 -1
  140. package/dist/{profile-STS3CZUK.js → profile-QFI7SL3S.js} +167 -143
  141. package/dist/profile-QFI7SL3S.js.map +1 -0
  142. package/dist/{project-R4DGM3ZG.js → project-3KR3EPYR.js} +506 -94
  143. package/dist/project-3KR3EPYR.js.map +1 -0
  144. package/dist/{resource-GJVEDXVZ.js → resource-45BPRQ7V.js} +66 -63
  145. package/dist/resource-45BPRQ7V.js.map +1 -0
  146. package/dist/status-refresh-worker.js +1155 -0
  147. package/dist/status-refresh-worker.js.map +1 -0
  148. package/dist/{version-FUHV4O6U.js → version-QUJZGTZ5.js} +3 -3
  149. package/dist/version-QUJZGTZ5.js.map +1 -0
  150. package/package.json +17 -11
  151. package/dist/apply-Q5SFF3FY.js +0 -67
  152. package/dist/chunk-24V5ZSIF.js +0 -658
  153. package/dist/chunk-24V5ZSIF.js.map +0 -1
  154. package/dist/chunk-2H7UOFLK.js +0 -11
  155. package/dist/chunk-3JOPDYQD.js +0 -730
  156. package/dist/chunk-3JOPDYQD.js.map +0 -1
  157. package/dist/chunk-555XE3NJ.js +0 -60
  158. package/dist/chunk-555XE3NJ.js.map +0 -1
  159. package/dist/chunk-64R32MG2.js.map +0 -1
  160. package/dist/chunk-6JMVGKMD.js.map +0 -1
  161. package/dist/chunk-6ZWKF3YZ.js +0 -7795
  162. package/dist/chunk-6ZWKF3YZ.js.map +0 -1
  163. package/dist/chunk-AFKCNFPP.js.map +0 -1
  164. package/dist/chunk-AUWWL6KX.js +0 -296
  165. package/dist/chunk-AUWWL6KX.js.map +0 -1
  166. package/dist/chunk-AVZOFMJX.js.map +0 -1
  167. package/dist/chunk-CZ4T75PP.js.map +0 -1
  168. package/dist/chunk-FUV7QYBS.js.map +0 -1
  169. package/dist/chunk-GWQVYGRD.js.map +0 -1
  170. package/dist/chunk-HENOKIBB.js +0 -346
  171. package/dist/chunk-HENOKIBB.js.map +0 -1
  172. package/dist/chunk-HWL67OCJ.js +0 -238
  173. package/dist/chunk-HWL67OCJ.js.map +0 -1
  174. package/dist/chunk-IKAGGJEO.js.map +0 -1
  175. package/dist/chunk-JJJJ2RAD.js.map +0 -1
  176. package/dist/chunk-JRFUTIEH.js +0 -426
  177. package/dist/chunk-JRFUTIEH.js.map +0 -1
  178. package/dist/chunk-KJIFZLHN.js +0 -11066
  179. package/dist/chunk-KJIFZLHN.js.map +0 -1
  180. package/dist/chunk-LDVXYN6F.js.map +0 -1
  181. package/dist/chunk-MHOTXMD2.js +0 -430
  182. package/dist/chunk-MHOTXMD2.js.map +0 -1
  183. package/dist/chunk-NAGAJ5UM.js +0 -145
  184. package/dist/chunk-NAGAJ5UM.js.map +0 -1
  185. package/dist/chunk-NEPUP33Q.js +0 -35
  186. package/dist/chunk-NEPUP33Q.js.map +0 -1
  187. package/dist/chunk-OPVIX7E4.js.map +0 -1
  188. package/dist/chunk-OQ4KBUN2.js.map +0 -1
  189. package/dist/chunk-OXVCYRZB.js +0 -491
  190. package/dist/chunk-OXVCYRZB.js.map +0 -1
  191. package/dist/chunk-PJQAMC6L.js +0 -183
  192. package/dist/chunk-PJQAMC6L.js.map +0 -1
  193. package/dist/chunk-PW5QXRBA.js +0 -1173
  194. package/dist/chunk-PW5QXRBA.js.map +0 -1
  195. package/dist/chunk-QNAIDM6W.js.map +0 -1
  196. package/dist/chunk-R4PTE774.js.map +0 -1
  197. package/dist/chunk-S2E4KSYW.js +0 -610
  198. package/dist/chunk-S2E4KSYW.js.map +0 -1
  199. package/dist/chunk-SNVAMWB7.js +0 -40
  200. package/dist/chunk-SNVAMWB7.js.map +0 -1
  201. package/dist/chunk-TQ2NA4Z4.js.map +0 -1
  202. package/dist/chunk-U472S6IB.js.map +0 -1
  203. package/dist/chunk-UEHDEADL.js.map +0 -1
  204. package/dist/chunk-UNRR4KH5.js.map +0 -1
  205. package/dist/chunk-VQVUJYYY.js.map +0 -1
  206. package/dist/chunk-XGTTOO4R.js +0 -84
  207. package/dist/chunk-XGTTOO4R.js.map +0 -1
  208. package/dist/chunk-XRXFJTAT.js.map +0 -1
  209. package/dist/chunk-Y2JGMICO.js.map +0 -1
  210. package/dist/chunk-YVJQ2QDG.js.map +0 -1
  211. package/dist/chunk-YX7MVSDA.js +0 -235
  212. package/dist/chunk-YX7MVSDA.js.map +0 -1
  213. package/dist/chunk-ZGRBIBO7.js +0 -681
  214. package/dist/chunk-ZGRBIBO7.js.map +0 -1
  215. package/dist/chunk-ZTBAMBAI.js +0 -6448
  216. package/dist/chunk-ZTBAMBAI.js.map +0 -1
  217. package/dist/chunk-ZVANUFPF.js +0 -1035
  218. package/dist/chunk-ZVANUFPF.js.map +0 -1
  219. package/dist/doctor-HH6CFBRQ.js.map +0 -1
  220. package/dist/environment-K7YMJJYN.js.map +0 -1
  221. package/dist/help-QR4VTJZU.js.map +0 -1
  222. package/dist/help-TLHNRJJ6.js.map +0 -1
  223. package/dist/init-AOKFPZHG.js.map +0 -1
  224. package/dist/marketplace-TUVLLPBG.js.map +0 -1
  225. package/dist/migrate-55S4XODX.js.map +0 -1
  226. package/dist/open-SLFQV45J.js +0 -32
  227. package/dist/plugin-WLEFFBRY.js +0 -64
  228. package/dist/plugin-from-project-UV2O364T.js +0 -16
  229. package/dist/profile-STS3CZUK.js.map +0 -1
  230. package/dist/project-R4DGM3ZG.js.map +0 -1
  231. package/dist/resource-GJVEDXVZ.js.map +0 -1
  232. /package/dist/{apply-Q5SFF3FY.js.map → apply-FTAIL3X3.js.map} +0 -0
  233. /package/dist/{chunk-IHW4PCDT.js.map → chunk-6FXJIKEG.js.map} +0 -0
  234. /package/dist/{chunk-IAZNF35S.js.map → chunk-CBSDMRMY.js.map} +0 -0
  235. /package/dist/{chunk-3EGM4IUI.js.map → chunk-EPXAOEBB.js.map} +0 -0
  236. /package/dist/{chunk-XCPWLGPB.js.map → chunk-K4UDZUJ2.js.map} +0 -0
  237. /package/dist/{chunk-FBYAIBHP.js.map → chunk-MHLAIGIM.js.map} +0 -0
  238. /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
  239. /package/dist/{chunk-BXSS2S4W.js.map → chunk-R27VZIF6.js.map} +0 -0
  240. /package/dist/{chunk-JQOKQKQT.js.map → chunk-S2D5PWAO.js.map} +0 -0
  241. /package/dist/{chunk-WXRPQICX.js.map → chunk-UK2IV2ZQ.js.map} +0 -0
  242. /package/dist/{open-SLFQV45J.js.map → live-read-cache-ESQQJBNS.js.map} +0 -0
  243. /package/dist/{plugin-WLEFFBRY.js.map → live-read-cache-WPUFHVMZ.js.map} +0 -0
  244. /package/dist/{plugin-from-project-UV2O364T.js.map → open-D3GWGDSQ.js.map} +0 -0
  245. /package/dist/{version-FUHV4O6U.js.map → plugin-L3466DHK.js.map} +0 -0
@@ -1,20 +1,4 @@
1
1
  import {
2
- isPluginAttachmentOnlyType,
3
- renderResourceShow,
4
- resolveResourceListType
5
- } from "./chunk-64R32MG2.js";
6
- import {
7
- filterPluginEditRowsBySearch,
8
- formatResourceSelectionLabel,
9
- listNavigablePluginEditRows,
10
- renderFlatPluginEditViewport,
11
- renderGroupedPluginEditViewport,
12
- sortResourcesByUpdatedAt,
13
- toResourceListRows
14
- } from "./chunk-OQ4KBUN2.js";
15
- import {
16
- PluginAmbiguityError,
17
- PluginResolveError,
18
2
  configurePluginListInteractiveDeps,
19
3
  createPluginFromSource,
20
4
  deleteCatalogPlugin,
@@ -23,26 +7,16 @@ import {
23
7
  handlePluginCatalogRegisterCommand,
24
8
  handlePluginCatalogRegisteredCommand,
25
9
  handlePluginCatalogUnregisterCommand,
10
+ handlePluginHideOptions,
26
11
  handlePluginInstallCommand,
27
12
  handlePluginListCommand,
28
13
  handlePluginPublishCommand,
29
14
  handlePluginPublishPlanCommand,
30
15
  handlePluginShowCommand,
31
- isPluginUrl,
32
16
  resolveApplyPluginSource,
33
17
  resolveCatalogSearchProjectRoot,
34
18
  runPluginCreateFromSourceWizard
35
- } from "./chunk-CZ4T75PP.js";
36
- import {
37
- createLocalPluginPickAdapter,
38
- resolvePluginMutationTarget
39
- } from "./chunk-XRXFJTAT.js";
40
- import {
41
- loadVerifiedPackageFiles
42
- } from "./chunk-PJQAMC6L.js";
43
- import {
44
- openPathInSystemEditor
45
- } from "./chunk-UEHDEADL.js";
19
+ } from "./chunk-5HACBPK2.js";
46
20
  import {
47
21
  importProjectConfigEnvironments,
48
22
  printApplyDryRun,
@@ -53,188 +27,190 @@ import {
53
27
  resolveExpectedPluginName,
54
28
  resolveProjectProfilePluginName,
55
29
  resolveUserPath
56
- } from "./chunk-AVZOFMJX.js";
30
+ } from "./chunk-D7R577XZ.js";
57
31
  import {
58
- validatePluginDependencyGraph
59
- } from "./chunk-FBYAIBHP.js";
32
+ isPluginAttachmentOnlyType,
33
+ marketplaceIsKnown,
34
+ renderResourceShow,
35
+ resolveResourceListType
36
+ } from "./chunk-GZU4LVFF.js";
60
37
  import {
61
- toPluginChoices
62
- } from "./chunk-XCPWLGPB.js";
38
+ createLocalPluginPickAdapter,
39
+ resolvePluginMutationTarget
40
+ } from "./chunk-MQCAPCAF.js";
41
+ import {
42
+ resolveSkillPackageCheckout
43
+ } from "./chunk-42E2MPES.js";
44
+ import {
45
+ readDeclaredLicense
46
+ } from "./chunk-CHQGE2HF.js";
47
+ import {
48
+ diagnoseParsedPackage,
49
+ formatResourceCounts,
50
+ formatSkippedEntry
51
+ } from "./chunk-HV3ENT2F.js";
52
+ import {
53
+ filterPluginEditRowsBySearch,
54
+ formatResourceSelectionLabel,
55
+ listNavigablePluginEditRows,
56
+ renderFlatPluginEditViewport,
57
+ renderGroupedPluginEditViewport,
58
+ sortResourcesByUpdatedAt,
59
+ toResourceListRows
60
+ } from "./chunk-L6BJCRBU.js";
61
+ import {
62
+ openPathInSystemEditor
63
+ } from "./chunk-MQCH3YZ5.js";
64
+ import {
65
+ validatePluginDependencyGraph
66
+ } from "./chunk-MHLAIGIM.js";
63
67
  import {
64
68
  createTableBrowserPrompt
65
- } from "./chunk-3EGM4IUI.js";
69
+ } from "./chunk-EPXAOEBB.js";
70
+ import {
71
+ toPluginChoices
72
+ } from "./chunk-K4UDZUJ2.js";
66
73
  import {
67
74
  matchesListSearchQuery,
68
75
  parseListSearchQuery
69
76
  } from "./chunk-KRI4R7EM.js";
70
- import {
71
- resolveSkillPackageCheckout
72
- } from "./chunk-U472S6IB.js";
73
77
  import {
74
78
  parseCommaSeparatedList
75
79
  } from "./chunk-37E5M4JX.js";
76
80
  import {
77
81
  buildHelpLine
78
82
  } from "./chunk-3FIWOI3H.js";
79
- import {
80
- readDeclaredLicense
81
- } from "./chunk-CHQGE2HF.js";
82
83
  import {
83
84
  renderCliError
84
- } from "./chunk-YVJQ2QDG.js";
85
- import {
86
- PinnedPluginInstallConsentError,
87
- captureManagedSnapshotState,
88
- collectPluginPinsForPrepare,
89
- ensureClaudeMarketplacesFromConfig,
90
- ensureCursorMarketplaces,
91
- ensureMissingCatalogDependencies,
92
- gateDeployFiles,
93
- generateFiles,
94
- getActiveProfileName,
95
- getGitOrigin,
96
- installPluginFromCatalog,
97
- installPluginPinAsync,
98
- materializeFiles,
99
- normalizeGitUrl,
100
- persistWrittenMaterializations,
101
- preparePluginPinsForApply,
102
- printUnicodeGateWarnings,
103
- projectNameFromUrl,
104
- removeStaleProjectDeployedFiles,
105
- resolveDefaultPluginInstallScope,
106
- resolveEnvironmentCascadeForApply,
107
- resolvePluginInstallScope,
108
- setPluginEnvironmentCommand,
109
- skillPlacementsFromPaths,
110
- syncPluginPinsForApply,
111
- tagProfileCommand,
112
- unsetPluginEnvironmentCommand
113
- } from "./chunk-6ZWKF3YZ.js";
114
- import {
115
- isPromptCancellationError,
116
- promptForChoice,
117
- promptForConfirmation,
118
- promptForSearchableChoice,
119
- promptForValue,
120
- shouldUseBrowsePicker,
121
- shouldUseWizard
122
- } from "./chunk-NAGAJ5UM.js";
85
+ } from "./chunk-CR2TYMKC.js";
123
86
  import {
124
87
  initializeSchema
125
- } from "./chunk-QNAIDM6W.js";
126
- import {
127
- PROFILE_PLUGIN_TAG,
128
- isProfilePlugin
129
- } from "./chunk-NEPUP33Q.js";
88
+ } from "./chunk-RQLVXJH2.js";
130
89
  import {
131
- createSnapshot
132
- } from "./chunk-555XE3NJ.js";
133
- import {
134
- createPluginFromProject
135
- } from "./chunk-ENHDEB7Z.js";
90
+ configureCommandGroup
91
+ } from "./chunk-T4EKNX2Q.js";
136
92
  import {
137
- findProjectConfig,
138
- getProfileEntry
139
- } from "./chunk-HENOKIBB.js";
93
+ handlePluginAutoUpdateCommand,
94
+ maybePromptKeepUpToDate
95
+ } from "./chunk-XNS4I3W6.js";
140
96
  import {
141
97
  formatPluginLabel
142
98
  } from "./chunk-I6XFZLTJ.js";
143
99
  import {
144
- APM_MANIFEST_FILENAME,
145
- TargetFlagError,
146
- parseApmYamlDocument,
147
- readPackageRuntimeApmDependencies,
148
- resolveCompileTargets
149
- } from "./chunk-S2E4KSYW.js";
150
- import {
151
- CriticalUnicodeError
152
- } from "./chunk-JRFUTIEH.js";
153
- import {
154
- applyConfiguredPluginToProject,
155
- assertSupportedHarnessTargets,
156
- collectApplyPreferenceHarnesses,
157
- getProjectByOrigin,
158
- getProjectHarnessConfig,
159
- uniqueHarnessTargets,
160
- upsertProject
161
- } from "./chunk-AUWWL6KX.js";
162
- import {
163
- detectPlatforms,
164
- persistPluginSourceScanResults
165
- } from "./chunk-ZTBAMBAI.js";
100
+ createPluginFromProject
101
+ } from "./chunk-MHMFF6A5.js";
166
102
  import {
167
103
  applyExecutableTrustGate,
168
104
  formatApproveRemedy,
169
105
  overlappingDeployedHashes
170
- } from "./chunk-YRGM7RAD.js";
106
+ } from "./chunk-QGTDQNVV.js";
171
107
  import {
172
- PolicyError,
173
- assertPolicyAllowsApply,
174
- collectSkillMdFiles,
175
- evaluateApplyPolicy
176
- } from "./chunk-PW5QXRBA.js";
108
+ parseOutputFormat,
109
+ printJson
110
+ } from "./chunk-R4NV3Q7G.js";
177
111
  import {
178
- LockIntegrityError,
179
- lockIsUsable,
180
- lockedVersionsFrom,
181
- lockfileFromResolution,
182
- readLockfile,
183
- writeLockfile
184
- } from "./chunk-MHOTXMD2.js";
112
+ ON_CONFLICT_APPLY_HELP,
113
+ ON_CONFLICT_PLUGIN_IMPORT_HELP,
114
+ collectRepeatedOption,
115
+ fail,
116
+ failCaught,
117
+ formatCommand,
118
+ parseOnConflict,
119
+ toPluginImportOnConflict
120
+ } from "./chunk-WGVU3LA5.js";
185
121
  import {
122
+ APM_MANIFEST_FILENAME,
186
123
  ApmGitResolveError,
187
- assertCheckoutPathSafe,
188
- canonicalApmRepoUrl,
189
- isApmVirtualFilePath,
190
- isFilesystemApmDependency,
191
- resolveAndFetchApmGitDependency
192
- } from "./chunk-ZGRBIBO7.js";
193
- import {
194
124
  BundleSymlinkError,
195
125
  CatalogDependencyVersionError,
126
+ CriticalUnicodeError,
127
+ InvalidGitDependencyConstraintError,
128
+ LocalPluginSelectorError,
129
+ LockIntegrityError,
196
130
  MATERIAL_RESOURCE_TYPES,
197
131
  PLUGIN_ATTACHMENT_TYPES,
132
+ PROFILE_PLUGIN_TAG,
133
+ PinnedPluginInstallConsentError,
134
+ PluginAmbiguityError,
198
135
  PluginAttachmentHintError,
136
+ PluginForkError,
199
137
  PluginProvenanceError,
138
+ PluginResolveError,
200
139
  PluginVersionError,
140
+ PolicyError,
201
141
  RESOURCE_TYPES,
202
142
  SingletonConflictError,
143
+ TargetFlagError,
203
144
  UnsatisfiableConstraintError,
204
145
  addDependency,
205
146
  addPluginAttachment,
206
147
  addResourceToPlugin,
207
148
  applyCheckedPluginOrigin,
149
+ applyConfiguredPluginToProject,
208
150
  assertAuthored,
151
+ assertCheckoutPathSafe,
209
152
  assertContainedPath,
210
153
  assertPluginsCleanForShare,
154
+ assertPolicyAllowsApply,
155
+ assertSupportedHarnessTargets,
211
156
  attachPluginPinToPlugin,
212
157
  attachScannedOriginResources,
213
158
  buildApPackageFiles,
159
+ canonicalApmRepoUrl,
160
+ captureManagedSnapshotState,
214
161
  clearPluginVersionOverride,
162
+ collectApplyPreferenceHarnesses,
163
+ collectPluginPinsForPrepare,
164
+ collectSkillMdFiles,
215
165
  createPlugin,
166
+ createSnapshot,
216
167
  cutPluginVersion,
217
168
  deletePlugin,
218
169
  dependenciesFromResources,
219
170
  describeConflictSide,
171
+ detectPlatforms,
172
+ displayConstraint,
173
+ ensureClaudeMarketplacesFromConfig,
174
+ ensureCursorMarketplaces,
175
+ ensureMissingCatalogDependencies,
220
176
  ensurePluginClaudeMarketplace,
221
177
  ensurePluginResource,
178
+ evaluateApplyPolicy,
222
179
  fetchCatalogPlugin,
223
- findPluginResourceByPin,
180
+ findLocalPluginBySelector,
181
+ findProjectConfig,
182
+ forkPlugin,
224
183
  formatOriginLocator,
225
184
  formatPluginRollbackConfirmMessage,
226
185
  formatPluginVersionLabel,
186
+ gateDeployFiles,
187
+ generateFiles,
188
+ getActiveProfileName,
189
+ getGitOrigin,
227
190
  getPlugin,
228
191
  getPluginById,
229
192
  getPluginByName,
230
193
  getPluginOrigin,
231
194
  getPluginResources,
195
+ getProfileEntry,
196
+ getProjectByOrigin,
197
+ getProjectHarnessConfig,
198
+ gitFetchRefForPin,
232
199
  gitOriginCacheDir,
233
200
  hashResourceBody,
234
201
  importApPackageFiles,
235
- ingestHostPluginTreeIntoCache,
202
+ importPluginFromGitHubRef,
203
+ installPluginFromCatalog,
204
+ installPluginPinAsync,
236
205
  isApEnvelopePath,
206
+ isApmVirtualFilePath,
207
+ isCatalogUpstreamRef,
208
+ isFilesystemApmDependency,
209
+ isGitHubPluginRef,
210
+ isPendingUpdate,
237
211
  isPluginInstallRoot,
212
+ isPluginUrl,
213
+ isProfilePlugin,
238
214
  listAttachedPluginPins,
239
215
  listAttachedPluginRefs,
240
216
  listContainedRegularFiles,
@@ -244,166 +220,183 @@ import {
244
220
  listPluginVersionHistory,
245
221
  listPlugins,
246
222
  listResources,
223
+ loadSpecPackagePath,
224
+ loadVerifiedPackageFiles,
225
+ lockIsUsable,
226
+ lockedVersionsFrom,
227
+ lockfileFromResolution,
228
+ marketplaceListsPlugin,
229
+ materializeFiles,
247
230
  mergePluginsById,
231
+ normalizeGitUrl,
248
232
  normalizeResourceInput,
233
+ notifySafely,
249
234
  originApplyFailureRow,
250
235
  originFailRow,
251
236
  originSkipRow,
252
237
  overrideWinnerValue,
253
238
  parseApPackageFiles,
239
+ parseApmYamlDocument,
254
240
  parseDependencyRef,
241
+ parseGitDependencyConstraint,
255
242
  parsePluginRef,
256
243
  parseVersionConstraint,
257
- pluginDescriptionFromManifest,
244
+ persistPluginSourceScanResults,
245
+ persistWrittenMaterializations,
246
+ preparePluginPinsForApply,
247
+ printUnicodeGateWarnings,
248
+ projectNameFromUrl,
249
+ readContainedPackageFiles,
250
+ readLockfile,
251
+ readPackageRuntimeApmDependencies,
252
+ readUpstreamChecks,
253
+ recordedPluginInstallRoot,
258
254
  recoverOriginLocator,
259
255
  removeDependency,
260
256
  removePluginAttachment,
261
257
  removeResourceFromPlugin,
258
+ removeStaleProjectDeployedFiles,
259
+ resolveAndFetchApmGitDependency,
262
260
  resolveClaudeEnabledPluginRef,
261
+ resolveCompileTargets,
263
262
  resolveComposition,
264
- resolveHomeRoot,
265
- resolveInstallRoot,
263
+ resolveDefaultPluginInstallScope,
264
+ resolveEnvironmentCascadeForApply,
266
265
  resolveMarketplacePluginDirectory,
266
+ resolvePluginInstallScope,
267
+ resolvePluginPackageRoot,
267
268
  resolvePluginSelector,
269
+ resolveUpstreamParent,
268
270
  rollbackPluginVersion,
269
271
  scanPluginSource,
270
272
  scanPluginSourceSync,
271
273
  selectOriginUpdateTarget,
272
- semverSafePluginVersion,
274
+ setPluginEnvironmentCommand,
273
275
  setPluginOrigin,
274
276
  setPluginResourceOrder,
275
277
  setPluginResourceOverride,
276
278
  setPluginTags,
277
279
  setPluginVersionOverride,
280
+ skillPlacementsFromPaths,
278
281
  slugifyApName,
279
282
  stampPluginOrigin,
280
283
  substituteResourcesForApply,
281
284
  summarizeOriginUpdate,
282
285
  syncClaudeMarketplacePluginsAfterAdd,
286
+ syncPluginPinsForApply,
287
+ tagProfileCommand,
283
288
  touchPluginUpdatedAt,
284
- updatePluginDescription,
289
+ uniqueHarnessTargets,
290
+ unsetPluginEnvironmentCommand,
291
+ upsertProject,
285
292
  upsertResource,
293
+ upstreamRange,
294
+ upstreamRefBase,
286
295
  validateApManifest,
287
296
  validatePluginAttachmentType,
288
297
  validatePublicOrgHasPlugins,
289
298
  validatePublicPluginExists,
290
299
  withDefaultedApSchema,
291
300
  writeApEnvelope,
292
- writeApPackageFiles
293
- } from "./chunk-KJIFZLHN.js";
301
+ writeApPackageFiles,
302
+ writeLockfile
303
+ } from "./chunk-BUA7WFI4.js";
294
304
  import {
295
- listMarketplaces,
305
+ catalogPluginDisplayVersion,
306
+ catalogPluginVersionLabel,
307
+ findKnownMarketplace,
308
+ isPromptCancellationError,
296
309
  marketplaceCacheDir,
310
+ parseFrontmatter,
311
+ promptForChoice,
312
+ promptForConfirmation,
313
+ promptForSearchableChoice,
314
+ promptForValue,
297
315
  refreshGitSource,
298
316
  refreshMarketplaceCatalog,
299
- searchCatalogPlugins
300
- } from "./chunk-ZVANUFPF.js";
301
- import {
302
- trackPluginApplied,
303
- trackPluginInstalled
304
- } from "./chunk-OXVCYRZB.js";
305
- import {
306
- configureCommandGroup
307
- } from "./chunk-JJJJ2RAD.js";
308
- import {
309
- parseOutputFormat,
310
- printJson
311
- } from "./chunk-TQ2NA4Z4.js";
312
- import {
313
- CliUsageError,
314
- ON_CONFLICT_APPLY_HELP,
315
- ON_CONFLICT_PLUGIN_IMPORT_HELP,
316
- collectRepeatedOption,
317
- conflictingOptions,
318
- fail,
319
- failCaught,
320
- formatCommand,
321
- missingRequiredArg,
322
- parseOnConflict,
323
- toPluginImportOnConflict
324
- } from "./chunk-Y2JGMICO.js";
325
- import {
326
- createProgress,
327
- formatCount,
328
- theme,
329
- ui
330
- } from "./chunk-LDVXYN6F.js";
317
+ resolveHomeRoot,
318
+ searchCatalogPlugins,
319
+ shouldUseBrowsePicker,
320
+ shouldUseWizard
321
+ } from "./chunk-UC27MQ3T.js";
331
322
  import {
332
323
  DEFAULT_CATALOG_ORG_SLUG,
324
+ cloudFetch,
333
325
  connectCatalogOrg,
334
326
  connectCatalogPlugin,
335
327
  disconnectCatalogOrg,
336
328
  disconnectCatalogPlugin,
329
+ ensureCloudAccountAccess,
337
330
  formatCatalogScopeLabel,
338
331
  loadCatalogSettings,
339
332
  loadRegisteredCatalogs,
340
333
  resolveCatalogScope,
341
- resolveRemotePluginSelector
342
- } from "./chunk-IKAGGJEO.js";
334
+ resolveRemotePluginSelector,
335
+ trackPluginApplied,
336
+ trackPluginInstalled
337
+ } from "./chunk-V4UNYSZO.js";
343
338
  import {
344
339
  CLI_ERRORS,
345
340
  CLI_HINTS,
341
+ CliUsageError,
342
+ applyCancelledMessage,
343
+ conflictingOptions,
344
+ createProgress,
346
345
  fetchWithTimeout,
347
346
  formatCatalogRequestError,
347
+ formatCount,
348
348
  getDb,
349
- getHarnesstapDir
350
- } from "./chunk-24V5ZSIF.js";
349
+ getHarnesstapDir,
350
+ missingRequiredArg,
351
+ theme,
352
+ ui
353
+ } from "./chunk-OHZNDV4A.js";
351
354
 
352
355
  // src/cli/commands/plugin.ts
353
356
  import { Option as Option2 } from "commander";
354
- import { readFileSync as readFileSync2 } from "fs";
357
+ import { readFileSync as readFileSync4 } from "fs";
355
358
 
356
359
  // src/cli/handlers/plugin-fork.ts
357
360
  function handlePluginForkCommand(selector, opts = {}) {
358
361
  const db = getDb();
359
362
  initializeSchema(db);
360
363
  const format = parseOutputFormat(opts.format);
361
- const source = resolvePluginSelector(selector);
362
- if (!source) {
363
- process.exitCode = 1;
364
- ui.danger(`Plugin not found: ${selector}`);
365
- return;
366
- }
367
- if (getPluginOrigin(source.id) === "authored") {
368
- process.exitCode = 1;
369
- ui.danger(`${source.name} is already authored; there is nothing to fork.`, {
370
- hints: [`ht plugin edit ${source.name}`]
371
- });
372
- return;
373
- }
374
- const name = opts.as ?? `${source.name}-fork`;
375
- if (getPluginByName(name)) {
364
+ let result;
365
+ try {
366
+ result = forkPlugin(selector, opts.as);
367
+ } catch (error) {
376
368
  process.exitCode = 1;
377
- ui.danger(`Plugin ${name} already exists.`, {
378
- hints: [`ht plugin fork ${source.name} --as <name>`]
379
- });
369
+ if (error instanceof PluginForkError) {
370
+ const sourceName = error.sourceName ?? selector;
371
+ if (error.code === "already_authored") {
372
+ ui.danger(error.message, { hints: [formatCommand(["plugin", "edit", sourceName])] });
373
+ return;
374
+ }
375
+ if (error.code === "plugin_exists") {
376
+ ui.danger(error.message, {
377
+ hints: [`${formatCommand(["plugin", "fork", sourceName])} --as <name>`]
378
+ });
379
+ return;
380
+ }
381
+ }
382
+ ui.danger(error instanceof Error ? error.message : String(error));
380
383
  return;
381
384
  }
382
- const fork = createPlugin({
383
- name,
384
- version: source.version,
385
- description: source.description || `Fork of ${source.name}@${source.version}`,
386
- tags: source.tags,
387
- ...source.claude ? { claude: source.claude } : {},
388
- ...source.needs ? { needs: source.needs } : {},
389
- origin: "authored"
390
- });
391
- for (const resource of getPluginResources(source.id)) {
392
- addResourceToPlugin(fork.id, resource.id);
393
- }
385
+ const { plugin, source, forked_from, upstream } = result;
394
386
  if (format === "json") {
395
387
  printJson({
396
- name: fork.name,
397
- version: fork.version,
388
+ name: plugin.name,
389
+ version: plugin.version,
398
390
  origin: "authored",
399
- forked_from: `${source.name}@${source.version}`
391
+ forked_from,
392
+ upstream
400
393
  });
401
394
  return;
402
395
  }
403
396
  ui.success(
404
- `Forked ${source.name}@${source.version} into ${ui.theme.accent(fork.name)}`
397
+ `Forked ${source.name}@${source.version} into ${ui.theme.accent(plugin.name)}`
405
398
  );
406
- ui.hint(`ht plugin edit ${fork.name}`);
399
+ ui.hint(formatCommand(["plugin", "edit", plugin.name]));
407
400
  }
408
401
 
409
402
  // src/services/plugin-origin-update.ts
@@ -436,6 +429,8 @@ async function scanOriginTree(sourcePath, pluginName) {
436
429
  const manifestCandidates = [
437
430
  join(sourcePath, ".claude-plugin", "marketplace.json"),
438
431
  join(sourcePath, ".cursor-plugin", "marketplace.json"),
432
+ join(sourcePath, ".github", "plugin", "marketplace.json"),
433
+ join(sourcePath, ".agents", "plugins", "marketplace.json"),
439
434
  join(sourcePath, "marketplace.json")
440
435
  ];
441
436
  for (const manifestPath of manifestCandidates) {
@@ -668,11 +663,15 @@ async function checkPluginOrigins(opts) {
668
663
  marketplaceFetches.set(name, pending);
669
664
  return pending;
670
665
  };
671
- const fetchGit = (url) => {
672
- const existing = gitFetches.get(url);
666
+ const fetchGit = (url, pinnedRef) => {
667
+ const key = pinnedRef ? `${url}#${pinnedRef}` : url;
668
+ const existing = gitFetches.get(key);
673
669
  if (existing) return existing;
674
670
  const targetDir = gitOriginCacheDir(harnesstapDir, url);
675
- const pending = Promise.resolve().then(() => refreshGit({ url, targetDir })).catch((error) => ({
671
+ const pending = Promise.resolve().then(async () => {
672
+ const { fetchRef } = await gitFetchRefForPin(url, pinnedRef, opts?.deps?.resolveSemverTag);
673
+ return refreshGit({ url, targetDir, ...fetchRef ? { ref: fetchRef } : {} });
674
+ }).catch((error) => ({
676
675
  ok: false,
677
676
  message: thrownErrorMessage(error)
678
677
  }));
@@ -696,7 +695,7 @@ async function checkPluginOrigins(opts) {
696
695
  break;
697
696
  }
698
697
  case "git": {
699
- const fetched = await fetchGit(locator.url);
698
+ const fetched = await fetchGit(locator.url, locator.ref);
700
699
  targetRow = await compareGitSha(
701
700
  target,
702
701
  locatorStr,
@@ -767,55 +766,480 @@ async function rowForCheck(check, force, deps) {
767
766
  if (!recoverOriginLocator(plugin) && !check.origin_locator) {
768
767
  return originSkipRow(plugin, check.message ?? MISSING_LOCATOR_MESSAGE);
769
768
  }
770
- switch (check.status) {
771
- case "current": {
772
- if (!force) {
773
- return originSkipRow(plugin);
774
- }
775
- try {
776
- return await applyCheckedPluginOrigin(plugin, check, deps);
777
- } catch (error) {
778
- return originApplyFailureRow(plugin, error);
769
+ switch (check.status) {
770
+ case "current": {
771
+ if (!force) {
772
+ return originSkipRow(plugin);
773
+ }
774
+ try {
775
+ return await applyCheckedPluginOrigin(plugin, check, deps);
776
+ } catch (error) {
777
+ return originApplyFailureRow(plugin, error);
778
+ }
779
+ }
780
+ case "outdated": {
781
+ try {
782
+ return await applyCheckedPluginOrigin(plugin, check, deps);
783
+ } catch (error) {
784
+ return originApplyFailureRow(plugin, error);
785
+ }
786
+ }
787
+ case "error":
788
+ return originFailRow(plugin, check.message);
789
+ case "unknown":
790
+ return originSkipRow(plugin, check.message ?? MISSING_LOCATOR_MESSAGE);
791
+ default: {
792
+ const _exhaustive = check.status;
793
+ throw new Error(`Unhandled check status: ${_exhaustive}`);
794
+ }
795
+ }
796
+ }
797
+ async function updatePluginOrigins(opts) {
798
+ if (!opts.name && !opts.all) {
799
+ throw new Error("pass a name or --all");
800
+ }
801
+ const check = await checkPluginOrigins({
802
+ name: opts.name,
803
+ refresh: true,
804
+ deps: opts.deps
805
+ });
806
+ if (opts.name && check.results.length === 0) {
807
+ const named = resolveNamedOriginPlugin(opts.name);
808
+ if (named?.frozen_at) {
809
+ const skipped = originSkipRow(named, FROZEN_UPDATE_MESSAGE);
810
+ return { results: [skipped], summary: summarizeOriginUpdate([skipped]) };
811
+ }
812
+ }
813
+ const results = [];
814
+ for (const row of check.results) {
815
+ results.push(await rowForCheck(row, Boolean(opts.force), opts.deps));
816
+ }
817
+ return { results, summary: summarizeOriginUpdate(results) };
818
+ }
819
+
820
+ // src/services/upstream-update-lock.ts
821
+ import { closeSync, mkdirSync, openSync, readFileSync, unlinkSync, writeSync } from "fs";
822
+ import { join as join2 } from "path";
823
+ var UPSTREAM_UPDATE_LOCK_FILE = "upstream-update.lock";
824
+ var UpstreamUpdateLockBusyError = class extends Error {
825
+ lockPath;
826
+ constructor(lockPath) {
827
+ super(`Another plugin update is in progress (${lockPath}). Try again when it finishes.`);
828
+ this.name = "UpstreamUpdateLockBusyError";
829
+ this.lockPath = lockPath;
830
+ }
831
+ };
832
+ function upstreamUpdateLockPath() {
833
+ return join2(getHarnesstapDir(), UPSTREAM_UPDATE_LOCK_FILE);
834
+ }
835
+ var depth = 0;
836
+ var heldFd;
837
+ function pidAlive(pid) {
838
+ try {
839
+ process.kill(pid, 0);
840
+ return true;
841
+ } catch (error) {
842
+ return error.code === "EPERM";
843
+ }
844
+ }
845
+ function clearIfStale(lockPath) {
846
+ let pid;
847
+ try {
848
+ pid = Number.parseInt(readFileSync(lockPath, "utf8").trim(), 10);
849
+ } catch {
850
+ return false;
851
+ }
852
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid || pidAlive(pid)) return false;
853
+ try {
854
+ unlinkSync(lockPath);
855
+ return true;
856
+ } catch {
857
+ return false;
858
+ }
859
+ }
860
+ function tryAcquire(lockPath) {
861
+ try {
862
+ heldFd = openSync(lockPath, "wx");
863
+ writeSync(heldFd, `${process.pid}
864
+ `);
865
+ return true;
866
+ } catch (error) {
867
+ if (error.code !== "EEXIST") throw error;
868
+ return clearIfStale(lockPath) ? tryAcquire(lockPath) : false;
869
+ }
870
+ }
871
+ function release(lockPath) {
872
+ depth -= 1;
873
+ if (depth > 0) return;
874
+ const fd = heldFd;
875
+ heldFd = void 0;
876
+ if (fd === void 0) return;
877
+ try {
878
+ closeSync(fd);
879
+ } finally {
880
+ try {
881
+ unlinkSync(lockPath);
882
+ } catch {
883
+ }
884
+ }
885
+ }
886
+ async function withUpstreamUpdateLock(fn, opts) {
887
+ const lockPath = upstreamUpdateLockPath();
888
+ if (depth > 0) {
889
+ depth += 1;
890
+ try {
891
+ return await fn();
892
+ } finally {
893
+ release(lockPath);
894
+ }
895
+ }
896
+ mkdirSync(getHarnesstapDir(), { recursive: true });
897
+ const waitMs = opts?.waitMs ?? 0;
898
+ const pollMs = opts?.pollMs ?? 250;
899
+ const deadline = Date.now() + waitMs;
900
+ let announced = false;
901
+ while (!tryAcquire(lockPath)) {
902
+ if (Date.now() >= deadline) throw new UpstreamUpdateLockBusyError(lockPath);
903
+ if (!announced) {
904
+ announced = true;
905
+ opts?.onWait?.();
906
+ }
907
+ await new Promise((resolve5) => setTimeout(resolve5, pollMs));
908
+ }
909
+ depth = 1;
910
+ try {
911
+ return await fn();
912
+ } finally {
913
+ release(lockPath);
914
+ }
915
+ }
916
+
917
+ // src/services/upstream-check.ts
918
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
919
+ import { dirname, join as join3 } from "path";
920
+ import semver from "semver";
921
+ var UPDATES_SINCE_BATCH = 100;
922
+ function catalogBaseOf(plugin) {
923
+ const locator = plugin.origin_locator ?? "";
924
+ const base = upstreamRefBase(locator);
925
+ return base.split("/").length === 3 ? base : void 0;
926
+ }
927
+ function listUpstreamTargets() {
928
+ const byKey = /* @__PURE__ */ new Map();
929
+ const put = (target) => {
930
+ const key = `${target.plugin_name}\0${target.kind === "catalog" ? upstreamRefBase(target.ref) : target.ref}`;
931
+ const existing = byKey.get(key);
932
+ if (!existing || semver.valid(target.local_version) && semver.valid(existing.local_version) && semver.gt(target.local_version, existing.local_version)) {
933
+ byKey.set(key, target);
934
+ }
935
+ };
936
+ for (const plugin of listPlugins()) {
937
+ if (plugin.frozen_at) continue;
938
+ if (plugin.upstream) {
939
+ const parent = plugin.upstream.kind === "extends" ? resolveUpstreamParent(plugin) : void 0;
940
+ put({
941
+ plugin_name: plugin.name,
942
+ ref: plugin.upstream.ref,
943
+ local_version: parent?.version ?? plugin.upstream.version_at_link,
944
+ kind: plugin.upstream.kind
945
+ });
946
+ continue;
947
+ }
948
+ if (plugin.origin === "catalog") {
949
+ const base = catalogBaseOf(plugin);
950
+ if (!base || !semver.valid(plugin.version)) continue;
951
+ put({
952
+ plugin_name: plugin.name,
953
+ ref: `${base}@${upstreamRange(plugin.version)}`,
954
+ local_version: plugin.version,
955
+ kind: "catalog"
956
+ });
957
+ }
958
+ }
959
+ return [...byKey.values()].sort(
960
+ (a, b) => a.plugin_name.localeCompare(b.plugin_name) || a.ref.localeCompare(b.ref)
961
+ );
962
+ }
963
+ function upstreamRefRange(ref) {
964
+ const at = ref.lastIndexOf("@");
965
+ const range = at > 0 ? ref.slice(at + 1) : "*";
966
+ return semver.validRange(range) ? range : "*";
967
+ }
968
+ function pickLatest(versions, range) {
969
+ const valid = versions.filter((version) => semver.valid(version));
970
+ const inRange = semver.maxSatisfying(valid, range) ?? "";
971
+ const floor = semver.minVersion(range)?.version;
972
+ const above = valid.filter(
973
+ (version) => !semver.satisfies(version, range) && (!floor || semver.gt(version, floor))
974
+ );
975
+ const major = above.length > 0 ? semver.rsort([...above])[0] ?? "" : "";
976
+ return { latest_in_range: inRange, latest_major: major };
977
+ }
978
+ function classifyUpstream(localVersion, latest) {
979
+ if (!latest.ok) {
980
+ return { status: latest.status, latest_in_range: "", latest_major: "", message: latest.message };
981
+ }
982
+ const { latest_in_range, latest_major } = latest;
983
+ const newer = (candidate) => Boolean(candidate) && (!semver.valid(localVersion) || semver.valid(candidate) !== null && semver.gt(candidate, localVersion));
984
+ if (newer(latest_in_range)) return { status: "update", latest_in_range, latest_major, message: "" };
985
+ if (newer(latest_major)) return { status: "major", latest_in_range, latest_major, message: "" };
986
+ return { status: "current", latest_in_range, latest_major, message: "" };
987
+ }
988
+ function localLatest(ref) {
989
+ const name = upstreamRefBase(ref);
990
+ const versions = listPlugins().filter((plugin) => plugin.name === name).map((plugin) => plugin.version);
991
+ if (versions.length === 0) {
992
+ return { ok: false, status: "unpublished", message: `${name} is not in the Library.` };
993
+ }
994
+ return { ok: true, ...pickLatest(versions, upstreamRefRange(ref)) };
995
+ }
996
+ var UPDATES_SINCE_MISSING = /* @__PURE__ */ new Set([404, 405, 501]);
997
+ function upstreamQueryKey(item) {
998
+ return `${item.base}@${item.range}`;
999
+ }
1000
+ var UPDATES_SINCE_CACHE_FILE = "updates-since.json";
1001
+ var UPDATES_SINCE_CACHE_KEEP = 20;
1002
+ function updatesSinceCachePath() {
1003
+ return join3(getHarnesstapDir(), "cache", UPDATES_SINCE_CACHE_FILE);
1004
+ }
1005
+ function readUpdatesSinceCache() {
1006
+ try {
1007
+ const parsed = JSON.parse(readFileSync2(updatesSinceCachePath(), "utf8"));
1008
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
1009
+ } catch {
1010
+ return {};
1011
+ }
1012
+ }
1013
+ function writeUpdatesSinceCache(cache) {
1014
+ try {
1015
+ const keys = Object.keys(cache);
1016
+ const trimmed = {};
1017
+ for (const key of keys.slice(-UPDATES_SINCE_CACHE_KEEP)) trimmed[key] = cache[key];
1018
+ mkdirSync2(dirname(updatesSinceCachePath()), { recursive: true });
1019
+ writeFileSync(updatesSinceCachePath(), JSON.stringify(trimmed));
1020
+ } catch {
1021
+ }
1022
+ }
1023
+ function latestFromUpdatesSince(item, row) {
1024
+ if (!row) return { ok: false, status: "unpublished", message: `${item.base} is not published.` };
1025
+ const inRange = row.latest_in_range_yanked ? "" : row.latest_in_range ?? "";
1026
+ return { ok: true, latest_in_range: inRange, latest_major: row.latest_major ?? "" };
1027
+ }
1028
+ var defaultFetchUpstreamLatest = async (items, opts) => {
1029
+ const out = /* @__PURE__ */ new Map();
1030
+ if (items.length === 0) return out;
1031
+ const root = resolveCatalogScope().cloudBaseUrl.replace(/\/+$/, "");
1032
+ let token;
1033
+ try {
1034
+ token = (await ensureCloudAccountAccess())?.accessToken;
1035
+ } catch {
1036
+ token = void 0;
1037
+ }
1038
+ const cache = readUpdatesSinceCache();
1039
+ let cacheChanged = false;
1040
+ for (let start = 0; start < items.length; start += UPDATES_SINCE_BATCH) {
1041
+ const batch = items.slice(start, start + UPDATES_SINCE_BATCH);
1042
+ const body = JSON.stringify({
1043
+ selectors: batch.map((item) => ({ ref: item.base, version: item.version, constraint: item.range }))
1044
+ });
1045
+ const cacheKey = `${root}
1046
+ ${token ? "auth" : "public"}
1047
+ ${body}`;
1048
+ const cached = cache[cacheKey];
1049
+ let response;
1050
+ try {
1051
+ response = await cloudFetch(`${root}/api/catalog/updates-since`, {
1052
+ method: "POST",
1053
+ headers: {
1054
+ "content-type": "application/json",
1055
+ ...token ? { authorization: `Bearer ${token}` } : {},
1056
+ ...cached?.etag ? { "if-none-match": cached.etag } : {}
1057
+ },
1058
+ body,
1059
+ ...opts.signal ? { signal: opts.signal } : {}
1060
+ });
1061
+ } catch (error) {
1062
+ for (const item of batch) {
1063
+ out.set(upstreamQueryKey(item), { ok: false, status: "unreachable", message: formatCatalogRequestError(error) });
779
1064
  }
1065
+ continue;
780
1066
  }
781
- case "outdated": {
782
- try {
783
- return await applyCheckedPluginOrigin(plugin, check, deps);
784
- } catch (error) {
785
- return originApplyFailureRow(plugin, error);
1067
+ const failure = response.ok || response.status === 304 ? void 0 : await readCloudError(response);
1068
+ if (failure && UPDATES_SINCE_MISSING.has(response.status) && !failure.code) {
1069
+ for (const item of batch) out.set(upstreamQueryKey(item), await latestFromCatalogList(item));
1070
+ continue;
1071
+ }
1072
+ let rows;
1073
+ if (response.status === 304 && cached) {
1074
+ rows = cached.items;
1075
+ } else if (response.ok) {
1076
+ const parsed = await response.json().catch(() => ({}));
1077
+ rows = Array.isArray(parsed.items) ? parsed.items : [];
1078
+ const etag = response.headers.get("etag");
1079
+ if (etag) {
1080
+ delete cache[cacheKey];
1081
+ cache[cacheKey] = { etag, items: rows };
1082
+ cacheChanged = true;
786
1083
  }
1084
+ } else {
1085
+ const detail = describeCloudError(response.status, failure ?? {});
1086
+ for (const item of batch) {
1087
+ out.set(upstreamQueryKey(item), { ok: false, status: "unreachable", message: detail });
1088
+ }
1089
+ continue;
787
1090
  }
788
- case "error":
789
- return originFailRow(plugin, check.message);
790
- case "unknown":
791
- return originSkipRow(plugin, check.message ?? MISSING_LOCATOR_MESSAGE);
792
- default: {
793
- const _exhaustive = check.status;
794
- throw new Error(`Unhandled check status: ${_exhaustive}`);
1091
+ for (const item of batch) {
1092
+ const row = rows.find((candidate) => candidate.ref === item.base && candidate.constraint === item.range) ?? rows.find((candidate) => candidate.ref === item.base && candidate.constraint === void 0);
1093
+ out.set(upstreamQueryKey(item), latestFromUpdatesSince(item, row));
795
1094
  }
796
1095
  }
1096
+ if (cacheChanged) writeUpdatesSinceCache(cache);
1097
+ return out;
1098
+ };
1099
+ function nonEmpty(value) {
1100
+ return typeof value === "string" && value.length > 0 ? value : void 0;
797
1101
  }
798
- async function updatePluginOrigins(opts) {
799
- if (!opts.name && !opts.all) {
800
- throw new Error("pass a name or --all");
1102
+ function parseCloudError(body, headers) {
1103
+ const top = body && typeof body === "object" ? body : {};
1104
+ const nested = top.error && typeof top.error === "object" ? top.error : {};
1105
+ return {
1106
+ code: nonEmpty(nested.code) ?? nonEmpty(top.error) ?? nonEmpty(top.code),
1107
+ message: nonEmpty(nested.message) ?? nonEmpty(top.message),
1108
+ requestId: nonEmpty(nested.requestId) ?? nonEmpty(top.requestId) ?? nonEmpty(headers?.get("x-request-id") ?? void 0)
1109
+ };
1110
+ }
1111
+ async function readCloudError(response) {
1112
+ const text = await response.text().catch(() => "");
1113
+ let body;
1114
+ try {
1115
+ body = text.trim() ? JSON.parse(text) : void 0;
1116
+ } catch {
1117
+ body = void 0;
801
1118
  }
802
- const check = await checkPluginOrigins({
803
- name: opts.name,
804
- refresh: true,
805
- deps: opts.deps
1119
+ return parseCloudError(body, response.headers);
1120
+ }
1121
+ function describeCloudError(status, info) {
1122
+ const request = info.requestId ? ` (request ${info.requestId})` : "";
1123
+ if (info.code === "catalog_not_found") {
1124
+ return `Cloud could not find the catalog for this check${info.message ? `: ${info.message}` : "."}${request}`;
1125
+ }
1126
+ if (info.code === "not_found") {
1127
+ return `Cloud could not find what this check asked for${info.message ? `: ${info.message}` : "."}${request}`;
1128
+ }
1129
+ return [`Cloud answered ${status}`, info.message ?? info.code ?? ""].filter(Boolean).join(" ") + request;
1130
+ }
1131
+ var upstreamCheckDeps = {
1132
+ fetchLatest: defaultFetchUpstreamLatest
1133
+ };
1134
+ async function latestFromCatalogList(item) {
1135
+ const [org = "", catalog = "", slug = ""] = item.base.split("/");
1136
+ try {
1137
+ const plugin = await fetchCatalogPlugin({ orgSlug: org, catalogSlug: catalog, slug });
1138
+ if (!plugin.latestVersion) {
1139
+ return { ok: false, status: "unpublished", message: `${item.base} has no published version.` };
1140
+ }
1141
+ return { ok: true, ...pickLatest([plugin.latestVersion], item.range) };
1142
+ } catch (error) {
1143
+ const message = formatCatalogRequestError(error);
1144
+ return /not found/i.test(message) ? { ok: false, status: "unpublished", message: `${item.base} is not published.` } : { ok: false, status: "unreachable", message };
1145
+ }
1146
+ }
1147
+ async function runUpstreamCheck(opts) {
1148
+ const all = listUpstreamTargets();
1149
+ const targets = opts?.name ? all.filter((target) => target.plugin_name === opts.name) : all;
1150
+ const catalogQueries = /* @__PURE__ */ new Map();
1151
+ for (const target of targets) {
1152
+ if (!isCatalogUpstreamRef(target.ref)) continue;
1153
+ const base = upstreamRefBase(target.ref);
1154
+ const query = { base, version: target.local_version, range: upstreamRefRange(target.ref) };
1155
+ catalogQueries.set(upstreamQueryKey(query), query);
1156
+ }
1157
+ const fetchLatest = opts?.fetchLatest ?? upstreamCheckDeps.fetchLatest;
1158
+ const latestByBase = await fetchLatest([...catalogQueries.values()], { signal: opts?.signal });
1159
+ const checkedAt = (opts?.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
1160
+ const computed = targets.map((target) => {
1161
+ const base = upstreamRefBase(target.ref);
1162
+ const latest = isCatalogUpstreamRef(target.ref) ? latestByBase.get(upstreamQueryKey({ base, range: upstreamRefRange(target.ref) })) ?? latestByBase.get(base) ?? { ok: false, status: "unreachable", message: "No answer for this ref." } : localLatest(target.ref);
1163
+ const known = isCatalogUpstreamRef(target.ref) && latest.ok ? { ok: true, ...narrowToRange(latest, upstreamRefRange(target.ref)) } : latest;
1164
+ return {
1165
+ plugin_name: target.plugin_name,
1166
+ ref: target.ref,
1167
+ local_version: target.local_version,
1168
+ checked_at: checkedAt,
1169
+ ...classifyUpstream(target.local_version, known)
1170
+ };
806
1171
  });
807
- if (opts.name && check.results.length === 0) {
808
- const named = resolveNamedOriginPlugin(opts.name);
809
- if (named?.frozen_at) {
810
- const skipped = originSkipRow(named, FROZEN_UPDATE_MESSAGE);
811
- return { results: [skipped], summary: summarizeOriginUpdate([skipped]) };
1172
+ const db = getDb();
1173
+ const previous = new Map(
1174
+ readUpstreamChecks().map((row) => [`${row.plugin_name}\0${row.ref}`, row.local_version])
1175
+ );
1176
+ const upsert = db.prepare(
1177
+ `INSERT INTO upstream_checks
1178
+ (plugin_name, ref, local_version, latest_in_range, latest_major, status, checked_at, message)
1179
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
1180
+ ON CONFLICT(plugin_name, ref) DO UPDATE SET
1181
+ local_version = excluded.local_version,
1182
+ latest_in_range = excluded.latest_in_range,
1183
+ latest_major = excluded.latest_major,
1184
+ status = excluded.status,
1185
+ checked_at = excluded.checked_at,
1186
+ message = excluded.message`
1187
+ );
1188
+ db.transaction(() => {
1189
+ for (const row of computed) {
1190
+ upsert.run(
1191
+ row.plugin_name,
1192
+ row.ref,
1193
+ row.local_version,
1194
+ row.latest_in_range,
1195
+ row.latest_major,
1196
+ row.status,
1197
+ row.checked_at,
1198
+ row.message
1199
+ );
812
1200
  }
1201
+ if (!opts?.name) {
1202
+ const keep = new Set(computed.map((row) => `${row.plugin_name}\0${row.ref}`));
1203
+ const stale = db.prepare("SELECT plugin_name, ref FROM upstream_checks").all().filter((row) => !keep.has(`${row.plugin_name}\0${row.ref}`));
1204
+ const drop = db.prepare("DELETE FROM upstream_checks WHERE plugin_name = ? AND ref = ?");
1205
+ for (const row of stale) drop.run(row.plugin_name, row.ref);
1206
+ }
1207
+ })();
1208
+ const rows = readUpstreamChecks().filter(
1209
+ (row) => !opts?.name || row.plugin_name === opts.name
1210
+ );
1211
+ notifyUpstreamUpdates(rows, new Map(targets.map((target) => [`${target.plugin_name}\0${target.ref}`, target.kind])), previous);
1212
+ return { checked_at: checkedAt, rows };
1213
+ }
1214
+ function notifyUpstreamUpdates(rows, kinds, previous) {
1215
+ for (const row of rows) {
1216
+ const key = `${row.plugin_name}\0${row.ref}`;
1217
+ const before = previous.get(key);
1218
+ if (kinds.get(key) === "extends" && before && semver.valid(before) && semver.valid(row.local_version) && semver.gt(row.local_version, before)) {
1219
+ notifySafely({
1220
+ kind: "parent_published",
1221
+ plugin_name: row.plugin_name,
1222
+ title: `${row.plugin_name} now uses ${row.local_version}`,
1223
+ body: `Synced from ${upstreamRefBase(row.ref)} (was ${before}).`,
1224
+ payload: { version: row.local_version, ref: row.ref, from: before, major: false }
1225
+ });
1226
+ }
1227
+ if (!isPendingUpdate(row)) continue;
1228
+ const major = row.status === "major";
1229
+ const version = major ? row.latest_major : row.latest_in_range;
1230
+ const parent = kinds.get(`${row.plugin_name}\0${row.ref}`) === "extends";
1231
+ const source = upstreamRefBase(row.ref);
1232
+ notifySafely({
1233
+ kind: parent ? "parent_published" : "update_available",
1234
+ plugin_name: row.plugin_name,
1235
+ title: parent ? `${source} published ${version}` : `${row.plugin_name} ${version} is available`,
1236
+ body: major ? `Major update, needs your OK. You have ${row.local_version}.` : `You have ${row.local_version}.`,
1237
+ payload: { version, ref: row.ref, from: row.local_version, major }
1238
+ });
813
1239
  }
814
- const results = [];
815
- for (const row of check.results) {
816
- results.push(await rowForCheck(row, Boolean(opts.force), opts.deps));
817
- }
818
- return { results, summary: summarizeOriginUpdate(results) };
1240
+ }
1241
+ function narrowToRange(latest, range) {
1242
+ return pickLatest([latest.latest_in_range, latest.latest_major].filter(Boolean), range);
819
1243
  }
820
1244
 
821
1245
  // src/cli/handlers/plugin-origin-update.ts
@@ -834,6 +1258,12 @@ function originUpdateConfirmMode(yes) {
834
1258
  function originRef(row) {
835
1259
  return row.origin_version ?? row.origin_fingerprint ?? "";
836
1260
  }
1261
+ function upstreamAvailable(row) {
1262
+ if (row.status === "update") return row.latest_in_range;
1263
+ if (row.status === "major") return `${row.latest_major} (major)`;
1264
+ if (row.status === "unreachable" || row.status === "unpublished") return row.message;
1265
+ return "";
1266
+ }
837
1267
  async function handlePluginCheckCommand(name, opts) {
838
1268
  const db = getDb();
839
1269
  initializeSchema(db);
@@ -842,8 +1272,9 @@ async function handlePluginCheckCommand(name, opts) {
842
1272
  name,
843
1273
  refresh: opts.refresh
844
1274
  });
1275
+ const upstream = (await runUpstreamCheck(name ? { name } : void 0)).rows;
845
1276
  if (format === "json") {
846
- printJson(report);
1277
+ printJson({ ...report, upstream });
847
1278
  } else {
848
1279
  ui.table.print({
849
1280
  columns: [
@@ -863,6 +1294,25 @@ async function handlePluginCheckCommand(name, opts) {
863
1294
  summary: formatCount(report.results.length, "plugin"),
864
1295
  empty: "No syncable working heads."
865
1296
  });
1297
+ if (upstream.length > 0) {
1298
+ ui.table.print({
1299
+ columns: [
1300
+ { key: "name", header: "NAME", width: 18 },
1301
+ { key: "upstream", header: "UPSTREAM", width: 30 },
1302
+ { key: "status", header: "STATUS", width: 11 },
1303
+ { key: "local", header: "LOCAL", width: 8 },
1304
+ { key: "available", header: "AVAILABLE", width: 16 }
1305
+ ],
1306
+ rows: upstream.map((row) => ({
1307
+ name: row.plugin_name,
1308
+ upstream: row.ref,
1309
+ status: row.status,
1310
+ local: row.local_version,
1311
+ available: upstreamAvailable(row)
1312
+ })),
1313
+ summary: upstream.some((row) => row.status === "major") ? `${formatCount(upstream.length, "upstream link")}. A major version is never installed automatically.` : formatCount(upstream.length, "upstream link")
1314
+ });
1315
+ }
866
1316
  }
867
1317
  if (report.results.some((row) => row.status === "error")) {
868
1318
  process.exitCode = 1;
@@ -893,7 +1343,7 @@ async function handlePluginUpdateCommand(name, opts) {
893
1343
  const count = listOriginUpdateCandidates().length;
894
1344
  try {
895
1345
  const confirmed = await promptForConfirmation({
896
- message: `Update ${count} plugins from origin?`,
1346
+ message: `Update ${formatCount(count, "plugin")} from origin?`,
897
1347
  default: false
898
1348
  });
899
1349
  if (!confirmed) {
@@ -910,11 +1360,13 @@ async function handlePluginUpdateCommand(name, opts) {
910
1360
  }
911
1361
  }
912
1362
  try {
913
- const report = await updatePluginOrigins({
914
- name,
915
- all: opts.all,
916
- force: opts.force
917
- });
1363
+ const report = await withUpstreamUpdateLock(
1364
+ () => updatePluginOrigins({ name, all: opts.all, force: opts.force }),
1365
+ {
1366
+ waitMs: UPDATE_LOCK_WAIT_MS,
1367
+ onWait: () => ui.info("Waiting for another plugin update to finish.")
1368
+ }
1369
+ );
918
1370
  if (format === "json") {
919
1371
  printJson(report);
920
1372
  } else {
@@ -925,6 +1377,8 @@ async function handlePluginUpdateCommand(name, opts) {
925
1377
  }
926
1378
  if (report.results.some((row) => row.status === "failed")) {
927
1379
  process.exitCode = 1;
1380
+ } else if (opts.all && format !== "json") {
1381
+ await maybePromptKeepUpToDate();
928
1382
  }
929
1383
  } catch (error) {
930
1384
  process.exitCode = 1;
@@ -932,6 +1386,7 @@ async function handlePluginUpdateCommand(name, opts) {
932
1386
  ui.danger(message);
933
1387
  }
934
1388
  }
1389
+ var UPDATE_LOCK_WAIT_MS = 5 * 60 * 1e3;
935
1390
  function printUpdateHuman(rows) {
936
1391
  ui.table.print({
937
1392
  columns: [
@@ -1062,6 +1517,31 @@ function handlePluginVersionsCommand(name, opts) {
1062
1517
  });
1063
1518
  }
1064
1519
 
1520
+ // src/cli/handlers/plugin-validate.ts
1521
+ function handlePluginValidateCommand(file, opts) {
1522
+ const format = parseOutputFormat(opts.format);
1523
+ const report = loadSpecPackagePath(file, opts.spec ?? "1.0.0");
1524
+ if (format === "json") {
1525
+ printJson(report);
1526
+ } else if (!report.ok) {
1527
+ ui.danger(report.rejected ?? "Invalid Agent Plugins package");
1528
+ } else {
1529
+ ui.success(`${report.name}@${report.version}`);
1530
+ ui.info(`skills: ${report.loaded.skills.join(", ") || "(none)"}`);
1531
+ ui.info(`mcp servers: ${report.loaded.mcpServers.join(", ") || "(none)"}`);
1532
+ for (const item of report.skipped) {
1533
+ ui.warn(`skipped ${item.component} ${item.name}: ${item.reason}`);
1534
+ }
1535
+ for (const item of report.reported) {
1536
+ ui.warn(`${item.field}: ${item.message}`);
1537
+ }
1538
+ if (report.mcpDisabled) {
1539
+ ui.warn(`MCP disabled: ${report.mcpDisabled}`);
1540
+ }
1541
+ }
1542
+ if (!report.ok) process.exitCode = 1;
1543
+ }
1544
+
1065
1545
  // src/cli/handlers/plugin-validate-package.ts
1066
1546
  import { resolve } from "path";
1067
1547
 
@@ -1221,8 +1701,8 @@ function resolveProjectCompileTargets(input) {
1221
1701
  }
1222
1702
 
1223
1703
  // src/services/plugin-editor.ts
1224
- import { mkdirSync } from "fs";
1225
- import { dirname, join as join2 } from "path";
1704
+ import { mkdirSync as mkdirSync3 } from "fs";
1705
+ import { dirname as dirname2, join as join4 } from "path";
1226
1706
 
1227
1707
  // src/services/plugin-export.ts
1228
1708
  import { existsSync as existsSync2, statSync } from "fs";
@@ -1260,7 +1740,7 @@ function exportToFile(pluginNameOrId, filePath, exportOpts) {
1260
1740
 
1261
1741
  // src/services/plugin-editor.ts
1262
1742
  function resolvePluginDefinitionPath(plugin) {
1263
- return join2(
1743
+ return join4(
1264
1744
  getHarnesstapDir(),
1265
1745
  "plugins",
1266
1746
  `${slugifyApName(plugin.name)}@${plugin.version}.ap.json`
@@ -1268,7 +1748,7 @@ function resolvePluginDefinitionPath(plugin) {
1268
1748
  }
1269
1749
  function exportPluginDefinition(plugin, filePath) {
1270
1750
  const definitionPath = filePath ?? resolvePluginDefinitionPath(plugin);
1271
- mkdirSync(dirname(definitionPath), { recursive: true });
1751
+ mkdirSync3(dirname2(definitionPath), { recursive: true });
1272
1752
  exportToFile(plugin.id, definitionPath, { singleFile: true });
1273
1753
  return definitionPath;
1274
1754
  }
@@ -1366,7 +1846,7 @@ async function handlePluginCatalogDisconnectPluginCommand(selector) {
1366
1846
 
1367
1847
  // src/services/plugin-diff.ts
1368
1848
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
1369
- import { join as join3 } from "path";
1849
+ import { join as join5 } from "path";
1370
1850
  function resourceKey(resource) {
1371
1851
  if (resource.namespace) {
1372
1852
  return `${resource.type}:${resource.name}@${resource.namespace}`;
@@ -1379,7 +1859,7 @@ function isPackagePath(nameOrPath) {
1379
1859
  }
1380
1860
  try {
1381
1861
  if (existsSync3(nameOrPath) && statSync2(nameOrPath).isDirectory()) {
1382
- return existsSync3(join3(nameOrPath, "plugin.json"));
1862
+ return existsSync3(join5(nameOrPath, "plugin.json"));
1383
1863
  }
1384
1864
  } catch {
1385
1865
  return false;
@@ -1564,7 +2044,7 @@ function diffPlugins(leftName, rightName) {
1564
2044
 
1565
2045
  // src/services/plugin-package-hydrate.ts
1566
2046
  import { existsSync as existsSync4 } from "fs";
1567
- import { join as join4 } from "path";
2047
+ import { join as join6 } from "path";
1568
2048
  var MATERIAL_TYPES = new Set(MATERIAL_RESOURCE_TYPES);
1569
2049
  function hasMaterialResources(resources) {
1570
2050
  return resources.some((resource) => MATERIAL_TYPES.has(resource.type));
@@ -1583,9 +2063,11 @@ function tryScan(sourcePath, pluginName) {
1583
2063
  }
1584
2064
  function scanMarketplaceManifests(sourcePath, pluginName) {
1585
2065
  const manifestCandidates = [
1586
- join4(sourcePath, ".claude-plugin", "marketplace.json"),
1587
- join4(sourcePath, ".cursor-plugin", "marketplace.json"),
1588
- join4(sourcePath, "marketplace.json")
2066
+ join6(sourcePath, ".claude-plugin", "marketplace.json"),
2067
+ join6(sourcePath, ".cursor-plugin", "marketplace.json"),
2068
+ join6(sourcePath, ".github", "plugin", "marketplace.json"),
2069
+ join6(sourcePath, ".agents", "plugins", "marketplace.json"),
2070
+ join6(sourcePath, "marketplace.json")
1589
2071
  ];
1590
2072
  for (const manifestPath of manifestCandidates) {
1591
2073
  if (!existsSync4(manifestPath)) {
@@ -1598,35 +2080,6 @@ function scanMarketplaceManifests(sourcePath, pluginName) {
1598
2080
  }
1599
2081
  return void 0;
1600
2082
  }
1601
- function resolveUpstreamPackageRoot(plugin) {
1602
- const locator = recoverOriginLocator(plugin);
1603
- const harnesstapDir = getHarnesstapDir();
1604
- const homeRoot = resolveHomeRoot();
1605
- if (!locator) {
1606
- return resolveInstallRoot(plugin.name, homeRoot);
1607
- }
1608
- switch (locator.kind) {
1609
- case "marketplace": {
1610
- const parsed = parseDependencyRef(locator.ref);
1611
- const cacheDir = marketplaceCacheDir(harnesstapDir, parsed.namespace);
1612
- const fromCache = resolveMarketplacePluginDirectory(cacheDir, parsed.name) ?? resolveMarketplacePluginDirectory(cacheDir, plugin.name);
1613
- if (fromCache) {
1614
- return fromCache;
1615
- }
1616
- return resolveInstallRoot(locator.ref, homeRoot) ?? resolveInstallRoot(`${plugin.name}@${parsed.namespace}`, homeRoot);
1617
- }
1618
- case "git": {
1619
- const cacheDir = gitOriginCacheDir(harnesstapDir, locator.url);
1620
- return resolveMarketplacePluginDirectory(cacheDir, plugin.name) ?? (existsSync4(cacheDir) ? cacheDir : void 0);
1621
- }
1622
- case "catalog":
1623
- return void 0;
1624
- default: {
1625
- const _exhaustive = locator;
1626
- return _exhaustive;
1627
- }
1628
- }
1629
- }
1630
2083
  function scanPackageTree(plugin, sourcePath) {
1631
2084
  const fromManifest = scanMarketplaceManifests(sourcePath, plugin.name);
1632
2085
  if (fromManifest) {
@@ -1649,7 +2102,10 @@ function ensureUpstreamPluginResources(plugin) {
1649
2102
  if (plugin.origin === "authored") {
1650
2103
  return attached;
1651
2104
  }
1652
- const packageRoot = resolveUpstreamPackageRoot(plugin);
2105
+ if (recordedPluginInstallRoot(plugin.name, plugin.version)) {
2106
+ return attached;
2107
+ }
2108
+ const packageRoot = resolvePluginPackageRoot(plugin);
1653
2109
  if (!packageRoot) {
1654
2110
  return attached;
1655
2111
  }
@@ -1760,13 +2216,40 @@ var emptyPluginCheck = {
1760
2216
  }
1761
2217
  };
1762
2218
 
2219
+ // src/services/git-dependency-pin-check.ts
2220
+ function gitDependencyPinIssue(ref, constraint) {
2221
+ try {
2222
+ const pin = parseGitDependencyConstraint(constraint);
2223
+ if (pin.kind === "none") {
2224
+ return {
2225
+ severity: "warning",
2226
+ message: `Git dependency ${ref} is not pinned and tracks the default branch HEAD. Pin a commit, tag or branch, for example #<sha> or ref:<tag>.`
2227
+ };
2228
+ }
2229
+ return null;
2230
+ } catch (error) {
2231
+ return {
2232
+ severity: "error",
2233
+ message: error instanceof InvalidGitDependencyConstraintError ? `${error.message} (${ref})` : `Invalid git dependency constraint for ${ref}`
2234
+ };
2235
+ }
2236
+ }
2237
+
1763
2238
  // src/services/plugin-doctor/checks/plugin-metadata.ts
2239
+ function checkGitDependencyPin(ref, constraint) {
2240
+ const issue = gitDependencyPinIssue(ref, constraint);
2241
+ return issue ? [{ severity: issue.severity === "error" ? "error" : "warn", message: issue.message }] : [];
2242
+ }
1764
2243
  var pluginMetadataCheck = {
1765
2244
  id: "plugin-metadata",
1766
2245
  description: "Validate plugin refs, versions, and Claude plugin metadata",
1767
2246
  run({ plugin, plugins }) {
1768
2247
  const results = [];
1769
2248
  for (const pin of plugins) {
2249
+ if (pin.source_kind === "git") {
2250
+ results.push(...checkGitDependencyPin(pin.ref, pin.version_constraint));
2251
+ continue;
2252
+ }
1770
2253
  if (!pin.ref.includes("@")) {
1771
2254
  results.push({
1772
2255
  severity: "error",
@@ -1807,23 +2290,52 @@ var pluginMetadataCheck = {
1807
2290
  }
1808
2291
  };
1809
2292
 
2293
+ // src/services/plugin-doctor/checks/skipped-files.ts
2294
+ var skippedFilesCheck = {
2295
+ id: "skipped-files",
2296
+ description: "Detect package files that import skipped (bad frontmatter, unsupported dirs)",
2297
+ run({ packageDiagnostics: packageDiagnostics2 }) {
2298
+ if (!packageDiagnostics2) return [];
2299
+ return packageDiagnostics2.skipped.map((item) => ({
2300
+ severity: "error",
2301
+ message: formatSkippedEntry(item)
2302
+ }));
2303
+ }
2304
+ };
2305
+
1810
2306
  // src/services/plugin-doctor.ts
1811
2307
  var pluginDoctorChecks = [
1812
2308
  emptyPluginCheck,
1813
2309
  duplicateResourcesCheck,
1814
2310
  emptyContentCheck,
1815
- pluginMetadataCheck
2311
+ pluginMetadataCheck,
2312
+ skippedFilesCheck
1816
2313
  ];
2314
+ function packageDiagnostics(plugin, resources) {
2315
+ const root = recordedPluginInstallRoot(plugin.name, plugin.version);
2316
+ if (!root) return void 0;
2317
+ try {
2318
+ const parsed = parseApPackageFiles(readContainedPackageFiles(root), { root });
2319
+ return diagnoseParsedPackage(
2320
+ parsed,
2321
+ resources.map((resource) => resource.type)
2322
+ );
2323
+ } catch {
2324
+ return void 0;
2325
+ }
2326
+ }
1817
2327
  function createPluginDoctorContext(nameOrId) {
1818
2328
  const plugin = getPlugin(nameOrId);
1819
2329
  if (!plugin) {
1820
2330
  throw new Error(`Plugin not found: ${nameOrId}`);
1821
2331
  }
1822
2332
  const resources = ensureUpstreamPluginResources(plugin);
2333
+ const diagnostics = packageDiagnostics(plugin, resources);
1823
2334
  return {
1824
2335
  plugin,
1825
2336
  resources,
1826
- plugins: dependenciesFromResources(resources)
2337
+ plugins: dependenciesFromResources(resources),
2338
+ ...diagnostics ? { packageDiagnostics: diagnostics } : {}
1827
2339
  };
1828
2340
  }
1829
2341
  function listPluginDoctorChecks() {
@@ -1851,9 +2363,16 @@ function runPluginDoctor(input) {
1851
2363
  plugin: context.plugin.name,
1852
2364
  valid: !results.some((result) => result.severity === "error"),
1853
2365
  checks: checks.map((check) => check.id),
1854
- results
2366
+ results,
2367
+ resource_counts: context.packageDiagnostics?.counts ?? libraryCounts(context.resources)
1855
2368
  };
1856
2369
  }
2370
+ function libraryCounts(resources) {
2371
+ return [...MATERIAL_RESOURCE_TYPES, "plugin"].flatMap((type) => {
2372
+ const count = resources.filter((resource) => resource.type === type).length;
2373
+ return count > 0 ? [{ type, discovered: count, imported: count }] : [];
2374
+ });
2375
+ }
1857
2376
 
1858
2377
  // src/services/constraint-recovery.ts
1859
2378
  function catalogDependencyMatches(dependency, pluginName) {
@@ -1862,6 +2381,10 @@ function catalogDependencyMatches(dependency, pluginName) {
1862
2381
  function marketplaceDependencyMatches(dependency, pluginName) {
1863
2382
  return dependency.source_kind === "marketplace" && (dependency.name === pluginName || dependency.ref === pluginName || dependency.ref.endsWith(`/${pluginName}`));
1864
2383
  }
2384
+ function gitDependencyMatches(dependency, pluginName) {
2385
+ const ref = dependency.ref.replace(/\.git$/, "").replace(/\/+$/, "");
2386
+ return dependency.source_kind === "git" && (dependency.name === pluginName || ref === pluginName || ref.endsWith(`/${pluginName}`));
2387
+ }
1865
2388
  async function runConstraintRecovery(input) {
1866
2389
  const root = resolvePluginSelector(input.rootName);
1867
2390
  if (!root) {
@@ -1967,8 +2490,31 @@ async function runConstraintRecovery(input) {
1967
2490
  }
1968
2491
  return;
1969
2492
  }
2493
+ if (action.sourceKind === "git") {
2494
+ const pins = listDependencies(root.id).filter((dependency) => gitDependencyMatches(dependency, action.pluginName)).map((dependency) => ({
2495
+ ref: dependency.ref,
2496
+ version_constraint: dependency.version_constraint || "*"
2497
+ }));
2498
+ if (pins.length === 0) {
2499
+ throw new Error(`No git dependency on ${action.pluginName} in ${input.rootName}`);
2500
+ }
2501
+ const syncResult = await syncPluginPinsForApply({
2502
+ pins,
2503
+ syncAll: true,
2504
+ projectRoot: input.projectRoot ?? resolveHomeRoot()
2505
+ });
2506
+ const failed = syncResult.installs.filter(
2507
+ (install) => install.status === "failed" || install.status === "unsupported"
2508
+ );
2509
+ if (failed.length > 0) {
2510
+ throw new Error(
2511
+ `Could not fetch ${action.pluginName}: ${failed.map((install) => `${install.ref}: ${install.message}`).join("; ")}`
2512
+ );
2513
+ }
2514
+ return;
2515
+ }
1970
2516
  throw new Error(
1971
- `Automated sync-install is only supported for marketplace and catalog dependencies. Create or import ${action.pluginName} first (ht plugin create ${action.pluginName}).`
2517
+ `Automated sync-install is only supported for marketplace, catalog and git dependencies. Create or import ${action.pluginName} first (ht plugin create ${action.pluginName}).`
1972
2518
  );
1973
2519
  }
1974
2520
  default: {
@@ -2160,7 +2706,8 @@ function explainPayload(result) {
2160
2706
  path: plugin.path,
2161
2707
  constraints: plugin.constraints.map((record) => ({
2162
2708
  requirer: record.requirer,
2163
- constraint: record.constraint
2709
+ constraint: record.constraint,
2710
+ ...record.declared ? { declared: record.declared } : {}
2164
2711
  }))
2165
2712
  })),
2166
2713
  resources: result.decisions.map((decision) => ({
@@ -2188,7 +2735,7 @@ function renderExplain(result) {
2188
2735
  for (const record of plugin.constraints) {
2189
2736
  lines.push(
2190
2737
  ui.theme.muted(
2191
- ` ${record.requirer} \u2192 ${plugin.name} ${record.constraint || "*"}`
2738
+ ` ${record.requirer} \u2192 ${plugin.name} ${displayConstraint(record)}`
2192
2739
  )
2193
2740
  );
2194
2741
  }
@@ -2211,13 +2758,11 @@ function renderExplain(result) {
2211
2758
 
2212
2759
  // src/services/apm-graph.ts
2213
2760
  import { existsSync as existsSync6, lstatSync as lstatSync2 } from "fs";
2214
- import { homedir } from "os";
2215
- import { isAbsolute, join as join6, resolve as resolve4 } from "path";
2761
+ import { isAbsolute, join as join8, resolve as resolve4 } from "path";
2216
2762
 
2217
2763
  // src/services/apm-git-import.ts
2218
- import { existsSync as existsSync5, lstatSync, readdirSync, readFileSync } from "fs";
2219
- import { basename as basename2, join as join5 } from "path";
2220
- import matter from "gray-matter";
2764
+ import { existsSync as existsSync5, lstatSync, readdirSync, readFileSync as readFileSync3 } from "fs";
2765
+ import { basename as basename2, join as join7 } from "path";
2221
2766
  function isRecord(value) {
2222
2767
  return value !== null && typeof value === "object" && !Array.isArray(value);
2223
2768
  }
@@ -2234,8 +2779,8 @@ function importVirtualFile(checkoutRoot, relativePath) {
2234
2779
  `Virtual package file ${relativePath} is missing: apply aborted closed`
2235
2780
  );
2236
2781
  }
2237
- const raw = readFileSync(absolute, "utf8");
2238
- const parsed = matter(raw);
2782
+ const raw = readFileSync3(absolute, "utf8");
2783
+ const parsed = parseFrontmatter(raw);
2239
2784
  const data = isRecord(parsed.data) ? parsed.data : {};
2240
2785
  const fallback = basename2(relativePath).replace(/\.(agent|prompt|instructions)\.md$/i, "");
2241
2786
  const name = typeof data.name === "string" && data.name.trim().length > 0 ? data.name.trim() : fallback;
@@ -2270,7 +2815,7 @@ function assertPackageRootSafe(packageRoot) {
2270
2815
  if (entry.name === ".git") {
2271
2816
  continue;
2272
2817
  }
2273
- const child = join5(packageRoot, entry.name);
2818
+ const child = join7(packageRoot, entry.name);
2274
2819
  if (entry.isSymbolicLink() || lstatSync(child).isSymbolicLink()) {
2275
2820
  throw new BundleSymlinkError(entry.name);
2276
2821
  }
@@ -2284,10 +2829,10 @@ function assertPackageRootSafe(packageRoot) {
2284
2829
  }
2285
2830
  }
2286
2831
  function peekApmPackageIdentity(packageRoot) {
2287
- const pluginJson = join5(packageRoot, ".claude-plugin", "plugin.json");
2832
+ const pluginJson = join7(packageRoot, ".claude-plugin", "plugin.json");
2288
2833
  if (existsSync5(pluginJson) && lstatSync(pluginJson).isFile()) {
2289
2834
  try {
2290
- const parsed = JSON.parse(readFileSync(pluginJson, "utf8"));
2835
+ const parsed = JSON.parse(readFileSync3(pluginJson, "utf8"));
2291
2836
  if (isRecord(parsed)) {
2292
2837
  return {
2293
2838
  ...typeof parsed.name === "string" && parsed.name.trim() ? { name: parsed.name.trim() } : {},
@@ -2297,11 +2842,11 @@ function peekApmPackageIdentity(packageRoot) {
2297
2842
  } catch {
2298
2843
  }
2299
2844
  }
2300
- const manifestPath = join5(packageRoot, APM_MANIFEST_FILENAME);
2845
+ const manifestPath = join7(packageRoot, APM_MANIFEST_FILENAME);
2301
2846
  if (!existsSync5(manifestPath) || !lstatSync(manifestPath).isFile()) {
2302
2847
  return {};
2303
2848
  }
2304
- const document = parseApmYamlDocument(readFileSync(manifestPath, "utf8"), manifestPath);
2849
+ const document = parseApmYamlDocument(readFileSync3(manifestPath, "utf8"), manifestPath);
2305
2850
  return {
2306
2851
  ...typeof document.name === "string" && document.name.trim() ? { name: document.name.trim() } : {},
2307
2852
  ...typeof document.version === "string" && document.version.trim() ? { version: document.version.trim() } : {}
@@ -2487,7 +3032,7 @@ function apmDependencyIdentity(dependency, declaringRoot) {
2487
3032
  }
2488
3033
  function expandHome(originRef2) {
2489
3034
  if (originRef2.startsWith("~/") || originRef2.startsWith("~\\")) {
2490
- return join6(homedir(), originRef2.slice(2));
3035
+ return join8(resolveHomeRoot(), originRef2.slice(2));
2491
3036
  }
2492
3037
  return originRef2;
2493
3038
  }
@@ -2512,7 +3057,7 @@ function linkParent(parentPluginId, imported) {
2512
3057
  });
2513
3058
  }
2514
3059
  function pushGitLock(gitLocks, pluginName, fetched) {
2515
- const licenseRoot = fetched.virtualPath ? join6(fetched.checkoutRoot, fetched.virtualPath) : fetched.checkoutRoot;
3060
+ const licenseRoot = fetched.virtualPath ? join8(fetched.checkoutRoot, fetched.virtualPath) : fetched.checkoutRoot;
2516
3061
  const declared_license = readDeclaredLicense(licenseRoot);
2517
3062
  gitLocks.push({
2518
3063
  name: pluginName,
@@ -2618,7 +3163,7 @@ function claimAndEnqueue(frame, identity, importedPackage, packageRoot, walkNest
2618
3163
  return true;
2619
3164
  }
2620
3165
  async function visitGit(frame, identity, state) {
2621
- const fetched = resolveAndFetchApmGitDependency(frame.dependency, state.harnesstapDir, {
3166
+ const fetched = await resolveAndFetchApmGitDependency(frame.dependency, state.harnesstapDir, {
2622
3167
  ...state.update ? { update: true } : {},
2623
3168
  ...state.lock ? { lock: state.lock } : {}
2624
3169
  });
@@ -3499,9 +4044,7 @@ async function addPluginFromMarketplace(input) {
3499
4044
  const plugin = requirePlugin(input.pluginName);
3500
4045
  const parsed = requireMarketplaceRef(input.ref);
3501
4046
  const marketplaceName = parsed.namespace;
3502
- const marketplace = listMarketplaces(input.harnesstapDir).find(
3503
- (entry) => entry.name === marketplaceName
3504
- );
4047
+ const marketplace = findKnownMarketplace(input.harnesstapDir, marketplaceName);
3505
4048
  if (!marketplace) {
3506
4049
  throw new Error(`Marketplace not found in registry: ${marketplaceName}`);
3507
4050
  }
@@ -3544,10 +4087,10 @@ async function addPluginFromMarketplace(input) {
3544
4087
  homeRoot: input.homeRoot,
3545
4088
  projectRoot: input.projectRoot
3546
4089
  };
3547
- ensureMarketplaces(refreshed.claude, ensureOptions);
4090
+ await ensureMarketplaces(refreshed.claude, ensureOptions);
3548
4091
  if (marketplace.platforms.includes("cursor")) {
3549
4092
  const ensureCursor = input.ensureCursorMarketplaces ?? ensureCursorMarketplaces;
3550
- ensureCursor(
4093
+ await ensureCursor(
3551
4094
  [{ name: marketplace.name, url: marketplace.url }],
3552
4095
  {
3553
4096
  homeRoot: input.homeRoot,
@@ -3573,188 +4116,6 @@ async function addPluginFromMarketplace(input) {
3573
4116
  };
3574
4117
  }
3575
4118
 
3576
- // src/services/github-plugin-ref.ts
3577
- var GitPluginImportError = class extends Error {
3578
- code;
3579
- constructor(code, message) {
3580
- super(message);
3581
- this.name = "GitPluginImportError";
3582
- this.code = code;
3583
- }
3584
- };
3585
- var MISSING_PLUGIN_JSON_MESSAGE = "No plugin.json found at the repository root. Import currently supports Agent Plugins packages only; scanning the tree as loose resources is not available yet.";
3586
- var OWNER_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
3587
- var GH_PREFIX = /^gh:/i;
3588
- function invalidRef(input) {
3589
- return new GitPluginImportError(
3590
- "invalid_ref",
3591
- `Unrecognized GitHub plugin source "${input}". Use https://github.com/owner/repo, owner/repo, or gh:owner/repo.`
3592
- );
3593
- }
3594
- function ownerRepoFromPath(pathname) {
3595
- const parts = pathname.split("/").filter(Boolean);
3596
- if (parts.length < 2) {
3597
- return null;
3598
- }
3599
- const owner = parts[0];
3600
- const repo = (parts[1] ?? "").replace(/\.git$/i, "");
3601
- if (!owner || !repo || !OWNER_REPO.test(`${owner}/${repo}`)) {
3602
- return null;
3603
- }
3604
- return { owner, repo };
3605
- }
3606
- function normalizeGitHubPluginUrl(input) {
3607
- const trimmed = input.trim();
3608
- if (!trimmed) {
3609
- throw invalidRef(input);
3610
- }
3611
- const withoutGh = GH_PREFIX.test(trimmed) ? trimmed.replace(GH_PREFIX, "") : trimmed;
3612
- const candidate = withoutGh.trim();
3613
- if (OWNER_REPO.test(candidate.replace(/\.git$/i, ""))) {
3614
- const [owner, repo] = candidate.replace(/\.git$/i, "").split("/");
3615
- if (!owner || !repo) {
3616
- throw invalidRef(input);
3617
- }
3618
- return `https://github.com/${owner}/${repo}.git`;
3619
- }
3620
- let parsed;
3621
- try {
3622
- parsed = new URL(candidate);
3623
- } catch {
3624
- throw invalidRef(input);
3625
- }
3626
- const host = parsed.hostname.replace(/^www\./i, "").toLowerCase();
3627
- if (host !== "github.com" || parsed.protocol !== "https:" && parsed.protocol !== "http:") {
3628
- throw invalidRef(input);
3629
- }
3630
- const pair = ownerRepoFromPath(parsed.pathname);
3631
- if (!pair) {
3632
- throw invalidRef(input);
3633
- }
3634
- return `https://github.com/${pair.owner}/${pair.repo}.git`;
3635
- }
3636
- function isGitHubPluginRef(input) {
3637
- try {
3638
- normalizeGitHubPluginUrl(input);
3639
- return true;
3640
- } catch {
3641
- return false;
3642
- }
3643
- }
3644
-
3645
- // src/services/plugin-git-import.ts
3646
- function sameGitLocator(plugin, url) {
3647
- const locator = recoverOriginLocator(plugin);
3648
- if (!locator || locator.kind !== "git") {
3649
- return false;
3650
- }
3651
- return formatOriginLocator(locator) === url;
3652
- }
3653
- async function importPluginFromGitHubRef(input, deps) {
3654
- let url;
3655
- try {
3656
- url = normalizeGitHubPluginUrl(input);
3657
- } catch (error) {
3658
- if (error instanceof GitPluginImportError) {
3659
- throw error;
3660
- }
3661
- throw new GitPluginImportError(
3662
- "invalid_ref",
3663
- error instanceof Error ? error.message : String(error)
3664
- );
3665
- }
3666
- const harnesstapDir = getHarnesstapDir();
3667
- const targetDir = gitOriginCacheDir(harnesstapDir, url);
3668
- const refreshGit = deps?.refreshGit ?? refreshGitSource;
3669
- const refresh = await refreshGit({ url, targetDir });
3670
- if (!refresh.ok || !refresh.sha) {
3671
- throw new GitPluginImportError(
3672
- "clone_failed",
3673
- refresh.message || `Failed to fetch ${url}`
3674
- );
3675
- }
3676
- if (!isPluginInstallRoot(targetDir)) {
3677
- throw new GitPluginImportError("missing_plugin_json", MISSING_PLUGIN_JSON_MESSAGE);
3678
- }
3679
- const scans = await scanPluginSource(targetDir);
3680
- const scan = scans[0];
3681
- if (!scan?.plugin_name) {
3682
- throw new GitPluginImportError("missing_plugin_json", MISSING_PLUGIN_JSON_MESSAGE);
3683
- }
3684
- const existing = getPluginByName(scan.plugin_name);
3685
- let plugin;
3686
- let created = false;
3687
- if (existing) {
3688
- if (getPluginOrigin(existing.id) !== "upstream" || !sameGitLocator(existing, url)) {
3689
- throw new GitPluginImportError(
3690
- "name_conflict",
3691
- `Plugin name already exists: ${scan.plugin_name}. Use a different local name or delete the existing plugin first.`
3692
- );
3693
- }
3694
- plugin = existing;
3695
- const nextDescription = pluginDescriptionFromManifest(scan.plugin_description);
3696
- if (nextDescription && nextDescription !== existing.description) {
3697
- updatePluginDescription(existing.id, nextDescription);
3698
- }
3699
- } else {
3700
- plugin = createPlugin({
3701
- name: scan.plugin_name,
3702
- version: semverSafePluginVersion(scan.plugin_version, refresh.sha),
3703
- description: pluginDescriptionFromManifest(scan.plugin_description),
3704
- origin: "upstream"
3705
- });
3706
- setPluginOrigin(plugin.id, "upstream");
3707
- created = true;
3708
- }
3709
- try {
3710
- await applyCheckedPluginOrigin(plugin, {
3711
- origin_locator: url,
3712
- origin_fingerprint: refresh.sha
3713
- });
3714
- const pinRef = `${scan.plugin_name}@local`;
3715
- const pinVersion = plugin.version || refresh.sha.slice(0, 12) || "0.0.0";
3716
- ingestHostPluginTreeIntoCache({
3717
- harnesstapDir: getHarnesstapDir(),
3718
- homeRoot: resolveHomeRoot(),
3719
- originRef: pinRef,
3720
- sourceInstallRoot: targetDir,
3721
- version: pinVersion
3722
- });
3723
- attachPluginPinToPlugin(plugin.id, pinRef, pinVersion);
3724
- const pin = findPluginResourceByPin(pinRef, pinVersion) ?? findPluginResourceByPin(pinRef);
3725
- if (pin) {
3726
- const metadata = {
3727
- ...pin.metadata,
3728
- resolved_version: pinVersion,
3729
- sync_status: "synced",
3730
- marketplace_name: "local"
3731
- };
3732
- getDb().prepare("UPDATE resources SET metadata = ?, origin_ref = ?, updated_at = ? WHERE id = ?").run(JSON.stringify(metadata), pinRef, (/* @__PURE__ */ new Date()).toISOString(), pin.id);
3733
- }
3734
- const updated = getPluginById(plugin.id) ?? plugin;
3735
- if (created) {
3736
- trackPluginInstalled({ pluginSlug: updated.name, source: "url" });
3737
- }
3738
- return {
3739
- plugin: updated,
3740
- origin_locator: url,
3741
- origin_fingerprint: refresh.sha,
3742
- created
3743
- };
3744
- } catch (error) {
3745
- if (created) {
3746
- deletePlugin(plugin.id);
3747
- }
3748
- if (error instanceof GitPluginImportError) {
3749
- throw error;
3750
- }
3751
- throw new GitPluginImportError(
3752
- "clone_failed",
3753
- error instanceof Error ? error.message : String(error)
3754
- );
3755
- }
3756
- }
3757
-
3758
4119
  // src/services/plugin-edit.ts
3759
4120
  function attachmentKey(resource) {
3760
4121
  if (resource.namespace) {
@@ -4503,6 +4864,7 @@ async function handleProjectApplyCommand(pluginNames, opts) {
4503
4864
  syncAll: opts.syncPlugins,
4504
4865
  scope: resolvePluginInstallScope(projectRoot, Boolean(getGitOrigin(projectRoot))),
4505
4866
  ignoreMissingInstall: Boolean(opts.ignorePluginVersions || opts.dryRun),
4867
+ installInexactPins: Boolean(opts.ignorePluginVersions && !opts.dryRun),
4506
4868
  yes: Boolean(opts.yes),
4507
4869
  interactive: opts.noInteractive === true ? false : opts.interactive,
4508
4870
  progress: {
@@ -4677,6 +5039,7 @@ async function handleProjectApplyCommand(pluginNames, opts) {
4677
5039
  syncAll: opts.syncPlugins,
4678
5040
  scope: resolvePluginInstallScope(projectRoot, Boolean(getGitOrigin(projectRoot))),
4679
5041
  ignoreMissingInstall: opts.ignorePluginVersions,
5042
+ installInexactPins: Boolean(opts.ignorePluginVersions),
4680
5043
  yes: Boolean(opts.yes),
4681
5044
  interactive: opts.noInteractive === true ? false : opts.interactive,
4682
5045
  progress: {
@@ -5020,7 +5383,7 @@ async function handleProjectApplyCommand(pluginNames, opts) {
5020
5383
  });
5021
5384
  spin.stop();
5022
5385
  if (materialized.cancelled) {
5023
- fail("Apply cancelled due to file conflicts.", {
5386
+ fail(applyCancelledMessage(materialized.conflicts.map((conflict) => conflict.path), "apply"), {
5024
5387
  hint: CLI_HINTS.onConflictReplace
5025
5388
  });
5026
5389
  process.exitCode = 1;
@@ -5259,7 +5622,7 @@ async function handlePluginEditCommand(name, opts) {
5259
5622
  return;
5260
5623
  }
5261
5624
  if (opts.apply) {
5262
- const raw = readFileSync2(opts.apply, "utf8");
5625
+ const raw = readFileSync4(opts.apply, "utf8");
5263
5626
  const attachments = parsePluginEditApplyFile(raw);
5264
5627
  const pending = buildPendingFromApplySpec(candidates, attachments);
5265
5628
  const result2 = await applyPluginEdit({
@@ -5476,7 +5839,7 @@ function handlePluginDiffCommand(left, right, opts) {
5476
5839
  console.log(ui.renderChangeList(changeEntries));
5477
5840
  console.log("");
5478
5841
  console.log(
5479
- `${report.changes.length} changes ${ui.icons.bullet} ${added} added ${ui.icons.bullet} ${removed} removed ${ui.icons.bullet} ${modified} modified`
5842
+ `${formatCount(report.changes.length, "change")} ${ui.icons.bullet} ${added} added ${ui.icons.bullet} ${removed} removed ${ui.icons.bullet} ${modified} modified`
5480
5843
  );
5481
5844
  } catch (err) {
5482
5845
  process.exitCode = 1;
@@ -5521,8 +5884,9 @@ async function handlePluginDoctorCommand(name, opts) {
5521
5884
  );
5522
5885
  return;
5523
5886
  }
5887
+ const target = getPlugin(resolvedName) ?? findLocalPluginBySelector(resolvedName, { command: "ht plugin doctor" });
5524
5888
  const report = runPluginDoctor({
5525
- nameOrId: resolvedName,
5889
+ nameOrId: target?.id ?? resolvedName,
5526
5890
  checkIds: opts.check
5527
5891
  });
5528
5892
  if (format === "json") {
@@ -5569,13 +5933,18 @@ async function handlePluginDoctorCommand(name, opts) {
5569
5933
  { key: "message", header: "MESSAGE", width: 44 }
5570
5934
  ],
5571
5935
  rows,
5936
+ wordWrap: true,
5572
5937
  summary: report.valid ? `${report.plugin}: valid` : `${report.plugin}: invalid`
5573
5938
  });
5939
+ ui.info(`Resources, imported of discovered: ${formatResourceCounts(report.resource_counts)}`);
5574
5940
  if (!report.valid) {
5575
5941
  process.exitCode = 1;
5576
5942
  }
5577
5943
  } catch (err) {
5578
- fail(err instanceof Error ? err.message : String(err));
5944
+ fail(
5945
+ err instanceof Error ? err.message : String(err),
5946
+ err instanceof LocalPluginSelectorError ? { hints: err.hints } : void 0
5947
+ );
5579
5948
  process.exitCode = 1;
5580
5949
  }
5581
5950
  }
@@ -5601,7 +5970,7 @@ async function handlePluginFromProjectCommand(name, opts) {
5601
5970
  fail(error instanceof Error ? error.message : String(error));
5602
5971
  return;
5603
5972
  }
5604
- const { previewPluginFromProject } = await import("./plugin-from-project-UV2O364T.js");
5973
+ const { previewPluginFromProject } = await import("./plugin-from-project-U5UGKTJH.js");
5605
5974
  const preview = await previewPluginFromProject({
5606
5975
  name: resolvedName,
5607
5976
  projectRoot,
@@ -5764,7 +6133,7 @@ async function handlePluginCreateCommand(name, opts) {
5764
6133
  if (harnesses) {
5765
6134
  assertSupportedHarnessTargets(harnesses);
5766
6135
  }
5767
- const resolvedPackage = resolveSkillPackageCheckout(opts.from, harnesstapDir);
6136
+ const resolvedPackage = await resolveSkillPackageCheckout(opts.from, harnesstapDir);
5768
6137
  const shouldPrompt = shouldUseWizard({
5769
6138
  noInteractive: opts.yes,
5770
6139
  interactive: opts.interactive,
@@ -5948,7 +6317,7 @@ function printPluginSearchResults(plugins, format) {
5948
6317
  rows: plugins.map((plugin) => ({
5949
6318
  name: plugin.name,
5950
6319
  ref: plugin.ref,
5951
- version: plugin.version ?? "",
6320
+ version: catalogPluginDisplayVersion(plugin) ?? "",
5952
6321
  description: plugin.description ?? ""
5953
6322
  })),
5954
6323
  summary: formatCount(plugins.length, "plugin"),
@@ -5984,7 +6353,7 @@ async function handlePluginSearchCommand(query, opts = {}) {
5984
6353
  format: opts.format
5985
6354
  });
5986
6355
  if (useBrowsePicker) {
5987
- const plugins2 = searchCatalogPlugins(harnesstapDir, query ?? "", {
6356
+ const plugins2 = await searchCatalogPlugins(harnesstapDir, query ?? "", {
5988
6357
  refresh: opts.refresh
5989
6358
  });
5990
6359
  if (plugins2.length === 0) {
@@ -5997,7 +6366,7 @@ async function handlePluginSearchCommand(query, opts = {}) {
5997
6366
  choices: plugins2.map((plugin) => ({
5998
6367
  name: plugin.description ? `${plugin.name}: ${plugin.description}` : plugin.name,
5999
6368
  value: plugin.ref,
6000
- description: plugin.version ? `v${plugin.version}` : void 0
6369
+ description: catalogPluginVersionLabel(plugin)
6001
6370
  }))
6002
6371
  });
6003
6372
  const pluginName = await resolveMarketplacePinPluginName(opts.plugin, true);
@@ -6015,7 +6384,7 @@ async function handlePluginSearchCommand(query, opts = {}) {
6015
6384
  await addMarketplacePluginPin(selectedRef, pluginName, format);
6016
6385
  return;
6017
6386
  }
6018
- const plugins = searchCatalogPlugins(harnesstapDir, query ?? "", {
6387
+ const plugins = await searchCatalogPlugins(harnesstapDir, query ?? "", {
6019
6388
  refresh: opts.refresh
6020
6389
  });
6021
6390
  printPluginSearchResults(plugins, format);
@@ -6042,6 +6411,27 @@ function handlePluginAddDependencyCommand(ref, opts = {}) {
6042
6411
  fail(`Plugin not found: ${targetName}`);
6043
6412
  return;
6044
6413
  }
6414
+ const parsedRef = parseDependencyRef(ref);
6415
+ const marketplace = parsedRef.source_kind === "marketplace" ? parsedRef.namespace : "";
6416
+ if (marketplace && !marketplaceIsKnown(marketplace, resolveHomeRoot())) {
6417
+ process.exitCode = 1;
6418
+ fail(`Marketplace ${marketplace} is not configured.`, {
6419
+ hint: `ht marketplace add <git-url> --name ${marketplace}`
6420
+ });
6421
+ return;
6422
+ }
6423
+ if (marketplace && marketplaceListsPlugin({
6424
+ homeRoot: resolveHomeRoot(),
6425
+ harnesstapDir: getHarnesstapDir(),
6426
+ marketplace,
6427
+ pluginName: parsedRef.name
6428
+ }) === false) {
6429
+ process.exitCode = 1;
6430
+ fail(`Plugin ${parsedRef.name} not found in marketplace ${marketplace}.`, {
6431
+ hint: `ht marketplace show ${marketplace}`
6432
+ });
6433
+ return;
6434
+ }
6045
6435
  addDependency(plugin.id, ref);
6046
6436
  const format = parseOutputFormat(opts.format);
6047
6437
  if (format === "json") {
@@ -6158,7 +6548,10 @@ function registerPluginCommands(root) {
6158
6548
  }
6159
6549
  handlePluginShowCommand(resolvedName, opts);
6160
6550
  });
6161
- pluginCmd.command("edit").argument("[name]", "Plugin name or ID").option("-t, --type <type>", `Attachment or filter type (${PLUGIN_ATTACHMENT_TYPES.join(", ")})`).option("-s, --search <query>", "Pre-fill search filter (interactive mode)").option("--show-id", "Show IDs in tables").option("--all", "Show all resources per type (default: first 10 per type)").option("--add <selector>", "Add attachment (repeatable; scripting mode)", collectRepeatedOption, []).option("--remove <selector>", "Remove attachment (repeatable; scripting mode)", collectRepeatedOption, []).option("--apply <file>", "Apply membership from JSON file (scripting mode)").option("--version <constraint>", "Version constraint for plugin or plugin attachments").option("--embed", "Mark plugin pin as embed-on-export when adding").option("--sync", "Sync plugin resource immediately after add").option("--environment <name>", "Set default environment for plugin apply cascade").option("--clear-environment", "Clear default environment from plugin").option("--profile", "Tag the plugin as a switchable profile").option("--no-profile", "Remove the profile tag from the plugin").option("--dry-run", "Preview changes without writing").option("--format <mode>", "Output format: human or json", "human").option("--interactive", "Prompt instead of relying on explicit flags").description("Edit plugin composition and default environment (interactive or scripting)").action(async (name, opts) => {
6551
+ pluginCmd.command("edit").argument("[name]", "Plugin name or ID").option("-t, --type <type>", `Attachment or filter type (${PLUGIN_ATTACHMENT_TYPES.join(", ")})`).option("-s, --search <query>", "Pre-fill search filter (interactive mode)").option("--show-id", "Show IDs in tables").option("--all", "Show all resources per type (default: first 10 per type)").option("--add <selector>", "Add attachment (repeatable; scripting mode)", collectRepeatedOption, []).option("--remove <selector>", "Remove attachment (repeatable; scripting mode)", collectRepeatedOption, []).option("--apply <file>", "Apply membership from JSON file (scripting mode)").option("--version <constraint>", "Version constraint for plugin or plugin attachments").option("--embed", "Mark plugin pin as embed-on-export when adding").option("--sync", "Sync plugin resource immediately after add").option("--environment <name>", "Set default environment for plugin apply cascade").option("--clear-environment", "Clear default environment from plugin").option("--profile", "Tag the plugin as a switchable profile").option("--no-profile", "Remove the profile tag from the plugin").option("--hide <entry>", "Hide an inherited item, e.g. skill:review or plugin:web-search (repeatable; keep-in-sync profiles)", collectRepeatedOption, []).option("--unhide <entry>", "Show a hidden inherited item again (repeatable)", collectRepeatedOption, []).option("--dry-run", "Preview changes without writing").option("--format <mode>", "Output format: human or json", "human").option("--interactive", "Prompt instead of relying on explicit flags").description("Edit plugin composition and default environment (interactive or scripting)").action(async (name, opts) => {
6552
+ if (handlePluginHideOptions(name, opts)) {
6553
+ return;
6554
+ }
6162
6555
  try {
6163
6556
  await handlePluginEditCommand(name, opts);
6164
6557
  } catch (error) {
@@ -6219,7 +6612,10 @@ function registerPluginCommands(root) {
6219
6612
  pluginCmd.command("add").argument(
6220
6613
  "<ref>",
6221
6614
  "GitHub plugin URL (owner/repo, gh:owner/repo, or https://github.com/owner/repo) to import into the library, or a dependency ref with --to"
6222
- ).option("--to <plugin>", "Plugin that receives the dependency (skips GitHub library import)").addOption(new Option2("--layer <plugin>", "Deprecated alias for --to").hideHelp()).option("--format <mode>", "Output format: human or json", "human").description(
6615
+ ).option("--to <plugin>", "Plugin that receives the dependency (skips GitHub library import)").addOption(new Option2("--layer <plugin>", "Deprecated alias for --to").hideHelp()).option(
6616
+ "--force-remove",
6617
+ "Back up and replace files in a host plugin cache folder that HarnessTap did not write"
6618
+ ).option("--format <mode>", "Output format: human or json", "human").description(
6223
6619
  "Import a GitHub plugin.json package into the library, or add a dependency to a plugin with --to"
6224
6620
  ).action(async (ref, opts) => {
6225
6621
  try {
@@ -6365,7 +6761,10 @@ function registerPluginCommands(root) {
6365
6761
  pluginPublishCmd.command("plan").argument("<plugin>", "Local plugin name").option("--account <name>", "Cloud account to use").option("--format <mode>", "Output format: human or json", "human").description("Dry-run publish targets for a local plugin").action(async (plugin, opts) => {
6366
6762
  await handlePluginPublishPlanCommand(plugin, opts);
6367
6763
  });
6368
- pluginPublishCmd.argument("<plugin>", "Local plugin name to publish").argument("[target]", "One-off org/catalog target").option("--org <slug>", "One-off organization slug").option("--catalog <slug>", "One-off catalog slug (default: default)").option("--version <semver>", "Cut the plugin to this semver before publishing").option("--account <name>", "Cloud account to use").option("--format <mode>", "Output format: human or json", "human").action((plugin, target, opts) => handlePluginPublishCommand(plugin, target, opts));
6764
+ pluginPublishCmd.argument("<plugin>", "Local plugin name to publish").argument("[target]", "One-off org/catalog target").option("--org <slug>", "One-off organization slug").option("--catalog <slug>", "One-off catalog slug (default: default)").option("--version <semver>", "Cut the plugin to this semver before publishing").option("--account <name>", "Cloud account to use").option("--format <mode>", "Output format: human or json", "human").option("--strict", "Block publish when Agent Plugins export warnings are present").option(
6765
+ "--vendor-extensions",
6766
+ "Also write com.github.copilot files and Codex hook settings"
6767
+ ).action((plugin, target, opts) => handlePluginPublishCommand(plugin, target, opts));
6369
6768
  pluginCmd.command("cut").argument("<plugin>", "Plugin name, name@version, or id").requiredOption("--version <semver>", "New version (must differ from current)").option("--format <mode>", "Output format: human or json", "human").description("Cut a new local version from the working head").action((plugin, opts) => {
6370
6769
  handlePluginCutCommand(plugin, opts);
6371
6770
  });
@@ -6379,6 +6778,7 @@ function registerPluginCommands(root) {
6379
6778
  );
6380
6779
  pluginCmd.command("diff").argument("<left>", "Plugin name or plugin export file").argument("<right>", "Plugin name or plugin export file").option("--format <mode>", "Output format: human or json", "human").description("Diff two plugins or a plugin and a plugin export file").action(handlePluginDiffCommand);
6381
6780
  pluginCmd.command("doctor").argument("[name]", "Plugin name or ID").option("--check <name>", "Run only the named check", (value, previous = []) => [...previous, value], []).option("--list-checks", "List available checks").option("--format <mode>", "Output format: human or json", "human").description("Run doctor checks against a plugin").action(handlePluginDoctorCommand);
6781
+ pluginCmd.command("validate").argument("<file>", "Plugin directory, .zip, or .ap.json envelope").option("--spec <version>", "Agent Plugins version to load as", "1.0.0").option("--format <mode>", "Output format: human or json", "human").description("Load an Agent Plugins package and report skills, MCP servers, and skipped entries").action(handlePluginValidateCommand);
6382
6782
  pluginCmd.command("validate-package", { hidden: true }).argument("<file>", "Package directory, .zip, or .ap.json envelope").option("--strict", "Require plugin.json $schema (publish and authoring rules)").option("--format <mode>", "Output format: human or json", "human").description("Validate an Agent Plugins package the same way catalog import does").action(handlePluginValidatePackageCommand);
6383
6783
  pluginCmd.command("check").argument("[name]", "Plugin name; omit to check every syncable working head").option("--refresh", "Force-fetch origins").option("--format <mode>", "Output format: human or json", "human").description("Compare library working heads to marketplace, git, and catalog origins").action(async (name, opts) => {
6384
6784
  try {
@@ -6400,6 +6800,14 @@ function registerPluginCommands(root) {
6400
6800
  renderCliError(error);
6401
6801
  }
6402
6802
  });
6803
+ pluginCmd.command("auto-update").option("--mode <mode>", "off, notify (default) or install (minor and patch in range, never a major)").option("--frequency <frequency>", "hourly, daily (default) or weekly").option("--format <mode>", "Output format: human or json", "human").description("Show or change how plugin updates are checked and installed").action(async (opts) => {
6804
+ try {
6805
+ await handlePluginAutoUpdateCommand(opts);
6806
+ } catch (error) {
6807
+ process.exitCode = 1;
6808
+ renderCliError(error);
6809
+ }
6810
+ });
6403
6811
  pluginCmd.command("why").argument("<target>", "Plugin name, or a resource key like skill:deploy").option("--project <path>", "Project directory", ".").option("--root <plugin>", "Resolve against this root instead of the lockfile root").option("--format <mode>", "Output format: human or json", "human").description("Explain why a version was selected or which plugin won a resource").action((target, opts) => {
6404
6812
  handlePluginWhyCommand(target, opts);
6405
6813
  });
@@ -6435,4 +6843,4 @@ export {
6435
6843
  registerPluginCommands,
6436
6844
  registerDeprecatedLayerAlias
6437
6845
  };
6438
- //# sourceMappingURL=chunk-6JMVGKMD.js.map
6846
+ //# sourceMappingURL=chunk-3Q72LZPJ.js.map