Skip to content

feat(config): add profile list/rename/delete and clearer arg errors - #59

Merged
n8agrin merged 1 commit into
mainfrom
claude/wonderful-pascal-66e110
Jun 23, 2026
Merged

feat(config): add profile list/rename/delete and clearer arg errors#59
n8agrin merged 1 commit into
mainfrom
claude/wonderful-pascal-66e110

Conversation

@n8agrin

@n8agrin n8agrin commented May 21, 2026

Copy link
Copy Markdown
Contributor

Closes #45.

Background

The issue reported omni config use Playground Org-scoped failing with a cryptic accepts 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:

  1. The error was opaque — it didn't hint that quoting was the fix.
  2. There was no in-CLI way to manage profiles, so the reporter had to 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 moves defaultProfile along if it pointed at the old name.
  • omni config delete <name> — interactive [y/N] confirmation by default (--yes/-y to skip). Clears defaultProfile when it referenced the deleted profile.
  • Clearer multi-word arg errorsuse/login/logout/delete share a profileNameArgs validator. 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:
    got 2 arguments — a profile name is a single value; if it contains spaces,
    quote it: omni config use "Playground Org-scoped"
    
  • "not found" errors list available profiles quoted, so spaced names are visually distinct.

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 scripting config 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

  • Rebased onto main on top of feat: add flags to omni config init for non-interactive setup #63 (non-interactive config init flags). Net diff touches only cmd/omni/config_commands*.gointernal/config is unchanged from main.
  • config use remains single-name; the two-positional config rename is unambiguous, so a spaced target name there works without quoting gymnastics.

Test plan

  • go test ./... green
  • omni config use Foo Bar (unquoted) → quoting hint naming "Foo Bar"
  • omni config use "Playground Org-scoped" → switches profiles
  • omni config init --name "My Org (prod)" … → allowed
  • omni config list marks the default
  • omni config rename prod "Production (US)" → renames, updates default
  • omni config delete name prompts; --yes skips

🤖 Generated with Claude Code

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
n8agrin force-pushed the claude/wonderful-pascal-66e110 branch from a0804d6 to 2bc1d0b Compare June 16, 2026 21:50
@n8agrin n8agrin changed the title fix(config): validate profile names and add list/rename/delete feat(config): add profile list/rename/delete and clearer arg errors Jun 16, 2026
@n8agrin
n8agrin requested a review from dspangen June 16, 2026 22:11

@dspangen dspangen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@n8agrin
n8agrin merged commit ccfa63f into main Jun 23, 2026
2 checks passed
@n8agrin
n8agrin deleted the claude/wonderful-pascal-66e110 branch June 23, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config profile lifecycle management

2 participants