@mightybot/mbcli 0.0.1-rc.99

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.
Files changed (3) hide show
  1. package/README.md +225 -0
  2. package/bin/mb.js +87 -0
  3. package/package.json +25 -0
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ # @mightybot/mbcli
2
+
3
+ The MightyBot `mb` CLI and local design-time MCP server, distributed over npm so
4
+ it can be run with `npx`.
5
+
6
+ `mb` is a single Go binary. This package is a thin launcher: the binary ships in
7
+ a per-platform optional dependency (`@mightybot/mbcli-<platform>`), and npm
8
+ installs only the one matching your machine.
9
+
10
+
11
+ ## Start here — one command
12
+
13
+ With Node.js 16+, this one command is the entire setup — it signs you in and
14
+ registers the MCP server with your AI agents:
15
+
16
+ ```bash
17
+ npx @mightybot/mbcli@latest setup
18
+ ```
19
+
20
+ `setup` = `mb auth login` (browser sign-in) + `mb mcp install --agent all`.
21
+ `npx` fetches the right platform binary on demand — nothing to install first.
22
+
23
+ Run any other command the same way:
24
+
25
+ ```bash
26
+ npx @mightybot/mbcli@latest workflow list
27
+ npx @mightybot/mbcli@latest version
28
+ ```
29
+
30
+ > Prefer a permanent `mb` on your PATH? `npm i -g @mightybot/mbcli@latest`,
31
+ > then run `mb <cmd>` (re-run the install to upgrade). The MCP server installs to
32
+ > the stable `~/.mightybot/mcp/mb` either way.
33
+
34
+ ### Release channels
35
+
36
+ - **`@latest`** — the stable release. Use this. *(recommended for everyone)*
37
+ - **`@preprod`** — the newest build, ahead of `@latest`; use it to try the most
38
+ recent changes before they're promoted.
39
+
40
+ `@latest` is promoted from a tested `@preprod` build — same bytes, no rebuild.
41
+
42
+ ### Always getting the newest
43
+
44
+ npx caches by version spec. To avoid running a stale cached copy, either pin the
45
+ channel tag or force a registry check:
46
+
47
+ ```bash
48
+ npx @mightybot/mbcli@latest version # re-resolves the latest tag
49
+ npx --prefer-online @mightybot/mbcli version # revalidates cache against the registry
50
+ ```
51
+
52
+ ### Release-age cooldown
53
+
54
+ If your npm config (or your organization's `.npmrc`) sets `min-release-age` as a
55
+ supply-chain guard, npm refuses any version published in the last N days — so a
56
+ **same-day release fails with `ENOVERSIONS` / "No versions available for
57
+ @mightybot/mbcli"** even though it published fine. Override the cooldown to
58
+ install a fresh build:
59
+
60
+ ```bash
61
+ npx --min-release-age=0 @mightybot/mbcli@latest # CLI flag, or
62
+ npm_config_min_release_age=0 npx @mightybot/mbcli@latest # env var
63
+ ```
64
+
65
+ Once the build is older than the cooldown window, plain `npx …` works with no
66
+ flag. (This guard is intentional — it protects against installing a
67
+ freshly-compromised package; the override is only for trusted same-day builds.)
68
+
69
+ ## Commands
70
+
71
+ Every example below uses the bare `mb` (after a global install or inside
72
+ `mb setup`). With `npx`, prefix any command:
73
+ `npx @mightybot/mbcli@latest <command>`.
74
+
75
+ Get machine-readable help any time:
76
+
77
+ ```bash
78
+ mb help # human-readable usage
79
+ mb help --json # full command catalog (command, usage, backend method/path)
80
+ mb version # build info (version, commit, build date) as JSON
81
+ ```
82
+
83
+ > Builder-step **configuration writes** (workflow schemas, file processing,
84
+ > validation, policies, agent compiler, data trail, views) are **MCP-native** —
85
+ > done by an agent through the `mb mcp` server, not these shell subcommands. The
86
+ > shell commands below cover auth, setup, fleet ops, tests, SDLC, deploy/release,
87
+ > and evidence. After `mb setup`, an agent should start with the MCP tool
88
+ > `mightybot.start_here`.
89
+
90
+ ### `mb setup` — one-step provisioning
91
+
92
+ ```bash
93
+ mb setup [auth flags] # mb auth login + mb mcp install --agent all
94
+ ```
95
+
96
+ Logs in (browser device auth) and registers the MCP server with all detected
97
+ agents. Auth flags pass through (e.g. `--base-url <your-platform-url>`).
98
+
99
+ ### `mb auth` — platform authentication
100
+
101
+ | Command | What it does |
102
+ |---|---|
103
+ | `mb auth login` | Browser device-code login; stores the token under `~/.mightybot`. |
104
+ | `mb auth inspect` | Show the active profile/backend and token status. |
105
+ | `mb auth profile` | Print the current auth profile (tenant, user, backend URL). |
106
+ | `mb auth configure` | Set/switch the backend (base URL, environment). |
107
+ | `mb auth probe-write` | Pre-flight check that the token can perform writes. |
108
+
109
+ > `mb` has **one** profile slot — the last `mb auth login` wins. Confirm the
110
+ > active backend with `mb auth inspect` before any write.
111
+
112
+ ### `mb mcp` — local design-time MCP server
113
+
114
+ | Command | What it does |
115
+ |---|---|
116
+ | `mb mcp` | Run the MCP server on stdio (what agents launch). |
117
+ | `mb mcp install [--agent codex,claude,opencode\|all]` | Copy the binary to `~/.mightybot/mcp/mb` and register it with the chosen agents. |
118
+ | `mb mcp register` | Register an already-installed server with an agent. |
119
+ | `mb mcp update` | Re-copy/re-register after a CLI upgrade. |
120
+ | `mb mcp uninstall` | Remove the server registration. |
121
+ | `mb mcp status` / `mb mcp doctor` | Show registration health / diagnose problems. |
122
+ | `mb mcp start` / `mb mcp stop` | Start/stop the managed server. |
123
+
124
+ ### `mb surface` — inspect the workflow surface
125
+
126
+ ```bash
127
+ mb surface overview # high-level map of the workflow definition
128
+ mb surface resources # resources referenced by the workflow
129
+ mb surface operations # available builder operations
130
+ mb surface step # step-level detail
131
+ ```
132
+
133
+ ### `mb workflow` — workflow definitions (read/SDLC)
134
+
135
+ | Command | What it does |
136
+ |---|---|
137
+ | `mb workflow list` | List workflow definitions. |
138
+ | `mb workflow inspect <id>` | Show a definition's full configuration. |
139
+ | `mb workflow create` / `update` / `duplicate` / `delete` | Manage definitions. |
140
+ | `mb workflow export <id>` | Export a definition (e.g. for diffing/backup). |
141
+ | `mb workflow diff` | Diff two definitions/versions. |
142
+ | `mb workflow validate <id>` | Validate a definition. |
143
+ | `mb workflow versions` / `version` / `version-history` / `version-diff` | Inspect version history and compare versions. |
144
+
145
+ ### `mb git` — git ↔ workflow sync state
146
+
147
+ ```bash
148
+ mb git branches # branches relevant to workflow definitions
149
+ mb git sync-status # git/DB sync status
150
+ mb git auto-merge # auto-merge eligible changes
151
+ mb git resource-state # per-resource git state
152
+ mb git pr-status # PR status for workflow changes
153
+ ```
154
+
155
+ ### `mb instance` — workflow instances & their files
156
+
157
+ | Command | What it does |
158
+ |---|---|
159
+ | `mb instance list` / `get <id>` / `stats` | List, fetch, and summarize instances. |
160
+ | `mb instance create` / `patch` / `delete` / `close` | Manage instances. |
161
+ | `mb instance repair` / `backfill` | Maintenance operations. |
162
+ | `mb instance data` | Inspect/manage instance data entries. |
163
+ | `mb instance file upload …` | Upload a file to an instance. |
164
+
165
+ ### `mb run` — workflow runs (tests & evidence)
166
+
167
+ | Command | What it does |
168
+ |---|---|
169
+ | `mb run test` | Run a workflow end-to-end as a test. |
170
+ | `mb run create` / `partial` | Start a full or partial run. |
171
+ | `mb run rerun` | Re-execute a prior run. |
172
+ | `mb run list` / `inspect <id>` | List runs / inspect one. |
173
+ | `mb run result <id>` / `files <id>` | Fetch a run's result / output files. |
174
+
175
+ ### `mb eval` — evaluations
176
+
177
+ ```bash
178
+ mb eval lists | list # list eval sets / evals
179
+ mb eval run # run an evaluation
180
+ mb eval result # fetch results
181
+ mb eval annotation # annotations
182
+ mb eval comment | review # commenting / review
183
+ mb eval packet # export an eval packet
184
+ ```
185
+
186
+ ### `mb deploy` — deploys
187
+
188
+ | Command | What it does |
189
+ |---|---|
190
+ | `mb deploy draft` / `preview` | Stage and preview a deploy. |
191
+ | `mb deploy release` | Cut a release/deploy. |
192
+ | `mb deploy status` / `release-status` | Check deploy/release status. |
193
+ | `mb deploy list` / `releases` | List deploys / releases. |
194
+
195
+ ### `mb release` — release tagging
196
+
197
+ ```bash
198
+ mb release tag suggest # suggest the next release tag
199
+ mb release tag create # create a release tag
200
+ ```
201
+
202
+ ### `mb view-serving` — view-serving checks
203
+
204
+ ```bash
205
+ mb view-serving smoke # smoke-test served views
206
+ mb view-serving test # run view-serving tests
207
+ ```
208
+
209
+ ### Global flags
210
+
211
+ - `--home <dir>` — override `HOME` (where `~/.mightybot` lives); useful for
212
+ isolated/CI runs.
213
+ - `--json` after `help` — emit the full command catalog as JSON.
214
+
215
+ ### Under the hood
216
+
217
+ `setup` copies the binary to a stable location (`~/.mightybot/mcp/mb`, alongside
218
+ its docs, re-signed for macOS) and registers *that* path — so the long-lived MCP
219
+ server does not depend on the ephemeral npx cache. Re-run `setup` after an
220
+ upgrade, then restart your agent so it reloads MCP.
221
+
222
+ ## Supported platforms
223
+
224
+ macOS arm64 (Apple Silicon), macOS x64 (Intel), Linux x64, Linux arm64,
225
+ Windows x64 — npm installs only the package matching your machine.
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 it is published as (e.g. @mightybot-ai/mbcli private and
18
+ // @mightybot/mbcli public). The binary ships in `<self>-<platform>` (e.g.
19
+ // @mightybot/mbcli-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.0.1-rc.99",
4
+ "description": "MightyBot mb CLI and local 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.0.1-rc.99",
19
+ "@mightybot/mbcli-darwin-x64": "0.0.1-rc.99",
20
+ "@mightybot/mbcli-linux-x64": "0.0.1-rc.99",
21
+ "@mightybot/mbcli-linux-arm64": "0.0.1-rc.99",
22
+ "@mightybot/mbcli-win32-x64": "0.0.1-rc.99"
23
+ },
24
+ "homepage": "https://mightybot.ai"
25
+ }