mandrel 2.31.0 → 2.32.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 (250) hide show
  1. package/.agents/README.md +13 -17
  2. package/.agents/agents/acceptance-critic.md +1 -2
  3. package/.agents/docs/SDLC.md +4 -4
  4. package/.agents/docs/agentrc-reference.json +61 -57
  5. package/.agents/docs/configuration.md +274 -227
  6. package/.agents/docs/execution-reference.md +13 -14
  7. package/.agents/docs/quality-gates.md +195 -23
  8. package/.agents/instructions.md +2 -5
  9. package/.agents/rules/git-conventions-reference.md +27 -27
  10. package/.agents/rules/git-conventions.md +4 -2
  11. package/.agents/rules/known-tooling-behavior.md +66 -30
  12. package/.agents/rules/testing-standards.md +35 -71
  13. package/.agents/runtime-deps.json +0 -1
  14. package/.agents/schemas/agentrc.schema.json +1939 -1400
  15. package/.agents/schemas/lifecycle/README.md +21 -14
  16. package/.agents/schemas/lifecycle/ledger-record.schema.json +76 -22
  17. package/.agents/schemas/story-deliver-terminal.schema.json +2 -2
  18. package/.agents/scripts/README.md +7 -29
  19. package/.agents/scripts/apply-quality-bootstrap.js +27 -34
  20. package/.agents/scripts/bootstrap.js +28 -26
  21. package/.agents/scripts/check-baseline-drift.js +73 -13
  22. package/.agents/scripts/check-baseline-scope.js +362 -0
  23. package/.agents/scripts/check-dead-exports.js +9 -1
  24. package/.agents/scripts/check-gherkin-corpus.js +508 -0
  25. package/.agents/scripts/check-knip-entries.js +136 -0
  26. package/.agents/scripts/check-lifecycle-lint.js +36 -112
  27. package/.agents/scripts/check-schema-references.js +1 -1
  28. package/.agents/scripts/diagnose-friction.js +7 -4
  29. package/.agents/scripts/generate-config-docs.js +263 -171
  30. package/.agents/scripts/install-matrix-assert.js +0 -1
  31. package/.agents/scripts/lib/ITicketingProvider.js +0 -58
  32. package/.agents/scripts/lib/audit-baselines/staleness.js +6 -6
  33. package/.agents/scripts/lib/audit-baselines/trend.js +7 -8
  34. package/.agents/scripts/lib/audit-baselines/weights.js +4 -5
  35. package/.agents/scripts/lib/audit-suite/checklist-threading.js +1 -1
  36. package/.agents/scripts/lib/audit-to-stories/build-story-body.js +0 -1
  37. package/.agents/scripts/lib/baselines/envelope.js +41 -60
  38. package/.agents/scripts/lib/baselines/git-base.js +30 -37
  39. package/.agents/scripts/lib/baselines/kinds/_crap-new-method-gate.js +103 -0
  40. package/.agents/scripts/lib/baselines/kinds/_crap-read.js +150 -0
  41. package/.agents/scripts/lib/baselines/kinds/crap.js +25 -65
  42. package/.agents/scripts/lib/baselines/orphan-pruner.js +233 -0
  43. package/.agents/scripts/lib/baselines/refresh-service.js +6 -8
  44. package/.agents/scripts/lib/baselines/scope-assert.js +223 -0
  45. package/.agents/scripts/lib/baselines/scope-inventory.js +314 -0
  46. package/.agents/scripts/lib/bdd-step-index.js +326 -0
  47. package/.agents/scripts/lib/bootstrap/install-ledger.js +5 -3
  48. package/.agents/scripts/lib/bootstrap/issue-forms-template.js +4 -6
  49. package/.agents/scripts/lib/bootstrap/manifest.js +17 -40
  50. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +12 -59
  51. package/.agents/scripts/lib/bootstrap/quality-bootstrap.js +62 -2
  52. package/.agents/scripts/lib/checks/loop-health.js +9 -37
  53. package/.agents/scripts/lib/child-exec.js +193 -0
  54. package/.agents/scripts/lib/cli/standard-args.js +1 -1
  55. package/.agents/scripts/lib/cli-args.js +64 -0
  56. package/.agents/scripts/lib/close-validation/gates.js +2 -2
  57. package/.agents/scripts/lib/close-validation/runner.js +3 -3
  58. package/.agents/scripts/lib/config/acceptance-eval.js +5 -52
  59. package/.agents/scripts/lib/config/commands.js +3 -5
  60. package/.agents/scripts/lib/config/explain.js +5 -7
  61. package/.agents/scripts/lib/config/gates/bundle-size.schema.js +32 -6
  62. package/.agents/scripts/lib/config/gates/coverage.schema.js +25 -5
  63. package/.agents/scripts/lib/config/gates/crap-incremental-coverage.schema.js +12 -2
  64. package/.agents/scripts/lib/config/gates/crap.schema.js +68 -23
  65. package/.agents/scripts/lib/config/gates/duplication.schema.js +29 -17
  66. package/.agents/scripts/lib/config/gates/index.js +5 -2
  67. package/.agents/scripts/lib/config/gates/lighthouse.schema.js +34 -6
  68. package/.agents/scripts/lib/config/gates/lint.schema.js +11 -2
  69. package/.agents/scripts/lib/config/gates/maintainability.schema.js +37 -15
  70. package/.agents/scripts/lib/config/gates/mutation.schema.js +15 -3
  71. package/.agents/scripts/lib/config/gates/shared.js +58 -9
  72. package/.agents/scripts/lib/config/github.js +0 -1
  73. package/.agents/scripts/lib/config/limits.js +3 -48
  74. package/.agents/scripts/lib/config/qa.js +105 -0
  75. package/.agents/scripts/lib/config/temp-paths.js +6 -5
  76. package/.agents/scripts/lib/config-settings-schema-delivery.js +237 -56
  77. package/.agents/scripts/lib/config-settings-schema-quality.js +209 -29
  78. package/.agents/scripts/lib/config-settings-schema.js +386 -39
  79. package/.agents/scripts/lib/crap-baseline-join.js +126 -9
  80. package/.agents/scripts/lib/crap-utils.js +84 -520
  81. package/.agents/scripts/lib/dead-exports-knip.js +79 -10
  82. package/.agents/scripts/lib/degraded-mode.js +2 -2
  83. package/.agents/scripts/lib/doc-tiers.js +3 -3
  84. package/.agents/scripts/lib/feedback-loop/graduator-core.js +46 -104
  85. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +10 -8
  86. package/.agents/scripts/lib/fs-walk.js +52 -0
  87. package/.agents/scripts/lib/git-branch-lifecycle.js +2 -2
  88. package/.agents/scripts/lib/git-utils.js +16 -36
  89. package/.agents/scripts/lib/knip-entry-sync.js +469 -0
  90. package/.agents/scripts/lib/observability/metrics-ledger.js +1 -1
  91. package/.agents/scripts/lib/observability/runtime-friction.js +10 -0
  92. package/.agents/scripts/lib/observability/signal-validator.js +5 -85
  93. package/.agents/scripts/lib/observability/signals-writer.js +19 -62
  94. package/.agents/scripts/lib/observability/source-classifier.js +5 -7
  95. package/.agents/scripts/lib/observability/terse-result.js +3 -3
  96. package/.agents/scripts/lib/orchestration/behind-recovery.js +114 -0
  97. package/.agents/scripts/lib/orchestration/ceremony-routing.js +7 -8
  98. package/.agents/scripts/lib/orchestration/ci-rerun-guard.js +34 -33
  99. package/.agents/scripts/lib/orchestration/code-review.js +2 -2
  100. package/.agents/scripts/lib/orchestration/complexity-gate.js +43 -161
  101. package/.agents/scripts/lib/orchestration/diff-magnitude.js +4 -4
  102. package/.agents/scripts/lib/orchestration/label-transitions.js +3 -2
  103. package/.agents/scripts/lib/orchestration/lease-guard-shared.js +12 -38
  104. package/.agents/scripts/lib/orchestration/lifecycle/emit-merge-unlanded.js +5 -6
  105. package/.agents/scripts/lib/orchestration/plan-metrics.js +2 -3
  106. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +6 -0
  107. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +0 -1
  108. package/.agents/scripts/lib/orchestration/{lifecycle/listeners/watcher.js → pr-watch.js} +58 -208
  109. package/.agents/scripts/lib/orchestration/resolve-stories.js +5 -15
  110. package/.agents/scripts/lib/orchestration/review-providers/codex.js +1 -1
  111. package/.agents/scripts/lib/orchestration/review-providers/mi-exemptions.js +130 -0
  112. package/.agents/scripts/lib/orchestration/review-providers/native.js +30 -16
  113. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +1 -1
  114. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +37 -26
  115. package/.agents/scripts/lib/orchestration/single-story-close/phases/conventional-subject.js +376 -0
  116. package/.agents/scripts/lib/orchestration/single-story-close/phases/normalize-pr-title.js +161 -151
  117. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +15 -3
  118. package/.agents/scripts/lib/orchestration/single-story-close/phases/pull-request.js +10 -15
  119. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +5 -0
  120. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-override.js +157 -0
  121. package/.agents/scripts/lib/orchestration/single-story-close/phases/worktree-reap.js +0 -14
  122. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +59 -25
  123. package/.agents/scripts/lib/orchestration/single-story-lease-guard.js +20 -31
  124. package/.agents/scripts/lib/orchestration/spec-spill.js +17 -3
  125. package/.agents/scripts/lib/orchestration/story-close/phases/review-core.js +7 -6
  126. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +2 -1
  127. package/.agents/scripts/lib/orchestration/task-body-validator.js +4 -1
  128. package/.agents/scripts/lib/orchestration/ticket-lease.js +28 -127
  129. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +1 -1
  130. package/.agents/scripts/lib/orchestration/ticketing/reads.js +5 -5
  131. package/.agents/scripts/lib/orchestration/ticketing/transition.js +5 -4
  132. package/.agents/scripts/lib/orchestration/verify-tier-repair.js +107 -0
  133. package/.agents/scripts/lib/qa/coverage-verdict.js +5 -87
  134. package/.agents/scripts/lib/signals/detectors/common.js +1 -1
  135. package/.agents/scripts/lib/signals/index.js +8 -6
  136. package/.agents/scripts/lib/signals/schema.js +20 -25
  137. package/.agents/scripts/lib/signals/write.js +8 -8
  138. package/.agents/scripts/lib/story-body/story-body.js +12 -59
  139. package/.agents/scripts/lib/temp-retention.js +1 -1
  140. package/.agents/scripts/lib/templates/decomposer-prompts.js +16 -14
  141. package/.agents/scripts/lib/ticket-body-sections.js +4 -5
  142. package/.agents/scripts/lib/worktree/lifecycle/merge-reachability.js +13 -45
  143. package/.agents/scripts/lib/worktree/lifecycle/reap.js +4 -5
  144. package/.agents/scripts/lib/worktree-manager.js +2 -3
  145. package/.agents/scripts/lint-label-vocabulary.js +2 -24
  146. package/.agents/scripts/pr-watch-with-update.js +7 -5
  147. package/.agents/scripts/providers/github/cache.js +2 -2
  148. package/.agents/scripts/providers/github/comments.js +6 -28
  149. package/.agents/scripts/providers/github/compose.js +0 -15
  150. package/.agents/scripts/providers/github/errors.js +10 -27
  151. package/.agents/scripts/providers/github/request-helpers.js +1 -2
  152. package/.agents/scripts/providers/github/sub-issues.js +10 -218
  153. package/.agents/scripts/providers/github.js +4 -7
  154. package/.agents/scripts/prune-baseline-orphans.js +181 -0
  155. package/.agents/scripts/resolve-stories.js +0 -2
  156. package/.agents/scripts/run-lint.js +61 -61
  157. package/.agents/scripts/run-test-profile.js +6 -6
  158. package/.agents/scripts/run-verify.js +48 -30
  159. package/.agents/scripts/single-story-close.js +20 -0
  160. package/.agents/scripts/single-story-init.js +12 -35
  161. package/.agents/scripts/update-dead-exports-baseline.js +321 -0
  162. package/.agents/skills/core/gates-and-baselines/SKILL.md +2 -2
  163. package/.agents/skills/skills.index.json +1 -11
  164. package/.agents/workflows/audit-documentation.md +5 -6
  165. package/.agents/workflows/audit-to-stories.md +2 -2
  166. package/.agents/workflows/helpers/audit-lens-core.md +11 -12
  167. package/.agents/workflows/helpers/code-quality-guardrails.md +15 -14
  168. package/.agents/workflows/helpers/code-review.md +3 -8
  169. package/.agents/workflows/helpers/deliver-reference.md +2 -1
  170. package/.agents/workflows/helpers/deliver-story-reference.md +27 -16
  171. package/.agents/workflows/helpers/worktree-lifecycle.md +1 -2
  172. package/.agents/workflows/mandrel-update.md +10 -10
  173. package/.agents/workflows/qa-assist.md +15 -20
  174. package/.agents/workflows/qa-explore.md +9 -8
  175. package/README.md +1 -1
  176. package/docs/CHANGELOG.md +42 -0
  177. package/lib/migrations/index.js +2 -0
  178. package/lib/migrations/steps/2.32.0-retire-lint-baseline-command.js +127 -0
  179. package/package.json +12 -3
  180. package/.agents/schemas/lifecycle/checkpoint.written.schema.json +0 -13
  181. package/.agents/schemas/lifecycle/close-validate.end.schema.json +0 -18
  182. package/.agents/schemas/lifecycle/close-validate.start.schema.json +0 -13
  183. package/.agents/schemas/lifecycle/code-review.end.schema.json +0 -30
  184. package/.agents/schemas/lifecycle/code-review.start.schema.json +0 -12
  185. package/.agents/schemas/lifecycle/intervention.recorded.schema.json +0 -15
  186. package/.agents/schemas/lifecycle/loop.tick.schema.json +0 -20
  187. package/.agents/schemas/lifecycle/notification.emitted.schema.json +0 -18
  188. package/.agents/schemas/lifecycle/pr.created.schema.json +0 -14
  189. package/.agents/schemas/lifecycle/retro.end.schema.json +0 -16
  190. package/.agents/schemas/lifecycle/retro.start.schema.json +0 -12
  191. package/.agents/schemas/lifecycle/story.blocked.schema.json +0 -13
  192. package/.agents/schemas/lifecycle/story.dispatch.end.schema.json +0 -17
  193. package/.agents/schemas/lifecycle/story.dispatch.start.schema.json +0 -15
  194. package/.agents/schemas/lifecycle/story.merged.schema.json +0 -13
  195. package/.agents/scripts/check-gherkin-placeholders.js +0 -663
  196. package/.agents/scripts/check-lifecycle-doc-drift.js +0 -411
  197. package/.agents/scripts/lib/audit-suite/cli.js +0 -64
  198. package/.agents/scripts/lib/bootstrap/baselines-layout-migration.js +0 -202
  199. package/.agents/scripts/lib/bootstrap/ci-workflow-template.js +0 -212
  200. package/.agents/scripts/lib/checks/baseline-drift-main-checkout.js +0 -104
  201. package/.agents/scripts/lib/checks/push-hook-parity.js +0 -106
  202. package/.agents/scripts/lib/checks/windows-coverage-noise-floor.js +0 -92
  203. package/.agents/scripts/lib/checks/worktree-bootstrap-env.js +0 -81
  204. package/.agents/scripts/lib/checks/worktree-residue-biome.js +0 -55
  205. package/.agents/scripts/lib/crap-baseline-index.js +0 -46
  206. package/.agents/scripts/lib/crap-utils-incremental.js +0 -113
  207. package/.agents/scripts/lib/dynamic-workflow/capability.js +0 -396
  208. package/.agents/scripts/lib/feedback-loop/audit-results-graduator.js +0 -335
  209. package/.agents/scripts/lib/mutation/baseline-snapshot.js +0 -239
  210. package/.agents/scripts/lib/mutation/config-detector.js +0 -119
  211. package/.agents/scripts/lib/mutation/stryker-runner.js +0 -306
  212. package/.agents/scripts/lib/mutation/survivor-report.js +0 -160
  213. package/.agents/scripts/lib/observability/active-story-env.js +0 -170
  214. package/.agents/scripts/lib/observability/tool-trace-hook.js +0 -456
  215. package/.agents/scripts/lib/orchestration/acceptance-clusters.js +0 -111
  216. package/.agents/scripts/lib/orchestration/context-envelope.js +0 -277
  217. package/.agents/scripts/lib/orchestration/detectors-phase.js +0 -194
  218. package/.agents/scripts/lib/orchestration/lifecycle/bus.js +0 -309
  219. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +0 -181
  220. package/.agents/scripts/lib/orchestration/lifecycle/ledger-writer.js +0 -229
  221. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +0 -54
  222. package/.agents/scripts/lib/orchestration/lifecycle/trace-logger.js +0 -344
  223. package/.agents/scripts/lib/orchestration/lint-baseline-service.js +0 -114
  224. package/.agents/scripts/lib/orchestration/pr-base-guard.js +0 -37
  225. package/.agents/scripts/lib/orchestration/resolves-token.js +0 -127
  226. package/.agents/scripts/lib/orchestration/spec-section-validator.js +0 -130
  227. package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +0 -55
  228. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +0 -211
  229. package/.agents/scripts/lib/planning-corpus.js +0 -37
  230. package/.agents/scripts/lib/qa/coverage-report.js +0 -181
  231. package/.agents/scripts/lib/qa/propose-missing-test.js +0 -95
  232. package/.agents/scripts/lib/qa/qa-context-hydrator.js +0 -217
  233. package/.agents/scripts/lib/signals/detectors/index.js +0 -14
  234. package/.agents/scripts/lib/signals/detectors/retry.js +0 -253
  235. package/.agents/scripts/lib/signals/detectors/rework.js +0 -167
  236. package/.agents/scripts/lib/signals/read.js +0 -268
  237. package/.agents/scripts/lib/signals/span-tree.js +0 -291
  238. package/.agents/scripts/lib/story-lifecycle.js +0 -194
  239. package/.agents/scripts/lib/story-plan.js +0 -379
  240. package/.agents/scripts/lib/util/phase-timer-state.js +0 -72
  241. package/.agents/scripts/lib/util/phase-timer.js +0 -163
  242. package/.agents/scripts/lib/workers/combined-mi-crap-worker.js +0 -169
  243. package/.agents/scripts/lint-baseline.js +0 -507
  244. package/.agents/scripts/providers/github/prs.js +0 -103
  245. package/.agents/scripts/signals-view.js +0 -309
  246. package/.agents/scripts/story-plan.js +0 -370
  247. package/.agents/scripts/sync-branch-from-base.js +0 -149
  248. package/.agents/scripts/validate-docs-freshness.js +0 -314
  249. package/.agents/skills/core/diagnose-friction/SKILL.md +0 -78
  250. package/.agents/workflows/helpers/signals.md +0 -112
@@ -7,12 +7,17 @@
7
7
  // resolved QUALITY_SCHEMA is byte-for-byte equivalent in effect.
8
8
  // ---------------------------------------------------------------------------
9
9
 
10
+ import { GATES_SCHEMA } from './config/gates/index.js';
10
11
  // `delivery.quality.gates.<tier>` sub-schemas live in their own module
11
12
  // (Story #1737); see `config/gates/index.js` for the seven gate shapes
12
13
  // and the shared { kind, value } tolerance + workspace-keyed floors
13
14
  // fragments. Story #2987 split the former `config-gates-schema.js`
14
15
  // aggregate into per-gate files under `config/gates/`.
15
- import { GATES_SCHEMA } from './config/gates/index.js';
16
+ import {
17
+ BASELINE_EPSILON_DEFAULTS,
18
+ CODING_GUARDRAILS_DEFAULTS,
19
+ } from './config/quality.js';
20
+ import { DEFAULT_CODE_REVIEW } from './config/runners.js';
16
21
 
17
22
  // Story #4531: miDropMustRefactor (here) and autoRefresh.miDropCap (below)
18
23
  // were retired. Both were schema-validated, defaulted, and resolved, but
@@ -25,20 +30,58 @@ import { GATES_SCHEMA } from './config/gates/index.js';
25
30
  // below means a leftover key is a hard AJV failure, not a silent no-op).
