Skip to content

feat(repo-hygiene): add --owner and cite the target-scope contract for repository selection - #17360

Merged
melodic-automation-lanes[bot] merged 7 commits into
mainfrom
work-resolve-issue/issue-17247-44447272674-1
Nov 19, 2026
Merged

melodic-automation-lanes[bot] merged 7 commits into
mainfrom
work-resolve-issue/issue-17247-44447272674-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #17247

Summary

Opened by the work-resolve-issue lane. The run's own summary:

clean-batch.sh gains --owner &lt;owner&gt; (repeatable): it keeps the --fleet discovery repos (ghq list -p plus the chezmoi source) whose origin is <host>/<owner>/<name>, case-insensitive on github.com as batch_remote_key already folds that host, and turns on the same clone dedupe as --fleet, matching the contract's 'two clones of one origin count once'. The clean SKILL.md §8 now cites the plugin-shipped copy of the target-scope contract as the owner of the repository-selection words and states only what differs here (--repo/--repos-from take local paths, not owner/name, and alone keep every clone); argument-hint shows \[--repo &lt;repo&gt; ...\]. With no repository flag nothing changes: the single-repo tiers and the existing flags are untouched. Eval case whose run reads the changed text: clean-scan-batch-read-only (routes a batch scan through §8); no eval case exercises --owner itself.

Not verified

  • clean-batch.test.sh was not run here: the lane allows only the named wrappers, and check-affected did not report running the repo-hygiene script suites; left to the PR's CI. The reviewer traced the new assertions against the fixtures and found they hold.
  • docs/skill-cheat-sheet.md was edited by hand rather than regenerated with node scripts/generate-cheatsheet.mjs (no interpreter allowed in this lane); the row matches the new argument-hint and the coupling/improvement rows' format, and CI's generator check confirms it.
  • Tidy skipped: the change touches 16 files (cutoff 10) and the shared path scripts/shared-copies.txt.
  • Review finding not fixed: on bash 4.3, an empty array expanded under set -u in batch_discover_owner aborts instead of exiting 2; the same pattern predates this change (batch_dedupe_clones), and bash 4.4+ is unaffected.
  • --owner is added only to clean-batch.sh (the §8 forms). tree-batch and the branch and stash audits keep their --repo/--repos-from/--skip selection, as the issue's table names only the §8 line.
  • comment-hygiene, typos and size-check could not run here (network fetch blocked, tool not installed, script absent); left to the PR's CI.

Fix

  • plugins/repo-hygiene/skills/clean/scripts/lib/batch-common.sh: new batch_discover_owner filters fleet discovery by origin owner (no-origin and host-less local origins never match)
  • plugins/repo-hygiene/skills/clean/scripts/clean-batch.sh: parse --owner (requires a value, sets clone dedupe), usage/help text, no-repos error message
  • plugins/repo-hygiene/skills/clean/scripts/clean-batch.test.sh: --owner tests (owner match case-insensitive, other owner and no-origin repos dropped, clone dedupe, scan tier, no-match and missing-value exit 2)
  • plugins/repo-hygiene/skills/clean/SKILL.md: argument-hint and Arguments line add [--repo <repo> ...]; §8 Repo sources adds --owner and cites the target-scope contract, naming what differs
  • plugins/repo-hygiene/skills/clean/context/clean-batch.md: --owner in the script synopsis, the Repo sources table and the clone-dedupe paragraph
  • plugins/repo-hygiene/reference/target-scope.md: new generated copy of the contract (sync-shared-copies.sh)
  • scripts/shared-copies.txt: registers the repo-hygiene copy (scripts/cross-plugin-source-registry.txt already covers plugins/*/reference/target-scope.md by glob, so it needed no edit)
  • docs/contracts/target-scope/README.md: Adopters table lists /repo-hygiene:clean (batch forms)
  • plugins/architecture/reference/target-scope.md, plugins/coupling/reference/target-scope.md, plugins/improvement/reference/target-scope.md: regenerated copies (new Adopters row)
  • docs/skill-cheat-sheet.md: /repo-hygiene:clean argument-hint column updated by hand to the new frontmatter value
  • .changes/repo-hygiene/work-resolve-issue-issue-17247-44447272674-1-13b8814f.md: minor fragment for --owner and the contract citation
  • .changes/architecture/, .changes/coupling/, .changes/improvement/ work-resolve-issue-issue-17247-* fragments: patch fragments for the regenerated shipped copy

Verification

The runner ran each check from the base copy against dd99e72:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • sync-shared-copies --check: all 967 registered copies match their canonical sources
  • check-changelog-fragments: all 8 fragments valid
  • check-changed-skills: CHECK-SKILL clean PASS, 0 errors, 4 pre-existing size/gotchas warnings
  • check-affected: 15 passed, 8 skipped (typos not installed, comment-hygiene fetch blocked, size-check script absent, validate-plugins sub-checks and changed-skills that run checked-tree code), 0 failed
  • fresh-context review subagent over the whole diff: no high findings; fixed the medium (SKILL §8 deferred to the contract without naming that --repo/--repos-from take paths, not owner/name) and lows (clone-keeping wording when combined with --owner/--fleet, host-less local origins matching --owner,…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/44447272674

Left out: the items under Not verified.

Related

#17247

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44450012013

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 5227ae991c3528cb448653043f4b0505bc72d358. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

a pr-unblock lane stopped its head (pr-unblock/conflict is failure), which clears when the lane runs
  again

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/fix-ci
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44456349665

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed fd6b043
Run 44456349665

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg base
Run job success
Activity step skipped
Commits pushed none (read lane)
Run 44457329831

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44461501381

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

Lane-Activity: pr-unblock/resolve-conflicts
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed b3d2fac
Run 44461501381

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4bfd3df2f72a69bde60b68c624e5b5e424f4edac: read 10 of 10 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17360 at 4bfd3df

No security issues found. This lane already reviewed an earlier head (blocking only: yes), so this review reports only CRITICAL and IMPORTANT findings. There are none.

What I checked

  • The new --owner flag (clean-batch.sh and batch_discover_owner):
    • The owner value is only compared as a string against batch_remote_key output. It never reaches a command line, a path or eval.
    • The flag refuses an empty value or one that starts with -, and exits 2.
    • The nameref target is always the fixed caller array REPO_INPUTS.
    • --owner can only narrow the set --fleet already discovers, so it reaches no repository that --fleet could not, and it runs the same clone dedupe.
    • Destructive tiers still go through the unchanged dry-run plan, the single confirmation gate and CLEAN_GUARD_ACK=1 … --apply --batch-plan. Each child script keeps its own gates.
  • Skill instructions (SKILL.md, context/clean-batch.md):
    • The changes add an argument-hint suffix and the --owner prose, and cite the target-scope contract.
    • allowed-tools is unchanged.
    • No guardrail is deleted, narrowed or softened: the confirmation gate, "Autonomous sessions: abort" and "deletion stays one repo, one gate" are all intact.
    • The removed clean-batch.sh header comments restated the usage text and the old dedupe scope. They are code comments, not standing instructions.
  • Docs and registry changes: the generated reference/target-scope.md copy, the adopters.md row, the cheat-sheet row, the changelog fragment and the shared-copies.txt line. None of them runs code.
  • Trusted paths: no changed file matches a trusted-path glob. No trust control, merge hold, token scope or kill switch is touched.
  • Plugin manifests: none changed, so there is no manifest block.
  • PR context: it holds no embedded instructions aimed at this lane.
  • Settled threads: both are about shared-copy sync and changelog-fragment coverage, not security. Nothing to raise again.
  • Prior findings: the only earlier post is a summary with no findings, so nothing carries over.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on b3d2fac1280a3a5e4a5dc0441e8ec91ba4652da0; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 4bfd3df2f72a69bde60b68c624e5b5e424f4edac: read 10 of 10 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #17360 at 4bfd3df2 (blocking findings only)

I found nothing blocking at this head. This lane has already reviewed three earlier heads, so this pass reports blocking findings only.

What I checked at this head. This head merges main into the branch after #17295. I read every hunk of all 10 changed files in the full diff.

  • Shipped copy. plugins/repo-hygiene/reference/target-scope.md has the 3-line generated header. Its lines 4–118 match all 115 lines of docs/contracts/target-scope/README.md at this head, line for line. I compared them by reading both files; I did not run sync-shared-copies.sh --check.
  • Adopters table. docs/contracts/target-scope/adopters.md now lists /repo-hygiene:clean (batch forms). It sits after main's new /code-metrics:* row. No plugin-shipped copy changes, so no other plugin needs a changelog fragment.
  • batch_discover_owner. It filters fleet discovery by the owner part of batch_remote_key. On github.com it lowercases the owner, the same way the key is already folded. It skips entries with no origin or no host.
  • --owner flag. It sets FLEET=1, so clone dedupe runs in both the scan path and the dry-run path. It exits 2 when no value is given.
  • Tests. I traced the new --owner assertions against the fleet fixtures in clean-batch.test.sh: FL_A, FL_B, FL_CLONE, the chezmoi source, and an other-owner repo and a no-origin repo. The expected counts hold, including repos=3. I did not run the suite; the PR leaves that to CI.
  • Removed header block. The PR deletes the # Usage: comment block in clean-batch.sh. Nothing reads it, and the usage() help text still documents every flag, --owner included.

Closing issue #17247. These "Done when" items are met in the diff:

  • The argument-hint shows [--repo <repo> ...].
  • SKILL.md §8 cites the contract.
  • Runs with no target form are unchanged.
  • The shipped copy is registered in scripts/shared-copies.txt.
  • The Adopters row is added.
  • A .changes/repo-hygiene/ fragment is added.
  • The PR body names an eval case.

The cheat-sheet row was edited by hand and matches the new argument-hint. That it matches the generator's output is the author's claim, which I did not verify.

Earlier threads. The two settled threads (the out-of-sync copy and the missing docs-naming fragment) no longer apply at this head, and I am not raising them again.

Loosened-check verdict: fail. That is the default, because the prompt has no loosened_check_verdict: or loosened_check_patterns: lines; patterns: 0. No check is loosened in this diff. The prompt has no decision-record line, so I did not check the citation requirement.

The PR changes no plugin manifests. The PR context, settled threads and prior findings contain no instructions aimed at this lane.

Verifier dropped 0 of 0 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44462952840

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-feedback-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 3d7574e
Run 44462952840

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 3d7574e.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44462952840

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 3d7574e4f29cee1e9edfc67b683608e6f3aaa53c; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44464616759

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 2 of max 4 on 3d7574e.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44464616759

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/fix-ci
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44468241017

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 5227ae9
Run 44468241017

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 19, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped address-feedback on this pull request: the pull request has an unresolved review thread the lane does not take (a reviewer it does not act on, a review of an older head, or a thread it already answered), so no lane resolves it and a session builder takes it. The lane labels it needs-session for a session builder, who makes the change this lane cannot, and the run ends in a failing pr-unblock/address-feedback status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=17360 -f activity=address-feedback

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/report-escalation
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44469617768

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 19, 2026
@kyle-sexton

Copy link
Copy Markdown
Member

A session is reworking this PR: the fix-ci lane already added the .changes/docs-naming/ patch fragment at 5227ae9 and the branch merges cleanly, and the session is settling the two review threads the address-feedback lane left open (both fixed at this head). The session set the do-not-merge label for the rework and removes it when done.

@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 19, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 5227ae991c3528cb448653043f4b0505bc72d358, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=5227ae991c3528cb448653043f4b0505bc72d358 rubric=10.4.0 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 19, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 19, 2026
@melodic-automation-lanes melodic-automation-lanes Bot removed the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44488034971

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44488034971

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/report-escalation
Model rung 0
Leg base
Run job failure
Activity step skipped
Commits pushed none recorded
Run 44488034971

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44503908592

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44503908592

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped resolve-conflicts on this pull request: the lane could not resolve every conflict. The lane sets no label: the run ends in a failing pr-unblock/conflict status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=17360 -f activity=resolve-conflicts

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/report-escalation
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44503908592

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

kyle-sexton and others added 2 commits November 19, 2026 09:55
Main (#17398) moved the target-scope Adopters table into
docs/contracts/target-scope/adopters.md. The repo-hygiene:clean row lands
there; the README and every plugin copy take main's text, the
repo-hygiene copy is regenerated to match, and the four fragments that
announced the other plugins' copy edits are dropped since those copies
no longer change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 4bfd3df2f72a69bde60b68c624e5b5e424f4edac, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=4bfd3df2f72a69bde60b68c624e5b5e424f4edac rubric=10.4.0 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 7ed4522 Nov 19, 2026
53 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-17247-44447272674-1 branch November 19, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(repo-hygiene): add --owner and cite the target-scope contract for repository selection

1 participant