@appifex/codegen
v1.0.0
Published
LLM-driven code generation for SwiftUI / Kotlin Compose targets
Readme
@appifex/codegen
Pluggable code generation adapter for the DTC toolkit. Accepts a design spec and test files, produces source code.
Usage
import { ClaudeAdapter } from '@appifex/codegen'
import { LocalRunner } from '@appifex/runner'
const adapter = new ClaudeAdapter({
generateFn: async (input) => {
// Call your LLM here with input.spec and input.uiTestPaths
return { success: true, files: [...], tokensUsed: 5000 }
},
})
// Generate code
const result = await adapter.generate({ spec, uiTestPaths, unitTestPaths, outputDir: './src' })
// Or generate and write to disk in one step
const runner = new LocalRunner(process.cwd())
await adapter.generateAndWrite(input, runner)Custom adapters
Implement the CodegenAdapter interface to use any code generation backend:
import type { CodegenAdapter } from '@appifex/codegen'
const myAdapter: CodegenAdapter = {
name: 'my-custom',
async generate(input) {
return { success: true, files: [...], tokensUsed: 0 }
},
}