Description
An error-message quality audit (discussion #50886) found that shared low-level helpers in pkg/gitutil/gitutil.go wrap common failures ("failed to get current directory", "failed to find git root", "failed to get home directory") with bare fmt.Errorf("...: %w", err) and no recovery guidance, violating the repo's own style guide at .github/skills/error-messages/SKILL.md. These helpers are reused across 8+ call sites each in pkg/cli, so fixing them once fixes many.
Suggested Changes
- Update
pkg/gitutil/gitutil.go:134 and equivalent functions to follow [what's wrong]. [what's expected/how to fix] format, e.g.:
fmt.Errorf("failed to determine current working directory: %w (check that the process has a valid working directory and read permissions)", err)
fmt.Errorf("failed to find git repository root: %w (run this command from inside a git repository, or use 'git init')", err)
- Search
pkg/cli (e.g. trial_repository.go, actionlint.go, poutine.go, runner_guard.go) for local duplicates of the same wrap and route them through the shared pkg/gitutil helper instead.
Files Affected
pkg/gitutil/gitutil.go
pkg/cli/runner_guard.go:62
pkg/cli/actionlint.go:305
pkg/cli/poutine.go:83
pkg/cli/trial_repository.go:257,663
Success Criteria
Source
Extracted from Repository Quality Improvement Report - Error Message & Diagnostics Quality (discussion #50886)
Priority
High - primary user-facing CLI error surface, small/mechanical fix
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 35.3 AIC · ⌖ 4.12 AIC · ⊞ 10.2K · ◷
Description
An error-message quality audit (discussion #50886) found that shared low-level helpers in
pkg/gitutil/gitutil.gowrap common failures ("failed to get current directory", "failed to find git root", "failed to get home directory") with barefmt.Errorf("...: %w", err)and no recovery guidance, violating the repo's own style guide at.github/skills/error-messages/SKILL.md. These helpers are reused across 8+ call sites each inpkg/cli, so fixing them once fixes many.Suggested Changes
pkg/gitutil/gitutil.go:134and equivalent functions to follow[what's wrong]. [what's expected/how to fix]format, e.g.:fmt.Errorf("failed to determine current working directory: %w (check that the process has a valid working directory and read permissions)", err)fmt.Errorf("failed to find git repository root: %w (run this command from inside a git repository, or use 'git init')", err)pkg/cli(e.g.trial_repository.go,actionlint.go,poutine.go,runner_guard.go) for local duplicates of the same wrap and route them through the sharedpkg/gitutilhelper instead.Files Affected
pkg/gitutil/gitutil.gopkg/cli/runner_guard.go:62pkg/cli/actionlint.go:305pkg/cli/poutine.go:83pkg/cli/trial_repository.go:257,663Success Criteria
make test-unitpasses with no regressionsSource
Extracted from Repository Quality Improvement Report - Error Message & Diagnostics Quality (discussion #50886)
Priority
High - primary user-facing CLI error surface, small/mechanical fix