Skip to content

feat: migrate apps:link to git connections - #194

Open
robingenz wants to merge 3 commits into
mainfrom
feat/git-connections
Open

feat: migrate apps:link to git connections#194
robingenz wants to merge 3 commits into
mainfrom
feat/git-connections

Conversation

@robingenz

Copy link
Copy Markdown
Member

This PR migrates the apps:link command from the legacy repository-linking flow to the new git-connection-based flow.

  • Link repositories via PUT /v1/apps/:appId/repository with { gitConnectionId, path } instead of the legacy slug body.
  • Resolve the local git remote server-side via the new resolve endpoint — all provider/host parsing logic removed from the CLI.
  • New options: --git-connection-id, --git-connection (name lookup), and --path for non-interactive/CI usage.
  • Interactive flow: confirm the single resolved candidate, pick from multiple candidates, or fall back to a connection picker with repository browsing (Bitbucket workspace, Azure DevOps organization/project, and Git HTTP/S clone URL prompts).
  • Git connections are org-scoped with a server-controlled restricted flag; restricted connections are excluded from selection.
  • New git-connections service and types; AppDto now includes organizationId.

robingenz and others added 3 commits July 24, 2026 08:33
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>
@robingenz robingenz added the feature Feature label Jul 26, 2026
Copilot AI review requested due to automatic review settings July 26, 2026 07:06
@robingenz robingenz added the feature Feature label Jul 26, 2026
@robingenz robingenz self-assigned this Jul 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:link to 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-connections service 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 restricted connections, they can appear in the selection/auto-confirm path. Filter out restricted connections 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 thread src/commands/apps/link.ts
Comment on lines +70 to +72
if (gitConnectionName) {
const gitConnections = await gitConnectionsService.findAll({ organizationId, name: gitConnectionName });
const gitConnection = gitConnections[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants