fix(table-generator): run the CLI when invoked from a Windows path - #35
Open
Dusk1e wants to merge 1 commit into
Open
fix(table-generator): run the CLI when invoked from a Windows path#35Dusk1e wants to merge 1 commit into
Dusk1e wants to merge 1 commit into
Conversation
The entry-point guard compared import.meta.url against a template string built from process.argv[1]. argv[1] is a filesystem path, not a URL, so on Windows it never matches the percent-encoded module URL and main() never runs: pnpm update-table and pnpm check-table both exit 0 without doing anything. The same happens on any path that needs percent-encoding, such as one containing a space. Compare against pathToFileURL(process.argv[1]).href instead.
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.
Summary
The entry point guard compares
import.meta.urlwith a template string built fromprocess.argv[1], which is a filesystem path and not a URL, so it never matches on Windows or on any path that needs percent encoding.main()never runs, andpnpm update-tableandpnpm check-tableboth exit 0 without doing anything.Now compares against
pathToFileURL(process.argv[1]).href.Tests
Before,
tsx src/cli.ts --helpprinted nothing and exited 0. After, it prints the help text.After,
tsx src/cli.ts --checkruns the scan and reports the table status instead of exiting silently.biome checkclean on the changed file.Note
Low Risk
Single-file CLI bootstrap fix with no auth, data, or API surface changes; restores intended behavior on Windows.
Overview
Fixes the table-generator CLI so
main()actually runs when the script is executed directly.The direct-execution check compared
import.meta.urlto`file://${process.argv[1]}`, which is wrong becauseprocess.argv[1]is a filesystem path, not a URL. That guard never matched on Windows (drive letters, backslashes) or when paths need percent-encoding, sopnpm update-table/pnpm check-tablecould exit 0 without updating or checking anything.The guard now uses
pathToFileURL(process.argv[1]).hreffor a proper file-URL comparison, with a short comment explaining why.Reviewed by Cursor Bugbot for commit f318f8e. Bugbot is set up for automated code reviews on this repo. Configure here.