Skip to content

feat: ccx pick session (HITL session resolver via TUI)#25

Merged
zzJinux merged 4 commits intomasterfrom
edgar/pick-session
Apr 20, 2026
Merged

feat: ccx pick session (HITL session resolver via TUI)#25
zzJinux merged 4 commits intomasterfrom
edgar/pick-session

Conversation

@zzJinux
Copy link
Copy Markdown
Collaborator

@zzJinux zzJinux commented Apr 18, 2026

Summary

  • Adds ccx pick session — an interactive resolver that launches the full ccx TUI on stderr and emits the user's pick as JSON on stdout. Scripts/agents can pipe it (sid=\$(ccx pick session | jq -r '.sessions[0].id')).
  • Picker is the existing session browser running in pick mode, so filters (/), badges, grouping, multi-select (space), etc. all work without duplication.
  • Press P to confirm the pick (top-level shortcut on the session list).
  • Introduces tui.PickResult sum-type (currently SessionsResult) so Phase 2 entities (entries/URLs/files/…) can add variants without per-entity picker models.
  • Prefs save is gated off in pick mode to avoid clobbering state from ephemeral invocations.

Test plan

  • bin/ccx pick session | jq '.sessions[0].id' returns the picked session's UUID
  • bin/ccx pick session -multi with 2–3 space-selected rows emits matching sessions | length
  • bin/ccx pick session -search "is:live" opens with the filter applied
  • Cancel path (q / esc) exits 130 with no stdout
  • Normal bin/ccx launch does NOT show a Pick shortcut in help line; quit still saves prefs
  • filter_term in ~/.config/ccx/config.yaml is unchanged after a ccx pick session run

Generated with AI

zzJinux added 2 commits April 18, 2026 19:43
New `ccx pick session` subcommand renders an interactive session picker
on stderr and prints a stable JSON envelope on stdout, making ccx
composable with shells, scripts, and agents.

    sid=$(ccx pick session -query is:current | jq -r '.sessions[0].id')
    claude --resume "$sid"

- Extract session filter engine (session.FilterValueFor, session.Matches)
  out of internal/tui so TUI and CLI share one source of truth. TUI
  behavior unchanged.
- Add `is:current` filter token matching tmux-window Claude CWDs and the
  invoker's cwd; populated only when cwdProjectPaths are supplied, so
  the TUI path is unaffected.
- Dedicated bubbletea model for the CLI picker with `/` search, space
  multi-select (when -multi), and esc/ctrl-c cancel. Row rendering and
  result conversion live in standalone helpers for future generalization.
- Exit codes: 0 confirm, 1 error, 2 no candidates, 130 cancel.
- Flags: -query, -multi, -dir.

Design doc: _workbench/design-cli-resolver.md.

Claude-Session: LOCAL_
Replaces the standalone slim picker with the existing session browser
running in pick mode so filters, badges, grouping, and multi-select all
come for free. Introduces a `tui.PickResult` sum-type interface
(currently `SessionsResult`) so Phase 2 entities can add variants
without per-entity picker models.

- `P` on the session list captures the pick and quits (top-level
  shortcut, not inside the actions menu).
- TUI runs on stderr via `tea.WithOutput`; stdout stays JSON-only.
- Prefs save is gated off in pick mode to avoid clobbering state.
- CLI flag `-query` renamed to `-search` for consistency with the TUI.

Claude-Session: LOCAL_
@zzJinux zzJinux self-assigned this Apr 18, 2026
@zzJinux zzJinux requested review from dikpaal and gavin-jeong April 18, 2026 14:53
@zzJinux
Copy link
Copy Markdown
Collaborator Author

zzJinux commented Apr 18, 2026

Screen.Recording.2026-04-18.at.11.52.39.PM.mov

Copy link
Copy Markdown

@jinsekim jinsekim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Pipe consumers (jq, shell one-liners) prefer newline-delimited compact
output; the indented form added noise without buying readability.

Claude-Session: LOCAL_
@gavin-jeong
Copy link
Copy Markdown
Collaborator

I think this should be merged with existing ccx sessions ?

@zzJinux
Copy link
Copy Markdown
Collaborator Author

zzJinux commented Apr 19, 2026

I think this should be merged with existing ccx sessions ?

I'll refactor it to ccx sessions -interactive

I'll refactor it to ccx sessions -pick (cause it's shorter)

Collapse the separate `pick` subcommand into a flag on `sessions` so
there's one entrypoint for listing sessions and picking one.

Claude-Session: LOCAL_
@zzJinux zzJinux merged commit 586ea7d into master Apr 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants