✨ feat(cli): add GIT managment - #395
Draft
vincent-psarga wants to merge 13 commits into
Draft
Conversation
Introduce a `git` command group with a `connection list` subcommand that lists the organization's git providers via the existing GET /organizations/:orgId/git/providers endpoint. Wires a new GitGateway into PackmindGateway and exposes listGitConnections() on the CLI facade. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Greptile SummaryAdds CLI commands for administering Git connections and repositories, restricts provider/repository creation to organization administrators, and changes distribution tracking to use repositories configured beforehand.
Confidence Score: 5/5The pull request appears safe to merge because no blocking failure eligible for this follow-up review remains. No blocking failure remains. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant API
participant Git as Git domain
participant Deployments
User->>CLI: git connection/repo command
CLI->>API: Organization-scoped request
API->>Git: List or administer provider/repository
Git-->>API: Connection/repository result
API-->>CLI: HTTP response
CLI-->>User: Formatted result
User->>CLI: Install/render and notify distribution
CLI->>API: Distribution notification
API->>Deployments: Resolve configured repository and target
alt Repository is configured
Deployments-->>API: Recorded deployment ID
else Repository is not configured
Deployments-->>API: Null deployment ID
end
Reviews (5): Last reviewed commit: "✅ test(e2e): track repo before asserting..." | Re-trigger Greptile |
Add a `git connection add <token> --displayName --type --url` subcommand that creates a token-authenticated git provider via PUT /organizations/:orgId/git/providers. The --type option accepts github or gitlab; --url is optional for provider.com hosts and required for self-hosted instances. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a `git repo list --connectionId` subcommand listing the repositories managed under a connection. The `--show-available` flag instead lists the repositories that can be managed (paginated via `--page`), sourced from the provider's available-repos endpoint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a `git repo add <owner/repo> --connectionId [--branch]` subcommand that manages a repository under a connection via POST /organizations/:orgId/git/repositories. When --branch is omitted, the default branch is resolved by scanning the connection's available repositories; the command asks for --branch if the repo cannot be located. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Exercise the new `git connection list/add` and `git repo list/add` commands end-to-end against a real CLI binary and API: the unauthenticated guard, the empty-connection listing, connection creation, and managing a repository under the created connection. Adds a read-only git gateway to the e2e helpers to resolve the created provider id for the repo commands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a "Git Command" section to the CLI reference covering `git connection list/add` and `git repo list/add`, and cross-link it with the Git Repository Connection governance guide. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Distribution recording no longer provisions a git provider or repo on the fly. TargetResolutionService now finds an existing repo (never creates one) and only creates the target under it; when no repo has been set up for the remote, it returns null. The notify use cases skip recording and return `deploymentId: null` in that case, and plugin render skips its distribution record. This makes distribution tracking depend on a repository being set up beforehand (an admin-only step via `track` or Git settings) instead of implicitly creating tokenless providers/repos on install. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AddGitProviderUseCase and AddGitRepoUseCase now extend AbstractAdminUseCase, so creating a git provider or repository requires an organization admin and throws OrganizationAdminRequiredError otherwise. This is safe now that distribution recording no longer auto-provisions repos on notify — the admin-gated tracking flows still create repos in admin context. Note this also gates the GitHub App install callback and the UI/CLI repo-add paths, which all funnel through these use cases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Map OrganizationAdminRequiredError to a 403 Forbidden in the add-provider and add-repository controllers (previously it surfaced as a 500), and show a clear message in the CLI when the user is not an organization admin: "You need to be an organization administrator to add a git connection." / "...to manage a repository." instead of the raw server error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document that `git connection add` and `git repo add` require an organization admin, and add a troubleshooting entry for the permission error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Distribution recording now only happens for a repository set up beforehand (admin-only, via `track`); rendering no longer provisions a repo on the fly. Move the plugin distribution-tracking tests into their own suite that signs up with a packmind.com email (for the `cli-repo-tracking` flag), runs `track` before rendering, and is gated to `> 0.31.0` so older production CLIs skip it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`notifyDistribution` no longer auto-provisions a tokenless provider/repo, so the install distribution spec now sets up a tracked repository first. Add a `setTrackedRepository` gateway to the Playwright API fixture and run the suite under the `cli-repo-tracking` feature flag so the distribution and CLI-managed provider assertions hold under the new existing-repo-only behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
vincent-psarga
marked this pull request as draft
July 28, 2026 12:44
cteyton
reviewed
Jul 29, 2026
|
|
||
| logConsole('\nGit connections:\n'); | ||
| const sorted = [...connections].sort((a, b) => | ||
| a.displayName.localeCompare(b.displayName), |
Contributor
There was a problem hiding this comment.
is displayName mandatory or optional?
If 2), is there any risk it'd fail at runtime ?
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.



Introduce a set of
gitsubcommands to manage git providers (called connection, like in the app) and repos.Could be a first step to manage marketplaces from the cli