Skip to content

PromptScript API


Class: Resolver

Defined in: resolver/src/resolver.ts:50

Resolver for PromptScript files with inheritance and import support.

Handles: - @inherit: Single inheritance with deep merge - @use: Import declarations - @extend: Block modifications

Example

const resolver = new Resolver({
  registryPath: '/path/to/registry',
  localPath: '/path/to/project',
});

const result = await resolver.resolve('./instructions.prs');
if (result.ast) {
  console.log('Resolved successfully');
}

Constructors

Constructor

new Resolver(options): Resolver

Defined in: resolver/src/resolver.ts:56

Parameters

options

ResolverOptions

Returns

Resolver

Methods

clearCache()

clearCache(): void

Defined in: resolver/src/resolver.ts:233

Clear the resolution cache.

Returns

void


getLoader()

getLoader(): FileLoader

Defined in: resolver/src/resolver.ts:240

Get the file loader.

Returns

FileLoader


resolve()

resolve(entryPath): Promise\<ResolvedAST>

Defined in: resolver/src/resolver.ts:70

Resolve a PromptScript file and all its dependencies.

Parameters

entryPath

string

Path to the entry file

Returns

Promise\<ResolvedAST>

Resolved AST with sources and errors

Throws

CircularDependencyError if a circular dependency is detected