|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Common Commands |
| 6 | + |
| 7 | +- **Build**: `bun run build` - Uses the custom build script in `scripts/build.ts` |
| 8 | +- **Lint**: `bun run lint` - Runs Biome linter checks |
| 9 | +- **Format**: `bun run fmt` - Formats code using Biome with unsafe fixes |
| 10 | +- **Type check**: `bun run typecheck` - Runs TypeScript compiler without emitting files |
| 11 | + |
| 12 | +## Project Structure |
| 13 | + |
| 14 | +This is a TypeScript CLI tool using the following stack: |
| 15 | +- **Runtime**: Bun (primary development runtime) |
| 16 | +- **CLI Framework**: Commander.js for argument parsing |
| 17 | +- **Build Tool**: Custom Bun build script that creates executable CLI binary |
| 18 | +- **Linting/Formatting**: Biome (replaces ESLint + Prettier) |
| 19 | +- **Package Manager**: Bun with lockfile management |
| 20 | + |
| 21 | +### Key Files |
| 22 | +- `src/index.ts` - Main entry point with Commander.js CLI setup |
| 23 | +- `scripts/build.ts` - Custom build script that outputs to `dist/` with shebang |
| 24 | +- `biome.json` - Biome configuration for linting and formatting |
| 25 | +- `tsconfig.json` - TypeScript configuration optimized for bundler mode |
| 26 | + |
| 27 | +### Build Process |
| 28 | +The build process creates a standalone executable CLI tool: |
| 29 | +1. Removes existing `dist/` directory |
| 30 | +2. Uses Bun.build() to bundle TypeScript to JavaScript |
| 31 | +3. Adds Node.js shebang for CLI execution |
| 32 | +4. Makes output executable with chmod +x |
| 33 | + |
| 34 | +## Development Notes |
| 35 | + |
| 36 | +- Uses `"module": "Preserve"` and `"moduleResolution": "bundler"` in tsconfig for modern bundler compatibility |
| 37 | +- Biome is configured with strict rules including unused variable/import detection |
| 38 | +- Package is configured as ESM with `"type": "module"` |
| 39 | +- Binary is published as `cat-code` command via `bin` field in package.json |
0 commit comments