axconfig 3.3.0 → 3.4.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.
@@ -8,11 +8,10 @@
8
8
  * - Bash patterns via commandPrefix
9
9
  * - Does NOT support path restrictions
10
10
  */
11
- import { mkdirSync } from "node:fs";
11
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
12
12
  import path from "node:path";
13
13
  import { atomicWriteFileSync } from "../atomic-write.js";
14
14
  import { registerConfigBuilder } from "../builder.js";
15
- import { mergeSecuritySettings, readExistingSettings, } from "./gemini-settings.js";
16
15
  // Re-export reader
17
16
  export { geminiConfigReader } from "./gemini-reader.js";
18
17
  /** Gemini CLI tool name mapping */
@@ -57,6 +56,23 @@ commandPrefix = ${prefixValue}
57
56
  decision = "${decision}"
58
57
  priority = ${priority}`;
59
58
  }
59
+ /**
60
+ * Read existing settings.json, returning empty object if not found.
61
+ * Throws if file exists but contains invalid JSON to prevent data loss.
62
+ */
63
+ function readExistingSettings(settingsPath) {
64
+ if (!existsSync(settingsPath)) {
65
+ return {};
66
+ }
67
+ try {
68
+ const content = readFileSync(settingsPath, "utf8");
69
+ return JSON.parse(content);
70
+ }
71
+ catch (error) {
72
+ const message = error instanceof Error ? error.message : String(error);
73
+ throw new Error(`Failed to parse existing settings at ${settingsPath}: ${message}`);
74
+ }
75
+ }
60
76
  /**
61
77
  * Build Gemini CLI configuration.
62
78
  *
@@ -141,10 +157,7 @@ function build(config, output) {
141
157
  // Write settings.json, preserving existing settings (e.g., model)
142
158
  const settingsPath = path.join(output, "settings.json");
143
159
  const existingSettings = readExistingSettings(settingsPath);
144
- // Disable Gemini's environment variable redaction so shell commands
145
- // can access tokens like GH_TOKEN in CI environments
146
- const settings = mergeSecuritySettings(existingSettings);
147
- atomicWriteFileSync(settingsPath, JSON.stringify(settings, undefined, 2));
160
+ atomicWriteFileSync(settingsPath, JSON.stringify(existingSettings, undefined, 2));
148
161
  return {
149
162
  ok: true,
150
163
  env: { GEMINI_DIR: output },
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.3.0",
5
+ "version": "3.4.0",
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",
@@ -1,14 +0,0 @@
1
- /**
2
- * Gemini CLI settings utilities.
3
- */
4
- type NestedRecord = Record<string, unknown>;
5
- /**
6
- * Read existing settings.json, returning empty object if not found.
7
- * Throws if file exists but contains invalid JSON to prevent data loss.
8
- */
9
- export declare function readExistingSettings(settingsPath: string): NestedRecord;
10
- /**
11
- * Merge existing settings with security.environmentVariableRedaction.enabled = false.
12
- */
13
- export declare function mergeSecuritySettings(existing: NestedRecord): NestedRecord;
14
- export {};
@@ -1,36 +0,0 @@
1
- /**
2
- * Gemini CLI settings utilities.
3
- */
4
- import { existsSync, readFileSync } from "node:fs";
5
- /**
6
- * Read existing settings.json, returning empty object if not found.
7
- * Throws if file exists but contains invalid JSON to prevent data loss.
8
- */
9
- export function readExistingSettings(settingsPath) {
10
- if (!existsSync(settingsPath)) {
11
- return {};
12
- }
13
- try {
14
- const content = readFileSync(settingsPath, "utf8");
15
- return JSON.parse(content);
16
- }
17
- catch (error) {
18
- const message = error instanceof Error ? error.message : String(error);
19
- throw new Error(`Failed to parse existing settings at ${settingsPath}: ${message}`);
20
- }
21
- }
22
- /**
23
- * Merge existing settings with security.environmentVariableRedaction.enabled = false.
24
- */
25
- export function mergeSecuritySettings(existing) {
26
- const security = (existing.security ?? {});
27
- const redaction = (security.environmentVariableRedaction ??
28
- {});
29
- return {
30
- ...existing,
31
- security: {
32
- ...security,
33
- environmentVariableRedaction: { ...redaction, enabled: false },
34
- },
35
- };
36
- }