harnesstap 1.4.0 → 1.6.1

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 (211) hide show
  1. package/README.md +3 -1
  2. package/dist/apply-ZGEAY6YZ.js +50 -0
  3. package/dist/{approve-FBGYQGWN.js → approve-VPVMU2MM.js} +10 -13
  4. package/dist/{approve-FBGYQGWN.js.map → approve-VPVMU2MM.js.map} +1 -1
  5. package/dist/{audit-VI4QZ6X2.js → audit-AO7AGET3.js} +11 -15
  6. package/dist/{audit-VI4QZ6X2.js.map → audit-AO7AGET3.js.map} +1 -1
  7. package/dist/{auth-4CQCDS2W.js → auth-7YRIJNXU.js} +10 -12
  8. package/dist/{auth-4CQCDS2W.js.map → auth-7YRIJNXU.js.map} +1 -1
  9. package/dist/bin.js +13 -34
  10. package/dist/bin.js.map +1 -1
  11. package/dist/{chunk-OML4HXKT.js → chunk-262KZULH.js} +16 -22
  12. package/dist/chunk-262KZULH.js.map +1 -0
  13. package/dist/{chunk-ZUASVASP.js → chunk-26QGX47N.js} +26097 -16881
  14. package/dist/chunk-26QGX47N.js.map +1 -0
  15. package/dist/{chunk-3P6BWL5F.js → chunk-27IPOVKQ.js} +2 -2
  16. package/dist/{chunk-M4KLHJ6U.js → chunk-2BESDRYP.js} +8 -10
  17. package/dist/{chunk-M4KLHJ6U.js.map → chunk-2BESDRYP.js.map} +1 -1
  18. package/dist/{chunk-PCMON7Y2.js → chunk-2BWIEB2G.js} +8 -10
  19. package/dist/{chunk-PCMON7Y2.js.map → chunk-2BWIEB2G.js.map} +1 -1
  20. package/dist/{chunk-XTVGCVU4.js → chunk-2NMLWSUH.js} +41 -42
  21. package/dist/chunk-2NMLWSUH.js.map +1 -0
  22. package/dist/{chunk-TQ2NA4Z4.js → chunk-4E3G4H5B.js} +8 -2
  23. package/dist/chunk-4E3G4H5B.js.map +1 -0
  24. package/dist/chunk-4QCGTUTM.js +61 -0
  25. package/dist/chunk-4QCGTUTM.js.map +1 -0
  26. package/dist/{chunk-TPEJFLV7.js → chunk-6RKJZW2N.js} +4 -6
  27. package/dist/{chunk-TPEJFLV7.js.map → chunk-6RKJZW2N.js.map} +1 -1
  28. package/dist/{chunk-JQOKQKQT.js → chunk-7IBFH736.js} +2 -2
  29. package/dist/{chunk-P2C7JPLD.js → chunk-CKJIS2FM.js} +6 -6
  30. package/dist/{chunk-R7ZOYVN3.js → chunk-CUOEQQFI.js} +187 -59
  31. package/dist/chunk-CUOEQQFI.js.map +1 -0
  32. package/dist/{chunk-REHRUNBB.js → chunk-CWXCZBJR.js} +70 -5
  33. package/dist/chunk-CWXCZBJR.js.map +1 -0
  34. package/dist/{chunk-4ZQ2SCGY.js → chunk-FLYQEB6D.js} +509 -207
  35. package/dist/chunk-FLYQEB6D.js.map +1 -0
  36. package/dist/{chunk-U6DXASQP.js → chunk-HC7IZY75.js} +2 -2
  37. package/dist/{chunk-UVVZHWD2.js → chunk-I4DKV63E.js} +2 -2
  38. package/dist/{chunk-PNGF5EV2.js → chunk-JEC5PWNH.js} +2 -2
  39. package/dist/{chunk-MR7IOHSX.js → chunk-KFIRABC7.js} +16 -22
  40. package/dist/{chunk-MR7IOHSX.js.map → chunk-KFIRABC7.js.map} +1 -1
  41. package/dist/{chunk-6LTLYV5D.js → chunk-LGWFLVZQ.js} +1064 -265
  42. package/dist/chunk-LGWFLVZQ.js.map +1 -0
  43. package/dist/{chunk-RDG5DT7S.js → chunk-LX6PMOOC.js} +54 -40
  44. package/dist/chunk-LX6PMOOC.js.map +1 -0
  45. package/dist/{chunk-WGP4GUYZ.js → chunk-MILGCNBK.js} +9 -11
  46. package/dist/{chunk-WGP4GUYZ.js.map → chunk-MILGCNBK.js.map} +1 -1
  47. package/dist/chunk-MKLJBW5N.js +14 -0
  48. package/dist/{chunk-N3ZCH64F.js → chunk-MSKTWYHG.js} +86 -32
  49. package/dist/chunk-MSKTWYHG.js.map +1 -0
  50. package/dist/{chunk-WG5A6EAU.js → chunk-MTCCUYBZ.js} +821 -28
  51. package/dist/chunk-MTCCUYBZ.js.map +1 -0
  52. package/dist/{chunk-BPWFQKI5.js → chunk-NIFKCS7J.js} +2 -2
  53. package/dist/{chunk-43BDGVN3.js → chunk-NWOYPK2O.js} +56 -9
  54. package/dist/chunk-NWOYPK2O.js.map +1 -0
  55. package/dist/{chunk-3FS775NP.js → chunk-NXILQDJG.js} +85 -4
  56. package/dist/chunk-NXILQDJG.js.map +1 -0
  57. package/dist/chunk-QF73VLAW.js +31673 -0
  58. package/dist/chunk-QF73VLAW.js.map +1 -0
  59. package/dist/{chunk-RFQ3N7FB.js → chunk-QHCGA6LC.js} +11 -19
  60. package/dist/chunk-QHCGA6LC.js.map +1 -0
  61. package/dist/{chunk-L6YZE5MY.js → chunk-QPJZKWML.js} +5 -7
  62. package/dist/{chunk-L6YZE5MY.js.map → chunk-QPJZKWML.js.map} +1 -1
  63. package/dist/{chunk-ULCD6DJE.js → chunk-RM7VP6ID.js} +24 -61
  64. package/dist/chunk-RM7VP6ID.js.map +1 -0
  65. package/dist/{chunk-7HP6AAI3.js → chunk-SMLO5YPI.js} +2 -2
  66. package/dist/{chunk-73OJQTBW.js → chunk-T2JBSRGG.js} +2 -2
  67. package/dist/{chunk-IE7B6Q5K.js → chunk-U5Y6WKKT.js} +17 -18
  68. package/dist/chunk-U5Y6WKKT.js.map +1 -0
  69. package/dist/chunk-UEA4NCY2.js +106 -0
  70. package/dist/chunk-UEA4NCY2.js.map +1 -0
  71. package/dist/chunk-VAPCU2FX.js +70 -0
  72. package/dist/chunk-VAPCU2FX.js.map +1 -0
  73. package/dist/{chunk-RVEXPMM3.js → chunk-WEJVFNRO.js} +3 -5
  74. package/dist/{chunk-RVEXPMM3.js.map → chunk-WEJVFNRO.js.map} +1 -1
  75. package/dist/{chunk-IMROMZ2K.js → chunk-WWFVMCTR.js} +19 -14
  76. package/dist/chunk-WWFVMCTR.js.map +1 -0
  77. package/dist/chunk-XPONNOBR.js +102 -0
  78. package/dist/chunk-XPONNOBR.js.map +1 -0
  79. package/dist/{chunk-N3VGY3T3.js → chunk-Y3HJ2F2W.js} +7 -5
  80. package/dist/{chunk-N3VGY3T3.js.map → chunk-Y3HJ2F2W.js.map} +1 -1
  81. package/dist/{chunk-2A36HWDE.js → chunk-Y4I7ZCAE.js} +129 -136
  82. package/dist/chunk-Y4I7ZCAE.js.map +1 -0
  83. package/dist/{chunk-GRASK6M6.js → chunk-ZREU2UHM.js} +5 -5
  84. package/dist/{chunk-QA5U36JN.js → chunk-ZT7ANP3H.js} +774 -364
  85. package/dist/chunk-ZT7ANP3H.js.map +1 -0
  86. package/dist/{chunk-EOPFER6N.js → chunk-ZUXFPAVX.js} +19 -5
  87. package/dist/chunk-ZUXFPAVX.js.map +1 -0
  88. package/dist/{chunk-D432JAXV.js → chunk-ZWB6YXVQ.js} +153 -25
  89. package/dist/chunk-ZWB6YXVQ.js.map +1 -0
  90. package/dist/{chunk-23XSG7LI.js → chunk-ZZQDJGWX.js} +4 -4
  91. package/dist/{compile-GXADKGH5.js → compile-IMJHVXQO.js} +33 -37
  92. package/dist/{compile-GXADKGH5.js.map → compile-IMJHVXQO.js.map} +1 -1
  93. package/dist/{config-JMHNA2U5.js → config-FVVN3NWL.js} +16 -21
  94. package/dist/{config-JMHNA2U5.js.map → config-FVVN3NWL.js.map} +1 -1
  95. package/dist/cursor-local-install-JS5KSOES.js +94 -0
  96. package/dist/{cursor-local-install-46RWRBDT.js.map → cursor-local-install-JS5KSOES.js.map} +1 -1
  97. package/dist/{cursor-local-install-46RWRBDT.js → cursor-local-install-QU5R2FV5.js} +8 -12
  98. package/dist/cursor-local-install-QU5R2FV5.js.map +1 -0
  99. package/dist/{doctor-N7ZULPOL.js → doctor-A7VUJSCP.js} +14 -17
  100. package/dist/doctor-A7VUJSCP.js.map +1 -0
  101. package/dist/{environment-OBB3WU5B.js → environment-6INIUBNC.js} +42 -50
  102. package/dist/environment-6INIUBNC.js.map +1 -0
  103. package/dist/{github-PBYBGOLH.js → github-TFJT3P53.js} +9 -10
  104. package/dist/{github-PBYBGOLH.js.map → github-TFJT3P53.js.map} +1 -1
  105. package/dist/{harness-7KYATIV6.js → harness-WQNC5HPZ.js} +46 -84
  106. package/dist/harness-WQNC5HPZ.js.map +1 -0
  107. package/dist/{help-EE3AJQD4.js → help-NMS3EXJB.js} +15 -20
  108. package/dist/{help-EE3AJQD4.js.map → help-NMS3EXJB.js.map} +1 -1
  109. package/dist/{help-VXWKLQ6A.js → help-VW4RIICD.js} +57 -575
  110. package/dist/help-VW4RIICD.js.map +1 -0
  111. package/dist/host-plugin-view-kept-HYCHDB4D.js +139 -0
  112. package/dist/host-plugin-view-kept-HYCHDB4D.js.map +1 -0
  113. package/dist/index.js +12 -16
  114. package/dist/{init-LBTMPDVJ.js → init-RXYL5ZUE.js} +33 -41
  115. package/dist/{init-LBTMPDVJ.js.map → init-RXYL5ZUE.js.map} +1 -1
  116. package/dist/live-read-cache-BHU6L7MA.js +13 -0
  117. package/dist/live-read-cache-NQU7M2C7.js +12 -0
  118. package/dist/{lock-WLJRXRVK.js → lock-3H3Z65DS.js} +9 -12
  119. package/dist/{lock-WLJRXRVK.js.map → lock-3H3Z65DS.js.map} +1 -1
  120. package/dist/{marketplace-GXSV6QIY.js → marketplace-KW35PJCY.js} +26 -79
  121. package/dist/marketplace-KW35PJCY.js.map +1 -0
  122. package/dist/{mcp-XPDWWU75.js → mcp-2HUGVDJ5.js} +33 -37
  123. package/dist/{mcp-XPDWWU75.js.map → mcp-2HUGVDJ5.js.map} +1 -1
  124. package/dist/{migrate-SBUIWN3U.js → migrate-6VAPYNXI.js} +93 -34
  125. package/dist/migrate-6VAPYNXI.js.map +1 -0
  126. package/dist/notifications-Y7KQCN6K.js +154 -0
  127. package/dist/notifications-Y7KQCN6K.js.map +1 -0
  128. package/dist/open-FADABB2S.js +20 -0
  129. package/dist/{pack-A73LDVOX.js → pack-NTECD3BZ.js} +10 -14
  130. package/dist/{pack-A73LDVOX.js.map → pack-NTECD3BZ.js.map} +1 -1
  131. package/dist/plugin-T2YFCYIO.js +47 -0
  132. package/dist/plugin-from-project-FGX5AHW6.js +15 -0
  133. package/dist/{policy-6VY3CMSU.js → policy-3FOWB4GR.js} +9 -12
  134. package/dist/{policy-6VY3CMSU.js.map → policy-3FOWB4GR.js.map} +1 -1
  135. package/dist/{profile-YCKPMRRU.js → profile-HM3ROXXB.js} +108 -78
  136. package/dist/profile-HM3ROXXB.js.map +1 -0
  137. package/dist/{project-KHPPBKPN.js → project-3DTXKMI6.js} +512 -119
  138. package/dist/project-3DTXKMI6.js.map +1 -0
  139. package/dist/{resource-IJU3FAN5.js → resource-TZDZAVZ6.js} +55 -45
  140. package/dist/resource-TZDZAVZ6.js.map +1 -0
  141. package/dist/status-refresh-worker.js +1155 -0
  142. package/dist/status-refresh-worker.js.map +1 -0
  143. package/dist/{version-Z66FWWMQ.js → version-AMZJHJIB.js} +3 -3
  144. package/dist/version-AMZJHJIB.js.map +1 -0
  145. package/package.json +16 -11
  146. package/dist/apply-SUNDXRJ3.js +0 -54
  147. package/dist/chunk-2A36HWDE.js.map +0 -1
  148. package/dist/chunk-2H7UOFLK.js +0 -11
  149. package/dist/chunk-3FS775NP.js.map +0 -1
  150. package/dist/chunk-43BDGVN3.js.map +0 -1
  151. package/dist/chunk-4ZQ2SCGY.js.map +0 -1
  152. package/dist/chunk-6LTLYV5D.js.map +0 -1
  153. package/dist/chunk-D432JAXV.js.map +0 -1
  154. package/dist/chunk-DF4Z7LAD.js +0 -3463
  155. package/dist/chunk-DF4Z7LAD.js.map +0 -1
  156. package/dist/chunk-EOPFER6N.js.map +0 -1
  157. package/dist/chunk-G6WKY2W4.js +0 -389
  158. package/dist/chunk-G6WKY2W4.js.map +0 -1
  159. package/dist/chunk-IE7B6Q5K.js.map +0 -1
  160. package/dist/chunk-IMROMZ2K.js.map +0 -1
  161. package/dist/chunk-M2U3J7UX.js +0 -46
  162. package/dist/chunk-M2U3J7UX.js.map +0 -1
  163. package/dist/chunk-N3ZCH64F.js.map +0 -1
  164. package/dist/chunk-NAGAJ5UM.js +0 -145
  165. package/dist/chunk-NAGAJ5UM.js.map +0 -1
  166. package/dist/chunk-OML4HXKT.js.map +0 -1
  167. package/dist/chunk-QA5U36JN.js.map +0 -1
  168. package/dist/chunk-R7ZOYVN3.js.map +0 -1
  169. package/dist/chunk-RDG5DT7S.js.map +0 -1
  170. package/dist/chunk-REHRUNBB.js.map +0 -1
  171. package/dist/chunk-RFQ3N7FB.js.map +0 -1
  172. package/dist/chunk-TQ2NA4Z4.js.map +0 -1
  173. package/dist/chunk-ULCD6DJE.js.map +0 -1
  174. package/dist/chunk-WG5A6EAU.js.map +0 -1
  175. package/dist/chunk-XGTTOO4R.js +0 -84
  176. package/dist/chunk-XGTTOO4R.js.map +0 -1
  177. package/dist/chunk-XTVGCVU4.js.map +0 -1
  178. package/dist/chunk-XUJKZQZA.js +0 -235
  179. package/dist/chunk-XUJKZQZA.js.map +0 -1
  180. package/dist/chunk-ZUASVASP.js.map +0 -1
  181. package/dist/doctor-N7ZULPOL.js.map +0 -1
  182. package/dist/environment-OBB3WU5B.js.map +0 -1
  183. package/dist/harness-7KYATIV6.js.map +0 -1
  184. package/dist/help-VXWKLQ6A.js.map +0 -1
  185. package/dist/live-read-cache-TUSP7U3D.js +0 -10
  186. package/dist/marketplace-GXSV6QIY.js.map +0 -1
  187. package/dist/migrate-SBUIWN3U.js.map +0 -1
  188. package/dist/open-HDGLYYVU.js +0 -24
  189. package/dist/plugin-CEO6ZJM5.js +0 -51
  190. package/dist/plugin-from-project-UK7VJVUP.js +0 -18
  191. package/dist/profile-YCKPMRRU.js.map +0 -1
  192. package/dist/project-KHPPBKPN.js.map +0 -1
  193. package/dist/resource-IJU3FAN5.js.map +0 -1
  194. /package/dist/{apply-SUNDXRJ3.js.map → apply-ZGEAY6YZ.js.map} +0 -0
  195. /package/dist/{chunk-3P6BWL5F.js.map → chunk-27IPOVKQ.js.map} +0 -0
  196. /package/dist/{chunk-JQOKQKQT.js.map → chunk-7IBFH736.js.map} +0 -0
  197. /package/dist/{chunk-P2C7JPLD.js.map → chunk-CKJIS2FM.js.map} +0 -0
  198. /package/dist/{chunk-U6DXASQP.js.map → chunk-HC7IZY75.js.map} +0 -0
  199. /package/dist/{chunk-UVVZHWD2.js.map → chunk-I4DKV63E.js.map} +0 -0
  200. /package/dist/{chunk-PNGF5EV2.js.map → chunk-JEC5PWNH.js.map} +0 -0
  201. /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
  202. /package/dist/{chunk-BPWFQKI5.js.map → chunk-NIFKCS7J.js.map} +0 -0
  203. /package/dist/{chunk-7HP6AAI3.js.map → chunk-SMLO5YPI.js.map} +0 -0
  204. /package/dist/{chunk-73OJQTBW.js.map → chunk-T2JBSRGG.js.map} +0 -0
  205. /package/dist/{chunk-GRASK6M6.js.map → chunk-ZREU2UHM.js.map} +0 -0
  206. /package/dist/{chunk-23XSG7LI.js.map → chunk-ZZQDJGWX.js.map} +0 -0
  207. /package/dist/{live-read-cache-TUSP7U3D.js.map → live-read-cache-BHU6L7MA.js.map} +0 -0
  208. /package/dist/{open-HDGLYYVU.js.map → live-read-cache-NQU7M2C7.js.map} +0 -0
  209. /package/dist/{plugin-CEO6ZJM5.js.map → open-FADABB2S.js.map} +0 -0
  210. /package/dist/{plugin-from-project-UK7VJVUP.js.map → plugin-T2YFCYIO.js.map} +0 -0
  211. /package/dist/{version-Z66FWWMQ.js.map → plugin-from-project-FGX5AHW6.js.map} +0 -0
