opencode-buddy 0.3.3 → 0.3.4

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.
package/README.md CHANGED
@@ -34,10 +34,12 @@ Requires opencode ≥ 1.15.
34
34
  npm install -g opencode-buddy
35
35
  ```
36
36
 
37
- The `postinstall` script automatically registers both plugin entrypoints in your opencode config:
37
+ The `postinstall` script automatically registers the plugin in both config files using the same spec. opencode picks the right entrypoint from the package's `exports` field:
38
38
 
39
- - `opencode-buddy` → `~/.config/opencode/opencode.json` (server plugin)
40
- - `opencode-buddy/tui` → `~/.config/opencode/tui.json` (TUI plugin)
39
+ - `opencode-buddy` (main) `src/server-plugin.js` (server plugin, no-op since 0.3.x)
40
+ - `opencode-buddy` with kind `tui` → `src/tui-plugin.jsx` (TUI plugin)
41
+
42
+ Both `~/.config/opencode/opencode.json` and `~/.config/opencode/tui.json` get the same `plugin: ["opencode-buddy"]` entry.
41
43
 
42
44
  If you have those config files as JSONC (with comments), the script skips them — add the entries manually:
43
45
 
@@ -52,7 +54,7 @@ If you have those config files as JSONC (with comments), the script skips them
52
54
  // ~/.config/opencode/tui.json
53
55
  {
54
56
  "$schema": "https://opencode.ai/tui.json",
55
- "plugin": ["opencode-buddy/tui"]
57
+ "plugin": ["opencode-buddy"]
56
58
  }
57
59
  ```
58
60
 
@@ -177,12 +179,12 @@ flowchart LR
177
179
  6. Slash commands typed in the prompt hit the keymap → buddy's `run()` → reads/writes `state.json` directly → toast feedback to the user.
178
180
  7. The view's reactive signals propagate state changes back to the sidebar render. No re-render of the TUI shell is needed.
179
181
 
180
- ### Why two config files?
182
+ ### Why two config files with the same spec?
181
183
 
182
- opencode has separate plugin registries for the **server** (LLM tools, file watching) and the **TUI** (sidebar slots, slash commands, keybindings). The buddy exports both:
184
+ opencode has separate plugin registries for the **server** (LLM tools, file watching) and the **TUI** (sidebar slots, slash commands, keybindings). When the same package spec appears in both, opencode looks at the package's `exports` field to pick the right entrypoint:
183
185
 
184
- - `opencode-buddy` → `src/server-plugin.js` (currently a no-op — we no longer expose an LLM tool)
185
- - `opencode-buddy/tui` → `src/tui-plugin.jsx` (the sidebar slot + slash commands)
186
+ - `opencode.json` → `kind: "server"` → loads `src/server-plugin.js` via `main` (currently a no-op — we no longer expose an LLM tool)
187
+ - `tui.json` → `kind: "tui"` → loads `src/tui-plugin.jsx` via `exports["./tui"]` (the sidebar slot + slash commands)
186
188
 
187
189
  This split lets slash commands update state instantly without round-tripping through the LLM, which is the right UX for "I want to feed my pet right now" interactions.
188
190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-buddy",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "A virtual ASCII pet companion that lives in the opencode TUI sidebar. Hatches, feeds, plays, and reacts to what you're coding.",
5
5
  "type": "module",
6
6
  "main": "src/server-plugin.js",
@@ -13,8 +13,7 @@ import { promises as fs } from "node:fs"
13
13
  import path from "node:path"
14
14
  import os from "node:os"
15
15
 
16
- const SERVER_SPEC = "opencode-buddy"
17
- const TUI_SPEC = "opencode-buddy/tui"
16
+ const PLUGIN_SPEC = "opencode-buddy"
18
17
  const CONFIG_DIR = path.join(os.homedir(), ".config", "opencode")
19
18
  const SERVER_CONFIG = path.join(CONFIG_DIR, "opencode.json")
20
19
  const TUI_CONFIG = path.join(CONFIG_DIR, "tui.json")
@@ -86,7 +85,7 @@ async function main() {
86
85
  file: SERVER_CONFIG,
87
86
  ...(await updateConfig({
88
87
  filepath: SERVER_CONFIG,
89
- spec: SERVER_SPEC,
88
+ spec: PLUGIN_SPEC,
90
89
  fallback: { $schema: "https://opencode.ai/config.json" },
91
90
  })),
92
91
  })
@@ -95,7 +94,7 @@ async function main() {
95
94
  file: TUI_CONFIG,
96
95
  ...(await updateConfig({
97
96
  filepath: TUI_CONFIG,
98
- spec: TUI_SPEC,
97
+ spec: PLUGIN_SPEC,
99
98
  fallback: { $schema: "https://opencode.ai/tui.json" },
100
99
  })),
101
100
  })