Description
Add MacApp/Packages/SharedModels/Sources/SharedModels/GitRemote.swift:
public struct GitRemote: Sendable, Equatable, Codable {
public let host: String
public let owner: String
public let repo: String
public let `protocol`: GitRemote.Protocol
}
public extension GitRemote {
enum Protocol: Sendable, Equatable, Codable { case ssh, https, scp }
static func parse(_ url: String) -> GitRemote?
}
public struct GitRemoteEntry: Sendable, Equatable {
public let name: String
public let url: String
}
parse supports:
https://github.com/owner/repo.git
https://github.com/owner/repo
git@github.com:owner/repo.git
ssh://git@github.com/owner/repo.git
https://<token>@github.com/owner/repo.git
- Repo names with dots (
my.repo)
- GHE hostnames parsed as-is (classification is done by GitHubFeature, not here)
GitRemoteEntry — raw name+url pair from git remote -v parsing (before URL classification).
Spec reference
See swarm-report/github-integration-decomposition.md#t-1 on branch feature/github-integration.
Relationships
Acceptance criteria
Complexity
S
Suggested agent
developer-workflow:swift-engineer
Module / Layer
SharedModels / Value types
Description
Add
MacApp/Packages/SharedModels/Sources/SharedModels/GitRemote.swift:parsesupports:https://github.com/owner/repo.githttps://github.com/owner/repogit@github.com:owner/repo.gitssh://git@github.com/owner/repo.githttps://<token>@github.com/owner/repo.gitmy.repo)GitRemoteEntry— raw name+url pair fromgit remote -vparsing (before URL classification).Spec reference
See
swarm-report/github-integration-decomposition.md#t-1on branchfeature/github-integration.Relationships
Acceptance criteria
GitRemote.parse("https://github.com/owner/repo.git")→ host/owner/repo match,protocol == .httpsGitRemote.parse("git@github.com:owner/repo.git")→ host/owner/repo matchGitRemote.parse("https://github.com/owner/my.repo")→repo == "my.repo"GitRemote.parse("https://example.com"),"","not a url"→nilGitRemote.parse("https://ghe.acme.corp/owner/repo.git")→ parses,host == "ghe.acme.corp"Sendable, pure Swift 6 (no@preconcurrency)swiftlint lint --strictgreenSharedModelsTestscover all formats + invalid inputsxcodebuild build+xcodebuild testgreen for Relay schemeComplexity
S
Suggested agent
developer-workflow:swift-engineerModule / Layer
SharedModels/ Value types