run402 3.8.1 → 3.8.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.
@@ -393,8 +393,19 @@ export function detectInstallContext({
393
393
  const executableUnderProject = projectRoot ? isPathInside(executable, projectRoot) : false;
394
394
  const localNodeModules = executableUnderProject &&
395
395
  (containsPathSegment(executable, "node_modules") || command === "yarn_pnp");
396
-
397
- if (command === "npx" || command === "npm_exec" || command === "bunx") {
396
+ const packageManagerShim = isPackageManagerShim(executable);
397
+ const globalRun402Path = looksLikeGlobalRun402Path(executable, env, platform);
398
+ const explicitNpxCachePath = containsPathSegment(executable, "_npx");
399
+ const packageExecUsesDeclaredRun402 = run402Declared &&
400
+ !globalRun402Path &&
401
+ !explicitNpxCachePath &&
402
+ (localNodeModules ||
403
+ packageManagerShim ||
404
+ command === "npm_exec" ||
405
+ command === "yarn_pnp" ||
406
+ command === "direct");
407
+
408
+ if (!packageExecUsesDeclaredRun402 && (command === "npx" || command === "npm_exec" || command === "bunx")) {
398
409
  return {
399
410
  kind: "ephemeral_exec",
400
411
  confidence: command === "npx" || command === "bunx" ? "high" : "medium",
@@ -405,22 +416,25 @@ export function detectInstallContext({
405
416
  };
406
417
  }
407
418
 
408
- if (localNodeModules || (command === "yarn_pnp" && run402Declared)) {
419
+ if (packageExecUsesDeclaredRun402) {
409
420
  return {
410
421
  kind: "local_project",
411
- confidence: run402Declared || localNodeModules ? "high" : "medium",
422
+ confidence: localNodeModules || packageManagerShim ? "high" : "medium",
412
423
  package_manager: packageManager.name,
413
424
  cwd: packageInfo?.dir ?? resolvedCwd,
414
425
  package_root: packageInfo?.dir ?? nearestPackageInfo?.dir ?? null,
415
426
  reasons: [
416
- localNodeModules ? "project_node_modules" : "yarn_pnp",
417
- ...(run402Declared ? ["package_declares_run402"] : []),
427
+ ...(localNodeModules ? ["project_node_modules"] : []),
428
+ ...(packageManagerShim ? ["package_manager_shim"] : []),
429
+ ...(command === "npm_exec" ? ["package_manager_exec"] : []),
430
+ ...(command === "yarn_pnp" ? ["yarn_pnp"] : []),
431
+ "package_declares_run402",
418
432
  ...(workspacePackageInfo && workspacePackageInfo !== nearestPackageInfo ? ["workspace_root"] : []),
419
433
  ],
420
434
  };
421
435
  }
422
436
 
423
- if (looksLikeGlobalRun402Path(executable, env, platform)) {
437
+ if (globalRun402Path) {
424
438
  return {
425
439
  kind: "global_npm",
426
440
  confidence: "high",
@@ -442,7 +456,7 @@ export function detectInstallContext({
442
456
  };
443
457
  }
444
458
 
445
- if (isPackageManagerShim(executable)) {
459
+ if (packageManagerShim) {
446
460
  return {
447
461
  kind: "package_manager_shim",
448
462
  confidence: "low",
@@ -222,6 +222,28 @@ describe("CLI install-context detection", () => {
222
222
  assert.equal(action.mutates_project, true);
223
223
  }));
224
224
 
225
+ it("treats package-declared shims and pnpm exec as local project installs", () => withTemp((dir) => {
226
+ packageJson(dir, { packageManager: "npm@11.0.0", devDependencies: { run402: "3.7.14" } });
227
+ let install = detectInstallContext({
228
+ cwd: dir,
229
+ execPath: "node_modules/.bin/run402",
230
+ env: {},
231
+ });
232
+ assert.equal(install.kind, "local_project");
233
+ assert.equal(install.package_manager, "npm");
234
+ assert.deepEqual(upgradeNextActions({ install })[0].argv, ["npm", "install", "-D", "run402@latest"]);
235
+
236
+ packageJson(dir, { packageManager: "pnpm@10.0.0", devDependencies: { run402: "3.7.14" } });
237
+ install = detectInstallContext({
238
+ cwd: dir,
239
+ execPath: "/opt/pnpm/run402",
240
+ env: { npm_command: "exec", npm_config_user_agent: "pnpm/10.0.0 npm/? node/v22" },
241
+ });
242
+ assert.equal(install.kind, "local_project");
243
+ assert.equal(install.package_manager, "pnpm");
244
+ assert.deepEqual(upgradeNextActions({ install })[0].argv, ["pnpm", "add", "-D", "run402@latest"]);
245
+ }));
246
+
225
247
  it("uses packageManager over conflicting lockfiles and gives custom paths low-confidence doctor guidance", () => withTemp((dir) => {
226
248
  packageJson(dir, { packageManager: "pnpm@10.0.0" });
227
249
  writeFileSync(join(dir, "package-lock.json"), "{}");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "3.8.1",
3
+ "version": "3.8.3",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 and MPP micropayments.",
5
5
  "type": "module",
6
6
  "bin": {