Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CATALOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ plugin manifests and kept in sync by CI — never hand-edit it; the category voc
- [`docs-hygiene`](../plugins/docs-hygiene) — Documentation-hygiene toolkit of six skills: compress (flavor-trim markdown with a semantic-diff safety net), audit-noise (classify markdown noise), extract-ssot (deduplicate repeated content into a single source of truth), audit-encapsulation (detect citations into skill-private surfaces), rename-references (sweep stale references after renames), and audit-derivability (classify whether a whole document earns its existence — could a fresh agent re-derive it from the code?).
- [`code-tidying`](../plugins/code-tidying) — Code tidying and comment hygiene: /code-tidying:tidy proactively hunts a rotated, glob-scoped lane for Beck-style tidyings under a research-backed scope budget and ships one tight PR; /code-tidying:batch-simplify sweeps recently changed files through grouped, dependency-ordered simplification waves with a never-drop deferred-items contract; /code-tidying:audit-comment-residue is a read-only classifier that flags history, plan, conversational, and ticket/PR residue in code comments for author-applied deletion. Project-specific tidy lanes are scaffolded into a tracked .claude/tidy-lanes/ config folder by a re-runnable setup skill.
- [`repo-hygiene`](../plugins/repo-hygiene) — Repo hygiene action-router: /repo-hygiene:clean sweeps reclaimable caches, build artifacts, and stale git metadata, and can realign the working tree to a fresh-pull state — dry-run-first, with destructive tiers gated behind explicit confirmation and a session-scoped destructive-command guard. Ecosystem targets are detected at runtime; secrets, runtime dependencies, and skill data are preserved by default.
- [`repo-fleet-hygiene`](../plugins/repo-fleet-hygiene) — Machine-wide Git/GitHub repository discovery, evidence rollup, and action-plan handoff to the per-repository cleanup owners. The current audit is read-only and confidence-tiered; this plugin never deletes branches or worktrees.
- [`repo-fleet-hygiene`](../plugins/repo-fleet-hygiene) — Machine-wide Git/GitHub repository discovery, evidence rollup, and a gated apply verb that executes a prior fleet action plan behind one confirmation. Audit stays read-only and confidence-tiered; apply mutates only with --apply plus interactive confirmation or --yes.
- [`disk-hygiene`](../plugins/disk-hygiene) — Context-aware disk hygiene for arbitrary directory trees: inventories orphaned and temporary artifacts, classifies evidence into review tiers, and offers exact-path cleanup only after a fresh safety preview and explicit per-tier approval. The target is read-only by default; OS-managed paths, links and mount points, VCS-tracked content without the complete checkout evidence bundle, changed entries, and live-handle uncertainty fail closed.

## Claude Code
Expand Down
1 change: 1 addition & 0 deletions docs/SKILL-CHEAT-SHEET.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ owned by [docs/CATALOG-TAXONOMY.md](CATALOG-TAXONOMY.md).
| [`/claude-ops:morning-brief`](../plugins/claude-ops/skills/morning-brief/SKILL.md) | `claude-ops` | daily | Print the operator's read-only morning view — queues, merge-ready PRs, parked decisions |
| [`/claude-ops:observability`](../plugins/claude-ops/skills/observability/SKILL.md) | `claude-ops` | weekly | Report on locally captured telemetry — token burn, cost, hook latency, trends |
| [`/claude-ops:plugins`](../plugins/claude-ops/skills/plugins/SKILL.md) | `claude-ops` | weekly | Bring the machine's plugin fleet current — refresh, update, install per policy |
| [`/repo-fleet-hygiene:apply`](../plugins/repo-fleet-hygiene/skills/apply/SKILL.md) | `repo-fleet-hygiene` | weekly | Execute a fleet action plan behind one confirmation gate |
| [`/repo-fleet-hygiene:audit`](../plugins/repo-fleet-hygiene/skills/audit/SKILL.md) | `repo-fleet-hygiene` | weekly | Discover a repository fleet and coordinate read-only evidence handoffs |
| [`/source-control:babysit-loop`](../plugins/source-control/skills/babysit-loop/SKILL.md) | `source-control` | continuous | Run one repo's PR queue as a standing merge lane |
| [`/source-control:babysit-prs`](../plugins/source-control/skills/babysit-prs/SKILL.md) | `source-control` | continuous | Tiered fleet pass advancing your open PRs |
Expand Down
4 changes: 2 additions & 2 deletions plugins/repo-fleet-hygiene/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
"name": "repo-fleet-hygiene",
"version": "0.21.1",
"description": "Machine-wide Git/GitHub repository discovery, evidence rollup, and action-plan handoff to the per-repository cleanup owners. The current audit is read-only and confidence-tiered; this plugin never deletes branches or worktrees.",
"version": "0.22.0",
"description": "Machine-wide Git/GitHub repository discovery, evidence rollup, and a gated apply verb that executes a prior fleet action plan behind one confirmation. Audit stays read-only and confidence-tiered; apply mutates only with --apply plus interactive confirmation or --yes.",
"author": {
"name": "Melodic Software",
"email": "info@melodicsoftware.com"
Expand Down
20 changes: 20 additions & 0 deletions plugins/repo-fleet-hygiene/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
All notable changes to `repo-fleet-hygiene` are documented here. Format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning.

## [0.22.0]

### Added

- **`/repo-fleet-hygiene:apply` — execute a prior audit action plan behind one gate (#2597).**
New skill + `apply-plan.sh` consume the machine-readable plan from `:audit` (`--plan-file`).
Default is dry-run with live OID refresh; `--apply` requires interactive confirmation or
`--yes` for non-interactive consent. One confirmation covers the whole fleet plan. Branch
deletes run before worktree cleanups. Mutable tips are re-derived immediately before every
delete; OID drift, missing plan OIDs, protected/current/attached branches, and dirty/unpushed
worktrees skip fail-closed. Batched `merged-local-branch` deletion is owned here so
`audit-fleet.sh` stays read-only (no execute flag on the auditor allowlist) and
`repo-hygiene:clean` keeps its per-branch interactive deletion model.

### Changed

- **Fleet cleanup-plan contract marked shipped.** README epic table and audit skill prose point
operators at `:apply` for execution; audit `--apply-plan` remains the read-only approval
artifact.

## [0.21.1]

### Fixed
Expand Down
53 changes: 30 additions & 23 deletions plugins/repo-fleet-hygiene/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ The currently shipped audit reports:
- linked worktrees that do not conform to the configured worktree root (or placement when unset); and
- GitHub repositories whose configured remote resolves to a different owner or name.

The plugin is deliberately **read-only by default**. The current release is report-only: it never
fetches, prunes, repairs, deletes, checks out, or rewrites anything. Every finding names its evidence,
confidence, disposition, and exact target. Cleanup stays with the existing per-repository
capabilities:
The plugin is deliberately **read-only by default**. `/repo-fleet-hygiene:audit` never fetches,
prunes, repairs, deletes, checks out, or rewrites anything. Every finding names its evidence,
confidence, disposition, and exact target. Fleet-wide mutation is a separate explicit act:
`/repo-fleet-hygiene:apply --plan-file <path> [--apply] [--yes]` consumes the audit's action-plan
JSON behind one confirmation gate (see [Fleet cleanup plan](#fleet-cleanup-plan)). Per-repository
owners remain available for interactive work:

- `/repo-hygiene:clean git` for a local-branch audit and its own confirmation gate;
- `/source-control:worktree cleanup --dry-run` for worktree cleanup planning; and
Expand All @@ -35,7 +37,7 @@ The epic's fleet architecture is intentionally split from the current implementa
| Per-repository worktree status, stranded-work classification, and cleanup | `/source-control:worktree` | Delegated; fleet-local reclaimability was retired in [#2605](https://github.com/melodic-software/claude-code-plugins/issues/2605) |
| Per-repository branch, cache, build, and deletion triage | `/repo-hygiene:clean` | Delegated |
| Per-repository verdicts, target deduplication, and a machine-readable rollup artifact | `repo-fleet-hygiene` | Shipped in [#2644](https://github.com/melodic-software/claude-code-plugins/pull/2644) / [#2608](https://github.com/melodic-software/claude-code-plugins/issues/2608) |
| One fleet cleanup-plan handoff consuming that artifact | `repo-fleet-hygiene` plus the per-repo owners | Plan artifact shipped in [#2644](https://github.com/melodic-software/claude-code-plugins/pull/2644) / [#2609](https://github.com/melodic-software/claude-code-plugins/issues/2609); execute consumer still deferred |
| One fleet cleanup-plan handoff consuming that artifact | `repo-fleet-hygiene:apply` (owns batched merged-local-branch deletion; worktree cleanup in plan order) | Shipped in 0.22.0 / [#2597](https://github.com/melodic-software/claude-code-plugins/issues/2597); plan artifact from [#2644](https://github.com/melodic-software/claude-code-plugins/pull/2644) / [#2609](https://github.com/melodic-software/claude-code-plugins/issues/2609) |
| Conformance against the configured worktree root | `repo-fleet-hygiene`, reading the convention owned by `source-control` | Shipped in [#2651](https://github.com/melodic-software/claude-code-plugins/pull/2651) / [#2606](https://github.com/melodic-software/claude-code-plugins/issues/2606) |
| Complete exact branch merge evidence via GraphQL | `repo-fleet-hygiene` | Shipped in [#2642](https://github.com/melodic-software/claude-code-plugins/pull/2642) / [#2604](https://github.com/melodic-software/claude-code-plugins/issues/2604) |
| Merged remote-branch reporting and its separate safety gate | `repo-fleet-hygiene` | Tracked by [#2607](https://github.com/melodic-software/claude-code-plugins/issues/2607); follow-up PR [#2645](https://github.com/melodic-software/claude-code-plugins/pull/2645) |
Expand All @@ -48,7 +50,8 @@ report and exact per-repository handoffs.

| Skill | Purpose |
|---|---|
| `/repo-fleet-hygiene:audit` | Scan one repository, explicit repositories, or repository-tree roots and render a fleet report |
| `/repo-fleet-hygiene:audit` | Scan one repository, explicit repositories, or repository-tree roots and render a fleet report (read-only; writes an action-plan JSON) |
| `/repo-fleet-hygiene:apply` | Dry-run or apply a prior action-plan JSON behind one fleet confirmation (`--apply` + confirm / `--yes`) |
| `/repo-fleet-hygiene:setup` | `check` inspects the optional tracked fleet configuration read-only; `apply` creates or updates it without touching user settings |

## Quick start
Expand Down Expand Up @@ -79,23 +82,27 @@ additive.

## Fleet cleanup plan

The fleet cleanup-plan contract consumes the machine-readable rollup artifact defined by
[#2608](https://github.com/melodic-software/claude-code-plugins/issues/2608); it must never scrape the
human report. The consumer defined by
[#2609](https://github.com/melodic-software/claude-code-plugins/issues/2609) will:

1. validate that the artifact came from a completed fleet audit and preserve repository-qualified
targets, evidence, confidence, and evidence gaps;
2. group approved work by canonical repository and route each action to `/repo-hygiene:clean` or
`/source-control:worktree`, rather than duplicating either skill's per-repository verdict;
3. show one fleet action plan and require one explicit confirmation before any mutation; and
4. re-derive mutable facts such as branch and worktree OIDs at execution time rather than treating
the artifact as fresh authorization.

Neither the rollup artifact nor its consumer is present in this release. Do not invent a
`cleanup-plan`, `execute`, or auto-delete command, and do not interpret a `HIGH` finding as permission
to remove a branch or worktree. Until #2608 and #2609 ship, use the exact per-repository handoffs in
the report, each receiving tool's preview, and its own confirmation gate.
`/repo-fleet-hygiene:apply` consumes the machine-readable action-plan JSON from
[#2608](https://github.com/melodic-software/claude-code-plugins/issues/2608) /
[#2609](https://github.com/melodic-software/claude-code-plugins/issues/2609); it never scrapes the
human report.

```text
/repo-fleet-hygiene:apply --plan-file <path-from-audit>
/repo-fleet-hygiene:apply --plan-file <path-from-audit> --apply
/repo-fleet-hygiene:apply --plan-file <path-from-audit> --apply --yes
```

The apply verb:

1. validates `schema_version: 1` and preserves repository-qualified targets;
2. owns batched `merged-local-branch` deletion (repo-hygiene branch deletion stays interactive) and
cleans merged/prunable/missing worktrees in the plan's declared order;
3. shows one fleet plan and requires one explicit confirmation (or `--yes`) before any mutation; and
4. re-derives mutable branch/worktree OIDs at execution time — tip drift skips fail-closed.

Audit remains read-only. A `HIGH` finding is never itself permission to delete; only `:apply
--apply` after confirmation (or `--yes`) mutates. Do not add an execute flag to `audit-fleet.sh`.

## Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set -uo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 1

SKILLS=(audit)
SKILLS=(audit apply)

# Optional per-skill allowlist, space-separated and sorted. When a skill names
# one, the granted set must equal it EXACTLY — this is the guard for a
Expand Down
75 changes: 75 additions & 0 deletions plugins/repo-fleet-hygiene/skills/apply/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
description: "Apply a prior /repo-fleet-hygiene:audit action-plan JSON behind one fleet confirmation: default dry-run re-derives branch/worktree tips and prints the ordered batch; --apply mutates only after interactive confirmation or --yes. Owns batched merged-local-branch deletion with fail-closed OID refresh; cleans merged/prunable/missing worktrees in plan order (branches before worktrees). Use when: 'apply fleet plan', 'execute fleet cleanup', 'batch delete merged branches', 'one confirmation for fleet cleanup'."
user-invocable: true
disable-model-invocation: true
argument-hint: "--plan-file <path> [--apply] [--yes]"
allowed-tools:
- Bash(${CLAUDE_SKILL_DIR}/scripts/apply-plan.sh:*)
metadata:
workflow-stage: operator
summary: Execute a fleet action plan behind one confirmation gate
cadence: weekly
---

## Purpose

Consume the machine-readable action-plan JSON emitted by `/repo-fleet-hygiene:audit` and drive
cleanup for N repositories behind **one** confirmation gate. This is the executing verb for the
fleet cleanup contract (#2597 / #2609). It is a separate skill from `:audit` on purpose: the audit's
`allowed-tools` grant matches any argv on `audit-fleet.sh`, so an execute flag there would widen
mutation authority silently.

Default is **dry-run** (evidence refresh + ordered preview, no mutation). Execution requires an
explicit `--apply`, then interactive confirmation **or** `--yes` for non-interactive consent.

## Non-negotiable boundary

- Never run without `--plan-file` pointing at a prior audit plan (`schema_version: 1`).
- Never treat plan tips as authorization — re-derive every mutable OID immediately before delete.
- Skip fail-closed on OID drift, missing plan OID, protected/current/worktree-attached branches,
locked or stranded worktrees, or unknown operations.
- Own batched `merged-local-branch` deletion here (repo-hygiene branch deletion stays interactive /
per-repo and is not batched).
- Order: `delete-merged-local-branches` before `cleanup-worktrees`.

## Arguments

Parse `$ARGUMENTS` and pass them through to the bundled script. Supported flags:

- `--plan-file <path>` (required): action-plan JSON from a prior audit (`--plan-file` on audit, or
the temp path named in the audit report).
- `--apply`: opt into mutation after the batch confirmation gate.
- `--yes` / `-y`: skip the interactive prompt (required for non-interactive `--apply`).

Reject any other flag. Run exactly once:

```bash
${CLAUDE_SKILL_DIR}/scripts/apply-plan.sh <validated-and-quoted-arguments>
```

## Confirmation gate

| Session | Flags | Behavior |
|---|---|---|
| Any | (default / no `--apply`) | Dry-run preview only |
| Interactive tty | `--apply` | Prompt once for the whole plan; decline → mutate nothing |
| Interactive tty | `--apply --yes` | Apply without prompt |
| Non-interactive | `--apply` without `--yes` | Print plan, stop (exit 3), mutate nothing |
| Non-interactive | `--apply --yes` | Apply |

One gate covers every repository and every operation in the plan.

## What this skill does NOT do

- Re-run fleet discovery or GitHub evidence collection — that is `/repo-fleet-hygiene:audit`.
- Add execution flags to `audit-fleet.sh`.
- Batch-delete via `/repo-hygiene:clean git` (that skill refuses to batch branch deletion).
- Remove stranded/dirty/locked worktrees, or act on tip-drift / manual-review findings.
- Change GitHub `delete_branch_on_merge` or delete remote branches.

## Workflow

1. Operator runs `/repo-fleet-hygiene:audit … --plan-file <path>` (or takes the path from the report).
2. Review the plan: `${CLAUDE_SKILL_DIR}/scripts/apply-plan.sh --plan-file <path>`
3. Apply once: add `--apply` (interactive) or `--apply --yes` (headless).
4. Report applied / skipped / failed counts; skips name the fail-closed reason (OID drift, etc.).
Loading