npm.io
3.0.3 • Published 20h agoCLI

@hile/cli

Licence
MIT
Version
3.0.3
Deps
6
Size
30 kB
Vulns
0
Weekly
0

@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_packages for file paths. It accepts package names only.

  • Do not use the default @hile/ioredis or @hile/typeorm services 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_ENTITIES is 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_packages contains package names, not local files.
  • hile start --dev can find src/**/*.boot.ts.
  • Production build emits dist/**/*.boot.js.

More Context

  • AI.md in this package: full package-local AI guide.
  • Root llms-full.txt: full monorepo AI context.
  • Root references/: source files copied from docs/ai.