feat: prompt to clear contexts when switching profiles - #236
Merged
Conversation
When a single context exists and no current context is set, GetCurrentProjectID now returns that context project ID automatically, removing the need to run acloud context use after acloud context set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When running `acloud config profile use`, the CLI now asks whether to clear all saved contexts, since project IDs belong to a specific tenant and may not be valid after a profile switch. - Interactive mode: prompts "Clear all contexts? (y/N)" - Non-interactive mode: keeps contexts by default - --clear-contexts flag: clears without prompting (CI/scripts) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #236 +/- ##
=======================================
Coverage 78.09% 78.09%
=======================================
Files 53 53
Lines 12438 12461 +23
=======================================
+ Hits 9713 9732 +19
- Misses 1565 1567 +2
- Partials 1160 1162 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…e clear-contexts Mirror the two English callouts added in feat/context-auto-select-single and this branch into the Italian current docs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
aru-amedeo
pushed a commit
that referenced
this pull request
Jun 19, 2026
Covers all changes since v0.5.1: - feat: context auto-selection (#234) - feat: clear-contexts prompt on profile switch (#236) - fix: shell completion parent-ID slots for network sub-resources (#239/#240) - fix: shell completion parent-ID slots for database/storage sub-resources (#241) - fix: zone value in docs examples (#238) - docs: English and Italian completion section updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
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
acloud config profile use <name>now asks whether to clear all contexts after switching profiles, since project IDs are tenant-scoped and unlikely to be valid across profilesContexts may not be valid for the new profile. Clear all contexts? (y/N):--clear-contextsflag: clears without prompting, useful in CI or automationChanges
cmd/prompt.gopromptConfirmOptional— yes/no prompt that returnsfalsesilently in non-interactive modecmd/context.goClearAllContexts()— resets context file to empty statecmd/config.goConfigProfileUseRunwires the prompt + flag;--clear-contextsregistered ininit()cmd/config_profile_test.godocs/website/docs/configuration.mdTest plan
acloud config profile use stagingin a terminal — prompt appears, y/N worksacloud config profile use staging --clear-contexts— clears without promptecho "" | acloud config profile use staging) — no prompt, contexts unchangedgo test ./cmd/ -run TestConfigProfileUse— 4 passACLOUD_TEST_SKIP_CLIENT=true go test ./cmd/— no regressionsGenerated with Claude Code