Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .claude/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `.claude/` — federated harness surface

Federated under [terrarium](https://github.com/cerebral-work/terrarium) standards.

| Hook | Event | What | Bypass |
|---|---|---|---|
| `guard-main-push` | PreToolUse Bash | deny direct push to main | `# allow-direct-push` |
9 changes: 9 additions & 0 deletions .claude/hooks/guard-main-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Deny direct push to main/master. Override: "# allow-direct-push".
input=$(cat); cmd=$(printf '%s' "$input" | jq -r '.tool_input.command // ""')
case "$cmd" in *"# allow-direct-push"*) exit 0 ;; esac
if printf '%s' "$cmd" | grep -qE 'git +push.*(origin +)?(main|master)\b' \
|| { printf '%s' "$cmd" | grep -qE 'git +push' && [ "$(git branch --show-current 2>/dev/null)" = "main" ]; }; then
printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Direct push to main is blocked — open a PR. Override: # allow-direct-push and surface why."}}'
fi
exit 0
22 changes: 22 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"attribution": { "commit": "", "pr": "" },
"permissions": {
"allow": [
"Bash(git add *)", "Bash(git commit *)", "Bash(git push)",
"Bash(git fetch *)", "Bash(git status*)", "Bash(git diff*)",
"Bash(git log*)", "Bash(git checkout *)",
"Bash(rg *)", "Bash(grep *)", "Bash(jq *)", "Bash(gh pr *)",
"Read", "Edit", "Write"
],
"deny": ["Bash(rm -rf /*)", "Bash(rm -rf ~)"],
"defaultMode": "default"
},
"hooks": {
"PreToolUse": [
{ "matcher": "Bash", "hooks": [
{ "type": "command", "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/guard-main-push.sh", "timeout": 5 }
]}
]
}
}
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* @todie
/.claude/ @todie
/.github/ @todie
14 changes: 14 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Conventional Commits + gitleaks (federated standard).
# Skip: LEFTHOOK=0.
commit-msg:
commands:
conventional:
run: |
head -1 {1} | grep -qE '^(feat|fix|perf|refactor|docs|test|ci|build|infra|security|style|chore)(\(.+\))?!?: .+' \
|| { echo "commit-msg must be Conventional Commits: <type>(scope): <desc>"; exit 1; }

pre-commit:
parallel: true
commands:
gitleaks:
run: gitleaks protect --staged --redact --no-banner || echo "gitleaks not installed — CI will enforce"
Loading