@@ -1,6 +1,4 @@
1
1
  import {
2
- PluginAmbiguityError,
3
- PluginResolveError,
4
2
  configurePluginListInteractiveDeps,
5
3
  createPluginFromSource,
6
4
  deleteCatalogPlugin,
@@ -9,16 +7,16 @@ import {
9
7
  handlePluginCatalogRegisterCommand,
10
8
  handlePluginCatalogRegisteredCommand,
11
9
  handlePluginCatalogUnregisterCommand,
10
+ handlePluginHideOptions,
12
11
  handlePluginInstallCommand,
13
12
  handlePluginListCommand,
14
13
  handlePluginPublishCommand,
15
14
  handlePluginPublishPlanCommand,
16
15
  handlePluginShowCommand,
17
- isPluginUrl,
18
16
  resolveApplyPluginSource,
19
17
  resolveCatalogSearchProjectRoot,
20
18
  runPluginCreateFromSourceWizard
21
- } from "./chunk-4ZQ2SCGY.js";
19
+ } from "./chunk-FLYQEB6D.js";
22
20
  import {
23
21
  importProjectConfigEnvironments,
24
22
  printApplyDryRun,
@@ -29,22 +27,28 @@ import {
29
27
  resolveExpectedPluginName,
30
28
  resolveProjectProfilePluginName,
31
29
  resolveUserPath
32
- } from "./chunk-R7ZOYVN3.js";
30
+ } from "./chunk-CUOEQQFI.js";
33
31
  import {
34
32
  isPluginAttachmentOnlyType,
33
+ marketplaceIsKnown,
35
34
  renderResourceShow,
36
35
  resolveResourceListType
37
- } from "./chunk-D432JAXV.js";
36
+ } from "./chunk-ZWB6YXVQ.js";
38
37
  import {
39
38
  createLocalPluginPickAdapter,
40
39
  resolvePluginMutationTarget
41
- } from "./chunk-MR7IOHSX.js";
40
+ } from "./chunk-KFIRABC7.js";
42
41
  import {
43
42
  resolveSkillPackageCheckout
44
- } from "./chunk-OML4HXKT.js";
43
+ } from "./chunk-262KZULH.js";
45
44
  import {
46
45
  readDeclaredLicense
47
46
  } from "./chunk-CHQGE2HF.js";
47
+ import {
48
+ diagnoseParsedPackage,
49
+ formatResourceCounts,
50
+ formatSkippedEntry
51
+ } from "./chunk-4QCGTUTM.js";
48
52
  import {
49
53
  filterPluginEditRowsBySearch,
50
54
  formatResourceSelectionLabel,
@@ -53,19 +57,19 @@ import {
53
57
  renderGroupedPluginEditViewport,
54
58
  sortResourcesByUpdatedAt,
55
59
  toResourceListRows
56
- } from "./chunk-ULCD6DJE.js";
60
+ } from "./chunk-RM7VP6ID.js";
57
61
  import {
58
62
  openPathInSystemEditor
59
- } from "./chunk-N3VGY3T3.js";
63
+ } from "./chunk-Y3HJ2F2W.js";
60
64
  import {
61
65
  validatePluginDependencyGraph
62
- } from "./chunk-PNGF5EV2.js";
66
+ } from "./chunk-JEC5PWNH.js";
63
67
  import {
64
68
  createTableBrowserPrompt
65
- } from "./chunk-P2C7JPLD.js";
69
+ } from "./chunk-CKJIS2FM.js";
66
70
  import {
67
71
  toPluginChoices
68
- } from "./chunk-3P6BWL5F.js";
72
+ } from "./chunk-27IPOVKQ.js";
69
73
  import {
70
74
  matchesListSearchQuery,
71
75
  parseListSearchQuery
@@ -78,37 +82,32 @@ import {
78
82
  } from "./chunk-3FIWOI3H.js";
79
83
  import {
80
84
  renderCliError
81
- } from "./chunk-RDG5DT7S.js";
82
- import {
83
- isPromptCancellationError,
84
- promptForChoice,
85
- promptForConfirmation,
86
- promptForSearchableChoice,
87
- promptForValue,
88
- shouldUseBrowsePicker,
89
- shouldUseWizard
90
- } from "./chunk-NAGAJ5UM.js";
85
+ } from "./chunk-LX6PMOOC.js";
91
86
  import {
92
87
  initializeSchema
93
- } from "./chunk-3FS775NP.js";
88
+ } from "./chunk-NXILQDJG.js";
94
89
  import {
95
90
  configureCommandGroup
96
- } from "./chunk-43BDGVN3.js";
91
+ } from "./chunk-NWOYPK2O.js";
97
92
  import {
98
- createPluginFromProject
99
- } from "./chunk-BPWFQKI5.js";
93
+ handlePluginAutoUpdateCommand,
94
+ maybePromptKeepUpToDate
95
+ } from "./chunk-XPONNOBR.js";
100
96
  import {
101
97
  formatPluginLabel
102
98
  } from "./chunk-I6XFZLTJ.js";
