Thanks for contributing to gitee-cli.
This document covers local development setup, validation commands, repository conventions, and pull request expectations. User-facing install and workflow examples stay in README.md.
The project uses Rust 1.94.0 from .tool-versions.
Common local commands:
cargo build
cargo test
cargo fmt -- --check
cargo clippy --all-targets --all-features -- -D warningsUseful smoke tests while wiring commands:
cargo run -- auth status --json
cargo run -- repo view --repo octo/demo --json
cargo run -- issue list --repo octo/demo --json
cargo run -- pr list --repo octo/demo --jsonKeep executable startup thin in src/main.rs, route argument parsing through
src/cli.rs, and keep feature logic in focused modules such as:
src/auth.rssrc/repo.rssrc/issue.rssrc/pr.rssrc/config.rssrc/gitee_api.rssrc/repo_context.rssrc/command.rssrc/lib.rs
End-to-end CLI coverage lives in tests/, including:
tests/auth_cli.rstests/repo_view_cli.rstests/repo_clone_cli.rstests/issue_cli.rstests/pr_view_cli.rstests/pr_list_cli.rstests/pr_create_cli.rstests/pr_comment_cli.rstests/pr_status_cli.rstests/pr_checkout_cli.rs
Follow standard Rust conventions:
- 4-space indentation
snake_casefor modules and functionsPascalCasefor types- thin command parsing with service-style logic
Keep CLI text output, --json payloads, flags, stderr messages, and exit codes
stable unless a deliberate behavior change is covered by tests and documented in
the pull request.
When adding or changing tests:
- prefer integration tests with
assert_cmd - use
httpmockfor Gitee HTTP calls - use
tempfilefor filesystem isolation - cover both text and
--jsonoutput when behavior changes - keep using real local git fixtures for git-dependent flows such as repo context inference, clone, PR create, PR status, and PR checkout
Use a short imperative commit subject. A feat: or chore: prefix is fine, but
do not append PR numbers unless the change specifically requires that format.
Pull requests and issues should be written in English. A good PR includes:
- the user-visible CLI change
- the validation commands you ran
- sample output when flags, JSON payloads, or exit codes changed
If a user-facing documentation change affects both languages, update README.md and README_CN.md together. Keep English and Chinese contribution guidance aligned in CONTRIBUTING.md and CONTRIBUTING_CN.md.
Never commit real Gitee tokens.
Runtime configuration may read from:
GITEE_TOKENGITEE_CONFIG_DIRXDG_CONFIG_HOMEHOMEUSERPROFILEHOMEDRIVEHOMEPATH
Persisted credentials default to ~/.config/gitee/config.toml when
GITEE_CONFIG_DIR is not set. Use GITEE_BASE_URL only for tests or local API
mocking.