evalution
    Preparing search index...

    Class TSPromptFileType

    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.

    Implements

    Index

    Constructors

    Properties

    defaultFileExtension: string = ".prompt.ts"

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

    • 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>