claude-multiacc 2.0.4 → 2.0.5

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.
@@ -2351,6 +2351,15 @@ cmd_self_update() {
2351
2351
  ulog "self-update: no npm found (looked in $prefix/bin, /opt/homebrew/bin, /usr/local/bin, /usr/bin, PATH); skipping"
2352
2352
  return 0
2353
2353
  }
2354
+ # Finding npm is not the same as being able to RUN it: npm ships as
2355
+ # `#!/usr/bin/env node`, so an agent PATH without the node that owns it makes
2356
+ # every invocation die with "env: node: No such file or directory" — and npm
2357
+ # exits 0 on that, so the version probe just came back empty and the update
2358
+ # "failed" with nothing to explain it. node lives beside npm, so every npm call
2359
+ # below runs with that directory in front (command-scoped: nothing else in this
2360
+ # process has its PATH changed underneath it).
2361
+ local npm_path
2362
+ npm_path="$(dirname "$npm_bin"):$PATH"
2354
2363
  # Update THE COPY THAT IS RUNNING, not whichever one the ambient npm prefix
2355
2364
  # happens to point at. my-mini had two global installs — homebrew's on PATH and
2356
2365
  # nvm's under `npm root -g` — and self-update kept upgrading the nvm one and
@@ -2359,13 +2368,13 @@ cmd_self_update() {
2359
2368
  # A deploy nobody runs is not a deploy, and one that announces success is worse
2360
2369
  # than one that fails.
2361
2370
  cur="$(pkg_version_at "$REPO_DIR")"
2362
- lat="$("$npm_bin" view claude-multiacc version 2>/dev/null)"
2371
+ lat="$(PATH="$npm_path" "$npm_bin" view claude-multiacc version 2>/dev/null)"
2363
2372
  if [ -n "$lat" ] && [ "$cur" = "$lat" ]; then
2364
2373
  ulog "self-update: already latest ($cur)"
2365
2374
  return 0
2366
2375
  fi
2367
2376
  ulog "self-update: npm $cur -> ${lat:-latest} (prefix $prefix, npm $npm_bin)"
2368
- if "$npm_bin" install -g --prefix "$prefix" claude-multiacc@latest \
2377
+ if PATH="$npm_path" "$npm_bin" install -g --prefix "$prefix" claude-multiacc@latest \
2369
2378
  >>"$ACC_ROOT/update.log" 2>&1; then
2370
2379
  # Verify by re-reading the file on disk. npm reporting success says nothing
2371
2380
  # about which tree it wrote to.
@@ -1899,14 +1899,23 @@ cmd_self_update() {
1899
1899
  ulog "self-update: no npm found (looked in $prefix/bin, /opt/homebrew/bin, /usr/local/bin, /usr/bin, PATH); skipping"
1900
1900
  return 0
1901
1901
  }
1902
+ # Finding npm is not the same as being able to RUN it: npm ships as
1903
+ # `#!/usr/bin/env node`, so an agent PATH without the node that owns it makes
1904
+ # every invocation die with "env: node: No such file or directory" — and npm
1905
+ # exits 0 on that, so the version probe just came back empty and the update
1906
+ # "failed" with nothing to explain it. node lives beside npm, so every npm call
1907
+ # below runs with that directory in front (command-scoped: nothing else in this
1908
+ # process has its PATH changed underneath it).
1909
+ local npm_path
1910
+ npm_path="$(dirname "$npm_bin"):$PATH"
1902
1911
  cur="$(pkg_version_at "$REPO_DIR")"
1903
- lat="$("$npm_bin" view claude-multiacc version 2>/dev/null)"
1912
+ lat="$(PATH="$npm_path" "$npm_bin" view claude-multiacc version 2>/dev/null)"
1904
1913
  if [ -n "$lat" ] && [ "$cur" = "$lat" ]; then
1905
1914
  ulog "self-update: already latest ($cur)"
1906
1915
  return 0
1907
1916
  fi
1908
1917
  ulog "self-update: npm $cur -> ${lat:-latest} (prefix $prefix, npm $npm_bin)"
1909
- if "$npm_bin" install -g --prefix "$prefix" claude-multiacc@latest \
1918
+ if PATH="$npm_path" "$npm_bin" install -g --prefix "$prefix" claude-multiacc@latest \
1910
1919
  >>"$ACC_ROOT/update.log" 2>&1; then
1911
1920
  after="$(pkg_version_at "$REPO_DIR")"
1912
1921
  if [ -n "$lat" ] && [ "$after" != "$lat" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-multiacc",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Unified Claude Code and OpenAI Codex subscription pooling with quota-aware selection.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2451,8 +2451,17 @@ if command -v node >/dev/null 2>&1; then
2451
2451
  mkdir -p "$NPMROOT" "$PFX/bin"
2452
2452
  cp -R "$REPO_DIR/bin" "$REPO_DIR/lib" "$REPO_DIR/package.json" "$NPMROOT/"
2453
2453
  # A fake npm that records how it was called and "installs" by bumping package.json.
2454
- cat > "$PFX/bin/npm" <<NPMEOF
2454
+ # Its shebang names an interpreter that exists ONLY beside it, mirroring the real
2455
+ # npm's `#!/usr/bin/env node`: resolving npm by absolute path is not enough if the
2456
+ # agent's PATH cannot find npm's own interpreter, which is how the update failed
2457
+ # with an empty version probe and no explanation.
2458
+ cat > "$PFX/bin/multiacc-fake-node" <<'NODEEOF'
2455
2459
  #!/usr/bin/env bash
2460
+ exec /bin/bash "$@"
2461
+ NODEEOF
2462
+ chmod +x "$PFX/bin/multiacc-fake-node"
2463
+ cat > "$PFX/bin/npm" <<NPMEOF
2464
+ #!/usr/bin/env multiacc-fake-node
2456
2465
  echo "npm \$*" >> "$WORK/npm-calls-$_cli.log"
2457
2466
  case "\${1:-}" in
2458
2467
  view) echo 9.9.9 ;;
@@ -2488,6 +2497,9 @@ NPMEOF
2488
2497
  && t_fail "$_cli npm choice" "used the npm from PATH instead of the running prefix's" \
2489
2498
  || t_ok "$_cli: a stray npm on PATH never wins over the running prefix's"
2490
2499
  check "$_cli: self-update verifies the tree it wrote" "npm update ok (9.9.9)" "$out"
2500
+ grep -q "^npm view " "$WORK/npm-calls-$_cli.log" \
2501
+ && t_ok "$_cli: npm ran despite its interpreter being off PATH" \
2502
+ || t_fail "$_cli npm interpreter" "npm never executed — its shebang interpreter was not found"
2491
2503
  done
2492
2504
  # The agents install.sh writes must carry a PATH for the same reason (a future tool
2493
2505
  # that is not resolved by absolute path would hit exactly this again).