@remotehost/cli 2.0.0 → 2.0.2

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/remote.js CHANGED
@@ -3,16 +3,15 @@
3
3
  // program; npm installs it as one of four optional platform packages
4
4
  // (@remotehost/cli-<darwin|linux>-<arm64|x64>, clients/remote/npm), and this
5
5
  // file finds the one for this machine and runs it with the terminal
6
- // inherited, exiting as it exits. Nothing is downloaded: a machine whose
7
- // package is missing is told why.
6
+ // inherited, exiting as it exits. Where Node has process.execve (Unix, Node
7
+ // 22.15 or 23.11 and later, REM-6995) the program replaces this process, as
8
+ // openai/codex's launcher does: no Node stays behind, and signals reach the
9
+ // program itself. Elsewhere it runs as a child, with signals passed on.
10
+ // Nothing is downloaded: a machine whose package is missing is told why.
8
11
  //
9
- // It tells the program three things through the environment:
10
- // REMOTEHOST_LAUNCHER this file
11
- // REMOTEHOST_NODE_COMMANDS dist/node-commands.js, the Node entry of the
12
- // commands that stayed in Node: none since
13
- // Remotehost Claims was removed (REM-6889), so
14
- // the program no longer runs it
15
- // REMOTEHOST_NODE the Node.js running this file, to run it with
12
+ // It tells the program one thing through the environment:
13
+ // REMOTEHOST_LAUNCHER this file
14
+ // The program runs nothing in Node: the package holds this file alone.
16
15
  //
17
16
  // Plain JavaScript: it runs on the Node.js of whoever installed the package.
18
17
 
