Skip to content

feat(picker): delete a session from disk with Ctrl-D#3

Merged
jarvan1 merged 1 commit into
mainfrom
feat/delete-session
Jul 8, 2026
Merged

feat(picker): delete a session from disk with Ctrl-D#3
jarvan1 merged 1 commit into
mainfrom
feat/delete-session

Conversation

@jarvan1

@jarvan1 jarvan1 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

What

Adds provider-aware session deletion to the picker. Press Ctrl-D on the highlighted row, then y to confirm (any other key cancels).

How each provider is handled

  • claude — remove <uuid>.jsonl plus the per-uuid session-env/<uuid> and file-history/<uuid> sidecar directories (both confirmed to be per-UUID dirs), so no orphans are left behind.
  • codex — run native codex delete <id> first (it also prunes Codex's own history/index db), then remove the rollout file as a fallback if the CLI isn't on PATH.
  • copilot / gemini — remove the whole per-session directory.

Safety

del.guardOK gates every removal target: it must be an absolute path, live under $HOME, and be at least 3 segments deep. A malformed session (empty ID/File) can therefore never target $HOME, ~/.claude, ~/.codex, etc. os.RemoveAll treats already-missing paths as success.

UX

  • Ctrl-D arms a red delete <provider> <cwd>? (y/N) prompt on the top line.
  • y deletes, drops the row from the list, and shows a green status; any other key cancels.
  • A failed delete keeps the row and surfaces the error.
  • Delete is injected into the picker as a callback, keeping the picker decoupled from the del package.

Tests

  • internal/del: plan building per provider + guard rejection (shallow / outside-home / home itself).
  • internal/picker: Ctrl-D arm → cancel, arm → confirm → drop row, and failure-keeps-row.

Docs updated in README and --help.

🤖 Generated with Claude Code

Add provider-aware session deletion, triggered by Ctrl-D on the highlighted
row and gated behind a y/N confirm.

- new internal/del package: BuildPlan + Delete
  - claude: remove <uuid>.jsonl plus the per-uuid session-env/ and
    file-history/ sidecar dirs
  - codex: run native `codex delete <id>` (prunes its index db), then remove
    the rollout file as a fallback
  - copilot / gemini: remove the whole per-session directory
  - guardOK: every target must be absolute, under $HOME, and >=3 segments
    deep, so a malformed session can never target $HOME or ~/.claude itself
- picker: Ctrl-D arms a red "delete <provider> <cwd>? (y/N)" prompt; y deletes
  and drops the row (green status), any other key cancels; a failed delete
  keeps the row and shows the error. Delete is injected as a callback to keep
  the picker decoupled from del.
- tests: del plan building + guard rejection; picker arm/cancel/confirm/drop
  and failure-keeps-row.
- docs: README + --help document the key.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jarvan1
jarvan1 merged commit 737df9f into main Jul 8, 2026
1 check passed
@jarvan1
jarvan1 deleted the feat/delete-session branch July 8, 2026 08:17
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.

1 participant