evalution
    Preparing search index...

    Interface PromptFileType

    Strategy object that knows how to parse, edit, and execute a specific prompt file format.

    The default implementation is TSPromptFileType, which handles TypeScript .prompt.ts files. Provide a custom implementation to support other file formats, then pass it to FilePromptProvider via its fileType option.

    interface PromptFileType {
        defaultFileExtension: string;
        defaultIncludePatterns: readonly string[];
        addProperty(
            filePath: string,
            promptName: string,
            propertyName: string,
            value: ModelPropValue,
        ): Promise<void>;
        loadConfig(
            filePath: string,
            promptName: string,
            params: any[],
        ): Promise<any>;
        newPromptSkeleton(
            promptsId: string,
            name: string,
            importPath: string,
        ): string;
        parsePrompts(files: string[], rootDir: string): Promise<ParsedFilePrompt[]>;
        removeProperty(filePath: string, propDef: PropDefinition): Promise<void>;
        renamePrompt(
            filePath: string,
            oldName: string,
            newName: string,
        ): Promise<void>;
        updateProperty(
            filePath: string,
            propDef: PropDefinition,
            value: ModelPropValue,
            promptId?: string,
        ): Promise<void>;
    }

    Implemented by

    Index

    Properties

    defaultFileExtension: string

    File extension appended to a new prompt's filename when the user does not supply one (e.g. '.prompt.ts'). Includes the leading dot.

    defaultIncludePatterns: readonly string[]

    Glob patterns used by FilePromptProvider when no explicit includePatterns option is provided.

    Methods

    • Adds a new property to a prompt in a source file.

      Parameters

      • filePath: string

        Absolute path to the file to edit.

      • promptName: string

        Name of the exported function to add the property to.

      • propertyName: string

        The key to add.

      • value: ModelPropValue

        The value to assign.

      Returns Promise<void>

    • Dynamically imports filePath, calls the exported function named promptName with params, and returns the resulting config object.

      Parameters

      • filePath: string

        Absolute path to the prompt file.

      • promptName: string

        Name of the exported function to invoke.

      • params: any[]

        Positional arguments forwarded to the function.

      Returns Promise<any>

    • Generates the starter source code for a new prompt file.

      Parameters

      • promptsId: string

        The module ID passed to the prompts() helper (typically derived from the file name).

      • name: string

        The initial prompt function name.

      • importPath: string

        The package path to import the prompts() helper from.

      Returns string

    • Parses the given files and returns all discovered prompts. Reads fresh file content at the time of the call.

      Parameters

      • files: string[]

        Absolute paths of the files to parse.

      • rootDir: string

        The project root; used to compute relative prompt IDs.

      Returns Promise<ParsedFilePrompt[]>

    • Renames an exported prompt in a source file.

      Parameters

      • filePath: string

        Absolute path to the file to edit.

      • oldName: string

        Current prompt name.

      • newName: string

        New prompt name.

      Returns Promise<void>

    • Updates the value of an existing property in a prompt source file.

      Parameters

      • filePath: string

        Absolute path to the file to edit.

      • propDef: PropDefinition

        The property definition to update (must carry source-position metadata).

      • value: ModelPropValue

        The new value to write.

      • OptionalpromptId: string

        The prompt ID, used to re-parse for fresh spans.

      Returns Promise<void>