@hile/cli
@hile/cli
Run hile start, scan boot files, load auto-loaded services, and start registries from the command line.
This README is intentionally short and example-first. The complete AI-facing guide ships in AI.md in this package.
When To Use
Use these packages when an app needs managed startup, singleton resources, dependency ordering, environment-file loading, graceful shutdown, logs, Redis, or SQL database connections.
Install
pnpm add @hile/cli
Copy-Paste Example
// src/services/http.boot.ts
import { defineService } from '@hile/core'
import { Http } from '@hile/http'
export default defineService('http', async (shutdown) => {
const http = new Http({ port: Number(process.env.HTTP_PORT ?? 3000) })
await http.load(new URL('../controllers', import.meta.url).pathname)
const close = await http.listen()
shutdown(close)
return http
})
Run:
hile start --dev --env-file .env
Boundaries
Do not use
loadService()at module top level.Do not use
auto_load_packagesfor file paths. It accepts package names only.Do not use the default
@hile/ioredisor@hile/typeormservices when one app needs multiple Redis or database connections; define separate services with separate keys.Reusing one service key for unrelated factories.
Missing
shutdown()callbacks for network connections or servers.Assuming TypeORM env config fills entities automatically when
TYPEORM_ENTITIESis not set.Calling
transaction()and manually committing; the helper commits or rolls back internally.
Verify
- Boot files default-export
defineService(...). - Long-lived resources register teardown callbacks.
auto_load_packagescontains package names, not local files.hile start --devcan findsrc/**/*.boot.ts.- Production build emits
dist/**/*.boot.js.
More Context
AI.mdin this package: full package-local AI guide.- Root
llms-full.txt: full monorepo AI context. - Root
references/: source files copied fromdocs/ai.