@bounded-sh/cli 0.0.148 → 0.0.150
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/bounded.js +21 -11
- package/package.json +6 -6
package/bin/bounded.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
// Launcher for the
|
|
4
|
+
// Launcher for the CLI's npm package.
|
|
5
5
|
//
|
|
6
6
|
// The CLI itself is a native Go binary. npm installs exactly one of the
|
|
7
7
|
// per-platform packages listed as optional dependencies (each declares `os` and
|
|
8
8
|
// `cpu`, so npm skips the rest); this file finds that package next to itself and
|
|
9
9
|
// runs the binary with the caller's stdio, forwarding signals and the exit code.
|
|
10
10
|
// It has no dependencies and no install scripts. The child sees
|
|
11
|
-
// BOUNDED_INSTALL_CHANNEL=npm so `
|
|
11
|
+
// BOUNDED_INSTALL_CHANNEL=npm so its `update` command defers to npm instead of
|
|
12
12
|
// replacing a file npm owns.
|
|
13
|
+
//
|
|
14
|
+
// The same file ships in two packages built from one release (see
|
|
15
|
+
// release/npm-package.sh): @bounded-sh/cli runs `bounded` from
|
|
16
|
+
// @bounded-sh/cli-<os>-<cpu>, and openapps runs `openapps` from
|
|
17
|
+
// openapps-<os>-<cpu>. It reads which one it is from its own package.json.
|
|
13
18
|
|
|
14
19
|
const { spawn } = require('node:child_process');
|
|
15
20
|
const path = require('node:path');
|
|
@@ -21,20 +26,25 @@ const PLATFORMS = {
|
|
|
21
26
|
};
|
|
22
27
|
const OVERRIDE_ENV = 'BOUNDED_CLI_BINARY_OVERRIDE';
|
|
23
28
|
const CHANNEL_ENV = 'BOUNDED_INSTALL_CHANNEL';
|
|
24
|
-
const
|
|
29
|
+
const MANIFEST = require('../package.json');
|
|
30
|
+
const PACKAGE = MANIFEST.name;
|
|
31
|
+
const COMMAND = PACKAGE === 'openapps' ? 'openapps' : 'bounded';
|
|
32
|
+
const PLATFORM_PREFIX = PACKAGE === 'openapps' ? 'openapps-' : `${PACKAGE}-`;
|
|
33
|
+
const REINSTALL = `npm install -D ${PACKAGE}`;
|
|
25
34
|
|
|
26
35
|
function platformPackage() {
|
|
27
36
|
const byArch = PLATFORMS[process.platform];
|
|
28
37
|
const suffix = byArch && byArch[process.arch];
|
|
29
|
-
|
|
38
|
+
const shipped = MANIFEST.optionalDependencies;
|
|
39
|
+
if (!suffix || (shipped && !(`${PLATFORM_PREFIX}${suffix}` in shipped))) {
|
|
30
40
|
throw new Error(
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
`${PACKAGE} has no prebuilt binary for ${process.platform}-${process.arch}. ` +
|
|
42
|
+
`Supported: ${shipped ? Object.keys(shipped).map((name) => name.slice(PLATFORM_PREFIX.length)).join(', ') : 'darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-x64'}.`,
|
|
33
43
|
);
|
|
34
44
|
}
|
|
35
45
|
return {
|
|
36
|
-
name:
|
|
37
|
-
executable: process.platform === 'win32' ?
|
|
46
|
+
name: `${PLATFORM_PREFIX}${suffix}`,
|
|
47
|
+
executable: process.platform === 'win32' ? `${COMMAND}.exe` : COMMAND,
|
|
38
48
|
};
|
|
39
49
|
}
|
|
40
50
|
|
|
@@ -47,7 +57,7 @@ function resolveBinary() {
|
|
|
47
57
|
manifest = require.resolve(`${name}/package.json`);
|
|
48
58
|
} catch {
|
|
49
59
|
throw new Error(
|
|
50
|
-
`${name} is not installed next to
|
|
60
|
+
`${name} is not installed next to ${PACKAGE}. Reinstall with "${REINSTALL}" ` +
|
|
51
61
|
'with optional dependencies enabled; npm installs only the package for this platform.',
|
|
52
62
|
);
|
|
53
63
|
}
|
|
@@ -59,7 +69,7 @@ function main() {
|
|
|
59
69
|
try {
|
|
60
70
|
binary = resolveBinary();
|
|
61
71
|
} catch (error) {
|
|
62
|
-
console.error(
|
|
72
|
+
console.error(`${COMMAND}: ${error.message}`);
|
|
63
73
|
process.exit(1);
|
|
64
74
|
}
|
|
65
75
|
|
|
@@ -86,7 +96,7 @@ function main() {
|
|
|
86
96
|
|
|
87
97
|
child.on('error', (error) => {
|
|
88
98
|
release();
|
|
89
|
-
console.error(
|
|
99
|
+
console.error(`${COMMAND}: could not start ${binary}: ${error.message}`);
|
|
90
100
|
process.exit(1);
|
|
91
101
|
});
|
|
92
102
|
child.on('exit', (code, signal) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bounded-sh/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.150",
|
|
4
4
|
"description": "The bounded CLI (bounded.sh): a full-stack app builder and policy-enforced runtime for coding agents. Installs the native binary for this platform as an optional dependency.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bounded",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@bounded-sh/cli-darwin-arm64": "0.0.
|
|
39
|
-
"@bounded-sh/cli-darwin-x64": "0.0.
|
|
40
|
-
"@bounded-sh/cli-linux-arm64": "0.0.
|
|
41
|
-
"@bounded-sh/cli-linux-x64": "0.0.
|
|
42
|
-
"@bounded-sh/cli-win32-x64": "0.0.
|
|
38
|
+
"@bounded-sh/cli-darwin-arm64": "0.0.150",
|
|
39
|
+
"@bounded-sh/cli-darwin-x64": "0.0.150",
|
|
40
|
+
"@bounded-sh/cli-linux-arm64": "0.0.150",
|
|
41
|
+
"@bounded-sh/cli-linux-x64": "0.0.150",
|
|
42
|
+
"@bounded-sh/cli-win32-x64": "0.0.150"
|
|
43
43
|
}
|
|
44
44
|
}
|