feat(config): add profile list/rename/delete and clearer arg errors - #59
Merged
Conversation
Issue #45 reported `omni config use Playground Org-scoped` failing with a cryptic "accepts 1 arg(s), received 2". The root cause is shell tokenization — the name needs quoting — but the CLI made it worse two ways: an opaque error, and no in-CLI way to manage profiles (the reporter had to sudo-edit the JSON to rename/delete). Rather than forbid spaces in profile names (they work fine quoted, and the config format is shared with the TS CLI), this allows them and fixes the ergonomics around them: - `config list` — show profiles, marking the default with `*`. - `config rename <old> <new>` — recover a badly-named profile without editing JSON; refuses to overwrite; moves `defaultProfile` along. - `config delete <name>` — interactive confirmation, `--yes` to skip; clears `defaultProfile` when it referenced the deleted profile. - use/login/logout/delete now share a profileNameArgs validator: when the shell passes more than one token (the #45 case), the error names the likely-intended profile already quoted, e.g. `… quote it: omni config use "Playground Org-scoped"`. - "not found" errors list available profiles quoted, so spaced names are visible. No profile-name validation on save: spaced/parenthesized names are allowed; quoting them at the shell is the user's responsibility. Closes #45. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
n8agrin
force-pushed
the
claude/wonderful-pascal-66e110
branch
from
June 16, 2026 21:50
a0804d6 to
2bc1d0b
Compare
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.
Closes #45.
Background
The issue reported
omni config use Playground Org-scopedfailing with a crypticaccepts 1 arg(s), received 2. The root cause is plain shell tokenization — the name has a space and needs quoting (omni config use "Playground Org-scoped"works fine). But the CLI made the situation worse in two ways:sudo-edit the JSON to rename/delete a badly-named profile.The issue offered two directions: forbid spaces on save, or allow them and make them usable. This PR takes the "allow them" path — spaced/parenthesized names work fine when quoted, and the config format is shared with the TS CLI, so refusing to create names the TS CLI allows would be inconsistent. Instead it fixes the ergonomics around such names and adds the lifecycle CRUD the issue also asked for.
Changes
omni config list— lists profiles, marking the default with*(plus auth method + endpoint).omni config rename <old> <new>— the recovery path for a badly-named profile, no JSON editing required. Refuses to overwrite an existing profile and movesdefaultProfilealong if it pointed at the old name.omni config delete <name>— interactive[y/N]confirmation by default (--yes/-yto skip). ClearsdefaultProfilewhen it referenced the deleted profile.use/login/logout/deleteshare aprofileNameArgsvalidator. When the shell passes more than one token (the exact Config profile lifecycle management #45 case), the error names the likely-intended profile already quoted:No validation is added on save — spaced/special names are allowed; quoting at the shell is the user's responsibility.
Why not forbid spaces?
An earlier revision of this PR did exactly that (strict
[A-Za-z0-9_.-]allowlist). Dropped because: quoting args is standard shell behavior, the allowlist forbade reasonable display names (My Org (prod),client: acme), it was a mild behavior change for anyone scriptingconfig init --name, and it diverged from the TS CLI which shares the on-disk format. The CRUD + better errors solve the reported pain without the policy.Notes for reviewers
mainon top of feat: add flags toomni config initfor non-interactive setup #63 (non-interactiveconfig initflags). Net diff touches onlycmd/omni/config_commands*.go—internal/configis unchanged frommain.config useremains single-name; the two-positionalconfig renameis unambiguous, so a spaced target name there works without quoting gymnastics.Test plan
go test ./...greenomni config use Foo Bar(unquoted) → quoting hint naming"Foo Bar"omni config use "Playground Org-scoped"→ switches profilesomni config init --name "My Org (prod)" …→ allowedomni config listmarks the defaultomni config rename prod "Production (US)"→ renames, updates defaultomni config delete nameprompts;--yesskips🤖 Generated with Claude Code