Move the config schema generator into a dedicated crate (#41915)

## What changed

- Add the `codex-config-schema` workspace and Bazel crate for the
  `codex-write-config-schema` binary.
- Preserve `codex-rs/core/config.schema.json` as the default output location.
- Update `just write-config-schema` to run the new crate and remove the schema
  generator's `clap` dependency and binary target from `codex-core`.

GitOrigin-RevId: 7447f97d6e44d1077b16d2d850f8a8add9117ea6
This commit is contained in:
Tamir Duberstein
2026-08-31 21:27:51 +00:00
committed by copyberry
parent 17e8101699
commit 9a4b78579a
7 changed files with 39 additions and 10 deletions
+9 -1
View File
@@ -2703,6 +2703,15 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "codex-config-schema"
version = "0.0.0"
dependencies = [
"anyhow",
"clap",
"codex-config",
]
[[package]]
name = "codex-connectors"
version = "0.0.0"
@@ -2759,7 +2768,6 @@ dependencies = [
"base64 0.22.1",
"bm25",
"chrono",
"clap",
"codex-agent-graph-store",
"codex-agent-roles",
"codex-analytics",
+1
View File
@@ -36,6 +36,7 @@ members = [
"collaboration-mode-templates",
"connectors",
"config",
"config-schema",
"context-fragments",
"shell-command",
"shell-escalation",
+6
View File
@@ -0,0 +1,6 @@
load("//:defs.bzl", "codex_rust_crate")
codex_rust_crate(
name = "config-schema",
crate_name = "codex_config_schema",
)
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "codex-config-schema"
version.workspace = true
edition.workspace = true
license.workspace = true
[[bin]]
name = "codex-write-config-schema"
path = "src/main.rs"
[lints]
workspace = true
[dependencies]
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
codex-config = { workspace = true }
@@ -1,3 +1,5 @@
//! Generates the canonical config schema fixture for development and releases.
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;
@@ -12,9 +14,9 @@ struct Args {
fn main() -> Result<()> {
let args = Args::parse();
let out_path = args
.out
.unwrap_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("config.schema.json"));
let out_path = args.out.unwrap_or_else(|| {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../core/config.schema.json")
});
codex_config::schema::write_config_schema(&out_path)?;
Ok(())
}
-5
View File
@@ -8,10 +8,6 @@ version.workspace = true
name = "codex_core"
path = "src/lib.rs"
[[bin]]
name = "codex-write-config-schema"
path = "src/bin/config_schema.rs"
[lints]
workspace = true
@@ -22,7 +18,6 @@ async-channel = { workspace = true }
base64 = { workspace = true }
bm25 = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
clap = { workspace = true, features = ["derive"] }
codex-analytics = { workspace = true }
codex-agent-graph-store = { workspace = true }
codex-agent-roles = { workspace = true }
+1 -1
View File
@@ -175,7 +175,7 @@ mcp-server-run *args:
# Regenerate the json schema for config.toml from the current config types.
write-config-schema:
cargo run -p codex-core --bin codex-write-config-schema
cargo run -p codex-config-schema --bin codex-write-config-schema
# Regenerate vendored app-server protocol schema artifacts.
write-app-server-schema *args: