axconfig 3.4.0 → 3.4.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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini settings.json helpers.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Read existing settings.json, returning empty object if not found.
|
|
6
|
+
* Throws if file exists but contains invalid JSON to prevent data loss.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readExistingSettings(settingsPath: string): Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Disable Gemini's environment variable redaction for CI compatibility.
|
|
11
|
+
*
|
|
12
|
+
* Gemini CLI sanitizes environment variables in GitHub Actions, which blocks
|
|
13
|
+
* access to REAL_HOME, GH_TOKEN, and other vars needed for shell commands.
|
|
14
|
+
* Disabling redaction allows all parent env vars to pass through.
|
|
15
|
+
*/
|
|
16
|
+
export declare function disableEnvironmentVariableRedaction(existingSettings: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini settings.json helpers.
|
|
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
|
+
* Disable Gemini's environment variable redaction for CI compatibility.
|
|
24
|
+
*
|
|
25
|
+
* Gemini CLI sanitizes environment variables in GitHub Actions, which blocks
|
|
26
|
+
* access to REAL_HOME, GH_TOKEN, and other vars needed for shell commands.
|
|
27
|
+
* Disabling redaction allows all parent env vars to pass through.
|
|
28
|
+
*/
|
|
29
|
+
export function disableEnvironmentVariableRedaction(existingSettings) {
|
|
30
|
+
const existingSecurity = existingSettings.security ?? {};
|
|
31
|
+
return {
|
|
32
|
+
...existingSettings,
|
|
33
|
+
security: {
|
|
34
|
+
...existingSecurity,
|
|
35
|
+
environmentVariableRedaction: {
|
|
36
|
+
enabled: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
package/dist/agents/gemini.js
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* - Bash patterns via commandPrefix
|
|
9
9
|
* - Does NOT support path restrictions
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { mkdirSync } 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
15
|
// Re-export reader
|
|
16
16
|
export { geminiConfigReader } from "./gemini-reader.js";
|
|
17
|
+
import { disableEnvironmentVariableRedaction, readExistingSettings, } from "./gemini-settings.js";
|
|
17
18
|
/** Gemini CLI tool name mapping */
|
|
18
19
|
const TOOL_MAP = {
|
|
19
20
|
read: "read_file",
|
|
@@ -56,23 +57,6 @@ commandPrefix = ${prefixValue}
|
|
|
56
57
|
decision = "${decision}"
|
|
57
58
|
priority = ${priority}`;
|
|
58
59
|
}
|
|
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
|
-
}
|
|
76
60
|
/**
|
|
77
61
|
* Build Gemini CLI configuration.
|
|
78
62
|
*
|
|
@@ -154,10 +138,11 @@ function build(config, output) {
|
|
|
154
138
|
const policyPath = path.join(policiesDirectory, "axconfig.toml");
|
|
155
139
|
const policyContent = rules.filter((r) => r !== "").join("\n\n");
|
|
156
140
|
atomicWriteFileSync(policyPath, policyContent || "# No rules\n");
|
|
157
|
-
// Write settings.json, preserving existing settings
|
|
141
|
+
// Write settings.json, preserving existing settings and disabling env var redaction
|
|
158
142
|
const settingsPath = path.join(output, "settings.json");
|
|
159
143
|
const existingSettings = readExistingSettings(settingsPath);
|
|
160
|
-
|
|
144
|
+
const mergedSettings = disableEnvironmentVariableRedaction(existingSettings);
|
|
145
|
+
atomicWriteFileSync(settingsPath, JSON.stringify(mergedSettings, undefined, 2));
|
|
161
146
|
return {
|
|
162
147
|
ok: true,
|
|
163
148
|
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.4.
|
|
5
|
+
"version": "3.4.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",
|