feat(tui): add :bookmark/:bookmarks command and Shift+B picker - #5
Merged
Conversation
Phase 3.2 of the v0.2 improvement plan — bookmarks & quick access: - `:bookmark <name>` saves the last successful command under a name; `:bookmark --remove <name>` deletes one; `:bookmarks` lists all of them. Backed by a new src/kairos/services/bookmarks.py, persisted as a flat JSON array at .kairos/.bookmarks.json. Unlike command history (which fails closed since it's passive/background), saving/removing a bookmark is a deliberate action, so I/O errors here surface as a normal KairosError through the existing status-line path. - Shift+B opens a picker (BookmarkPickerScreen): Enter re-runs the highlighted bookmark's command, `d` removes it, Escape closes. - The tab bar shows the 3 most-recently-saved bookmarks, refreshed on every :bookmark/:bookmarks dispatch and loaded at startup (best-effort — a corrupt .bookmarks.json degrades to "no bookmarks shown" rather than crashing the app before the UI can report anything). - docs/tli.md and the in-app :help screen updated with the new commands/keybinding, and backfilled a few Phase-1 items that were missing from docs/tli.md (:ingest, :tutorial, Ctrl+G, persisted command history). Also fixes a real pre-existing bug found while wiring the picker's result handler: `on_list_view_selected` called `MainScreen.refresh_from_state(None, new_state)` on every Explorer selection, and `refresh_from_state`'s `old is None` branch unconditionally re-appends the last activity entry to the Workspace transcript — so every single Explorer click/Enter was duplicating the previous command's entire result table into the transcript. Fixed by passing the real prior state instead of `None`; added a regression test (test_selecting_in_explorer_does_not_duplicate_workspace_transcript). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoRVBGw6Ea7wd8d1ZDFKAx
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThe TLI adds JSON-backed bookmarks, bookmark commands, recent-bookmark state, a modal picker, bookmark tabs, expanded help, and regression coverage for persistence and TUI behavior. ChangesTLI bookmark workflow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant KairosApp
participant BookmarkPickerScreen
participant TuiController
User->>KairosApp: Open bookmark picker
KairosApp->>BookmarkPickerScreen: Display saved bookmarks
User->>BookmarkPickerScreen: Select bookmark
BookmarkPickerScreen-->>KairosApp: Return saved command
KairosApp->>TuiController: Dispatch command
TuiController->>TuiController: Update bookmark and activity state
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Jacobcdsmith
marked this pull request as ready for review
August 21, 2026 18:20
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Implements Phase 3.2 ("Bookmarks & Quick Access") of the KAIROS TUI v0.2 improvement plan — a "SHOULD HAVE" deliverable from the original plan, picked up as the next self-contained chunk after Phase 1 (#3) merged.
:bookmark <name>saves the last successful command under a name.:bookmark --remove <name>deletes one.:bookmarkslists all of them. Newsrc/kairos/services/bookmarks.py, persisted as a flat JSON array at.kairos/.bookmarks.json(unlike command history's append-only JSONL — bookmarks are a small, named, mutable set, so a whole-file read/write is the right model). Saving/removing a bookmark is a deliberate user action, so — unlike command history, which fails closed since it's passive/background — I/O errors here surface as a normalKairosErrorthrough the existing status-line path.Shift+Bopens a picker (BookmarkPickerScreen):Enterre-runs the highlighted bookmark's command,dremoves it,Escapecloses.:bookmark/:bookmarksdispatch and loaded at startup (best-effort — a corrupt.bookmarks.jsondegrades to "no bookmarks shown" rather than crashing the app before the UI exists to report anything).docs/tli.mdand the in-app:helpscreen updated with the new commands/keybinding — and while I was in there, backfilled a few Phase-1 items that had been missing fromdocs/tli.mdsince the last PR (:ingest,:tutorial,Ctrl+G, persisted command history).Also fixes a real pre-existing bug, found while wiring the picker's result handler:
KairosApp.on_list_view_selectedcalledMainScreen.refresh_from_state(None, new_state)on every Explorer selection, andrefresh_from_state'sold is Nonebranch unconditionally re-appends the last activity entry to the Workspace transcript — so every single Explorer click/Enter was duplicating the previous command's entire result table into the transcript. Confirmed via a manual repro (line count grew by ~9 on each selection) before and after. Fixed by passing the real prior state instead ofNone; added a regression test.No new dependencies; no changes to the
:-command grammar's existing commands (:bookmark/:bookmarksare additive) or to provenance/layer logic.Checklist
ruff format --check src testspassesruff check src testspassespyrightpasses with zero errors (repo-wide)pytestpasses, and I added/updated tests for the behavior changedocs/cli.mdand/ordocs/architecture.mdif this changes command behavior, schema, or provenance guarantees — n/a (TUI-only, no CLI/schema/provenance change); updateddocs/tli.md(the TUI-specific doc) insteadHow was this tested?
pytest -q(full suite, base + TUI extras) — 197 passed.tests/tui/test_bookmarks.py: persistence roundtrip (save/overwrite/remove/corrupt-file),:bookmark/:bookmarks/:bookmark --removecommand-grammar dispatch, and Pilot-driven picker flows (open/run, open/cancel, open/remove-and-sync-tab-bar, tab bar caps at 3).tests/tui/test_app.pyfor the Explorer-selection transcript-duplication fix.ruff check/ruff format --check/pyrightclean on every touched file and repo-wide.Generated by Claude Code
Summary by CodeRabbit
New Features
Documentation
Bug Fixes