dotfiles

andersuno
git clone git://git.andersuno.nu/dotfiles.git
Log | Files | Refs | README

commit 019485747e5c2dc2794dc341e4492d1bdfdb3647
parent cde865111d0d3b3153b9ce62f3b3c919026a0308
Author: Anders Hedman <anders.hedman01@gmail.com>
Date:   Mon, 24 Aug 2026 21:24:05 +0200

opencode: add opencode to dots

Diffstat:
A.config/opencode/opencode.jsonc | 158+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/opencode/skills/git-commiter/SKILL.md | 40++++++++++++++++++++++++++++++++++++++++
2 files changed, 198 insertions(+), 0 deletions(-)

diff --git a/.config/opencode/opencode.jsonc b/.config/opencode/opencode.jsonc @@ -0,0 +1,158 @@ +{ + "$schema": "https://opencode.ai/config.json", + + "provider": { + "ollama": { + "npm": "@ai-sdk/openai-compatible", + "name": "Ollama Local", + "options": { + "baseURL": "http://127.0.0.1:11434/v1" + }, + "models": { + "gemma4:e2b": { + "name": "gemma4:e2b", + "reasoning": true, + "tool_call": true, + }, + } + }, + }, + + "permission": { + // Read-only tools: ask for anything, but never touch .env / .envrc + "read": { + "*": "ask", + "*.env": "deny", + "*.envrc": "deny", + "cloud.conf": "deny", + "secret*": "deny", + "terraform.tfstate*": "deny" + }, + "glob": { + "*": "ask", + "*.env": "deny", + "*.envrc": "deny", + "cloud.conf": "deny", + "secret*": "deny", + "terraform.tfstate*": "deny" + }, + "grep": { + "*": "ask", + "*.env": "deny", + "*.envrc": "deny", + "cloud.conf": "deny", + "secret*": "deny", + "terraform.tfstate*": "deny" + }, + "list": "allow", + "lsp": "allow", + "task": "allow", + "skill": "allow", + "todowrite": "allow", + "question": "allow", + "webfetch": "ask", + "websearch": "allow", + + "edit": "ask", + + "bash": { + "*": "ask", + // basic inspection + "ls*": "allow", + "pwd*": "allow", + "cat*": "allow", + "head*": "allow", + "tail*": "allow", + "find*": "allow", + "grep*": "allow", + "rg*": "allow", + "diff*": "allow", + "file*": "allow", + "which*": "allow", + "wc*": "allow", + "du*": "allow", + "df*": "allow", + "uname*": "allow", + // read-only git + "git status*": "allow", + "git diff*": "allow", + "git log*": "allow", + "git show*": "allow", + "git fetch*": "allow", + "git branch*": "allow", + "git remote*": "allow", + "git stash list*": "allow", + // test / check commands + "npm test*": "allow", + "npm run lint*": "allow", + "npm run typecheck*": "allow", + "cargo check*": "allow", + "cargo test*": "allow", + "go vet*": "allow", + "go test*": "allow", + "pytest*": "allow", + "python3 -m pytest*": "allow", + // mutating: always confirm (must come after any matching allow) + "git add*": "ask", + "git commit*": "ask", + "git push*": "ask", + "git reset*": "ask", + "git checkout*": "ask", + "git clean*": "ask", + "git rebase*": "ask", + "npm install*": "ask", + "npm run build*": "ask", + "cargo build*": "ask", + "go build*": "ask", + "pip install*": "ask", + "terraform plan*": "ask", + "terraform apply*": "ask", + "docker*": "ask", + "curl*": "ask", + "wget*": "ask", + "sudo*": "ask", + "chmod*": "ask", + "chown*": "ask", + "cp*": "ask", + "mv*": "ask", + "mkdir*": "ask", + "touch*": "ask", + "rm *": "ask", + // .env / .envrc via shell + "cat* .env*": "deny", + "grep* .env*": "deny", + "rg* .env*": "deny", + "head* .env*": "deny", + "tail* .env*": "deny", + // terraform.tfstate + "cat* terraform.tfstate*": "deny", + "grep* terraform.tfstate*": "deny", + "rg* terraform.tfstate*": "deny", + "head* terraform.tfstate*": "deny", + "tail* terraform.tfstate*": "deny", + // Sops + "sops*": "deny", + // destructive: never auto-run (last rules win) + "rm -rf*": "deny", + "rm -fr*": "deny", + "git push --force*": "deny", + "shutdown*": "deny", + "reboot*": "deny", + "mkfs*": "deny", + "dd *": "deny" + }, + + // Files outside the workspace: confirm, but block secrets outright + "external_directory": { + "*": "ask", + "~/.aws/**": "deny", + "~/.config/opencode/**": "ask", + "~/.gnupg/**": "deny", + "~/.kube/**": "deny", + "~/.s3cfg*": "deny", + "~/.ssh/**": "deny", + "~/.vault_pass.txt*": "deny", + "~/.vault-token*": "deny" + } + } +} diff --git a/.config/opencode/skills/git-commiter/SKILL.md b/.config/opencode/skills/git-commiter/SKILL.md @@ -0,0 +1,40 @@ +--- +name: git-commiter +description: Write descriptive but managable git commit messages +--- + +## Commit Message Guidelines + +- The subject line must be **≤ 50 characters** (includes whitespace). +- Include a descriptive body +- Write in imperative mood and start with a capital letter. +- Do not end the subject with a period. +- Separate subject and body with a blank line. + +## Body Rules + +- Each body line ≤ 72 characters. +- Use `-m` for each paragraph when committing from CLI. + Example: + ``` + git commit -m "Subject" -m "Body paragraph 1" -m "Body paragraph 2" + ``` + +## Useful commands + +- Use `git commit --amend` to modify the most recent commit. + ``` + git commit --amend -m "New subject" -m "New body" + ``` +- To view the last commit verbatim, run: + ``` + git log -1 --pretty=full + ``` + +## Remember + +- Avoid using `git commit -a` unless you know what you’re committing. +- Keep messages focused; explain *what* was done and *why* it matters. +- Show the plan first. +- Do not commit until the user confirms. +