harnesstap 1.3.2 → 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 (210) hide show
  1. package/README.md +2 -0
  2. package/dist/apply-SUNDXRJ3.js +54 -0
  3. package/dist/{approve-L7IFSYBO.js → approve-FBGYQGWN.js} +14 -15
  4. package/dist/{approve-L7IFSYBO.js.map → approve-FBGYQGWN.js.map} +1 -1
  5. package/dist/{audit-PBJDK7A4.js → audit-VI4QZ6X2.js} +30 -39
  6. package/dist/{audit-PBJDK7A4.js.map → audit-VI4QZ6X2.js.map} +1 -1
  7. package/dist/{auth-OM73RLNS.js → auth-4CQCDS2W.js} +17 -19
  8. package/dist/{auth-OM73RLNS.js.map → auth-4CQCDS2W.js.map} +1 -1
  9. package/dist/bin.js +3 -3
  10. package/dist/{chunk-YRGM7RAD.js → chunk-23XSG7LI.js} +7 -11
  11. package/dist/{chunk-YRGM7RAD.js.map → chunk-23XSG7LI.js.map} +1 -1
  12. package/dist/{chunk-LDVXYN6F.js → chunk-2A36HWDE.js} +63 -13
  13. package/dist/chunk-2A36HWDE.js.map +1 -0
  14. package/dist/{chunk-QNAIDM6W.js → chunk-3FS775NP.js} +51 -4
  15. package/dist/chunk-3FS775NP.js.map +1 -0
  16. package/dist/{chunk-XCPWLGPB.js → chunk-3P6BWL5F.js} +2 -2
  17. package/dist/{chunk-JJJJ2RAD.js → chunk-43BDGVN3.js} +19 -6
  18. package/dist/chunk-43BDGVN3.js.map +1 -0
  19. package/dist/{chunk-CZ4T75PP.js → chunk-4ZQ2SCGY.js} +146 -78
  20. package/dist/chunk-4ZQ2SCGY.js.map +1 -0
  21. package/dist/{chunk-ZVANUFPF.js → chunk-6LTLYV5D.js} +353 -267
  22. package/dist/chunk-6LTLYV5D.js.map +1 -0
  23. package/dist/{chunk-OPVIX7E4.js → chunk-73OJQTBW.js} +6 -2
  24. package/dist/chunk-73OJQTBW.js.map +1 -0
  25. package/dist/{chunk-WXRPQICX.js → chunk-7HP6AAI3.js} +2 -2
  26. package/dist/{chunk-ENHDEB7Z.js → chunk-BPWFQKI5.js} +5 -7
  27. package/dist/{chunk-ENHDEB7Z.js.map → chunk-BPWFQKI5.js.map} +1 -1
  28. package/dist/{chunk-64R32MG2.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-FUV7QYBS.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-IHW4PCDT.js → chunk-GRASK6M6.js} +5 -5
  37. package/dist/{chunk-R4PTE774.js → chunk-IE7B6Q5K.js} +33 -39
  38. package/dist/chunk-IE7B6Q5K.js.map +1 -0
  39. package/dist/{chunk-UNRR4KH5.js → chunk-IMROMZ2K.js} +6 -5
  40. package/dist/{chunk-UNRR4KH5.js.map → chunk-IMROMZ2K.js.map} +1 -1
  41. package/dist/{chunk-G5RWVZZ7.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-AFKCNFPP.js → chunk-M4KLHJ6U.js} +16 -13
  45. package/dist/chunk-M4KLHJ6U.js.map +1 -0
  46. package/dist/{chunk-XRXFJTAT.js → chunk-MR7IOHSX.js} +16 -19
  47. package/dist/chunk-MR7IOHSX.js.map +1 -0
  48. package/dist/{chunk-UEHDEADL.js → chunk-N3VGY3T3.js} +15 -15
  49. package/dist/chunk-N3VGY3T3.js.map +1 -0
  50. package/dist/{chunk-IKAGGJEO.js → chunk-N3ZCH64F.js} +496 -10
  51. package/dist/chunk-N3ZCH64F.js.map +1 -0
  52. package/dist/{chunk-U472S6IB.js → chunk-OML4HXKT.js} +20 -22
  53. package/dist/chunk-OML4HXKT.js.map +1 -0
  54. package/dist/{chunk-3EGM4IUI.js → chunk-P2C7JPLD.js} +3 -3
  55. package/dist/{chunk-MFCZN253.js → chunk-PCMON7Y2.js} +7 -7
  56. package/dist/{chunk-FBYAIBHP.js → chunk-PNGF5EV2.js} +2 -2
  57. package/dist/{chunk-6JMVGKMD.js → chunk-QA5U36JN.js} +187 -203
  58. package/dist/chunk-QA5U36JN.js.map +1 -0
  59. package/dist/{chunk-AVZOFMJX.js → chunk-R7ZOYVN3.js} +241 -126
  60. package/dist/chunk-R7ZOYVN3.js.map +1 -0
  61. package/dist/{chunk-YVJQ2QDG.js → chunk-RDG5DT7S.js} +45 -49
  62. package/dist/{chunk-YVJQ2QDG.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-Y2JGMICO.js → chunk-RFQ3N7FB.js} +19 -29
  66. package/dist/chunk-RFQ3N7FB.js.map +1 -0
  67. package/dist/{chunk-EY4ES5MG.js → chunk-RVEXPMM3.js} +3 -3
  68. package/dist/{chunk-6I3RY6R5.js → chunk-TPEJFLV7.js} +13 -15
  69. package/dist/{chunk-6I3RY6R5.js.map → chunk-TPEJFLV7.js.map} +1 -1
  70. package/dist/{chunk-IAZNF35S.js → chunk-U6DXASQP.js} +2 -2
  71. package/dist/{chunk-OQ4KBUN2.js → chunk-ULCD6DJE.js} +30 -8
  72. package/dist/chunk-ULCD6DJE.js.map +1 -0
  73. package/dist/{chunk-BXSS2S4W.js → chunk-UVVZHWD2.js} +2 -2
  74. package/dist/{chunk-24V5ZSIF.js → chunk-WG5A6EAU.js} +269 -13
  75. package/dist/chunk-WG5A6EAU.js.map +1 -0
  76. package/dist/{chunk-LGWUTV5Q.js → chunk-WGP4GUYZ.js} +10 -10
  77. package/dist/{chunk-GWQVYGRD.js → chunk-XTVGCVU4.js} +124 -83
  78. package/dist/chunk-XTVGCVU4.js.map +1 -0
  79. package/dist/{chunk-YX7MVSDA.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-SDOASKGL.js → compile-GXADKGH5.js} +37 -50
  84. package/dist/{compile-SDOASKGL.js.map → compile-GXADKGH5.js.map} +1 -1
  85. package/dist/{config-4VZTVZKF.js → config-JMHNA2U5.js} +22 -35
  86. package/dist/{config-4VZTVZKF.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-HH6CFBRQ.js → doctor-N7ZULPOL.js} +18 -19
  90. package/dist/{doctor-HH6CFBRQ.js.map → doctor-N7ZULPOL.js.map} +1 -1
  91. package/dist/{environment-K7YMJJYN.js → environment-OBB3WU5B.js} +60 -71
  92. package/dist/{environment-K7YMJJYN.js.map → environment-OBB3WU5B.js.map} +1 -1
  93. package/dist/{github-A6TYG7WS.js → github-PBYBGOLH.js} +17 -17
  94. package/dist/{harness-772XBFZQ.js → harness-7KYATIV6.js} +56 -67
  95. package/dist/{harness-772XBFZQ.js.map → harness-7KYATIV6.js.map} +1 -1
  96. package/dist/{help-QR4VTJZU.js → help-EE3AJQD4.js} +48 -52
  97. package/dist/help-EE3AJQD4.js.map +1 -0
  98. package/dist/{help-TLHNRJJ6.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-AOKFPZHG.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-INAXNLMC.js → lock-WLJRXRVK.js} +16 -16
  106. package/dist/{marketplace-TUVLLPBG.js → marketplace-GXSV6QIY.js} +62 -28
  107. package/dist/marketplace-GXSV6QIY.js.map +1 -0
  108. package/dist/{mcp-MMWGRASN.js → mcp-XPDWWU75.js} +35 -48
  109. package/dist/{mcp-MMWGRASN.js.map → mcp-XPDWWU75.js.map} +1 -1
  110. package/dist/{migrate-55S4XODX.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-VZIBS42E.js → pack-A73LDVOX.js} +16 -22
  114. package/dist/{pack-VZIBS42E.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-P3HGLEZS.js → policy-6VY3CMSU.js} +13 -14
  118. package/dist/{policy-P3HGLEZS.js.map → policy-6VY3CMSU.js.map} +1 -1
  119. package/dist/{profile-STS3CZUK.js → profile-YCKPMRRU.js} +96 -102
  120. package/dist/profile-YCKPMRRU.js.map +1 -0
  121. package/dist/{project-R4DGM3ZG.js → project-KHPPBKPN.js} +63 -77
  122. package/dist/{project-R4DGM3ZG.js.map → project-KHPPBKPN.js.map} +1 -1
  123. package/dist/{resource-GJVEDXVZ.js → resource-IJU3FAN5.js} +42 -49
  124. package/dist/{resource-GJVEDXVZ.js.map → resource-IJU3FAN5.js.map} +1 -1
  125. package/dist/{version-FUHV4O6U.js → version-Z66FWWMQ.js} +2 -2
  126. package/dist/version-Z66FWWMQ.js.map +1 -0
  127. package/package.json +3 -2
  128. package/dist/apply-Q5SFF3FY.js +0 -67
  129. package/dist/chunk-24V5ZSIF.js.map +0 -1
  130. package/dist/chunk-3JOPDYQD.js +0 -730
  131. package/dist/chunk-3JOPDYQD.js.map +0 -1
  132. package/dist/chunk-555XE3NJ.js +0 -60
  133. package/dist/chunk-555XE3NJ.js.map +0 -1
  134. package/dist/chunk-64R32MG2.js.map +0 -1
  135. package/dist/chunk-6JMVGKMD.js.map +0 -1
  136. package/dist/chunk-6ZWKF3YZ.js +0 -7795
  137. package/dist/chunk-6ZWKF3YZ.js.map +0 -1
  138. package/dist/chunk-AFKCNFPP.js.map +0 -1
  139. package/dist/chunk-AUWWL6KX.js +0 -296
  140. package/dist/chunk-AUWWL6KX.js.map +0 -1
  141. package/dist/chunk-AVZOFMJX.js.map +0 -1
  142. package/dist/chunk-CZ4T75PP.js.map +0 -1
  143. package/dist/chunk-FUV7QYBS.js.map +0 -1
  144. package/dist/chunk-GWQVYGRD.js.map +0 -1
  145. package/dist/chunk-HENOKIBB.js +0 -346
  146. package/dist/chunk-HENOKIBB.js.map +0 -1
  147. package/dist/chunk-HWL67OCJ.js +0 -238
  148. package/dist/chunk-HWL67OCJ.js.map +0 -1
  149. package/dist/chunk-IKAGGJEO.js.map +0 -1
  150. package/dist/chunk-JJJJ2RAD.js.map +0 -1
  151. package/dist/chunk-JRFUTIEH.js +0 -426
  152. package/dist/chunk-JRFUTIEH.js.map +0 -1
  153. package/dist/chunk-KJIFZLHN.js +0 -11066
  154. package/dist/chunk-KJIFZLHN.js.map +0 -1
  155. package/dist/chunk-LDVXYN6F.js.map +0 -1
  156. package/dist/chunk-MHOTXMD2.js +0 -430
  157. package/dist/chunk-MHOTXMD2.js.map +0 -1
  158. package/dist/chunk-NEPUP33Q.js +0 -35
  159. package/dist/chunk-NEPUP33Q.js.map +0 -1
  160. package/dist/chunk-OPVIX7E4.js.map +0 -1
  161. package/dist/chunk-OQ4KBUN2.js.map +0 -1
  162. package/dist/chunk-OXVCYRZB.js +0 -491
  163. package/dist/chunk-OXVCYRZB.js.map +0 -1
  164. package/dist/chunk-PJQAMC6L.js +0 -183
  165. package/dist/chunk-PJQAMC6L.js.map +0 -1
  166. package/dist/chunk-PW5QXRBA.js +0 -1173
  167. package/dist/chunk-PW5QXRBA.js.map +0 -1
  168. package/dist/chunk-QNAIDM6W.js.map +0 -1
  169. package/dist/chunk-R4PTE774.js.map +0 -1
  170. package/dist/chunk-S2E4KSYW.js +0 -610
  171. package/dist/chunk-S2E4KSYW.js.map +0 -1
  172. package/dist/chunk-SNVAMWB7.js.map +0 -1
  173. package/dist/chunk-U472S6IB.js.map +0 -1
  174. package/dist/chunk-UEHDEADL.js.map +0 -1
  175. package/dist/chunk-VQVUJYYY.js.map +0 -1
  176. package/dist/chunk-XRXFJTAT.js.map +0 -1
  177. package/dist/chunk-Y2JGMICO.js.map +0 -1
  178. package/dist/chunk-YX7MVSDA.js.map +0 -1
  179. package/dist/chunk-ZGRBIBO7.js +0 -681
  180. package/dist/chunk-ZGRBIBO7.js.map +0 -1
  181. package/dist/chunk-ZTBAMBAI.js +0 -6448
  182. package/dist/chunk-ZTBAMBAI.js.map +0 -1
  183. package/dist/chunk-ZVANUFPF.js.map +0 -1
  184. package/dist/help-QR4VTJZU.js.map +0 -1
  185. package/dist/help-TLHNRJJ6.js.map +0 -1
  186. package/dist/init-AOKFPZHG.js.map +0 -1
  187. package/dist/marketplace-TUVLLPBG.js.map +0 -1
  188. package/dist/migrate-55S4XODX.js.map +0 -1
  189. package/dist/open-SLFQV45J.js +0 -32
  190. package/dist/plugin-WLEFFBRY.js +0 -64
  191. package/dist/plugin-from-project-UV2O364T.js +0 -16
  192. package/dist/profile-STS3CZUK.js.map +0 -1
  193. /package/dist/{apply-Q5SFF3FY.js.map → apply-SUNDXRJ3.js.map} +0 -0
  194. /package/dist/{chunk-XCPWLGPB.js.map → chunk-3P6BWL5F.js.map} +0 -0
  195. /package/dist/{chunk-WXRPQICX.js.map → chunk-7HP6AAI3.js.map} +0 -0
  196. /package/dist/{chunk-IHW4PCDT.js.map → chunk-GRASK6M6.js.map} +0 -0
  197. /package/dist/{chunk-G5RWVZZ7.js.map → chunk-L6YZE5MY.js.map} +0 -0
  198. /package/dist/{chunk-3EGM4IUI.js.map → chunk-P2C7JPLD.js.map} +0 -0
  199. /package/dist/{chunk-MFCZN253.js.map → chunk-PCMON7Y2.js.map} +0 -0
  200. /package/dist/{chunk-FBYAIBHP.js.map → chunk-PNGF5EV2.js.map} +0 -0
  201. /package/dist/{chunk-EY4ES5MG.js.map → chunk-RVEXPMM3.js.map} +0 -0
  202. /package/dist/{chunk-IAZNF35S.js.map → chunk-U6DXASQP.js.map} +0 -0
  203. /package/dist/{chunk-BXSS2S4W.js.map → chunk-UVVZHWD2.js.map} +0 -0
  204. /package/dist/{chunk-LGWUTV5Q.js.map → chunk-WGP4GUYZ.js.map} +0 -0
  205. /package/dist/{github-A6TYG7WS.js.map → github-PBYBGOLH.js.map} +0 -0
  206. /package/dist/{open-SLFQV45J.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
  207. /package/dist/{lock-INAXNLMC.js.map → lock-WLJRXRVK.js.map} +0 -0
  208. /package/dist/{plugin-WLEFFBRY.js.map → open-HDGLYYVU.js.map} +0 -0
  209. /package/dist/{plugin-from-project-UV2O364T.js.map → plugin-CEO6ZJM5.js.map} +0 -0
  210. /package/dist/{version-FUHV4O6U.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-OPVIX7E4.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-24V5ZSIF.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,82 +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
-
238
- // src/services/agent-plugins/schema-registry.ts
239
- var AP_SCHEMA_VERSIONS = {
240
- "1.0.0": {
241
- version: "1.0.0",
242
- plugin: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
243
- mcp: "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json"
244
- }
245
- };
246
- var AP_CURRENT_VERSION = AP_SCHEMA_VERSIONS["1.0.0"];
247
- var AP_SCHEMA_URL = AP_CURRENT_VERSION.plugin;
248
- var AP_MCP_SCHEMA_URL = AP_CURRENT_VERSION.mcp;
249
- var AP_LEGACY_SCHEMA_URLS = [
250
- "https://agentplugins.org/schema/v1/plugin.schema.json",
251
- "https://agentplugins.org/schemas/v1/plugin.json"
252
- ];
253
- var SPEC_SCHEMA_PREFIX = "https://agent-plugins.org/schemas/";
254
- function lookupApSchema(schema) {
255
- for (const version of Object.values(AP_SCHEMA_VERSIONS)) {
256
- if (schema === version.plugin) return { kind: "current", version };
257
- }
258
- if (AP_LEGACY_SCHEMA_URLS.includes(schema)) {
259
- return { kind: "legacy", upgradeTo: AP_SCHEMA_URL };
260
- }
261
- if (schema.startsWith(SPEC_SCHEMA_PREFIX)) return { kind: "unsupported-spec" };
262
- return { kind: "unknown" };
263
- }
264
- function isAgentPluginsSchemaId(schema) {
265
- if (typeof schema !== "string") return false;
266
- return lookupApSchema(schema).kind !== "unknown";
267
- }
268
-
269
- // src/plugins/host-plugin-manifest.ts
270
- var HOST_PLUGIN_MANIFEST_RELATIVE_PATHS = [
271
- ".claude-plugin/plugin.json",
272
- ".cursor-plugin/plugin.json",
273
- ".codex-plugin/plugin.json",
274
- ".github/plugin/plugin.json",
275
- ".goose-plugin/plugin.json",
276
- "plugin.json"
277
- ];
278
- function readJsonFile(path) {
279
- if (!existsSync2(path)) return null;
280
- try {
281
- return JSON.parse(readFileSync(path, "utf-8"));
282
- } catch {
283
- return null;
284
- }
285
- }
286
- function readFirstHostPluginManifest(installPath) {
287
- for (const relativePath of HOST_PLUGIN_MANIFEST_RELATIVE_PATHS) {
288
- const manifest = readJsonFile(
289
- join2(installPath, relativePath)
290
- );
291
- if (manifest?.name) {
292
- return manifest;
293
- }
294
- }
295
- return null;
296
- }
297
- function parsePluginRef(ref) {
298
- const at = ref.lastIndexOf("@");
299
- if (at <= 0) return { name: ref, marketplace: "" };
300
- return { name: ref.slice(0, at), marketplace: ref.slice(at + 1) };
301
- }
208
+ import matter2 from "gray-matter";
302
209
 
303
210
  // src/services/skill-discovery.ts
304
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
305
- import { join as join3, relative } from "path";
211
+ import { existsSync, readdirSync, readFileSync, statSync } from "fs";
212
+ import { join, relative } from "path";
306
213
  import matter from "gray-matter";
307
214
  var SKILL_ROOTS = ["skills", ".agents/skills"];
308
215
  function isDirectory(path) {
@@ -349,11 +256,11 @@ function parseSkillMarkdown(raw) {
349
256
  }
350
257
  }
351
258
  function readSkillMd(skillDir) {
352
- const skillPath = join3(skillDir, "SKILL.md");
353
- if (!existsSync3(skillPath)) return null;
259
+ const skillPath = join(skillDir, "SKILL.md");
260
+ if (!existsSync(skillPath)) return null;
354
261
  let raw;
355
262
  try {
356
- raw = readFileSync2(skillPath, "utf-8");
263
+ raw = readFileSync(skillPath, "utf-8");
357
264
  } catch {
358
265
  return null;
359
266
  }
@@ -384,17 +291,17 @@ function walkForSkills(rootPath, currentDir, results) {
384
291
  }
385
292
  for (const entry of readdirSync(currentDir)) {
386
293
  if (entry.startsWith(".")) continue;
387
- walkForSkills(rootPath, join3(currentDir, entry), results);
294
+ walkForSkills(rootPath, join(currentDir, entry), results);
388
295
  }
389
296
  }
390
297
  function discoverSkillPackage(rootPath) {
391
298
  const results = [];
392
299
  for (const root of SKILL_ROOTS) {
393
- const dir = join3(rootPath, root);
300
+ const dir = join(rootPath, root);
394
301
  if (!isDirectory(dir)) continue;
395
302
  for (const entry of readdirSync(dir)) {
396
303
  if (entry.startsWith(".")) continue;
397
- walkForSkills(rootPath, join3(dir, entry), results);
304
+ walkForSkills(rootPath, join(dir, entry), results);
398
305
  }
399
306
  }
400
307
  const byName = /* @__PURE__ */ new Map();
@@ -410,7 +317,7 @@ var PLUGIN_ROOT_WALK_MAX_DEPTH = 6;
410
317
  var COMMAND_DIRS = ["commands", ".claude/commands"];
411
318
  function isDirectory2(path) {
412
319
  try {
413
- return existsSync4(path) && statSync2(path).isDirectory();
320
+ return existsSync2(path) && statSync2(path).isDirectory();
414
321
  } catch {
415
322
  return false;
416
323
  }
@@ -425,11 +332,19 @@ function uniqueStrings(values) {
425
332
  }
426
333
  return next;
427
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
+ }
428
343
  function looksLikePluginRoot(path) {
429
344
  for (const relative2 of HOST_PLUGIN_MANIFEST_RELATIVE_PATHS) {
430
- if (existsSync4(join4(path, relative2))) return true;
345
+ if (existsSync2(join2(path, relative2))) return true;
431
346
  }
432
- return isDirectory2(join4(path, "skills")) || isDirectory2(join4(path, "commands"));
347
+ return isDirectory2(join2(path, "skills")) || isDirectory2(join2(path, "commands"));
433
348
  }
434
349
  function walkNamedPluginRoot(dir, pluginName, depth) {
435
350
  if (depth > PLUGIN_ROOT_WALK_MAX_DEPTH || !isDirectory2(dir)) {
@@ -441,7 +356,7 @@ function walkNamedPluginRoot(dir, pluginName, depth) {
441
356
  if (!entry.isDirectory() || PLUGIN_ROOT_WALK_SKIP.has(entry.name)) {
442
357
  continue;
443
358
  }
444
- const child = join4(dir, entry.name);
359
+ const child = join2(dir, entry.name);
445
360
  if (entry.name === pluginName && looksLikePluginRoot(child)) {
446
361
  return child;
447
362
  }
@@ -455,14 +370,14 @@ function walkNamedPluginRoot(dir, pluginName, depth) {
455
370
  }
456
371
  function resolveMarketplaceCatalogPluginRoot(marketplaceRoot, plugin) {
457
372
  if (plugin.sourcePath) {
458
- const fromSource = join4(marketplaceRoot, plugin.sourcePath);
373
+ const fromSource = join2(marketplaceRoot, plugin.sourcePath);
459
374
  if (isDirectory2(fromSource)) return fromSource;
460
375
  }
461
- const underPlugins = join4(marketplaceRoot, "plugins", plugin.name);
376
+ const underPlugins = join2(marketplaceRoot, "plugins", plugin.name);
462
377
  if (isDirectory2(underPlugins) && looksLikePluginRoot(underPlugins)) {
463
378
  return underPlugins;
464
379
  }
465
- const atRoot = join4(marketplaceRoot, plugin.name);
380
+ const atRoot = join2(marketplaceRoot, plugin.name);
466
381
  if (isDirectory2(atRoot) && looksLikePluginRoot(atRoot)) {
467
382
  return atRoot;
468
383
  }
@@ -472,7 +387,7 @@ function commandContents(pluginRoot) {
472
387
  const contents = [];
473
388
  const seen = /* @__PURE__ */ new Set();
474
389
  for (const relative2 of COMMAND_DIRS) {
475
- const dir = join4(pluginRoot, relative2);
390
+ const dir = join2(pluginRoot, relative2);
476
391
  if (!isDirectory2(dir)) continue;
477
392
  let entries;
478
393
  try {
@@ -483,11 +398,11 @@ function commandContents(pluginRoot) {
483
398
  for (const entry of entries) {
484
399
  const name = entry.replace(/\.(md|toml)$/, "");
485
400
  if (name === entry || seen.has(name)) continue;
486
- const absolute = join4(dir, entry);
401
+ const absolute = join2(dir, entry);
487
402
  let description;
488
403
  if (entry.endsWith(".md")) {
489
404
  try {
490
- const parsed = matter2(readFileSync3(absolute, "utf8"));
405
+ const parsed = matter2(readFileSync2(absolute, "utf8"));
491
406
  if (typeof parsed.data.description === "string") {
492
407
  description = parsed.data.description;
493
408
  }
@@ -507,7 +422,10 @@ function commandContents(pluginRoot) {
507
422
  }
508
423
  function enrichCatalogPlugin(marketplaceRoot, plugin) {
509
424
  const pluginRoot = resolveMarketplaceCatalogPluginRoot(marketplaceRoot, plugin);
510
- if (!pluginRoot) return plugin;
425
+ if (!pluginRoot) {
426
+ const { packageFormat: _dropped2, ...rest2 } = plugin;
427
+ return rest2;
428
+ }
511
429
  const manifest = readFirstHostPluginManifest(pluginRoot);
512
430
  const description = plugin.description ?? manifest?.description;
513
431
  const keywords = (manifest?.keywords ?? []).filter(
@@ -528,11 +446,14 @@ function enrichCatalogPlugin(marketplaceRoot, plugin) {
528
446
  })),
529
447
  ...commandContents(pluginRoot)
530
448
  ];
449
+ const packageFormat = agentPluginPackageFormat(pluginRoot);
450
+ const { packageFormat: _dropped, ...rest } = plugin;
531
451
  return {
532
- ...plugin,
452
+ ...rest,
533
453
  ...description ? { description } : {},
534
454
  ...tags.length > 0 ? { tags } : {},
535
- ...contents.length > 0 ? { contents } : {}
455
+ ...contents.length > 0 ? { contents } : {},
456
+ ...packageFormat ? { packageFormat } : {}
536
457
  };
537
458
  }
538
459
  function enrichCatalogPlugins(marketplaceRoot, plugins) {
@@ -595,14 +516,26 @@ function resolveTags(entry) {
595
516
  function normalizeMarketplaceSourcePath(value) {
596
517
  return value.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
597
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
+ }
598
525
  function resolveSourcePath(entry) {
599
526
  const source = entry.source;
600
527
  if (typeof source === "string" && source.trim().length > 0) {
601
- 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
+ }
602
535
  }
603
536
  const path = entry.path;
604
537
  if (typeof path === "string" && path.trim().length > 0) {
605
- return normalizeMarketplaceSourcePath(path);
538
+ return asMarketplaceSourcePath(path);
606
539
  }
607
540
  return void 0;
608
541
  }
@@ -654,6 +587,28 @@ function parseClaudeMarketplaceManifest(raw) {
654
587
  const plugins = parsePlugins(raw, marketplaceName, resolveClaudePluginName);
655
588
  return { marketplaceName, plugins };
656
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
+ }
657
612
  function parseCursorMarketplaceManifest(raw) {
658
613
  const marketplaceName = readMarketplaceName(raw);
659
614
  const plugins = parsePlugins(raw, marketplaceName, resolveCursorPluginName);
@@ -692,15 +647,19 @@ function uniqueStrings2(values) {
692
647
  }
693
648
  return next;
694
649
  }
650
+ function catalogPluginIdentity(plugin) {
651
+ return `${plugin.name}\0${plugin.flavor ?? ""}`;
652
+ }
695
653
  function mergeCatalogPluginsByIdentity(plugins) {
696
654
  const byName = /* @__PURE__ */ new Map();
697
655
  for (const plugin of plugins) {
698
- const existing = byName.get(plugin.name);
656
+ const identity = catalogPluginIdentity(plugin);
657
+ const existing = byName.get(identity);
699
658
  if (!existing) {
700
- byName.set(plugin.name, plugin);
659
+ byName.set(identity, plugin);
701
660
  continue;
702
661
  }
703
- byName.set(plugin.name, preferCatalogPlugin(existing, plugin));
662
+ byName.set(identity, preferCatalogPlugin(existing, plugin));
704
663
  }
705
664
  return [...byName.values()];
706
665
  }
@@ -708,15 +667,18 @@ function mergeCatalogPluginsByIdentity(plugins) {
708
667
  // src/services/marketplace-catalog.ts
709
668
  var MARKETPLACE_CATALOG_INDEX_VERSION = 1;
710
669
  var MANIFEST_PATHS = [
711
- { path: ".claude-plugin/marketplace.json", platform: "claude-code" },
712
- { path: ".cursor-plugin/marketplace.json", platform: "cursor" },
713
- { 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 }
714
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).";
715
677
  function marketplaceCacheDir(harnesstapDir, name) {
716
- return join5(harnesstapDir, "cache", "marketplaces", name);
678
+ return join3(harnesstapDir, "cache", "marketplaces", name);
717
679
  }
718
680
  function marketplaceCatalogPath(harnesstapDir, name) {
719
- return join5(marketplaceCacheDir(harnesstapDir, name), "catalog.json");
681
+ return join3(marketplaceCacheDir(harnesstapDir, name), "catalog.json");
720
682
  }
721
683
  var MARKETPLACE_CATALOG_MAX_AGE_MS = marketplaceRefreshMaxAgeMs(
722
684
  DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES
@@ -725,14 +687,14 @@ function isGooseOnly(platforms) {
725
687
  return platforms.length === 1 && platforms[0] === "goose";
726
688
  }
727
689
  function catalogIsFresh(catalogPath, maxAgeMs) {
728
- if (!existsSync5(catalogPath)) return false;
690
+ if (!existsSync3(catalogPath)) return false;
729
691
  const ageMs = Date.now() - statSync3(catalogPath).mtimeMs;
730
692
  return ageMs < maxAgeMs;
731
693
  }
732
694
  function readStoredCatalog(catalogPath) {
733
- if (!existsSync5(catalogPath)) return void 0;
695
+ if (!existsSync3(catalogPath)) return void 0;
734
696
  try {
735
- const raw = JSON.parse(readFileSync4(catalogPath, "utf8"));
697
+ const raw = JSON.parse(readFileSync3(catalogPath, "utf8"));
736
698
  if (!Array.isArray(raw.plugins)) return void 0;
737
699
  return raw;
738
700
  } catch {
@@ -740,39 +702,65 @@ function readStoredCatalog(catalogPath) {
740
702
  }
741
703
  }
742
704
  function writeStoredCatalog(catalogPath, catalog) {
743
- mkdirSync2(dirname(catalogPath), { recursive: true });
705
+ mkdirSync(dirname(catalogPath), { recursive: true });
744
706
  writeFileSync(catalogPath, `${JSON.stringify(catalog, null, 2)}
745
707
  `, "utf8");
746
708
  }
747
- 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 = [];
748
720
  for (const candidate of MANIFEST_PATHS) {
749
- const manifestPath = join5(cacheDir, candidate.path);
750
- if (!existsSync5(manifestPath)) continue;
751
- if (candidate.platform) {
752
- 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;
753
726
  }
754
- if (platforms.includes("claude-code") || platforms.includes("copilot-cli")) {
755
- return { manifestPath, platform: "claude-code" };
727
+ const flavor = rootMarketplaceFlavor(platforms);
728
+ if (flavor) {
729
+ found.push({ manifestPath, flavor });
756
730
  }
757
- if (platforms.includes("cursor")) {
758
- 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;
759
747
  }
760
- return void 0;
761
748
  }
762
- return void 0;
763
749
  }
764
- function parseManifest(platform, raw) {
765
- switch (platform) {
750
+ function parseManifest(flavor, raw) {
751
+ switch (flavor) {
766
752
  case "claude-code":
767
753
  return parseClaudeMarketplaceManifest(raw);
768
754
  case "copilot-cli":
769
755
  return parseClaudeMarketplaceManifest(raw);
756
+ case "codex":
757
+ return parseCodexMarketplaceManifest(raw);
770
758
  case "cursor":
771
759
  return parseCursorMarketplaceManifest(raw);
772
760
  case "goose":
773
761
  return { marketplaceName: "", plugins: [] };
774
762
  default: {
775
- const _exhaustive = platform;
763
+ const _exhaustive = flavor;
776
764
  return _exhaustive;
777
765
  }
778
766
  }
@@ -799,27 +787,47 @@ function catalogRefreshEntry(harnesstapDir, name) {
799
787
  }
800
788
  return builtinMarketplaceEntry();
801
789
  }
802
- function parseCatalogFromDir(dir, platforms, registryName) {
803
- const manifest = resolveManifest(dir, platforms);
804
- if (!manifest) {
790
+ function loadCatalogFromDir(dir, platforms, registryName) {
791
+ const manifests = resolveManifests(dir, platforms);
792
+ if (manifests.length === 0) {
805
793
  return {
806
794
  ok: false,
807
- message: "No marketplace manifest found (.claude-plugin/marketplace.json, .cursor-plugin/marketplace.json, or marketplace.json)."
795
+ message: MISSING_MANIFEST_MESSAGE
808
796
  };
809
797
  }
810
- let raw;
811
- try {
812
- raw = JSON.parse(readFileSync4(manifest.manifestPath, "utf8"));
813
- } catch {
814
- 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
+ }
815
817
  }
818
+ const partitioned = partitionEscapingCatalogPlugins(plugins);
816
819
  return {
817
820
  ok: true,
818
- catalog: catalogWithRegistryIdentity(parseManifest(manifest.platform, raw), registryName)
821
+ catalog: {
822
+ marketplaceName,
823
+ ...manifestName ? { manifestName } : {},
824
+ plugins: partitioned.plugins,
825
+ warnings: partitioned.warnings
826
+ }
819
827
  };
820
828
  }
821
- function checkoutBranchName(dir) {
822
- const result = runCommandWithTimeout("git", [
829
+ async function checkoutBranchName(dir, unattended) {
830
+ const result = await runCommandWithTimeout("git", [
823
831
  "-c",
824
832
  "protocol.file.allow=always",
825
833
  "-C",
@@ -827,7 +835,7 @@ function checkoutBranchName(dir) {
827
835
  "rev-parse",
828
836
  "--abbrev-ref",
829
837
  "HEAD"
830
- ]);
838
+ ], { unattended });
831
839
  const name = result.stdout.trim();
832
840
  return result.exitCode === 0 && name && name !== "HEAD" ? name : "HEAD";
833
841
  }
@@ -839,7 +847,14 @@ function versionsFromPlugins(plugins, branch) {
839
847
  }
840
848
  return rows;
841
849
  }
842
- 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) {
843
858
  const entry = catalogRefreshEntry(harnesstapDir, options.name);
844
859
  if (!entry) {
845
860
  return { ok: false, message: `Marketplace not found: ${options.name}` };
@@ -864,30 +879,34 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
864
879
  ...stored2?.sha ? { sha: stored2.sha } : {}
865
880
  };
866
881
  }
867
- const refresh = refreshGitSource({
882
+ const unattended = options.unattended === true;
883
+ const refresh = await refreshGitSource({
868
884
  url: entry.url,
869
- targetDir: cacheDir
885
+ targetDir: cacheDir,
886
+ unattended
870
887
  });
871
888
  if (!refresh.ok) {
872
889
  return { ok: false, message: refresh.message };
873
890
  }
874
- const defaultCatalog = parseCatalogFromDir(cacheDir, entry.platforms, entry.name);
891
+ const defaultCatalog = loadCatalogFromDir(cacheDir, entry.platforms, entry.name);
875
892
  if (!defaultCatalog.ok) {
876
893
  return defaultCatalog;
877
894
  }
878
- const defaultBranch = checkoutBranchName(cacheDir);
895
+ const defaultBranch = await checkoutBranchName(cacheDir, unattended);
879
896
  const extraBranches = parseTrackedBranches(entry.trackedBranches ?? []).filter(
880
897
  (branch) => branch !== defaultBranch
881
898
  );
882
899
  const pluginVersions = versionsFromPlugins(defaultCatalog.catalog.plugins, defaultBranch);
883
900
  const pluginBatches = [defaultCatalog.catalog.plugins];
901
+ const warnings = [...defaultCatalog.catalog.warnings];
884
902
  for (const branch of extraBranches) {
885
- const branchDir = mkdtempSync(join5(tmpdir(), "ht-mkt-branch-"));
903
+ const branchDir = mkdtempSync(join3(tmpdir(), "ht-mkt-branch-"));
886
904
  try {
887
- const branchRefresh = refreshGitSource({
905
+ const branchRefresh = await refreshGitSource({
888
906
  url: entry.url,
889
907
  targetDir: branchDir,
890
- ref: branch
908
+ ref: branch,
909
+ unattended
891
910
  });
892
911
  if (!branchRefresh.ok) {
893
912
  return {
@@ -895,7 +914,7 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
895
914
  message: `Tracked branch "${branch}": ${branchRefresh.message}`
896
915
  };
897
916
  }
898
- const branchCatalog = parseCatalogFromDir(branchDir, entry.platforms, entry.name);
917
+ const branchCatalog = loadCatalogFromDir(branchDir, entry.platforms, entry.name);
899
918
  if (!branchCatalog.ok) {
900
919
  return {
901
920
  ok: false,
@@ -903,17 +922,21 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
903
922
  };
904
923
  }
905
924
  pluginBatches.push(branchCatalog.catalog.plugins);
925
+ warnings.push(...branchCatalog.catalog.warnings);
906
926
  pluginVersions.push(...versionsFromPlugins(branchCatalog.catalog.plugins, branch));
907
927
  } finally {
908
- rmSync2(branchDir, { recursive: true, force: true });
928
+ rmSync(branchDir, { recursive: true, force: true });
909
929
  }
910
930
  }
931
+ const uniqueWarnings = [...new Set(warnings)];
911
932
  const catalog = {
912
- ...defaultCatalog.catalog,
933
+ marketplaceName: defaultCatalog.catalog.marketplaceName,
934
+ ...defaultCatalog.catalog.manifestName ? { manifestName: defaultCatalog.catalog.manifestName } : {},
913
935
  plugins: enrichCatalogPlugins(
914
936
  cacheDir,
915
937
  mergeCatalogPluginsByIdentity(pluginBatches.flat())
916
- )
938
+ ),
939
+ ...uniqueWarnings.length > 0 ? { warnings: uniqueWarnings } : {}
917
940
  };
918
941
  const stored = {
919
942
  ...catalog,
@@ -927,9 +950,24 @@ function refreshMarketplaceCatalog(harnesstapDir, options) {
927
950
  return {
928
951
  ok: true,
929
952
  message: refresh.message,
930
- ...refresh.sha ? { sha: refresh.sha } : {}
953
+ ...refresh.sha ? { sha: refresh.sha } : {},
954
+ ...uniqueWarnings.length > 0 ? { warnings: uniqueWarnings } : {}
931
955
  };
932
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
+ }
933
971
  function persistIndexedCatalog(harnesstapDir, name, stored) {
934
972
  if (stored.indexVersion === MARKETPLACE_CATALOG_INDEX_VERSION) {
935
973
  return stored;
@@ -952,21 +990,72 @@ function listCatalogPlugins(harnesstapDir, options) {
952
990
  }
953
991
  return persistIndexedCatalog(harnesstapDir, options.name, stored).plugins;
954
992
  }
955
- function ensureMarketplaceCatalog(harnesstapDir, options) {
956
- 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, {
957
1017
  name: options.name,
958
- force: options.force ?? false
1018
+ force: options.force ?? true,
1019
+ unattended: false
959
1020
  });
960
1021
  return listCatalogPlugins(harnesstapDir, { name: options.name });
961
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
+ }
962
1055
  function readMarketplaceManifest(root) {
963
- const manifest = resolveManifest(root, ["claude-code", "cursor", "copilot-cli"]);
1056
+ const manifest = resolveManifests(root, ["claude-code", "cursor", "copilot-cli"])[0];
964
1057
  if (!manifest) return void 0;
965
- try {
966
- return JSON.parse(readFileSync4(manifest.manifestPath, "utf8"));
967
- } catch {
968
- return void 0;
969
- }
1058
+ return readCachedMarketplaceJson(manifest.manifestPath);
970
1059
  }
971
1060
  function pluginMatchesQuery(plugin, query) {
972
1061
  return catalogPluginMatchesQuery(plugin, query);
@@ -978,14 +1067,22 @@ function listCatalogSearchMarketplaces(harnesstapDir) {
978
1067
  }
979
1068
  return [...registered, builtinMarketplaceEntry()];
980
1069
  }
981
- function searchCatalogPlugins(harnesstapDir, query, options = {}) {
1070
+ async function searchCatalogPlugins(harnesstapDir, query, options = {}) {
982
1071
  const marketplaces = listCatalogSearchMarketplaces(harnesstapDir);
983
1072
  if (options.refresh) {
1073
+ const failures = [];
984
1074
  for (const marketplace of marketplaces) {
985
- refreshMarketplaceCatalog(harnesstapDir, {
1075
+ const refresh = await refreshMarketplaceCatalog(harnesstapDir, {
986
1076
  name: marketplace.name,
987
- force: true
1077
+ force: true,
1078
+ unattended: false
988
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("; ")}`);
989
1086
  }
990
1087
  }
991
1088
  const trimmed = query.trim();
@@ -1002,21 +1099,6 @@ function searchCatalogPlugins(harnesstapDir, query, options = {}) {
1002
1099
  }
1003
1100
 
1004
1101
  export {
1005
- AP_SCHEMA_URL,
1006
- AP_MCP_SCHEMA_URL,
1007
- lookupApSchema,
1008
- isAgentPluginsSchemaId,
1009
- readJsonFile,
1010
- readFirstHostPluginManifest,
1011
- parsePluginRef,
1012
- DEFAULT_GIT_CLONE_TIMEOUT_MS,
1013
- runCommandWithTimeout,
1014
- refreshGitSource,
1015
- cursorRepoSourceKey,
1016
- cursorCacheRoot,
1017
- cursorLocalRoot,
1018
- cursorMarketplacesRoot,
1019
- cursorProjectsMcpsRoot,
1020
1102
  isCursorPublicMarketplace,
1021
1103
  builtinMarketplaceGitUrl,
1022
1104
  builtinMarketplaceEntry,
@@ -1025,11 +1107,15 @@ export {
1025
1107
  addMarketplace,
1026
1108
  removeMarketplace,
1027
1109
  discoverSkillPackage,
1110
+ escapingMarketplaceSourceWarning,
1028
1111
  marketplaceCacheDir,
1029
1112
  refreshMarketplaceCatalog,
1030
1113
  listCatalogPlugins,
1031
1114
  ensureMarketplaceCatalog,
1115
+ marketplaceCatalogWarnings,
1116
+ marketplaceRowFlavors,
1117
+ alignImplicitMarketplacePlatforms,
1032
1118
  readMarketplaceManifest,
1033
1119
  searchCatalogPlugins
1034
1120
  };
1035
- //# sourceMappingURL=chunk-ZVANUFPF.js.map
1121
+ //# sourceMappingURL=chunk-6LTLYV5D.js.map