diff --git a/pkg/cli/add_command.go b/pkg/cli/add_command.go index 489a901689..72fe91122e 100644 --- a/pkg/cli/add_command.go +++ b/pkg/cli/add_command.go @@ -361,7 +361,7 @@ func addWorkflowWithTracking(workflow *WorkflowSpec, number int, verbose bool, q } if verbose { - fmt.Fprintln(os.Stderr, "Locating workflow components...") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Locating workflow components...")) } workflowPath := workflow.WorkflowPath @@ -381,12 +381,12 @@ func addWorkflowWithTracking(workflow *WorkflowSpec, number int, verbose bool, q fmt.Fprintln(os.Stderr, console.FormatInfoMessage("To add workflows to your project:")) fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Use the 'add' command with repository/workflow specifications:")) - fmt.Fprintf(os.Stderr, " %s add owner/repo/workflow-name\n", string(constants.CLIExtensionPrefix)) - fmt.Fprintf(os.Stderr, " %s add owner/repo/workflow-name@version\n", string(constants.CLIExtensionPrefix)) + fmt.Fprintln(os.Stderr, console.FormatCommandMessage(fmt.Sprintf(" %s add owner/repo/workflow-name", string(constants.CLIExtensionPrefix)))) + fmt.Fprintln(os.Stderr, console.FormatCommandMessage(fmt.Sprintf(" %s add owner/repo/workflow-name@version", string(constants.CLIExtensionPrefix)))) fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Example:")) - fmt.Fprintf(os.Stderr, " %s add githubnext/agentics/ci-doctor\n", string(constants.CLIExtensionPrefix)) - fmt.Fprintf(os.Stderr, " %s add githubnext/agentics/daily-plan@main\n", string(constants.CLIExtensionPrefix)) + fmt.Fprintln(os.Stderr, console.FormatCommandMessage(fmt.Sprintf(" %s add githubnext/agentics/ci-doctor", string(constants.CLIExtensionPrefix)))) + fmt.Fprintln(os.Stderr, console.FormatCommandMessage(fmt.Sprintf(" %s add githubnext/agentics/daily-plan@main", string(constants.CLIExtensionPrefix)))) } return fmt.Errorf("workflow not found: %s", workflowPath) diff --git a/pkg/cli/add_interactive.go b/pkg/cli/add_interactive.go index 0ff51e496f..d590d23fc3 100644 --- a/pkg/cli/add_interactive.go +++ b/pkg/cli/add_interactive.go @@ -71,9 +71,9 @@ func RunAddInteractive(ctx context.Context, workflowSpecs []string, verbose bool // Step 1: Welcome message fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "🚀 Welcome to GitHub Agentic Workflows!") + fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("🚀 Welcome to GitHub Agentic Workflows!")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "This tool will walk you through adding an automated workflow to your repository.") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("This tool will walk you through adding an automated workflow to your repository.")) fmt.Fprintln(os.Stderr, "") // Step 1b: Resolve workflows early to get descriptions and validate specs @@ -177,7 +177,7 @@ func (c *AddInteractiveConfig) checkGHAuthStatus() error { if err != nil { fmt.Fprintln(os.Stderr, console.FormatErrorMessage("You are not logged in to GitHub CLI.")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "Please run the following command to authenticate:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please run the following command to authenticate:")) fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, console.FormatCommandMessage(" gh auth login")) fmt.Fprintln(os.Stderr, "") @@ -200,7 +200,7 @@ func (c *AddInteractiveConfig) checkGitRepository() error { if !isGitRepo() { fmt.Fprintln(os.Stderr, console.FormatErrorMessage("Not in a git repository.")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "Please navigate to a git repository or initialize one with:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please navigate to a git repository or initialize one with:")) fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, console.FormatCommandMessage(" git init")) fmt.Fprintln(os.Stderr, "") @@ -287,11 +287,11 @@ func (c *AddInteractiveConfig) checkActionsEnabled() error { if enabled != "true" { fmt.Fprintln(os.Stderr, console.FormatErrorMessage("GitHub Actions is disabled for this repository.")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "To enable GitHub Actions:") - fmt.Fprintln(os.Stderr, " 1. Go to your repository on GitHub") - fmt.Fprintln(os.Stderr, " 2. Navigate to Settings → Actions → General") - fmt.Fprintln(os.Stderr, " 3. Under 'Actions permissions', select 'Allow all actions and reusable workflows'") - fmt.Fprintln(os.Stderr, " 4. Click 'Save'") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("To enable GitHub Actions:")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" 1. Go to your repository on GitHub")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" 2. Navigate to Settings → Actions → General")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" 3. Under 'Actions permissions', select 'Allow all actions and reusable workflows'")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" 4. Click 'Save'")) fmt.Fprintln(os.Stderr, "") return fmt.Errorf("GitHub Actions is not enabled for this repository") } @@ -324,8 +324,8 @@ func (c *AddInteractiveConfig) checkUserPermissions() error { if !hasAccess { fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("You do not have write access to %s/%s.", owner, repo))) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "You need to be a maintainer, admin, or have write permissions on this repository.") - fmt.Fprintln(os.Stderr, "Please contact the repository owner or request access.") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("You need to be a maintainer, admin, or have write permissions on this repository.")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please contact the repository owner or request access.")) fmt.Fprintln(os.Stderr, "") return fmt.Errorf("insufficient repository permissions") } @@ -513,17 +513,17 @@ func (c *AddInteractiveConfig) collectCopilotPAT() error { } fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "GitHub Copilot requires a Personal Access Token (PAT) with Copilot permissions.") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("GitHub Copilot requires a Personal Access Token (PAT) with Copilot permissions.")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "Please create a token at:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please create a token at:")) fmt.Fprintln(os.Stderr, console.FormatCommandMessage(" https://github.com/settings/personal-access-tokens/new")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "Configure the token with:") - fmt.Fprintln(os.Stderr, " â€ĸ Token name: Agentic Workflows Copilot") - fmt.Fprintln(os.Stderr, " â€ĸ Expiration: 90 days (recommended for testing)") - fmt.Fprintln(os.Stderr, " â€ĸ Resource owner: Your personal account") - fmt.Fprintln(os.Stderr, " â€ĸ Repository access: \"Public repositories\" (you must use this setting even for private repos)") - fmt.Fprintln(os.Stderr, " â€ĸ Account permissions → Copilot Requests: Read-only") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Configure the token with:")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" â€ĸ Token name: Agentic Workflows Copilot")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" â€ĸ Expiration: 90 days (recommended for testing)")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" â€ĸ Resource owner: Your personal account")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" â€ĸ Repository access: \"Public repositories\" (you must use this setting even for private repos)")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" â€ĸ Account permissions → Copilot Requests: Read-only")) fmt.Fprintln(os.Stderr, "") var token string @@ -576,9 +576,9 @@ func (c *AddInteractiveConfig) collectGenericAPIKey(opt *constants.EngineOption) } fmt.Fprintln(os.Stderr, "") - fmt.Fprintf(os.Stderr, "%s requires an API key.\n", opt.Label) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("%s requires an API key.", opt.Label))) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "Get your API key from:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Get your API key from:")) fmt.Fprintln(os.Stderr, console.FormatCommandMessage(fmt.Sprintf(" %s", opt.KeyURL))) fmt.Fprintln(os.Stderr, "") @@ -626,9 +626,9 @@ func (c *AddInteractiveConfig) determineFilesToAdd() (workflowFiles []string, in } fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "The following workflow files will be added:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("The following workflow files will be added:")) for _, f := range workflowFiles { - fmt.Fprintf(os.Stderr, " â€ĸ .github/workflows/%s\n", f) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" â€ĸ .github/workflows/%s", f))) } return workflowFiles, initFiles, nil @@ -716,7 +716,7 @@ func (c *AddInteractiveConfig) applyChanges(ctx context.Context, workflowFiles, // Step 8b: Auto-merge the PR if result.PRNumber == 0 { fmt.Fprintln(os.Stderr, console.FormatWarningMessage("Could not determine PR number")) - fmt.Fprintln(os.Stderr, "Please merge the PR manually from the GitHub web interface.") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please merge the PR manually from the GitHub web interface.")) } else { if err := c.mergePullRequest(result.PRNumber); err != nil { // Check if already merged @@ -724,7 +724,7 @@ func (c *AddInteractiveConfig) applyChanges(ctx context.Context, workflowFiles, fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("Merged pull request %s", result.PRURL))) } else { fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to merge PR: %v", err))) - fmt.Fprintln(os.Stderr, "Please merge the PR manually from the GitHub web interface.") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please merge the PR manually from the GitHub web interface.")) } } else { fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("Merged pull request %s", result.PRURL))) @@ -745,9 +745,9 @@ func (c *AddInteractiveConfig) applyChanges(ctx context.Context, workflowFiles, if err := c.addRepositorySecret(secretName, secretValue); err != nil { fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("Failed to add secret: %v", err))) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, "Please add the secret manually:") - fmt.Fprintln(os.Stderr, " 1. Go to your repository Settings → Secrets and variables → Actions") - fmt.Fprintf(os.Stderr, " 2. Click 'New repository secret' and add '%s'\n", secretName) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Please add the secret manually:")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" 1. Go to your repository Settings → Secrets and variables → Actions")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" 2. Click 'New repository secret' and add '%s'", secretName))) return fmt.Errorf("failed to add secret: %w", err) } diff --git a/pkg/cli/audit_report_render.go b/pkg/cli/audit_report_render.go index fbec0c68b7..be68134f0a 100644 --- a/pkg/cli/audit_report_render.go +++ b/pkg/cli/audit_report_render.go @@ -75,11 +75,11 @@ func renderConsole(data AuditData, logsPath string) { fmt.Fprintln(os.Stderr) for _, file := range data.DownloadedFiles { formattedSize := console.FormatFileSize(file.Size) - fmt.Fprintf(os.Stderr, " â€ĸ %s (%s)", file.Path, formattedSize) + fileInfo := fmt.Sprintf(" â€ĸ %s (%s)", file.Path, formattedSize) if file.Description != "" { - fmt.Fprintf(os.Stderr, " - %s", file.Description) + fileInfo += fmt.Sprintf(" - %s", file.Description) } - fmt.Fprintln(os.Stderr) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fileInfo)) } fmt.Fprintln(os.Stderr) } @@ -89,10 +89,10 @@ func renderConsole(data AuditData, logsPath string) { fmt.Fprintln(os.Stderr, console.FormatSectionHeader("Missing Tools")) fmt.Fprintln(os.Stderr) for _, tool := range data.MissingTools { - fmt.Fprintf(os.Stderr, " â€ĸ %s\n", tool.Tool) - fmt.Fprintf(os.Stderr, " Reason: %s\n", tool.Reason) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" â€ĸ %s", tool.Tool))) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Reason: %s", tool.Reason))) if tool.Alternatives != "" { - fmt.Fprintf(os.Stderr, " Alternatives: %s\n", tool.Alternatives) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Alternatives: %s", tool.Alternatives))) } } fmt.Fprintln(os.Stderr) @@ -103,7 +103,7 @@ func renderConsole(data AuditData, logsPath string) { fmt.Fprintln(os.Stderr, console.FormatSectionHeader("MCP Server Failures")) fmt.Fprintln(os.Stderr) for _, failure := range data.MCPFailures { - fmt.Fprintf(os.Stderr, " â€ĸ %s: %s\n", failure.ServerName, failure.Status) + fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf(" â€ĸ %s: %s", failure.ServerName, failure.Status))) } fmt.Fprintln(os.Stderr) } @@ -138,9 +138,9 @@ func renderConsole(data AuditData, logsPath string) { fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("Errors (%d):", len(data.Errors)))) for _, err := range data.Errors { if err.File != "" && err.Line > 0 { - fmt.Fprintf(os.Stderr, " %s:%d: %s\n", filepath.Base(err.File), err.Line, err.Message) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s:%d: %s", filepath.Base(err.File), err.Line, err.Message))) } else { - fmt.Fprintf(os.Stderr, " %s\n", err.Message) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", err.Message))) } } fmt.Fprintln(os.Stderr) @@ -150,9 +150,9 @@ func renderConsole(data AuditData, logsPath string) { fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Warnings (%d):", len(data.Warnings)))) for _, warn := range data.Warnings { if warn.File != "" && warn.Line > 0 { - fmt.Fprintf(os.Stderr, " %s:%d: %s\n", filepath.Base(warn.File), warn.Line, warn.Message) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s:%d: %s", filepath.Base(warn.File), warn.Line, warn.Message))) } else { - fmt.Fprintf(os.Stderr, " %s\n", warn.Message) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", warn.Message))) } } fmt.Fprintln(os.Stderr) @@ -163,7 +163,7 @@ func renderConsole(data AuditData, logsPath string) { fmt.Fprintln(os.Stderr, console.FormatSectionHeader("Logs Location")) fmt.Fprintln(os.Stderr) absPath, _ := filepath.Abs(logsPath) - fmt.Fprintf(os.Stderr, " %s\n", absPath) + fmt.Fprintln(os.Stderr, console.FormatLocationMessage(fmt.Sprintf(" %s", absPath))) fmt.Fprintln(os.Stderr) } @@ -262,17 +262,17 @@ func renderToolUsageTable(toolUsage []ToolUsageInfo) { // renderFirewallAnalysis renders firewall analysis with summary and domain breakdown func renderFirewallAnalysis(analysis *FirewallAnalysis) { // Summary statistics - fmt.Fprintf(os.Stderr, " Total Requests : %d\n", analysis.TotalRequests) - fmt.Fprintf(os.Stderr, " Allowed : %d\n", analysis.AllowedRequests) - fmt.Fprintf(os.Stderr, " Blocked : %d\n", analysis.BlockedRequests) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Total Requests : %d", analysis.TotalRequests))) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Allowed : %d", analysis.AllowedRequests))) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Blocked : %d", analysis.BlockedRequests))) fmt.Fprintln(os.Stderr) // Allowed domains if len(analysis.AllowedDomains) > 0 { - fmt.Fprintln(os.Stderr, " Allowed Domains:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" Allowed Domains:")) for _, domain := range analysis.AllowedDomains { if stats, ok := analysis.RequestsByDomain[domain]; ok { - fmt.Fprintf(os.Stderr, " ✓ %s (%d requests)\n", domain, stats.Allowed) + fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf(" ✓ %s (%d requests)", domain, stats.Allowed))) } } fmt.Fprintln(os.Stderr) @@ -280,10 +280,10 @@ func renderFirewallAnalysis(analysis *FirewallAnalysis) { // Blocked domains if len(analysis.BlockedDomains) > 0 { - fmt.Fprintln(os.Stderr, " Blocked Domains:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" Blocked Domains:")) for _, domain := range analysis.BlockedDomains { if stats, ok := analysis.RequestsByDomain[domain]; ok { - fmt.Fprintf(os.Stderr, " ✗ %s (%d requests)\n", domain, stats.Blocked) + fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf(" ✗ %s (%d requests)", domain, stats.Blocked))) } } fmt.Fprintln(os.Stderr) @@ -293,14 +293,14 @@ func renderFirewallAnalysis(analysis *FirewallAnalysis) { // renderRedactedDomainsAnalysis renders redacted domains analysis func renderRedactedDomainsAnalysis(analysis *RedactedDomainsAnalysis) { // Summary statistics - fmt.Fprintf(os.Stderr, " Total Domains Redacted: %d\n", analysis.TotalDomains) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Total Domains Redacted: %d", analysis.TotalDomains))) fmt.Fprintln(os.Stderr) // List domains if len(analysis.Domains) > 0 { - fmt.Fprintln(os.Stderr, " Redacted Domains:") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" Redacted Domains:")) for _, domain := range analysis.Domains { - fmt.Fprintf(os.Stderr, " 🔒 %s\n", domain) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" 🔒 %s", domain))) } fmt.Fprintln(os.Stderr) } @@ -333,9 +333,9 @@ func renderKeyFindings(findings []Finding) { // Render critical findings first for _, finding := range critical { fmt.Fprintf(os.Stderr, " 🔴 %s [%s]\n", console.FormatErrorMessage(finding.Title), finding.Category) - fmt.Fprintf(os.Stderr, " %s\n", finding.Description) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", finding.Description))) if finding.Impact != "" { - fmt.Fprintf(os.Stderr, " Impact: %s\n", finding.Impact) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Impact: %s", finding.Impact))) } fmt.Fprintln(os.Stderr) } @@ -343,9 +343,9 @@ func renderKeyFindings(findings []Finding) { // Then high severity for _, finding := range high { fmt.Fprintf(os.Stderr, " 🟠 %s [%s]\n", console.FormatWarningMessage(finding.Title), finding.Category) - fmt.Fprintf(os.Stderr, " %s\n", finding.Description) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", finding.Description))) if finding.Impact != "" { - fmt.Fprintf(os.Stderr, " Impact: %s\n", finding.Impact) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Impact: %s", finding.Impact))) } fmt.Fprintln(os.Stderr) } @@ -353,9 +353,9 @@ func renderKeyFindings(findings []Finding) { // Medium severity for _, finding := range medium { fmt.Fprintf(os.Stderr, " 🟡 %s [%s]\n", finding.Title, finding.Category) - fmt.Fprintf(os.Stderr, " %s\n", finding.Description) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", finding.Description))) if finding.Impact != "" { - fmt.Fprintf(os.Stderr, " Impact: %s\n", finding.Impact) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Impact: %s", finding.Impact))) } fmt.Fprintln(os.Stderr) } @@ -363,9 +363,9 @@ func renderKeyFindings(findings []Finding) { // Low severity for _, finding := range low { fmt.Fprintf(os.Stderr, " â„šī¸ %s [%s]\n", finding.Title, finding.Category) - fmt.Fprintf(os.Stderr, " %s\n", finding.Description) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", finding.Description))) if finding.Impact != "" { - fmt.Fprintf(os.Stderr, " Impact: %s\n", finding.Impact) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Impact: %s", finding.Impact))) } fmt.Fprintln(os.Stderr) } @@ -373,9 +373,9 @@ func renderKeyFindings(findings []Finding) { // Info findings for _, finding := range info { fmt.Fprintf(os.Stderr, " ✅ %s [%s]\n", console.FormatSuccessMessage(finding.Title), finding.Category) - fmt.Fprintf(os.Stderr, " %s\n", finding.Description) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" %s", finding.Description))) if finding.Impact != "" { - fmt.Fprintf(os.Stderr, " Impact: %s\n", finding.Impact) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Impact: %s", finding.Impact))) } fmt.Fprintln(os.Stderr) } @@ -402,9 +402,9 @@ func renderRecommendations(recommendations []Recommendation) { // Render high priority first for i, rec := range high { fmt.Fprintf(os.Stderr, " %d. [HIGH] %s\n", i+1, console.FormatWarningMessage(rec.Action)) - fmt.Fprintf(os.Stderr, " Reason: %s\n", rec.Reason) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Reason: %s", rec.Reason))) if rec.Example != "" { - fmt.Fprintf(os.Stderr, " Example: %s\n", rec.Example) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Example: %s", rec.Example))) } fmt.Fprintln(os.Stderr) } @@ -413,9 +413,9 @@ func renderRecommendations(recommendations []Recommendation) { startIdx := len(high) + 1 for i, rec := range medium { fmt.Fprintf(os.Stderr, " %d. [MEDIUM] %s\n", startIdx+i, rec.Action) - fmt.Fprintf(os.Stderr, " Reason: %s\n", rec.Reason) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Reason: %s", rec.Reason))) if rec.Example != "" { - fmt.Fprintf(os.Stderr, " Example: %s\n", rec.Example) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Example: %s", rec.Example))) } fmt.Fprintln(os.Stderr) } @@ -424,9 +424,9 @@ func renderRecommendations(recommendations []Recommendation) { startIdx += len(medium) for i, rec := range low { fmt.Fprintf(os.Stderr, " %d. [LOW] %s\n", startIdx+i, rec.Action) - fmt.Fprintf(os.Stderr, " Reason: %s\n", rec.Reason) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Reason: %s", rec.Reason))) if rec.Example != "" { - fmt.Fprintf(os.Stderr, " Example: %s\n", rec.Example) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Example: %s", rec.Example))) } fmt.Fprintln(os.Stderr) } @@ -434,18 +434,18 @@ func renderRecommendations(recommendations []Recommendation) { // renderFailureAnalysis renders failure analysis information func renderFailureAnalysis(analysis *FailureAnalysis) { - fmt.Fprintf(os.Stderr, " Primary Failure: %s\n", console.FormatErrorMessage(analysis.PrimaryFailure)) + fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf(" Primary Failure: %s", analysis.PrimaryFailure))) fmt.Fprintln(os.Stderr) if len(analysis.FailedJobs) > 0 { - fmt.Fprintf(os.Stderr, " Failed Jobs:\n") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" Failed Jobs:")) for _, job := range analysis.FailedJobs { - fmt.Fprintf(os.Stderr, " â€ĸ %s\n", job) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" â€ĸ %s", job))) } fmt.Fprintln(os.Stderr) } - fmt.Fprintf(os.Stderr, " Error Summary: %s\n", analysis.ErrorSummary) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" Error Summary: %s", analysis.ErrorSummary))) fmt.Fprintln(os.Stderr) if analysis.RootCause != "" { diff --git a/pkg/cli/trial_command.go b/pkg/cli/trial_command.go index 57124d4ff5..425a7b9245 100644 --- a/pkg/cli/trial_command.go +++ b/pkg/cli/trial_command.go @@ -735,8 +735,8 @@ func showTrialConfirmation(parsedSpecs []*WorkflowSpec, logicalRepoSlug, cloneRe workflowName := parsedSpecs[0].WorkflowName if repeatCount > 0 && autoMergePRs { fmt.Fprintf(os.Stderr, console.FormatInfoMessage(" %d. For each of %d executions:\n"), stepNum, repeatCount+1) - fmt.Fprintf(os.Stderr, " a. Execute %s\n", workflowName) - fmt.Fprintf(os.Stderr, " b. Auto-merge any pull requests created during execution\n") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" a. Execute %s", workflowName))) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" b. Auto-merge any pull requests created during execution")) } else if repeatCount > 0 { fmt.Fprintf(os.Stderr, console.FormatInfoMessage(" %d. Execute %s %d times\n"), stepNum, workflowName, repeatCount+1) } else if autoMergePRs { @@ -755,8 +755,8 @@ func showTrialConfirmation(parsedSpecs []*WorkflowSpec, logicalRepoSlug, cloneRe if repeatCount > 0 && autoMergePRs { fmt.Fprintf(os.Stderr, console.FormatInfoMessage(" %d. For each of %d executions:\n"), stepNum, repeatCount+1) - fmt.Fprintf(os.Stderr, " a. Execute: %s\n", workflowList) - fmt.Fprintf(os.Stderr, " b. Auto-merge any pull requests created during execution\n") + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" a. Execute: %s", workflowList))) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage(" b. Auto-merge any pull requests created during execution")) } else if repeatCount > 0 { fmt.Fprintf(os.Stderr, console.FormatInfoMessage(" %d. Execute %d times: %s\n"), stepNum, repeatCount+1, workflowList) } else if autoMergePRs {