Repository navigation
CLI → Replace commander with node:util parseArgs - #40
Merged
Merged
Conversation
Drops the commander dependency. Help, version and the variadic -l/--labelTypeIds option keep working as before. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
Comment on lines
+160
to
+163
| } else if (Object.hasOwn(COMMANDS, name)) { | ||
| await index(name, COMMANDS[name], args); | ||
| } else { | ||
| usageError(`unknown command '${name}'`); |
There was a problem hiding this comment.
Running plain help or plain help index-url now exits with “unknown command 'help'” instead of showing help. The previous commander setup supplied these commands automatically. The new routing only accepts flags and names in COMMANDS, so existing help calls reach usageError. Restore support for help and help <command>.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/index.ts
Line: 160-163
Comment:
**Help command stops working**
Running `plain help` or `plain help index-url` now exits with “unknown command 'help'” instead of showing help. The previous `commander` setup supplied these commands automatically. The new routing only accepts flags and names in `COMMANDS`, so existing help calls reach `usageError`. Restore support for `help` and `help <command>`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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.
Removes
commander, our only dependency besides@team-plain/graphql, and parses arguments with Node's built-innode:utilparseArgs.Note
Low Risk
CLI-only refactor with no API or auth changes; behavior is locked in by expanded tests, with minor risk of subtle flag/positional parsing differences versus commander.
Overview
Drops the
commanderdependency and implements CLI routing and parsing with Node’s built-innode:utilparseArgs, leaving@team-plain/graphqlas the only runtime dependency.index-urlandindex-sitemapare driven by a smallCOMMANDSmap with hand-written top-level and per-command help, plus--version/--help. Subcommand parsing keeps prior behavior for--labelTypeIds/-l(including values after-luntil the next flag) and adds explicit errors for unknown commands, bad arity, and invalid options.Integration tests cover repeated label flags, validation failures, help output, and version printing. A changeset records a patch release for
@team-plain/cli.Reviewed by Cursor Bugbot for commit 93e6115. Bugbot is set up for automated code reviews on this repo. Configure here.