Skip to content

Add partio clean command to remove stale session state #165

@jcleira

Description

@jcleira

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 clean removes orphaned state files from .partio/state/
  • partio clean --all removes 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

Program file

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions