Add region-aware CLI profile support#40
Open
sunshinexcode wants to merge 18 commits into
Open
Conversation
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
Add region-aware CLI profile support for
globalandcn, so login, API/OAuth endpoints, doctor checks, Console/docs links, quickstart URLs, and project context resolution follow the active login region. This also removes projectregionfields that are not returned by the project APIs and stops persisting API/OAuth integration defaults inconfig.json.Type of change
error.coderename/removal)Public-contract impact
error.code— added todocs/error-codes.md.error.code— flagged as breaking, included in CHANGELOG.docs/automation.md.Contract changes:
auth login --jsonandauth status --jsonnow includedata.region.region, because the project list API does not return that field.config get --jsonno longer returnsapiBaseUrl,oauthBaseUrl,oauthClientId, oroauthScope.config updateremoves the endpoint/OAuth persistence flags:--api-base-url,--oauth-base-url,--oauth-client-id, and--oauth-scope.project createandinitno longer accept--region; they use the active login region.project env writeadds--projectfor explicit project targeting.PROJECT_REGION_MISMATCHerror is returned when a repo-local project binding region conflicts with the active login region.Config migration:
config.jsonschema is bumped to version 4.apiBaseUrl,oauthBaseUrl,oauthClientId, andoauthScopekeys are dropped during migration.AGORA_API_BASE_URL,AGORA_OAUTH_BASE_URL,AGORA_OAUTH_CLIENT_ID, andAGORA_OAUTH_SCOPE.Test plan
go test ./...passes locally.make lintpasses locally (gofmt,golangci-lint, error-code coverage audit).internal/cli/integration_test.go.internal/cli/app_test.go(where applicable).Additional verification run:
go run ./cmd/gendocs -checkgit diff --checkDocumentation
CHANGELOG.mdupdated under## Unreleased(Added / Changed / Deprecated / Removed / Fixed / Security).docs/automation.mdupdated for any user-facing JSON shape, env var, or flag change.docs/error-codes.mdupdated for any newerror.code(or N/A).README.mdupdated if the command tree, install path, or quickstart changed.AGENTS.mdupdated if engineering or release process changed.Security checklist
$HOMEwithout0o600perms when it can contain credentials (e.g. session, config).unsafeimport.Additional notes
Reviewers should pay extra attention to the config migration and region-switching behavior:
PROJECT_REGION_MISMATCHwhen they do not match the active login region.