@wpro-eng/opencode-config 1.2.0 → 1.3.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.
@@ -0,0 +1,72 @@
1
+ ---
2
+ description: Remove stale cache files, broken symlinks, and unused plugins from OpenCode's plugin cache
3
+ ---
4
+ Clean up stale artifacts left behind by @wpro-eng/opencode-config and OpenCode's plugin cache.
5
+
6
+ OpenCode's plugin cache (`~/.cache/opencode/package.json`) is append-only: it never removes plugins you've uninstalled from `opencode.json`. This command fixes that, along with other accumulated cruft.
7
+
8
+ ## Instructions
9
+
10
+ Run each cleanup step below in order. Report what was found and what was removed. Use the Bash tool for filesystem operations.
11
+
12
+ ### 1. Remove old git-clone cache (legacy architecture)
13
+
14
+ The plugin used to clone the team config repo via git. That was replaced by bundled npm assets. The entire `repos/` directory is inert.
15
+
16
+ ```
17
+ rm -rf ~/.cache/opencode/wpromote-config/repos/
18
+ rm -f ~/.cache/opencode/wpromote-config/opencode-config.sync-status.json
19
+ ```
20
+
21
+ Report the size freed if the directory existed.
22
+
23
+ ### 2. Prune unused plugins from OpenCode's npm cache
24
+
25
+ Read `~/.config/opencode/opencode.json` to get the active `plugin` list. Then read `~/.cache/opencode/package.json` to get cached dependencies.
26
+
27
+ Any dependency in the cache that is NOT in the active plugin list AND is NOT `opencode-anthropic-auth` (OpenCode's built-in default plugin) should be removed:
28
+ - Delete the entry from `~/.cache/opencode/package.json`
29
+ - Delete the package directory from `~/.cache/opencode/node_modules/<pkg>/`
30
+ - Delete `~/.cache/opencode/bun.lock` so Bun re-resolves cleanly on next startup
31
+
32
+ List each removed package by name and version.
33
+
34
+ **Important**: Also check for project-level `.opencode/opencode.json` plugin entries (in the current working directory) so you don't accidentally prune a plugin that's declared at the project level rather than the user level.
35
+
36
+ ### 3. Fix broken symlinks
37
+
38
+ Check these locations for symlinks whose targets no longer exist:
39
+ - `~/.config/opencode/skill/_plugins/opencode-config/*/`
40
+ - `~/.config/opencode/plugin/_remote_opencode-config_*`
41
+ - `~/.config/opencode/plugins/_remote_opencode-config_*`
42
+ - `~/.config/opencode/mcp/_plugins/opencode-config/*/`
43
+
44
+ Remove any broken symlinks. Report each one removed.
45
+
46
+ ### 4. Clean stale orchestration task files
47
+
48
+ Check `~/.cache/opencode/wpromote-config/orchestration-tasks/` for session files older than 7 days:
49
+
50
+ ```bash
51
+ find ~/.cache/opencode/wpromote-config/orchestration-tasks/ -name "ses_*.json" -mtime +7
52
+ ```
53
+
54
+ Remove them and report the count.
55
+
56
+ ### 5. Rotate plugin log
57
+
58
+ If `~/.cache/opencode/wpromote-config/plugin.log` is larger than 1MB, truncate it to the last 200 lines.
59
+
60
+ ## Output Format
61
+
62
+ Present a summary table:
63
+
64
+ | Category | Found | Cleaned | Details |
65
+ |----------|-------|---------|---------|
66
+ | Git clone cache | ... | ... | ... |
67
+ | Unused cached plugins | ... | ... | ... |
68
+ | Broken symlinks | ... | ... | ... |
69
+ | Stale task files | ... | ... | ... |
70
+ | Plugin log | ... | ... | ... |
71
+
72
+ End with either "All clean, no restart needed." or "Restart OpenCode to pick up changes." if any cached plugins were removed or symlinks were fixed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpro-eng/opencode-config",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Wpromote OpenCode plugin to sync team config assets on startup",
5
5
  "repository": {
6
6
  "type": "git",