From 5cd50c31ff06cd95d69288668bb57b8d84279556 Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 20 Nov 2026 21:48:14 +0100 Subject: [PATCH] chore: require approval for commits and guard the kubeconfig Claude committed after a yes that was only meant for an edit, and once edited the local kubeconfig on its own. Commits now prompt, and kubeconfig/token edits are denied or prompt instead of relying on CLAUDE.md alone. --- .claude/settings.json | 8 +++++++- CLAUDE.md | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.claude/settings.json b/.claude/settings.json index 466058f..3e37d41 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -21,7 +21,6 @@ "Bash(kubectl top *)", "Bash(kubectl config get-contexts *)", "Bash(git add *)", - "Bash(git commit *)", "Bash(git switch *)", "Bash(.claude/scripts/gitea.sh GET *)", "WebFetch(domain:www.pulumi.com)", @@ -40,6 +39,10 @@ "Bash(pulumi config set *)", "Bash(pulumi config rm *)", "Bash(kubectl get secret*)", + "Bash(kubectl config set*)", + "Bash(kubectl config use-context *)", + "Bash(kubectl config delete*)", + "Bash(kubectl config rename-context *)", "Bash(kubectl apply *)", "Bash(kubectl delete *)", "Bash(kubectl patch *)", @@ -48,6 +51,7 @@ "Bash(ssh *)", "Bash(scp *)", "Bash(curl *)", + "Bash(git commit *)", "Bash(git push *)", "Bash(.claude/scripts/gitea.sh POST *)", "Bash(.claude/scripts/gitea.sh PATCH *)", @@ -61,6 +65,8 @@ "Bash(pulumi *--show-secrets*)", "Read(**/.env)", "Edit(**/Pulumi.dev.yaml)", + "Edit(~/.kube/**)", + "Edit(~/.config/homelab-agent/**)", "Read(~/.config/homelab-agent/token)", "Bash(*homelab-agent/token*)" ] diff --git a/CLAUDE.md b/CLAUDE.md index a02c0d1..ce61fb0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,6 +41,8 @@ A stack's outputs must exist (i.e. it must have been deployed) before any downst Branch names, commit messages and PR titles follow @CONVENTIONS.md. Don't add a co-author when committing to git. +Only commit when I explicitly say "commit" for that change. A yes to a question that also mentioned committing is not enough; when unsure, ask. + The remote is a self-hosted Gitea, so `gh` doesn't work. For PRs and their CI status use `.claude/scripts/gitea.sh` (acts as `claude-bot`), e.g. `.claude/scripts/gitea.sh GET '/repos/kasun/homelab-infrastructure-as-code/pulls?state=open'`. Use it for PRs only, and ask before opening or merging one. ## Live infrastructure