@wpro-eng/opencode-config 1.0.0

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.
Files changed (3) hide show
  1. package/README.md +366 -0
  2. package/dist/index.js +10689 -0
  3. package/package.json +50 -0
package/README.md ADDED
@@ -0,0 +1,366 @@
1
+ # @wpro-eng/opencode-config
2
+
3
+ Wpromote's proprietary OpenCode plugin that keeps team developers' configurations in lockstep. This repo contains both the plugin code AND the team's shared skills, agents, commands, plugins, instructions, and MCP configs.
4
+
5
+ ## How It Works
6
+
7
+ When installed, this plugin:
8
+
9
+ 1. **Syncs** this repository to your local machine (clone once, fetch on startup)
10
+ 2. **Installs** team skills, plugins, and MCPs via symlinks to your OpenCode config
11
+ 3. **Injects** team agents, commands, and instructions into OpenCode's runtime config
12
+ 4. **Respects** your local overrides and explicit disables
13
+
14
+ ### Priority Order
15
+
16
+ 1. **Your local configs** — always win
17
+ 2. **Team configs** — fill in the gaps
18
+
19
+ ## Installation
20
+
21
+ ### 1. Add to your OpenCode config
22
+
23
+ In `~/.config/opencode/opencode.json`:
24
+
25
+ ```json
26
+ {
27
+ "plugin": ["@wpro-eng/opencode-config"]
28
+ }
29
+ ```
30
+
31
+ ### 2. Install the plugin
32
+
33
+ ```bash
34
+ # From npm (when published)
35
+ npm install -g @wpro-eng/opencode-config
36
+
37
+ # Or link locally for development
38
+ cd /path/to/opencode-config
39
+ bun install
40
+ bun run build
41
+ npm link
42
+ ```
43
+
44
+ ### 3. Restart OpenCode
45
+
46
+ The plugin will automatically sync on startup.
47
+
48
+ ## Configuration
49
+
50
+ Create `~/.config/opencode/wpromote.json` or `~/.config/opencode/wpromote.jsonc` (same for project-level `.opencode/`):
51
+
52
+ ```json
53
+ {
54
+ "disable": ["skill:example", "agent:verbose-debugger"],
55
+ "ref": "v1.0.0",
56
+ "installMethod": "link"
57
+ }
58
+ ```
59
+
60
+ ### Options
61
+
62
+ | Option | Type | Default | Description |
63
+ |--------|------|---------|-------------|
64
+ | `disable` | `string[]` | `[]` | Assets to disable (see below) |
65
+ | `ref` | `string` | `"main"` | Git ref to sync (branch, tag, or SHA) |
66
+ | `installMethod` | `"link"` \| `"copy"` | `"link"` | How to install skills/plugins/MCPs |
67
+ | `dryRun` | `boolean` | `false` | Preview changes without installing |
68
+ | `orchestration` | `object` | defaults | Runtime orchestration controls, limits, and fallback policy |
69
+
70
+ ### Orchestration Runtime Configuration
71
+
72
+ ```json
73
+ {
74
+ "orchestration": {
75
+ "providerMode": "copilot",
76
+ "limits": {
77
+ "maxConcurrent": 3,
78
+ "maxRetries": 2,
79
+ "maxIterations": 25,
80
+ "retryBackoffMs": 1500,
81
+ "taskTimeoutMs": 120000
82
+ },
83
+ "runtimeFallback": {
84
+ "enabled": true,
85
+ "retryOnErrors": [400, 401, 403, 408, 429, 500, 502, 503, 504, 529],
86
+ "maxFallbackAttempts": 2,
87
+ "cooldownSeconds": 30,
88
+ "timeoutSeconds": 30,
89
+ "notifyOnFallback": true,
90
+ "providerOrder": ["copilot", "native"]
91
+ },
92
+ "hooks": {
93
+ "disabled": ["activity-feed"],
94
+ "telemetry": true
95
+ },
96
+ "notifications": {
97
+ "enabled": true,
98
+ "maxItems": 100
99
+ },
100
+ "categories": {
101
+ "routing": {
102
+ "quick": "native"
103
+ },
104
+ "maxConcurrent": {
105
+ "quick": 1
106
+ }
107
+ },
108
+ "recovery": {
109
+ "autoResumeOnStart": true
110
+ },
111
+ "tmux": {
112
+ "enabled": false,
113
+ "layout": "main-vertical",
114
+ "mainPaneSize": 60,
115
+ "mainPaneMinWidth": 120,
116
+ "agentPaneMinWidth": 40,
117
+ "sessionPrefix": "wpo"
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ Tmux support is optional and only active when `orchestration.tmux.enabled` is `true` and OpenCode is running inside a tmux session. When enabled, task launches can attach a live pane, queue attachment when pane capacity is full, and auto-clean up panes when tasks complete, fail, stop, or parent sessions end.
124
+
125
+ Category policies are optional. Use `orchestration.categories.routing` to override provider mode per task category (for example, `quick` -> `native`) and `orchestration.categories.maxConcurrent` to cap active tasks per category.
126
+
127
+ Recovery policies are optional. `orchestration.recovery.autoResumeOnStart` controls whether queued/running/retrying task records from prior sessions are automatically restored into `queued` state on startup.
128
+
129
+ ### Dry-Run Mode
130
+
131
+ Preview what the plugin would do without making any changes:
132
+
133
+ ```json
134
+ // ~/.config/opencode/wpromote.json
135
+ {
136
+ "dryRun": true
137
+ }
138
+ ```
139
+
140
+ Or set the environment variable:
141
+ ```bash
142
+ WPROMOTE_DRY_RUN=1 opencode
143
+ ```
144
+
145
+ In dry-run mode, the plugin will:
146
+ - Sync the team repository (to see what's available)
147
+ - Log what skills, plugins, and MCPs would be installed or removed
148
+ - Log what agents, commands, and instructions would be injected
149
+ - Log what assets would be skipped due to conflicts or disables
150
+ - **Make no actual file changes**
151
+
152
+ This is useful for:
153
+ - Testing configuration changes before applying them
154
+ - Debugging why certain assets aren't appearing
155
+ - Understanding what the plugin does on your system
156
+
157
+ ### Using a Specific Git Ref
158
+
159
+ By default, the plugin syncs from the `main` branch. To pin to a specific version for stability:
160
+
161
+ ```json
162
+ {
163
+ "ref": "v1.2.0"
164
+ }
165
+ ```
166
+
167
+ > **Note**: Configuration changes (including changes to `wpromote.json` / `wpromote.jsonc`) take effect on restart. After modifying your config, restart OpenCode to apply the changes.
168
+
169
+ By default, the plugin syncs from the `main` branch. To pin to a specific version for stability:
170
+
171
+ ```json
172
+ // ~/.config/opencode/wpromote.json
173
+ {
174
+ "ref": "v1.2.3" // Use a tagged release
175
+ }
176
+ ```
177
+
178
+ Or use a feature branch for testing:
179
+ ```json
180
+ {
181
+ "ref": "feature/new-skills"
182
+ }
183
+ ```
184
+
185
+ This is useful when:
186
+ - You want stability and don't want automatic updates
187
+ - You're testing unreleased team configurations
188
+ - You need to roll back to a known-good version
189
+
190
+
191
+ ### Disable Syntax
192
+
193
+ ```json
194
+ {
195
+ "disable": [
196
+ "skill:verbose-logger", // Disable specific skill
197
+ "agent:heavy-model", // Disable specific agent
198
+ "command:dangerous-cmd", // Disable specific command
199
+ "plugin:auto-formatter", // Disable specific plugin
200
+ "instruction:old-guide", // Disable specific instruction
201
+ "mcp:expensive-api", // Disable specific MCP
202
+ "deprecated-thing" // Disable across ALL types (bare name)
203
+ ]
204
+ }
205
+ ```
206
+
207
+ ## Overriding Team Configs
208
+
209
+ The plugin respects local configurations. Your local settings always take precedence over team defaults.
210
+
211
+ ### Override Priority
212
+
213
+ ```
214
+ 1. Your local OpenCode config (opencode.json) ← Highest priority
215
+ 2. Explicit disable list (wpromote.json)
216
+ 3. Local skill directories (~/.config/opencode/skill/<name>/)
217
+ 4. Team configuration from this repo ← Lowest priority
218
+ ```
219
+
220
+ ### By Asset Type
221
+
222
+ | Asset Type | How to Override | How to Disable |
223
+ |------------|-----------------|----------------|
224
+ | **Skill** | Create `~/.config/opencode/skill/<name>/SKILL.md` | `"skill:<name>"` in disable list |
225
+ | **Agent** | Add to `opencode.json`: `{ "agents": { "<name>": {...} } }` | `"agent:<name>"` in disable list |
226
+ | **Command** | Add to `opencode.json`: `{ "commands": { "<name>": {...} } }` | `"command:<name>"` in disable list |
227
+ | **Plugin** | Disable team plugin, add your own to plugins directory | `"plugin:<name>"` in disable list |
228
+ | **Instruction** | Cannot override (only append). Disable and add your own. | `"instruction:<name>"` in disable list |
229
+ | **MCP** | Add to `opencode.json` MCP config section | `"mcp:<name>"` in disable list |
230
+
231
+ ### Examples
232
+
233
+ **Override a team agent with different settings:**
234
+ ```json
235
+ // ~/.config/opencode/opencode.json
236
+ {
237
+ "agents": {
238
+ "team-agent": {
239
+ "model": "claude-sonnet-4-20250514",
240
+ "temperature": 0.5
241
+ }
242
+ }
243
+ }
244
+ ```
245
+
246
+ **Disable multiple team assets:**
247
+ ```json
248
+ // ~/.config/opencode/wpromote.json
249
+ {
250
+ "disable": [
251
+ "skill:verbose-logger",
252
+ "agent:heavy-model",
253
+ "instruction:old-conventions"
254
+ ]
255
+ }
256
+ ```
257
+
258
+ **Override a skill with your own version:**
259
+ ```bash
260
+ # Create your local skill directory
261
+ mkdir -p ~/.config/opencode/skill/my-skill
262
+
263
+ # Add your SKILL.md
264
+ cat > ~/.config/opencode/skill/my-skill/SKILL.md << 'EOF'
265
+ ---
266
+ name: my-skill
267
+ description: My customized version
268
+ ---
269
+ Your custom skill content here...
270
+ EOF
271
+ ```
272
+
273
+ **Completely disable a skill you don't use:**
274
+ ```json
275
+ // ~/.config/opencode/wpromote.json
276
+ {
277
+ "disable": ["skill:unused-skill"]
278
+ }
279
+ ```
280
+
281
+ ## What's Included
282
+
283
+ ### Skills (`skill/`)
284
+ Reusable skill files that agents can load. Each skill is a directory containing `SKILL.md` with YAML frontmatter.
285
+
286
+ ### Agents (`agent/`)
287
+ Pre-configured agent definitions with model, temperature, and system prompts.
288
+
289
+ ### Commands (`command/`)
290
+ Slash commands available to all team members.
291
+
292
+ ### Plugins (`plugin/`)
293
+ OpenCode hook plugins for team-wide automation.
294
+
295
+ ### Instructions (`instruction/`)
296
+ Markdown files automatically appended to agent context (like AGENTS.md).
297
+
298
+ ### MCPs (`mcp/`)
299
+ Model Context Protocol server configurations.
300
+
301
+ Current team MCP configs include:
302
+ - `chrome-devtools` (`https://www.npmjs.com/package/chrome-devtools-mcp` via `npx`)
303
+ - `context7` (`https://mcp.context7.com/mcp`)
304
+ - `exa` (`https://mcp.exa.ai/mcp`)
305
+
306
+ ## Development
307
+
308
+ ```bash
309
+ # Install dependencies
310
+ bun install
311
+
312
+ # Build
313
+ bun run build
314
+
315
+ # Run tests
316
+ bun test
317
+
318
+ # Type check
319
+ bun run typecheck
320
+
321
+ # Link for local testing
322
+ npm link
323
+ ```
324
+
325
+ ## Adding New Configs
326
+
327
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to add new skills, agents, commands, and more.
328
+
329
+ ## Version Pinning
330
+
331
+ By default, the plugin tracks the `main` branch. For stability, pin to a release:
332
+
333
+ ```json
334
+ {
335
+ "ref": "v1.0.0"
336
+ }
337
+ ```
338
+
339
+ Check the [releases](https://github.com/wpromote/opencode-config/releases) for available versions.
340
+
341
+ ## Cache Location
342
+
343
+ Synced repository: `~/.cache/opencode/wpromote-config/repos/`
344
+
345
+ Installed assets:
346
+ - Skills: `~/.config/opencode/skill/_plugins/opencode-config/`
347
+ - Plugins: `~/.config/opencode/plugins/_remote_opencode-config_*.ts`
348
+ - MCPs: `~/.config/opencode/mcp/_plugins/opencode-config/`
349
+
350
+ ## Troubleshooting
351
+
352
+ Quick fixes for common issues:
353
+
354
+ | Issue | Solution |
355
+ |-------|----------|
356
+ | Sync not working | Check log: `~/.cache/opencode/wpromote-config/plugin.log` |
357
+ | SSH key issues | Run `ssh -T git@github.com` to verify access |
358
+ | Stale configs | Delete cache: `rm -rf ~/.cache/opencode/wpromote-config` |
359
+ | Asset not appearing | Check disable list in `wpromote.json` |
360
+ | Override not working | Verify exact name match (case-sensitive) |
361
+
362
+ For detailed troubleshooting, see **[TROUBLESHOOTING.md](./TROUBLESHOOTING.md)**.
363
+
364
+ ## License
365
+
366
+ Proprietary - Wpromote Internal Use Only