This file documents the development guidelines and design decisions for Hono CLI.
- Each command is placed in
src/commands/{command}/index.ts - Related logic is organized within the same directory
- Complex features are properly modularized
- Separation by Function: e.g., built-in middleware map separated into
builtin-map.ts - Testability: Parts that can be benchmarked or tested independently become standalone modules
- Reusability: Components that can be used by other features are made common
- Vitest used (fast, full TypeScript support)
- Type Safety: Minimize use of
any - Mocking: Proper type definitions for test reliability
- Test Execution: Run tests with
bun run test
- Bun as main package manager
- tsup for building
- Production Build: Use
bun run buildfor production builds - Development Build: Use
bun run watchfor development with auto-rebuild - esbuild used in serve command (TypeScript/JSX transformation)
- ESLint + Prettier for code quality maintenance
- Format and Lint Fix: Use
bun run format:fix && bun run lint:fixto automatically fix formatting and linting issues - GitHub Actions for CI/CD (Node.js 20, 22, 24 support)
- Type Safety focused implementation
- Simplicity: Avoid overly complex implementations
- Modularity: Properly separate features for easy testing and reuse
- Type Safety: Maximize TypeScript benefits
- Performance: Focus on optimization, especially for compile command
- Developer Experience: Aim for developer-friendly CLI
- Consistency: Always refer to projects under https://github.com/honojs for implementation patterns and conventions
- Documentation: Always update README when adding or modifying features
When you need information about Hono framework, APIs, or middleware, use the following CLI commands:
hono docs- Display main documentation summaryhono docs <path>- View specific documentation pages directly in terminalhono search <query>- Search through Hono documentation with keyword matching
# Search for specific topics
hono search middleware
hono search "getting started"
hono search jwt
hono search cors
# View specific documentation
hono docs /docs/api/context
hono docs /docs/guides/middleware
hono docs /docs/concepts/routing
hono docs /examples/basic
# Get overview of all Hono features
hono docsFor efficient documentation access from web URLs, convert paths using the following rule:
https://hono.dev/docs/middleware/builtin/basic-auth→hono docs /docs/middleware/builtin/basic-authhttps://hono.dev/docs/api/context→hono docs /docs/api/contexthttps://hono.dev/examples/basic→hono docs /examples/basic
Simply remove the https://hono.dev portion and append the path to the hono docs command to access documentation directly in the terminal.
Important: When you need to fetch information from Hono documentation (e.g., https://hono.dev/docs/middleware/builtin/basic-auth), always use the hono docs command instead of WebFetch. For example:
- Instead of:
WebFetch(https://hono.dev/docs/middleware/builtin/basic-auth) - Use:
hono docs /docs/middleware/builtin/basic-auth
- Search first: Use
hono search <keyword>to find relevant documentation - View locally: Use the provided
hono docscommand from search results to read full content - Reference online: Use the URL from search results for detailed browsing if needed
This approach ensures you have quick access to accurate, up-to-date Hono information without leaving the terminal.
- Language: TypeScript
- Runtime: Node.js 20+
- Package Manager: Bun
- Build Tool: tsup
- Testing Framework: Vitest
- Linter: ESLint + Prettier
- CI/CD: GitHub Actions