mandrel 2.122.0 → 2.124.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 (65) hide show
  1. package/.agents/README.md +1 -1
  2. package/.agents/docs/agentrc-reference.json +1 -0
  3. package/.agents/docs/configuration.md +10 -7
  4. package/.agents/runtime-deps.json +2 -2
  5. package/.agents/schemas/agentrc.schema.json +26 -4
  6. package/.agents/schemas/audit-rules.schema.json +1 -1
  7. package/.agents/schemas/story-deliver-terminal.schema.json +7 -2
  8. package/.agents/scripts/check-doc-links.js +4 -4
  9. package/.agents/scripts/lib/audit-baselines/surface-entry.js +2 -2
  10. package/.agents/scripts/lib/audit-exceptions/globs.js +2 -2
  11. package/.agents/scripts/lib/audit-exceptions/scope.js +2 -2
  12. package/.agents/scripts/lib/audit-suite/selector.js +3 -3
  13. package/.agents/scripts/lib/baselines/bundle-size-scorer.js +3 -3
  14. package/.agents/scripts/lib/baselines/components.js +2 -2
  15. package/.agents/scripts/lib/baselines/kinds/_crap-new-method-gate.js +2 -2
  16. package/.agents/scripts/lib/bdd-runner-detect.js +3 -4
  17. package/.agents/scripts/lib/close-validation/base-sync-revalidation.js +2 -2
  18. package/.agents/scripts/lib/close-validation/gates.js +16 -3
  19. package/.agents/scripts/lib/close-validation/test-delta.js +9 -4
  20. package/.agents/scripts/lib/config/gates/coverage.schema.js +2 -2
  21. package/.agents/scripts/lib/config/handoff.js +21 -6
  22. package/.agents/scripts/lib/config-settings-schema-delivery.js +19 -10
  23. package/.agents/scripts/lib/config-settings-schema-quality.js +1 -1
  24. package/.agents/scripts/lib/coverage-baseline.js +8 -4
  25. package/.agents/scripts/lib/coverage-capture-delta.js +2 -2
  26. package/.agents/scripts/lib/coverage-capture-own-fix.js +2 -2
  27. package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
  28. package/.agents/scripts/lib/git-test-guard.js +119 -0
  29. package/.agents/scripts/lib/git-utils.js +3 -0
  30. package/.agents/scripts/lib/maintainability-utils.js +4 -4
  31. package/.agents/scripts/lib/observability/handoff-telemetry.js +2 -0
  32. package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +3 -2
  33. package/.agents/scripts/lib/orchestration/block-class-recovery.js +44 -0
  34. package/.agents/scripts/lib/orchestration/code-review.js +35 -19
  35. package/.agents/scripts/lib/orchestration/diff-magnitude.js +1 -1
  36. package/.agents/scripts/lib/orchestration/git-cleanup/phases/filters.js +3 -3
  37. package/.agents/scripts/lib/orchestration/handoff-suite-of-record.js +15 -7
  38. package/.agents/scripts/lib/orchestration/merge-queue.js +36 -10
  39. package/.agents/scripts/lib/orchestration/plan-persist/audit-attribution.js +3 -4
  40. package/.agents/scripts/lib/orchestration/review-history.js +9 -10
  41. package/.agents/scripts/lib/orchestration/review-providers/code-review.js +9 -2
  42. package/.agents/scripts/lib/orchestration/review-providers/codex-cli.js +8 -5
  43. package/.agents/scripts/lib/orchestration/review-providers/codex.js +3 -11
  44. package/.agents/scripts/lib/orchestration/review-providers/mi-exemptions.js +2 -2
  45. package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +22 -0
  46. package/.agents/scripts/lib/orchestration/review-providers/security-review.js +10 -2
  47. package/.agents/scripts/lib/orchestration/review-providers/types.js +2 -0
  48. package/.agents/scripts/lib/orchestration/review-providers/ultrareview.js +13 -2
  49. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +40 -15
  50. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +8 -1
  51. package/.agents/scripts/lib/orchestration/story-handoff.js +216 -54
  52. package/.agents/scripts/lib/test-temp.js +5 -5
  53. package/.agents/scripts/lib/test-tiers.js +3 -3
  54. package/.agents/scripts/lib/util/glob-match.js +64 -0
  55. package/.agents/scripts/lib/wave-runner/footprint.js +3 -3
  56. package/.agents/scripts/run-tests.js +2 -1
  57. package/.agents/scripts/single-story-init.js +3 -3
  58. package/.agents/workflows/helpers/code-review.md +8 -1
  59. package/.agents/workflows/helpers/deliver-digest.md +23 -24
  60. package/.agents/workflows/helpers/deliver-reference.md +62 -26
  61. package/.agents/workflows/helpers/deliver-story-reference.md +10 -3
  62. package/.agents/workflows/helpers/deliver-story.md +27 -7
  63. package/.agents/workflows/mandrel-deliver.md +8 -2
  64. package/docs/CHANGELOG.md +23 -0
  65. package/package.json +2 -2
@@ -249,7 +249,7 @@ const CLOSE_SCHEMA = {
249
249
  type: 'array',
250
250
  items: { type: 'string', minLength: 1 },
251
251
  description:
252
- 'Globs (picomatch, dotfiles included) for whole-repo invariants: a base merge bringing in any matching path always re-runs every gate under `revalidateAfterBaseSync: "ci"`.',
252
+ 'Globs (dotfiles included) for whole-repo invariants: a base merge bringing in any matching path always re-runs every gate under `revalidateAfterBaseSync: "ci"`.',
253
253
  },
254
254
  },
255
255
  additionalProperties: false,
@@ -372,22 +372,31 @@ const PULL_REQUEST_DELIVERY_SCHEMA = {
372
372
  additionalProperties: false,
373
373
  };
374
374
 
375
+ const HANDOFF_CHECK_ITEMS = {
376
+ type: 'object',
377
+ properties: {
378
+ cmd: { type: 'string', minLength: 1 },
379
+ args: { type: 'array', items: { type: 'string' } },
380
+ },
381
+ required: ['cmd'],
382
+ additionalProperties: false,
383
+ };
384
+
375
385
  const HANDOFF_SCHEMA = {
376
386
  type: 'object',
377
387
  description:
378
388
  "Story #5960. What `story-handoff.js` runs beyond close's own gates.",
379
389
  properties: {
390
+ firstChecks: {
391
+ type: 'array',
392
+ items: HANDOFF_CHECK_ITEMS,
393
+ description:
394
+ "Story #6099. Cheap consumer checks the handoff preflight runs first, in order, beside close's independent baseline compare: each `{ cmd, args? }` runs in the worktree without a shell, with `MANDREL_HANDOFF_STEP=preflight`. A non-zero exit settles `fix-required` naming the check and quoting its failure rows, before typecheck, lint, format, quality-preview, the ratchets or the held review start; under `--report-all` the rest still run. Default [] runs only the compare first.",
395
+ default: [],
396
+ },
380
397
  postSeatChecks: {
381
398
  type: 'array',
382
- items: {
383
- type: 'object',
384
- properties: {
385
- cmd: { type: 'string', minLength: 1 },
386
- args: { type: 'array', items: { type: 'string' } },
387
- },
388
- required: ['cmd'],
389
- additionalProperties: false,
390
- },
399
+ items: HANDOFF_CHECK_ITEMS,
391
400
  description:
392
401
  "Story #5960. Consumer checks the handoff re-runs in its post-capture step, after the seat commits the Story's new baseline rows: each `{ cmd, args? }` runs in the worktree without a shell, with `MANDREL_HANDOFF_STEP=post-capture`, and a non-zero exit settles `fix-required`. Declare the check a consumer downgrades during `preflight` (keyed on `MANDREL_HANDOFF_STEP`) here, so a row the seat did not write still fails the handoff; while any is declared the preflight `lint` credit is withheld until they pass at HEAD. Skipped under a coverage deferral. Default [] runs nothing extra.",
393
402
  default: [],
@@ -137,7 +137,7 @@ export const CODE_REVIEW_SCHEMA = {
137
137
  sensitivePaths: {
138
138
  type: 'object',
139
139
  description:
140
- "The project's own sensitive-path classes, merged additively over the shipped `audit-rules.json` `sensitivePaths`: a class named like a shipped one appends its patterns to it, a new name adds a class, and no shipped class or pattern can be removed or narrowed. A changed file matching any class derives a `high` change level, which drives both code-review depth (`deep`, never `light`) and plan-time routing. Patterns are picomatch globs matched with `dot: true`.",
140
+ "The project's own sensitive-path classes, merged additively over the shipped `audit-rules.json` `sensitivePaths`: a class named like a shipped one appends its patterns to it, a new name adds a class, and no shipped class or pattern can be removed or narrowed. A changed file matching any class derives a `high` change level, which drives both code-review depth (`deep`, never `light`) and plan-time routing. Patterns are globs matched with `dot: true`.",
141
141
  propertyNames: { pattern: '^[a-z0-9][a-z0-9-]*$' },
142
142
  additionalProperties: {
143
143
  type: 'object',
@@ -5,7 +5,6 @@
5
5
 
6
6
  import fs from 'node:fs';
7
7
  import path from 'node:path';
8
- import picomatch from 'picomatch';
9
8
  import { write, writeFile } from './baselines/writer.js';
10
9
  import { COVERAGE_CAPTURE_DEFAULTS } from './config/gates/coverage.schema.js';
11
10
  import {
@@ -13,6 +12,8 @@ import {
13
12
  MissingCoverageArtifactError,
14
13
  } from './coverage-capture.js';
15
14
  import { isObject } from './json-utils.js';
15
+ import { isScorableSourceFile } from './source-extensions.js';
16
+ import { globMatcher } from './util/glob-match.js';
16
17
 
17
18
  const COVERAGE_FINAL_PATH = COVERAGE_CAPTURE_DEFAULTS.coveragePath;
18
19
  const COVERAGE_BASELINE_PATH = 'baselines/coverage.json';
@@ -29,9 +30,9 @@ function toForwardSlash(p) {
29
30
  /** c8's scope rule: some `include` matches and no `exclude` does. */
30
31
  export function buildScopePredicate({ include = [], exclude = [] } = {}) {
31
32
  const inc =
32
- include.length === 0 ? () => true : picomatch(include, { dot: true });
33
+ include.length === 0 ? () => true : globMatcher(include, { dot: true });
33
34
  const exc =
34
- exclude.length === 0 ? () => false : picomatch(exclude, { dot: true });
35
+ exclude.length === 0 ? () => false : globMatcher(exclude, { dot: true });
35
36
  return (relPath) => {
36
37
  const norm = toForwardSlash(relPath);
37
38
  return inc(norm) && !exc(norm);
@@ -342,9 +343,12 @@ export async function resolveCoverageRefreshScope({
342
343
  if (fullScope) return { fullScope: true };
343
344
  return diffScopeRef ? { baseRef: diffScopeRef } : {};
344
345
  }
346
+ // Only a scorable source can carry a row; a docs-only diff scopes nothing.
345
347
  const diff = fullScope
346
348
  ? null
347
- : await deriveDiffFiles(diffScopeRef ?? 'origin/main');
349
+ : (await deriveDiffFiles(diffScopeRef ?? 'origin/main')).filter(
350
+ isScorableSourceFile,
351
+ );
348
352
  return {
349
353
  scopeFiles: narrowScopeToMeasured(diff, listMeasured(cwd), inCoverageScope),
350
354
  requireRowsForScopeFiles: true,
@@ -7,7 +7,6 @@
7
7
  */
8
8
  import fs from 'node:fs';
9
9
  import path from 'node:path';
10
- import picomatch from 'picomatch';
11
10
  import { getQuality } from './config/quality.js';
12
11
  import {
13
12
  captureStampPath,
@@ -18,6 +17,7 @@ import {
18
17
  } from './coverage-capture.js';
19
18
  import { judgeOwnFix, supersededSeed } from './coverage-capture-own-fix.js';
20
19
  import { gitSpawn } from './git-utils.js';
20
+ import { globMatcher } from './util/glob-match.js';
21
21
 
22
22
  /** Basenames whose change moves coverage beyond the files it names. */
23
23
  const COVERAGE_CONFIG_RE =
@@ -127,7 +127,7 @@ function treeIneligibility({ cwd, commit, spawn }) {
127
127
  /** `nonInputGlobs` as a predicate; an unset list matches nothing. */
128
128
  function nonInputMatcher(globs) {
129
129
  return Array.isArray(globs) && globs.length > 0
130
- ? picomatch(globs, { dot: true })
130
+ ? globMatcher(globs, { dot: true })
131
131
  : () => false;
132
132
  }
133
133
 
@@ -8,12 +8,12 @@
8
8
 
9
9
  import fs from 'node:fs';
10
10
  import path from 'node:path';
11
- import picomatch from 'picomatch';
12
11
  import {
13
12
  filterSuiteInputPaths,
14
13
  supersededArtifactPath,
15
14
  supersededStampPath,
16
15
  } from './coverage-capture.js';
16
+ import { globMatcher } from './util/glob-match.js';
17
17
 
18
18
  const TEST_FILE_RE = /\.(test|spec)\.[cm]?[jt]sx?$/;
19
19
  const TEST_DIR_RE = /(^|\/)(tests?|__tests__|spec|e2e)\//;
@@ -172,7 +172,7 @@ function ownFixContext({
172
172
  }) {
173
173
  const isNonInput =
174
174
  coverage.nonInputGlobs?.length > 0
175
- ? picomatch(coverage.nonInputGlobs, { dot: true })
175
+ ? globMatcher(coverage.nonInputGlobs, { dot: true })
176
176
  : () => false;
177
177
  const suite = (files) => filterSuiteInputPaths(files, crap.coveragePath);
178
178
  return {