26
31
  const CODING_GUARDRAILS_SCHEMA = {
27
32
  type: 'object',
33
+ description:
34
+ 'Authoring-time cyclomatic-complexity advisories surfaced by the quality-preview pre-commit gate.',
28
35
  properties: {
29
- cyclomaticFlag: { type: 'integer', minimum: 1 },
30
- cyclomaticMustFix: { type: 'integer', minimum: 1 },
31
- requireSiblingTest: { type: 'boolean' },
36
+ cyclomaticFlag: {
37
+ type: 'integer',
38
+ minimum: 1,
39
+ description:
40
+ 'Cyclomatic complexity at which a new or changed method is flagged for a refactor look.',
41
+ default: CODING_GUARDRAILS_DEFAULTS.cyclomaticFlag,
42
+ },
43
+ cyclomaticMustFix: {
44
+ type: 'integer',
45
+ minimum: 1,
46
+ description:
47
+ 'Cyclomatic complexity at which a new or changed method must be decomposed before the diff closes.',
48
+ default: CODING_GUARDRAILS_DEFAULTS.cyclomaticMustFix,
49
+ },
50
+ requireSiblingTest: {
51
+ type: 'boolean',
52
+ description:
53
+ 'When true, a new source file with no colocated sibling test is reported by the guardrails pass.',
54
+ default: CODING_GUARDRAILS_DEFAULTS.requireSiblingTest,
55
+ },
32
56
  },
33
57
  additionalProperties: false,
34
58
  };
35
59
 
36
60
  const AUTO_REFRESH_SCHEMA = {
37
61
  type: 'object',
62
+ description:
63
+ 'Baseline-attribution auto-refresh: when a gate can prove a regression is a legitimate consequence of the diff, it rewrites the baseline instead of blocking.',
38
64
  properties: {
39
- enabled: { type: 'boolean' },
40
- crapJumpCap: { type: 'number', minimum: 0 },
41
- scope: { type: 'string', enum: ['diff', 'full'] },
65
+ enabled: {
66
+ type: 'boolean',
67
+ description:
68
+ 'Master switch for the auto-refresh path. When false, every baseline refresh is a deliberate operator action.',
69
+ default: true,
70
+ },
71
+ crapJumpCap: {
72
+ type: 'number',
73
+ minimum: 0,
74
+ description:
75
+ 'Largest single-row CRAP jump the auto-refresh will absorb. A larger jump is reported as a regression rather than rewritten.',
76
+ default: 5,
77
+ },
78
+ scope: {
79
+ type: 'string',
80
+ enum: ['diff', 'full'],
81
+ description:
82
+ 'Whether an auto-refresh rescores only the changed files (`diff`) or every file in the target dirs (`full`).',
83
+ default: 'diff',
84
+ },
42
85
  },
43
86
  additionalProperties: false,
44
87
  };
@@ -50,15 +93,49 @@ const AUTO_REFRESH_SCHEMA = {
50
93
  */
51
94
  const BASELINE_EPSILON_SCHEMA = {
52
95
  type: 'object',
96
+ description:
97
+ 'Per-kind epsilon for s-stability-epsilon (Story #1964). Sub-epsilon row deltas resolve to prior bytes so env variance does not rewrite the on-disk baseline.',
53
98
  properties: {
54
- maintainability: { type: 'number', minimum: 0 },
55
- crap: { type: 'number', minimum: 0 },
56
- coverage: { type: 'number', minimum: 0 },
57
- mutation: { type: 'number', minimum: 0 },
58
- lint: { type: 'number', minimum: 0 },
59
- lighthouse: { type: 'number', minimum: 0 },
60
- 'bundle-size': { type: 'number', minimum: 0 },
61
- duplication: { type: 'number', minimum: 0 },
99
+ maintainability: {
100
+ type: 'number',
101
+ minimum: 0,
102
+ default: BASELINE_EPSILON_DEFAULTS.maintainability,
103
+ },
104
+ crap: {
105
+ type: 'number',
106
+ minimum: 0,
107
+ default: BASELINE_EPSILON_DEFAULTS.crap,
108
+ },
109
+ coverage: {
110
+ type: 'number',
111
+ minimum: 0,
112
+ default: BASELINE_EPSILON_DEFAULTS.coverage,
113
+ },
114
+ mutation: {
115
+ type: 'number',
116
+ minimum: 0,
117
+ default: BASELINE_EPSILON_DEFAULTS.mutation,
118
+ },
119
+ lint: {
120
+ type: 'number',
121
+ minimum: 0,
122
+ default: BASELINE_EPSILON_DEFAULTS.lint,
123
+ },
124
+ lighthouse: {
125
+ type: 'number',
126
+ minimum: 0,
127
+ default: BASELINE_EPSILON_DEFAULTS.lighthouse,
128
+ },
129
+ 'bundle-size': {
130
+ type: 'number',
131
+ minimum: 0,
132
+ default: BASELINE_EPSILON_DEFAULTS['bundle-size'],
133
+ },
134
+ duplication: {
135
+ type: 'number',
136
+ minimum: 0,
137
+ default: BASELINE_EPSILON_DEFAULTS.duplication,
138
+ },
62
139
  },
63
140
  additionalProperties: false,
64
141
  };
@@ -72,8 +149,15 @@ const BASELINE_EPSILON_SCHEMA = {
72
149
  */
73
150
  const FORMAT_AUTOFIX_SCHEMA = {
74
151
  type: 'object',
152
+ description:
153
+ 'Bounded-timeout knob for the close-time `npx biome format --write` spawn (Story #2165). A SIGKILL fired at the budget boundary maps to exit 124 so the close orchestrator can flip the Story to `agent::blocked` with a friction comment.',
75
154
  properties: {
76
- timeoutMs: { type: 'integer', minimum: 1 },
155
+ timeoutMs: {
156
+ type: 'integer',
157
+ minimum: 1,
158
+ description: 'Timeout (ms) for the format-write spawn.',
159
+ default: 60000,
160
+ },
77
161
  },
78
162
  additionalProperties: false,
79
163
  };
@@ -89,12 +173,27 @@ const FORMAT_AUTOFIX_SCHEMA = {
89
173
  */
90
174
  export const QUALITY_SCHEMA = {
91
175
  type: 'object',
176
+ description:
177
+ 'Quality-gate configuration. Every gate lives under `gates.<tier>` and shares the same `{ enabled, baselinePath, tolerance, floors, components }` base; shared scoping lives at this block root.',
92
178
  properties: {
93
179
  gateScoping: {
94
180
  type: 'object',
181
+ description:
182
+ 'Shared scope applied to every gate that supports one, unless the gate overrides it.',
95
183
  properties: {
96
- scope: { type: 'string', enum: ['diff', 'full'] },
97
- diffRef: { type: 'string', minLength: 1 },
184
+ scope: {
185
+ type: 'string',
186
+ enum: ['diff', 'full'],
187
+ description:
188
+ 'Score only the files changed against `diffRef` (`diff`) or every file in the gate target dirs (`full`).',
189
+ default: 'diff',
190
+ },
191
+ diffRef: {
192
+ type: 'string',
193
+ minLength: 1,
194
+ description: 'Git ref the `diff` scope is computed against.',
195
+ default: 'main',
196
+ },
98
197
  },
99
198
  additionalProperties: false,
100
199
  },
@@ -111,17 +210,40 @@ export const QUALITY_SCHEMA = {
111
210
  // registered so an absent baseline artifact fails close-validation with a
112
211
  // preflight hint (the fail-closed posture, analogous to
113
212
  // delivery.ci.requireChecks).
114
- requireBaselines: { type: 'boolean' },
213
+ requireBaselines: {
214
+ type: 'boolean',
215
+ description:
216
+ 'Story #4495. Fail-closed baseline-enforcement policy for the unified check-baselines close-validation gate. When false (default), a consumer that enables baseline gates (crap/maintainability/…) but has not committed the corresponding baseline artifacts under baselines/ gets a clean skip-with-reason instead of a deterministic first-try close failure. Set true to keep the gate registered so an absent baseline artifact fails close-validation with a preflight hint naming the fix (the fail-closed posture).',
217
+ default: false,
218
+ },
115
219
  // Navigability lens + post-wave integration gate config (Epic #4131,
116
220
  // F2/F3/F1/F4). Read by audit-suite/selector.js (route globs) and the
117
221
  // deliver-epic.md Phase 6.5 gate (journey suite). Opt-in: absent or empty
118
222
  // routeGlobs degrades to a silent no-op.
119
223
  navigability: {
120
224
  type: 'object',
225
+ description:
226
+ "Navigability lens + journey-suite config (Epic #4131, F2/F3/F1/F4). Read by audit-suite/selector.js (route globs) and /deliver's per-Story ceremony (journey suite). Opt-in: absent or empty routeGlobs degrades to a silent no-op.",
121
227
  properties: {
122
- routeGlobs: { type: 'array', items: { type: 'string' } },
123
- navRegistry: { type: 'array', items: { type: 'string' } },
124
- journeySuite: { type: 'string' },
228
+ routeGlobs: {
229
+ type: 'array',
230
+ items: { type: 'string' },
231
+ description:
232
+ 'Glob patterns (pages/**, app/**/route.ts) marking paths that add a user-facing route — the route-tree SSOT the navigability lens enumerates and the route-added routing predicate matches against.',
233
+ default: [],
234
+ },
235
+ navRegistry: {
236
+ type: 'array',
237
+ items: { type: 'string' },
238
+ description:
239
+ 'Tokens identifying the nav-registry SSOT the navigability lens checks every route resolves a nav door against.',
240
+ default: [],
241
+ },
242
+ journeySuite: {
243
+ type: 'string',
244
+ description:
245
+ "Path or command for the per-persona journey suite /deliver's per-Story ceremony runs.",
246
+ },
125
247
  },
126
248
  additionalProperties: false,
127
249
  },
@@ -140,6 +262,8 @@ export const QUALITY_SCHEMA = {
140
262
  */
141
263
  export const CODE_REVIEW_SCHEMA = {
142
264
  type: 'object',
265
+ description:
266
+ 'Review-provider chain plus bounded-retry knobs for the /deliver code-review ceremony.',
143
267
  properties: {
144
268
  // Story #2825 (Epic #2815) seeded the pluggable review backend
145
269
  // with `native`; Story #2830 added `codex` (the
@@ -163,21 +287,42 @@ export const CODE_REVIEW_SCHEMA = {
163
287
  name: {
164
288
  type: 'string',
165
289
  enum: ['native', 'codex', 'security-review', 'ultrareview'],
290
+ description:
291
+ 'Registered provider key. Inline: native, codex, security-review. Manual-prompt: ultrareview.',
166
292
  },
167
293
  scopes: {
168
294
  type: 'array',
169
295
  items: { type: 'string', enum: ['story', 'epic'] },
296
+ description:
297
+ 'Invocation scopes this entry fires on. Default (omitted) is both.',
298
+ },
299
+ optional: {
300
+ type: 'boolean',
301
+ default: false,
302
+ description:
303
+ 'When true, construction failure (host missing CLI/plugin) is logged and the entry is skipped instead of hard-failing the chain. Use for cross-runtime portability.',
304
+ },
305
+ manualPrompt: {
306
+ type: 'boolean',
307
+ default: false,
308
+ description:
309
+ 'When true, the entry is loaded from the manual-prompt registry: contributes a one-line operator suggestion via `renderPrompt()` instead of running a review via `runReview()`. Does not affect severity counts or `halted`.',
170
310
  },
171
- optional: { type: 'boolean', default: false },
172
- manualPrompt: { type: 'boolean', default: false },
173
311
  when: {
174
312
  type: 'object',
313
+ description:
314
+ "Optional label-gated invocation predicate. Evaluated against the ticket's current labels at invocation time; when false, the entry is silently skipped for this run.",
175
315
  properties: {
176
- label: { type: 'string', minLength: 1 },
316
+ label: {
317
+ type: 'string',
318
+ minLength: 1,
319
+ description: 'Single label that MUST be present on the ticket.',
320
+ },
177
321
  labelAny: {
178
322
  type: 'array',
179
323
  items: { type: 'string', minLength: 1 },
180
324
  minItems: 1,
325
+ description: 'Run when ANY of the listed labels is present.',
181
326
  },
182
327
  },
183
328
  additionalProperties: false,
@@ -185,11 +330,46 @@ export const CODE_REVIEW_SCHEMA = {
185
330
  },
186
331
  additionalProperties: false,
187
332
  },
333
+ description:
334
+ 'Review-provider chain (Story #2871). When unset or empty, defaults to [{ name: "native" }]. The orchestrator iterates inline entries in declaration order and merges their Finding[] before posting one structured comment; manual-prompt entries (e.g. ultrareview) contribute a trailing \'Manual review suggestions\' section. Selecting an adapter whose probe fails hard-fails at factory construction unless declared `optional: true` in the chain.',
335
+ default: [
336
+ { name: 'native' },
337
+ { name: 'security-review', scopes: ['story'], optional: true },
338
+ {
339
+ name: 'ultrareview',
340
+ scopes: ['story'],
341
+ manualPrompt: true,
342
+ when: { label: 'risk::high' },
343
+ },
344
+ ],
345
+ },
346
+ providerConfig: {
347
+ type: 'object',
348
+ additionalProperties: true,
349
+ description:
350
+ 'Optional escape hatch for adapter-specific configuration. No documented keys in Epic #2815; reserved so future adapters can be configured without another schema migration.',
351
+ },
352
+ maxFixAttempts: {
353
+ type: 'integer',
354
+ minimum: 0,
355
+ description:
356
+ 'Maximum auto-fix retry attempts per finding in /deliver Phase 5 (code-review). 0 disables auto-fix. Default 3.',
357
+ default: DEFAULT_CODE_REVIEW.maxFixAttempts,
358
+ },
359
+ maxFixScopeFiles: {
360
+ type: 'integer',
361
+ minimum: 1,
362
+ description:
363
+ 'Maximum file count a single auto-fix may modify before escalating to agent::blocked. Default 5.',
364
+ default: DEFAULT_CODE_REVIEW.maxFixScopeFiles,
365
+ },
366
+ autoFixSeverity: {
367
+ type: 'string',
368
+ enum: ['high', 'medium'],
369
+ description:
370
+ 'Severity threshold for on-branch remediation in /deliver Phase 5 (code-review). `medium` (default) routes 🔴/🟠/🟡 findings into the host-LLM focused-fix routing (Mediums batched per lens: one commit per lens, a single validation + rescan at the end) while 🟢 suggestions still graduate to follow-up issues; `high` reproduces the pre-4399 Critical/High-only routing. Hard cutover — no back-compat flag.',
371
+ default: DEFAULT_CODE_REVIEW.autoFixSeverity,
188
372
  },
189
- providerConfig: { type: 'object', additionalProperties: true },
190
- maxFixAttempts: { type: 'integer', minimum: 0 },
191
- maxFixScopeFiles: { type: 'integer', minimum: 1 },
192
- autoFixSeverity: { type: 'string', enum: ['high', 'medium'] },
193
373
  },
194
374
  additionalProperties: false,
195
375
  };