feat(packages): add fj packages command group (FJ-41) #51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/packages-command-FJ-41"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a
fj packagescommand group for the Forgejo Packages registry, closing the verify-after-publish gap: after publishing to a Forgejo registry there was no terminal path to confirm the artifact landed (an auth-gated registry 401s an anonymous GET, leaving only the web UI), even thoughfjalready holds the credentials.Subcommands
packages list --owner <o> [--type <t>]- list an owner's packages.packages versions <name> --owner <o> [--type <t>]- list one package's versions.packages view <name> --owner <o> [--type <t>] [--version <v>]- with--version, show that single version plus its files and sha256 checksums; without it, list the package's versions.packages delete <name> --owner <o> --type <t> --version <v>- delete a version behind a y/N confirmation (skipped under--json, matchingrepo delete).Owner comes from
--owner, else is inferred from--repo/ the current git remote.--hostand--format json/--jsonare honored like the other command groups; auth uses the existingkeys.jsoncredentials.Design notes
fj_core::packagesmodule (thin wrappers returningforgejo-apistructs) so the planned MCP server can reuse it; rendering, the clap tree, and localization stay in the binary. The MCP-reuse contract grep (clap|crossterm|fluentinfj-core/fj-client) stays clean.--typeis validated up front against theListPackagesQueryTypeenum via the serde rename the API already declares, so accepted spellings never drift from the wire format; an unknown type errors with the full accepted list.versionsnarrows server-side with the name as a query, then keeps only exact name matches so a substringqhit on another package cannot leak in (the API has no exact-name version endpoint).Testing
cargo fmt --check,cargo clippy --all-targets -- -D warnings, and the fullcargo testsuite pass in the rust-builder-glibc image. Smoke-tested live againstdev.a8n.run:list,versions,view(single-version with files, and no-version listing),--jsonfor all, the--typefilter, the unknown-type error, and the--version-without---typeguard all behave. The destructivedeletepath mirrors the provenrepo deleteconfirmation flow.Closes FJ-41.
fj packagescommand group