Skip to content

PromptScript API


Class: GitRegistry

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

Git-based registry implementation.

Implements

Constructors

Constructor

new GitRegistry(options): GitRegistry

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

Parameters

options

GitRegistryOptions

Returns

GitRegistry

Methods

cloneAtTag()

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

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

Clone a repo at a specific Git tag (shallow, depth=1).

Parameters

repoUrl

string

Repository URL to clone

tag

string

Git tag to check out

targetDir

string

Directory to clone into

Returns

Promise\<void>


cloneSparse()

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

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

Clone with sparse checkout — only fetch the requested path within the repo.

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

Returns

Promise\<void>


exists()

exists(path): Promise\<boolean>

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

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

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

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

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

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

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

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