Aihu CLI (`aihu`, `create-aihu`) — scaffolding, dev, build commands.
appAboutAihufunction appAboutAihu(appName: string = 'app'): stringsrc/pages/about.aihu — a second route, emitted by the `full` template to demonstrate the router resolving more than one page.
appAihuConfigfunction appAihuConfig(): stringaihu.config.ts — kept for server/SSR config; optional for client-only apps.
appDefaultLayoutfunction appDefaultLayout(): stringsrc/layouts/default.aihu for Hello World (v1 syntax).
appDocsGuideAihufunction appDocsGuideAihu(appName: string = 'app'): stringsrc/pages/guide.aihu — second docs route for the `docs` template.
appDocsIndexAihufunction appDocsIndexAihu(appName: string = 'app'): stringsrc/pages/index.aihu for the `docs` template — a docs-flavored landing page.
appIndexAihufunction appIndexAihu(appName: string = 'app', withCssEngine = false): stringsrc/pages/index.aihu for Hello World (v1 syntax).
appIndexHtmlfunction appIndexHtml(name: string): stringindex.html for a new aihu application.
appMainTsfunction appMainTs(_name: string): stringsrc/main.ts entry point for a new aihu app.
appPackageJsonfunction appPackageJson( name: string, pm: PkgManager = 'bun', withCssEngine = false, ): stringpackage.json for a new aihu application.
appTsConfigfunction appTsConfig(): stringtsconfig.json for a new aihu application.
appViteConfigfunction appViteConfig( appName = 'app', withCssEngine = false, shadowMode?: ShadowChoice, ): stringvite.config.ts for a new aihu application (`minimal` and `docs`).
appVscodeExtensionsfunction appVscodeExtensions(): string.vscode/extensions.json — recommends the aihu language extension.
appVscodeSettingsfunction appVscodeSettings(): string.vscode/settings.json — file associations and editor wiring for .aihu.
componentAihufunction componentAihu(name: string): stringA component file for a given component name.
pageAihufunction pageAihu(routePath: string): stringA page file for a given route path.
pluginIndexfunction pluginIndex(name: string): stringsrc/index.ts for a new aihu plugin.
pluginPackageJsonfunction pluginPackageJson(name: string): stringpackage.json for a new aihu plugin.
scaffoldAppfunction scaffoldApp( name: string, outDir?: string, opts?: { pm?: PkgManager template?: AppTemplate /** `'engine'` includes `@aihu/css-engine` OOTB; `'none'` (default) is the plain scaffold. */ css?: CssChoice /** * Explicit shadow-mode choice when css-engine is opted in. `undefined` * (default) emits NO plugin-global `css: { shadowMode }` block, so the * DA4 framework defaults apply (pages/layouts light, leaves shadow) — * only a genuine user choice is written out (FEL-425). */ shadowMode?: ShadowChoice | undefined /** * Coding-assistant files (AGENTS.md, CLAUDE.md, .mcp.json) — on by * default, `--no-agent-tooling` opts out. This governs ONLY the * developer-environment files; the app's own runtime agent surface * (`$action`, llms.txt, the cards) is the product thesis and is never * affected by this flag. */ agentTooling?: boolean }, ): ScaffoldResultScaffold a new aihu application at `<outDir>/<name>/`.
scaffoldComponentfunction scaffoldComponent(name: string, outDir?: string): ScaffoldResultScaffold a component file under `src/components/`.
scaffoldPagefunction scaffoldPage(routePath: string, outDir?: string): ScaffoldResultScaffold a page file under `src/pages/`.
scaffoldPluginfunction scaffoldPlugin(name: string, outDir?: string): ScaffoldResultScaffold a plugin package directory.
toKebabfunction toKebab(name: string): stringtoSafefunction toSafe(name: string): stringConvert a project name to a safe JS identifier (for use as rolldown input key or custom-element tag name component).
validateManifestfunction validateManifest(obj: unknown): TemplateManifestValidate an arbitrary value as a TemplateManifest.
ConditionalDepinterface ConditionalDep {
readonly version: string
readonly when: string
}ConditionalFileinterface ConditionalFile {
readonly path: string
readonly when: string
/** F-5b: when set, the scaffolded file is written with this filename
* (relative to the same directory as `path`) instead of the source filename.
* Enables e.g. `.env.example.better-auth` → `.env.example`. */
readonly rename?: string
}OverridableFieldinterface OverridableField {
readonly choices: ReadonlyArray<ChoiceValue>
readonly default: ChoiceValue
}PostInstallStepinterface PostInstallStep {
readonly kind: PostInstallKind
readonly when?: string
readonly allowFailure?: boolean
}ScaffoldResultinterface ScaffoldResult {
/** Files that were written. */
readonly created: ReadonlyArray<string>
/** Files skipped because they already existed. */
readonly skipped: ReadonlyArray<string>
}TemplateManifestinterface TemplateManifest {
readonly name: string
readonly displayName: string
readonly description: string
readonly contractVersion: number
readonly cliRange: string
readonly fixed: Readonly<Record<string, ChoiceValue>>
readonly overridable: Readonly<Record<string, OverridableField>>
readonly conditionalFiles: ReadonlyArray<ConditionalFile>
readonly placeholders: ReadonlyArray<string>
readonly postInstall: ReadonlyArray<PostInstallStep>
readonly appPeerDeps: Readonly<Record<string, string>>
readonly appPeerDepsConditional?: Readonly<Record<string, ConditionalDep>>
}AppTemplatetype AppTemplate = 'minimal' | 'full' | 'docs' | 'agent' | 'ssr'ChoiceValuetype ChoiceValue = string | booleanCssChoicetype CssChoice = 'engine' | 'none'Out-of-the-box CSS strategy for a scaffolded app.
PkgManagertype PkgManager = 'bun' | 'pnpm' | 'npm' | 'yarn'PostInstallKindtype PostInstallKind = 'pm-install' | 'git-init' | 'lint-fix' | 'aihu-check'ShadowChoicetype ShadowChoice = 'light' | 'shadow'Shadow-DOM mode threaded into the compiler when css-engine is opted in.