config: add override config foundation

# Conflicts:
#	codex-rs/config/src/loader/mod.rs
This commit is contained in:
Brent Traut
2026-05-19 13:29:23 -07:00
parent 5c43a64e2b
commit ed68380a48
27 changed files with 1814 additions and 125 deletions
@@ -7443,6 +7443,27 @@
"title": "SystemConfigLayerSource",
"type": "object"
},
{
"description": "System override layer from a sibling `config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/v2/AbsolutePathBuf"
},
"type": {
"enum": [
"systemOverride"
],
"title": "SystemOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "SystemOverrideConfigLayerSource",
"type": "object"
},
{
"description": "User config layer from $CODEX_HOME/config.toml. This layer is special in that it is expected to be: - writable by the user - generally outside the workspace directory",
"properties": {
@@ -7476,6 +7497,27 @@
"title": "UserConfigLayerSource",
"type": "object"
},
{
"description": "User override layer from `$CODEX_HOME/config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/v2/AbsolutePathBuf"
},
"type": {
"enum": [
"userOverride"
],
"title": "UserOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "UserOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Path to a .codex/ folder within a project. There could be multiple of these between `cwd` and the project/repo root.",
"properties": {
@@ -7497,6 +7539,27 @@
"title": "ProjectConfigLayerSource",
"type": "object"
},
{
"description": "Project override layer from a sibling `.codex/config.override.toml`.",
"properties": {
"dotCodexFolder": {
"$ref": "#/definitions/v2/AbsolutePathBuf"
},
"type": {
"enum": [
"projectOverride"
],
"title": "ProjectOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"dotCodexFolder",
"type"
],
"title": "ProjectOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Session-layer overrides supplied via `-c`/`--config`.",
"properties": {
@@ -7591,6 +7654,12 @@
"$ref": "#/definitions/v2/ConfigLayerMetadata"
},
"type": "object"
},
"userConfigVersion": {
"type": [
"string",
"null"
]
}
},
"required": [
@@ -3832,6 +3832,27 @@
"title": "SystemConfigLayerSource",
"type": "object"
},
{
"description": "System override layer from a sibling `config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"systemOverride"
],
"title": "SystemOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "SystemOverrideConfigLayerSource",
"type": "object"
},
{
"description": "User config layer from $CODEX_HOME/config.toml. This layer is special in that it is expected to be: - writable by the user - generally outside the workspace directory",
"properties": {
@@ -3865,6 +3886,27 @@
"title": "UserConfigLayerSource",
"type": "object"
},
{
"description": "User override layer from `$CODEX_HOME/config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"userOverride"
],
"title": "UserOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "UserOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Path to a .codex/ folder within a project. There could be multiple of these between `cwd` and the project/repo root.",
"properties": {
@@ -3886,6 +3928,27 @@
"title": "ProjectConfigLayerSource",
"type": "object"
},
{
"description": "Project override layer from a sibling `.codex/config.override.toml`.",
"properties": {
"dotCodexFolder": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"projectOverride"
],
"title": "ProjectOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"dotCodexFolder",
"type"
],
"title": "ProjectOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Session-layer overrides supplied via `-c`/`--config`.",
"properties": {
@@ -3980,6 +4043,12 @@
"$ref": "#/definitions/ConfigLayerMetadata"
},
"type": "object"
},
"userConfigVersion": {
"type": [
"string",
"null"
]
}
},
"required": [
@@ -511,6 +511,27 @@
"title": "SystemConfigLayerSource",
"type": "object"
},
{
"description": "System override layer from a sibling `config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"systemOverride"
],
"title": "SystemOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "SystemOverrideConfigLayerSource",
"type": "object"
},
{
"description": "User config layer from $CODEX_HOME/config.toml. This layer is special in that it is expected to be: - writable by the user - generally outside the workspace directory",
"properties": {
@@ -544,6 +565,27 @@
"title": "UserConfigLayerSource",
"type": "object"
},
{
"description": "User override layer from `$CODEX_HOME/config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"userOverride"
],
"title": "UserOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "UserOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Path to a .codex/ folder within a project. There could be multiple of these between `cwd` and the project/repo root.",
"properties": {
@@ -565,6 +607,27 @@
"title": "ProjectConfigLayerSource",
"type": "object"
},
{
"description": "Project override layer from a sibling `.codex/config.override.toml`.",
"properties": {
"dotCodexFolder": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"projectOverride"
],
"title": "ProjectOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"dotCodexFolder",
"type"
],
"title": "ProjectOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Session-layer overrides supplied via `-c`/`--config`.",
"properties": {
@@ -931,6 +994,12 @@
"$ref": "#/definitions/ConfigLayerMetadata"
},
"type": "object"
},
"userConfigVersion": {
"type": [
"string",
"null"
]
}
},
"required": [
@@ -73,6 +73,27 @@
"title": "SystemConfigLayerSource",
"type": "object"
},
{
"description": "System override layer from a sibling `config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"systemOverride"
],
"title": "SystemOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "SystemOverrideConfigLayerSource",
"type": "object"
},
{
"description": "User config layer from $CODEX_HOME/config.toml. This layer is special in that it is expected to be: - writable by the user - generally outside the workspace directory",
"properties": {
@@ -106,6 +127,27 @@
"title": "UserConfigLayerSource",
"type": "object"
},
{
"description": "User override layer from `$CODEX_HOME/config.override.toml`.",
"properties": {
"file": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"userOverride"
],
"title": "UserOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"file",
"type"
],
"title": "UserOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Path to a .codex/ folder within a project. There could be multiple of these between `cwd` and the project/repo root.",
"properties": {
@@ -127,6 +169,27 @@
"title": "ProjectConfigLayerSource",
"type": "object"
},
{
"description": "Project override layer from a sibling `.codex/config.override.toml`.",
"properties": {
"dotCodexFolder": {
"$ref": "#/definitions/AbsolutePathBuf"
},
"type": {
"enum": [
"projectOverride"
],
"title": "ProjectOverrideConfigLayerSourceType",
"type": "string"
}
},
"required": [
"dotCodexFolder",
"type"
],
"title": "ProjectOverrideConfigLayerSource",
"type": "object"
},
{
"description": "Session-layer overrides supplied via `-c`/`--config`.",
"properties": {
@@ -8,7 +8,7 @@ export type ConfigLayerSource = { "type": "mdm", domain: string, key: string, }
* This is the path to the system config.toml file, though it is not
* guaranteed to exist.
*/
file: AbsolutePathBuf, } | { "type": "user",
file: AbsolutePathBuf, } | { "type": "systemOverride", file: AbsolutePathBuf, } | { "type": "user",
/**
* This is the path to the user's config.toml file, though it is not
* guaranteed to exist.
@@ -18,4 +18,4 @@ file: AbsolutePathBuf,
* Name of the selected profile-v2 config layered on top of the base
* user config, when this layer represents one.
*/
profile: string | null, } | { "type": "project", dotCodexFolder: AbsolutePathBuf, } | { "type": "sessionFlags" } | { "type": "legacyManagedConfigTomlFromFile", file: AbsolutePathBuf, } | { "type": "legacyManagedConfigTomlFromMdm" };
profile: string | null, } | { "type": "userOverride", file: AbsolutePathBuf, } | { "type": "project", dotCodexFolder: AbsolutePathBuf, } | { "type": "projectOverride", dotCodexFolder: AbsolutePathBuf, } | { "type": "sessionFlags" } | { "type": "legacyManagedConfigTomlFromFile", file: AbsolutePathBuf, } | { "type": "legacyManagedConfigTomlFromMdm" };
@@ -5,4 +5,4 @@ import type { Config } from "./Config";
import type { ConfigLayer } from "./ConfigLayer";
import type { ConfigLayerMetadata } from "./ConfigLayerMetadata";
export type ConfigReadResponse = { config: Config, origins: { [key in string]?: ConfigLayerMetadata }, layers: Array<ConfigLayer> | null, };
export type ConfigReadResponse = { config: Config, origins: { [key in string]?: ConfigLayerMetadata }, userConfigVersion: string | null, layers: Array<ConfigLayer> | null, };