mirror of
https://github.com/openai/codex.git
synced 2026-04-26 23:55:25 +00:00
Adding a `--experimental` flag to the `generate-ts` fct in the app-sever. It can be called through one of those 2 command ``` just write-app-server-schema --experimental codex app-server generate-ts --experimental ```
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
use anyhow::Context;
|
|
use anyhow::Result;
|
|
use clap::Parser;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[command(about = "Regenerate vendored app-server schema fixtures")]
|
|
struct Args {
|
|
/// Root directory containing `typescript/` and `json/`.
|
|
#[arg(long = "schema-root", value_name = "DIR")]
|
|
schema_root: Option<PathBuf>,
|
|
|
|
/// Optional path to the Prettier executable 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 fixtures.
|
|
#[arg(long = "experimental")]
|
|
experimental: bool,
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
let args = Args::parse();
|
|
|
|
let schema_root = args
|
|
.schema_root
|
|
.unwrap_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("schema"));
|
|
|
|
codex_app_server_protocol::write_schema_fixtures_with_options(
|
|
&schema_root,
|
|
args.prettier.as_deref(),
|
|
codex_app_server_protocol::SchemaFixtureOptions {
|
|
experimental_api: args.experimental,
|
|
},
|
|
)
|
|
.with_context(|| {
|
|
format!(
|
|
"failed to regenerate schema fixtures under {}",
|
|
schema_root.display()
|
|
)
|
|
})
|
|
}
|