Skip to content

CanonicalFormatter

PromptScript API


Defined in: formatters/src/types.ts:144

Formatter contract for implementations that consume the immutable AST.

Extends

Properties

defaultConvention

readonly defaultConvention: string

Defined in: formatters/src/types.ts:101

Default convention for this formatter

Inherited from

Formatter.defaultConvention


description

readonly description: string

Defined in: formatters/src/types.ts:99

Human-readable description

Inherited from

Formatter.description


name

readonly name: string

Defined in: formatters/src/types.ts:95

Unique formatter identifier

Inherited from

Formatter.name


outputPath

readonly outputPath: string

Defined in: formatters/src/types.ts:97

Default output file path

Inherited from

Formatter.outputPath

Methods

format()

format(ast, options?): FormatterOutput

Defined in: formatters/src/types.ts:103

Transform AST to target format

Parameters

ast

Program

options?

FormatOptions

Returns

FormatterOutput

Inherited from

Formatter.format


formatCanonical()

formatCanonical(ast, options?): FormatterOutput

Defined in: formatters/src/types.ts:145

Optional canonical entry point.

Implementations that do not provide this method are legacy formatters. The formatter adapter creates a detached compatibility projection before invoking their format method.

Parameters

ast

CanonicalProgram

options?

FormatOptions

Returns

FormatterOutput

Overrides

Formatter.formatCanonical


getDotDir()?

optional getDotDir(): string | null

Defined in: formatters/src/types.ts:120

Dot directory of the target (e.g., ‘.claude’), used for the {{prs.dotDir}} path token. Null or not implemented leaves the token as written.

Returns

string | null

Inherited from

Formatter.getDotDir


getSkillBasePath()

getSkillBasePath(): string | null

Defined in: formatters/src/types.ts:113

Base path for skills (e.g., ‘.claude/skills’), or null if no skill support

Returns

string | null

Inherited from

Formatter.getSkillBasePath


getSkillFileName()

getSkillFileName(): string | null

Defined in: formatters/src/types.ts:115

Skill file name (e.g., ‘SKILL.md’ or ‘skill.md’), or null if no skill support

Returns

string | null

Inherited from

Formatter.getSkillFileName


referencesMode()

referencesMode(): "none" | "directory" | "inline"

Defined in: formatters/src/types.ts:122

How this formatter handles skill references: ‘directory’, ‘inline’, or ‘none’

Returns

"none" | "directory" | "inline"

Inherited from

Formatter.referencesMode


transformInjectedSkillContent()?

optional transformInjectedSkillContent(content): string

Defined in: formatters/src/types.ts:131

Transform the raw content of a pass-through skill file (e.g. the bundled PromptScript SKILL.md injected by the compiler) before it is written to disk. Formatters whose target tools enforce frontmatter schemas (such as Factory AI) can override this to strip unsupported fields.

Defaults to identity when not implemented.

Parameters

content

string

Returns

string

Inherited from

Formatter.transformInjectedSkillContent