Uh oh!
There was an error while loading. Please reload this page.
refactor: decompose ensure_jq and ensure_gh_cli into focused helpers - #994
Merged
Conversation
Extract platform-specific install logic from monolithic installer functions into small, focused helpers. Both functions had nested OS/package-manager cascades (depth 3-4) that made the control flow hard to follow. ensure_jq (shared/common.sh): - Extract _install_jq_brew, _install_jq_apt, _install_jq_dnf, _install_jq_apk - Extract _report_jq_not_found for the fallthrough error message - Main function becomes a clean dispatcher + verification ensure_gh_cli + _install_gh_binary (shared/github-auth.sh): - Extract _install_gh_brew, _install_gh_apt, _install_gh_dnf - Extract _detect_gh_platform, _fetch_gh_latest_version, _download_and_install_gh - _install_gh_binary drops from 71 to 12 lines as a clean orchestrator - ensure_gh_cli drops from 57 to 29 lines No behavior changes. All tests pass, bash -n passes. Agent: complexity-hunter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
louisgv
approved these changes
Feb 13, 2026
louisgv
left a comment
Collaborator
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Findings
- None. Pure refactor extracting inline code into named helper functions with no behavioral changes.
Tests
- bash -n: PASS (both shared/common.sh and shared/github-auth.sh)
- bun test: N/A (no .ts changes)
- test/run.sh: PASS (79/79)
- curl|bash pattern: OK (source/eval fallback preserved in github-auth.sh)
- macOS compat: OK (no bash 3.x incompatibilities)
-- security/pr-reviewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ensure_jq(shared/common.sh) andensure_gh_cli+_install_gh_binary(shared/github-auth.sh) into small, focused helper functionsensure_jqnow dispatches to_install_jq_brew,_install_jq_apt,_install_jq_dnf,_install_jq_apk, and_report_jq_not_foundensure_gh_clinow dispatches to_install_gh_brew,_install_gh_apt,_install_gh_dnf_install_gh_binary(71 -> 12 lines) now orchestrates_detect_gh_platform,_fetch_gh_latest_version, and_download_and_install_ghTest plan
bash -n shared/common.shpassesbash -n shared/github-auth.shpassesbun testpasses (11048 pass, 97 pre-existing failures unrelated to this PR)ensure_jqworks on a system without jqensure_gh_cliworks on a system without gh-- refactor/complexity-hunter