Skip to content

repo-fleet-hygiene: a bare path and a drive root are outside the flag grammar, and no-argument scope is the project directory rather than the machine #2599

Description

@kyle-sexton

Context: #2597

Problem

The skill's argument grammar accepts only --root, --repo, --config, --canonical, --max-depth, and --project-dir, and instructs the caller to reject anything outside it. A bare path — the most natural thing an operator types — is therefore invalid.

Separately, the no-scope default is close to the opposite of what an operator expects from a fleet tool: it uses the project directory as an exact --repo target and hard-fails when that directory is not a working tree. A machine-wide audit is the expected default for a plugin whose purpose is machine-wide hygiene.

Evidence

The invocation /repo-fleet-hygiene:audit D: is outside the grammar. Interpreting it required a judgement call by the caller, and the interpretation chosen (--root "D:/") then hit the abort described in the separate discovery issue.

Operator intent for a bare drive letter is unambiguous: "every repository on this drive." A drive root is also self-evidently not a repository, so failing on that basis reads as pedantry rather than safety.

Proposed change

Accept three levels of granularity:

  • no argument → machine-wide discovery
  • a drive or directory → that volume or tree
  • a repository path → that repository

Concretely:

  • A bare positional path is treated as --root; if it is itself a Git working tree, as --repo.
  • Keep reject-on-unknown for anything beginning with -, which is where the injection concern actually lives.
  • A drive root is a legitimate discovery root. If it genuinely contains no repositories, that is a finding ("0 repositories found under D:/"), not an error.

For the machine-wide default, compose cheap authoritative sources before any filesystem sweep:

Rung Source Cost
1 ghq list --full-path instant
2 configured roots (worktree_root, fleet.root, fleet.repo) instant
3 known agent state (project list in ~/.claude.json, tool worktree roots) instant
4 bounded filesystem sweep of fixed drives plus the home directory, with the exclusion list slow — opt-in or cached

Then resolve every hit to its canonical main worktree and deduplicate. That step is not optional: ghq list reports each worktree as a repository of its own, so rung 1 alone is actively misleading.

On the fleet this was measured against, rungs 1–3 would have found every repository, including the one outside ghq root (a chezmoi source checkout in the home directory).

Acceptance criteria

  • audit D: and audit /path/to/tree both work without flags.
  • audit with no argument audits the machine rather than failing on the project directory.
  • A drive root containing no repositories reports zero found rather than erroring.
  • Discovery output distinguishes canonical repositories from linked worktrees, and the count reported is of repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions