@rtorcato/repo-tooling 3.10.2 → 3.11.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.
@@ -115,7 +115,15 @@ async function probeRepo(exec) {
115
115
  autoMerge: d.allow_auto_merge === true,
116
116
  squashMerge: d.allow_squash_merge === true,
117
117
  deleteOnMerge: d.delete_branch_on_merge === true,
118
- mergeVisible: ['allow_auto_merge', 'allow_squash_merge', 'delete_branch_on_merge'].every((k) => typeof d[k] === 'boolean'),
118
+ mergeCommit: d.allow_merge_commit === true,
119
+ rebaseMerge: d.allow_rebase_merge === true,
120
+ mergeVisible: [
121
+ 'allow_auto_merge',
122
+ 'allow_squash_merge',
123
+ 'delete_branch_on_merge',
124
+ 'allow_merge_commit',
125
+ 'allow_rebase_merge',
126
+ ].every((k) => typeof d[k] === 'boolean'),
119
127
  },
120
128
  };
121
129
  }
@@ -197,6 +205,16 @@ async function checkBranchProtection(exec, nwo, branch) {
197
205
  };
198
206
  return { check, status: 'ok', detail: `${branch} protected per standard` };
199
207
  }
208
+ /**
209
+ * Squash is required *and exclusive* (#410). Leaving merge-commit or rebase
210
+ * enabled only makes them available on the merge button, and one mis-click puts
211
+ * every intermediate branch commit on the default branch: semantic-release then
212
+ * reads subjects nobody reviewed (a stray `fix:` inside a docs PR cuts a
213
+ * release), and `ai-issue-loop`'s Pass 2 stops finding the `(#N)` squash subject
214
+ * it uses to confirm work landed, so worktrees leak. Observed on `js-common`
215
+ * #204, whose CONTRIBUTING already said squash-only — the rule existed, nothing
216
+ * enforced it.
217
+ */
200
218
  function checkMergeSettings(info) {
201
219
  const check = 'Merge settings';
202
220
  // The token can't see the merge-setting fields (no admin:read) — skip rather
@@ -210,14 +228,18 @@ function checkMergeSettings(info) {
210
228
  deltas.push('squash-merge disabled');
211
229
  if (!info.deleteOnMerge)
212
230
  deltas.push('delete-branch-on-merge disabled');
231
+ if (info.mergeCommit)
232
+ deltas.push('merge commits allowed (squash only)');
233
+ if (info.rebaseMerge)
234
+ deltas.push('rebase merging allowed (squash only)');
213
235
  if (deltas.length)
214
236
  return {
215
237
  check,
216
238
  status: 'drift',
217
239
  detail: deltas.join('; '),
218
- hint: 'Enable auto-merge, squash-merge, and delete-branch-on-merge in repo settings',
240
+ hint: 'Enable auto-merge and delete-branch-on-merge, and make squash the only merge method',
219
241
  };
220
- return { check, status: 'ok', detail: 'auto-merge, squash-merge, delete-on-merge all on' };
242
+ return { check, status: 'ok', detail: 'squash-only, auto-merge and delete-on-merge on' };
221
243
  }
222
244
  async function checkWorkflowPermissions(exec, nwo) {
223
245
  const check = 'Workflow permissions';
@@ -370,7 +392,7 @@ export function buildGhApplyCommands(state) {
370
392
  const commands = [];
371
393
  if (state.merge)
372
394
  commands.push({
373
- label: 'merge settings (auto-merge, squash, delete-on-merge)',
395
+ label: 'merge settings (squash-only, auto-merge, delete-on-merge)',
374
396
  args: [
375
397
  'api',
376
398
  '-X',
@@ -382,6 +404,10 @@ export function buildGhApplyCommands(state) {
382
404
  'allow_squash_merge=true',
383
405
  '-F',
384
406
  'delete_branch_on_merge=true',
407
+ '-F',
408
+ 'allow_merge_commit=false',
409
+ '-F',
410
+ 'allow_rebase_merge=false',
385
411
  ],
386
412
  });
387
413
  if (state.protection)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtorcato/repo-tooling",
3
- "version": "3.10.2",
3
+ "version": "3.11.0",
4
4
  "description": "One CLI to scaffold, audit and fix your repo's whole toolchain — linting, tests, commits, releases & CI.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -806,10 +806,14 @@ times against one trivial issue and watch the labels advance.
806
806
  ## Repo prerequisites
807
807
 
808
808
  ```bash
809
- gh api repos/$OWNER_REPO --jq '{allow_squash_merge, allow_auto_merge, delete_branch_on_merge}'
809
+ gh api repos/$OWNER_REPO --jq '{allow_squash_merge, allow_merge_commit, allow_rebase_merge, allow_auto_merge, delete_branch_on_merge}'
810
810
  gh api repos/$OWNER_REPO/branches/main/protection --jq '{contexts: .required_status_checks.contexts, reviews: .required_pull_request_reviews}'
811
811
  ```
812
812
 
813
- Need: squash + auto-merge + delete-on-merge all true, at least one required
814
- status check, and `required_pull_request_reviews: null`. See the
815
- `github-pr-workflow` skill for the one-time bootstrap.
813
+ Need: auto-merge + delete-on-merge + squash all true, **`allow_merge_commit` and
814
+ `allow_rebase_merge` both false**, at least one required status check, and
815
+ `required_pull_request_reviews: null`. Squash has to be the *only* method, not
816
+ merely an available one: Pass 2 confirms a PR landed by finding its `(#N)` squash
817
+ subject on `main`, and a merge commit leaves nothing to find — the worktree then
818
+ survives every tick and its `ai-wip` slot leaks. See the `github-pr-workflow`
819
+ skill for the one-time bootstrap.