harnesstap 1.2.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.
- package/README.md +28 -15
- package/dist/apply-QSS4242W.js +67 -0
- package/dist/apply-QSS4242W.js.map +1 -0
- package/dist/approve-CNYQY6DC.js +181 -0
- package/dist/approve-CNYQY6DC.js.map +1 -0
- package/dist/audit-V4SUV7KA.js +434 -0
- package/dist/audit-V4SUV7KA.js.map +1 -0
- package/dist/auth-63FOHIQ3.js +220 -0
- package/dist/auth-63FOHIQ3.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-2NE3QYMP.js +103 -0
- package/dist/chunk-2NE3QYMP.js.map +1 -0
- package/dist/chunk-2P2EOYEW.js +1140 -0
- package/dist/chunk-2P2EOYEW.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-37LQQWMF.js +496 -0
- package/dist/chunk-37LQQWMF.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3PGC6OA3.js +540 -0
- package/dist/chunk-3PGC6OA3.js.map +1 -0
- package/dist/chunk-4IHKBIY3.js +118 -0
- package/dist/chunk-4IHKBIY3.js.map +1 -0
- package/dist/chunk-4ZUBRLSP.js +17 -0
- package/dist/chunk-4ZUBRLSP.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-5TXI6BI2.js +1359 -0
- package/dist/chunk-5TXI6BI2.js.map +1 -0
- package/dist/chunk-6P5IO4BX.js +235 -0
- package/dist/chunk-6P5IO4BX.js.map +1 -0
- package/dist/chunk-ABXUKHAU.js +571 -0
- package/dist/chunk-ABXUKHAU.js.map +1 -0
- package/dist/chunk-AOUDSNRK.js +1357 -0
- package/dist/chunk-AOUDSNRK.js.map +1 -0
- package/dist/chunk-BNDJJAEI.js +311 -0
- package/dist/chunk-BNDJJAEI.js.map +1 -0
- package/dist/chunk-C2IWSFF5.js +818 -0
- package/dist/chunk-C2IWSFF5.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DEJLP7QJ.js +681 -0
- package/dist/chunk-DEJLP7QJ.js.map +1 -0
- package/dist/chunk-DJ6FN6EW.js +532 -0
- package/dist/chunk-DJ6FN6EW.js.map +1 -0
- package/dist/chunk-E4WRTRMH.js +1173 -0
- package/dist/chunk-E4WRTRMH.js.map +1 -0
- package/dist/chunk-E5QXNU3K.js +238 -0
- package/dist/chunk-E5QXNU3K.js.map +1 -0
- package/dist/chunk-EMTBGOR3.js +2959 -0
- package/dist/chunk-EMTBGOR3.js.map +1 -0
- package/dist/chunk-FFWYIGQ4.js +18 -0
- package/dist/chunk-FFWYIGQ4.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IHWAOIAU.js +172 -0
- package/dist/chunk-IHWAOIAU.js.map +1 -0
- package/dist/chunk-IHZUYG66.js +583 -0
- package/dist/chunk-IHZUYG66.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-KCBI6JQC.js +115 -0
- package/dist/chunk-KCBI6JQC.js.map +1 -0
- package/dist/chunk-KDUQMINL.js +60 -0
- package/dist/chunk-KDUQMINL.js.map +1 -0
- package/dist/chunk-KLR2DURP.js +656 -0
- package/dist/chunk-KLR2DURP.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LYQMK6SV.js +87 -0
- package/dist/chunk-LYQMK6SV.js.map +1 -0
- package/dist/chunk-MK3Q37ZN.js +183 -0
- package/dist/chunk-MK3Q37ZN.js.map +1 -0
- package/dist/chunk-MSGAGV7B.js +346 -0
- package/dist/chunk-MSGAGV7B.js.map +1 -0
- package/dist/chunk-MZQRSERO.js +430 -0
- package/dist/chunk-MZQRSERO.js.map +1 -0
- package/dist/chunk-N3WIJXXM.js +691 -0
- package/dist/chunk-N3WIJXXM.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NFYPBTKO.js +302 -0
- package/dist/chunk-NFYPBTKO.js.map +1 -0
- package/dist/chunk-NPO2IG6G.js +491 -0
- package/dist/chunk-NPO2IG6G.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PFUK3HJ4.js +296 -0
- package/dist/chunk-PFUK3HJ4.js.map +1 -0
- package/dist/chunk-PMQ55GDB.js +115 -0
- package/dist/chunk-PMQ55GDB.js.map +1 -0
- package/dist/chunk-QIVE2YFJ.js +514 -0
- package/dist/chunk-QIVE2YFJ.js.map +1 -0
- package/dist/chunk-QKXD3EUF.js +691 -0
- package/dist/chunk-QKXD3EUF.js.map +1 -0
- package/dist/chunk-RNQYUWF6.js +32 -0
- package/dist/chunk-RNQYUWF6.js.map +1 -0
- package/dist/chunk-S2E4SSQV.js +41 -0
- package/dist/chunk-S2E4SSQV.js.map +1 -0
- package/dist/chunk-SN4BXX3B.js +186 -0
- package/dist/chunk-SN4BXX3B.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-T5VRREN4.js +696 -0
- package/dist/chunk-T5VRREN4.js.map +1 -0
- package/dist/chunk-TKBMHZTS.js +10945 -0
- package/dist/chunk-TKBMHZTS.js.map +1 -0
- package/dist/chunk-TNJPTUE4.js +35 -0
- package/dist/chunk-TNJPTUE4.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TXXDMDPN.js +998 -0
- package/dist/chunk-TXXDMDPN.js.map +1 -0
- package/dist/chunk-UWXUBU7V.js +184 -0
- package/dist/chunk-UWXUBU7V.js.map +1 -0
- package/dist/chunk-UYRK2H24.js +141 -0
- package/dist/chunk-UYRK2H24.js.map +1 -0
- package/dist/chunk-V4IXIM3C.js +806 -0
- package/dist/chunk-V4IXIM3C.js.map +1 -0
- package/dist/chunk-VFHVXXP4.js +6438 -0
- package/dist/chunk-VFHVXXP4.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-W7HQ5X3S.js +610 -0
- package/dist/chunk-W7HQ5X3S.js.map +1 -0
- package/dist/chunk-WMSQAFK5.js +65 -0
- package/dist/chunk-WMSQAFK5.js.map +1 -0
- package/dist/chunk-WMYTBJPB.js +364 -0
- package/dist/chunk-WMYTBJPB.js.map +1 -0
- package/dist/chunk-WNLFNCOH.js +7795 -0
- package/dist/chunk-WNLFNCOH.js.map +1 -0
- package/dist/chunk-WRX7CB2M.js +6448 -0
- package/dist/chunk-WRX7CB2M.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-YSXRBUR4.js +682 -0
- package/dist/chunk-YSXRBUR4.js.map +1 -0
- package/dist/chunk-YTC2EG64.js +1759 -0
- package/dist/chunk-YTC2EG64.js.map +1 -0
- package/dist/compile-J3UGQSS3.js +161 -0
- package/dist/compile-J3UGQSS3.js.map +1 -0
- package/dist/config-5BPSZND3.js +438 -0
- package/dist/config-5BPSZND3.js.map +1 -0
- package/dist/doctor-BVFKLJVO.js +111 -0
- package/dist/doctor-BVFKLJVO.js.map +1 -0
- package/dist/environment-3RI5H32O.js +2745 -0
- package/dist/environment-3RI5H32O.js.map +1 -0
- package/dist/github-YFJQVH5K.js +114 -0
- package/dist/github-YFJQVH5K.js.map +1 -0
- package/dist/harness-ECGHPEKA.js +746 -0
- package/dist/harness-ECGHPEKA.js.map +1 -0
- package/dist/help-ELPNPPEM.js +2079 -0
- package/dist/help-ELPNPPEM.js.map +1 -0
- package/dist/help-UL5XLY3I.js +1892 -0
- package/dist/help-UL5XLY3I.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-UJQTDHW7.js +873 -0
- package/dist/init-UJQTDHW7.js.map +1 -0
- package/dist/lock-XUMJ63NZ.js +455 -0
- package/dist/lock-XUMJ63NZ.js.map +1 -0
- package/dist/marketplace-ZUMOLVXE.js +495 -0
- package/dist/marketplace-ZUMOLVXE.js.map +1 -0
- package/dist/mcp-RZA5O2ND.js +202 -0
- package/dist/mcp-RZA5O2ND.js.map +1 -0
- package/dist/migrate-CYQI2FH6.js +1043 -0
- package/dist/migrate-CYQI2FH6.js.map +1 -0
- package/dist/open-AWOAWLKO.js +32 -0
- package/dist/open-AWOAWLKO.js.map +1 -0
- package/dist/pack-2QD5ZUIO.js +99 -0
- package/dist/pack-2QD5ZUIO.js.map +1 -0
- package/dist/plugin-GQSSSFX4.js +64 -0
- package/dist/plugin-GQSSSFX4.js.map +1 -0
- package/dist/plugin-from-project-SIQUFYIO.js +16 -0
- package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
- package/dist/policy-CT4JRCJI.js +105 -0
- package/dist/policy-CT4JRCJI.js.map +1 -0
- package/dist/profile-4JQ6LECP.js +1886 -0
- package/dist/profile-4JQ6LECP.js.map +1 -0
- package/dist/project-JG7QWXRG.js +1392 -0
- package/dist/project-JG7QWXRG.js.map +1 -0
- package/dist/resource-QRMR6CSD.js +555 -0
- package/dist/resource-QRMR6CSD.js.map +1 -0
- package/dist/version-LZ5POOXY.js +17 -0
- package/dist/version-LZ5POOXY.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptForSearchableChoice,
|
|
3
|
+
shouldUseBrowsePicker
|
|
4
|
+
} from "./chunk-NAGAJ5UM.js";
|
|
5
|
+
import "./chunk-I6XFZLTJ.js";
|
|
6
|
+
import {
|
|
7
|
+
addMarketplace,
|
|
8
|
+
listCatalogPlugins,
|
|
9
|
+
listMarketplaces,
|
|
10
|
+
normalizeMarketplaceUrl,
|
|
11
|
+
refreshMarketplaceCatalog,
|
|
12
|
+
removeMarketplace
|
|
13
|
+
} from "./chunk-TXXDMDPN.js";
|
|
14
|
+
import {
|
|
15
|
+
githubGitConfigArgs,
|
|
16
|
+
githubHttpsRemoteForAuth,
|
|
17
|
+
resolveGithubAccessToken
|
|
18
|
+
} from "./chunk-C2IWSFF5.js";
|
|
19
|
+
import {
|
|
20
|
+
configureCommandGroup
|
|
21
|
+
} from "./chunk-5TXI6BI2.js";
|
|
22
|
+
import {
|
|
23
|
+
parseOutputFormat,
|
|
24
|
+
printJson
|
|
25
|
+
} from "./chunk-TQ2NA4Z4.js";
|
|
26
|
+
import {
|
|
27
|
+
collectRepeatedOption,
|
|
28
|
+
fail
|
|
29
|
+
} from "./chunk-NFYPBTKO.js";
|
|
30
|
+
import {
|
|
31
|
+
formatCount,
|
|
32
|
+
ui
|
|
33
|
+
} from "./chunk-ABXUKHAU.js";
|
|
34
|
+
import "./chunk-VQVUJYYY.js";
|
|
35
|
+
import {
|
|
36
|
+
getHarnesstapDir,
|
|
37
|
+
marketplaceAddFailedNothingSaved,
|
|
38
|
+
marketplacePathMissing,
|
|
39
|
+
marketplacePathNotMarketplace,
|
|
40
|
+
marketplaceUnreachable,
|
|
41
|
+
marketplaceUnreachableHint
|
|
42
|
+
} from "./chunk-KLR2DURP.js";
|
|
43
|
+
|
|
44
|
+
// src/services/marketplace-validate.ts
|
|
45
|
+
import { existsSync as existsSync3 } from "fs";
|
|
46
|
+
import { join as join2 } from "path";
|
|
47
|
+
|
|
48
|
+
// src/services/marketplace-type-detect.ts
|
|
49
|
+
import { existsSync } from "fs";
|
|
50
|
+
import { join } from "path";
|
|
51
|
+
var MARKETPLACE_TYPE_CANDIDATES = [
|
|
52
|
+
{ path: ".claude-plugin/marketplace.json", platform: "claude-code" },
|
|
53
|
+
{ path: ".cursor-plugin/marketplace.json", platform: "cursor" },
|
|
54
|
+
{ path: ".github/plugin/marketplace.json", platform: "copilot-cli" },
|
|
55
|
+
{ path: ".codex-plugin/marketplace.json", platform: null },
|
|
56
|
+
{ path: "marketplace.json", platform: null }
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
// src/services/marketplace-reachability.ts
|
|
60
|
+
import { spawn } from "child_process";
|
|
61
|
+
import { access, constants, stat } from "fs/promises";
|
|
62
|
+
|
|
63
|
+
// src/services/marketplace-source-branches.ts
|
|
64
|
+
import { existsSync as existsSync2 } from "fs";
|
|
65
|
+
var GIT_LS_REMOTE_TIMEOUT_MS = 2e4;
|
|
66
|
+
|
|
67
|
+
// src/services/marketplace-reachability.ts
|
|
68
|
+
function isLocalFilesystemSource(value) {
|
|
69
|
+
if (value.startsWith("file:")) return true;
|
|
70
|
+
if (value.startsWith("/") || value.startsWith("./") || value.startsWith("../")) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (value.startsWith("~/")) return true;
|
|
74
|
+
if (/^[A-Za-z]:[\\/]/.test(value)) return true;
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
function shortRemoteReachabilityReason(stderr) {
|
|
78
|
+
const line = stderr.split(/\r?\n/).map((part) => part.trim()).find((part) => part.length > 0 && !part.toLowerCase().startsWith("warning:")) ?? "";
|
|
79
|
+
const cleaned = line.replace(/^(fatal|error):\s*/i, "");
|
|
80
|
+
const lower = `${cleaned} ${stderr}`.toLowerCase();
|
|
81
|
+
if (lower.includes("command not found") || lower.includes("enoent") || lower.includes("not recognized as an internal")) {
|
|
82
|
+
return "Git is not available";
|
|
83
|
+
}
|
|
84
|
+
if (lower.includes("authentication failed") || lower.includes("could not read username") || lower.includes("access denied") || lower.includes("permission denied") || lower.includes("http basic") || lower.includes("401") || lower.includes("403")) {
|
|
85
|
+
return "Could not authenticate with the remote";
|
|
86
|
+
}
|
|
87
|
+
if (lower.includes("repository not found") || lower.includes("remote: not found") || lower.includes("404")) {
|
|
88
|
+
return "Remote repository was not found";
|
|
89
|
+
}
|
|
90
|
+
if (lower.includes("timed out") || lower.includes("timeout") || lower.includes("signal: sigterm")) {
|
|
91
|
+
return "Remote check timed out";
|
|
92
|
+
}
|
|
93
|
+
if (lower.includes("could not resolve host") || lower.includes("name or service not known") || lower.includes("temporary failure in name resolution") || lower.includes("nodename nor servname") || lower.includes("network is unreachable") || lower.includes("connection refused") || lower.includes("failed to connect") || lower.includes("unable to access") || lower.includes("could not access")) {
|
|
94
|
+
return "Could not reach the remote host";
|
|
95
|
+
}
|
|
96
|
+
return "Could not reach the remote repository";
|
|
97
|
+
}
|
|
98
|
+
function runGitAsync(args, runCommand, timeoutMs) {
|
|
99
|
+
if (runCommand) {
|
|
100
|
+
return Promise.resolve(runCommand("git", args, { timeoutMs }));
|
|
101
|
+
}
|
|
102
|
+
return new Promise((resolve) => {
|
|
103
|
+
const child = spawn("git", args, {
|
|
104
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
105
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
106
|
+
});
|
|
107
|
+
let stdout = "";
|
|
108
|
+
let stderr = "";
|
|
109
|
+
let settled = false;
|
|
110
|
+
const finish = (result) => {
|
|
111
|
+
if (settled) return;
|
|
112
|
+
settled = true;
|
|
113
|
+
clearTimeout(timer);
|
|
114
|
+
resolve(result);
|
|
115
|
+
};
|
|
116
|
+
const timer = setTimeout(() => {
|
|
117
|
+
child.kill("SIGTERM");
|
|
118
|
+
}, timeoutMs);
|
|
119
|
+
child.stdout?.on("data", (chunk) => {
|
|
120
|
+
stdout += String(chunk);
|
|
121
|
+
});
|
|
122
|
+
child.stderr?.on("data", (chunk) => {
|
|
123
|
+
stderr += String(chunk);
|
|
124
|
+
});
|
|
125
|
+
child.on("error", (error) => {
|
|
126
|
+
const missing = "code" in error && error.code === "ENOENT";
|
|
127
|
+
finish({
|
|
128
|
+
stdout,
|
|
129
|
+
stderr: missing ? "git: command not found" : error.message,
|
|
130
|
+
exitCode: missing ? 127 : 1
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
child.on("close", (code, signal) => {
|
|
134
|
+
const timedOut = signal === "SIGTERM";
|
|
135
|
+
finish({
|
|
136
|
+
stdout,
|
|
137
|
+
stderr: timedOut && !stderr.trim() ? `Command timed out after ${timeoutMs}ms` : stderr,
|
|
138
|
+
exitCode: timedOut ? 124 : code ?? 1
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async function checkLocalPath(path) {
|
|
144
|
+
try {
|
|
145
|
+
const info = await stat(path);
|
|
146
|
+
if (!info.isDirectory()) {
|
|
147
|
+
return { status: "error", reason: "Local path is not a directory" };
|
|
148
|
+
}
|
|
149
|
+
await access(path, constants.R_OK);
|
|
150
|
+
return { status: "healthy" };
|
|
151
|
+
} catch (error) {
|
|
152
|
+
const code = error && typeof error === "object" && "code" in error ? String(error.code) : "";
|
|
153
|
+
if (code === "ENOENT") {
|
|
154
|
+
return { status: "error", reason: "Local directory is missing" };
|
|
155
|
+
}
|
|
156
|
+
return { status: "error", reason: "Local directory is unreachable" };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function checkRemoteGit(url, runCommand) {
|
|
160
|
+
const token = resolveGithubAccessToken().token;
|
|
161
|
+
const remote = githubHttpsRemoteForAuth(url, token);
|
|
162
|
+
const listed = await runGitAsync(
|
|
163
|
+
[...githubGitConfigArgs(token), "ls-remote", "--heads", "--symref", remote],
|
|
164
|
+
runCommand,
|
|
165
|
+
GIT_LS_REMOTE_TIMEOUT_MS
|
|
166
|
+
);
|
|
167
|
+
if (listed.exitCode === 0) {
|
|
168
|
+
return { status: "healthy" };
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
status: "error",
|
|
172
|
+
reason: shortRemoteReachabilityReason(listed.stderr)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async function checkMarketplaceReachability(source, options = {}) {
|
|
176
|
+
const trimmed = source.trim();
|
|
177
|
+
if (!trimmed) {
|
|
178
|
+
return { status: "error", reason: "Marketplace URL or path is required" };
|
|
179
|
+
}
|
|
180
|
+
if (isLocalFilesystemSource(trimmed)) {
|
|
181
|
+
const path = normalizeMarketplaceUrl(trimmed);
|
|
182
|
+
if (!path) {
|
|
183
|
+
return { status: "error", reason: "Marketplace URL or path is required" };
|
|
184
|
+
}
|
|
185
|
+
return checkLocalPath(path);
|
|
186
|
+
}
|
|
187
|
+
const url = normalizeMarketplaceUrl(trimmed);
|
|
188
|
+
if (!url) {
|
|
189
|
+
return { status: "error", reason: "Marketplace URL or path is required" };
|
|
190
|
+
}
|
|
191
|
+
return checkRemoteGit(url, options.runCommand);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/services/marketplace-validate.ts
|
|
195
|
+
var MarketplaceSourceError = class extends Error {
|
|
196
|
+
hint;
|
|
197
|
+
constructor(message, hint) {
|
|
198
|
+
super(message);
|
|
199
|
+
this.name = "MarketplaceSourceError";
|
|
200
|
+
this.hint = hint;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function isLocalFilesystemSource2(value) {
|
|
204
|
+
if (value.startsWith("file:")) return true;
|
|
205
|
+
if (value.startsWith("/") || value.startsWith("./") || value.startsWith("../")) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
if (value.startsWith("~/")) return true;
|
|
209
|
+
if (/^[A-Za-z]:[\\/]/.test(value)) return true;
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
function localMarketplaceHasManifest(root) {
|
|
213
|
+
return MARKETPLACE_TYPE_CANDIDATES.some(
|
|
214
|
+
(candidate) => existsSync3(join2(root, candidate.path))
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
async function assertMarketplaceSourceReachable(source, options = {}) {
|
|
218
|
+
const trimmed = source.trim();
|
|
219
|
+
if (!trimmed) {
|
|
220
|
+
throw new MarketplaceSourceError(
|
|
221
|
+
marketplaceUnreachable(source),
|
|
222
|
+
`${marketplaceUnreachableHint()}
|
|
223
|
+
${marketplaceAddFailedNothingSaved()}`
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
if (isLocalFilesystemSource2(trimmed)) {
|
|
227
|
+
const path = normalizeMarketplaceUrl(trimmed);
|
|
228
|
+
if (!path || !existsSync3(path)) {
|
|
229
|
+
throw new MarketplaceSourceError(
|
|
230
|
+
marketplacePathMissing(path || trimmed),
|
|
231
|
+
marketplaceAddFailedNothingSaved()
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
if (!localMarketplaceHasManifest(path)) {
|
|
235
|
+
throw new MarketplaceSourceError(
|
|
236
|
+
marketplacePathNotMarketplace(path),
|
|
237
|
+
marketplaceAddFailedNothingSaved()
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const reachability = await checkMarketplaceReachability(trimmed, options);
|
|
243
|
+
if (reachability.status === "healthy") {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
throw new MarketplaceSourceError(
|
|
247
|
+
marketplaceUnreachable(normalizeMarketplaceUrl(trimmed) || trimmed),
|
|
248
|
+
`${marketplaceUnreachableHint()}
|
|
249
|
+
${marketplaceAddFailedNothingSaved()}`
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// src/cli/commands/marketplace.ts
|
|
254
|
+
var VALID_PLATFORMS = /* @__PURE__ */ new Set([
|
|
255
|
+
"claude-code",
|
|
256
|
+
"cursor",
|
|
257
|
+
"goose",
|
|
258
|
+
"copilot-cli"
|
|
259
|
+
]);
|
|
260
|
+
function parsePlatforms(platforms) {
|
|
261
|
+
const ids = platforms && platforms.length > 0 ? platforms : ["claude-code"];
|
|
262
|
+
const parsed = [];
|
|
263
|
+
for (const id of ids) {
|
|
264
|
+
if (!VALID_PLATFORMS.has(id)) {
|
|
265
|
+
throw new Error(
|
|
266
|
+
`Invalid --platform value: ${id}. Use claude-code, cursor, goose, or copilot-cli.`
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
parsed.push(id);
|
|
270
|
+
}
|
|
271
|
+
return parsed;
|
|
272
|
+
}
|
|
273
|
+
function deriveMarketplaceNameFromUrl(url) {
|
|
274
|
+
const normalized = normalizeMarketplaceUrl(url);
|
|
275
|
+
try {
|
|
276
|
+
const parsed = new URL(normalized);
|
|
277
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
278
|
+
const last2 = segments.at(-1);
|
|
279
|
+
if (last2) {
|
|
280
|
+
return last2.replace(/\.git$/i, "");
|
|
281
|
+
}
|
|
282
|
+
} catch {
|
|
283
|
+
}
|
|
284
|
+
const last = normalized.split("/").filter(Boolean).at(-1);
|
|
285
|
+
if (!last) {
|
|
286
|
+
throw new Error("Could not derive marketplace name from URL; pass --name.");
|
|
287
|
+
}
|
|
288
|
+
return last.replace(/\.git$/i, "");
|
|
289
|
+
}
|
|
290
|
+
function requireMarketplaceEntry(name) {
|
|
291
|
+
const entry = listMarketplaces(getHarnesstapDir()).find((marketplace) => marketplace.name === name);
|
|
292
|
+
if (!entry) {
|
|
293
|
+
throw new Error(`Marketplace not found: ${name}`);
|
|
294
|
+
}
|
|
295
|
+
return entry;
|
|
296
|
+
}
|
|
297
|
+
async function handleMarketplaceAddCommand(url, opts) {
|
|
298
|
+
const format = parseOutputFormat(opts.format);
|
|
299
|
+
const harnesstapDir = getHarnesstapDir();
|
|
300
|
+
const name = opts.name?.trim() || deriveMarketplaceNameFromUrl(url);
|
|
301
|
+
const platforms = parsePlatforms(opts.platform);
|
|
302
|
+
try {
|
|
303
|
+
await assertMarketplaceSourceReachable(url);
|
|
304
|
+
} catch (error) {
|
|
305
|
+
if (error instanceof MarketplaceSourceError) {
|
|
306
|
+
fail(error.message, error.hint ? { hint: error.hint } : void 0);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
const result = addMarketplace(harnesstapDir, {
|
|
312
|
+
url,
|
|
313
|
+
name,
|
|
314
|
+
platforms,
|
|
315
|
+
trackedBranches: opts.branch
|
|
316
|
+
});
|
|
317
|
+
let refresh;
|
|
318
|
+
try {
|
|
319
|
+
refresh = refreshMarketplaceCatalog(harnesstapDir, {
|
|
320
|
+
name: result.entry.name,
|
|
321
|
+
force: true
|
|
322
|
+
});
|
|
323
|
+
if (!refresh.ok && result.status === "added") {
|
|
324
|
+
removeMarketplace(harnesstapDir, result.entry.name);
|
|
325
|
+
fail(marketplaceUnreachable(result.entry.url), {
|
|
326
|
+
hints: [refresh.message, marketplaceAddFailedNothingSaved()].filter(
|
|
327
|
+
(line) => line.trim().length > 0
|
|
328
|
+
)
|
|
329
|
+
});
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (!refresh.ok) {
|
|
333
|
+
fail(marketplaceUnreachable(result.entry.url), {
|
|
334
|
+
hints: [refresh.message, marketplaceAddFailedNothingSaved()].filter(
|
|
335
|
+
(line) => line.trim().length > 0
|
|
336
|
+
)
|
|
337
|
+
});
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
} catch (error) {
|
|
341
|
+
if (result.status === "added") {
|
|
342
|
+
removeMarketplace(harnesstapDir, result.entry.name);
|
|
343
|
+
}
|
|
344
|
+
fail(error instanceof Error ? error.message : String(error), {
|
|
345
|
+
hint: marketplaceAddFailedNothingSaved()
|
|
346
|
+
});
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (format === "json") {
|
|
350
|
+
printJson({
|
|
351
|
+
status: result.status,
|
|
352
|
+
entry: result.entry,
|
|
353
|
+
...refresh ? { refresh } : {}
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (result.status === "already_configured") {
|
|
358
|
+
ui.info(`Marketplace already configured: ${result.entry.name}`);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
ui.success(`Added marketplace: ${result.entry.name}`, {
|
|
362
|
+
hint: result.entry.url
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function handleMarketplaceListCommand(opts = {}) {
|
|
366
|
+
const format = parseOutputFormat(opts.format);
|
|
367
|
+
const marketplaces = listMarketplaces(getHarnesstapDir());
|
|
368
|
+
if (format === "json") {
|
|
369
|
+
printJson({ marketplaces });
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (marketplaces.length === 0) {
|
|
373
|
+
ui.dim("No marketplaces configured.");
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
ui.table.print({
|
|
377
|
+
columns: [
|
|
378
|
+
{ key: "name", header: "NAME", width: 24 },
|
|
379
|
+
{ key: "url", header: "URL", width: 48 },
|
|
380
|
+
{ key: "platforms", header: "PLATFORMS", width: 24 }
|
|
381
|
+
],
|
|
382
|
+
rows: marketplaces.map((entry) => ({
|
|
383
|
+
name: entry.name,
|
|
384
|
+
url: entry.url,
|
|
385
|
+
platforms: entry.platforms.join(", ")
|
|
386
|
+
})),
|
|
387
|
+
summary: formatCount(marketplaces.length, "marketplace"),
|
|
388
|
+
empty: "No marketplaces configured."
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function handleMarketplaceRemoveCommand(name, opts = {}) {
|
|
392
|
+
const format = parseOutputFormat(opts.format);
|
|
393
|
+
const result = removeMarketplace(getHarnesstapDir(), name);
|
|
394
|
+
if (result.status === "not_found") {
|
|
395
|
+
throw new Error(`Marketplace not found: ${name}`);
|
|
396
|
+
}
|
|
397
|
+
if (format === "json") {
|
|
398
|
+
printJson(result);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
ui.success(`Removed marketplace: ${result.entry.name}`);
|
|
402
|
+
}
|
|
403
|
+
async function handleMarketplaceShowCommand(name, opts = {}) {
|
|
404
|
+
const format = parseOutputFormat(opts.format);
|
|
405
|
+
const harnesstapDir = getHarnesstapDir();
|
|
406
|
+
requireMarketplaceEntry(name);
|
|
407
|
+
let refresh;
|
|
408
|
+
if (opts.refresh) {
|
|
409
|
+
refresh = refreshMarketplaceCatalog(harnesstapDir, { name, force: true });
|
|
410
|
+
if (!refresh.ok) {
|
|
411
|
+
throw new Error(refresh.message);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
const plugins = listCatalogPlugins(harnesstapDir, { name });
|
|
415
|
+
const useBrowsePicker = shouldUseBrowsePicker({
|
|
416
|
+
noInteractive: opts.noInteractive,
|
|
417
|
+
format: opts.format
|
|
418
|
+
});
|
|
419
|
+
if (useBrowsePicker) {
|
|
420
|
+
if (plugins.length === 0) {
|
|
421
|
+
throw new Error(
|
|
422
|
+
`No plugins in catalog for "${name}". Try marketplace show ${name} --refresh.`
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
const selectedRef = await promptForSearchableChoice({
|
|
426
|
+
message: `Select a plugin from ${name}`,
|
|
427
|
+
choices: plugins.map((plugin) => ({
|
|
428
|
+
name: plugin.description ? `${plugin.name}: ${plugin.description}` : plugin.name,
|
|
429
|
+
value: plugin.ref,
|
|
430
|
+
description: plugin.version ? `v${plugin.version}` : void 0
|
|
431
|
+
}))
|
|
432
|
+
});
|
|
433
|
+
if (format === "json") {
|
|
434
|
+
printJson({
|
|
435
|
+
name,
|
|
436
|
+
ref: selectedRef,
|
|
437
|
+
...refresh ? { refresh } : {}
|
|
438
|
+
});
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
console.log(selectedRef);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (format === "json") {
|
|
445
|
+
printJson({
|
|
446
|
+
name,
|
|
447
|
+
plugins,
|
|
448
|
+
...refresh ? { refresh } : {}
|
|
449
|
+
});
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (plugins.length === 0) {
|
|
453
|
+
ui.dim(`No plugins in catalog for "${name}". Try: marketplace show ${name} --refresh`);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
ui.table.print({
|
|
457
|
+
columns: [
|
|
458
|
+
{ key: "name", header: "NAME", width: 24 },
|
|
459
|
+
{ key: "ref", header: "REF", width: 32 },
|
|
460
|
+
{ key: "version", header: "VERSION", width: 12 },
|
|
461
|
+
{ key: "description", header: "DESCRIPTION", width: 40, truncate: true }
|
|
462
|
+
],
|
|
463
|
+
rows: plugins.map((plugin) => ({
|
|
464
|
+
name: plugin.name,
|
|
465
|
+
ref: plugin.ref,
|
|
466
|
+
version: plugin.version ?? "",
|
|
467
|
+
description: plugin.description ?? ""
|
|
468
|
+
})),
|
|
469
|
+
summary: formatCount(plugins.length, "plugin"),
|
|
470
|
+
empty: `No plugins in catalog for "${name}".`
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function registerMarketplaceCommands(root) {
|
|
474
|
+
const marketplaceCmd = configureCommandGroup(
|
|
475
|
+
root.command("marketplace").alias("mkt").description("Manage plugin marketplace sources")
|
|
476
|
+
);
|
|
477
|
+
marketplaceCmd.command("add").argument("<url>", "Marketplace git URL, file:// URL, or local git path").option("--name <id>", "Marketplace registry name").option(
|
|
478
|
+
"--platform <id>",
|
|
479
|
+
"Target platform (repeatable; default: claude-code)",
|
|
480
|
+
collectRepeatedOption,
|
|
481
|
+
[]
|
|
482
|
+
).option(
|
|
483
|
+
"--branch <name>",
|
|
484
|
+
"Extra git branch to catalog (repeatable; default: the repo default branch only)",
|
|
485
|
+
collectRepeatedOption,
|
|
486
|
+
[]
|
|
487
|
+
).option("--format <mode>", "Output format: human or json", "human").option("--no-interactive", "Disable interactive prompts").description("Register a plugin marketplace git URL or local path").action(handleMarketplaceAddCommand);
|
|
488
|
+
marketplaceCmd.command("list").alias("ls").option("--format <mode>", "Output format: human or json", "human").description("List configured plugin marketplaces").action(handleMarketplaceListCommand);
|
|
489
|
+
marketplaceCmd.command("remove").alias("rm").argument("<name>", "Marketplace registry name to remove").option("--format <mode>", "Output format: human or json", "human").description("Remove a configured plugin marketplace").action(handleMarketplaceRemoveCommand);
|
|
490
|
+
marketplaceCmd.command("show").argument("<name>", "Marketplace registry name to browse").option("--refresh", "Refresh the marketplace catalog before listing").option("--format <mode>", "Output format: human or json", "human").option("--no-interactive", "Disable interactive browse picker").description("List or browse plugins from a marketplace catalog").action(handleMarketplaceShowCommand);
|
|
491
|
+
}
|
|
492
|
+
export {
|
|
493
|
+
registerMarketplaceCommands
|
|
494
|
+
};
|
|
495
|
+
//# sourceMappingURL=marketplace-ZUMOLVXE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/marketplace-validate.ts","../src/services/marketplace-type-detect.ts","../src/services/marketplace-reachability.ts","../src/services/marketplace-source-branches.ts","../src/cli/commands/marketplace.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n marketplaceAddFailedNothingSaved,\n marketplacePathMissing,\n marketplacePathNotMarketplace,\n marketplaceUnreachable,\n marketplaceUnreachableHint,\n} from \"../copy/cli.js\";\nimport { MARKETPLACE_TYPE_CANDIDATES } from \"./marketplace-type-detect.js\";\nimport {\n checkMarketplaceReachability,\n type CheckMarketplaceReachabilityOptions,\n} from \"./marketplace-reachability.js\";\nimport { normalizeMarketplaceUrl } from \"./marketplace-registry.js\";\n\nexport class MarketplaceSourceError extends Error {\n readonly hint?: string;\n\n constructor(message: string, hint?: string) {\n super(message);\n this.name = \"MarketplaceSourceError\";\n this.hint = hint;\n }\n}\n\nfunction isLocalFilesystemSource(value: string): boolean {\n if (value.startsWith(\"file:\")) return true;\n if (value.startsWith(\"/\") || value.startsWith(\"./\") || value.startsWith(\"../\")) {\n return true;\n }\n if (value.startsWith(\"~/\")) return true;\n if (/^[A-Za-z]:[\\\\/]/.test(value)) return true;\n return false;\n}\n\nexport function localMarketplaceHasManifest(root: string): boolean {\n return MARKETPLACE_TYPE_CANDIDATES.some((candidate) =>\n existsSync(join(root, candidate.path)),\n );\n}\n\nexport async function assertMarketplaceSourceReachable(\n source: string,\n options: CheckMarketplaceReachabilityOptions = {},\n): Promise<void> {\n const trimmed = source.trim();\n if (!trimmed) {\n throw new MarketplaceSourceError(\n marketplaceUnreachable(source),\n `${marketplaceUnreachableHint()}\\n${marketplaceAddFailedNothingSaved()}`,\n );\n }\n\n if (isLocalFilesystemSource(trimmed)) {\n const path = normalizeMarketplaceUrl(trimmed);\n if (!path || !existsSync(path)) {\n throw new MarketplaceSourceError(\n marketplacePathMissing(path || trimmed),\n marketplaceAddFailedNothingSaved(),\n );\n }\n if (!localMarketplaceHasManifest(path)) {\n throw new MarketplaceSourceError(\n marketplacePathNotMarketplace(path),\n marketplaceAddFailedNothingSaved(),\n );\n }\n return;\n }\n\n const reachability = await checkMarketplaceReachability(trimmed, options);\n if (reachability.status === \"healthy\") {\n return;\n }\n throw new MarketplaceSourceError(\n marketplaceUnreachable(normalizeMarketplaceUrl(trimmed) || trimmed),\n `${marketplaceUnreachableHint()}\\n${marketplaceAddFailedNothingSaved()}`,\n );\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { PluginMarketplacePlatform } from \"../config/settings.js\";\nimport type { RunCommand } from \"../plugins/run-command.js\";\nimport { runCommandWithTimeout } from \"../utils/run-command-with-timeout.js\";\nimport { normalizeMarketplaceUrl } from \"./marketplace-registry.js\";\n\nexport const GH_DETECT_TIMEOUT_MS = 20_000;\n\nexport type MarketplaceTypeDetectStatus = \"inferred\" | \"ambiguous\" | \"error\";\n\nexport interface MarketplaceTypeDetectResult {\n status: MarketplaceTypeDetectStatus;\n platforms: PluginMarketplacePlatform[];\n manifests: string[];\n message: string;\n}\n\nexport interface GithubContentsProbe {\n status: number;\n}\n\nexport type FetchGithubContents = (\n owner: string,\n repo: string,\n path: string,\n) => Promise<GithubContentsProbe>;\n\nexport interface DetectMarketplaceTypeOptions {\n runCommand?: RunCommand;\n fetchGithub?: FetchGithubContents;\n}\n\ninterface ManifestCandidate {\n path: string;\n platform: PluginMarketplacePlatform | null;\n}\n\nexport const MARKETPLACE_TYPE_CANDIDATES: readonly ManifestCandidate[] = [\n { path: \".claude-plugin/marketplace.json\", platform: \"claude-code\" },\n { path: \".cursor-plugin/marketplace.json\", platform: \"cursor\" },\n { path: \".github/plugin/marketplace.json\", platform: \"copilot-cli\" },\n { path: \".codex-plugin/marketplace.json\", platform: null },\n { path: \"marketplace.json\", platform: null },\n];\n\nconst OWNER_REPO_SEGMENT = /^[A-Za-z0-9_.-]+$/;\nconst GITHUB_SCP = /^(?:[^@/\\s]+@)?github\\.com:(.+)$/i;\n\nexport function parseGithubOwnerRepo(\n source: string,\n): { owner: string; repo: string } | null {\n const trimmed = source.trim();\n if (!trimmed) {\n return null;\n }\n\n const scp = GITHUB_SCP.exec(trimmed);\n if (scp?.[1]) {\n return ownerRepoFromPath(`/${scp[1]}`);\n }\n\n let parsed: URL;\n try {\n parsed = new URL(trimmed);\n } catch {\n return null;\n }\n\n const host = parsed.hostname.replace(/^www\\./i, \"\").toLowerCase();\n if (host !== \"github.com\") {\n return null;\n }\n return ownerRepoFromPath(parsed.pathname);\n}\n\nfunction ownerRepoFromPath(pathname: string): { owner: string; repo: string } | null {\n const parts = pathname.split(\"/\").filter(Boolean);\n if (parts.length < 2) {\n return null;\n }\n const owner = parts[0];\n const repo = (parts[1] ?? \"\").replace(/\\.git$/i, \"\");\n if (!owner || !repo || !OWNER_REPO_SEGMENT.test(owner) || !OWNER_REPO_SEGMENT.test(repo)) {\n return null;\n }\n return { owner, repo };\n}\n\nfunction looksLikeLocalPath(value: string): boolean {\n if (value.startsWith(\"file:\")) return true;\n if (value.startsWith(\"/\") || value.startsWith(\"./\") || value.startsWith(\"../\")) {\n return true;\n }\n if (value.startsWith(\"~/\")) return true;\n if (/^[A-Za-z]:[\\\\/]/.test(value)) return true;\n return false;\n}\n\nfunction platformLabel(platform: PluginMarketplacePlatform): string {\n switch (platform) {\n case \"claude-code\":\n return \"Claude Code\";\n case \"cursor\":\n return \"Cursor\";\n case \"goose\":\n return \"Goose\";\n case \"copilot-cli\":\n return \"Copilot CLI\";\n default: {\n const _exhaustive: never = platform;\n return _exhaustive;\n }\n }\n}\n\nexport function joinMarketplacePlatformLabels(\n platforms: readonly PluginMarketplacePlatform[],\n): string {\n const labels = platforms.map(platformLabel);\n if (labels.length === 0) {\n return \"\";\n }\n if (labels.length === 1) {\n return labels[0] ?? \"\";\n }\n if (labels.length === 2) {\n return `${labels[0]} and ${labels[1]}`;\n }\n return `${labels.slice(0, -1).join(\", \")}, and ${labels[labels.length - 1]}`;\n}\n\nfunction resultFromManifests(manifests: string[]): MarketplaceTypeDetectResult {\n const platforms: PluginMarketplacePlatform[] = [];\n const seen = new Set<PluginMarketplacePlatform>();\n for (const relative of manifests) {\n const candidate = MARKETPLACE_TYPE_CANDIDATES.find((item) => item.path === relative);\n if (!candidate?.platform || seen.has(candidate.platform)) {\n continue;\n }\n seen.add(candidate.platform);\n platforms.push(candidate.platform);\n }\n\n if (platforms.length > 0) {\n return {\n status: \"inferred\",\n platforms,\n manifests,\n message: `Inferred: ${joinMarketplacePlatformLabels(platforms)}`,\n };\n }\n\n if (manifests.length === 1 && manifests[0] === \"marketplace.json\") {\n return {\n status: \"ambiguous\",\n platforms: [],\n manifests,\n message: \"Could not tell marketplace type. Found marketplace.json at the repo root.\",\n };\n }\n\n if (manifests.length > 0) {\n return {\n status: \"ambiguous\",\n platforms: [],\n manifests,\n message: `Could not tell marketplace type. Found ${manifests.join(\", \")}.`,\n };\n }\n\n return {\n status: \"error\",\n platforms: [],\n manifests: [],\n message: \"No marketplace manifest found.\",\n };\n}\n\nfunction detectFromFilesystem(root: string): MarketplaceTypeDetectResult {\n const manifests = MARKETPLACE_TYPE_CANDIDATES\n .filter((candidate) => existsSync(join(root, candidate.path)))\n .map((candidate) => candidate.path);\n return resultFromManifests(manifests);\n}\n\nfunction runGh(\n runCommand: RunCommand,\n args: string[],\n): ReturnType<RunCommand> {\n return runCommand(\"gh\", args, { timeoutMs: GH_DETECT_TIMEOUT_MS });\n}\n\nfunction ghAvailable(runCommand: RunCommand): boolean {\n return runGh(runCommand, [\"--version\"]).exitCode === 0;\n}\n\ntype RemoteProbe = \"present\" | \"absent\" | \"auth\" | \"failed\";\n\nfunction classifyGithubFailure(stderr: string, stdout: string, status?: number): RemoteProbe {\n if (status === 401 || status === 403) {\n return \"auth\";\n }\n if (status === 404) {\n return \"absent\";\n }\n const text = `${stderr}\\n${stdout}`;\n if (/401|403|Bad credentials|Requires authentication|HTTP\\s*403|HTTP\\s*401/i.test(text)) {\n return \"auth\";\n }\n if (/404|Not Found/i.test(text)) {\n return \"absent\";\n }\n return \"failed\";\n}\n\nfunction probeGhPath(\n runCommand: RunCommand,\n owner: string,\n repo: string,\n path: string,\n): RemoteProbe {\n const result = runGh(runCommand, [\"api\", `repos/${owner}/${repo}/contents/${path}`]);\n if (result.exitCode === 0) {\n return \"present\";\n }\n return classifyGithubFailure(result.stderr, result.stdout);\n}\n\nfunction ghRepoReadable(runCommand: RunCommand, owner: string, repo: string): boolean {\n return runGh(runCommand, [\"api\", `repos/${owner}/${repo}`]).exitCode === 0;\n}\n\nasync function defaultFetchGithub(\n owner: string,\n repo: string,\n path: string,\n): Promise<GithubContentsProbe> {\n const encoded = path.split(\"/\").map(encodeURIComponent).join(\"/\");\n const response = await fetch(\n `https://api.github.com/repos/${owner}/${repo}/contents/${encoded}`,\n {\n headers: {\n Accept: \"application/vnd.github+json\",\n \"User-Agent\": \"HarnessTap\",\n },\n },\n );\n return { status: response.status };\n}\n\nfunction classifyHttpStatus(status: number): RemoteProbe {\n if (status === 200) {\n return \"present\";\n }\n return classifyGithubFailure(\"\", \"\", status);\n}\n\nasync function probePublicPaths(\n fetchGithub: FetchGithubContents,\n owner: string,\n repo: string,\n): Promise<string[]> {\n const manifests: string[] = [];\n for (const candidate of MARKETPLACE_TYPE_CANDIDATES) {\n const probe = classifyHttpStatus(\n (await fetchGithub(owner, repo, candidate.path)).status,\n );\n if (probe === \"present\") {\n manifests.push(candidate.path);\n }\n }\n return manifests;\n}\n\nfunction privateRepoMessage(usedGh: boolean): MarketplaceTypeDetectResult {\n return {\n status: \"error\",\n platforms: [],\n manifests: [],\n message: usedGh\n ? \"Could not read this GitHub repo. For private repos, run gh auth login.\"\n : \"Could not read this GitHub repo. Install GitHub CLI (gh) and run gh auth login for private repos.\",\n };\n}\n\nasync function detectFromGithub(\n owner: string,\n repo: string,\n options: DetectMarketplaceTypeOptions,\n): Promise<MarketplaceTypeDetectResult> {\n const runCommand =\n options.runCommand\n ?? ((command, args, runOptions) =>\n runCommandWithTimeout(command, args, {\n ...runOptions,\n timeoutMs: GH_DETECT_TIMEOUT_MS,\n }));\n const fetchGithub = options.fetchGithub ?? defaultFetchGithub;\n const hasGh = ghAvailable(runCommand);\n\n if (hasGh) {\n const manifests: string[] = [];\n const probes: RemoteProbe[] = [];\n for (const candidate of MARKETPLACE_TYPE_CANDIDATES) {\n const probe = probeGhPath(runCommand, owner, repo, candidate.path);\n probes.push(probe);\n if (probe === \"present\") {\n manifests.push(candidate.path);\n }\n }\n if (manifests.length > 0) {\n return resultFromManifests(manifests);\n }\n if (ghRepoReadable(runCommand, owner, repo)) {\n return resultFromManifests([]);\n }\n const publicManifests = await probePublicPaths(fetchGithub, owner, repo);\n if (publicManifests.length > 0) {\n return resultFromManifests(publicManifests);\n }\n return privateRepoMessage(true);\n }\n\n const publicManifests = await probePublicPaths(fetchGithub, owner, repo);\n if (publicManifests.length > 0) {\n return resultFromManifests(publicManifests);\n }\n return privateRepoMessage(false);\n}\n\nexport async function detectMarketplaceType(\n source: string,\n options: DetectMarketplaceTypeOptions = {},\n): Promise<MarketplaceTypeDetectResult> {\n const trimmed = source.trim();\n if (!trimmed) {\n return {\n status: \"error\",\n platforms: [],\n manifests: [],\n message: \"URL or path is required.\",\n };\n }\n\n const normalized = normalizeMarketplaceUrl(trimmed);\n if (existsSync(normalized)) {\n return detectFromFilesystem(normalized);\n }\n\n if (looksLikeLocalPath(trimmed) || looksLikeLocalPath(normalized)) {\n return {\n status: \"error\",\n platforms: [],\n manifests: [],\n message: \"Local path not found.\",\n };\n }\n\n const github = parseGithubOwnerRepo(trimmed) ?? parseGithubOwnerRepo(normalized);\n if (github) {\n return detectFromGithub(github.owner, github.repo, options);\n }\n\n return {\n status: \"error\",\n platforms: [],\n manifests: [],\n message: \"Detection supports a local folder or a GitHub URL.\",\n };\n}\n","import { spawn } from \"node:child_process\";\nimport { access, constants, stat } from \"node:fs/promises\";\nimport type { CommandResult, RunCommand } from \"../plugins/run-command.js\";\nimport {\n githubGitConfigArgs,\n githubHttpsRemoteForAuth,\n resolveGithubAccessToken,\n} from \"./github-credentials.js\";\nimport { normalizeMarketplaceUrl } from \"./marketplace-registry.js\";\nimport { GIT_LS_REMOTE_TIMEOUT_MS } from \"./marketplace-source-branches.js\";\n\nexport type MarketplaceReachability =\n | { status: \"healthy\" }\n | { status: \"error\"; reason: string };\n\nexport interface CheckMarketplaceReachabilityOptions {\n runCommand?: RunCommand;\n}\n\nfunction isLocalFilesystemSource(value: string): boolean {\n if (value.startsWith(\"file:\")) return true;\n if (value.startsWith(\"/\") || value.startsWith(\"./\") || value.startsWith(\"../\")) {\n return true;\n }\n if (value.startsWith(\"~/\")) return true;\n if (/^[A-Za-z]:[\\\\/]/.test(value)) return true;\n return false;\n}\n\nexport function shortRemoteReachabilityReason(stderr: string): string {\n const line =\n stderr\n .split(/\\r?\\n/)\n .map((part) => part.trim())\n .find((part) => part.length > 0 && !part.toLowerCase().startsWith(\"warning:\")) ?? \"\";\n const cleaned = line.replace(/^(fatal|error):\\s*/i, \"\");\n const lower = `${cleaned} ${stderr}`.toLowerCase();\n\n if (\n lower.includes(\"command not found\")\n || lower.includes(\"enoent\")\n || lower.includes(\"not recognized as an internal\")\n ) {\n return \"Git is not available\";\n }\n if (\n lower.includes(\"authentication failed\")\n || lower.includes(\"could not read username\")\n || lower.includes(\"access denied\")\n || lower.includes(\"permission denied\")\n || lower.includes(\"http basic\")\n || lower.includes(\"401\")\n || lower.includes(\"403\")\n ) {\n return \"Could not authenticate with the remote\";\n }\n if (\n lower.includes(\"repository not found\")\n || lower.includes(\"remote: not found\")\n || lower.includes(\"404\")\n ) {\n return \"Remote repository was not found\";\n }\n if (\n lower.includes(\"timed out\")\n || lower.includes(\"timeout\")\n || lower.includes(\"signal: sigterm\")\n ) {\n return \"Remote check timed out\";\n }\n if (\n lower.includes(\"could not resolve host\")\n || lower.includes(\"name or service not known\")\n || lower.includes(\"temporary failure in name resolution\")\n || lower.includes(\"nodename nor servname\")\n || lower.includes(\"network is unreachable\")\n || lower.includes(\"connection refused\")\n || lower.includes(\"failed to connect\")\n || lower.includes(\"unable to access\")\n || lower.includes(\"could not access\")\n ) {\n return \"Could not reach the remote host\";\n }\n return \"Could not reach the remote repository\";\n}\n\nfunction runGitAsync(\n args: string[],\n runCommand: RunCommand | undefined,\n timeoutMs: number,\n): Promise<CommandResult> {\n if (runCommand) {\n return Promise.resolve(runCommand(\"git\", args, { timeoutMs }));\n }\n\n return new Promise((resolve) => {\n const child = spawn(\"git\", args, {\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n env: { ...process.env, GIT_TERMINAL_PROMPT: \"0\" },\n });\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n const finish = (result: CommandResult) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(result);\n };\n const timer = setTimeout(() => {\n child.kill(\"SIGTERM\");\n }, timeoutMs);\n child.stdout?.on(\"data\", (chunk) => {\n stdout += String(chunk);\n });\n child.stderr?.on(\"data\", (chunk) => {\n stderr += String(chunk);\n });\n child.on(\"error\", (error) => {\n const missing = \"code\" in error && error.code === \"ENOENT\";\n finish({\n stdout,\n stderr: missing ? \"git: command not found\" : error.message,\n exitCode: missing ? 127 : 1,\n });\n });\n child.on(\"close\", (code, signal) => {\n const timedOut = signal === \"SIGTERM\";\n finish({\n stdout,\n stderr: timedOut && !stderr.trim()\n ? `Command timed out after ${timeoutMs}ms`\n : stderr,\n exitCode: timedOut ? 124 : (code ?? 1),\n });\n });\n });\n}\n\nasync function checkLocalPath(path: string): Promise<MarketplaceReachability> {\n try {\n const info = await stat(path);\n if (!info.isDirectory()) {\n return { status: \"error\", reason: \"Local path is not a directory\" };\n }\n await access(path, constants.R_OK);\n return { status: \"healthy\" };\n } catch (error) {\n const code = error && typeof error === \"object\" && \"code\" in error\n ? String(error.code)\n : \"\";\n if (code === \"ENOENT\") {\n return { status: \"error\", reason: \"Local directory is missing\" };\n }\n return { status: \"error\", reason: \"Local directory is unreachable\" };\n }\n}\n\nasync function checkRemoteGit(\n url: string,\n runCommand: RunCommand | undefined,\n): Promise<MarketplaceReachability> {\n const token = resolveGithubAccessToken().token;\n const remote = githubHttpsRemoteForAuth(url, token);\n const listed = await runGitAsync(\n [...githubGitConfigArgs(token), \"ls-remote\", \"--heads\", \"--symref\", remote],\n runCommand,\n GIT_LS_REMOTE_TIMEOUT_MS,\n );\n if (listed.exitCode === 0) {\n return { status: \"healthy\" };\n }\n return {\n status: \"error\",\n reason: shortRemoteReachabilityReason(listed.stderr),\n };\n}\n\nexport async function checkMarketplaceReachability(\n source: string,\n options: CheckMarketplaceReachabilityOptions = {},\n): Promise<MarketplaceReachability> {\n const trimmed = source.trim();\n if (!trimmed) {\n return { status: \"error\", reason: \"Marketplace URL or path is required\" };\n }\n\n if (isLocalFilesystemSource(trimmed)) {\n const path = normalizeMarketplaceUrl(trimmed);\n if (!path) {\n return { status: \"error\", reason: \"Marketplace URL or path is required\" };\n }\n return checkLocalPath(path);\n }\n\n const url = normalizeMarketplaceUrl(trimmed);\n if (!url) {\n return { status: \"error\", reason: \"Marketplace URL or path is required\" };\n }\n return checkRemoteGit(url, options.runCommand);\n}\n\nexport async function checkMarketplacesReachability(\n entries: readonly { name: string; url: string }[],\n options: CheckMarketplaceReachabilityOptions = {},\n): Promise<Record<string, MarketplaceReachability>> {\n const rows = await Promise.all(\n entries.map(async (entry) => {\n const result = await checkMarketplaceReachability(entry.url, options);\n return [entry.name, result] as const;\n }),\n );\n return Object.fromEntries(rows);\n}\n","import { existsSync } from \"node:fs\";\nimport type { RunCommand } from \"../plugins/run-command.js\";\nimport { runCommandWithTimeout } from \"../utils/run-command-with-timeout.js\";\nimport {\n githubGitConfigArgs,\n githubHttpsRemoteForAuth,\n resolveGithubAccessToken,\n} from \"./github-credentials.js\";\nimport { normalizeMarketplaceUrl } from \"./marketplace-registry.js\";\n\nexport const GIT_LS_REMOTE_TIMEOUT_MS = 20_000;\n\nexport interface MarketplaceSourceBranches {\n branches: string[];\n defaultBranch: string | null;\n}\n\nfunction gitConfigArgs(): string[] {\n return githubGitConfigArgs(resolveGithubAccessToken().token);\n}\n\nexport function parseGitHeadSymref(stdout: string): string | null {\n for (const line of stdout.split(/\\r?\\n/)) {\n const match = /^\\s*ref:\\s+refs\\/heads\\/(\\S+)/.exec(line);\n if (match?.[1]) {\n return match[1];\n }\n }\n return null;\n}\n\nexport function parseGitLsRemoteHeads(stdout: string): string[] {\n const seen = new Set<string>();\n const branches: string[] = [];\n for (const line of stdout.split(/\\r?\\n/)) {\n const match = /\\trefs\\/heads\\/(.+)$/.exec(line);\n const name = match?.[1];\n if (!name || seen.has(name)) continue;\n seen.add(name);\n branches.push(name);\n }\n return branches;\n}\n\nexport function parseGitForEachRefHeads(stdout: string): string[] {\n const seen = new Set<string>();\n const branches: string[] = [];\n for (const part of stdout.split(/\\r?\\n/)) {\n const name = part.trim();\n if (!name || seen.has(name)) continue;\n seen.add(name);\n branches.push(name);\n }\n return branches;\n}\n\nfunction runGit(\n runCommand: RunCommand | undefined,\n args: string[],\n): ReturnType<RunCommand> {\n const run =\n runCommand\n ?? ((command, commandArgs, options) =>\n runCommandWithTimeout(command, commandArgs, {\n ...options,\n timeoutMs: GIT_LS_REMOTE_TIMEOUT_MS,\n }));\n return run(\"git\", args);\n}\n\nfunction gitFailed(stderr: string, fallback: string): never {\n throw new Error(stderr.trim() || fallback);\n}\n\nfunction listLocalBranches(\n dir: string,\n runCommand: RunCommand | undefined,\n): MarketplaceSourceBranches {\n const listed = runGit(runCommand, [\n ...gitConfigArgs(),\n \"-C\",\n dir,\n \"for-each-ref\",\n \"--format=%(refname:short)\",\n \"refs/heads\",\n ]);\n if (listed.exitCode !== 0) {\n gitFailed(listed.stderr, \"Could not list local git branches\");\n }\n const head = runGit(runCommand, [\n ...gitConfigArgs(),\n \"-C\",\n dir,\n \"symbolic-ref\",\n \"--short\",\n \"HEAD\",\n ]);\n const name = head.stdout.trim();\n const defaultBranch =\n head.exitCode === 0 && name && name !== \"HEAD\" ? name : null;\n return {\n branches: parseGitForEachRefHeads(listed.stdout),\n defaultBranch,\n };\n}\n\nfunction listRemoteBranches(\n url: string,\n runCommand: RunCommand | undefined,\n): MarketplaceSourceBranches {\n const listed = runGit(runCommand, [\n ...gitConfigArgs(),\n \"ls-remote\",\n \"--heads\",\n \"--symref\",\n url,\n ]);\n if (listed.exitCode !== 0) {\n gitFailed(listed.stderr, \"Could not list remote git branches\");\n }\n return {\n branches: parseGitLsRemoteHeads(listed.stdout),\n defaultBranch: parseGitHeadSymref(listed.stdout),\n };\n}\n\nexport function listMarketplaceSourceBranches(\n source: string,\n runCommand?: RunCommand,\n): MarketplaceSourceBranches {\n const url = normalizeMarketplaceUrl(source);\n if (!url) {\n throw new Error(\"Marketplace URL or path is required\");\n }\n if (existsSync(url)) {\n return listLocalBranches(url, runCommand);\n }\n const token = resolveGithubAccessToken().token;\n return listRemoteBranches(githubHttpsRemoteForAuth(url, token), runCommand);\n}\n","import type { Command } from \"commander\";\nimport type { PluginMarketplacePlatform } from \"../../config/settings.js\";\nimport { getHarnesstapDir } from \"../../db/connection.js\";\nimport {\n listCatalogPlugins,\n refreshMarketplaceCatalog,\n type RefreshMarketplaceCatalogResult,\n} from \"../../services/marketplace-catalog.js\";\nimport {\n addMarketplace,\n listMarketplaces,\n normalizeMarketplaceUrl,\n removeMarketplace,\n} from \"../../services/marketplace-registry.js\";\nimport {\n MarketplaceSourceError,\n assertMarketplaceSourceReachable,\n} from \"../../services/marketplace-validate.js\";\nimport {\n promptForSearchableChoice,\n shouldUseBrowsePicker,\n} from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport {\n marketplaceAddFailedNothingSaved,\n marketplaceUnreachable,\n} from \"../../copy/cli.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { configureCommandGroup } from \"../help.js\";\nimport { collectRepeatedOption, fail } from \"../shared.js\";\n\nconst VALID_PLATFORMS = new Set<PluginMarketplacePlatform>([\n \"claude-code\",\n \"cursor\",\n \"goose\",\n \"copilot-cli\",\n]);\n\nfunction parsePlatforms(platforms: string[] | undefined): PluginMarketplacePlatform[] {\n const ids = platforms && platforms.length > 0 ? platforms : [\"claude-code\"];\n const parsed: PluginMarketplacePlatform[] = [];\n for (const id of ids) {\n if (!VALID_PLATFORMS.has(id as PluginMarketplacePlatform)) {\n throw new Error(\n `Invalid --platform value: ${id}. Use claude-code, cursor, goose, or copilot-cli.`,\n );\n }\n parsed.push(id as PluginMarketplacePlatform);\n }\n return parsed;\n}\n\nfunction deriveMarketplaceNameFromUrl(url: string): string {\n const normalized = normalizeMarketplaceUrl(url);\n try {\n const parsed = new URL(normalized);\n const segments = parsed.pathname.split(\"/\").filter(Boolean);\n const last = segments.at(-1);\n if (last) {\n return last.replace(/\\.git$/i, \"\");\n }\n } catch {\n // fall through to path split fallback\n }\n\n const last = normalized.split(\"/\").filter(Boolean).at(-1);\n if (!last) {\n throw new Error(\"Could not derive marketplace name from URL; pass --name.\");\n }\n return last.replace(/\\.git$/i, \"\");\n}\n\nfunction requireMarketplaceEntry(name: string) {\n const entry = listMarketplaces(getHarnesstapDir()).find((marketplace) => marketplace.name === name);\n if (!entry) {\n throw new Error(`Marketplace not found: ${name}`);\n }\n return entry;\n}\n\nasync function handleMarketplaceAddCommand(\n url: string,\n opts: {\n name?: string;\n platform?: string[];\n branch?: string[];\n format?: string;\n },\n): Promise<void> {\n const format = parseOutputFormat(opts.format);\n const harnesstapDir = getHarnesstapDir();\n const name = opts.name?.trim() || deriveMarketplaceNameFromUrl(url);\n const platforms = parsePlatforms(opts.platform);\n\n try {\n await assertMarketplaceSourceReachable(url);\n } catch (error) {\n if (error instanceof MarketplaceSourceError) {\n fail(error.message, error.hint ? { hint: error.hint } : undefined);\n return;\n }\n throw error;\n }\n\n const result = addMarketplace(harnesstapDir, {\n url,\n name,\n platforms,\n trackedBranches: opts.branch,\n });\n\n let refresh: RefreshMarketplaceCatalogResult | undefined;\n try {\n refresh = refreshMarketplaceCatalog(harnesstapDir, {\n name: result.entry.name,\n force: true,\n });\n if (!refresh.ok && result.status === \"added\") {\n removeMarketplace(harnesstapDir, result.entry.name);\n fail(marketplaceUnreachable(result.entry.url), {\n hints: [refresh.message, marketplaceAddFailedNothingSaved()].filter(\n (line) => line.trim().length > 0,\n ),\n });\n return;\n }\n if (!refresh.ok) {\n fail(marketplaceUnreachable(result.entry.url), {\n hints: [refresh.message, marketplaceAddFailedNothingSaved()].filter(\n (line) => line.trim().length > 0,\n ),\n });\n return;\n }\n } catch (error) {\n if (result.status === \"added\") {\n removeMarketplace(harnesstapDir, result.entry.name);\n }\n fail(error instanceof Error ? error.message : String(error), {\n hint: marketplaceAddFailedNothingSaved(),\n });\n return;\n }\n\n if (format === \"json\") {\n printJson({\n status: result.status,\n entry: result.entry,\n ...(refresh ? { refresh } : {}),\n });\n return;\n }\n\n if (result.status === \"already_configured\") {\n ui.info(`Marketplace already configured: ${result.entry.name}`);\n return;\n }\n\n ui.success(`Added marketplace: ${result.entry.name}`, {\n hint: result.entry.url,\n });\n}\n\nfunction handleMarketplaceListCommand(opts: { format?: string } = {}): void {\n const format = parseOutputFormat(opts.format);\n const marketplaces = listMarketplaces(getHarnesstapDir());\n\n if (format === \"json\") {\n printJson({ marketplaces });\n return;\n }\n\n if (marketplaces.length === 0) {\n ui.dim(\"No marketplaces configured.\");\n return;\n }\n\n ui.table.print({\n columns: [\n { key: \"name\", header: \"NAME\", width: 24 },\n { key: \"url\", header: \"URL\", width: 48 },\n { key: \"platforms\", header: \"PLATFORMS\", width: 24 },\n ],\n rows: marketplaces.map((entry) => ({\n name: entry.name,\n url: entry.url,\n platforms: entry.platforms.join(\", \"),\n })),\n summary: formatCount(marketplaces.length, \"marketplace\"),\n empty: \"No marketplaces configured.\",\n });\n}\n\nfunction handleMarketplaceRemoveCommand(name: string, opts: { format?: string } = {}): void {\n const format = parseOutputFormat(opts.format);\n const result = removeMarketplace(getHarnesstapDir(), name);\n if (result.status === \"not_found\") {\n throw new Error(`Marketplace not found: ${name}`);\n }\n\n if (format === \"json\") {\n printJson(result);\n return;\n }\n\n ui.success(`Removed marketplace: ${result.entry.name}`);\n}\n\nasync function handleMarketplaceShowCommand(\n name: string,\n opts: {\n refresh?: boolean;\n format?: string;\n noInteractive?: boolean;\n } = {},\n): Promise<void> {\n const format = parseOutputFormat(opts.format);\n const harnesstapDir = getHarnesstapDir();\n requireMarketplaceEntry(name);\n\n let refresh: RefreshMarketplaceCatalogResult | undefined;\n if (opts.refresh) {\n refresh = refreshMarketplaceCatalog(harnesstapDir, { name, force: true });\n if (!refresh.ok) {\n throw new Error(refresh.message);\n }\n }\n\n const plugins = listCatalogPlugins(harnesstapDir, { name });\n const useBrowsePicker = shouldUseBrowsePicker({\n noInteractive: opts.noInteractive,\n format: opts.format,\n });\n\n if (useBrowsePicker) {\n if (plugins.length === 0) {\n throw new Error(\n `No plugins in catalog for \"${name}\". Try marketplace show ${name} --refresh.`,\n );\n }\n\n const selectedRef = await promptForSearchableChoice({\n message: `Select a plugin from ${name}`,\n choices: plugins.map((plugin) => ({\n name: plugin.description\n ? `${plugin.name}: ${plugin.description}`\n : plugin.name,\n value: plugin.ref,\n description: plugin.version ? `v${plugin.version}` : undefined,\n })),\n });\n\n if (format === \"json\") {\n printJson({\n name,\n ref: selectedRef,\n ...(refresh ? { refresh } : {}),\n });\n return;\n }\n\n console.log(selectedRef);\n return;\n }\n\n if (format === \"json\") {\n printJson({\n name,\n plugins,\n ...(refresh ? { refresh } : {}),\n });\n return;\n }\n\n if (plugins.length === 0) {\n ui.dim(`No plugins in catalog for \"${name}\". Try: marketplace show ${name} --refresh`);\n return;\n }\n\n ui.table.print({\n columns: [\n { key: \"name\", header: \"NAME\", width: 24 },\n { key: \"ref\", header: \"REF\", width: 32 },\n { key: \"version\", header: \"VERSION\", width: 12 },\n { key: \"description\", header: \"DESCRIPTION\", width: 40, truncate: true },\n ],\n rows: plugins.map((plugin) => ({\n name: plugin.name,\n ref: plugin.ref,\n version: plugin.version ?? \"\",\n description: plugin.description ?? \"\",\n })),\n summary: formatCount(plugins.length, \"plugin\"),\n empty: `No plugins in catalog for \"${name}\".`,\n });\n}\n\nexport function registerMarketplaceCommands(root: Command): void {\n const marketplaceCmd = configureCommandGroup(\n root\n .command(\"marketplace\")\n .alias(\"mkt\")\n .description(\"Manage plugin marketplace sources\"),\n );\n\n marketplaceCmd\n .command(\"add\")\n .argument(\"<url>\", \"Marketplace git URL, file:// URL, or local git path\")\n .option(\"--name <id>\", \"Marketplace registry name\")\n .option(\n \"--platform <id>\",\n \"Target platform (repeatable; default: claude-code)\",\n collectRepeatedOption,\n [],\n )\n .option(\n \"--branch <name>\",\n \"Extra git branch to catalog (repeatable; default: the repo default branch only)\",\n collectRepeatedOption,\n [],\n )\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .description(\"Register a plugin marketplace git URL or local path\")\n .action(handleMarketplaceAddCommand);\n\n marketplaceCmd\n .command(\"list\")\n .alias(\"ls\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"List configured plugin marketplaces\")\n .action(handleMarketplaceListCommand);\n\n marketplaceCmd\n .command(\"remove\")\n .alias(\"rm\")\n .argument(\"<name>\", \"Marketplace registry name to remove\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Remove a configured plugin marketplace\")\n .action(handleMarketplaceRemoveCommand);\n\n marketplaceCmd\n .command(\"show\")\n .argument(\"<name>\", \"Marketplace registry name to browse\")\n .option(\"--refresh\", \"Refresh the marketplace catalog before listing\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--no-interactive\", \"Disable interactive browse picker\")\n .description(\"List or browse plugins from a marketplace catalog\")\n .action(handleMarketplaceShowCommand);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,QAAAC,aAAY;;;ACDrB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAqCd,IAAM,8BAA4D;AAAA,EACvE,EAAE,MAAM,mCAAmC,UAAU,cAAc;AAAA,EACnE,EAAE,MAAM,mCAAmC,UAAU,SAAS;AAAA,EAC9D,EAAE,MAAM,mCAAmC,UAAU,cAAc;AAAA,EACnE,EAAE,MAAM,kCAAkC,UAAU,KAAK;AAAA,EACzD,EAAE,MAAM,oBAAoB,UAAU,KAAK;AAC7C;;;AC5CA,SAAS,aA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