opencode-cliproxyapi-sync 1.1.4 → 1.2.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.
package/README.md CHANGED
@@ -48,8 +48,19 @@ Add to your `opencode.jsonc` plugin array:
48
48
 
49
49
  ### 2. Create Plugin Config File
50
50
 
51
- Create the config file at `~/.config/opencode-cliproxyapi-sync/config.json`:
51
+ Create the config file in the **same directory** as your `opencode.json`:
52
52
 
53
+ **Standard location:**
54
+ ```
55
+ ~/.config/opencode/opencode-cliproxyapi-sync/config.json
56
+ ```
57
+
58
+ **With OCX profile:**
59
+ ```
60
+ ~/.config/opencode/profiles/<profilename>/opencode-cliproxyapi-sync/config.json
61
+ ```
62
+
63
+ **Config content:**
53
64
  ```json
54
65
  {
55
66
  "dashboardUrl": "https://dashboard.yourdomain.com",
@@ -92,21 +103,43 @@ If only `oh-my-opencode.json` changes, no notification is shown (those changes a
92
103
 
93
104
  ## File Locations
94
105
 
95
- - **Plugin Config**: `~/.config/opencode-cliproxyapi-sync/config.json`
106
+ **Standard (no profile):**
107
+ - **Plugin Config**: `~/.config/opencode/opencode-cliproxyapi-sync/config.json`
96
108
  - **OpenCode Config**: `~/.config/opencode/opencode.json`
97
109
  - **Oh My OpenCode Config**: `~/.config/opencode/oh-my-opencode.json`
98
110
 
99
- (Respects `XDG_CONFIG_HOME` environment variable if set)
111
+ **With OCX profile:**
112
+ - **Plugin Config**: `~/.config/opencode/profiles/<name>/opencode-cliproxyapi-sync/config.json`
113
+ - **OpenCode Config**: `~/.config/opencode/profiles/<name>/opencode.json`
114
+ - **Oh My OpenCode Config**: `~/.config/opencode/profiles/<name>/oh-my-opencode.json`
115
+
116
+ (Respects `XDG_CONFIG_HOME` and `OPENCODE_CONFIG_DIR` environment variables)
100
117
 
101
118
  ## OCX Profile Support
102
119
 
103
- When using [OCX](https://github.com/kdcokenny/ocx) profiles, the plugin automatically detects the profile directory via the `OPENCODE_CONFIG_DIR` environment variable that OCX sets.
120
+ When using [OCX](https://github.com/kdcokenny/ocx) profiles, the plugin uses **per-profile configuration**. This means:
121
+
122
+ 1. **Each profile has its own plugin config** - you can sync different profiles to different dashboards or disable sync for some profiles
123
+ 2. **Syncing only affects the active profile** - starting `ocx oc -p work` will only update configs in the `work` profile directory
124
+ 3. **No cross-profile interference** - the standard config is never touched when using a profile
104
125
 
105
- This means configs are synced to the correct profile location:
106
- - **Without profile**: `~/.config/opencode/opencode.json`
107
- - **With profile**: `~/.config/opencode/profiles/<name>/opencode.json`
126
+ **Setup for OCX profiles:**
127
+ ```bash
128
+ # Create config for your profile
129
+ mkdir -p ~/.config/opencode/profiles/myprofile/opencode-cliproxyapi-sync
130
+ cat > ~/.config/opencode/profiles/myprofile/opencode-cliproxyapi-sync/config.json << 'EOF'
131
+ {
132
+ "dashboardUrl": "https://dashboard.yourdomain.com",
133
+ "syncToken": "your-token-here",
134
+ "lastKnownVersion": null
135
+ }
136
+ EOF
137
+
138
+ # Now start with profile - only this profile syncs
139
+ ocx oc -p myprofile
140
+ ```
108
141
 
109
- No additional configuration needed - just use `ocx oc -p myprofile` as usual.
142
+ **Disable sync for a profile:** Simply don't create a `config.json` in that profile's `opencode-cliproxyapi-sync` folder.
110
143
 
111
144
  ## Troubleshooting
112
145
 
@@ -114,7 +147,11 @@ No additional configuration needed - just use `ocx oc -p myprofile` as usual.
114
147
 
115
148
  **Check config file exists and is valid**:
116
149
  ```bash
117
- cat ~/.config/opencode-cliproxyapi-sync/config.json
150
+ # Standard location
151
+ cat ~/.config/opencode/opencode-cliproxyapi-sync/config.json
152
+
153
+ # Or with OCX profile
154
+ cat ~/.config/opencode/profiles/<profilename>/opencode-cliproxyapi-sync/config.json
118
155
  ```
119
156
 
120
157
  **Check OpenCode logs** for sync messages:
package/dist/index.js CHANGED
@@ -9,9 +9,13 @@ import { readFileSync, writeFileSync, existsSync, mkdirSync, chmodSync } from "f
9
9
  import { homedir } from "os";
10
10
  import { join } from "path";
11
11
  function getConfigDir() {
12
+ const ocxConfigDir = process.env.OPENCODE_CONFIG_DIR;
13
+ if (ocxConfigDir) {
14
+ return join(ocxConfigDir, "opencode-cliproxyapi-sync");
15
+ }
12
16
  const xdgConfigHome = process.env.XDG_CONFIG_HOME;
13
17
  const baseDir = xdgConfigHome || join(homedir(), ".config");
14
- return join(baseDir, "opencode-cliproxyapi-sync");
18
+ return join(baseDir, "opencode", "opencode-cliproxyapi-sync");
15
19
  }
16
20
  function getConfigPath() {
17
21
  return join(getConfigDir(), "config.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-cliproxyapi-sync",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "Auto-sync OpenCode configs from CLIProxyAPI Dashboard",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",