Skip to content

feat: replace inquirer with @clack/prompts for modern TUI#13

Merged
m1ngsama merged 10 commits intomainfrom
feat/clack-prompts-ui-rewrite
Mar 1, 2026
Merged

feat: replace inquirer with @clack/prompts for modern TUI#13
m1ngsama merged 10 commits intomainfrom
feat/clack-prompts-ui-rewrite

Conversation

@m1ngsama
Copy link
Member

@m1ngsama m1ngsama commented Mar 1, 2026

Closes #12

Summary

  • Drop inquirer, @inquirer/prompts, @types/inquirer — 87 packages removed
  • Add @clack/prompts — 4 packages, covers all interactive primitives
  • Replace fake fixed-duration spinner with real async SpinnerResult bound to actual operations
  • Replace [✓]/[✗]/[ℹ] hand-assembled strings with log.success/error/info/warn
  • Replace inquirer list prompt with select({ label, hint }) + emoji icons
  • Add intro()/outro() session frame around the interactive TUI
  • Rewrite showAbout() as a note() info box
  • Upgrade calendar table to Unicode box-drawing characters (┌─┬─┐)
  • Replace all docs.ts inquirer calls with select()/confirm()

Files changed

File Change
package.json swap dependency
src/core/ui.ts delegate to clack log.*; add createSpinner()
src/core/menu.ts full rewrite — select(), isCancel(), outro(), note()
src/main.ts printHeader()intro()
src/features/calendar.ts real spinner + Unicode table
src/features/repair.ts spinner wraps open()
src/features/website.ts spinner wraps open()
src/features/docs.ts all inquirer replaced with clack
src/i18n/index.ts + locales add eventsFound key

Test plan

  • npm run build passes with zero errors
  • nbtca --help prints usage (non-interactive, unaffected)
  • nbtca events --json returns JSON array (non-interactive, unaffected)
  • nbtca lang zh sets language (non-interactive, unaffected)
  • npm run dev — interactive TUI shows intro() frame after logo
  • Main menu renders with emoji labels and hint text on focused item
  • Ctrl+C at any menu shows outro("Goodbye!") and exits cleanly
  • Selecting "Recent Events" shows real spinner → Unicode table on success
  • Selecting "Recent Events" with no network shows spinner .error() state
  • Selecting "About" shows note() info box
  • Selecting "Language" pre-selects current language; switching applies immediately
  • j/k vim keys navigate the select prompt (via vim-keys.ts passthrough)
  • Docs menu: all categories render with emoji; Ctrl+C exits cleanly

m1ngsama added 10 commits March 1, 2026 12:31
Replaces the entire inquirer stack with @clack/prompts, bringing the
terminal experience in line with modern CLIs (Claude Code, Gemini CLI).

Changes:
- Drop inquirer, @inquirer/prompts, @types/inquirer (-87 packages)
- Add @clack/prompts (+4 packages)
- ui.ts: delegate success/error/info/warn to clack log.*; add
  createSpinner() that returns a real async-bound SpinnerResult
- menu.ts: select() with emoji labels + hint text; isCancel + outro
  for graceful Ctrl+C exit; showAbout() now uses note() info box
- main.ts: printHeader() replaced by intro() session frame
- calendar.ts: real spinner bound to fetchEvents(); Unicode box-drawing
  table (┌─┬─┐) replaces dashed ASCII output
- repair.ts, website.ts: spinner wraps open() instead of fake timer
- docs.ts: all inquirer prompts replaced with select()/confirm();
  doc category labels updated with emoji icons
- i18n: add eventsFound key (zh + en); add field to Translations type

Backward compatibility: src/index.ts script mode is untouched.
All non-interactive commands (--json, --help, lang) continue to work.
@m1ngsama m1ngsama merged commit 29d6b05 into main Mar 1, 2026
2 checks passed
@m1ngsama m1ngsama deleted the feat/clack-prompts-ui-rewrite branch March 1, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal UI overhaul: replace inquirer with @clack/prompts

1 participant