Skip to content

Improve CLI robustness and usability#568

Merged
dahlia merged 7 commits intofedify-dev:mainfrom
dahlia:cli-adjustments
Feb 17, 2026
Merged

Improve CLI robustness and usability#568
dahlia merged 7 commits intofedify-dev:mainfrom
dahlia:cli-adjustments

Conversation

@dahlia
Copy link
Member

@dahlia dahlia commented Feb 16, 2026

Summary

A batch of CLI improvements addressing runtime errors, help output quality, and standard conventions.

Changes

Bug fixes

  • Remove duplicate debug option from init: The init subcommand defined its own -d/--debug flag, which conflicted with the global one and caused DuplicateOptionError at runtime.
  • Add @fedify/init to CLI runtime dependencies: The CLI imports @fedify/init but it was missing from packages/cli/package.json, causing ERR_MODULE_NOT_FOUND on Node.js.
  • Upgrade Optique to 0.10.1: Bump @optique/config, @optique/core, and @optique/run from 0.10.0 to 0.10.1. This fixes usage string rendering that collapsed to a single line when shell completion with name: "both" was enabled, and fixes bindConfig() usage rendering when a default is provided so that bound options correctly appear in square brackets.

Improvements

  • Suppress SQLite ExperimentalWarning: Pass --disable-warning=ExperimentalWarning in both the npm scripts and the installed binary's shebang so users no longer see the node:sqlite warning.
  • Unify global options help section: Merge the --debug flag into the same “Global options” group as --ignore-config and --config so help output shows a single section instead of two.
  • Improve CLI argument parsing setup: Add --version flag (reads version from deno.json), shell completion support, and display options (colors, max width, show defaults/choices). Convert the command dispatch chain to if/else if with an exhaustive never check for type safety.
  • Respect NO_COLOR environment variable: Disable colored output when NO_COLOR is set to a non-empty value, following the no-color.org convention.

dahlia and others added 7 commits February 17, 2026 00:23
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.
@issues-auto-labeler issues-auto-labeler bot added component/build Build system and packaging component/ci CI/CD workflows and GitHub Actions component/cli CLI tools related labels Feb 16, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Fixed Duplicate Debug Option: Resolved a DuplicateOptionError by removing a redundant debug flag definition in the init subcommand, ensuring proper CLI operation.
  • Added Missing CLI Dependency: Included @fedify/init in packages/cli/package.json to prevent ERR_MODULE_NOT_FOUND errors, making the CLI runtime more stable.
  • Upgraded Optique Library: Bumped @optique/config, @optique/core, and @optique/run to version 0.10.1, which fixes issues with usage string rendering and bindConfig() display in the CLI.
  • Suppressed SQLite Experimental Warning: Added --disable-warning=ExperimentalWarning to npm scripts and the binary's shebang, eliminating distracting Node.js SQLite experimental warnings for users.
  • Unified Global Options Help: Merged the --debug flag into the existing 'Global options' group, resulting in cleaner and more consistent help output for the CLI.
  • Enhanced CLI Argument Parsing: Implemented a --version flag, added shell completion support, and improved display options for colors, maximum width, default values, and choices, enhancing overall CLI usability.
  • Improved Command Dispatch Logic: Refactored the command dispatch chain to use if/else if statements with an exhaustive never check, improving type safety and maintainability.
  • Respected NO_COLOR Environment Variable: Integrated support for the NO_COLOR environment variable, allowing users to disable colored output in the CLI according to standard conventions.
Changelog
  • deno.json
    • Updated @optique package dependencies to version 0.10.1.
  • deno.lock
    • Updated @optique package versions and their integrity hashes to 0.10.1.
  • packages/cli/package.json
    • Added @fedify/init to runtime dependencies.
    • Modified run scripts to suppress Node.js experimental warnings.
  • packages/cli/src/mod.ts
    • Updated shebang to suppress Node.js experimental warnings.
    • Imported deno.json to retrieve the project version.
    • Added --version flag support.
    • Implemented shell completion support.
    • Configured CLI display options for colors, max width, default values, and choices.
    • Refactored command dispatch logic from chained if statements to if/else if with an exhaustive type check.
  • packages/cli/src/options.ts
    • Removed the explicit 'Global options' grouping from the debug option to allow for unified global options help output.
  • packages/init/src/command.ts
    • Removed a duplicate definition of the debug option.
  • pnpm-lock.yaml
    • Updated @optique package versions to 0.10.1 and their integrity hashes.
    • Added @fedify/init as a dependency for the packages/cli workspace.
  • pnpm-workspace.yaml
    • Updated @optique package versions to 0.10.1 in the catalog.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dahlia dahlia removed the component/ci CI/CD workflows and GitHub Actions label Feb 16, 2026
@dahlia dahlia added this to the Fedify 2.0 milestone Feb 16, 2026
@dahlia
Copy link
Member Author

dahlia commented Feb 16, 2026

@2chanhaeng @sij411 Could you take a look into this?

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

@issues-auto-labeler issues-auto-labeler bot added the component/ci CI/CD workflows and GitHub Actions label Feb 16, 2026
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
packages/cli/src/options.ts 77.77% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dahlia dahlia merged commit d539ef4 into fedify-dev:main Feb 17, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/build Build system and packaging component/ci CI/CD workflows and GitHub Actions component/cli CLI tools related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants