diff --git a/src/cli.ts b/src/cli.ts index 4a2c2a4..532c3ae 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -36,7 +36,6 @@ type CliOptionState = Pick< | 'force' | 'checkOverrides' | 'coverage' - | 'directMerge' >; type MenuContext = { @@ -79,7 +78,6 @@ function readOptions(opts: Record): CliOptionState { force: opts.force === true, checkOverrides: opts.checkOverrides === true, coverage: opts.coverage === true, - directMerge: opts.directMerge === true, }; } @@ -106,10 +104,6 @@ const serviceDefinitions: ServiceDefinition[] = [ { flags: '--hard', description: 'overwrite drifted files with upstream version (aggressive realignment)' }, { flags: '--unpinned', description: 'ignore pinned files (except package.json) to resurface upstream changes' }, { flags: '--track ', description: 'override upstream tracking for this run: release|branch' }, - { - flags: '--direct-merge', - description: 'auto-merge (squash) the sync PR once checks pass — needs auto-merge enabled on the repo', - }, ], includeInMenu: (context) => !context.isUpstreamRepo, menuDescription: () => 'merge upstream changes + sync package.json', @@ -219,7 +213,6 @@ function buildProgram(setSelection: (selection: CliServiceSelection) => void): C ' $ cella sync --hard', ' $ cella sync --unpinned', ' $ cella sync --track branch', - ' $ cella sync --direct-merge', ' $ cella audit --check-overrides', ' $ cella contributions --fork raak --json', ].join('\n'), diff --git a/src/config/types.ts b/src/config/types.ts index ce4601e..62da10c 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -272,13 +272,6 @@ export interface RuntimeConfig extends CellaCliConfig { /** Regenerate test coverage before showing the stats summary (stats service) */ coverage?: boolean; - - /** - * After opening the sync PR, enable GitHub auto-merge (squash) so it merges itself once - * required checks pass (sync service). Opt-in per run via `--direct-merge`; needs auto-merge - * enabled on the repo. Not the advised default — a sync PR is usually worth a human look. - */ - directMerge?: boolean; } /** File status after analysis */ diff --git a/src/services/sync.ts b/src/services/sync.ts index c872bc9..709258b 100644 --- a/src/services/sync.ts +++ b/src/services/sync.ts @@ -358,22 +358,6 @@ function indentLines(text: string): string { .join('\n'); } -/** - * Turn on GitHub auto-merge (squash) for the just-opened sync PR: it merges itself once required - * checks pass, so `--direct-merge` needs no babysitting. Returns whether it was enabled; on failure - * (the repo doesn't allow auto-merge, `gh` too old) it prints the manual command and returns false. - */ -function enableAutoMerge(forkPath: string, branch: string): boolean { - console.info(pc.dim('enabling auto-merge (squash) once checks pass...')); - const merge = mergePrSquash(forkPath, branch, { auto: true, deleteBranch: true }); - if (merge.ok) return true; - - console.info(pc.yellow('could not enable auto-merge (is it enabled for the repo?). merge it manually:')); - if (merge.output) console.info(pc.dim(indentLines(merge.output))); - console.info(pc.dim(` gh pr merge ${branch} --squash --delete-branch`)); - return false; -} - /** * Push the finished sync branch to `origin`, open a PR into the trunk, and switch back to the * trunk. Runs when `cella sync` is invoked on a sync branch whose merge is already committed — @@ -382,9 +366,6 @@ function enableAutoMerge(forkPath: string, branch: string): boolean { * Before pushing, any merge commits on the branch are flattened away (see `flattenSyncBranch`) * so the PR never lists the upstream branch's entire history. * - * With `--direct-merge`, once the PR is open GitHub auto-merge is enabled (see `enableAutoMerge`) - * so it squash-merges itself as soon as required checks pass — no forgotten open PR to trip over. - * * Every step degrades gracefully: a failed push (no `origin`, auth) prints the manual steps and * leaves you on the branch; a missing/failed `gh` (or an existing PR) prints the `gh` command but * still returns you to the trunk since the branch is already pushed. @@ -396,7 +377,6 @@ async function shipSyncBranch(config: RuntimeConfig, branch: string): Promise { expect(config.service).toBe('sync'); expect(config.logFile).toBe(true); expect(config.hard).toBe(true); - expect(config.directMerge).toBe(false); - }); - - it('parses --direct-merge for sync', async () => { - process.argv = ['node', 'cella', 'sync', '--direct-merge']; - - const config = await parseCli(baseConfig, '/tmp/fork'); - - expect(config.service).toBe('sync'); - expect(config.directMerge).toBe(true); }); }); diff --git a/tests/gh.test.ts b/tests/gh.test.ts index b414e45..29225a9 100644 --- a/tests/gh.test.ts +++ b/tests/gh.test.ts @@ -45,18 +45,7 @@ describe('buildMergeArgs', () => { expect(buildMergeArgs('42')).toEqual(['pr', 'merge', '42', '--squash']); }); - it('adds --auto for auto-merge and --delete-branch when requested', () => { - expect(buildMergeArgs('cella/sync/x', { auto: true, deleteBranch: true })).toEqual([ - 'pr', - 'merge', - 'cella/sync/x', - '--squash', - '--auto', - '--delete-branch', - ]); - }); - - it('can delete the branch without enabling auto-merge', () => { + it('deletes the branch when requested', () => { expect(buildMergeArgs('7', { deleteBranch: true })).toEqual(['pr', 'merge', '7', '--squash', '--delete-branch']); }); });