cli/pkg/qa/cmd_qa.go

45 lines
1.1 KiB
Go
Raw Normal View History

// Package qa provides quality assurance workflow commands.
//
// Unlike `core dev` which is about doing work (commit, push, pull),
// `core qa` is about verifying work (CI status, reviews, issues).
//
// Commands:
// - watch: Monitor GitHub Actions after a push, report actionable data
feat(qa): add review command for PR status (#64) * feat(qa): add qa watch command for CI monitoring (#47) Implements `core qa watch` to monitor GitHub Actions after a push: - Polls workflow runs for a commit until completion - Shows live progress with pass/fail counts - On failure, shows job name, failed step, and link to logs - Exits with appropriate code (0 = passed, 1 = failed) Usage: core qa watch # Watch current repo's HEAD core qa watch --repo X # Watch specific repo core qa watch --timeout 5m # Custom timeout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(qa): address CodeRabbit feedback on watch command - Add length check before slicing commitSha to prevent panic on short SHAs - Count all non-success conclusions as failures (cancelled, timed_out, etc.) - Use errors.E/Wrap pattern for consistent error handling with operation context Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(qa): add context-aware commands and log parsing - Use exec.CommandContext with timeout context for all gh invocations so commands are cancelled when deadline expires - Implement fetchErrorFromLogs using 'gh run view --log-failed' to extract first meaningful error line from failed workflows - Pass context through call chain for proper timeout propagation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(qa): add review command for PR status (#62) Add `core qa review` command to show PR review status with actionable next steps. Answers: "What do I need to do to get my PRs merged?" and "What reviews am I blocking?" Features: - Shows your open PRs with merge status (CI, reviews, conflicts) - Shows PRs where your review is requested - Provides actionable suggestions (rebase, address feedback, etc.) - Flags: --mine, --requested, --repo Closes #62 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(qa): add review command for PR status (#62) Add `core qa review` command to show PR review status with actionable next steps. Answers: "What do I need to do to get my PRs merged?" and "What reviews am I blocking?" Features: - Shows your open PRs with merge status (CI, reviews, conflicts) - Shows PRs where your review is requested - Provides actionable suggestions (rebase, address feedback, etc.) - Flags: --mine, --requested, --repo Closes #62 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(qa): address CodeRabbit feedback on review command - Fix truncate to use runes for UTF-8 safe string slicing - Remove unused user parameter from showMyPRs and showRequestedReviews - Remove unused getCurrentUser function Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(qa): remove duplicate i18n block and improve error handling - Remove duplicate cmd.qa block in en_GB.json - Use errors.E consistently for error wrapping - Require --repo flag when not in a git repository Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 03:56:48 +00:00
// - review: PR review status with actionable next steps
// - health: Aggregate CI health across all repos
// - issues: Intelligent issue triage
package qa
import (
"github.com/host-uk/core/pkg/cli"
"github.com/host-uk/core/pkg/i18n"
)
func init() {
cli.RegisterCommands(AddQACommands)
}
// Style aliases from shared package
var (
successStyle = cli.SuccessStyle
errorStyle = cli.ErrorStyle
warningStyle = cli.WarningStyle
dimStyle = cli.DimStyle
)
// AddQACommands registers the 'qa' command and all subcommands.
func AddQACommands(root *cli.Command) {
qaCmd := &cli.Command{
Use: "qa",
Short: i18n.T("cmd.qa.short"),
Long: i18n.T("cmd.qa.long"),
}
root.AddCommand(qaCmd)
// Subcommands
addWatchCommand(qaCmd)
feat(qa): add review command for PR status (#64) * feat(qa): add qa watch command for CI monitoring (#47) Implements `core qa watch` to monitor GitHub Actions after a push: - Polls workflow runs for a commit until completion - Shows live progress with pass/fail counts - On failure, shows job name, failed step, and link to logs - Exits with appropriate code (0 = passed, 1 = failed) Usage: core qa watch # Watch current repo's HEAD core qa watch --repo X # Watch specific repo core qa watch --timeout 5m # Custom timeout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(qa): address CodeRabbit feedback on watch command - Add length check before slicing commitSha to prevent panic on short SHAs - Count all non-success conclusions as failures (cancelled, timed_out, etc.) - Use errors.E/Wrap pattern for consistent error handling with operation context Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(qa): add context-aware commands and log parsing - Use exec.CommandContext with timeout context for all gh invocations so commands are cancelled when deadline expires - Implement fetchErrorFromLogs using 'gh run view --log-failed' to extract first meaningful error line from failed workflows - Pass context through call chain for proper timeout propagation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(qa): add review command for PR status (#62) Add `core qa review` command to show PR review status with actionable next steps. Answers: "What do I need to do to get my PRs merged?" and "What reviews am I blocking?" Features: - Shows your open PRs with merge status (CI, reviews, conflicts) - Shows PRs where your review is requested - Provides actionable suggestions (rebase, address feedback, etc.) - Flags: --mine, --requested, --repo Closes #62 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(qa): add review command for PR status (#62) Add `core qa review` command to show PR review status with actionable next steps. Answers: "What do I need to do to get my PRs merged?" and "What reviews am I blocking?" Features: - Shows your open PRs with merge status (CI, reviews, conflicts) - Shows PRs where your review is requested - Provides actionable suggestions (rebase, address feedback, etc.) - Flags: --mine, --requested, --repo Closes #62 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(qa): address CodeRabbit feedback on review command - Fix truncate to use runes for UTF-8 safe string slicing - Remove unused user parameter from showMyPRs and showRequestedReviews - Remove unused getCurrentUser function Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(qa): remove duplicate i18n block and improve error handling - Remove duplicate cmd.qa block in en_GB.json - Use errors.E consistently for error wrapping - Require --repo flag when not in a git repository Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 03:56:48 +00:00
addReviewCommand(qaCmd)
addHealthCommand(qaCmd)
addIssuesCommand(qaCmd)
}