Skip to content

fix(cli): name the removed setup flags instead of a generic unknown-flag error - #509

Open
Agnik47 wants to merge 1 commit into
agentrhq:mainfrom
Agnik47:fix/setup-removed-mode-flag
Open

Agnik47 wants to merge 1 commit into
agentrhq:mainfrom
Agnik47:fix/setup-removed-mode-flag

Conversation

@Agnik47

@Agnik47 Agnik47 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Problem

#493 removed --mode and --api-key from webcmd setup. Both now fall through to the generic unknown-flag branch:

$ webcmd setup --mode local --browser cloak
ok: false
error:
  code: ARGUMENT
  message: unknown flag --mode for `setup`
  help: >-
    valid flags for `setup`: --browser, --chrome-profile, --import-chrome-cookies,
    --no-import-chrome-cookies, --sync-to-chrome, --status, --help
  exitCode: 2

That message can't tell the user whether they mistyped something or the flag is gone, and it doesn't point at --browser, which is what replaced --mode local. webcmd setup --mode local --browser ... was the documented form until recently, so it is still in older docs, in blog posts, and in muscle memory.

Change

parseSetupArgs now names removed flags before the generic branch:

$ webcmd setup --mode local --browser cloak
ok: false
error:
  code: ARGUMENT
  message: >-
    `setup` no longer accepts --mode; setup always configures local mode, so drop the
    flag and pick a browser with `webcmd setup --browser <cloak|chrome|slab|absolute-path>`.
  exitCode: 2

$ webcmd setup --api-key sk-...
  message: '`setup` no longer accepts --api-key; setup no longer stores a Webcmd Cloud API key.'

Handles the --flag value and --flag=value spellings. Genuinely unknown flags (--bogus) keep the existing "unknown flag" message and valid-flag list, and SETUP_HELP is unchanged — removed flags are named on use, not advertised.

Tests

Added a parameterized case in src/hosted/setup.test.ts covering --mode local, --mode=local, and --api-key, asserting each is named and no longer reaches the unknown-flag branch.

src/hosted/setup.test.ts: 49/49 pass. tsc --noEmit: clean.

Notes

I originally had docs changes alongside this — the setup --mode local --browser ... occurrences in cli-reference.mdx / troubleshooting.mdx. Those are already fixed on main, so this PR is the CLI-side half only.

…lag error

`webcmd setup` dropped `--mode` and `--api-key` when it stopped configuring
hosted mode (agentrhq#493). Passing either now falls through to the generic unknown
flag branch, which prints the valid-flag list and leaves the user guessing
whether they mistyped something or the flag is gone.

Name both flags explicitly and point `--mode` at the `--browser` selection
that replaced it, so anyone following an older doc or their own muscle memory
gets an actionable error. Genuinely unknown flags keep the existing message.
@github-actions

Copy link
Copy Markdown
Contributor

🟢 No documentation gap found — medium confidence

The automated review found no documentation gap in the supplied changes.

This review is advisory and does not block merging.

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.

1 participant