From 337164738ab5ee2280f17f7628c2e2e69ae22631 Mon Sep 17 00:00:00 2001 From: Ryan Ragona Date: Sat, 26 Apr 2025 14:25:35 -0700 Subject: [PATCH] fmt --- codex-rs/core/src/approval_mode_cli_arg.rs | 3 ++- codex-rs/exec/src/cli.rs | 3 ++- codex-rs/interactive/src/cli.rs | 3 ++- codex-rs/repl/src/cli.rs | 3 ++- codex-rs/session/build.rs | 1 - codex-rs/session/src/build.rs | 1 - codex-rs/session/src/cli.rs | 11 ++++++----- codex-rs/session/src/lib.rs | 6 +++--- codex-rs/session/src/meta.rs | 7 ++++--- codex-rs/session/src/store.rs | 3 ++- codex-rs/session/tests/meta_round_trip.rs | 4 ++-- 11 files changed, 25 insertions(+), 20 deletions(-) diff --git a/codex-rs/core/src/approval_mode_cli_arg.rs b/codex-rs/core/src/approval_mode_cli_arg.rs index 7c31912c1e..55c092541d 100644 --- a/codex-rs/core/src/approval_mode_cli_arg.rs +++ b/codex-rs/core/src/approval_mode_cli_arg.rs @@ -5,7 +5,8 @@ use clap::ValueEnum; use crate::protocol::AskForApproval; use crate::protocol::SandboxPolicy; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; #[derive(Clone, Debug, ValueEnum, Serialize, Deserialize)] #[value(rename_all = "kebab-case")] diff --git a/codex-rs/exec/src/cli.rs b/codex-rs/exec/src/cli.rs index f628f67d47..d7f6547488 100644 --- a/codex-rs/exec/src/cli.rs +++ b/codex-rs/exec/src/cli.rs @@ -1,5 +1,6 @@ use clap::Parser; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::path::PathBuf; /// Command-line interface for the non-interactive `codex-exec` agent. diff --git a/codex-rs/interactive/src/cli.rs b/codex-rs/interactive/src/cli.rs index 3e17cca463..a090f8f700 100644 --- a/codex-rs/interactive/src/cli.rs +++ b/codex-rs/interactive/src/cli.rs @@ -1,7 +1,8 @@ use clap::Parser; use codex_core::ApprovalModeCliArg; use codex_core::SandboxModeCliArg; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::path::PathBuf; #[derive(Parser, Debug, Clone, Serialize, Deserialize)] diff --git a/codex-rs/repl/src/cli.rs b/codex-rs/repl/src/cli.rs index a86b1f4628..ccb610493b 100644 --- a/codex-rs/repl/src/cli.rs +++ b/codex-rs/repl/src/cli.rs @@ -2,7 +2,8 @@ use clap::ArgAction; use clap::Parser; use codex_core::ApprovalModeCliArg; use codex_core::SandboxModeCliArg; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::path::PathBuf; /// Command‑line arguments. diff --git a/codex-rs/session/build.rs b/codex-rs/session/build.rs index 8dd08f7647..16da936201 100644 --- a/codex-rs/session/build.rs +++ b/codex-rs/session/build.rs @@ -16,4 +16,3 @@ fn main() { println!("cargo:rustc-env=GIT_SHA={git_sha}"); } - diff --git a/codex-rs/session/src/build.rs b/codex-rs/session/src/build.rs index f2ec2eb089..edcff408d0 100644 --- a/codex-rs/session/src/build.rs +++ b/codex-rs/session/src/build.rs @@ -7,4 +7,3 @@ pub fn git_sha() -> &'static str { env!("GIT_SHA") } - diff --git a/codex-rs/session/src/cli.rs b/codex-rs/session/src/cli.rs index dacc3fbc81..89a1e4cf29 100644 --- a/codex-rs/session/src/cli.rs +++ b/codex-rs/session/src/cli.rs @@ -8,7 +8,8 @@ //! The `create` command therefore has mutually exclusive sub-commands so the appropriate //! arguments can be forwarded to the underlying agent binaries. -use crate::meta::{AgentCli, SessionMeta}; +use crate::meta::AgentCli; +use crate::meta::SessionMeta; use crate::spawn; use crate::store; use anyhow::Context; @@ -146,10 +147,10 @@ impl CreateCmd { // Capture the child PID *and* the full CLI config so we can persist it // in the metadata file. let spawn_result: Result<( - u32, // pid - Option, // prompt preview - store::SessionKind, // kind - AgentCli, // full CLI config + u32, // pid + Option, // prompt preview + store::SessionKind, // kind + AgentCli, // full CLI config )> = (|| match self.agent { AgentKind::Exec(cmd) => { let args = build_exec_args(&cmd.exec_cli); diff --git a/codex-rs/session/src/lib.rs b/codex-rs/session/src/lib.rs index 5456d5a3b4..027da4aedd 100644 --- a/codex-rs/session/src/lib.rs +++ b/codex-rs/session/src/lib.rs @@ -5,11 +5,11 @@ //! This library is thin: it only re-exports the clap CLI and helpers so //! the binary can stay small and unit tests can call into pure Rust APIs. +pub mod build; pub mod cli; // public so main.rs can access it. -mod spawn; // process creation helpers -pub mod store; // on-disk bookkeeping (public for tests) pub mod meta; // richer on-disk metadata envelope -pub mod build; // build-time information helpers +mod spawn; // process creation helpers +pub mod store; // on-disk bookkeeping (public for tests) // build-time information helpers pub use cli::Cli; diff --git a/codex-rs/session/src/meta.rs b/codex-rs/session/src/meta.rs index 28f3018ecb..88ac72bcbc 100644 --- a/codex-rs/session/src/meta.rs +++ b/codex-rs/session/src/meta.rs @@ -6,8 +6,10 @@ //! bits of contextual information (like the git commit of the build) makes //! debugging and reproducibility significantly easier. -use chrono::{DateTime, Utc}; -use serde::{Deserialize, Serialize}; +use chrono::DateTime; +use chrono::Utc; +use serde::Deserialize; +use serde::Serialize; use crate::store::SessionKind; @@ -86,4 +88,3 @@ impl SessionMeta { } } } - diff --git a/codex-rs/session/src/store.rs b/codex-rs/session/src/store.rs index f225ebdb03..70d73a4e1e 100644 --- a/codex-rs/session/src/store.rs +++ b/codex-rs/session/src/store.rs @@ -10,7 +10,8 @@ use anyhow::Result; // The rich metadata envelope lives in its own module so other parts of the // crate can import it without pulling in the whole `store` implementation. use crate::meta::SessionMeta; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use std::path::PathBuf; #[derive(Clone, Debug)] diff --git a/codex-rs/session/tests/meta_round_trip.rs b/codex-rs/session/tests/meta_round_trip.rs index 18386cf6c3..25f4c8e240 100644 --- a/codex-rs/session/tests/meta_round_trip.rs +++ b/codex-rs/session/tests/meta_round_trip.rs @@ -1,7 +1,8 @@ //! Simple round-trip test that serialises a freshly constructed `SessionMeta` //! and deserialises it back to ensure the schema is self-consistent. -use codex_session::meta::{AgentCli, SessionMeta}; +use codex_session::meta::AgentCli; +use codex_session::meta::SessionMeta; use codex_session::store::SessionKind; #[test] @@ -33,4 +34,3 @@ fn meta_round_trip() { assert_eq!(de.pid, 42); assert!(matches!(de.cli, AgentCli::Exec(_))); } -