|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Guidance for AI coding agents in this repo. Human contributors: see [CONTRIBUTING.md](./CONTRIBUTING.md). |
| 4 | + |
| 5 | +## Workflow |
| 6 | + |
| 7 | +- Clarify the design before implementing. For anything non-trivial, agree on the approach first; |
| 8 | + prefer a short design note over jumping to code. |
| 9 | +- One unit of change per commit. Never mix unrelated changes. Present the change for review |
| 10 | + before committing. |
| 11 | +- Every change ships with tests. Run local CI before calling it done, and do not claim it passes |
| 12 | + without running it. |
| 13 | +- Verify against the code and the tools: read before you answer, run before you assert. |
| 14 | + |
| 15 | +Local CI: |
| 16 | + |
| 17 | +```shell |
| 18 | +cargo fmt --all --check |
| 19 | +cargo clippy --all-targets --all-features --locked -- -D warnings |
| 20 | +cargo test --all-features |
| 21 | +``` |
| 22 | + |
| 23 | +## Writing: code, comments, docs, commits |
| 24 | + |
| 25 | +- Concise and to the point. No fluff. Explain the non-obvious; do not narrate the obvious. |
| 26 | +- ASCII only. No em-dash and no `--`; write `-`. Use `->` not the arrow glyph, `!=` not the |
| 27 | + not-equal glyph, and so on. |
| 28 | +- Comments justify *why*, not *what*. Delete any comment that restates the code. |
| 29 | +- Do not use the word "seam"; say boundary, interface, or extension point. |
| 30 | +- Do not use "bespoke"; say "custom". |
| 31 | + |
| 32 | +## Commits |
| 33 | + |
| 34 | +- Conventional Commits (see CONTRIBUTING.md). Write the subject in the present tense, imperative |
| 35 | + voice: `feat: add fetch TTL`, not `added` or `adds`. |
| 36 | +- Disclose AI with an `Assisted-by: Claude:claude-opus-4-8` trailer. Never `Co-Authored-By`, and |
| 37 | + never add a human's `Signed-off-by`. |
| 38 | + |
| 39 | +## Tests |
| 40 | + |
| 41 | +- Unit tests inline (`#[cfg(test)] mod tests`); public-surface tests in `tests/`. |
| 42 | +- Put helpers *after* the tests that use them. |
| 43 | +- Prefer deterministic time: drive tokio's paused clock, not sleeps or `yield_now` loops. |
| 44 | + |
| 45 | +## Terminology |
| 46 | + |
| 47 | +- **upstream**: the origin git server the proxy fetches from. The proxy holds a single |
| 48 | + read-only credential for it and never writes to it. |
| 49 | +- **mirror**: the local bare repository (`clone --mirror`) the proxy serves clients from and |
| 50 | + keeps fresh with incremental fetches. |
| 51 | +- **serve**: responding to a client's `info/refs` / `git-upload-pack` from the mirror. |
| 52 | +- git-cache-proxy is strictly read-only and pull-only. Any change that could push or |
| 53 | + proactively replicate to upstream is out of scope. |
| 54 | + |
| 55 | +## Code conventions |
| 56 | + |
| 57 | +- All git protocol work is delegated to the system `git` binary. Do not reimplement pack |
| 58 | + negotiation; shell out to `git` so protocol correctness (v2, shallow, partial clones) is free. |
| 59 | +- Import a type by one path and use it consistently (e.g. a single `use std::sync::Arc`, not |
| 60 | + mixed inline `std::sync::Arc` paths). |
| 61 | +- Prefer `tokio::fs` in async paths unless `std::fs` is clearly fine (small, at startup, no |
| 62 | + blocking concern). |
| 63 | +- Document public items with rustdoc; keep it accurate and free of drift. |
| 64 | + |
| 65 | +## CI workflows |
| 66 | + |
| 67 | +- GitHub Actions live in `.github/workflows`. Write the workflow `name:`, every job name, and |
| 68 | + every named step in Sentence case, matching `ci.yml` (e.g. `name: CI`, `Check formatting`). |
| 69 | +- Keep workflows minimal and scoped to one purpose; prefer the built-in `GITHUB_TOKEN` over a |
| 70 | + personal access token. |
0 commit comments