feat: migrate apps:link to git connections - #194
Open
robingenz wants to merge 3 commits into
Open
Conversation
Git connections are now always org-scoped. The connection DTO exposes a server-controlled `restricted` boolean instead of `appId`, the resolve endpoint no longer takes `appId`, and the interactive fallback fetches a single list filtered by `restricted=false` instead of merging two scope-filtered requests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates apps:link from the legacy “parse local git remote + slug payload” flow to the new org-scoped git-connection flow, relying on server-side remote resolution and enabling non-interactive usage via explicit git-connection and repository path options.
Changes:
- Reworks
apps:linkto link via{ gitConnectionId, path }, adds--git-connection-id,--git-connection, and--path, and introduces server-side remote resolution. - Introduces git-connection DTOs plus a
git-connectionsservice for listing, resolving, and browsing repositories. - Simplifies git utilities by removing provider/host parsing and deleting the associated tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/utils/prompt.ts | Adds interactive selection helpers for git connections and repositories. |
| src/utils/git.ts | Replaces remote parsing logic with a lightweight getGitRemoteUrl() helper. |
| src/utils/git.test.ts | Removes tests for the deleted remote parsing implementation. |
| src/types/git-connection.ts | Adds DTOs for git connections, resolution results, and repository browsing. |
| src/types/app.ts | Updates app/repository-link DTOs to support git-connection linking and adds organizationId to AppDto. |
| src/services/git-connections.ts | New service for listing git connections, resolving remote URLs, and listing repositories. |
| src/commands/apps/link.ts | Migrates command logic to git connections, adds non-interactive flags, and implements interactive resolution/selection flows. |
| src/commands/apps/link.test.ts | Updates tests to cover new options, resolution flow, and selection fallbacks. |
Comments suppressed due to low confidence (1)
src/commands/apps/link.ts:103
- Resolved git-connection candidates from the resolve endpoint are used directly in the interactive flow; if the server returns any
restrictedconnections, they can appear in the selection/auto-confirm path. Filter outrestrictedconnections before prompting/auto-selecting to ensure restricted connections are never selectable.
const gitConnections = resolution.gitConnections;
const gitConnection = gitConnections[0];
if (gitConnections.length === 1 && gitConnection) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+70
to
+72
| if (gitConnectionName) { | ||
| const gitConnections = await gitConnectionsService.findAll({ organizationId, name: gitConnectionName }); | ||
| const gitConnection = gitConnections[0]; |
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.
This PR migrates the
apps:linkcommand from the legacy repository-linking flow to the new git-connection-based flow.PUT /v1/apps/:appId/repositorywith{ gitConnectionId, path }instead of the legacy slug body.--git-connection-id,--git-connection(name lookup), and--pathfor non-interactive/CI usage.restrictedflag; restricted connections are excluded from selection.git-connectionsservice and types;AppDtonow includesorganizationId.