@hmanlab/hl-plugins 0.1.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/bin/hl-plugins.js +44 -0
- package/dist/commands/help.js +30 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/install.js +247 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.js +39 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/status.js +120 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/uninstall.js +121 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.js +148 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.js +79 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/paths.js +83 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/registry.js +112 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/shell.js +58 -0
- package/dist/lib/shell.js.map +1 -0
- package/dist/lib/ui.js +103 -0
- package/dist/lib/ui.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Shim for the `hl-plugins` binary.
|
|
3
|
+
// Prefers the compiled dist/ entry (published + after `npm run build`).
|
|
4
|
+
// Falls back to running src/index.ts through tsx (dev, no build required).
|
|
5
|
+
|
|
6
|
+
import { spawn } from "node:child_process"
|
|
7
|
+
import { fileURLToPath } from "node:url"
|
|
8
|
+
import { dirname, join, resolve } from "node:path"
|
|
9
|
+
import { existsSync } from "node:fs"
|
|
10
|
+
|
|
11
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
12
|
+
const pkgDir = resolve(here, "..")
|
|
13
|
+
const args = process.argv.slice(2)
|
|
14
|
+
|
|
15
|
+
// Locate the entry. dist/ wins; src/ is the dev fallback.
|
|
16
|
+
const distEntry = join(pkgDir, "dist", "index.js")
|
|
17
|
+
const srcEntry = join(pkgDir, "src", "index.ts")
|
|
18
|
+
|
|
19
|
+
if (existsSync(distEntry)) {
|
|
20
|
+
const child = spawn(process.execPath, [distEntry, ...args], { stdio: "inherit" })
|
|
21
|
+
child.on("exit", (code, signal) => {
|
|
22
|
+
if (signal) process.kill(process.pid, signal)
|
|
23
|
+
process.exit(code ?? 0)
|
|
24
|
+
})
|
|
25
|
+
} else {
|
|
26
|
+
// Dev path: find tsx in any ancestor node_modules.
|
|
27
|
+
const candidates = [
|
|
28
|
+
join(pkgDir, "node_modules", ".bin", "tsx"),
|
|
29
|
+
join(pkgDir, "..", "..", "node_modules", ".bin", "tsx"),
|
|
30
|
+
]
|
|
31
|
+
const tsxBin = candidates.find((p) => existsSync(p))
|
|
32
|
+
if (!tsxBin) {
|
|
33
|
+
console.error(
|
|
34
|
+
"hl-plugins: tsx not found and dist/ is missing.\n" +
|
|
35
|
+
"Run `npm install` at the monorepo root, or `npm run build` to compile.",
|
|
36
|
+
)
|
|
37
|
+
process.exit(1)
|
|
38
|
+
}
|
|
39
|
+
const child = spawn(resolve(tsxBin), [srcEntry, ...args], { stdio: "inherit" })
|
|
40
|
+
child.on("exit", (code, signal) => {
|
|
41
|
+
if (signal) process.kill(process.pid, signal)
|
|
42
|
+
process.exit(code ?? 0)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Show all commands and a short description of each.
|
|
2
|
+
const rows = [
|
|
3
|
+
["hl-plugins install [plugin]", "Install one or more plugins"],
|
|
4
|
+
["hl-plugins uninstall [plugin]", "Remove one or more plugins"],
|
|
5
|
+
["hl-plugins list", "Show known plugins and their install state"],
|
|
6
|
+
["hl-plugins status [plugin]", "Per-plugin diagnostic report"],
|
|
7
|
+
["hl-plugins update [plugin]", "Re-copy files and bump dependencies"],
|
|
8
|
+
["hl-plugins help", "Show this help text"],
|
|
9
|
+
];
|
|
10
|
+
import { ui } from "../lib/ui.js";
|
|
11
|
+
import { opencodeConfigDir, tilde } from "../lib/paths.js";
|
|
12
|
+
export async function help(_args) {
|
|
13
|
+
const out = [];
|
|
14
|
+
out.push(ui.header("hl-plugins — curated OpenCode plugins"));
|
|
15
|
+
out.push(ui.bold("Usage:"), " hl-plugins <command> [args]", "", ui.bold("Commands:"));
|
|
16
|
+
for (const [name, desc] of rows) {
|
|
17
|
+
out.push(` ${ui.cyan(name.padEnd(38))} ${desc}`);
|
|
18
|
+
}
|
|
19
|
+
out.push("");
|
|
20
|
+
out.push(ui.bold("Install target:"));
|
|
21
|
+
out.push(` ${tilde(opencodeConfigDir())}/`);
|
|
22
|
+
out.push("");
|
|
23
|
+
out.push(ui.bold("More info:"));
|
|
24
|
+
out.push(" docs/commands.md -- full CLI reference");
|
|
25
|
+
out.push(" docs/architecture.md -- install flow + plugin contract");
|
|
26
|
+
out.push(" docs/adding-a-plugin.md -- how to add a new plugin");
|
|
27
|
+
ui.info(out.join("\n"));
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,MAAM,IAAI,GAA4B;IACpC,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;IAC9D,CAAC,+BAA+B,EAAE,4BAA4B,CAAC;IAC/D,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;IACjE,CAAC,4BAA4B,EAAE,8BAA8B,CAAC;IAC9D,CAAC,4BAA4B,EAAE,qCAAqC,CAAC;IACrE,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;CAC3C,CAAA;AAED,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE1D,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,KAAe;IACxC,MAAM,GAAG,G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, opencode config dir)
|
|
6
|
+
// 3. Requirements (auto-install missing binaries)
|
|
7
|
+
// 4. Authenticate (hidden API key prompt, region auto-retry on 401)
|
|
8
|
+
// 5. Copy files (plugin + skill) into ~/.opencode/
|
|
9
|
+
// 6. Merge config (additive, idempotent)
|
|
10
|
+
// 7. Verify (run postInstall commands)
|
|
11
|
+
import { copyFileSync, existsSync, mkdirSync, statSync } from "node:fs";
|
|
12
|
+
import { basename, dirname, join } from "node:path";
|
|
13
|
+
import { defaultInstallPlugins, getPlugin } from "../lib/registry.js";
|
|
14
|
+
import { run, tryRun, ShellError, fillTemplate } from "../lib/shell.js";
|
|
15
|
+
import { ui } from "../lib/ui.js";
|
|
16
|
+
import { opencodeConfigDir, opencodePluginDir, opencodeSkillDir, tilde, } from "../lib/paths.js";
|
|
17
|
+
import { addBashPermission, addPluginToConfig } from "../lib/config.js";
|
|
18
|
+
// ── Per-step actions ──────────────────────────────────────────────────────
|
|
19
|
+
async function checkPreflight() {
|
|
20
|
+
const major = parseInt(process.versions.node.split(".")[0] ?? "0", 10);
|
|
21
|
+
if (major < 18) {
|
|
22
|
+
throw new Error(`Node.js >= 18 required (you have ${process.versions.node}).`);
|
|
23
|
+
}
|
|
24
|
+
if (!existsSync(opencodeConfigDir())) {
|
|
25
|
+
mkdirSync(opencodeConfigDir(), { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function ensureRequirement(req) {
|
|
29
|
+
const probe = await tryRun(req.check);
|
|
30
|
+
if (probe && probe.code === 0) {
|
|
31
|
+
// Try to surface a version string from the probe output if present
|
|
32
|
+
const line = (probe.stdout.trim().split("\n")[0] ?? "").trim();
|
|
33
|
+
return line ? `present (${line})` : "present";
|
|
34
|
+
}
|
|
35
|
+
// Not present -- auto-install
|
|
36
|
+
ui.info(` ${ui.cyan("→")} installing ${req.name}: ${req.install}`);
|
|
37
|
+
const install = await run(req.install, { throwOnError: false });
|
|
38
|
+
if (install.code !== 0) {
|
|
39
|
+
throw new Error(`Failed to install ${req.name}.\n` +
|
|
40
|
+
` command: ${req.install}\n` +
|
|
41
|
+
` ${install.stderr.trim() || install.stdout.trim() || "(no output)"}`);
|
|
42
|
+
}
|
|
43
|
+
// Re-check
|
|
44
|
+
const verify = await tryRun(req.check);
|
|
45
|
+
if (!verify || verify.code !== 0) {
|
|
46
|
+
throw new Error(`Installed ${req.name} but "${req.check}" still fails. ` +
|
|
47
|
+
`Make sure it's on your PATH.`);
|
|
48
|
+
}
|
|
49
|
+
return "installed";
|
|
50
|
+
}
|
|
51
|
+
async function authenticate(plugin, opts) {
|
|
52
|
+
const auth = plugin.contract.auth;
|
|
53
|
+
if (!auth)
|
|
54
|
+
return "no auth required";
|
|
55
|
+
if (opts.skipAuth)
|
|
56
|
+
return "skipped (--no-auth)";
|
|
57
|
+
// Already logged in?
|
|
58
|
+
const status = await tryRun(auth.check);
|
|
59
|
+
if (status && status.code === 0)
|
|
60
|
+
return "already authenticated";
|
|
61
|
+
// Find a key: flag → env var → prompt
|
|
62
|
+
let key = opts.key;
|
|
63
|
+
if (!key && auth.envVar)
|
|
64
|
+
key = process.env[auth.envVar];
|
|
65
|
+
if (!key) {
|
|
66
|
+
key = await ui.promptHidden(`Paste your ${auth.keyLabel} (input hidden): `);
|
|
67
|
+
}
|
|
68
|
+
if (!key)
|
|
69
|
+
throw new Error(`No ${auth.keyLabel} provided.`);
|
|
70
|
+
const loginCmd = fillTemplate(auth.login, { key });
|
|
71
|
+
const login = await run(loginCmd, { throwOnError: false });
|
|
72
|
+
if (login.code !== 0) {
|
|
73
|
+
throw new Error(`Login failed (exit ${login.code}).\n` +
|
|
74
|
+
` ${(login.stderr || login.stdout).trim() || "(no output)"}`);
|
|
75
|
+
}
|
|
76
|
+
// Smoke test + region auto-retry
|
|
77
|
+
const regions = ["global", "cn"];
|
|
78
|
+
for (const attempt of [auth.verify, ...regions.map((r) => `mmx config set --key region --value ${r} && ${auth.verify}`)]) {
|
|
79
|
+
const res = await run(attempt, { throwOnError: false });
|
|
80
|
+
if (res.code === 0) {
|
|
81
|
+
return attempt === auth.verify ? "authenticated" : "authenticated (region auto-retry succeeded)";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`Authentication smoke test ("${auth.verify}") failed. ` +
|
|
85
|
+
`Tried region=global and region=cn. ` +
|
|
86
|
+
`Check your key and network connection.`);
|
|
87
|
+
}
|
|
88
|
+
async function copyPluginFiles(plugin) {
|
|
89
|
+
const copied = [];
|
|
90
|
+
if (plugin.contract.opencodePlugin) {
|
|
91
|
+
const src = join(plugin.packageDir, plugin.contract.opencodePlugin);
|
|
92
|
+
const dest = join(opencodePluginDir(), basename(plugin.contract.opencodePlugin));
|
|
93
|
+
if (!existsSync(src)) {
|
|
94
|
+
throw new Error(`Plugin source missing: ${src}`);
|
|
95
|
+
}
|
|
96
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
97
|
+
copyFileSync(src, dest);
|
|
98
|
+
copied.push(tilde(dest));
|
|
99
|
+
}
|
|
100
|
+
if (plugin.contract.opencodeSkill) {
|
|
101
|
+
const src = join(plugin.packageDir, plugin.contract.opencodeSkill);
|
|
102
|
+
if (!existsSync(src)) {
|
|
103
|
+
throw new Error(`Skill source missing: ${src}`);
|
|
104
|
+
}
|
|
105
|
+
// Preserve the relative path under skill/ (e.g. "mmx/SKILL.md" or "mmx/index.md")
|
|
106
|
+
const parts = plugin.contract.opencodeSkill.split("/");
|
|
107
|
+
const skillIdx = parts.lastIndexOf("skill");
|
|
108
|
+
const rel = skillIdx >= 0 ? parts.slice(skillIdx + 1).join("/") : basename(src);
|
|
109
|
+
const dest = join(opencodeSkillDir(), rel);
|
|
110
|
+
if (statSync(src).isDirectory()) {
|
|
111
|
+
// skill is a directory → copy its contents recursively
|
|
112
|
+
await copyDir(src, dirname(dest));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
116
|
+
copyFileSync(src, dest);
|
|
117
|
+
}
|
|
118
|
+
copied.push(tilde(dest));
|
|
119
|
+
}
|
|
120
|
+
return copied;
|
|
121
|
+
}
|
|
122
|
+
async function copyDir(src, dest) {
|
|
123
|
+
mkdirSync(dest, { recursive: true });
|
|
124
|
+
// Use the shell's `cp -R` -- works on macOS + Linux, no extra dep.
|
|
125
|
+
// The `/.` trick copies contents without nesting a subdirectory.
|
|
126
|
+
await run(`cp -R ${JSON.stringify(src + "/.")} ${JSON.stringify(dest)}`);
|
|
127
|
+
}
|
|
128
|
+
async function mergeConfig(plugin) {
|
|
129
|
+
const changes = [];
|
|
130
|
+
if (plugin.contract.opencodePlugin) {
|
|
131
|
+
const filename = basename(plugin.contract.opencodePlugin);
|
|
132
|
+
const entry = `./plugin/${filename}`;
|
|
133
|
+
if (addPluginToConfig(entry)) {
|
|
134
|
+
changes.push(`added ${entry} to plugin[]`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
changes.push(`plugin[] already has ${entry}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (plugin.contract.permission) {
|
|
141
|
+
if (addBashPermission(plugin.contract.permission, "allow")) {
|
|
142
|
+
changes.push(`added bash.${plugin.contract.permission} = "allow"`);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
changes.push(`bash.${plugin.contract.permission} = "allow" already set`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return changes;
|
|
149
|
+
}
|
|
150
|
+
async function verify(plugin) {
|
|
151
|
+
const out = [];
|
|
152
|
+
for (const cmd of plugin.contract.postInstall ?? []) {
|
|
153
|
+
const res = await run(cmd, { throwOnError: false });
|
|
154
|
+
const text = (res.stdout || res.stderr).trim();
|
|
155
|
+
if (res.code !== 0) {
|
|
156
|
+
throw new Error(`Verification failed: ${cmd}\n` +
|
|
157
|
+
` ${text || "(no output)"}`);
|
|
158
|
+
}
|
|
159
|
+
out.push(text.split("\n")[0] || cmd);
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
async function installOne(plugin, opts, step, total) {
|
|
164
|
+
ui.info(ui.bold(`\n[${step}/${total}] ${plugin.name} -- ${plugin.description}`));
|
|
165
|
+
await ui.spinner("Pre-flight checks", async () => {
|
|
166
|
+
await checkPreflight();
|
|
167
|
+
});
|
|
168
|
+
for (const req of plugin.contract.requires ?? []) {
|
|
169
|
+
const note = await ui.spinner(`Requirement: ${req.name}`, () => ensureRequirement(req));
|
|
170
|
+
if (note)
|
|
171
|
+
ui.info(` ${ui.dim(note)}`);
|
|
172
|
+
}
|
|
173
|
+
const auth = plugin.contract.auth;
|
|
174
|
+
if (auth) {
|
|
175
|
+
const note = await ui.spinner(`Authenticate: ${auth.keyLabel}`, () => authenticate(plugin, opts));
|
|
176
|
+
if (note)
|
|
177
|
+
ui.info(` ${ui.dim(note)}`);
|
|
178
|
+
}
|
|
179
|
+
const copied = await ui.spinner("Copy files", () => copyPluginFiles(plugin));
|
|
180
|
+
for (const p of copied)
|
|
181
|
+
ui.info(` ${ui.dim("→")} ${p}`);
|
|
182
|
+
const configChanges = await ui.spinner("Merge opencode config", () => mergeConfig(plugin));
|
|
183
|
+
for (const c of configChanges)
|
|
184
|
+
ui.info(` ${ui.dim("•")} ${c}`);
|
|
185
|
+
if (plugin.contract.postInstall?.length) {
|
|
186
|
+
const verified = await ui.spinner("Verify", () => verify(plugin));
|
|
187
|
+
for (const v of verified)
|
|
188
|
+
ui.info(` ${ui.dim("•")} ${v}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function parseArgs(args) {
|
|
192
|
+
const names = [];
|
|
193
|
+
let key;
|
|
194
|
+
let skipAuth = false;
|
|
195
|
+
for (let i = 0; i < args.length; i++) {
|
|
196
|
+
const a = args[i];
|
|
197
|
+
if (a === "--no-auth")
|
|
198
|
+
skipAuth = true;
|
|
199
|
+
else if (a === "--key" || a === "-k") {
|
|
200
|
+
key = args[++i];
|
|
201
|
+
if (!key)
|
|
202
|
+
throw new Error("--key requires a value");
|
|
203
|
+
}
|
|
204
|
+
else if (a === "--verbose" || a === "-v") {
|
|
205
|
+
// handled below
|
|
206
|
+
}
|
|
207
|
+
else if (a.startsWith("--")) {
|
|
208
|
+
// unknown flag -- ignore for now, but warn
|
|
209
|
+
ui.warn(`unknown flag: ${a}`);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
names.push(a);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return { names, skipAuth, key, verbose: args.includes("--verbose") || args.includes("-v") || process.env["HL_PLUGINS_DEBUG"] === "1" };
|
|
216
|
+
}
|
|
217
|
+
export async function install(args) {
|
|
218
|
+
const opts = parseArgs(args);
|
|
219
|
+
const targets = opts.names.length > 0 ? opts.names.map((n) => getPlugin(n)) : defaultInstallPlugins();
|
|
220
|
+
if (targets.length === 0) {
|
|
221
|
+
ui.warn("No plugins to install (none marked defaultInstall in this monorepo).");
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
let succeeded = 0;
|
|
225
|
+
for (let i = 0; i < targets.length; i++) {
|
|
226
|
+
const plugin = targets[i];
|
|
227
|
+
try {
|
|
228
|
+
await installOne(plugin, opts, i + 1, targets.length);
|
|
229
|
+
succeeded++;
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
ui.info("");
|
|
233
|
+
ui.error(`${plugin.name}: ${err.message}`);
|
|
234
|
+
if (err instanceof ShellError) {
|
|
235
|
+
ui.info(ui.dim(` command: ${err.cmd}`));
|
|
236
|
+
}
|
|
237
|
+
// Don't roll back: the install is idempotent, so re-running picks
|
|
238
|
+
// up where this attempt left off.
|
|
239
|
+
return 1;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (succeeded > 0) {
|
|
243
|
+
ui.info(ui.green(`\n✓ Done. Installed ${succeeded} plugin${succeeded === 1 ? "" : "s"}. Restart opencode to use the new tools.`));
|
|
244
|
+
}
|
|
245
|
+
return 0;
|
|
246
|
+
}
|
|
247
|
+
//#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AAC,EAAE,CAAC,GAAG,CAAC,cAAc,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YAC1C,CAAC;YACD,kEAAkE;YAClE,kCAAkC;YAClC,OAAO,CAAC,CAAA;QACV,CAAC;IACH,CAAC;IAED,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,EAAE,CAAC,IAAI,CACL,EAAE,CAAC,KAAK,CACN,uBAAuB,SAAS,UAAU,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,0CAA0C,CAC/G,CACF,CAAA;IACH,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// list -- show all known plugins and whether they're installed.
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { discoverPlugins } from "../lib/registry.js";
|
|
5
|
+
import { ui } from "../lib/ui.js";
|
|
6
|
+
import { opencodePluginDir, tilde } from "../lib/paths.js";
|
|
7
|
+
export async function list(_args) {
|
|
8
|
+
const plugins = discoverPlugins();
|
|
9
|
+
if (plugins.length === 0) {
|
|
10
|
+
ui.info("No plugins discovered in this monorepo.");
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
const nameW = Math.max(5, ...plugins.map((p) => p.name.length));
|
|
14
|
+
const verW = Math.max(7, ...plugins.map((p) => p.version.length));
|
|
15
|
+
const stateW = 9;
|
|
16
|
+
const header = [
|
|
17
|
+
"PLUGIN".padEnd(nameW),
|
|
18
|
+
"INSTALLED".padEnd(stateW),
|
|
19
|
+
"VERSION".padEnd(verW),
|
|
20
|
+
"DESCRIPTION",
|
|
21
|
+
].join(" ");
|
|
22
|
+
ui.info(ui.header("hl-plugins -- known plugins"));
|
|
23
|
+
ui.info(ui.bold(header));
|
|
24
|
+
for (const p of plugins) {
|
|
25
|
+
const pluginTarget = p.contract.opencodePlugin
|
|
26
|
+
? join(opencodePluginDir(), p.contract.opencodePlugin.split("/").pop() ?? "")
|
|
27
|
+
: null;
|
|
28
|
+
const installed = pluginTarget && existsSync(pluginTarget) ? "✓" : "·";
|
|
29
|
+
ui.info([
|
|
30
|
+
ui.cyan(p.name.padEnd(nameW)),
|
|
31
|
+
(installed === "✓" ? ui.green : ui.gray)(installed.padEnd(stateW)),
|
|
32
|
+
ui.gray(p.version.padEnd(verW)),
|
|
33
|
+
p.description || ui.gray("(no description)"),
|
|
34
|
+
].join(" "));
|
|
35
|
+
}
|
|
36
|
+
ui.info(ui.dim(`\ninstall target: ${tilde(opencodePluginDir())}/`));
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAoB,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5E,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,KAAe;IACxC,MAAM,OAAO,GAAG,eAAe,EAAE,CAAA;IACjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,EAAE,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAA;QAClD,OAAO,CAAC,CAAA;IACV,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/D,MAA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,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC;SAC7C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAA;IACH,CAAC;IACD,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,qBAAqB,KAAK,CAAC,iBAAiB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IACnE,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// status [plugin] -- per-plugin diagnostic report.
|
|
2
|
+
// Shows: file presence, config merge state, required binaries, auth, smoke test.
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { basename, join } from "node:path";
|
|
5
|
+
import { discoverPlugins, getPlugin } from "../lib/registry.js";
|
|
6
|
+
import { run, tryRun } from "../lib/shell.js";
|
|
7
|
+
import { ui } from "../lib/ui.js";
|
|
8
|
+
import { opencodePluginDir, opencodeSkillDir, tilde } from "../lib/paths.js";
|
|
9
|
+
import { readOpencodeConfig } from "../lib/config.js";
|
|
10
|
+
const LABEL_W = 16;
|
|
11
|
+
function row(label, value, ok) {
|
|
12
|
+
const pad = label.padEnd(LABEL_W);
|
|
13
|
+
const mark = ok === "info" ? ui.dim("·") : ok ? ui.green("✓") : ui.red("â");
|
|
14
|
+
return ` ${ui.dim(pad)} ${value} ${mark}`;
|
|
15
|
+
}
|
|
16
|
+
function firstNonEmptyLine(s) {
|
|
17
|
+
for (const line of s.split("\n")) {
|
|
18
|
+
const t = line.trim();
|
|
19
|
+
if (t)
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
async function checkBinary(req) {
|
|
25
|
+
const res = await tryRun(req.check);
|
|
26
|
+
if (res && res.code === 0) {
|
|
27
|
+
return { ok: true, version: firstNonEmptyLine(res.stdout) || "present" };
|
|
28
|
+
}
|
|
29
|
+
return { ok: false, version: "not found" };
|
|
30
|
+
}
|
|
31
|
+
function skillDest(contractPath) {
|
|
32
|
+
const parts = contractPath.split("/");
|
|
33
|
+
const skillIdx = parts.lastIndexOf("skill");
|
|
34
|
+
if (skillIdx === -1)
|
|
35
|
+
return null;
|
|
36
|
+
const rel = parts.slice(skillIdx + 1).join("/");
|
|
37
|
+
return join(opencodeSkillDir(), rel);
|
|
38
|
+
}
|
|
39
|
+
async function reportOne(plugin) {
|
|
40
|
+
ui.info(ui.bold(`\n${plugin.name} -- ${plugin.description || "(no description)"}`));
|
|
41
|
+
// Plugin file
|
|
42
|
+
if (plugin.contract.opencodePlugin) {
|
|
43
|
+
const dest = join(opencodePluginDir(), basename(plugin.contract.opencodePlugin));
|
|
44
|
+
ui.info(row("Plugin file:", tilde(dest), existsSync(dest)));
|
|
45
|
+
}
|
|
46
|
+
// Skill file
|
|
47
|
+
if (plugin.contract.opencodeSkill) {
|
|
48
|
+
const dest = skillDest(plugin.contract.opencodeSkill);
|
|
49
|
+
if (dest) {
|
|
50
|
+
ui.info(row("Skill file:", tilde(dest), existsSync(dest)));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Config merged: plugin[] entry + permission pattern
|
|
54
|
+
const cfg = readOpencodeConfig();
|
|
55
|
+
const pluginEntry = plugin.contract.opencodePlugin
|
|
56
|
+
? `./plugin/${basename(plugin.contract.opencodePlugin)}`
|
|
57
|
+
: null;
|
|
58
|
+
const pluginInCfg = pluginEntry ? (cfg.plugin ?? []).includes(pluginEntry) : true;
|
|
59
|
+
const permInCfg = plugin.contract.permission
|
|
60
|
+
? cfg.permission?.bash?.[plugin.contract.permission] === "allow"
|
|
61
|
+
: true;
|
|
62
|
+
const configOk = pluginInCfg && permInCfg;
|
|
63
|
+
const configDetail = configOk
|
|
64
|
+
? `plugin[] + ${plugin.contract.permission ?? "(no perm)"}`
|
|
65
|
+
: [pluginInCfg ? null : "plugin[]", permInCfg ? null : "permission"].filter(Boolean).join(" + ") + " missing";
|
|
66
|
+
ui.info(row("Config merged:", configDetail, configOk));
|
|
67
|
+
// Requirements
|
|
68
|
+
for (const req of plugin.contract.requires ?? []) {
|
|
69
|
+
const { ok, version } = await checkBinary(req);
|
|
70
|
+
ui.info(row(`Required: ${req.name}`, version, ok));
|
|
71
|
+
}
|
|
72
|
+
// Auth: just show logged in / not logged in based on exit code
|
|
73
|
+
if (plugin.contract.auth) {
|
|
74
|
+
const status = await tryRun(plugin.contract.auth.check);
|
|
75
|
+
ui.info(row("Auth:", "logged in", status?.code === 0));
|
|
76
|
+
}
|
|
77
|
+
// Smoke test (postInstall)
|
|
78
|
+
for (const cmd of plugin.contract.postInstall ?? []) {
|
|
79
|
+
const res = await run(cmd, { throwOnError: false });
|
|
80
|
+
if (res.code === 0) {
|
|
81
|
+
const detail = summarizeOutput(res.stdout);
|
|
82
|
+
ui.info(row(`${cmd.split(" ")[0]}:`, detail, true));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const errText = firstNonEmptyLine(res.stderr || res.stdout) || `(exit ${res.code})`;
|
|
86
|
+
ui.info(row(`${cmd.split(" ")[0]}:`, ui.red(errText), false));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** Collapse multi-line output to a single readable line. */
|
|
91
|
+
function summarizeOutput(s) {
|
|
92
|
+
const collapsed = s.replace(/\s+/g, " ").trim();
|
|
93
|
+
if (collapsed.length <= 120)
|
|
94
|
+
return collapsed || "ok";
|
|
95
|
+
return collapsed.slice(0, 117) + "...";
|
|
96
|
+
}
|
|
97
|
+
function parseArgs(args) {
|
|
98
|
+
const names = [];
|
|
99
|
+
for (const a of args) {
|
|
100
|
+
if (a.startsWith("-"))
|
|
101
|
+
ui.warn(`unknown flag: ${a}`);
|
|
102
|
+
else
|
|
103
|
+
names.push(a);
|
|
104
|
+
}
|
|
105
|
+
return { names };
|
|
106
|
+
}
|
|
107
|
+
export async function status(args) {
|
|
108
|
+
const { names } = parseArgs(args);
|
|
109
|
+
const targets = names.length > 0 ? names.map((n) => getPlugin(n)) : discoverPlugins();
|
|
110
|
+
if (targets.length === 0) {
|
|
111
|
+
ui.info("No plugins discovered.");
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
let allOk = true;
|
|
115
|
+
for (const plugin of targets) {
|
|
116
|
+
await reportOne(plugin);
|
|
117
|
+
}
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,iFAAiF;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAGrD,MAAM,OAAO,GAAG,EAAE,CAAA;AAElB,SAAS,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,EAAoB;IAC7D,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,MAAM,IAAI,GAAG,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,C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,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAA;;YAC/C,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc;IACzC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;IACrF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;QACjC,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,CAAA;IAChB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,SAAS,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// uninstall [plugin] -- remove plugin files and config entries.
|
|
2
|
+
// Symmetric with install: same manifest, same idempotency rules.
|
|
3
|
+
// Does NOT remove the plugin's dependencies (e.g. mmx-cli) or auth.
|
|
4
|
+
import { existsSync, readdirSync, rmSync } from "node:fs";
|
|
5
|
+
import { basename, dirname, join } from "node:path";
|
|
6
|
+
import { discoverPlugins, getPlugin } from "../lib/registry.js";
|
|
7
|
+
import { ui } from "../lib/ui.js";
|
|
8
|
+
import { opencodePluginDir, opencodeSkillDir, tilde } from "../lib/paths.js";
|
|
9
|
+
import { removeBashPermission, removePluginFromConfig } from "../lib/config.js";
|
|
10
|
+
function parseArgs(args) {
|
|
11
|
+
const names = [];
|
|
12
|
+
let force = false;
|
|
13
|
+
for (const a of args) {
|
|
14
|
+
if (a === "-y" || a === "--yes" || a === "--force")
|
|
15
|
+
force = true;
|
|
16
|
+
else if (a.startsWith("-"))
|
|
17
|
+
ui.warn(`unknown flag: ${a}`);
|
|
18
|
+
else
|
|
19
|
+
names.push(a);
|
|
20
|
+
}
|
|
21
|
+
return { force, names };
|
|
22
|
+
}
|
|
23
|
+
/** Plugins whose plugin file currently exists in the install target. */
|
|
24
|
+
function installedPluginNames() {
|
|
25
|
+
return discoverPlugins()
|
|
26
|
+
.filter((p) => {
|
|
27
|
+
if (!p.contract.opencodePlugin)
|
|
28
|
+
return false;
|
|
29
|
+
const target = join(opencodePluginDir(), basename(p.contract.opencodePlugin));
|
|
30
|
+
return existsSync(target);
|
|
31
|
+
})
|
|
32
|
+
.map((p) => p.name);
|
|
33
|
+
}
|
|
34
|
+
function uninstallOne(plugin) {
|
|
35
|
+
ui.info(ui.bold(`\n${plugin.name}`));
|
|
36
|
+
// 1. Remove plugin file
|
|
37
|
+
if (plugin.contract.opencodePlugin) {
|
|
38
|
+
const dest = join(opencodePluginDir(), basename(plugin.contract.opencodePlugin));
|
|
39
|
+
if (existsSync(dest)) {
|
|
40
|
+
rmSync(dest);
|
|
41
|
+
ui.info(` ${ui.ok("removed " + tilde(dest))}`);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
ui.info(` ${ui.dim("· plugin file not present: " + tilde(dest))}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// 2. Remove skill file (and its parent dir if empty)
|
|
48
|
+
if (plugin.contract.opencodeSkill) {
|
|
49
|
+
const parts = plugin.contract.opencodeSkill.split("/");
|
|
50
|
+
const skillIdx = parts.lastIndexOf("skill");
|
|
51
|
+
const rel = skillIdx >= 0 ? parts.slice(skillIdx + 1).join("/") : basename(plugin.contract.opencodeSkill);
|
|
52
|
+
const dest = join(opencodeSkillDir(), rel);
|
|
53
|
+
if (existsSync(dest)) {
|
|
54
|
+
rmSync(dest);
|
|
55
|
+
ui.info(` ${ui.ok("removed " + tilde(dest))}`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
ui.info(` ${ui.dim("· skill file not present: " + tilde(dest))}`);
|
|
59
|
+
}
|
|
60
|
+
// Remove the skill directory if it's now empty (be conservative).
|
|
61
|
+
const parent = dirname(dest);
|
|
62
|
+
try {
|
|
63
|
+
if (existsSync(parent) && readdirSync(parent).length === 0) {
|
|
64
|
+
rmSync(parent, { recursive: true });
|
|
65
|
+
ui.info(` ${ui.dim("· removed empty dir " + tilde(parent))}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
/* ignore */
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// 3. Remove plugin[] entry
|
|
73
|
+
if (plugin.contract.opencodePlugin) {
|
|
74
|
+
const entry = `./plugin/${basename(plugin.contract.opencodePlugin)}`;
|
|
75
|
+
if (removePluginFromConfig(entry)) {
|
|
76
|
+
ui.info(` ${ui.ok(`removed ${entry} from plugin[]`)}`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
ui.info(` ${ui.dim(`· ${entry} not in plugin[]`)}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// 4. Remove permission.bash pattern (only the plugin's own, never the catch-all)
|
|
83
|
+
if (plugin.contract.permission) {
|
|
84
|
+
if (removeBashPermission(plugin.contract.permission)) {
|
|
85
|
+
ui.info(` ${ui.ok(`removed bash.${plugin.contract.permission}`)}`);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
ui.info(` ${ui.dim(`· bash.${plugin.contract.permission} not set`)}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export async function uninstall(args) {
|
|
93
|
+
const opts = parseArgs(args);
|
|
94
|
+
const names = opts.names.length > 0 ? opts.names : installedPluginNames();
|
|
95
|
+
if (names.length === 0) {
|
|
96
|
+
ui.info("Nothing to uninstall (no installed plugins detected).");
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
if (!opts.force) {
|
|
100
|
+
ui.info(`About to uninstall: ${names.join(", ")}`);
|
|
101
|
+
ui.info(ui.dim("This removes plugin files and config entries. " +
|
|
102
|
+
"Plugin dependencies (e.g. mmx-cli) and credentials are left untouched."));
|
|
103
|
+
const answer = await ui.promptVisible("Proceed? [y/N] ");
|
|
104
|
+
if (answer.toLowerCase() !== "y" && answer.toLowerCase() !== "yes") {
|
|
105
|
+
ui.info("Cancelled.");
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const name of names) {
|
|
110
|
+
try {
|
|
111
|
+
uninstallOne(getPlugin(name));
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
ui.error(`${name}: ${err.message}`);
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
ui.info(ui.green(`\n✓ Uninstalled ${names.length} plugin${names.length === 1 ? "" : "s"}.`));
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=uninstall.js.map
|