@mobb.ai/cli 0.0.1 → 1.4.49
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 +84 -0
- package/bin/mobbdev.js +10 -0
- package/lib/binary.js +52 -0
- package/package.json +24 -6
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @mobb.ai/cli
|
|
2
|
+
|
|
3
|
+
Binary distribution of the Bugsy CLI, delivered entirely through the `@mobb.ai`
|
|
4
|
+
npm org. The package itself is a ~30-line launcher that runs on **any Node.js
|
|
5
|
+
>= 14**; the real CLI is a standalone executable (own Node runtime embedded)
|
|
6
|
+
that npm installs as a platform-specific optional dependency. No downloads
|
|
7
|
+
outside npm, no GitHub access, no checksum plumbing — registry + lockfile
|
|
8
|
+
integrity cover supply-chain verification.
|
|
9
|
+
|
|
10
|
+
Scoped under `@mobb.ai` so only the org can publish the launcher and platform
|
|
11
|
+
binaries (typosquat / fake-package resistance).
|
|
12
|
+
|
|
13
|
+
## Usage (customers)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @mobb.ai/cli # ~40 MB download, exactly one platform package
|
|
17
|
+
mobbdev scan -r https://github.com/WebGoat/WebGoat
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Published platforms: `linux-x64`, `linux-arm64`, `win-x64` (glibc — musl/Alpine
|
|
21
|
+
is not supported, the binary needs the glibc loader). The `macos-*` names are
|
|
22
|
+
reserved in the org but not built yet: postject invalidates the Mach-O
|
|
23
|
+
signature and macOS then refuses to exec the binary, so those targets need a
|
|
24
|
+
macOS build job. macOS and Alpine users install the `mobbdev` npm package.
|
|
25
|
+
|
|
26
|
+
Same CLI, commands, config, and login as the `mobbdev` package. Customers
|
|
27
|
+
choose:
|
|
28
|
+
|
|
29
|
+
| | `mobbdev` | `@mobb.ai/cli` |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| What runs | JS on the customer's Node | standalone binary (Node 22 inside) |
|
|
32
|
+
| Node requirement | engines range of `mobbdev` | any Node >= 14 |
|
|
33
|
+
| Install size | ~380 MB (467 packages) | ~40 MB compressed / ~120 MB on disk (2 packages) |
|
|
34
|
+
|
|
35
|
+
## How it works
|
|
36
|
+
|
|
37
|
+
- `@mobb.ai/cli-<os>-<cpu>` packages each contain one compiled binary and
|
|
38
|
+
declare `os`/`cpu` (Node `process.platform` / `process.arch` values), so npm
|
|
39
|
+
installs only the matching one. Package *names* use `macos` / `win` slugs
|
|
40
|
+
(`@mobb.ai/cli-macos-arm64`, `@mobb.ai/cli-win-x64`, …).
|
|
41
|
+
- `@mobb.ai/cli` lists them as exact-version `optionalDependencies` and its
|
|
42
|
+
`mobbdev` bin resolves + spawns the installed binary, forwarding args and
|
|
43
|
+
exit code.
|
|
44
|
+
|
|
45
|
+
## Release flow
|
|
46
|
+
|
|
47
|
+
**Shared version:** `clients/cli_wrapper/package.json` must always equal
|
|
48
|
+
`clients/cli/package.json`. Platform packages and `@mobb.ai/cli` publish under
|
|
49
|
+
that version. `clients/cli/scripts/increment-version.sh` bumps both when either
|
|
50
|
+
tree changes; `scripts/check_cli_version.sh` (CI), the version step in
|
|
51
|
+
`.github/workflows/cli-binary-tests.yml` and `sharedVersion()` in
|
|
52
|
+
`clients/scripts/targets.mjs` (used by the packaging step) all fail on mismatch.
|
|
53
|
+
|
|
54
|
+
The JS npm package `mobbdev` (from `clients/cli`) is published separately;
|
|
55
|
+
binary packages are generated by `scripts/prepare_publish.mjs` (one package per
|
|
56
|
+
binary in `binaries/`, optionalDeps stamped into `publish/`).
|
|
57
|
+
|
|
58
|
+
`scripts/publish_cli_binaries.sh` (Production deploy, after `publish_cli.sh`):
|
|
59
|
+
1. Skips if `@mobb.ai/cli@<version>` is already on npm.
|
|
60
|
+
2. `pnpm run build:binary:all` in `clients/cli` (Node SEA + postject).
|
|
61
|
+
3. **Gate:** `pnpm run test:binary` in `clients/cli` — binary smoke tests +
|
|
62
|
+
Verdaccio publish → install (platform packages first, then `@mobb.ai/cli`
|
|
63
|
+
with optionalDependency resolution) and exit-code passthrough. No publish
|
|
64
|
+
if it fails.
|
|
65
|
+
4. `scripts/prepare_publish.mjs` stages the artifacts, then publishes the
|
|
66
|
+
platform packages and `@mobb.ai/cli` last, so a published launcher can
|
|
67
|
+
always resolve its binaries.
|
|
68
|
+
|
|
69
|
+
Run the tests locally: `pnpm run build:binary` in `clients/cli` (the host
|
|
70
|
+
binary the e2e executes), then `pnpm run test:binary` there. On macOS use
|
|
71
|
+
`build:binary`, not `build:binary:all` — the release matrix has no mac target,
|
|
72
|
+
so `:all` leaves no host binary for the e2e to run.
|
|
73
|
+
|
|
74
|
+
The build/packaging logic is JS: `clients/scripts/targets.mjs` (target matrix,
|
|
75
|
+
platform↔slug mapping, shared version), `clients/cli/scripts/build_binary.mjs`
|
|
76
|
+
(SEA build), `scripts/prepare_publish.mjs` (npm artifacts),
|
|
77
|
+
`clients/cli/__e2e__/binary.mjs` (`node --test` e2e).
|
|
78
|
+
|
|
79
|
+
## Environment variables
|
|
80
|
+
|
|
81
|
+
| Variable | Set by | Purpose |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `MOBBDEV_MODULE_ROOT` | the binary itself (`src/sea_assets.ts`) | Where SEA-embedded assets (`package.json`, `.env`, protos) were materialized; `getModuleRootDir()` reads it. Not meant to be set by hand. |
|
|
84
|
+
| `MOBB_SNYK_DOWNLOAD_BASE` | user | Mirror for Snyk's standalone CLI, default `https://downloads.snyk.io/cli`. Set it when that host is blocked — the binary has no bundled `snyk`, so `mobbdev scan --scanner snyk` downloads it (pinned version, checksum-verified, cached in `~/.mobb/tools/snyk/`). |
|
package/bin/mobbdev.js
ADDED
package/lib/binary.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
// @mobb.ai/cli launcher: resolves the platform binary installed by npm via
|
|
3
|
+
// optionalDependencies (@mobb.ai/cli-<os>-<cpu>, gated by os/cpu fields so
|
|
4
|
+
// npm installs exactly one) and forwards all arguments to it.
|
|
5
|
+
//
|
|
6
|
+
// No downloads, no checksums: the binary arrives through npm like any other
|
|
7
|
+
// dependency, so registry mirrors / lockfile integrity already cover it.
|
|
8
|
+
//
|
|
9
|
+
// Zero runtime dependencies. Must stay runnable on Node >= 14: no ESM,
|
|
10
|
+
// no syntax newer than what Node 14 parses.
|
|
11
|
+
|
|
12
|
+
const { spawnSync } = require('child_process')
|
|
13
|
+
|
|
14
|
+
// npm package slug uses macos/win (org convention); process.platform is
|
|
15
|
+
// darwin/win32. Keep in sync with scripts/gen_platform_pkg.js.
|
|
16
|
+
function npmOs() {
|
|
17
|
+
if (process.platform === 'darwin') return 'macos'
|
|
18
|
+
if (process.platform === 'win32') return 'win'
|
|
19
|
+
return process.platform
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getPlatformPackage() {
|
|
23
|
+
return '@mobb.ai/cli-' + npmOs() + '-' + process.arch
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getBinaryPath() {
|
|
27
|
+
const pkgName = getPlatformPackage()
|
|
28
|
+
const binName = process.platform === 'win32' ? 'mobbdev.exe' : 'mobbdev'
|
|
29
|
+
try {
|
|
30
|
+
return require.resolve(pkgName + '/' + binName)
|
|
31
|
+
} catch (e) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
'Could not find the mobbdev binary package "' +
|
|
34
|
+
pkgName +
|
|
35
|
+
'".\n' +
|
|
36
|
+
'Either this platform is not supported by the binary distribution,\n' +
|
|
37
|
+
'or optional dependencies were skipped (npm install --no-optional).\n' +
|
|
38
|
+
'Reinstall with optional dependencies enabled, or use the regular\n' +
|
|
39
|
+
'npm package instead: npm install mobbdev (requires a supported Node.js).'
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function run(args) {
|
|
45
|
+
const result = spawnSync(getBinaryPath(), args, { stdio: 'inherit' })
|
|
46
|
+
if (result.error) {
|
|
47
|
+
throw result.error
|
|
48
|
+
}
|
|
49
|
+
process.exit(result.status === null ? 1 : result.status)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = { run }
|
package/package.json
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobb.ai/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
3
|
+
"version": "1.4.49",
|
|
4
|
+
"description": "Binary distribution of mobbdev (Bugsy CLI). Installs a standalone, self-contained executable via npm — no Node.js version requirement, the binary embeds its own runtime. Same CLI, same commands as the mobbdev package.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/mobb-dev/bugsy.git"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"mobbdev": "bin/mobbdev.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"lib"
|
|
15
|
+
],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@mobb.ai/cli-linux-arm64": "1.4.49",
|
|
18
|
+
"@mobb.ai/cli-linux-x64": "1.4.49",
|
|
19
|
+
"@mobb.ai/cli-win-x64": "1.4.49"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=14"
|
|
8
26
|
},
|
|
9
27
|
"author": "",
|
|
10
|
-
"license": "
|
|
28
|
+
"license": "MIT"
|
|
11
29
|
}
|