FJ-31: Add fj repo webhook subcommands (list/view/create/edit/delete/test) #36

Merged
David merged 1 commit from feat/repo-webhook-subcommands-FJ-31 into main 2026-06-06 15:54:38 +02:00
Owner

FJ-31: Add fj repo webhook subcommands

Adds CLI management of repository webhooks: fj repo webhook list|view|create|edit|delete|test.

fj-core (domain layer, MCP-reusable)

Thin forgejo-api wrappers in crates/fj-core/src/repo.rs following the existing pattern: list_hooks, get_hook, create_hook, edit_hook, delete_hook, test_hook. No clap/crossterm/fluent dependency leaks; cargo tree -p fj-client -p fj-core -e normal | grep -E 'clap|crossterm|fluent' stays empty.

fj binary

WebhookSubcommand enum wired as RepoCommand::Webhook (literal webhook, alias webhooks), mirroring the labels/units pattern. Hooks are addressed by numeric id; list output includes the id so it can be fed to the other subcommands.

  • create maps every CreateHookOption/CreateHookOptionConfig field: --type (clap ValueEnum over the forgejo-api hook kinds, default forgejo), --url, --content-type (default json), --secret, repeatable --event, --branch-filter, --authorization-header, --active.
  • edit <id> takes the same flags as options and sends only the fields whose flags were passed; the config map is built from just the supplied url/content-type/secret keys.
  • test <id> triggers a delivery and accepts optional --ref.
  • list and view support --json via a stable WebhookJson projection that intentionally excludes the webhook secret.

New user-facing strings have en-US .ftl entries in crates/fj/localization/en-US/messages.ftl. Git server hooks (repo_*_git_hook) are out of scope per the issue.

Verification

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo build, cargo test all clean.
  • MCP-reuse contract grep returns empty.
  • fj repo webhook --help and ... create --help render the expected command tree.

Closes FJ-31 once merged.

## FJ-31: Add `fj repo webhook` subcommands Adds CLI management of repository webhooks: `fj repo webhook list|view|create|edit|delete|test`. ### fj-core (domain layer, MCP-reusable) Thin `forgejo-api` wrappers in `crates/fj-core/src/repo.rs` following the existing pattern: `list_hooks`, `get_hook`, `create_hook`, `edit_hook`, `delete_hook`, `test_hook`. No clap/crossterm/fluent dependency leaks; `cargo tree -p fj-client -p fj-core -e normal | grep -E 'clap|crossterm|fluent'` stays empty. ### fj binary `WebhookSubcommand` enum wired as `RepoCommand::Webhook` (literal `webhook`, alias `webhooks`), mirroring the labels/units pattern. Hooks are addressed by numeric id; `list` output includes the id so it can be fed to the other subcommands. - `create` maps every `CreateHookOption`/`CreateHookOptionConfig` field: `--type` (clap ValueEnum over the forgejo-api hook kinds, default `forgejo`), `--url`, `--content-type` (default `json`), `--secret`, repeatable `--event`, `--branch-filter`, `--authorization-header`, `--active`. - `edit <id>` takes the same flags as options and sends only the fields whose flags were passed; the config map is built from just the supplied url/content-type/secret keys. - `test <id>` triggers a delivery and accepts optional `--ref`. - `list` and `view` support `--json` via a stable `WebhookJson` projection that intentionally excludes the webhook secret. New user-facing strings have en-US `.ftl` entries in `crates/fj/localization/en-US/messages.ftl`. Git server hooks (`repo_*_git_hook`) are out of scope per the issue. ### Verification - `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo build`, `cargo test` all clean. - MCP-reuse contract grep returns empty. - `fj repo webhook --help` and `... create --help` render the expected command tree. Closes FJ-31 once merged.
feat(repo): add webhook subcommands (list/view/create/edit/delete/test)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 38s
Create release / Create release from merged PR (pull_request) Has been skipped
0b47b49708
Add `fj repo webhook list|view|create|edit|delete|test` for managing repository webhooks. The API/domain layer lands in fj-core (`list_hooks`, `get_hook`, `create_hook`, `edit_hook`, `delete_hook`, `test_hook`) as thin `forgejo-api` wrappers so the planned Forgejo MCP can reuse it; no clap/crossterm/fluent leaks into the libraries.

The binary adds a `WebhookSubcommand` enum wired as `RepoCommand::Webhook` (literal `webhook`, alias `webhooks`) mirroring the labels/units pattern. Hooks are addressed by numeric id. `create` covers every `CreateHookOption`/`CreateHookOptionConfig` field via `--type` (a clap ValueEnum over the forgejo-api hook types), `--url`, `--content-type`, `--secret`, repeatable `--event`, `--branch-filter`, `--authorization-header`, and `--active`. `edit <id>` takes the same flags as options and only sends the fields whose flags were passed, building the config map from just the supplied keys. `test <id>` triggers a delivery and accepts an optional `--ref`.

`list` and `view` support `--json` via a stable `WebhookJson` projection that intentionally excludes the webhook secret. New user-facing strings go through the `ftl_*` macros with en-US keys in localization/en-US/messages.ftl. Git server hooks (`repo_*_git_hook`) stay out of scope.

#FJ-31
David merged commit bbd3f18d0d into main 2026-06-06 15:54:38 +02:00
David deleted branch feat/repo-webhook-subcommands-FJ-31 2026-06-06 15:54:39 +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!36
No description provided.