π§ Semantic Function Clustering Analysis
Analysis of repository: github/gh-aw β 2026-06-29
Executive Summary
Analyzed ~920 non-test Go files. The codebase already maintains dedicated *util packages (stringutil, sliceutil, setutil, semverutil, repoutil, jsonutil, fileutil, gitutil, ...) and is generally well-organized. The strongest actionable findings are a small cluster of semver helpers reinvented in feature files that the existing pkg/semverutil already provides, plus a few generic helpers misplaced in domain files.
The dominant noise source (wasm vs. native pairs in *_wasm.go) is intentional build-tag stubbing β not duplication. Likewise audit_math_helpers.go is already a consolidated helper file. Those are excluded.
Verified findings (high confidence)
| Function |
File |
Duplicates |
Fix |
ensureSemverPrefix |
pkg/cli/compile_update_check.go:323 |
semverutil.EnsureVPrefix (identical) |
delete, call util |
semverMajorMinorParts |
pkg/cli/compile_update_check.go:301 |
semverutil.ParseVersion (.Major/.Minor) |
reuse parser |
isMorePreciseVersion |
pkg/workflow/action_cache.go:722 |
semver-precision logic; near semverutil.IsPreciseVersion |
move to semverutil |
Side-by-side
// pkg/cli/compile_update_check.go
func ensureSemverPrefix(version string) string {
if strings.HasPrefix(version, "v") { return version }
return "v" + version
}
// pkg/semverutil/semverutil.go -> EnsureVPrefix(v string) string (same behavior)
Priority 1: Consolidate semver helpers
Move pkg/workflow/action_cache.go:isMorePreciseVersion into pkg/semverutil, and replace ensureSemverPrefix / semverMajorMinorParts in compile_update_check.go with semverutil.EnsureVPrefix / semverutil.ParseVersion. Single source of truth for version logic. Est. 1β2h.
Priority 2: Centralize stray helpers
Generic comparison/string helpers (truncateSHAForLog already wraps stringutil.Truncate β) and containsAny (pkg/cli/audit_agentic_analysis.go:497) overlap sliceutil. Audit per call-site; remove thin wrappers. Est. 2β3h.
Implementation checklist
Metadata
- Files analyzed: ~920 (
pkg/, non-test, non-testdata) Β· Method: parallel symbol scan + manual verification of each finding
- Excluded:
*_wasm.go build-tag stub pairs (intentional), already-consolidated helper files
Generated by π§ Semantic Function Refactoring Β· 221.4 AIC Β· β 14.1 AIC Β· β 9.2K Β· β·
π§ Semantic Function Clustering Analysis
Analysis of repository: github/gh-aw β 2026-06-29
Executive Summary
Analyzed ~920 non-test Go files. The codebase already maintains dedicated
*utilpackages (stringutil,sliceutil,setutil,semverutil,repoutil,jsonutil,fileutil,gitutil, ...) and is generally well-organized. The strongest actionable findings are a small cluster of semver helpers reinvented in feature files that the existingpkg/semverutilalready provides, plus a few generic helpers misplaced in domain files.The dominant noise source (wasm vs. native pairs in
*_wasm.go) is intentional build-tag stubbing β not duplication. Likewiseaudit_math_helpers.gois already a consolidated helper file. Those are excluded.Verified findings (high confidence)
ensureSemverPrefixpkg/cli/compile_update_check.go:323semverutil.EnsureVPrefix(identical)semverMajorMinorPartspkg/cli/compile_update_check.go:301semverutil.ParseVersion(.Major/.Minor)isMorePreciseVersionpkg/workflow/action_cache.go:722semverutil.IsPreciseVersionsemverutilSide-by-side
Priority 1: Consolidate semver helpers
Move
pkg/workflow/action_cache.go:isMorePreciseVersionintopkg/semverutil, and replaceensureSemverPrefix/semverMajorMinorPartsincompile_update_check.gowithsemverutil.EnsureVPrefix/semverutil.ParseVersion. Single source of truth for version logic. Est. 1β2h.Priority 2: Centralize stray helpers
Generic comparison/string helpers (
truncateSHAForLogalready wrapsstringutil.Truncateβ) andcontainsAny(pkg/cli/audit_agentic_analysis.go:497) overlapsliceutil. Audit per call-site; remove thin wrappers. Est. 2β3h.Implementation checklist
pkg/semverutil, update call sitesgo build ./...+ testsMetadata
pkg/, non-test, non-testdata) Β· Method: parallel symbol scan + manual verification of each finding*_wasm.gobuild-tag stub pairs (intentional), already-consolidated helper files