feat(FN-2160): add push-after-merge remote sync workflow

- Add project settings for pushAfterMerge and pushRemote with defaults and typed merge result fields for push status/errors
- Implement post-merge remote sync in the merger with pull --rebase, auto/AI conflict resolution, and one non-fast-forward retry before push
- Expose push-after-merge controls in Settings modal with conditional Push Remote input and coverage for desktop/mobile save flows
- Document the new settings in the settings reference and stabilize CLI cross-build help test timeout
This commit is contained in:
Fusion
2026-04-19 13:29:59 -07:00
committed by gsxdsm
parent 4c08b1c32a
commit a93f0f2ef9
9 changed files with 821 additions and 1 deletions

View File

@@ -63,6 +63,8 @@ export const DEFAULT_PROJECT_SETTINGS = {
groupOverlappingFiles: true,
autoMerge: true,
mergeStrategy: "direct",
pushAfterMerge: false,
pushRemote: "origin",
worktreeInitCommand: undefined,
testCommand: undefined,
buildCommand: undefined,

View File

@@ -1045,6 +1045,16 @@ export interface ProjectSettings {
* before merging through GitHub
* Default: "direct" for backward compatibility. */
mergeStrategy?: MergeStrategy;
/** When true, automatically push to the configured remote after a successful direct merge.
* The push process includes pulling the latest from the remote (rebase) first.
* If conflicts arise during the pull, they are resolved using the AI conflict resolution pipeline.
* Only applies when mergeStrategy is "direct". Default: false. */
pushAfterMerge?: boolean;
/** The git remote and branch to push to after merging (e.g. "origin", "origin main").
* When set to just a remote name (e.g. "origin"), the current branch is pushed.
* When set to "remote branch" format, both the remote and branch are specified.
* Only used when pushAfterMerge is true. Default: "origin". */
pushRemote?: string;
/** Shell command to run inside each new worktree immediately after creation.
* Useful for project-specific setup (e.g. `pnpm install`, `cp .env.local .env`). */
worktreeInitCommand?: string;
@@ -1426,6 +1436,10 @@ export interface MergeResult extends MergeDetails {
worktreeRemoved: boolean;
branchDeleted: boolean;
error?: string;
/** Whether the merged result was pushed to the remote. Only set when pushAfterMerge is enabled. */
pushedToRemote?: boolean;
/** Error message if push to remote failed. Non-fatal — merge is already committed locally. */
pushError?: string;
/** Internal flag to track if a build retry has been attempted. Not persisted. */
_buildRetried?: boolean;
}