-
Notifications
You must be signed in to change notification settings - Fork 0
Add --output-format flag for GitHub Actions workflow integration #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: EndlessTrax <[email protected]>
Co-authored-by: EndlessTrax <[email protected]>
Co-authored-by: EndlessTrax <[email protected]>
|
@copilot let's refactor this and remove all output logic and code into /pkg. the /cmd/check.go should contain only cli logic. Use the same design pattern used through the code base to use a separation of duties and implement a common interface for output. Also, if you are able, look a the code base for https://github.com/astral-sh/ruff. They have very nicely formatted output that works well for GitHub actions with their |
- Created pkg/output package with Formatter interface - Implemented DefaultFormatter, VerboseFormatter, and GitHubFormatter - Changed --github-output flag to --output-format with values: default, verbose, github - Kept -v/--verbose flag for backward compatibility (deprecated) - All output logic moved from cmd/check.go to pkg/output - cmd/check.go now contains only CLI logic - Added comprehensive tests for output package - Updated README with new --output-format flag documentation Co-authored-by: EndlessTrax <[email protected]>
Refactored! All output logic moved to Architecture:
Flag Changes:
Examples: # Default (broken links only)
brokli check url https://example.com
# Verbose (all links)
brokli check url https://example.com -o verbose
# GitHub Actions format
brokli check url https://example.com -o githubTesting:
See full demo output below showing all three formats in action. Demo Output: Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
- Changed GITHUB_OUTPUT file permissions from 0644 to 0600 for better security - Fixed comment to use correct type names (AnchorTag/SitemapUrl instead of plural) Co-authored-by: EndlessTrax <[email protected]>
|
@copilot Linting is failing with: Please fix. |
- Added FormatNameDefault, FormatNameVerbose, FormatNameGitHub constants to pkg/output - Updated cmd/check.go to use these constants instead of string literals - Fixes goconst linting error about string "verbose" having 4 occurrences Co-authored-by: EndlessTrax <[email protected]>
... Fixed in commit dbaa110. Added string constants Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Almost there. Please update |
- Added pkg/output/ to architecture overview - Updated completed features to include output formats and GitHub Actions integration - Documented the Formatter interface and three implementations - Added detailed explanation of CLI flags and output format options - Documented helper functions in pkg/output/utils.go - Added "Adding a new output format" common task section - Updated "Working with output formatters" guidance Co-authored-by: EndlessTrax <[email protected]>
Updated in commit 511808e. The copilot-instructions.md now includes:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Refactoring Complete ✅
Summary
Refactored the output logic following the separation of concerns pattern used throughout the codebase. All output formatting has been moved from
/cmd/check.goto a new/pkg/outputpackage with an interface-based design.Changes Made
Architecture
/pkg/outputpackage with clean interface-based designFormatterinterface - Common interface for all output formattersDefaultFormatter- Shows only broken links (default)VerboseFormatter- Shows all links with status codesGitHubFormatter- GitHub Actions format with annotationsCLI Changes
--github-outputto--output-format(or-o)default,verbose,github--output-format=github)-v/--verboseflag (marked as deprecated)/cmd/check.go: Now contains only CLI logic, no output formattingCode Organization
Code Quality
Documentation
Testing
Usage Examples
Benefits
-vflag still worksOriginal prompt
--github-outputflag for GitHub Actions CI compatibility #17✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.