Skip to content

[FEAT] fresh-user origin accounts (claude/codex/gemini) - #22

Merged
gradyzhuo merged 7 commits into
mainfrom
feat/fresh-origin-account
Jul 7, 2026
Merged

[FEAT] fresh-user origin accounts (claude/codex/gemini)#22
gradyzhuo merged 7 commits into
mainfrom
feat/fresh-origin-account

Conversation

@gradyzhuo

Copy link
Copy Markdown
Member

Implements docs/superpowers/specs/2026-07-07-fresh-origin-account-design.md (spec + plan committed on this branch).

What

For a user who never used Orrery, takeover already moves ~/.<tool> into the origin workspace, but nothing created an account. This adds a tool-generic OriginAccountSeeder.seedOriginAccountsIfNeeded() (run from main.swift right before enforceOriginClaudeDir) that, per tool with no origin account and a capturable login:

  1. creates a fresh origin account,
  2. captures the existing login (codex/gemini: copy auth.json/oauth_creds.json via AccountLoginFlow.importFrom; macOS claude: copyKeychainItem from the default Claude Code-credentials service),
  3. pins it to the origin workspace,
  4. (claude only) runs ClaudeAccountMigration.migrateAccount → link-only account; enforceOriginClaudeDir then repoints ~/.claude.

Idempotent + best-effort; existing installs untouched (guarded on "no origin account"). New installs only.

Keychain testability

KeychainAccess is an injectable seam over ClaudeKeychain. Every seeder test injects a fake — the macOS login keychain is global and NOT isolated by ORRERY_HOME, so .live in a test creates stray Claude Code-orrery-* items. Verified: the seeder-only test run leaves the keychain item count unchanged.

Test plan

  • codex + gemini: origin account created, credential copied into the account dir, pin set (file-based, isolated)
  • claude: created + pinned + link-only (plugins mirrored) + keychain copied Claude Code-credentials → per-account service (fake keychain records the call)
  • guards: no-login → skip; existing origin account → no-op; twice → one account
  • full suite green (382)
  • binary end-to-end — deferred: the real binary's claude branch hits the real keychain (see the suite-wide keychain-pollution issue reported separately); unit coverage via fakes instead

🤖 Generated with Claude Code

gradyzhuo added 7 commits July 7, 2026 17:05
…keychain)

Adds the claude + idempotency/edge tests and fixes seedsCodex/seedsGemini to pass
a no-login fake keychain. The seeder loops all tools, so a real .live keychain in
any test lets the claude branch copy the real Claude Code-credentials item into a
stray per-account service — the macOS keychain is global and NOT isolated by
ORRERY_HOME. All seeder tests now inject a fake; verified the keychain item count
is unchanged across the run.
@gradyzhuo
gradyzhuo merged commit 7af346d into main Jul 7, 2026
1 check passed
@gradyzhuo
gradyzhuo deleted the feat/fresh-origin-account branch July 7, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant