mirror of
https://github.com/openai/codex.git
synced 2026-04-28 02:11:08 +03:00
## Why The `argument-comment-lint` entrypoints had grown into two shell wrappers with duplicated parsing, environment setup, and Cargo forwarding logic. The recent `--` separator regression was a good example of the problem: the behavior was subtle, easy to break, and hard to verify. This change rewrites those wrappers in Python so the control flow is easier to follow, the shared behavior lives in one place, and the tricky argument/defaulting paths have direct test coverage. ## What changed - replaced `tools/argument-comment-lint/run.sh` and `tools/argument-comment-lint/run-prebuilt-linter.sh` with Python entrypoints: `run.py` and `run-prebuilt-linter.py` - moved shared wrapper behavior into `tools/argument-comment-lint/wrapper_common.py`, including: - splitting lint args from forwarded Cargo args after `--` - defaulting repo runs to `--manifest-path codex-rs/Cargo.toml --workspace --no-deps` - defaulting non-`--fix` runs to `--all-targets` unless the caller explicitly narrows the target set - setting repo defaults for `DYLINT_RUSTFLAGS` and `CARGO_INCREMENTAL` - kept the prebuilt wrapper thin: it still just resolves the packaged DotSlash entrypoint, keeps `rustup` shims first on `PATH`, infers `RUSTUP_HOME` when needed, and then launches the packaged `cargo-dylint` path - updated `justfile`, `rust-ci.yml`, and `tools/argument-comment-lint/README.md` to use the Python entrypoints - updated `rust-ci` so the package job runs Python syntax checks plus the new wrapper unit tests, and the OS-specific lint jobs invoke the wrappers through an explicit Python interpreter This is a follow-up to #16054: it keeps the current lint semantics while making the wrapper logic maintainable enough to iterate on safely. ## Validation - `python3 -m py_compile tools/argument-comment-lint/wrapper_common.py tools/argument-comment-lint/run.py tools/argument-comment-lint/run-prebuilt-linter.py tools/argument-comment-lint/test_wrapper_common.py` - `python3 -m unittest discover -s tools/argument-comment-lint -p 'test_*.py'` - `python3 ./tools/argument-comment-lint/run-prebuilt-linter.py -p codex-terminal-detection -- --lib` - `python3 ./tools/argument-comment-lint/run.py -p codex-terminal-detection -- --lib`
109 lines
2.9 KiB
Makefile
109 lines
2.9 KiB
Makefile
set working-directory := "codex-rs"
|
|
set positional-arguments
|
|
|
|
# Display help
|
|
help:
|
|
just -l
|
|
|
|
# `codex`
|
|
alias c := codex
|
|
codex *args:
|
|
cargo run --bin codex -- "$@"
|
|
|
|
# `codex exec`
|
|
exec *args:
|
|
cargo run --bin codex -- exec "$@"
|
|
|
|
# Start codex-exec-server and run codex-tui.
|
|
[no-cd]
|
|
tui-with-exec-server *args:
|
|
./scripts/run_tui_with_exec_server.sh "$@"
|
|
|
|
# Run the CLI version of the file-search crate.
|
|
file-search *args:
|
|
cargo run --bin codex-file-search -- "$@"
|
|
|
|
# Build the CLI and run the app-server test client
|
|
app-server-test-client *args:
|
|
cargo build -p codex-cli
|
|
cargo run -p codex-app-server-test-client -- --codex-bin ./target/debug/codex "$@"
|
|
|
|
# format code
|
|
fmt:
|
|
cargo fmt -- --config imports_granularity=Item 2>/dev/null
|
|
|
|
fix *args:
|
|
cargo clippy --fix --tests --allow-dirty "$@"
|
|
|
|
clippy *args:
|
|
cargo clippy --tests "$@"
|
|
|
|
install:
|
|
rustup show active-toolchain
|
|
cargo fetch
|
|
|
|
# Run `cargo nextest` since it's faster than `cargo test`, though including
|
|
# --no-fail-fast is important to ensure all tests are run.
|
|
#
|
|
# Run `cargo install cargo-nextest` if you don't have it installed.
|
|
# Prefer this for routine local runs; use explicit `cargo test --all-features`
|
|
# only when you specifically need full feature coverage.
|
|
test:
|
|
cargo nextest run --no-fail-fast
|
|
|
|
# Build and run Codex from source using Bazel.
|
|
# Note we have to use the combination of `[no-cd]` and `--run_under="cd $PWD &&"`
|
|
# to ensure that Bazel runs the command in the current working directory.
|
|
[no-cd]
|
|
bazel-codex *args:
|
|
bazel run //codex-rs/cli:codex --run_under="cd $PWD &&" -- "$@"
|
|
|
|
[no-cd]
|
|
bazel-lock-update:
|
|
bazel mod deps --lockfile_mode=update
|
|
|
|
[no-cd]
|
|
bazel-lock-check:
|
|
./scripts/check-module-bazel-lock.sh
|
|
|
|
bazel-test:
|
|
bazel test //... --keep_going
|
|
|
|
bazel-clippy:
|
|
bazel build --config=clippy -- //codex-rs/... -//codex-rs/v8-poc:all
|
|
|
|
bazel-remote-test:
|
|
bazel test //... --config=remote --platforms=//:rbe --keep_going
|
|
|
|
build-for-release:
|
|
bazel build //codex-rs/cli:release_binaries --config=remote
|
|
|
|
# Run the MCP server
|
|
mcp-server-run *args:
|
|
cargo run -p codex-mcp-server -- "$@"
|
|
|
|
# Regenerate the json schema for config.toml from the current config types.
|
|
write-config-schema:
|
|
cargo run -p codex-core --bin codex-write-config-schema
|
|
|
|
# Regenerate vendored app-server protocol schema artifacts.
|
|
write-app-server-schema *args:
|
|
cargo run -p codex-app-server-protocol --bin write_schema_fixtures -- "$@"
|
|
|
|
[no-cd]
|
|
write-hooks-schema:
|
|
cargo run --manifest-path ./codex-rs/Cargo.toml -p codex-hooks --bin write_hooks_schema_fixtures
|
|
|
|
# Run the argument-comment Dylint checks across codex-rs.
|
|
[no-cd]
|
|
argument-comment-lint *args:
|
|
./tools/argument-comment-lint/run-prebuilt-linter.py "$@"
|
|
|
|
[no-cd]
|
|
argument-comment-lint-from-source *args:
|
|
./tools/argument-comment-lint/run.py "$@"
|
|
|
|
# Tail logs from the state SQLite database
|
|
log *args:
|
|
if [ "${1:-}" = "--" ]; then shift; fi; cargo run -p codex-state --bin logs_client -- "$@"
|