-
Notifications
You must be signed in to change notification settings - Fork 0
Add partio clean command to remove stale session state #165
Description
Summary
Add a partio clean command that removes orphaned and stale state files from .partio/state/. When git hooks are interrupted (crash during commit, failed amend, aborted operations), pre-commit state files can be left behind. Over time these accumulate and can cause spurious checkpoint creation on the next commit.
Default behavior:
- Remove pre-commit state files left by interrupted hook operations
- Remove session state for sessions that ended but whose state files were not cleaned up
With --all flag:
- Remove all session state files regardless of session status
Why
Partio saves detection state to .partio/state/pre-commit.json before each commit and deletes it in post-commit. If the commit is interrupted before post-commit runs, this file lingers. On the next commit, Partio may pick up the stale state and create an incorrect checkpoint linkage. A partio clean command lets users recover without running partio disable && partio enable.
Source
Inspired by entireio/cli PR #846 which fixed entire clean --all to clean all sessions (not just orphaned ones) — changelog 0.5.3.
Acceptance Criteria
-
partio cleanremoves orphaned state files from.partio/state/ -
partio clean --allremoves all session state files, including idle sessions - Command is idempotent — safe to run when nothing needs cleaning, exits 0
- Command prints a summary of what was removed (or 'nothing to clean')
- Existing active session state is preserved by default