lmc/AGENTS.md

39 lines
1.8 KiB
Markdown

# lmc
TypeScript CLI tool for streaming LLM chat with inline markdown rendering.
## Commands
```
pnpm run dev # dev run (rolldown bundle + node)
pnpm run check # biome lint + format + organize imports + typecheck
pnpm run build # check + bundle index.ts and tts.ts (minified ESM)
pnpm run build:bin # check + bundle with esbuild (CJS) + build SEA binaries
pnpm run clean # remove dist/
```
## Architecture
- `src/index.ts` — LMC CLI entry point, orchestration
- `src/tts.ts` — TTSC CLI entry point (text-to-speech, Kokoro pipeline via `uv run`)
- `src/config.ts``initConfig()`, `loadConfig()`: manages `~/.lmc_config.json`
- `src/conversation.ts``Conversation` class: load/save to `~/.lmc_convo.json`
- `src/errors.ts``handleTopLevel()`: TTY-aware error wrapping
- `src/prompts.ts``commitDiff()`, `reviewFile()`, `reviewDiff()`, `file()`: prompt builders
- `src/render/index.ts``Renderer` class: streams LLM response, buffers markdown, renders to stdout/stderr
- `src/render/markdown.ts``renderMarkdown()`: markdown via `marked` + Shiki + `@cliffy/table`
- `src/render/codeToANSI.ts` — Shiki token output to ANSI escape sequences
## Gotchas
- **Node.js** — Use modern Node APIs (`node:fs/promises`, `node:stream/consumers`, etc.).
- **No tests** — none exist.
- **Biome config**: double quotes, space indent, auto-import-organize on. `pnpm run check` also runs `tsc --noEmit`.
- **Build tools**: rolldown for ESM bundles, esbuild for CJS binaries, `node --build-sea` for SEA single-executable apps.
- **TTS**: requires Python with `uv` — Kokoro pipeline lives in `tts/`.
## Style
- Double quotes (enforced by biome).
- Preserve `verbatimModuleSyntax` — imports must be used or type-imported.
- `strict: true` in tsconfig.