mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
## Summary - add an `--experimental` flag to the export binary and thread the option through TypeScript and JSON schema generation - flatten the v2 schema bundle into a datamodel-code-generator-friendly `codex_app_server_protocol.v2.schemas.json` export - retarget shared helper refs to namespaced v2 definitions, add coverage for the new export behavior, and vendor the generated schema fixtures ## Validation - `cargo test -p codex-app-server-protocol` (71 unit tests and bin targets passed locally; the final schema fixture integration target was revalidated via fresh schema regeneration and a tree diff) - `./target/debug/write_schema_fixtures --schema-root <tmpdir>` - `diff -rq app-server-protocol/schema <tmpdir>` ## Tickets - None
35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use anyhow::Result;
|
|
use clap::Parser;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[command(
|
|
about = "Generate TypeScript bindings and JSON Schemas for the Codex app-server protocol"
|
|
)]
|
|
struct Args {
|
|
/// Output directory where generated files will be written
|
|
#[arg(short = 'o', long = "out", value_name = "DIR")]
|
|
out_dir: PathBuf,
|
|
|
|
/// Optional Prettier executable path to format generated TypeScript files
|
|
#[arg(short = 'p', long = "prettier", value_name = "PRETTIER_BIN")]
|
|
prettier: Option<PathBuf>,
|
|
|
|
/// Include experimental API methods and fields in generated output.
|
|
#[arg(long = "experimental")]
|
|
experimental: bool,
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
let args = Args::parse();
|
|
codex_app_server_protocol::generate_ts_with_options(
|
|
&args.out_dir,
|
|
args.prettier.as_deref(),
|
|
codex_app_server_protocol::GenerateTsOptions {
|
|
experimental_api: args.experimental,
|
|
..codex_app_server_protocol::GenerateTsOptions::default()
|
|
},
|
|
)?;
|
|
codex_app_server_protocol::generate_json_with_experimental(&args.out_dir, args.experimental)
|
|
}
|