feat: multi-profile auth via --profile flag#127
Merged
Conversation
Add `--profile <name>` global flag to switch between multiple API tokens stored as `~/.linear_api_token_<name>` files. Profiles are just named token files — no config format, no new dependencies. SDK breaking changes: - Remove `Client::auto()`, `Client::from_file()`, `auth::auto_token()` - Add `Client::from_token_file(&Path)`, change `auth::token_from_file()` to accept `&Path` — SDK is now path-agnostic, CLI owns conventions CLI: - `--profile` conflicts with `--api-token` (clap hard error) - `--profile default` maps to `~/.linear_api_token` - `--profile` skips env var — goes straight to the named file - Actionable error messages when profile file is missing - `lineark usage` shows active profile and available alternatives Closes #126
- Extract profile.rs module from inline code in main.rs and usage.rs - Remove `home` crate from SDK (no longer needed since SDK is path-agnostic) - Add test helper `lineark_with_profiles()` to reduce test boilerplate - Add edge-case tests: hyphenated names, dotted names, whitespace-only tokens - Fix stale SDK API references in MASTERPLAN.md and top-level README - Fix mutation signatures in SDK README (comment_update, comment_resolve, issue_label_create, issue_label_update) - Document --profile feature in CLI README and top-level README
This was referenced Mar 8, 2026
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.
Summary
Closes #126
--profile <name>global flag to switch between API tokens stored as~/.linear_api_token_<name>files--profile defaultmaps to~/.linear_api_tokenfor consistency--profileand--api-tokenare mutually exclusive (clap hard error)--profileskips the env var — goes straight to the named filelineark usageshows active profile and other available profiles on line 3SDK breaking changes:
Client::auto(),Client::from_file(),auth::auto_token(),auth::token_file_path()Client::from_token_file(&Path), changeauth::token_from_file()to accept&Path~/.linear_api_tokenconvention lives in the CLI onlyTest-utils: Refactored
test_token()to uselineark_sdk::auth::token_from_file()instead of duplicating file-reading logic.Test plan
make checkpasses (fmt, clippy, doc, build)make testpasses (218 tests, 15 new profile-specific offline tests)make test-onlinewith~/.linear_api_token_testlineark --profile work whoamiwith a valid~/.linear_api_token_worklineark --profile nonexistent whoamishows available profiles + creation hintlineark usageshows active profile + available profileslineark --profile work usagereflects the work profile on line 3