Documentation
¶
Overview ¶
Package repoid resolves stable Studio repository entity IDs.
Feature: cli/studio/index (REQ: fact-shape)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalID ¶
LocalID returns an order-independent ID for a local-only repository. The readable basename is paired with a short hash of the normalized absolute path, so same-basename repositories remain distinct without `-2` aliases.
func ParseRemote ¶
ParseRemote normalizes a supported git remote URL to `host/path`. URL-style HTTPS, HTTP, SSH and git remotes and SCP-style SSH remotes are supported. Transport, credentials, a trailing slash, and a trailing `.git` do not form part of repository identity. Local/file remotes and unsafe paths are rejected.
Types ¶
type OriginURLFunc ¶
OriginURLFunc resolves the origin remote URL for a local repository path. A missing origin, a non-repository directory, or any other git failure is represented by a non-nil error and makes the resolver use the local-only ID.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver mints stable repository IDs and detects two different paths that resolve to the same identity. It is intentionally stateful for one workspace run so an identity collision cannot silently merge two ingestion sources.
func NewResolver ¶
func NewResolver() *Resolver
NewResolver returns a resolver backed by `git remote get-url origin`.
func NewResolverWithOriginURL ¶
func NewResolverWithOriginURL(originURL OriginURLFunc) *Resolver
NewResolverWithOriginURL returns a resolver with an injectable origin lookup.
func (*Resolver) ID ¶
ID returns a stable repository entity ID. A supported origin remote becomes its normalized forge coordinate (`host/org/name`). A repository without a supported origin uses a deterministic local-only ID derived from its absolute path. If another path already claimed the same ID, ID returns that ID alongside an error instead of assigning an input-order suffix.