Skip to content

feat: auto-select context when only one is configured - #234

Merged
aru-amedeo merged 1 commit into
mainfrom
feat/context-auto-select-single
Jun 19, 2026
Merged

feat: auto-select context when only one is configured#234
aru-amedeo merged 1 commit into
mainfrom
feat/context-auto-select-single

Conversation

@aru-amedeo

@aru-amedeo aru-amedeo commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

  • GetCurrentProjectID() now auto-selects the only configured context when CurrentContext is unset, so acloud context set alone is enough — no follow-up acloud context use required
  • When two or more contexts exist the existing behaviour is preserved: an explicit acloud context use <name> is required
  • Tests updated: the single-context / no-current-context scenario now expects success; a new test covers the multi-context / no-current case
  • Docs (docs/website/docs/configuration.md) and ai/ARCHITECTURE.md updated to document the behaviour

Test plan

  • acloud context set my-ctx --project-id <id> then acloud network vpc list works without acloud context use
  • Adding a second context and running without acloud context use still returns an error
  • Unit tests: go test ./cmd/ -run TestGetCurrentProjectID — all pass
  • Full suite: ACLOUD_TEST_SKIP_CLIENT=true go test ./cmd/ — no regressions

Closes #235

Generated with Claude Code

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>
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.09%. Comparing base (a3bc509) to head (ced71ab).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #234   +/-   ##
=======================================
  Coverage   78.09%   78.09%           
=======================================
  Files          53       53           
  Lines       12438    12441    +3     
=======================================
+ Hits         9713     9716    +3     
  Misses       1565     1565           
  Partials     1160     1160           
Flag Coverage Δ
unittests 78.09% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aru-amedeo
aru-amedeo merged commit 6c9ec50 into main Jun 19, 2026
12 checks passed
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>
@aru-amedeo
aru-amedeo deleted the feat/context-auto-select-single branch June 20, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: auto-select context when only one is configured

2 participants