feat(mirror): add repo mirror collaborators add/remove/list - #1458
Merged
Conversation
Ports the per-mirror access verbs introduced in entiredb (`entire-core admin mirrors collaborators`) to the public CLI, under the existing `entire repo mirror` subtree: entire repo mirror collaborators add <github-url> <handle> [cluster-host] --role reader|writer entire repo mirror collaborators remove <github-url> <handle> [cluster-host] entire repo mirror collaborators list <github-url> [cluster-host] cluster-host is an optional trailing positional defaulting to defaultClusterHost, matching sibling create/remove. They hit the user-facing /mirrors/collaborators endpoints (live GitHub-admin gated) and inherit the cross-juris transport from the parent branch. coreapi client regenerated from a refreshed spec; the refresh also pulls in GET /version (latent, no command wired). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds public CLI support for managing per-mirror collaborators under entire repo mirror collaborators, backed by regenerated internal/coreapi client code for the new /mirrors/collaborators endpoints (plus a newly surfaced /version endpoint in the spec).
Changes:
- Add
repo mirror collaborators add|remove|listcommands, including role parsing and table rendering for human output. - Refactor cluster-host positional parsing via
clusterArgAt, and add unit tests for the new helpers/row formatting. - Regenerate
internal/coreapiOpenAPI specs + ogen output to include mirror-collaborator APIs (and/version).
Reviewed changes
Copilot reviewed 4 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/coreapi/spec/core.openapi.json | Updates the OpenAPI source spec to include /mirrors/collaborators and /version. |
| internal/coreapi/spec/core.gen.json | Regenerated normalized spec used by codegen (new schemas + endpoints). |
| internal/coreapi/oas_validators_gen.go | Generated validators for new request/response models and enum types. |
| internal/coreapi/oas_security_gen.go | Generated security-operation maps updated for new mirror-collaborator ops. |
| internal/coreapi/oas_schemas_gen.go | Generated Go schema/types for collaborator and version endpoints (plus new repo fields). |
| internal/coreapi/oas_response_decoders_gen.go | Generated response decoders for getVersion + collaborator endpoints. |
| internal/coreapi/oas_request_encoders_gen.go | Generated request encoder for grantMirrorCollaborator. |
| internal/coreapi/oas_parameters_gen.go | Generated parameter structs for list/revoke mirror collaborators. |
| internal/coreapi/oas_operations_gen.go | Registers new operation names for codegen/client wiring. |
| internal/coreapi/oas_client_gen.go | Generated client methods for getVersion and mirror collaborator add/list/remove. |
| cmd/entire/cli/repo_mirror.go | Adds collaborators subtree to repo mirror, and introduces clusterArgAt. |
| cmd/entire/cli/repo_mirror_test.go | Adds tests for clusterArgAt, parseMirrorRole, and mirrorCollaboratorRow. |
| cmd/entire/cli/repo_mirror_collaborators.go | Implements `repo mirror collaborators add |
Files not reviewed (9)
- internal/coreapi/oas_client_gen.go: Generated file
- internal/coreapi/oas_json_gen.go: Generated file
- internal/coreapi/oas_operations_gen.go: Generated file
- internal/coreapi/oas_parameters_gen.go: Generated file
- internal/coreapi/oas_request_encoders_gen.go: Generated file
- internal/coreapi/oas_response_decoders_gen.go: Generated file
- internal/coreapi/oas_schemas_gen.go: Generated file
- internal/coreapi/oas_security_gen.go: Generated file
- internal/coreapi/oas_validators_gen.go: Generated file
Review feedback: the add success line went to stderr, inconsistent with remove (cmd.Printf → stdout) and sibling mirror create/remove. Move it to stdout so scripted/piped use is consistent across the subtree. remove keeps prose on stdout and ignores --json, matching every other remove/revoke in the CLI (no 204 body to render); the PR description is corrected to not over-claim --json there. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ogen emits empty role slices as []string{}, but lint:gofmt enforces the
simplified {} form (gofmt -l -s). Adding gofmt -s -w . as the final
//go:generate step makes a bare `go generate` idempotent and CI-clean
instead of leaving ~76 lines of churn that lint rejects.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
1 issue from previous review remains unresolved.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 94030f4. Configure here.
Trail review: list used clusterArg(args) while add/remove use clusterArgAt(args, N). Behaviour is identical (clusterArg delegates to clusterArgAt(..., 1)), but the explicit index reads uniformly across the three collaborator commands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Soph
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

https://entire.io/gh/entireio/cli/trails/600
Spinoff of #1457 (based on its branch — these commands are cross-region control-plane ops that need the cross-juris transport that PR adds).
What
Adds mirror permission management verbs to the public CLI, under the existing
entire repo mirrorsubtree:Ergonomics:
cluster-hostis an optional trailing positional defaulting todefaultClusterHost, consistent with siblingmirror create/remove.add/listhonor--json;removeprints a prose confirmation to stdout (no body to render), like the other remove/revoke commands. They hit the user-facing/mirrors/collaboratorsendpoints (GitHub-admin gated).coreapi regen — needs a look
Refreshed
spec/core.openapi.jsonfrom the live console and rango generate. The spec drift is clean: only the 3 collaborator ops + an unrelatedGET /version(latent, no command wired).However,
go generatewith gen.go's pinnedogen@v1.20.3re-churnsoas_security_gen.goby ~76 lines (Op: {}⟷Op: []string{}). Root cause: ogen emits[]string{}, and our committed files aregofmt -s-simplified to{}— the simplify pass (whichlint:gofmtenforces viagofmt -l -s) isn't part of thego generaterecipe in gen.go. Runninggofmt -s -wafter generate collapses it back, so the committed diff here is purely additive.Fixed at the source in this PR: the
//go:generaterecipe ininternal/coreapi/gen.gonow ends withgofmt -s -w ., so a barego generateis idempotent and CI-clean — the[]string{}⟷{}churn no longer escapes the recipe.Test
Added unit tests for
parseMirrorRole,clusterArgAt, andmirrorCollaboratorRow.Note
Medium Risk
Changes who can pull/push mirrored repos via live GitHub-admin-gated API calls; mistakes or misuse affect access control, though enforcement remains server-side.
Overview
Adds
entire repo mirror collaboratorswith add, remove, and list so GitHub admins can grant or revoke per-cluster mirror access (reader/writer) for a qualified handle, with optional trailingcluster-hostlike other mirror commands.Introduces
clusterArgAtfor commands that put the cluster after extra positionals (e.g.<handle>).parseMirrorRoleand table helpers validate--roleand format list output; unit tests cover those paths.Regenerates
internal/coreapifrom an updated OpenAPI spec (mirror collaborator endpoints plus incidentalGET /versionand repo mirror-suspension fields).gen.gonow runsgofmt -s -w .after ogen so generate stays lint-clean.Reviewed by Cursor Bugbot for commit 94030f4. Configure here.