diff --git a/AGENTS.md b/AGENTS.md index b0bb2e1..4f1015f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,26 +1,36 @@ # lmc -Bun CLI tool for streaming LLM chat with inline markdown rendering. +TypeScript CLI tool for streaming LLM chat with inline markdown rendering. ## Commands ``` -bun run dev # dev run -bun run prod # run bundled output -bun run check # biome lint + format + organize imports +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 -- `index.ts` — CLI entry point, orchestration +- `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()`: syntax-highlighted markdown via `@comark/ansi` + Shiki +- `src/render/markdown.ts` — `renderMarkdown()`: markdown via `marked` + Shiki + `@cliffy/table` +- `src/render/codeToANSI.ts` — Shiki token output to ANSI escape sequences ## Gotchas -- **Bun only** — not Node. Use `Bun.file()`, `Bun.argv`, `Bun.sleep()`. +- **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. Run `bun run check` before committing. +- **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