@flowcraft/compiler
Programmatic API for compiling imperative workflows into declarative blueprints.
compileProject()
Compiles workflow files and returns the compilation result.
typescript
function compileProject(options: CompileOptions): Promise<CompilationOutput>Parameters
options.entryPoints:string[]- Array of glob patterns matching workflow filesoptions.tsConfigPath?:string- Path to tsconfig.json (defaults to './tsconfig.json')
Returns
typescript
interface CompilationOutput {
blueprints: Blueprint[]
registry: FlowRegistry
diagnostics: CompilationDiagnostic[]
manifestSource: string
}blueprints: Array of compiled blueprint objects ready for executionregistry: Registry containing all discovered flows and steps with their metadatadiagnostics: Array of compilation errors or warningsmanifestSource: Generated TypeScript code that exports all blueprints
buildFlows()
Convenience function that loads configuration from flowcraft.config.ts and writes the manifest file.
typescript
function buildFlows(configPath?: string): Promise<void>Parameters
configPath?:string- Path to config file (defaults to './flowcraft.config.ts')
This function:
- Loads the configuration from
flowcraft.config.ts - Compiles all workflows using
compileProject() - Writes the generated manifest to the configured
manifestPath - Throws an error if compilation fails
Type Definitions
typescript
interface FlowcraftConfig {
entryPoints: string[]
manifestPath: string
tsConfigPath?: string
}
interface CompilationDiagnostic {
file: string
line: number
column: number
message: string
severity: 'error' | 'warning'
}
interface Blueprint {
id: string
nodes: Node[]
edges: Edge[]
// ... additional blueprint properties
}
interface FlowRegistry {
flows: Map<string, FlowDefinition>
steps: Map<string, StepDefinition>
}