DEV Community

Cover image for Dotfiles Coach Update: Interactive TUI and RAG Search for Shell History
Ola Prøis
Ola Prøis

Posted on

Dotfiles Coach Update: Interactive TUI and RAG Search for Shell History

GitHub Copilot CLI Challenge Submission

A couple of weeks ago I posted about Dotfiles Coach, a CLI tool that analyses your shell history and uses GitHub Copilot CLI to generate aliases and functions based on your actual workflow.

Since then I've added two features that I think make the tool a lot more useful, and I wanted to share them.

Search: find forgotten commands by describing them

Ever typed a really useful command three weeks ago and have no idea what it was? Instead of scrolling through thousands of history lines or piping through grep, you just describe what you're looking for:

dotfiles-coach search "that docker compose command"
dotfiles-coach search "kubernetes pods"
dotfiles-coach search "ffmpeg convert"
Enter fullscreen mode Exit fullscreen mode

It tokenizes your query and every command in your history, then scores them with a weighted mix of exact keyword overlap, fuzzy Levenshtein matching, substring detection, frequency, and recency. The top results come back ranked in a table with scores and usage counts.

Search Pipeline

The whole thing runs 100% locally. No network, no Copilot needed for the core search. But if you add --explain, it sends just the top result (scrubbed of secrets) to Copilot for a plain-English explanation of what the command does and when you'd use it.

This quickly became my favorite feature. It's the kind of thing you don't think you need until you use it once, and then you use it all the time.

Interactive TUI: review suggestions before applying

The original version dumped all Copilot suggestions to your terminal at once. That works, but when you have 20+ suggestions it's hard to decide which ones to keep and which to skip.

Now you can add --interactive to either suggest or apply:

dotfiles-coach suggest --interactive
dotfiles-coach apply --interactive --dry-run
Enter fullscreen mode Exit fullscreen mode

This launches a terminal UI built with ink (React for CLIs) where you can:

  • Scroll through suggestions one at a time
  • Press Enter to mark one for apply, Space to ignore it
  • Press e to open the code in your editor, tweak it, and come back
  • Press a to approve everything at once
  • Press q when you're done

The TUI re-renders after each editor session so you can keep reviewing. If you're piping output or running in CI, it falls back to non-interactive mode automatically.

Updated pipeline

The workflow diagram now includes search as its own branch:

Dotfiles Coach Workflow

And the internal architecture shows how search sits alongside the suggest pipeline, sharing the same parser layer but going straight to the tokenizer/scorer without touching Copilot:

Dotfiles Coach Architecture

Updated numbers

The test suite grew quite a bit with these additions:

  • 425 automated tests (up from 291), across 22 test files
  • 102 tests just for the search scorer (tokenization, fuzzy matching, edge cases)
  • The interactive TUI has TTY detection and graceful fallback, tested in both modes

Try it out

Everything works with the bundled sample data, no real history or Copilot subscription needed:

git clone https://github.com/OlaProeis/dotfiles-coach.git
cd dotfiles-coach
npm install && npm run build && npm link

# Search (100% local)
dotfiles-coach search "docker" --shell bash --history-file tests/fixtures/sample_bash_history.txt

# Suggest with interactive TUI
dotfiles-coach suggest --interactive --shell bash --history-file tests/fixtures/sample_bash_history.txt --min-frequency 1

# Apply with interactive review (dry run)
dotfiles-coach apply --interactive --dry-run
Enter fullscreen mode Exit fullscreen mode

If you don't have Copilot installed, set DOTFILES_COACH_USE_MOCK_COPILOT=1 first and the mock client will return realistic sample suggestions.

Repo: github.com/OlaProeis/dotfiles-coach

Hope these additions make the tool more useful. Happy to answer any questions in the comments.

Top comments (0)