fix(pnpm): rewrite pnpm commands with global flags before the subcommand
The hook rewriter matched pnpm via a subcommand allowlist anchored right after `pnpm ` (`^pnpm\s+(install|list|...)`), so flag-first monorepo forms were never rewritten and streamed raw: pnpm run build -> rtk pnpm run build (matched) pnpm -r install -> (not rewritten) pnpm --filter @app list -> (not rewritten) pnpm -w install -> (not rewritten) Add `strip_pnpm_global_opts` (mirror of the existing `strip_git_global_opts`) that strips a fixed set of pnpm global options (`-r`/`--recursive`, `-w`/`--workspace-root`, `--filter`/`-F`) for CLASSIFICATION only. The rewrite step still operates on the original text via `strip_word_prefix`, so an unknown flag or a flag-first form with no matching rewrite prefix is a safe no-op — never a malformed rewrite. `rtk pnpm` now accepts `-r`/`-w` globally and forwards them. The flags are forwarded after the subcommand (`pnpm install -r`), matching the established `--filter` handling. This is behavior-preserving: they are root-level pnpm options accepted in either position (verified against pnpm 9.15.4; `pnpm <flag> <sub>` and `pnpm <sub> <flag>` produce identical output and install scope for `-r`, `-w`, and `--filter`). Adds 16 tests: flag-first rewrite forms, no-regression on bare forms, and false-positive guards (unknown flag not stripped, filter without subcommand, recursive-lint safe no-op).
B
breisnerlopez committed
0fe63b392439fef46dc9c75e6cd6bdf5e1d0a5fb
Parent: 79347d5