opencode-cliproxyapi-sync 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.
package/README.md CHANGED
@@ -48,11 +48,11 @@ Add to your `opencode.jsonc` plugin array:
48
48
 
49
49
  ### 2. Create Plugin Config File
50
50
 
51
- Create the config file in the **same directory** as your `opencode.json`:
51
+ Create the plugin config file:
52
52
 
53
53
  **Standard location:**
54
54
  ```
55
- ~/.config/opencode/opencode-cliproxyapi-sync/config.json
55
+ ~/.config/opencode-cliproxyapi-sync/config.json
56
56
  ```
57
57
 
58
58
  **With OCX profile:**
@@ -104,7 +104,7 @@ If only `oh-my-opencode.json` changes, no notification is shown (those changes a
104
104
  ## File Locations
105
105
 
106
106
  **Standard (no profile):**
107
- - **Plugin Config**: `~/.config/opencode/opencode-cliproxyapi-sync/config.json`
107
+ - **Plugin Config**: `~/.config/opencode-cliproxyapi-sync/config.json`
108
108
  - **OpenCode Config**: `~/.config/opencode/opencode.json`
109
109
  - **Oh My OpenCode Config**: `~/.config/opencode/oh-my-opencode.json`
110
110
 
@@ -148,7 +148,7 @@ ocx oc -p myprofile
148
148
  **Check config file exists and is valid**:
149
149
  ```bash
150
150
  # Standard location
151
- cat ~/.config/opencode/opencode-cliproxyapi-sync/config.json
151
+ cat ~/.config/opencode-cliproxyapi-sync/config.json
152
152
 
153
153
  # Or with OCX profile
154
154
  cat ~/.config/opencode/profiles/<profilename>/opencode-cliproxyapi-sync/config.json
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ function getConfigDir() {
15
15
  }
16
16
  const xdgConfigHome = process.env.XDG_CONFIG_HOME;
17
17
  const baseDir = xdgConfigHome || join(homedir(), ".config");
18
- return join(baseDir, "opencode", "opencode-cliproxyapi-sync");
18
+ return join(baseDir, "opencode-cliproxyapi-sync");
19
19
  }
20
20
  function getConfigPath() {
21
21
  return join(getConfigDir(), "config.json");
@@ -142,6 +142,16 @@ function getOpenCodeConfigDir() {
142
142
  }
143
143
  return join2(homedir2(), ".config", "opencode");
144
144
  }
145
+ function resolveOpencodeConfigPath(configDir) {
146
+ const isOcx = !!process.env.OPENCODE_CONFIG_DIR;
147
+ if (isOcx) {
148
+ const jsoncPath = join2(configDir, "opencode.jsonc");
149
+ if (existsSync2(jsoncPath)) {
150
+ return jsoncPath;
151
+ }
152
+ }
153
+ return join2(configDir, "opencode.json");
154
+ }
145
155
  async function writeConfigAtomic(filePath, content) {
146
156
  const tempPath = `${filePath}.cliproxy-sync.tmp`;
147
157
  writeFileSync2(tempPath, content, "utf-8");
@@ -184,7 +194,7 @@ var ConfigSyncPlugin = async (ctx) => {
184
194
  return {};
185
195
  }
186
196
  const configDir = getOpenCodeConfigDir();
187
- const opencodeConfigPath = join3(configDir, "opencode.json");
197
+ const opencodeConfigPath = resolveOpencodeConfigPath(configDir);
188
198
  const ohMyConfigPath = join3(configDir, "oh-my-opencode.json");
189
199
  const oldOpencodeHash = await readFileHash(opencodeConfigPath);
190
200
  await writeConfigAtomic(opencodeConfigPath, JSON.stringify(bundle.opencode, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-cliproxyapi-sync",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Auto-sync OpenCode configs from CLIProxyAPI Dashboard",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",