feat(cli): jcode session delete <id> with confirmation + cleanup (#153)#195
Merged
Conversation
Adds the missing `jcode session delete` subcommand requested in issue #153. Users had to manually `rm ~/.jcode/sessions/<id>.json` which left journal files and sidecars behind. Behavior: jcode session delete <session> # interactive: type 'yes' jcode session delete <session> --force # skip confirmation jcode session delete <session> --json # machine-readable output # (requires --force) The command: - Resolves the session via the existing `find_session_by_name_or_id` so memorable short names (`fox`, custom titles) work. - Refuses to prompt in JSON mode or when stdin is not a TTY (CI safety). - Deletes the snapshot, journal, and any sibling sidecars matching the same stem with whitelisted suffixes (.tmp, .swarm.json, .json.bak, .journal.jsonl) — never wildcards arbitrary files. - Invalidates the session-picker cache so the TUI updates immediately. - Reports either a human-readable line or a structured JSON object listing every file removed. Two tests in src/cli/commands_tests.rs: - run_session_delete_command_with_force_removes_files - run_session_delete_command_in_json_mode_requires_force Closes #153
zombi3butt
pushed a commit
to zombi3butt/jcode
that referenced
this pull request
May 22, 2026
The fork's CI has never run (`gh api repos/quangdang46/jcode/actions/runs`
returns total_count=0 for both pull_request and push events) because
upstream's workflows assume a `DEPLOY_KEY` SSH secret that the fork
does not have.
Two changes:
1. Gate every `webfactory/ssh-agent@v0.9.0` step on
`if: ${{ secrets.DEPLOY_KEY != '' }}` so the SSH agent setup is
simply skipped when the secret is absent. This is safe here because
none of this fork's Cargo git dependencies use SSH URLs:
- `agentgrep` -> https://github.com/1jehuang/agentgrep.git
- `mermaid-rs-renderer` -> https://github.com/1jehuang/mermaid-rs-renderer.git
So the `actions/checkout@v4` step's empty `ssh-key` falls back to
the GITHUB_TOKEN HTTPS path automatically. Applies to 5 jobs in
ci.yml + 1 step in release.yml.
2. Add `workflow_dispatch:` to ci.yml so maintainers can trigger CI
manually from the Actions tab while debugging without having to
force-push a no-op commit.
Note for the fork owner: GitHub disables Actions on a freshly-forked
repo until you visit the Actions tab once and click 'I understand my
workflows, go ahead and enable them'. After this PR is merged AND the
fork's Actions are enabled, future PRs will automatically run CI.
Refs the absence of CI runs blocking PRs quangdang46#174-quangdang46#195.
19 tasks
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
Adds the missing
jcode session deletesubcommand requested in issue #153: #153. Users had to manuallyrm ~/.jcode/sessions/<id>.jsonwhich left journal files and sidecars behind.Usage
Changes
SessionCommand::Delete { session, force, json }.run_session_delete_command+SessionDeleteOutputJSON struct. Resolves via the existingfind_session_by_name_or_idso memorable short names work. Refuses to prompt in JSON mode or non-TTY; whitelists deletable sidecars (.tmp / .swarm.json / .json.bak / .journal.jsonl) — never wildcards arbitrary files in the sessions dir. Invalidates the session-picker cache.Tests
Notes
The second half of issue #153 ("add text files or directories to context") is unrelated to session deletion and is best filed as a separate UX issue (overlaps with #11
@pathreferences).