mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Add codex app-server --stdio alias (#24940)
## Summary - Add `--stdio` as a direct alias for `codex app-server --listen stdio://`. - Keep `--stdio` and `--listen` mutually exclusive. - Update the app-server README to document both forms.
This commit is contained in:
@@ -452,6 +452,10 @@ struct AppServerCommand {
|
||||
)]
|
||||
listen: codex_app_server::AppServerTransport,
|
||||
|
||||
/// Use stdio as the transport (equivalent to `--listen stdio://`).
|
||||
#[arg(long = "stdio", conflicts_with = "listen")]
|
||||
stdio: bool,
|
||||
|
||||
/// Enable remote control for this app-server process.
|
||||
#[arg(long = "remote-control", hide = true)]
|
||||
remote_control: bool,
|
||||
@@ -965,6 +969,7 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
|
||||
subcommand,
|
||||
strict_config: app_server_strict_config,
|
||||
listen,
|
||||
stdio,
|
||||
remote_control,
|
||||
analytics_default_enabled,
|
||||
auth,
|
||||
@@ -978,7 +983,11 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
|
||||
)?;
|
||||
match subcommand {
|
||||
None => {
|
||||
let transport = listen;
|
||||
let transport = if stdio {
|
||||
codex_app_server::AppServerTransport::Stdio
|
||||
} else {
|
||||
listen
|
||||
};
|
||||
let auth = auth.try_into_settings()?;
|
||||
let runtime_options = codex_app_server::AppServerRuntimeOptions {
|
||||
remote_control_enabled: remote_control,
|
||||
@@ -3197,6 +3206,25 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn app_server_stdio_flag_parses() {
|
||||
let app_server = app_server_from_args(["codex", "app-server", "--stdio"].as_ref());
|
||||
assert!(app_server.stdio);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn app_server_stdio_flag_conflicts_with_listen() {
|
||||
let err = MultitoolCli::try_parse_from([
|
||||
"codex",
|
||||
"app-server",
|
||||
"--stdio",
|
||||
"--listen",
|
||||
"stdio://",
|
||||
])
|
||||
.expect_err("--stdio and --listen should be rejected together");
|
||||
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn app_server_listen_unix_socket_url_parses() {
|
||||
let app_server =
|
||||
|
||||
Reference in New Issue
Block a user