delve-dict
v1.0.1
Published
Look up English word definitions from Merriam-Webster
Maintainers
Readme
delve-dict
Look up English word definitions from Merriam-Webster.
╭── incubate verb ──────────────────────────────────╮
│ │
│ 1. to sit on (eggs) so as to hatch by warmth │
│ 2. to maintain under conditions favorable for │
│ hatching, development, or reaction │
│ │
│ Etymology: Latin incubatus, from incubare... │
│ │
│ Pronunciation: ˈiŋ-kyə-ˌbāt │
│ incubated; incubating │
╰────────────────────────────────────────────────────╯Install
git clone https://github.com/xiaoshaoning/delve-dict.git
cd delve-dict
pnpm install
pnpm build
pnpm link --global # makes `delve` available from anywhereRequires a browser for Playwright (used to bypass M-W's bot protection):
- Windows/macOS: Google Chrome or Microsoft Edge (auto-detected)
- Linux / WSL2: run
npx playwright install chromiumafter install
Usage
Single-shot lookup
delve <word>delve incubate
delve serendipity
delve ephemeralInteractive REPL
delve -iType words one at a time, results stay on screen. Type q to quit, Esc to exit.
Flags
| Flag | Short | Effect |
|------|-------|--------|
| --interactive | -i | Start REPL mode |
| --minimal | -m | Definitions + pronunciation only (no etymology, examples) |
| --full | -f | Include synonyms and antonyms |
| --refresh | -r | Bypass cache, fetch fresh from M-W |
Examples
# Minimal output — just the essentials
delve ephemeral -m
# Full output — includes synonyms & antonyms
delve beautiful -f
# Force a fresh fetch, ignore cache
delve incubate -r
# Interactive mode with full detail
delve -i -fHow It Works
- Cache check — looks in
~/.delve/cache/<word>.json(TTL: 7 days). Instant if cached. - Browser fetch — on cache miss, Playwright launches Edge headless, navigates to
merriam-webster.com/dictionary/<word>. - Parse — cheerio extracts headword, part of speech, definitions, pronunciations (IPA), inflections, etymology.
- Render — Ink (React-on-terminal) displays the result in a styled box.
- Cache write — result saved to disk for next time.
Tech Stack
| Layer | Library | |-------|---------| | Runtime | Node.js + TypeScript (strict) | | CLI args | commander | | Browser | Playwright (Chrome → Edge fallback) | | HTML parse | cheerio | | Terminal UI | Ink + React | | Dev runner | tsx |
Cache
- Location:
~/.delve/cache/ - TTL: 7 days
- Force refresh:
--refreshflag - Manual clear:
rm -rf ~/.delve/cache/
