@bounded-sh/cli 0.0.149 → 0.0.151

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 (2) hide show
  1. package/bin/bounded.js +21 -11
  2. 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 @bounded-sh/cli npm package.
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 `bounded update` defers to npm instead of
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 REINSTALL = 'npm install -D @bounded-sh/cli';
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
- if (!suffix) {
38
+ const shipped = MANIFEST.optionalDependencies;
39
+ if (!suffix || (shipped && !(`${PLATFORM_PREFIX}${suffix}` in shipped))) {
30
40
  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).',
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: `@bounded-sh/cli-${suffix}`,
37
- executable: process.platform === 'win32' ? 'bounded.exe' : 'bounded',
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 @bounded-sh/cli. Reinstall with "${REINSTALL}" ` +
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(`bounded: ${error.message}`);
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(`bounded: could not start ${binary}: ${error.message}`);
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.149",
3
+ "version": "0.0.151",
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.149",
39
- "@bounded-sh/cli-darwin-x64": "0.0.149",
40
- "@bounded-sh/cli-linux-arm64": "0.0.149",
41
- "@bounded-sh/cli-linux-x64": "0.0.149",
42
- "@bounded-sh/cli-win32-x64": "0.0.149"
38
+ "@bounded-sh/cli-darwin-arm64": "0.0.151",
39
+ "@bounded-sh/cli-darwin-x64": "0.0.151",
40
+ "@bounded-sh/cli-linux-arm64": "0.0.151",
41
+ "@bounded-sh/cli-linux-x64": "0.0.151",
42
+ "@bounded-sh/cli-win32-x64": "0.0.151"
43
43
  }
44
44
  }