@rtorcato/repo-tooling 3.13.0 → 3.13.2

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/README.md CHANGED
@@ -175,7 +175,7 @@ ln -sf ../../node_modules/@rtorcato/repo-tooling/tooling/claude/repo-tooling.md
175
175
 
176
176
  This repo is also a self-hosted Claude Code marketplace. Install the plugin to
177
177
  get three skills — `repo-tooling` (adopt/audit the presets via the CLI),
178
- `npm-publish` (the family's release rules) and `ai-issue-loop` (the label-driven
178
+ `npm-publish` (never hand-cut a release) and `ai-issue-loop` (the label-driven
179
179
  issue → PR pipeline) — in any session:
180
180
 
181
181
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtorcato/repo-tooling",
3
- "version": "3.13.0",
3
+ "version": "3.13.2",
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": [
@@ -60,6 +60,8 @@ header names the agent *and* says why it is wearing a human's face:
60
60
  | `ai-wip` | issue | Claimed; a worktree exists. |
61
61
  | `ai-blocked` | issue | Agent gave up; needs a human. |
62
62
  | `ai-review` | PR | Awaiting agent review. |
63
+ | `ai-reviewing-code` | PR | `code-reviewer` claimed and running. Cleared with its verdict. |
64
+ | `ai-reviewing-sec` | PR | `security-expert` claimed and running. Cleared with its verdict. |
63
65
  | `ai-ok-code` | PR | `code-reviewer` passed. |
64
66
  | `ai-ok-sec` | PR | `security-expert` passed. |
65
67
  | `ai-changes` | PR | A reviewer requested changes. |
@@ -86,6 +88,8 @@ gh label create ai-ready -c '#0e8a16' -d 'Eligible for an AI agent to impleme
86
88
  gh label create ai-wip -c '#fbca04' -d 'Claimed by an agent; worktree exists'
87
89
  gh label create ai-blocked -c '#b60205' -d 'Agent gave up; needs a human'
88
90
  gh label create ai-review -c '#1d76db' -d 'PR awaiting agent review'
91
+ gh label create ai-reviewing-code -c '#c5def5' -d 'code-reviewer claimed and running'
92
+ gh label create ai-reviewing-sec -c '#c5def5' -d 'security-expert claimed and running'
89
93
  gh label create ai-ok-code -c '#0e8a16' -d 'code-reviewer passed'
90
94
  gh label create ai-ok-sec -c '#0e8a16' -d 'security-expert passed'
91
95
  gh label create ai-changes -c '#d93f0b' -d 'Reviewer requested changes'
@@ -100,14 +104,19 @@ grep -qxF '.claude/ai-loop-status' .gitignore || echo '.claude/ai-loop-status' >
100
104
 
101
105
  ```
102
106
  issue: ai-ready ─pickup─> ai-wip ─> PR opened, labelled ai-review
103
- PR: ai-review ─> reviewers ─┬─> ai-ok-code + ai-ok-sec ─┬─ issue PR ─> assigned to you, ai-review dropped
104
- │ (± ai-notes) │ ─> YOU merge ─> worktree removed
105
- │ └─ dependabot ─┬─ no ai-notes ─> auto-merge ─> worktree removed
106
- │ └─ ai-notes ───> assigned to you
107
- └─> ai-changes ─> fix round (max 2) ─> ai-review
108
- └─ round 3 ─> ai-blocked
107
+ PR: ai-review ─> ai-reviewing-* ─┬─> ai-ok-code + ai-ok-sec ─┬─ issue PR ─> assigned to you, ai-review dropped
108
+ │ (± ai-notes) │ ─> YOU merge ─> worktree removed
109
+ │ └─ dependabot ─┬─ no ai-notes ─> auto-merge ─> worktree removed
110
+ │ └─ ai-notes ───> assigned to you
111
+ └─> ai-changes ─> fix round (max 2) ─> ai-review
112
+ └─ round 3 ─> ai-blocked
109
113
  ```
110
114
 
115
+ `ai-reviewing-code` / `ai-reviewing-sec` are the *claim* step: Pass 3 applies one
116
+ immediately before spawning that reviewer, and the reviewer clears its own
117
+ alongside its verdict label. They are transient — a claim outliving its reviewer
118
+ means the agent died, which is Pass 2's stall reaping, not a state of the PR.
119
+
111
120
  Only the Dependabot arm merges itself, and only when no reviewer left `ai-notes`.
112
121
  An issue PR ends at *assigned to you* and waits there — `ai-ok-code, ai-ok-sec`
113
122
  with no `ai-review` is the loop's way of saying done. Add `ai-notes` and it means
@@ -374,7 +383,7 @@ work must never be reaped out from under itself.
374
383
  | Stalled | Condition | Do |
375
384
  |---|---|---|
376
385
  | Implementer died | issue `ai-wip` ≥45min, **and no PR exists** for `ai-<N>-<slug>` | `gh issue edit <N> --add-label ai-blocked --remove-label ai-wip --add-assignee @me`, comment, remove the worktree |
377
- | Reviewer died | PR `ai-review` ≥45min with no `ai-ok-*` and no `ai-changes` | re-spawn the missing reviewer — they're cheap and diff-scoped. If `ai-review` has been applied ≥3 times, `ai-blocked` instead |
386
+ | Reviewer died | PR `ai-reviewing-code` (or `ai-reviewing-sec`) ≥45min with no matching `ai-ok-*` and no `ai-changes` | `gh pr edit <N> --remove-label <the claim that stalled>` — drop **that** label, not a fixed one; a stalled `ai-reviewing-sec` cleared as `ai-reviewing-code` leaves the dead claim in place and the reviewer never re-spawns. Dropping the claim is what lets Pass 3 re-spawn it, and they're cheap and diff-scoped. If that claim has been applied ≥3 times, `ai-blocked` instead |
378
387
  | Orphan worktree | `"$WT_ROOT"/ai-<N>-*` whose issue is not `ai-wip` and has no open PR | remove the worktree and branch |
379
388
 
380
389
  The **no PR exists** condition on the first row is what makes reaping safe. An
@@ -404,8 +413,34 @@ means *a human must look*; do not spend it on a claim you already understand.
404
413
 
405
414
  **PRs labelled `ai-review`.** For each, spawn *in background* only the reviewers
406
415
  whose pass-label is missing — `code-reviewer` if no `ai-ok-code`,
407
- `security-expert` if no `ai-ok-sec`. Both can run concurrently; launch them in a
408
- single message.
416
+ `security-expert` if no `ai-ok-sec` — and **only those not already claimed**: skip
417
+ `code-reviewer` if the PR carries `ai-reviewing-code`, `security-expert` if it
418
+ carries `ai-reviewing-sec`. Both can run concurrently; launch them in a single
419
+ message.
420
+
421
+ **Claim first, then spawn** — the same shape Pass 4 uses before picking up an
422
+ issue. Apply the label immediately before the spawn, not after:
423
+
424
+ ```bash
425
+ gh pr edit <N> --add-label ai-reviewing-code # then spawn code-reviewer
426
+ gh pr edit <N> --add-label ai-reviewing-sec # then spawn security-expert
427
+ ```
428
+
429
+ Without the claim there is no window in which "a reviewer is running" is visible.
430
+ A reviewer applies its verdict label only at the *end*, after reading the diff and
431
+ posting its comment, so from spawn until then the labels are indistinguishable
432
+ from "nobody has started" — and a 15-minute tick is comfortably shorter than a
433
+ review. A tick landing in that gap spawns a duplicate of every reviewer in flight:
434
+ two agents read the same diff and post two review comments under the owner's
435
+ avatar, and the verdicts race, one applying `ai-ok-code` while the other applies
436
+ `ai-changes` and leaves the PR contradictory for Pass 1 to interpret. On a 4-PR
437
+ queue that is 8 duplicated reviewers against the monthly cap the limits section
438
+ exists to protect.
439
+
440
+ Two labels rather than one, because the reviewers are spawned independently and a
441
+ single flag could not say *which* was already running. The reviewer clears its own
442
+ claim alongside its verdict, so a claim never outlives its run; if one does, the
443
+ agent died and Pass 2's stall reaping drops it.
409
444
 
410
445
  Reviewer prompt template:
411
446
 
@@ -452,9 +487,14 @@ Reviewer prompt template:
452
487
  > restating the diff. Writing `Nothing.` is a real verdict and the common one —
453
488
  > say it plainly rather than padding the section to look thorough.
454
489
  >
455
- > Then apply exactly one verdict label:
456
- > - Clean, or only nit-level suggestions → `gh pr edit <N> --add-label <ai-ok-code|ai-ok-sec>`
457
- > - A real defect a maintainer would block on → `gh pr edit <N> --add-label ai-changes --remove-label ai-review`
490
+ > Then apply exactly one verdict label, **clearing your claim label in the same
491
+ > command**:
492
+ > - Clean, or only nit-level suggestions → `gh pr edit <N> --add-label <ai-ok-code|ai-ok-sec> --remove-label <ai-reviewing-code|ai-reviewing-sec>`
493
+ > - A real defect a maintainer would block on → `gh pr edit <N> --add-label ai-changes --remove-label ai-review --remove-label <ai-reviewing-code|ai-reviewing-sec>`
494
+ >
495
+ > Pass 3 applied that claim label immediately before spawning you, and skips
496
+ > spawning a second of you for as long as it is set. Leaving it behind wedges your
497
+ > half of the review until Pass 2 reaps it as a dead reviewer.
458
498
  >
459
499
  > And **additionally**, if and only if your `### Before merging` section is not
460
500
  > `Nothing.`:
@@ -537,7 +577,10 @@ package/from/to table survives because it sits at the top; classify from that.
537
577
  > State in your comment which rule fired, name the packages that tripped it, and say
538
578
  > whether the body was truncated so the reader knows what you could and couldn't see.
539
579
  > Same `🤖 *Automated review — …*` header line, same closing `### Before merging`
540
- > section, and same one-verdict-label rule as above.
580
+ > section, and same one-verdict-label rule as above — **including clearing your
581
+ > `<ai-reviewing-code|ai-reviewing-sec>` claim label in the same `gh pr edit`**.
582
+ > Pass 3 claimed you with it before spawning you, and a claim left behind wedges
583
+ > your half of the review until Pass 2 reaps it.
541
584
  >
542
585
  > Be sparing with `ai-notes` here specifically: it suppresses auto-merge, so a
543
586
  > reflexive note on every dependency bump wedges the one path that runs
@@ -694,6 +737,16 @@ Then spawn a background implementer agent:
694
737
  > 3. Read the repo's `CLAUDE.md` and obey it — especially any pre-commit build
695
738
  > step or committed build output.
696
739
  > 4. Do the work. Conventional Commits within the branch.
740
+ >
741
+ > **Do not run `pnpm install`.** This worktree's `node_modules` is a symlink to
742
+ > the main checkout, so pnpm sees a foreign directory it must purge first and
743
+ > aborts with `ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY`. Dependencies are
744
+ > already present — run tests, lint and build directly. If the work *is* a
745
+ > dependency change, `pnpm install --lockfile-only` updates `pnpm-lock.yaml`
746
+ > without touching `node_modules`. When that leaves a verification step you
747
+ > cannot run, say so in the PR body — name the command you could not run and
748
+ > why — so the reviewer knows CI is the only check on it rather than assuming
749
+ > you ran it.
697
750
  > 5. Push and open the PR. The title must be a Conventional Commit — it becomes
698
751
  > the squash subject on `main` and, in repos using semantic-release, decides
699
752
  > whether a release goes out at all. Body must contain `Closes #<N>`.
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  name: npm-publish
3
- description: Use before releasing or publishing any @rtorcato/* package (repo-tooling and the whole family publish the same way). Triggers on "publish", "cut a release", "bump the version", "tag a release", "npm publish", "how do releases work here". The hard rule — releases are automated by semantic-release on merge to main; an agent must NEVER run `npm publish`, `npm version`, or `git tag`, or hand-edit the version in package.json. NOT for the day-to-day tooling audit/fix flow — that's the repo-tooling skill.
3
+ description: Use before releasing or publishing any package in a repo set up by @rtorcato/repo-tooling. Triggers on "publish", "cut a release", "bump the version", "tag a release", "npm publish", "how do releases work here". The hard rule — releases are automated by the repo's release tool (semantic-release, Changesets, or Release Please); an agent must NEVER run `npm publish`, `npm version`, or `git tag`, or hand-edit the version in package.json. NOT for the day-to-day tooling audit/fix flow — that's the repo-tooling skill.
4
4
  ---
5
5
 
6
6
  # npm-publish
7
7
 
8
- Every `@rtorcato/*` package releases through **semantic-release on push to `main`**.
9
- Versioning, the git tag, the GitHub release, the CHANGELOG, and the npm publish are
10
- all derived from the commit history. There is no manual release step.
8
+ A repo set up by `@rtorcato/repo-tooling` releases through **automation on merge to
9
+ `main`** — one of semantic-release, Changesets, or Release Please. Versioning, the
10
+ git tag, the GitHub release, the CHANGELOG, and the npm publish all come from that
11
+ pipeline. There is no manual release step under any of them.
11
12
 
12
13
  ## The rule
13
14
 
@@ -17,31 +18,78 @@ all derived from the commit history. There is no manual release step.
17
18
  - `npm version` (or editing `"version"` in `package.json`)
18
19
  - `git tag` / pushing tags
19
20
  - hand-editing `CHANGELOG.md`
21
+ - merging the "Version Packages" PR (Changesets) or the release PR (Release Please) —
22
+ that merge *is* the publish, so it is the human's release decision, not yours
20
23
 
21
- If asked to "release" or "bump the version", the correct action is to land a
22
- **conventional commit** on `main` (via PR) and let the pipeline do the rest.
24
+ This holds for all three tools. Only the "what to do instead" differs, so first
25
+ work out which tool the repo uses.
23
26
 
24
- ## How a release actually happens
27
+ ## Which release tool is this repo on?
25
28
 
26
- 1. Work on a branch; commit with Conventional Commits (header ≤ 100 chars).
27
- 2. Open a PR; merge to `main` after review + green CI.
28
- 3. semantic-release runs on `main` and decides the bump from the commits:
29
- - `fix:` → patch
30
- - `feat:` → minor
31
- - `feat!:` / `BREAKING CHANGE:` → major
32
- - `chore:` / `docs:` / `refactor:` / `test:` → **no release**
33
- 4. It writes the version, tag, GitHub release, CHANGELOG, and publishes to npm.
29
+ Check the repo root, in this order — these are the same signals the CLI's
30
+ `doctor` check uses (`usesChangesets` / `checkSemanticRelease` in
31
+ `src/languages/js/checks.ts`):
32
+
33
+ | Signal | Tool |
34
+ |---|---|
35
+ | `.changeset/config.json` exists | **Changesets** |
36
+ | `release-please-config.json` exists | **Release Please** |
37
+ | `.releaserc*` / `release.config.*` exists, or a `"release"` key in `package.json` | **semantic-release** |
38
+
39
+ Or just ask the tooling: `npx @rtorcato/repo-tooling doctor --json` reports the
40
+ `semantic-release` check as ok with a detail naming the tool actually in use.
41
+
42
+ If more than one is configured that's drift, not a choice — stop and flag it.
43
+
44
+ ## What to do instead, per tool
45
+
46
+ ### semantic-release
47
+
48
+ The bump is derived from the commit history, so the commit type *is* the release
49
+ decision:
50
+
51
+ - `fix:` → patch
52
+ - `feat:` → minor
53
+ - `feat!:` / `BREAKING CHANGE:` → major
54
+ - `chore:` / `docs:` / `refactor:` / `test:` → **no release**
55
+
56
+ To ship a change: give it the right commit type and merge to `main`.
57
+
58
+ ### Changesets
59
+
60
+ The bump is declared in a changeset file, **not** inferred from commits. A PR with
61
+ no changeset publishes nothing, silently — so this is a required step, not an
62
+ optional one:
63
+
64
+ ```bash
65
+ pnpm changeset # pick the packages + bump level, write the summary
66
+ ```
67
+
68
+ That writes `.changeset/<name>.md`. Commit it with the change. On merge to `main`
69
+ the release action opens (or updates) a "Version Packages" PR; merging *that* is
70
+ what publishes — so never merge it yourself, leave it for a human. Hand-authoring
71
+ `.changeset/*.md` is fine — it is the one file in this flow you are meant to
72
+ write. `CHANGELOG.md` is still generated; don't touch it.
73
+
74
+ ### Release Please
75
+
76
+ Also commit-driven, same Conventional Commit → bump mapping as semantic-release.
77
+ On merge to `main` it opens a release PR that carries the version bump and the
78
+ CHANGELOG entry; merging that PR tags and publishes, so leave that merge to a
79
+ human — never do it yourself. Don't edit `.release-please-manifest.json` by hand.
34
80
 
35
81
  ## What an agent should do
36
82
 
37
- - To ship a change: make sure it carries the right commit type, then merge to `main`.
83
+ - To ship a change: right commit type, plus a changeset if the repo is on Changesets.
38
84
  - To check the last release: `git tag --sort=-creatordate | head -1`, or the GitHub
39
- Releases page — don't infer it from `package.json` (that's `0.0.0-development` /
40
- the placeholder until CI stamps it).
41
- - If a release seems stuck, inspect the release workflow run — do **not** publish by hand.
85
+ Releases page — don't infer it from `package.json` (under semantic-release that's
86
+ `0.0.0-development` / a placeholder until CI stamps it).
87
+ - If a release seems stuck, inspect the release workflow run, and check for an open
88
+ release / "Version Packages" PR waiting to be merged — report it, do **not** merge
89
+ it yourself and do **not** publish by hand.
42
90
 
43
91
  ## Why
44
92
 
45
93
  Manual publishes skip provenance, the CHANGELOG, and the tag/version invariant the
46
- whole family relies on, and a stray `npm version` commit derails the next automated
47
- bump. One automated path keeps every sibling repo publishing identically.
94
+ pipeline maintains, and a stray `npm version` commit derails the next automated bump.
95
+ One automated path per repo keeps releases reproducible and reviewable.