Skip to content

feat(cli): v0.2 Command Center — Ink TUI split-pane search with live preview#42

Open
sairam0424 wants to merge 15 commits into
developfrom
feat/github-workflows
Open

feat(cli): v0.2 Command Center — Ink TUI split-pane search with live preview#42
sairam0424 wants to merge 15 commits into
developfrom
feat/github-workflows

Conversation

@sairam0424
Copy link
Copy Markdown
Owner

Summary

  • Replaces the @inquirer-based interactive CLI mode with a full-screen Ink TUI (vault / vault i) featuring a live split-pane layout: fuzzy search on the left, content preview on the right, updating as you arrow through results
  • Adds getContentExcerpt() utility to @commandvault/core that finds the first query-match in skill content and returns a centred line window — used by both the TUI preview pane and available for the VS Code extension
  • TTY-gated: real terminals get the Ink TUI; pipes and CI scripts automatically fall through to the existing @inquirer legacy mode unchanged

What ships

@commandvault/core

  • src/utils/excerpt.tsgetContentExcerpt(content, query, maxLines) with 11 tests, 100% coverage

@commandvault/cli

  • src/tui/App.tsx — root Ink component; all state + keyboard handling (q, Esc, ↑↓, Tab, [, ], Enter/copy, o/open, f/favorite)
  • src/tui/SearchBar.tsx — query input with active filter badges
  • src/tui/ResultsList.tsx — windowed scroll list with active row marker
  • src/tui/PreviewPane.tsx — content excerpt with match-line highlighting, metadata fallback for empty-content entries
  • src/tui/ActionBar.tsx — key hints / error messages (auto-clear 3s)
  • src/tui/FilterBar.tsx — Tab-activated type/source pill selector
  • src/tui/hooks/useScroll.tsuseReducer-based windowed scroll (concurrent-React safe)
  • src/tui/hooks/usePreviewScroll.ts — preview pane scroll with visibleLines=0 guard
  • src/tui/hooks/useVaultSearch.ts — 80ms debounce, stable onError ref, usage-sorted default view
  • src/commands/interactive.tsx — TTY gate: Ink TUI with enableWatcher: true, legacy fallback preserved

New deps (CLI only): ink, ink-text-input, clipboardy, react (runtime); @types/react, ink-testing-library (dev)

Test plan

  • pnpm --filter @commandvault/cli test → 73/73 pass
  • pnpm --filter @commandvault/core test → 129/130 pass (1 pre-existing env-sensitive integration test)
  • pnpm --filter commandvault-ai test → 56/56 pass
  • pnpm build → all 3 packages compile clean
  • pnpm typecheck → no errors
  • node packages/cli/dist/index.js in a real terminal → TUI launches, search works, preview updates on ↑↓, q exits
  • node packages/cli/dist/index.js interactive | cat → legacy @inquirer mode runs (non-TTY fallback)

Keyboard contract

Key Action
Any char Search query
↑ / ↓ Move selection
Enter Copy slash command to clipboard
o Open in $EDITOR
f Toggle favorite
[ / ] Scroll preview pane
Tab Open type/source filter bar
Esc Clear query / exit
q / Ctrl+C Exit

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant