Skip to content

feat(adopt): non-interactive --include ancestors for remote adoption#756

Open
simsinght wants to merge 2 commits into
masterfrom
adopt-remote-include-ancestors
Open

feat(adopt): non-interactive --include ancestors for remote adoption#756
simsinght wants to merge 2 commits into
masterfrom
adopt-remote-include-ancestors

Conversation

@simsinght

Copy link
Copy Markdown
Contributor

pls 🙏 my Claude needs non-interactive adoption of entire stacks

What

av adopt --remote <branch> always drops into the interactive picker, which is a wall for scripts and agents trying to mirror a coworker's stack locally. This adds an --include ancestors flag that skips the picker:

av adopt --remote feat-c --include ancestors            # adopt feat-c + its ancestors, no prompt
av adopt --remote feat-c --include ancestors --dry-run  # print the adoption plan only

It adopts the named branch and its ancestor chain up to the trunk without prompting. Bare --remote still opens the picker, so this is non-breaking. --include is a validated string flag (only ancestors today) so it can grow to descendants/stack later without adding new flags.

Tests

Extends the e2e harness, which had no coverage of the remote-adopt path:

  • the mock GitHub server now answers the pullRequest(number:) query used to walk parent PRs
  • mock-pull accepts base=<ref> and body=<file> so a remote stack with av stack metadata can be modeled

New testscript covers the --dry-run plan and --include validation.

Stacked on #755.

🤖 Generated with Claude Code

@simsinght simsinght requested a review from a team as a code owner June 2, 2026 20:28
@aviator-app

aviator-app Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🔃 FlexReview Status

Common Owner: aviator-co/engineering (expert-load-balance assignment)
Owner and Assignment:

  • 🔒 aviator-co/engineering (expert-load-balance assignment)
    Owned Files
    • 🔒 docs/av-adopt.1.md
    • 🔒 e2e_tests/mock_ghgql_server.go
    • 🔒 e2e_tests/testscript_test.go
    • 🔒 cmd/av/adopt.go
    • 🔒 e2e_tests/testdata/script/adopt_remote_include_ancestors.txtar

Review SLO: 7 business hours if PR size is <= 200 LOC for the first response.
❕ This PR modifies 255 lines, which is larger than the Review SLO threshold.

@aviator-app aviator-app Bot requested a review from jainankit June 2, 2026 20:28

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new --include ancestors flag to the av adopt command, enabling non-interactive adoption of a remote branch and its ancestors. It includes updates to the command-line documentation, enhances the mock GitHub GraphQL server in end-to-end tests to support querying pull requests by number, and adds corresponding test coverage. The feedback suggests registering a shell completion function for the new --include flag to improve the CLI user experience.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread cmd/av/adopt.go
Comment on lines +488 to +491
adoptCmd.Flags().StringVar(
&adoptFlags.Include, "include", "",
"with --remote, non-interactively adopt the named branch and related branches\n(ancestors)",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To improve the CLI user experience, we can register a shell completion function for the new --include flag. Since the only valid value currently is ancestors (defined in adoptIncludeValues), we can provide this directly to Cobra's shell completion mechanism.

	adoptCmd.Flags().StringVar(
		&adoptFlags.Include, "include", "",
		"with --remote, non-interactively adopt the named branch and related branches\n(ancestors)",
	)
	_ = adoptCmd.RegisterFlagCompletionFunc(
		"include",
		func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
			return adoptIncludeValues, cobra.ShellCompDirectiveNoFileComp
		},
	)

Base automatically changed from adopt-remote-set-upstream-tracking to master June 2, 2026 21:17
@jainankit jainankit requested review from tulioz and removed request for jainankit June 2, 2026 22:51
av adopt --remote opens an interactive picker, which is awkward for
scripts and agents mirroring a coworker's stack. Add --include ancestors
to skip the picker and adopt the named branch plus its ancestors up to
the trunk in one shot. --dry-run prints the adoption plan.

Also extend the e2e harness: the mock GitHub server now answers the
pullRequest(number:) query used to walk parent PRs, and mock-pull accepts
base=<ref> and body=<file> so a remote stack with av metadata can be
modeled in tests.
@simsinght simsinght force-pushed the adopt-remote-include-ancestors branch from f364378 to 0efd2fc Compare June 3, 2026 18:51
@aviator-app

aviator-app Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This pull request is currently open (not queued).

How to merge

To merge this PR, comment /aviator merge or add the mergequeue label.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

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.

1 participant