The hook matched `npm\s+run\s+dev` against the raw command string, which
cannot see through the shell's own quoting. Every one of these reached the
shell as a plain `npm run dev` and was allowed:
npm run "dev" npm --silent run dev
npm run 'dev' yarn --cwd app dev
npm run de"v" pnpm "dev" / yarn run "dev" / bun run "dev"
Read the script name from the tokens instead, reusing the quote-aware
readToken() the file already had: skip options (and the value of one known to
take a value), skip a `run` / `run-script` keyword, stop at `--`, then compare
the first remaining token against /^dev(?::|$)/.
`dev-setup` / `dev-docs` / `dev-build` stay allowed by the same rule the old
lookahead encoded, `npm test -- --grep dev` is allowed because `--` ends the
manager's own arguments, and the tmux launcher exemption is unchanged.
The blocking tests were skipped on Windows, where the hook no-ops, so this
class could only be caught on CI. The new cases force the platform in-process
and therefore run everywhere.
`DEV_PATTERN`'s trailing `\b` treats a hyphen as a word boundary, so
`dev\b` matched the `dev` prefix of distinct npm scripts like
`dev-setup` / `dev-docs` / `dev-build` and blocked them with exit 2.
Replace the trailing `\b` with `(?![\w-])` so the dev server still
matches (`dev`, `dev;`, `dev:ssr`) but `dev-<suffix>` scripts pass.
Adds regression tests for dev-setup/dev-docs/dev-build (allowed) and
dev:ssr (still blocked).
Co-authored-by: bymle <229636660+bymle@users.noreply.github.com>