Skip to content

Remove --create-pull-request and --push flags from add command#19016

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/remove-pr-creation-behavior
Closed

Remove --create-pull-request and --push flags from add command#19016
Copilot wants to merge 7 commits intomainfrom
copilot/remove-pr-creation-behavior

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

  • Remove --create-pull-request / --pr flags and CreatePR from AddOptions / AddWorkflowsResult
  • Split types: new AddWizardResult and AddResolvedWorkflowsWithPR for wizard-only PR concerns
  • Remove --push / Push flag from add command — git operations belong to the add-wizard only
  • Update docs: remove references to add --create-pull-request, --pr, and --push from docs/src/content/docs/setup/cli.md and docs/src/content/docs/guides/packaging-imports.md
  • Fix log line in AddResolvedWorkflowsWithPR to report both spec count (specs=) and resolved workflow count (resolved_workflows=)
  • Replace trivial TestAddWizardResult struct round-trip test with TestAddResolvedWorkflowsWithPR_GHNotAvailable and TestAddResolvedWorkflowsWithPR_NotGitRepo to cover real failure paths
Original prompt

Remove PR creation behavior in "add" command. The add-wizard does this kind of operation.

The "add" command should behave like other package add command so that engineer are familiar with its behavior.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove PR creation behavior from add command Remove --create-pull-request flag from add command Mar 1, 2026
@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

@copilot split the interface types for add wizard and finish the cleanup

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

Copilot AI commented Mar 1, 2026

@copilot split the interface types for add wizard and finish the cleanup

Done in b7921d3. Split the types as follows:

  • AddOptions.CreatePR removed — wizard-only concern
  • AddWorkflowsResult.PRNumber/PRURL removed — wizard-only concern
  • New AddWizardResult type in add_workflow_pr.go holds PRNumber, PRURL, HasWorkflowDispatch
  • New AddResolvedWorkflowsWithPR function in add_workflow_pr.go encapsulates PR prerequisite checks + PR creation for the wizard
  • add_interactive_git.go calls AddResolvedWorkflowsWithPR directly; add_interactive_orchestrator.go stores *AddWizardResult

@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

@copilot render the help of add and add-wizard

@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

@copilot remove the --push option of add command. The add command should not interact with git. Only the add-wizard does git operations.

Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot render the help of add and add-wizard

Both add and add-wizard are aliases of the same command, so their help output is identical. Here it is:

Add one or more workflows from repositories to .github/workflows.

By default, this command runs in interactive mode, which guides you through:
  - Selecting an AI engine (Copilot, Claude, or Codex)
  - Configuring API keys and secrets
  - Creating a pull request with the workflow
  - Optionally running the workflow

Use --non-interactive to skip the guided setup and add workflows directly.

