You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dcd login: reuse the last selected org instead of always asking #241
dcd login always shows the org picker when the user belongs to more than one org, even when they are signing in again to the org they used last time. That is the common case: access tokens last about an hour, so people re-run dcd login often.
The picker also needs a keypress. Where nobody can answer it, the login never completes:
a shell an AI agent runs (for example a Claude Code ! command)
a script
The browser sign-in succeeds, but the CLI sits at "Pick an organization", and nothing is saved.
The config already records the last choice: current_org_id and current_org_name in ~/.dcd/config.json. It survives dcd logout too, which only clears session.
Proposal
Default to the last org. If current_org_id from the existing config is one of the orgs /me/orgs returns, preselect it in the picker. Pressing Enter then confirms it.
Don't prompt when nobody can answer. When stdin or stdout isn't a TTY, use the last org without prompting, and print one line saying which org was chosen. If there is no previous org, or it's no longer in the list, fail with a clear error, not a hang.
Add --org <id|name> to dcd login, to pick an org without the prompt, for scripts and CI. Fail if the user isn't a member of it.
dcd switch-org stays the way to change org on purpose.
Where
src/commands/login.ts: the call to pickOrg(orgs, …) after the claim.
src/utils/orgs.ts: pickOrg, which auto-selects only when there is exactly one org.
readConfig() already provides current_org_id.
Acceptance
Re-login with a remembered org and a TTY: the picker opens with that org selected.
Re-login without a TTY: no prompt, the remembered org is used, and one line says so.
Without a TTY and with no remembered org (or it's gone): a clear error and a non-zero exit, not a hang.
dcd login --org <id|name> selects that org, or errors if the user isn't a member.
Activity