Skip to content

PromptScript API


Class: GitRegistry

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

Git-based registry implementation.

Implements

Constructors

Constructor

new GitRegistry(options): GitRegistry

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

Parameters

options

GitRegistryOptions

Returns

GitRegistry

Methods

cloneAtTag()

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

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

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

Git tag to check out

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:388

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:191

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:166

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:247

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:211

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:329

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:235

Force refresh the cache for a specific ref.

Parameters

ref?

string

Git ref to refresh (defaults to defaultRef)

Returns

Promise\<void>


resolveVersion()

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

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

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

Parameters

repoUrl

string

Repository URL

range

string

Semver range string (e.g. "^1.0.0", ">=2.0.0 <3.0.0", "1.x")

cache?

RegistryCache

Optional RegistryCache passed through to listTags

Returns

Promise\<string | null>

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