Skip to content

refactor(scripts): simplify six hygiene and check scripts - #14586

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14350-42612623801-1
Nov 9, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14350-42612623801-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #14350

Summary

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

Simplified six of the seven listed scripts without changing their behavior. aggregate-hygiene-results.sh now has one tail_lines helper for the HYGIENE_TAIL_LINES check that was written twice. check-affected.sh records a failure through one fail_check helper, which replaces two copies of the same FAIL block. The other four scripts lose small bits of extra code: a counter that copied an array's length, a join loop, a cut subprocess run per line, and a redundant -d test. cheatsheet-config.mjs is left unchanged: it is mostly data plus one tight guard function, and no change I considered made it shorter without making it less clear.

Not verified

  • The scripts' own test suites (scripts/aggregate-hygiene-results.sh --self-test, ai-slop-report.test.sh, check-adr-numbers.test.sh, check-affected.test.sh, check-all-skills-verb-contract.test.sh, check-app-key-references.test.sh, check-script-contract.test.sh) were not run: this lane runs only its…
  • ci-status green is a PR CI check; left to the PR's CI.
  • Tidy not run: every changed file is under scripts/, a shared path the tidy cutoffs exclude.
  • scripts/cheatsheet-config.mjs left unchanged: it is mostly data plus one tight guard function, and no reuse, simplification or efficiency fix I found made it clearer.
  • Build/test step: these are bash scripts with no build, and their test suites could not be executed here (see the first item).

Fix

  • scripts/aggregate-hygiene-results.sh: added tail_lines() for the HYGIENE_TAIL_LINES default and validation that tail_of and gate_annotations each repeated; merged aggregate_results' nine local lines into two; the blank-record skip is now a one-line guard.
  • scripts/ai-slop-report.sh: finish() drops the -d test, since rm -rf on a missing path is silent and WORKDIR only comes from mktemp -d; the two awk gsub lines are joined onto one.
  • scripts/check-adr-numbers.sh: the offender file list is joined with printf -v and a suffix trim instead of a loop.
  • scripts/check-affected.sh: added fail_check(), which replaces the duplicated FAIL-record block in run_check and the npm-deps branch (same text written to the same file); removed the '-h | --help) usage' case arm, which did the same as the '*) usage' arm under it.
  • scripts/check-all-skills-verb-contract.sh: dropped the bad counter in favor of ${#hits[]}, which holds the same count.
  • scripts/check-app-key-references.sh: the path:line prefix now comes from parameter expansion instead of one cut subprocess per hit; it gives the same result for every line shape, including a line with no colon.

Verification

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

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

The run reports:

  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: 10 passed, 6 skipped over 6 changed files (shellcheck, shell-portability, exec-bit, changelog-fragments and comment-hygiene among the passes; typos skipped because it is not installed)
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changelog-fragments: all 7 fragments valid; no fragment needed, since no plugin changed
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changed-skills: no changed skills, nothing to gate
  • Fresh-context review subagent compared each hunk with the old code for behavior differences: one difference, for a file name containing a newline in check-app-key-references.sh; fixed by switching to parameter expansion that matches cut on that input; no other difference found
  • grep of scripts/check-affected-gates.test.sh: it requires a 'run_check <name> ' line for each gate row; those lines are unchanged and npm-deps never went through run_check
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42612623801

Left out: the items under Not verified.

Related

#14350

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14586 (head e9dcb48)

I found no security issues.

Scope. I read every hunk of all six changed files. None of them matches a trusted-path glob, and none is a trust control, merge hold, plugin manifest or standing instruction.

  • scripts/aggregate-hygiene-results.sh: the new tail_lines() helper keeps the same positive-integer check on HYGIENE_TAIL_LINES, with a fallback of 10, and its quoted output goes into tail/head -n. Nothing new can be injected. The local merges and the blank-record guard don't change behavior, and a named empty outcome still fails.
  • scripts/ai-slop-report.sh: finish() no longer runs a -d test before rm -rf "$WORKDIR". The empty-string guard is still there, and WORKDIR is set only by mktemp -d, so the delete can't reach a different path. The % escaping of rule and excerpt for the ::warning workflow command is the same, just on one line.
  • scripts/check-adr-numbers.sh: switching to printf -v and a suffix trim changes only how the message is built. The offender check is the same.
  • scripts/check-affected.sh: fail_check() writes the same FAIL record that the two inline blocks wrote, and it still adds to failed in both places. Removing the -h | --help arm changes nothing, because *) usage handles those flags the same way.
  • scripts/check-all-skills-verb-contract.sh: the failure count now comes from ${#hits[@]}, and any hit still exits 1.
  • scripts/check-app-key-references.sh: this check guards against references to the lanes App key. The change only affects how the path:line prefix is printed. The [[ -n "$hits" ]] → exit 1 path is unchanged, so the guard catches exactly what it caught before.

PR context. The description and the closing-issue section contain no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14586, simplify six hygiene and check scripts

I read every hunk in all 6 changed files, plus the unchanged code each changed line depends on. I found nothing to block or flag.

What I checked (by reading the code; I ran nothing)

  • scripts/aggregate-hygiene-results.sh: tail_lines() repeats the old HYGIENE_TAIL_LINES default and check exactly. n was dropped from gate_annotations' locals, and nothing else reads it. $(tail_lines) sits in head's arguments, which leaves PIPESTATUS[0] (from jq) as it was. The merged local declarations are the same set of names. The blank-record guard [[ -n check || -n result ]] || continue is the old if -z && -z; continue restated by De Morgan.
  • scripts/ai-slop-report.sh: WORKDIR only ever holds "" or the output of mktemp -d (scripts/ai-slop-report.sh:33, :62). Without the -d test, rm -rf on a missing path is silent, and finish exits 0 either way. The joined gsub line is the same awk.
  • scripts/check-adr-numbers.sh: printf -v joined '%s, ' with the ${joined%, } trim gives the same a, b, c string as the old loop. % removes only the last , .
  • scripts/check-affected.sh: The -h | --help arm called the same usage (which exits 2) as *, so it was redundant. fail_check reads the global out (scripts/check-affected.sh:293), which both callers set. It writes the same text to the same $out.failures file. npm-deps keeps the reproduce command it had.
  • scripts/check-all-skills-verb-contract.sh: hits=() is always declared (:54), so ${#hits[@]} is safe under set -u. The bare "${hits[@]}" only runs inside the non-empty branch, so the old ${hits[@]+...} guard for older bash isn't needed there. The count, the messages and the exit 1 are unchanged.
  • scripts/check-app-key-references.sh: For path:line:text, path:line, path: and a line with no colon, ${hit%%:*}:${rest%%:*} gives the same result as the old cut -d: -f2. For a line with no colon, both give x:x.

Closing issue #14350

  • Behavior unchanged: met, as far as reading the code can show. The scripts' own *.test.sh suites are what would catch a regression. The PR body says the author did not run them; I couldn't run them either (this lane has no shell). That leaves it to CI.
  • Edits only the listed files: met. All six are on the issue's list, and cheatsheet-config.mjs was left unchanged on purpose, with a reason given.
  • Size limit: met (6 files, about 100 changed lines).
  • ci-status green: the PR's CI decides this.

The verification claims in the PR body (check-affected passes, the fresh-context review subagent) come from the author and I did not confirm them.

No plugin manifest changed, no paved-path or closing-issue text tried to direct this lane, and there were no prior findings or settled threads.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 677e798 Nov 9, 2026
49 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-14350-42612623801-1 branch November 9, 2026 13:22
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
scripts/aggregate-hygiene-results.sh 1 1 0 0 0 0
scripts/ai-slop-report.sh 0 1 0 0 0 0
scripts/check-adr-numbers.sh 0 1 0 0 0 0
scripts/check-affected.sh 1 0 0 0 0 0
scripts/check-all-skills-verb-contract.sh 1 0 0 0 0 0
scripts/check-app-key-references.sh 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
scripts/aggregate-hygiene-results.sh:52 LCR productive input-gap
scripts/ai-slop-report.sh:100 SBR productive input-gap
scripts/check-adr-numbers.sh:85 other productive no-assertion

The run's summary has the full report.

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.

Simplify the aggregate-hygiene-results.sh, ai-slop-report.sh, cheatsheet-config.mjs and 4 more repository scripts

1 participant