@open-tomato/rafa 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3963,7 +3963,7 @@ var init_shared_flags = __esm(() => {
3963
3963
  });
3964
3964
 
3965
3965
  // package.json
3966
- var name = "@open-tomato/rafa", version = "0.48.0";
3966
+ var name = "@open-tomato/rafa", version = "0.49.0";
3967
3967
  var init_package = () => {};
3968
3968
 
3969
3969
  // packages/rafa/src/core/command/version.ts
@@ -45362,23 +45362,42 @@ function readMergeRefusal(reading2) {
45362
45362
  const held2 = worktreesHolding(reading2.worktrees, reading2.branch, reading2.at);
45363
45363
  return held2.length === 0 ? null : worktreeRefusal(reading2.branch, held2);
45364
45364
  }
45365
- function cleanUpSteps(plan) {
45366
- const { base: base2, branch, remote = DEFAULT_REMOTE2, localBranchPresent, remoteBranchPresent } = plan;
45367
- const steps = [
45368
- { id: "switch-base", label: `switch to ${base2}`, argv: ["git", "switch", base2] },
45365
+ function baseSteps(base2, heldAt) {
45366
+ if (heldAt === null) {
45367
+ return [
45368
+ { id: "switch-base", label: `switch to ${base2}`, argv: ["git", "switch", base2] },
45369
+ { id: "pull-base", label: `pull ${base2}, fast-forward only`, argv: ["git", "pull", "--ff-only"] }
45370
+ ];
45371
+ }
45372
+ return [
45369
45373
  {
45370
45374
  id: "pull-base",
45371
- label: `pull ${base2}, fast-forward only`,
45372
- argv: ["git", "pull", "--ff-only"]
45375
+ label: `pull ${base2} in ${heldAt}, fast-forward only`,
45376
+ argv: ["git", "-C", heldAt, "pull", "--ff-only"]
45373
45377
  },
45374
- {
45378
+ { id: "switch-base", label: `detach this checkout at ${base2}`, argv: ["git", "switch", "--detach", base2] }
45379
+ ];
45380
+ }
45381
+ function cleanUpSteps(plan) {
45382
+ const {
45383
+ base: base2,
45384
+ branch,
45385
+ remote = DEFAULT_REMOTE2,
45386
+ localBranchPresent,
45387
+ remoteBranchPresent,
45388
+ kept = false,
45389
+ baseHeldAt = null
45390
+ } = plan;
45391
+ const steps = baseSteps(base2, baseHeldAt);
45392
+ if (!kept) {
45393
+ steps.push({
45375
45394
  id: "delete-local",
45376
45395
  label: `delete the local branch ${branch}`,
45377
45396
  argv: ["git", "branch", "-D", branch],
45378
45397
  ...localBranchPresent ? {} : { skip: `no local branch ${branch}; nothing to delete` }
45379
- }
45380
- ];
45381
- if (remoteBranchPresent) {
45398
+ });
45399
+ }
45400
+ if (!kept && remoteBranchPresent) {
45382
45401
  steps.push({
45383
45402
  id: "delete-remote",
45384
45403
  label: `delete ${remote}/${branch}`,
@@ -45876,7 +45895,7 @@ var init_declarations5 = __esm(() => {
45876
45895
  subject: PR_SUBJECT.name,
45877
45896
  action: "merge",
45878
45897
  summary: "merge a pull request and clean up both branches",
45879
- description: "Merges one pull request through the GitHub CLI and then, in code, switches to the base branch," + " pulls it fast-forward only, deletes the head branch locally and on the remote where it is still there," + " and prunes, reporting each step; a head branch this checkout has no local branch for is reported as a" + " skipped local delete, and the rest still run. Refuses before it asks anything on a tracked change in the working tree or an" + " untracked path the pull request's head or the base's remote-tracking branch holds, on a pull" + " request that is not green or does not merge, and on a head branch checked out in another worktree, except a" + " clean, ended loop worktree under `loop.worktreeDir`, which it removes after copying its two plan files out. It" + " shows the pull request, its branches and the method and asks `Merge? [y/N]`; `--yes` skips the question," + " and without a terminal and without `--yes` it refuses. A pull request that reports no checks at all is" + " refused unless `--skip-checks` is given, which is refused on any pull request that does report checks;" + " with it the command reads how many workflows the repository defines, prints a warning for that case, asks" + " `Merge #<n> with no checks? [y/N]` (which `--yes` answers only where the repository defines no workflow, or" + " where no workflow file on the base has a `pull_request` trigger naming it)," + " and after the merge posts one comment on the pull request saying so. Where the release runs, the release" + " guard reads the branch before the question: a `collision` is refused unless" + " `dangerous.acceptVersionCollision` is true, and `pr.versionCollision` sets whether a `missing` or" + " `stale` branch merges silently, with a warning, after its own question, or not at all. A step that fails never undoes the merge: it" + " prints what is left as commands to paste and exits 1. After the merge it ticks the `Closes #<n>` line of" + " every issue the pull request closes, first on the checklist of the open epic that issue's `epic:` label" + " names, printing one line per epic, then on every open board whose checklist lists it, or on the roadmap" + " issue while no issue carries `type:roadmap`, warning rather than failing when one of those writes" + ' does not land. It ends by reading every open issue whose "Blocked by:" line names an issue this pull' + " request closes, asking whether to remove `spec:blocked` from each one whose blockers have all closed;" + " `--yes` does not answer that question, and every failure of that reading is a warning. With" + " board.relationships set to native it ticks no epic checklist and, in place of that reading, prints the" + " open issues the merge freed, whose blockers GitHub clears by itself, asking nothing and writing nothing. With" + " `--output=json` the pull request, the method, the steps that ran, the follow-ups, the roadmap tick and" + " the unblock reading, or the freed issues in native mode, are the data of the terminal result event;" + " the tick of each closed issue's epic checklist is one line per epic and no key of that data, and under" + " native there is none. Refuses with exit code 2 where" + " `pr.provider` is not `gh`.",
45898
+ description: "Merges one pull request through the GitHub CLI and then, in code, switches to the base branch," + " pulls it fast-forward only, deletes the head branch locally and on the remote where it is still there," + " and prunes, reporting each step; a head branch this checkout has no local branch for is reported as a" + " skipped local delete, and the rest still run. A head branch that is a trunk (`pr.base`, the remote's default" + " branch, `main` where `pr.base` names none, or a branch `cleanup.keep` names) is kept on both sides, with one" + " line saying so, and `--keep-branch` keeps any other head branch the same way. Refuses before it asks anything on a tracked change in the working tree or an" + " untracked path the pull request's head or the base's remote-tracking branch holds, on a pull" + " request that is not green or does not merge, and on a head branch checked out in another worktree, except a" + " clean, ended loop worktree under `loop.worktreeDir`, which it removes after copying its two plan files out. It" + " shows the pull request, its branches and the method and asks `Merge? [y/N]`; `--yes` skips the question," + " and without a terminal and without `--yes` it refuses. A pull request that reports no checks at all is" + " refused unless `--skip-checks` is given, which is refused on any pull request that does report checks;" + " with it the command reads how many workflows the repository defines, prints a warning for that case, asks" + " `Merge #<n> with no checks? [y/N]` (which `--yes` answers only where the repository defines no workflow, or" + " where no workflow file on the base has a `pull_request` trigger naming it)," + " and after the merge posts one comment on the pull request saying so. Where the release runs, the release" + " guard reads the branch before the question: a `collision` is refused unless" + " `dangerous.acceptVersionCollision` is true, and `pr.versionCollision` sets whether a `missing` or" + " `stale` branch merges silently, with a warning, after its own question, or not at all. A step that fails never undoes the merge: it" + " prints what is left as commands to paste and exits 1. After the merge it ticks the `Closes #<n>` line of" + " every issue the pull request closes, first on the checklist of the open epic that issue's `epic:` label" + " names, printing one line per epic, then on every open board whose checklist lists it, or on the roadmap" + " issue while no issue carries `type:roadmap`, warning rather than failing when one of those writes" + ' does not land. It ends by reading every open issue whose "Blocked by:" line names an issue this pull' + " request closes, asking whether to remove `spec:blocked` from each one whose blockers have all closed;" + " `--yes` does not answer that question, and every failure of that reading is a warning. With" + " board.relationships set to native it ticks no epic checklist and, in place of that reading, prints the" + " open issues the merge freed, whose blockers GitHub clears by itself, asking nothing and writing nothing. With" + " `--output=json` the pull request, the method, the steps that ran, the follow-ups, the roadmap tick and" + " the unblock reading, or the freed issues in native mode, are the data of the terminal result event;" + " the tick of each closed issue's epic checklist is one line per epic and no key of that data, and under" + " native there is none. Refuses with exit code 2 where" + " `pr.provider` is not `gh`.",
45880
45899
  args: [
45881
45900
  {
45882
45901
  name: "n",
@@ -45895,6 +45914,11 @@ var init_declarations5 = __esm(() => {
45895
45914
  description: "Merge a pull request that reports no checks at all, after a warning and its own question." + " Refused where the pull request reports any check; `--yes` beside it is refused where the repository" + " defines a workflow that may run on pull requests into the base, or its workflow count could not be read.",
45896
45915
  type: "boolean"
45897
45916
  },
45917
+ {
45918
+ name: "keep-branch",
45919
+ description: "Keep the head branch locally and on the remote after the merge. A trunk is kept without it.",
45920
+ type: "boolean"
45921
+ },
45898
45922
  {
45899
45923
  name: "method",
45900
45924
  description: "How to merge: squash, merge or rebase. `pr.mergeMethod` when it is left out.",
@@ -45915,6 +45939,10 @@ var init_declarations5 = __esm(() => {
45915
45939
  cmd: "rafa pr merge 41 --skip-checks",
45916
45940
  note: "Warns that nothing on GitHub tested pull request 41, asks, merges it and comments that it had no checks."
45917
45941
  },
45942
+ {
45943
+ cmd: "rafa pr merge 41 --keep-branch",
45944
+ note: "Merges pull request 41 and keeps its head branch on both sides, deleting neither."
45945
+ },
45918
45946
  {
45919
45947
  cmd: "rafa pr merge 41 --method=rebase --output=json",
45920
45948
  note: "Merges by rebase and writes a result event holding each clean-up step and the follow-ups."
@@ -46667,6 +46695,7 @@ async function openPrContext(context, seams = DEFAULT_PR_SEAMS) {
46667
46695
  pulls: makeProvider(project.root),
46668
46696
  mergeMethod: config.prMergeMethod,
46669
46697
  base: config.prBase,
46698
+ cleanupKeep: config.cleanupKeep,
46670
46699
  resolveBudget: config.prResolveBudget,
46671
46700
  trustedAuthors: config.boardTrustedAuthors,
46672
46701
  roadmapIssue: config.roadmapIssue,
@@ -46731,7 +46760,7 @@ var init_pr_context = __esm(() => {
46731
46760
  show: "rafa pr show [<n>]",
46732
46761
  view: "rafa pr view [<n>]",
46733
46762
  list: "rafa pr list",
46734
- merge: "rafa pr merge [<n>] [--yes] [--skip-checks] [--method=squash|merge|rebase]",
46763
+ merge: "rafa pr merge [<n>] [--yes] [--skip-checks] [--keep-branch] [--method=squash|merge|rebase]",
46735
46764
  triage: "rafa pr triage [<n>] [--no-comment] [--resolve] [--allow-local-config] [--max-attempts=<count>]",
46736
46765
  wait: "rafa pr wait [<n>] [--timeout=<minutes>]",
46737
46766
  open: "rafa pr open --head=<branch> --base=<branch> --title=<text> --body-file=<path>",
@@ -50928,8 +50957,42 @@ function localHoldsBranch(git, branch, warn4) {
50928
50957
  warn4(`could not read whether this checkout holds a local branch ${branch}, so its delete runs: ${said}`);
50929
50958
  return true;
50930
50959
  }
50931
- function readyLine(base2, branch, present) {
50932
- const pulled = `${base2} is checked out and pulled`;
50960
+ function baseHeldElsewhere(git, base2, warn4) {
50961
+ const unread5 = (probe3) => {
50962
+ warn4(`could not read which worktree holds ${base2}, so it is switched to here: ${gitSaid(probe3)}`);
50963
+ return null;
50964
+ };
50965
+ const listed3 = git(["worktree", "list", "--porcelain"]);
50966
+ if (!listed3.ok)
50967
+ return unread5(listed3);
50968
+ const worktrees = parseWorktrees(listed3.stdout);
50969
+ if (!worktrees.some((entry) => entry.branch === base2))
50970
+ return null;
50971
+ const root = git(["rev-parse", "--show-toplevel"]);
50972
+ if (!root.ok)
50973
+ return unread5(root);
50974
+ return worktreesHolding(worktrees, base2, root.stdout.trim())[0]?.path ?? null;
50975
+ }
50976
+ function keptBecause(git, branch, settings) {
50977
+ if (settings.base !== null && branch === settings.base)
50978
+ return "it is pr.base";
50979
+ if (branch === readRemoteHead(git))
50980
+ return `it is ${REMOTE4}'s default branch`;
50981
+ if (settings.base === null && branch === DEFAULT_BASE_BRANCH) {
50982
+ return `it is ${DEFAULT_BASE_BRANCH}, the base where pr.base names none`;
50983
+ }
50984
+ if (isKept(branch, settings.keep))
50985
+ return "a cleanup.keep pattern names it";
50986
+ return settings.keepBranch ? "--keep-branch was given" : null;
50987
+ }
50988
+ function basePulled(base2, heldAt) {
50989
+ return heldAt === null ? `${base2} is checked out and pulled` : `${base2} is pulled in ${heldAt} and this checkout is detached at it`;
50990
+ }
50991
+ function keptLine2(base2, branch, why, heldAt = null) {
50992
+ return `${basePulled(base2, heldAt)}; ${branch} is kept locally and on ${REMOTE4}, since ${why}.`;
50993
+ }
50994
+ function readyLine(base2, branch, present, heldAt = null) {
50995
+ const pulled = basePulled(base2, heldAt);
50933
50996
  if (present.local) {
50934
50997
  return present.remote ? `${pulled}, and ${branch} is gone locally and on ${REMOTE4}.` : `${pulled}, and ${branch} is gone locally; ${REMOTE4} had already deleted it.`;
50935
50998
  }
@@ -50939,13 +51002,14 @@ function quotedLines2(said) {
50939
51002
  return said === "" ? [] : said.split(`
50940
51003
  `).map((line) => `${INDENT7}${line}`);
50941
51004
  }
50942
- function runCleanUp(git, merged, present, info2) {
51005
+ function runCleanUp(git, merged, present, info2, shape = {}) {
50943
51006
  const steps = cleanUpSteps({
50944
51007
  branch: merged.headRefName,
50945
51008
  base: merged.baseRefName,
50946
51009
  remote: REMOTE4,
50947
51010
  localBranchPresent: present.local,
50948
- remoteBranchPresent: present.remote
51011
+ remoteBranchPresent: present.remote,
51012
+ ...shape
50949
51013
  });
50950
51014
  const reports = [];
50951
51015
  for (const step2 of steps) {
@@ -50970,14 +51034,21 @@ function runCleanUp(git, merged, present, info2) {
50970
51034
  }
50971
51035
  return reports;
50972
51036
  }
50973
- function cleanUpAfterMerge(git, merged, report4) {
51037
+ function cleanUpAfterMerge(git, merged, settings, report4) {
51038
+ const kept = keptBecause(git, merged.headRefName, settings);
51039
+ const baseHeldAt = baseHeldElsewhere(git, merged.baseRefName, report4.warn);
51040
+ if (kept !== null) {
51041
+ const steps2 = runCleanUp(git, merged, { local: false, remote: false }, report4.info, { kept: true, baseHeldAt });
51042
+ report4.info(keptLine2(merged.baseRefName, merged.headRefName, kept, baseHeldAt));
51043
+ return { steps: steps2, kept };
51044
+ }
50974
51045
  const present = {
50975
51046
  remote: remoteHoldsBranch(git, merged.headRefName, report4.warn),
50976
51047
  local: localHoldsBranch(git, merged.headRefName, report4.warn)
50977
51048
  };
50978
- const steps = runCleanUp(git, merged, present, report4.info);
50979
- report4.info(readyLine(merged.baseRefName, merged.headRefName, present));
50980
- return steps;
51049
+ const steps = runCleanUp(git, merged, present, report4.info, { baseHeldAt });
51050
+ report4.info(readyLine(merged.baseRefName, merged.headRefName, present, baseHeldAt));
51051
+ return { steps, kept: null };
50981
51052
  }
50982
51053
  function textOf4(path3) {
50983
51054
  try {
@@ -51015,8 +51086,10 @@ function reportFollowUps(place2, git, info2) {
51015
51086
  var REMOTE4 = "origin", INDENT7 = " ";
51016
51087
  var init_merge_cleanup = __esm(() => {
51017
51088
  init_command2();
51089
+ init_sections();
51018
51090
  init_runtime();
51019
51091
  init_live_loops();
51092
+ init_branches();
51020
51093
  init_pr();
51021
51094
  init_settle_waiting();
51022
51095
  init_merge_followups();
@@ -51897,6 +51970,7 @@ async function askToMerge(context, pr, seams, ask) {
51897
51970
  async function runMerge(context, seams) {
51898
51971
  const yes = readBooleanFlag(context.flags, "yes", USAGE21);
51899
51972
  const skipChecks = readBooleanFlag(context.flags, "skip-checks", USAGE21);
51973
+ const keepBranch = readBooleanFlag(context.flags, "keep-branch", USAGE21);
51900
51974
  const wanted = readMethodFlag(context.flags, USAGE21);
51901
51975
  const asked = readPullArgument(context.args, USAGE21);
51902
51976
  const pr = await openPrContext(context, seams);
@@ -51945,6 +52019,7 @@ async function runMerge(context, seams) {
51945
52019
  declined: true,
51946
52020
  detail: "",
51947
52021
  steps: [],
52022
+ kept: null,
51948
52023
  followUps: [],
51949
52024
  roadmapTick: null,
51950
52025
  roadmapTicks: null,
@@ -51969,7 +52044,7 @@ async function runMerge(context, seams) {
51969
52044
  };
51970
52045
  const commentUrl = await commentIfUnchecked(pr.pulls, detail.number, answer4.unchecked, { info: info2, warn: warn4 });
51971
52046
  const roadmapTicks = await reportTick(context, pr, seams, detail);
51972
- const steps = cleanUpAfterMerge(git, detail, { info: info2, warn: warn4 });
52047
+ const { steps, kept } = cleanUpAfterMerge(git, detail, { base: pr.base, keep: pr.cleanupKeep, keepBranch }, { info: info2, warn: warn4 });
51973
52048
  const board = await reportAfterCleanUp(context, pr, seams, detail);
51974
52049
  await refreshProjectAfterMerge({
51975
52050
  body: detail.body,
@@ -51992,6 +52067,7 @@ async function runMerge(context, seams) {
51992
52067
  declined: false,
51993
52068
  detail: outcome2.detail,
51994
52069
  steps,
52070
+ kept,
51995
52071
  followUps,
51996
52072
  roadmapTick: roadmapTicks?.[0] ?? null,
51997
52073
  roadmapTicks,
@@ -66364,7 +66440,7 @@ function keepCommits(git, branch, template) {
66364
66440
  function thisDevice2(storeId) {
66365
66441
  return storeId === null ? "this device, whose store names no claimant" : `this device (store ${storeId})`;
66366
66442
  }
66367
- function keptLine2(lost) {
66443
+ function keptLine3(lost) {
66368
66444
  const { kept, branch } = lost;
66369
66445
  if (kept.state !== "failed")
66370
66446
  return `This device's commits are kept on the local branch ${kept.name} at ${kept.sha}.`;
@@ -66384,7 +66460,7 @@ function claimLostReport(lost) {
66384
66460
  return [
66385
66461
  `\u274C Claim lost: #${String(issue5)} is claimed by store ${owner} on ${branch}, not by ${thisDevice2(storeId)}.`,
66386
66462
  `${REMOTE} refused the push of ${branch}, and nothing was force-pushed over store ${owner}'s branch.`,
66387
- keptLine2(lost),
66463
+ keptLine3(lost),
66388
66464
  nextStep(lost)
66389
66465
  ].map((line, index) => index === 0 ? line : ` ${line}`).join(`
66390
66466
  `);
@@ -13,10 +13,10 @@ import {
13
13
  openNdjsonStore,
14
14
  openSqliteStore,
15
15
  selectEffortStore
16
- } from "../../index-jx3x70xh.js";
16
+ } from "../../index-vfny3ryr.js";
17
17
  import {
18
18
  TRUSTED_PERMISSIONS
19
- } from "../../index-2xzkzwm6.js";
19
+ } from "../../index-thqpre1b.js";
20
20
  import"../../index-2a7nb3an.js";
21
21
  import"../../index-m672ptpg.js";
22
22
  import {
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  normalizeRemote,
22
22
  setActiveStoreSettings
23
- } from "./index-2xzkzwm6.js";
23
+ } from "./index-thqpre1b.js";
24
24
  import {
25
25
  activeOutput,
26
26
  activeOutputMode
@@ -220,7 +220,7 @@ var HINT_FLAG_SPEC = Object.freeze({
220
220
  });
221
221
  var DEFAULT_CI_TIMEOUT_MIN = 20;
222
222
  // package.json
223
- var version = "0.48.0";
223
+ var version = "0.49.0";
224
224
 
225
225
  // packages/rafa/src/core/command/version.ts
226
226
  var RAFA_VERSION = version;
@@ -8,7 +8,7 @@ import {
8
8
  createGitRunner,
9
9
  normalizeRemote,
10
10
  runningCommand
11
- } from "./index-2xzkzwm6.js";
11
+ } from "./index-thqpre1b.js";
12
12
  import {
13
13
  activeOutput,
14
14
  activeOutputMode,
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ import {
82
82
  withSqliteStore,
83
83
  writeNames,
84
84
  writeSqliteStore
85
- } from "./index-jx3x70xh.js";
85
+ } from "./index-vfny3ryr.js";
86
86
  import {
87
87
  ACTION_SHAPE,
88
88
  CONFIG_DEFAULTS,
@@ -269,7 +269,7 @@ import {
269
269
  writeHopRecord,
270
270
  writePositionFile,
271
271
  writeRefsBlock
272
- } from "./index-z4r20zwr.js";
272
+ } from "./index-j154qpbj.js";
273
273
  import {
274
274
  BLOCKER_GAP,
275
275
  PLAN_BLOCK_KINDS,
@@ -321,7 +321,7 @@ import {
321
321
  parseWorkingTree,
322
322
  registerAdapters,
323
323
  restoreAdapters
324
- } from "./index-2xzkzwm6.js";
324
+ } from "./index-thqpre1b.js";
325
325
  import {
326
326
  activeOutput,
327
327
  activeOutputMode,
@@ -13976,7 +13976,7 @@ var PR_MERGE_DECLARATION = Object.freeze({
13976
13976
  subject: PR_SUBJECT.name,
13977
13977
  action: "merge",
13978
13978
  summary: "merge a pull request and clean up both branches",
13979
- description: "Merges one pull request through the GitHub CLI and then, in code, switches to the base branch," + " pulls it fast-forward only, deletes the head branch locally and on the remote where it is still there," + " and prunes, reporting each step; a head branch this checkout has no local branch for is reported as a" + " skipped local delete, and the rest still run. Refuses before it asks anything on a tracked change in the working tree or an" + " untracked path the pull request's head or the base's remote-tracking branch holds, on a pull" + " request that is not green or does not merge, and on a head branch checked out in another worktree, except a" + " clean, ended loop worktree under `loop.worktreeDir`, which it removes after copying its two plan files out. It" + " shows the pull request, its branches and the method and asks `Merge? [y/N]`; `--yes` skips the question," + " and without a terminal and without `--yes` it refuses. A pull request that reports no checks at all is" + " refused unless `--skip-checks` is given, which is refused on any pull request that does report checks;" + " with it the command reads how many workflows the repository defines, prints a warning for that case, asks" + " `Merge #<n> with no checks? [y/N]` (which `--yes` answers only where the repository defines no workflow, or" + " where no workflow file on the base has a `pull_request` trigger naming it)," + " and after the merge posts one comment on the pull request saying so. Where the release runs, the release" + " guard reads the branch before the question: a `collision` is refused unless" + " `dangerous.acceptVersionCollision` is true, and `pr.versionCollision` sets whether a `missing` or" + " `stale` branch merges silently, with a warning, after its own question, or not at all. A step that fails never undoes the merge: it" + " prints what is left as commands to paste and exits 1. After the merge it ticks the `Closes #<n>` line of" + " every issue the pull request closes, first on the checklist of the open epic that issue's `epic:` label" + " names, printing one line per epic, then on every open board whose checklist lists it, or on the roadmap" + " issue while no issue carries `type:roadmap`, warning rather than failing when one of those writes" + ' does not land. It ends by reading every open issue whose "Blocked by:" line names an issue this pull' + " request closes, asking whether to remove `spec:blocked` from each one whose blockers have all closed;" + " `--yes` does not answer that question, and every failure of that reading is a warning. With" + " board.relationships set to native it ticks no epic checklist and, in place of that reading, prints the" + " open issues the merge freed, whose blockers GitHub clears by itself, asking nothing and writing nothing. With" + " `--output=json` the pull request, the method, the steps that ran, the follow-ups, the roadmap tick and" + " the unblock reading, or the freed issues in native mode, are the data of the terminal result event;" + " the tick of each closed issue's epic checklist is one line per epic and no key of that data, and under" + " native there is none. Refuses with exit code 2 where" + " `pr.provider` is not `gh`.",
13979
+ description: "Merges one pull request through the GitHub CLI and then, in code, switches to the base branch," + " pulls it fast-forward only, deletes the head branch locally and on the remote where it is still there," + " and prunes, reporting each step; a head branch this checkout has no local branch for is reported as a" + " skipped local delete, and the rest still run. A head branch that is a trunk (`pr.base`, the remote's default" + " branch, `main` where `pr.base` names none, or a branch `cleanup.keep` names) is kept on both sides, with one" + " line saying so, and `--keep-branch` keeps any other head branch the same way. Refuses before it asks anything on a tracked change in the working tree or an" + " untracked path the pull request's head or the base's remote-tracking branch holds, on a pull" + " request that is not green or does not merge, and on a head branch checked out in another worktree, except a" + " clean, ended loop worktree under `loop.worktreeDir`, which it removes after copying its two plan files out. It" + " shows the pull request, its branches and the method and asks `Merge? [y/N]`; `--yes` skips the question," + " and without a terminal and without `--yes` it refuses. A pull request that reports no checks at all is" + " refused unless `--skip-checks` is given, which is refused on any pull request that does report checks;" + " with it the command reads how many workflows the repository defines, prints a warning for that case, asks" + " `Merge #<n> with no checks? [y/N]` (which `--yes` answers only where the repository defines no workflow, or" + " where no workflow file on the base has a `pull_request` trigger naming it)," + " and after the merge posts one comment on the pull request saying so. Where the release runs, the release" + " guard reads the branch before the question: a `collision` is refused unless" + " `dangerous.acceptVersionCollision` is true, and `pr.versionCollision` sets whether a `missing` or" + " `stale` branch merges silently, with a warning, after its own question, or not at all. A step that fails never undoes the merge: it" + " prints what is left as commands to paste and exits 1. After the merge it ticks the `Closes #<n>` line of" + " every issue the pull request closes, first on the checklist of the open epic that issue's `epic:` label" + " names, printing one line per epic, then on every open board whose checklist lists it, or on the roadmap" + " issue while no issue carries `type:roadmap`, warning rather than failing when one of those writes" + ' does not land. It ends by reading every open issue whose "Blocked by:" line names an issue this pull' + " request closes, asking whether to remove `spec:blocked` from each one whose blockers have all closed;" + " `--yes` does not answer that question, and every failure of that reading is a warning. With" + " board.relationships set to native it ticks no epic checklist and, in place of that reading, prints the" + " open issues the merge freed, whose blockers GitHub clears by itself, asking nothing and writing nothing. With" + " `--output=json` the pull request, the method, the steps that ran, the follow-ups, the roadmap tick and" + " the unblock reading, or the freed issues in native mode, are the data of the terminal result event;" + " the tick of each closed issue's epic checklist is one line per epic and no key of that data, and under" + " native there is none. Refuses with exit code 2 where" + " `pr.provider` is not `gh`.",
13980
13980
  args: [
13981
13981
  {
13982
13982
  name: "n",
@@ -13995,6 +13995,11 @@ var PR_MERGE_DECLARATION = Object.freeze({
13995
13995
  description: "Merge a pull request that reports no checks at all, after a warning and its own question." + " Refused where the pull request reports any check; `--yes` beside it is refused where the repository" + " defines a workflow that may run on pull requests into the base, or its workflow count could not be read.",
13996
13996
  type: "boolean"
13997
13997
  },
13998
+ {
13999
+ name: "keep-branch",
14000
+ description: "Keep the head branch locally and on the remote after the merge. A trunk is kept without it.",
14001
+ type: "boolean"
14002
+ },
13998
14003
  {
13999
14004
  name: "method",
14000
14005
  description: "How to merge: squash, merge or rebase. `pr.mergeMethod` when it is left out.",
@@ -14015,6 +14020,10 @@ var PR_MERGE_DECLARATION = Object.freeze({
14015
14020
  cmd: "rafa pr merge 41 --skip-checks",
14016
14021
  note: "Warns that nothing on GitHub tested pull request 41, asks, merges it and comments that it had no checks."
14017
14022
  },
14023
+ {
14024
+ cmd: "rafa pr merge 41 --keep-branch",
14025
+ note: "Merges pull request 41 and keeps its head branch on both sides, deleting neither."
14026
+ },
14018
14027
  {
14019
14028
  cmd: "rafa pr merge 41 --method=rebase --output=json",
14020
14029
  note: "Merges by rebase and writes a result event holding each clean-up step and the follow-ups."
@@ -14671,7 +14680,7 @@ var PR_USAGE = Object.freeze({
14671
14680
  show: "rafa pr show [<n>]",
14672
14681
  view: "rafa pr view [<n>]",
14673
14682
  list: "rafa pr list",
14674
- merge: "rafa pr merge [<n>] [--yes] [--skip-checks] [--method=squash|merge|rebase]",
14683
+ merge: "rafa pr merge [<n>] [--yes] [--skip-checks] [--keep-branch] [--method=squash|merge|rebase]",
14675
14684
  triage: "rafa pr triage [<n>] [--no-comment] [--resolve] [--allow-local-config] [--max-attempts=<count>]",
14676
14685
  wait: "rafa pr wait [<n>] [--timeout=<minutes>]",
14677
14686
  open: "rafa pr open --head=<branch> --base=<branch> --title=<text> --body-file=<path>",
@@ -28664,7 +28673,7 @@ function createPlanBlockedOffer(seams = DEFAULT_BLOCKED_SEAMS) {
28664
28673
 
28665
28674
  // src/commands/plan/ready-offer.ts
28666
28675
  var runIssueReadyLazily = async (options) => {
28667
- const { runIssueReady: run } = await import("./ready-gax3hhtt.js");
28676
+ const { runIssueReady: run } = await import("./ready-mh5wdzq5.js");
28668
28677
  return run(options);
28669
28678
  };
28670
28679
  var DEFAULT_OFFER_SEAMS = Object.freeze({});
@@ -24,14 +24,14 @@ import {
24
24
  requireCompleteSpec,
25
25
  requireTrustedBoardAuthor,
26
26
  typeOfLabels
27
- } from "./index-z4r20zwr.js";
27
+ } from "./index-j154qpbj.js";
28
28
  import"./index-ajv88fkm.js";
29
29
  import {
30
30
  CommandExit,
31
31
  createGitRunner,
32
32
  createLinePrompter,
33
33
  lazyPrompter
34
- } from "./index-2xzkzwm6.js";
34
+ } from "./index-thqpre1b.js";
35
35
  import"./index-2a7nb3an.js";
36
36
  import"./index-g91ys6kw.js";
37
37
  import"./index-m672ptpg.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tomato/rafa",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Alpha. Runs a plan through the ralph loop: one Claude Code session per task, one commit per task, then a pull request and a CI wait.",
5
5
  "private": false,
6
6
  "publishConfig": {