Commit 012e9ca
committed
fix(toolkit): handle single-quoted grep patterns in claim-verification hook (DOJ-4872)
Round-3 bot review at 4/5 confidence flagged 1 P3: the pattern extractor
only handled double-quoted forms, so `grep -rn 'Symbol' src/` would fall
through to the awk fallback and (until the awk fallback also stripped
single quotes) emit `'Symbol'` with the quotes attached.
Applied:
- Added a second extractor branch that mirrors the double-quote form but
for single-quoted patterns. Tries double-quote first (cheapest grep),
then single-quote, then the multi-flag awk fallback.
- Extended `tr -d` in the awk fallback to strip both `"` and `'`, so the
unquoted-token output is clean regardless of which quote style the
original command used.
Verification:
- shellcheck → 0 issues
- "grep -rn 'Symbol' src/" → "Symbol" (was: 'Symbol')
- "grep -rn \"Symbol\" src/" → "Symbol" (regression)
- "grep -i -r 'Symbol' src/" → "Symbol" (new, multi-flag + single quote)
- "grep -i -r \"Symbol\" src/" → "Symbol" (regression)
- "ls src/foo.tsx" → src/foo.tsx (regression)
- "echo hello" → silent (regression)
Created by Claude Code on behalf of @lapc506.1 parent 067c74b commit 012e9ca
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
| 183 | + | |
| 184 | + | |
175 | 185 | | |
176 | 186 | | |
177 | | - | |
| 187 | + | |
178 | 188 | | |
179 | 189 | | |
180 | 190 | | |
| |||
0 commit comments