@@ -79,14 +78,9 @@ export function findBinary({ platform, arch, resolve, exists = existsSync, nodeO
79
78
  return { binary };
80
79
  }
81
80
 
82
- /** The program's environment: the caller's, and where this installation's Node parts are. */
83
- export function childEnv(env, { launcher, node }) {
84
- return {
85
- ...env,
86
- REMOTEHOST_LAUNCHER: launcher,
87
- REMOTEHOST_NODE_COMMANDS: join(dirname(dirname(launcher)), "dist", "node-commands.js"),
88
- REMOTEHOST_NODE: node,
89
- };
81
+ /** The program's environment: the caller's, and this installation's launcher. */
82
+ export function childEnv(env, { launcher }) {
83
+ return { ...env, REMOTEHOST_LAUNCHER: launcher };
90
84
  }
91
85
 
92
86
  /** The exit status a shell reports for a process a signal ended. */
@@ -94,6 +88,19 @@ export function signalStatus(signal) {
94
88
  return 128 + (constants.signals[signal] ?? 0);
95
89
  }
96
90
 
91
+ /**
92
+ * Runs `binary` with `args` and `env`: through `execve`, which replaces this
93
+ * process and does not return, on any platform but win32 when Node has one;
94
+ * otherwise through `spawnChild`, whose result it returns.
95
+ */
96
+ export function launch({ binary, args, env, platform, execve, spawnChild }) {
97
+ if (platform !== "win32" && typeof execve === "function") {
98
+ execve(binary, [binary, ...args], env);
99
+ return undefined;
100
+ }
101
+ return spawnChild(binary, args, env);
102
+ }
103
+
97
104
  function nodeOnlyVersion(launcher) {
98
105
  try {
99
106
  const manifest = JSON.parse(readFileSync(join(dirname(dirname(launcher)), "package.json"), "utf8"));
@@ -118,10 +125,24 @@ function main() {
118
125
  process.exit(1);
119
126
  }
120
127
 
121
- const child = spawn(found.binary, process.argv.slice(2), {
122
- stdio: "inherit",
123
- env: childEnv(process.env, { launcher, node: process.execPath }),
124
- });
128
+ try {
129
+ launch({
130
+ binary: found.binary,
131
+ args: process.argv.slice(2),
132
+ env: childEnv(process.env, { launcher }),
133
+ platform: process.platform,
134
+ execve: process.execve?.bind(process),
135
+ spawnChild: runChild,
136
+ });
137
+ } catch (error) {
138
+ console.error(`remote: could not run ${found.binary}: ${error.message}`);
139
+ process.exit(1);
140
+ }
141
+ }
142
+
143
+ /** The program as a child, where this process cannot become it. */
144
+ function runChild(binary, args, env) {
145
+ const child = spawn(binary, args, { stdio: "inherit", env });
125
146
 
126
147
  // Ctrl-C and Ctrl-\ reach the program from the terminal, which signals the
127
148
  // whole foreground group: this process only has to outlive it. A signal
@@ -135,7 +156,7 @@ function main() {
135
156
  for (const [signal, handler] of handlers) process.on(signal, handler);
136
157
 
137
158
  child.on("error", (error) => {
138
- console.error(`remote: could not run ${found.binary}: ${error.message}`);
159
+ console.error(`remote: could not run ${binary}: ${error.message}`);
139
160
  process.exit(1);
140
161
  });
141
162
  child.on("exit", (code, signal) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotehost/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Create, attach to, and manage RemoteHost sandboxes from your terminal.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://remotehost.ai",
@@ -29,13 +29,14 @@
29
29
  "README.md",
30
30
  "THIRD-PARTY-NOTICES.md",
31
31
  "bin/remote.js",
32
- "dist/node-commands.js"
32
+ "signatures/linux-arm64.sigstore.json",
33
+ "signatures/linux-x64.sigstore.json"
33
34
  ],
34
35
  "optionalDependencies": {
35
- "@remotehost/cli-darwin-arm64": "2.0.0",
36
- "@remotehost/cli-darwin-x64": "2.0.0",
37
- "@remotehost/cli-linux-x64": "2.0.0",
38
- "@remotehost/cli-linux-arm64": "2.0.0"
36
+ "@remotehost/cli-darwin-arm64": "2.0.2",
37
+ "@remotehost/cli-darwin-x64": "2.0.2",
38
+ "@remotehost/cli-linux-x64": "2.0.2",
39
+ "@remotehost/cli-linux-arm64": "2.0.2"
39
40
  },
40
41
  "remotehostCli": {
41
42
  "nodeOnlyVersion": "1.0.1"
@@ -0,0 +1 @@
1
+ {"mediaType":"application/vnd.dev.sigstore.bundle.v0.3+json","verificationMaterial":{"publicKey":{"hint":"yxz4W6FyCVHYNJVIpo4Qn3CLBisxu+HbxVDG5exLk50="}},"messageSignature":{"messageDigest":{"algorithm":"SHA2_256","digest":"JmhKtLnawxqGYqGZK9OULAJzAPRNU6rXBrl0hNxVxtI="},"signature":"MEUCIQDwdISi2/A7LREA1ON1mhliZmeoq9Dd3OUenrnKw/iCKQIgAi29jZmmFH8bLtfDtuAJXAjyGu8qO0Q2ZAjgeozx5TE="}}
@@ -0,0 +1 @@
1
+ {"mediaType":"application/vnd.dev.sigstore.bundle.v0.3+json","verificationMaterial":{"publicKey":{"hint":"yxz4W6FyCVHYNJVIpo4Qn3CLBisxu+HbxVDG5exLk50="}},"messageSignature":{"messageDigest":{"algorithm":"SHA2_256","digest":"rvBnJ0/uANAk6gMMUvMK80FTJsYrIE5lE8+vM6Vs74c="},"signature":"MEUCIQD/ExOvbyUaE6gS0OwSgFMu/zooyyITKq4JBpgh5in5kwIgY+4Pku6jo/sNAbs34ldP2/6tT5bztq+PZY77ewxPkYM="}}
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __createRequire } from 'node:module';
3
- const require = __createRequire(import.meta.url);
4
-
5
- // ../session/dist/index.js
6
- import { homedir } from "node:os";
7
- import { dirname, join } from "node:path";
8
- var REFRESH_SKEW_MS = 60 * 1e3;
9
- function configDir(env = process.env) {
10
- return env.REMOTEHOST_CONFIG_DIR?.trim() || join(homedir(), ".config", "remotehost");
11
- }
12
-
13
- // src/claims-removed.ts
14
- var CLAIMS_INSTALLED = ["check-commit", "check-push", "hook", "mcp"];
15
- var CLAIMS_REMOVED = [
16
- "Remotehost Claims has been removed from RemoteHost, and `{cli} claims` no longer does anything.",
17
- "",
18
- "This command now exits 0 whatever it is given, so that the hooks `{cli} claims init` and `{cli} claims integrate` installed do not block your commits, pushes or agents. It goes away in the next release, and those hooks will fail then, so remove them now:",
19
- "",
20
- '1. Git hooks. In each repository where you ran `{cli} claims init`, delete the pre-commit and pre-push hooks it wrote (they hold the line "# agentsync:managed") and put back any hook of yours it set aside as <hook>.agentsync-backup:',
21
- "",
22
- " hooks=$(git rev-parse --git-path hooks)",
23
- " for h in pre-commit pre-push; do",
24
- ' if grep -q \'# agentsync:managed\' "${hooks:?}/$h" 2>/dev/null; then rm "${hooks:?}/$h"; fi',
25
- ' if [ -e "${hooks:?}/$h.agentsync-backup" ]; then mv "${hooks:?}/$h.agentsync-backup" "${hooks:?}/$h"; fi',
26
- " done",
27
- "",
28
- ' A hook from an older release may already refuse a commit with "the agentsync CLI could not be found". AGENTSYNC_SKIP_HOOKS=1 gets past it until it is deleted.',
29
- "",
30
- '2. Repository files. Delete the .agentsync folder at the top of the repository and the agentsync folder inside its git directory (`git rev-parse --git-common-dir` prints that directory), and take the four .agentsync/ lines under "# Remotehost Claims runtime state" out of .gitignore.',
31
- "",
32
- '3. MCP server. Remove the server named "agentsync" from .mcp.json, .cursor/mcp.json and .vscode/mcp.json in the repository. If you ran `{cli} claims integrate`, remove it too from ~/.codeium/windsurf/mcp_config.json, ~/.gemini/settings.json and ~/.codex/config.toml (the [mcp_servers.agentsync] table).',
33
- "",
34
- '4. Claude Code hooks. If you ran `{cli} claims integrate`, remove the SessionStart, PreToolUse and SessionEnd hooks whose command ends in "claims hook claude-code" from .claude/settings.json in the repository, or from ~/.claude/settings.json if you installed them for every project.',
35
- "",
36
- "5. Sign-in cache. Delete {config}/claims-cache.json. Your `{cli} login` session is not affected."
37
- ].join("\n");
38
- var CLAIMS_REMOVED_HOOK = "{cli}: Remotehost Claims has been removed from RemoteHost, so this hook checks nothing, and it will fail once `{cli} claims` is gone in the next release. Run `{cli} claims` to see how to remove it.";
39
- function claimsRemovedNotice(cli, config = configDir()) {
40
- return `${CLAIMS_REMOVED.replaceAll("{cli}", cli).replaceAll("{config}", config)}
41
- `;
42
- }
43
- function claimsRemovedHookLine(cli) {
44
- return CLAIMS_REMOVED_HOOK.replaceAll("{cli}", cli);
45
- }
46
- function isInstalledClaimsRun(args) {
47
- const subcommand = args.find((word) => !word.startsWith("-"));
48
- return subcommand !== void 0 && CLAIMS_INSTALLED.includes(subcommand);
49
- }
50
- function printClaimsRemoved(cli, args) {
51
- if (isInstalledClaimsRun(args)) {
52
- process.stderr.write(`${claimsRemovedHookLine(cli)}
53
- `);
54
- } else {
55
- process.stdout.write(claimsRemovedNotice(cli));
56
- }
57
- }
58
-
59
- // src/node-commands.ts
60
- var cliName = process.env.REMOTEHOST_CLI_NAME?.trim() || "remote";
61
- var command = process.argv[2];
62
- if (command !== "claims") {
63
- console.error(`${cliName}: node-commands runs no command; \`${cliName}\` runs every command itself.`);
64
- process.exit(1);
65
- }
66
- printClaimsRemoved(cliName, process.argv.slice(3));