feat(profile): add multi-profile configuration system#12
Merged
Conversation
Introduce profile-based configuration allowing users to manage multiple
StackHawk configurations with named profiles. Each profile stores its own
API key, organization, and cached JWT token.
New features:
- Profile commands: list, use, create, delete, show
- --profile/-P global flag for one-time profile override
- HAWKOP_PROFILE environment variable support
- Automatic v1 to v2 config migration (backward compatible)
Architecture improvements:
- Introduce GlobalOptions struct to consolidate CLI parameters
- Simplify all command handler signatures
- Update CommandContext to accept single &GlobalOptions parameter
Config format v2 example:
version: 2
active_profile: prod
profiles:
prod:
api_key: sk_prod_...
org_id: org_123
test:
api_key: sk_test_...
org_id: org_456
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove implications that profiles target different API hosts. Profile help now emphasizes switching between organizations, user accounts, and API keys rather than environments like prod/test/local. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
GlobalOptionsstruct to consolidate CLI parameters, simplifying command handler signatureslist,use,create,delete,showChanges
New files:
src/cli/args/global.rs-GlobalOptionsstruct consolidating all global CLI optionssrc/cli/profile.rs- Profile command handlersKey modifications:
src/config/mod.rs- NewProfileConfigandProfiledConfigtypes with v1→v2 migrationsrc/cli/context.rs- Accept&GlobalOptionsinstead of 6 parameterssrc/main.rs- Simplified routing usingGlobalOptions&GlobalOptionsConfig Format (v2)
Test plan
cargo test- All 206 unit tests passcargo clippy -- -D warnings- No warnings🤖 Generated with Claude Code