API / @aihu/cli

@aihu/cli

Compiler & tooling

Aihu CLI (`aihu`, `create-aihu`) — scaffolding, dev, build commands.

version
1.3.0
exports
36
values
24
types
12
01

appAboutAihu

function
function appAboutAihu(appName: string = 'app'): string

src/pages/about.aihu — a second route, emitted by the `full` template to demonstrate the router resolving more than one page.

02

appAihuConfig

function
function appAihuConfig(): string

aihu.config.ts — kept for server/SSR config; optional for client-only apps.

03

appDefaultLayout

function
function appDefaultLayout(): string

src/layouts/default.aihu for Hello World (v1 syntax).

04

appDocsGuideAihu

function
function appDocsGuideAihu(appName: string = 'app'): string

src/pages/guide.aihu — second docs route for the `docs` template.

05

appDocsIndexAihu

function
function appDocsIndexAihu(appName: string = 'app'): string

src/pages/index.aihu for the `docs` template — a docs-flavored landing page.

06

appIndexAihu

function
function appIndexAihu(appName: string = 'app', withCssEngine = false): string

src/pages/index.aihu for Hello World (v1 syntax).

07

appIndexHtml

function
function appIndexHtml(name: string): string

index.html for a new aihu application.

08

appMainTs

function
function appMainTs(_name: string): string

src/main.ts entry point for a new aihu app.

09

appPackageJson

function
function appPackageJson( name: string, pm: PkgManager = 'bun', withCssEngine = false, ): string

package.json for a new aihu application.

10

appTsConfig

function
function appTsConfig(): string

tsconfig.json for a new aihu application.

11

appViteConfig

function
function appViteConfig( appName = 'app', withCssEngine = false, shadowMode?: ShadowChoice, ): string

vite.config.ts for a new aihu application (`minimal` and `docs`).

12

appVscodeExtensions

function
function appVscodeExtensions(): string

.vscode/extensions.json — recommends the aihu language extension.

13

appVscodeSettings

function
function appVscodeSettings(): string

.vscode/settings.json — file associations and editor wiring for .aihu.

14

componentAihu

function
function componentAihu(name: string): string

A component file for a given component name.

15

pageAihu

function
function pageAihu(routePath: string): string

A page file for a given route path.

16

pluginIndex

function
function pluginIndex(name: string): string

src/index.ts for a new aihu plugin.

17

pluginPackageJson

function
function pluginPackageJson(name: string): string

package.json for a new aihu plugin.

18

scaffoldApp

function
function 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 }, ): ScaffoldResult

Scaffold a new aihu application at `<outDir>/<name>/`.

19

scaffoldComponent

function
function scaffoldComponent(name: string, outDir?: string): ScaffoldResult

Scaffold a component file under `src/components/`.

20

scaffoldPage

function
function scaffoldPage(routePath: string, outDir?: string): ScaffoldResult

Scaffold a page file under `src/pages/`.

21

scaffoldPlugin

function
function scaffoldPlugin(name: string, outDir?: string): ScaffoldResult

Scaffold a plugin package directory.

22

toKebab

function
function toKebab(name: string): string
23

toSafe

function
function toSafe(name: string): string

Convert a project name to a safe JS identifier (for use as rolldown input key or custom-element tag name component).

24

validateManifest

function
function validateManifest(obj: unknown): TemplateManifest

Validate an arbitrary value as a TemplateManifest.

25

ConditionalDep

interface
interface ConditionalDep {
  readonly version: string
  readonly when: string
}
26

ConditionalFile

interface
interface 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
}
27

OverridableField

interface
interface OverridableField {
  readonly choices: ReadonlyArray<ChoiceValue>
  readonly default: ChoiceValue
}
28

PostInstallStep

interface
interface PostInstallStep {
  readonly kind: PostInstallKind
  readonly when?: string
  readonly allowFailure?: boolean
}
29

ScaffoldResult

interface
interface ScaffoldResult {
  /** Files that were written. */
  readonly created: ReadonlyArray<string>
  /** Files skipped because they already existed. */
  readonly skipped: ReadonlyArray<string>
}
30

TemplateManifest

interface
interface 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>>
}
31

AppTemplate

type
type AppTemplate = 'minimal' | 'full' | 'docs' | 'agent' | 'ssr'
32

ChoiceValue

type
type ChoiceValue = string | boolean
33

CssChoice

type
type CssChoice = 'engine' | 'none'

Out-of-the-box CSS strategy for a scaffolded app.

34

PkgManager

type
type PkgManager = 'bun' | 'pnpm' | 'npm' | 'yarn'
35

PostInstallKind

type
type PostInstallKind = 'pm-install' | 'git-init' | 'lint-fix' | 'aihu-check'
36

ShadowChoice

type
type ShadowChoice = 'light' | 'shadow'

Shadow-DOM mode threaded into the compiler when css-engine is opted in.