Skip to content

feat(cli): add zeph project purge command for full project state cleanup#3598

Merged
bug-ops merged 1 commit intomainfrom
project-purge
May 5, 2026
Merged

feat(cli): add zeph project purge command for full project state cleanup#3598
bug-ops merged 1 commit intomainfrom
project-purge

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 5, 2026

Summary

  • Adds zeph project purge [--config <path>] [--dry-run] [-y] CLI command that removes all project-local state in a single operation
  • Pre-flight exclusive lock check (fails if agent is running — --yes does not bypass safety)
  • Removes SQLite DB + WAL/SHM, log files, debug artifacts, trace files, audit log, and all 10 Qdrant collections concurrently
  • --dry-run reports byte counts per category without deleting
  • VectorBackend guard: skips Qdrant when vector_backend = sqlite; PostgreSQL guard: skips SQLite file deletion when database_url is postgres://

Changes

  • src/cli.rsCommand::Project { command: ProjectCommand } + ProjectCommand::Purge
  • src/commands/project.rs — new: PurgeEngine, PurgeReport, PurgeCategory, PurgeItem, all purge steps, 14 unit tests
  • src/commands/mod.rs — expose mod project
  • src/runner.rs — dispatch arm for Command::Project
  • CHANGELOG.md[Unreleased] entry

Test Plan

  • cargo nextest run --workspace --lib --bins -E 'test(purge)' → 14/14 pass
  • cargo +nightly fmt --check → clean
  • cargo clippy --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler" -- -D warnings → clean
  • Live test: zeph project purge --dry-run → verify byte-count report, no deletions
  • Live test: zeph project purge -y → verify SQLite + artifacts removed
  • Live test: purge while agent running → verify lock check aborts with clear error
  • See .local/testing/playbooks/project-purge.md for full scenario matrix

Closes #3573

…eanup

Adds `zeph project purge [--config <path>] [--dry-run] [-y]` that removes
all project-local state in a single operation:

- Pre-flight exclusive lock check on SQLite DB (aborts if agent is running)
- SQLite database file + WAL/SHM siblings (OsString-safe path composition)
- Log files: main log + rotated siblings, scheduler daemon log + PID file
- Debug artifacts directory and trace files directory
- Audit log file (when configured as a file path)
- All 10 known Qdrant collections, deleted concurrently via buffer_unordered(10)
- VectorBackend guard: skips Qdrant step when vector_backend = sqlite
- PostgreSQL guard: skips SQLite file deletion when database_url is postgres://

--dry-run lists byte counts per category without deleting.
-y skips the confirmation prompt but never bypasses the DB lock safety check.

Closes #3573
@github-actions github-actions Bot added enhancement New feature or request size/XL Extra large PR (500+ lines) documentation Improvements or additions to documentation labels May 5, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 5, 2026 14:40
@bug-ops bug-ops merged commit a030b2a into main May 5, 2026
57 of 59 checks passed
@bug-ops bug-ops deleted the project-purge branch May 5, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

research(ux): Claude Code project state management — project purge pattern for full project-scoped state lifecycle

1 participant