Examples:
  gh aw add githubnext/agentics/daily-repo-status        # Interactive setup (recommended)
  gh aw add githubnext/agentics/ci-doctor --non-interactive  # Skip interactive mode
  gh aw add githubnext/agentics/ci-doctor@v1.0.0         # Add with version
  gh aw add githubnext/agentics/workflows/ci-doctor.md@main
  gh aw add https://github.com/githubnext/agentics/blob/main/workflows/ci-doctor.md
  gh aw add githubnext/agentics/ci-doctor --push         # Add and push changes
  gh aw add ./my-workflow.md                             # Add local workflow
  gh aw add ./*.md                                       # Add all local workflows
  gh aw add githubnext/agentics/ci-doctor --dir shared   # Add to .github/workflows/shared/

...

Usage:
  gh aw add <workflow>... [flags]

Aliases:
  add, add-wizard

Flags:
      --append string              Append extra content to the end of agentic workflow on installation
  -d, --dir string                 Subdirectory under .github/workflows/ (e.g., 'shared' creates .github/workflows/shared/)
      --disable-security-scanner   Disable security scanning of workflow markdown content
  -e, --engine string              Override AI engine (claude, codex, copilot, custom)
  -f, --force                      Overwrite existing workflow files without confirmation
  -h, --help                       help for add
  -n, --name string                Specify name for the added workflow (without .md extension)
      --no-gitattributes           Skip updating .gitattributes file
      --no-stop-after              Remove any stop-after field from the workflow
      --non-interactive            Skip interactive setup and use traditional behavior (for CI/automation)
      --push                       Automatically commit and push changes after successful workflow addition
  -r, --repo string                Source repository containing workflows (owner/repo format)
      --stop-after string          Override stop-after value in the workflow (e.g., '+48h', '2025-12-31 23:59:59')

Global Flags:
      --banner    Display ASCII logo banner with purple GitHub color theme
  -v, --verbose   Enable verbose output showing detailed information

--create-pull-request / --pr are gone from the flags list. PR creation remains part of the interactive wizard flow only.

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

Copilot AI commented Mar 1, 2026

@copilot remove the --push option of add command. The add command should not interact with git. Only the add-wizard does git operations.

Done in 57f9a23. Removed --push from the add command entirely — Push bool dropped from AddOptions, flag registration removed, and the commitAndPush block deleted from addWorkflowsWithTracking. Git operations remain exclusively in the add-wizard path.

Updated help:

Flags:
      --append string              Append extra content to the end of agentic workflow on installation
  -d, --dir string                 ...
      --disable-security-scanner   ...
  -e, --engine string              ...
  -f, --force                      ...
  -h, --help                       ...
  -n, --name string                ...
      --no-gitattributes           ...
      --no-stop-after              ...
      --non-interactive            ...
  -r, --repo string                ...
      --stop-after string          ...

--push is no longer listed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go /tmp/go-build772/tmp/gh-aw/aw-feature-branch.patch -tes�� -test.paniconexit0 -test.v=true /usr/bin/git -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha GOMODCACHE go ache/node/24.13.1/x64/bin/node -json GO111MODULE 64/bin/go ache/node/24.13.1/x64/bin/node 1921�� y -importcfg /usr/bin/git -s -w -buildmode=exe git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha SameOutput1753691547/001/stability-test.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 540808/b419/styles.test GOINSECURE GOMOD GOMODCACHE 540808/b419/styles.test (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -unreachable=false /tmp/go-build772540808/b108/vet.cfg /usr/bin/git prettier --check 64/bin/go git rev-�� --show-toplevel sh /opt/hostedtoolcache/node/24.13.1/x64/bin/node &#34;prettier&#34; --chegit sh 64/bin/go node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel go /usr/bin/git 350897061 GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE til.test git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha runs/20260301-120955-28350/test-1856630369 -trimpath /usr/bin/git -p main -lang=go1.25 git rev-�� --show-toplevel -dwarf=false ache/node/24.13.1/x64/bin/node go1.25.0 -c=4 -nolocalimports infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha bility_SameInputSameOutput1753691547/001/stability-test.md -trimpath /usr/bin/infocmp -p main -lang=go1.25 infocmp -1 xterm-color -dwarf=false /usr/bin/gh go1.25.0 -c=4 -nolocalimports gh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ck &#39;scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build772540808/b386/importcfg -pack /tmp/go-build772540808/b386/_testmain.go env 5588887/b394/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/logg-o GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build772540808/b392/importcfg -pack /tmp/go-build772540808/b392/_testmain.go env 5588887/b411/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/time-atomic GOMODCACHE /bin/sh (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git rev-�� --show-toplevel (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha s/test.md --json /usr/bin/git GOSUMDB GOWORK 64/bin/go git -C /home/REDACTED/work/gh-aw/gh-aw/.github/workflows rev-parse /opt/hostedtoolcache/node/24.13.1/x64/bin/node ck &#39;scripts/**/*git GO111MODULE 64/bin/go node (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile env 540808/b399/_pkg_.a GO111MODULE 540808/b399=&gt; GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE wE/WqLtr-OMj2UJecdoY4J0/osnbqV-Hv_T9I4Q6GR2m (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go stlo�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go stlo�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ck &#39;scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 1832887582/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE go m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build772540808/b380/cli.test /tmp/go-build772540808/b380/cli.test -test.testlogfile=/tmp/go-build772540808/b380/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE ortcfg env g/workflow/featuGOINSECURE g/workflow/imporGOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env ck &#39;scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel git 64/bin/go tags/v3 go /usr/bin/git git rev-�� --show-toplevel git 64/bin/go --show-toplevel go /usr/bin/git git (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Remove --create-pull-request flag from add command Remove --create-pull-request and --push flags from add command Mar 1, 2026
@github-actions github-actions bot mentioned this pull request Mar 1, 2026
@dsyme
Copy link
Contributor

dsyme commented Mar 1, 2026

I'd expect the flags to still be on "add". I mean why not, people like to automate these things?

It's the "do things without asking" we want to convert to "do things either by asking (add-wizard) or opt in flag (add)"

@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

/scout research how add/install commands behaves in the top 5 most popular package/library frameworks and compare the behaviors of how libraries are added.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Scout Research Report

Triggered by @pelikhan

Executive Summary

All top package managers follow a consistent pattern: add/install commands are purely local manifest operations — they download a package and update the dependency manifest (and optionally a lockfile), then stop. None of them perform git commits, push changes, or create pull requests. This strongly validates the design decision in this PR to strip those behaviors from the add command and delegate git/PR operations exclusively to the add-wizard.

Detailed Findings by Package Manager

1. npm — npm install (package) (alias: npm add)

Behavior Details
Command npm install (package) or npm add (package) (official alias)
Manifest Adds entry to package.json dependencies or devDependencies
Lockfile Updates package-lock.json
Git ops ❌ None — developer commits manually
PR creation ❌ None

Key note: npm install has many [command aliases]((docs.npmjs.com/redacted) including add, i, in, ins, etc. All are treated identically.


2. Yarn — yarn add (package)

Behavior Details
Command yarn add (package)
Manifest Adds entry to package.json immediately (no --save flag needed)
Lockfile Updates yarn.lock
Git ops ❌ None — developer commits manually
PR creation ❌ None

Key differentiator from npm: Yarn chose add over install as the primary verb for adding a new package, while yarn (no args) installs all existing dependencies. The naming makes the intent explicit.


3. pip — pip install (package)

Behavior Details
Command pip install (package)
Manifest Installs to site-packages/; does not auto-update requirements.txt (manual pip freeze needed) or pyproject.toml
Lockfile None native (tools like Poetry/uv add this)
Git ops ❌ None
PR creation ❌ None

Note: Modern tools like uv add and poetry add do update pyproject.toml/lockfile, but still stop there — no git or PR operations.


4. Cargo (Rust) — cargo add (crate)

Behavior Details
Command cargo add (crate)
Manifest Adds entry under [dependencies] in Cargo.toml
Lockfile Updates Cargo.lock on next build
Git ops ❌ None — Cargo does not touch git at all after adding a dependency
PR creation ❌ None

cargo add is explicitly a manifest command (listed under "Manifest Commands" in the Cargo book). cargo install is a separate concept that installs a binary to $GOPATH/bin, not a project dependency.


5. Go modules — go get (module)

Behavior Details
Command go get (module)
Manifest Adds require directive to go.mod
Lockfile Updates go.sum (checksum database)
Git ops ❌ None — go get downloads to module cache only
PR creation ❌ None

Note: Since Go 1.16, go get is dedicated to dependency management (updating go.mod), while go install is for building/installing binaries. A clean separation of concerns.


6. dotnet/NuGet — dotnet add package (name)

Behavior Details
Command dotnet add package (name) (or dotnet package add in .NET 10+)
Manifest Adds (PackageReference) element to .csproj file; runs dotnet restore automatically
Lockfile Restores packages to ~/.nuget/packages cache
Git ops ❌ None
PR creation ❌ None

Universal Pattern

Developer runs:    add / install (package)
Package manager:   1. Resolves version
                   2. Downloads package
                   3. Updates manifest (package.json / Cargo.toml / go.mod / .csproj)
                   4. Updates lockfile (if applicable)
                   5. STOPS ← no git, no commit, no push, no PR
Developer decides: when and how to commit, push, and open a PR

Recommendations

  • The PR is well-aligned with industry norms. Removing --create-pull-request / --push from add follows the universal convention that package add/install commands are local manifest operations only.
  • Naming is consistent with Yarn's precedent. Yarn popularized the add verb specifically for the "add a new dependency" action vs. install (install all existing). Both have clear, narrowly scoped behavior.
  • Separation of concerns is the right approach. Git operations (branch, commit, push) and PR creation belong to the wizard/orchestration layer — exactly what add-wizard (AddResolvedWorkflowsWithPR) now encapsulates.
  • No package manager auto-commits. If the add command were to auto-commit, it would be unique among all major package managers in a way that would surprise engineers onboarding to the tool.

Key Sources

  • [npm install docs (aliases: add, i, ...)]((docs.npmjs.com/redacted)
  • [Yarn vs npm command cheat sheet]((shift.infinite.red/redacted)
  • [pip install documentation]((pip.pypa.io/redacted)
  • [The Cargo Book — cargo add]((doc.rustlang.org/redacted)
  • [Go modules — managing dependencies]((go.dev/redacted)
  • dotnet add package — NuGet CLI

References: §22546670994

🔭 Intelligence gathered by Scout

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

Hey @Copilot 👋 — great structural improvement here! Moving --create-pull-request / --push out of the add command and into the wizard-specific AddResolvedWorkflowsWithPR is a clean separation of concerns that aligns add with standard package-manager conventions.

One issue needs to be addressed before this is ready:

  • Missing CHANGELOG.md entry for a breaking change — Removing the --create-pull-request, --pr, and --push flags from the add command is a breaking change (Flag Removal or Renaming). Per the project's contribution guidelines, breaking changes require a CHANGELOG.md entry with migration guidance so existing users know how the new flow works (i.e., the wizard now handles PR creation automatically).

If you'd like a hand, you can assign this prompt to your coding agent:

This PR removes the --create-pull-request (--pr) and --push flags from the `add` command.
Flag removal is a breaking change and requires:

1. Add a new entry to CHANGELOG.md documenting this as a breaking change. Follow the existing changelog format:
   - Mark it clearly as a breaking change
   - Explain what was removed (--create-pull-request / --pr / --push flags on `add`)
   - Provide migration guidance: users who relied on `gh aw add --create-pull-request` should now use the interactive wizard (`gh aw add`) which handles branch creation, commit, push, and PR creation automatically via the wizard flow

2. Confirm the changeset type is `major` in any associated release tooling.

Look at existing CHANGELOG.md entries for formatting examples.

Generated by Contribution Check

@pelikhan pelikhan marked this pull request as ready for review March 1, 2026 20:42
Copilot AI review requested due to automatic review settings March 1, 2026 20:42
@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

@copilot review docs to determine if any sample relies on add --push or add --create-pull-request

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 refactors the add command to behave more like a standard “package add/install” command by removing git/PR side effects from the non-interactive path and moving PR creation responsibilities into the interactive add wizard flow.

Changes:

  • Removed --create-pull-request/--pr and --push flags and the associated PR/push execution paths from add.
  • Introduced a wizard-specific AddWizardResult and AddResolvedWorkflowsWithPR helper to encapsulate branch/commit/push/PR creation for interactive flows.
  • Updated interactive orchestration to consume the new wizard result type; updated unit tests accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/cli/add_command.go Removes PR/push flags and deletes PR/push behavior from the non-interactive add execution path.
pkg/cli/add_workflow_pr.go Adds wizard-specific result type and a PR-creating workflow-add entrypoint for interactive usage.
pkg/cli/add_interactive_git.go Switches interactive apply flow to call the new PR-specific add function directly.
pkg/cli/add_interactive_orchestrator.go Updates stored add result type to the new wizard result.
pkg/cli/add_command_test.go Removes assertions for deleted flags/fields and simplifies result tests.
pkg/cli/add_workflow_pr_test.go Adds a new test for the wizard result type.

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

Comment on lines 202 to 254
func TestAddWizardResult(t *testing.T) {
tests := []struct {
name string
prNumber int
prURL string
hasWorkflowDispatch bool
}{
{
name: "default values",
prNumber: 0,
prURL: "",
hasWorkflowDispatch: false,
},
{
name: "with PR number",
prNumber: 123,
prURL: "",
hasWorkflowDispatch: false,
},
{
name: "with PR URL",
prNumber: 0,
prURL: "https://github.com/owner/repo/pull/123",
hasWorkflowDispatch: false,
},
{
name: "with workflow dispatch",
prNumber: 0,
prURL: "",
hasWorkflowDispatch: true,
},
{
name: "all fields set",
prNumber: 456,
prURL: "https://github.com/owner/repo/pull/456",
hasWorkflowDispatch: true,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := &AddWizardResult{
PRNumber: tt.prNumber,
PRURL: tt.prURL,
HasWorkflowDispatch: tt.hasWorkflowDispatch,
}

assert.Equal(t, tt.prNumber, result.PRNumber, "PRNumber should match")
assert.Equal(t, tt.prURL, result.PRURL, "PRURL should match")
assert.Equal(t, tt.hasWorkflowDispatch, result.HasWorkflowDispatch, "HasWorkflowDispatch should match")
})
}
}
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

TestAddWizardResult only verifies that struct fields round-trip after assignment, which doesn’t exercise any behavior and won’t catch regressions. Consider replacing this with targeted tests for AddResolvedWorkflowsWithPR (e.g., deterministic failure paths like “gh not available” via t.Setenv("PATH", ""), and “not a git repo” via os.Chdir(t.TempDir())) so the newly introduced PR-wizard logic has meaningful coverage.

Suggested change
func TestAddWizardResult(t *testing.T) {
tests := []struct {
name string
prNumber int
prURL string
hasWorkflowDispatch bool
}{
{
name: "default values",
prNumber: 0,
prURL: "",
hasWorkflowDispatch: false,
},
{
name: "with PR number",
prNumber: 123,
prURL: "",
hasWorkflowDispatch: false,
},
{
name: "with PR URL",
prNumber: 0,
prURL: "https://github.com/owner/repo/pull/123",
hasWorkflowDispatch: false,
},
{
name: "with workflow dispatch",
prNumber: 0,
prURL: "",
hasWorkflowDispatch: true,
},
{
name: "all fields set",
prNumber: 456,
prURL: "https://github.com/owner/repo/pull/456",
hasWorkflowDispatch: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := &AddWizardResult{
PRNumber: tt.prNumber,
PRURL: tt.prURL,
HasWorkflowDispatch: tt.hasWorkflowDispatch,
}
assert.Equal(t, tt.prNumber, result.PRNumber, "PRNumber should match")
assert.Equal(t, tt.prURL, result.PRURL, "PRURL should match")
assert.Equal(t, tt.hasWorkflowDispatch, result.HasWorkflowDispatch, "HasWorkflowDispatch should match")
})
}
}

Copilot uses AI. Check for mistakes.
// AddResolvedWorkflowsWithPR adds workflows using pre-resolved workflow data and creates a pull request.
// This is the wizard-specific variant of AddResolvedWorkflows used by the interactive add flow.
func AddResolvedWorkflowsWithPR(workflowStrings []string, resolved *ResolvedWorkflows, opts AddOptions) (*AddWizardResult, error) {
addWorkflowPRLog.Printf("Adding workflows with PR: count=%d", len(workflowStrings))
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

In AddResolvedWorkflowsWithPR, the log line reports count based on len(workflowStrings), which can be misleading when a single spec expands to multiple resolved workflows (e.g., local wildcard). Consider logging len(resolved.Workflows) (and/or logging both values) so the count reflects the actual number of workflows being added.

Suggested change
addWorkflowPRLog.Printf("Adding workflows with PR: count=%d", len(workflowStrings))
addWorkflowPRLog.Printf(
"Adding workflows with PR: specs=%d, resolved_workflows=%d",
len(workflowStrings),
len(resolved.Workflows),
)

Copilot uses AI. Check for mistakes.
… flags

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

Copilot AI commented Mar 1, 2026

@copilot review docs to determine if any sample relies on add --push or add --create-pull-request

Found and fixed in 59df85a. Two doc files referenced the removed flags:

  • docs/src/content/docs/setup/cli.md — had gh aw add ci-doctor --create-pull-request as a code example and listed --create-pull-request / --pr in the options. Both removed.
  • docs/src/content/docs/guides/packaging-imports.md — listed --pr in the list of customization flags. Removed.

The --push flag appeared in docs only for init, run, and upgrade commands (not add), so no changes were needed there.

@pelikhan
Copy link
Contributor

pelikhan commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

…t with failure-path tests

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

Copilot AI commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

Done in d083d89. Applied both reviewer suggestions:

  1. Log line (add_workflow_pr.go:32): Now reports both counts — specs=%d, resolved_workflows=%d — so a single wildcard spec that expands to many workflows is accurately reflected.

  2. Tests (add_workflow_pr_test.go): Replaced the trivial struct round-trip TestAddWizardResult with two meaningful failure-path tests for AddResolvedWorkflowsWithPR:

    • TestAddResolvedWorkflowsWithPR_GHNotAvailable — clears PATH so gh is not found, verifies the function errors with a message mentioning gh
    • TestAddResolvedWorkflowsWithPR_NotGitRepo — chdirs to a temp directory with no git repo, verifies the function errors with a message mentioning git

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.

4 participants