claude-multiacc 1.0.18 → 1.0.19

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.
@@ -2206,6 +2206,13 @@ cmd_post_sync() {
2206
2206
  cmd_verify --quick
2207
2207
  }
2208
2208
 
2209
+ # Version of the copy at $1, read from its package.json on disk — the only answer
2210
+ # that describes what will actually execute.
2211
+ pkg_version_at() {
2212
+ [ -f "$1/package.json" ] || return 0
2213
+ sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$1/package.json" | head -1
2214
+ }
2215
+
2209
2216
  cmd_self_update() {
2210
2217
  # Update the addon in place. npm global install => npm i -g @latest (its postinstall
2211
2218
  # re-runs install.sh). git checkout => git pull + ./install.sh. Anything else is a
@@ -2217,16 +2224,32 @@ cmd_self_update() {
2217
2224
  case "$REPO_DIR" in
2218
2225
  */node_modules/claude-multiacc|*/node_modules/claude-multiacc/*)
2219
2226
  command -v npm >/dev/null 2>&1 || { ulog "self-update: npm not found; skipping"; return 0; }
2220
- local cur lat
2221
- cur="$(npm ls -g --depth=0 claude-multiacc 2>/dev/null | sed -n 's/.*claude-multiacc@//p' | head -1)"
2227
+ local cur lat prefix after
2228
+ # Update THE COPY THAT IS RUNNING, not whichever one the ambient npm prefix
2229
+ # happens to point at. my-mini had two global installs — homebrew's on PATH and
2230
+ # nvm's under `npm root -g` — and self-update kept upgrading the nvm one and
2231
+ # reporting success while every `claude` invocation ran the stale homebrew copy.
2232
+ # It sat eleven versions behind for weeks and said "already latest" throughout.
2233
+ # A deploy nobody runs is not a deploy, and one that announces success is worse
2234
+ # than one that fails.
2235
+ prefix="${REPO_DIR%/lib/node_modules/claude-multiacc*}"
2236
+ cur="$(pkg_version_at "$REPO_DIR")"
2222
2237
  lat="$(npm view claude-multiacc version 2>/dev/null)"
2223
2238
  if [ -n "$lat" ] && [ "$cur" = "$lat" ]; then
2224
2239
  ulog "self-update: already latest ($cur)"
2225
2240
  return 0
2226
2241
  fi
2227
- ulog "self-update: npm $cur -> ${lat:-latest}"
2228
- if npm install -g claude-multiacc@latest >>"$ACC_ROOT/update.log" 2>&1; then
2229
- ulog "self-update: npm update ok"
2242
+ ulog "self-update: npm $cur -> ${lat:-latest} (prefix $prefix)"
2243
+ if npm install -g --prefix "$prefix" claude-multiacc@latest \
2244
+ >>"$ACC_ROOT/update.log" 2>&1; then
2245
+ # Verify by re-reading the file on disk. npm reporting success says nothing
2246
+ # about which tree it wrote to.
2247
+ after="$(pkg_version_at "$REPO_DIR")"
2248
+ if [ -n "$lat" ] && [ "$after" != "$lat" ]; then
2249
+ ulog "self-update: npm reported success but $REPO_DIR is still $after, not $lat — this install is NOT being updated"
2250
+ return 1
2251
+ fi
2252
+ ulog "self-update: npm update ok ($after)"
2230
2253
  else
2231
2254
  ulog "self-update: npm update FAILED (see update.log)"
2232
2255
  return 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-multiacc",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Multi-account addon for Claude Code and OpenAI Codex CLI: every claude / claude -p and every codex / codex exec runs under a randomly-picked subscription account with the most usage headroom. Mirrors to a deploy server. No API keys.",
5
5
  "type": "module",
6
6
  "bin": {