wso2 / wso2/wso2-cli

feat: name a new account account-N and ask for the name instead of naming it after the provider

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ready-for-agent Type/UX
Dominant language
Go
Stars
0
Forks
3
Avg merge
8h 43m
Merged PRs (30d)
60

Description

What to build

A shell that creates an account no longer names it after the software. wso2 <namespace> connect <url> today names a new account after the product descriptor's provider string, so a Thunder deployment becomes an account called thunder, wso2 whoami reports Account thunder, and a second Thunder server collides on the same name. wso2 login --url <issuer> has the same shape of problem from the other direction: it names the account after the issuer host.

Both paths should instead fall back to the next free account-N (account-1, account-2, …), and should ask for a name when they are allowed to ask. The prompt reads Account name [account-1]:, Enter accepts the default, and a name that is invalid or already taken is asked again rather than refused — a person who typed a name that is already in use should be able to type another without re-running the command. When nothing may prompt (--no-input, WSO2_NO_INPUT, or standard input is not a terminal) the default is taken silently, so scripts and CI never hang.

An explicit --account <name> keeps behaving exactly as it does now, including the refusal when that name is already taken: the user named something specific, and quietly renaming it would be the shell overriding them.

wso2 login --url <issuer> must stay idempotent. It reuses an account of the derived name today, so re-running it against the same issuer does not pile up accounts. With a numbered default, that reuse has to be found by the issuer and client the account already authenticates against; only when no account matches does the login allocate a new account-N.

The same-named context keeps following the account name, as it does now.

Acceptance criteria

  • wso2 <namespace> connect <url> with no --account and nothing to prompt creates account-1 on an empty document, and the next free number when lower ones are taken.
  • wso2 login --url <issuer> with no name given behaves the same way, and reuses an existing account that already authenticates against that issuer with that client instead of allocating a new number.
  • When a prompt is allowed, both paths ask Account name [account-1]: on standard error, and Enter accepts the default.
  • A name entered at the prompt that fails the context-document name rule, or that is already taken by an account or a context, is asked again.
  • --no-input, WSO2_NO_INPUT, and a standard input that is not a terminal each take the default without asking.
  • --account <name> naming an account that already exists is still refused, with the recovery it gives today.
  • The connect and login reports say the name was assigned and name --account <name> as the way to choose one.
  • docs/reference/commands.md and docs/guides/login.md describe the new naming; the command synopsis near the top of commands.md matches.

Blocked by

  • None — can start immediately.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the connect and login command entry points and the account/context document handling, then read the existing naming, prompting, and issuer-matching flows. Use the acceptance criteria to check numbered allocation, interactive and non-interactive behavior, explicit-name errors, idempotent login, and reports. Update docs/reference/commands.md and docs/guides/login.md, including the commands synopsis.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.