Skip to content

CLI: allow excess arguments for htmlhint#1837

Merged
coliff merged 1 commit intomainfrom
dev/coliff/update-dev-deps-march26
Mar 22, 2026
Merged

CLI: allow excess arguments for htmlhint#1837
coliff merged 1 commit intomainfrom
dev/coliff/update-dev-deps-march26

Conversation

@coliff
Copy link
Copy Markdown
Member

@coliff coliff commented Mar 22, 2026

Enable commander to accept extra CLI arguments by adding program.allowExcessArguments(true) to the htmlhint CLI. Updated the source (src/cli/htmlhint.ts) and rebuilt distribution files (dist/cli/htmlhint.js, dist/cli/parse-glob.js).
Also includes package.json/package-lock.json updates from the rebuild.

Enable commander to accept extra CLI arguments by adding program.allowExcessArguments(true) to the htmlhint CLI. Updated the source (src/cli/htmlhint.ts) and rebuilt distribution files (dist/cli/htmlhint.js, dist/cli/parse-glob.js). Also includes package.json/package-lock.json updates from the rebuild.
Copilot AI review requested due to automatic review settings March 22, 2026 04:00
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying htmlhint with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4281b64
Status: ✅  Deploy successful!
Preview URL: https://405a2756.htmlhint.pages.dev
Branch Preview URL: https://dev-coliff-update-dev-deps-m.htmlhint.pages.dev

View logs

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 enhances the htmlhint CLI by enabling the acceptance of excess arguments, which gives users more flexibility when running the tool. It also updates several dependencies to their latest versions, ensuring the project benefits from the newest features, security patches, and performance improvements.

Highlights

  • Excess Argument Handling: The CLI now allows for excess arguments to be passed to the htmlhint command, providing more flexibility in usage.
  • Commander Update: The commander dependency has been updated to version 14.0.3, potentially bringing new features and bug fixes.
  • Dependency Updates: Several development dependencies, including rimraf and typescript, have been updated to newer versions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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.

@coliff coliff merged commit a4a4b7a into main Mar 22, 2026
23 checks passed
@coliff coliff deleted the dev/coliff/update-dev-deps-march26 branch March 22, 2026 04:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the htmlhint CLI to tolerate additional positional arguments by configuring Commander to allow excess arguments, and refreshes the built dist/ artifacts and lockfiles accordingly.

Changes:

  • Enable Commander’s “allow excess arguments” behavior in the htmlhint CLI.
  • Update commander (and rebuild outputs), along with incidental toolchain/lockfile updates.
  • Rebuild dist/ artifacts to reflect the source/dependency changes.

Reviewed changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/cli/htmlhint.ts Enables Commander excess-argument acceptance for the CLI entrypoint.
dist/cli/htmlhint.js Rebuilt CLI bundle reflecting the new Commander setting.
dist/cli/parse-glob.js Rebuilt helper output as part of the updated build/toolchain.
package.json Updates Commander (runtime) and bumps dev tooling versions used in the rebuild.
package-lock.json Lockfile updates to match the dependency/toolchain changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 76 to +79
"prettier": "3.8.1",
"rimraf": "^5.0.0",
"rimraf": "^6.1.3",
"rollup": "4.59.1",
"typescript": "5.4.5"
"typescript": "5.9.3"
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

rimraf and typescript are also bumped as part of the rebuild. These toolchain upgrades can change emitted dist/ output and are not directly required by the CLI behavior change; consider moving these devDependency upgrades into a separate PR to keep the risk/review surface focused.

Copilot uses AI. Check for mistakes.
}

const program = new Command()
program.allowExcessArguments(true)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

This change alters how the CLI tolerates additional positional args, but there’s no regression test covering the new behavior. Please add a CLI-level test (e.g., invoking bin/htmlhint with multiple targets or with additional args after --) that would have previously failed and now succeeds, so the intent is locked in.

Copilot uses AI. Check for mistakes.
"dependencies": {
"async": "3.2.6",
"commander": "11.1.0",
"commander": "14.0.3",
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

commander is bumped from 11.x to 14.x as part of this change. Since this is a runtime dependency for the published CLI, a major-version upgrade can introduce unrelated breaking behavior; consider either keeping the existing major version (if allowExcessArguments is available there) or splitting the commander upgrade into a dedicated PR with explicit compatibility/testing notes.

Suggested change
"commander": "14.0.3",
"commander": "11.1.0",

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
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 enables htmlhint to accept excess arguments by calling program.allowExcessArguments(true), which is necessary due to a breaking change in the updated commander library. The change correctly restores the previous behavior. However, I've suggested a more idiomatic approach using .argument('[targets...]') to explicitly declare variadic arguments, which improves code clarity and adheres to modern commander best practices. The PR also includes updates to other dependencies like rimraf and typescript as part of the rebuild process, which look fine.

}

const program = new Command()
program.allowExcessArguments(true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While allowExcessArguments(true) works, a more idiomatic approach with commander since v12 is to explicitly declare that your program accepts variadic arguments. This makes the CLI definition clearer.

I suggest removing this line and instead adding .argument('[targets...]', 'file, folder, pattern, stdin, or url to lint') to the command definition chain (e.g., after .usage()).

// src/cli/htmlhint.ts:56
program
  .version(pkg.version)
  .usage('<file|folder|pattern|stdin|url ...> [options]')
  .argument('[targets...]', 'file, folder, pattern, stdin, or url to lint') // Add this line
  .option('-l, --list', 'show all of the rules available')
  // ...

This will have the same effect of allowing multiple file/path arguments, but it is more explicit about the command's interface.

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.

2 participants