Skip to content

rfc: global -C flag for working-directory switching#2022

Draft
fengmk2 wants to merge 19 commits into
mainfrom
rfc/monorepo-app-commands
Draft

rfc: global -C flag for working-directory switching#2022
fengmk2 wants to merge 19 commits into
mainfrom
rfc/monorepo-app-commands

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 2, 2026

Copy link
Copy Markdown
Member

RFC for a global -C <dir> flag and the monorepo app-command UX built on it:

  • vp -C <dir> <cmd> behaves exactly like cd <dir> && vp <cmd>, for every vp command (the git -C / make -C convention). This is the first-class "run there" primitive vp lacks today; it also gives vp pack its missing directory form.
  • Fully backward compatible: vp dev <path> keeps upstream Vite semantics (root only), pack positionals stay tsdown entries, no flags are added to the subcommands themselves.
  • Built on -C, the app commands (dev/build/preview/pack) stop being silently wrong at a workspace root: an interactive fuzzy package picker in a TTY, a defaultPackage root config (also covers non-workspace framework repos like Laravel with a frontend/ directory), and a clear package listing plus exit 1 when non-interactive. All three expand to an implicit -C.

Pain points are reproducible: https://github.com/why-reproductions-are-required/vite-plus-monorepo-app-commands-repro

Full UX mockups, behavior spec, decisions, and open questions are in rfcs/cwd-flag.md.

@fengmk2 fengmk2 self-assigned this Jul 2, 2026
@netlify

netlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 19dcd2b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a47713a823c540007358a77
😎 Deploy Preview https://deploy-preview-2022--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@fengmk2 fengmk2 force-pushed the rfc/monorepo-app-commands branch from 410ac4d to ca5db55 Compare July 2, 2026 14:06
Comment thread rfcs/monorepo-app-commands.md Outdated

@fengmk2 fengmk2 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Left a few inline RFC comments.

Comment thread rfcs/monorepo-app-commands.md Outdated
Comment thread rfcs/monorepo-app-commands.md Outdated
Comment thread rfcs/monorepo-app-commands.md Outdated
@fengmk2 fengmk2 changed the title rfc: app commands at the monorepo root rfc: global -C flag for working-directory switching Jul 2, 2026
fengmk2 added a commit that referenced this pull request Jul 3, 2026
…pp commands

Implements rfcs/cwd-flag.md (RFC #2022):

- vp -C <dir> <cmd> runs any command as if started in <dir> (git/make/pnpm
  convention), parsed by both the global binary and the local bin; the
  spawned tool gets <dir> as its working directory, no process.chdir
- bare dev/build/preview/pack at a workspace root now resolve a target:
  defaultPackage from the root config (static extraction, works without a
  vite-plus install), single-runnable auto-select in interactive terminals,
  otherwise a package listing with -C hints and exit 1
- positional semantics are untouched: vite [root] and tsdown entries behave
  exactly as before (covered by a parity regression snap test)
- interactive picker is a follow-up pending vite_select prompt support
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.

1 participant