Skip to content

Commit 4a45b99

Browse files
committed
feat: turn-level auto-pair so user msg + response delete together
Also: non-interactive CLI (list/show/info/delete with --json) for LLM agents, and CI fixes (rustfmt, box Screen::Edit, sort_by_key, enumerate).
1 parent fa1cc63 commit 4a45b99

12 files changed

Lines changed: 1125 additions & 71 deletions

File tree

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,43 @@ cc-session --version
4848
| Key | Action |
4949
|-----|--------|
5050
| `j` / `k` | move selection |
51-
| `gg` / `G` | jump top / bottom |
51+
| `t` / `b` | jump top / bottom |
5252
| `d` | toggle delete on current message (auto-pairs tool_use/result) |
5353
| `v` | start visual range selection |
5454
| `s` | save |
5555
| `q` | back to list |
5656

57+
## Non-interactive CLI (LLM-friendly)
58+
59+
Every operation is also available as a subcommand with structured output, so other agents (Claude Code, Codex, scripts, CI) can drive the editor without a human at the terminal.
60+
61+
```sh
62+
cc-session list --json [--project <slug>] [--limit N]
63+
cc-session show <id-or-path> [--json] [--full] [--include-hidden]
64+
cc-session info <id-or-path> [--json]
65+
cc-session delete <id-or-path> --indices 3,5,7 [--from-top N] [--from-bottom N] [--range lo..hi] [--dry-run] [--force] [--json]
66+
```
67+
68+
`<id-or-path>` accepts a full path, a session UUID, or a unique substring of one. Indices are 0-based positions in the raw JSONL (use `cc-session show --json` to map text → index). Auto-pair always extends the delete set to keep `tool_use`/`tool_result` blocks together; `paired_added` in the output reports what was added.
69+
70+
### Example LLM workflow
71+
72+
```sh
73+
# 1. Pick a session.
74+
cc-session list --json --limit 5
75+
76+
# 2. Inspect messages.
77+
cc-session show 20042ea8 --json
78+
79+
# 3. Preview the edit.
80+
cc-session delete 20042ea8 --indices 4,6 --dry-run --json
81+
82+
# 4. Apply.
83+
cc-session delete 20042ea8 --indices 4,6 --json
84+
```
85+
86+
The `delete` JSON output names every key an agent needs: `requested`, `paired_added`, `after_auto_pair`, `total_messages_before`, `total_messages_after`, `dry_run`, `saved`, `backup`, `warnings`. Pair this with `--dry-run` to plan, then drop the flag to apply.
87+
5788
## Safety
5889

5990
- Always closes Claude Code first. `cc-session` detects open file handles via `lsof` and refuses to save unless `--force` is passed.

src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct Config {
99

1010
pub enum Screen {
1111
List(screens::list::ListState),
12-
Edit(screens::edit::EditState),
12+
Edit(Box<screens::edit::EditState>),
1313
}
1414

1515
pub struct App {

0 commit comments

Comments
 (0)