Skip to content

Comments

feat(cli): add persistent input history with rustyline#607

Merged
bug-ops merged 2 commits intomainfrom
feat/604-cli-input-history
Feb 19, 2026
Merged

feat(cli): add persistent input history with rustyline#607
bug-ops merged 2 commits intomainfrom
feat/604-cli-input-history

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 19, 2026

Summary

Closes #604

  • Integrate rustyline 17 into CLI channel for readline-style input editing
  • Persistent history backed by SQLite via custom SqliteHistory implementing rustyline::history::History trait
  • Arrow key navigation (Up/Down) to browse previous inputs across restarts
  • Prefix search: type partial text + Up to find matching history entry
  • Full line editing (Emacs keybindings, word navigation, etc.)

Changes

  • migrations/010_input_history.sql — new input_history table
  • crates/zeph-memory/src/sqlite/history.rsload_input_history, save_input_entry, clear_input_history on SqliteStore
  • crates/zeph-channels/src/cli.rsSqliteHistory struct with VecDeque<String> + SqlitePool; CliChannel::with_history() constructor; recv()/confirm() use editor.readline()
  • src/main.rs — pre-load history from SQLite, pass pool + entries to channel creation

Design decisions

  • Custom History impl over rustyline's built-in with-sqlite-history to avoid adding rusqlite (project uses sqlx)
  • In-memory VecDeque for fast search + SQLite writes via Handle::block_on() inside spawn_blocking
  • CliChannel::new() preserved for tests (no editor, falls back to stdin)

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --workspace -- -D warnings
  • cargo nextest run --workspace --lib --bins (1948 passed)
  • Manual: run cargo run, type messages, exit, restart, press Up — history restored
  • Manual: type prefix + Up — matching entry found

@github-actions github-actions bot added enhancement New feature or request memory Persistence and memory channels User interface channels rust dependencies size/XL documentation Improvements or additions to documentation and removed enhancement New feature or request labels Feb 19, 2026
Integrate rustyline 17 into CLI channel for readline-style input with
persistent history backed by SQLite. Custom SqliteHistory implements
rustyline::history::History trait using in-memory VecDeque with async
SQLite persistence via Handle::block_on inside spawn_blocking.

- Add input_history table migration (010)
- Add SqliteStore history CRUD (load/save/clear)
- Implement SqliteHistory with prefix search and dedup support
- Rewrite CliChannel::recv() and confirm() to use rustyline editor
- Wire SqlitePool from memory into channel creation in main.rs
@bug-ops bug-ops force-pushed the feat/604-cli-input-history branch from 7ad23fd to cd071fd Compare February 19, 2026 15:41
@bug-ops bug-ops enabled auto-merge (squash) February 19, 2026 15:43
@bug-ops bug-ops merged commit 1b0eb3f into main Feb 19, 2026
31 of 33 checks passed
@bug-ops bug-ops deleted the feat/604-cli-input-history branch February 19, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels User interface channels dependencies documentation Improvements or additions to documentation enhancement New feature or request memory Persistence and memory rust size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): persistent input history with prefix search

1 participant