Class: Resolver¶
Defined in: resolver/src/resolver.ts:442
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:451
Parameters¶
options¶
Returns¶
Resolver
Methods¶
clearCache()¶
clearCache():
void
Defined in: resolver/src/resolver.ts:2163
Clear the resolution cache.
Returns¶
void
getLoader()¶
getLoader():
FileLoader
Defined in: resolver/src/resolver.ts:2303
Get the file loader.
Returns¶
invalidate()¶
invalidate(
changedPaths):void
Defined in: resolver/src/resolver.ts:2172
Invalidate cached resolutions affected by changed files.
Parameters¶
changedPaths¶
readonly string[]
Files or directories that changed
Returns¶
void
resolve()¶
resolve(
entryPath,compositionContext?):Promise\<ResolvedAST>
Defined in: resolver/src/resolver.ts:473
Resolve a PromptScript file and all its dependencies.
Parameters¶
entryPath¶
string
Path to the entry file
compositionContext?¶
CompositionResolutionContext
Returns¶
Promise\<ResolvedAST>
Resolved AST with sources and errors
Throws¶
CircularDependencyError if a circular dependency is detected
verifyReferenceHashes()¶
verifyReferenceHashes(
lockfile):Promise\<ResolveError[]>
Defined in: resolver/src/resolver.ts:2208
Verify integrity hashes for registry reference files. Reads each referenced file from the registry cache and compares its hash against the lockfile entry.
Parameters¶
lockfile¶
Lockfile with reference hashes
Returns¶
Promise\<ResolveError[]>
Array of errors for mismatched references