claude-dev-env 8.109.7 → 8.110.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.
Files changed (28) hide show
  1. package/.agents/agents/reference/pr-description-illustrative-voice.md +1 -0
  2. package/.agents/skills/pull-request/reference/body-sections.md +2 -2
  3. package/bin/install-pstack-plugin.mjs +80 -14
  4. package/bin/install-pstack-plugin.test.mjs +111 -40
  5. package/bin/install.mjs +23 -20
  6. package/bin/install.test.mjs +22 -17
  7. package/docs/rule-guides/proof-before-pull-request.md +1 -1
  8. package/hooks/blocking/body_flowchart.py +152 -0
  9. package/hooks/blocking/pr_lifecycle_skill_gate.py +5 -0
  10. package/hooks/blocking/pull_request_proof.py +67 -2
  11. package/hooks/blocking/reply_length_gate.py +17 -1
  12. package/hooks/blocking/test_body_flowchart.py +99 -0
  13. package/hooks/blocking/test_pr_lifecycle_skill_gate.py +6 -2
  14. package/hooks/blocking/test_pull_request_proof.py +98 -0
  15. package/hooks/blocking/test_reply_length_gate.py +120 -0
  16. package/hooks/features/conduct-gates.md +1 -1
  17. package/hooks/hooks_constants/body_flowchart_constants.py +18 -0
  18. package/hooks/hooks_constants/pull_request_proof_constants.py +8 -0
  19. package/hooks/hooks_constants/reply_length_gate_constants.py +1 -0
  20. package/hooks/hooks_constants/test_visual_reply_rules_constants.py +1 -0
  21. package/hooks/hooks_constants/visual_reply_rules_constants.py +19 -0
  22. package/hooks/test_visual_reply_rules.py +93 -0
  23. package/hooks/visual_reply_rules.py +61 -1
  24. package/package.json +1 -1
  25. package/rules/visual-reply-rules.json +5 -0
  26. package/scripts/durable_post_lint.py +15 -0
  27. package/scripts/durable_post_lint_config/config/constants.py +5 -0
  28. package/scripts/test_durable_post_lint.py +140 -1
@@ -46,5 +46,6 @@ The person running the loop asked for a full look, so every pass gets a full loo
46
46
  - Use picture words: hand it, open it, find it, check it, save it, skip it, stop, call by name.
47
47
  - Prefer spoken results: “found it,” “missing,” “duplicated,” “couldn’t.”
48
48
  - Keep `What this does` short and concrete.
49
+ - Draw the flow before and after the change under `What this does` as a fenced `mermaid` flowchart with at least two nodes and one arrow.
49
50
  - Put proof only in `Proof in practice`.
50
51
  - Explain jargon immediately or replace it.
@@ -4,7 +4,7 @@ A reviewer reads the body in place of the code. The body says what the change do
4
4
 
5
5
  | Section | Holds |
6
6
  |---|---|
7
- | `## What this does` | Two or three plain sentences: the behavior before, the behavior after, and who notices. Written for a reviewer who has not read the worker's conversation. |
7
+ | `## What this does` | Two or three plain sentences: the behavior before, the behavior after, and who notices. Written for a reviewer who has not read the worker's conversation. A fenced `mermaid` flowchart under this heading draws the flow before and after the change; a one-step change gets a short chart. |
8
8
  | `## What changed` | One bullet per area of the diff, in plain words. |
9
9
  | `## Existing work` | What already did part of the job, with a link or file and line, and what this change adds. Or the places searched. |
10
10
  | `## Proof in practice` | Each command in backticks, and the output without the change and with it. The run on the target the change exists to fix is here before the pull request opens. |
@@ -15,4 +15,4 @@ A reviewer reads the body in place of the code. The body says what the change do
15
15
 
16
16
  A repository's own sections, such as a request record or a session link, follow these. Optional `## Why now` and `## After merge` sections go after What this does and after How to revert.
17
17
 
18
- `pull_request.py template` writes the headings in this order into a new body, and appends each missing heading to the end of a body that already has some. `durable_post_lint.py` reports a create body missing What this does, Risk, or How to revert, and the proof gate holds one missing Existing work, Proof in practice, or Eval for a `feat` title.
18
+ `pull_request.py template` writes the headings in this order into a new body, and appends each missing heading to the end of a body that already has some. `durable_post_lint.py` reports a create body missing What this does, Risk, or How to revert, and reports a create or edit body whose What this does section holds no flowchart: a closed `mermaid` block whose first line starts with `flowchart` and that joins two nodes with an arrow. The proof gate holds one missing Existing work, Proof in practice, or Eval for a `feat` title, and holds a create body, or an edit body that has a What this does heading, with no flowchart there.
@@ -23,13 +23,16 @@ export const PSTACK_PLUGIN_SPEC = Object.freeze({
23
23
  optOutVariable: PSTACK_PLUGIN_OPT_OUT_VARIABLE,
24
24
  });
25
25
 
26
+ export const MODS_FRAMEWORK_MARKETPLACE_REPOSITORY = 'jl-cmd-projects/claude-mods-framework';
27
+ export const MODS_FRAMEWORK_MARKETPLACE_NAME = 'claude-mods-framework';
28
+
26
29
  export const USAGE_WRAPUP_PLUGIN_SPEC = Object.freeze({
27
30
  name: 'usage-wrapup',
28
31
  label: 'Usage-wrapup',
29
- marketplaceRepository: 'jl-cmd-projects/claude-dev-env',
30
- marketplaceName: 'claude-dev-env',
31
- sparsePaths: Object.freeze(['.claude-plugin', 'packages/usage-wrapup']),
32
- pluginIdentifier: 'usage-wrapup@claude-dev-env',
32
+ marketplaceRepository: MODS_FRAMEWORK_MARKETPLACE_REPOSITORY,
33
+ marketplaceName: MODS_FRAMEWORK_MARKETPLACE_NAME,
34
+ sparsePaths: Object.freeze([]),
35
+ pluginIdentifier: `usage-wrapup@${MODS_FRAMEWORK_MARKETPLACE_NAME}`,
33
36
  hosts: Object.freeze(['claude']),
34
37
  optOutFlag: '--no-usage-wrapup',
35
38
  optOutVariable: 'CDE_INSTALL_USAGE_WRAPUP',
@@ -47,18 +50,79 @@ export const ALL_RETIRED_PLUGIN_SPECS = Object.freeze([
47
50
  }),
48
51
  ]);
49
52
 
53
+ /**
54
+ * The usage-wrapup and subagent-models copies this repository once shipped.
55
+ * The mods framework marketplace now supplies each one, and an install
56
+ * removes an old copy only after its replacement installs, so a home that
57
+ * cannot reach that marketplace keeps the copy it has.
58
+ */
59
+ export const ALL_REPLACED_PLUGIN_SPECS = Object.freeze([
60
+ Object.freeze({
61
+ name: 'usage-wrapup',
62
+ marketplaceName: 'claude-dev-env',
63
+ pluginIdentifier: 'usage-wrapup@claude-dev-env',
64
+ }),
65
+ Object.freeze({
66
+ name: 'subagent-models',
67
+ marketplaceName: 'claude-dev-env',
68
+ pluginIdentifier: 'subagent-models@claude-dev-env',
69
+ }),
70
+ ]);
71
+
72
+ /**
73
+ * Pick the old copies an install may remove now that its replacements are in.
74
+ *
75
+ * @param {ReadonlyArray<{name: string}>} allReplacedSpecs The old copies.
76
+ * @param {ReadonlyArray<{name: string}>} allInstalledSpecs The plugins the install wrote.
77
+ * @param {{status: string}} installOutcome The outcome of that install.
78
+ * @returns {Array<{name: string}>} Each old copy whose same-named replacement installed.
79
+ */
80
+ export function replacedSpecsToRemove(allReplacedSpecs, allInstalledSpecs, installOutcome) {
81
+ if (installOutcome.status !== 'installed') return [];
82
+ const allInstalledNames = new Set(allInstalledSpecs.map(eachSpec => eachSpec.name));
83
+ return allReplacedSpecs.filter(eachSpec => allInstalledNames.has(eachSpec.name));
84
+ }
85
+
86
+ /**
87
+ * The shared drawer the usage-wrapup and subagent-models panes register
88
+ * through. It has no opt-out of its own, and it installs whenever a plugin
89
+ * that depends on it installs.
90
+ */
91
+ export const DRAWER_CORE_PLUGIN_SPEC = Object.freeze({
92
+ name: 'drawer-core',
93
+ label: 'Drawer-core',
94
+ marketplaceRepository: MODS_FRAMEWORK_MARKETPLACE_REPOSITORY,
95
+ marketplaceName: MODS_FRAMEWORK_MARKETPLACE_NAME,
96
+ sparsePaths: Object.freeze([]),
97
+ pluginIdentifier: `drawer-core@${MODS_FRAMEWORK_MARKETPLACE_NAME}`,
98
+ hosts: Object.freeze(['claude']),
99
+ });
100
+
50
101
  export const SUBAGENT_MODELS_PLUGIN_SPEC = Object.freeze({
51
102
  name: 'subagent-models',
52
103
  label: 'Subagent-models',
53
- marketplaceRepository: 'jl-cmd-projects/claude-dev-env',
54
- marketplaceName: 'claude-dev-env',
55
- sparsePaths: Object.freeze(['.claude-plugin', 'packages/subagent-models']),
56
- pluginIdentifier: 'subagent-models@claude-dev-env',
104
+ marketplaceRepository: MODS_FRAMEWORK_MARKETPLACE_REPOSITORY,
105
+ marketplaceName: MODS_FRAMEWORK_MARKETPLACE_NAME,
106
+ sparsePaths: Object.freeze([]),
107
+ pluginIdentifier: `subagent-models@${MODS_FRAMEWORK_MARKETPLACE_NAME}`,
57
108
  hosts: Object.freeze(['claude']),
58
109
  optOutFlag: '--no-subagent-models',
59
110
  optOutVariable: 'CDE_INSTALL_SUBAGENT_MODELS',
60
111
  });
61
112
 
113
+ /**
114
+ * Pick the mods framework plugins one install writes.
115
+ *
116
+ * @param {string[]} [argumentList] The installer's command-line arguments.
117
+ * @param {Record<string, string|undefined>} [environment] The process environment.
118
+ * @returns {Array<typeof DRAWER_CORE_PLUGIN_SPEC>} drawer-core first, then each plugin not opted out, or none when every plugin is opted out.
119
+ */
120
+ export function modsFrameworkPluginSpecs(argumentList = process.argv.slice(2), environment = process.env) {
121
+ const allChosenSpecs = [USAGE_WRAPUP_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC]
122
+ .filter(eachSpec => shouldInstallMarketplacePlugin(eachSpec, argumentList, environment));
123
+ return allChosenSpecs.length === 0 ? [] : [DRAWER_CORE_PLUGIN_SPEC, ...allChosenSpecs];
124
+ }
125
+
62
126
  /**
63
127
  * Anthropic's security-guidance plugin, which reviews each edit, turn, and
64
128
  * commit an agent makes for security problems.
@@ -529,11 +593,12 @@ export function installMarketplacePlugins(allSpecs, options = {}, dependencies =
529
593
  /**
530
594
  * Uninstall each retired plugin a Claude home still holds.
531
595
  *
532
- * A home holds a retired plugin when its plugin cache has a folder for it. For
533
- * each such plugin the step runs `claude plugin uninstall` and then deletes
534
- * the cached versions Claude Code marked as orphaned. A home with no cached
535
- * folder runs no command, so a fresh install and a second update both leave
536
- * the home as it stands. A missing `claude` command skips the step. A failed
596
+ * A home holds a retired plugin when its plugin cache folder holds a version.
597
+ * For each such plugin the step runs `claude plugin uninstall`, deletes the
598
+ * cached versions Claude Code marked as orphaned, and deletes the plugin
599
+ * folder once no version is left. A home with no cached version runs no
600
+ * command, so a fresh install and a second update both leave the home as it
601
+ * stands. A missing `claude` command skips the step. A failed
537
602
  * uninstall is recorded in `failedRemovals` with its detail, and its cached
538
603
  * versions stay on disk.
539
604
  *
@@ -555,7 +620,7 @@ export function removeRetiredMarketplacePlugins(allRetiredSpecs, options, depend
555
620
  if (!options.claudeRoot) return { removedIdentifiers, removedVersionPaths, failedRemovals };
556
621
  for (const eachSpec of allRetiredSpecs) {
557
622
  const versionsDirectory = hostDefinition.orphanedVersionsDirectory(options.claudeRoot, eachSpec);
558
- if (!existsSync(versionsDirectory)) continue;
623
+ if (!existsSync(versionsDirectory) || readdirSync(versionsDirectory).length === 0) continue;
559
624
  const outcome = runCommand(
560
625
  executable,
561
626
  ['plugin', hostDefinition.uninstallVerb, eachSpec.pluginIdentifier],
@@ -569,6 +634,7 @@ export function removeRetiredMarketplacePlugins(allRetiredSpecs, options, depend
569
634
  }
570
635
  removedIdentifiers.push(eachSpec.pluginIdentifier);
571
636
  removedVersionPaths.push(...removeOrphanedPluginVersions(versionsDirectory));
637
+ if (readdirSync(versionsDirectory).length === 0) rmSync(versionsDirectory, { recursive: true, force: true });
572
638
  }
573
639
  return { removedIdentifiers, removedVersionPaths, failedRemovals };
574
640
  }
@@ -7,7 +7,9 @@ import {
7
7
  PSTACK_MARKETPLACE_REPOSITORY,
8
8
  PSTACK_PLUGIN_HOSTS,
9
9
  PSTACK_PLUGIN_IDENTIFIER,
10
+ ALL_REPLACED_PLUGIN_SPECS,
10
11
  ALL_RETIRED_PLUGIN_SPECS,
12
+ DRAWER_CORE_PLUGIN_SPEC,
11
13
  PSTACK_PLUGIN_SPEC,
12
14
  SECURITY_GUIDANCE_PLUGIN_SPEC,
13
15
  SUBAGENT_MODELS_PLUGIN_SPEC,
@@ -15,9 +17,11 @@ import {
15
17
  hostCommandInvocation,
16
18
  installMarketplacePlugins,
17
19
  marketplacePluginsPlan,
20
+ modsFrameworkPluginSpecs,
18
21
  removeOrphanedPluginVersions,
19
22
  removeStaleMarketplaceClone,
20
23
  removeRetiredMarketplacePlugins,
24
+ replacedSpecsToRemove,
21
25
  restartNotice,
22
26
  runHostCommand,
23
27
  shouldInstallMarketplacePlugin,
@@ -111,11 +115,11 @@ test('a failed Claude refresh falls back to removing and adding the marketplace
111
115
  const outcome = installMarketplacePlugins([USAGE_WRAPUP_PLUGIN_SPEC], { ...ROOTS, hosts: ['claude'] }, runner);
112
116
  assert.equal(outcome.status, 'installed');
113
117
  assert.deepEqual(runner.calls.map(call => call.commandArguments), [
114
- ['plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-dev-env', '--sparse', '.claude-plugin', 'packages/usage-wrapup'],
115
- ['plugin', 'uninstall', 'usage-wrapup@claude-dev-env'],
116
- ['plugin', 'marketplace', 'remove', 'claude-dev-env'],
117
- ['plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-dev-env', '--sparse', '.claude-plugin', 'packages/usage-wrapup'],
118
- ['plugin', 'install', 'usage-wrapup@claude-dev-env'],
118
+ ['plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-mods-framework'],
119
+ ['plugin', 'uninstall', 'usage-wrapup@claude-mods-framework'],
120
+ ['plugin', 'marketplace', 'remove', 'claude-mods-framework'],
121
+ ['plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-mods-framework'],
122
+ ['plugin', 'install', 'usage-wrapup@claude-mods-framework'],
119
123
  ]);
120
124
  });
121
125
 
@@ -336,13 +340,13 @@ test('a non-zero exit that is not command-not-found still reads as a failure', (
336
340
  assert.match(outcome.hosts[0].warning, /rejected the catalog/);
337
341
  });
338
342
 
339
- test('the usage-wrapup plan adds this repository marketplace and installs the plugin on Claude', () => {
343
+ test('the usage-wrapup plan adds the mods framework marketplace and installs the plugin on Claude', () => {
340
344
  const plan = marketplacePluginsPlan([USAGE_WRAPUP_PLUGIN_SPEC], 'claude');
341
345
  assert.equal(plan.executable, 'claude');
342
346
  assert.equal(plan.homeVariable, 'CLAUDE_CONFIG_DIR');
343
347
  assert.deepEqual(plan.commands, [
344
- ['plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-dev-env', '--sparse', '.claude-plugin', 'packages/usage-wrapup'],
345
- ['plugin', 'install', 'usage-wrapup@claude-dev-env'],
348
+ ['plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-mods-framework'],
349
+ ['plugin', 'install', 'usage-wrapup@claude-mods-framework'],
346
350
  ]);
347
351
  });
348
352
 
@@ -357,10 +361,10 @@ test('installing usage-wrapup runs only the Claude commands, inside the managed
357
361
  assert.equal(outcome.status, 'installed');
358
362
  assert.deepEqual(outcome.hosts.map(host => host.host), ['claude']);
359
363
  assert.deepEqual(runner.calls.map(call => [call.executable, ...call.commandArguments]), [
360
- ['claude', 'plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-dev-env', '--sparse', '.claude-plugin', 'packages/usage-wrapup'],
361
- ['claude', 'plugin', 'marketplace', 'update', 'claude-dev-env'],
362
- ['claude', 'plugin', 'install', 'usage-wrapup@claude-dev-env'],
363
- ['claude', 'plugin', 'update', 'usage-wrapup@claude-dev-env'],
364
+ ['claude', 'plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-mods-framework'],
365
+ ['claude', 'plugin', 'marketplace', 'update', 'claude-mods-framework'],
366
+ ['claude', 'plugin', 'install', 'usage-wrapup@claude-mods-framework'],
367
+ ['claude', 'plugin', 'update', 'usage-wrapup@claude-mods-framework'],
364
368
  ]);
365
369
  for (const call of runner.calls) {
366
370
  assert.deepEqual(call.environment, { CLAUDE_CONFIG_DIR: ROOTS.claudeRoot });
@@ -391,39 +395,30 @@ test('the usage-wrapup opt-out flag and variable turn off only usage-wrapup', ()
391
395
  );
392
396
  });
393
397
 
394
- for (const [spec, packageFolder] of [
395
- [USAGE_WRAPUP_PLUGIN_SPEC, './packages/usage-wrapup'],
396
- [SUBAGENT_MODELS_PLUGIN_SPEC, './packages/subagent-models'],
397
- ]) {
398
- test(`the repository marketplace lists ${spec.name} from its package folder in this repository`, () => {
399
- const marketplace = JSON.parse(readFileSync(
400
- new URL('../../../.claude-plugin/marketplace.json', import.meta.url),
401
- 'utf8',
402
- ));
403
- const [pluginName, marketplaceName] = spec.pluginIdentifier.split('@');
404
- assert.equal(marketplace.name, marketplaceName);
405
- const entry = marketplace.plugins.find(plugin => plugin.name === pluginName);
406
- assert.ok(entry, `the marketplace lists ${pluginName}`);
407
- assert.equal(entry.source, packageFolder);
408
- assert.ok(spec.sparsePaths.includes(packageFolder.slice(2)), `the sparse checkout holds ${packageFolder}`);
398
+ for (const spec of [DRAWER_CORE_PLUGIN_SPEC, USAGE_WRAPUP_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC]) {
399
+ test(`${spec.name} comes from the whole mods framework marketplace`, () => {
400
+ assert.equal(spec.marketplaceRepository, 'jl-cmd-projects/claude-mods-framework');
401
+ assert.equal(spec.pluginIdentifier, `${spec.name}@claude-mods-framework`);
402
+ assert.deepEqual(spec.sparsePaths, []);
409
403
  });
410
404
  }
411
405
 
412
- test('should add and update the shared marketplace once when installing usage-wrapup and subagent-models together', () => {
406
+ test('should add and update the mods framework marketplace once for drawer-core, usage-wrapup and subagent-models', () => {
413
407
  const runner = recordingRunner();
414
- const outcome = installMarketplacePlugins([USAGE_WRAPUP_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC], ROOTS, runner);
408
+ const outcome = installMarketplacePlugins(
409
+ [DRAWER_CORE_PLUGIN_SPEC, USAGE_WRAPUP_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC], ROOTS, runner,
410
+ );
415
411
  assert.equal(outcome.status, 'installed');
416
412
  assert.deepEqual(outcome.hosts.map(host => host.host), ['claude']);
417
413
  assert.deepEqual(runner.calls.map(call => [call.executable, ...call.commandArguments]), [
418
- [
419
- 'claude', 'plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-dev-env',
420
- '--sparse', '.claude-plugin', 'packages/usage-wrapup', 'packages/subagent-models',
421
- ],
422
- ['claude', 'plugin', 'marketplace', 'update', 'claude-dev-env'],
423
- ['claude', 'plugin', 'install', 'usage-wrapup@claude-dev-env'],
424
- ['claude', 'plugin', 'install', 'subagent-models@claude-dev-env'],
425
- ['claude', 'plugin', 'update', 'usage-wrapup@claude-dev-env'],
426
- ['claude', 'plugin', 'update', 'subagent-models@claude-dev-env'],
414
+ ['claude', 'plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-mods-framework'],
415
+ ['claude', 'plugin', 'marketplace', 'update', 'claude-mods-framework'],
416
+ ['claude', 'plugin', 'install', 'drawer-core@claude-mods-framework'],
417
+ ['claude', 'plugin', 'install', 'usage-wrapup@claude-mods-framework'],
418
+ ['claude', 'plugin', 'install', 'subagent-models@claude-mods-framework'],
419
+ ['claude', 'plugin', 'update', 'drawer-core@claude-mods-framework'],
420
+ ['claude', 'plugin', 'update', 'usage-wrapup@claude-mods-framework'],
421
+ ['claude', 'plugin', 'update', 'subagent-models@claude-mods-framework'],
427
422
  ]);
428
423
  });
429
424
 
@@ -437,6 +432,57 @@ test('the repository marketplace no longer lists a retired plugin', () => {
437
432
  assert.equal(allListedNames.includes(eachRetiredSpec.name), false, `${eachRetiredSpec.name} is retired`);
438
433
  }
439
434
  assert.deepEqual(ALL_RETIRED_PLUGIN_SPECS.map(spec => spec.pluginIdentifier), ['deepen-first-prompt@claude-dev-env']);
435
+ for (const eachReplacedSpec of ALL_REPLACED_PLUGIN_SPECS) {
436
+ assert.equal(allListedNames.includes(eachReplacedSpec.name), false, `${eachReplacedSpec.name} moved out`);
437
+ }
438
+ });
439
+
440
+ test('should remove each old copy whose mods framework replacement installed', () => {
441
+ assert.deepEqual(
442
+ replacedSpecsToRemove(
443
+ ALL_REPLACED_PLUGIN_SPECS,
444
+ [DRAWER_CORE_PLUGIN_SPEC, USAGE_WRAPUP_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC],
445
+ { status: 'installed' },
446
+ ).map(spec => spec.pluginIdentifier),
447
+ ['usage-wrapup@claude-dev-env', 'subagent-models@claude-dev-env'],
448
+ );
449
+ });
450
+
451
+ test('should keep the old usage-wrapup copy when the install skipped usage-wrapup', () => {
452
+ assert.deepEqual(
453
+ replacedSpecsToRemove(
454
+ ALL_REPLACED_PLUGIN_SPECS,
455
+ [DRAWER_CORE_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC],
456
+ { status: 'installed' },
457
+ ).map(spec => spec.pluginIdentifier),
458
+ ['subagent-models@claude-dev-env'],
459
+ );
460
+ });
461
+
462
+ for (const status of ['failed', 'skipped']) {
463
+ test(`should keep every old copy when the mods framework install ${status}`, () => {
464
+ assert.deepEqual(
465
+ replacedSpecsToRemove(
466
+ ALL_REPLACED_PLUGIN_SPECS,
467
+ [DRAWER_CORE_PLUGIN_SPEC, USAGE_WRAPUP_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC],
468
+ { status },
469
+ ),
470
+ [],
471
+ );
472
+ });
473
+ }
474
+
475
+ test('a Claude home that holds the old subagent-models copy gets only that copy uninstalled', (context) => {
476
+ const claudeRoot = mkdtempSync(join(tmpdir(), 'retired-plugin-'));
477
+ context.after(() => rmSync(claudeRoot, { recursive: true, force: true }));
478
+ mkdirSync(join(claudeRoot, 'plugins', 'cache', 'claude-dev-env', 'subagent-models', '0.3.0'), { recursive: true });
479
+ mkdirSync(join(claudeRoot, 'plugins', 'cache', 'claude-mods-framework', 'usage-wrapup', '0.4.0'), { recursive: true });
480
+ const runner = recordingRunner();
481
+ const outcome = removeRetiredMarketplacePlugins(ALL_REPLACED_PLUGIN_SPECS, { claudeRoot, environment: {} }, runner);
482
+ assert.deepEqual(runner.calls.map(call => [call.executable, ...call.commandArguments]), [
483
+ ['claude', 'plugin', 'uninstall', 'subagent-models@claude-dev-env'],
484
+ ]);
485
+ assert.deepEqual(outcome.removedIdentifiers, ['subagent-models@claude-dev-env']);
440
486
  });
441
487
 
442
488
  test('a Claude home that holds a retired plugin gets it uninstalled and its orphaned versions deleted', (context) => {
@@ -456,6 +502,17 @@ test('a Claude home that holds a retired plugin gets it uninstalled and its orph
456
502
  assert.deepEqual(runner.calls[0].environment, { CLAUDE_CONFIG_DIR: claudeRoot });
457
503
  assert.deepEqual(outcome.removedIdentifiers, ['deepen-first-prompt@claude-dev-env']);
458
504
  assert.equal(existsSync(orphanedVersion), false);
505
+ assert.equal(existsSync(versionsDirectory), false);
506
+ });
507
+
508
+ test('should run no command for a retired plugin whose cache folder holds no version', (context) => {
509
+ const claudeRoot = mkdtempSync(join(tmpdir(), 'retired-plugin-'));
510
+ context.after(() => rmSync(claudeRoot, { recursive: true, force: true }));
511
+ mkdirSync(join(claudeRoot, 'plugins', 'cache', 'claude-dev-env', 'subagent-models'), { recursive: true });
512
+ const runner = recordingRunner();
513
+ const outcome = removeRetiredMarketplacePlugins(ALL_REPLACED_PLUGIN_SPECS, { claudeRoot, environment: {} }, runner);
514
+ assert.deepEqual(runner.calls, []);
515
+ assert.deepEqual(outcome.failedRemovals, []);
459
516
  });
460
517
 
461
518
  test('a Claude home with no retired plugin runs no command', (context) => {
@@ -484,10 +541,24 @@ test('a failed retired plugin uninstall is reported as failed and keeps its cach
484
541
  test('should refuse one plan for plugins from two marketplaces', () => {
485
542
  assert.throws(
486
543
  () => marketplacePluginsPlan([PSTACK_PLUGIN_SPEC, SUBAGENT_MODELS_PLUGIN_SPEC], 'claude'),
487
- /subagent-models comes from jl-cmd-projects\/claude-dev-env/,
544
+ /subagent-models comes from jl-cmd-projects\/claude-mods-framework/,
488
545
  );
489
546
  });
490
547
 
548
+ for (const [optOutArguments, optOutEnvironment, expectedNames] of [
549
+ [[], {}, ['drawer-core', 'usage-wrapup', 'subagent-models']],
550
+ [['--no-subagent-models'], {}, ['drawer-core', 'usage-wrapup']],
551
+ [[], { CDE_INSTALL_USAGE_WRAPUP: '0' }, ['drawer-core', 'subagent-models']],
552
+ [['--no-usage-wrapup', '--no-subagent-models'], {}, []],
553
+ ]) {
554
+ test(`should install drawer-core with each plugin that needs it for ${JSON.stringify([optOutArguments, optOutEnvironment])}`, () => {
555
+ assert.deepEqual(
556
+ modsFrameworkPluginSpecs(optOutArguments, optOutEnvironment).map(spec => spec.name),
557
+ expectedNames,
558
+ );
559
+ });
560
+ }
561
+
491
562
  test('should turn off only subagent-models with its opt-out flag or variable', () => {
492
563
  assert.equal(shouldInstallMarketplacePlugin(SUBAGENT_MODELS_PLUGIN_SPEC, [], {}), true);
493
564
  assert.equal(shouldInstallMarketplacePlugin(SUBAGENT_MODELS_PLUGIN_SPEC, ['--no-subagent-models'], {}), false);
@@ -573,7 +644,7 @@ test('a held folder that was not searched adds no claim about what holds it', ()
573
644
 
574
645
  test('should delete a half-made marketplace clone before the shared marketplace add', () => {
575
646
  const claudeRoot = mkdtempSync(join(tmpdir(), 'cde-stale-clone-'));
576
- const cloneDirectory = join(claudeRoot, 'plugins', 'marketplaces', 'jl-cmd-projects-claude-dev-env..clone');
647
+ const cloneDirectory = join(claudeRoot, 'plugins', 'marketplaces', 'jl-cmd-projects-claude-mods-framework..clone');
577
648
  mkdirSync(join(cloneDirectory, '.git'), { recursive: true });
578
649
  writeFileSync(join(cloneDirectory, '.git', 'shallow.lock'), '');
579
650
  const allCloneStatesAtAdd = [];
package/bin/install.mjs CHANGED
@@ -56,13 +56,14 @@ import {
56
56
  ALL_CODEX_NATIVE_POST_TOOL_USE_HOOK_SCRIPT_NAMES,
57
57
  } from './install-constants.mjs';
58
58
  import {
59
+ ALL_REPLACED_PLUGIN_SPECS,
59
60
  ALL_RETIRED_PLUGIN_SPECS,
60
61
  PSTACK_PLUGIN_SPEC,
61
62
  SECURITY_GUIDANCE_PLUGIN_SPEC,
62
- SUBAGENT_MODELS_PLUGIN_SPEC,
63
- USAGE_WRAPUP_PLUGIN_SPEC,
64
63
  installMarketplacePlugins,
64
+ modsFrameworkPluginSpecs,
65
65
  removeRetiredMarketplacePlugins,
66
+ replacedSpecsToRemove,
66
67
  shouldInstallMarketplacePlugin,
67
68
  } from './install-pstack-plugin.mjs';
68
69
  import {
@@ -481,6 +482,17 @@ function printPluginHostOutcomes(allSpecs, pluginOutcome) {
481
482
  }
482
483
  }
483
484
 
485
+ function removeAndReportRetiredPlugins(allRetiredSpecs) {
486
+ const retiredPlugins = removeRetiredMarketplacePlugins(allRetiredSpecs, { claudeRoot: CLAUDE_HOME });
487
+ for (const eachIdentifier of retiredPlugins.removedIdentifiers) {
488
+ console.log(` Retired plugin uninstalled: ${eachIdentifier}`);
489
+ }
490
+ for (const eachFailure of retiredPlugins.failedRemovals) {
491
+ console.warn(` Warning: retired plugin ${eachFailure.pluginIdentifier} was not uninstalled: ${eachFailure.detail}`);
492
+ }
493
+ return retiredPlugins;
494
+ }
495
+
484
496
  function printActionNeeded() {
485
497
  if (allActionNeededLines.length === 0) return;
486
498
  console.warn(`Action needed (${allActionNeededLines.length}):`);
@@ -3171,27 +3183,18 @@ function executeInstallPlanMutations(plan, transactionHelpers) {
3171
3183
  if (retiredCursorHooksPath) {
3172
3184
  console.log(` Retired first-task hook removed from ${retiredCursorHooksPath}`);
3173
3185
  }
3174
- const retiredPlugins = removeRetiredMarketplacePlugins(ALL_RETIRED_PLUGIN_SPECS, {
3175
- claudeRoot: CLAUDE_HOME,
3176
- });
3177
- summary.retiredPlugins = retiredPlugins;
3178
- for (const eachIdentifier of retiredPlugins.removedIdentifiers) {
3179
- console.log(` Retired plugin uninstalled: ${eachIdentifier}`);
3180
- }
3181
- for (const eachFailure of retiredPlugins.failedRemovals) {
3182
- console.warn(` Warning: retired plugin ${eachFailure.pluginIdentifier} was not uninstalled: ${eachFailure.detail}`);
3183
- }
3186
+ summary.retiredPlugins = removeAndReportRetiredPlugins(ALL_RETIRED_PLUGIN_SPECS);
3184
3187
  }
3185
- const allRepositoryPluginSpecs = [
3186
- USAGE_WRAPUP_PLUGIN_SPEC,
3187
- SUBAGENT_MODELS_PLUGIN_SPEC,
3188
- ].filter(eachSpec => shouldInstallMarketplacePlugin(eachSpec));
3189
- if (!selectedGroups && allRepositoryPluginSpecs.length > 0) {
3190
- const repositoryPlugins = installMarketplacePlugins(allRepositoryPluginSpecs, {
3188
+ const allModsFrameworkPluginSpecs = modsFrameworkPluginSpecs();
3189
+ if (!selectedGroups && allModsFrameworkPluginSpecs.length > 0) {
3190
+ const modsFrameworkPlugins = installMarketplacePlugins(allModsFrameworkPluginSpecs, {
3191
3191
  claudeRoot: CLAUDE_HOME,
3192
3192
  });
3193
- summary.repositoryPlugins = repositoryPlugins;
3194
- printPluginHostOutcomes(allRepositoryPluginSpecs, repositoryPlugins);
3193
+ summary.modsFrameworkPlugins = modsFrameworkPlugins;
3194
+ printPluginHostOutcomes(allModsFrameworkPluginSpecs, modsFrameworkPlugins);
3195
+ summary.replacedPlugins = removeAndReportRetiredPlugins(replacedSpecsToRemove(
3196
+ ALL_REPLACED_PLUGIN_SPECS, allModsFrameworkPluginSpecs, modsFrameworkPlugins,
3197
+ ));
3195
3198
  }
3196
3199
  if (!selectedGroups && shouldInstallMarketplacePlugin(SECURITY_GUIDANCE_PLUGIN_SPEC)) {
3197
3200
  const securityGuidancePlugin = installMarketplacePlugins([SECURITY_GUIDANCE_PLUGIN_SPEC], {
@@ -3420,17 +3420,19 @@ test('a pstack install after a --no-pstack install seeds the Codex model sheet',
3420
3420
  });
3421
3421
 
3422
3422
  const USAGE_WRAPUP_CLAUDE_COMMANDS = Object.freeze([
3423
- 'claude plugin marketplace add jl-cmd-projects/claude-dev-env --sparse .claude-plugin packages/usage-wrapup',
3424
- 'claude plugin marketplace update claude-dev-env',
3425
- 'claude plugin install usage-wrapup@claude-dev-env',
3426
- 'claude plugin update usage-wrapup@claude-dev-env',
3423
+ 'claude plugin marketplace add jl-cmd-projects/claude-mods-framework',
3424
+ 'claude plugin marketplace update claude-mods-framework',
3425
+ 'claude plugin install drawer-core@claude-mods-framework',
3426
+ 'claude plugin install usage-wrapup@claude-mods-framework',
3427
+ 'claude plugin update drawer-core@claude-mods-framework',
3428
+ 'claude plugin update usage-wrapup@claude-mods-framework',
3427
3429
  ]);
3428
3430
 
3429
3431
  function usageWrapupCommands(allRecordedCommands) {
3430
- return allRecordedCommands.filter(eachCommand => eachCommand.includes('claude-dev-env'));
3432
+ return allRecordedCommands.filter(eachCommand => eachCommand.includes('claude-mods-framework'));
3431
3433
  }
3432
3434
 
3433
- test('a full install adds this marketplace and installs usage-wrapup on Claude only', t => {
3435
+ test('a full install adds the mods framework marketplace and installs usage-wrapup with drawer-core on Claude only', t => {
3434
3436
  const sandbox = pstackPluginSandbox(t);
3435
3437
 
3436
3438
  const installerOutput = runPstackInstaller(sandbox.homeDirectory, [], {
@@ -3498,16 +3500,18 @@ test('the help output names the usage-wrapup opt-out beside the pstack one', ()
3498
3500
  assert.doesNotMatch(helpRun.stdout, /--no-deepen-first-prompt/);
3499
3501
  });
3500
3502
 
3501
- const REPOSITORY_PLUGIN_CLAUDE_COMMANDS = Object.freeze([
3502
- 'claude plugin marketplace add jl-cmd-projects/claude-dev-env --sparse .claude-plugin packages/usage-wrapup packages/subagent-models',
3503
- 'claude plugin marketplace update claude-dev-env',
3504
- 'claude plugin install usage-wrapup@claude-dev-env',
3505
- 'claude plugin install subagent-models@claude-dev-env',
3506
- 'claude plugin update usage-wrapup@claude-dev-env',
3507
- 'claude plugin update subagent-models@claude-dev-env',
3503
+ const MODS_FRAMEWORK_PLUGIN_CLAUDE_COMMANDS = Object.freeze([
3504
+ 'claude plugin marketplace add jl-cmd-projects/claude-mods-framework',
3505
+ 'claude plugin marketplace update claude-mods-framework',
3506
+ 'claude plugin install drawer-core@claude-mods-framework',
3507
+ 'claude plugin install usage-wrapup@claude-mods-framework',
3508
+ 'claude plugin install subagent-models@claude-mods-framework',
3509
+ 'claude plugin update drawer-core@claude-mods-framework',
3510
+ 'claude plugin update usage-wrapup@claude-mods-framework',
3511
+ 'claude plugin update subagent-models@claude-mods-framework',
3508
3512
  ]);
3509
3513
 
3510
- test('should install subagent-models beside usage-wrapup with one marketplace add on a full install', t => {
3514
+ test('should install drawer-core and subagent-models beside usage-wrapup with one marketplace add on a full install', t => {
3511
3515
  const sandbox = pstackPluginSandbox(t);
3512
3516
 
3513
3517
  const installerOutput = runPstackInstaller(sandbox.homeDirectory, ['--no-pstack'], {
@@ -3516,9 +3520,10 @@ test('should install subagent-models beside usage-wrapup with one marketplace ad
3516
3520
  CDE_INSTALL_SUBAGENT_MODELS: '1',
3517
3521
  });
3518
3522
 
3519
- assert.deepEqual(usageWrapupCommands(sandbox.recordedCommands()), REPOSITORY_PLUGIN_CLAUDE_COMMANDS);
3523
+ assert.deepEqual(usageWrapupCommands(sandbox.recordedCommands()), MODS_FRAMEWORK_PLUGIN_CLAUDE_COMMANDS);
3520
3524
  assert.match(installerOutput, /Usage-wrapup \(claude\): installed/);
3521
3525
  assert.match(installerOutput, /Subagent-models \(claude\): installed/);
3526
+ assert.match(installerOutput, /Drawer-core \(claude\): installed/);
3522
3527
  assert.doesNotMatch(installerOutput, /Deepen-first-prompt \(/);
3523
3528
  });
3524
3529
 
@@ -3536,10 +3541,10 @@ for (const [caseName, extraArguments, environmentOverrides] of [
3536
3541
  });
3537
3542
 
3538
3543
  assert.equal(
3539
- sandbox.recordedCommands().some(eachCommand => eachCommand.includes('subagent-models')),
3544
+ sandbox.recordedCommands().some(eachCommand => eachCommand.includes('subagent-models') || eachCommand.includes('drawer-core')),
3540
3545
  false,
3541
3546
  );
3542
- assert.doesNotMatch(installerOutput, /Subagent-models \(/);
3547
+ assert.doesNotMatch(installerOutput, /Subagent-models \(|Drawer-core \(/);
3543
3548
  });
3544
3549
  }
3545
3550
 
@@ -40,7 +40,7 @@ When you cannot prove it, leave the pull request unopened. Tell the owner in thr
40
40
 
41
41
  ## Enforcement
42
42
 
43
- `hooks/blocking/pull_request_proof.py` reads the body of each new pull request before it opens. `pr_lifecycle_skill_gate.py` runs it on `gh pr create`, the `pull_request.py create` script, and each `mcp__*__create_pull_request` tool. The gate denies the call when the body has no "Proof in practice" heading, or when the text under that heading names no command in backticks. The gate also denies a section whose only commands run a test runner, such as `pytest`, `python -m unittest`, `uv run pytest`, `npm test`, `npx vitest`, `jest`, `go test` or `cargo test`. Quotes around a runner word, interpreter flags before `-m`, and `coverage run -m unittest` are still test runs. A command is an inline backticked span or a `$ ` line inside a fenced block. A span that starts with a path and line, such as `gate.py:12`, is not a command. A span that holds one path or file name, such as `src/x.py`, is not a command unless that span runs a test runner, such as `py.test` or `pytest.exe`. A test run piped into `tee`, `tail`, `head`, `grep` or `cat` is still a test run. The deny quotes the line "Unit tests are welcome as extra evidence. The live run is the proof." and asks for a run of the changed thing the way its user runs it, without the change and with it. The gate also denies a section whose prose says part of the change is not proven, not tested or not verified, with "yet", "been" or "fully" allowed after the "not", or says unproven, untested or unverified. The line passes only for a workflow file the branch adds, when the body's "After merge" heading plans that file's first run; `pull_request_proof.py` and `hooks_constants/pull_request_proof_constants.py` hold the exact conditions. Otherwise the deny quotes that line, and asks for the run before the pull request opens, or for the line under a "Not covered" heading when the change does not target it. The same denial covers a proof line that opens with "not run", "not exercised" or "not executed" (a "yet" or "been" may follow the "not") or says "has not been run". A proof line with a merge word (merge, merged, merges or merging, so post-merge too) is denied with its own reason: run the check on the branch, and put a file or command name that contains merge in backticks. A step that needs the merged code to exist goes under a "Not covered" heading at the same level as the proof heading, as a line that opens with "not run". `UNPROVEN_ADMISSION_PATTERN` and `MERGE_WORD_PATTERN` list the shapes. Words inside backticks or a fenced block are quoted output and do not count. A section with one command that is not a test run, and no such line, passes. A `gh pr create` with no `--body` or `--body-file` is denied with a request for the body. A body edit through `update_pull_request`, `gh pr edit` or the `pull_request.py edit` script gets the same checks on its proof section that a new pull request gets, so an edit cannot swap in a proof that a new pull request would be denied. An edit with no proof section passes. A body the gate cannot read passes, such as an inline multi-line `--body`, a body from standard input, or a body written through `gh api`. Merges and pushes pass.
43
+ `hooks/blocking/pull_request_proof.py` reads the body of each new pull request before it opens. `pr_lifecycle_skill_gate.py` runs it on `gh pr create`, the `pull_request.py create` script, and each `mcp__*__create_pull_request` tool. The gate denies the call when the body has no "Proof in practice" heading, or when the text under that heading names no command in backticks. The gate also denies a section whose only commands run a test runner, such as `pytest`, `python -m unittest`, `uv run pytest`, `npm test`, `npx vitest`, `jest`, `go test` or `cargo test`. Quotes around a runner word, interpreter flags before `-m`, and `coverage run -m unittest` are still test runs. A command is an inline backticked span or a `$ ` line inside a fenced block. A span that starts with a path and line, such as `gate.py:12`, is not a command. A span that holds one path or file name, such as `src/x.py`, is not a command unless that span runs a test runner, such as `py.test` or `pytest.exe`. A test run piped into `tee`, `tail`, `head`, `grep` or `cat` is still a test run. The deny quotes the line "Unit tests are welcome as extra evidence. The live run is the proof." and asks for a run of the changed thing the way its user runs it, without the change and with it. The gate also denies a section whose prose says part of the change is not proven, not tested or not verified, with "yet", "been" or "fully" allowed after the "not", or says unproven, untested or unverified. The line passes only for a workflow file the branch adds, when the body's "After merge" heading plans that file's first run; `pull_request_proof.py` and `hooks_constants/pull_request_proof_constants.py` hold the exact conditions. Otherwise the deny quotes that line, and asks for the run before the pull request opens, or for the line under a "Not covered" heading when the change does not target it. The same denial covers a proof line that opens with "not run", "not exercised" or "not executed" (a "yet" or "been" may follow the "not") or says "has not been run". A proof line with a merge word (merge, merged, merges or merging, so post-merge too) is denied with its own reason: run the check on the branch, and put a file or command name that contains merge in backticks. A step that needs the merged code to exist goes under a "Not covered" heading at the same level as the proof heading, as a line that opens with "not run". `UNPROVEN_ADMISSION_PATTERN` and `MERGE_WORD_PATTERN` list the shapes. Words inside backticks or a fenced block are quoted output and do not count. A section with one command that is not a test run, and no such line, passes. A `gh pr create` with no `--body` or `--body-file` is denied with a request for the body. A body edit through `update_pull_request`, `gh pr edit` or the `pull_request.py edit` script gets the same checks on its proof section that a new pull request gets, so an edit cannot swap in a proof that a new pull request would be denied. An edit with no proof section passes. The gate also denies a new pull request whose "What this does" section holds no flowchart: a closed `mermaid` block whose first line starts with `flowchart` and that joins two nodes with an arrow. A body edit meets the same check when its body carries a "What this does" heading. A body the gate cannot read passes, such as an inline multi-line `--body`, a body from standard input, or a body written through `gh api`. Merges and pushes pass.
44
44
 
45
45
  When the checked-out branch changes a file people see (`.html`, `.htm`, `.css`, `.scss`, `.tsx`, `.jsx`, `.vue`, `.svelte`), the gate also denies a body whose proof section holds no picture: a markdown image, an image URL, or an Artifact page link that shows the screenshots. Render the change, read the screenshot, and put it in the section, so the reader sees what you looked at. A page the branch only moves to another folder or name that ends the same way, with every byte kept (`R100` in `git diff --name-status`), changes nothing people see, so the gate leaves it out; a moved page that also changed, or a file that becomes a page by a change of name ending, still needs the picture. When git in the session directory cannot list the branch's changed files, the gate asks for the picture as well.
46
46