FJ-32: Add fj repo deploy-key subcommands (list/view/create/delete) #39

Merged
David merged 2 commits from feat/repo-deploy-key-subcommands-FJ-32 into main 2026-06-06 16:29:14 +02:00
Owner

FJ-32: Add fj repo deploy-key subcommands (list/view/create/delete)

Adds fj repo deploy-key list|view|create|delete to manage a repository's deploy keys, with the API/domain layer in fj-core for reuse by the planned Forgejo MCP.

Changes

  • fj-core (crates/fj-core/src/repo.rs): thin forgejo-api wrappers list_deploy_keys, get_deploy_key, create_deploy_key, delete_deploy_key, returning forgejo-api structs via eyre::Result. No clap/crossterm/fluent deps (MCP-reuse contract verified empty).
  • fj binary (crates/fj/src/repo.rs): new DeployKeySubcommand enum wired as RepoCommand::DeployKey under the deploy-key literal (explicit naming to avoid ambiguity with user SSH keys and GPG keys). Keys addressed by numeric id; list/view support the global --json flag via a stable DeployKeyJson projection (id, title, fingerprint, read_only, created_at).
  • create takes --title, optional --read-only, and the public key material from a positional file path or - for stdin, mapping to CreateKeyOption { title, key, read_only }.
  • Command help documents that rotation is delete plus create (the Forgejo API has no edit endpoint for deploy keys).
  • New user-facing strings added to crates/fj/localization/en-US/messages.ftl.

Acceptance criteria

  • fj-core exposes list/get/create/delete wrappers; cargo tree -p fj-client -p fj-core -e normal | grep -E 'clap|crossterm|fluent' stays empty
  • fj repo deploy-key list prints id, title, fingerprint, read-only state; --json emits projection structs
  • fj repo deploy-key view <id> shows one key; --json supported
  • fj repo deploy-key create --title <t> [--read-only] <keyfile|-> creates the key from a file or stdin
  • fj repo deploy-key delete <id> removes the key
  • Command help documents that rotation is delete plus create (no edit endpoint upstream)
  • New output strings have en-US .ftl entries

Verification

cargo fmt --check, cargo clippy -p forgejo-cli -p fj-core --all-targets -- -D warnings, cargo build, and cargo test all pass locally.

Closes FJ-32.

## FJ-32: Add fj repo deploy-key subcommands (list/view/create/delete) Adds `fj repo deploy-key list|view|create|delete` to manage a repository's deploy keys, with the API/domain layer in `fj-core` for reuse by the planned Forgejo MCP. ### Changes - `fj-core` (`crates/fj-core/src/repo.rs`): thin `forgejo-api` wrappers `list_deploy_keys`, `get_deploy_key`, `create_deploy_key`, `delete_deploy_key`, returning `forgejo-api` structs via `eyre::Result`. No clap/crossterm/fluent deps (MCP-reuse contract verified empty). - `fj` binary (`crates/fj/src/repo.rs`): new `DeployKeySubcommand` enum wired as `RepoCommand::DeployKey` under the `deploy-key` literal (explicit naming to avoid ambiguity with user SSH keys and GPG keys). Keys addressed by numeric id; `list`/`view` support the global `--json` flag via a stable `DeployKeyJson` projection (id, title, fingerprint, read_only, created_at). - `create` takes `--title`, optional `--read-only`, and the public key material from a positional file path or `-` for stdin, mapping to `CreateKeyOption { title, key, read_only }`. - Command help documents that rotation is delete plus create (the Forgejo API has no edit endpoint for deploy keys). - New user-facing strings added to `crates/fj/localization/en-US/messages.ftl`. ### Acceptance criteria - [x] fj-core exposes list/get/create/delete wrappers; `cargo tree -p fj-client -p fj-core -e normal | grep -E 'clap|crossterm|fluent'` stays empty - [x] `fj repo deploy-key list` prints id, title, fingerprint, read-only state; `--json` emits projection structs - [x] `fj repo deploy-key view <id>` shows one key; `--json` supported - [x] `fj repo deploy-key create --title <t> [--read-only] <keyfile|->` creates the key from a file or stdin - [x] `fj repo deploy-key delete <id>` removes the key - [x] Command help documents that rotation is delete plus create (no edit endpoint upstream) - [x] New output strings have en-US .ftl entries ### Verification `cargo fmt --check`, `cargo clippy -p forgejo-cli -p fj-core --all-targets -- -D warnings`, `cargo build`, and `cargo test` all pass locally. Closes FJ-32.
feat(repo): add deploy-key subcommands (list/view/create/delete)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 43s
83d16a3636
Add `fj repo deploy-key list|view|create|delete` to manage a repository's deploy keys. The API/domain layer lands in fj-core (`list_deploy_keys`, `get_deploy_key`, `create_deploy_key`, `delete_deploy_key`) as thin `forgejo-api` wrappers, keeping the crate clap/crossterm/fluent-free for the planned Forgejo MCP. The binary adds a `DeployKeySubcommand` enum mirroring the labels pattern, plus a stable `DeployKeyJson` projection (id, title, fingerprint, read_only, created_at) behind the global `--json` flag.

Keys are addressed by numeric id. `create` takes `--title`, optional `--read-only`, and the public key material from a file path or `-` for stdin. The Forgejo API has no edit endpoint for deploy keys, so the command help documents that rotation is delete plus create. New user-facing strings are added to the en-US Fluent catalog.

#FJ-32
Merge branch 'main' into feat/repo-deploy-key-subcommands-FJ-32
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 1m33s
Create release / Create release from merged PR (pull_request) Has been skipped
411ea9249c
Resolves conflicts with the webhook (#36), collaborator (#37), and branch-protection (#38) subcommands: union of imports and op functions in fj-core repo.rs, all four ftl message blocks kept, and the deploy-key RepoCommand variant, match arm, JSON projection, and helpers restored alongside the existing subcommand code in the binary.

#FJ-32
David merged commit 45c3bb33b8 into main 2026-06-06 16:29:14 +02:00
David deleted branch feat/repo-deploy-key-subcommands-FJ-32 2026-06-06 16:29:14 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
pandoras-box/forgejo-cli!39
No description provided.