Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- uses: actions/checkout@v4
- run: apt-get update && apt-get install -y pkg-config libssl-dev
- run: rustup component add clippy
- run: cargo clippy -- -D warnings
- run: cargo clippy
71 changes: 44 additions & 27 deletions .specs/TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,59 @@
# Spec Template
# Spec Title — Short Descriptor

## Goal

[One or two sentences: what does this spec achieve and why.]

---

## Small Change (bug fix, tweak)

Skip this template. Write a clear PR description instead.

## Feature / New Behavior
---

### Problem
[What problem does this solve?]
## 1. Section Name

### Solution
[High-level approach]
**What:** [One sentence describing the deliverable.]

### Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3
**Spec:**

### Edge Cases
- [ ] Edge case 1: [expected behavior]
- [ ] Edge case 2: [expected behavior]
- Requirement 1
- Requirement 2
- Requirement 3

### Test Plan
- Unit tests: [what to test]
- Integration tests: [what to test]
- Manual verification: [steps]
**Checkpoint:** [Concrete, verifiable condition that confirms this section is done.]

### Files to Modify
- [ ] file.rs
---

### Documentation Updates
- [ ] CHANGELOG.md
- [ ] README.md (if user-facing)
## 2. Section Name

**What:** [One sentence describing the deliverable.]

**Spec:**

- Requirement 1
- Requirement 2

**Checkpoint:** [Concrete, verifiable condition.]

---

## Checkpoints (tied to deliverables, not percentages)
## Implementation Order

1. Section that must come first (e.g., audit / discovery)
2. Section that depends on 1
3. Section that depends on 2
4. Final pass (fmt, clippy, test, version bump if applicable)

## Test Plan

- [ ] [Deliverable 1 — e.g., "Semver parsing compiles and passes tests"]
- [ ] [Deliverable 2 — e.g., "Lockfile generates valid TOML"]
- [ ] [Deliverable 3 — e.g., "Alias cycle works end-to-end"]
- [ ] [Final review before PR]
- [Test category]: [what is tested]
- [Test category]: [what is tested]
- `cargo fmt && cargo clippy && cargo test` must pass

## Files to Modify

- [ ] file.rs
- [ ] CHANGELOG.md
- [ ] README.md (if user-facing)
99 changes: 0 additions & 99 deletions .specs/v1.0.0-stability.md

This file was deleted.

47 changes: 30 additions & 17 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ Development guide for gitclaw contributors and agents.

## Source Modules

| 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` |
| 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` |

## Output Conventions

Expand Down Expand Up @@ -58,12 +58,25 @@ Development guide for gitclaw contributors and agents.
6. Specs are temporary planning artifacts, delete after merge
7. Post-mortem lessons go to AGENTS.md, not the spec

## CI Flow
## Constants

- All named constants live in `src/core/constants.rs` — no magic strings or numbers elsewhere in `src/`
- Archive extension constants: `EXT_TAR_GZ`, `EXT_TGZ`, `EXT_ZIP`, etc.
- ar header offsets for `.deb` parsing: private `const` inside `extract.rs` (not in `constants.rs`, not `pub`)
- Output prefix tags (`[EXEC]`, `[INFO]`, etc.): inline literals in `output/mod.rs` only
- GitHub API path templates: `const &str` with `{}` placeholders, used with `.replacen("{}", value, 1)` at call sites

## Test Fixtures

- 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 local `const` at the top of that file
- `tests/fixtures.rs` contains: `OWNER`, `REPO`, `VERSION`, `ASSET`, `PACKAGE`, `FD_OWNER`, `FD_REPO`, `FD_VERSION`, `BAT_REPO`, `BAT_VERSION`

Verify, Test, Build

## Post-Mortems

After rework or significant issues, document: what went wrong, root cause, prevention. Add to this file so it persists.

*Last updated: 2026-04-24*
_Last updated: 2026-04-24_
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ cargo test
## Submitting Changes

1. Branch from `main` with a prefix: `fix/`, `feat/`, `docs/`, `chore/`

2. Verify before pushing:

```bash
cargo fmt -- --check
cargo clippy -- -D warnings
cargo fmt
cargo clippy
cargo test
```

3. Open a PR, squash merge into `main`

## Commit Messages
Expand All @@ -42,4 +45,4 @@ docs: update readme
chore: bump dependency
```

Lowercase, imperative, no period.
Lowercase, imperative, no period.
8 changes: 0 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ edition = "2021"
name = "gitclaw"
path = "src/lib.rs"

[[bin]]
name = "gitclaw"
path = "src/main.rs"

[[bin]]
name = "gcw"
path = "src/main.rs"

[dependencies]
clap = { version = "=4.4.18", features = ["derive", "env"] }
clap_complete = "=4.4.5"
Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ gcw list

## Commands

| Command | Description |
|---------|-------------|
| alias | Manage package aliases. |
| cache | Manage the asset cache. |
| completions | Generate shell completions. |
| export | Export installed packages to TOML. |
| import | Install packages from a TOML file. |
| install | Install packages from GitHub releases. |
| list | List installed packages. |
| lock | Generate a lockfile from installed packages. |
| platform | Show platform information. |
| run | Run an installed package. |
| search | Search for releases on GitHub. |
| self | Update gitclaw to the latest version. |
| uninstall | Uninstall a package. |
| update | Update installed packages. |
| Command | Description |
| ----------- | -------------------------------------------- |
| alias | Manage package aliases. |
| cache | Manage the asset cache. |
| completions | Generate shell completions. |
| export | Export installed packages to TOML. |
| import | Install packages from a TOML file. |
| install | Install packages from GitHub releases. |
| list | List installed packages. |
| lock | Generate a lockfile from installed packages. |
| platform | Show platform information. |
| run | Run an installed package. |
| search | Search for releases on GitHub. |
| self | Update gitclaw to the latest version. |
| uninstall | Uninstall a package. |
| update | Update installed packages. |

## Configuration

Expand Down Expand Up @@ -70,20 +70,20 @@ verbose = false

## Supported Platforms

| OS | x86_64 | aarch64 |
|----|--------|---------|
| Linux | yes | yes |
| OS | x86_64 | aarch64 |
| ----- | ------ | ------- |
| Linux | yes | yes |

## Development

```bash
cargo fmt -- --check
cargo clippy -- -D warnings
cargo fmt
cargo clippy
cargo test
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

MIT -- Copyright (c) 2026 Francesco Sardone (Airscript)
MIT -- Copyright (c) 2026 Francesco Sardone (Airscript)
4 changes: 2 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ROADMAP

*All planned features have been shipped. gitclaw is approaching 1.0.0 stability.*
_All planned features have been shipped. gitclaw is approaching 1.0.0 stability._

*Last updated: 2026-04-23*
_Last updated: 2026-04-23_
Loading
Loading