Problem
Currently the CLI stores a single token at ~/.config/linear/token. Users with access to multiple Linear workspaces (e.g., corporate + personal) must log out and back in to switch between them.
Current State
The codebase already has some infrastructure for this:
WorkspaceConfig struct exists with per-workspace OAuth credentials
GetLinearCredentials(workspace string) method exists but isn't wired to CLI
- Token storage in
internal/token/storage.go is hardcoded to single path
Proposed Solution
Add profile-based multi-account support:
Token Storage:
~/.config/linear/tokens/
├── default.json
├── work.json
└── personal.json
Config:
default_profile: work
profiles:
work:
name: "Corporate"
oauth: { client_id: ..., client_secret: ... }
personal:
name: "Personal"
oauth: { client_id: ..., client_secret: ... }
Commands:
linear profile list # List profiles
linear profile use <name> # Set default
linear profile add <name> # Add new profile
linear profile remove <name> # Remove profile
UX Decision Needed
- Per-directory
.linear-profile files - Auto-detect profile based on cwd (like .nvmrc)
- Global default + switch -
linear profile use <name> sets default, no flags needed
- Both - Per-directory with global fallback
Files to Modify
internal/token/storage.go - Profile-aware token paths
internal/config/manager.go - Profile config types
internal/cli/root.go - Profile flag/detection
internal/cli/auth.go - Profile-aware auth
internal/cli/profile.go (new) - Profile commands
Migration
Automatically migrate existing token to tokens/default.json on first run.
Problem
Currently the CLI stores a single token at
~/.config/linear/token. Users with access to multiple Linear workspaces (e.g., corporate + personal) must log out and back in to switch between them.Current State
The codebase already has some infrastructure for this:
WorkspaceConfigstruct exists with per-workspace OAuth credentialsGetLinearCredentials(workspace string)method exists but isn't wired to CLIinternal/token/storage.gois hardcoded to single pathProposed Solution
Add profile-based multi-account support:
Token Storage:
Config:
Commands:
UX Decision Needed
.linear-profilefiles - Auto-detect profile based on cwd (like.nvmrc)linear profile use <name>sets default, no flags neededFiles to Modify
internal/token/storage.go- Profile-aware token pathsinternal/config/manager.go- Profile config typesinternal/cli/root.go- Profile flag/detectioninternal/cli/auth.go- Profile-aware authinternal/cli/profile.go(new) - Profile commandsMigration
Automatically migrate existing
tokentotokens/default.jsonon first run.