diff --git a/tilde/private_dot_config/opencode/AGENTS.md b/tilde/private_dot_config/opencode/AGENTS.md new file mode 100644 index 0000000..e908053 --- /dev/null +++ b/tilde/private_dot_config/opencode/AGENTS.md @@ -0,0 +1,57 @@ +# Global Instructions + +Personal defaults for opencode across all projects. Ported from the Claude Code +instruction set in `~/.claude/instructions/` (those files aren't wired into any +`CLAUDE.md` import, so they weren't actually loaded there — consolidated here so +they're active). + +## Editor Configuration + +- Always check for `.editorconfig` in the project root before editing files. +- If `.editorconfig` exists, strictly follow its rules: indentation style/size, + end of line characters, character encoding, final newline, trailing whitespace. + +## Code Quality + +- Write clear, maintainable code with proper documentation. +- Follow established conventions for the project's language. +- Include appropriate error handling. +- Use meaningful variable and function names. +- Follow DRY, YAGNI, KISS, and SOLID. + +### Error handling and debugging + +- Investigate and understand the root cause of errors — don't patch around them. +- Never use quick fixes/workarounds, comment out error-causing code, silence + errors with empty catch blocks, or modify tests just to make them pass. +- Preserve the integrity of existing test cases unless explicitly instructed + otherwise. +- If unsure about the best approach, ask for guidance. + +### Research + +- Actively search the web for unfamiliar libraries/frameworks, API docs, best + practices, error messages, or recent syntax/feature changes — don't assume + knowledge about rapidly changing technologies. +- If research is insufficient: report what was tried and what's still unknown, + and ask for guidance rather than filling gaps with assumptions. + +## Git + +- Prioritize Git MCP server tools over bash commands for Git operations when + an MCP server is available. +- Analyze all changes before committing; identify logical units of work and + never mix unrelated changes (different features, different bugfixes, + different components, code vs. config vs. docs) into a single commit. +- Acceptable to bundle: code with its tests, a feature with its docs, a bugfix + with its test case, config changes that directly support the same feature. +- Propose the commit split to the user before executing when a change touches + multiple logical units. + +## General Reminders + +- Do what's been asked; nothing more, nothing less. +- Prefer editing an existing file over creating a new one. +- Don't proactively create documentation or README files unless requested. +- Don't guess at unclear requirements — ask for clarification instead of + proceeding on assumptions. diff --git a/tilde/private_dot_config/opencode/commands/chezmoi-apply.md b/tilde/private_dot_config/opencode/commands/chezmoi-apply.md new file mode 100644 index 0000000..82ccb7d --- /dev/null +++ b/tilde/private_dot_config/opencode/commands/chezmoi-apply.md @@ -0,0 +1,33 @@ +--- +description: Apply chezmoi changes with conflict resolution +--- + +This command applies all staged changes from the chezmoi source directory to your home directory with intelligent conflict handling. + +## Command Behavior + +When you run `/chezmoi-apply`, opencode will: + +1. Show a preview of changes using `chezmoi diff --no-tty` +2. Attempt to apply changes using `chezmoi apply --no-tty` +3. If conflicts are detected: + - Display the conflicting files and their differences + - Present options: overwrite, skip, or quit for each conflict + - Wait for user decision before proceeding +4. Report the final result of the operation + +## Conflict Resolution Options + +When conflicts occur, you'll be prompted with these options for each file: +- **overwrite**: Replace the target file with chezmoi's version +- **skip**: Keep the existing file and skip this change +- **quit**: Stop the apply process entirely + +## Security + +This command is safe to use as it only applies changes that are already staged in your chezmoi source directory. The conflict resolution ensures you maintain control over which changes are applied. + +## Related Commands + +- Use regular file editing commands to modify files in the chezmoi source directory first +- This command only applies changes; it doesn't modify source files diff --git a/tilde/private_dot_config/opencode/opencode.json b/tilde/private_dot_config/opencode/opencode.json new file mode 100644 index 0000000..d689ba6 --- /dev/null +++ b/tilde/private_dot_config/opencode/opencode.json @@ -0,0 +1,135 @@ +{ + "$schema": "https://opencode.ai/config.json", + "model": "anthropic/claude-sonnet-4-5", + "provider": { + "anthropic": { + "options": { + "apiKey": "{env:ANTHROPIC_API_KEY}" + } + }, + "openrouter": { + "options": { + "apiKey": "{env:OPENROUTER_API_KEY}" + } + } + }, + "autoupdate": false, + "permission": { + "edit": "allow", + "webfetch": "allow", + "websearch": "allow", + "bash": { + "*": "ask", + "chezmoi status": "allow", + "chezmoi diff *": "allow", + "chezmoi cat *": "allow", + "chezmoi data": "allow", + "chezmoi doctor": "allow", + "chezmoi dump *": "allow", + "chezmoi list *": "allow", + "chezmoi state *": "allow", + "chezmoi verify *": "allow", + "chezmoi --version": "allow", + "brew list *": "allow", + "brew outdated *": "allow", + "brew deps *": "allow", + "brew info *": "allow", + "brew search *": "allow", + "brew doctor *": "allow", + "brew config": "allow", + "mise outdated *": "allow", + "mise list-remote *": "allow", + "mise plugins *": "allow", + "mise settings *": "allow", + "mise tasks *": "allow", + "mise env *": "allow", + "mise --version": "allow", + "mise list": "allow", + "mise current": "allow", + "mise ls": "allow", + "mise doctor": "allow", + "mise which *": "allow", + "terraform --version": "allow", + "terraform -version": "allow", + "terraform version": "allow", + "terraform version *": "allow", + "terraform validate": "allow", + "terraform validate *": "allow", + "terraform fmt -check": "allow", + "terraform fmt -check *": "allow", + "terraform graph": "allow", + "terraform graph *": "allow", + "terraform show": "allow", + "terraform show *": "allow", + "terraform output": "allow", + "terraform output *": "allow", + "terraform providers": "allow", + "terraform providers schema": "allow", + "terraform providers schema *": "allow", + "terraform state list": "allow", + "terraform state list *": "allow", + "terraform state show *": "allow", + "terraform workspace list": "allow", + "terraform workspace show": "allow", + "git status *": "allow", + "git log *": "allow", + "git show *": "allow", + "git diff *": "allow", + "git branch *": "allow", + "git remote *": "allow", + "gh run download *": "allow", + "gh run list *": "allow", + "gh run view *": "allow", + "gh run watch *": "allow", + "gh repo view *": "allow", + "gh repo list *": "allow", + "gh pr *": "allow", + "gh issue create *": "allow", + "gh issue list *": "allow", + "gh issue view *": "allow", + "gh release list *": "allow", + "gh release view *": "allow", + "gh status": "allow", + "gh auth status": "allow", + "gh api *": "allow", + "markdownlint *": "allow", + "uv run *": "allow", + "grep *": "allow", + "ls *": "allow", + "cat *": "allow", + "head *": "allow", + "tail *": "allow", + "wc *": "allow", + "find *": "allow", + "which *": "allow", + "pwd": "allow", + "env": "allow", + "printenv *": "allow", + "tree *": "allow", + "file *": "allow", + "stat *": "allow", + "diff *": "allow", + "rg *": "allow", + "ripgrep *": "allow", + "fd *": "allow", + "bat *": "allow", + "jq *": "allow", + "awk *": "allow", + "sed *": "allow", + "sort *": "allow", + "uniq *": "allow", + "python -c *": "allow", + "python -m json.tool *": "allow", + "pytest --collect-only *": "allow", + "pytest --help": "allow", + "npm list *": "allow", + "npm outdated *": "allow", + "pip list *": "allow", + "pip show *": "allow", + "poetry show *": "allow", + "poetry check": "allow", + "docker ps *": "allow", + "docker images *": "allow" + } + } +}