Files
ECC/tests/hooks
Nguyen Thanh Dat ddfdfffffc fix(dev-server-block): decide the script name from tokens, not raw text
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.
2026-08-24 10:46:01 +07:00
..