Skip to content

Add upgrade command combining init and codemods for all workflows#10884

Merged
pelikhan merged 3 commits intomainfrom
copilot/ensure-init-runs-with-codemods
Jan 20, 2026
Merged

Add upgrade command combining init and codemods for all workflows#10884
pelikhan merged 3 commits intomainfrom
copilot/ensure-init-runs-with-codemods

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Adds gh aw upgrade to update repositories to the latest gh-aw version. Previously users had to manually run gh aw init to update agent files and gh aw fix --write to migrate deprecated syntax.

Changes

  • New command: gh aw upgrade

    • Updates agent/prompt files to latest templates (init functionality)
    • Applies codemods to migrate deprecated fields (fix functionality)
    • Always upgrades all workflows in the directory
    • Supports --no-fix flag to skip codemods
    • Supports --dir flag for custom workflow directories
  • Implementation: pkg/cli/upgrade_command.go

    • Calls updateAgentFiles() to ensure latest templates
    • Calls RunFix() with write enabled to apply codemods to all workflows
    • Skips compilation by default (users run gh aw compile after)
  • Test coverage: pkg/cli/upgrade_command_test.go

    • Tests agent file updates, codemod application, flag behavior
    • Validates that all workflows are upgraded together
    • Tests error handling for non-git repositories

Usage

gh aw upgrade                    # Upgrade all workflows
gh aw upgrade --no-fix          # Update agent files only
gh aw upgrade --dir custom/workflows  # Upgrade workflows in custom directory
gh aw compile                    # Compile after upgrading

The command always processes all workflows in the directory, migrating deprecated syntax (e.g., timeout_minutestimeout-minutes) and updating all agent files in a single operation.

Custom agent used: w3c-specification-writer
AI technical specification writer following W3C conventions and best practices for formal specifications

Original prompt

The "upgrade" command should also ensure that "init" is run with codemods to upgrade workflows.

Custom agent used: w3c-specification-writer
AI technical specification writer following W3C conventions and best practices for formal specifications


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

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Ensure upgrade command runs init with codemods for workflows Add upgrade command combining init and codemods Jan 20, 2026
Copilot AI requested a review from pelikhan January 20, 2026 18:17
@pelikhan
Copy link
Contributor

@copilot remove options to upgrade selectively workflows, always upgrade all workflows

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 20, 2026

@copilot remove options to upgrade selectively workflows, always upgrade all workflows

Done in commit 7bda172. The upgrade command now always upgrades all workflows and no longer accepts workflow arguments.

Changes:

  • Command signature changed from gh aw upgrade [workflow]... to gh aw upgrade
  • Removed WorkflowIDs field from config
  • Command now uses Args: cobra.NoArgs to reject arguments
  • Updated help text and examples to emphasize upgrading all workflows
  • Removed test for selective workflow upgrades

The command now correctly rejects workflow arguments (e.g., gh aw upgrade ci-doctor returns an error) and always processes all workflows in the directory.

Copilot AI changed the title Add upgrade command combining init and codemods Add upgrade command combining init and codemods for all workflows Jan 20, 2026
@pelikhan pelikhan marked this pull request as ready for review January 20, 2026 20:00
@pelikhan pelikhan merged commit 5f89796 into main Jan 20, 2026
@pelikhan pelikhan deleted the copilot/ensure-init-runs-with-codemods branch January 20, 2026 20:00
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