axconfig 3.0.0 → 3.0.1

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.
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { existsSync, mkdirSync, readFileSync } from "node:fs";
12
12
  import path from "node:path";
13
- import { getAgentConfigSubdirectory } from "axshared";
13
+ import { buildAgentRuntimeEnvironment } from "axshared";
14
14
  import { atomicWriteFileSync } from "../atomic-write.js";
15
15
  import { registerConfigBuilder } from "../builder.js";
16
16
  // Re-export reader
@@ -62,11 +62,9 @@ function build(config, output) {
62
62
  if (errors.length > 0) {
63
63
  return { ok: false, errors };
64
64
  }
65
- // OpenCode expects config at XDG_CONFIG_HOME/opencode/opencode.json
66
- const subdirectory = getAgentConfigSubdirectory("opencode") ?? "opencode";
67
- const openCodeDirectory = path.join(output, subdirectory);
68
- mkdirSync(openCodeDirectory, { recursive: true });
69
- const configPath = path.join(openCodeDirectory, "opencode.json");
65
+ // OpenCode config is at {configDir}/opencode.json
66
+ // The output directory is used directly as the config directory.
67
+ const configPath = path.join(output, "opencode.json");
70
68
  // Build permission config
71
69
  const permissionConfig = {};
72
70
  if (permissions) {
@@ -156,11 +154,15 @@ function build(config, output) {
156
154
  permission: permissionConfig,
157
155
  };
158
156
  atomicWriteFileSync(configPath, JSON.stringify(openCodeConfig, undefined, 2));
157
+ // Build environment variables:
158
+ // - OPENCODE_CONFIG_DIR: axpoint convention for config directory
159
+ // - XDG_DATA_HOME/XDG_CONFIG_HOME: OpenCode uses these for auth and other XDG-based paths
160
+ const runtimeEnvironment = buildAgentRuntimeEnvironment("opencode", output);
159
161
  return {
160
162
  ok: true,
161
163
  env: {
162
- XDG_CONFIG_HOME: output,
163
- XDG_DATA_HOME: output,
164
+ OPENCODE_CONFIG_DIR: output,
165
+ ...runtimeEnvironment,
164
166
  },
165
167
  warnings,
166
168
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "axconfig",
3
3
  "author": "Łukasz Jerciński",
4
4
  "license": "MIT",
5
- "version": "3.0.0",
5
+ "version": "3.0.1",
6
6
  "description": "Unified configuration management for AI coding agents - common API for permissions, settings, and config across Claude Code, Codex, Gemini CLI, and OpenCode",
7
7
  "repository": {
8
8
  "type": "git",
@@ -68,7 +68,7 @@
68
68
  "dependencies": {
69
69
  "@commander-js/extra-typings": "^14.0.0",
70
70
  "@iarna/toml": "^2.2.5",
71
- "axshared": "^1.2.0",
71
+ "axshared": "^1.3.0",
72
72
  "commander": "^14.0.2"
73
73
  },
74
74
  "devDependencies": {