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

Closed

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.

Activity

  1. added
    needs-triage
    on Aug 14, 2026
  2. added 12 commits that reference this issue on Aug 14, 2026
    c2ae30a
    14346a3
    bfd2eca
    0a60b8b
    d200f35
    5233485
    0e667b8
    581b143
    7367a88
    abcd076
    77214ab
    5a2e8e3
  3. kyle-sexton commented on Aug 15, 2026

    @kyle-sexton
    MemberAuthor

    Reopening — the bare-path half landed; the machine-wide half did not, and the skill layer was reverted eight minutes later

    PR #2638 (b7e56070) landed the parsing work and it is good: normalize_discovery_root() maps D: → D:/, the positional *) arm accepts a bare path while -*) still hard-rejects, and an empty discovery root now reports zero repositories instead of erroring. A genuine bug was caught and fixed before merge — a symlinked or unreadable root would otherwise have reported a false clean empty audit.

    Two acceptance criteria remain unmet, and one landed change was undone by a later PR.

    Criterion 2 is not met

    audit with no argument audits the machine rather than failing on the project directory

    What shipped stops failing on the project directory and starts failing outright: audit-fleet.sh:1069 — fail "no scope resolved: no bare path, --root, or --repo, and no config-supplied fleet.root/fleet.repo". Without config, a bare audit still hard-fails. The failure moved; it did not become machine-wide discovery.

    The discovery ladder was never implemented

    grep -n "ghq\|claude\.json" over the landed script returns nothing. Only rung 2 (configured fleet.root / fleet.repo) exists. Rung 1 (ghq list --full-path), rung 3 (the ~/.claude.json project list), and rung 4 (bounded FS sweep) are absent.

    Canonical-main deduplication — which the issue called "not optional" — was already present and survives.

    PR #2646 reverted the skill layer eight minutes after #2638 landed

    Both are on main. The script keeps #2638's behaviour; skills/audit/SKILL.md was reverted to pre-#2638 text:

    Script (actual) SKILL.md (documented)
    :484 bare positional accepted :4 argument-hint no longer lists a positional form; the - <dir>: bare positional path bullet deleted
    :1069 hard-fails with a scope remedy :59 still says the project directory is used as an exact --repo target
    project dir is a config rung only :46 still calls --project-dir "the no-scope fallback target"
    — :77 "reject any arguments outside this grammar" — and bare paths are no longer in the enumerated grammar

    The skill body now instructs an agent to reject audit D: — the exact invocation this issue exists to enable — while the bundled script accepts it. It is an instruction-layer regression rather than a hard parser gate, but the documented contract and the implemented contract contradict each other.

    Also reverted and still live: SKILL.md no longer documents bare-repo-with-working-tree (shipped by #2633 for #2602) — git grep -c on main returns 0.

    Nothing caught it. scripts/docs-only-paths.txt holds exactly one prefix (docs/topics/), so plugin-gate ran the full suite on #2646 — there is simply no assertion tying SKILL.md prose to script behaviour. All 38 checks were green.

    Remaining work

    1. Restore SKILL.md: argument-hint, the bare-path bullet, the --project-dir description, the no-scope paragraph at :59, the in-grammar clause at :77, and the bare-repo-with-working-tree bullet.
    2. Implement the discovery ladder, or amend this issue to drop it explicitly rather than leaving it silently unbuilt.
    3. Add a gate tying the documented grammar to the actual argument parser — this class passed 38 green checks.

    Two process notes

    Semver. A change whose own CHANGELOG entry calls it a "breaking change for bare /repo-fleet-hygiene:audit invocations" shipped as 0.19.0 → 0.19.1, a patch bump, in a plugin whose CHANGELOG header declares semantic versioning.

    Windows CI. plugin-gate runs scripts/run-plugin-tests.sh on ubuntu-24.04 only; the sole Windows job runs lib/hook-utils.test.sh. A PR entirely about Windows drive roots had zero Windows CI, and its new chmod a-rx unreadable-root test is specifically unreliable under Git Bash ACL emulation — never exercised there.

  4. kyle-sexton commented on Aug 15, 2026

    @kyle-sexton
    MemberAuthor

    Shipped on main via #2638 (repo-fleet-hygiene 0.19.1 bare-path/drive-root grammar and no-argument scope hard-fail).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Fields

    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