Skip to content

Add audit command suggestion to run command output#4445

Merged
pelikhan merged 2 commits intomainfrom
copilot/suggest-run-audit-analysis
Nov 21, 2025
Merged

Add audit command suggestion to run command output#4445
pelikhan merged 2 commits intomainfrom
copilot/suggest-run-audit-analysis

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

After triggering a workflow, users and AI agents had no immediate guidance on how to analyze the run results.

Changes

  • Display audit command suggestion with run ID after workflow trigger:

    🔗 View workflow run: https://github.com/owner/repo/actions/runs/1234567890
    
    💡 To analyze this run, use: gh aw audit 1234567890
    
  • Add test coverage for message format and agent-friendly characteristics

Implementation

Added 3 lines in pkg/cli/run_command.go after the workflow URL display:

// Suggest audit command for analysis
fmt.Printf("\n💡 To analyze this run, use: %s audit %d\n", constants.CLIExtensionPrefix, runInfo.DatabaseID)

The suggestion appears only when run info is successfully retrieved, providing immediate actionable guidance without requiring users to extract the run ID from the URL.

Original prompt

Review the output of the run command such that it suggests to run audit to analyze the run. Make it friendly for an agent


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Add friendly suggestion to use 'gh aw audit <run-id>' after workflow is triggered. This makes it easier for AI agents and users to analyze workflow runs.

- Added audit suggestion message with run ID
- Includes lightbulb emoji for visual friendliness
- Shows specific command with run ID (no lookup needed)
- Added comprehensive tests for message format and agent-friendliness

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review November 21, 2025 03:37
Copilot AI review requested due to automatic review settings November 21, 2025 03:37
Copilot AI changed the title [WIP] Suggest running audit to analyze the run command output Add audit command suggestion to run command output Nov 21, 2025
Copilot AI requested a review from pelikhan November 21, 2025 03:37
@pelikhan pelikhan added the smoke label Nov 21, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

✅ Agentic Changeset Generator completed successfully.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a helpful audit command suggestion after workflow runs are triggered, improving discoverability of the audit feature for both users and AI agents. The implementation is minimal (3 lines) and includes comprehensive test coverage.

Key Changes

  • Added audit command suggestion to run command output with run ID
  • Created dedicated test file with 3 test functions covering message format and agent-friendliness
  • Message displays only when run info is successfully retrieved

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/cli/run_command.go Adds 3 lines to display audit suggestion with run ID after workflow URL
pkg/cli/run_command_test.go New test file with 128 lines covering message format, exact output, and agent-friendly characteristics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

runLog.Printf("Workflow run URL: %s (ID: %d)", runInfo.URL, runInfo.DatabaseID)

// Suggest audit command for analysis
fmt.Printf("\n💡 To analyze this run, use: %s audit %d\n", constants.CLIExtensionPrefix, runInfo.DatabaseID)
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codebase uses console.FormatInfoMessage() for informational messages with emojis to maintain consistent styling across the CLI. This pattern is used in other parts of the codebase (e.g., mcp_inspect_mcp.go line 533, 568).

Consider using:

fmt.Printf("\n%s\n", console.FormatInfoMessage(fmt.Sprintf("💡 To analyze this run, use: %s audit %d", constants.CLIExtensionPrefix, runInfo.DatabaseID)))

This ensures the message uses the standard info message styling (with ℹ prefix) applied by FormatInfoMessage().

Suggested change
fmt.Printf("\n💡 To analyze this run, use: %s audit %d\n", constants.CLIExtensionPrefix, runInfo.DatabaseID)
fmt.Printf("\n%s\n", console.FormatInfoMessage(fmt.Sprintf("💡 To analyze this run, use: %s audit %d", constants.CLIExtensionPrefix, runInfo.DatabaseID)))

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 9d96b45 into main Nov 21, 2025
175 of 176 checks passed
@pelikhan pelikhan deleted the copilot/suggest-run-audit-analysis branch November 21, 2025 03:45
github-actions bot added a commit that referenced this pull request Nov 21, 2025
Updated documentation based on merged pull requests from the last 24 hours.

Features documented:
- --progress flag for run command (PR #4450)
- Noop message parsing in logs/audit commands (PR #4428)
- close-discussion safe output type (PR #4411)
- debug-agentic-workflow custom agent (PR #4449)
- Audit command suggestion in run output (PR #4445)

Changes:
- Updated docs/setup/cli.md to document --progress flag and noop parsing
- Updated docs/reference/safe-outputs.md to add close-discussion safe output
- Updated docs/reference/custom-agents.md to mention debug-agentic-workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants