Introduces support for slash commands like in the TypeScript CLI. We do not support the full set of commands yet, but the core abstraction is there now. In particular, we have a `SlashCommand` enum and due to thoughtful use of the [strum](https://crates.io/crates/strum) crate, it requires minimal boilerplate to add a new command to the list. The key new piece of UI is `CommandPopup`, though the keyboard events are still handled by `ChatComposer`. The behavior is roughly as follows: * if the first character in the composer is `/`, the command popup is displayed (if you really want to send a message to Codex that starts with a `/`, simply put a space before the `/`) * while the popup is displayed, up/down can be used to change the selection of the popup * if there is a selection, hitting tab completes the command, but does not send it * if there is a selection, hitting enter sends the command * if the prefix of the composer matches a command, the command will be visible in the popup so the user can see the description (commands could take arguments, so additional text may appear after the command name itself) https://github.com/user-attachments/assets/39c3e6ee-eeb7-4ef7-a911-466d8184975f Incidentally, Codex wrote almost all the code for this PR!
48 lines
1.1 KiB
TOML
48 lines
1.1 KiB
TOML
[package]
|
|
name = "codex-tui"
|
|
version = { workspace = true }
|
|
edition = "2024"
|
|
|
|
[[bin]]
|
|
name = "codex-tui"
|
|
path = "src/main.rs"
|
|
|
|
[lib]
|
|
name = "codex_tui"
|
|
path = "src/lib.rs"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
clap = { version = "4", features = ["derive"] }
|
|
codex-ansi-escape = { path = "../ansi-escape" }
|
|
codex-core = { path = "../core" }
|
|
codex-common = { path = "../common", features = ["cli", "elapsed"] }
|
|
color-eyre = "0.6.3"
|
|
crossterm = { version = "0.28.1", features = ["bracketed-paste"] }
|
|
mcp-types = { path = "../mcp-types" }
|
|
ratatui = { version = "0.29.0", features = [
|
|
"unstable-widget-ref",
|
|
"unstable-rendered-line-info",
|
|
] }
|
|
serde_json = "1"
|
|
shlex = "1.3.0"
|
|
strum = "0.27.1"
|
|
strum_macros = "0.27.1"
|
|
tokio = { version = "1", features = [
|
|
"io-std",
|
|
"macros",
|
|
"process",
|
|
"rt-multi-thread",
|
|
"signal",
|
|
] }
|
|
tracing = { version = "0.1.41", features = ["log"] }
|
|
tracing-appender = "0.2.3"
|
|
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
|
tui-input = "0.11.1"
|
|
tui-markdown = "0.3.3"
|
|
tui-textarea = "0.7.0"
|
|
uuid = { version = "1" }
|