FJ-33: Add fj repo collaborator subcommands (list/add/remove/permission) #37

Merged
David merged 2 commits from feat/repo-collaborator-subcommands-FJ-33 into main 2026-06-06 16:00:14 +02:00
Owner

Implements FJ-33: adds fj repo collaborator list|add|remove|permission for managing repository collaborators from the CLI.

What

  • fj-core: thin forgejo-api wrappers in crates/fj-core/src/repo.rs (list_collaborators, add_collaborator, remove_collaborator, get_collaborator_permission) returning eyre::Result, following the existing repo-op pattern. No clap/crossterm/fluent deps, so the MCP-reuse contract holds (cargo tree -p fj-client -p fj-core -e normal | grep -E 'clap|crossterm|fluent' stays empty).
  • fj binary: new CollaboratorSubcommand enum wired as RepoCommand::Collaborator (subcommand literal collaborator, alias collab), a CollaboratorPermission clap ValueEnum mapped to AddCollaboratorOptionPermission, rendering helpers, JSON projection structs, and en-US ftl strings.

Behavior

  • add <username> --permission <read|write|admin> adds a collaborator or updates an existing one's permission (the upstream endpoint is an upsert). --permission is optional; omitting it uses the server default.
  • remove <username> removes the collaborator.
  • permission <username> prints the user's effective permission. This subsumes a standalone check command, so none was added.
  • list and permission support --json via stable serde projection structs. Because the list endpoint returns plain users with no permission field, each collaborator's permission is fetched alongside its username.

Verification

  • cargo build, cargo clippy, cargo fmt --check, and cargo test all pass.
  • MCP-reuse contract grep returns empty.
  • fj repo collaborator --help and subcommand help render the expected surface.

🤖 Generated with Claude Code

Implements FJ-33: adds `fj repo collaborator list|add|remove|permission` for managing repository collaborators from the CLI. ## What - fj-core: thin `forgejo-api` wrappers in `crates/fj-core/src/repo.rs` (`list_collaborators`, `add_collaborator`, `remove_collaborator`, `get_collaborator_permission`) returning `eyre::Result`, following the existing repo-op pattern. No clap/crossterm/fluent deps, so the MCP-reuse contract holds (`cargo tree -p fj-client -p fj-core -e normal | grep -E 'clap|crossterm|fluent'` stays empty). - fj binary: new `CollaboratorSubcommand` enum wired as `RepoCommand::Collaborator` (subcommand literal `collaborator`, alias `collab`), a `CollaboratorPermission` clap ValueEnum mapped to `AddCollaboratorOptionPermission`, rendering helpers, JSON projection structs, and en-US ftl strings. ## Behavior - `add <username> --permission <read|write|admin>` adds a collaborator or updates an existing one's permission (the upstream endpoint is an upsert). `--permission` is optional; omitting it uses the server default. - `remove <username>` removes the collaborator. - `permission <username>` prints the user's effective permission. This subsumes a standalone `check` command, so none was added. - `list` and `permission` support `--json` via stable serde projection structs. Because the list endpoint returns plain users with no permission field, each collaborator's permission is fetched alongside its username. ## Verification - `cargo build`, `cargo clippy`, `cargo fmt --check`, and `cargo test` all pass. - MCP-reuse contract grep returns empty. - `fj repo collaborator --help` and subcommand help render the expected surface. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(repo): add collaborator subcommands (list/add/remove/permission)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 36s
dde53a08fd
Add `fj repo collaborator list|add|remove|permission` for managing repository collaborators from the CLI. The API/domain layer lands in fj-core (`list_collaborators`, `add_collaborator`, `remove_collaborator`, `get_collaborator_permission`) as thin `forgejo-api` wrappers returning eyre::Result, keeping the crate clap/crossterm/fluent-free for the planned Forgejo MCP. The clap surface, ValueEnum permission mapping, rendering, and en-US ftl strings stay in the binary.

`add <username> --permission <read|write|admin>` upserts a collaborator (the upstream endpoint adds or updates). `remove <username>` deletes one. `permission <username>` prints the user's effective permission, subsuming a standalone check command. `list` and `permission` support `--json` via stable serde projection structs; because the list endpoint returns plain users, each collaborator's permission is fetched alongside.

#FJ-33
Merge branch 'main' into feat/repo-collaborator-subcommands-FJ-33
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 40s
Create release / Create release from merged PR (pull_request) Has been skipped
5dce488403
Resolves conflicts with the webhook subcommands (#36): union of collaborator and webhook imports/ops in fj-core repo.rs, both ftl message blocks kept, and both RepoCommand match arms restored in the binary.

#FJ-33
David merged commit bd748c7242 into main 2026-06-06 16:00:14 +02:00
David deleted branch feat/repo-collaborator-subcommands-FJ-33 2026-06-06 16:00: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!37
No description provided.