fix: correct regex anchors and align npx timeout in hook scripts

- Change \brg$ and \bgrep$ to \brg\b and \bgrep\b so full paths
  like /usr/bin/rg are matched correctly (all 3 hook variants)
- Reduce npx fallback timeout from 15s to 8s to fit within the
  10s hook runner timeout (Factory plugin)
This commit is contained in:
mrwogu 2026-03-09 09:25:08 +01:00
parent 455a75bce7
commit ef12f9811d
3 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ function extractPattern(toolName, toolInput) {
for (const token of tokens) {
if (skipNext) { skipNext = false; continue; }
if (!foundCmd) {
if (/\brg$|\bgrep$/.test(token)) foundCmd = true;
if (/\brg\b|\bgrep\b/.test(token)) foundCmd = true;
continue;
}
if (token.startsWith('-')) {

View file

@ -64,7 +64,7 @@ function extractPattern(toolName, toolInput) {
for (const token of tokens) {
if (skipNext) { skipNext = false; continue; }
if (!foundCmd) {
if (/\brg$|\bgrep$/.test(token)) foundCmd = true;
if (/\brg\b|\bgrep\b/.test(token)) foundCmd = true;
continue;
}
if (token.startsWith('-')) {
@ -122,7 +122,7 @@ function main() {
const child = spawnSync(
'npx',
['-y', 'gitnexus', 'augment', pattern],
{ encoding: 'utf-8', timeout: 15000, cwd, stdio: ['pipe', 'pipe', 'pipe'], shell: isWin }
{ encoding: 'utf-8', timeout: 8000, cwd, stdio: ['pipe', 'pipe', 'pipe'], shell: isWin }
);
if (child.status === 0 && child.stderr && child.stderr.trim()) {
result = child.stderr;

View file

@ -69,7 +69,7 @@ function extractPattern(toolName, toolInput) {
for (const token of tokens) {
if (skipNext) { skipNext = false; continue; }
if (!foundCmd) {
if (/\brg$|\bgrep$/.test(token)) foundCmd = true;
if (/\brg\b|\bgrep\b/.test(token)) foundCmd = true;
continue;
}
if (token.startsWith('-')) {