Add console global flags (--console-region, --console-site, --console-switch-agent)
to the options of all 12 commands that depend on callConsoleGateway, so they appear
in --help output. Document this as convention #4 in AGENTS.md for future commands.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Eliminate per-command --region/--site/--switch-agent duplication across 11 console gateway commands.
These values now flow through config (CLI flags → config file → defaults) and are consumed by
callConsoleGateway automatically. Also wire consoleSite into resolveConsoleOrigin so --console-site
selects the correct login URL (domestic vs international).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adapts to bailian-cli-login af06baf which added workspace_id to the
notifyToken payload. The field is parsed from query/body and written
to config.json as workspace_id.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Field was replaced by region+site gateway resolution but ConfigFile
definition, parseConfigFile logic, and test case were left behind.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Export validateAndPersistApiKey from login-console.ts and reuse in
login.ts. Remove duplicated canRetry, RETRY_DELAY_BASE_MS, and
validateKeyAndPersist from login.ts. Unify validation model to
qwen3.7-max. Reorder base_url write before apiKey validation in
the --api-key path to avoid double read-modify-write.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When used with --api-key, validates the key against the specified
base URL and persists it to config.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move apiKey validation into login-console.ts so it uses the baseUrl
from the same callback (not stale config). All fields are now persisted
in one place: config fields first, then apiKey validated + written.
Remove onApiKey callback indirection from runConsoleLogin signature.
Clean up debug logging.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>