A simple CLI utility to chat with LLMs.
Find a file
2026-06-26 17:09:22 -04:00
src refactor(lmc): use short property for options and simplify flags 2026-06-26 17:09:22 -04:00
tts fix: pin exact dependency versions in tts/pyproject.toml 2026-04-29 01:00:57 -04:00
.gitignore style: markdown render improvements 2026-04-20 20:21:36 -04:00
AGENTS.md docs: update AGENTS.md to reflect Node.js/pnpm migration 2026-06-18 18:24:02 -04:00
biome.json chore: add biome and fix to pass 2026-04-15 15:20:18 -04:00
package.json fix(markdown): correct list item whitespace and indentation 2026-06-19 15:14:00 -04:00
pnpm-lock.yaml chore(deps): update dependencies and configure pnpm minimum release age 2026-06-18 17:47:09 -04:00
pnpm-workspace.yaml chore(deps): update dependencies and configure pnpm minimum release age 2026-06-18 17:47:09 -04:00
README.md chore(docs): update README.md 2026-06-12 03:32:28 -04:00
sea-config-tts.json refactor(tts): make cjs compatible and add sea config 2026-06-08 15:17:07 -04:00
sea-config.json refactor(build): switch from esbuild to rolldown 2026-06-05 23:02:25 -04:00
tsconfig.json refactor: migrate from bun to node types and fix discrepancies 2026-06-08 20:17:22 -04:00

lmc

A CLI tool for LLM chats with terminal native streaming.

Features

  • Streaming markdown rendering — incremental rendering with syntax highlighting
  • Conversation persistence — chat history saved to JSON
  • Model configuration — persist model preferences to JSON
  • Reasoning display — thinking tokens rendered in style on stderr
  • Usage stats — input/output tokens and tokens/sec rate after each response
  • TTY-aware — automatically disables markdown rendering when output is piped
  • Text-to-speechttsc sub-command for streaming TTS via Kokoro model

Requirements

Installation

# Bundle and install locally
pnpm build
pnpm add --global .

# Build a single-file exe
pnpm build:bin
cp dist/lmc dist/ttsc /somewhere/bin/

# For ttsc only
cp -r tts ~/.ttsc

Package to come later

Usage

Chat (lmc)

lmc [options] <prompt...>
Flag Short Type Description
--new -n boolean Start a new conversation (clear history)
--model -m string Set model name for this session
--config -c boolean Initialize a new config file (~/.lmc_config.json)
--plain boolean Disable markdown rendering for both stdout and stderr
--plainOut boolean Disable markdown rendering for stdout only
--plainErr boolean Disable markdown rendering for stderr only

Examples:

lmc --config                                 # Initialize/edit config
lmc --new "Introduce yourself."              # New conversation
lmc "What is TypeScript?"                    # Continue most recent chat
lmc -m llama3 "Explain quantum computing"    # Chat with specific model on-the-fly
lmc --plain "Plain text output"              # No markdown rendering

Text-to-Speech (ttsc)

echo "text" | ttsc [options]
Flag Short Type Description
--wait -w boolean Wait for all processing before exiting (don't auto-play)
--url -u boolean Fetch text from a URL instead of stdin
--edit -e boolean Edit the input with your $EDITOR before processing

Examples:

echo "Hello, world!" | ttsc
echo "Read this aloud" | ttsc --wait
echo "https://example.com" | ttsc --url

Requires: uv

Wants:

  • mpv for playback
  • sox for wav merging with --wait

Development

pnpm run dev      # dev run
pnpm run check    # biome lint + format + organize imports

Architecture

index.ts                — LMC entry point, orchestration
tts.ts                  — TTSC entry point, orchestration
src/render/index.ts     — Renderer class: streams LLM response, buffers markdown
src/render/markdown.ts  — renderMarkdown(): syntax-highlighted markdown via Marked + Shiki
src/conversation/       — Conversation persistence
src/config/             — App config persistence
tts/                    — TTS python stub (Kokoro pipeline)
out/                    — Bundled output (index.js, tts.js)

Configuration

  • Conversation history: ~/.lmc_convo.json
  • Model config: ~/.lmc_config.json
  • TTS files: ~/.ttsc/

Dependencies

Package Purpose
ai (Vercel AI SDK) Streaming text/usage
@clack/prompts Interactive prompts and spinner
@cliffy/table ASCII table rendering
@mozilla/readability HTML-to-text extraction (ttsc)
chalk Terminal string styling
happy-dom DOM parsing for URLs (ttsc)
shiki Syntax highlighting
terminal-link Clickable terminal hyperlinks
marked Markdown parsing