opencodekit 0.12.0 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,16 @@
1
1
  ---
2
2
  purpose: Code patterns, commit style, PR process, team conventions
3
- updated: 2024-12-21
3
+ updated: 2025-01-05
4
4
  ---
5
5
 
6
6
  # Project Conventions
7
7
 
8
8
  ## Code Style
9
9
 
10
- <!-- Naming conventions, formatting rules, import ordering -->
10
+ - **TypeScript**: ES2022, ESNext modules, strict disabled, forceConsistentCasing
11
+ - **Python**: 3.10+, type hints required, dataclasses for config, pathlib for paths
12
+ - **Imports**: Group stdlib, third-party, local imports
13
+ - **Naming**: PascalCase classes, snake_case functions/variables, UPPER_CASE constants
11
14
 
12
15
  ## Commit Messages
13
16
 
@@ -17,10 +20,106 @@ updated: 2024-12-21
17
20
 
18
21
  <!-- Review requirements, CI checks, merge strategy -->
19
22
 
20
- ## Patterns to Follow
23
+ ## OpenCode Configuration Patterns (v1.1.2+)
21
24
 
22
- <!-- Recurring patterns in this codebase -->
25
+ ### Permission Structure Best Practice
26
+
27
+ ```jsonc
28
+ {
29
+ "permission": {
30
+ "bash": {
31
+ "*": "allow", // 1. Base rule first (catch-all)
32
+ "git status*": "allow", // 2. Safe operations whitelisted
33
+ "git diff*": "allow",
34
+ "npm *": "allow",
35
+ "rm*": "deny", // 3. Dangerous operations denied
36
+ "sudo*": "deny",
37
+ },
38
+ "read": {
39
+ ".env": "deny", // 4. Protect secrets
40
+ ".env.example": "allow", // But allow examples
41
+ },
42
+ },
43
+ }
44
+ ```
45
+
46
+ ### LSP Tool Strategy
47
+
48
+ **This project uses built-in experimental LSP** (`experimental.lsp: true`).
49
+
50
+ | Tool | Purpose |
51
+ | --------------------------- | ---------------------------- |
52
+ | `lsp_lsp_hover` | Type info and docs at cursor |
53
+ | `lsp_lsp_goto_definition` | Jump to symbol definition |
54
+ | `lsp_lsp_find_references` | Find all usages |
55
+ | `lsp_lsp_rename` | Rename across codebase |
56
+ | `lsp_lsp_code_actions` | Get available refactorings |
57
+ | `lsp_lsp_code_action_apply` | Apply a code action |
58
+ | `lsp_lsp_diagnostics` | Get errors/warnings |
59
+ | `lsp_lsp_document_symbols` | File outline |
60
+ | `lsp_lsp_workspace_symbols` | Search symbols |
61
+ | `lsp_lsp_organize_imports` | Clean up imports |
62
+
63
+ ### DCP Configuration Tiers
64
+
65
+ | Tier | Strategies | nudgeFrequency | turnProtection | Use When |
66
+ | ---------------- | ------------------ | -------------- | -------------- | ---------------------------- |
67
+ | **Aggressive** | All enabled | 8 | 3 | Long sessions, context-heavy |
68
+ | **Conservative** | Deduplication only | 12+ | 6+ | Safety-first, debugging |
69
+ | **Balanced** | All enabled | 10 | 4 | Default, general use |
70
+
71
+ ### Protected Tools Pattern
72
+
73
+ Always protect these tools from auto-pruning:
74
+
75
+ ```jsonc
76
+ "protectedTools": [
77
+ // State-modifying
78
+ "write", "edit", "skill_mcp", "bd_sync",
79
+ // Metadata
80
+ "memory-search", "memory-update", "observation", "todowrite", "todoread",
81
+ // Task management
82
+ "task", "batch",
83
+ // LSP (if using plugin)
84
+ "lsp_lsp_find_references", "lsp_lsp_goto_definition"
85
+ ]
86
+ ```
23
87
 
24
88
  ## Patterns to Avoid
25
89
 
26
- <!-- Anti-patterns specific to this project -->
90
+ ### Anti-Pattern: Mixing LSP Systems
91
+
92
+ ```jsonc
93
+ // DON'T: Causes tool duplication and naming confusion
94
+ {
95
+ "experimental": { "lsp": true }, // Built-in: lsp_lsp_*
96
+ // AND .opencode/tool/lsp.ts // Custom: lsp_*
97
+ }
98
+
99
+ // DO: Use built-in only (recommended for this project)
100
+ {
101
+ "experimental": { "lsp": true }
102
+ }
103
+ // Delete any custom .opencode/tool/lsp.ts
104
+ ```
105
+
106
+ ### Anti-Pattern: Over-Restrictive Permissions
107
+
108
+ ```jsonc
109
+ // DON'T: Blocks legitimate workflow
110
+ {
111
+ "bash": { "git *": "ask" } // Every git command asks
112
+ }
113
+
114
+ // DO: Whitelist safe, ask dangerous
115
+ {
116
+ "bash": {
117
+ "git status*": "allow",
118
+ "git diff*": "allow",
119
+ "git log*": "allow",
120
+ "git commit*": "ask",
121
+ "git push*": "ask",
122
+ "git reset*": "ask"
123
+ }
124
+ }
125
+ ```
@@ -1,26 +1,60 @@
1
1
  ---
2
2
  purpose: Footguns, edge cases, and "don't forget this" warnings
3
- updated: 2024-12-21
3
+ updated: 2025-01-05
4
4
  ---
5
5
 
6
6
  # Project Gotchas
7
7
 
8
- ## Code That Looks Right But Breaks
8
+ ## Configuration Quirks
9
+
10
+ ### DCP v1.1.3 Schema Breaking Changes
11
+
12
+ 1. **Legacy `strategies.onIdle` removed**: v1.1.2+ no longer supports this field
13
+ - Error: `Unknown keys: strategies.onIdle`
14
+ - Fix: Remove the entire `onIdle` block from `dcp.jsonc`
9
15
 
10
- <!-- Subtle bugs, misleading APIs -->
16
+ 2. **Permission model changed**: v1.1.1+ deprecated legacy `tools: { write: true }` boolean syntax
17
+ - Old: Global `tools: {}` with booleans
18
+ - New: `permission: {}` with `"allow"` / `"ask"` / `"deny"` actions
19
+ - Both still work for backwards compatibility, but new syntax preferred
20
+
21
+ ### OpenCode v1.1.2 New Features
22
+
23
+ - `compaction.auto` and `compaction.prune` are NEW - enable both for long sessions
24
+ - `experimental.continue_loop_on_deny` - controls agent behavior after permission denial
25
+ - `cargo-fmt` formatter support added for Rust projects
11
26
 
12
27
  ## Non-Obvious Dependencies
13
28
 
14
- <!-- Hidden coupling, initialization order -->
29
+ ### LSP Tool Naming Convention
15
30
 
16
- ## Configuration Quirks
31
+ - OpenCode built-in LSP uses `lsp_lsp_*` prefix (e.g., `lsp_lsp_rename`, `lsp_lsp_hover`)
32
+ - Requires `experimental.lsp: true` in opencode.json
33
+ - **This project uses built-in LSP** (custom plugin removed for simplicity)
34
+ - Custom plugins would use `lsp_*` prefix - avoid mixing both
17
35
 
18
- <!-- Environment variables, config files that bite -->
36
+ ### Protected Tools in DCP
37
+
38
+ v1.1.3 recognizes more tool variants. Ensure these are protected:
39
+
40
+ - `lsp_lsp_find_references`, `lsp_lsp_goto_definition` (plugin-specific naming)
41
+ - `memory-search`, `skill_mcp`, `bd_sync` (often forgotten)
19
42
 
20
43
  ## Time Wasters
21
44
 
22
- <!-- Things that will waste 2+ hours if you forget -->
45
+ ### Debugging DCP Errors
46
+
47
+ If DCP plugin throws "Unknown keys" errors:
48
+
49
+ 1. Check OpenCode version (`opencode --version`)
50
+ 2. Compare against [DCP schema](https://github.com/opencode/dcp) for your version
51
+ 3. Remove deprecated fields - don't try to "fix" them
52
+
53
+ ### Permission Debugging
23
54
 
24
- ## Platform-Specific Issues
55
+ If tools are unexpectedly blocked:
25
56
 
26
- <!-- macOS vs Linux, Node versions, etc. -->
57
+ 1. Check global config: `~/.config/opencode/opencode.json`
58
+ 2. Check project config: `.opencode/opencode.json`
59
+ 3. Project config takes precedence
60
+ 4. Use `"*": "ask"` as base rule to debug which pattern is matching
@@ -41,16 +41,26 @@
41
41
  }
42
42
  },
43
43
  "autoupdate": false,
44
+ "compaction": {
45
+ "auto": true,
46
+ "prune": true
47
+ },
44
48
  "experimental": {
45
49
  "batch_tool": true,
46
50
  "chatMaxRetries": 2,
47
- "primary_tools": ["edit", "write", "bash", "prune"]
51
+ "continue_loop_on_deny": false,
52
+ "lsp": true,
53
+ "primary_tools": ["edit", "write", "bash"]
48
54
  },
49
55
  "formatter": {
50
56
  "biome": {
51
57
  "command": ["npx", "@biomejs/biome", "check", "--write", "$FILE"],
52
58
  "extensions": [".js", ".jsx", ".ts", ".tsx", ".json", ".jsonc"]
53
59
  },
60
+ "cargo-fmt": {
61
+ "command": ["cargo", "fmt", "--", "$FILE"],
62
+ "extensions": [".rs"]
63
+ },
54
64
  "java-formatter": {
55
65
  "command": ["google-java-format", "--replace", "$FILE"],
56
66
  "environment": {
@@ -92,14 +102,32 @@
92
102
  "model": "github-copilot/claude-haiku-4.5",
93
103
  "permission": {
94
104
  "bash": {
105
+ "*": "allow",
106
+ "git status *": "allow",
107
+ "git diff *": "allow",
108
+ "git log *": "allow",
109
+ "git branch *": "allow",
110
+ "npm *": "allow",
111
+ "npx *": "allow",
112
+ "ls *": "allow",
113
+ "cat *": "allow",
95
114
  "git commit *": "ask",
96
115
  "git push *": "ask",
97
- "rm *": "ask",
98
- "rm -rf *": "ask"
116
+ "git reset *": "ask",
117
+ "git rebase *": "ask",
118
+ "rm *": "deny",
119
+ "rm -rf *": "deny",
120
+ "sudo *": "deny"
99
121
  },
100
122
  "doom_loop": "ask",
101
123
  "edit": "allow",
102
- "external_directory": "allow"
124
+ "external_directory": "ask",
125
+ "read": {
126
+ "*": "allow",
127
+ "*.env": "deny",
128
+ "*.env.*": "deny",
129
+ "*.env.example": "allow"
130
+ }
103
131
  },
104
132
  "plugin": [
105
133
  "@tarquinen/opencode-dcp@latest",
@@ -217,7 +245,14 @@
217
245
  "context": 880964,
218
246
  "output": 65536
219
247
  },
220
- "name": "Gemini 3 Flash Preview"
248
+ "name": "Gemini 3 Flash Preview",
249
+ "options": {
250
+ "thinking": {
251
+ "budgetTokens": 24576,
252
+ "type": "enabled"
253
+ }
254
+ },
255
+ "reasoning": true
221
256
  },
222
257
  "gemini-3-pro-image-preview": {
223
258
  "limit": {
@@ -231,7 +266,14 @@
231
266
  "context": 880964,
232
267
  "output": 65536
233
268
  },
234
- "name": "Gemini 3 Pro Preview"
269
+ "name": "Gemini 3 Pro Preview",
270
+ "options": {
271
+ "thinking": {
272
+ "budgetTokens": 24576,
273
+ "type": "enabled"
274
+ }
275
+ },
276
+ "reasoning": true
235
277
  },
236
278
  "gemini-claude-opus-4-5-thinking": {
237
279
  "limit": {
@@ -450,17 +492,6 @@
450
492
  },
451
493
  "share": "manual",
452
494
  "small_model": "opencode/gpt-5-nano",
453
- "permission": {
454
- "bash": {
455
- "git commit *": "ask",
456
- "git push *": "ask",
457
- "rm *": "ask",
458
- "rm -rf *": "ask"
459
- },
460
- "doom_loop": "ask",
461
- "edit": "allow",
462
- "external_directory": "allow"
463
- },
464
495
  "tui": {
465
496
  "diff_style": "auto",
466
497
  "scroll_acceleration": {
@@ -11,7 +11,7 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "@opencode-ai/plugin": "1.1.1"
14
+ "@opencode-ai/plugin": "1.1.2"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/node": "^25.0.3",