diff --git a/opencode/.config/opencode/agents/safe-build.md b/opencode/.config/opencode/agents/safe-build.md new file mode 100644 index 0000000..1d7ca21 --- /dev/null +++ b/opencode/.config/opencode/agents/safe-build.md @@ -0,0 +1,78 @@ +--- +description: Build agent with guarded shell access and no silent git mutations +mode: primary + +tools: + write: true + edit: true + patch: true + bash: true + +permission: + write: allow + edit: allow + patch: allow + webfetch: ask + + task: + "*": deny + "explore": allow + + bash: + "*": ask + + # безопасное чтение + "pwd": allow + "ls": allow + "ls *": allow + "cat": allow + "cat *": allow + "head": allow + "head *": allow + "tail": allow + "tail *": allow + "wc -l": allow + "wc -l *": allow + + # read-only git + "git status": allow + "git status *": allow + "git diff": allow + "git diff *": allow + "git log": allow + "git log *": allow + "git show": allow + "git show *": allow + "git blame": allow + "git blame *": allow + "git rev-parse": allow + "git rev-parse *": allow + "git branch --show-current": allow + "git branch --list*": allow + "git tag --list*": allow + + # опасные git-операции — только с подтверждением + "git add*": ask + "git commit*": ask + "git switch*": ask + "git checkout*": ask + "git restore*": ask + "git reset*": ask + "git clean*": ask + "git merge*": ask + "git rebase*": ask + "git stash*": ask + "git fetch*": ask + "git pull*": ask + + # push вообще запрещаем + "git push*": deny +--- + +You are a build agent. + +Default to making code changes through native file-editing tools. +Use bash when it is the clearest path, but avoid unnecessary shell usage. + +Never run git commit, branch switching, history rewriting, or network git operations without explicit user approval. +Prefer built-in tools for reading files and searching code. \ No newline at end of file diff --git a/opencode/.config/opencode/agents/safe-plan.md b/opencode/.config/opencode/agents/safe-plan.md new file mode 100644 index 0000000..bb17b22 --- /dev/null +++ b/opencode/.config/opencode/agents/safe-plan.md @@ -0,0 +1,99 @@ +--- +description: Safe planning and repository analysis with read-only focus +mode: primary + +tools: + write: false + edit: false + patch: false + bash: true + +permission: + webfetch: ask + + task: + "*": deny + "explore": allow + + bash: + "*": ask + + "pwd": allow + + "ls": allow + "ls *": allow + + "find": allow + "find *": allow + + "cat": allow + "cat *": allow + "head": allow + "head *": allow + "tail": allow + "tail *": allow + "wc -l": allow + "wc -l *": allow + + "rg": allow + "rg *": allow + + "git status": allow + "git status *": allow + "git diff": allow + "git diff *": allow + "git log": allow + "git log *": allow + "git show": allow + "git show *": allow + "git blame": allow + "git blame *": allow + "git remote -v": allow + + # жёсткий запрет на мутации + "git add*": deny + "git commit*": deny + "git switch*": deny + "git checkout*": deny + "git restore*": deny + "git reset*": deny + "git clean*": deny + "git merge*": deny + "git rebase*": deny + "git stash*": deny + "git push*": deny + "git pull*": deny + "git fetch*": deny + + "rm *": deny + "mv *": deny + "cp *": deny + "tee *": deny + "chmod *": deny + "chown *": deny + "sed -i*": deny + "perl -pi*": deny + "python*": deny + "node*": deny + "sh -c*": deny + "bash -c*": deny + "npm *": deny + "pnpm *": deny + "yarn *": deny + "bun *": deny +--- + +You are a planning and analysis agent. + +For repository briefing: +1. First inspect README, root manifests, and top-level directories using built-in tools. +2. Use bash only for: + - file discovery across the repo + - git history and change analysis + - quick read-only summaries +3. Never use bash for edits or execution of interpreters. + +Prefer: +- read/list/glob/grep for content inspection +- git log/show/diff/blame for history +- find/rg only when built-in tools are inconvenient \ No newline at end of file diff --git a/opencode/.config/opencode/opencode.json b/opencode/.config/opencode/opencode.json index a21c391..6e45189 100644 --- a/opencode/.config/opencode/opencode.json +++ b/opencode/.config/opencode/opencode.json @@ -1,14 +1,24 @@ { "$schema": "https://opencode.ai/config.json", + + // По умолчанию всегда стартуем в безопасном режиме + "default_agent": "safe-plan", + + // Глобальный baseline: если случайно переключился на встроенный build, + // ничего критичного не должно улететь без вопросов. "permission": { + "write": "ask", + "edit": "ask", + "patch": "ask", + "webfetch": "ask", + "task": "ask", "bash": { - "git commit*": "ask", - "git commit --amend*": "ask", - "git branch*": "ask", - "git switch*": "ask", - "git *": "allow" + "*": "ask", + "git push": "deny", + "git push *": "deny" } }, + "mcp": { "context7": { "type": "remote", @@ -18,6 +28,7 @@ }, "enabled": true }, + "web-reader": { "type": "remote", "url": "https://api.z.ai/api/mcp/web_reader/mcp", @@ -26,6 +37,7 @@ }, "enabled": false }, + "web-search-prime": { "type": "remote", "url": "https://api.z.ai/api/mcp/web_search_prime/mcp", @@ -34,6 +46,7 @@ }, "enabled": false }, + "zread": { "type": "remote", "url": "https://api.z.ai/api/mcp/zread/mcp", @@ -42,10 +55,13 @@ }, "enabled": false }, + "playwright": { "type": "local", "command": ["npx", "-y", "@playwright/mcp@latest"], "enabled": false } - } -} + }, + + "share": "manual" +} \ No newline at end of file