Skip to content

Conversation

bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented May 7, 2025

I started this PR because I wanted to share the format_duration() utility function in codex-rs/exec/src/event_processor.rs with the TUI. The question was: where to put it?

core should have as few dependencies as possible, so moving it there would introduce a dependency on chrono, which seemed undesirable. core already had this cli feature to deal with a similar situation around sharing common utility functions, so I decided to:

  • make core feature-free
  • introduce common
  • common can have as many "special interest" features as it needs, each of which can declare their own deps
  • the first two features of common are cli and elapsed

In practice, this meant updating a number of Cargo.toml files, replacing this line:

codex-core = { path = "../core", features = ["cli"] }

with these:

codex-core = { path = "../core" }
codex-common = { path = "../common", features = ["cli"] }

Moving format_duration() into its own file gave it some "breathing room" to add a unit test, so I had Codex generate some tests and new support for durations over 1 minute.

@bolinfest bolinfest force-pushed the pr843 branch 4 times, most recently from 6da5631 to 51facd7 Compare May 7, 2025 00:33
@bolinfest bolinfest merged commit c577e94 into main May 7, 2025
8 checks passed
@bolinfest bolinfest deleted the pr843 branch May 7, 2025 00:38
@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant