@bypane/cli 0.0.0-stage → 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/dist/png.js ADDED
@@ -0,0 +1,208 @@
1
+ import { inflateSync } from "node:zlib";
2
+ const PNG_SIG = [137, 80, 78, 71, 13, 10, 26, 10];
3
+ function u32be(buf, offset) {
4
+ return (((buf[offset] << 24) |
5
+ (buf[offset + 1] << 16) |
6
+ (buf[offset + 2] << 8) |
7
+ buf[offset + 3]) >>>
8
+ 0);
9
+ }
10
+ function paeth(a, b, c) {
11
+ const p = a + b - c;
12
+ const pa = Math.abs(p - a);
13
+ const pb = Math.abs(p - b);
14
+ const pc = Math.abs(p - c);
15
+ if (pa <= pb && pa <= pc)
16
+ return a;
17
+ if (pb <= pc)
18
+ return b;
19
+ return c;
20
+ }
21
+ /**
22
+ * Minimal pure-TypeScript PNG decoder (8-bit RGB, RGBA, Grayscale, Grayscale+Alpha, Indexed PLTE).
23
+ * Returns RGBA bytes suitable for `tui`'s `createImage(rgba, width, height)`.
24
+ */
25
+ export function decodePng(data) {
26
+ if (data.length < 33) {
27
+ throw new Error("File is too small to be a PNG image");
28
+ }
29
+ for (let i = 0; i < 8; i++) {
30
+ if (data[i] !== PNG_SIG[i]) {
31
+ throw new Error("Not a PNG image (invalid signature)");
32
+ }
33
+ }
34
+ let width = 0;
35
+ let height = 0;
36
+ let bitDepth = 0;
37
+ let colorType = 0;
38
+ let interlace = 0;
39
+ let palette = null;
40
+ let trns = null;
41
+ const idatChunks = [];
42
+ let pos = 8;
43
+ while (pos + 12 <= data.length) {
44
+ const length = u32be(data, pos);
45
+ const type = String.fromCharCode(data[pos + 4], data[pos + 5], data[pos + 6], data[pos + 7]);
46
+ const start = pos + 8;
47
+ const end = start + length;
48
+ if (end + 4 > data.length) {
49
+ throw new Error("Truncated PNG chunk");
50
+ }
51
+ const chunk = data.subarray(start, end);
52
+ if (type === "IHDR") {
53
+ width = u32be(chunk, 0);
54
+ height = u32be(chunk, 4);
55
+ bitDepth = chunk[8];
56
+ colorType = chunk[9];
57
+ const compression = chunk[10];
58
+ const filterMethod = chunk[11];
59
+ interlace = chunk[12];
60
+ if (compression !== 0 || filterMethod !== 0) {
61
+ throw new Error("Unsupported PNG compression or filter method");
62
+ }
63
+ if (interlace !== 0) {
64
+ throw new Error("Interlaced PNGs are not supported yet (press 'o' to open externally)");
65
+ }
66
+ if (bitDepth !== 8 && bitDepth !== 16) {
67
+ throw new Error(`Unsupported PNG bit depth ${bitDepth} (press 'o' to open externally)`);
68
+ }
69
+ }
70
+ else if (type === "PLTE") {
71
+ palette = chunk;
72
+ }
73
+ else if (type === "tRNS") {
74
+ trns = chunk;
75
+ }
76
+ else if (type === "IDAT") {
77
+ idatChunks.push(chunk);
78
+ }
79
+ else if (type === "IEND") {
80
+ break;
81
+ }
82
+ pos = end + 4;
83
+ }
84
+ if (width <= 0 || height <= 0 || idatChunks.length === 0) {
85
+ throw new Error("Incomplete PNG image data");
86
+ }
87
+ let totalLen = 0;
88
+ for (const c of idatChunks)
89
+ totalLen += c.length;
90
+ const compressed = new Uint8Array(totalLen);
91
+ let offset = 0;
92
+ for (const c of idatChunks) {
93
+ compressed.set(c, offset);
94
+ offset += c.length;
95
+ }
96
+ const raw = inflateSync(compressed);
97
+ const channels = colorType === 0
98
+ ? 1
99
+ : colorType === 2
100
+ ? 3
101
+ : colorType === 3
102
+ ? 1
103
+ : colorType === 4
104
+ ? 2
105
+ : colorType === 6
106
+ ? 4
107
+ : 0;
108
+ if (channels === 0) {
109
+ throw new Error(`Unsupported PNG color type ${colorType}`);
110
+ }
111
+ const bytesPerSample = bitDepth === 16 ? 2 : 1;
112
+ const bpp = channels * bytesPerSample;
113
+ const stride = width * bpp;
114
+ if (raw.length < height * (stride + 1)) {
115
+ throw new Error("Decompressed PNG buffer is smaller than expected");
116
+ }
117
+ const scanlines = new Uint8Array(height * stride);
118
+ for (let y = 0; y < height; y++) {
119
+ const filter = raw[y * (stride + 1)];
120
+ const srcRow = y * (stride + 1) + 1;
121
+ const dstRow = y * stride;
122
+ for (let x = 0; x < stride; x++) {
123
+ const val = raw[srcRow + x];
124
+ const left = x >= bpp ? scanlines[dstRow + x - bpp] : 0;
125
+ const up = y > 0 ? scanlines[dstRow - stride + x] : 0;
126
+ const upLeft = y > 0 && x >= bpp ? scanlines[dstRow - stride + x - bpp] : 0;
127
+ let recon = val;
128
+ if (filter === 1)
129
+ recon = (val + left) & 0xff;
130
+ else if (filter === 2)
131
+ recon = (val + up) & 0xff;
132
+ else if (filter === 3)
133
+ recon = (val + ((left + up) >> 1)) & 0xff;
134
+ else if (filter === 4)
135
+ recon = (val + paeth(left, up, upLeft)) & 0xff;
136
+ else if (filter !== 0) {
137
+ throw new Error(`Unknown PNG filter type ${filter}`);
138
+ }
139
+ scanlines[dstRow + x] = recon;
140
+ }
141
+ }
142
+ // Downsample huge images gently (max 640px wide/tall) so terminal rendering stays instant & low-RAM.
143
+ const maxDim = 640;
144
+ const scale = Math.max(1, Math.ceil(Math.max(width, height) / maxDim));
145
+ const outW = Math.max(1, Math.floor(width / scale));
146
+ const outH = Math.max(1, Math.floor(height / scale));
147
+ const rgba = new Uint8Array(outW * outH * 4);
148
+ for (let oy = 0; oy < outH; oy++) {
149
+ const sy = Math.min(height - 1, oy * scale);
150
+ const rowOff = sy * stride;
151
+ for (let ox = 0; ox < outW; ox++) {
152
+ const sx = Math.min(width - 1, ox * scale);
153
+ const px = rowOff + sx * bpp;
154
+ const di = (oy * outW + ox) * 4;
155
+ if (colorType === 6) {
156
+ rgba[di] = scanlines[px];
157
+ rgba[di + 1] = scanlines[px + bytesPerSample];
158
+ rgba[di + 2] = scanlines[px + 2 * bytesPerSample];
159
+ rgba[di + 3] = scanlines[px + 3 * bytesPerSample];
160
+ }
161
+ else if (colorType === 2) {
162
+ rgba[di] = scanlines[px];
163
+ rgba[di + 1] = scanlines[px + bytesPerSample];
164
+ rgba[di + 2] = scanlines[px + 2 * bytesPerSample];
165
+ rgba[di + 3] = 255;
166
+ }
167
+ else if (colorType === 0) {
168
+ const g = scanlines[px];
169
+ rgba[di] = g;
170
+ rgba[di + 1] = g;
171
+ rgba[di + 2] = g;
172
+ rgba[di + 3] = 255;
173
+ }
174
+ else if (colorType === 4) {
175
+ const g = scanlines[px];
176
+ rgba[di] = g;
177
+ rgba[di + 1] = g;
178
+ rgba[di + 2] = g;
179
+ rgba[di + 3] = scanlines[px + bytesPerSample];
180
+ }
181
+ else if (colorType === 3) {
182
+ const idx = scanlines[px];
183
+ if (!palette || idx * 3 + 2 >= palette.length) {
184
+ rgba[di] = 0;
185
+ rgba[di + 1] = 0;
186
+ rgba[di + 2] = 0;
187
+ rgba[di + 3] = 255;
188
+ }
189
+ else {
190
+ rgba[di] = palette[idx * 3];
191
+ rgba[di + 1] = palette[idx * 3 + 1];
192
+ rgba[di + 2] = palette[idx * 3 + 2];
193
+ rgba[di + 3] = trns && idx < trns.length ? trns[idx] : 255;
194
+ }
195
+ }
196
+ }
197
+ }
198
+ return { width: outW, height: outH, rgba };
199
+ }
200
+ export function isPngBuffer(buf) {
201
+ if (buf.length < 8)
202
+ return false;
203
+ for (let i = 0; i < 8; i++) {
204
+ if (buf[i] !== PNG_SIG[i])
205
+ return false;
206
+ }
207
+ return true;
208
+ }
package/dist/setup.js ADDED
@@ -0,0 +1,328 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { existsSync, lstatSync, mkdirSync, symlinkSync, unlinkSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { delimiter, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { confirm, multiselect, select, spinner } from "tui/prompt";
7
+ import { loadConfig, saveConfig } from "./config.js";
8
+ import { canAutoDock, detectRexIdentity, detectTmuxWindow } from "./multiplexer.js";
9
+ import { BYPANE_SKILL_MD, discoverSkillTargets, installSkillTo, removeSkillFrom, } from "./skill.js";
10
+ import { bypaneTheme } from "./ui.js";
11
+ const ANSI = {
12
+ reset: "\x1b[0m",
13
+ bold: "\x1b[1m",
14
+ dim: "\x1b[2m",
15
+ accent: "\x1b[38;2;122;162;255m",
16
+ green: "\x1b[38;2;95;215;135m",
17
+ amber: "\x1b[38;2;245;166;35m",
18
+ };
19
+ function styled(code, text) {
20
+ return process.stdout.isTTY ? `${code}${text}${ANSI.reset}` : text;
21
+ }
22
+ function isBypaneOnPath() {
23
+ try {
24
+ execFileSync(process.platform === "win32" ? "where" : "which", ["bypane"], {
25
+ stdio: "ignore",
26
+ timeout: 1500,
27
+ });
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
34
+ const NPM_PACKAGE = "@bypane/cli";
35
+ export function installBypanePermanently(overrideHome) {
36
+ if (isBypaneOnPath()) {
37
+ return { status: "already_installed" };
38
+ }
39
+ // When running directly from a local TypeScript checkout during dev/tests, skip registry install.
40
+ if (import.meta.url.endsWith(".ts")) {
41
+ return { status: "skipped", via: "dev-source" };
42
+ }
43
+ // 1. Try standard global npm install first.
44
+ try {
45
+ execFileSync("npm", ["install", "-g", NPM_PACKAGE, "--no-audit", "--no-fund"], {
46
+ stdio: ["ignore", "pipe", "pipe"],
47
+ timeout: 45_000,
48
+ });
49
+ if (isBypaneOnPath()) {
50
+ return { status: "installed", via: `npm install -g ${NPM_PACKAGE}` };
51
+ }
52
+ }
53
+ catch {
54
+ // Fall through to user-local prefix install (handles root-owned global npm / EACCES cleanly).
55
+ }
56
+ // 2. Durable user-local fallback (~/.local/share/bypane -> ~/.local/bin/bypane).
57
+ const home = overrideHome || process.env.HOME || homedir();
58
+ const prefix = join(home, ".local", "share", "bypane");
59
+ const binDir = join(home, ".local", "bin");
60
+ const binLink = join(binDir, "bypane");
61
+ const targetBin = join(prefix, "node_modules", ".bin", "bypane");
62
+ try {
63
+ mkdirSync(prefix, { recursive: true });
64
+ execFileSync("npm", ["install", "--prefix", prefix, NPM_PACKAGE, "--no-audit", "--no-fund"], {
65
+ stdio: ["ignore", "pipe", "pipe"],
66
+ timeout: 45_000,
67
+ });
68
+ if (!existsSync(targetBin)) {
69
+ return { status: "failed", error: `Installed prefix missing ${targetBin}` };
70
+ }
71
+ mkdirSync(binDir, { recursive: true });
72
+ try {
73
+ lstatSync(binLink);
74
+ unlinkSync(binLink);
75
+ }
76
+ catch {
77
+ // No existing file/symlink.
78
+ }
79
+ symlinkSync(targetBin, binLink);
80
+ const pathEntries = (process.env.PATH || "").split(delimiter);
81
+ const pathMissing = !pathEntries.includes(binDir);
82
+ return { status: "installed", via: binLink, path: binLink, pathMissing };
83
+ }
84
+ catch (err) {
85
+ return { status: "failed", error: err.message };
86
+ }
87
+ }
88
+ function mcpCommandSpec(cliAvailable) {
89
+ const isTs = import.meta.url.endsWith(".ts");
90
+ if (cliAvailable) {
91
+ return { command: "bypane", args: ["mcp"], shell: "bypane mcp", viaNpx: false };
92
+ }
93
+ if (!isTs) {
94
+ return {
95
+ command: "npx",
96
+ args: ["-y", NPM_PACKAGE, "mcp"],
97
+ shell: `npx -y ${NPM_PACKAGE} mcp`,
98
+ viaNpx: true,
99
+ };
100
+ }
101
+ const cliPath = fileURLToPath(new URL("./cli.ts", import.meta.url));
102
+ return { command: "node", args: [cliPath, "mcp"], shell: `node ${cliPath} mcp`, viaNpx: false };
103
+ }
104
+ export async function runSetupWizard(options = {}) {
105
+ const existingConfig = loadConfig(options.overrideHome);
106
+ const targets = discoverSkillTargets(options.overrideHome);
107
+ const rex = detectRexIdentity();
108
+ const tmux = detectTmuxWindow();
109
+ const envParts = [];
110
+ if (rex)
111
+ envParts.push("Rex");
112
+ else if (tmux)
113
+ envParts.push("tmux");
114
+ else
115
+ envParts.push("standalone terminal");
116
+ if (process.env.TERM === "xterm-ghostty")
117
+ envParts.push("Ghostty graphics");
118
+ else if (process.env.TERM === "xterm-kitty")
119
+ envParts.push("Kitty graphics");
120
+ const detectedHarnesses = targets.filter((t) => t.detected && t.id !== "project").map((t) => t.id);
121
+ if (detectedHarnesses.length > 0)
122
+ envParts.push(`skill dirs: ${detectedHarnesses.join(", ")}`);
123
+ process.stdout.write("\n");
124
+ process.stdout.write(`${styled(ANSI.accent + ANSI.bold, "◈ bypane setup")}\n`);
125
+ process.stdout.write(`${styled(ANSI.dim, ` Detected: ${envParts.join(" · ")}`)}\n\n`);
126
+ let chosenSkillIds;
127
+ let layoutChoice;
128
+ let showMcpSnippet;
129
+ let launchDemo = false;
130
+ const wizardTargets = targets.filter((t) => t.id !== "project");
131
+ if (options.yes || !process.stdin.isTTY) {
132
+ chosenSkillIds = wizardTargets
133
+ .filter((t) => t.detected || t.id === "agents")
134
+ .map((t) => t.id);
135
+ layoutChoice = `${existingConfig.splitDirection}:${existingConfig.splitRatio}`;
136
+ showMcpSnippet = true;
137
+ }
138
+ else {
139
+ const defaultSkills = wizardTargets.map((t) => t.id);
140
+ const pickedSkills = await multiselect({
141
+ theme: bypaneTheme,
142
+ message: "Install bypane agent skill?",
143
+ items: wizardTargets.map((t) => ({
144
+ value: t.id,
145
+ label: t.installed ? `${t.label} [installed]` : t.label,
146
+ })),
147
+ defaultValues: defaultSkills,
148
+ });
149
+ if (pickedSkills === null) {
150
+ process.stdout.write(`${styled(ANSI.dim, "Setup cancelled.")}\n`);
151
+ return;
152
+ }
153
+ chosenSkillIds = [...pickedSkills];
154
+ const currentLayout = existingConfig.autoDock
155
+ ? `${existingConfig.splitDirection}:${existingConfig.splitRatio}`
156
+ : "manual";
157
+ const layoutItems = [
158
+ { value: "right:44", label: "Auto-dock on the right (44% width, keep focus on chat)" },
159
+ { value: "right:50", label: "Auto-dock on the right (50% split, keep focus on chat)" },
160
+ { value: "left:42", label: "Auto-dock on the left (42% width, keep focus on chat)" },
161
+ { value: "below:38", label: "Auto-dock below (38% height, keep focus on chat)" },
162
+ { value: "manual", label: "Manual only (never auto-split; I'll run `bypane` myself)" },
163
+ ];
164
+ const defaultLayout = layoutItems.some((i) => i.value === currentLayout)
165
+ ? currentLayout
166
+ : "right:44";
167
+ const pickedLayout = await select({
168
+ theme: bypaneTheme,
169
+ message: "Companion pane auto-dock layout:",
170
+ items: layoutItems,
171
+ defaultValue: defaultLayout,
172
+ });
173
+ if (pickedLayout === null) {
174
+ process.stdout.write(`${styled(ANSI.dim, "Setup cancelled.")}\n`);
175
+ return;
176
+ }
177
+ layoutChoice = pickedLayout;
178
+ const wantMcp = await confirm({
179
+ theme: bypaneTheme,
180
+ message: "Show optional MCP config snippet? (CLI + skill works without MCP)",
181
+ defaultValue: true,
182
+ });
183
+ if (wantMcp === null) {
184
+ process.stdout.write(`${styled(ANSI.dim, "Setup cancelled.")}\n`);
185
+ return;
186
+ }
187
+ showMcpSnippet = wantMcp;
188
+ }
189
+ let nextConfig;
190
+ if (layoutChoice === "manual") {
191
+ nextConfig = { ...existingConfig, autoDock: false };
192
+ }
193
+ else {
194
+ const [dirRaw, ratioRaw] = layoutChoice.split(":");
195
+ const dir = dirRaw || "right";
196
+ const ratio = Number(ratioRaw) || 44;
197
+ nextConfig = { autoDock: true, splitDirection: dir, splitRatio: ratio };
198
+ }
199
+ const spin = process.stdout.isTTY
200
+ ? spinner({ theme: bypaneTheme, message: "Setting up bypane…" })
201
+ : null;
202
+ let installRes = { status: "skipped" };
203
+ if (!options.skipInstall) {
204
+ spin?.update("Installing bypane command on PATH…");
205
+ installRes = options.installCli
206
+ ? options.installCli()
207
+ : installBypanePermanently(options.overrideHome);
208
+ }
209
+ spin?.update("Saving bypane configuration…");
210
+ const savedConfigPath = saveConfig(nextConfig, options.overrideHome);
211
+ const installedPaths = [];
212
+ for (const id of chosenSkillIds) {
213
+ const target = targets.find((t) => t.id === id);
214
+ if (!target)
215
+ continue;
216
+ spin?.update(`Installing skill to ${target.path}…`);
217
+ installedPaths.push(installSkillTo(target.path));
218
+ }
219
+ spin?.stop("bypane configured");
220
+ process.stdout.write("\n");
221
+ if (installRes.status === "installed") {
222
+ process.stdout.write(` ${styled(ANSI.green, "✓")} CLI installed permanently (${installRes.via})\n`);
223
+ if (installRes.pathMissing) {
224
+ process.stdout.write(` ${styled(ANSI.amber, "Note: add ~/.local/bin to your PATH to run `bypane` directly.")}\n`);
225
+ }
226
+ }
227
+ else if (installRes.status === "already_installed") {
228
+ process.stdout.write(` ${styled(ANSI.green, "✓")} CLI ready on PATH (\`bypane\`)\n`);
229
+ }
230
+ else if (installRes.status === "failed") {
231
+ process.stdout.write(` ${styled(ANSI.amber, "!")} Could not install \`bypane\` globally (${installRes.error ?? "offline"}) — falling back to \`npx -y ${NPM_PACKAGE}\`\n`);
232
+ }
233
+ process.stdout.write(` ${styled(ANSI.green, "✓")} Config saved: ${savedConfigPath}\n`);
234
+ process.stdout.write(` ${styled(ANSI.dim, nextConfig.autoDock ? `auto-dock: ${nextConfig.splitDirection} (${nextConfig.splitRatio}%)` : "auto-dock: manual")}\n`);
235
+ if (installedPaths.length > 0) {
236
+ for (const item of installedPaths) {
237
+ process.stdout.write(` ${styled(ANSI.green, "✓")} Skill ${item.status}: ${item.path}\n`);
238
+ }
239
+ }
240
+ else {
241
+ process.stdout.write(` ${styled(ANSI.dim, "·")} No skill files installed (run \`bypane skill setup\` anytime)\n`);
242
+ }
243
+ if (showMcpSnippet) {
244
+ const cliAvailable = installRes.status === "installed" ||
245
+ installRes.status === "already_installed" ||
246
+ isBypaneOnPath();
247
+ const mcp = mcpCommandSpec(cliAvailable);
248
+ process.stdout.write("\n");
249
+ process.stdout.write(`${styled(ANSI.bold, "Optional MCP registration:")}\n`);
250
+ process.stdout.write(` ${styled(ANSI.dim, "# Claude Code")}\n`);
251
+ process.stdout.write(` claude mcp add bypane -- ${mcp.shell}\n`);
252
+ process.stdout.write(` ${styled(ANSI.dim, "# Generic JSON (Codex / OpenCode / Antigravity / Cursor)")}\n`);
253
+ process.stdout.write(` ${JSON.stringify({ mcpServers: { bypane: { command: mcp.command, args: mcp.args } } })}\n`);
254
+ }
255
+ if (!options.yes && process.stdin.isTTY && canAutoDock() && options.onLaunchDemo) {
256
+ process.stdout.write("\n");
257
+ const tryDemo = await confirm({
258
+ theme: bypaneTheme,
259
+ message: "Open a live demo pane right now to test it?",
260
+ defaultValue: true,
261
+ });
262
+ launchDemo = tryDemo === true;
263
+ }
264
+ if (launchDemo && options.onLaunchDemo) {
265
+ await options.onLaunchDemo();
266
+ }
267
+ else {
268
+ process.stdout.write("\n");
269
+ process.stdout.write(`${styled(ANSI.dim, "Next: run `bypane --demo` (or `bypane demo` inside Rex/tmux) to see all surfaces live.")}\n`);
270
+ }
271
+ }
272
+ export function runSkillSubcommand(sub, flags, overrideHome) {
273
+ const action = sub || "status";
274
+ const targets = discoverSkillTargets(overrideHome);
275
+ if (action === "show") {
276
+ process.stdout.write(BYPANE_SKILL_MD);
277
+ return 0;
278
+ }
279
+ if (action === "status") {
280
+ process.stdout.write("bypane skill status:\n");
281
+ for (const t of targets) {
282
+ const state = t.installed
283
+ ? t.managed
284
+ ? "installed (managed)"
285
+ : "installed (custom)"
286
+ : "not installed";
287
+ process.stdout.write(` ${t.id.padEnd(8)} ${state.padEnd(20)} ${t.path}\n`);
288
+ }
289
+ return 0;
290
+ }
291
+ if (action === "setup" || action === "install") {
292
+ const requested = typeof flags.target === "string" ? flags.target : "agents";
293
+ const list = requested === "all"
294
+ ? targets.filter((t) => t.id !== "project" && (t.detected || t.id === "agents"))
295
+ : targets.filter((t) => t.id === requested);
296
+ if (list.length === 0) {
297
+ process.stderr.write(`Unknown skill target "${requested}". Use: agents, claude, codex, project, or all.\n`);
298
+ return 1;
299
+ }
300
+ for (const t of list) {
301
+ const res = installSkillTo(t.path);
302
+ process.stdout.write(`bypane skill ${res.status}: ${res.path}\n`);
303
+ }
304
+ return 0;
305
+ }
306
+ if (action === "remove" || action === "uninstall") {
307
+ const force = Boolean(flags.force);
308
+ const requested = typeof flags.target === "string" ? flags.target : "all";
309
+ const list = requested === "all" ? targets : targets.filter((t) => t.id === requested);
310
+ let removedAny = false;
311
+ for (const t of list) {
312
+ const res = removeSkillFrom(t.path, force);
313
+ if (res.status === "removed") {
314
+ removedAny = true;
315
+ process.stdout.write(`Removed: ${res.path}\n`);
316
+ }
317
+ else if (res.status === "unmanaged") {
318
+ process.stderr.write(`Skipped unmanaged skill (pass --force to remove): ${res.path}\n`);
319
+ }
320
+ }
321
+ if (!removedAny) {
322
+ process.stdout.write("No managed bypane skill installations found.\n");
323
+ }
324
+ return 0;
325
+ }
326
+ process.stderr.write("Usage: bypane skill <setup|show|status|remove> [--target agents|claude|codex|project|all] [--force]\n");
327
+ return 1;
328
+ }