Skip to content

feat(auth): add named auth profiles#7

Merged
altaywtf merged 4 commits into
mainfrom
feat/named-auth-profiles
May 16, 2026
Merged

feat(auth): add named auth profiles#7
altaywtf merged 4 commits into
mainfrom
feat/named-auth-profiles

Conversation

@altaywtf
Copy link
Copy Markdown
Member

Summary

Adds named auth profiles for stable automation sessions while preserving the existing single-token config path and PUTIO_CLI_TOKEN override behavior.

Changed

  • Adds profile-aware auth persistence, profile validation, default profile selection, and PUTIO_CLI_PROFILE selection.
  • Adds auth login/status/logout --profile, auth profiles list/use/remove, and profile metadata in describe.
  • Updates README, architecture notes, and the putio-cli consumer skill docs for devs-fe-auto harness usage and auth precedence.
  • Expands state, command-path, CLI, config, and metadata tests for profile behavior and JSON output.

Risks

  • Auth resolution precedence could regress legacy single-token users or automation relying on env-token override semantics.
  • Profile config migration and profile removal/logout behavior need careful review for token leakage or accidental state mutation.

Verification

  • Security scan and threat model: no reportable findings.
  • pnpm exec vp run verify
  • pnpm exec tsc --noEmit
  • ./dist/bin.mjs describe
  • ./dist/bin.mjs auth status --output json
  • runtime profile proof with PUTIO_CLI_PROFILE=devs-fe-auto
  • pnpm exec vp run smoke:pack
  • $HOME/.agents/skills/codex-review/scripts/codex-review --mode auto clean

Complexity

Increased: auth state now has legacy and profile-aware resolution paths, kept in internal helpers/services with command modules staying thin.

Copilot AI review requested due to automatic review settings May 16, 2026 22:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds named auth profiles to the CLI while preserving the existing single-token config and PUTIO_CLI_TOKEN override semantics. Profile selection is driven by --profile, PUTIO_CLI_PROFILE, or a persisted default_profile, with new auth profiles list/use/remove subcommands and updated status/login/logout flows.

Changes:

  • Extends config schema and CliState service with profile-aware load/save/clear/list/use/remove and a new "profile" auth source.
  • Adds --profile to auth login/status/logout, new auth profiles subcommands, profile arg/flag schema in command-specs, PUTIO_CLI_PROFILE env wiring, and profile metadata in describe.
  • Updates README, architecture notes, skill docs, i18n strings, and tests (state/CLI/command-paths/metadata/config) for profile behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/internal/state.ts Adds profile schemas, validation, and profile-aware save/clear/list/use/remove/resolve effects.
src/internal/state.test.ts Tests for profile save/list/use/remove/logout and env precedence.
src/internal/auth-profile.ts New profile-name pattern, description, and normalizer.
src/internal/config.ts Adds PUTIO_CLI_PROFILE to runtime config.
src/internal/config.test.ts Adds profile to runtime config expectation.
src/internal/env.ts Exports ENV_CLI_PROFILE.
src/internal/command-specs.ts Adds CommandArgument schema and stringArgument helper.
src/internal/metadata.ts Includes profiles/default_profile and profileEnv in metadata.
src/internal/metadata.test.ts Asserts new auth profiles commands and profileEnv.
src/internal/terminal/auth-terminal.ts Renders saved profile in login success panel.
src/commands/auth.ts Wires --profile, new auth profiles subcommands, profile validation, updated status/login/logout.
src/i18n/catalog/en.ts New strings for profile commands, status, and login success.
src/cli.test.ts New auth status/profiles list JSON assertions.
src/command-paths.test.ts Profile flow assertions for login/status/logout/profiles.
src/test-support/command-path-mocks.ts Mocks for new profile-aware state service methods.
README.md, docs/ARCHITECTURE.md, skills/putio-cli/*.md Documentation for profile precedence and usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/internal/state.ts
@altaywtf altaywtf merged commit 63ee525 into main May 16, 2026
6 checks passed
@altaywtf altaywtf deleted the feat/named-auth-profiles branch May 16, 2026 22:46
@putio-release-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants