Contributing¶
Thanks for your interest in contributing. Guisu is pre-1.0; expect breaking API changes in the library crates.
Documentation¶
[!WARNING] Update docs in the same PR Every PR that adds or changes a user-facing command, flag, config key, file-attribute convention, template function, or hook mode must update the relevant page under
docs/{user-guide,reference}/in the same PR. The PR template (below) has a matching checklist.
Checklist before opening a PR:
- [ ] If the PR adds a new subcommand, update Reference — Commands and add a "Common usage" example to the relevant user-guide page.
- [ ] If the PR adds a template function or filter, update Reference — Template Functions with the function's name, signature, and a one-line description. Mark the row as a function or filter explicitly.
- [ ] If the PR adds a config key, update Reference — Configuration with type, default, and notes.
- [ ] If the PR changes file-attribute behaviour, update User Guide — File Attributes.
- [ ] If the PR changes hook semantics, update User Guide — Hooks.
- [ ] If the PR changes the CLI global flags (
--source,--dest,--config,--log-file,--verbose), update Reference — Commands. - [ ] If the PR adds a new shell or installer integration (e.g. extending
guisu completion), update README — Shell completion with install instructions for the new shell. - [ ] If the PR fixes a user-visible bug that previously diverged between commands (e.g.
diffandapplyreporting different file sets, or non-deterministic output order), document the corrected behaviour in the relevant getting-started / user-guide page so users can trust the docs again. Bug-fix PRs are not exempt from the "update docs in the same PR" rule above.
The site is English-only. A Chinese translation is not in scope; if one is added later, it is a separate effort and tracked elsewhere.
Development setup¶
git clone https://github.com/YvanY0/guisu.git
cd guisu
cargo build
cargo test --workspace
cargo clippy --workspace -- -D warnings
cargo fmt -- --check
Recommended tools:
pre-commit(orprek) — see.pre-commit-config.yaml. Install once withpre-commit install.nixfmt— provided by the official NixOS/nixfmt hook in.pre-commit-config.yaml(skipped on pre-commit.ci, whose runner image lacks cabal). Locally the hook needscabal/ghc; otherwise skip it withSKIP=nixfmt git commit.cargo-shear— installed byrust.yml; also runs locally viacargo install cargo-shear --locked.cargo-llvm-cov— installed byrust.yml; produceslcov.infofor Codecov uploads.cargo-dist— installed byrelease.yml;dist plan/dist buildsimulate the release pipeline locally without pushing a tag.
CI & local hooks¶
.github/workflows/rust.ymlrunscargo fmt/check/clippy --all-features --locked/test --all-features/deny check/outdated/shear. It auto-skips on PRs that don't touch Rust files. Cache usesSwatinem/rust-cache@v2with asave-ifso PR forks don't write back to the shared cache namespace..github/workflows/zizmor.ymlaudits every.github/workflows/*.ymlfor unsafe GH Actions patterns (unpinned actions, script-injection sinks, excessive permissions). It only runs when the workflow directory itself changes..pre-commit-config.yamlruns lint hooks (nixfmt, taplo, betterleaks, typos, commitlint) on thepre-commitstage and cargofmt/clippy/check/test/denyon thepre-pushstage. Run from a terminal viaprekorpre-commit.
Signing commits¶
git commit must include both -s (DCO Signed-off-by:) and -S (GPG or SSH signature). Don't commit without them; don't bypass with --no-gpg-sign/--no-verify. If signing fails, stop and ask the user to commit for you.
Tip: in ~/.gitconfig, set [commit] gpgsign = true and signoff = true so git injects -s and -S automatically on every commit.
Pull request process¶
- Branch from
main. Use a short descriptive prefix:feat/...,fix/...,docs/...,refactor/.... - Commit with
-sand-S(DCO + GPG/SSH signature). The repo enforces both — see Signing commits above. - Run the build & verify commands above. They must all pass.
- Open a PR with a clear title and a short description of the change. Reference any related issues.
- Address review feedback. Squash-merge is preferred for a linear history.
PR template¶
## Description
Brief description of changes.
## Motivation
Why is this change needed?
## Changes
- List of changes
- Another change
## Documentation
- [ ] Updated the relevant docs page (which one: ...)
- [ ] No docs update needed (reason: ...)
## Testing
How was this tested?
## Checklist
- [ ] Tests added/updated
- [ ] `cargo fmt --all -- --check` passes
- [ ] `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` passes
- [ ] `cargo test --workspace --all-features --locked` passes
- [ ] Commit signed (`-s -S`)
Architecture guidelines¶
- Follow the existing layered architecture — see Architecture. Lower layers never depend on higher layers.
- Use newtype paths (
AbsPath,RelPath), not rawPathBuf. - Use
?with.context(...)in the CLI, not bareunwrap(). Library errors usethiserror; see Error Handling. - For new template functions, follow the existing per-category layout in
crates/template/src/functions/. One file per category; one function perpub fnwith a doctest. - For new vault providers, implement
SecretProviderincrates/vault/src/. See vault/AGENTS.md for the full checklist.
Adding a new subcommand¶
- Create
crates/cli/src/cmd/<name>.rswith a#[derive(Args)]struct and aCommandimpl. - Add a variant to
Commandsincrates/cli/src/lib.rswith a docstring. - Add a row to Reference — Commands.
- Add tests under
crates/cli/src/cmd/<name>_test.rs(or inline with#[cfg(test)]).
See also¶
- Architecture
- Three-State Model
- Crates
- Error Handling
- AGENTS.md — the project rules every agent follows.