Skip to content

App

new App(options?: object): App

Parameter Type Description

options

{ header?: string | null; lockfile?: string | null; root?: string; transforms?: readonly Transform[]; }

options.header?

string | null

Custom header comment template for generated files. May contain {variable} placeholders — see the emitter’s HEADER_VARIABLES. Set to null to keep the ghagen default; set to undefined to use the default.

options.lockfile?

string | null

Path to the pin lockfile, relative to root. Set to null to disable lockfile auto-loading. Defaults to .ghagen.lock.yml.

options.root?

string

Repository root directory. All registered output paths and the lockfile are resolved relative to this. Defaults to process.cwd().

options.transforms?

readonly Transform[]

Additional model transforms to apply during synthesis. The pin transform is auto-registered when a lockfile is present; these are appended after it.

App

Property Modifier Type

_userTransforms

readonly

readonly Transform[]

headerTxt

readonly

string | null | undefined

lockfilePath

readonly

string | null

rootAbsPath

readonly

string

add(item: SynthItem, path: string): void

Register an item at an explicit path relative to root.

Use this escape hatch when you need to write to a path that doesn’t fit the standard conventions. For the common cases, prefer addWorkflow() / addAction().

Parameter Type

item

SynthItem

path

string

void


addAction(action: ActionModel, dir?: string): void

Register an action, writing {dir}/action.yml (defaults to repo root).

Parameter Type Default value

action

ActionModel

undefined

dir

string

"."

void


addWorkflow(workflow: WorkflowModel, filename: string): void

Register a workflow at .github/workflows/{filename}.

Parameter Type

workflow

WorkflowModel

filename

string

void


check(): Promise<[string, string][]>

Check whether the on-disk YAML matches what synth() would write.

Returns one [path, diff] tuple for each file that’s stale or missing. An empty list means everything is in sync.

Promise<[string, string][]>


synth(): Promise<string[]>

Synthesize all registered items to YAML files.

Returns the absolute paths of every file written. Asynchronous so we have room to add async transforms in the future without breaking the API.

Promise<string[]>