fj release: --pattern, --clobber, and implicit-latest for download/upload/view #133

Closed
opened 2026-06-11 00:57:41 +00:00 by stephen · 0 comments
Owner

Task

Make fj release asset and lookup verbs scriptable:

  • Add --pattern <glob> to fj release download (repeatable, OR-combined), matched against a.name with a glob crate, alongside the existing exact -n/--name.
  • Add --clobber to download (overwrite existing files; without it, skip-with-note instead of the current silent std::fs::write overwrite at src/cli/release.rs:410) and to upload (delete-then-reupload, or PATCH, an existing same-named asset) so re-runs are idempotent.
  • Make <TAG> optional on view and download: when omitted, resolve the latest published release (skip drafts/prereleases unless asked). Optionally a --latest flag for explicitness.

Source: rasterstate/fj#122.

Priority

p3. These flags turn the install/publish surface into a scriptable one (self-update/bootstrap pulling fj-*-linux-x86_64.tar.gz from the latest release; re-runnable publish jobs). Below the p2 parity items because the audience is narrower (release pipelines specifically) and exact-name download plus release list --json | jq '.[0].tag_name' is a working stopgap.

Reason

Three concrete gaps in src/cli/release.rs: download is exact-match only (&a.name != filter string equality at :395-399), there is no --clobber on download or upload so retried publish jobs fight prior assets, and both view and download require a positional <TAG> (get_by_tag at :226/:390) with no implicit-latest, forcing callers to scrape .tag_name back out first. fj release already gets the hard parts right (draft/prerelease, path-traversal-safe safe_asset_dest); these are small, well-scoped flags.

Acceptance

  • fj release download <tag> --pattern '*.tar.gz' downloads matching assets; repeatable and OR-combined.
  • --clobber overwrites on download and republishes on upload; without it, download skips existing files with a note rather than silently overwriting.
  • fj release view and fj release download with no <TAG> resolve the latest published release (drafts/prereleases skipped).
  • (Optional) fj release list --exclude-drafts / --exclude-pre-releases.
  • Wiremock coverage in src/client/integration_tests.rs for pattern matching, clobber, and latest resolution.
  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, and cargo test --all pass.

Dependencies

None. Self-contained within fj release.

Size

M

## Task Make `fj release` asset and lookup verbs scriptable: - Add `--pattern <glob>` to `fj release download` (repeatable, OR-combined), matched against `a.name` with a glob crate, alongside the existing exact `-n/--name`. - Add `--clobber` to `download` (overwrite existing files; without it, skip-with-note instead of the current silent `std::fs::write` overwrite at `src/cli/release.rs:410`) and to `upload` (delete-then-reupload, or PATCH, an existing same-named asset) so re-runs are idempotent. - Make `<TAG>` optional on `view` and `download`: when omitted, resolve the latest published release (skip drafts/prereleases unless asked). Optionally a `--latest` flag for explicitness. Source: rasterstate/fj#122. ## Priority p3. These flags turn the install/publish surface into a scriptable one (self-update/bootstrap pulling `fj-*-linux-x86_64.tar.gz` from the latest release; re-runnable publish jobs). Below the p2 parity items because the audience is narrower (release pipelines specifically) and exact-name download plus `release list --json | jq '.[0].tag_name'` is a working stopgap. ## Reason Three concrete gaps in `src/cli/release.rs`: download is exact-match only (`&a.name != filter` string equality at `:395-399`), there is no `--clobber` on download or upload so retried publish jobs fight prior assets, and both `view` and `download` require a positional `<TAG>` (`get_by_tag` at `:226`/`:390`) with no implicit-latest, forcing callers to scrape `.tag_name` back out first. `fj release` already gets the hard parts right (draft/prerelease, path-traversal-safe `safe_asset_dest`); these are small, well-scoped flags. ## Acceptance - [ ] `fj release download <tag> --pattern '*.tar.gz'` downloads matching assets; repeatable and OR-combined. - [ ] `--clobber` overwrites on download and republishes on upload; without it, download skips existing files with a note rather than silently overwriting. - [ ] `fj release view` and `fj release download` with no `<TAG>` resolve the latest published release (drafts/prereleases skipped). - [ ] (Optional) `fj release list --exclude-drafts` / `--exclude-pre-releases`. - [ ] Wiremock coverage in `src/client/integration_tests.rs` for pattern matching, clobber, and latest resolution. - [ ] `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test --all` pass. ## Dependencies None. Self-contained within `fj release`. ## Size M
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj#133
No description provided.