Rules for AI agents and humans working on sofka. docs/architecture.md explains
the module layout; this file is about how to change the repo without making a
mess.
- Propose new features in GitHub Discussions before opening a feature issue or pull request. Wait for a maintainer to agree on the scope before implementation.
- Before an agent starts feature work, check for a linked discussion and maintainer agreement. If either is missing, show this warning and ask for the discussion: "sofka requires a feature discussion and maintainer agreement before feature implementation. Please provide the agreed discussion before we start coding."
- If agreement is missing, help describe the problem and prepare the discussion. Do not implement the feature or open a feature issue or pull request yet.
- Link the agreed discussion in the feature issue and pull request.
- Bug reports and bug fix pull requests do not need a discussion first.
- Review generated code and run the required checks before submitting a pull request. The contributor is responsible for the submitted change.
- Never hand-align anything a formatter owns.
cargo fmtowns Rust,oxfmtowns Markdown and YAML,nixpkgs-fmtowns Nix. - Run
just hooksonce after cloning. The lefthook pre-commit hook then runs the formatters, clippy, and the tests on every commit and stages what it reformats. - Never commit with
--no-verify. If the hook rewrites a file you touched, that rewrite is correct; commit it. - Markdown tables in
docs/are re-flowed byoxfmtto fit the widest cell. Do not pad cells by hand to keep a table narrow. Shorten the text instead.
Use the Justfile; it matches CI exactly.
just check # fmt-check + clippy (-D warnings) + cargo test
just fmt # cargo fmt --all
just clippy # cargo clippy --locked --all-targets -- -D warnings
just test # cargo test --locked
just run <resource> # cargo run -- <resource> against the current kube context
just smoke # headless connectivity check (cargo run -- --check)CI runs cargo fmt --all -- --check, cargo clippy --locked --all-targets -- -D warnings,
and cargo test --locked. All three must pass before a PR is ready.
The locked checks reject dependency changes without a matching Cargo.lock
update. Regenerate the lockfile with Cargo and commit it with the manifest change.
- Rust edition 2024.
letchains andis_none_or/is_some_andare fine and already used. - Clippy runs with
-D warnings. A new warning is a build failure. - Tests live next to the code:
src/app/tests.rsfor application behaviour,mod testsat the bottom of other modules. Tests never need a cluster;Cluster::fake()provides the kind registry andapply(&mut app, json!(...))feeds objects through the same message path a watch would. - Every user-visible behaviour change gets a test that drives it through
handle_key, not by calling the internal method directly. - Things that must stay in sync:
- the
entermatch insrc/app/navigation.rsandviews::BUILTIN_DRILLS - a new key or built-in command and its rows in
docs/keys.md, the?help text insrc/ui.rs, anddocs/features.md - a new config field and
docs/configuration.md
- the
- Do not edit
Cargo.lockby hand. Renovate owns dependency bumps. - Do not add comments or doc comments to code you are not otherwise changing.
- Base branch is
main. - Conventional commits:
feat:,fix:,docs:,refactor:,test:,chore:. The subject says what changed; the body says why and what the root cause was. Do not list files in the body; the diff already does. - One logical change per PR. Docs for a feature ship in the same PR as the feature.
Closes #Nin the commit body or PR description when the change resolves an issue.
Releases are cut from a clean main with just release patch|minor|major. The
recipe bumps Cargo.toml and Cargo.lock, pushes, and creates the GitHub
Release; the release workflow builds the binaries, publishes to crates.io, and
warms the Nix cache. Never bump the version in a feature PR.