mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
The worktree path regex in pre-merge-check.ts used [^\s/]+ which only matched a single path segment after /tmp/spawn-worktrees/. This blocked PR merges from nested worktrees like refactor/fix/issue-N used by the automated refactoring service. Fix both the TypeScript regex ([^\s/]+ -> [^\s]+) and the inline bash grep pattern in settings.json ([a-zA-Z0-9._-]+ -> [a-zA-Z0-9._/-]+). Closes #2401 Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c4ae16849d
commit
d584cc4d4e
2 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ function fail(msg: string): never {
|
|||
|
||||
// Find repo root — try extracting a worktree path from the command, else use git
|
||||
let repoRoot: string;
|
||||
const worktreeMatch = command.match(/\/tmp\/spawn-worktrees\/[^\s/]+/);
|
||||
const worktreeMatch = command.match(/\/tmp\/spawn-worktrees\/[^\s]+/);
|
||||
if (worktreeMatch) {
|
||||
repoRoot = worktreeMatch[0];
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "bash -c 'INPUT=$(cat); CMD=$(echo \"$INPUT\" | jq -r \".tool_input.command // empty\"); echo \"$CMD\" | grep -qE \"gh pr (merge|ready)\" || exit 0; WT=$(echo \"$CMD\" | grep -oE \"/tmp/spawn-worktrees/[a-zA-Z0-9._-]+\" | head -1); if [ -n \"$WT\" ] && [ -d \"$WT/packages/cli\" ]; then ROOT=\"$WT\"; else ROOT=$(git rev-parse --show-toplevel 2>/dev/null); fi; if [ -z \"$ROOT\" ] || [ ! -d \"$ROOT/packages/cli\" ]; then echo \"WARNING: Could not find spawn repo for pre-merge checks\" >&2; exit 0; fi; cd \"$ROOT/packages/cli\" || exit 2; echo \"Pre-merge gate: running biome check + bun test in $ROOT/packages/cli ...\" >&2; bunx @biomejs/biome check src/ 2>&1 || { echo \"BLOCKED: biome check failed — fix lint/format issues before merging\" >&2; exit 2; }; bun test 2>&1 || { echo \"BLOCKED: tests failed — fix failures before merging\" >&2; exit 2; }; echo \"Pre-merge checks passed\" >&2'"
|
||||
"command": "bash -c 'INPUT=$(cat); CMD=$(echo \"$INPUT\" | jq -r \".tool_input.command // empty\"); echo \"$CMD\" | grep -qE \"gh pr (merge|ready)\" || exit 0; WT=$(echo \"$CMD\" | grep -oE \"/tmp/spawn-worktrees/[a-zA-Z0-9._/-]+\" | head -1); if [ -n \"$WT\" ] && [ -d \"$WT/packages/cli\" ]; then ROOT=\"$WT\"; else ROOT=$(git rev-parse --show-toplevel 2>/dev/null); fi; if [ -z \"$ROOT\" ] || [ ! -d \"$ROOT/packages/cli\" ]; then echo \"WARNING: Could not find spawn repo for pre-merge checks\" >&2; exit 0; fi; cd \"$ROOT/packages/cli\" || exit 2; echo \"Pre-merge gate: running biome check + bun test in $ROOT/packages/cli ...\" >&2; bunx @biomejs/biome check src/ 2>&1 || { echo \"BLOCKED: biome check failed — fix lint/format issues before merging\" >&2; exit 2; }; bun test 2>&1 || { echo \"BLOCKED: tests failed — fix failures before merging\" >&2; exit 2; }; echo \"Pre-merge checks passed\" >&2'"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue