Skip to content

fix: ponytail audit — remove ~330 lines of redundant code#30

Merged
locus313 merged 1 commit into
mainfrom
fix/ponytail-audit-release-trigger
Jun 27, 2026
Merged

fix: ponytail audit — remove ~330 lines of redundant code#30
locus313 merged 1 commit into
mainfrom
fix/ponytail-audit-release-trigger

Conversation

@locus313

Copy link
Copy Markdown
Owner

Summary

Third-pass complexity reduction across the codebase (~330 lines removed net).

Changes

lib/github-common.sh

  • Add err() helper (print_error + exit 1 in one call)
  • Add --api-version VERSION optional param to gh_api()

github-close-archived-repo-security-alerts

  • Collapse 3 near-identical close_*_alerts() functions (~165 lines) into 1 generic close_alerts() (~55 lines)
  • Replace 27-line hand-rolled archived-repo pagination loop with mapfile + gh_api_paginate

github-copilot-report

  • Collapse _copilot_api() from 30 lines to 3 using --api-version 2026-03-10
  • Remove info()/warn() pass-through aliases; replace call sites with print_status/print_warning
  • Remove err() (now from lib)

github-repo-permissions-report

  • Remove info() pass-through alias
  • Remove err() (now from lib)

github-dockerfile-discovery

  • Delete dead gh_api_link() function + RESPONSE_LINK global (~40 lines, never called)
  • Remove vestigial print_* stderr-redirect redefines
  • Inline check_prerequisites()

github-get-public-repos

  • Inline check_prerequisites()
  • Drop no-op print_error override (lib already writes to stderr)

7 pagination scripts (add-repo-permissions, add-repo-collaborators-by-pattern, archive-old-repos, enable-issues, get-repo-list, migrate-internal-repos-to-private, monthly-issues-report)

  • Remove local get_repo_pagination()/limit_repo_pagination() wrappers; use get_repo_page_count from lib directly

github-organize-stars

  • Replace 7-line hand-rolled command -v loop with require_command jq

github-archive-old-repos

  • Inline validate_environment() into main()
  • Move 14 pre-declared bare local vars to assignment site
  • Drop stale/obvious comments

github-auto-repo-creation

  • Merge add_teams_to_repo + add_repo_owners_to_repo into single add_team_to_repo repo team permission
  • Remove obvious function-header comments and redundant variable comments

Docs

  • AGENTS.md + copilot-instructions.md: add err() to helpers table, document --api-version on gh_api
  • copilot-instructions.md: fix stale pagination example (was showing deleted get_repo_pagination() pattern); fill previously blank Shared Library section

- lib: add err(), --api-version param to gh_api()
- close-archived-alerts: collapse 3 close_*_alerts() into 1 generic
  close_alerts(); replace hand-rolled pagination with gh_api_paginate
- copilot-report: collapse _copilot_api() 30→3 lines using --api-version;
  remove info()/warn() pass-through aliases
- repo-permissions-report: remove info() pass-through alias
- dockerfile-discovery: delete dead gh_api_link() + RESPONSE_LINK global;
  remove vestigial print_* redefines; inline check_prerequisites()
- get-public-repos: inline check_prerequisites(); drop no-op print_error override
- 7 pagination scripts: remove local get_repo_pagination() wrappers, use
  lib get_repo_page_count() directly
- organize-stars: replace 7-line command check loop with require_command
- archive-old-repos: inline validate_environment(); move local declarations
  to assignment site; drop stale comments
- auto-repo-creation: merge add_teams_to_repo + add_repo_owners_to_repo
  into single add_team_to_repo with permission param
- docs: update AGENTS.md and copilot-instructions.md with err(), --api-version,
  correct pagination example, and fill blank shared-library section

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@locus313 locus313 merged commit 042d71e into main Jun 27, 2026
2 checks passed
@locus313 locus313 deleted the fix/ponytail-audit-release-trigger branch June 27, 2026 05:18
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.

1 participant