99
+ import {
100
+ createPluginFromProject
101
+ } from "./chunk-NIFKCS7J.js";
103
102
  import {
104
103
  applyExecutableTrustGate,
105
104
  formatApproveRemedy,
106
105
  overlappingDeployedHashes
107
- } from "./chunk-23XSG7LI.js";
106
+ } from "./chunk-ZZQDJGWX.js";
108
107
  import {
109
108
  parseOutputFormat,
110
109
  printJson
111
- } from "./chunk-TQ2NA4Z4.js";
110
+ } from "./chunk-4E3G4H5B.js";
112
111
  import {
113
112
  ON_CONFLICT_APPLY_HELP,
114
113
  ON_CONFLICT_PLUGIN_IMPORT_HELP,
@@ -118,20 +117,25 @@ import {
118
117
  formatCommand,
119
118
  parseOnConflict,
120
119
  toPluginImportOnConflict
121
- } from "./chunk-RFQ3N7FB.js";
120
+ } from "./chunk-QHCGA6LC.js";
122
121
  import {
123
122
  APM_MANIFEST_FILENAME,
124
123
  ApmGitResolveError,
125
124
  BundleSymlinkError,
126
125
  CatalogDependencyVersionError,
127
126
  CriticalUnicodeError,
127
+ InvalidGitDependencyConstraintError,
128
+ LocalPluginSelectorError,
128
129
  LockIntegrityError,
129
130
  MATERIAL_RESOURCE_TYPES,
130
131
  PLUGIN_ATTACHMENT_TYPES,
131
132
  PROFILE_PLUGIN_TAG,
132
133
  PinnedPluginInstallConsentError,
134
+ PluginAmbiguityError,
133
135
  PluginAttachmentHintError,
136
+ PluginForkError,
134
137
  PluginProvenanceError,
138
+ PluginResolveError,
135
139
  PluginVersionError,
136
140
  PolicyError,
137
141
  RESOURCE_TYPES,
@@ -142,6 +146,7 @@ import {
142
146
  addPluginAttachment,
143
147
  addResourceToPlugin,
144
148
  applyCheckedPluginOrigin,
149
+ applyConfiguredPluginToProject,
145
150
  assertAuthored,
146
151
  assertCheckoutPathSafe,
147
152
  assertContainedPath,
@@ -158,25 +163,32 @@ import {
158
163
  collectPluginPinsForPrepare,
159
164
  collectSkillMdFiles,
160
165
  createPlugin,
166
+ createSnapshot,
161
167
  cutPluginVersion,
162
168
  deletePlugin,
163
169
  dependenciesFromResources,
164
170
  describeConflictSide,
165
171
  detectPlatforms,
172
+ displayConstraint,
166
173
  ensureClaudeMarketplacesFromConfig,
167
174
  ensureCursorMarketplaces,
168
175
  ensureMissingCatalogDependencies,
169
176
  ensurePluginClaudeMarketplace,
170
177
  ensurePluginResource,
178
+ ensureProjectForRoot,
171
179
  evaluateApplyPolicy,
172
180
  fetchCatalogPlugin,
173
- findPluginResourceByPin,
181
+ findLocalPluginBySelector,
174
182
  findProjectConfig,
183
+ findProjectForRoot,
184
+ forkPlugin,
175
185
  formatOriginLocator,
176
186
  formatPluginRollbackConfirmMessage,
177
187
  formatPluginVersionLabel,
178
188
  gateDeployFiles,
179
189
  generateFiles,
190
+ getActiveProfileName,
191
+ getGitOrigin,
180
192
  getPlugin,
181
193
  getPluginById,
182
194
  getPluginByName,
@@ -184,16 +196,21 @@ import {
184
196
  getPluginResources,
185
197
  getProfileEntry,
186
198
  getProjectHarnessConfig,
199
+ gitFetchRefForPin,
187
200
  gitOriginCacheDir,
188
201
  hashResourceBody,
189
202
  importApPackageFiles,
190
- ingestHostPluginTreeIntoCache,
203
+ importPluginFromGitHubRef,
191
204
  installPluginFromCatalog,
192
205
  installPluginPinAsync,
193
206
  isApEnvelopePath,
194
207
  isApmVirtualFilePath,
208
+ isCatalogUpstreamRef,
195
209
  isFilesystemApmDependency,
210
+ isGitHubPluginRef,
211
+ isPendingUpdate,
196
212
  isPluginInstallRoot,
213
+ isPluginUrl,
197
214
  isProfilePlugin,
198
215
  listAttachedPluginPins,
199
216
  listAttachedPluginRefs,
@@ -209,9 +226,11 @@ import {
209
226
  lockIsUsable,
210
227
  lockedVersionsFrom,
211
228
  lockfileFromResolution,
229
+ marketplaceListsPlugin,
212
230
  materializeFiles,
213
231
  mergePluginsById,
214
232
  normalizeResourceInput,
233
+ notifySafely,
215
234
  originApplyFailureRow,
216
235
  originFailRow,
217
236
  originSkipRow,
@@ -219,21 +238,25 @@ import {
219
238
  parseApPackageFiles,
220
239
  parseApmYamlDocument,
221
240
  parseDependencyRef,
241
+ parseGitDependencyConstraint,
222
242
  parsePluginRef,
223
243
  parseVersionConstraint,
224
244
  persistPluginSourceScanResults,
225
245
  persistWrittenMaterializations,
226
- pluginDescriptionFromManifest,
227
246
  preparePluginPinsForApply,
228
247
  printUnicodeGateWarnings,
248
+ readContainedPackageFiles,
229
249
  readLockfile,
230
250
  readPackageRuntimeApmDependencies,
251
+ readUpstreamChecks,
252
+ recordedPluginInstallRoot,
231
253
  recoverOriginLocator,
232
254
  removeDependency,
233
255
  removePluginAttachment,
234
256
  removeResourceFromPlugin,
235
257
  removeStaleProjectDeployedFiles,
236
258
  resolveAndFetchApmGitDependency,
259
+ resolveClaudeEnabledPluginRef,
237
260
  resolveCompileTargets,
238
261
  resolveComposition,
239
262
  resolveDefaultPluginInstallScope,
@@ -242,11 +265,11 @@ import {
242
265
  resolvePluginInstallScope,
243
266
  resolvePluginPackageRoot,
244
267
  resolvePluginSelector,
268
+ resolveUpstreamParent,
245
269
  rollbackPluginVersion,
246
270
  scanPluginSource,
247
271
  scanPluginSourceSync,
248
272
  selectOriginUpdateTarget,
249
- semverSafePluginVersion,
250
273
  setPluginEnvironmentCommand,
251
274
  setPluginOrigin,
252
275
  setPluginResourceOrder,
@@ -256,6 +279,7 @@ import {
256
279
  skillPlacementsFromPaths,
257
280
  slugifyApName,
258
281
  stampPluginOrigin,
282
+ substituteResourcesForApply,
259
283
  summarizeOriginUpdate,
260
284
  syncClaudeMarketplacePluginsAfterAdd,
261
285
  syncPluginPinsForApply,
@@ -263,8 +287,9 @@ import {
263
287
  touchPluginUpdatedAt,
264
288
  uniqueHarnessTargets,
265
289
  unsetPluginEnvironmentCommand,
266
- updatePluginDescription,
267
290
  upsertResource,
291
+ upstreamRange,
292
+ upstreamRefBase,
268
293
  validateApManifest,
269
294
  validatePluginAttachmentType,
270
295
  validatePublicOrgHasPlugins,
@@ -273,19 +298,33 @@ import {
273
298
  writeApEnvelope,
274
299
  writeApPackageFiles,
275
300
  writeLockfile
276
- } from "./chunk-ZUASVASP.js";
301
+ } from "./chunk-26QGX47N.js";
277
302
  import {
278
- listMarketplaces,
303
+ catalogPluginDisplayVersion,
304
+ catalogPluginVersionLabel,
305
+ findKnownMarketplace,
306
+ isPromptCancellationError,
279
307
  marketplaceCacheDir,
308
+ parseFrontmatter,
309
+ promptForChoice,
310
+ promptForConfirmation,
311
+ promptForSearchableChoice,
312
+ promptForValue,
313
+ refreshGitSource,
280
314
  refreshMarketplaceCatalog,
281
- searchCatalogPlugins
282
- } from "./chunk-6LTLYV5D.js";
315
+ resolveHomeRoot,
316
+ searchCatalogPlugins,
317
+ shouldUseBrowsePicker,
318
+ shouldUseWizard
319
+ } from "./chunk-LGWFLVZQ.js";
283
320
  import {
284
321
  DEFAULT_CATALOG_ORG_SLUG,
322
+ cloudFetch,
285
323
  connectCatalogOrg,
286
324
  connectCatalogPlugin,
287
325
  disconnectCatalogOrg,
288
326
  disconnectCatalogPlugin,
327
+ ensureCloudAccountAccess,
289
328
  formatCatalogScopeLabel,
290
329
  loadCatalogSettings,
291
330
  loadRegisteredCatalogs,
@@ -293,97 +332,69 @@ import {
293
332
  resolveRemotePluginSelector,
294
333
  trackPluginApplied,
295
334
  trackPluginInstalled
296
- } from "./chunk-N3ZCH64F.js";
297
- import {
298
- CliUsageError,
299
- conflictingOptions,
300
- createProgress,
301
- missingRequiredArg,
302
- theme,
303
- ui
304
- } from "./chunk-2A36HWDE.js";
305
- import {
306
- applyConfiguredPluginToProject,
307
- createSnapshot,
308
- getActiveProfileName,
309
- getGitOrigin,
310
- getProjectByOrigin,
311
- normalizeGitUrl,
312
- projectNameFromUrl,
313
- resolveClaudeEnabledPluginRef,
314
- resolveHomeRoot,
315
- substituteResourcesForApply,
316
- upsertProject
317
- } from "./chunk-DF4Z7LAD.js";
318
- import {
319
- refreshGitSource
320
- } from "./chunk-G6WKY2W4.js";
335
+ } from "./chunk-MSKTWYHG.js";
321
336
  import {
322
337
  CLI_ERRORS,
323
338
  CLI_HINTS,
339
+ CliUsageError,
324
340
  applyCancelledMessage,
341
+ conflictingOptions,
342
+ createProgress,
325
343
  fetchWithTimeout,
326
344
  formatCatalogRequestError,
327
345
  formatCount,
328
346
  getDb,
329
- getHarnesstapDir
330
- } from "./chunk-WG5A6EAU.js";
347
+ getHarnesstapDir,
348
+ missingRequiredArg,
349
+ theme,
350
+ ui
351
+ } from "./chunk-MTCCUYBZ.js";
331
352
 
332
353
  // src/cli/commands/plugin.ts
333
354
  import { Option as Option2 } from "commander";
334
- import { readFileSync as readFileSync2 } from "fs";
355
+ import { readFileSync as readFileSync4 } from "fs";
335
356
 
336
357
  // src/cli/handlers/plugin-fork.ts
337
358
  function handlePluginForkCommand(selector, opts = {}) {
338
359
  const db = getDb();
339
360
  initializeSchema(db);
340
361
  const format = parseOutputFormat(opts.format);
341
- const source = resolvePluginSelector(selector);
342
- if (!source) {
343
- process.exitCode = 1;
344
- ui.danger(`Plugin not found: ${selector}`);
345
- return;
346
- }
347
- if (getPluginOrigin(source.id) === "authored") {
348
- process.exitCode = 1;
349
- ui.danger(`${source.name} is already authored; there is nothing to fork.`, {
350
- hints: [`ht plugin edit ${source.name}`]
351
- });
352
- return;
353
- }
354
- const name = opts.as ?? `${source.name}-fork`;
355
- if (getPluginByName(name)) {
362
+ let result;
363
+ try {
364
+ result = forkPlugin(selector, opts.as);
365
+ } catch (error) {
356
366
  process.exitCode = 1;
357
- ui.danger(`Plugin ${name} already exists.`, {
358
- hints: [`ht plugin fork ${source.name} --as <name>`]
359
- });
367
+ if (error instanceof PluginForkError) {
368
+ const sourceName = error.sourceName ?? selector;
369
+ if (error.code === "already_authored") {
370
+ ui.danger(error.message, { hints: [formatCommand(["plugin", "edit", sourceName])] });
371
+ return;
372
+ }
373
+ if (error.code === "plugin_exists") {
374
+ ui.danger(error.message, {
375
+ hints: [`${formatCommand(["plugin", "fork", sourceName])} --as <name>`]
376
+ });
377
+ return;
378
+ }
379
+ }
380
+ ui.danger(error instanceof Error ? error.message : String(error));
360
381
  return;
361
382
  }
362
- const fork = createPlugin({
363
- name,
364
- version: source.version,
365
- description: source.description || `Fork of ${source.name}@${source.version}`,
366
- tags: source.tags,
367
- ...source.claude ? { claude: source.claude } : {},
368
- ...source.needs ? { needs: source.needs } : {},
369
- origin: "authored"
370
- });
371
- for (const resource of getPluginResources(source.id)) {
372
- addResourceToPlugin(fork.id, resource.id);
373
- }
383
+ const { plugin, source, forked_from, upstream } = result;
374
384
  if (format === "json") {
375
385
  printJson({
376
- name: fork.name,
377
- version: fork.version,
386
+ name: plugin.name,
387
+ version: plugin.version,
378
388
  origin: "authored",
379
- forked_from: `${source.name}@${source.version}`
389
+ forked_from,
390
+ upstream
380
391
  });
381
392
  return;
382
393
  }
383
394
  ui.success(
384
- `Forked ${source.name}@${source.version} into ${ui.theme.accent(fork.name)}`
395
+ `Forked ${source.name}@${source.version} into ${ui.theme.accent(plugin.name)}`
385
396
  );
386
- ui.hint(`ht plugin edit ${fork.name}`);
397
+ ui.hint(formatCommand(["plugin", "edit", plugin.name]));
387
398
  }
388
399
 
389
400
  // src/services/plugin-origin-update.ts
@@ -650,11 +661,15 @@ async function checkPluginOrigins(opts) {
650
661
  marketplaceFetches.set(name, pending);
651
662
  return pending;
652
663
  };
653
- const fetchGit = (url) => {
654
- const existing = gitFetches.get(url);
664
+ const fetchGit = (url, pinnedRef) => {
665
+ const key = pinnedRef ? `${url}#${pinnedRef}` : url;
666
+ const existing = gitFetches.get(key);
655
667
  if (existing) return existing;
656
668
  const targetDir = gitOriginCacheDir(harnesstapDir, url);
657
- const pending = Promise.resolve().then(() => refreshGit({ url, targetDir })).catch((error) => ({
669
+ const pending = Promise.resolve().then(async () => {
670
+ const { fetchRef } = await gitFetchRefForPin(url, pinnedRef, opts?.deps?.resolveSemverTag);
671
+ return refreshGit({ url, targetDir, ...fetchRef ? { ref: fetchRef } : {} });
672
+ }).catch((error) => ({
658
673
  ok: false,
659
674
  message: thrownErrorMessage(error)
660
675
  }));
@@ -678,7 +693,7 @@ async function checkPluginOrigins(opts) {
678
693
  break;
679
694
  }
680
695
  case "git": {
681
- const fetched = await fetchGit(locator.url);
696
+ const fetched = await fetchGit(locator.url, locator.ref);
682
697
  targetRow = await compareGitSha(
683
698
  target,
684
699
  locatorStr,
@@ -800,6 +815,431 @@ async function updatePluginOrigins(opts) {
800
815
  return { results, summary: summarizeOriginUpdate(results) };
801
816
  }
802
817
 
818
+ // src/services/upstream-update-lock.ts
819
+ import { closeSync, mkdirSync, openSync, readFileSync, unlinkSync, writeSync } from "fs";
820
+ import { join as join2 } from "path";
821
+ var UPSTREAM_UPDATE_LOCK_FILE = "upstream-update.lock";
822
+ var UpstreamUpdateLockBusyError = class extends Error {
823
+ lockPath;
824
+ constructor(lockPath) {
825
+ super(`Another plugin update is in progress (${lockPath}). Try again when it finishes.`);
826
+ this.name = "UpstreamUpdateLockBusyError";
827
+ this.lockPath = lockPath;
828
+ }
829
+ };
830
+ function upstreamUpdateLockPath() {
831
+ return join2(getHarnesstapDir(), UPSTREAM_UPDATE_LOCK_FILE);
832
+ }
833
+ var depth = 0;
834
+ var heldFd;
835
+ function pidAlive(pid) {
836
+ try {
837
+ process.kill(pid, 0);
838
+ return true;
839
+ } catch (error) {
840
+ return error.code === "EPERM";
841
+ }
842
+ }
843
+ function clearIfStale(lockPath) {
844
+ let pid;
845
+ try {
846
+ pid = Number.parseInt(readFileSync(lockPath, "utf8").trim(), 10);
847
+ } catch {
848
+ return false;
849
+ }
850
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid || pidAlive(pid)) return false;
851
+ try {
852
+ unlinkSync(lockPath);
853
+ return true;
854
+ } catch {
855
+ return false;
856
+ }
857
+ }
858
+ function tryAcquire(lockPath) {
859
+ try {
860
+ heldFd = openSync(lockPath, "wx");
861
+ writeSync(heldFd, `${process.pid}
862
+ `);
863
+ return true;
864
+ } catch (error) {
865
+ if (error.code !== "EEXIST") throw error;
866
+ return clearIfStale(lockPath) ? tryAcquire(lockPath) : false;
867
+ }
868
+ }
869
+ function release(lockPath) {
870
+ depth -= 1;
871
+ if (depth > 0) return;
872
+ const fd = heldFd;
873
+ heldFd = void 0;
874
+ if (fd === void 0) return;
875
+ try {
876
+ closeSync(fd);
877
+ } finally {
878
+ try {
879
+ unlinkSync(lockPath);
880
+ } catch {
881
+ }
882
+ }
883
+ }
884
+ async function withUpstreamUpdateLock(fn, opts) {
885
+ const lockPath = upstreamUpdateLockPath();
886
+ if (depth > 0) {
887
+ depth += 1;
888
+ try {
889
+ return await fn();
890
+ } finally {
891
+ release(lockPath);
892
+ }
893
+ }
894
+ mkdirSync(getHarnesstapDir(), { recursive: true });
895
+ const waitMs = opts?.waitMs ?? 0;
896
+ const pollMs = opts?.pollMs ?? 250;
897
+ const deadline = Date.now() + waitMs;
898
+ let announced = false;
899
+ while (!tryAcquire(lockPath)) {
900
+ if (Date.now() >= deadline) throw new UpstreamUpdateLockBusyError(lockPath);
901
+ if (!announced) {
902
+ announced = true;
903
+ opts?.onWait?.();
904
+ }
905
+ await new Promise((resolve5) => setTimeout(resolve5, pollMs));
906
+ }
907
+ depth = 1;
908
+ try {
909
+ return await fn();
910
+ } finally {
911
+ release(lockPath);
912
+ }
913
+ }
914
+
915
+ // src/services/upstream-check.ts
916
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
917
+ import { dirname, join as join3 } from "path";
918
+ import semver from "semver";
919
+ var UPDATES_SINCE_BATCH = 100;
920
+ function catalogBaseOf(plugin) {
921
+ const locator = plugin.origin_locator ?? "";
922
+ const base = upstreamRefBase(locator);
923
+ return base.split("/").length === 3 ? base : void 0;
924
+ }
925
+ function listUpstreamTargets() {
926
+ const byKey = /* @__PURE__ */ new Map();
927
+ const put = (target) => {
928
+ const key = `${target.plugin_name}\0${target.kind === "catalog" ? upstreamRefBase(target.ref) : target.ref}`;
929
+ const existing = byKey.get(key);
930
+ if (!existing || semver.valid(target.local_version) && semver.valid(existing.local_version) && semver.gt(target.local_version, existing.local_version)) {
931
+ byKey.set(key, target);
932
+ }
933
+ };
934
+ for (const plugin of listPlugins()) {
935
+ if (plugin.frozen_at) continue;
936
+ if (plugin.upstream) {
937
+ const parent = plugin.upstream.kind === "extends" ? resolveUpstreamParent(plugin) : void 0;
938
+ put({
939
+ plugin_name: plugin.name,
940
+ ref: plugin.upstream.ref,
941
+ local_version: parent?.version ?? plugin.upstream.version_at_link,
942
+ kind: plugin.upstream.kind
943
+ });
944
+ continue;
945
+ }
946
+ if (plugin.origin === "catalog") {
947
+ const base = catalogBaseOf(plugin);
948
+ if (!base || !semver.valid(plugin.version)) continue;
949
+ put({
950
+ plugin_name: plugin.name,
951
+ ref: `${base}@${upstreamRange(plugin.version)}`,
952
+ local_version: plugin.version,
953
+ kind: "catalog"
954
+ });
955
+ }
956
+ }
957
+ return [...byKey.values()].sort(
958
+ (a, b) => a.plugin_name.localeCompare(b.plugin_name) || a.ref.localeCompare(b.ref)
959
+ );
960
+ }
961
+ function upstreamRefRange(ref) {
962
+ const at = ref.lastIndexOf("@");
963
+ const range = at > 0 ? ref.slice(at + 1) : "*";
964
+ return semver.validRange(range) ? range : "*";
965
+ }
966
+ function pickLatest(versions, range) {
967
+ const valid = versions.filter((version) => semver.valid(version));
968
+ const inRange = semver.maxSatisfying(valid, range) ?? "";
969
+ const floor = semver.minVersion(range)?.version;
970
+ const above = valid.filter(
971
+ (version) => !semver.satisfies(version, range) && (!floor || semver.gt(version, floor))
972
+ );
973
+ const major = above.length > 0 ? semver.rsort([...above])[0] ?? "" : "";
974
+ return { latest_in_range: inRange, latest_major: major };
975
+ }
976
+ function classifyUpstream(localVersion, latest) {
977
+ if (!latest.ok) {
978
+ return { status: latest.status, latest_in_range: "", latest_major: "", message: latest.message };
979
+ }
980
+ const { latest_in_range, latest_major } = latest;
981
+ const newer = (candidate) => Boolean(candidate) && (!semver.valid(localVersion) || semver.valid(candidate) !== null && semver.gt(candidate, localVersion));
982
+ if (newer(latest_in_range)) return { status: "update", latest_in_range, latest_major, message: "" };
983
+ if (newer(latest_major)) return { status: "major", latest_in_range, latest_major, message: "" };
984
+ return { status: "current", latest_in_range, latest_major, message: "" };
985
+ }
986
+ function localLatest(ref) {
987
+ const name = upstreamRefBase(ref);
988
+ const versions = listPlugins().filter((plugin) => plugin.name === name).map((plugin) => plugin.version);
989
+ if (versions.length === 0) {
990
+ return { ok: false, status: "unpublished", message: `${name} is not in the Library.` };
991
+ }
992
+ return { ok: true, ...pickLatest(versions, upstreamRefRange(ref)) };
993
+ }
994
+ var UPDATES_SINCE_MISSING = /* @__PURE__ */ new Set([404, 405, 501]);
995
+ function upstreamQueryKey(item) {
996
+ return `${item.base}@${item.range}`;
997
+ }
998
+ var UPDATES_SINCE_CACHE_FILE = "updates-since.json";
999
+ var UPDATES_SINCE_CACHE_KEEP = 20;
1000
+ function updatesSinceCachePath() {
1001
+ return join3(getHarnesstapDir(), "cache", UPDATES_SINCE_CACHE_FILE);
1002
+ }
1003
+ function readUpdatesSinceCache() {
1004
+ try {
1005
+ const parsed = JSON.parse(readFileSync2(updatesSinceCachePath(), "utf8"));
1006
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
1007
+ } catch {
1008
+ return {};
1009
+ }
1010
+ }
1011
+ function writeUpdatesSinceCache(cache) {
1012
+ try {
1013
+ const keys = Object.keys(cache);
1014
+ const trimmed = {};
1015
+ for (const key of keys.slice(-UPDATES_SINCE_CACHE_KEEP)) trimmed[key] = cache[key];
1016
+ mkdirSync2(dirname(updatesSinceCachePath()), { recursive: true });
1017
+ writeFileSync(updatesSinceCachePath(), JSON.stringify(trimmed));
1018
+ } catch {
1019
+ }
1020
+ }
1021
+ function latestFromUpdatesSince(item, row) {
1022
+ if (!row) return { ok: false, status: "unpublished", message: `${item.base} is not published.` };
1023
+ const inRange = row.latest_in_range_yanked ? "" : row.latest_in_range ?? "";
1024
+ return { ok: true, latest_in_range: inRange, latest_major: row.latest_major ?? "" };
1025
+ }
1026
+ var defaultFetchUpstreamLatest = async (items, opts) => {
1027
+ const out = /* @__PURE__ */ new Map();
1028
+ if (items.length === 0) return out;
1029
+ const root = resolveCatalogScope().cloudBaseUrl.replace(/\/+$/, "");
1030
+ let token;
1031
+ try {
1032
+ token = (await ensureCloudAccountAccess())?.accessToken;
1033
+ } catch {
1034
+ token = void 0;
1035
+ }
1036
+ const cache = readUpdatesSinceCache();
1037
+ let cacheChanged = false;
1038
+ for (let start = 0; start < items.length; start += UPDATES_SINCE_BATCH) {
1039
+ const batch = items.slice(start, start + UPDATES_SINCE_BATCH);
1040
+ const body = JSON.stringify({
1041
+ selectors: batch.map((item) => ({ ref: item.base, version: item.version, constraint: item.range }))
1042
+ });
1043
+ const cacheKey = `${root}
1044
+ ${token ? "auth" : "public"}
1045
+ ${body}`;
1046
+ const cached = cache[cacheKey];
1047
+ let response;
1048
+ try {
1049
+ response = await cloudFetch(`${root}/api/catalog/updates-since`, {
1050
+ method: "POST",
1051
+ headers: {
1052
+ "content-type": "application/json",
1053
+ ...token ? { authorization: `Bearer ${token}` } : {},
1054
+ ...cached?.etag ? { "if-none-match": cached.etag } : {}
1055
+ },
1056
+ body,
1057
+ ...opts.signal ? { signal: opts.signal } : {}
1058
+ });
1059
+ } catch (error) {
1060
+ for (const item of batch) {
1061
+ out.set(upstreamQueryKey(item), { ok: false, status: "unreachable", message: formatCatalogRequestError(error) });
1062
+ }
1063
+ continue;
1064
+ }
1065
+ const failure = response.ok || response.status === 304 ? void 0 : await readCloudError(response);
1066
+ if (failure && UPDATES_SINCE_MISSING.has(response.status) && !failure.code) {
1067
+ for (const item of batch) out.set(upstreamQueryKey(item), await latestFromCatalogList(item));
1068
+ continue;
1069
+ }
1070
+ let rows;
1071
+ if (response.status === 304 && cached) {
1072
+ rows = cached.items;
1073
+ } else if (response.ok) {
1074
+ const parsed = await response.json().catch(() => ({}));
1075
+ rows = Array.isArray(parsed.items) ? parsed.items : [];
1076
+ const etag = response.headers.get("etag");
1077
+ if (etag) {
1078
+ delete cache[cacheKey];
1079
+ cache[cacheKey] = { etag, items: rows };
1080
+ cacheChanged = true;
1081
+ }
1082
+ } else {
1083
+ const detail = describeCloudError(response.status, failure ?? {});
1084
+ for (const item of batch) {
1085
+ out.set(upstreamQueryKey(item), { ok: false, status: "unreachable", message: detail });
1086
+ }
1087
+ continue;
1088
+ }
1089
+ for (const item of batch) {
1090
+ const row = rows.find((candidate) => candidate.ref === item.base && candidate.constraint === item.range) ?? rows.find((candidate) => candidate.ref === item.base && candidate.constraint === void 0);
1091
+ out.set(upstreamQueryKey(item), latestFromUpdatesSince(item, row));
1092
+ }
1093
+ }
1094
+ if (cacheChanged) writeUpdatesSinceCache(cache);
1095
+ return out;
1096
+ };
1097
+ function nonEmpty(value) {
1098
+ return typeof value === "string" && value.length > 0 ? value : void 0;
1099
+ }
1100
+ function parseCloudError(body, headers) {
1101
+ const top = body && typeof body === "object" ? body : {};
1102
+ const nested = top.error && typeof top.error === "object" ? top.error : {};
1103
+ return {
1104
+ code: nonEmpty(nested.code) ?? nonEmpty(top.error) ?? nonEmpty(top.code),
1105
+ message: nonEmpty(nested.message) ?? nonEmpty(top.message),
1106
+ requestId: nonEmpty(nested.requestId) ?? nonEmpty(top.requestId) ?? nonEmpty(headers?.get("x-request-id") ?? void 0)
1107
+ };
1108
+ }
1109
+ async function readCloudError(response) {
1110
+ const text = await response.text().catch(() => "");
1111
+ let body;
1112
+ try {
1113
+ body = text.trim() ? JSON.parse(text) : void 0;
1114
+ } catch {
1115
+ body = void 0;
1116
+ }
1117
+ return parseCloudError(body, response.headers);
1118
+ }
1119
+ function describeCloudError(status, info) {
1120
+ const request = info.requestId ? ` (request ${info.requestId})` : "";
1121
+ if (info.code === "catalog_not_found") {
1122
+ return `Cloud could not find the catalog for this check${info.message ? `: ${info.message}` : "."}${request}`;
1123
+ }
1124
+ if (info.code === "not_found") {
1125
+ return `Cloud could not find what this check asked for${info.message ? `: ${info.message}` : "."}${request}`;
1126
+ }
1127
+ return [`Cloud answered ${status}`, info.message ?? info.code ?? ""].filter(Boolean).join(" ") + request;
1128
+ }
1129
+ var upstreamCheckDeps = {
1130
+ fetchLatest: defaultFetchUpstreamLatest
1131
+ };
1132
+ async function latestFromCatalogList(item) {
1133
+ const [org = "", catalog = "", slug = ""] = item.base.split("/");
1134
+ try {
1135
+ const plugin = await fetchCatalogPlugin({ orgSlug: org, catalogSlug: catalog, slug });
1136
+ if (!plugin.latestVersion) {
1137
+ return { ok: false, status: "unpublished", message: `${item.base} has no published version.` };
1138
+ }
1139
+ return { ok: true, ...pickLatest([plugin.latestVersion], item.range) };
1140
+ } catch (error) {
1141
+ const message = formatCatalogRequestError(error);
1142
+ return /not found/i.test(message) ? { ok: false, status: "unpublished", message: `${item.base} is not published.` } : { ok: false, status: "unreachable", message };
1143
+ }
1144
+ }
1145
+ async function runUpstreamCheck(opts) {
1146
+ const all = listUpstreamTargets();
1147
+ const targets = opts?.name ? all.filter((target) => target.plugin_name === opts.name) : all;
1148
+ const catalogQueries = /* @__PURE__ */ new Map();
1149
+ for (const target of targets) {
1150
+ if (!isCatalogUpstreamRef(target.ref)) continue;
1151
+ const base = upstreamRefBase(target.ref);
1152
+ const query = { base, version: target.local_version, range: upstreamRefRange(target.ref) };
1153
+ catalogQueries.set(upstreamQueryKey(query), query);
1154
+ }
1155
+ const fetchLatest = opts?.fetchLatest ?? upstreamCheckDeps.fetchLatest;
1156
+ const latestByBase = await fetchLatest([...catalogQueries.values()], { signal: opts?.signal });
1157
+ const checkedAt = (opts?.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
1158
+ const computed = targets.map((target) => {
1159
+ const base = upstreamRefBase(target.ref);
1160
+ 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);
1161
+ const known = isCatalogUpstreamRef(target.ref) && latest.ok ? { ok: true, ...narrowToRange(latest, upstreamRefRange(target.ref)) } : latest;
1162
+ return {
1163
+ plugin_name: target.plugin_name,
1164
+ ref: target.ref,
1165
+ local_version: target.local_version,
1166
+ checked_at: checkedAt,
1167
+ ...classifyUpstream(target.local_version, known)
1168
+ };
1169
+ });
1170
+ const db = getDb();
1171
+ const previous = new Map(
1172
+ readUpstreamChecks().map((row) => [`${row.plugin_name}\0${row.ref}`, row.local_version])
1173
+ );
1174
+ const upsert = db.prepare(
1175
+ `INSERT INTO upstream_checks
1176
+ (plugin_name, ref, local_version, latest_in_range, latest_major, status, checked_at, message)
1177
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
1178
+ ON CONFLICT(plugin_name, ref) DO UPDATE SET
1179
+ local_version = excluded.local_version,
1180
+ latest_in_range = excluded.latest_in_range,
1181
+ latest_major = excluded.latest_major,
1182
+ status = excluded.status,
1183
+ checked_at = excluded.checked_at,
1184
+ message = excluded.message`
1185
+ );
1186
+ db.transaction(() => {
1187
+ for (const row of computed) {
1188
+ upsert.run(
1189
+ row.plugin_name,
1190
+ row.ref,
1191
+ row.local_version,
1192
+ row.latest_in_range,
1193
+ row.latest_major,
1194
+ row.status,
1195
+ row.checked_at,
1196
+ row.message
1197
+ );
1198
+ }
1199
+ if (!opts?.name) {
1200
+ const keep = new Set(computed.map((row) => `${row.plugin_name}\0${row.ref}`));
1201
+ const stale = db.prepare("SELECT plugin_name, ref FROM upstream_checks").all().filter((row) => !keep.has(`${row.plugin_name}\0${row.ref}`));
1202
+ const drop = db.prepare("DELETE FROM upstream_checks WHERE plugin_name = ? AND ref = ?");
1203
+ for (const row of stale) drop.run(row.plugin_name, row.ref);
1204
+ }
1205
+ })();
1206
+ const rows = readUpstreamChecks().filter(
1207
+ (row) => !opts?.name || row.plugin_name === opts.name
1208
+ );
1209
+ notifyUpstreamUpdates(rows, new Map(targets.map((target) => [`${target.plugin_name}\0${target.ref}`, target.kind])), previous);
1210
+ return { checked_at: checkedAt, rows };
1211
+ }
1212
+ function notifyUpstreamUpdates(rows, kinds, previous) {
1213
+ for (const row of rows) {
1214
+ const key = `${row.plugin_name}\0${row.ref}`;
1215
+ const before = previous.get(key);
1216
+ if (kinds.get(key) === "extends" && before && semver.valid(before) && semver.valid(row.local_version) && semver.gt(row.local_version, before)) {
1217
+ notifySafely({
1218
+ kind: "parent_published",
1219
+ plugin_name: row.plugin_name,
1220
+ title: `${row.plugin_name} now uses ${row.local_version}`,
1221
+ body: `Synced from ${upstreamRefBase(row.ref)} (was ${before}).`,
1222
+ payload: { version: row.local_version, ref: row.ref, from: before, major: false }
1223
+ });
1224
+ }
1225
+ if (!isPendingUpdate(row)) continue;
1226
+ const major = row.status === "major";
1227
+ const version = major ? row.latest_major : row.latest_in_range;
1228
+ const parent = kinds.get(`${row.plugin_name}\0${row.ref}`) === "extends";
1229
+ const source = upstreamRefBase(row.ref);
1230
+ notifySafely({
1231
+ kind: parent ? "parent_published" : "update_available",
1232
+ plugin_name: row.plugin_name,
1233
+ title: parent ? `${source} published ${version}` : `${row.plugin_name} ${version} is available`,
1234
+ body: major ? `Major update, needs your OK. You have ${row.local_version}.` : `You have ${row.local_version}.`,
1235
+ payload: { version, ref: row.ref, from: row.local_version, major }
1236
+ });
1237
+ }
1238
+ }
1239
+ function narrowToRange(latest, range) {
1240
+ return pickLatest([latest.latest_in_range, latest.latest_major].filter(Boolean), range);
1241
+ }
1242
+
803
1243
  // src/cli/handlers/plugin-origin-update.ts
804
1244
  function originUpdateConfirmMode(yes) {
805
1245
  if (yes) {
@@ -816,6 +1256,12 @@ function originUpdateConfirmMode(yes) {
816
1256
  function originRef(row) {
817
1257
  return row.origin_version ?? row.origin_fingerprint ?? "";
818
1258
  }
1259
+ function upstreamAvailable(row) {
1260
+ if (row.status === "update") return row.latest_in_range;
1261
+ if (row.status === "major") return `${row.latest_major} (major)`;
1262
+ if (row.status === "unreachable" || row.status === "unpublished") return row.message;
1263
+ return "";
1264
+ }
819
1265
  async function handlePluginCheckCommand(name, opts) {
820
1266
  const db = getDb();
821
1267
  initializeSchema(db);
@@ -824,8 +1270,9 @@ async function handlePluginCheckCommand(name, opts) {
824
1270
  name,
825
1271
  refresh: opts.refresh
826
1272
  });
1273
+ const upstream = (await runUpstreamCheck(name ? { name } : void 0)).rows;
827
1274
  if (format === "json") {
828
- printJson(report);
1275
+ printJson({ ...report, upstream });
829
1276
  } else {
830
1277
  ui.table.print({
831
1278
  columns: [
@@ -845,6 +1292,25 @@ async function handlePluginCheckCommand(name, opts) {
845
1292
  summary: formatCount(report.results.length, "plugin"),
846
1293
  empty: "No syncable working heads."
847
1294
  });
1295
+ if (upstream.length > 0) {
1296
+ ui.table.print({
1297
+ columns: [
1298
+ { key: "name", header: "NAME", width: 18 },
1299
+ { key: "upstream", header: "UPSTREAM", width: 30 },
1300
+ { key: "status", header: "STATUS", width: 11 },
1301
+ { key: "local", header: "LOCAL", width: 8 },
1302
+ { key: "available", header: "AVAILABLE", width: 16 }
1303
+ ],
1304
+ rows: upstream.map((row) => ({
1305
+ name: row.plugin_name,
1306
+ upstream: row.ref,
1307
+ status: row.status,
1308
+ local: row.local_version,
1309
+ available: upstreamAvailable(row)
1310
+ })),
1311
+ summary: upstream.some((row) => row.status === "major") ? `${formatCount(upstream.length, "upstream link")}. A major version is never installed automatically.` : formatCount(upstream.length, "upstream link")
1312
+ });
1313
+ }
848
1314
  }
849
1315
  if (report.results.some((row) => row.status === "error")) {
850
1316
  process.exitCode = 1;
@@ -875,7 +1341,7 @@ async function handlePluginUpdateCommand(name, opts) {
875
1341
  const count = listOriginUpdateCandidates().length;
876
1342
  try {
877
1343
  const confirmed = await promptForConfirmation({
878
- message: `Update ${count} plugins from origin?`,
1344
+ message: `Update ${formatCount(count, "plugin")} from origin?`,
879
1345
  default: false
880
1346
  });
881
1347
  if (!confirmed) {
@@ -892,11 +1358,13 @@ async function handlePluginUpdateCommand(name, opts) {
892
1358
  }
893
1359
  }
894
1360
  try {
895
- const report = await updatePluginOrigins({
896
- name,
897
- all: opts.all,
898
- force: opts.force
899
- });
1361
+ const report = await withUpstreamUpdateLock(
1362
+ () => updatePluginOrigins({ name, all: opts.all, force: opts.force }),
1363
+ {
1364
+ waitMs: UPDATE_LOCK_WAIT_MS,
1365
+ onWait: () => ui.info("Waiting for another plugin update to finish.")
1366
+ }
1367
+ );
900
1368
  if (format === "json") {
901
1369
  printJson(report);
902
1370
  } else {
@@ -907,6 +1375,8 @@ async function handlePluginUpdateCommand(name, opts) {
907
1375
  }
908
1376
  if (report.results.some((row) => row.status === "failed")) {
909
1377
  process.exitCode = 1;
1378
+ } else if (opts.all && format !== "json") {
1379
+ await maybePromptKeepUpToDate();
910
1380
  }
911
1381
  } catch (error) {
912
1382
  process.exitCode = 1;
@@ -914,6 +1384,7 @@ async function handlePluginUpdateCommand(name, opts) {
914
1384
  ui.danger(message);
915
1385
  }
916
1386
  }
1387
+ var UPDATE_LOCK_WAIT_MS = 5 * 60 * 1e3;
917
1388
  function printUpdateHuman(rows) {
918
1389
  ui.table.print({
919
1390
  columns: [
@@ -1228,8 +1699,8 @@ function resolveProjectCompileTargets(input) {
1228
1699
  }
1229
1700
 
1230
1701
  // src/services/plugin-editor.ts
1231
- import { mkdirSync } from "fs";
1232
- import { dirname, join as join2 } from "path";
1702
+ import { mkdirSync as mkdirSync3 } from "fs";
1703
+ import { dirname as dirname2, join as join4 } from "path";
1233
1704
 
1234
1705
  // src/services/plugin-export.ts
1235
1706
  import { existsSync as existsSync2, statSync } from "fs";
@@ -1267,7 +1738,7 @@ function exportToFile(pluginNameOrId, filePath, exportOpts) {
1267
1738
 
1268
1739
  // src/services/plugin-editor.ts
1269
1740
  function resolvePluginDefinitionPath(plugin) {
1270
- return join2(
1741
+ return join4(
1271
1742
  getHarnesstapDir(),
1272
1743
  "plugins",
1273
1744
  `${slugifyApName(plugin.name)}@${plugin.version}.ap.json`
@@ -1275,7 +1746,7 @@ function resolvePluginDefinitionPath(plugin) {
1275
1746
  }
1276
1747
  function exportPluginDefinition(plugin, filePath) {
1277
1748
  const definitionPath = filePath ?? resolvePluginDefinitionPath(plugin);
1278
- mkdirSync(dirname(definitionPath), { recursive: true });
1749
+ mkdirSync3(dirname2(definitionPath), { recursive: true });
1279
1750
  exportToFile(plugin.id, definitionPath, { singleFile: true });
1280
1751
  return definitionPath;
1281
1752
  }
@@ -1373,7 +1844,7 @@ async function handlePluginCatalogDisconnectPluginCommand(selector) {
1373
1844
 
1374
1845
  // src/services/plugin-diff.ts
1375
1846
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
1376
- import { join as join3 } from "path";
1847
+ import { join as join5 } from "path";
1377
1848
  function resourceKey(resource) {
1378
1849
  if (resource.namespace) {
1379
1850
  return `${resource.type}:${resource.name}@${resource.namespace}`;
@@ -1386,7 +1857,7 @@ function isPackagePath(nameOrPath) {
1386
1857
  }
1387
1858
  try {
1388
1859
  if (existsSync3(nameOrPath) && statSync2(nameOrPath).isDirectory()) {
1389
- return existsSync3(join3(nameOrPath, "plugin.json"));
1860
+ return existsSync3(join5(nameOrPath, "plugin.json"));
1390
1861
  }
1391
1862
  } catch {
1392
1863
  return false;
@@ -1571,7 +2042,7 @@ function diffPlugins(leftName, rightName) {
1571
2042
 
1572
2043
  // src/services/plugin-package-hydrate.ts
1573
2044
  import { existsSync as existsSync4 } from "fs";
1574
- import { join as join4 } from "path";
2045
+ import { join as join6 } from "path";
1575
2046
  var MATERIAL_TYPES = new Set(MATERIAL_RESOURCE_TYPES);
1576
2047
  function hasMaterialResources(resources) {
1577
2048
  return resources.some((resource) => MATERIAL_TYPES.has(resource.type));
@@ -1590,11 +2061,11 @@ function tryScan(sourcePath, pluginName) {
1590
2061
  }
1591
2062
  function scanMarketplaceManifests(sourcePath, pluginName) {
1592
2063
  const manifestCandidates = [
1593
- join4(sourcePath, ".claude-plugin", "marketplace.json"),
1594
- join4(sourcePath, ".cursor-plugin", "marketplace.json"),
1595
- join4(sourcePath, ".github", "plugin", "marketplace.json"),
1596
- join4(sourcePath, ".agents", "plugins", "marketplace.json"),
1597
- join4(sourcePath, "marketplace.json")
2064
+ join6(sourcePath, ".claude-plugin", "marketplace.json"),
2065
+ join6(sourcePath, ".cursor-plugin", "marketplace.json"),
2066
+ join6(sourcePath, ".github", "plugin", "marketplace.json"),
2067
+ join6(sourcePath, ".agents", "plugins", "marketplace.json"),
2068
+ join6(sourcePath, "marketplace.json")
1598
2069
  ];
1599
2070
  for (const manifestPath of manifestCandidates) {
1600
2071
  if (!existsSync4(manifestPath)) {
@@ -1629,6 +2100,9 @@ function ensureUpstreamPluginResources(plugin) {
1629
2100
  if (plugin.origin === "authored") {
1630
2101
  return attached;
1631
2102
  }
2103
+ if (recordedPluginInstallRoot(plugin.name, plugin.version)) {
2104
+ return attached;
2105
+ }
1632
2106
  const packageRoot = resolvePluginPackageRoot(plugin);
1633
2107
  if (!packageRoot) {
1634
2108
  return attached;
@@ -1740,13 +2214,40 @@ var emptyPluginCheck = {
1740
2214
  }
1741
2215
  };
1742
2216
 
2217
+ // src/services/git-dependency-pin-check.ts
2218
+ function gitDependencyPinIssue(ref, constraint) {
2219
+ try {
2220
+ const pin = parseGitDependencyConstraint(constraint);
2221
+ if (pin.kind === "none") {
2222
+ return {
2223
+ severity: "warning",
2224
+ 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>.`
2225
+ };
2226
+ }
2227
+ return null;
2228
+ } catch (error) {
2229
+ return {
2230
+ severity: "error",
2231
+ message: error instanceof InvalidGitDependencyConstraintError ? `${error.message} (${ref})` : `Invalid git dependency constraint for ${ref}`
2232
+ };
2233
+ }
2234
+ }
2235
+
1743
2236
  // src/services/plugin-doctor/checks/plugin-metadata.ts
2237
+ function checkGitDependencyPin(ref, constraint) {
2238
+ const issue = gitDependencyPinIssue(ref, constraint);
2239
+ return issue ? [{ severity: issue.severity === "error" ? "error" : "warn", message: issue.message }] : [];
2240
+ }
1744
2241
  var pluginMetadataCheck = {
1745
2242
  id: "plugin-metadata",
1746
2243
  description: "Validate plugin refs, versions, and Claude plugin metadata",
1747
2244
  run({ plugin, plugins }) {
1748
2245
  const results = [];
1749
2246
  for (const pin of plugins) {
2247
+ if (pin.source_kind === "git") {
2248
+ results.push(...checkGitDependencyPin(pin.ref, pin.version_constraint));
2249
+ continue;
2250
+ }
1750
2251
  if (!pin.ref.includes("@")) {
1751
2252
  results.push({
1752
2253
  severity: "error",
@@ -1787,23 +2288,52 @@ var pluginMetadataCheck = {
1787
2288
  }
1788
2289
  };
1789
2290
 
2291
+ // src/services/plugin-doctor/checks/skipped-files.ts
2292
+ var skippedFilesCheck = {
2293
+ id: "skipped-files",
2294
+ description: "Detect package files that import skipped (bad frontmatter, unsupported dirs)",
2295
+ run({ packageDiagnostics: packageDiagnostics2 }) {
2296
+ if (!packageDiagnostics2) return [];
2297
+ return packageDiagnostics2.skipped.map((item) => ({
2298
+ severity: "error",
2299
+ message: formatSkippedEntry(item)
2300
+ }));
2301
+ }
2302
+ };
2303
+
1790
2304
  // src/services/plugin-doctor.ts
1791
2305
  var pluginDoctorChecks = [
1792
2306
  emptyPluginCheck,
1793
2307
  duplicateResourcesCheck,
1794
2308
  emptyContentCheck,
1795
- pluginMetadataCheck
2309
+ pluginMetadataCheck,
2310
+ skippedFilesCheck
1796
2311
  ];
2312
+ function packageDiagnostics(plugin, resources) {
2313
+ const root = recordedPluginInstallRoot(plugin.name, plugin.version);
2314
+ if (!root) return void 0;
2315
+ try {
2316
+ const parsed = parseApPackageFiles(readContainedPackageFiles(root), { root });
2317
+ return diagnoseParsedPackage(
2318
+ parsed,
2319
+ resources.map((resource) => resource.type)
2320
+ );
2321
+ } catch {
2322
+ return void 0;
2323
+ }
2324
+ }
1797
2325
  function createPluginDoctorContext(nameOrId) {
1798
2326
  const plugin = getPlugin(nameOrId);
1799
2327
  if (!plugin) {
1800
2328
  throw new Error(`Plugin not found: ${nameOrId}`);
1801
2329
  }
1802
2330
  const resources = ensureUpstreamPluginResources(plugin);
2331
+ const diagnostics = packageDiagnostics(plugin, resources);
1803
2332
  return {
1804
2333
  plugin,
1805
2334
  resources,
1806
- plugins: dependenciesFromResources(resources)
2335
+ plugins: dependenciesFromResources(resources),
2336
+ ...diagnostics ? { packageDiagnostics: diagnostics } : {}
1807
2337
  };
1808
2338
  }
1809
2339
  function listPluginDoctorChecks() {
@@ -1831,9 +2361,16 @@ function runPluginDoctor(input) {
1831
2361
  plugin: context.plugin.name,
1832
2362
  valid: !results.some((result) => result.severity === "error"),
1833
2363
  checks: checks.map((check) => check.id),
1834
- results
2364
+ results,
2365
+ resource_counts: context.packageDiagnostics?.counts ?? libraryCounts(context.resources)
1835
2366
  };
1836
2367
  }
2368
+ function libraryCounts(resources) {
2369
+ return [...MATERIAL_RESOURCE_TYPES, "plugin"].flatMap((type) => {
2370
+ const count = resources.filter((resource) => resource.type === type).length;
2371
+ return count > 0 ? [{ type, discovered: count, imported: count }] : [];
2372
+ });
2373
+ }
1837
2374
 
1838
2375
  // src/services/constraint-recovery.ts
1839
2376
  function catalogDependencyMatches(dependency, pluginName) {
@@ -1842,6 +2379,10 @@ function catalogDependencyMatches(dependency, pluginName) {
1842
2379
  function marketplaceDependencyMatches(dependency, pluginName) {
1843
2380
  return dependency.source_kind === "marketplace" && (dependency.name === pluginName || dependency.ref === pluginName || dependency.ref.endsWith(`/${pluginName}`));
1844
2381
  }
2382
+ function gitDependencyMatches(dependency, pluginName) {
2383
+ const ref = dependency.ref.replace(/\.git$/, "").replace(/\/+$/, "");
2384
+ return dependency.source_kind === "git" && (dependency.name === pluginName || ref === pluginName || ref.endsWith(`/${pluginName}`));
2385
+ }
1845
2386
  async function runConstraintRecovery(input) {
1846
2387
  const root = resolvePluginSelector(input.rootName);
1847
2388
  if (!root) {
@@ -1947,8 +2488,31 @@ async function runConstraintRecovery(input) {
1947
2488
  }
1948
2489
  return;
1949
2490
  }
2491
+ if (action.sourceKind === "git") {
2492
+ const pins = listDependencies(root.id).filter((dependency) => gitDependencyMatches(dependency, action.pluginName)).map((dependency) => ({
2493
+ ref: dependency.ref,
2494
+ version_constraint: dependency.version_constraint || "*"
2495
+ }));
2496
+ if (pins.length === 0) {
2497
+ throw new Error(`No git dependency on ${action.pluginName} in ${input.rootName}`);
2498
+ }
2499
+ const syncResult = await syncPluginPinsForApply({
2500
+ pins,
2501
+ syncAll: true,
2502
+ projectRoot: input.projectRoot ?? resolveHomeRoot()
2503
+ });
2504
+ const failed = syncResult.installs.filter(
2505
+ (install) => install.status === "failed" || install.status === "unsupported"
2506
+ );
2507
+ if (failed.length > 0) {
2508
+ throw new Error(
2509
+ `Could not fetch ${action.pluginName}: ${failed.map((install) => `${install.ref}: ${install.message}`).join("; ")}`
2510
+ );
2511
+ }
2512
+ return;
2513
+ }
1950
2514
  throw new Error(
1951
- `Automated sync-install is only supported for marketplace and catalog dependencies. Create or import ${action.pluginName} first (ht plugin create ${action.pluginName}).`
2515
+ `Automated sync-install is only supported for marketplace, catalog and git dependencies. Create or import ${action.pluginName} first (ht plugin create ${action.pluginName}).`
1952
2516
  );
1953
2517
  }
1954
2518
  default: {
@@ -2140,7 +2704,8 @@ function explainPayload(result) {
2140
2704
  path: plugin.path,
2141
2705
  constraints: plugin.constraints.map((record) => ({
2142
2706
  requirer: record.requirer,
2143
- constraint: record.constraint
2707
+ constraint: record.constraint,
2708
+ ...record.declared ? { declared: record.declared } : {}
2144
2709
  }))
2145
2710
  })),
2146
2711
  resources: result.decisions.map((decision) => ({
@@ -2168,7 +2733,7 @@ function renderExplain(result) {
2168
2733
  for (const record of plugin.constraints) {
2169
2734
  lines.push(
2170
2735
  ui.theme.muted(
2171
- ` ${record.requirer} \u2192 ${plugin.name} ${record.constraint || "*"}`
2736
+ ` ${record.requirer} \u2192 ${plugin.name} ${displayConstraint(record)}`
2172
2737
  )
2173
2738
  );
2174
2739
  }
@@ -2191,13 +2756,11 @@ function renderExplain(result) {
2191
2756
 
2192
2757
  // src/services/apm-graph.ts
2193
2758
  import { existsSync as existsSync6, lstatSync as lstatSync2 } from "fs";
2194
- import { homedir } from "os";
2195
- import { isAbsolute, join as join6, resolve as resolve4 } from "path";
2759
+ import { isAbsolute, join as join8, resolve as resolve4 } from "path";
2196
2760
 
2197
2761
  // src/services/apm-git-import.ts
2198
- import { existsSync as existsSync5, lstatSync, readdirSync, readFileSync } from "fs";
2199
- import { basename as basename2, join as join5 } from "path";
2200
- import matter from "gray-matter";
2762
+ import { existsSync as existsSync5, lstatSync, readdirSync, readFileSync as readFileSync3 } from "fs";
2763
+ import { basename as basename2, join as join7 } from "path";
2201
2764
  function isRecord(value) {
2202
2765
  return value !== null && typeof value === "object" && !Array.isArray(value);
2203
2766
  }
@@ -2214,8 +2777,8 @@ function importVirtualFile(checkoutRoot, relativePath) {
2214
2777
  `Virtual package file ${relativePath} is missing: apply aborted closed`
2215
2778
  );
2216
2779
  }
2217
- const raw = readFileSync(absolute, "utf8");
2218
- const parsed = matter(raw);
2780
+ const raw = readFileSync3(absolute, "utf8");
2781
+ const parsed = parseFrontmatter(raw);
2219
2782
  const data = isRecord(parsed.data) ? parsed.data : {};
2220
2783
  const fallback = basename2(relativePath).replace(/\.(agent|prompt|instructions)\.md$/i, "");
2221
2784
  const name = typeof data.name === "string" && data.name.trim().length > 0 ? data.name.trim() : fallback;
@@ -2250,7 +2813,7 @@ function assertPackageRootSafe(packageRoot) {
2250
2813
  if (entry.name === ".git") {
2251
2814
  continue;
2252
2815
  }
2253
- const child = join5(packageRoot, entry.name);
2816
+ const child = join7(packageRoot, entry.name);
2254
2817
  if (entry.isSymbolicLink() || lstatSync(child).isSymbolicLink()) {
2255
2818
  throw new BundleSymlinkError(entry.name);
2256
2819
  }
@@ -2264,10 +2827,10 @@ function assertPackageRootSafe(packageRoot) {
2264
2827
  }
2265
2828
  }
2266
2829
  function peekApmPackageIdentity(packageRoot) {
2267
- const pluginJson = join5(packageRoot, ".claude-plugin", "plugin.json");
2830
+ const pluginJson = join7(packageRoot, ".claude-plugin", "plugin.json");
2268
2831
  if (existsSync5(pluginJson) && lstatSync(pluginJson).isFile()) {
2269
2832
  try {
2270
- const parsed = JSON.parse(readFileSync(pluginJson, "utf8"));
2833
+ const parsed = JSON.parse(readFileSync3(pluginJson, "utf8"));
2271
2834
  if (isRecord(parsed)) {
2272
2835
  return {
2273
2836
  ...typeof parsed.name === "string" && parsed.name.trim() ? { name: parsed.name.trim() } : {},
@@ -2277,11 +2840,11 @@ function peekApmPackageIdentity(packageRoot) {
2277
2840
  } catch {
2278
2841
  }
2279
2842
  }
2280
- const manifestPath = join5(packageRoot, APM_MANIFEST_FILENAME);
2843
+ const manifestPath = join7(packageRoot, APM_MANIFEST_FILENAME);
2281
2844
  if (!existsSync5(manifestPath) || !lstatSync(manifestPath).isFile()) {
2282
2845
  return {};
2283
2846
  }
2284
- const document = parseApmYamlDocument(readFileSync(manifestPath, "utf8"), manifestPath);
2847
+ const document = parseApmYamlDocument(readFileSync3(manifestPath, "utf8"), manifestPath);
2285
2848
  return {
2286
2849
  ...typeof document.name === "string" && document.name.trim() ? { name: document.name.trim() } : {},
2287
2850
  ...typeof document.version === "string" && document.version.trim() ? { version: document.version.trim() } : {}
@@ -2467,7 +3030,7 @@ function apmDependencyIdentity(dependency, declaringRoot) {
2467
3030
  }
2468
3031
  function expandHome(originRef2) {
2469
3032
  if (originRef2.startsWith("~/") || originRef2.startsWith("~\\")) {
2470
- return join6(homedir(), originRef2.slice(2));
3033
+ return join8(resolveHomeRoot(), originRef2.slice(2));
2471
3034
  }
2472
3035
  return originRef2;
2473
3036
  }
@@ -2492,7 +3055,7 @@ function linkParent(parentPluginId, imported) {
2492
3055
  });
2493
3056
  }
2494
3057
  function pushGitLock(gitLocks, pluginName, fetched) {
2495
- const licenseRoot = fetched.virtualPath ? join6(fetched.checkoutRoot, fetched.virtualPath) : fetched.checkoutRoot;
3058
+ const licenseRoot = fetched.virtualPath ? join8(fetched.checkoutRoot, fetched.virtualPath) : fetched.checkoutRoot;
2496
3059
  const declared_license = readDeclaredLicense(licenseRoot);
2497
3060
  gitLocks.push({
2498
3061
  name: pluginName,
@@ -3479,9 +4042,7 @@ async function addPluginFromMarketplace(input) {
3479
4042
  const plugin = requirePlugin(input.pluginName);
3480
4043
  const parsed = requireMarketplaceRef(input.ref);
3481
4044
  const marketplaceName = parsed.namespace;
3482
- const marketplace = listMarketplaces(input.harnesstapDir).find(
3483
- (entry) => entry.name === marketplaceName
3484
- );
4045
+ const marketplace = findKnownMarketplace(input.harnesstapDir, marketplaceName);
3485
4046
  if (!marketplace) {
3486
4047
  throw new Error(`Marketplace not found in registry: ${marketplaceName}`);
3487
4048
  }
@@ -3553,188 +4114,6 @@ async function addPluginFromMarketplace(input) {
3553
4114
  };
3554
4115
  }
3555
4116
 
3556
- // src/services/github-plugin-ref.ts
3557
- var GitPluginImportError = class extends Error {
3558
- code;
3559
- constructor(code, message) {
3560
- super(message);
3561
- this.name = "GitPluginImportError";
3562
- this.code = code;
3563
- }
3564
- };
3565
- 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.";
3566
- var OWNER_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
3567
- var GH_PREFIX = /^gh:/i;
3568
- function invalidRef(input) {
3569
- return new GitPluginImportError(
3570
- "invalid_ref",
3571
- `Unrecognized GitHub plugin source "${input}". Use https://github.com/owner/repo, owner/repo, or gh:owner/repo.`
3572
- );
3573
- }
3574
- function ownerRepoFromPath(pathname) {
3575
- const parts = pathname.split("/").filter(Boolean);
3576
- if (parts.length < 2) {
3577
- return null;
3578
- }
3579
- const owner = parts[0];
3580
- const repo = (parts[1] ?? "").replace(/\.git$/i, "");
3581
- if (!owner || !repo || !OWNER_REPO.test(`${owner}/${repo}`)) {
3582
- return null;
3583
- }
3584
- return { owner, repo };
3585
- }
3586
- function normalizeGitHubPluginUrl(input) {
3587
- const trimmed = input.trim();
3588
- if (!trimmed) {
3589
- throw invalidRef(input);
3590
- }
3591
- const withoutGh = GH_PREFIX.test(trimmed) ? trimmed.replace(GH_PREFIX, "") : trimmed;
3592
- const candidate = withoutGh.trim();
3593
- if (OWNER_REPO.test(candidate.replace(/\.git$/i, ""))) {
3594
- const [owner, repo] = candidate.replace(/\.git$/i, "").split("/");
3595
- if (!owner || !repo) {
3596
- throw invalidRef(input);
3597
- }
3598
- return `https://github.com/${owner}/${repo}.git`;
3599
- }
3600
- let parsed;
3601
- try {
3602
- parsed = new URL(candidate);
3603
- } catch {
3604
- throw invalidRef(input);
3605
- }
3606
- const host = parsed.hostname.replace(/^www\./i, "").toLowerCase();
3607
- if (host !== "github.com" || parsed.protocol !== "https:" && parsed.protocol !== "http:") {
3608
- throw invalidRef(input);
3609
- }
3610
- const pair = ownerRepoFromPath(parsed.pathname);
3611
- if (!pair) {
3612
- throw invalidRef(input);
3613
- }
3614
- return `https://github.com/${pair.owner}/${pair.repo}.git`;
3615
- }
3616
- function isGitHubPluginRef(input) {
3617
- try {
3618
- normalizeGitHubPluginUrl(input);
3619
- return true;
3620
- } catch {
3621
- return false;
3622
- }
3623
- }
3624
-
3625
- // src/services/plugin-git-import.ts
3626
- function sameGitLocator(plugin, url) {
3627
- const locator = recoverOriginLocator(plugin);
3628
- if (!locator || locator.kind !== "git") {
3629
- return false;
3630
- }
3631
- return formatOriginLocator(locator) === url;
3632
- }
3633
- async function importPluginFromGitHubRef(input, deps) {
3634
- let url;
3635
- try {
3636
- url = normalizeGitHubPluginUrl(input);
3637
- } catch (error) {
3638
- if (error instanceof GitPluginImportError) {
3639
- throw error;
3640
- }
3641
- throw new GitPluginImportError(
3642
- "invalid_ref",
3643
- error instanceof Error ? error.message : String(error)
3644
- );
3645
- }
3646
- const harnesstapDir = getHarnesstapDir();
3647
- const targetDir = gitOriginCacheDir(harnesstapDir, url);
3648
- const refreshGit = deps?.refreshGit ?? refreshGitSource;
3649
- const refresh = await refreshGit({ url, targetDir });
3650
- if (!refresh.ok || !refresh.sha) {
3651
- throw new GitPluginImportError(
3652
- "clone_failed",
3653
- refresh.message || `Failed to fetch ${url}`
3654
- );
3655
- }
3656
- if (!isPluginInstallRoot(targetDir)) {
3657
- throw new GitPluginImportError("missing_plugin_json", MISSING_PLUGIN_JSON_MESSAGE);
3658
- }
3659
- const scans = await scanPluginSource(targetDir);
3660
- const scan = scans[0];
3661
- if (!scan?.plugin_name) {
3662
- throw new GitPluginImportError("missing_plugin_json", MISSING_PLUGIN_JSON_MESSAGE);
3663
- }
3664
- const existing = getPluginByName(scan.plugin_name);
3665
- let plugin;
3666
- let created = false;
3667
- if (existing) {
3668
- if (getPluginOrigin(existing.id) !== "upstream" || !sameGitLocator(existing, url)) {
3669
- throw new GitPluginImportError(
3670
- "name_conflict",
3671
- `Plugin name already exists: ${scan.plugin_name}. Use a different local name or delete the existing plugin first.`
3672
- );
3673
- }
3674
- plugin = existing;
3675
- const nextDescription = pluginDescriptionFromManifest(scan.plugin_description);
3676
- if (nextDescription && nextDescription !== existing.description) {
3677
- updatePluginDescription(existing.id, nextDescription);
3678
- }
3679
- } else {
3680
- plugin = createPlugin({
3681
- name: scan.plugin_name,
3682
- version: semverSafePluginVersion(scan.plugin_version, refresh.sha),
3683
- description: pluginDescriptionFromManifest(scan.plugin_description),
3684
- origin: "upstream"
3685
- });
3686
- setPluginOrigin(plugin.id, "upstream");
3687
- created = true;
3688
- }
3689
- try {
3690
- await applyCheckedPluginOrigin(plugin, {
3691
- origin_locator: url,
3692
- origin_fingerprint: refresh.sha
3693
- });
3694
- const pinRef = `${scan.plugin_name}@local`;
3695
- const pinVersion = plugin.version || refresh.sha.slice(0, 12) || "0.0.0";
3696
- ingestHostPluginTreeIntoCache({
3697
- harnesstapDir: getHarnesstapDir(),
3698
- homeRoot: resolveHomeRoot(),
3699
- originRef: pinRef,
3700
- sourceInstallRoot: targetDir,
3701
- version: pinVersion
3702
- });
3703
- attachPluginPinToPlugin(plugin.id, pinRef, pinVersion);
3704
- const pin = findPluginResourceByPin(pinRef, pinVersion) ?? findPluginResourceByPin(pinRef);
3705
- if (pin) {
3706
- const metadata = {
3707
- ...pin.metadata,
3708
- resolved_version: pinVersion,
3709
- sync_status: "synced",
3710
- marketplace_name: "local"
3711
- };
3712
- getDb().prepare("UPDATE resources SET metadata = ?, origin_ref = ?, updated_at = ? WHERE id = ?").run(JSON.stringify(metadata), pinRef, (/* @__PURE__ */ new Date()).toISOString(), pin.id);
3713
- }
3714
- const updated = getPluginById(plugin.id) ?? plugin;
3715
- if (created) {
3716
- trackPluginInstalled({ pluginSlug: updated.name, source: "url" });
3717
- }
3718
- return {
3719
- plugin: updated,
3720
- origin_locator: url,
3721
- origin_fingerprint: refresh.sha,
3722
- created
3723
- };
3724
- } catch (error) {
3725
- if (created) {
3726
- deletePlugin(plugin.id);
3727
- }
3728
- if (error instanceof GitPluginImportError) {
3729
- throw error;
3730
- }
3731
- throw new GitPluginImportError(
3732
- "clone_failed",
3733
- error instanceof Error ? error.message : String(error)
3734
- );
3735
- }
3736
- }
3737
-
3738
4117
  // src/services/plugin-edit.ts
3739
4118
  function attachmentKey(resource) {
3740
4119
  if (resource.namespace) {
@@ -4483,6 +4862,7 @@ async function handleProjectApplyCommand(pluginNames, opts) {
4483
4862
  syncAll: opts.syncPlugins,
4484
4863
  scope: resolvePluginInstallScope(projectRoot, Boolean(getGitOrigin(projectRoot))),
4485
4864
  ignoreMissingInstall: Boolean(opts.ignorePluginVersions || opts.dryRun),
4865
+ installInexactPins: Boolean(opts.ignorePluginVersions && !opts.dryRun),
4486
4866
  yes: Boolean(opts.yes),
4487
4867
  interactive: opts.noInteractive === true ? false : opts.interactive,
4488
4868
  progress: {
@@ -4657,6 +5037,7 @@ async function handleProjectApplyCommand(pluginNames, opts) {
4657
5037
  syncAll: opts.syncPlugins,
4658
5038
  scope: resolvePluginInstallScope(projectRoot, Boolean(getGitOrigin(projectRoot))),
4659
5039
  ignoreMissingInstall: opts.ignorePluginVersions,
5040
+ installInexactPins: Boolean(opts.ignorePluginVersions),
4660
5041
  yes: Boolean(opts.yes),
4661
5042
  interactive: opts.noInteractive === true ? false : opts.interactive,
4662
5043
  progress: {
@@ -4852,8 +5233,7 @@ async function handleProjectApplyCommand(pluginNames, opts) {
4852
5233
  } : claude;
4853
5234
  const generateSpin = createProgress("Generating harness files...");
4854
5235
  let generated;
4855
- const gitOriginForApply = getGitOrigin(projectRoot);
4856
- const projectForHarness = gitOriginForApply ? getProjectByOrigin(normalizeGitUrl(gitOriginForApply)) : void 0;
5236
+ const projectForHarness = findProjectForRoot(projectRoot);
4857
5237
  const projectHarnessConfig = projectForHarness ? getProjectHarnessConfig(projectForHarness.id) : void 0;
4858
5238
  try {
4859
5239
  generated = await generateFiles(
@@ -5041,31 +5421,20 @@ async function handleProjectApplyCommand(pluginNames, opts) {
5041
5421
  });
5042
5422
  const unchanged = Math.max(0, desiredPaths.length - wroteCount);
5043
5423
  const hasChanges = wroteCount > 0 || staleRemoved.removed.length > 0;
5044
- const gitOrigin = getGitOrigin(projectRoot);
5045
5424
  let snapshotId;
5046
- if (gitOrigin) {
5047
- const project = upsertProject({
5048
- git_origin: normalizeGitUrl(gitOrigin),
5049
- name: projectNameFromUrl(gitOrigin),
5050
- local_path: projectRoot
5051
- });
5052
- applyConfiguredPluginToProject({
5425
+ const project = ensureProjectForRoot(projectRoot);
5426
+ applyConfiguredPluginToProject({
5427
+ project_id: project.id,
5428
+ configured_plugin_id: applyBundle.primaryConfiguredPluginId,
5429
+ platforms
5430
+ });
5431
+ if (hasChanges) {
5432
+ const snapshot = createSnapshot({
5053
5433
  project_id: project.id,
5054
- configured_plugin_id: applyBundle.primaryConfiguredPluginId,
5055
- platforms
5434
+ label: resolvedPluginNames.length > 1 ? `Before applying: ${resolvedPluginNames.join(" + ")}` : `Before applying: ${primaryPlugin.name}`,
5435
+ state: capturedState
5056
5436
  });
5057
- if (hasChanges) {
5058
- const snapshot = createSnapshot({
5059
- project_id: project.id,
5060
- label: resolvedPluginNames.length > 1 ? `Before applying: ${resolvedPluginNames.join(" + ")}` : `Before applying: ${primaryPlugin.name}`,
5061
- state: capturedState
5062
- });
5063
- snapshotId = snapshot.id;
5064
- }
5065
- } else if (outputFormat === "human") {
5066
- ui.warn("No git remote origin: configuration snapshot will not be stored.");
5067
- ui.hint("git remote add origin <url>");
5068
- ui.hint("Snapshots and drift detection require a git repository with origin configured.");
5437
+ snapshotId = snapshot.id;
5069
5438
  }
5070
5439
  if (outputFormat === "json") {
5071
5440
  printJson({
@@ -5239,7 +5608,7 @@ async function handlePluginEditCommand(name, opts) {
5239
5608
  return;
5240
5609
  }
5241
5610
  if (opts.apply) {
5242
- const raw = readFileSync2(opts.apply, "utf8");
5611
+ const raw = readFileSync4(opts.apply, "utf8");
5243
5612
  const attachments = parsePluginEditApplyFile(raw);
5244
5613
  const pending = buildPendingFromApplySpec(candidates, attachments);
5245
5614
  const result2 = await applyPluginEdit({
@@ -5456,7 +5825,7 @@ function handlePluginDiffCommand(left, right, opts) {
5456
5825
  console.log(ui.renderChangeList(changeEntries));
5457
5826
  console.log("");
5458
5827
  console.log(
5459
- `${report.changes.length} changes ${ui.icons.bullet} ${added} added ${ui.icons.bullet} ${removed} removed ${ui.icons.bullet} ${modified} modified`
5828
+ `${formatCount(report.changes.length, "change")} ${ui.icons.bullet} ${added} added ${ui.icons.bullet} ${removed} removed ${ui.icons.bullet} ${modified} modified`
5460
5829
  );
5461
5830
  } catch (err) {
5462
5831
  process.exitCode = 1;
@@ -5501,8 +5870,9 @@ async function handlePluginDoctorCommand(name, opts) {
5501
5870
  );
5502
5871
  return;
5503
5872
  }
5873
+ const target = getPlugin(resolvedName) ?? findLocalPluginBySelector(resolvedName, { command: "ht plugin doctor" });
5504
5874
  const report = runPluginDoctor({
5505
- nameOrId: resolvedName,
5875
+ nameOrId: target?.id ?? resolvedName,
5506
5876
  checkIds: opts.check
5507
5877
  });
5508
5878
  if (format === "json") {
@@ -5549,13 +5919,18 @@ async function handlePluginDoctorCommand(name, opts) {
5549
5919
  { key: "message", header: "MESSAGE", width: 44 }
5550
5920
  ],
5551
5921
  rows,
5922
+ wordWrap: true,
5552
5923
  summary: report.valid ? `${report.plugin}: valid` : `${report.plugin}: invalid`
5553
5924
  });
5925
+ ui.info(`Resources, imported of discovered: ${formatResourceCounts(report.resource_counts)}`);
5554
5926
  if (!report.valid) {
5555
5927
  process.exitCode = 1;
5556
5928
  }
5557
5929
  } catch (err) {
5558
- fail(err instanceof Error ? err.message : String(err));
5930
+ fail(
5931
+ err instanceof Error ? err.message : String(err),
5932
+ err instanceof LocalPluginSelectorError ? { hints: err.hints } : void 0
5933
+ );
5559
5934
  process.exitCode = 1;
5560
5935
  }
5561
5936
  }
@@ -5581,7 +5956,7 @@ async function handlePluginFromProjectCommand(name, opts) {
5581
5956
  fail(error instanceof Error ? error.message : String(error));
5582
5957
  return;
5583
5958
  }
5584
- const { previewPluginFromProject } = await import("./plugin-from-project-UK7VJVUP.js");
5959
+ const { previewPluginFromProject } = await import("./plugin-from-project-FGX5AHW6.js");
5585
5960
  const preview = await previewPluginFromProject({
5586
5961
  name: resolvedName,
5587
5962
  projectRoot,
@@ -5928,7 +6303,7 @@ function printPluginSearchResults(plugins, format) {
5928
6303
  rows: plugins.map((plugin) => ({
5929
6304
  name: plugin.name,
5930
6305
  ref: plugin.ref,
5931
- version: plugin.version ?? "",
6306
+ version: catalogPluginDisplayVersion(plugin) ?? "",
5932
6307
  description: plugin.description ?? ""
5933
6308
  })),
5934
6309
  summary: formatCount(plugins.length, "plugin"),
@@ -5977,7 +6352,7 @@ async function handlePluginSearchCommand(query, opts = {}) {
5977
6352
  choices: plugins2.map((plugin) => ({
5978
6353
  name: plugin.description ? `${plugin.name}: ${plugin.description}` : plugin.name,
5979
6354
  value: plugin.ref,
5980
- description: plugin.version ? `v${plugin.version}` : void 0
6355
+ description: catalogPluginVersionLabel(plugin)
5981
6356
  }))
5982
6357
  });
5983
6358
  const pluginName = await resolveMarketplacePinPluginName(opts.plugin, true);
@@ -6022,6 +6397,27 @@ function handlePluginAddDependencyCommand(ref, opts = {}) {
6022
6397
  fail(`Plugin not found: ${targetName}`);
6023
6398
  return;
6024
6399
  }
6400
+ const parsedRef = parseDependencyRef(ref);
6401
+ const marketplace = parsedRef.source_kind === "marketplace" ? parsedRef.namespace : "";
6402
+ if (marketplace && !marketplaceIsKnown(marketplace, resolveHomeRoot())) {
6403
+ process.exitCode = 1;
6404
+ fail(`Marketplace ${marketplace} is not configured.`, {
6405
+ hint: `ht marketplace add <git-url> --name ${marketplace}`
6406
+ });
6407
+ return;
6408
+ }
6409
+ if (marketplace && marketplaceListsPlugin({
6410
+ homeRoot: resolveHomeRoot(),
6411
+ harnesstapDir: getHarnesstapDir(),
6412
+ marketplace,
6413
+ pluginName: parsedRef.name
6414
+ }) === false) {
6415
+ process.exitCode = 1;
6416
+ fail(`Plugin ${parsedRef.name} not found in marketplace ${marketplace}.`, {
6417
+ hint: `ht marketplace show ${marketplace}`
6418
+ });
6419
+ return;
6420
+ }
6025
6421
  addDependency(plugin.id, ref);
6026
6422
  const format = parseOutputFormat(opts.format);
6027
6423
  if (format === "json") {
@@ -6138,7 +6534,10 @@ function registerPluginCommands(root) {
6138
6534
  }
6139
6535
  handlePluginShowCommand(resolvedName, opts);
6140
6536
  });
6141
- 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) => {
6537
+ 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) => {
6538
+ if (handlePluginHideOptions(name, opts)) {
6539
+ return;
6540
+ }
6142
6541
  try {
6143
6542
  await handlePluginEditCommand(name, opts);
6144
6543
  } catch (error) {
@@ -6199,7 +6598,10 @@ function registerPluginCommands(root) {
6199
6598
  pluginCmd.command("add").argument(
6200
6599
  "<ref>",
6201
6600
  "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"
6202
- ).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(
6601
+ ).option("--to <plugin>", "Plugin that receives the dependency (skips GitHub library import)").addOption(new Option2("--layer <plugin>", "Deprecated alias for --to").hideHelp()).option(
6602
+ "--force-remove",
6603
+ "Back up and replace files in a host plugin cache folder that HarnessTap did not write"
6604
+ ).option("--format <mode>", "Output format: human or json", "human").description(
6203
6605
  "Import a GitHub plugin.json package into the library, or add a dependency to a plugin with --to"
6204
6606
  ).action(async (ref, opts) => {
6205
6607
  try {
@@ -6384,6 +6786,14 @@ function registerPluginCommands(root) {
6384
6786
  renderCliError(error);
6385
6787
  }
6386
6788
  });
6789
+ 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) => {
6790
+ try {
6791
+ await handlePluginAutoUpdateCommand(opts);
6792
+ } catch (error) {
6793
+ process.exitCode = 1;
6794
+ renderCliError(error);
6795
+ }
6796
+ });
6387
6797
  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) => {
6388
6798
  handlePluginWhyCommand(target, opts);
6389
6799
  });
@@ -6419,4 +6829,4 @@ export {
6419
6829
  registerPluginCommands,
6420
6830
  registerDeprecatedLayerAlias
6421
6831
  };
6422
- //# sourceMappingURL=chunk-QA5U36JN.js.map
6832
+ //# sourceMappingURL=chunk-ZT7ANP3H.js.map