Files
OmniRoute/src/shared/utils/codexConfig.ts
Diego Rodrigues de Sa e Souza d0396c200d Release v3.8.31 (#4377)
Release v3.8.31 — see CHANGELOG.md [3.8.31] for full notes and contributors.

Merged over known non-blocking reds (all correctness gates green): Integration Tests (2/2) is env/flaky (polls a real upstream batch that did not complete in the poll window); SonarQube/SonarCloud is the advisory server-side new-code quality gate. Unit (8 shards), Coverage, Node 22/24/26, Lint, PR Test Policy, Quality Ratchet, Docs-Strict, Quality-Extended and all 4 CodeQL analyses are green.
2026-06-20 14:55:24 -03:00

31 lines
1.2 KiB
TypeScript

/**
* Helpers for generating/maintaining the Codex CLI `config.toml`.
*/
interface ParsedCodexToml {
_root: Record<string, unknown>;
_sections: Record<string, Record<string, unknown>>;
}
/**
* Migrate the deprecated Codex `[features].codex_hooks` flag to `[features].hooks`.
*
* Codex renamed the feature flag; recent Codex CLI versions ignore the old key and
* print a deprecation notice. When OmniRoute rewrites an existing `config.toml` it
* should carry the user's intent forward by renaming the key (preserving its value)
* and dropping the deprecated one. A no-op when `[features]` or `codex_hooks` is
* absent, and it never clobbers an already-present `hooks` value. (#1327)
*
* Operates in place on the route's parsed-TOML shape (`{ _root, _sections }`).
*/
export function migrateCodexFeatureFlags(parsed: ParsedCodexToml): ParsedCodexToml {
const features = parsed?._sections?.features;
if (!features || typeof features !== "object") return parsed;
if (!Object.prototype.hasOwnProperty.call(features, "codex_hooks")) return parsed;
if (!Object.prototype.hasOwnProperty.call(features, "hooks")) {
features.hooks = features.codex_hooks;
}
delete features.codex_hooks;
return parsed;
}