@bounded-sh/cli 0.0.122
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 +23 -0
- package/bin/bounded.js +111 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @bounded-sh/cli
|
|
2
|
+
|
|
3
|
+
The `bounded` CLI for [Bounded](https://bounded.sh), the full-stack app builder
|
|
4
|
+
and policy-enforced runtime for coding agents.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install -D @bounded-sh/cli
|
|
8
|
+
npx bounded init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This package is a small launcher. npm installs the native binary for your
|
|
12
|
+
platform through one of the optional dependencies (`@bounded-sh/cli-darwin-arm64`,
|
|
13
|
+
`cli-darwin-x64`, `cli-linux-arm64`, `cli-linux-x64`, `cli-win32-x64`), so keep
|
|
14
|
+
optional dependencies enabled. Node 20 or later.
|
|
15
|
+
|
|
16
|
+
Run every command through npx: `npx bounded verify`, `npx bounded deploy`, and
|
|
17
|
+
so on. Update with `npm install -D @bounded-sh/cli@latest`; `bounded update`
|
|
18
|
+
prints that command instead of replacing a file npm owns.
|
|
19
|
+
|
|
20
|
+
Without Node, the shell installer installs a global `bounded` on macOS and
|
|
21
|
+
Linux: `curl -fsSL https://get.bounded.sh/install.sh | sh`.
|
|
22
|
+
|
|
23
|
+
Docs: https://bounded.sh/docs/cli
|
package/bin/bounded.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Launcher for the @bounded-sh/cli npm package.
|
|
5
|
+
//
|
|
6
|
+
// The CLI itself is a native Go binary. npm installs exactly one of the
|
|
7
|
+
// per-platform packages listed as optional dependencies (each declares `os` and
|
|
8
|
+
// `cpu`, so npm skips the rest); this file finds that package next to itself and
|
|
9
|
+
// runs the binary with the caller's stdio, forwarding signals and the exit code.
|
|
10
|
+
// It has no dependencies and no install scripts. The child sees
|
|
11
|
+
// BOUNDED_INSTALL_CHANNEL=npm so `bounded update` defers to npm instead of
|
|
12
|
+
// replacing a file npm owns.
|
|
13
|
+
|
|
14
|
+
const { spawn } = require('node:child_process');
|
|
15
|
+
const path = require('node:path');
|
|
16
|
+
|
|
17
|
+
const PLATFORMS = {
|
|
18
|
+
darwin: { arm64: 'darwin-arm64', x64: 'darwin-x64' },
|
|
19
|
+
linux: { arm64: 'linux-arm64', x64: 'linux-x64' },
|
|
20
|
+
win32: { x64: 'win32-x64' },
|
|
21
|
+
};
|
|
22
|
+
const OVERRIDE_ENV = 'BOUNDED_CLI_BINARY_OVERRIDE';
|
|
23
|
+
const CHANNEL_ENV = 'BOUNDED_INSTALL_CHANNEL';
|
|
24
|
+
const REINSTALL = 'npm install -D @bounded-sh/cli';
|
|
25
|
+
|
|
26
|
+
function platformPackage() {
|
|
27
|
+
const byArch = PLATFORMS[process.platform];
|
|
28
|
+
const suffix = byArch && byArch[process.arch];
|
|
29
|
+
if (!suffix) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`@bounded-sh/cli has no prebuilt binary for ${process.platform}-${process.arch}. ` +
|
|
32
|
+
'Supported: macOS (arm64, x64), Linux (arm64, x64), Windows (x64).',
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
name: `@bounded-sh/cli-${suffix}`,
|
|
37
|
+
executable: process.platform === 'win32' ? 'bounded.exe' : 'bounded',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function resolveBinary() {
|
|
42
|
+
const override = process.env[OVERRIDE_ENV];
|
|
43
|
+
if (override) return override;
|
|
44
|
+
const { name, executable } = platformPackage();
|
|
45
|
+
let manifest;
|
|
46
|
+
try {
|
|
47
|
+
manifest = require.resolve(`${name}/package.json`);
|
|
48
|
+
} catch {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`${name} is not installed next to @bounded-sh/cli. Reinstall with "${REINSTALL}" ` +
|
|
51
|
+
'with optional dependencies enabled; npm installs only the package for this platform.',
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return path.join(path.dirname(manifest), 'bin', executable);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function main() {
|
|
58
|
+
let binary;
|
|
59
|
+
try {
|
|
60
|
+
binary = resolveBinary();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error(`bounded: ${error.message}`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const child = spawn(binary, process.argv.slice(2), {
|
|
67
|
+
stdio: 'inherit',
|
|
68
|
+
env: { ...process.env, [CHANNEL_ENV]: 'npm' },
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const forwarders = new Map();
|
|
72
|
+
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
73
|
+
const forward = () => {
|
|
74
|
+
if (child.exitCode === null && child.signalCode === null) child.kill(signal);
|
|
75
|
+
};
|
|
76
|
+
try {
|
|
77
|
+
process.on(signal, forward);
|
|
78
|
+
forwarders.set(signal, forward);
|
|
79
|
+
} catch {
|
|
80
|
+
// A platform without this signal simply does not forward it.
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const release = () => {
|
|
84
|
+
for (const [signal, forward] of forwarders) process.removeListener(signal, forward);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
child.on('error', (error) => {
|
|
88
|
+
release();
|
|
89
|
+
console.error(`bounded: could not start ${binary}: ${error.message}`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
});
|
|
92
|
+
child.on('exit', (code, signal) => {
|
|
93
|
+
release();
|
|
94
|
+
if (signal !== null) {
|
|
95
|
+
if (process.platform !== 'win32') {
|
|
96
|
+
try {
|
|
97
|
+
process.kill(process.pid, signal);
|
|
98
|
+
// Keep the event loop alive for the signal to land; exit 1 otherwise.
|
|
99
|
+
setTimeout(() => process.exit(1), 1000);
|
|
100
|
+
return;
|
|
101
|
+
} catch {
|
|
102
|
+
// Fall through to a plain failure exit.
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
process.exit(code === null ? 1 : code);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bounded-sh/cli",
|
|
3
|
+
"version": "0.0.122",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"author": "Bounded",
|
|
7
|
+
"homepage": "https://bounded.sh/docs/cli",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/poofdotnew/bounded-cli/issues"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/poofdotnew/bounded-cli.git",
|
|
14
|
+
"directory": "npm/cli"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"bounded",
|
|
18
|
+
"cli",
|
|
19
|
+
"full-stack",
|
|
20
|
+
"app-builder",
|
|
21
|
+
"realtime-backend",
|
|
22
|
+
"policy",
|
|
23
|
+
"ai-apps"
|
|
24
|
+
],
|
|
25
|
+
"bin": {
|
|
26
|
+
"bounded": "bin/bounded.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"bin/"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"optionalDependencies": {
|
|
38
|
+
"@bounded-sh/cli-darwin-arm64": "0.0.122",
|
|
39
|
+
"@bounded-sh/cli-darwin-x64": "0.0.122",
|
|
40
|
+
"@bounded-sh/cli-linux-arm64": "0.0.122",
|
|
41
|
+
"@bounded-sh/cli-linux-x64": "0.0.122",
|
|
42
|
+
"@bounded-sh/cli-win32-x64": "0.0.122"
|
|
43
|
+
}
|
|
44
|
+
}
|