@mightybot/mbcli 0.5.398
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 +12 -0
- package/bin/mb.js +87 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @mightybot/mbcli
|
|
2
|
+
|
|
3
|
+
The MightyBot `mb` CLI. Run it with npx (no install):
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx @mightybot/mbcli@latest setup # log in + register MCP with your agents
|
|
7
|
+
npx @mightybot/mbcli@latest workflow list
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Or install globally: `npm i -g @mightybot/mbcli`, then `mb <cmd>`.
|
|
11
|
+
|
|
12
|
+
Homepage: https://mightybot.ai
|
package/bin/mb.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Thin launcher for the `mb` Go binary distributed over npm.
|
|
5
|
+
//
|
|
6
|
+
// The actual binary ships in a per-platform optional dependency
|
|
7
|
+
// (@mightybot-ai/mbcli-<platform>). npm installs only the package matching the
|
|
8
|
+
// host's os/cpu, so this shim resolves that package's binary and execs it,
|
|
9
|
+
// passing argv and stdio straight through. stdio is inherited so `mb mcp`
|
|
10
|
+
// (a long-lived stdio MCP server) works unchanged.
|
|
11
|
+
|
|
12
|
+
const { execFileSync } = require("child_process");
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
|
|
16
|
+
// Derive the platform packages from THIS package's own name, so the same shim
|
|
17
|
+
// works under any scope/name it is published as (e.g. @mightybot-ai/mbcli and
|
|
18
|
+
// @mightybot/mbflow). The binary ships in `<self>-<platform>` (e.g.
|
|
19
|
+
// @mightybot/mbflow-darwin-arm64).
|
|
20
|
+
const SELF_NAME = require(path.join(__dirname, "..", "package.json")).name;
|
|
21
|
+
const SUPPORTED = new Set([
|
|
22
|
+
"darwin-arm64",
|
|
23
|
+
"darwin-x64",
|
|
24
|
+
"linux-x64",
|
|
25
|
+
"linux-arm64",
|
|
26
|
+
"win32-x64",
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
function resolveBinary() {
|
|
30
|
+
const key = `${process.platform}-${process.arch}`;
|
|
31
|
+
if (!SUPPORTED.has(key)) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`${SELF_NAME}: unsupported platform "${key}". Supported: ${[...SUPPORTED].join(", ")}.`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
const pkg = `${SELF_NAME}-${key}`;
|
|
37
|
+
const exe = process.platform === "win32" ? "mb.exe" : "mb";
|
|
38
|
+
try {
|
|
39
|
+
// require.resolve walks node_modules and returns the absolute file path.
|
|
40
|
+
return require.resolve(`${pkg}/${exe}`);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`${SELF_NAME}: platform package "${pkg}" is not installed for "${key}".\n` +
|
|
44
|
+
`It is an optionalDependency — reinstall without "--no-optional" / ` +
|
|
45
|
+
`"--omit=optional".\n` +
|
|
46
|
+
`Underlying error: ${err.message}`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function main() {
|
|
52
|
+
let binary;
|
|
53
|
+
try {
|
|
54
|
+
binary = resolveBinary();
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error(err.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// npm normalizes non-`bin` files to 0644 on install (strips the execute bit),
|
|
61
|
+
// so ensure the binary is executable before launching. Best-effort: a global
|
|
62
|
+
// install owned by root may not be chmod-able, but is usually already 0755.
|
|
63
|
+
if (process.platform !== "win32") {
|
|
64
|
+
try {
|
|
65
|
+
fs.chmodSync(binary, 0o755);
|
|
66
|
+
} catch (_) {
|
|
67
|
+
/* ignore — fall through to exec, which surfaces a clear error if needed */
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
73
|
+
} catch (err) {
|
|
74
|
+
// execFileSync throws on any non-zero exit; mirror the child's status.
|
|
75
|
+
if (typeof err.status === "number") {
|
|
76
|
+
process.exit(err.status);
|
|
77
|
+
}
|
|
78
|
+
if (err.signal) {
|
|
79
|
+
console.error(`mbcli: mb terminated by signal ${err.signal}`);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
console.error(`mbcli: failed to launch mb: ${err.message}`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mightybot/mbcli",
|
|
3
|
+
"version": "0.5.398",
|
|
4
|
+
"description": "MightyBot mb CLI and local design-time MCP server",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mb": "bin/mb.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/mb.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=16"
|
|
14
|
+
},
|
|
15
|
+
"license": "UNLICENSED",
|
|
16
|
+
"private": false,
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@mightybot/mbcli-darwin-arm64": "0.5.398",
|
|
19
|
+
"@mightybot/mbcli-darwin-x64": "0.5.398",
|
|
20
|
+
"@mightybot/mbcli-linux-x64": "0.5.398",
|
|
21
|
+
"@mightybot/mbcli-linux-arm64": "0.5.398",
|
|
22
|
+
"@mightybot/mbcli-win32-x64": "0.5.398"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://mightybot.ai"
|
|
25
|
+
}
|