Skip to content

Add --version flag support to gh-aw CLI#1104

Merged
pelikhan merged 4 commits intomainfrom
copilot/fix-a4f17aff-7708-451b-b92e-a673f0a57092
Sep 30, 2025
Merged

Add --version flag support to gh-aw CLI#1104
pelikhan merged 4 commits intomainfrom
copilot/fix-a4f17aff-7708-451b-b92e-a673f0a57092

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 30, 2025

Overview

Implements support for the --version flag to provide parity with gh CLI behavior. Previously, only the version subcommand was available, and using --version would result in an error.

Changes

Before

$ gh aw --version
Error: unknown flag: --version

After

$ gh aw --version
ℹ gh aw version v0.10.0
ℹ GitHub Agentic Workflows CLI from GitHub Next

$ gh aw version
ℹ gh aw version v0.10.0
ℹ GitHub Agentic Workflows CLI from GitHub Next

Both commands now work and produce identical output.

Implementation Details

  • Added Version field to rootCmd: Leverages Cobra's built-in version flag support by setting the Version field on the root command
  • Configured custom version template: Uses the same console formatting as the existing version subcommand for consistency
  • Set output to stderr: Ensures all CLI output goes to stderr per project guidelines using SetOut(os.Stderr)
  • Added comprehensive tests: Verifies both --version and version work correctly and produce identical output

Testing

  • ✅ New tests verify --version flag functionality
  • ✅ Tests ensure output consistency between flag and subcommand
  • ✅ All existing tests continue to pass
  • make agent-finish completes successfully

This change maintains backward compatibility while adding the requested functionality with minimal code changes.

Fixes #[issue number]

Original prompt

the cli should support the flag --version and display the version: gh aw --version. Parity with the gh behavior.


💡 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.

Copilot AI and others added 3 commits September 30, 2025 05:30
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] the cli should support the flag --version and display the version: gh aw --version. Parity with the gh behavior. Add --version flag support to gh-aw CLI Sep 30, 2025
Copilot AI requested a review from pelikhan September 30, 2025 05:43
@pelikhan pelikhan marked this pull request as ready for review September 30, 2025 06:26
@pelikhan pelikhan merged commit 778ef94 into main Sep 30, 2025
14 checks passed
@pelikhan pelikhan deleted the copilot/fix-a4f17aff-7708-451b-b92e-a673f0a57092 branch September 30, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants