harnesstap 1.3.1 → 1.4.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 (217) hide show
  1. package/README.md +2 -0
  2. package/dist/apply-SUNDXRJ3.js +54 -0
  3. package/dist/{approve-KQNCNH2R.js → approve-FBGYQGWN.js} +14 -15
  4. package/dist/{approve-KQNCNH2R.js.map → approve-FBGYQGWN.js.map} +1 -1
  5. package/dist/{audit-SLYOZCMI.js → audit-VI4QZ6X2.js} +30 -39
  6. package/dist/{audit-SLYOZCMI.js.map → audit-VI4QZ6X2.js.map} +1 -1
  7. package/dist/{auth-3IEVICFT.js → auth-4CQCDS2W.js} +17 -19
  8. package/dist/{auth-3IEVICFT.js.map → auth-4CQCDS2W.js.map} +1 -1
  9. package/dist/bin.js +3 -3
  10. package/dist/{chunk-KDDXZBMC.js → chunk-23XSG7LI.js} +7 -11
  11. package/dist/{chunk-KDDXZBMC.js.map → chunk-23XSG7LI.js.map} +1 -1
  12. package/dist/{chunk-YDD3ES2K.js → chunk-2A36HWDE.js} +63 -13
  13. package/dist/chunk-2A36HWDE.js.map +1 -0
  14. package/dist/{chunk-IK524ZDW.js → chunk-3FS775NP.js} +51 -4
  15. package/dist/chunk-3FS775NP.js.map +1 -0
  16. package/dist/{chunk-IBOABSIA.js → chunk-3P6BWL5F.js} +2 -2
  17. package/dist/{chunk-G26HZZDJ.js → chunk-43BDGVN3.js} +19 -6
  18. package/dist/chunk-43BDGVN3.js.map +1 -0
  19. package/dist/{chunk-TYULB6ZY.js → chunk-4ZQ2SCGY.js} +146 -78
  20. package/dist/chunk-4ZQ2SCGY.js.map +1 -0
  21. package/dist/{chunk-6BY4BV5G.js → chunk-6LTLYV5D.js} +353 -230
  22. package/dist/chunk-6LTLYV5D.js.map +1 -0
  23. package/dist/{chunk-GQKKX7OE.js → chunk-73OJQTBW.js} +6 -2
  24. package/dist/chunk-73OJQTBW.js.map +1 -0
  25. package/dist/{chunk-IRU7NBOT.js → chunk-7HP6AAI3.js} +2 -2
  26. package/dist/{chunk-MWXA4PFE.js → chunk-BPWFQKI5.js} +5 -7
  27. package/dist/{chunk-MWXA4PFE.js.map → chunk-BPWFQKI5.js.map} +1 -1
  28. package/dist/{chunk-3RBYT7QN.js → chunk-D432JAXV.js} +44 -19
  29. package/dist/chunk-D432JAXV.js.map +1 -0
  30. package/dist/chunk-DF4Z7LAD.js +3463 -0
  31. package/dist/chunk-DF4Z7LAD.js.map +1 -0
  32. package/dist/{chunk-J4CKQXQ6.js → chunk-EOPFER6N.js} +71 -318
  33. package/dist/chunk-EOPFER6N.js.map +1 -0
  34. package/dist/chunk-G6WKY2W4.js +389 -0
  35. package/dist/chunk-G6WKY2W4.js.map +1 -0
  36. package/dist/{chunk-JKGSJGCC.js → chunk-GRASK6M6.js} +5 -5
  37. package/dist/{chunk-63U7QWNY.js → chunk-IE7B6Q5K.js} +33 -39
  38. package/dist/chunk-IE7B6Q5K.js.map +1 -0
  39. package/dist/{chunk-VC6OKCJF.js → chunk-IMROMZ2K.js} +7 -4
  40. package/dist/{chunk-VC6OKCJF.js.map → chunk-IMROMZ2K.js.map} +1 -1
  41. package/dist/{chunk-DV74UZJI.js → chunk-L6YZE5MY.js} +3 -3
  42. package/dist/{chunk-SNVAMWB7.js → chunk-M2U3J7UX.js} +7 -1
  43. package/dist/chunk-M2U3J7UX.js.map +1 -0
  44. package/dist/{chunk-BSOBXLYI.js → chunk-M4KLHJ6U.js} +16 -13
  45. package/dist/chunk-M4KLHJ6U.js.map +1 -0
  46. package/dist/{chunk-VL7BGD47.js → chunk-MR7IOHSX.js} +16 -19
  47. package/dist/chunk-MR7IOHSX.js.map +1 -0
  48. package/dist/{chunk-4KNQZDZC.js → chunk-N3VGY3T3.js} +15 -15
  49. package/dist/chunk-N3VGY3T3.js.map +1 -0
  50. package/dist/{chunk-ZY2MZ2KQ.js → chunk-N3ZCH64F.js} +496 -10
  51. package/dist/chunk-N3ZCH64F.js.map +1 -0
  52. package/dist/{chunk-H6DVP2SI.js → chunk-OML4HXKT.js} +20 -22
  53. package/dist/chunk-OML4HXKT.js.map +1 -0
  54. package/dist/{chunk-NJ7WRKIQ.js → chunk-P2C7JPLD.js} +3 -3
  55. package/dist/{chunk-LNJ3WZZX.js → chunk-PCMON7Y2.js} +7 -7
  56. package/dist/{chunk-VL2NWCZV.js → chunk-PNGF5EV2.js} +2 -2
  57. package/dist/{chunk-SZNBUIDR.js → chunk-QA5U36JN.js} +199 -215
  58. package/dist/chunk-QA5U36JN.js.map +1 -0
  59. package/dist/{chunk-KDAV2GUT.js → chunk-R7ZOYVN3.js} +241 -126
  60. package/dist/chunk-R7ZOYVN3.js.map +1 -0
  61. package/dist/{chunk-QO4LBDVI.js → chunk-RDG5DT7S.js} +45 -49
  62. package/dist/{chunk-QO4LBDVI.js.map → chunk-RDG5DT7S.js.map} +1 -1
  63. package/dist/{chunk-VQVUJYYY.js → chunk-REHRUNBB.js} +8 -3
  64. package/dist/chunk-REHRUNBB.js.map +1 -0
  65. package/dist/{chunk-DXKAKKLP.js → chunk-RFQ3N7FB.js} +19 -29
  66. package/dist/chunk-RFQ3N7FB.js.map +1 -0
  67. package/dist/{chunk-C4QBVVEH.js → chunk-RVEXPMM3.js} +3 -3
  68. package/dist/{chunk-XFZQVYIN.js → chunk-TPEJFLV7.js} +13 -15
  69. package/dist/{chunk-XFZQVYIN.js.map → chunk-TPEJFLV7.js.map} +1 -1
  70. package/dist/{chunk-7LWH5SWH.js → chunk-U6DXASQP.js} +2 -2
  71. package/dist/{chunk-BIBUCC2E.js → chunk-ULCD6DJE.js} +30 -8
  72. package/dist/chunk-ULCD6DJE.js.map +1 -0
  73. package/dist/{chunk-KMWHZSEG.js → chunk-UVVZHWD2.js} +2 -2
  74. package/dist/{chunk-DWVAR4BP.js → chunk-WG5A6EAU.js} +270 -12
  75. package/dist/chunk-WG5A6EAU.js.map +1 -0
  76. package/dist/{chunk-QRZPQNLX.js → chunk-WGP4GUYZ.js} +10 -10
  77. package/dist/{chunk-F2L4VNQK.js → chunk-XTVGCVU4.js} +124 -83
  78. package/dist/chunk-XTVGCVU4.js.map +1 -0
  79. package/dist/{chunk-EIWXS4RM.js → chunk-XUJKZQZA.js} +8 -8
  80. package/dist/chunk-XUJKZQZA.js.map +1 -0
  81. package/dist/chunk-ZUASVASP.js +30317 -0
  82. package/dist/chunk-ZUASVASP.js.map +1 -0
  83. package/dist/{compile-57EEIUMB.js → compile-GXADKGH5.js} +37 -50
  84. package/dist/{compile-57EEIUMB.js.map → compile-GXADKGH5.js.map} +1 -1
  85. package/dist/{config-4EJ3D7QJ.js → config-JMHNA2U5.js} +22 -35
  86. package/dist/{config-4EJ3D7QJ.js.map → config-JMHNA2U5.js.map} +1 -1
  87. package/dist/cursor-local-install-46RWRBDT.js +98 -0
  88. package/dist/cursor-local-install-46RWRBDT.js.map +1 -0
  89. package/dist/{doctor-EEV6P5CH.js → doctor-N7ZULPOL.js} +18 -19
  90. package/dist/{doctor-EEV6P5CH.js.map → doctor-N7ZULPOL.js.map} +1 -1
  91. package/dist/{environment-WFEG4DAT.js → environment-OBB3WU5B.js} +60 -71
  92. package/dist/{environment-WFEG4DAT.js.map → environment-OBB3WU5B.js.map} +1 -1
  93. package/dist/{github-BSMQD72A.js → github-PBYBGOLH.js} +17 -17
  94. package/dist/{harness-VX3PNVQW.js → harness-7KYATIV6.js} +56 -67
  95. package/dist/{harness-VX3PNVQW.js.map → harness-7KYATIV6.js.map} +1 -1
  96. package/dist/{help-AW2HKX63.js → help-EE3AJQD4.js} +48 -52
  97. package/dist/help-EE3AJQD4.js.map +1 -0
  98. package/dist/{help-BVFOZD7E.js → help-VXWKLQ6A.js} +55 -15
  99. package/dist/help-VXWKLQ6A.js.map +1 -0
  100. package/dist/index.d.ts +7 -0
  101. package/dist/index.js +16 -24
  102. package/dist/{init-SPN2GEZ4.js → init-LBTMPDVJ.js} +43 -56
  103. package/dist/init-LBTMPDVJ.js.map +1 -0
  104. package/dist/live-read-cache-TUSP7U3D.js +10 -0
  105. package/dist/{lock-K2LLUU7H.js → lock-WLJRXRVK.js} +16 -16
  106. package/dist/{marketplace-VEKSWGX3.js → marketplace-GXSV6QIY.js} +62 -28
  107. package/dist/marketplace-GXSV6QIY.js.map +1 -0
  108. package/dist/{mcp-T6DKIKSF.js → mcp-XPDWWU75.js} +35 -48
  109. package/dist/{mcp-T6DKIKSF.js.map → mcp-XPDWWU75.js.map} +1 -1
  110. package/dist/{migrate-OO37WSB2.js → migrate-SBUIWN3U.js} +79 -64
  111. package/dist/migrate-SBUIWN3U.js.map +1 -0
  112. package/dist/open-HDGLYYVU.js +24 -0
  113. package/dist/{pack-V32UPC7W.js → pack-A73LDVOX.js} +16 -22
  114. package/dist/{pack-V32UPC7W.js.map → pack-A73LDVOX.js.map} +1 -1
  115. package/dist/plugin-CEO6ZJM5.js +51 -0
  116. package/dist/plugin-from-project-UK7VJVUP.js +18 -0
  117. package/dist/{policy-F5MKZNOC.js → policy-6VY3CMSU.js} +13 -14
  118. package/dist/{policy-F5MKZNOC.js.map → policy-6VY3CMSU.js.map} +1 -1
  119. package/dist/{profile-H4PMH4XT.js → profile-YCKPMRRU.js} +96 -102
  120. package/dist/profile-YCKPMRRU.js.map +1 -0
  121. package/dist/{project-QVNEJJGH.js → project-KHPPBKPN.js} +63 -77
  122. package/dist/{project-QVNEJJGH.js.map → project-KHPPBKPN.js.map} +1 -1
  123. package/dist/{resource-GL4RLSGI.js → resource-IJU3FAN5.js} +42 -49
  124. package/dist/{resource-GL4RLSGI.js.map → resource-IJU3FAN5.js.map} +1 -1
  125. package/dist/{version-PBHZK44K.js → version-Z66FWWMQ.js} +2 -2
  126. package/dist/version-Z66FWWMQ.js.map +1 -0
  127. package/package.json +4 -1
  128. package/schemas/fixtures/confidence.ap.json +1 -1
  129. package/schemas/fixtures/context7.ap.json +1 -1
  130. package/schemas/fixtures/legacy-schema-v1.ap.json +13 -0
  131. package/schemas/fixtures/legacy-schemas-v1.ap.json +13 -0
  132. package/schemas/fixtures/minimal-with-schema.ap.json +1 -1
  133. package/schemas/fixtures/superpowers.ap.json +1 -1
  134. package/schemas/fixtures/third-party-skills.ap.json +1 -1
  135. package/dist/apply-2GRNKR5H.js +0 -67
  136. package/dist/chunk-2EIJYDNI.js +0 -10945
  137. package/dist/chunk-2EIJYDNI.js.map +0 -1
  138. package/dist/chunk-3IWTJCPA.js +0 -6448
  139. package/dist/chunk-3IWTJCPA.js.map +0 -1
  140. package/dist/chunk-3IZ7SEGT.js +0 -346
  141. package/dist/chunk-3IZ7SEGT.js.map +0 -1
  142. package/dist/chunk-3RBYT7QN.js.map +0 -1
  143. package/dist/chunk-4KNQZDZC.js.map +0 -1
  144. package/dist/chunk-63U7QWNY.js.map +0 -1
  145. package/dist/chunk-6BY4BV5G.js.map +0 -1
  146. package/dist/chunk-7L2K4N25.js +0 -610
  147. package/dist/chunk-7L2K4N25.js.map +0 -1
  148. package/dist/chunk-BIBUCC2E.js.map +0 -1
  149. package/dist/chunk-BSOBXLYI.js.map +0 -1
  150. package/dist/chunk-DWVAR4BP.js.map +0 -1
  151. package/dist/chunk-DXKAKKLP.js.map +0 -1
  152. package/dist/chunk-EIWXS4RM.js.map +0 -1
  153. package/dist/chunk-EWBCFAF3.js +0 -681
  154. package/dist/chunk-EWBCFAF3.js.map +0 -1
  155. package/dist/chunk-F2L4VNQK.js.map +0 -1
  156. package/dist/chunk-G26HZZDJ.js.map +0 -1
  157. package/dist/chunk-GQKKX7OE.js.map +0 -1
  158. package/dist/chunk-GRJY22U6.js +0 -691
  159. package/dist/chunk-GRJY22U6.js.map +0 -1
  160. package/dist/chunk-H6DVP2SI.js.map +0 -1
  161. package/dist/chunk-HVVPTCKR.js +0 -1173
  162. package/dist/chunk-HVVPTCKR.js.map +0 -1
  163. package/dist/chunk-IK524ZDW.js.map +0 -1
  164. package/dist/chunk-J4CKQXQ6.js.map +0 -1
  165. package/dist/chunk-JRFUTIEH.js +0 -426
  166. package/dist/chunk-JRFUTIEH.js.map +0 -1
  167. package/dist/chunk-K2BPYEH5.js +0 -491
  168. package/dist/chunk-K2BPYEH5.js.map +0 -1
  169. package/dist/chunk-KCQC7YBK.js +0 -7795
  170. package/dist/chunk-KCQC7YBK.js.map +0 -1
  171. package/dist/chunk-KDAV2GUT.js.map +0 -1
  172. package/dist/chunk-MY62SSKC.js +0 -183
  173. package/dist/chunk-MY62SSKC.js.map +0 -1
  174. package/dist/chunk-PXU2OS26.js +0 -238
  175. package/dist/chunk-PXU2OS26.js.map +0 -1
  176. package/dist/chunk-SNVAMWB7.js.map +0 -1
  177. package/dist/chunk-SPRVUATR.js +0 -430
  178. package/dist/chunk-SPRVUATR.js.map +0 -1
  179. package/dist/chunk-SY7G5QEI.js +0 -35
  180. package/dist/chunk-SY7G5QEI.js.map +0 -1
  181. package/dist/chunk-SZNBUIDR.js.map +0 -1
  182. package/dist/chunk-TYULB6ZY.js.map +0 -1
  183. package/dist/chunk-UJYFTXHV.js +0 -296
  184. package/dist/chunk-UJYFTXHV.js.map +0 -1
  185. package/dist/chunk-VL7BGD47.js.map +0 -1
  186. package/dist/chunk-VQVUJYYY.js.map +0 -1
  187. package/dist/chunk-XQFT4PEP.js +0 -60
  188. package/dist/chunk-XQFT4PEP.js.map +0 -1
  189. package/dist/chunk-YDD3ES2K.js.map +0 -1
  190. package/dist/chunk-ZY2MZ2KQ.js.map +0 -1
  191. package/dist/help-AW2HKX63.js.map +0 -1
  192. package/dist/help-BVFOZD7E.js.map +0 -1
  193. package/dist/init-SPN2GEZ4.js.map +0 -1
  194. package/dist/marketplace-VEKSWGX3.js.map +0 -1
  195. package/dist/migrate-OO37WSB2.js.map +0 -1
  196. package/dist/open-3V3QK5RK.js +0 -32
  197. package/dist/plugin-KOBNQ7GT.js +0 -64
  198. package/dist/plugin-from-project-X3VO3MB6.js +0 -16
  199. package/dist/profile-H4PMH4XT.js.map +0 -1
  200. /package/dist/{apply-2GRNKR5H.js.map → apply-SUNDXRJ3.js.map} +0 -0
  201. /package/dist/{chunk-IBOABSIA.js.map → chunk-3P6BWL5F.js.map} +0 -0
  202. /package/dist/{chunk-IRU7NBOT.js.map → chunk-7HP6AAI3.js.map} +0 -0
  203. /package/dist/{chunk-JKGSJGCC.js.map → chunk-GRASK6M6.js.map} +0 -0
  204. /package/dist/{chunk-DV74UZJI.js.map → chunk-L6YZE5MY.js.map} +0 -0
  205. /package/dist/{chunk-NJ7WRKIQ.js.map → chunk-P2C7JPLD.js.map} +0 -0
  206. /package/dist/{chunk-LNJ3WZZX.js.map → chunk-PCMON7Y2.js.map} +0 -0
  207. /package/dist/{chunk-VL2NWCZV.js.map → chunk-PNGF5EV2.js.map} +0 -0
  208. /package/dist/{chunk-C4QBVVEH.js.map → chunk-RVEXPMM3.js.map} +0 -0
  209. /package/dist/{chunk-7LWH5SWH.js.map → chunk-U6DXASQP.js.map} +0 -0
  210. /package/dist/{chunk-KMWHZSEG.js.map → chunk-UVVZHWD2.js.map} +0 -0
  211. /package/dist/{chunk-QRZPQNLX.js.map → chunk-WGP4GUYZ.js.map} +0 -0
  212. /package/dist/{github-BSMQD72A.js.map → github-PBYBGOLH.js.map} +0 -0
  213. /package/dist/{open-3V3QK5RK.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
  214. /package/dist/{lock-K2LLUU7H.js.map → lock-WLJRXRVK.js.map} +0 -0
  215. /package/dist/{plugin-KOBNQ7GT.js.map → open-HDGLYYVU.js.map} +0 -0
  216. /package/dist/{plugin-from-project-X3VO3MB6.js.map → plugin-CEO6ZJM5.js.map} +0 -0
  217. /package/dist/{version-PBHZK44K.js.map → plugin-from-project-UK7VJVUP.js.map} +0 -0
@@ -1,18 +1,19 @@
1
- import {
2
- githubGitConfigArgs,
3
- githubHttpsRemoteForAuth,
4
- resolveGithubAccessToken
5
- } from "./chunk-GQKKX7OE.js";
6
1
  import {
7
2
  DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,
8
3
  loadSettings,
9
4
  marketplaceRefreshMaxAgeMs,
10
5
  parseTrackedBranches,
11
6
  saveSettings
12
- } from "./chunk-VQVUJYYY.js";
7
+ } from "./chunk-REHRUNBB.js";
13
8
  import {
14
- mapGitStderr
15
- } from "./chunk-DWVAR4BP.js";
9
+ HOST_PLUGIN_MANIFEST_RELATIVE_PATHS,
10
+ lookupApSchema,
11
+ readCachedMarketplaceJson,
12
+ readFirstHostPluginManifest,
13
+ readJsonFile,
14
+ refreshGitSource,
15
+ runCommandWithTimeout
16
+ } from "./chunk-G6WKY2W4.js";
16
17
 
17
18
  // src/services/marketplace-registry.ts
18
19
  import { homedir } from "os";
@@ -110,100 +111,75 @@ function removeMarketplace(harnesstapDir, name) {
110
111
  });
111
112
  return { status: "removed", entry };
112
113
  }
114
+ function updateMarketplace(harnesstapDir, currentName, input) {
115
+ const settings = loadSettings(harnesstapDir);
116
+ const existing = settings.plugins.marketplaces;
117
+ const index = existing.findIndex((e) => e.name === currentName);
118
+ if (index < 0) return { status: "not_found", name: currentName };
119
+ const current = existing[index];
120
+ if (!current) return { status: "not_found", name: currentName };
121
+ const nextName = input.name !== void 0 ? input.name.trim() : current.name;
122
+ if (!nextName) throw new Error("Marketplace name is required");
123
+ const nextUrl = input.url !== void 0 ? normalizeMarketplaceUrl(input.url) : current.url;
124
+ if (!nextUrl) throw new Error("Marketplace URL is required");
125
+ const nextPlatforms = input.platforms !== void 0 ? [...input.platforms] : [...current.platforms];
126
+ if (nextPlatforms.length === 0) {
127
+ throw new Error("At least one --platform is required");
128
+ }
129
+ const nextTrackedBranches = input.trackedBranches !== void 0 ? parseTrackedBranches(input.trackedBranches) : parseTrackedBranches(current.trackedBranches ?? []);
130
+ if (nextName !== current.name) {
131
+ const collision = existing.find((e) => e.name === nextName);
132
+ if (collision) {
133
+ throw new Error(
134
+ `Marketplace name conflict: "${nextName}" already points at ${collision.url}. Pass a different --name or remove it first.`
135
+ );
136
+ }
137
+ }
138
+ if (nextUrl !== current.url) {
139
+ const collision = existing.find(
140
+ (e) => e.name !== current.name && normalizeMarketplaceUrl(e.url) === nextUrl
141
+ );
142
+ if (collision) {
143
+ throw new Error(
144
+ `Marketplace URL conflict: "${collision.name}" already points at ${collision.url}. Pass a different --url or remove it first.`
145
+ );
146
+ }
147
+ }
148
+ const entry = marketplaceEntryPayload(
149
+ nextName,
150
+ nextUrl,
151
+ nextPlatforms,
152
+ nextTrackedBranches
153
+ );
154
+ const trackedBranchesChanged = parseTrackedBranches(current.trackedBranches ?? []).join("\0") !== parseTrackedBranches(entry.trackedBranches ?? []).join("\0");
155
+ const marketplaces = [...existing];
156
+ marketplaces[index] = entry;
157
+ saveSettings(harnesstapDir, {
158
+ ...settings,
159
+ plugins: { ...settings.plugins, marketplaces }
160
+ });
161
+ return {
162
+ status: "updated",
163
+ entry,
164
+ ...nextName !== current.name ? { renamedFrom: current.name } : {},
165
+ urlChanged: nextUrl !== current.url,
166
+ trackedBranchesChanged
167
+ };
168
+ }
113
169
 
114
170
  // src/services/marketplace-catalog.ts
115
171
  import {
116
- existsSync as existsSync5,
117
- mkdirSync as mkdirSync2,
172
+ existsSync as existsSync3,
173
+ mkdirSync,
118
174
  mkdtempSync,
119
- readFileSync as readFileSync4,
175
+ readFileSync as readFileSync3,
120
176
  renameSync,
121
- rmSync as rmSync2,
177
+ rmSync,
122
178
  statSync as statSync3,
123
179
  writeFileSync
124
180
  } from "fs";
125
181
  import { tmpdir } from "os";
126
- import { dirname, join as join5 } from "path";
127
-
128
- // src/plugins/refresh.ts
129
- import { existsSync, mkdirSync, rmSync } from "fs";
130
- import { join } from "path";
131
-
132
- // src/utils/run-command-with-timeout.ts
133
- import { spawnSync } from "child_process";
134
- var DEFAULT_GIT_CLONE_TIMEOUT_MS = 12e4;
135
- function runCommandWithTimeout(command, args, options) {
136
- const timeoutMs = options?.timeoutMs ?? DEFAULT_GIT_CLONE_TIMEOUT_MS;
137
- const result = spawnSync(command, args, {
138
- encoding: "utf-8",
139
- stdio: ["ignore", "pipe", "pipe"],
140
- cwd: options?.cwd,
141
- timeout: timeoutMs,
142
- killSignal: "SIGTERM",
143
- env: command === "git" ? { ...process.env, GIT_TERMINAL_PROMPT: "0", GCM_INTERACTIVE: "never" } : process.env
144
- });
145
- const spawnError = result.error;
146
- if (spawnError && "code" in spawnError && spawnError.code === "ETIMEDOUT") {
147
- return {
148
- stdout: result.stdout?.toString() ?? "",
149
- stderr: `Command timed out after ${timeoutMs}ms: ${command} ${args.join(" ")}`,
150
- exitCode: 124
151
- };
152
- }
153
- return {
154
- stdout: result.stdout?.toString() ?? "",
155
- stderr: result.stderr?.toString() ?? "",
156
- exitCode: result.status ?? 1
157
- };
158
- }
159
-
160
- // src/plugins/refresh.ts
161
- function refreshGitSource(opts) {
162
- const run = opts.runCommand ?? runCommandWithTimeout;
163
- if (existsSync(opts.targetDir)) {
164
- rmSync(opts.targetDir, { recursive: true, force: true });
165
- }
166
- mkdirSync(opts.targetDir, { recursive: true });
167
- const token = resolveGithubAccessToken().token;
168
- const url = githubHttpsRemoteForAuth(opts.url, token);
169
- const cloneArgs = [...githubGitConfigArgs(token), "clone", "--depth", "1"];
170
- if (opts.ref) cloneArgs.push("--branch", opts.ref);
171
- cloneArgs.push(url, opts.targetDir);
172
- const clone = run("git", cloneArgs, { timeoutMs: DEFAULT_GIT_CLONE_TIMEOUT_MS });
173
- if (clone.exitCode !== 0) {
174
- return {
175
- ok: false,
176
- message: mapGitStderr(clone.stderr.trim() || "git clone failed", opts.url)
177
- };
178
- }
179
- const rev = run("git", [
180
- ...githubGitConfigArgs(token),
181
- "-C",
182
- opts.targetDir,
183
- "rev-parse",
184
- "HEAD"
185
- ]);
186
- return {
187
- ok: true,
188
- sha: rev.stdout.trim(),
189
- message: "Refreshed from git"
190
- };
191
- }
192
- function cursorRepoSourceKey(url) {
193
- return `cursor:repo:${url}`;
194
- }
195
- function cursorCacheRoot(homeRoot) {
196
- return join(homeRoot, ".cursor", "plugins", "cache");
197
- }
198
- function cursorLocalRoot(homeRoot) {
199
- return join(homeRoot, ".cursor", "plugins", "local");
200
- }
201
- function cursorMarketplacesRoot(homeRoot) {
202
- return join(homeRoot, ".cursor", "plugins", "marketplaces");
203
- }
204
- function cursorProjectsMcpsRoot(homeRoot) {
205
- return join(homeRoot, ".cursor", "projects", "mcps");
206
- }
182
+ import { dirname, join as join3 } from "path";
207
183
 
208
184
  // src/services/builtin-marketplaces.ts
209
185
  var CURSOR_PUBLIC_MARKETPLACE = "cursor-public";
@@ -227,49 +203,13 @@ function builtinMarketplaceEntry() {
227
203
  }
228
204
 
229
205
  // src/services/marketplace-catalog-index.ts
230
- import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
231
- import { join as join4 } from "path";
232
- import matter2 from "gray-matter";
233
-
234
- // src/plugins/host-plugin-manifest.ts
235
- import { existsSync as existsSync2, readFileSync } from "fs";
206
+ import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync as readFileSync2, statSync as statSync2 } from "fs";
236
207
  import { join as join2 } from "path";
237
- var HOST_PLUGIN_MANIFEST_RELATIVE_PATHS = [
238
- ".claude-plugin/plugin.json",
239
- ".cursor-plugin/plugin.json",
240
- ".codex-plugin/plugin.json",
241
- ".github/plugin/plugin.json",
242
- ".goose-plugin/plugin.json",
243
- "plugin.json"
244
- ];
245
- function readJsonFile(path) {
246
- if (!existsSync2(path)) return null;
247
- try {
248
- return JSON.parse(readFileSync(path, "utf-8"));
249
- } catch {
250
- return null;
251
- }
252
- }
253
- function readFirstHostPluginManifest(installPath) {
254
- for (const relativePath of HOST_PLUGIN_MANIFEST_RELATIVE_PATHS) {
255
- const manifest = readJsonFile(
256
- join2(installPath, relativePath)
257
- );
258
- if (manifest?.name) {
259
- return manifest;
260
- }
261
- }
262
- return null;
263
- }
264
- function parsePluginRef(ref) {
265
- const at = ref.lastIndexOf("@");
266
- if (at <= 0) return { name: ref, marketplace: "" };
267
- return { name: ref.slice(0, at), marketplace: ref.slice(at + 1) };
268
- }
208
+ import matter2 from "gray-matter";
269
209
 
270
210
  // src/services/skill-discovery.ts
271
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
272
- import { join as join3, relative } from "path";
211
+ import { existsSync, readdirSync, readFileSync, statSync } from "fs";
212
+ import { join, relative } from "path";
273
213
  import matter from "gray-matter";
274
214
  var SKILL_ROOTS = ["skills", ".agents/skills"];
275
215
  function isDirectory(path) {
@@ -316,11 +256,11 @@ function parseSkillMarkdown(raw) {
316
256
  }
317
257
  }
318
258
  function readSkillMd(skillDir) {
319
- const skillPath = join3(skillDir, "SKILL.md");
320
- if (!existsSync3(skillPath)) return null;
259
+ const skillPath = join(skillDir, "SKILL.md");
260
+ if (!existsSync(skillPath)) return null;
321
261
  let raw;
322
262
  try {
323
- raw = readFileSync2(skillPath, "utf-8");
263
+ raw = readFileSync(skillPath, "utf-8");
324
264
  } catch {
325
265
  return null;
326
266
  }
@@ -351,17 +291,17 @@ function walkForSkills(rootPath, currentDir, results) {
351
291
  }
352
292
  for (const entry of readdirSync(currentDir)) {
353
293
  if (entry.startsWith(".")) continue;
354
- walkForSkills(rootPath, join3(currentDir, entry), results);
294
+ walkForSkills(rootPath, join(currentDir, entry), results);
355
295
  }
356
296
  }
357
297
  function discoverSkillPackage(rootPath) {
358
298
  const results = [];
359
299
  for (const root of SKILL_ROOTS) {
360
- const dir = join3(rootPath, root);
300
+ const dir = join(rootPath, root);
361
301
  if (!isDirectory(dir)) continue;
362
302
  for (const entry of readdirSync(dir)) {
363
303
  if (entry.startsWith(".")) continue;
364
- walkForSkills(rootPath, join3(dir, entry), results);
304
+ walkForSkills(rootPath, join(dir, entry), results);
365
305
  }
366
306
  }
367
307
  const byName = /* @__PURE__ */ new Map();
@@ -377,7 +317,7 @@ var PLUGIN_ROOT_WALK_MAX_DEPTH = 6;
377
317
  var COMMAND_DIRS = ["commands", ".claude/commands"];
378
318
  function isDirectory2(path) {
379
319
  try {
380
- return existsSync4(path) && statSync2(path).isDirectory();
320
+ return existsSync2(path) && statSync2(path).isDirectory();
381
321
  } catch {
382
322
  return false;
383
323
  }
@@ -392,11 +332,19 @@ function uniqueStrings(values) {
392
332
  }
393
333
  return next;
394
334
  }
335
+ function agentPluginPackageFormat(pluginRoot) {
336
+ const manifest = readJsonFile(join2(pluginRoot, "plugin.json"));
337
+ const schema = manifest?.$schema;
338
+ if (typeof schema === "string" && lookupApSchema(schema).kind === "current") {
339
+ return "agent-plugin";
340
+ }
341
+ return void 0;
342
+ }
395
343
  function looksLikePluginRoot(path) {
396
344
  for (const relative2 of HOST_PLUGIN_MANIFEST_RELATIVE_PATHS) {
397
- if (existsSync4(join4(path, relative2))) return true;
345
+ if (existsSync2(join2(path, relative2))) return true;
398
346
  }
399
- return isDirectory2(join4(path, "skills")) || isDirectory2(join4(path, "commands"));
347
+ return isDirectory2(join2(path, "skills")) || isDirectory2(join2(path, "commands"));
400
348
  }
401
349
  function walkNamedPluginRoot(dir, pluginName, depth) {
402
350
  if (depth > PLUGIN_ROOT_WALK_MAX_DEPTH || !isDirectory2(dir)) {
@@ -408,7 +356,7 @@ function walkNamedPluginRoot(dir, pluginName, depth) {
408
356
  if (!entry.isDirectory() || PLUGIN_ROOT_WALK_SKIP.has(entry.name)) {
409
357
  continue;
410
358
  }
411
- const child = join4(dir, entry.name);
359
+ const child = join2(dir, entry.name);
412
360
  if (entry.name === pluginName && looksLikePluginRoot(child)) {
413
361
  return child;
414
362
  }
@@ -422,14 +370,14 @@ function walkNamedPluginRoot(dir, pluginName, depth) {
422
370
  }
423
371
  function resolveMarketplaceCatalogPluginRoot(marketplaceRoot, plugin) {
424
372
  if (plugin.sourcePath) {
425
- const fromSource = join4(marketplaceRoot, plugin.sourcePath);
373
+ const fromSource = join2(marketplaceRoot, plugin.sourcePath);
426
374
  if (isDirectory2(fromSource)) return fromSource;
427
375
  }
428
- const underPlugins = join4(marketplaceRoot, "plugins", plugin.name);
376
+ const underPlugins = join2(marketplaceRoot, "plugins", plugin.name);
429
377
  if (isDirectory2(underPlugins) && looksLikePluginRoot(underPlugins)) {
430
378
  return underPlugins;
431
379
  }
432
- const atRoot = join4(marketplaceRoot, plugin.name);
380
+ const atRoot = join2(marketplaceRoot, plugin.name);
433
381
  if (isDirectory2(atRoot) && looksLikePluginRoot(atRoot)) {
434
382
  return atRoot;
435
383
  }
@@ -439,7 +387,7 @@ function commandContents(pluginRoot) {
439
387
  const contents = [];
440
388
  const seen = /* @__PURE__ */ new Set();
441
389
  for (const relative2 of COMMAND_DIRS) {
442
- const dir = join4(pluginRoot, relative2);
390
+ const dir = join2(pluginRoot, relative2);
443
391
  if (!isDirectory2(dir)) continue;
444
392
  let entries;
445
393
  try {
@@ -450,11 +398,11 @@ function commandContents(pluginRoot) {
450
398
  for (const entry of entries) {
451
399
  const name = entry.replace(/\.(md|toml)$/, "");
452
400
  if (name === entry || seen.has(name)) continue;
453
- const absolute = join4(dir, entry);
401
+ const absolute = join2(dir, entry);
454
402
  let description;
455
403
  if (entry.endsWith(".md")) {
456
404
  try {
457
- const parsed = matter2(readFileSync3(absolute, "utf8"));
405
+ const parsed = matter2(readFileSync2(absolute, "utf8"));
458
406
  if (typeof parsed.data.description === "string") {
459
407
  description = parsed.data.description;
460
408
  }
@@ -474,7 +422,10 @@ function commandContents(pluginRoot) {
474
422
  }
475
423
  function enrichCatalogPlugin(marketplaceRoot, plugin) {
476
424
  const pluginRoot = resolveMarketplaceCatalogPluginRoot(marketplaceRoot, plugin);
477
- if (!pluginRoot) return plugin;
425
+ if (!pluginRoot) {
426
+ const { packageFormat: _dropped2, ...rest2 } = plugin;
427
+ return rest2;
428
+ }
478
429
  const manifest = readFirstHostPluginManifest(pluginRoot);
479
430
  const description = plugin.description ?? manifest?.description;
480
431
  const keywords = (manifest?.keywords ?? []).filter(
@@ -495,11 +446,14 @@ function enrichCatalogPlugin(marketplaceRoot, plugin) {
495
446
  })),
496
447
  ...commandContents(pluginRoot)
497
448
  ];
449
+ const packageFormat = agentPluginPackageFormat(pluginRoot);
450
+ const { packageFormat: _dropped, ...rest } = plugin;
498
451
  return {
499
- ...plugin,
452
+ ...rest,
500
453
  ...description ? { description } : {},
501
454
  ...tags.length > 0 ? { tags } : {},
502
- ...contents.length > 0 ? { contents } : {}
455
+ ...contents.length > 0 ? { contents } : {},
456
+ ...packageFormat ? { packageFormat } : {}
503
457
  };
504
458
  }
505
459
  function enrichCatalogPlugins(marketplaceRoot, plugins) {
@@ -562,14 +516,26 @@ function resolveTags(entry) {
562
516
  function normalizeMarketplaceSourcePath(value) {
563
517
  return value.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
564
518
  }
519
+ function asMarketplaceSourcePath(value) {
520
+ const trimmed = value.trim().replaceAll("\\", "/");
521
+ if (trimmed === "." || trimmed === "./") return ".";
522
+ const normalized = normalizeMarketplaceSourcePath(trimmed);
523
+ return normalized.length > 0 ? normalized : void 0;
524
+ }
565
525
  function resolveSourcePath(entry) {
566
526
  const source = entry.source;
567
527
  if (typeof source === "string" && source.trim().length > 0) {
568
- return normalizeMarketplaceSourcePath(source);
528
+ return asMarketplaceSourcePath(source);
529
+ }
530
+ if (isRecord(source)) {
531
+ const nested = source.path;
532
+ if (typeof nested === "string" && nested.trim().length > 0) {
533
+ return asMarketplaceSourcePath(nested);
534
+ }
569
535
  }
570
536
  const path = entry.path;
571
537
  if (typeof path === "string" && path.trim().length > 0) {
572
- return normalizeMarketplaceSourcePath(path);
538
+ return asMarketplaceSourcePath(path);
573
539
  }
574
540
  return void 0;
575
541
  }
@@ -621,6 +587,28 @@ function parseClaudeMarketplaceManifest(raw) {
621
587
  const plugins = parsePlugins(raw, marketplaceName, resolveClaudePluginName);
622
588
  return { marketplaceName, plugins };
623
589
  }
590
+ function parseCodexMarketplaceManifest(raw) {
591
+ return parseClaudeMarketplaceManifest(raw);
592
+ }
593
+ function sourcePathLeavesMarketplace(sourcePath) {
594
+ if (!sourcePath) return false;
595
+ return sourcePath.replaceAll("\\", "/").split("/").includes("..");
596
+ }
597
+ function escapingMarketplaceSourceWarning(pluginName) {
598
+ return `Skipped ${pluginName}: source path leaves the marketplace repository.`;
599
+ }
600
+ function partitionEscapingCatalogPlugins(plugins) {
601
+ const kept = [];
602
+ const warnings = [];
603
+ for (const plugin of plugins) {
604
+ if (!sourcePathLeavesMarketplace(plugin.sourcePath)) {
605
+ kept.push(plugin);
606
+ continue;
607
+ }
608
+ warnings.push(escapingMarketplaceSourceWarning(plugin.name));
609
+ }
610
+ return { plugins: kept, warnings };
611
+ }
624
612
  function parseCursorMarketplaceManifest(raw) {
625
613
  const marketplaceName = readMarketplaceName(raw);
626
614
  const plugins = parsePlugins(raw, marketplaceName, resolveCursorPluginName);
@@ -659,15 +647,19 @@ function uniqueStrings2(values) {
659
647
  }
660
648
  return next;
661
649
  }
650
+ function catalogPluginIdentity(plugin) {
651
+ return `${plugin.name}\0${plugin.flavor ?? ""}`;
652
+ }
662
653
  function mergeCatalogPluginsByIdentity(plugins) {
663
654
  const byName = /* @__PURE__ */ new Map();
664
655
  for (const plugin of plugins) {
665
- const existing = byName.get(plugin.name);
656
+ const identity = catalogPluginIdentity(plugin);
657
+ const existing = byName.get(identity);
666
658
  if (!existing) {
667
- byName.set(plugin.name, plugin);
659
+ byName.set(identity, plugin);
668
660
  continue;
669
661
  }
670
- byName.set(plugin.name, preferCatalogPlugin(existing, plugin));
662
+ byName.set(identity, preferCatalogPlugin(existing, plugin));
671
663
  }
672
664
  return [...byName.values()];
673
665
  }
@@ -675,15 +667,18 @@ function mergeCatalogPluginsByIdentity(plugins) {
675
667
  // src/services/marketplace-catalog.ts
676
668
  var MARKETPLACE_CATALOG_INDEX_VERSION = 1;
677
669
  var MANIFEST_PATHS = [
678
- { path: ".claude-plugin/marketplace.json", platform: "claude-code" },
679
- { path: ".cursor-plugin/marketplace.json", platform: "cursor" },
680
- { path: "marketplace.json", platform: null }
670
+ { path: ".claude-plugin/marketplace.json", flavor: "claude-code" },
671
+ { path: ".cursor-plugin/marketplace.json", flavor: "cursor" },
672
+ { path: ".github/plugin/marketplace.json", flavor: "copilot-cli" },
673
+ { path: ".agents/plugins/marketplace.json", flavor: "codex" },
674
+ { path: "marketplace.json", flavor: null }
681
675
  ];
676
+ var MISSING_MANIFEST_MESSAGE = "No marketplace manifest found (.claude-plugin/marketplace.json, .cursor-plugin/marketplace.json, .github/plugin/marketplace.json, .agents/plugins/marketplace.json, or marketplace.json).";
682
677
  function marketplaceCacheDir(harnesstapDir, name) {
683
- return join5(harnesstapDir, "cache", "marketplaces", name);
678
+ return join3(harnesstapDir, "cache", "marketplaces", name);
684
679
  }
685
680
  function marketplaceCatalogPath(harnesstapDir, name) {
686
- return join5(marketplaceCacheDir(harnesstapDir, name), "catalog.json");
681
+ return join3(marketplaceCacheDir(harnesstapDir, name), "catalog.json");
687
682
  }
688
683
  var MARKETPLACE_CATALOG_MAX_AGE_MS = marketplaceRefreshMaxAgeMs(
689
684
  DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES
@@ -692,14 +687,14 @@ function isGooseOnly(platforms) {
692
687
  return platforms.length === 1 && platforms[0] === "goose";
693
688
  }
694
689
  function catalogIsFresh(catalogPath, maxAgeMs) {
695
- if (!existsSync5(catalogPath)) return false;
690
+ if (!existsSync3(catalogPath)) return false;
696
691
  const ageMs = Date.now() - statSync3(catalogPath).mtimeMs;
697
692
  return ageMs < maxAgeMs;
698
693
  }
699
694
  function readStoredCatalog(catalogPath) {
700
- if (!existsSync5(catalogPath)) return void 0;
695
+ if (!existsSync3(catalogPath)) return void 0;
701
696
  try {
702
- const raw = JSON.parse(readFileSync4(catalogPath, "utf8"));
697
+ const raw = JSON.parse(readFileSync3(catalogPath, "utf8"));
703
698
  if (!Array.isArray(raw.plugins)) return void 0;
704
699
  return raw;
705
700
  } catch {
@@ -707,39 +702,65 @@ function readStoredCatalog(catalogPath) {
707
702
  }
708
703
  }
709
704
  function writeStoredCatalog(catalogPath, catalog) {
710
- mkdirSync2(dirname(catalogPath), { recursive: true });
705
+ mkdirSync(dirname(catalogPath), { recursive: true });
711
706
  writeFileSync(catalogPath, `${JSON.stringify(catalog, null, 2)}
712
707
  `, "utf8");
713
708
  }
714
- function resolveManifest(cacheDir, platforms) {
709
+ function rootMarketplaceFlavor(platforms) {
710
+ if (platforms.includes("claude-code") || platforms.includes("copilot-cli")) {
711
+ return "claude-code";
712
+ }
713
+ if (platforms.includes("cursor")) {
714
+ return "cursor";
715
+ }
716
+ return void 0;
717
+ }
718
+ function resolveManifests(cacheDir, platforms) {
719
+ const found = [];
715
720
  for (const candidate of MANIFEST_PATHS) {
716
- const manifestPath = join5(cacheDir, candidate.path);
717
- if (!existsSync5(manifestPath)) continue;
718
- if (candidate.platform) {
719
- return { manifestPath, platform: candidate.platform };
721
+ const manifestPath = join3(cacheDir, candidate.path);
722
+ if (!existsSync3(manifestPath)) continue;
723
+ if (candidate.flavor) {
724
+ found.push({ manifestPath, flavor: candidate.flavor });
725
+ continue;
720
726
  }
721
- if (platforms.includes("claude-code") || platforms.includes("copilot-cli")) {
722
- return { manifestPath, platform: "claude-code" };
727
+ const flavor = rootMarketplaceFlavor(platforms);
728
+ if (flavor) {
729
+ found.push({ manifestPath, flavor });
723
730
  }
724
- if (platforms.includes("cursor")) {
725
- return { manifestPath, platform: "cursor" };
731
+ }
732
+ return found;
733
+ }
734
+ function registryPlatformForFlavor(flavor) {
735
+ switch (flavor) {
736
+ case "claude-code":
737
+ case "cursor":
738
+ case "goose":
739
+ case "copilot-cli":
740
+ return flavor;
741
+ case "codex":
742
+ case void 0:
743
+ return void 0;
744
+ default: {
745
+ const _exhaustive = flavor;
746
+ return _exhaustive;
726
747
  }
727
- return void 0;
728
748
  }
729
- return void 0;
730
749
  }
731
- function parseManifest(platform, raw) {
732
- switch (platform) {
750
+ function parseManifest(flavor, raw) {
751
+ switch (flavor) {
733
752
  case "claude-code":
734
753
  return parseClaudeMarketplaceManifest(raw);
735
754
  case "copilot-cli":
736
755
  return parseClaudeMarketplaceManifest(raw);
756
+ case "codex":
757
+ return parseCodexMarketplaceManifest(raw);
737
758
  case "cursor":
738
759
  return parseCursorMarketplaceManifest(raw);
739
760
  case "goose":
740
761
  return { marketplaceName: "", plugins: [] };
741
762
  default: {
742
- const _exhaustive = platform;
763
+ const _exhaustive = flavor;
743
764
  return _exhaustive;
744
765
  }
745
766
  }
@@ -766,27 +787,47 @@ function catalogRefreshEntry(harnesstapDir, name) {
766
787
  }
767
788
  return builtinMarketplaceEntry();
768
789
  }
769
- function parseCatalogFromDir(dir, platforms, registryName) {
770
- const manifest = resolveManifest(dir, platforms);
771
- if (!manifest) {
790
+ function loadCatalogFromDir(dir, platforms, registryName) {
791
+ const manifests = resolveManifests(dir, platforms);
792
+ if (manifests.length === 0) {
772
793
  return {
773
794
  ok: false,
774
- message: "No marketplace manifest found (.claude-plugin/marketplace.json, .cursor-plugin/marketplace.json, or marketplace.json)."
795
+ message: MISSING_MANIFEST_MESSAGE
775
796
  };
776
797
  }
777
- let raw;
778
- try {
779
- raw = JSON.parse(readFileSync4(manifest.manifestPath, "utf8"));
780
- } catch {
781
- return { ok: false, message: "Failed to parse marketplace manifest JSON" };
798
+ const plugins = [];
799
+ let marketplaceName = "";
800
+ let manifestName;
801
+ for (const manifest of manifests) {
802
+ const raw = readCachedMarketplaceJson(manifest.manifestPath);
803
+ if (raw === void 0) {
804
+ return { ok: false, message: "Failed to parse marketplace manifest JSON" };
805
+ }
806
+ const identified = catalogWithRegistryIdentity(
807
+ parseManifest(manifest.flavor, raw),
808
+ registryName
809
+ );
810
+ if (!marketplaceName) {
811
+ marketplaceName = identified.marketplaceName;
812
+ manifestName = identified.manifestName;
813
+ }
814
+ for (const plugin of identified.plugins) {
815
+ plugins.push({ ...plugin, flavor: manifest.flavor });
816
+ }
782
817
  }
818
+ const partitioned = partitionEscapingCatalogPlugins(plugins);
783
819
  return {
784
820
  ok: true,
785
- catalog: catalogWithRegistryIdentity(parseManifest(manifest.platform, raw), registryName)
821
+ catalog: {
822
+ marketplaceName,
823
+ ...manifestName ? { manifestName } : {},
824
+ plugins: partitioned.plugins,
825
+ warnings: partitioned.warnings
826
+ }
786
827
  };
787
828
  }
788
- function checkoutBranchName(dir) {
789
- const result = runCommandWithTimeout("git", [
829
+ async function checkoutBranchName(dir, unattended) {
830
+ const result = await runCommandWithTimeout("git", [
790
831
  "-c",
791
832
  "protocol.file.allow=always",
792
833
  "-C",
@@ -794,7 +835,7 @@ function checkoutBranchName(dir) {
794
835
  "rev-parse",
795
836
  "--abbrev-ref",
796
837
  "HEAD"
797
- ]);
838
+ ], { unattended });
798
839
  const name = result.stdout.trim();
799
840
  return result.exitCode === 0 && name && name !== "HEAD" ? name : "HEAD";
800
841
  }
@@ -806,7 +847,14 @@ function versionsFromPlugins(plugins, branch) {
806
847
  }
807
848
  return rows;
808
849
  }
809
- function refreshMarketplaceCatalog(harnesstapDir, options) {
850
+ var catalogRefreshInflight = /* @__PURE__ */ new Map();
851
+ function catalogRefreshKey(harnesstapDir, name) {
852
+ return `${harnesstapDir}\0${name}`;
853
+ }
854
+ function logUnattendedRefreshFailure(name, message) {
855
+ console.error(`[ht-agent] marketplace catalog refresh failed for ${name}: ${message}`);
856
+ }
857
+ async function refreshMarketplaceCatalogNow(harnesstapDir, options) {
810
858
  const entry = catalogRefreshEntry(harnesstapDir, options.name);
811
859
  if (!entry) {
812
860
  return { ok: false, message: `Marketplace not found: ${options.name}` };
@@ -831,30 +879,34 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
831
879
  ...stored2?.sha ? { sha: stored2.sha } : {}
832
880
  };
833
881
  }
834
- const refresh = refreshGitSource({
882
+ const unattended = options.unattended === true;
883
+ const refresh = await refreshGitSource({
835
884
  url: entry.url,
836
- targetDir: cacheDir
885
+ targetDir: cacheDir,
886
+ unattended
837
887
  });
838
888
  if (!refresh.ok) {
839
889
  return { ok: false, message: refresh.message };
840
890
  }
841
- const defaultCatalog = parseCatalogFromDir(cacheDir, entry.platforms, entry.name);
891
+ const defaultCatalog = loadCatalogFromDir(cacheDir, entry.platforms, entry.name);
842
892
  if (!defaultCatalog.ok) {
843
893
  return defaultCatalog;
844
894
  }
845
- const defaultBranch = checkoutBranchName(cacheDir);
895
+ const defaultBranch = await checkoutBranchName(cacheDir, unattended);
846
896
  const extraBranches = parseTrackedBranches(entry.trackedBranches ?? []).filter(
847
897
  (branch) => branch !== defaultBranch
848
898
  );
849
899
  const pluginVersions = versionsFromPlugins(defaultCatalog.catalog.plugins, defaultBranch);
850
900
  const pluginBatches = [defaultCatalog.catalog.plugins];
901
+ const warnings = [...defaultCatalog.catalog.warnings];
851
902
  for (const branch of extraBranches) {
852
- const branchDir = mkdtempSync(join5(tmpdir(), "ht-mkt-branch-"));
903
+ const branchDir = mkdtempSync(join3(tmpdir(), "ht-mkt-branch-"));
853
904
  try {
854
- const branchRefresh = refreshGitSource({
905
+ const branchRefresh = await refreshGitSource({
855
906
  url: entry.url,
856
907
  targetDir: branchDir,
857
- ref: branch
908
+ ref: branch,
909
+ unattended
858
910
  });
859
911
  if (!branchRefresh.ok) {
860
912
  return {
@@ -862,7 +914,7 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
862
914
  message: `Tracked branch "${branch}": ${branchRefresh.message}`
863
915
  };
864
916
  }
865
- const branchCatalog = parseCatalogFromDir(branchDir, entry.platforms, entry.name);
917
+ const branchCatalog = loadCatalogFromDir(branchDir, entry.platforms, entry.name);
866
918
  if (!branchCatalog.ok) {
867
919
  return {
868
920
  ok: false,
@@ -870,17 +922,21 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
870
922
  };
871
923
  }
872
924
  pluginBatches.push(branchCatalog.catalog.plugins);
925
+ warnings.push(...branchCatalog.catalog.warnings);
873
926
  pluginVersions.push(...versionsFromPlugins(branchCatalog.catalog.plugins, branch));
874
927
  } finally {
875
- rmSync2(branchDir, { recursive: true, force: true });
928
+ rmSync(branchDir, { recursive: true, force: true });
876
929
  }
877
930
  }
931
+ const uniqueWarnings = [...new Set(warnings)];
878
932
  const catalog = {
879
- ...defaultCatalog.catalog,
933
+ marketplaceName: defaultCatalog.catalog.marketplaceName,
934
+ ...defaultCatalog.catalog.manifestName ? { manifestName: defaultCatalog.catalog.manifestName } : {},
880
935
  plugins: enrichCatalogPlugins(
881
936
  cacheDir,
882
937
  mergeCatalogPluginsByIdentity(pluginBatches.flat())
883
- )
938
+ ),
939
+ ...uniqueWarnings.length > 0 ? { warnings: uniqueWarnings } : {}
884
940
  };
885
941
  const stored = {
886
942
  ...catalog,
@@ -894,9 +950,24 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
894
950
  return {
895
951
  ok: true,
896
952
  message: refresh.message,
897
- ...refresh.sha ? { sha: refresh.sha } : {}
953
+ ...refresh.sha ? { sha: refresh.sha } : {},
954
+ ...uniqueWarnings.length > 0 ? { warnings: uniqueWarnings } : {}
898
955
  };
899
956
  }
957
+ function refreshMarketplaceCatalog(harnesstapDir, options) {
958
+ const key = catalogRefreshKey(harnesstapDir, options.name);
959
+ const existing = catalogRefreshInflight.get(key);
960
+ if (existing) {
961
+ return existing;
962
+ }
963
+ const job = refreshMarketplaceCatalogNow(harnesstapDir, options).finally(() => {
964
+ if (catalogRefreshInflight.get(key) === job) {
965
+ catalogRefreshInflight.delete(key);
966
+ }
967
+ });
968
+ catalogRefreshInflight.set(key, job);
969
+ return job;
970
+ }
900
971
  function persistIndexedCatalog(harnesstapDir, name, stored) {
901
972
  if (stored.indexVersion === MARKETPLACE_CATALOG_INDEX_VERSION) {
902
973
  return stored;
@@ -919,21 +990,72 @@ function listCatalogPlugins(harnesstapDir, options) {
919
990
  }
920
991
  return persistIndexedCatalog(harnesstapDir, options.name, stored).plugins;
921
992
  }
922
- function ensureMarketplaceCatalog(harnesstapDir, options) {
923
- refreshMarketplaceCatalog(harnesstapDir, {
993
+ async function ensureMarketplaceCatalog(harnesstapDir, options) {
994
+ const catalogPath = marketplaceCatalogPath(harnesstapDir, options.name);
995
+ const stored = readStoredCatalog(catalogPath);
996
+ const settings = loadSettings(harnesstapDir);
997
+ const maxAgeMs = marketplaceRefreshMaxAgeMs(
998
+ settings.plugins.marketplaceRefreshMaxAgeMinutes
999
+ );
1000
+ const fresh = catalogIsFresh(catalogPath, maxAgeMs);
1001
+ if (stored && fresh && !options.force) {
1002
+ return listCatalogPlugins(harnesstapDir, { name: options.name });
1003
+ }
1004
+ if (stored && !options.force) {
1005
+ void refreshMarketplaceCatalog(harnesstapDir, {
1006
+ name: options.name,
1007
+ force: false,
1008
+ unattended: true
1009
+ }).then((result) => {
1010
+ if (!result.ok) {
1011
+ logUnattendedRefreshFailure(options.name, result.message);
1012
+ }
1013
+ });
1014
+ return listCatalogPlugins(harnesstapDir, { name: options.name });
1015
+ }
1016
+ await refreshMarketplaceCatalog(harnesstapDir, {
924
1017
  name: options.name,
925
- force: options.force ?? false
1018
+ force: options.force ?? true,
1019
+ unattended: false
926
1020
  });
927
1021
  return listCatalogPlugins(harnesstapDir, { name: options.name });
928
1022
  }
1023
+ function marketplaceCatalogWarnings(harnesstapDir, name) {
1024
+ return readStoredCatalog(marketplaceCatalogPath(harnesstapDir, name))?.warnings ?? [];
1025
+ }
1026
+ function marketplaceRowFlavors(harnesstapDir, entry) {
1027
+ const plugins = listCatalogPlugins(harnesstapDir, { name: entry.name });
1028
+ const flavors = [];
1029
+ const seen = /* @__PURE__ */ new Set();
1030
+ for (const plugin of plugins) {
1031
+ if (!plugin.flavor || seen.has(plugin.flavor)) continue;
1032
+ seen.add(plugin.flavor);
1033
+ flavors.push(plugin.flavor);
1034
+ }
1035
+ return flavors.length > 0 ? flavors : [...entry.platforms];
1036
+ }
1037
+ function alignImplicitMarketplacePlatforms(harnesstapDir, name) {
1038
+ const plugins = listCatalogPlugins(harnesstapDir, { name });
1039
+ const detected = [];
1040
+ const seen = /* @__PURE__ */ new Set();
1041
+ for (const plugin of plugins) {
1042
+ const platform = registryPlatformForFlavor(plugin.flavor);
1043
+ if (!platform || seen.has(platform)) continue;
1044
+ seen.add(platform);
1045
+ detected.push(platform);
1046
+ }
1047
+ if (detected.length === 0) return void 0;
1048
+ const current = listMarketplaces(harnesstapDir).find((entry) => entry.name === name);
1049
+ if (!current) return void 0;
1050
+ const same = current.platforms.length === detected.length && current.platforms.every((platform, index) => platform === detected[index]);
1051
+ if (same) return detected;
1052
+ const updated = updateMarketplace(harnesstapDir, name, { platforms: detected });
1053
+ return updated.status === "updated" ? updated.entry.platforms : void 0;
1054
+ }
929
1055
  function readMarketplaceManifest(root) {
930
- const manifest = resolveManifest(root, ["claude-code", "cursor", "copilot-cli"]);
1056
+ const manifest = resolveManifests(root, ["claude-code", "cursor", "copilot-cli"])[0];
931
1057
  if (!manifest) return void 0;
932
- try {
933
- return JSON.parse(readFileSync4(manifest.manifestPath, "utf8"));
934
- } catch {
935
- return void 0;
936
- }
1058
+ return readCachedMarketplaceJson(manifest.manifestPath);
937
1059
  }
938
1060
  function pluginMatchesQuery(plugin, query) {
939
1061
  return catalogPluginMatchesQuery(plugin, query);
@@ -945,14 +1067,22 @@ function listCatalogSearchMarketplaces(harnesstapDir) {
945
1067
  }
946
1068
  return [...registered, builtinMarketplaceEntry()];
947
1069
  }
948
- function searchCatalogPlugins(harnesstapDir, query, options = {}) {
1070
+ async function searchCatalogPlugins(harnesstapDir, query, options = {}) {
949
1071
  const marketplaces = listCatalogSearchMarketplaces(harnesstapDir);
950
1072
  if (options.refresh) {
1073
+ const failures = [];
951
1074
  for (const marketplace of marketplaces) {
952
- refreshMarketplaceCatalog(harnesstapDir, {
1075
+ const refresh = await refreshMarketplaceCatalog(harnesstapDir, {
953
1076
  name: marketplace.name,
954
- force: true
1077
+ force: true,
1078
+ unattended: false
955
1079
  });
1080
+ if (!refresh.ok) {
1081
+ failures.push(`${marketplace.name}: ${refresh.message}`);
1082
+ }
1083
+ }
1084
+ if (failures.length > 0) {
1085
+ console.error(`[ht-agent] marketplace search refresh failed: ${failures.join("; ")}`);
956
1086
  }
957
1087
  }
958
1088
  const trimmed = query.trim();
@@ -969,17 +1099,6 @@ function searchCatalogPlugins(harnesstapDir, query, options = {}) {
969
1099
  }
970
1100
 
971
1101
  export {
972
- readJsonFile,
973
- readFirstHostPluginManifest,
974
- parsePluginRef,
975
- DEFAULT_GIT_CLONE_TIMEOUT_MS,
976
- runCommandWithTimeout,
977
- refreshGitSource,
978
- cursorRepoSourceKey,
979
- cursorCacheRoot,
980
- cursorLocalRoot,
981
- cursorMarketplacesRoot,
982
- cursorProjectsMcpsRoot,
983
1102
  isCursorPublicMarketplace,
984
1103
  builtinMarketplaceGitUrl,
985
1104
  builtinMarketplaceEntry,
@@ -988,11 +1107,15 @@ export {
988
1107
  addMarketplace,
989
1108
  removeMarketplace,
990
1109
  discoverSkillPackage,
1110
+ escapingMarketplaceSourceWarning,
991
1111
  marketplaceCacheDir,
992
1112
  refreshMarketplaceCatalog,
993
1113
  listCatalogPlugins,
994
1114
  ensureMarketplaceCatalog,
1115
+ marketplaceCatalogWarnings,
1116
+ marketplaceRowFlavors,
1117
+ alignImplicitMarketplacePlatforms,
995
1118
  readMarketplaceManifest,
996
1119
  searchCatalogPlugins
997
1120
  };
998
- //# sourceMappingURL=chunk-6BY4BV5G.js.map
1121
+ //# sourceMappingURL=chunk-6LTLYV5D.js.map