diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..618207f30 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Cargo launch", + "cargo": { + "cwd": "${workspaceFolder}/codex-rs", + "args": [ + "build", + "--bin=codex-tui" + ] + }, + "args": [] + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..f66a12583 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "rust-analyzer.checkOnSave": true, + "rust-analyzer.check.command": "clippy", + "rust-analyzer.check.extraArgs": ["--all-features", "--tests"], + "rust-analyzer.rustfmt.extraArgs": ["--config", "imports_granularity=Item"], + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer", + "editor.formatOnSave": true, + } +} diff --git a/AGENTS.md b/AGENTS.md index 1348e5782..4188cc987 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,3 +3,7 @@ In the codex-rs folder where the rust code lives: - Never add or modify any code related to `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR`. You operate in a sandbox where `CODEX_SANDBOX_NETWORK_DISABLED=1` will be set whenever you use the `shell` tool. Any existing code that uses `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR` was authored with this fact in mind. It is often used to early exit out of tests that the author knew you would not be able to run given your sandbox limitations. + +After making changes to the rust code run `just fmt` (in `codex-rs` directory) to format the code and `just fix` (in `codex-rs` directory) to fix any linter issues in the code. + +Ensure the test suite passes by running `cargo test --all-features` in the `codex-rs` directory. diff --git a/codex-rs/justfile b/codex-rs/justfile index 83a390ec5..6c8e9f9e4 100644 --- a/codex-rs/justfile +++ b/codex-rs/justfile @@ -23,3 +23,9 @@ file-search *args: # format code fmt: cargo fmt -- --config imports_granularity=Item + +fix: + cargo clippy --fix --all-features --tests --allow-dirty + +install: + cargo fetch diff --git a/codex-rs/toolchain.toml b/codex-rs/toolchain.toml new file mode 100644 index 000000000..72bafdf4b --- /dev/null +++ b/codex-rs/toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.88.0" +components = [ "clippy", "rustfmt", "rust-src"] diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 883250400..ac69bef2e 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -60,7 +60,7 @@ struct ChatWidgetArgs { initial_images: Vec, } -impl<'a> App<'a> { +impl App<'_> { pub(crate) fn new( config: Config, initial_prompt: Option, diff --git a/codex-rs/tui/src/bottom_pane/status_indicator_view.rs b/codex-rs/tui/src/bottom_pane/status_indicator_view.rs index d9ac57d7b..de46ac270 100644 --- a/codex-rs/tui/src/bottom_pane/status_indicator_view.rs +++ b/codex-rs/tui/src/bottom_pane/status_indicator_view.rs @@ -24,7 +24,7 @@ impl StatusIndicatorView { } } -impl<'a> BottomPaneView<'a> for StatusIndicatorView { +impl BottomPaneView<'_> for StatusIndicatorView { fn update_status_text(&mut self, text: String) -> ConditionalUpdate { self.update_text(text); ConditionalUpdate::NeedsRedraw