Skip to content

Feature: Support multiple Linear accounts via profiles #2

@jzillmann

Description

@jzillmann

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

  1. Per-directory .linear-profile files - Auto-detect profile based on cwd (like .nvmrc)
  2. Global default + switch - linear profile use <name> sets default, no flags needed
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions