Commit Graph
7 Commits
Author SHA1 Message Date
L4XB ce2b27664f fix(hooks): check the commands that an expanded here-document body runs
Bash expands a here-document body unless part of its delimiter is quoted, and runs the $(...) and backquoted substitutions in it, with quotes as plain text. Leaving the whole body out of the segments hid those commands, so npm --version <<EOF with '$(npm run dev)' in the body was allowed. The commands of these substitutions are now segments of their own. An escaped substitution, or a body whose delimiter is quoted (<<'EOF', <<\EOF), stays data.
2026-10-23 03:13:14 +02:00
L4XB de87e6ec74 fix(hooks): leave here-document bodies out of the shell segments
A body attached to the segment of its command was still searched by the dev-server check. For npm --version <<EOF && cat, the body line npm run dev made the npm segment look like a dev server. A body is data, so it is no longer part of any segment. An empty delimiter (<<'') is a valid opener again, and its body ends at the first empty line.
2026-10-23 02:47:32 +02:00
L4XB d583576552 fix(hooks): read a here-document delimiter as a shell word and keep bodies with their command
The opener pattern read only an identifier, so <<EOF/END stored EOF, <<E"OF" stored E and <<123 was no opener at all. In each case the body was split into segments, or the line after it was swallowed. The delimiter is now read as a shell word with its quotes and backslashes removed, as Bash does. A body that follows an operator at the end of its line (cat <<EOF &&) was split off as a segment of its own. It now goes with the command that opened it.
2026-10-23 02:18:33 +02:00
L4XB 2eee66a6c1 fix(hooks): split shell segments at newlines, keeping here-document bodies whole
splitShellSegments() split at &&, ||, ; and & but not at a newline, so a multi-line command such as "cd app\nnpm run dev" was one segment led by cd, and the dev-server block let the dev server through. A newline now ends a segment. The body of a here-document (<<EOF, <<-EOF, <<'EOF') stays in the segment of the command that reads it, so a README written with cat <<EOF that mentions npm run dev is not blocked; a here-string (<<<) or a shift such as $((x << 2)) is not read as one.
2026-10-23 01:45:20 +02:00
bymleandbymle 7883da658b fix(dev-server-block): stop blocking dev-<suffix> scripts (#2179)
`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>
2026-06-07 13:25:39 +08:00
375d750b4c fix: integrate recent hook and docs PRs (#1905)
Integrates useful changes from #1882, #1884, #1889, #1893, #1898, #1899, and #1903:
- fix rule install docs to preserve language directories
- correct Ruby security command examples
- harden dev-server hook command-substitution parsing
- add Prisma patterns skill and catalog/package surfaces
- allow first-time protected config creation while blocking existing configs
- read cost metrics from Stop hook transcripts
- emit suggest-compact additionalContext on stdout

Co-authored-by: Jamkris <dltmdgus1412@gmail.com>
Co-authored-by: Levi-Evan <levishantz@gmail.com>
Co-authored-by: gaurav0107 <gauravdubey0107@gmail.com>
Co-authored-by: richm-spp <richard.millar@salarypackagingplus.com.au>
Co-authored-by: zomia <zomians@outlook.jp>
Co-authored-by: donghyeun02 <donghyeun02@gmail.com>
2026-05-14 21:37:28 -04:00
Affaan Mustafa b6595974c2 feat: add C++ language support and hook tests (#539)
- agents: cpp-build-resolver, cpp-reviewer
- commands: cpp-build, cpp-review, cpp-test
- rules: cpp/ (coding-style, hooks, patterns, security, testing)
- tests: 9 new hook test files with comprehensive coverage

Cherry-picked from PR #436.
2026-03-16 14:31:49 -07:00