@codexhost/cli 0.2.5 → 0.3.0-test.1

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 CHANGED
@@ -5,10 +5,10 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -g @codexhost/cli@0.2.5
8
+ npm install -g @codexhost/cli@0.3.0-test.1
9
9
  ```
10
10
 
11
- npm automatically installs the matching macOS, Windows, or Linux platform package. Node.js 22 or newer and the official ChatGPT/Codex Desktop are required.
11
+ npm automatically installs the matching macOS, Windows, or Linux platform package. Node.js 22 or 24 and the official ChatGPT/Codex Desktop are required.
12
12
 
13
13
  ## Usage
14
14
 
package/bin/codexhost.js CHANGED
@@ -2,10 +2,11 @@
2
2
  import { spawn } from "node:child_process";
3
3
  import { existsSync, realpathSync } from "node:fs";
4
4
  import { createRequire } from "node:module";
5
+ import { homedir } from "node:os";
5
6
  import path from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
8
 
8
- const version = "0.2.5";
9
+ const version = "0.3.0-test.1";
9
10
  const userArguments = process.argv.slice(2);
10
11
  const startupTraceStartedAt = Date.now();
11
12
  function startupTrace(stage) {
@@ -167,14 +168,36 @@ const updateEnvironment = {
167
168
  CODEXHOST_NPM_LAUNCHER_PATH: fileURLToPath(import.meta.url),
168
169
  CODEXHOST_NPM_PACKAGE_ROOT: packageRoot,
169
170
  };
171
+ // A managed SSH installation deliberately exports these variables from the
172
+ // remote login profile so stock Codex can enter the remote Host. When this npm
173
+ // command starts the local Desktop on that same machine, replace the remote
174
+ // bootstrap with a local data root. CODEXHOST_CLAUDE_COMMAND is intentionally
175
+ // shared and therefore preserved.
176
+ const remoteSshBootstrapEnvironment = [
177
+ "CODEX_INSTALL_DIR",
178
+ "CODEXHOST_DATA_DIR",
179
+ "CODEXHOST_DEFAULT_AGENT",
180
+ "CODEXHOST_HOST_NODE_PATH",
181
+ "CODEXHOST_HOST_RUNTIME_PATH",
182
+ "CODEXHOST_REMOTE_SSH_MANAGED",
183
+ "CODEXHOST_STOCK_CODEX_PATH",
184
+ ];
185
+ if (updateEnvironment.CODEXHOST_REMOTE_SSH_MANAGED === "1") {
186
+ for (const name of remoteSshBootstrapEnvironment) delete updateEnvironment[name];
187
+ updateEnvironment.CODEXHOST_DATA_DIR = path.join(homedir(), ".codexhost");
188
+ }
170
189
 
171
190
  let launchArguments;
191
+ let remoteArguments = null;
172
192
  if (userArguments.length === 0) {
173
193
  launchArguments = ["launch"];
174
194
  } else if (userArguments[0] === "launch") {
175
195
  launchArguments = userArguments;
176
196
  } else if (userArguments[0] === "inspect") {
177
197
  launchArguments = userArguments;
198
+ } else if (userArguments[0] === "remote") {
199
+ launchArguments = null;
200
+ remoteArguments = userArguments.slice(1);
178
201
  } else if (userArguments[0] === "--help" || userArguments[0] === "-h") {
179
202
  console.log(
180
203
  [
@@ -183,6 +206,7 @@ if (userArguments.length === 0) {
183
206
  " codexhost --version",
184
207
  " codexhost inspect",
185
208
  " codexhost launch [launcher options]",
209
+ " codexhost remote install|status|uninstall",
186
210
  "",
187
211
  "This npm package uses the current Node.js runtime and the packaged",
188
212
  "Rust launcher/shim. Codex Desktop must already be installed.",
@@ -195,7 +219,7 @@ if (userArguments.length === 0) {
195
219
  );
196
220
  }
197
221
 
198
- if (launchArguments[0] === "launch") {
222
+ if (launchArguments?.[0] === "launch") {
199
223
  const injected = new Set();
200
224
  for (let index = 1; index < launchArguments.length; index += 1) {
201
225
  const argument = launchArguments[index];
@@ -221,7 +245,35 @@ if (launchArguments[0] === "launch") {
221
245
  launchArguments = ["launch", ...extras, ...launchArguments.slice(1)];
222
246
  }
223
247
 
224
- if (launchArguments[0] === "launch") {
248
+ if (remoteArguments !== null) {
249
+ const child = spawn(
250
+ process.execPath,
251
+ [
252
+ hostRuntime,
253
+ "--codexhost-remote",
254
+ ...remoteArguments,
255
+ "--node",
256
+ process.execPath,
257
+ "--shim",
258
+ shim,
259
+ "--host-runtime",
260
+ hostRuntime,
261
+ ],
262
+ {
263
+ env: updateEnvironment,
264
+ stdio: "inherit",
265
+ windowsHide: true,
266
+ },
267
+ );
268
+ child.on("error", (error) => fail(error.message));
269
+ child.on("exit", (code, signal) => {
270
+ if (signal) {
271
+ process.kill(process.pid, signal);
272
+ return;
273
+ }
274
+ process.exit(code ?? 1);
275
+ });
276
+ } else if (launchArguments?.[0] === "launch") {
225
277
  // The Launcher prints "ready" once the Desktop, Controller, and Host chain
226
278
  // are up, then detaches from the terminal to keep supervising. Return
227
279
  // success immediately so the terminal is not held open by this command.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codexhost/cli",
3
- "version": "0.2.5",
3
+ "version": "0.3.0-test.1",
4
4
  "description": "Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,11 +14,11 @@
14
14
  "node": ">=22"
15
15
  },
16
16
  "optionalDependencies": {
17
- "@codexhost/cli-darwin-arm64": "0.2.5",
18
- "@codexhost/cli-darwin-x64": "0.2.5",
19
- "@codexhost/cli-win32-x64": "0.2.5",
20
- "@codexhost/cli-win32-arm64": "0.2.5",
21
- "@codexhost/cli-linux-x64": "0.2.5"
17
+ "@codexhost/cli-darwin-arm64": "0.3.0-test.1",
18
+ "@codexhost/cli-darwin-x64": "0.3.0-test.1",
19
+ "@codexhost/cli-win32-x64": "0.3.0-test.1",
20
+ "@codexhost/cli-win32-arm64": "0.3.0-test.1",
21
+ "@codexhost/cli-linux-x64": "0.3.0-test.1"
22
22
  },
23
23
  "keywords": [
24
24
  "codex",