codex-config 0.1.0 → 0.144.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,61 @@
1
+ export declare const CODEX_TARGET: {
2
+ readonly sourceRevision: "9e552e9d15ba52bed7077d5357f3e18e330f8f38";
3
+ readonly sourceCommitDate: "2026-07-11T21:03:12Z";
4
+ readonly minimumClientVersion: "0.144.0";
5
+ readonly defaultModel: "gpt-5.6-sol";
6
+ readonly models: readonly [{
7
+ readonly id: "gpt-5.6-sol";
8
+ readonly displayName: "GPT-5.6-Sol";
9
+ readonly contextWindow: 372000;
10
+ readonly reasoningEfforts: readonly ["low", "medium", "high", "xhigh", "max", "ultra"];
11
+ readonly defaultReasoningEffort: "low";
12
+ readonly defaultReasoningSummary: "none";
13
+ readonly supportsVerbosity: true;
14
+ readonly serviceTiers: readonly ["priority"];
15
+ readonly minimumClientVersion: "0.144.0";
16
+ readonly toolMode: "code_mode_only";
17
+ readonly multiAgentVersion: "v2";
18
+ readonly supportsPersonality: false;
19
+ }, {
20
+ readonly id: "gpt-5.6-terra";
21
+ readonly displayName: "GPT-5.6-Terra";
22
+ readonly contextWindow: 372000;
23
+ readonly reasoningEfforts: readonly ["low", "medium", "high", "xhigh", "max", "ultra"];
24
+ readonly defaultReasoningEffort: "medium";
25
+ readonly defaultReasoningSummary: "none";
26
+ readonly supportsVerbosity: true;
27
+ readonly serviceTiers: readonly ["priority"];
28
+ readonly minimumClientVersion: "0.144.0";
29
+ readonly toolMode: "code_mode_only";
30
+ readonly multiAgentVersion: "v2";
31
+ readonly supportsPersonality: false;
32
+ }, {
33
+ readonly id: "gpt-5.6-luna";
34
+ readonly displayName: "GPT-5.6-Luna";
35
+ readonly contextWindow: 372000;
36
+ readonly reasoningEfforts: readonly ["low", "medium", "high", "xhigh", "max"];
37
+ readonly defaultReasoningEffort: "medium";
38
+ readonly defaultReasoningSummary: "none";
39
+ readonly supportsVerbosity: true;
40
+ readonly serviceTiers: readonly ["priority"];
41
+ readonly minimumClientVersion: "0.144.0";
42
+ readonly toolMode: "code_mode_only";
43
+ readonly multiAgentVersion: "v1";
44
+ readonly supportsPersonality: false;
45
+ }];
46
+ readonly removedFeatureKeys: readonly ["apply_patch_freeform", "apps_mcp_path_override", "codex_git_commit", "collaboration_modes", "elevated_windows_sandbox", "experimental_windows_sandbox", "external_migration", "image_detail_original", "js_repl", "js_repl_tools_only", "multi_agent_mode", "plugin_hooks", "remote_control", "remote_models", "request_rule", "resize_all_images", "responses_websockets", "responses_websockets_v2", "search_tool", "skill_env_var_dependency_prompt", "sqlite", "steer", "terminal_resize_reflow", "tool_search", "tool_search_always_defer_mcp_tools", "tui_app_server", "unavailable_dummy_tools", "undo", "use_linux_sandbox_bwrap", "workspace_owner_usage_nudge"];
47
+ readonly retiredFeatureKeys: readonly ["approve_all", "apps_mcp_gateway", "auto_compaction", "builtin_mcp", "child_agents_md", "debug_hide_spawn_agent_metadata", "enable_elevated_windows_sandbox", "exec_policy", "experimental_sandbox_command_assessment", "general_analytics", "ghost_commit", "hierarchical_agents", "parallel", "plan_tool", "powershell_utf8", "realtime_conversation_v2", "remote_compaction", "responses_websocket_response_processed", "rmcp_client", "shell_command_tool", "skill_approval", "skills", "sleep_tool", "smart_approvals", "spawn_csv", "streamable_shell", "tui2", "view_image_tool", "voice_transcription", "warnings"];
48
+ readonly deprecatedFeatureKeys: readonly ["use_legacy_landlock", "web_search_cached", "web_search_request"];
49
+ readonly legacyFeatureAliases: {
50
+ readonly codex_hooks: "hooks";
51
+ readonly collab: "multi_agent";
52
+ readonly connectors: "apps";
53
+ readonly enable_experimental_windows_sandbox: "experimental_windows_sandbox";
54
+ readonly experimental_use_unified_exec_tool: "unified_exec";
55
+ readonly imagegenext: "image_generation";
56
+ readonly memory_tool: "memories";
57
+ readonly request_permissions: "exec_permission_approvals";
58
+ readonly telepathy: "chronicle";
59
+ readonly web_search: "web_search_request";
60
+ };
61
+ };
@@ -0,0 +1,159 @@
1
+ // Generated by scripts/sync-codex.mjs. Do not edit by hand.
2
+ export const CODEX_TARGET = {
3
+ "sourceRevision": "9e552e9d15ba52bed7077d5357f3e18e330f8f38",
4
+ "sourceCommitDate": "2026-07-11T21:03:12Z",
5
+ "minimumClientVersion": "0.144.0",
6
+ "defaultModel": "gpt-5.6-sol",
7
+ "models": [
8
+ {
9
+ "id": "gpt-5.6-sol",
10
+ "displayName": "GPT-5.6-Sol",
11
+ "contextWindow": 372000,
12
+ "reasoningEfforts": [
13
+ "low",
14
+ "medium",
15
+ "high",
16
+ "xhigh",
17
+ "max",
18
+ "ultra"
19
+ ],
20
+ "defaultReasoningEffort": "low",
21
+ "defaultReasoningSummary": "none",
22
+ "supportsVerbosity": true,
23
+ "serviceTiers": [
24
+ "priority"
25
+ ],
26
+ "minimumClientVersion": "0.144.0",
27
+ "toolMode": "code_mode_only",
28
+ "multiAgentVersion": "v2",
29
+ "supportsPersonality": false
30
+ },
31
+ {
32
+ "id": "gpt-5.6-terra",
33
+ "displayName": "GPT-5.6-Terra",
34
+ "contextWindow": 372000,
35
+ "reasoningEfforts": [
36
+ "low",
37
+ "medium",
38
+ "high",
39
+ "xhigh",
40
+ "max",
41
+ "ultra"
42
+ ],
43
+ "defaultReasoningEffort": "medium",
44
+ "defaultReasoningSummary": "none",
45
+ "supportsVerbosity": true,
46
+ "serviceTiers": [
47
+ "priority"
48
+ ],
49
+ "minimumClientVersion": "0.144.0",
50
+ "toolMode": "code_mode_only",
51
+ "multiAgentVersion": "v2",
52
+ "supportsPersonality": false
53
+ },
54
+ {
55
+ "id": "gpt-5.6-luna",
56
+ "displayName": "GPT-5.6-Luna",
57
+ "contextWindow": 372000,
58
+ "reasoningEfforts": [
59
+ "low",
60
+ "medium",
61
+ "high",
62
+ "xhigh",
63
+ "max"
64
+ ],
65
+ "defaultReasoningEffort": "medium",
66
+ "defaultReasoningSummary": "none",
67
+ "supportsVerbosity": true,
68
+ "serviceTiers": [
69
+ "priority"
70
+ ],
71
+ "minimumClientVersion": "0.144.0",
72
+ "toolMode": "code_mode_only",
73
+ "multiAgentVersion": "v1",
74
+ "supportsPersonality": false
75
+ }
76
+ ],
77
+ "removedFeatureKeys": [
78
+ "apply_patch_freeform",
79
+ "apps_mcp_path_override",
80
+ "codex_git_commit",
81
+ "collaboration_modes",
82
+ "elevated_windows_sandbox",
83
+ "experimental_windows_sandbox",
84
+ "external_migration",
85
+ "image_detail_original",
86
+ "js_repl",
87
+ "js_repl_tools_only",
88
+ "multi_agent_mode",
89
+ "plugin_hooks",
90
+ "remote_control",
91
+ "remote_models",
92
+ "request_rule",
93
+ "resize_all_images",
94
+ "responses_websockets",
95
+ "responses_websockets_v2",
96
+ "search_tool",
97
+ "skill_env_var_dependency_prompt",
98
+ "sqlite",
99
+ "steer",
100
+ "terminal_resize_reflow",
101
+ "tool_search",
102
+ "tool_search_always_defer_mcp_tools",
103
+ "tui_app_server",
104
+ "unavailable_dummy_tools",
105
+ "undo",
106
+ "use_linux_sandbox_bwrap",
107
+ "workspace_owner_usage_nudge"
108
+ ],
109
+ "retiredFeatureKeys": [
110
+ "approve_all",
111
+ "apps_mcp_gateway",
112
+ "auto_compaction",
113
+ "builtin_mcp",
114
+ "child_agents_md",
115
+ "debug_hide_spawn_agent_metadata",
116
+ "enable_elevated_windows_sandbox",
117
+ "exec_policy",
118
+ "experimental_sandbox_command_assessment",
119
+ "general_analytics",
120
+ "ghost_commit",
121
+ "hierarchical_agents",
122
+ "parallel",
123
+ "plan_tool",
124
+ "powershell_utf8",
125
+ "realtime_conversation_v2",
126
+ "remote_compaction",
127
+ "responses_websocket_response_processed",
128
+ "rmcp_client",
129
+ "shell_command_tool",
130
+ "skill_approval",
131
+ "skills",
132
+ "sleep_tool",
133
+ "smart_approvals",
134
+ "spawn_csv",
135
+ "streamable_shell",
136
+ "tui2",
137
+ "view_image_tool",
138
+ "voice_transcription",
139
+ "warnings"
140
+ ],
141
+ "deprecatedFeatureKeys": [
142
+ "use_legacy_landlock",
143
+ "web_search_cached",
144
+ "web_search_request"
145
+ ],
146
+ "legacyFeatureAliases": {
147
+ "codex_hooks": "hooks",
148
+ "collab": "multi_agent",
149
+ "connectors": "apps",
150
+ "enable_experimental_windows_sandbox": "experimental_windows_sandbox",
151
+ "experimental_use_unified_exec_tool": "unified_exec",
152
+ "imagegenext": "image_generation",
153
+ "memory_tool": "memories",
154
+ "request_permissions": "exec_permission_approvals",
155
+ "telepathy": "chronicle",
156
+ "web_search": "web_search_request"
157
+ }
158
+ };
159
+ //# sourceMappingURL=codex-target.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-target.generated.js","sourceRoot":"","sources":["../src/codex-target.generated.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,gBAAgB,EAAE,0CAA0C;IAC5D,kBAAkB,EAAE,sBAAsB;IAC1C,sBAAsB,EAAE,SAAS;IACjC,cAAc,EAAE,aAAa;IAC7B,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,aAAa;YACnB,aAAa,EAAE,aAAa;YAC5B,eAAe,EAAE,MAAM;YACvB,kBAAkB,EAAE;gBAClB,KAAK;gBACL,QAAQ;gBACR,MAAM;gBACN,OAAO;gBACP,KAAK;gBACL,OAAO;aACR;YACD,wBAAwB,EAAE,KAAK;YAC/B,yBAAyB,EAAE,MAAM;YACjC,mBAAmB,EAAE,IAAI;YACzB,cAAc,EAAE;gBACd,UAAU;aACX;YACD,sBAAsB,EAAE,SAAS;YACjC,UAAU,EAAE,gBAAgB;YAC5B,mBAAmB,EAAE,IAAI;YACzB,qBAAqB,EAAE,KAAK;SAC7B;QACD;YACE,IAAI,EAAE,eAAe;YACrB,aAAa,EAAE,eAAe;YAC9B,eAAe,EAAE,MAAM;YACvB,kBAAkB,EAAE;gBAClB,KAAK;gBACL,QAAQ;gBACR,MAAM;gBACN,OAAO;gBACP,KAAK;gBACL,OAAO;aACR;YACD,wBAAwB,EAAE,QAAQ;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X,iBAAiB;QACjB,0BAA0B;QAC1B,mBAAmB;QACnB,wCAAwC;QACxC,aAAa;QACb,oBAAoB;QACpB,gBAAgB;QAChB,QAAQ;QACR,YAAY;QACZ,iBAAiB;QACjB,WAAW;QACX,kBAAkB;QAClB,MAAM;QACN,iBAAiB;QACjB,qBAAqB;QACrB,UAAU;KACX;IACD,uBAAuB,EAAE;QACvB,qBAAqB;QACrB,mBAAmB;QACnB,oBAAoB;KACrB;IACD,sBAAsB,EAAE;QACtB,aAAa,EAAE,OAAO;QACtB,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,MAAM;QACpB,qCAAqC,EAAE,8BAA8B;QACrE,oCAAoC,EAAE,cAAc;QACpD,aAAa,EAAE,kBAAkB;QACjC,aAAa,EAAE,UAAU;QACzB,qBAAqB,EAAE,2BAA2B;QAClD,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,oBAAoB;KACnC;CACO,CAAC"}
@@ -1,8 +1,10 @@
1
+ import { type ConfigIssue } from "./codex-policy.js";
1
2
  import { type ChangeOperation, type MergeMode } from "./toml-merge.js";
2
3
  export interface CommandOptions {
3
4
  target?: string;
4
5
  template?: string;
5
- overrideAll?: boolean;
6
+ profile?: string;
7
+ force?: boolean;
6
8
  }
7
9
  export interface ApplyOptions extends CommandOptions {
8
10
  dryRun?: boolean;
@@ -18,15 +20,29 @@ export interface CommandResult {
18
20
  }
19
21
  export interface DoctorResult {
20
22
  ok: boolean;
23
+ codex: {
24
+ sourceRevision: string;
25
+ sourceCommitDate: string;
26
+ minimumClientVersion: string;
27
+ schema: string;
28
+ defaultModel: string;
29
+ supportedModels: string[];
30
+ };
21
31
  target: {
22
32
  path: string;
23
33
  exists: boolean;
24
34
  validToml: boolean | null;
35
+ compatible: boolean | null;
36
+ clean: boolean | null;
37
+ issues: ConfigIssue[];
25
38
  };
26
39
  template: {
27
40
  path: string;
28
41
  exists: boolean;
29
42
  validToml: boolean;
43
+ compatible: boolean;
44
+ clean: boolean;
45
+ issues: ConfigIssue[];
30
46
  };
31
47
  authRequired: false;
32
48
  }
package/dist/commands.js CHANGED
@@ -1,14 +1,16 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { dirname, resolve } from "node:path";
3
+ import { planCodexMigrations } from "./codex-migrations.js";
4
+ import { CODEX_TARGET, formatConfigIssues, inspectCodexConfig, } from "./codex-policy.js";
3
5
  import { atomicWriteFile, fileExists, readTextIfExists } from "./fs.js";
4
- import { defaultTargetPath, defaultTemplatePath } from "./paths.js";
5
- import { planConfigChange, validateToml } from "./toml-merge.js";
6
+ import { defaultSchemaPath, defaultTargetPath, defaultTemplatePath } from "./paths.js";
7
+ import { planConfigChange } from "./toml-merge.js";
6
8
  export async function applyConfig(options) {
7
9
  const paths = resolvePaths(options);
8
10
  const mode = modeFromOptions(options);
9
11
  const templateText = await readFile(paths.template, "utf8");
10
12
  const targetText = await readTextIfExists(paths.target);
11
- const plan = planConfigChange({ targetText, templateText, mode, targetPath: paths.target });
13
+ const plan = await buildConfigPlan(targetText, templateText, mode, paths.target);
12
14
  if (plan.changed && !options.dryRun) {
13
15
  await atomicWriteFile(paths.target, plan.outputText);
14
16
  }
@@ -27,7 +29,7 @@ export async function diffConfig(options) {
27
29
  const mode = modeFromOptions(options);
28
30
  const templateText = await readFile(paths.template, "utf8");
29
31
  const targetText = await readTextIfExists(paths.target);
30
- const plan = planConfigChange({ targetText, templateText, mode, targetPath: paths.target });
32
+ const plan = await buildConfigPlan(targetText, templateText, mode, paths.target);
31
33
  return {
32
34
  ok: true,
33
35
  changed: plan.changed,
@@ -40,39 +42,95 @@ export async function diffConfig(options) {
40
42
  export async function doctor(options) {
41
43
  const paths = resolvePaths(options);
42
44
  const templateExists = await fileExists(paths.template);
43
- let templateValid = false;
45
+ let templateInspection = emptyInspection();
44
46
  if (templateExists) {
45
- validateToml(await readFile(paths.template, "utf8"), "template");
46
- templateValid = true;
47
+ templateInspection = await inspectCodexConfig(await readFile(paths.template, "utf8"), "template", {
48
+ requireModel: true,
49
+ });
47
50
  }
48
51
  const targetExists = await fileExists(paths.target);
49
- let targetValid = null;
52
+ let targetInspection = null;
50
53
  if (targetExists) {
51
- validateToml((await readTextIfExists(paths.target)) ?? "", "target");
52
- targetValid = true;
54
+ targetInspection = await inspectCodexConfig((await readTextIfExists(paths.target)) ?? "", "target", { requireModel: true });
53
55
  }
54
56
  return {
55
- ok: templateExists && templateValid && (!targetExists || targetValid === true),
57
+ ok: templateExists &&
58
+ templateInspection.valid &&
59
+ templateInspection.clean &&
60
+ (!targetInspection || (targetInspection.valid && targetInspection.clean)),
61
+ codex: {
62
+ sourceRevision: CODEX_TARGET.sourceRevision,
63
+ sourceCommitDate: CODEX_TARGET.sourceCommitDate,
64
+ minimumClientVersion: CODEX_TARGET.minimumClientVersion,
65
+ schema: defaultSchemaPath(),
66
+ defaultModel: CODEX_TARGET.defaultModel,
67
+ supportedModels: CODEX_TARGET.models.map((model) => model.id),
68
+ },
56
69
  target: {
57
70
  path: paths.target,
58
71
  exists: targetExists,
59
- validToml: targetValid,
72
+ validToml: targetInspection ? hasValidToml(targetInspection) : null,
73
+ compatible: targetInspection?.valid ?? null,
74
+ clean: targetInspection?.clean ?? null,
75
+ issues: targetInspection?.issues ?? [],
60
76
  },
61
77
  template: {
62
78
  path: paths.template,
63
79
  exists: templateExists,
64
- validToml: templateValid,
80
+ validToml: templateExists && hasValidToml(templateInspection),
81
+ compatible: templateExists && templateInspection.valid,
82
+ clean: templateExists && templateInspection.clean,
83
+ issues: templateInspection.issues,
65
84
  },
66
85
  authRequired: false,
67
86
  };
68
87
  }
88
+ async function buildConfigPlan(targetText, templateText, mode, targetPath) {
89
+ const templateInspection = await inspectCodexConfig(templateText, "template", {
90
+ requireModel: true,
91
+ });
92
+ if (!templateInspection.clean) {
93
+ throw new Error(`Template is not compatible with the GPT-5.6 target:\n${formatConfigIssues("template", templateInspection)}`);
94
+ }
95
+ const migrationPlan = targetText === undefined ? undefined : planCodexMigrations(targetText);
96
+ const mergePlan = planConfigChange({
97
+ targetText: migrationPlan?.outputText,
98
+ templateText,
99
+ mode,
100
+ targetPath,
101
+ });
102
+ const plan = migrationPlan ? combinePlans(migrationPlan, mergePlan) : mergePlan;
103
+ const finalInspection = await inspectCodexConfig(plan.outputText, "result", {
104
+ requireModel: true,
105
+ });
106
+ if (!finalInspection.valid) {
107
+ throw new Error(`Result is not compatible with the GPT-5.6 target:\n${formatConfigIssues("result", finalInspection)}`);
108
+ }
109
+ return plan;
110
+ }
111
+ function combinePlans(first, second) {
112
+ return {
113
+ changed: first.changed || second.changed,
114
+ outputText: second.outputText,
115
+ operations: [...first.operations, ...second.operations],
116
+ };
117
+ }
118
+ function emptyInspection() {
119
+ return { valid: false, clean: false, issues: [] };
120
+ }
121
+ function hasValidToml(inspection) {
122
+ return !inspection.issues.some((issue) => issue.code === "invalid_toml");
123
+ }
69
124
  function resolvePaths(options) {
70
- const target = resolve(options.target ?? defaultTargetPath());
125
+ if (options.target && options.profile) {
126
+ throw new Error("--target and --profile cannot be used together.");
127
+ }
128
+ const target = resolve(options.target ?? defaultTargetPath(options.profile));
71
129
  const template = resolve(options.template ?? defaultTemplatePath());
72
130
  return { target, template };
73
131
  }
74
132
  function modeFromOptions(options) {
75
- return options.overrideAll ? "override" : "missing";
133
+ return options.force ? "override" : "missing";
76
134
  }
77
135
  export function formatTextResult(command, result) {
78
136
  const lines = [];
@@ -99,18 +157,36 @@ export function formatTextResult(command, result) {
99
157
  return `${lines.join("\n")}\n`;
100
158
  }
101
159
  export function formatDoctorText(result) {
102
- return [
160
+ const lines = [
103
161
  result.ok ? "codex-config is ready." : "codex-config is not ready.",
162
+ `Codex source: ${result.codex.sourceRevision}`,
163
+ `minimum Codex version: ${result.codex.minimumClientVersion}`,
164
+ `default model: ${result.codex.defaultModel}`,
165
+ `supported models: ${result.codex.supportedModels.join(", ")}`,
104
166
  `target: ${result.target.path}`,
105
167
  `target exists: ${String(result.target.exists)}`,
106
168
  `target valid TOML: ${String(result.target.validToml)}`,
169
+ `target compatible: ${String(result.target.compatible)}`,
170
+ `target clean: ${String(result.target.clean)}`,
107
171
  `template: ${result.template.path}`,
108
172
  `template exists: ${String(result.template.exists)}`,
109
173
  `template valid TOML: ${String(result.template.validToml)}`,
174
+ `template compatible: ${String(result.template.compatible)}`,
175
+ `template clean: ${String(result.template.clean)}`,
110
176
  "auth required: false",
111
- ].join("\n") + "\n";
177
+ ];
178
+ for (const issue of result.target.issues) {
179
+ lines.push(`${issue.severity}: target${issue.path ? `.${issue.path}` : ""}: ${issue.message}`);
180
+ }
181
+ for (const issue of result.template.issues) {
182
+ lines.push(`${issue.severity}: template${issue.path ? `.${issue.path}` : ""}: ${issue.message}`);
183
+ }
184
+ return `${lines.join("\n")}\n`;
112
185
  }
113
186
  export function targetDirectory(options) {
114
- return dirname(resolve(options.target ?? defaultTargetPath()));
187
+ if (options.target && options.profile) {
188
+ throw new Error("--target and --profile cannot be used together.");
189
+ }
190
+ return dirname(resolve(options.target ?? defaultTargetPath(options.profile)));
115
191
  }
116
192
  //# sourceMappingURL=commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAwC,MAAM,iBAAiB,CAAC;AAqCvG,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAqB;IACrD,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,YAAY,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,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAuB;IACrD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
package/dist/paths.d.ts CHANGED
@@ -1,2 +1,5 @@
1
- export declare function defaultTargetPath(): string;
1
+ export declare function defaultCodexHomePath(): string;
2
+ export declare function defaultTargetPath(profile?: string): string;
2
3
  export declare function defaultTemplatePath(): string;
4
+ export declare function defaultSchemaPath(): string;
5
+ export declare function validateProfileName(profile: string): string;
package/dist/paths.js CHANGED
@@ -1,11 +1,26 @@
1
1
  import { homedir } from "node:os";
2
- import { dirname, resolve } from "node:path";
2
+ import { dirname, join, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
- export function defaultTargetPath() {
5
- return resolve(homedir(), ".codex/config.toml");
4
+ export function defaultCodexHomePath() {
5
+ const configuredHome = process.env.CODEX_HOME?.trim();
6
+ return configuredHome ? resolve(configuredHome) : resolve(homedir(), ".codex");
7
+ }
8
+ export function defaultTargetPath(profile) {
9
+ const filename = profile ? `${validateProfileName(profile)}.config.toml` : "config.toml";
10
+ return join(defaultCodexHomePath(), filename);
6
11
  }
7
12
  export function defaultTemplatePath() {
8
13
  const currentDirectory = dirname(fileURLToPath(import.meta.url));
9
14
  return resolve(currentDirectory, "../config.toml.template");
10
15
  }
16
+ export function defaultSchemaPath() {
17
+ const currentDirectory = dirname(fileURLToPath(import.meta.url));
18
+ return resolve(currentDirectory, "../config.schema.json");
19
+ }
20
+ export function validateProfileName(profile) {
21
+ if (!/^[A-Za-z0-9_-]+$/.test(profile)) {
22
+ throw new Error(`Invalid profile name \`${profile}\`; use a plain name such as \`work\`.`);
23
+ }
24
+ return profile;
25
+ }
11
26
  //# sourceMappingURL=paths.js.map
package/dist/paths.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,iBAAiB;IAC/B,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,oBAAoB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;AAC9D,CAAC"}
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,oBAAoB;IAClC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;IACtD,OAAO,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC;IACzF,OAAO,IAAI,CAAC,oBAAoB,EAAE,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,OAAO,wCAAwC,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -6,7 +6,7 @@ export interface PlanConfigChangeOptions {
6
6
  targetPath?: string;
7
7
  }
8
8
  export interface ChangeOperation {
9
- action: "create" | "add" | "update";
9
+ action: "create" | "add" | "update" | "remove";
10
10
  path: string;
11
11
  }
12
12
  export interface ConfigChangePlan {
@@ -16,3 +16,4 @@ export interface ConfigChangePlan {
16
16
  }
17
17
  export declare function planConfigChange(options: PlanConfigChangeOptions): ConfigChangePlan;
18
18
  export declare function validateToml(text: string, label: string): void;
19
+ export declare function planConfigRemovals(targetText: string, paths: ReadonlyArray<ReadonlyArray<string>>): ConfigChangePlan;
@@ -82,6 +82,37 @@ export function planConfigChange(options) {
82
82
  export function validateToml(text, label) {
83
83
  parseToml(text, label);
84
84
  }
85
+ export function planConfigRemovals(targetText, paths) {
86
+ const normalizedTarget = normalizeNewlines(targetText);
87
+ const targetParsed = parseToml(normalizedTarget, "target");
88
+ const targetScan = scanToml(normalizedTarget, false);
89
+ const operations = [];
90
+ const mutations = [];
91
+ for (const readonlyPath of paths) {
92
+ const path = [...readonlyPath];
93
+ if (!hasPath(targetParsed, path)) {
94
+ continue;
95
+ }
96
+ const targetEntry = targetScan.entryByPath.get(pathKey(path));
97
+ if (!targetEntry) {
98
+ throw new Error(`Cannot remove ${formatPath(path)} because it is not represented as a standalone TOML key.`);
99
+ }
100
+ mutations.push({ start: targetEntry.start, end: targetEntry.end, lines: [] });
101
+ operations.push({ action: "remove", path: formatPath(path) });
102
+ }
103
+ if (mutations.length === 0) {
104
+ return {
105
+ changed: false,
106
+ outputText: ensureTrailingNewline(normalizedTarget),
107
+ operations,
108
+ };
109
+ }
110
+ return {
111
+ changed: true,
112
+ outputText: ensureTrailingNewline(applyMutations(targetScan.lines, mutations).join("\n")),
113
+ operations,
114
+ };
115
+ }
85
116
  function parseToml(text, label) {
86
117
  try {
87
118
  return parse(text);