zenox 1.0.4 → 1.0.5

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.
@@ -1,4 +1,10 @@
1
1
  import type { OpencodeConfig, ConfigFormat } from "./types";
2
+ /**
3
+ * Find OpenCode config file in order of priority:
4
+ * 1. .opencode/opencode.json[c] (project-local subdirectory)
5
+ * 2. opencode.json[c] (project root)
6
+ * 3. ~/.config/opencode/opencode.json[c] (global)
7
+ */
2
8
  export declare function findConfigFile(directory: string): {
3
9
  path: string;
4
10
  format: ConfigFormat;
@@ -10,4 +16,5 @@ export declare function readConfig(configPath: string): Promise<{
10
16
  export declare function isPluginInstalled(config: OpencodeConfig): boolean;
11
17
  export declare function installPlugin(configPath: string): Promise<void>;
12
18
  export declare function getDefaultConfigPath(directory: string): string;
19
+ export declare function getGlobalConfigPath(): string;
13
20
  export declare function createDefaultConfig(configPath: string): Promise<void>;
package/dist/cli/index.js CHANGED
@@ -2978,6 +2978,7 @@ var import_picocolors3 = __toESM(require_picocolors(), 1);
2978
2978
  import { existsSync } from "node:fs";
2979
2979
  import { readFile, writeFile } from "node:fs/promises";
2980
2980
  import { join } from "node:path";
2981
+ import { homedir } from "node:os";
2981
2982
 
2982
2983
  // node_modules/strip-json-comments/index.js
2983
2984
  var singleComment = Symbol("singleComment");
@@ -3108,12 +3109,33 @@ var DEFAULT_MODELS = {
3108
3109
 
3109
3110
  // src/cli/config-manager.ts
3110
3111
  var CONFIG_FILENAMES = ["opencode.json", "opencode.jsonc"];
3112
+ function getGlobalConfigDir() {
3113
+ if (process.platform === "win32") {
3114
+ const crossPlatformDir = join(homedir(), ".config", "opencode");
3115
+ const crossPlatformConfig = join(crossPlatformDir, "opencode.json");
3116
+ const crossPlatformConfigJsonc = join(crossPlatformDir, "opencode.jsonc");
3117
+ if (existsSync(crossPlatformConfig) || existsSync(crossPlatformConfigJsonc)) {
3118
+ return crossPlatformDir;
3119
+ }
3120
+ const appData = process.env.APPDATA || join(homedir(), "AppData", "Roaming");
3121
+ return join(appData, "opencode");
3122
+ }
3123
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
3124
+ return join(xdgConfig, "opencode");
3125
+ }
3111
3126
  function findConfigFile(directory) {
3112
- for (const filename of CONFIG_FILENAMES) {
3113
- const configPath = join(directory, filename);
3114
- if (existsSync(configPath)) {
3115
- const format = filename.endsWith(".jsonc") ? "jsonc" : "json";
3116
- return { path: configPath, format };
3127
+ const searchPaths = [
3128
+ join(directory, ".opencode"),
3129
+ directory,
3130
+ getGlobalConfigDir()
3131
+ ];
3132
+ for (const searchDir of searchPaths) {
3133
+ for (const filename of CONFIG_FILENAMES) {
3134
+ const configPath = join(searchDir, filename);
3135
+ if (existsSync(configPath)) {
3136
+ const format = filename.endsWith(".jsonc") ? "jsonc" : "json";
3137
+ return { path: configPath, format };
3138
+ }
3117
3139
  }
3118
3140
  }
3119
3141
  return null;
@@ -3179,6 +3201,10 @@ async function installPlugin(configPath) {
3179
3201
  await writeFile(configPath, newContent, "utf-8");
3180
3202
  }
3181
3203
  function getDefaultConfigPath(directory) {
3204
+ const dotOpencodeDir = join(directory, ".opencode");
3205
+ if (existsSync(dotOpencodeDir)) {
3206
+ return join(dotOpencodeDir, "opencode.json");
3207
+ }
3182
3208
  return join(directory, "opencode.json");
3183
3209
  }
3184
3210
  async function createDefaultConfig(configPath) {
@@ -3193,9 +3219,9 @@ async function createDefaultConfig(configPath) {
3193
3219
  import { existsSync as existsSync2 } from "node:fs";
3194
3220
  import { readFile as readFile2, writeFile as writeFile2, mkdir } from "node:fs/promises";
3195
3221
  import { join as join2, dirname } from "node:path";
3196
- import { homedir } from "node:os";
3222
+ import { homedir as homedir2 } from "node:os";
3197
3223
  function getZenoxConfigPath() {
3198
- return join2(homedir(), ".config", "opencode", "zenox.json");
3224
+ return join2(homedir2(), ".config", "opencode", "zenox.json");
3199
3225
  }
3200
3226
  async function readZenoxConfig() {
3201
3227
  const configPath = getZenoxConfigPath();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenox",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "OpenCode plugin with specialized agents (explorer, librarian, oracle, ui-planner), background tasks for parallel execution, and smart orchestration",
5
5
  "author": "Ayush",
6
6
  "license": "MIT",