Conventions that require human judgment during review. Lint-enforced rules
(see Cargo.toml [lints] and lib.rs deny attributes) are omitted here.
- Place all
useimports at the top of the file or module — never inside function bodies. For test modules, place imports at the top of themod testsblock. - Do not use
pub(super). Usepub(crate)orpubinstead. - Prefer the narrowest visibility that compiles — plain
fnoverpub(crate)when the function is only used within its own module. - Use
anyhow::Resultwith.context("…")so the error chain shown to users viaError: {err:#}stays informative. --format jsonmust produce valid JSON. Never mix human-readable text (hints, update notices) into JSON output — guard behind a format check.- New commands that accept a
repopositional should make it optional and fall back to inferringowner/repofrom the git or jj remote (seesrc/utils/vcs.rs).
- API types come from OpenAPI codegen (progenitor). Do not hand-write types that
duplicate generated ones.
src/api/types.rsshould only contain re-exports, type aliases, and trait impls on generated types. - Update
openapi.jsonviacargo xtask generate-openapiand help docs viacargo xtask generate-help > docs/HELP.md. Do not edit these by hand.
- All writes to
config.tomlmust go throughupdate_config(|c| …), which holds a file lock and preserves user comments and unknown keys. - When a config field is set to
None, remove the key from disk.
- Follow conventional commits:
type(scope): description. - Common types:
feat,fix,refactor,chore,test,lint,docs,ci,style.