Configuration
bunli.config.ts
Section titled “bunli.config.ts”The bunli.config.ts file is the main configuration entry point for your Bunli CLI project. It uses the defineConfig function from @bunli/core to export a complete project configuration object.
import { defineConfig } from "@bunli/core";
export default defineConfig({ name: "docs-mcp", version: "0.1.0", description: "A CLI built with Bunli",
commands: { directory: "./src/commands", },
build: { entry: "./src/index.ts", outdir: "./dist", targets: ["native"], minify: true, sourcemap: true, compress: false, },
dev: { watch: true, inspect: true, },
test: { pattern: ["**/*.test.ts", "**/*.spec.ts"], coverage: true, watch: false, },
plugins: [],});The configuration includes project metadata (name, version, description), command directory path, build settings, development options with file watching and inspection enabled, and testing configuration with coverage reporting.
Environment Variables
Section titled “Environment Variables”Environment variables for the docs-mcp project are typically defined in a .env file and accessed through your CLI commands. Key variables used by the project include:
MEILI_MASTER_KEY: Authentication token for Meilisearch integrationANTHROPIC_API_KEY: API credentials for Claude LLM access
These variables should be loaded at runtime when your CLI starts. Reference the .env.example file in your project root for the required template variables.
Build Configuration
Section titled “Build Configuration”The build configuration in bunli.config.ts controls how your CLI is compiled and packaged:
- Entry point:
./src/index.tsis the main entry file for compilation - Output directory:
./distcontains the final built artifact - Target:
nativeproduces native binaries optimized for your platform - Minification: Enabled (
minify: true) to reduce bundle size - Sourcemaps: Enabled (
sourcemap: true) for debugging the compiled output - Compression: Disabled (
compress: false) for flexibility
The binary entrypoint is defined in package.json under the bin field as docs-mcp, pointing to ./dist/index.js as the executable.
Command Discovery
Section titled “Command Discovery”Bunli automatically discovers and registers commands from the directory specified in commands.directory. The discovery process generates a type-safe CLI registry in .bunli/commands.gen.ts that exports five available commands:
- ask: Ask a question to an LLM and print the response
- build-repo-docs: Walk a code repository and build documentation using AI agents
- chat: Interactive TUI chat with an LLM
- create-description: Generate a description summary for documentation frontmatter
- create-llms-txt: Generate a project guidance file from documentation descriptions
The generated registry provides helper functions like listCommands(), getCommandApi(), and validateCommand() for runtime command introspection and execution. This system enables zero-config CLI setup—commands are automatically available without manual registration.