require-existing-repository-hook-cwd
Require repository hook cwd values to resolve to existing repository paths.
Rule catalog ID: R063
Targeted pattern scopeâ
.github/hooks/**/*.json
What this rule reportsâ
- relative hook
cwdvalues that do not exist in the repository
Why this rule existsâ
A repository-relative working directory still needs to point somewhere real. Validating the path on disk catches stale or misspelled hook working directories before the hook runs.
â Incorrectâ
{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready", "cwd": "scripts/hooks" }]
}
}
when scripts/hooks does not exist in the repository.
â Correctâ
{
"version": 1,
"hooks": {
"sessionStart": [{ "type": "command", "bash": "echo ready", "cwd": "scripts" }]
}
}