Skip to content

refactor(scripts): simplify five repository scripts without changing behavior - #14599

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

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14365-42612659945-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #14365

Summary

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

Simplified five of the eight listed scripts and left their outputs, exit codes, flags and written files unchanged. credential-sweep.sh gains header_value and tsv_list helpers in place of duplicated awk blocks. gen-hook-event-registry.sh pipes build_registry straight into jq (no temp file), parses the fetched page and a --from file through one path, and shares one drift helper between its two --check failures. emit-windows-path.sh shifts once per option and passes paths through with one printf. generate-catalog.mjs merges two comments that said the same thing and inlines a one-use function. generate-cheatsheet.mjs reads frontmatter in one loop and destructures the swept keys. dependabot-fragments.sh, generate-marketplace.mjs and git-mv-rm.sh were already minimal: every candidate change there either changed behavior (for example, running intent-to-add on a mv destination that does not exist yet) or saved nothing, so they are untouched. credential-sweep.sh lines 1-20 are untouched because its usage() prints them by line number, and the gen-hook-event-registry.sh header is untouched because its usage() prints up to the first blank line.

Not verified

  • The suites for the changed scripts (scripts/credential-sweep.test.sh, emit-windows-path.test.sh, gen-hook-event-registry.test.sh, the generate-cheatsheet tests) were not run: this lane allows no test runner, so they are left to the PR's CI
  • ci-status green: a PR CI check, left to the PR's CI
  • tidy: not run, because every changed file is under scripts/, a listed shared path
  • verify: no build or test step could run in this lane; the PR's CI runs it

Fix

  • scripts/credential-sweep.sh: header_value <name> replaces the two inline rate-limit header awk calls in read_headers; tsv_list <file> replaces the two GAPS / Unreadable-by-design list blocks in report()
  • scripts/emit-windows-path.sh: option loop shifts once after the case; POSIX pass-through uses printf '%s\n' "$"
  • scripts/gen-hook-event-registry.sh: build_registry pipes rows into jq without a temp file; fetch mode writes the page to FROM so one parse_table call serves fetch and --from; drift helper replaces two identical report-diff-exit blocks in --check
  • scripts/generate-catalog.mjs: two overlapping comments about the taxonomy parity check condensed into one; one-use currentBlock() inlined with the same error
  • scripts/generate-cheatsheet.mjs: readCheatsheetMeta's collect-then-parse loops merged into one; three value reads replaced by one destructure

Verification

The runner ran each check from the base copy against 1bb9c8b:

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

The run reports:

Left out: the items under Not verified.

Related

#14365

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14599 (refactor: simplify five repository scripts)

No findings. I read every hunk in all 5 changed files and checked each one against the code it touches at head. None of the changes alters behavior.

  • scripts/credential-sweep.sh
    • header_value runs the same awk as the two inline calls it replaces. It passes the lowercase header name through -v k.
    • tsv_list tests -s where the GAPS block used to test ((gaps == 0)). These agree: gaps is wc -l of gaps.tsv, and gap() always ends a row with a newline, so the file is empty exactly when the count is 0. The by-design block already tested -s.
  • scripts/emit-windows-path.sh
    • Moving to one shift after the case keeps the parsing the same. --) still shifts once and then breaks, *) breaks without shifting, and -h and unknown options exit first.
    • printf '%s\n' "$@" runs only after the $# == 0 guard. With at least one argument it prints the same as the old loop.
  • scripts/gen-hook-event-registry.sh
    • Piping build_registry into jq moves the loop into a subshell. Nothing escapes it: classify_to sets only the local cat/prod, the warning goes to stderr, and set -euo pipefail still makes the call at line 245 fail as it did before.
    • Reusing FROM for the fetched page is safe. Check mode never reads FROM, the trap deletes only the temp file, and --from x --fetch still leaves the user's file alone.
    • The drift messages and exit 1 match the old code.
  • scripts/generate-catalog.mjs: only comments change, plus currentBlock is inlined with the same error.
  • scripts/generate-cheatsheet.mjs: the merged loop stops at the same --- fence. The body has no break and does not use i. The destructure reads the same three keys.

Closing issue #14365 acceptance criteria

  • Behavior unchanged: met, judging by reading the code. I ran nothing. Test suites sit beside four of the scripts (credential-sweep.test.sh, emit-windows-path.test.sh, gen-hook-event-registry.test.sh, generate-cheatsheet.test.sh). generate-catalog.mjs has no test of its own, but its change is only comments and one inlined function, and --check exercises it.
  • Diff edits only listed files: met. All 5 files are on the issue's list.
  • Within 400 lines / 15 files: met. The diff is 5 files and about 138 changed lines.
  • ci-status green: I can't check this from this lane. The PR body also says the test suites were not run there, so CI has to confirm it.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14599 (refactor of five repository scripts)

I found no security issues.

I read every hunk of all 5 changed files. None of them matches a trusted-path glob. The changes refactor local tooling scripts under scripts/. None of them touches a trust control, a token request, the kill switch, a merge hold, a plugin manifest or an instruction surface.

What I checked:

  • scripts/credential-sweep.sh
    • header_value passes fixed header names to awk through -v, so no caller-controlled text reaches the awk program.
    • tsv_list writes the GAPS and Unreadable-by-design lists inside the same { … } | tr -d '\000-\010\013-\037\177' block as before, so the control-character scrub on summary.md still covers both lists.
    • The GAPS branch now checks -s gaps.tsv where it used to check gaps == 0. That is at most a correctness question, not a security one.
  • scripts/emit-windows-path.sh: the single shift after case runs only for -w and -m. The -- branch and the positional *) branch still break before it, and -h exits first. Paths still pass through as quoted "$@" to printf '%s\n', so there is no word splitting or format-string injection.
  • scripts/gen-hook-event-registry.sh
    • In fetch mode FROM is now reassigned to a fresh mktemp file before curl writes to it, and the EXIT trap removes it. FROM is read only at line 237 (parse_table <"$FROM"), so a --from value can't redirect the write.
    • build_registry now pipes into jq with all arguments passed through --arg, and the temp file it used to create is gone.
    • The drift helper keeps the same diff-to-stderr-then-exit-1 behavior for both --check failures.
  • scripts/generate-catalog.mjs and scripts/generate-cheatsheet.mjs: comments were merged, a one-use function was inlined with the same fail-closed throw, and a loop was merged with a destructure. The taxonomy parity check still runs on every invocation, and no input handling changes.

Embedded text in the PR context: none that directs the lane.

critical-findings: 0

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit b105f30 Nov 9, 2026
50 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-14365-42612659945-1 branch November 9, 2026 13:24
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 credential-sweep.sh, dependabot-fragments.sh, emit-windows-path.sh and 5 more repository scripts

1 participant