[repository-quality] 🎯 Repository Quality Improvement Report - Code Organization (2026-08-12) #52298
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-08-13T13:19:46.322Z.
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
🎯 Repository Quality Improvement Report - Code Organization
Analysis Date: 2026-08-12
Focus Area: Code Organization
Strategy Type: Standard
Custom Area: No
Executive Summary
This is the first recorded run of the Repository Quality Improvement Agent for
github/gh-aw, so the focus-area selection defaults to a standard category with no reuse history to draw on. Analysis of the Go codebase (1,218 non-test source files, ~272,944 source LOC vs. 531,699 test LOC) shows a healthy overall test-to-source ratio (~1.95:1), but a notable cluster of 35 files exceeding the repository's own documented 500-line guideline for source files, several surpassing 1,000 lines. This concentrates logic in a handful of "god files" inpkg/cli/andpkg/workflow/, increasing merge-conflict risk, cognitive load for reviewers, and coupling between unrelated responsibilities.The largest offenders —
pkg/cli/update_actions.go(1,144 lines, 18 functions),pkg/workflow/compiler_custom_jobs.go(1,142 lines, 37 functions), andpkg/cli/audit.go(1,095 lines, 28+ functions) — each mix multiple distinct concerns (e.g., action-release resolution, skill-ref updates, and workflow-file rewriting all live inupdate_actions.go). Thedeveloper-code-organizationskill already documents a "Prefer Many Small Files Over Large Ones" principle with a 100–500 line target and a "Create Functions Pattern" precedent (one file per operation), giving a clear template to apply here.Recommended next steps: split the three largest files along their existing functional seams (which are already well-delineated by function naming, e.g.
extractCustomJob*vs.applyBuiltinJob*vs.insert*Steps*), verify no regressions via targeted unit tests, and consider adding a lightweight CI line-count lint to prevent future regrowth.Full Analysis Report
Focus Area: Code Organization
Current State Assessment
The codebase is large and mature (1,218 non-test
.gofiles acrosspkg/andcmd/), with strong test coverage by volume. However, file-size discipline has drifted for a subset of files, most concentrated inpkg/cli(CLI command implementations) andpkg/workflow(compiler internals).Metrics Collected:
update_actions.go)compiler_custom_jobs.go)audit.go)Findings
Strengths
developer-code-organizationskill already documents clear file-size guidance (100–500 lines) and naming/functional-grouping patterns (create_issue.go,engine_helpers.go, etc.) that can be directly reused as a refactor template.extractCustomJob*,applyBuiltinJob*,getLatestActionRelease*,updateSkillRefs*), meaning splitting is mostly mechanical rather than requiring new abstractions.Areas for Improvement
pkg/cli(23 files) andpkg/workflow(12 files).pkg/cli/update_actions.go(1,144 lines) mixes at least three concerns: GitHub Action version resolution/caching, cooldown logic, and skill-ref/workflow-file content rewriting — each independently testable and separable.pkg/workflow/compiler_custom_jobs.go(1,142 lines, 37 functions) combines custom-job property extraction, built-in job augmentation, and step-insertion utilities — three cohesive sub-domains that map cleanly to 3 separate files.pkg/cli/audit.go(1,095 lines) interleaves command registration/flag parsing, single-run auditing, multi-run auditing, and analysis-result collection/launching (viaerrgroup).Detailed Analysis
pkg/cli/update_actions.go— Natural split points based on function grouping:update_actions_core.go:UpdateActions,updateActions,actionUpdateDepshelpers (lines 61–403)update_actions_release.go:getLatestActionRelease*,parseActionTagRefs,findCooledDownActionVersion,getActionSHAForTag(lines 403–803)update_actions_content.go:UpdateActionsInWorkflowFiles,updateSkillRefsInContent*,updateActionRefsInContentWithDeps(lines 804–end)pkg/workflow/compiler_custom_jobs.go— Split by domain:compiler_custom_jobs_extract.go: allextractCustomJob*functions (property/runs-on/timeout/concurrency/env/container/services/outputs extraction, lines 173–433)compiler_custom_jobs_builtin.go:applyBuiltinJob*,extractBuiltinJob*,normalizeBuiltinJobAlias,validateRestrictedBuiltin*(lines 598–984)compiler_custom_jobs_steps.go:insertActivationStepsBeforeArtifactStaging,insertSetupStepsAtStart,insertPreStepsAtEarliestBoundary,extractPinnedJobSteps, checkout helpers (lines 670–end)pkg/cli/audit.go— Split by lifecycle stage:audit_command.go:NewAuditCommand, flag registration, option resolution, arg resolution (lines 94–251)audit_run_single.go/audit_run_multi.go: single vs. multi-run orchestration (lines 208–373)audit_pipeline.go:AuditWorkflowRunand the analysis-collection/launch pipeline (collectAuditAnalysisResults,launchCoreAuditAnalyses,launchMetricsAnalysis, lines 373–end)These splits preserve existing exported symbols (no API changes), keep package-level visibility intact, and align with the "Group by Functionality, Not by Type" principle already documented in the developer-code-organization skill.
🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Split
pkg/cli/update_actions.gointo focused filesPriority: Medium
Estimated Effort: Medium
Focus Area: Code Organization
Description:
pkg/cli/update_actions.gois 1,144 lines and mixes action-release resolution, cooldown logic, and workflow/skill-ref content rewriting. Split intoupdate_actions_core.go,update_actions_release.go, andupdate_actions_content.gofollowing the existing function boundaries, with no change to exported behavior.Acceptance Criteria:
cli)go build ./...andgo test ./pkg/cli/...pass with no behavior changesupdate_actions_test.gotests (if split) remain greenCode Region:
pkg/cli/update_actions.goTask 2: Split
pkg/workflow/compiler_custom_jobs.goby sub-domainPriority: Medium
Estimated Effort: Medium
Focus Area: Code Organization
Description:
pkg/workflow/compiler_custom_jobs.gois 1,142 lines with 37 functions spanning custom-job property extraction, built-in job augmentation, and step-insertion utilities. Split into three files aligned with these sub-domains.Acceptance Criteria:
extractCustomJob*) moved tocompiler_custom_jobs_extract.goapplyBuiltinJob*,extractBuiltinJob*,validateRestrictedBuiltin*) moved tocompiler_custom_jobs_builtin.goinsert*Steps*,extractPinnedJobSteps, checkout helpers) moved tocompiler_custom_jobs_steps.gogo build ./...andgo test ./pkg/workflow/...pass unchangedCode Region:
pkg/workflow/compiler_custom_jobs.goTask 3: Split
pkg/cli/audit.goby lifecycle stagePriority: Low
Estimated Effort: Medium
Focus Area: Code Organization
Description:
pkg/cli/audit.go(1,095 lines) interleaves command/flag setup, single-run auditing, multi-run auditing, and analysis-collection pipeline logic. Split along these existing boundaries to improve readability and reduce merge conflicts in this frequently-touched file.Acceptance Criteria:
NewAuditCommand,registerAuditCommandFlags,runAuditCommand,getAuditCommandOptions,resolveAuditCommandArgs) moved toaudit_command.gorunAuditSingle,runAuditMulti,applyAuditRepoFlag, permission-error helpers) moved toaudit_run.goAuditWorkflowRun,collectAuditAnalysisResults,launchCoreAuditAnalyses,launchMetricsAnalysis, and related helper functions) moved toaudit_pipeline.gogo build ./...andgo test ./pkg/cli/...pass unchangedCode Region:
pkg/cli/audit.goTask 4: Add a CI guardrail for source file size
Priority: Low
Estimated Effort: Small
Focus Area: Code Organization
Description: There is currently no automated check preventing Go source files from growing past the documented 500-line guideline. Add a lightweight, non-blocking (warn-only initially) check — either a Go linter rule (see
.github/skills/go-linters/SKILL.mdfor the custom-linter pattern) or a simplemake lintshell check — that flags non-test.gofiles exceeding a threshold (e.g., 800 lines) so growth is caught in review rather than accumulating silently.Acceptance Criteria:
.gofile over the chosen line thresholdmake lintor CI step without failing the build (warn-only for the initial rollout).github/skills/developer-code-organization/SKILL.mdCode Region:
pkg/linters/,Makefile📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
pkg/cli/update_actions.gointo 3 focused files — Priority: Mediumpkg/workflow/compiler_custom_jobs.gointo 3 focused files — Priority: MediumShort-term Actions (This Month)
pkg/cli/audit.gointo 3 focused files — Priority: LowLong-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-08-13 — Focus area selected by diversity algorithm
All reactions