Repository navigation
[repository-quality] 🎯 Repository Quality Improvement Report - CLI Output Consistency (2026-05-08) #31022
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-05-09T13:21:10.261Z.
|
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 - CLI Output Consistency
Analysis Date: 2026-05-08
Focus Area: CLI Output Consistency
Strategy Type: Custom
Custom Area: Yes — The repo has a well-defined console formatting system (
pkg/console) with explicit guidelines (AGENTS.md) for routing output. This area measures how well the codebase adheres to those standards.Executive Summary
The
pkg/clipackage has 1,502 correct uses ofconsole.Format*helpers, which is encouraging. However, analysis reveals 685 instances of barefmt.Fprintln(os.Stderr, ...)/fmt.Fprintf(os.Stderr, ...)calls that bypass the console formatting layer — resulting in visually inconsistent output (missing emoji prefixes, colour, and style) for a significant fraction of user-facing messages.The most notable clusters are:
compile_file_operations.go(error printed withoutFormatErrorMessage),add_interactive_engine.goandadd_interactive_workflow.go(debug/status lines withoutFormatInfoMessage/FormatProgressMessage), andaudit_cross_run_render.go(report-body lines mixed with stdout markdown output in the first output render function). Additionally, 20+ high-traffic code paths return bareerrwithout wrapping context, making error chains harder to diagnose.Closing these gaps will improve UX consistency for all CLI users and make error trails significantly easier to follow during debugging.
Full Analysis Report
Focus Area: CLI Output Consistency
Current State Assessment
Metrics Collected:
console.Format*calls inpkg/clifmt.Println/Printfto stdout (non-structured)return errwithout wrapping contextpkg/cliFindings
Strengths
console.Format*usages show strong adoption of the formatting systemadd_interactive_engine.go,add_interactive_workflow.go, andcompile_file_operations.goall have theconsoleimport and correctly apply formatting in many placesaudit_cross_run_render.gohas a well-structured dual-output design (markdown tables to stdout, summary stats to stderr)%wis used in the majority offmt.ErrorfcallsAreas for Improvement
compile_file_operations.go:74—fmt.Fprintln(os.Stderr, err.Error())bypassesFormatErrorMessage; users see a plain string instead of the styled error prefixcompile_file_operations.go:174—"Watching for file changes"uses bareFprintlninstead ofFormatProgressMessageadd_interactive_engine.go:77—fmt.Fprintf(os.Stderr, "Using coding agent: %s\n", ...)should beFormatInfoMessageadd_interactive_engine.go:162/add_interactive_workflow.go:50,56,65— multiple bare status lines without any console formatting in interactive flowsadd_interactive_workflow.go:135,140,143— "Updating local branch..." and associated messages are bare, breaking the visual cadence of a formatted success sequencereturn errinpkg/cli(e.g.mcp_secrets.go:55,logs_orchestrator.go:44,203,validate_command.go:42) add no context, making stack traces harder to interpretDetailed Analysis
compile_file_operations.gois invoked on every compile run and is one of the most user-visible code paths. Line 74 is in the per-file compile loop:Line 174 starts the watch mode:
add_interactive_workflow.gohas a noticeable drop in formatting quality in the progress-polling section (lines 50–65) where it uses rawfmt.Fprintf(os.Stderr, ...)for status check messages while surrounding lines useFormatSuccessMessage/FormatWarningMessage.add_interactive_engine.go:77is printed directly before a formattedFormatInfoMessageat line 83, producing inconsistent style in the same function.For error wrapping,
logs_orchestrator.go:44sits at the entry to log downloading and discards the call context entirely withreturn err.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Apply console formatting to compile_file_operations.go bare output calls
Priority: High
Estimated Effort: Small
Focus Area: CLI Output Consistency
Description: Two bare output calls in
pkg/cli/compile_file_operations.gobypass the console formatting system. Fix them to use the appropriateconsole.Format*helpers so compile-loop errors and watch-mode start messages are visually consistent with the rest of the CLI.Acceptance Criteria:
fmt.Fprintln(os.Stderr, err.Error())→fmt.Fprintln(os.Stderr, console.FormatErrorMessage(err.Error()))fmt.Fprintln(os.Stderr, "Watching for file changes")→fmt.Fprintln(os.Stderr, console.FormatProgressMessage("Watching for file changes"))make build && make fmtpasses without errorsCode Region:
pkg/cli/compile_file_operations.goTask 2: Apply console formatting to bare messages in add_interactive_engine.go
Priority: Medium
Estimated Effort: Small
Focus Area: CLI Output Consistency
Description:
pkg/cli/add_interactive_engine.gohas several barefmt.Fprintf/Fprintln(os.Stderr, ...)calls interleaved with properly formatted ones, breaking the visual cadence of the interactive engine-selection flow.Acceptance Criteria:
fmt.Fprintf(os.Stderr, "Using coding agent: %s\n", c.EngineOverride)→fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Using coding agent: "+c.EngineOverride))FormatInfoMessagefmt.Fprintln(os.Stderr, "")blank-line separators can remain as-is (they are intentional spacing, not messages)make build && make fmtpassesCode Region:
pkg/cli/add_interactive_engine.goTask 3: Apply console formatting to bare messages in add_interactive_workflow.go
Priority: Medium
Estimated Effort: Small
Focus Area: CLI Output Consistency
Description: The polling and branch-update sections of
pkg/cli/add_interactive_workflow.gouse barefmt.Fprintf(os.Stderr, ...)calls while adjacent lines useconsole.Format*, creating an inconsistent UX during thegh aw addinteractive flow.Acceptance Criteria:
fmt.Fprintf(os.Stderr, "Checking workflow status (attempt %d/5) for: %s\n", ...)→FormatProgressMessagefmt.Fprintf(os.Stderr, "Status check error: %v\n", err)→FormatWarningMessagefmt.Fprintf(os.Stderr, "Found %d workflow(s) matching pattern\n", ...)→FormatInfoMessagefmt.Fprintln(os.Stderr, "No workflows found matching pattern yet")→FormatInfoMessageFormatProgressMessageorFormatInfoMessagemake build && make fmtpassesCode Region:
pkg/cli/add_interactive_workflow.goTask 4: Add error context to bare
return errcalls in pkg/cli high-traffic pathsPriority: Medium
Estimated Effort: Medium
Focus Area: CLI Output Consistency
Description: Over 20 locations in
pkg/clireturnerrdirectly without wrapping it in a contextual message. The highest-impact locations are inlogs_orchestrator.go,validate_command.go,compile_validation.go, andmcp_secrets.go. Wrapping errors withfmt.Errorf("... context ...: %w", err)dramatically improves debugging and error chains.Acceptance Criteria:
logs_orchestrator.go:44— wrap withfmt.Errorf("failed to initialize logs orchestrator: %w", err)(or appropriate message)logs_orchestrator.go:203— wrap with contextual message indicating which operation failedvalidate_command.go:42,72— wrap withfmt.Errorf("validation failed: %w", err)compile_validation.go:42— wrap withfmt.Errorf("compile validation failed: %w", err)mcp_secrets.go:55— wrap with contextual messagemake test-unitpasses)Code Region:
pkg/cli/logs_orchestrator.go,pkg/cli/validate_command.go,pkg/cli/compile_validation.go,pkg/cli/mcp_secrets.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
compile_file_operations.gobare output calls — Priority: High (every compile run is affected)Short-term Actions (This Month)
add_interactive_engine.goandadd_interactive_workflow.gobare messages — Priority: Mediumreturn errin high-traffic paths — Priority: MediumLong-term Actions (This Quarter)
staticcheckorgolangci-lintcheck) that flagsfmt.Fprintln(os.Stderr, ...)withoutconsole.Format*— Priority: Low📈 Success Metrics
return errwithout context in pkg/cli: 20+ → < 5Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-05-09 — Focus area selected by diversity algorithm
References: §25557600244
All reactions