Skip to content

feat(cli): add clean command to prune sessions and checkpoints - #7

Merged
Kaap10 merged 4 commits into
PicadoLabs:mainfrom
HarshRajSinghania:feat/cli-clean-command
Sep 9, 2026
Merged

Kaap10 merged 4 commits into
PicadoLabs:mainfrom
HarshRajSinghania:feat/cli-clean-command

Conversation

@HarshRajSinghania

Copy link
Copy Markdown

Summary

Adds a terminal-agent clean command to prune old session, checkpoint, and telemetry artifacts under .terminal_agent/.

Motivation

Implements #2. Session and checkpoint data can accumulate during development and benchmark runs with no CLI way to reclaim disk space.

Implementation

  • New command: terminal-agent clean [--all] [--days N] [--dry-run] [-C DIR]
  • --days defaults to 7; --all ignores age and removes all matching artifacts
  • --dry-run lists file count and size (MB) without deleting
  • Empty or missing .terminal_agent exits 0 with an informative message
  • Parent directories (sessions/, checkpoints/) are kept
  • Helpers: SessionManager.delete_sessions_older_than, CheckpointManager.prune_checkpoints
  • Command registered in cli/main.py and KNOWN_COMMANDS

Testing

PYTHONPATH=src python3 -m pytest tests/unit/test_clean_command.py -q

Result: 7 passed

Also ran the existing tests/unit/test_config.py collection locally after installing typer, rich, pydantic, gitpython, pyyaml, psutil from PyPI.

Closes #2

Harsh Raj Singhania added 4 commits September 9, 2026 18:13
Implements terminal-agent clean --all --days --dry-run as requested in PicadoLabs#2.
Adds SessionManager.delete_sessions_older_than and CheckpointManager.prune_checkpoints helpers, plus unit tests.
@Kaap10

Kaap10 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution, @HarshRajSinghania.
The implementation is clean and all test checks have passed. Merging now.

@Kaap10
Kaap10 merged commit 57d2123 into PicadoLabs:main Sep 9, 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.

feat(cli): implement 'terminal-agent clean' command to prune old sessions and checkpoints

2 participants