Development guide for gitclaw contributors and agents.
- Nested
src/structure:core/,network/,cli/,output/ - Two binaries, one source:
gitclawandgcwboth compile fromsrc/main.rs src/lib.rsre-exports all modules publicly; integration tests consume the crate as a library- Integration tests in
tests/(flat, no subdirectories, one file per module) - Unit tests can stay in source files with
#[cfg(test)], integration tests go intests/
| File | Responsibility |
|---|---|
main.rs |
Entry point, CLI dispatch, run_package() |
lib.rs |
Module re-exports |
cli/mod.rs |
Clap CLI definition |
output/mod.rs |
print_success ([EXEC]), print_info (cyan), print_warn (yellow), print_error (red), print_kv, print_header |
core/config.rs |
Config, DownloadConfig, OutputConfig, config loading/merging |
core/checksum.rs |
ChecksumAlgorithm, verify_file, calculate_checksum, parse_checksum_file |
core/extract.rs |
ArchiveType, extract_archive, detect_archive_type |
core/install.rs |
handle_install, handle_update, handle_install_multiple |
core/registry.rs |
InstalledPackage, Registry, list_installed, uninstall |
core/updater.rs |
check_for_update, perform_update |
core/util.rs |
Path helpers, format_bytes |
network/github.rs |
GithubClient, Release, Asset, Platform, GithubError, parse_package, find_matching_asset |
network/platform.rs |
Arch, PlatformError, detect_arch, current_platform, score_asset, find_best_asset |
- Success:
[EXEC]prefix, bold green, viaoutput::print_success - Info:
[INFO]prefix, cyan, viaoutput::print_info - Warning:
[WARN]prefix, bold yellow, viaoutput::print_warn - Error:
[ERR]prefix, bold red, stderr, viaoutput::print_error - Key-value pairs: via
output::print_kv - No horizontal separator lines
NO_COLORenv var disables all color output
- No comments or docstrings anywhere in
.rsfiles - Use
?for error propagation, nounwrap()in production code - Opening brace on same line
- Blank line after multi-line blocks
#[serde(default)]on any new optional struct fields for backward compatibility- Imports sorted alphabetically within groups (stdlib / external / crate-internal), blank line between groups
- Integration tests go in
tests/, unit tests can stay in source files
- Create
.specs/feature-name.mdfrom TEMPLATE.md before coding - Small fixes: skip spec, write a clear PR description
- Features: full spec with acceptance criteria
- Review spec with user before implementation
- Checkpoints tied to deliverables, not percentages
- Specs are temporary planning artifacts, delete after merge
- Post-mortem lessons go to AGENTS.md, not the spec
- All named constants live in
src/core/constants.rs— no magic strings or numbers elsewhere insrc/ - Archive extension constants:
EXT_TAR_GZ,EXT_TGZ,EXT_ZIP, etc. - ar header offsets for
.debparsing: privateconstinsideextract.rs(not inconstants.rs, notpub) - Output prefix tags (
[EXEC],[INFO], etc.): inline literals inoutput/mod.rsonly - GitHub API path templates:
const &strwith{}placeholders, used with.replacen("{}", value, 1)at call sites
- Shared cross-file fixture strings (owner, repo, version, asset names that appear in 2+ test files) go in
tests/fixtures.rs - Each test file that uses them adds
mod fixtures;and imports what it needs - Integer-only or single-file literals (e.g.
Asset.id = 12345) stay as localconstat the top of that file tests/fixtures.rscontains:OWNER,REPO,VERSION,ASSET,PACKAGE,FD_OWNER,FD_REPO,FD_VERSION,BAT_REPO,BAT_VERSION
Verify, Test, Build
After rework or significant issues, document: what went wrong, root cause, prevention. Add to this file so it persists.
Last updated: 2026-04-24