Skip to content

PromptScript API


Class: GitRegistry

Defined in: resolver/src/git-registry.ts:126

Git-based registry implementation.

Implements

Constructors

Constructor

new GitRegistry(options): GitRegistry

Defined in: resolver/src/git-registry.ts:139

Parameters

options

GitRegistryOptions

Returns

GitRegistry

Methods

checkoutCommit()

checkoutCommit(targetDir, commit): Promise\<void>

Defined in: resolver/src/git-registry.ts:250

Checkout a specific commit in an already-cloned repository. Used to enforce lockfile pinning: after cloning at a tag/branch, checkout the exact commit recorded in the lockfile.

Parameters

targetDir

string

Path to the cloned repository

commit

string

Commit hash to checkout

Returns

Promise\<void>


cloneAtTag()

cloneAtTag(repoUrl, tag, targetDir, fallbackRepoUrl?): Promise\<void>

Defined in: resolver/src/git-registry.ts:299

Clone a repo at a specific Git tag (shallow, depth=1). When a fallbackRepoUrl is provided, auth errors trigger an automatic retry with the fallback URL.

Parameters

repoUrl

string

Repository URL to clone

tag

string | undefined

Git tag to check out, or undefined for the default branch

targetDir

string

Directory to clone into

fallbackRepoUrl?

string

Optional fallback URL to try on auth failure

Returns

Promise\<void>


cloneSparse()

cloneSparse(repoUrl, ref, targetDir, sparsePath, fallbackRepoUrl?): Promise\<void>

Defined in: resolver/src/git-registry.ts:419

Clone with sparse checkout — only fetch the requested path within the repo. When a fallbackRepoUrl is provided, auth errors trigger an automatic retry with the fallback URL.

Parameters

repoUrl

string

Repository URL

ref

string

Git ref (branch, tag, or commit)

targetDir

string

Directory to clone into

sparsePath

string

Subdirectory path to include in the sparse checkout

fallbackRepoUrl?

string

Optional fallback URL to try on auth failure

Returns

Promise\<void>


exists()

exists(path): Promise\<boolean>

Defined in: resolver/src/git-registry.ts:192

Check if a file exists in the registry.

Parameters

path

string

Path to check (may include version tag)

Returns

Promise\<boolean>

True if the file exists

Implementation of

Registry.exists


fetch()

fetch(path): Promise\<string>

Defined in: resolver/src/git-registry.ts:167

Fetch the content of a file from the registry.

Parameters

path

string

Path to the file (may include version tag)

Returns

Promise\<string>

File content as string

Throws

FileNotFoundError if the file doesn't exist

Throws

GitCloneError if cloning fails

Throws

GitRefNotFoundError if the ref doesn't exist

Implementation of

Registry.fetch


getCommitHash()

getCommitHash(ref?): Promise\<string>

Defined in: resolver/src/git-registry.ts:280

Get the current commit hash for a ref.

Parameters

ref?

string

Git ref (defaults to defaultRef)

Returns

Promise\<string>

Commit hash


list()

list(path): Promise\<string[]>

Defined in: resolver/src/git-registry.ts:212

List files in a directory.

Parameters

path

string

Directory path (may include version tag)

Returns

Promise\<string[]>

Array of file/directory names

Implementation of

Registry.list


listTags()

listTags(repoUrl, cache?): Promise\<string[]>

Defined in: resolver/src/git-registry.ts:360

List all semver tags from a remote repo. Results are cached via RegistryCache to avoid repeated ls-remote calls.

Parameters

repoUrl

string

Repository URL

cache?

RegistryCache

Optional RegistryCache (24-hour TTL for tag lists)

Returns

Promise\<string[]>

Sorted semver tag strings


refresh()

refresh(ref?): Promise\<void>

Defined in: resolver/src/git-registry.ts:236

Force refresh the cache for a specific ref.

Parameters

ref?

string

Git ref to refresh (defaults to defaultRef)

Returns

Promise\<void>


removeRemote()

removeRemote(targetDir): Promise\<void>

Defined in: resolver/src/git-registry.ts:270

Remove clone transport metadata before a repository is vendored.

Parameters

targetDir

string

Returns

Promise\<void>


resolveVersion()

resolveVersion(repoUrl, range, cache?): Promise\<string | null>

Defined in: resolver/src/git-registry.ts:399

Resolve a semver range against available tags from a remote repo.

Parameters

repoUrl

string

Repository URL

range

string | string[]

One or more semver ranges that the resolved tag must satisfy

cache?

RegistryCache

Optional RegistryCache passed through to listTags

Returns

Promise\<string | null>

Best-matching tag string, or null if no tag satisfies the range