@wpro-eng/opencode-config 1.1.2 → 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.
@@ -19,8 +19,8 @@ C) Config and Schema Consistency
19
19
  - List supported wpromote.json fields, defaults, and any dead/unused config keys.
20
20
  - Note any mismatch between docs and runtime behavior.
21
21
 
22
- D) Sync Pipeline Trace
23
- - Trace end-to-end flow across src/index.ts, src/git.ts, src/install.ts, src/disable.ts, src/mcp-install.ts.
22
+ D) Load Pipeline Trace
23
+ - Trace end-to-end flow across src/index.ts, src/assets.ts, src/install.ts, src/disable.ts, src/mcp-install.ts.
24
24
  - Produce a step-by-step execution map with key decision points and failure modes.
25
25
  - Identify where parallelism/concurrency exists and where it is effectively serialized.
26
26
 
@@ -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.
@@ -1,18 +1,22 @@
1
1
  ---
2
2
  description: List all team assets from wpromote config
3
3
  ---
4
- List all available team assets from the wpromote opencode-config repository.
4
+ List all available team assets from the installed @wpro-eng/opencode-config plugin.
5
5
 
6
6
  ## Instructions
7
7
 
8
- 1. Read the team config repository at ~/.config/opencode/_plugins/wpromote-opencode-config/
8
+ 1. Check the installed asset locations:
9
+ - Skills: ~/.config/opencode/skill/_plugins/opencode-config/
10
+ - Plugins: ~/.config/opencode/plugins/ (files matching _remote_opencode-config_*)
11
+ - MCPs: ~/.config/opencode/mcp/_plugins/opencode-config/
12
+
9
13
  2. For each asset type, list what's available:
10
14
 
11
15
  ### Skills (skill/ directory)
12
16
  - Show each skill name and its description from SKILL.md frontmatter
13
17
  - Mark if it's installed or skipped due to local conflict
14
18
 
15
- ### Agents (agent/ directory)
19
+ ### Agents (agent/ directory)
16
20
  - Show each agent name and description
17
21
  - These are injected into OpenCode automatically
18
22
 
@@ -1,23 +1,23 @@
1
1
  ---
2
- description: Show sync status for wpromote team config
2
+ description: Show status for wpromote team config
3
3
  ---
4
- Read the sync status file at ~/.cache/opencode/wpromote-config/opencode-config.sync-status.json and report:
4
+ Read the status file at ~/.cache/opencode/wpromote-config/opencode-config.plugin-status.json and report:
5
5
 
6
- 1. **Last Sync Time** - When the team config was last synced
7
- 2. **Current Ref** - The git branch/tag being used
8
- 3. **Installed Assets**:
6
+ 1. **Plugin Version** - The installed version of @wpro-eng/opencode-config
7
+ 2. **Last Load Time** - When the team config was last loaded
8
+ 3. **Installed Assets** (with names):
9
9
  - Skills (symlinked to local skill directory)
10
- - Plugins (running in OpenCode)
10
+ - Team Plugins (symlinked into plugins directory)
11
11
  - MCPs (configured MCP servers)
12
12
  - Agents (team agent definitions)
13
13
  - Commands (team slash commands)
14
14
  - Instructions (team instructions)
15
- 4. **Issues** (if any):
16
- - Skipped conflicts (local skills that blocked team skills)
17
- - Disabled assets (explicitly disabled in wpromote.json)
18
- - Errors from last sync attempt
19
- 5. **Actions Required** - Any restart needed for plugin changes
15
+ 4. **Runtime Plugins** - Plugins injected into config.plugin[] (e.g. @tarquinen/opencode-dcp@latest)
16
+ 5. **Issues** (if any):
17
+ - Skipped conflicts (local skills that blocked team skills, listed by name)
18
+ - Disabled assets (explicitly disabled in wpromote.json, listed by type:name)
19
+ 6. **Actions Required** - Any restart needed for plugin changes
20
20
 
21
- If the file doesn't exist, report that no sync has been performed yet.
21
+ If the file doesn't exist, report that the plugin hasn't loaded yet.
22
22
 
23
23
  Format the output as a clean, readable summary.
package/dist/index.js CHANGED
@@ -9842,30 +9842,42 @@ import * as fs7 from "fs";
9842
9842
  import * as path7 from "path";
9843
9843
  var STATUS_BASE = path7.join(process.env.HOME || "~", ".cache", "opencode", "wpromote-config");
9844
9844
  function getStatusFilePath() {
9845
- return path7.join(STATUS_BASE, `${REPO_SHORT_NAME}.sync-status.json`);
9845
+ return path7.join(STATUS_BASE, `${REPO_SHORT_NAME}.plugin-status.json`);
9846
9846
  }
9847
- function writeSyncStatus(status) {
9847
+ function writePluginStatus(status) {
9848
9848
  const statusPath = getStatusFilePath();
9849
9849
  const dir = path7.dirname(statusPath);
9850
9850
  fs7.mkdirSync(dir, { recursive: true });
9851
9851
  fs7.writeFileSync(statusPath, JSON.stringify(status, null, 2));
9852
- logDebug(`Wrote sync status to ${statusPath}`);
9852
+ logDebug(`Wrote plugin status to ${statusPath}`);
9853
9853
  }
9854
- function updateSyncStatus(data) {
9854
+ function getPluginVersion() {
9855
+ try {
9856
+ const pkgPath = path7.resolve(import.meta.dir, "..", "package.json");
9857
+ const content = fs7.readFileSync(pkgPath, "utf-8");
9858
+ const pkg = JSON.parse(content);
9859
+ return pkg.version ?? null;
9860
+ } catch {
9861
+ return null;
9862
+ }
9863
+ }
9864
+ function updatePluginStatus(data) {
9855
9865
  const status = {
9856
- lastSyncTime: new Date().toISOString(),
9857
- installedSkills: data.installedSkills,
9858
- installedPlugins: data.installedPlugins,
9859
- installedMcps: data.installedMcps,
9860
- remoteAgents: data.remoteAgents,
9861
- remoteCommands: data.remoteCommands,
9862
- remoteInstructions: data.remoteInstructions,
9866
+ lastLoadTime: new Date().toISOString(),
9867
+ pluginVersion: getPluginVersion(),
9868
+ skillNames: data.skillNames,
9869
+ pluginNames: data.pluginNames,
9870
+ runtimePluginNames: data.runtimePluginNames,
9871
+ mcpNames: data.mcpNames,
9872
+ agentNames: data.agentNames,
9873
+ commandNames: data.commandNames,
9874
+ instructionNames: data.instructionNames,
9863
9875
  skippedConflicts: data.skippedConflicts,
9864
9876
  disabledAssets: data.disabledAssets,
9865
9877
  lastError: null,
9866
9878
  pluginsChanged: data.pluginsChanged
9867
9879
  };
9868
- writeSyncStatus(status);
9880
+ writePluginStatus(status);
9869
9881
  }
9870
9882
 
9871
9883
  // src/index.ts
@@ -9873,9 +9885,9 @@ var PACKAGE_ROOT = path8.resolve(import.meta.dir, "..");
9873
9885
  var initialized = false;
9874
9886
  var REQUIRED_RUNTIME_PLUGINS = ["@tarquinen/opencode-dcp@latest"];
9875
9887
  var DEFAULT_OPENCODE_AGENTS_TO_DISABLE = ["build", "plan"];
9876
- async function performSync(config) {
9888
+ async function performLoad(config) {
9877
9889
  const disableMatcher = createDisableMatcher(config.disable);
9878
- log(config.dryRun ? "[DRY-RUN] Analyzing team configuration..." : "Syncing team configuration...");
9890
+ log(config.dryRun ? "[DRY-RUN] Analyzing team configuration..." : "Loading team configuration...");
9879
9891
  const result = await discoverAssets(PACKAGE_ROOT);
9880
9892
  if (!config.dryRun) {
9881
9893
  const brokenUnmanagedLinks = findBrokenUnmanagedPluginLinks();
@@ -10119,15 +10131,16 @@ async function performSync(config) {
10119
10131
  log(`Cleaned up ${mcpCleanup.removed.length} stale MCP installs`);
10120
10132
  }
10121
10133
  const totalMcps = newMcpInstalls.size;
10122
- updateSyncStatus({
10123
- installedSkills: totalSkills,
10124
- installedPlugins: totalPlugins,
10125
- installedMcps: totalMcps,
10126
- remoteAgents: remoteAgents.size,
10127
- remoteCommands: remoteCommands.size,
10128
- remoteInstructions: remoteInstructions.length,
10129
- skippedConflicts: skippedConflicts.length,
10130
- disabledAssets: disabledAssets.length,
10134
+ updatePluginStatus({
10135
+ skillNames: skillsToInstall.map((s) => s.name),
10136
+ pluginNames: pluginsToInstall.map((p) => p.name),
10137
+ runtimePluginNames: [...REQUIRED_RUNTIME_PLUGINS],
10138
+ mcpNames: [...remoteMcps.keys()],
10139
+ agentNames: [...remoteAgents.keys()],
10140
+ commandNames: [...remoteCommands.keys()],
10141
+ instructionNames: remoteInstructions.map((p) => p.split("/").pop() ?? p),
10142
+ skippedConflicts,
10143
+ disabledAssets,
10131
10144
  pluginsChanged
10132
10145
  });
10133
10146
  return {
@@ -10205,7 +10218,7 @@ var WpromoteConfigPlugin = async (ctx) => {
10205
10218
  pluginsChanged,
10206
10219
  totalPlugins,
10207
10220
  totalMcps
10208
- } = await performSync(userConfig);
10221
+ } = await performLoad(userConfig);
10209
10222
  if (pluginsChanged) {
10210
10223
  log("\u26A0 Plugin changes detected. Restart OpenCode to apply.");
10211
10224
  }
@@ -10351,7 +10364,7 @@ var WpromoteConfigPlugin = async (ctx) => {
10351
10364
  var RemoteSkillsPlugin = WpromoteConfigPlugin;
10352
10365
  var src_default = WpromoteConfigPlugin;
10353
10366
  export {
10354
- performSync,
10367
+ performLoad,
10355
10368
  src_default as default,
10356
10369
  WpromoteConfigPlugin,
10357
10370
  RemoteSkillsPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpro-eng/opencode-config",
3
- "version": "1.1.2",
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",