claude-dev-env 8.126.3 → 8.126.4
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`.
|
|
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).
|
|
15
15
|
|
|
16
16
|
**When to extract shared infrastructure first:** Multiple features need same utilities/helpers
|
|
17
17
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Split a pull request into slices
|
|
2
|
+
|
|
3
|
+
A slice is worth its own pull request when all four tests hold:
|
|
4
|
+
|
|
5
|
+
1. It merges alone and leaves the trunk working.
|
|
6
|
+
2. It has its own proof: a test or command that fails without the slice and passes with it.
|
|
7
|
+
3. It reverts alone.
|
|
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
|
+
|
|
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.
|
|
11
|
+
|
|
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
|
+
|
|
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.
|
|
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.
|
|
17
|
+
|
|
18
|
+
## Split a pull request that is already open
|
|
19
|
+
|
|
20
|
+
1. Pin the head SHA, and stop if it moves. Build the new branches from it. Never rewrite or push to a branch another session or person owns. The owner closes the original.
|
|
21
|
+
2. Read the body, the open review threads, and the latest review findings, and map each open finding to the slice it lands in.
|
|
22
|
+
3. Sort hunks by purpose. One file can hold hunks for two slices. Check imports across each seam before you fix the order, and put foundational work at the bottom.
|
|
23
|
+
4. Post the plan: the slices in order, the purpose sentence and proof command for each, and the cuts that failed the tests. Then get the owner's go before you build.
|
|
24
|
+
5. Change no code during the split. The tree at the top of the stack equals the tree at the pinned head, so `git diff <pinned-sha> <tip> --stat` prints nothing.
|
|
25
|
+
6. Prove each level alone, as [each stack level stands on its own](../SKILL.md#each-stack-level-stands-on-its-own) describes. Where CI runs only on the stack tip, a lower level has no verdict until you run its checks.
|
|
26
|
+
7. Each new pull request links the original pull request and carries its own proof. Approvals do not carry over, so name the approvals each one still needs.
|
|
@@ -285,12 +285,12 @@ test('sandbox uninstall removes only package-owned permission entries and keeps
|
|
|
285
285
|
}
|
|
286
286
|
});
|
|
287
287
|
|
|
288
|
-
test('package settings.json publishes the session agent,
|
|
288
|
+
test('package settings.json publishes the session agent, auto-compact, auto mode, idle compaction, Python UTF-8 and reminder-off defaults', () => {
|
|
289
289
|
const packageSettings = JSON.parse(readFileSync(PACKAGE_SETTINGS_PATH, 'utf8'));
|
|
290
290
|
const settingsDefaults = settingsDefaultsFromPackageSettings(packageSettings);
|
|
291
291
|
assert.deepEqual(
|
|
292
292
|
Object.keys(settingsDefaults).sort(),
|
|
293
|
-
['
|
|
293
|
+
['agent', 'autoCompactWindow', 'autoMode', 'env', 'modelSettings'],
|
|
294
294
|
);
|
|
295
295
|
assert.equal(settingsDefaults.autoCompactWindow, 350000);
|
|
296
296
|
assert.deepEqual(settingsDefaults.env, PACKAGE_ENV_DEFAULTS);
|
|
@@ -303,7 +303,6 @@ test('package settings.json publishes the session agent, advisor model, auto-com
|
|
|
303
303
|
existsSync(join(PACKAGE_ROOT, '.agents', 'agents', `${settingsDefaults.agent}.md`)),
|
|
304
304
|
'the session agent named by the agent default ships with the package',
|
|
305
305
|
);
|
|
306
|
-
assert.equal(settingsDefaults.advisorModel, 'fable');
|
|
307
306
|
const [firstAllowRule, ...allCustomAllowRules] = settingsDefaults.autoMode.allow;
|
|
308
307
|
assert.equal(firstAllowRule, '$defaults');
|
|
309
308
|
assert.equal(allCustomAllowRules.length, 2);
|
|
@@ -384,13 +383,13 @@ test('install leaves reminder-off variables the user already set in place and ad
|
|
|
384
383
|
}
|
|
385
384
|
});
|
|
386
385
|
|
|
387
|
-
test('install
|
|
386
|
+
test('install does not add advisorModel and keeps a user choice on rerun', () => {
|
|
388
387
|
const sandboxHome = mkdtempSync(join(tmpdir(), 'cde-settings-defaults-'));
|
|
389
388
|
try {
|
|
390
389
|
const firstRun = runInstallerInSandbox(sandboxHome);
|
|
391
390
|
assert.equal(firstRun.status, 0, firstRun.stderr);
|
|
392
391
|
const settingsPath = join(sandboxHome, '.claude', 'settings.json');
|
|
393
|
-
assert.equal(JSON.parse(readFileSync(settingsPath, 'utf8'))
|
|
392
|
+
assert.equal(Object.hasOwn(JSON.parse(readFileSync(settingsPath, 'utf8')), 'advisorModel'), false);
|
|
394
393
|
const userChoice = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
395
394
|
userChoice.advisorModel = 'sonnet';
|
|
396
395
|
writeFileSync(settingsPath, JSON.stringify(userChoice, null, 4) + '\n');
|
package/package.json
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""The pr-lifecycle skill points at the slice rule, and the reference carries the four tests and the retro-split steps."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
PACKAGE_ROOT = Path(__file__).resolve().parents[2]
|
|
6
|
+
SKILL_DIRECTORY = PACKAGE_ROOT / ".agents" / "skills" / "pr-lifecycle"
|
|
7
|
+
PR_LIFECYCLE_PATH = SKILL_DIRECTORY / "SKILL.md"
|
|
8
|
+
SLICE_REFERENCE_PATH = SKILL_DIRECTORY / "reference" / "split-a-pull-request.md"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _decision_tree(skill_text: str) -> str:
|
|
12
|
+
return skill_text.split("### Workflow decision tree", 1)[1].split("\n### ", 1)[0]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_the_decision_tree_points_at_the_slice_reference() -> None:
|
|
16
|
+
decision_tree = _decision_tree(PR_LIFECYCLE_PATH.read_text(encoding="utf-8"))
|
|
17
|
+
assert "(reference/split-a-pull-request.md)" in decision_tree
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_the_reference_lists_the_four_slice_tests_in_order() -> None:
|
|
21
|
+
reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
|
|
22
|
+
all_test_markers = (
|
|
23
|
+
"1. It merges alone and leaves the trunk working.",
|
|
24
|
+
"2. It has its own proof: a test or command that fails without the slice and passes with it.",
|
|
25
|
+
"3. It reverts alone.",
|
|
26
|
+
"4. One sentence states its purpose, and a reviewer can judge it without reading later levels.",
|
|
27
|
+
)
|
|
28
|
+
all_positions = [
|
|
29
|
+
reference_text.index(each_marker) for each_marker in all_test_markers
|
|
30
|
+
]
|
|
31
|
+
assert all_positions == sorted(all_positions)
|
|
32
|
+
assert "A slice that needs two sentences is usually two slices." in reference_text
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_the_reference_merges_cosmetic_cuts_back_and_allows_one_pull_request() -> None:
|
|
36
|
+
reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
|
|
37
|
+
assert (
|
|
38
|
+
"A cut by folder, file count, or line cap that fails these tests is cosmetic. Merge it back."
|
|
39
|
+
in reference_text
|
|
40
|
+
)
|
|
41
|
+
assert (
|
|
42
|
+
"Fewer slices is a valid answer, and so is one pull request with a stated reason."
|
|
43
|
+
in reference_text
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_the_reference_says_when_to_split_and_what_to_try_first() -> None:
|
|
48
|
+
reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
|
|
49
|
+
assert "the change carries more than one purpose" in reference_text
|
|
50
|
+
assert (
|
|
51
|
+
"Isolate the part that switches the behaviour on, so its revert is small."
|
|
52
|
+
in reference_text
|
|
53
|
+
)
|
|
54
|
+
assert "`linguist-generated`" in reference_text
|
|
55
|
+
assert "Decide the slices when you write the plan." in reference_text
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_the_retro_split_pins_the_head_and_posts_the_plan_before_building() -> None:
|
|
59
|
+
reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
|
|
60
|
+
assert "## Split a pull request that is already open" in reference_text
|
|
61
|
+
assert "Pin the head SHA" in reference_text
|
|
62
|
+
assert (
|
|
63
|
+
"Never rewrite or push to a branch another session or person owns."
|
|
64
|
+
in reference_text
|
|
65
|
+
)
|
|
66
|
+
assert "map each open finding to the slice it lands in" in reference_text
|
|
67
|
+
plan_position = reference_text.index("get the owner's go before you build")
|
|
68
|
+
no_code_position = reference_text.index("Change no code during the split.")
|
|
69
|
+
assert plan_position < no_code_position
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_the_retro_split_keeps_the_tree_and_names_the_approvals_each_slice_needs() -> (
|
|
73
|
+
None
|
|
74
|
+
):
|
|
75
|
+
reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
|
|
76
|
+
assert "`git diff <pinned-sha> <tip> --stat` prints nothing" in reference_text
|
|
77
|
+
assert "Approvals do not carry over" in reference_text
|
|
78
|
+
assert "links the original pull request" in reference_text
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_the_retro_split_links_the_stack_level_proof_and_does_not_copy_it() -> None:
|
|
82
|
+
reference_text = SLICE_REFERENCE_PATH.read_text(encoding="utf-8")
|
|
83
|
+
assert "(../SKILL.md#each-stack-level-stands-on-its-own)" in reference_text
|
|
84
|
+
assert "A symbol belongs at the level that first" not in reference_text
|
|
85
|
+
assert "CI runs only on the stack tip" in reference_text
|