Repository navigation
fix(claude-as): --add keeps only the login it asked for, and --tidy repairs the homes retries left - #83
Open
gutyoh wants to merge 1 commit into
Open
fix(claude-as): --add keeps only the login it asked for, and --tidy repairs the homes retries left#83gutyoh wants to merge 1 commit into
gutyoh wants to merge 1 commit into
Conversation
…epairs the homes retries left --add signed in straight into ~/.claude-<email>. When the browser signed in another account, or the sign-in was left unfinished, that home stayed behind under the wrong name, and each retry made the next one: -2, -3, -4. One machine ended up with its team account in -3, beside two homes holding the personal account and one holding nothing. - --add signs in in a staging folder and names the home only once the login is that email. Anything else leaves nothing behind. A second organization of one email is ~/.claude-<email>-<org>, never a number. - --tidy [--dry-run] archives signed-out and duplicate homes (history kept, credentials deleted, not revoked) and renames misnamed ones after their login, with the macOS Keychain item named after the path. A name without an email (~/.claude-work) stays. A home a running process holds is never archived; it is renamed only when its login is a .credentials.json, and the running sessions follow a link at the old path, dropped by a later --tidy. - Session records follow a renamed or archived home, so -r resumes in the right place. - --check names a misnamed or duplicate home and the command that fixes it. Tests: 31 new or rewritten bats cases (102 in claude-as.bats, all passing, also under macOS bash 3.2). Smoke-tested on guty-arm64-rig: the four retries became ~/.claude (personal) and ~/.claude-hermann.g.rosch@tafitech.io (team), with six live sessions running on through the link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
claude-as --addsigned in straight into~/.claude-<email>. When the browser signed in another account, or the sign-in was left unfinished, that home stayed behind under the wrong name, and each retry created the next one:-2,-3,-4. On guty-arm64-rig the team account ended up in~/.claude-hermann.g.rosch@tafitech.io-3. The base name and-2held the personal account (one signed out), and-4held nothing.Change
--addsigns in inside a staging folder and names the home only once the login is that email. A wrong account or an unfinished sign-in leaves nothing behind. A second organization of one email becomes~/.claude-<email>-<org>, never a number.--tidy [--dry-run]:~/.local/state/claude-as/removed/. History is kept; credentials are deleted, not revoked.~/.claude-work) alone..credentials.json; running sessions then follow a link at the old path, which a later--tidydrops. A Keychain login cannot be shared that way, so that home waits until its sessions end.-rresumes in the right place.--checknames a misnamed or duplicate home and the command that fixes it.A cross-review from the devbox session found 8 points. All are applied, with one adapted: a home in use is renamed only for a file-based login.
Tests
tests/claude-as.batsnow has 102 cases, 31 of them new or rewritten. All pass, including under macOS's stock bash 3.2. The new cases cover the wrong-browser, unfinished and retry paths, every--tidypath, the Keychain (moved via stdin, never on a command line; locked over SSH), ledger retargeting, and a replay of the four homes on guty-arm64-rig.just lintandjust format-checkare clean.just testalso fails two tests (portability.bats"setup.sh --minimal completes under stock macOS bash 3.2" andstatusline-forecast.bats"the mod's forecast wins..."). Both fail onmaintoo.--tidyarchived the signed-out base home and the empty-4, and renamed-3to~/.claude-hermann.g.rosch@tafitech.io.auth statusthere is signed in as the team account, and--where -rpoints at the new home.--move --dry-runshows all six sessions already on the account.-2, a duplicate of the personal login, was left alone because herdr and KDE Connect still carry it in their environment.🤖 Generated with Claude Code