harnesstap 1.1.0 → 1.3.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 (202) hide show
  1. package/README.md +33 -16
  2. package/dist/apply-QSS4242W.js +67 -0
  3. package/dist/apply-QSS4242W.js.map +1 -0
  4. package/dist/approve-CNYQY6DC.js +181 -0
  5. package/dist/approve-CNYQY6DC.js.map +1 -0
  6. package/dist/audit-V4SUV7KA.js +434 -0
  7. package/dist/audit-V4SUV7KA.js.map +1 -0
  8. package/dist/auth-63FOHIQ3.js +220 -0
  9. package/dist/auth-63FOHIQ3.js.map +1 -0
  10. package/dist/bin.js +166 -0
  11. package/dist/bin.js.map +1 -0
  12. package/dist/chunk-2H7UOFLK.js +11 -0
  13. package/dist/chunk-2H7UOFLK.js.map +1 -0
  14. package/dist/chunk-2NE3QYMP.js +103 -0
  15. package/dist/chunk-2NE3QYMP.js.map +1 -0
  16. package/dist/chunk-2P2EOYEW.js +1140 -0
  17. package/dist/chunk-2P2EOYEW.js.map +1 -0
  18. package/dist/chunk-37E5M4JX.js +34 -0
  19. package/dist/chunk-37E5M4JX.js.map +1 -0
  20. package/dist/chunk-37LQQWMF.js +496 -0
  21. package/dist/chunk-37LQQWMF.js.map +1 -0
  22. package/dist/chunk-3FIWOI3H.js +98 -0
  23. package/dist/chunk-3FIWOI3H.js.map +1 -0
  24. package/dist/chunk-3PGC6OA3.js +540 -0
  25. package/dist/chunk-3PGC6OA3.js.map +1 -0
  26. package/dist/chunk-4IHKBIY3.js +118 -0
  27. package/dist/chunk-4IHKBIY3.js.map +1 -0
  28. package/dist/chunk-4ZUBRLSP.js +17 -0
  29. package/dist/chunk-4ZUBRLSP.js.map +1 -0
  30. package/dist/chunk-5F3LNDZG.js +9 -0
  31. package/dist/chunk-5F3LNDZG.js.map +1 -0
  32. package/dist/chunk-5TXI6BI2.js +1359 -0
  33. package/dist/chunk-5TXI6BI2.js.map +1 -0
  34. package/dist/chunk-6P5IO4BX.js +235 -0
  35. package/dist/chunk-6P5IO4BX.js.map +1 -0
  36. package/dist/chunk-ABXUKHAU.js +571 -0
  37. package/dist/chunk-ABXUKHAU.js.map +1 -0
  38. package/dist/chunk-AOUDSNRK.js +1357 -0
  39. package/dist/chunk-AOUDSNRK.js.map +1 -0
  40. package/dist/chunk-BNDJJAEI.js +311 -0
  41. package/dist/chunk-BNDJJAEI.js.map +1 -0
  42. package/dist/chunk-C2IWSFF5.js +818 -0
  43. package/dist/chunk-C2IWSFF5.js.map +1 -0
  44. package/dist/chunk-CHQGE2HF.js +283 -0
  45. package/dist/chunk-CHQGE2HF.js.map +1 -0
  46. package/dist/chunk-DEJLP7QJ.js +681 -0
  47. package/dist/chunk-DEJLP7QJ.js.map +1 -0
  48. package/dist/chunk-DJ6FN6EW.js +532 -0
  49. package/dist/chunk-DJ6FN6EW.js.map +1 -0
  50. package/dist/chunk-E4WRTRMH.js +1173 -0
  51. package/dist/chunk-E4WRTRMH.js.map +1 -0
  52. package/dist/chunk-E5QXNU3K.js +238 -0
  53. package/dist/chunk-E5QXNU3K.js.map +1 -0
  54. package/dist/chunk-EMTBGOR3.js +2959 -0
  55. package/dist/chunk-EMTBGOR3.js.map +1 -0
  56. package/dist/chunk-FFWYIGQ4.js +18 -0
  57. package/dist/chunk-FFWYIGQ4.js.map +1 -0
  58. package/dist/chunk-I6XFZLTJ.js +9 -0
  59. package/dist/chunk-I6XFZLTJ.js.map +1 -0
  60. package/dist/chunk-IHWAOIAU.js +172 -0
  61. package/dist/chunk-IHWAOIAU.js.map +1 -0
  62. package/dist/chunk-IHZUYG66.js +583 -0
  63. package/dist/chunk-IHZUYG66.js.map +1 -0
  64. package/dist/chunk-JQOKQKQT.js +158 -0
  65. package/dist/chunk-JQOKQKQT.js.map +1 -0
  66. package/dist/chunk-JRFUTIEH.js +426 -0
  67. package/dist/chunk-JRFUTIEH.js.map +1 -0
  68. package/dist/chunk-KCBI6JQC.js +115 -0
  69. package/dist/chunk-KCBI6JQC.js.map +1 -0
  70. package/dist/chunk-KDUQMINL.js +60 -0
  71. package/dist/chunk-KDUQMINL.js.map +1 -0
  72. package/dist/chunk-KLR2DURP.js +656 -0
  73. package/dist/chunk-KLR2DURP.js.map +1 -0
  74. package/dist/chunk-KRI4R7EM.js +25 -0
  75. package/dist/chunk-KRI4R7EM.js.map +1 -0
  76. package/dist/chunk-LYQMK6SV.js +87 -0
  77. package/dist/chunk-LYQMK6SV.js.map +1 -0
  78. package/dist/chunk-MK3Q37ZN.js +183 -0
  79. package/dist/chunk-MK3Q37ZN.js.map +1 -0
  80. package/dist/chunk-MSGAGV7B.js +346 -0
  81. package/dist/chunk-MSGAGV7B.js.map +1 -0
  82. package/dist/chunk-MZQRSERO.js +430 -0
  83. package/dist/chunk-MZQRSERO.js.map +1 -0
  84. package/dist/chunk-N3WIJXXM.js +691 -0
  85. package/dist/chunk-N3WIJXXM.js.map +1 -0
  86. package/dist/chunk-NAGAJ5UM.js +145 -0
  87. package/dist/chunk-NAGAJ5UM.js.map +1 -0
  88. package/dist/chunk-NFYPBTKO.js +302 -0
  89. package/dist/chunk-NFYPBTKO.js.map +1 -0
  90. package/dist/chunk-NPO2IG6G.js +491 -0
  91. package/dist/chunk-NPO2IG6G.js.map +1 -0
  92. package/dist/chunk-OS6NUIBJ.js +38 -0
  93. package/dist/chunk-OS6NUIBJ.js.map +1 -0
  94. package/dist/chunk-PFUK3HJ4.js +296 -0
  95. package/dist/chunk-PFUK3HJ4.js.map +1 -0
  96. package/dist/chunk-PMQ55GDB.js +115 -0
  97. package/dist/chunk-PMQ55GDB.js.map +1 -0
  98. package/dist/chunk-QIVE2YFJ.js +514 -0
  99. package/dist/chunk-QIVE2YFJ.js.map +1 -0
  100. package/dist/chunk-QKXD3EUF.js +691 -0
  101. package/dist/chunk-QKXD3EUF.js.map +1 -0
  102. package/dist/chunk-RNQYUWF6.js +32 -0
  103. package/dist/chunk-RNQYUWF6.js.map +1 -0
  104. package/dist/chunk-S2E4SSQV.js +41 -0
  105. package/dist/chunk-S2E4SSQV.js.map +1 -0
  106. package/dist/chunk-SN4BXX3B.js +186 -0
  107. package/dist/chunk-SN4BXX3B.js.map +1 -0
  108. package/dist/chunk-SNVAMWB7.js +40 -0
  109. package/dist/chunk-SNVAMWB7.js.map +1 -0
  110. package/dist/chunk-T5VRREN4.js +696 -0
  111. package/dist/chunk-T5VRREN4.js.map +1 -0
  112. package/dist/chunk-TKBMHZTS.js +10945 -0
  113. package/dist/chunk-TKBMHZTS.js.map +1 -0
  114. package/dist/chunk-TNJPTUE4.js +35 -0
  115. package/dist/chunk-TNJPTUE4.js.map +1 -0
  116. package/dist/chunk-TQ2NA4Z4.js +24 -0
  117. package/dist/chunk-TQ2NA4Z4.js.map +1 -0
  118. package/dist/chunk-TXXDMDPN.js +998 -0
  119. package/dist/chunk-TXXDMDPN.js.map +1 -0
  120. package/dist/chunk-UWXUBU7V.js +184 -0
  121. package/dist/chunk-UWXUBU7V.js.map +1 -0
  122. package/dist/chunk-UYRK2H24.js +141 -0
  123. package/dist/chunk-UYRK2H24.js.map +1 -0
  124. package/dist/chunk-V4IXIM3C.js +806 -0
  125. package/dist/chunk-V4IXIM3C.js.map +1 -0
  126. package/dist/chunk-VFHVXXP4.js +6438 -0
  127. package/dist/chunk-VFHVXXP4.js.map +1 -0
  128. package/dist/chunk-VQVUJYYY.js +244 -0
  129. package/dist/chunk-VQVUJYYY.js.map +1 -0
  130. package/dist/chunk-VZQG2JDV.js +9 -0
  131. package/dist/chunk-VZQG2JDV.js.map +1 -0
  132. package/dist/chunk-W7HQ5X3S.js +610 -0
  133. package/dist/chunk-W7HQ5X3S.js.map +1 -0
  134. package/dist/chunk-WMSQAFK5.js +65 -0
  135. package/dist/chunk-WMSQAFK5.js.map +1 -0
  136. package/dist/chunk-WMYTBJPB.js +364 -0
  137. package/dist/chunk-WMYTBJPB.js.map +1 -0
  138. package/dist/chunk-WNLFNCOH.js +7795 -0
  139. package/dist/chunk-WNLFNCOH.js.map +1 -0
  140. package/dist/chunk-WRX7CB2M.js +6448 -0
  141. package/dist/chunk-WRX7CB2M.js.map +1 -0
  142. package/dist/chunk-XGTTOO4R.js +84 -0
  143. package/dist/chunk-XGTTOO4R.js.map +1 -0
  144. package/dist/chunk-YSXRBUR4.js +682 -0
  145. package/dist/chunk-YSXRBUR4.js.map +1 -0
  146. package/dist/chunk-YTC2EG64.js +1759 -0
  147. package/dist/chunk-YTC2EG64.js.map +1 -0
  148. package/dist/compile-J3UGQSS3.js +161 -0
  149. package/dist/compile-J3UGQSS3.js.map +1 -0
  150. package/dist/config-5BPSZND3.js +438 -0
  151. package/dist/config-5BPSZND3.js.map +1 -0
  152. package/dist/doctor-BVFKLJVO.js +111 -0
  153. package/dist/doctor-BVFKLJVO.js.map +1 -0
  154. package/dist/environment-3RI5H32O.js +2745 -0
  155. package/dist/environment-3RI5H32O.js.map +1 -0
  156. package/dist/github-YFJQVH5K.js +114 -0
  157. package/dist/github-YFJQVH5K.js.map +1 -0
  158. package/dist/harness-ECGHPEKA.js +746 -0
  159. package/dist/harness-ECGHPEKA.js.map +1 -0
  160. package/dist/help-ELPNPPEM.js +2079 -0
  161. package/dist/help-ELPNPPEM.js.map +1 -0
  162. package/dist/help-UL5XLY3I.js +1892 -0
  163. package/dist/help-UL5XLY3I.js.map +1 -0
  164. package/dist/index.d.ts +164 -1
  165. package/dist/index.js +50 -54362
  166. package/dist/index.js.map +1 -1
  167. package/dist/init-UJQTDHW7.js +873 -0
  168. package/dist/init-UJQTDHW7.js.map +1 -0
  169. package/dist/lock-XUMJ63NZ.js +455 -0
  170. package/dist/lock-XUMJ63NZ.js.map +1 -0
  171. package/dist/marketplace-ZUMOLVXE.js +495 -0
  172. package/dist/marketplace-ZUMOLVXE.js.map +1 -0
  173. package/dist/mcp-RZA5O2ND.js +202 -0
  174. package/dist/mcp-RZA5O2ND.js.map +1 -0
  175. package/dist/migrate-CYQI2FH6.js +1043 -0
  176. package/dist/migrate-CYQI2FH6.js.map +1 -0
  177. package/dist/open-AWOAWLKO.js +32 -0
  178. package/dist/open-AWOAWLKO.js.map +1 -0
  179. package/dist/pack-2QD5ZUIO.js +99 -0
  180. package/dist/pack-2QD5ZUIO.js.map +1 -0
  181. package/dist/plugin-GQSSSFX4.js +64 -0
  182. package/dist/plugin-GQSSSFX4.js.map +1 -0
  183. package/dist/plugin-from-project-SIQUFYIO.js +16 -0
  184. package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
  185. package/dist/policy-CT4JRCJI.js +105 -0
  186. package/dist/policy-CT4JRCJI.js.map +1 -0
  187. package/dist/profile-4JQ6LECP.js +1886 -0
  188. package/dist/profile-4JQ6LECP.js.map +1 -0
  189. package/dist/project-JG7QWXRG.js +1392 -0
  190. package/dist/project-JG7QWXRG.js.map +1 -0
  191. package/dist/resource-QRMR6CSD.js +555 -0
  192. package/dist/resource-QRMR6CSD.js.map +1 -0
  193. package/dist/version-LZ5POOXY.js +17 -0
  194. package/dist/version-LZ5POOXY.js.map +1 -0
  195. package/package.json +25 -14
  196. package/schemas/ap-package.v1.json +36 -0
  197. package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
  198. package/schemas/fixtures/confidence.ap.json +13 -0
  199. package/schemas/fixtures/context7.ap.json +13 -0
  200. package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
  201. package/schemas/fixtures/superpowers.ap.json +13 -0
  202. package/schemas/fixtures/third-party-skills.ap.json +13 -0
@@ -0,0 +1,540 @@
1
+ import {
2
+ containedFileStem,
3
+ formatOriginDisplayLabel,
4
+ formatResourceDisplayName,
5
+ inferContainedFileType,
6
+ isPackageEntryFileName,
7
+ packageDirectoryDisplayPath,
8
+ resourceHumanName
9
+ } from "./chunk-T5VRREN4.js";
10
+ import {
11
+ resolveExistingResourceFilesystemPath
12
+ } from "./chunk-WNLFNCOH.js";
13
+ import {
14
+ shouldUseWizard
15
+ } from "./chunk-NAGAJ5UM.js";
16
+ import {
17
+ RESOURCE_TYPES,
18
+ getInstalledCursorPluginInstallPath,
19
+ hostPluginPullUnavailableReason,
20
+ listContainedFilesPage,
21
+ listHostPluginVersions,
22
+ listResourcesMatchingOriginRef,
23
+ parseDependencyRef,
24
+ resolveHomeRoot,
25
+ resolveInstallRoot,
26
+ resolveMarketplaceRoot
27
+ } from "./chunk-TKBMHZTS.js";
28
+ import {
29
+ builtinMarketplaceEntry,
30
+ listMarketplaces,
31
+ normalizeMarketplaceUrl,
32
+ readJsonFile,
33
+ readMarketplaceManifest
34
+ } from "./chunk-TXXDMDPN.js";
35
+ import {
36
+ parseOutputFormat
37
+ } from "./chunk-TQ2NA4Z4.js";
38
+ import {
39
+ formatRelativeTimeWithAbsolute,
40
+ renderPanel,
41
+ renderSubheader,
42
+ ui
43
+ } from "./chunk-ABXUKHAU.js";
44
+ import {
45
+ getHarnesstapDir
46
+ } from "./chunk-KLR2DURP.js";
47
+
48
+ // src/cli/handlers/resource-list.ts
49
+ function makeResourceTypeColumn(width = 14) {
50
+ return {
51
+ key: "type",
52
+ header: "TYPE",
53
+ width,
54
+ style: (value) => ui.theme.resourceType(value)
55
+ };
56
+ }
57
+ function isPluginAttachmentOnlyType(type) {
58
+ if (!type) {
59
+ return false;
60
+ }
61
+ return type === "plugin";
62
+ }
63
+ function resolveResourceListType(positionalType, flagType) {
64
+ if (positionalType && flagType && positionalType !== flagType) {
65
+ return "conflict";
66
+ }
67
+ const type = positionalType ?? flagType;
68
+ if (!type) {
69
+ return void 0;
70
+ }
71
+ const normalized = type === "plugin_pin" ? "plugin" : type;
72
+ if (!RESOURCE_TYPES.includes(normalized)) {
73
+ return "invalid";
74
+ }
75
+ return normalized;
76
+ }
77
+ function shouldUseInteractiveResourceList(input) {
78
+ if (input.search) {
79
+ return false;
80
+ }
81
+ return shouldUseWizard({
82
+ interactive: true,
83
+ noInteractive: input.noInteractive,
84
+ format: parseOutputFormat(input.format),
85
+ missingRequiredArgs: true
86
+ });
87
+ }
88
+ function resourceListRenderOptions(opts) {
89
+ return {
90
+ showId: Boolean(opts.showId),
91
+ showAll: Boolean(opts.all)
92
+ };
93
+ }
94
+
95
+ // src/services/resource-show.ts
96
+ import { readFileSync } from "fs";
97
+
98
+ // src/services/plugin-resource-show.ts
99
+ import { existsSync as existsSync2, statSync } from "fs";
100
+ import { join as join2, relative, resolve, sep } from "path";
101
+
102
+ // src/services/host-marketplaces.ts
103
+ import { existsSync } from "fs";
104
+ import { join } from "path";
105
+ function isRecord(value) {
106
+ return typeof value === "object" && value !== null && !Array.isArray(value);
107
+ }
108
+ function stripTrailingSlash(url) {
109
+ return url.replace(/\/+$/, "");
110
+ }
111
+ function githubMarketplaceUrl(repo) {
112
+ const trimmed = repo.trim();
113
+ if (trimmed.includes("://")) {
114
+ return stripTrailingSlash(normalizeMarketplaceUrl(trimmed));
115
+ }
116
+ return stripTrailingSlash(normalizeMarketplaceUrl(`https://github.com/${trimmed}`));
117
+ }
118
+ function mergeMarketplacePlatforms(left, right) {
119
+ const seen = /* @__PURE__ */ new Set();
120
+ const merged = [];
121
+ for (const platform of [...left, ...right]) {
122
+ if (seen.has(platform)) continue;
123
+ seen.add(platform);
124
+ merged.push(platform);
125
+ }
126
+ return merged;
127
+ }
128
+ function repositoryUrlFromManifest(root) {
129
+ const raw = readMarketplaceManifest(root);
130
+ if (!isRecord(raw)) return void 0;
131
+ const repository = raw.repository;
132
+ if (typeof repository === "string" && repository.trim()) {
133
+ return stripTrailingSlash(normalizeMarketplaceUrl(repository));
134
+ }
135
+ if (isRecord(repository) && typeof repository.url === "string" && repository.url.trim()) {
136
+ return stripTrailingSlash(normalizeMarketplaceUrl(repository.url));
137
+ }
138
+ return void 0;
139
+ }
140
+ function discoverClaudeMarketplaces(homeRoot) {
141
+ const knownPath = join(homeRoot, ".claude", "plugins", "known_marketplaces.json");
142
+ const known = readJsonFile(knownPath);
143
+ if (!known || !isRecord(known)) return [];
144
+ const discovered = [];
145
+ for (const [name, value] of Object.entries(known)) {
146
+ const trimmedName = name.trim();
147
+ if (!trimmedName || !isRecord(value)) continue;
148
+ const source = isRecord(value.source) ? value.source : {};
149
+ const kind = typeof source.source === "string" ? source.source : "";
150
+ const installLocation = typeof value.installLocation === "string" && value.installLocation.trim() ? value.installLocation.trim() : void 0;
151
+ const contentRoot = installLocation && existsSync(installLocation) ? installLocation : void 0;
152
+ let url = "";
153
+ switch (kind) {
154
+ case "github": {
155
+ const repo = typeof source.repo === "string" ? source.repo : "";
156
+ if (!repo.trim()) continue;
157
+ url = githubMarketplaceUrl(repo);
158
+ break;
159
+ }
160
+ case "directory": {
161
+ const path = typeof source.path === "string" && source.path.trim() ? source.path.trim() : installLocation ?? "";
162
+ if (!path) continue;
163
+ url = (contentRoot ? repositoryUrlFromManifest(contentRoot) : void 0) ?? path;
164
+ break;
165
+ }
166
+ default:
167
+ continue;
168
+ }
169
+ const platforms = ["claude-code"];
170
+ discovered.push({
171
+ name: trimmedName,
172
+ url,
173
+ platforms,
174
+ managed: false,
175
+ ...contentRoot ? { contentRoot } : {}
176
+ });
177
+ }
178
+ return discovered;
179
+ }
180
+ function listVisibleMarketplaces(harnesstapDir, homeRoot = resolveHomeRoot()) {
181
+ const registered = listMarketplaces(harnesstapDir).map((entry) => ({
182
+ ...entry,
183
+ managed: true
184
+ }));
185
+ const seenNames = new Set(registered.map((entry) => entry.name));
186
+ const seenUrls = new Set(
187
+ registered.map((entry) => stripTrailingSlash(normalizeMarketplaceUrl(entry.url)))
188
+ );
189
+ const host = [];
190
+ for (const entry of discoverClaudeMarketplaces(homeRoot)) {
191
+ const urlKey = stripTrailingSlash(normalizeMarketplaceUrl(entry.url));
192
+ if (seenNames.has(entry.name) || seenUrls.has(urlKey)) continue;
193
+ seenNames.add(entry.name);
194
+ seenUrls.add(urlKey);
195
+ host.push(entry);
196
+ }
197
+ const listed = [...registered, ...host];
198
+ const builtin = builtinMarketplaceEntry();
199
+ const existing = listed.find((entry) => entry.name === builtin.name);
200
+ const contentRoot = resolveMarketplaceRoot(homeRoot, builtin.name);
201
+ if (existing) {
202
+ existing.platforms = mergeMarketplacePlatforms(builtin.platforms, existing.platforms);
203
+ if (!existing.url) {
204
+ existing.url = builtin.url;
205
+ }
206
+ if (contentRoot && !existing.contentRoot) {
207
+ existing.contentRoot = contentRoot;
208
+ }
209
+ } else {
210
+ listed.push({
211
+ ...builtin,
212
+ managed: false,
213
+ ...contentRoot ? { contentRoot } : {}
214
+ });
215
+ }
216
+ return listed;
217
+ }
218
+
219
+ // src/services/plugin-resource-show.ts
220
+ function pluginResourceShowExtras(resource, options) {
221
+ if (resource.type !== "plugin") {
222
+ return void 0;
223
+ }
224
+ const originRef = resource.origin_ref || resource.name;
225
+ const homeRoot = options?.homeRoot ?? resolveHomeRoot();
226
+ const cursorInstall = getInstalledCursorPluginInstallPath(homeRoot, originRef);
227
+ const preferCursorInstall = (resource.source ?? "").includes(".cursor/plugins");
228
+ const installPath = preferCursorInstall && cursorInstall ? cursorInstall : resolveInstallRoot(
229
+ originRef,
230
+ homeRoot,
231
+ join2(homeRoot, ".claude", "plugins"),
232
+ preferCursorInstall ? { preferCanonicalPackage: false } : {}
233
+ );
234
+ const marketplaceName = resource.metadata.marketplace_name || parseDependencyRef(originRef).namespace || resource.namespace?.split("#")[0] || "";
235
+ const marketplaceUrl = resource.origin_kind === "marketplace_link" && marketplaceName ? listVisibleMarketplaces(
236
+ options?.harnesstapDir ?? getHarnesstapDir(),
237
+ options?.homeRoot
238
+ ).find((entry) => entry.name === marketplaceName)?.url ?? null : null;
239
+ const versions = listHostPluginVersions(originRef, options?.homeRoot);
240
+ const pull_unavailable_reason = hostPluginPullUnavailableReason(
241
+ originRef,
242
+ options?.homeRoot
243
+ );
244
+ const current_version = versions.current_version ?? resource.metadata.resolved_version ?? null;
245
+ const includeContained = options?.includeContained !== false;
246
+ if (!installPath) {
247
+ return {
248
+ install_path: null,
249
+ marketplace_url: marketplaceUrl,
250
+ contained_resources: [],
251
+ current_version,
252
+ advertised_version: versions.advertised_version,
253
+ available_versions: versions.available_versions,
254
+ pull_unavailable_reason
255
+ };
256
+ }
257
+ return {
258
+ install_path: installPath,
259
+ marketplace_url: marketplaceUrl,
260
+ contained_resources: includeContained ? listContainedPluginFiles(installPath, originRef, resource.id, {
261
+ limit: options?.limit,
262
+ offset: options?.offset
263
+ }).contained_resources : [],
264
+ current_version,
265
+ advertised_version: versions.advertised_version,
266
+ available_versions: versions.available_versions,
267
+ pull_unavailable_reason
268
+ };
269
+ }
270
+ function packageResourceShowExtras(resource, options) {
271
+ if (resource.type === "plugin") {
272
+ return void 0;
273
+ }
274
+ if (options?.includeContained === false) {
275
+ return void 0;
276
+ }
277
+ const page = listPackageContainedFiles(resource, options);
278
+ if (!page || page.contained_resources.length === 0) {
279
+ return void 0;
280
+ }
281
+ return { contained_resources: page.contained_resources };
282
+ }
283
+ var SKIP_TREE_SEGMENTS = /* @__PURE__ */ new Set([".git", "node_modules"]);
284
+ function listPluginTreeRelativePaths(installPath, options) {
285
+ try {
286
+ const page = listContainedFilesPage(installPath, {
287
+ limit: options?.limit,
288
+ offset: options?.offset,
289
+ skipDirNames: SKIP_TREE_SEGMENTS
290
+ });
291
+ if (options?.limit === void 0 && (options?.offset ?? 0) === 0) {
292
+ return {
293
+ files: page.files.slice().sort((left, right) => left.localeCompare(right)),
294
+ hasMore: page.hasMore
295
+ };
296
+ }
297
+ return page;
298
+ } catch {
299
+ return { files: [], hasMore: false };
300
+ }
301
+ }
302
+ function inferPackageContainedFileType(relativePath) {
303
+ const base = relativePath.split("/").at(-1)?.toLowerCase() ?? "";
304
+ if (base === "skill.md") {
305
+ return "skill";
306
+ }
307
+ if (base === "plugin.json") {
308
+ return "plugin";
309
+ }
310
+ return inferContainedFileType(relativePath);
311
+ }
312
+ function listPackageTreeFiles(packageDir, options) {
313
+ const page = listPluginTreeRelativePaths(packageDir, options);
314
+ return {
315
+ contained_resources: page.files.map((relative_path) => ({
316
+ type: inferPackageContainedFileType(relative_path),
317
+ name: containedFileStem(relative_path),
318
+ path: join2(packageDir, ...relative_path.split("/")),
319
+ relative_path
320
+ })),
321
+ has_more: page.hasMore
322
+ };
323
+ }
324
+ function listPackageContainedFiles(resource, options) {
325
+ const filePath = resolveExistingResourceFilesystemPath(resource, options?.pathHint);
326
+ if (!filePath) {
327
+ return void 0;
328
+ }
329
+ const fileName = filePath.split(/[/\\]/).pop() ?? "";
330
+ if (!isPackageEntryFileName(fileName)) {
331
+ return void 0;
332
+ }
333
+ return listPackageTreeFiles(packageDirectoryDisplayPath(filePath), {
334
+ limit: options?.limit,
335
+ offset: options?.offset
336
+ });
337
+ }
338
+ function listContainedPluginFiles(installPath, originRef, pluginResourceId, options) {
339
+ const libraryByRelative = /* @__PURE__ */ new Map();
340
+ for (const row of listResourcesMatchingOriginRef(originRef)) {
341
+ if (row.type === "plugin" || row.id === pluginResourceId) {
342
+ continue;
343
+ }
344
+ const contained = containedFile(installPath, row.source);
345
+ if (contained) {
346
+ libraryByRelative.set(contained.relative_path, row);
347
+ }
348
+ }
349
+ const treePage = listPluginTreeRelativePaths(installPath, options);
350
+ if (treePage.files.length === 0 && !treePage.hasMore) {
351
+ const fallback = [...libraryByRelative.entries()].map(([relative_path, row]) => {
352
+ const contained = containedFile(installPath, row.source);
353
+ return {
354
+ type: row.type,
355
+ name: row.name,
356
+ path: contained?.path ?? join2(installPath, ...relative_path.split("/")),
357
+ relative_path
358
+ };
359
+ }).sort((left, right) => left.relative_path.localeCompare(right.relative_path));
360
+ const start = Math.max(0, options?.offset ?? 0);
361
+ const limit = options?.limit;
362
+ if (limit === void 0) {
363
+ return { contained_resources: fallback.slice(start), has_more: false };
364
+ }
365
+ const end = start + limit;
366
+ return {
367
+ contained_resources: fallback.slice(start, end),
368
+ has_more: end < fallback.length
369
+ };
370
+ }
371
+ return {
372
+ contained_resources: treePage.files.map((relative_path) => {
373
+ const path = join2(installPath, ...relative_path.split("/"));
374
+ const row = libraryByRelative.get(relative_path);
375
+ if (row) {
376
+ return {
377
+ type: row.type,
378
+ name: row.name,
379
+ path,
380
+ relative_path
381
+ };
382
+ }
383
+ return {
384
+ type: inferContainedFileType(relative_path),
385
+ name: containedFileStem(relative_path),
386
+ path,
387
+ relative_path
388
+ };
389
+ }),
390
+ has_more: treePage.hasMore
391
+ };
392
+ }
393
+ function containedFile(installPath, source) {
394
+ if (!source.trim()) {
395
+ return null;
396
+ }
397
+ const absolute = resolve(installPath, source);
398
+ const root = resolve(installPath);
399
+ const rel = relative(root, absolute);
400
+ if (!rel || rel.startsWith("..")) {
401
+ return null;
402
+ }
403
+ if (!existsSync2(absolute)) {
404
+ return null;
405
+ }
406
+ try {
407
+ if (!statSync(absolute).isFile()) {
408
+ return null;
409
+ }
410
+ } catch {
411
+ return null;
412
+ }
413
+ return {
414
+ path: absolute,
415
+ relative_path: rel.split(sep).join("/")
416
+ };
417
+ }
418
+
419
+ // src/services/resource-show.ts
420
+ var DEFAULT_CONTENT_LINE_LIMIT = 15;
421
+ function resourceShowExtras(resource) {
422
+ return pluginResourceShowExtras(resource) ?? packageResourceShowExtras(resource);
423
+ }
424
+ function resourceShowPanelRows(resource, extras, opts) {
425
+ const path = extras && "install_path" in extras && extras.install_path ? extras.install_path : packageDirectoryDisplayPath(resource.source);
426
+ const panelRows = [
427
+ ["Type", resource.type],
428
+ ["Name", resourceHumanName(resource)],
429
+ ["Description", resource.description || ": "],
430
+ ["Path", path || ": "],
431
+ ["Origin", formatOriginDisplayLabel(
432
+ resource.origin_kind,
433
+ resource.origin_ref,
434
+ { includeRef: resource.type !== "plugin" }
435
+ )],
436
+ ["Updated", formatRelativeTimeWithAbsolute(resource.updated_at)]
437
+ ];
438
+ if (resource.namespace) {
439
+ panelRows.splice(2, 0, ["Namespace", resource.namespace]);
440
+ }
441
+ if (opts?.showAllFields) {
442
+ panelRows.push(
443
+ ["Source", resource.source],
444
+ ["Content hash", resource.content_hash || ": "],
445
+ ["ID", resource.id],
446
+ ["Created", resource.created_at],
447
+ ["Metadata", JSON.stringify(resource.metadata)]
448
+ );
449
+ }
450
+ return panelRows;
451
+ }
452
+ function truncateResourceContent(content, maxLines = DEFAULT_CONTENT_LINE_LIMIT) {
453
+ const lines = content.split("\n");
454
+ if (lines.length <= maxLines) {
455
+ return content;
456
+ }
457
+ const totalLines = lines.length;
458
+ return [
459
+ ...lines.slice(0, maxLines),
460
+ `... (${totalLines} lines in content)`
461
+ ].join("\n");
462
+ }
463
+ function readContainedSkillBody(files) {
464
+ const skillFile = files.find((file) => {
465
+ const base = file.relative_path.split("/").at(-1)?.toLowerCase();
466
+ return base === "skill.md";
467
+ });
468
+ if (!skillFile) {
469
+ return void 0;
470
+ }
471
+ try {
472
+ return readFileSync(skillFile.path, "utf-8");
473
+ } catch {
474
+ return void 0;
475
+ }
476
+ }
477
+ function resolveResourceBody(resource, extras) {
478
+ if (resource.type !== "plugin" && resource.content.trim().length > 0) {
479
+ return resource.content;
480
+ }
481
+ if (resource.type !== "plugin" && extras && "contained_resources" in extras) {
482
+ const fromDisk = readContainedSkillBody(extras.contained_resources);
483
+ if (fromDisk !== void 0) {
484
+ return fromDisk;
485
+ }
486
+ }
487
+ return resource.content;
488
+ }
489
+ function renderContainedFileList(files) {
490
+ if (files.length === 0) {
491
+ return "Nothing loaded yet.";
492
+ }
493
+ return files.map((file) => file.relative_path).join("\n");
494
+ }
495
+ function renderResourceContent(resource, extras, opts) {
496
+ if (resource.type === "plugin") {
497
+ if (!extras || extras.contained_resources.length === 0) {
498
+ return "Nothing loaded yet.";
499
+ }
500
+ return renderContainedFileList(extras.contained_resources);
501
+ }
502
+ const body = resolveResourceBody(resource, extras);
503
+ const renderedBody = opts?.full ? body : truncateResourceContent(body);
504
+ if (!extras || extras.contained_resources.length === 0) {
505
+ return renderedBody;
506
+ }
507
+ const companions = extras.contained_resources.filter((file) => {
508
+ const base = file.relative_path.split("/").at(-1)?.toLowerCase();
509
+ return base !== "skill.md";
510
+ });
511
+ if (companions.length === 0) {
512
+ return renderedBody;
513
+ }
514
+ return [renderedBody, "", renderContainedFileList(extras.contained_resources)].join("\n");
515
+ }
516
+ function renderResourceShow(resource, opts) {
517
+ const extras = resourceShowExtras(resource);
518
+ return [
519
+ renderPanel({
520
+ title: ["RESOURCE", formatResourceDisplayName(resource)],
521
+ rows: resourceShowPanelRows(resource, extras, opts)
522
+ }),
523
+ renderSubheader("CONTENT"),
524
+ renderResourceContent(resource, extras, opts)
525
+ ].join("\n");
526
+ }
527
+ function printResourceShow(resource, opts) {
528
+ console.log(renderResourceShow(resource, opts));
529
+ }
530
+
531
+ export {
532
+ makeResourceTypeColumn,
533
+ isPluginAttachmentOnlyType,
534
+ resolveResourceListType,
535
+ shouldUseInteractiveResourceList,
536
+ resourceListRenderOptions,
537
+ renderResourceShow,
538
+ printResourceShow
539
+ };
540
+ //# sourceMappingURL=chunk-3PGC6OA3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/handlers/resource-list.ts","../src/services/resource-show.ts","../src/services/plugin-resource-show.ts","../src/services/host-marketplaces.ts"],"sourcesContent":["import type { ResourceType } from \"../../types.js\";\nimport { RESOURCE_TYPES } from \"../../types.js\";\nimport { ui } from \"../../ui/index.js\";\nimport type { Column } from \"../../ui/table.js\";\nimport { parseOutputFormat } from \"../../utils/output-format.js\";\nimport { shouldUseWizard } from \"../../services/wizards/shared.js\";\n\nexport function makeResourceTypeColumn(width = 14): Column {\n return {\n key: \"type\",\n header: \"TYPE\",\n width,\n style: (value) => ui.theme.resourceType(value),\n };\n}\n\nexport function isPluginAttachmentOnlyType(type: string | undefined): boolean {\n if (!type) {\n return false;\n }\n return type === \"plugin\";\n}\n\nexport function resolveResourceListType(\n positionalType?: string,\n flagType?: string,\n): ResourceType | undefined | \"invalid\" | \"conflict\" {\n if (positionalType && flagType && positionalType !== flagType) {\n return \"conflict\";\n }\n const type = positionalType ?? flagType;\n if (!type) {\n return undefined;\n }\n const normalized = type === \"plugin_pin\" ? \"plugin\" : type;\n if (!RESOURCE_TYPES.includes(normalized as ResourceType)) {\n return \"invalid\";\n }\n return normalized as ResourceType;\n}\n\nexport function shouldUseInteractiveResourceList(input: {\n noInteractive?: boolean;\n format?: string;\n search?: string;\n}): boolean {\n if (input.search) {\n return false;\n }\n\n return shouldUseWizard({\n interactive: true,\n noInteractive: input.noInteractive,\n format: parseOutputFormat(input.format),\n missingRequiredArgs: true,\n });\n}\n\nexport function resourceListRenderOptions(opts: {\n showId?: boolean;\n all?: boolean;\n}): { showId: boolean; showAll: boolean } {\n return {\n showId: Boolean(opts.showId),\n showAll: Boolean(opts.all),\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport type { Resource } from \"../types.js\";\nimport { formatRelativeTimeWithAbsolute } from \"../ui/format.js\";\nimport { renderPanel } from \"../ui/panel.js\";\nimport {\n formatOriginDisplayLabel,\n formatResourceDisplayName,\n packageDirectoryDisplayPath,\n resourceHumanName,\n} from \"../ui/resource-display.js\";\nimport { renderSubheader } from \"../ui/section.js\";\nimport {\n type PluginContainedResource,\n packageResourceShowExtras,\n pluginResourceShowExtras,\n} from \"./plugin-resource-show.js\";\n\nconst DEFAULT_CONTENT_LINE_LIMIT = 15;\n\nexport type ResourceShowOptions = {\n showAllFields?: boolean;\n full?: boolean;\n};\n\nfunction resourceShowExtras(\n resource: Resource,\n): ReturnType<typeof pluginResourceShowExtras> | ReturnType<typeof packageResourceShowExtras> {\n return pluginResourceShowExtras(resource) ?? packageResourceShowExtras(resource);\n}\n\nfunction resourceShowPanelRows(\n resource: Resource,\n extras: ReturnType<typeof resourceShowExtras>,\n opts?: ResourceShowOptions,\n): Array<[string, string]> {\n const path =\n extras && \"install_path\" in extras && extras.install_path\n ? extras.install_path\n : packageDirectoryDisplayPath(resource.source);\n const panelRows: Array<[string, string]> = [\n [\"Type\", resource.type],\n [\"Name\", resourceHumanName(resource)],\n [\"Description\", resource.description || \": \"],\n [\"Path\", path || \": \"],\n [\"Origin\", formatOriginDisplayLabel(\n resource.origin_kind,\n resource.origin_ref,\n { includeRef: resource.type !== \"plugin\" },\n )],\n [\"Updated\", formatRelativeTimeWithAbsolute(resource.updated_at)],\n ];\n if (resource.namespace) {\n panelRows.splice(2, 0, [\"Namespace\", resource.namespace]);\n }\n if (opts?.showAllFields) {\n panelRows.push(\n [\"Source\", resource.source],\n [\"Content hash\", resource.content_hash || \": \"],\n [\"ID\", resource.id],\n [\"Created\", resource.created_at],\n [\"Metadata\", JSON.stringify(resource.metadata)],\n );\n }\n return panelRows;\n}\n\nexport function truncateResourceContent(\n content: string,\n maxLines = DEFAULT_CONTENT_LINE_LIMIT,\n): string {\n const lines = content.split(\"\\n\");\n if (lines.length <= maxLines) {\n return content;\n }\n const totalLines = lines.length;\n return [\n ...lines.slice(0, maxLines),\n `... (${totalLines} lines in content)`,\n ].join(\"\\n\");\n}\n\nfunction readContainedSkillBody(files: PluginContainedResource[]): string | undefined {\n const skillFile = files.find((file) => {\n const base = file.relative_path.split(\"/\").at(-1)?.toLowerCase();\n return base === \"skill.md\";\n });\n if (!skillFile) {\n return undefined;\n }\n try {\n return readFileSync(skillFile.path, \"utf-8\");\n } catch {\n return undefined;\n }\n}\n\nfunction resolveResourceBody(\n resource: Resource,\n extras: ReturnType<typeof resourceShowExtras>,\n): string {\n if (resource.type !== \"plugin\" && resource.content.trim().length > 0) {\n return resource.content;\n }\n if (resource.type !== \"plugin\" && extras && \"contained_resources\" in extras) {\n const fromDisk = readContainedSkillBody(extras.contained_resources);\n if (fromDisk !== undefined) {\n return fromDisk;\n }\n }\n return resource.content;\n}\n\nfunction renderContainedFileList(files: PluginContainedResource[]): string {\n if (files.length === 0) {\n return \"Nothing loaded yet.\";\n }\n return files.map((file) => file.relative_path).join(\"\\n\");\n}\n\nfunction renderResourceContent(\n resource: Resource,\n extras: ReturnType<typeof resourceShowExtras>,\n opts?: ResourceShowOptions,\n): string {\n if (resource.type === \"plugin\") {\n if (!extras || extras.contained_resources.length === 0) {\n return \"Nothing loaded yet.\";\n }\n return renderContainedFileList(extras.contained_resources);\n }\n\n const body = resolveResourceBody(resource, extras);\n const renderedBody = opts?.full ? body : truncateResourceContent(body);\n if (!extras || extras.contained_resources.length === 0) {\n return renderedBody;\n }\n const companions = extras.contained_resources.filter((file) => {\n const base = file.relative_path.split(\"/\").at(-1)?.toLowerCase();\n return base !== \"skill.md\";\n });\n if (companions.length === 0) {\n return renderedBody;\n }\n return [renderedBody, \"\", renderContainedFileList(extras.contained_resources)].join(\"\\n\");\n}\n\nexport function renderResourceShow(resource: Resource, opts?: ResourceShowOptions): string {\n const extras = resourceShowExtras(resource);\n return [\n renderPanel({\n title: [\"RESOURCE\", formatResourceDisplayName(resource)],\n rows: resourceShowPanelRows(resource, extras, opts),\n }),\n renderSubheader(\"CONTENT\"),\n renderResourceContent(resource, extras, opts),\n ].join(\"\\n\");\n}\n\nexport function printResourceShow(resource: Resource, opts?: ResourceShowOptions): void {\n console.log(renderResourceShow(resource, opts));\n}\n","import { existsSync, statSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { listResourcesMatchingOriginRef } from \"../models/resource.js\";\nimport { getInstalledCursorPluginInstallPath } from \"../plugins/cursor-installed.js\";\nimport type { PluginDependencyMetadata, Resource } from \"../types.js\";\nimport {\n containedFileStem,\n inferContainedFileType,\n isPackageEntryFileName,\n packageDirectoryDisplayPath,\n} from \"../ui/resource-display.js\";\nimport { listContainedFilesPage } from \"../utils/path-containment.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { listVisibleMarketplaces } from \"./host-marketplaces.js\";\nimport { parseDependencyRef } from \"./plugin-dependency.js\";\nimport {\n hostPluginPullUnavailableReason,\n listHostPluginVersions,\n type HostPluginCacheVersion,\n} from \"./host-plugin-versions.js\";\nimport { resolveExistingResourceFilesystemPath } from \"./resource-editor-path.js\";\nimport { resolveInstallRoot } from \"./resource-sync.js\";\n\nexport const CONTAINED_FILES_PAGE_SIZE = 20;\n\nexport interface PluginContainedResource {\n type: string;\n name: string;\n path: string;\n relative_path: string;\n}\n\nexport interface PluginResourceShowExtras {\n install_path: string | null;\n marketplace_url: string | null;\n contained_resources: PluginContainedResource[];\n current_version: string | null;\n advertised_version: string | null;\n available_versions: HostPluginCacheVersion[];\n pull_unavailable_reason: string | null;\n}\n\nexport type PluginResourceShowOptions = {\n homeRoot?: string;\n harnesstapDir?: string;\n pathHint?: string | null;\n includeContained?: boolean;\n limit?: number;\n offset?: number;\n};\n\nexport type ContainedResourcePage = {\n contained_resources: PluginContainedResource[];\n has_more: boolean;\n};\n\nexport function pluginResourceShowExtras(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): PluginResourceShowExtras | undefined {\n if (resource.type !== \"plugin\") {\n return undefined;\n }\n const originRef = resource.origin_ref || resource.name;\n const homeRoot = options?.homeRoot ?? resolveHomeRoot();\n const cursorInstall = getInstalledCursorPluginInstallPath(homeRoot, originRef);\n const preferCursorInstall = (resource.source ?? \"\").includes(\".cursor/plugins\");\n const installPath =\n preferCursorInstall && cursorInstall\n ? cursorInstall\n : resolveInstallRoot(\n originRef,\n homeRoot,\n join(homeRoot, \".claude\", \"plugins\"),\n preferCursorInstall ? { preferCanonicalPackage: false } : {},\n );\n const marketplaceName =\n (resource.metadata as PluginDependencyMetadata).marketplace_name ||\n parseDependencyRef(originRef).namespace ||\n resource.namespace?.split(\"#\")[0] ||\n \"\";\n const marketplaceUrl =\n resource.origin_kind === \"marketplace_link\" && marketplaceName\n ? (listVisibleMarketplaces(\n options?.harnesstapDir ?? getHarnesstapDir(),\n options?.homeRoot,\n ).find((entry) => entry.name === marketplaceName)?.url ?? null)\n : null;\n const versions = listHostPluginVersions(originRef, options?.homeRoot);\n const pull_unavailable_reason = hostPluginPullUnavailableReason(\n originRef,\n options?.homeRoot,\n );\n const current_version =\n versions.current_version ??\n (resource.metadata as PluginDependencyMetadata).resolved_version ??\n null;\n const includeContained = options?.includeContained !== false;\n if (!installPath) {\n return {\n install_path: null,\n marketplace_url: marketplaceUrl,\n contained_resources: [],\n current_version,\n advertised_version: versions.advertised_version,\n available_versions: versions.available_versions,\n pull_unavailable_reason,\n };\n }\n return {\n install_path: installPath,\n marketplace_url: marketplaceUrl,\n contained_resources: includeContained\n ? listContainedPluginFiles(installPath, originRef, resource.id, {\n limit: options?.limit,\n offset: options?.offset,\n }).contained_resources\n : [],\n current_version,\n advertised_version: versions.advertised_version,\n available_versions: versions.available_versions,\n pull_unavailable_reason,\n };\n}\n\nexport interface PackageResourceShowExtras {\n contained_resources: PluginContainedResource[];\n}\n\n/** Nested files for SKILL.md / plugin.json packages that are not plugin-type resources. */\nexport function packageResourceShowExtras(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): PackageResourceShowExtras | undefined {\n if (resource.type === \"plugin\") {\n return undefined;\n }\n if (options?.includeContained === false) {\n return undefined;\n }\n const page = listPackageContainedFiles(resource, options);\n if (!page || page.contained_resources.length === 0) {\n return undefined;\n }\n return { contained_resources: page.contained_resources };\n}\n\nexport function listResourceContainedFiles(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): ContainedResourcePage {\n if (resource.type === \"plugin\") {\n const extras = pluginResourceShowExtras(resource, {\n ...options,\n includeContained: false,\n });\n if (!extras?.install_path) {\n return { contained_resources: [], has_more: false };\n }\n return listContainedPluginFiles(\n extras.install_path,\n resource.origin_ref || resource.name,\n resource.id,\n { limit: options?.limit, offset: options?.offset },\n );\n }\n return (\n listPackageContainedFiles(resource, options) ?? {\n contained_resources: [],\n has_more: false,\n }\n );\n}\n\nconst SKIP_TREE_SEGMENTS = new Set([\".git\", \"node_modules\"]);\n\nfunction listPluginTreeRelativePaths(\n installPath: string,\n options?: { limit?: number; offset?: number },\n): { files: string[]; hasMore: boolean } {\n try {\n const page = listContainedFilesPage(installPath, {\n limit: options?.limit,\n offset: options?.offset,\n skipDirNames: SKIP_TREE_SEGMENTS,\n });\n if (options?.limit === undefined && (options?.offset ?? 0) === 0) {\n return {\n files: page.files.slice().sort((left, right) => left.localeCompare(right)),\n hasMore: page.hasMore,\n };\n }\n return page;\n } catch {\n return { files: [], hasMore: false };\n }\n}\n\nfunction inferPackageContainedFileType(relativePath: string): string {\n const base = relativePath.split(\"/\").at(-1)?.toLowerCase() ?? \"\";\n if (base === \"skill.md\") {\n return \"skill\";\n }\n if (base === \"plugin.json\") {\n return \"plugin\";\n }\n return inferContainedFileType(relativePath);\n}\n\nfunction listPackageTreeFiles(\n packageDir: string,\n options?: { limit?: number; offset?: number },\n): ContainedResourcePage {\n const page = listPluginTreeRelativePaths(packageDir, options);\n return {\n contained_resources: page.files.map((relative_path) => ({\n type: inferPackageContainedFileType(relative_path),\n name: containedFileStem(relative_path),\n path: join(packageDir, ...relative_path.split(\"/\")),\n relative_path,\n })),\n has_more: page.hasMore,\n };\n}\n\nfunction listPackageContainedFiles(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): ContainedResourcePage | undefined {\n const filePath = resolveExistingResourceFilesystemPath(resource, options?.pathHint);\n if (!filePath) {\n return undefined;\n }\n const fileName = filePath.split(/[/\\\\]/).pop() ?? \"\";\n if (!isPackageEntryFileName(fileName)) {\n return undefined;\n }\n return listPackageTreeFiles(packageDirectoryDisplayPath(filePath), {\n limit: options?.limit,\n offset: options?.offset,\n });\n}\n\nfunction listContainedPluginFiles(\n installPath: string,\n originRef: string,\n pluginResourceId: string,\n options?: { limit?: number; offset?: number },\n): ContainedResourcePage {\n const libraryByRelative = new Map<string, Resource>();\n for (const row of listResourcesMatchingOriginRef(originRef)) {\n if (row.type === \"plugin\" || row.id === pluginResourceId) {\n continue;\n }\n const contained = containedFile(installPath, row.source);\n if (contained) {\n libraryByRelative.set(contained.relative_path, row);\n }\n }\n\n const treePage = listPluginTreeRelativePaths(installPath, options);\n if (treePage.files.length === 0 && !treePage.hasMore) {\n const fallback = [...libraryByRelative.entries()]\n .map(([relative_path, row]) => {\n const contained = containedFile(installPath, row.source);\n return {\n type: row.type,\n name: row.name,\n path: contained?.path ?? join(installPath, ...relative_path.split(\"/\")),\n relative_path,\n };\n })\n .sort((left, right) => left.relative_path.localeCompare(right.relative_path));\n const start = Math.max(0, options?.offset ?? 0);\n const limit = options?.limit;\n if (limit === undefined) {\n return { contained_resources: fallback.slice(start), has_more: false };\n }\n const end = start + limit;\n return {\n contained_resources: fallback.slice(start, end),\n has_more: end < fallback.length,\n };\n }\n\n return {\n contained_resources: treePage.files.map((relative_path) => {\n const path = join(installPath, ...relative_path.split(\"/\"));\n const row = libraryByRelative.get(relative_path);\n if (row) {\n return {\n type: row.type,\n name: row.name,\n path,\n relative_path,\n };\n }\n return {\n type: inferContainedFileType(relative_path),\n name: containedFileStem(relative_path),\n path,\n relative_path,\n };\n }),\n has_more: treePage.hasMore,\n };\n}\n\nfunction containedFile(\n installPath: string,\n source: string,\n): { path: string; relative_path: string } | null {\n if (!source.trim()) {\n return null;\n }\n const absolute = resolve(installPath, source);\n const root = resolve(installPath);\n const rel = relative(root, absolute);\n if (!rel || rel.startsWith(\"..\")) {\n return null;\n }\n if (!existsSync(absolute)) {\n return null;\n }\n try {\n if (!statSync(absolute).isFile()) {\n return null;\n }\n } catch {\n return null;\n }\n return {\n path: absolute,\n relative_path: rel.split(sep).join(\"/\"),\n };\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type {\n PluginMarketplaceEntry,\n PluginMarketplacePlatform,\n} from \"../config/settings.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { readJsonFile } from \"../plugins/claude-installed.js\";\nimport { readMarketplaceManifest } from \"./marketplace-catalog.js\";\nimport {\n listMarketplaces,\n normalizeMarketplaceUrl,\n} from \"./marketplace-registry.js\";\nimport { builtinMarketplaceEntry } from \"./builtin-marketplaces.js\";\nimport { resolveMarketplaceRoot } from \"./host-plugin-source.js\";\n\nexport interface VisibleMarketplaceEntry extends PluginMarketplaceEntry {\n managed: boolean;\n contentRoot?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction stripTrailingSlash(url: string): string {\n return url.replace(/\\/+$/, \"\");\n}\n\nfunction githubMarketplaceUrl(repo: string): string {\n const trimmed = repo.trim();\n if (trimmed.includes(\"://\")) {\n return stripTrailingSlash(normalizeMarketplaceUrl(trimmed));\n }\n return stripTrailingSlash(normalizeMarketplaceUrl(`https://github.com/${trimmed}`));\n}\n\nfunction mergeMarketplacePlatforms(\n left: PluginMarketplacePlatform[],\n right: PluginMarketplacePlatform[],\n): PluginMarketplacePlatform[] {\n const seen = new Set<PluginMarketplacePlatform>();\n const merged: PluginMarketplacePlatform[] = [];\n for (const platform of [...left, ...right]) {\n if (seen.has(platform)) continue;\n seen.add(platform);\n merged.push(platform);\n }\n return merged;\n}\n\nfunction repositoryUrlFromManifest(root: string): string | undefined {\n const raw = readMarketplaceManifest(root);\n if (!isRecord(raw)) return undefined;\n const repository = raw.repository;\n if (typeof repository === \"string\" && repository.trim()) {\n return stripTrailingSlash(normalizeMarketplaceUrl(repository));\n }\n if (isRecord(repository) && typeof repository.url === \"string\" && repository.url.trim()) {\n return stripTrailingSlash(normalizeMarketplaceUrl(repository.url));\n }\n return undefined;\n}\n\nfunction discoverClaudeMarketplaces(homeRoot: string): VisibleMarketplaceEntry[] {\n const knownPath = join(homeRoot, \".claude\", \"plugins\", \"known_marketplaces.json\");\n const known = readJsonFile<Record<string, unknown>>(knownPath);\n if (!known || !isRecord(known)) return [];\n\n const discovered: VisibleMarketplaceEntry[] = [];\n for (const [name, value] of Object.entries(known)) {\n const trimmedName = name.trim();\n if (!trimmedName || !isRecord(value)) continue;\n\n const source = isRecord(value.source) ? value.source : {};\n const kind = typeof source.source === \"string\" ? source.source : \"\";\n const installLocation =\n typeof value.installLocation === \"string\" && value.installLocation.trim()\n ? value.installLocation.trim()\n : undefined;\n const contentRoot =\n installLocation && existsSync(installLocation) ? installLocation : undefined;\n\n let url = \"\";\n switch (kind) {\n case \"github\": {\n const repo = typeof source.repo === \"string\" ? source.repo : \"\";\n if (!repo.trim()) continue;\n url = githubMarketplaceUrl(repo);\n break;\n }\n case \"directory\": {\n const path =\n typeof source.path === \"string\" && source.path.trim()\n ? source.path.trim()\n : (installLocation ?? \"\");\n if (!path) continue;\n url = (contentRoot ? repositoryUrlFromManifest(contentRoot) : undefined) ?? path;\n break;\n }\n default:\n continue;\n }\n\n const platforms: PluginMarketplacePlatform[] = [\"claude-code\"];\n discovered.push({\n name: trimmedName,\n url,\n platforms,\n managed: false,\n ...(contentRoot ? { contentRoot } : {}),\n });\n }\n return discovered;\n}\n\nexport function listVisibleMarketplaces(\n harnesstapDir: string,\n homeRoot: string = resolveHomeRoot(),\n): VisibleMarketplaceEntry[] {\n const registered: VisibleMarketplaceEntry[] = listMarketplaces(harnesstapDir).map((entry) => ({\n ...entry,\n managed: true,\n }));\n const seenNames = new Set(registered.map((entry) => entry.name));\n const seenUrls = new Set(\n registered.map((entry) => stripTrailingSlash(normalizeMarketplaceUrl(entry.url))),\n );\n\n const host: VisibleMarketplaceEntry[] = [];\n for (const entry of discoverClaudeMarketplaces(homeRoot)) {\n const urlKey = stripTrailingSlash(normalizeMarketplaceUrl(entry.url));\n if (seenNames.has(entry.name) || seenUrls.has(urlKey)) continue;\n seenNames.add(entry.name);\n seenUrls.add(urlKey);\n host.push(entry);\n }\n\n const listed = [...registered, ...host];\n const builtin = builtinMarketplaceEntry();\n const existing = listed.find((entry) => entry.name === builtin.name);\n const contentRoot = resolveMarketplaceRoot(homeRoot, builtin.name);\n if (existing) {\n existing.platforms = mergeMarketplacePlatforms(builtin.platforms, existing.platforms);\n if (!existing.url) {\n existing.url = builtin.url;\n }\n if (contentRoot && !existing.contentRoot) {\n existing.contentRoot = contentRoot;\n }\n } else {\n listed.push({\n ...builtin,\n managed: false,\n ...(contentRoot ? { contentRoot } : {}),\n });\n }\n\n return listed;\n}\n\nexport function toMarketplaceListEntry(\n entry: VisibleMarketplaceEntry,\n): PluginMarketplaceEntry & { managed: boolean } {\n return {\n name: entry.name,\n url: entry.url,\n platforms: entry.platforms,\n managed: entry.managed,\n ...(entry.trackedBranches && entry.trackedBranches.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