Skip to content

Update commands to use create and update stack APIs#10

Merged
skarim merged 7 commits intomainfrom
skarim/remote-stack-operations
Apr 3, 2026
Merged

Update commands to use create and update stack APIs#10
skarim merged 7 commits intomainfrom
skarim/remote-stack-operations

Conversation

@skarim
Copy link
Copy Markdown
Collaborator

@skarim skarim commented Apr 3, 2026

Introduce submit command and wire up Stack APIs

This PR separates the concerns of push and introduces a new submit command that handles PR creation and stack management on GitHub.

Changes

  • New submit command — pushes branches, creates/updates PRs (with interactive title prompting), and syncs the stack to GitHub via the new API. Absorbs the PR-creation logic previously in push. Includes --auto, --draft, and --remote flags.
  • Stacks API integration — POSTs and PUTs to the internal API for creating and adding to stacks.
  • Simplified push — now only pushes branches to the remote (more akin to git push) and updates base SHAs.
  • Removed unstack — deleted command pending API endpoints for stack deletion.

Copilot AI review requested due to automatic review settings April 3, 2026 08:23
Copy link
Copy Markdown

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 splits the existing push behavior into a branch-only push command and a new submit command that handles PR creation plus GitHub Stack API syncing, while removing the unstack command pending deletion endpoints.

Changes:

  • Add gh stack submit to push branches, create/update PRs (with optional interactive titling), and create/update a GitHub Stack via new REST endpoints.
  • Simplify gh stack push to only push active branches and update local base SHAs (no PR operations).
  • Remove gh stack unstack and update docs/help text/tests accordingly.

Reviewed changes

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

Show a summary per file
File Description
skills/gh-stack/SKILL.md Updates skill documentation/examples to reflect push vs submit and removes unstack.
README.md Updates user-facing docs for the new submit command and the narrowed push behavior.
internal/stack/stack_test.go Removes outdated comment referencing unstack.
internal/github/mock_client.go Updates mock GitHub client interface for stack create/update operations.
internal/github/github.go Implements CreateStack (POST) and UpdateStack (PUT) REST calls to the stacks API.
internal/github/client_interface.go Replaces DeleteStack with CreateStack/UpdateStack in ClientOps.
cmd/unstack.go Removes the unstack command implementation.
cmd/unstack_test.go Removes tests for the deleted unstack command.
cmd/submit.go Introduces submit command: push + PR creation + stack sync.
cmd/submit_test.go Adds test coverage for submit flow and stack sync scenarios (create/update/HTTP error handling).
cmd/root.go Registers the new submit command and removes unstack.
cmd/root_test.go Updates expected subcommand list after command changes.
cmd/rebase.go Updates post-rebase guidance to reference gh stack submit.
cmd/push.go Removes PR creation logic/flags; now pushes branches and updates base SHAs only.
cmd/push_test.go Updates tests to match push’s new behavior and adds submit-hint assertions.
cmd/merge.go Updates guidance to reference gh stack submit when PRs are missing.
cmd/merge_test.go Updates expectation to reference submit instead of push.
cmd/init.go Updates onboarding output to reference gh stack submit.

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

Comment thread README.md Outdated
Comment thread cmd/root_test.go Outdated
Copy link
Copy Markdown

Copilot AI commented Apr 3, 2026

Warning

This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated!

Copilot thinks this PR is not ready to approve — see review comments for details.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

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 introduces a new gh stack submit command for PR creation + GitHub Stack API syncing, while simplifying gh stack push to only push branches and removing the unstack command.

Changes:

  • Added submit command to push stack branches, create PRs, and create/update GitHub Stacks via new REST endpoints.
  • Simplified push to only push branches and update local base SHAs; removed PR-creation responsibilities and deleted unstack.
  • Updated docs and guidance strings across commands to reflect the new submit workflow.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
skills/gh-stack/SKILL.md Updates skill docs to reflect push vs submit and removes unstack references.
README.md Updates user-facing docs and examples for submit, new behavior of push, and removes unstack.
internal/stack/stack_test.go Removes outdated comment reference to unstack.
internal/github/mock_client.go Updates mock client to support Create/Update Stack API methods.
internal/github/github.go Implements REST calls for CreateStack/UpdateStack endpoints.
internal/github/client_interface.go Replaces DeleteStack with CreateStack/UpdateStack in the GitHub client interface.
cmd/unstack.go Removes the unstack command implementation.
cmd/unstack_test.go Removes tests for unstack.
cmd/submit.go Adds submit command implementation, including PR creation and stack syncing logic.
cmd/submit_test.go Adds unit tests for submit, PR body generation, and stack sync behaviors.
cmd/root.go Registers submit and removes unstack from the CLI root command.
cmd/root_test.go Updates subcommand registration expectations for submit/unstack.
cmd/rebase.go Updates post-rebase guidance to direct users to gh stack submit.
cmd/push.go Simplifies push behavior and adds hinting to use submit for PR creation.
cmd/push_test.go Updates push tests for the new behavior and hinting.
cmd/merge.go Updates guidance to direct users to gh stack submit when no PR exists.
cmd/merge_test.go Updates merge test expectation to reference submit.
cmd/init.go Updates init guidance to direct users to gh stack submit.

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

Comment thread cmd/push.go
Comment thread cmd/submit.go
Comment thread cmd/submit.go
Comment thread cmd/submit.go Outdated
Comment thread README.md Outdated
Copy link
Copy Markdown

Copilot AI commented Apr 3, 2026

Warning

This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated!

Copilot thinks this PR is not ready to approve — see review comments for details.

Copy link
Copy Markdown

@ktravers ktravers left a comment

Choose a reason for hiding this comment

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

Left one thought, definitely not blocking. Overall changes look good to me. Caveat: I'm reviewing as someone with only the most cursory understanding of Go 😅 so definitely good to get 👀 from someone with more expertise there.

Comment thread skills/gh-stack/SKILL.md
Comment on lines +740 to +741
5. **Server-side stack discovery is not supported.** `checkout` only works with locally tracked stacks.
6. **PR title and body are auto-generated.** There is no flag to set a custom PR title or body during `submit`. The title and body are generated from commit messages plus a footer. Use `gh pr edit` to modify PR title and body after creation.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Instead of removing unstack entirely, would it be helpful to let users know they can unstack from the web interface? 🤔

Suggested change
5. **Server-side stack discovery is not supported.** `checkout` only works with locally tracked stacks.
6. **PR title and body are auto-generated.** There is no flag to set a custom PR title or body during `submit`. The title and body are generated from commit messages plus a footer. Use `gh pr edit` to modify PR title and body after creation.
5. **Stack deletion is not supported.** Direct users to open the PR URL in a browser to unstack PRs.
6. **Server-side stack discovery is not supported.** `checkout` only works with locally tracked stacks.
7. **PR title and body are auto-generated.** There is no flag to set a custom PR title or body during `submit`. The title and body are generated from commit messages plus a footer. Use `gh pr edit` to modify PR title and body after creation.```

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I decided to remove any mentions of unstack because we don't have the APIs yet for getting or deleting stacks. There are some weird edge cases you could get stuck into. Def not ideal, but hoping to add this all back in the next release once we have the proper APIs in place.

@skarim skarim merged commit c9b61f2 into main Apr 3, 2026
7 checks passed
@skarim skarim deleted the skarim/remote-stack-operations branch April 3, 2026 19:24
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.

3 participants