@genrupt/cli 0.1.2 → 0.1.3

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
@@ -10,7 +10,7 @@ Use this when setting up Genrupt for an agent:
10
10
  npx -y @genrupt/cli@latest agent install
11
11
  ```
12
12
 
13
- This installs or updates the global CLI, checks auth, installs Genrupt skills for the detected agent, and writes a local runtime manifest.
13
+ This checks auth, installs Genrupt skills for the detected agent, and writes a local runtime manifest. It also tries to install or update the global CLI, but global npm install failures do not block the skills/runtime setup; use the printed `npx` commands when global npm install is restricted on the machine.
14
14
 
15
15
  ## Install
16
16
 
@@ -52,6 +52,8 @@ genrupt mcp serve
52
52
 
53
53
  Claude Code can then call Genrupt from chat while the local process can read user-approved local file paths.
54
54
 
55
+ If the global `genrupt` command is unavailable, setup registers the bridge through `npx -y @genrupt/cli@latest` so Claude Code can still start it.
56
+
55
57
  ## Doctor
56
58
 
57
59
  ```bash
package/dist/agent.js CHANGED
@@ -30,7 +30,7 @@ async function runCommand(command, args, timeoutMs = 120_000) {
30
30
  async function getGlobalNodeModulesPath() {
31
31
  return runCommand("npm", ["root", "-g"]);
32
32
  }
33
- async function getGlobalCliPackageVersion() {
33
+ export async function getGlobalCliPackageVersion() {
34
34
  try {
35
35
  const globalRoot = await getGlobalNodeModulesPath();
36
36
  const packageJsonPath = path.join(globalRoot, "@genrupt", "cli", "package.json");
@@ -48,7 +48,7 @@ async function ensureGlobalCli(minimumVersion) {
48
48
  const currentVersion = await getGlobalCliPackageVersion();
49
49
  if (currentVersion && isVersionAtLeast(currentVersion, minimumVersion)) {
50
50
  console.log(`Genrupt CLI is installed globally (${currentVersion}).`);
51
- return;
51
+ return true;
52
52
  }
53
53
  const reason = currentVersion
54
54
  ? `Global Genrupt CLI ${currentVersion} is below required ${minimumVersion}.`
@@ -60,15 +60,18 @@ async function ensureGlobalCli(minimumVersion) {
60
60
  }
61
61
  catch (error) {
62
62
  const message = error instanceof Error ? error.message : String(error);
63
- throw new Error(`Could not install ${CLI_PACKAGE_NAME}@latest globally.\n${message}\n` +
64
- `Run manually: npm install -g ${CLI_PACKAGE_NAME}@latest`);
63
+ console.log(`Could not install ${CLI_PACKAGE_NAME}@latest globally.\n${message}\n` +
64
+ "Continuing with the current npx CLI run.");
65
+ return false;
65
66
  }
66
67
  const nextVersion = await getGlobalCliPackageVersion();
67
68
  if (!nextVersion || !isVersionAtLeast(nextVersion, minimumVersion)) {
68
- throw new Error(`Global ${CLI_PACKAGE_NAME} did not report a usable version after install.\n` +
69
- `Run manually: npm install -g ${CLI_PACKAGE_NAME}@latest`);
69
+ console.log(`Global ${CLI_PACKAGE_NAME} did not report a usable version after install.\n` +
70
+ "Continuing with the current npx CLI run.");
71
+ return false;
70
72
  }
71
73
  console.log(`Genrupt CLI is installed globally (${nextVersion}).`);
74
+ return true;
72
75
  }
73
76
  async function ensureAuth(options) {
74
77
  try {
@@ -87,6 +90,7 @@ export async function installAgentRuntime(options = {}) {
87
90
  let stage = "download_runtime";
88
91
  let runtimeVersion;
89
92
  let requiredCliVersion;
93
+ let globalCliReady = Boolean(options.skipGlobalInstall);
90
94
  await emitRuntimeTelemetry({
91
95
  eventType: "agent_install_started",
92
96
  command: "agent_install",
@@ -102,7 +106,7 @@ export async function installAgentRuntime(options = {}) {
102
106
  requiredCliVersion = runtime.requiresCliVersion;
103
107
  if (!options.skipGlobalInstall) {
104
108
  stage = "global_cli_install";
105
- await ensureGlobalCli(runtime.requiresCliVersion);
109
+ globalCliReady = await ensureGlobalCli(runtime.requiresCliVersion);
106
110
  }
107
111
  if (!options.skipAuth) {
108
112
  stage = "auth";
@@ -128,6 +132,7 @@ export async function installAgentRuntime(options = {}) {
128
132
  stage,
129
133
  skipAuth: Boolean(options.skipAuth),
130
134
  skipGlobalInstall: Boolean(options.skipGlobalInstall),
135
+ globalCliReady,
131
136
  },
132
137
  }, { origin });
133
138
  throw error;
@@ -142,8 +147,17 @@ export async function installAgentRuntime(options = {}) {
142
147
  metadata: {
143
148
  skipAuth: Boolean(options.skipAuth),
144
149
  skipGlobalInstall: Boolean(options.skipGlobalInstall),
150
+ globalCliReady,
145
151
  },
146
152
  }, { origin });
147
153
  console.log();
148
154
  console.log("Genrupt agent runtime is ready.");
155
+ if (!globalCliReady) {
156
+ console.log();
157
+ console.log("Global CLI install was not completed. Use npx commands on this machine:");
158
+ console.log(` npx -y ${CLI_PACKAGE_NAME}@latest doctor`);
159
+ console.log(` npx -y ${CLI_PACKAGE_NAME}@latest setup claude-code`);
160
+ console.log();
161
+ console.log(`To repair the global command later: npm install -g ${CLI_PACKAGE_NAME}@latest`);
162
+ }
149
163
  }
package/dist/constants.js CHANGED
@@ -3,5 +3,5 @@ export const DEFAULT_MCP_SERVER_URL = `${DEFAULT_ORIGIN}/api/agent/mcp`;
3
3
  export const OAUTH_DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
4
4
  export const OAUTH_SCOPE = "mcp";
5
5
  export const CLI_CLIENT_NAME = "Genrupt CLI";
6
- export const CLI_VERSION = "0.1.2";
6
+ export const CLI_VERSION = "0.1.3";
7
7
  export const ACCESS_TOKEN_REFRESH_SKEW_MS = 60_000;
package/dist/setup.js CHANGED
@@ -1,14 +1,33 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { assertLoggedIn } from "./auth.js";
3
+ import { CLI_VERSION } from "./constants.js";
4
+ import { getGlobalCliPackageVersion } from "./agent.js";
5
+ import { CLI_PACKAGE_NAME, isVersionAtLeast } from "./version.js";
3
6
  function runClaude(args) {
4
7
  return spawnSync("claude", args, {
5
8
  stdio: "inherit",
6
9
  shell: process.platform === "win32",
7
10
  });
8
11
  }
12
+ async function resolveBridgeCommand() {
13
+ const globalVersion = await getGlobalCliPackageVersion();
14
+ if (globalVersion && isVersionAtLeast(globalVersion, CLI_VERSION)) {
15
+ return {
16
+ command: ["genrupt", "mcp", "serve"],
17
+ usingGlobalCli: true,
18
+ globalVersion,
19
+ };
20
+ }
21
+ return {
22
+ command: ["npx", "-y", `${CLI_PACKAGE_NAME}@latest`, "mcp", "serve"],
23
+ usingGlobalCli: false,
24
+ globalVersion,
25
+ };
26
+ }
9
27
  export async function setupClaudeCode(options = {}) {
10
28
  await assertLoggedIn();
11
29
  const scope = options.scope ?? "user";
30
+ const bridgeCommand = await resolveBridgeCommand();
12
31
  if (options.replace) {
13
32
  runClaude(["mcp", "remove", "genrupt"]);
14
33
  }
@@ -21,9 +40,7 @@ export async function setupClaudeCode(options = {}) {
21
40
  scope,
22
41
  "genrupt",
23
42
  "--",
24
- "genrupt",
25
- "mcp",
26
- "serve",
43
+ ...bridgeCommand.command,
27
44
  ];
28
45
  const result = runClaude(args);
29
46
  if (result.error || result.status !== 0) {
@@ -40,5 +57,10 @@ export async function setupClaudeCode(options = {}) {
40
57
  }
41
58
  console.log();
42
59
  console.log("Genrupt local MCP bridge is installed for Claude Code.");
60
+ if (!bridgeCommand.usingGlobalCli) {
61
+ console.log(bridgeCommand.globalVersion
62
+ ? `Global Genrupt CLI ${bridgeCommand.globalVersion} is below ${CLI_VERSION}, so Claude Code will launch the bridge with npx.`
63
+ : "No usable global Genrupt CLI was found, so Claude Code will launch the bridge with npx.");
64
+ }
43
65
  console.log("Start a new Claude Code chat, then ask Genrupt to upload local product files or run a workflow.");
44
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genrupt/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Genrupt CLI for OAuth login, local file uploads, and local MCP bridge setup.",
5
5
  "license": "MIT",
6
6
  "repository": {