Files
Mert Koseoglu 73955f34f7 fix(cli): rewrite stale shell snapshots during /ctx-upgrade (#710 Layer 1)
After the in-place file copy + hooks.json normalize, call
`rewriteShellSnapshots` against `~/.claude/shell-snapshots/` so the
PATH entries of every per-session snapshot bump to `newVersion`.

This is the upgrade-time arm of the fix. Without it, every Bash tool
call in the active session keeps `source`-ing a snapshot whose PATH
points at the deleted previous-version cache dir, surfacing
"Plugin directory does not exist" errors until session restart.

Gated to `detection.platform === "claude-code"` — no other adapter
writes `~/.claude/shell-snapshots`. Codex, Cursor, Gemini, Kimi,
etc. spawn Bash directly and are not affected by this bug class.

Placed AFTER `normalizeHooksJsonOnly` (PR #728's narrow heal) per
the issue charter — the two layers operate on independent surfaces
and the order is byte-irrelevant, but keeping snapshot heal last
makes the upgrade log read in cause-and-effect order.

Best-effort, idempotent, never throws — the upgrade pipeline cannot
regress on a snapshot-heal failure.

Archaeology: PR #728 (a342dd5) set the precedent for narrow
post-bump heal calls; PR #559 (4f68bd5) introduced the mid-session
upgrade lifecycle that makes stale snapshots possible.
2026-05-31 17:44:16 +03:00
..
2026-05-03 00:05:27 +03:00