Decisions/ADR-002-cli-entry-direct.md
ADR-002: CLI tsup Entry Points Directly at src/cli/index.ts
Decision
The tsup CLI config entry is { cli: 'src/cli/index.ts' } — pointing directly at the real Commander program. There is no intermediate stub file.
Context
An earlier design had src/cli.ts containing only import './cli/index.js'. This is a bare side-effect import (no exports consumed). With "sideEffects": false in package.json, esbuild's tree-shaker drops bare side-effect imports entirely. The resulting dist/cli.js contained only the shebang line — the entire CLI program was missing.
Alternatives Considered
Option A: Remove "sideEffects": false from package.json — rejected because it would disable tree-shaking for all consumers of the library entries (index, server), increasing bundle sizes.
Option B: Change src/cli.ts to re-export something (force non-side-effect) — rejected as a hack.
Option C (chosen): Point tsup directly at src/cli/index.ts and delete the stub. Clean, no hacks.
Consequence
No src/cli.ts file exists. The tsup config array has two configs: library config and CLI config as separate entries. The CLI binary is 151 lines and functional.