Skip to content

fix(router-cli): pass process.argv to yargs to fix silent CLI failure#6981

Merged
birkskyum merged 2 commits intomainfrom
fix-yargs
Mar 19, 2026
Merged

fix(router-cli): pass process.argv to yargs to fix silent CLI failure#6981
birkskyum merged 2 commits intomainfrom
fix-yargs

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Mar 19, 2026

The vite-config upgrade in #6923 changed import * as yargs to import yargs from 'yargs' and switched from the yargs singleton API (yargs.scriptName(...)) to the factory API (yargs().scriptName(...)).

However, calling yargs() without arguments creates an instance with no args to parse, so all commands (generate, watch, --help) silently did nothing.

Fix: pass hideBin(process.argv) so the new instance receives CLI args, as suggested in the docs:
https://yargs.js.org/docs/#api-reference

Fixes #6968

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a silent failure issue in the Router CLI where command-line arguments were not being properly recognized and processed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e8acb063-f345-42a1-949d-68ec2a37df5d

📥 Commits

Reviewing files that changed from the base of the PR and between 8d9988a and aca1e84.

📒 Files selected for processing (2)
  • .changeset/eighty-chairs-write.md
  • packages/router-cli/src/index.ts

📝 Walkthrough

Walkthrough

This pull request fixes a critical CLI parsing issue in the router-cli package introduced in version 1.166.9. The fix modifies the CLI entrypoint to correctly pass command-line arguments to yargs by using hideBin(process.argv), restoring proper command parsing functionality.

Changes

Cohort / File(s) Summary
CLI Argument Parsing Fix
packages/router-cli/src/index.ts
Updated yargs initialization from yargs() to yargs(hideBin(process.argv)) to properly parse and process command-line arguments.
Release Metadata
.changeset/eighty-chairs-write.md
Added changeset entry documenting the patch release fix for silent CLI failure by passing process.argv into yargs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A whisker of code, so small yet so right,
The argv now flows to yargs' delight,
No more silent failures in the dark,
The CLI commands now find their mark! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: passing process.argv to yargs to fix CLI failures in router-cli.
Linked Issues check ✅ Passed The changes directly address issue #6968 by restoring CLI functionality—yargs now receives process.argv as required, enabling generate and help commands.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the yargs argument handling issue; no out-of-scope modifications are present in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-yargs
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 19, 2026

View your CI Pipeline Execution ↗ for commit aca1e84

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 48s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-19 13:41:38 UTC

@github-actions
Copy link
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 0 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/router-cli 1.166.13 → 1.166.14 Changeset

@github-actions
Copy link
Contributor

Bundle Size Benchmarks

  • Commit: 8d9988a05402
  • Measured at: 2026-03-19T13:33:21.381Z
  • Baseline source: history:5ff4f0b8dce1
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.61 KiB 0 B (0.00%) 276.07 KiB 76.12 KiB ▁▁▁▁▁▁█████
react-router.full 90.65 KiB 0 B (0.00%) 286.28 KiB 78.68 KiB ▁▁▁▁▁▁█████
solid-router.minimal 37.14 KiB 0 B (0.00%) 111.38 KiB 33.29 KiB ▁▁▁▁▁▁█████
solid-router.full 41.36 KiB 0 B (0.00%) 124.18 KiB 37.12 KiB ▁▁▁▁▁▁█████
vue-router.minimal 52.99 KiB 0 B (0.00%) 151.41 KiB 47.65 KiB ▁▁▁▁▁▁█████
vue-router.full 57.69 KiB 0 B (0.00%) 166.34 KiB 51.60 KiB ▁▁▁▁▁▁█████
react-start.minimal 101.99 KiB 0 B (0.00%) 324.08 KiB 88.20 KiB ▁▁▁▁▁▁█████
react-start.full 105.33 KiB 0 B (0.00%) 333.89 KiB 91.02 KiB ▁▁▁▁▁▁█████
solid-start.minimal 51.24 KiB 0 B (0.00%) 157.82 KiB 45.28 KiB ▁▁▁▁▁▁█████
solid-start.full 56.53 KiB 0 B (0.00%) 173.32 KiB 49.72 KiB ▁▁▁▁▁▁█████

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 19, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@6981

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@6981

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@6981

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@6981

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@6981

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@6981

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@6981

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@6981

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@6981

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@6981

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@6981

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@6981

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@6981

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@6981

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@6981

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@6981

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@6981

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@6981

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@6981

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@6981

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@6981

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@6981

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@6981

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@6981

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@6981

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@6981

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@6981

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@6981

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@6981

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@6981

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@6981

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@6981

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@6981

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@6981

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@6981

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@6981

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@6981

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@6981

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@6981

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@6981

commit: aca1e84

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 19, 2026

Merging this PR will not alter performance

✅ 3 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing fix-yargs (aca1e84) with main (5ff4f0b)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (8d9988a) during the generation of this report, so 5ff4f0b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@birkskyum birkskyum merged commit e5d23ec into main Mar 19, 2026
19 of 20 checks passed
@birkskyum birkskyum deleted the fix-yargs branch March 19, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tsr generate doesn't generate routeTree.gen.ts after router-cli@1.166.9

1 participant