@nighthawklabs/mission-control 0.2.0 → 0.2.1
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/alias.mjs +19 -0
- package/bin/cli.mjs +13 -0
- package/package.json +2 -2
package/bin/alias.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Idempotency: the same repo can be registered in Claude Code under another marketplace name (e.g. from `marketplace add realnighthawk/nighthawk-plugins`), which would install the plugin twice.
|
|
2
|
+
// Remove those aliases (and the plugin copy from them) so one install is the only install. Pure parse of `claude plugin marketplace list`.
|
|
3
|
+
export function aliasMarketplaces(listOutput, keep = "mission-control-plugins") {
|
|
4
|
+
const out = [];
|
|
5
|
+
let name = null;
|
|
6
|
+
for (const line of listOutput.split("\n")) {
|
|
7
|
+
const n = line.match(/^\s*[❯>]\s*(\S+)\s*$/);
|
|
8
|
+
if (n) name = n[1];
|
|
9
|
+
else if (name && /Source:.*realnighthawk\/nighthawk-plugins/.test(line) && name !== keep) { out.push(name); name = null; }
|
|
10
|
+
}
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
15
|
+
const sample = ` ❯ nighthawk-plugins\n Source: GitHub (realnighthawk/nighthawk-plugins)\n\n ❯ mission-control-plugins\n Source: Git (https://github.com/realnighthawk/nighthawk-plugins.git)\n\n ❯ other\n Source: GitHub (foo/bar)\n`;
|
|
16
|
+
const got = JSON.stringify(aliasMarketplaces(sample));
|
|
17
|
+
if (got !== '["nighthawk-plugins"]') { console.error("alias check failed: " + got); process.exit(1); }
|
|
18
|
+
console.log("ok");
|
|
19
|
+
}
|
package/bin/cli.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// npx @nighthawklabs/mission-control — set up Mission Control for every harness found (Claude Code, oh-my-pi), then start with `mc claude` or `mc omp`.
|
|
3
3
|
// It runs the bundled mc/install.sh against the bundled mc (MC_SRC=file://...), so the starter matches this package's version. No dependencies.
|
|
4
4
|
// ponytail: POSIX only (the starter is a shell script); a Node port of mc is the upgrade for Windows.
|
|
5
|
+
import { aliasMarketplaces } from "./alias.mjs";
|
|
5
6
|
import { spawnSync } from "node:child_process";
|
|
6
7
|
import { existsSync, rmSync } from "node:fs";
|
|
7
8
|
import { dirname, join } from "node:path";
|
|
@@ -24,6 +25,8 @@ For any other agent that reads skills, install also runs npx @nighthawklabs/cook
|
|
|
24
25
|
process.exit(bad ? 2 : 0);
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
|
|
29
|
+
|
|
27
30
|
const sh = (c, opts = {}) => spawnSync("sh", ["-c", c], { stdio: "inherit", ...opts });
|
|
28
31
|
const has = (c) => spawnSync("sh", ["-c", `command -v ${c}`], { stdio: "ignore" }).status === 0;
|
|
29
32
|
const bin = process.env.MC_BIN_DIR || join(process.env.HOME, ".local", "bin");
|
|
@@ -51,6 +54,16 @@ if (cmd === "uninstall") {
|
|
|
51
54
|
process.exit(0);
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
if (has("claude")) {
|
|
58
|
+
const listed = spawnSync("sh", ["-c", "claude plugin marketplace list 2>&1"], { encoding: "utf8" }).stdout || "";
|
|
59
|
+
for (const alias of aliasMarketplaces(listed)) {
|
|
60
|
+
console.log(`removing the duplicate marketplace "${alias}" (same repo as mission-control-plugins)`);
|
|
61
|
+
sh(`claude plugin uninstall mission-control@${alias} --scope user 2>&1 | grep -v "not found in installed"; claude plugin marketplace remove ${alias} 2>&1`);
|
|
62
|
+
}
|
|
63
|
+
const mcp = spawnSync("sh", ["-c", "claude mcp list 2>&1"], { encoding: "utf8" }).stdout || "";
|
|
64
|
+
for (const l of mcp.split("\n").filter((l) => /mcp-hub\.nighthawklabs\.org/.test(l))) console.log(`warning: a leftover MCP entry points at a host that no longer answers: ${l.trim()}\n remove it with: claude mcp remove ${l.split(":")[0].trim()}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
54
67
|
// install and update are the same: install.sh is safe to run again and refreshes what is there.
|
|
55
68
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "mc");
|
|
56
69
|
const installer = join(root, "install.sh");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nighthawklabs/mission-control",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "One command to set up Mission Control for Claude Code and oh-my-pi: the plugin, the mc starter, the workstation browser, and sign-in.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "mission-control": "bin/cli.mjs" },
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"publishConfig": { "access": "public" },
|
|
16
16
|
"scripts": {
|
|
17
17
|
"prepack": "node bin/stage.mjs",
|
|
18
|
-
"test": "node bin/cli.mjs --help"
|
|
18
|
+
"test": "node bin/alias.mjs && node bin/cli.mjs --help"
|
|
19
19
|
}
|
|
20
20
|
}
|