Conversation
- Replace zx argv with yargs for proper subcommand handling - Add `cpr` as a bin alias for `comfy-pr` - Show help with available subcommands by default - `cpr create [repos..]` replaces the old positional args pattern Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Refactors the comfy-pr CLI to use yargs with a create subcommand and adds cpr as an additional executable alias.
Changes:
- Replaced
zxargv parsing withyargs-based subcommand parsing (create [repos..],--repolist,REPO=...). - Added help/usage examples and stricter CLI argument handling.
- Added
cpras abinalias inpackage.json.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/cli.ts |
Migrates CLI parsing to yargs, introduces create subcommand, and repo-resolution logic. |
package.json |
Adds cpr as a new bin alias pointing to the same CLI entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { readFile } from "fs/promises"; | ||
| import { argv, $ as zx } from "zx"; | ||
| import { hideBin } from "yargs/helpers"; | ||
| import yargs from "yargs/yargs"; |
There was a problem hiding this comment.
src/cli.ts now imports yargs at runtime, but package.json does not list yargs as a direct dependency. Relying on it being hoisted as a transitive dependency is not reliable and can break the published CLI. Add yargs (and keep it in dependencies, not devDependencies) so the bin works consistently.
| .example("$0 create url1 url2 url3", "Create PRs for multiple repos") | ||
| .example("REPO=https://github.com/owner/repo $0 create", "Create PR via env variable") | ||
| .demandCommand(1, "Please specify a command. Run with --help to see available commands.") | ||
| .strict() | ||
| .help() |
There was a problem hiding this comment.
PR description says running cpr with no args shows help by default, but .demandCommand(1, ...) treats missing commands as an error (non-zero exit) and prints an error message. If the intended behavior is a normal help display, add a default $0 command (or similar) that calls showHelp()/returns 0, and reserve demandCommand/failure messaging for genuinely invalid input.
| } | ||
|
|
||
| const cli = yargs(hideBin(process.argv)) | ||
| .scriptName("cpr") |
There was a problem hiding this comment.
.scriptName("cpr") hard-codes the displayed binary name in help/usage. Since package.json exposes both comfy-pr and cpr, this will show cpr even when invoked as comfy-pr, which is confusing for users following existing docs. Consider deriving the script name from process.argv[1] (basename) or omitting scriptName() so yargs uses the actual invoked name.
| .scriptName("cpr") |
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
src/cli.tsfromzxargv toyargswith proper subcommand handlingcpras a bin alias forcomfy-prin package.jsoncprwith no args shows help with available subcommandscpr create [repos..]replaces the old positional args patterncpr create --repolist repos.txtandREPO=... cpr createstill workTest plan
cprshows help by defaultcpr --helpshows usage with examples🤖 Generated with Claude Code