Skip to content

refactor(scripts): simplify hook-configs.sh and github-rest.mjs - #14530

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14379-42595315559-1
Nov 9, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14379-42595315559-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14379

Summary

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

Simplified the two shared scripts without changing their behavior. In scripts/lib/hook-configs.sh, _dispatch now strips CRs from its input itself, so _scan_files no longer strips them at each of its two call sites, and the per-file fallback in _scan_files is a plain if/else instead of a negated if with continue. In .github/scripts/lib/github-rest.mjs, budgetedClient builds the request headers and body inline in the fetch init, using one hasBody flag, instead of mutating a separate headers object. No restructuring across files was done: the issue puts that out of scope.

Not verified

  • Tidy was not run: both changed files are under listed shared paths (scripts/ and .github/), and the tidy cutoffs exclude those paths.
  • scripts/lib/hook-configs.test.sh, scripts/check-hook-exec-form.test.sh, scripts/check-exec-form-windows-probe.test.sh and .github/scripts/lib/github-rest.test.mjs were not run by name: this lane can run only the named wrappers. check-affected ran its selected suites (10 passed), but its output does…
  • shellcheck and the whole-repo hook scanners (hook-exec-form, exec-form-windows-probe, hook-slow-shapes, killswitch-hoist) run only in CI and were not run here. Left to the PR's CI.
  • ci-status green on the PR (an acceptance criterion) can only be checked once the PR's CI runs.
  • No changelog fragment was added: neither file belongs to a plugin, and check-changelog-fragments passed without one.
  • The change is left uncommitted in the working tree, as this lane's runner instructions require. The runner turns it into the patch.

Fix

  • scripts/lib/hook-configs.sh: _dispatch strips every CR from its rows. _scan_files passes raw jq output to it and handles a per-file parse failure with an if/else. The _dispatch comment now says it removes every CR.
  • .github/scripts/lib/github-rest.mjs: budgetedClient's call builds its headers and body inline in the fetch init. ...(hasBody && {...}) adds content-type and body only when a body is given, so header key order, init keys and the no-body case are unchanged.

Verification

The runner ran each check from the base copy against 9d0ace0:

  • 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-changelog-fragments: all 3 fragments under .changes/ valid. Run before and after the final edit.
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changed-skills: no changed skills, nothing to gate. Run before and after the final edit.
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: 10 passed, 6 skipped over the 2 changed files. Run before and after the final edit.
  • Fresh-context review subagent over git-read diff HEAD: no behavior differences found. It checked errexit and return status, CR stripping for both callers of _dispatch (manifest output was already CR-free), here-string input, header key order, and that "body" in init and content-type stay…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42595315559

Left out: the items under Not verified.

Related

#14379

Merge-Risk: max=MEDIUM demote=false head=9d0ace0fee2ae512e99337d79d9c3b8723ac729e rubric=8.1.3 rater=claude-opus-5-5 checker=claude-opus-5-5

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 9d0ace0fee2ae512e99337d79d9c3b8723ac729e: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14530

No security issues found.

I read every hunk of both changed files. Neither one matches a listed trusted path, and neither is a trust control, merge hold, kill switch, token request or plugin manifest.

  • .github/scripts/lib/github-rest.mjs: budgetedClient now builds its request headers and body inline in the fetch call. The headers are the same as before: accept, authorization: Bearer ${env.GITHUB_TOKEN} and x-github-api-version, plus content-type only when a body is given. When there is no body, ...(false && {...}) adds nothing. The token still goes only to the same GITHUB_API_URL destination, the call budget and pacing still run before the fetch, and the 404/error handling is unchanged. Nothing new reaches or exposes the token.
  • scripts/lib/hook-configs.sh: carriage returns (CR) are now stripped inside hook_configs::_dispatch itself, instead of at its two call sites in _scan_files. The per-file parse failure still calls the on_bad callback and moves on to the next file (an if/else now, in place of continue). The third caller, at line 293 (manifest output), now also gets CRs stripped. The PR says that output was already free of them, so the extra strip changes nothing. The IFS/read -r row parsing and the kind == H filter are unchanged, so no new input reaches the callbacks.
  • The diff also makes scripts/lib/hook-configs.sh executable (mode 100644 → 100755). This file is a sourced library for the hook scanners. Being executable gives it no new trigger or privilege.

The diff removes no standing instructions and changes no userConfig key, so neither the instruction-surface lens nor the manifest rules apply. There are no prior findings (earlier heads reviewed: 0), so this was a full review, not a blocking-only one. The PR context contains 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 9d0ace0fee2ae512e99337d79d9c3b8723ac729e: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings. I read every hunk of both changed files (.github/scripts/lib/github-rest.mjs and scripts/lib/hook-configs.sh).

github-rest.mjs: budgetedClient now builds its headers and body inline in the fetch call. The request comes out the same as before:

  • Without a body, ...(false) adds no keys. Neither content-type nor body is set, so "body" in init is still false.
  • With a body, content-type is still the last header and the body is still JSON.stringify(body).
  • Header names and values are unchanged.

hook-configs.sh:

  • _dispatch now removes carriage returns itself, so _scan_files no longer does it before both of its calls. _dispatch has one other caller, scan (
    hook_configs::_dispatch "$on_hook" "$out"
    ), and the text it passes from _manifest_out already has no carriage returns (
    _hc_mo="${_hc_mo//$'\r'/}"
    return 0
    fi
    _hc_mo=""
    for _hc_f in "$@"; do
    if _hc_one="$(jq -r --arg mode "$_hc_mode" "$HOOK_CONFIGS_JQ_MANIFEST" "$_hc_f" 2>/dev/null)"; then
    _hc_mo+="${_hc_one//$'\r'/}"$'\n'
    ). Removing them again does nothing, and the P-row loop at L297 still reads the same $out.
  • The per-file fallback changed from if !…continue to if/else. The same callbacks run in the same order. If the last file can't be parsed, the function's return status is now $on_bad's instead of continue's 0. Nothing can see that difference: scan calls _scan_files as a plain statement and ignores its status, and under errexit a failing $on_bad exits the same way in either branch.
  • The file's mode changes from 100644 to 100755, which the PR body doesn't mention. This is expected: apply-patch sets the executable bit on every changed .sh file (see scripts/check-affected.sh L241-L247). The file still refuses to run directly, with its "sourced-only" exit 2 (L55-L58). I didn't count this as a finding.

Closing issue #14379, acceptance criteria:

  • Behavior unchanged: met, by reading the code as above. I ran no tests. The PR's test results are the author's claim and I haven't confirmed them.
  • Only the listed files edited: met.
  • Within 400 changed lines and 15 files: met.
  • ci-status green: can't be checked from this lane; that's up to the PR's CI.

No prior findings, no settled threads and no plugin manifest changes. The PR context contains no instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9d0ace0

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14530-9d0ace0fee2ae512e99337d79d9c3b8723ac729e, expires on 2026-12-09.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 3ddfa46 Nov 9, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14379-42595315559-1 branch November 9, 2026 10:34
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 3ddfa46cdabd2d9b1774351b7d492d850efb1fe4; later checks count it verified from this comment.

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 hook-configs.sh and github-rest.mjs shared scripts

0 participants