mandrel 2.89.0 → 2.91.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 (175) hide show
  1. package/.agents/README.md +47 -7
  2. package/.agents/agents/story-worker.md +20 -0
  3. package/.agents/audit-checklists/lean.md +26 -0
  4. package/.agents/docs/agentrc-reference.json +5 -6
  5. package/.agents/docs/configuration.md +38 -30
  6. package/.agents/docs/workflows.md +7 -1
  7. package/.agents/instructions.md +3 -1
  8. package/.agents/runtime-deps.json +0 -2
  9. package/.agents/schemas/agentrc.schema.json +46 -45
  10. package/.agents/schemas/audit-rules.json +19 -0
  11. package/.agents/scripts/acceptance-eval.js +2 -6
  12. package/.agents/scripts/audit-exceptions.js +2 -4
  13. package/.agents/scripts/board-backfill.js +253 -0
  14. package/.agents/scripts/check-arch-cycles.js +1 -5
  15. package/.agents/scripts/check-context-budget.js +1 -5
  16. package/.agents/scripts/check-cyclomatic.js +1 -5
  17. package/.agents/scripts/check-dead-exports.js +23 -14
  18. package/.agents/scripts/check-doc-links.js +4 -4
  19. package/.agents/scripts/check-test-temp-hygiene.js +29 -33
  20. package/.agents/scripts/coverage-capture.js +14 -6
  21. package/.agents/scripts/diagnose-friction.js +8 -10
  22. package/.agents/scripts/generate-workflows-doc.js +5 -0
  23. package/.agents/scripts/lib/audit-exceptions/adapters/index.js +2 -0
  24. package/.agents/scripts/lib/audit-exceptions/adapters/inline-suppressions.js +36 -27
  25. package/.agents/scripts/lib/audit-exceptions/adapters/shortcut-markers.js +70 -0
  26. package/.agents/scripts/lib/audit-exceptions/adapters/source-scan.js +26 -0
  27. package/.agents/scripts/lib/audit-to-stories/audit-lenses.js +1 -0
  28. package/.agents/scripts/lib/baseline-schema-registry.js +3 -5
  29. package/.agents/scripts/lib/baselines/bundle-size-scorer.js +11 -28
  30. package/.agents/scripts/lib/baselines/components.js +5 -5
  31. package/.agents/scripts/lib/baselines/crap-preview-scan.js +4 -1
  32. package/.agents/scripts/lib/baselines/crap-updater-cli.js +6 -4
  33. package/.agents/scripts/lib/baselines/duplication-scanner.js +4 -10
  34. package/.agents/scripts/lib/baselines/kinds/crap.js +4 -2
  35. package/.agents/scripts/lib/baselines/kinds/duplication.js +4 -2
  36. package/.agents/scripts/lib/baselines/kinds/kind-factory.js +13 -6
  37. package/.agents/scripts/lib/baselines/refresh-service.js +10 -13
  38. package/.agents/scripts/lib/baselines/writer.js +4 -4
  39. package/.agents/scripts/lib/bdd-scenario-scanner.js +26 -31
  40. package/.agents/scripts/lib/bootstrap/gh-list.js +4 -5
  41. package/.agents/scripts/lib/bootstrap/gh-preflight.js +13 -8
  42. package/.agents/scripts/lib/child-exec.js +4 -4
  43. package/.agents/scripts/lib/claude/agents-projection.js +170 -0
  44. package/.agents/scripts/lib/claude/commands-projection.js +184 -0
  45. package/.agents/scripts/lib/close-validation/commands.js +28 -117
  46. package/.agents/scripts/lib/close-validation/gates.js +54 -48
  47. package/.agents/scripts/lib/close-validation/process.js +5 -1
  48. package/.agents/scripts/lib/close-validation/projections/crap.js +2 -1
  49. package/.agents/scripts/lib/close-validation/projections/maintainability.js +50 -15
  50. package/.agents/scripts/lib/config/agentrc-overlay.js +4 -7
  51. package/.agents/scripts/lib/config/commands.js +82 -7
  52. package/.agents/scripts/lib/config/explain.js +2 -1
  53. package/.agents/scripts/lib/config/gates/coverage.schema.js +39 -3
  54. package/.agents/scripts/lib/config/gates/crap-incremental-coverage.schema.js +1 -1
  55. package/.agents/scripts/lib/config/gates/crap.schema.js +5 -3
  56. package/.agents/scripts/lib/config/gates/duplication.schema.js +6 -11
  57. package/.agents/scripts/lib/config/gates/shared.js +2 -2
  58. package/.agents/scripts/lib/config/git-roots.js +120 -0
  59. package/.agents/scripts/lib/config/quality.js +46 -50
  60. package/.agents/scripts/lib/config/review-chain-default.js +4 -3
  61. package/.agents/scripts/lib/config/review-provider-clis.js +11 -0
  62. package/.agents/scripts/lib/config/temp-paths.js +3 -37
  63. package/.agents/scripts/lib/config-resolver.js +5 -9
  64. package/.agents/scripts/lib/config-settings-schema-delivery.js +2 -2
  65. package/.agents/scripts/lib/config-settings-schema-quality.js +3 -2
  66. package/.agents/scripts/lib/config-settings-schema.js +6 -7
  67. package/.agents/scripts/lib/coverage-baseline.js +2 -1
  68. package/.agents/scripts/lib/coverage-capture-affected.js +4 -3
  69. package/.agents/scripts/lib/coverage-capture-fullscope.js +3 -1
  70. package/.agents/scripts/lib/coverage-capture-passes.js +119 -34
  71. package/.agents/scripts/lib/coverage-capture-usage.js +1 -1
  72. package/.agents/scripts/lib/coverage-capture.js +80 -43
  73. package/.agents/scripts/lib/coverage-utils.js +34 -16
  74. package/.agents/scripts/lib/cpu-pool.js +2 -4
  75. package/.agents/scripts/lib/crap-engine.js +19 -1
  76. package/.agents/scripts/lib/crap-utils.js +2 -1
  77. package/.agents/scripts/lib/dead-exports-knip.js +29 -11
  78. package/.agents/scripts/lib/detect-package-manager.js +13 -0
  79. package/.agents/scripts/lib/feedback-loop/graduator-gh.js +4 -2
  80. package/.agents/scripts/lib/full-suite-lock.js +25 -9
  81. package/.agents/scripts/lib/gates/baseline-store.js +2 -10
  82. package/.agents/scripts/lib/generated/agentrc-validator.js +4 -1
  83. package/.agents/scripts/lib/gh-env.js +72 -0
  84. package/.agents/scripts/lib/gh-exec.js +26 -1
  85. package/.agents/scripts/lib/maintainability-utils.js +8 -8
  86. package/.agents/scripts/lib/npm-scripts.js +1 -1
  87. package/.agents/scripts/lib/observability/signal-validator.js +2 -6
  88. package/.agents/scripts/lib/observability/source-classifier.js +1 -0
  89. package/.agents/scripts/lib/observability/terse-result.js +2 -6
  90. package/.agents/scripts/lib/orchestration/board-access-latch.js +112 -0
  91. package/.agents/scripts/lib/orchestration/ci-rerun-guard.js +10 -13
  92. package/.agents/scripts/lib/orchestration/column-sync.js +107 -52
  93. package/.agents/scripts/lib/orchestration/deliver-recover.js +2 -1
  94. package/.agents/scripts/lib/orchestration/git-cleanup/phases/git-probes.js +3 -3
  95. package/.agents/scripts/lib/orchestration/lifecycle/emit-ledger-event.js +2 -6
  96. package/.agents/scripts/lib/orchestration/light-suitability.js +5 -7
  97. package/.agents/scripts/lib/orchestration/pr-watch.js +7 -7
  98. package/.agents/scripts/lib/orchestration/project-meta-cache.js +2 -11
  99. package/.agents/scripts/lib/orchestration/project-meta-resolver.js +44 -17
  100. package/.agents/scripts/lib/orchestration/review-deposit.js +2 -9
  101. package/.agents/scripts/lib/orchestration/review-providers/callers-context.js +219 -0
  102. package/.agents/scripts/lib/orchestration/review-providers/code-review.js +53 -5
  103. package/.agents/scripts/lib/orchestration/review-providers/codex-cli.js +2 -2
  104. package/.agents/scripts/lib/orchestration/review-providers/llm-review.js +96 -0
  105. package/.agents/scripts/lib/orchestration/review-providers/mi-exemptions.js +2 -2
  106. package/.agents/scripts/lib/orchestration/review-providers/native.js +13 -19
  107. package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +3 -2
  108. package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +2 -0
  109. package/.agents/scripts/lib/orchestration/review-providers/security-review.js +11 -3
  110. package/.agents/scripts/lib/orchestration/story-close/baseline-upward-writeback.js +2 -3
  111. package/.agents/scripts/lib/orchestration/story-close/format-autofix.js +41 -15
  112. package/.agents/scripts/lib/orchestration/story-deliver-terminal-schema.js +2 -4
  113. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +2 -13
  114. package/.agents/scripts/lib/orchestration/story-handoff.js +27 -6
  115. package/.agents/scripts/lib/orchestration/story-progress.js +3 -11
  116. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +3 -5
  117. package/.agents/scripts/lib/orchestration/verify-credit.js +52 -28
  118. package/.agents/scripts/lib/single-story-sweep/protection-ctx.js +11 -11
  119. package/.agents/scripts/lib/single-story-sweep/protection.js +1 -9
  120. package/.agents/scripts/lib/single-story-sweep/sweep-lock.js +1 -5
  121. package/.agents/scripts/lib/source-extensions.js +30 -15
  122. package/.agents/scripts/lib/test-run-credit.js +1 -9
  123. package/.agents/scripts/lib/test-temp.js +22 -21
  124. package/.agents/scripts/lib/util/ajv.js +111 -0
  125. package/.agents/scripts/lib/util/atomic-write.js +30 -0
  126. package/.agents/scripts/lib/util/paths.js +51 -0
  127. package/.agents/scripts/lib/util/sleep.js +6 -0
  128. package/.agents/scripts/lib/util/slug.js +12 -0
  129. package/.agents/scripts/lib/validation-evidence.js +19 -40
  130. package/.agents/scripts/lib/worktree/lifecycle/force-drain.js +2 -1
  131. package/.agents/scripts/lib/worktree/lifecycle/pending-cleanup.js +10 -28
  132. package/.agents/scripts/lib/worktree/lifecycle/reap.js +2 -2
  133. package/.agents/scripts/lib/worktree/node-modules-strategy.js +21 -14
  134. package/.agents/scripts/lint-issue-body.js +2 -2
  135. package/.agents/scripts/plan-context.js +2 -7
  136. package/.agents/scripts/providers/github/auth.js +3 -3
  137. package/.agents/scripts/providers/github/board-add.js +18 -9
  138. package/.agents/scripts/providers/github/errors.js +3 -1
  139. package/.agents/scripts/providers/github/gh-token-diagnostics.js +10 -7
  140. package/.agents/scripts/providers/github/issues.js +6 -2
  141. package/.agents/scripts/providers/github/mappers.js +1 -5
  142. package/.agents/scripts/providers/github/projects-v2-graphql.js +26 -6
  143. package/.agents/scripts/providers/github/search-budget.js +3 -1
  144. package/.agents/scripts/resolve-doc-tiers.js +7 -20
  145. package/.agents/scripts/sync-agentrc.js +5 -14
  146. package/.agents/scripts/sync-claude-agents.js +38 -150
  147. package/.agents/scripts/sync-claude-commands.js +35 -218
  148. package/.agents/scripts/update-coverage-baseline.js +1 -1
  149. package/.agents/scripts/update-crap-baseline.js +1 -1
  150. package/.agents/scripts/update-duplication-baseline.js +2 -16
  151. package/.agents/scripts/validate-skills.js +6 -10
  152. package/.agents/skills/core/code-review-and-quality/SKILL.md +3 -18
  153. package/.agents/skills/core/documentation-and-adrs/SKILL.md +4 -14
  154. package/.agents/workflows/audit-exceptions.md +9 -0
  155. package/.agents/workflows/audit-lean.md +129 -0
  156. package/.agents/workflows/helpers/audit-lens-core.md +7 -0
  157. package/.agents/workflows/helpers/code-quality-guardrails.md +21 -0
  158. package/.agents/workflows/helpers/code-review.md +15 -1
  159. package/.agents/workflows/helpers/deliver-digest.md +1 -1
  160. package/.agents/workflows/helpers/deliver-reference.md +2 -2
  161. package/.agents/workflows/mandrel-plan.md +2 -2
  162. package/docs/CHANGELOG.md +48 -0
  163. package/lib/cli/doctor-checks/codex.js +6 -5
  164. package/lib/cli/doctor-checks/llm-review.js +102 -0
  165. package/lib/cli/doctor-checks/project-access.js +124 -0
  166. package/lib/cli/doctor-checks/sync-parity.js +65 -140
  167. package/lib/cli/doctor-checks/test-credit-path.js +69 -28
  168. package/lib/cli/doctor-checks/toolchain.js +5 -3
  169. package/lib/cli/registry.js +11 -0
  170. package/lib/migrations/helpers/retire-agentrc-key.js +3 -3
  171. package/lib/migrations/index.js +6 -0
  172. package/lib/migrations/steps/2.91.0-move-shared-crap-capture-script.js +84 -0
  173. package/lib/migrations/steps/2.91.0-retire-duplication-formats.js +23 -0
  174. package/lib/migrations/steps/2.91.0-unset-null-lint-command.js +54 -0
  175. package/package.json +1 -3
@@ -2,6 +2,9 @@
2
2
 
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
+ import { COMMANDS_DEFAULTS } from '../../../.agents/scripts/lib/config/commands.js';
6
+ import { COVERAGE_CAPTURE_DEFAULTS } from '../../../.agents/scripts/lib/config/gates/coverage.schema.js';
7
+ import { packageScriptArgv } from '../../../.agents/scripts/lib/detect-package-manager.js';
5
8
  import { readJsonSafe } from './read-json.js';
6
9
 
7
10
  // check: test-credit-path
@@ -10,7 +13,7 @@ import { readJsonSafe } from './read-json.js';
10
13
  const MANDREL_TEST_RUNNER = 'run-tests.js';
11
14
 
12
15
  /** The close `test` gate's command when `project.commands.test` is unset. */
13
- const DEFAULT_TEST_COMMAND = 'npm test';
16
+ const DEFAULT_TEST_COMMAND = COMMANDS_DEFAULTS.test;
14
17
 
15
18
  /**
16
19
  * The deposit command that works on any runner, wrapping `command`.
@@ -88,45 +91,80 @@ function scriptNamed(scripts, name) {
88
91
  }
89
92
 
90
93
  /**
91
- * `delivery.quality.gates.crap.enabled` from `.agentrc.json` overlaid by
92
- * `.agentrc.local.json`, defaulting on — the predicate close registers
93
- * `coverage-capture` on. Read without `resolveConfig()` (built-ins only).
94
+ * The last boolean/string a key path holds across `.agentrc.json` overlaid by
95
+ * `.agentrc.local.json`. Read without `resolveConfig()` (built-ins only).
94
96
  *
95
97
  * @param {string} projectRoot
96
98
  * @param {typeof fs.readFileSync} readFileImpl
97
- * @returns {boolean}
99
+ * @param {(config: object|undefined) => unknown} pick
100
+ * @param {(value: unknown) => boolean} accept
101
+ * @returns {unknown} `undefined` when neither file sets an accepted value.
98
102
  */
99
- function isCrapEnabled(projectRoot, readFileImpl) {
100
- let enabled = true;
103
+ function overlaidValue(projectRoot, readFileImpl, pick, accept) {
104
+ let value;
101
105
  for (const file of ['.agentrc.json', '.agentrc.local.json']) {
102
- const value = readJsonSafe(path.join(projectRoot, file), {
103
- readFileSync: readFileImpl,
104
- })?.delivery?.quality?.gates?.crap?.enabled;
105
- if (typeof value === 'boolean') enabled = value;
106
+ const candidate = pick(
107
+ readJsonSafe(path.join(projectRoot, file), {
108
+ readFileSync: readFileImpl,
109
+ }),
110
+ );
111
+ if (accept(candidate)) value = candidate;
106
112
  }
107
- return enabled;
113
+ return value;
114
+ }
115
+
116
+ const isBoolean = (v) => typeof v === 'boolean';
117
+ const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;
118
+
119
+ /**
120
+ * The coverage-capture registration inputs close reads: whether the coverage
121
+ * or CRAP gate is on (each defaults on) and the coverage gate's
122
+ * `captureScript`.
123
+ *
124
+ * @param {string} projectRoot
125
+ * @param {typeof fs.readFileSync} readFileImpl
126
+ * @returns {{ captureEnabled: boolean, captureScript: string }}
127
+ */
128
+ function readCaptureConfig(projectRoot, readFileImpl) {
129
+ const gate = (name) => (c) => c?.delivery?.quality?.gates?.[name];
130
+ const enabled = (name) =>
131
+ overlaidValue(
132
+ projectRoot,
133
+ readFileImpl,
134
+ (c) => gate(name)(c)?.enabled,
135
+ isBoolean,
136
+ ) !== false;
137
+ const script = overlaidValue(
138
+ projectRoot,
139
+ readFileImpl,
140
+ (c) => gate('coverage')(c)?.captureScript,
141
+ isNonEmptyString,
142
+ );
143
+ return {
144
+ captureEnabled: enabled('coverage') || enabled('crap'),
145
+ captureScript: script?.trim() ?? COVERAGE_CAPTURE_DEFAULTS.captureScript,
146
+ };
108
147
  }
109
148
 
110
149
  /**
111
150
  * `project.commands.test` from `.agentrc.json` overlaid by
112
151
  * `.agentrc.local.json` — the command close's `test` gate spawns. Read without
113
- * `resolveConfig()` (built-ins only), like {@link isCrapEnabled}.
152
+ * `resolveConfig()` (built-ins only), like {@link readCaptureConfig}.
114
153
  *
115
154
  * @param {string} projectRoot
116
155
  * @param {typeof fs.readFileSync} readFileImpl
117
156
  * @returns {string|null} The configured command, or null when unset/default.
118
157
  */
119
158
  function configuredTestCommand(projectRoot, readFileImpl) {
120
- let command = null;
121
- for (const file of ['.agentrc.json', '.agentrc.local.json']) {
122
- const value = readJsonSafe(path.join(projectRoot, file), {
123
- readFileSync: readFileImpl,
124
- })?.project?.commands?.test;
125
- if (typeof value === 'string' && value.trim().length > 0) {
126
- command = value.trim();
127
- }
128
- }
129
- return command === DEFAULT_TEST_COMMAND ? null : command;
159
+ const command = overlaidValue(
160
+ projectRoot,
161
+ readFileImpl,
162
+ (c) => c?.project?.commands?.test,
163
+ isNonEmptyString,
164
+ )?.trim();
165
+ return command === undefined || command === DEFAULT_TEST_COMMAND
166
+ ? null
167
+ : command;
130
168
  }
131
169
 
132
170
  /**
@@ -153,13 +191,15 @@ function describeConfiguredTestCommand(command) {
153
191
  /**
154
192
  * Which depositor digest § 5 selects, stated with its exact command.
155
193
  *
156
- * @param {{ scripts: Record<string, string>, crapEnabled: boolean, testCommand: string|null }} probe
194
+ * @param {{ root: string, scripts: Record<string, string>, capture: { captureEnabled: boolean, captureScript: string }, testCommand: string|null }} probe
157
195
  * @returns {{ detail: string, remedy?: string }}
158
196
  */
159
- function describeCreditedRun({ scripts, crapEnabled, testCommand }) {
160
- if (crapEnabled && scriptNamed(scripts, 'test:coverage') !== null) {
197
+ function describeCreditedRun({ root, scripts, capture, testCommand }) {
198
+ const { captureEnabled, captureScript } = capture;
199
+ if (captureEnabled && scriptNamed(scripts, captureScript) !== null) {
200
+ const spawn = packageScriptArgv(root, captureScript).join(' ');
161
201
  return {
162
- detail: `the CRAP gate is enabled and \`test:coverage\` exists, so close registers \`coverage-capture\` and the credited run is the coverage capture: \`${COVERAGE_CAPTURE_COMMAND}\` — its fresh stamp lets close's capture skip the suite`,
202
+ detail: `the coverage or CRAP gate is enabled and the \`${captureScript}\` capture script exists, so close registers \`coverage-capture\` (spawning \`${spawn}\`) and the credited run is the coverage capture: \`${COVERAGE_CAPTURE_COMMAND}\` — its fresh stamp lets close's capture skip the suite`,
163
203
  };
164
204
  }
165
205
  return testCommand !== null
@@ -255,8 +295,9 @@ export function runTestCreditPath({
255
295
  detail: `the worker's \`${STORY_HANDOFF_COMMAND}\` runs the credited run close reads`,
256
296
  },
257
297
  describeCreditedRun({
298
+ root,
258
299
  scripts: readProjectScripts(root, readFile),
259
- crapEnabled: isCrapEnabled(root, readFile),
300
+ capture: readCaptureConfig(root, readFile),
260
301
  testCommand: configuredTestCommand(root, readFile),
261
302
  }),
262
303
  describePrePushHook(root, readFile),
@@ -1,10 +1,12 @@
1
1
  // lib/cli/doctor-checks/toolchain.js — Doctor checks: node-version, git-available, gh-available, github-token, gh-auth.
2
+ // Every `gh` probe goes through `runGh`, so it runs with the configured `GH_CONFIG_DIR`.
2
3
 
3
4
  import {
4
5
  REQUIRED_NODE_CEILING_MAJOR,
5
6
  REQUIRED_NODE_FLOOR,
6
7
  satisfiesNodeEngine,
7
8
  } from '../../../.agents/scripts/lib/bootstrap/project-bootstrap.js';
9
+ import { runGh } from '../../../.agents/scripts/lib/gh-exec.js';
8
10
  import { spawn } from './spawn.js';
9
11
 
10
12
  // check: node-version
@@ -50,7 +52,7 @@ export function runGitAvailable({ runner = spawn } = {}) {
50
52
  * @returns {{ ok: boolean, detail: string, remedy?: string }}
51
53
  */
52
54
  export function runGhAvailable({ runner = spawn } = {}) {
53
- const r = runner('gh', ['--version']);
55
+ const r = runGh(['--version'], {}, runner);
54
56
  if (r.error?.code === 'ENOENT' || r.status !== 0) {
55
57
  const snippet = (r.stderr || r.stdout || '').trim().slice(0, 120);
56
58
  return {
@@ -80,7 +82,7 @@ export function runGithubToken({ env = process.env, runner = spawn } = {}) {
80
82
  if (envToken && envToken.length > 0) {
81
83
  return { ok: true, detail: 'GITHUB_TOKEN set' };
82
84
  }
83
- const r = runner('gh', ['auth', 'token']);
85
+ const r = runGh(['auth', 'token'], {}, runner);
84
86
  const ghToken = !r.error && r.status === 0 ? (r.stdout || '').trim() : '';
85
87
  if (ghToken.length > 0) {
86
88
  return { ok: true, detail: 'token resolved via `gh auth token`' };
@@ -106,7 +108,7 @@ export function runGithubToken({ env = process.env, runner = spawn } = {}) {
106
108
  * @returns {{ ok: boolean, detail: string, remedy?: string }}
107
109
  */
108
110
  export function runGhAuth({ runner = spawn, env = process.env } = {}) {
109
- const r = runner('gh', ['auth', 'status']);
111
+ const r = runGh(['auth', 'status'], {}, runner);
110
112
  if (r.error?.code === 'ENOENT') {
111
113
  return {
112
114
  ok: false,
@@ -17,8 +17,10 @@ import {
17
17
  runCodexInstructions,
18
18
  runCodexSkillsInSync,
19
19
  } from './doctor-checks/codex.js';
20
+ import { runLlmReviewProvider } from './doctor-checks/llm-review.js';
20
21
  import { runMergeDriver } from './doctor-checks/merge-driver.js';
21
22
  import { runAgentsDrift, runPinCurrent } from './doctor-checks/payload.js';
23
+ import { runProjectAccess } from './doctor-checks/project-access.js';
22
24
  import {
23
25
  runAgentsMaterialized,
24
26
  runRuntimeDeps,
@@ -72,6 +74,11 @@ export const registry = [
72
74
  name: 'gh-auth',
73
75
  run: (opts) => runGhAuth(opts),
74
76
  },
77
+ // Presupposes gh-auth: an unauthenticated gh defers there.
78
+ {
79
+ name: 'github-project-access',
80
+ run: (opts) => runProjectAccess(opts),
81
+ },
75
82
  {
76
83
  name: 'commands-in-sync',
77
84
  run: (opts) => runCommandsInSync(opts),
@@ -112,6 +119,10 @@ export const registry = [
112
119
  ...opts,
113
120
  }),
114
121
  },
122
+ {
123
+ name: 'llm-review-provider',
124
+ run: (opts) => runLlmReviewProvider(opts),
125
+ },
115
126
  {
116
127
  name: 'merge-driver',
117
128
  run: (opts) => runMergeDriver(opts),
@@ -15,7 +15,7 @@ export const AGENTRC_BASE_FILENAME = '.agentrc.json';
15
15
 
16
16
  const AGENTRC_LOCAL_FILENAME = '.agentrc.local.json';
17
17
 
18
- const AGENTRC_FILENAMES = Object.freeze([
18
+ export const AGENTRC_FILENAMES = Object.freeze([
19
19
  AGENTRC_BASE_FILENAME,
20
20
  AGENTRC_LOCAL_FILENAME,
21
21
  ]);
@@ -25,7 +25,7 @@ const AGENTRC_FILENAMES = Object.freeze([
25
25
  * @param {string} filename
26
26
  * @returns {string}
27
27
  */
28
- function resolveAgentrcPath(ctx, filename) {
28
+ export function resolveAgentrcPath(ctx, filename) {
29
29
  const projectRoot = ctx?.projectRoot ?? process.cwd();
30
30
  return path.join(projectRoot, filename);
31
31
  }
@@ -38,7 +38,7 @@ function resolveAgentrcPath(ctx, filename) {
38
38
  * @param {typeof nodeFs} fsImpl
39
39
  * @returns {object | null}
40
40
  */
41
- function readAgentrcConfig(ctx, filename, fsImpl) {
41
+ export function readAgentrcConfig(ctx, filename, fsImpl) {
42
42
  try {
43
43
  const raw = fsImpl.readFileSync(resolveAgentrcPath(ctx, filename), 'utf8');
44
44
  return JSON.parse(raw);
@@ -20,6 +20,9 @@ import { foldClaudeMdIntoAgentsMdStep } from './steps/2.65.0-fold-claude-md-into
20
20
  import { retireAuditLedger } from './steps/2.70.0-retire-audit-ledger.js';
21
21
  import { containerSafeProjections } from './steps/2.79.0-container-safe-projections.js';
22
22
  import { hoistSystemPromptBlockStep } from './steps/2.84.0-hoist-system-prompt-block.js';
23
+ import { moveSharedCrapCaptureScript } from './steps/2.91.0-move-shared-crap-capture-script.js';
24
+ import { retireDuplicationFormats } from './steps/2.91.0-retire-duplication-formats.js';
25
+ import { unsetNullLintCommand } from './steps/2.91.0-unset-null-lint-command.js';
23
26
  import { stripRemovedAgentrcKeys } from './steps/strip-removed-agentrc-keys.js';
24
27
 
25
28
  /**
@@ -48,6 +51,9 @@ export const migrations = [
48
51
  retireAuditLedger,
49
52
  containerSafeProjections,
50
53
  hoistSystemPromptBlockStep,
54
+ moveSharedCrapCaptureScript,
55
+ unsetNullLintCommand,
56
+ retireDuplicationFormats,
51
57
  ];
52
58
 
53
59
  export { compareVersions };
@@ -0,0 +1,84 @@
1
+ // lib/migrations/steps/2.91.0-move-shared-crap-capture-script.js
2
+ /**
3
+ * Move a `delivery.quality.gates.crap.captureScript` that has no own CRAP
4
+ * artifact to `delivery.quality.gates.coverage.captureScript`. A shared
5
+ * artifact has one writer — the coverage gate — so the resolver now refuses
6
+ * the CRAP key without an own `crap.coveragePath`. An explicit coverage
7
+ * `captureScript` wins; the CRAP key is dropped either way. Each config
8
+ * surface is rewritten on its own. Builtins only.
9
+ */
10
+
11
+ import nodeFs from 'node:fs';
12
+ import { COVERAGE_CAPTURE_DEFAULTS } from '../../../.agents/scripts/lib/config/gates/coverage.schema.js';
13
+ import {
14
+ AGENTRC_FILENAMES,
15
+ resolveAgentrcPath as agentrcPath,
16
+ readAgentrcConfig as readConfig,
17
+ } from '../helpers/retire-agentrc-key.js';
18
+
19
+ /** @param {object|null} config */
20
+ function gatesOf(config) {
21
+ const gates = config?.delivery?.quality?.gates;
22
+ return gates && typeof gates === 'object' ? gates : null;
23
+ }
24
+
25
+ /** @param {unknown} value */
26
+ function slashed(value) {
27
+ return typeof value === 'string' ? value.trim().replace(/\\/g, '/') : '';
28
+ }
29
+
30
+ /**
31
+ * The CRAP gate's `captureScript` with no own artifact, or `null`.
32
+ *
33
+ * @param {object|null} config
34
+ * @returns {string|null}
35
+ */
36
+ function sharedCrapScript(config) {
37
+ const gates = gatesOf(config);
38
+ const script = gates?.crap?.captureScript;
39
+ if (typeof script !== 'string') return null;
40
+ const own = slashed(gates.crap.coveragePath);
41
+ const shared =
42
+ slashed(gates.coverage?.coveragePath) ||
43
+ COVERAGE_CAPTURE_DEFAULTS.coveragePath;
44
+ return own === '' || own === shared ? script : null;
45
+ }
46
+
47
+ /** @param {object} config @param {string} script */
48
+ function moveScript(config, script) {
49
+ const gates = gatesOf(config);
50
+ delete gates.crap.captureScript;
51
+ gates.coverage = gates.coverage ?? {};
52
+ if (gates.coverage.captureScript === undefined) {
53
+ gates.coverage.captureScript = script;
54
+ }
55
+ }
56
+
57
+ export const moveSharedCrapCaptureScript = {
58
+ version: '2.91.0',
59
+ description:
60
+ 'move a crap.captureScript with no own crap.coveragePath to ' +
61
+ 'coverage.captureScript — the coverage gate now owns its capture script ' +
62
+ '(Story #5737)',
63
+ /** @param {{ projectRoot?: string, fs?: typeof nodeFs }} [ctx] */
64
+ detect(ctx) {
65
+ const fsImpl = ctx?.fs ?? nodeFs;
66
+ return AGENTRC_FILENAMES.some(
67
+ (name) => sharedCrapScript(readConfig(ctx, name, fsImpl)) !== null,
68
+ );
69
+ },
70
+ /** @param {{ projectRoot?: string, fs?: typeof nodeFs }} [ctx] */
71
+ apply(ctx) {
72
+ const fsImpl = ctx?.fs ?? nodeFs;
73
+ for (const name of AGENTRC_FILENAMES) {
74
+ const config = readConfig(ctx, name, fsImpl);
75
+ const script = sharedCrapScript(config);
76
+ if (script === null) continue;
77
+ moveScript(config, script);
78
+ fsImpl.writeFileSync(
79
+ agentrcPath(ctx, name),
80
+ `${JSON.stringify(config, null, 2)}\n`,
81
+ );
82
+ }
83
+ },
84
+ };
@@ -0,0 +1,23 @@
1
+ // lib/migrations/steps/2.91.0-retire-duplication-formats.js
2
+ /**
3
+ * Strip `delivery.quality.gates.duplication.formats`: the jscpd formats are
4
+ * now derived from the scorable-extension list every other gate scores, and
5
+ * the gate block is `additionalProperties: false`. An emptied `duplication`
6
+ * block is pruned; its parents keep their other gates.
7
+ */
8
+
9
+ import { createRetireAgentrcKeyStep } from '../helpers/retire-agentrc-key.js';
10
+
11
+ export const retireDuplicationFormats = createRetireAgentrcKeyStep({
12
+ version: '2.91.0',
13
+ description:
14
+ 'strip retired delivery.quality.gates.duplication.formats from ' +
15
+ '.agentrc.json and .agentrc.local.json (the jscpd formats now derive ' +
16
+ 'from the scorable-extension list — Story #5738)',
17
+ keys: [
18
+ {
19
+ path: ['delivery', 'quality', 'gates', 'duplication', 'formats'],
20
+ pruneDepth: 1,
21
+ },
22
+ ],
23
+ });
@@ -0,0 +1,54 @@
1
+ // lib/migrations/steps/2.91.0-unset-null-lint-command.js
2
+ /**
3
+ * Drop an explicit `project.commands.lint: null`. It used to mean "use the
4
+ * `npm run lint` default" (the shipped reference carried it), and now means
5
+ * "disable the lint gate"; removing the key keeps the old behaviour. A
6
+ * consumer who wants lint off sets `null` again after the upgrade. Builtins
7
+ * only.
8
+ */
9
+
10
+ import nodeFs from 'node:fs';
11
+
12
+ import {
13
+ AGENTRC_FILENAMES,
14
+ resolveAgentrcPath as agentrcPath,
15
+ readAgentrcConfig as readConfig,
16
+ } from '../helpers/retire-agentrc-key.js';
17
+
18
+ /** @param {object|null} config */
19
+ function hasNullLint(config) {
20
+ const commands = config?.project?.commands;
21
+ return (
22
+ commands !== null &&
23
+ typeof commands === 'object' &&
24
+ Object.hasOwn(commands, 'lint') &&
25
+ commands.lint === null
26
+ );
27
+ }
28
+
29
+ export const unsetNullLintCommand = {
30
+ version: '2.91.0',
31
+ description:
32
+ 'drop an explicit project.commands.lint: null, which now disables the ' +
33
+ 'lint gate instead of meaning the npm run lint default (Story #5737)',
34
+ /** @param {{ projectRoot?: string, fs?: typeof nodeFs }} [ctx] */
35
+ detect(ctx) {
36
+ const fsImpl = ctx?.fs ?? nodeFs;
37
+ return AGENTRC_FILENAMES.some((name) =>
38
+ hasNullLint(readConfig(ctx, name, fsImpl)),
39
+ );
40
+ },
41
+ /** @param {{ projectRoot?: string, fs?: typeof nodeFs }} [ctx] */
42
+ apply(ctx) {
43
+ const fsImpl = ctx?.fs ?? nodeFs;
44
+ for (const name of AGENTRC_FILENAMES) {
45
+ const config = readConfig(ctx, name, fsImpl);
46
+ if (!hasNullLint(config)) continue;
47
+ delete config.project.commands.lint;
48
+ fsImpl.writeFileSync(
49
+ agentrcPath(ctx, name),
50
+ `${JSON.stringify(config, null, 2)}\n`,
51
+ );
52
+ }
53
+ },
54
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mandrel",
3
- "version": "2.89.0",
3
+ "version": "2.91.0",
4
4
  "description": "Claude Code-first opinionated workflow framework: instructions, skills, rules, and SDLC workflows that govern AI coding assistants.",
5
5
  "files": [
6
6
  ".agents/",
@@ -119,12 +119,10 @@
119
119
  "dependencies": {
120
120
  "@babel/parser": "^7.29.3",
121
121
  "ajv": "^8.20.0",
122
- "ajv-formats": "^3.0.1",
123
122
  "babel-runtime": "^6.26.0",
124
123
  "escomplex-plugin-metrics-module": "^0.1.0",
125
124
  "escomplex-plugin-syntax-babylon": "^0.1.0",
126
125
  "js-yaml": "^4.3.2",
127
- "minimatch": "^10.0.0",
128
126
  "picomatch": "^4.0.4",
129
127
  "typhonjs-ast-walker": "^0.2.1",
130
128
  "typhonjs-escomplex-commons": "^0.1.1"