Skip to content

Add repo-specific worktree artifact cleanup profiles #145

@chubes4

Description

@chubes4

Problem

Some repos are much more expensive per worktree than others. In the 2026-04-29 incident, homeboy@* worktrees were typically 2.5 GiB to 3.2 GiB each because Rust build artifacts live under target/. A few were larger than 6 GiB or 8 GiB.

Deleting old worktrees is the best cleanup, but DMC should also understand repo-specific build artifact profiles so it can explain and optionally reclaim large non-source directories safely.

Proposed solution

Add repo cleanup profiles to DMC workspace hygiene.

Examples:

  • Rust/Homeboy: target/, possibly benchmark output dirs.
  • Node repos: node_modules/, .next/, dist/, build caches when safe.
  • WordPress/PHP repos: vendor/ only if composer can restore it and the worktree is not active.

The MVP can be conservative: report artifact sizes first, then add opt-in cleanup actions.

CLI behavior

Examples:

wp datamachine-code workspace worktree artifacts --format=json
wp datamachine-code workspace worktree cleanup --dry-run --include-artifacts
wp datamachine-code workspace worktree cleanup-artifacts --repo=homeboy --older-than=7d

Safety requirements

  • Do not delete source files.
  • Do not delete artifacts in dirty worktrees unless explicitly requested.
  • Do not touch active Studio plugin/theme symlink targets.
  • Artifact cleanup should be separate from worktree removal in output and stats.

Acceptance criteria

  • DMC can report artifact size by worktree and by repo.
  • Rust target/ directories are detected and summarized.
  • Human output explains that removing the whole clean worktree is usually better than artifact-only cleanup.
  • Any artifact deletion is opt-in and dry-run-able.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions