Integrate console formatting with validation errors #12671
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Validation errors appeared as plain text while other CLI errors used console formatting (✗ prefix, color styling), creating inconsistent user experience.
Changes
New validation output helpers (
pkg/cli/validation_output.go):FormatValidationError(err)- Applies console styling while preserving error structurePrintValidationError(err)- Convenience wrapper for formatting + printing to stderrUpdated compile command (
cmd/gh-aw/main.go):Test coverage (
pkg/cli/validation_output_test.go):GitHubToolsetValidationError)Architecture
Maintains separation of concerns:
Example formatted output:
The helpers are available for future use in other commands that return validation errors.
Original prompt
This section details on the original issue you should resolve
<issue_title>[Code Quality] Integrate console formatting with validation errors</issue_title>
<issue_description>### Description
Bridge the gap between validation errors (currently plain text) and CLI console formatting to provide consistent, styled error display. Currently 0 validation errors use console formatting, leading to inconsistent user experience between validation errors and other CLI output.
Current Situation
Console Formatting Gap:
console.FormatErrorMessage()Current Pattern:
Proposed Architecture
Design Principle: Separation of concerns
This approach:
Implementation Plan
Phase 1: Create Formatting Helper (Day 1)
Create
pkg/cli/validation_output.go:Phase 2: Update CLI Commands (Day 1-2)
Pattern:
Commands to update (minimum 5):
pkg/cli/compile_command.go-RunCompileWorkflowpkg/cli/run_command.go-RunRunWorkflowpkg/cli/mcp_inspect_command.go- inspect operationspkg/cli/audit_command.go- validation failurespkg/cli/compile_validation.go- all validation error printsPhase 3: Testing (Day 2)
Create
pkg/cli/validation_output_test.go:Example Transformation
Before:
$ gh aw compile invalid.md missing required field 'engine'After:
$ gh aw compile invalid.md ✖ missing required field 'engine'. Example: engine: copilot(where ✖ and error text are styled with red color)
Success Criteria
pkg/cli/validation_output.gowithFormatValidationErrorhelperconsole.FormatErrorMessagestylingGitHubToolsetValidationError) preserve structurevalidation_output_test.goverify formatting doesn't alter error contentmake agent-finishsuccessfullyExpected Outcomes
Priority
Medium - User experience improvement
Estimated Effort
Medium (1-2 days)
Files to Create
pkg/cli/validation_output.go(new file)pkg/cli/validation_output_test.go(new file)Files to Update
pkg/cli/compile_command.gopkg/cli/run_command.gopkg/cli/mcp_inspect_command.gopkg/cli/audit_command.gopkg/cli/compile_validation.goRelated Issues
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.