feat: Add auth config file with login/status/logout commands#11
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a persisted, interactive authentication flow to the bob CLI by introducing a local config file fallback (while keeping environment variables as the highest-priority source), and wires this into API requests and new bob auth * commands.
Changes:
- Introduces
~/.config/bob-cli/config.jsonread/write/delete utilities for persisted credentials. - Updates auth resolution to prefer env vars, otherwise fall back to config; makes
getAuthHeader()async and updates API request code accordingly. - Adds
bob auth login/status/logoutCLI commands plus new unit tests for config/auth behavior.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/config.ts | New config persistence helpers for auth credentials. |
| src/lib/config.test.ts | Tests for config path, read/write/delete behavior. |
| src/lib/auth.ts | Auth resolution updated to include config fallback; getAuthHeader() becomes async; adds auth-source reporting. |
| src/lib/auth.test.ts | Tests for env vs config precedence and auth-source detection. |
| src/lib/api.ts | Awaits async getAuthHeader() when building request headers. |
| src/index.ts | Registers new auth command group with commander. |
| src/commands/auth.ts | Implements bob auth login/status/logout. |
| package-lock.json | Updates Node engine metadata in lockfile to match package settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gnapse
pushed a commit
that referenced
this pull request
Feb 6, 2026
🤖 I have created a release *beep* *boop* --- ## [1.2.0](v1.1.2...v1.2.0) (2026-02-06) ### Features * Add auth config file with login/status/logout commands ([#11](#11)) ([222c7ae](222c7ae)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Contributor
|
✅ |
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
Add interactive authentication flow with config file persistence. Users can now save credentials via
bob auth loginand the CLI will use them if environment variables are not set. Environment variables still take priority, maintaining full backward compatibility.Implementation
~/.config/bob-cli/config.json(JSON format withservice_idandapi_token)bob auth login(interactive),bob auth status(show source),bob auth logout(delete config)getAuthHeader()async to support config file readsDesign Decisions
Env vars take priority so automation/CI/CD flows remain unchanged. Config file acts as a convenient fallback for local development. Both can be in use simultaneously (e.g., env var for service ID, config file for token).