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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
pull_request:
push:
branches: [main]

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: gitleaks
env:
GITLEAKS_VERSION: 8.30.1
GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
shell: bash
run: |
set -euo pipefail
curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" -o gitleaks.tar.gz
echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum -c -
tar -xzf gitleaks.tar.gz gitleaks
./gitleaks git . --redact --no-banner --verbose
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