Skip to content

Commit 2129230

Browse files
committed
feat: code review action
1 parent 758d3eb commit 2129230

3 files changed

Lines changed: 676 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Codex Autonomous Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
review:
13+
name: Run Codex review
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout PR
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install codex from PyPI (system Python)
22+
run: |
23+
python3 -m pip install --upgrade pip
24+
python3 -m pip install --upgrade codex-python
25+
26+
- name: Run Codex autonomous code review
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
30+
CODEX_MODEL: gpt-5
31+
CODEX_REASONING_EFFORT: medium
32+
run: |
33+
python3 scripts/codex_autoreview.py

AGENTS.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- `codex/` – Python package (public API in `__init__.py`, config, client, protocol models).
5+
- `crates/codex_native/` – PyO3 native extension built with maturin (pinned upstream deps).
6+
- `tests/``pytest` tests (`test_*.py`).
7+
- `scripts/` – codegen helpers (e.g., `generate_protocol_py.py`).
8+
- `.generated/ts/` – transient TypeScript protocol types. Do not commit hand edits.
9+
- Generated file: `codex/protocol/types.py` – do not edit; run `make gen-protocol`.
10+
11+
## Build, Test, and Development Commands
12+
- Create venv: `make venv` then `. .venv/bin/activate`.
13+
- Format: `make fmt` (ruff format).
14+
- Lint: `make lint` (ruff check --fix + mypy).
15+
- Test: `make test` (pytest; skips if no native ext).
16+
- Build sdist/wheel: `make build` (uv build).
17+
- Native dev install: `make dev-native` (maturin develop or build+pip install).
18+
- Generate protocol: `make gen-protocol` (TS → Pydantic models).
19+
- Prebuild Linux wheels: `make wheelhouse-linux` (manylinux/musllinux via Docker).
20+
21+
## Coding Style & Naming Conventions
22+
- Python 3.12+; type hints required. Line length target: 100.
23+
- Run `make fmt && make lint` before commits.
24+
- Ruff rules: `E,F,I,B,UP` (imports sorted). Mypy: strict-ish (no untyped defs).
25+
- Naming: modules `snake_case.py`, classes `PascalCase`, functions/vars `snake_case`.
26+
- Pydantic v2: prefer `BaseModel`; place `model_config = ConfigDict(extra='allow')` at class end.
27+
28+
## Testing Guidelines
29+
- Framework: `pytest`. Test files: `tests/test_*.py`.
30+
- Write fast, deterministic tests; mock external I/O. Native-dependent tests already skip when the extension is unavailable.
31+
- Example: `uv run --group dev pytest -q` (or `make test`).
32+
33+
## Commit & Pull Request Guidelines
34+
- Use Conventional Commits (e.g., `feat:`, `fix:`, `ci:`, `chore:`). Keep subject ≤72 chars.
35+
- PRs should include: clear description, linked issues, tests (or rationale), and docs/`CHANGELOG.md` updates when user‑visible.
36+
- Keep diffs focused; avoid touching generated files.
37+
38+
## Security & Configuration Tips
39+
- Respect sandbox defaults; avoid introducing commands that assume unrestricted host access.
40+
- Publishing uses UV/PyPI tokens: `UV_PUBLISH_TOKEN` or `PYPI_API_TOKEN` (see `make publish`).
41+
- For local previews, you may set `CODEX_HOME` to a temp dir to isolate state.

0 commit comments

Comments
 (0)