feat(toolpath-cli): interactive fzf session picker + topic metadata#60
Merged
Conversation
`path import <provider>` now auto-launches `fzf` when run with no `--session`, stdin/stderr are TTYs, and `fzf` is on PATH. TAB multi-selects (produces a Graph); single-select produces a Path. Falls back silently to most-recent when fzf isn't available, or prints a manual recipe when `--project` is also missing. The picker leans on two new machine-readable surfaces: - `path list <provider> --format tsv|json|pretty` — defaults to pretty on a TTY, tsv when piped. The deprecated `--json` flag still works. For project-keyed providers (claude/gemini/pi) without `--project`, tsv emits sessions across all projects so the picker can scan globally. - `path show <provider> --…` — markdown summary for one session, used as fzf's `--preview`. Made the picker rows actually useful by adding a topic column. Picking a session is now searching by what the conversation was *about* rather than scrolling timestamps: - toolpath-claude: `ConversationMetadata.first_user_message` populated in the existing JSONL metadata pass (no extra I/O). Chain-aware: aggregated from the oldest segment. - toolpath-gemini: same field, populated for both main-session- file and orphan-UUID-directory cases. - toolpath-pi: `SessionMeta.first_user_message`, extracted by walking the JSONL until the first user-role message with text. Drive-by fix: `toolpath-claude::sanitize_project_path` now also maps `.` to `-`, matching Claude Code's actual encoding. Without this, projects under dotted paths (`github.com/…`, `.claude/worktrees/…`) couldn't be looked up by their original path — which broke the `path show` round-trip for any picker output. Versions bumped per the release checklist: toolpath-claude 0.7.0 → 0.8.0 toolpath-gemini 0.1.0 → 0.2.0 toolpath-pi 0.1.0 → 0.2.0 Documentation (CLAUDE.md, README.md, per-crate READMEs, CHANGELOG) updated to cover the new commands, the TSV column layout, the fzf flow, and the metadata field.
0564e9d to
8009f9e
Compare
|
🔍 Preview deployed: https://4c41d66b.toolpath.pages.dev |
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.
Summary
path import <provider>now auto-launchesfzfwhen run with no--session, stdin/stderr are TTYs, andfzfis onPATH. TAB multi-selects (produces aGraph); single-select produces aPath. The picker usespath show <provider> --…(a new command, also useful on its own) as its--previewso you can see the session's summary live as you scroll.The picker leans on a documented machine-readable surface so anyone can build their own:
path list <provider> --format tsv|json|pretty— replaces the bool--jsonflag (which still works as a deprecated alias). Default isprettyon a TTY andtsvwhen piped. For project-keyed providers (claude/gemini/pi) without--project, thetsvform emits sessions across all projects so the picker can scan globally.path show <provider>— markdown summary for one session, reusingtoolpath_md's summary detail.To make the picker rows actually pickable, every project-keyed provider's session metadata gained a
first_user_message: Option<String>field — the first non-empty user-prompt text. The fzf rows lead with the topic, so you can fuzzy-search by what the conversation was about instead of scrolling UUIDs and timestamps.What's in the diff
Crates with API changes (versions bumped per the release checklist):
toolpath-claude0.7.0 → 0.8.0 — addsConversationMetadata.first_user_message; populated in the existing JSONL metadata pass (no extra I/O), chain-aware. Also a drive-by bug fix tosanitize_project_pathso it maps.→-like Claude Code does — without this, projects under dotted paths (github.com/…,.claude/worktrees/…) couldn't be looked up, which broke thepath showround-trip for any picker output.toolpath-gemini0.1.0 → 0.2.0 — same field, populated for both main-session-file and orphan-UUID-directory cases.toolpath-pi0.1.0 → 0.2.0 —SessionMeta.first_user_message, extracted by walking the JSONL until the first user-role message with text.toolpath-cli(already at 0.5.0):crates/toolpath-cli/src/fzf.rs— TTY+fzf detection, picker invocation, manual-recipe printer.crates/toolpath-cli/src/cmd_show.rs—path show <provider>for the five session-keyed providers.cmd_import.rs— project args switched toOption<String>for project-keyed providers; fzf-pick wired into all five session-keyed providers; multi-select produces aGraph.cmd_list.rs—--format tsv|json|prettyflag, TSV layout per provider, cross-project listing for project-keyed providers when--projectis absent.Documentation
CLAUDE.md— refreshed test counts, addedpath list --format tsv/path showto the CLI examples, two new "Things to know" entries covering the picker and the metadata title field.README.md— replaced the stalederiveblock in the CLI reference with the actual current surface (import/export/cache/show/auth); new "Interactive selection (fzf)" section with copy-pasteable manual recipes for both project-keyed and single-keyed providers.toolpath-claude,toolpath-gemini,toolpath-pi) — example using the newfirst_user_messagefield.CHANGELOG.md— entry for the three crate version bumps.Test plan
cargo build --workspacecargo test --workspace— all green (~1300 tests)cargo clippy --workspace -- -D warnings— cleancargo test --docfor the three changed crates — cleanpath list claude --format tsvagainst my real~/.claude/projects— first-user-message column populated, TSV columns parse correctlypath show claude --project … --session …— works after the.-encoding fix; renders markdown summarypath deriveshim still routes throughcmd_importReviewer notes:
path showcommand parses sessions via the existingread_conversation/read_sessionpaths and renders viatoolpath_md::Detail::Summary, so each preview is one full derive — adequate for a few hundred sessions, but if it gets sluggish on huge histories we can add a lightweight metadata-only preview later.<uuid>/rather than<uuid>.jsonl) error at the read step. Pre-existingtoolpath-claudereader behavior; the picker just shows them as un-previewable.