1.8 KiB
1.8 KiB
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, orchestrationsrc/tts.ts— TTSC CLI entry point (text-to-speech, Kokoro pipeline viauv run)src/config.ts—initConfig(),loadConfig(): manages~/.lmc_config.jsonsrc/conversation.ts—Conversationclass: load/save to~/.lmc_convo.jsonsrc/errors.ts—handleTopLevel(): TTY-aware error wrappingsrc/prompts.ts—commitDiff(),reviewFile(),reviewDiff(),file(): prompt builderssrc/render/index.ts—Rendererclass: streams LLM response, buffers markdown, renders to stdout/stderrsrc/render/markdown.ts—renderMarkdown(): markdown viamarked+ Shiki +@cliffy/tablesrc/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 checkalso runstsc --noEmit. - Build tools: rolldown for ESM bundles, esbuild for CJS binaries,
node --build-seafor SEA single-executable apps. - TTS: requires Python with
uv— Kokoro pipeline lives intts/.
Style
- Double quotes (enforced by biome).
- Preserve
verbatimModuleSyntax— imports must be used or type-imported. strict: truein tsconfig.