2.2 KiB
+++ id = "35" title = "TUI Integration for Inspect-Env Command" status = "Done" dependencies = "10" # Rationale: depends on Task 10 for container state inspection last_updated = "2025-06-25T11:38:19Z" +++
This task is specific to codex-rs.
Status
General Status: Done
Summary: Follow-up to Task 10; add slash-command and TUI bindings for inspect-env.
Goal
Add an /inspect-env slash-command in the TUI that invokes the existing codex inspect-env logic to display sandbox state inline.
Acceptance Criteria
- Extend
SlashCommandenum to includeInspectEnv. - Dispatch
AppEvent::InlineInspectEnvwhen/inspect-envis entered. - Handle
InlineInspectEnvinapp.rsto runinspect-envlogic and stream its output to the TUI log pane. - Render mounts, permissions, and network status in a formatted table or tree view in the bottom pane.
- Unit/integration tests simulating slash-command invocation and verifying rendered output.
Implementation
High-level approach
- Extend
SlashCommandenum withInspectEnvand provide user-visible description. - Add
InlineInspectEnvvariant toAppEventenum to represent inline slash-command invocation. - Update dispatch logic in
App::runto spawn a background thread onInlineInspectEnvthat runscodex inspect-env, reads its stdout line-by-line, and sends each line asAppEvent::LatestLog, then triggers a redraw. - Wire up
/inspect-envto dispatchInlineInspectEnvin the slash-command handling. - Add unit tests in the TUI crate to verify
built_in_slash_commands()includesinspect-envmapping and description, and tests for the command-popup filter to ensureInspectEnvis listed when/inspect-envis entered.
How it works
When the user enters /inspect-env, the TUI parser recognizes the command and emits AppEvent::InlineInspectEnv. The main event loop handles this event by spawning a thread that invokes the external codex inspect-env command, captures its output line-by-line, and forwards each line into the TUI log pane via AppEvent::LatestLog. A redraw is scheduled once the inspection completes.
Notes
- Reuse formatting code from
cli/src/inspect_env.rsfor consistency.