Improve CLI robustness and usability#568
Conversation
Remove the init package's local -d/--debug option so the CLI parser no longer defines the same option twice when merged with global options. This prevents DuplicateOptionError from @optique/core when running `deno task cli`, where the top-level command already provides the global debug flag. Co-Authored-By: Codex <codex@openai.com>
The CLI runtime imports @fedify/init from dist/init/mod.js, but @fedify/init was not listed in packages/cli dependencies. Add @fedify/init as a workspace dependency and update pnpm-lock.yaml so Node can resolve the package when running pnpm scripts from packages/cli. This prevents ERR_MODULE_NOT_FOUND failures during CLI execution.
Add --disable-warning=ExperimentalWarning to the CLI run and runi scripts in packages/cli/package.json so local script execution no longer prints the node:sqlite ExperimentalWarning. Update the shebang in packages/cli/src/mod.ts to include the same Node option, ensuring the installed fedify executable also suppresses the warning when invoked via npm/pnpm-generated bin wrappers. Co-Authored-By: OpenAI Codex <codex@openai.com>
Remove the redundant "Global options" wrapper from `debugOption` so help output is rendered as a single combined section rather than two separate global option headings. This keeps `--debug`, `--ignore-config`, and `--config PATH` together under one "Global options" block. Co-Authored-By: Codex <codex@openai.com>
Bump @optique/config, @optique/core, and @optique/run from 0.10.0 to 0.10.1 in deno.json, pnpm-workspace.yaml, and their respective lockfiles.
Add version flag, shell completion support, and display options (colors, max width, show defaults/choices) to the CLI argument parser. Import version from deno.json so the --version flag reports the actual package version. Convert command dispatch from sequential if statements to if/else if chain with an exhaustive never check at the end, ensuring type safety when new commands are added.
Check the NO_COLOR environment variable when deciding whether to enable colored CLI output. Colors are now disabled when NO_COLOR is set to a non-empty value, following the no-color.org convention. Previously only TTY detection was used.
Summary of ChangesHello @dahlia, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the command-line interface (CLI) by addressing several critical issues and introducing usability improvements. It resolves runtime errors, refines help output, and aligns the CLI with standard conventions, making it more robust and user-friendly for developers and end-users alike. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@2chanhaeng @sij411 Could you take a look into this? |
There was a problem hiding this comment.
Code Review
This pull request brings a nice set of improvements to the CLI, enhancing its robustness and usability. The bug fixes for dependency issues and duplicate options are crucial. I particularly appreciate the improvements to argument parsing, such as adding the --version flag, shell completion, and the refactoring of the command dispatch logic to use an if/else if chain with an exhaustive check, which improves type safety. Suppressing the experimental SQLite warning is also a good quality-of-life change for users. I have one suggestion regarding the implementation of the NO_COLOR environment variable to better align with the standard. Overall, this is a solid contribution that makes the CLI tool more professional and easier to use.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Summary
A batch of CLI improvements addressing runtime errors, help output quality, and standard conventions.
Changes
Bug fixes
-d/--debugflag, which conflicted with the global one and causedDuplicateOptionErrorat runtime.@fedify/initto CLI runtime dependencies: The CLI imports@fedify/initbut it was missing from packages/cli/package.json, causingERR_MODULE_NOT_FOUNDon Node.js.@optique/config,@optique/core, and@optique/runfrom 0.10.0 to 0.10.1. This fixes usage string rendering that collapsed to a single line when shell completion withname: "both"was enabled, and fixesbindConfig()usage rendering when adefaultis provided so that bound options correctly appear in square brackets.Improvements
ExperimentalWarning: Pass--disable-warning=ExperimentalWarningin both the npm scripts and the installed binary's shebang so users no longer see thenode:sqlitewarning.--debugflag into the same “Global options” group as--ignore-configand--configso help output shows a single section instead of two.--versionflag (reads version from deno.json), shell completion support, and display options (colors, max width, show defaults/choices). Convert the command dispatch chain toif/else ifwith an exhaustivenevercheck for type safety.NO_COLORenvironment variable: Disable colored output whenNO_COLORis set to a non-empty value, following the no-color.org convention.