Skip to content

Add namespace switching with multi-profile support#766

Closed
smithery[bot] wants to merge 2 commits into
mainfrom
factory/smi-1872
Closed

Add namespace switching with multi-profile support#766
smithery[bot] wants to merge 2 commits into
mainfrom
factory/smi-1872

Conversation

@smithery
Copy link
Copy Markdown

@smithery smithery Bot commented May 6, 2026

Summary

  • Enable users to switch between personal and organization namespaces without re-authenticating
  • Store multiple credential profiles locally for fast switching
  • Add smithery namespace switch <name> command
  • Update smithery namespace list to show cached profiles
  • Update smithery auth whoami to list available profiles
  • Add --all flag to smithery auth logout for clearing all profiles

Implementation Details

  • Extended Settings interface to support a profiles map keyed by namespace name
  • Each profile contains apiKey, namespace, and authOrganization
  • Login flow automatically saves credentials as named profiles
  • Switch command validates profile exists locally before switching
  • Backwards compatible with existing settings format

Test plan

  • All existing tests pass
  • Added comprehensive tests for profile switching logic
  • Type checking passes
  • Code formatted with biome

Related

Implements: SMI-1872

🤖 Generated with Factory

Smithery Factory and others added 2 commits May 6, 2026 22:57
Enable users to switch between personal and organization namespaces
without re-authenticating by storing multiple credential profiles locally.

Changes:
- Extended Settings interface to support a profiles map
- Added saveProfile, getProfile, getProfiles, switchProfile, and removeProfile helpers
- Created 'smithery namespace switch <name>' command for fast profile switching
- Modified handleLogin to save credentials as named profiles
- Updated listNamespaces to show cached profiles alongside remote namespaces
- Updated handleWhoami to list available cached profiles
- Enhanced handleLogout to support profile-aware logout (--all flag for clearing all profiles)
- Added comprehensive tests for profile switching logic
- Updated README.md with multi-profile workflow documentation

Implements: SMI-1872
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@gurdasnijor
Copy link
Copy Markdown
Contributor

🤖 Factory council review

Tally: 1 approve · 1 reject · 0 neutral · 1 errored

claude-opus-4-7 — reject (score 0.35)

The handleLogout --all path in src/index.ts duplicates getSettingsPath logic inline and writes settings.json directly via fs, bypassing the saveSettings helper—this is a maintenance hazard and risks divergence from the canonical settings writer (e.g., schema/migration handling). Worse, the existing clearApiKey/clearNamespace/clearAuthOrganization calls already mutate and persist settings, then the inline write uses initResult.data captured before those clears, which can re-persist stale apiKey/namespace/authOrganization fields and undo the logout. Several new exported functions (saveProfile, removeProfile, switchProfile) also lack direct unit tests—the new test file only asserts on mocks of these functions rather than their real behavior.

claude-sonnet-4-6 — approve (score 0.78)

The diff fully implements the ticket requirements: new smithery namespace switch <name> command (switch.ts + index.ts export + src/index.ts wiring), --all flag on logout, whoami profile listing, and list cached-column. The settings layer additions (saveProfile, getProfile, getProfiles, switchProfile, removeProfile) are backwards-compatible via the optional profiles? field. Tests in namespace-switch.test.ts cover success, missing-profile error, available-profiles display, empty-profiles fallback, and removeProfile call. One minor concern: the --all logout path re-implements the settings file path resolution inline instead of calling the existing getSettingsPath() helper, which is a maintainability smell but not a production regression since the logic is identical.

claude-haiku-4-5-20251001 — errored (score 0.00)

reviewer threw: flamecast think 502: error code: 502

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