Skip to content

feat: Add one-step context setup with env export #69

@YoungJinJung

Description

@YoungJinJung

Summary

Add a one-step CLI workflow that lets users select an AWS context/account, activate it, and immediately emit shell exports for reuse in aws-cli and other local tools.

Why

UNIC currently lets users pick or create contexts inside the TUI, but users also need a smooth way to carry the selected auth into aws-cli, Terraform, and related terminal tools. The best UX here is a single interactive command that switches context and prints export commands that can be consumed with eval "$(unic context setup)".

Scope

  • Add unic context setup for interactive context selection/setup
  • Support configured SSO, assume-role, and credential contexts in one flow
  • Reuse an existing SSO portal configuration to log in and list accessible AWS accounts/roles when the selected base context uses SSO
  • Save or reuse a matching UNIC context and set it as current
  • Print shell export commands as the command output so the command can be used directly with eval
  • Keep the flow compatible with temporary credentials and avoid mutating ~/.aws/credentials
  • Keep unic env as a non-interactive follow-up command for the current or named context

Checklist

  • Add CLI commands for context setup and env
  • Make context setup activate the selected context and emit shell exports on stdout
  • Send prompts/status text to stderr so eval "$(unic context setup)" stays usable
  • Implement SSO account/role discovery using the AWS SSO APIs
  • Prompt for context, account, and role selection in the terminal as needed
  • Save or reuse the selected context in ~/.config/unic/config.yaml
  • Print export commands for shell usage without leaking secrets to logs
  • Add tests for config upsert, env rendering, and command wiring
  • Update README usage docs

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions