claude-dev-env 8.126.4 → 8.126.6

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.
@@ -11,7 +11,7 @@ User-level rule: applies to **every** git repo that uses GitHub with `gh`. Small
11
11
 
12
12
  ### Workflow decision tree
13
13
 
14
- **When to use stacked PRs:** Feature B depends on Feature A's implementation. See the Delivery section of `~/.claude/docs/rule-guides/verified-work.md`. To decide where to cut, or to split an open PR, read [the slice test](reference/split-a-pull-request.md).
14
+ **When to use stacked PRs:** Feature B depends on Feature A's implementation. See the Delivery section of `~/.claude/docs/rule-guides/verified-work.md`. To decide where to cut, or to split an open PR, read [the slice test](reference/split-a-pull-request.md). Every PR, stacked or not, checks [the size bar](reference/split-a-pull-request.md#size-bar).
15
15
 
16
16
  **When to extract shared infrastructure first:** Multiple features need same utilities/helpers
17
17
 
@@ -7,13 +7,23 @@ A slice is worth its own pull request when all four tests hold:
7
7
  3. It reverts alone.
8
8
  4. One sentence states its purpose, and a reviewer can judge it without reading later levels. A slice that needs two sentences is usually two slices.
9
9
 
10
- A cut by folder, file count, or line cap that fails these tests is cosmetic. Merge it back. Fewer slices is a valid answer, and so is one pull request with a stated reason.
10
+ A cut by folder, file count, or line cap that fails these tests is cosmetic, and the [size bar](#size-bar) only says when to look for a seam. Merge it back. Fewer slices is a valid answer, and so is one pull request with a stated reason.
11
11
 
12
12
  Split when the change carries more than one purpose, or when one small part carries the behaviour change and its risk while the rest is library, data, or docs. Isolate the part that switches the behaviour on, so its revert is small.
13
13
 
14
- Try the cheaper move first. Mark generated or data files that swell the diff with a `linguist-generated` line in `.gitattributes`, then judge the size again.
14
+ Try the cheaper move first. Mark generated or data files that swell the diff with a `linguist-generated` line in `.gitattributes`, then judge the size again against the [size bar](#size-bar).
15
15
 
16
- Decide the slices when you write the plan. The Delivery section of `~/.claude/docs/rule-guides/verified-work.md` already commits each verified piece as its own level. The steps below repair a pull request where that did not happen.
16
+ Decide the slices when you write the plan. The Delivery section of `~/.claude/docs/rule-guides/verified-work.md` already commits each verified piece as its own level. The steps in [Split a pull request that is already open](#split-a-pull-request-that-is-already-open) repair a pull request where that did not happen.
17
+
18
+ ## Size bar
19
+
20
+ Apply the bar to each pull request, including each stack level. The bar only says when to look for a seam. Every cut still passes the four tests. Count added plus deleted lines, tests included, without lockfiles and without files marked `linguist-generated`. A renamed or moved file counts only its edited lines. Count against the merge base with the target branch, which for a stack level is the branch below it.
21
+
22
+ - Up to 400 lines fits one review, and about 100 lines reads best.
23
+ - Over 400 lines, look for a seam that passes the four tests. When none passes, keep the slice whole and state the reason in the pull request body.
24
+ - Over 1,000 lines, put that reason under a `## Why one pull request` heading.
25
+
26
+ Sources: [Google small CLs](https://google.github.io/eng-practices/review/developer/small-cls.html) and [SmartBear code review practices](https://smartbear.com/learn/code-review/best-practices-for-peer-code-review/).
17
27
 
18
28
  ## Split a pull request that is already open
19
29
 
@@ -9,7 +9,7 @@ block to the agent's context::
9
9
 
10
10
  === OWNED PR REVIEW LOOP (context reminder, never a block) ===
11
11
  You opened jl-cmd-projects/claude-dev-env#42 https://github.com/...
12
- 1. Review loop. Load the efficient-review skill ...
12
+ 1. Review loop. In Claude Code, run /code-review ... In Codex, load efficient-review ...
13
13
  2. Mark ready. ...
14
14
  3. Babysit. Follow the pstack babysit playbook ...
15
15
  4. Ship. Follow the pstack shipping playbook ...
@@ -293,7 +293,9 @@ def test_should_name_every_step_and_skill_in_the_context() -> None:
293
293
  }
294
294
  )
295
295
  assert "jl-cmd-projects/claude-dev-env#42" in context
296
- assert "efficient-review" in context
296
+ assert "In Claude Code, run /code-review high --max-findings all 42" in context
297
+ assert "in this session" in context
298
+ assert "In Codex, load the efficient-review skill" in context
297
299
  assert "three full passes" in context
298
300
  assert "/code-review low --fix 42" in context
299
301
  assert "gh pr ready 42 --repo jl-cmd-projects/claude-dev-env" in context
@@ -321,7 +323,7 @@ def test_main_should_emit_the_loop_after_gh_pr_create_on_an_owned_repository() -
321
323
  stdout = _run_hook(_shell_payload("gh pr create --fill", f"{OWNED_PR_URL}\n"))
322
324
  payload = json.loads(stdout)
323
325
  assert payload["hookSpecificOutput"]["hookEventName"] == "PostToolUse"
324
- assert "efficient-review" in _context_of(stdout)
326
+ assert "/code-review high --max-findings all 42" in _context_of(stdout)
325
327
 
326
328
 
327
329
  def test_main_should_emit_the_loop_after_a_gh_api_pulls_post() -> None:
@@ -333,7 +335,9 @@ def test_main_should_emit_the_loop_after_a_gh_api_pulls_post() -> None:
333
335
  }
334
336
  )
335
337
  stdout = _run_hook(
336
- _shell_payload("gh api repos/jl-cmd-projects/claude-dev-env/pulls --input pr.json", rest_response)
338
+ _shell_payload(
339
+ "gh api repos/jl-cmd-projects/claude-dev-env/pulls --input pr.json", rest_response
340
+ )
337
341
  )
338
342
  assert "jl-cmd-projects/claude-dev-env#42" in _context_of(stdout)
339
343
 
@@ -411,7 +415,12 @@ def test_hooks_json_should_route_shell_and_mcp_create_calls_to_the_hook() -> Non
411
415
 
412
416
  def test_should_leave_a_held_pull_request_with_the_user() -> None:
413
417
  context = owned_pr_review_loop.build_review_loop_context(
414
- {"owner": "jl-cmd-projects", "repository": "claude-dev-env", "number": "42", "url": OWNED_PR_URL}
418
+ {
419
+ "owner": "jl-cmd-projects",
420
+ "repository": "claude-dev-env",
421
+ "number": "42",
422
+ "url": OWNED_PR_URL,
423
+ }
415
424
  )
416
425
  assert "When the user asked to hold this PR or to read it before it merges" in context
417
426
  assert "Blocked: jl-cmd-projects/claude-dev-env#42 - the user holds the merge." in context
@@ -15,7 +15,7 @@ This family rewrites a Git Bash command when path conversion would change a revi
15
15
  - `blocking/bash_post_call_dispatcher.py` runs hosted observers and joins their context output without blocking the call.
16
16
  - When a hosted hook exits 2, both dispatchers exit 2. Its stderr reaches the host as written. Before a call, exit 2 blocks the call. After a call, exit 2 shows that stderr to Claude.
17
17
  - `advisory/pr_done_reminder.py` adds a pull request checklist after a successful push or pull request creation.
18
- - `advisory/owned_pr_review_loop.py` adds review-loop instructions after the agent opens a pull request on an owned repository outside the preset list of repositories that run their own automated review: run efficient-review until clean, mark the pull request ready, babysit it, and ship it to merge. It also records the pull request for the session in `owned_pr_session_record.py`.
18
+ - `advisory/owned_pr_review_loop.py` adds review-loop instructions after the agent opens a pull request on an owned repository outside the preset list of repositories that run their own automated review: run `/code-review` in a Claude Code session, or efficient-review in Codex, until clean, mark the pull request ready, babysit it, and ship it to merge. It also records the pull request for the session in `owned_pr_session_record.py`.
19
19
 
20
20
  ## When it fires
21
21
 
@@ -20,6 +20,8 @@ from __future__ import annotations
20
20
 
21
21
  import re
22
22
 
23
+ from hooks_constants.merge_review_gate_constants import DEFAULT_REVIEW_COMMAND
24
+
23
25
  __all__ = [
24
26
  "NAME_DIGEST_TEXT_ENCODING",
25
27
  "ALL_OWNED_OWNER_DIGESTS",
@@ -124,8 +126,9 @@ REVIEW_LOOP_CONTEXT_TEMPLATE: str = (
124
126
  "This repository has no automated review, so you own the review and the merge.\n"
125
127
  "Your task now runs past opening this PR to its merge, also when your brief\n"
126
128
  "asked for a draft or stopped at opening it.\n"
127
- "1. Review loop. Load the efficient-review skill (/efficient-review). Review the\n"
128
- " branch, check each finding against the code, fix every one that holds, push,\n"
129
+ f"1. Review loop. In Claude Code, run {DEFAULT_REVIEW_COMMAND} {{number}}\n"
130
+ " in this session. In Codex, load the efficient-review skill (/efficient-review).\n"
131
+ " Check each finding against the code, fix every one that holds, push,\n"
129
132
  " and review again. After three full passes, each later pass is\n"
130
133
  " /code-review low --fix {number}; commit and push its fixes, then review the new head.\n"
131
134
  " Repeat until a pass reports no findings.\n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "8.126.4",
3
+ "version": "8.126.6",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,4 @@
1
- """The pr-lifecycle skill points at the slice rule, and the reference carries the four tests and the retro-split steps."""
1
+ """The pr-lifecycle skill points at the slice rule, and the reference carries the four tests, the size bar, and the retro-split steps."""
2
2
 
3
3
  from pathlib import Path
4
4
 
@@ -35,7 +35,7 @@ def test_the_reference_lists_the_four_slice_tests_in_order() -> None:
35
35
  def test_the_reference_merges_cosmetic_cuts_back_and_allows_one_pull_request() -> None:
36
36
  reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
37
37
  assert (
38
- "A cut by folder, file count, or line cap that fails these tests is cosmetic. Merge it back."
38
+ "A cut by folder, file count, or line cap that fails these tests is cosmetic, and the [size bar](#size-bar) only says when to look for a seam. Merge it back."
39
39
  in reference_text
40
40
  )
41
41
  assert (
@@ -83,3 +83,45 @@ def test_the_retro_split_links_the_stack_level_proof_and_does_not_copy_it() -> N
83
83
  assert "(../SKILL.md#each-stack-level-stands-on-its-own)" in reference_text
84
84
  assert "A symbol belongs at the level that first" not in reference_text
85
85
  assert "CI runs only on the stack tip" in reference_text
86
+
87
+
88
+ def test_the_decision_tree_points_every_pull_request_at_the_size_bar() -> None:
89
+ decision_tree = _decision_tree(PR_LIFECYCLE_PATH.read_text(encoding="utf-8"))
90
+ assert (
91
+ "Every PR, stacked or not, checks [the size bar](reference/split-a-pull-request.md#size-bar)."
92
+ in decision_tree
93
+ )
94
+
95
+
96
+ def test_the_reference_sets_a_size_bar_after_the_four_tests() -> None:
97
+ reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
98
+ fourth_test_position = reference_text.index("4. One sentence states its purpose")
99
+ size_bar_position = reference_text.index("## Size bar")
100
+ assert fourth_test_position < size_bar_position
101
+ retro_split_position = reference_text.index(
102
+ "## Split a pull request that is already open"
103
+ )
104
+ assert size_bar_position < retro_split_position
105
+ size_bar = reference_text[size_bar_position:retro_split_position]
106
+ all_required_phrases = (
107
+ "Apply the bar to each pull request, including each stack level.",
108
+ "A renamed or moved file counts only its edited lines.",
109
+ "Count against the merge base with the target branch, which for a stack level is the branch below it.",
110
+ "Every cut still passes the four tests.",
111
+ "Count added plus deleted lines, tests included, without lockfiles",
112
+ "without files marked `linguist-generated`",
113
+ "Up to 400 lines fits one review, and about 100 lines reads best.",
114
+ "Over 400 lines, look for a seam that passes the four tests.",
115
+ "When none passes, keep the slice whole and state the reason in the pull request body.",
116
+ "Over 1,000 lines, put that reason under a `## Why one pull request` heading.",
117
+ "google.github.io/eng-practices/review/developer/small-cls.html",
118
+ "smartbear.com/learn/code-review/best-practices-for-peer-code-review",
119
+ )
120
+ for each_phrase in all_required_phrases:
121
+ assert each_phrase in size_bar, each_phrase
122
+ all_bullet_positions = [
123
+ size_bar.index("- Up to 400 lines"),
124
+ size_bar.index("- Over 400 lines"),
125
+ size_bar.index("- Over 1,000 lines"),
126
+ ]
127
+ assert all_bullet_positions == sorted(all_bullet_positions)