Skip to content

Commit 5761f24

Browse files
lvergroclaude
andcommitted
ci: shellcheck hooks + gate-check/session-context smoke tests
Runs on Ubuntu's default mawk — the environment where the original gawk-dependent gate failed open. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c17fba2 commit 5761f24

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
hooks:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: ShellCheck hooks
15+
run: shellcheck --severity=warning .claude/hooks/*.sh
16+
17+
# The smoke tests run with Ubuntu's default awk (mawk) — this is the
18+
# environment where the original gawk-dependent gate failed open.
19+
- name: gate-check smoke test
20+
env:
21+
CLAUDE_PROJECT_DIR: ${{ github.workspace }}
22+
run: |
23+
set -euo pipefail
24+
25+
# Protected path (migrations/ in project.yml) → must ask
26+
out=$(printf '{"tool_input":{"file_path":"%s/migrations/001.sql"}}' "$PWD" | bash .claude/hooks/gate-check.sh)
27+
echo "$out" | grep -q '"permissionDecision": "ask"'
28+
29+
# Nested path under a protected area → must ask
30+
out=$(printf '{"tool_input":{"file_path":"%s/migrations/2026/add.sql"}}' "$PWD" | bash .claude/hooks/gate-check.sh)
31+
echo "$out" | grep -q '"permissionDecision": "ask"'
32+
33+
# Unprotected path → no decision, exit 0
34+
out=$(printf '{"tool_input":{"file_path":"%s/src/index.ts"}}' "$PWD" | bash .claude/hooks/gate-check.sh)
35+
test -z "$out"
36+
37+
# Invalid JSON → no decision, exit 0
38+
out=$(printf 'not-json' | bash .claude/hooks/gate-check.sh)
39+
test -z "$out"
40+
41+
- name: session-context smoke test
42+
env:
43+
CLAUDE_PROJECT_DIR: ${{ github.workspace }}
44+
run: |
45+
set -euo pipefail
46+
# Idle template state → no injection, exit 0
47+
out=$(bash .claude/hooks/session-context.sh)
48+
test -z "$out"

0 commit comments

Comments
 (0)