mandrel 2.96.0 → 2.98.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 (32) hide show
  1. package/.agents/audit-checklists/policies.md +23 -0
  2. package/.agents/docs/agentrc-reference.json +2 -5
  3. package/.agents/docs/configuration.md +8 -6
  4. package/.agents/docs/workflows.md +2 -1
  5. package/.agents/schemas/agentrc.schema.json +46 -29
  6. package/.agents/schemas/audit-rules.json +32 -0
  7. package/.agents/schemas/audit-rules.schema.json +2 -2
  8. package/.agents/scripts/lib/audit-suite/selector.js +119 -27
  9. package/.agents/scripts/lib/audit-to-stories/audit-lenses.js +1 -0
  10. package/.agents/scripts/lib/baselines/duplication-scanner.js +44 -3
  11. package/.agents/scripts/lib/baselines/refresh-service.js +54 -14
  12. package/.agents/scripts/lib/config/explain.js +1 -7
  13. package/.agents/scripts/lib/config/gates/duplication.schema.js +12 -5
  14. package/.agents/scripts/lib/config-settings-schema-quality.js +0 -27
  15. package/.agents/scripts/lib/config-settings-schema.js +30 -0
  16. package/.agents/scripts/lib/generated/agentrc-validator.js +2 -2
  17. package/.agents/scripts/lib/orchestration/review-providers/code-review.js +2 -14
  18. package/.agents/scripts/lib/orchestration/review-providers/generated-diff.js +61 -0
  19. package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-gate-steps.js +3 -1
  20. package/.agents/scripts/lib/orchestration/story-close/baseline-upward-writeback.js +1 -1
  21. package/.agents/scripts/lib/orchestration/story-close/commit-body.js +100 -0
  22. package/.agents/scripts/lib/orchestration/story-close/context-budget-writeback.js +1 -1
  23. package/.agents/scripts/lib/orchestration/story-close/duplication-close-rescore.js +20 -5
  24. package/.agents/scripts/lib/orchestration/story-close/ratchet-shrink-writeback.js +1 -1
  25. package/.agents/scripts/lib/source-extensions.js +3 -2
  26. package/.agents/workflows/audit-documentation.md +5 -0
  27. package/.agents/workflows/audit-policies.md +221 -0
  28. package/docs/CHANGELOG.md +16 -0
  29. package/lib/migrations/index.js +2 -0
  30. package/lib/migrations/steps/2.91.0-retire-duplication-formats.js +65 -9
  31. package/lib/migrations/steps/2.97.0-retire-quality-navigability.js +80 -0
  32. package/package.json +1 -1
@@ -1,19 +1,34 @@
1
1
  // lib/migrations/steps/2.91.0-retire-duplication-formats.js
2
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.
3
+ * Retire `delivery.quality.gates.duplication.formats` (the scorable formats
4
+ * now derive from the scorable-extension list). Entries outside that list move
5
+ * into `additionalFormats` so the upgrade keeps measuring them; an emptied
6
+ * `duplication` block is pruned.
7
7
  */
8
8
 
9
- import { createRetireAgentrcKeyStep } from '../helpers/retire-agentrc-key.js';
9
+ import nodeFs from 'node:fs';
10
+ import {
11
+ AGENTRC_FILENAMES,
12
+ createRetireAgentrcKeyStep,
13
+ readAgentrcConfig,
14
+ resolveAgentrcPath,
15
+ } from '../helpers/retire-agentrc-key.js';
10
16
 
11
- export const retireDuplicationFormats = createRetireAgentrcKeyStep({
17
+ /** A 2.91.0 snapshot, not an import: migrations run builtins-only. */
18
+ const SCORABLE_FORMATS = Object.freeze([
19
+ 'javascript',
20
+ 'jsx',
21
+ 'typescript',
22
+ 'tsx',
23
+ ]);
24
+
25
+ const retireFormats = createRetireAgentrcKeyStep({
12
26
  version: '2.91.0',
13
27
  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)',
28
+ 'move non-scorable delivery.quality.gates.duplication.formats entries ' +
29
+ 'into additionalFormats, then strip the retired key from .agentrc.json ' +
30
+ 'and .agentrc.local.json (the scorable jscpd formats now derive from ' +
31
+ 'the scorable-extension list — Stories #5738, #5849)',
17
32
  keys: [
18
33
  {
19
34
  path: ['delivery', 'quality', 'gates', 'duplication', 'formats'],
@@ -21,3 +36,44 @@ export const retireDuplicationFormats = createRetireAgentrcKeyStep({
21
36
  },
22
37
  ],
23
38
  });
39
+
40
+ /**
41
+ * @param {object | null} config
42
+ * @returns {{ duplication: object, extra: string[] } | null}
43
+ */
44
+ function nonScorableFormats(config) {
45
+ const duplication = config?.delivery?.quality?.gates?.duplication;
46
+ if (!Array.isArray(duplication?.formats)) return null;
47
+ const extra = duplication.formats.filter(
48
+ (name) => typeof name === 'string' && !SCORABLE_FORMATS.includes(name),
49
+ );
50
+ return extra.length > 0 ? { duplication, extra } : null;
51
+ }
52
+
53
+ /** Leaves `formats` itself for the retire step to strip. */
54
+ function carryNonScorableFormats(ctx) {
55
+ const fsImpl = ctx?.fs ?? nodeFs;
56
+ for (const filename of AGENTRC_FILENAMES) {
57
+ const config = readAgentrcConfig(ctx, filename, fsImpl);
58
+ const found = nonScorableFormats(config);
59
+ if (!found) continue;
60
+ const prior = Array.isArray(found.duplication.additionalFormats)
61
+ ? found.duplication.additionalFormats
62
+ : [];
63
+ found.duplication.additionalFormats = [
64
+ ...new Set([...prior, ...found.extra]),
65
+ ];
66
+ fsImpl.writeFileSync(
67
+ resolveAgentrcPath(ctx, filename),
68
+ `${JSON.stringify(config, null, 2)}\n`,
69
+ );
70
+ }
71
+ }
72
+
73
+ export const retireDuplicationFormats = {
74
+ ...retireFormats,
75
+ apply(ctx) {
76
+ carryNonScorableFormats(ctx);
77
+ retireFormats.apply(ctx);
78
+ },
79
+ };
@@ -0,0 +1,80 @@
1
+ // lib/migrations/steps/2.97.0-retire-quality-navigability.js
2
+ /**
3
+ * Retire the `delivery.quality.navigability` block. The route
4
+ * tree and nav registry have one home, `planning.navigation`, which the plan
5
+ * reachability gate, the navigability lens and the audit selector all read;
6
+ * `journeySuite` and this block's `navRegistry` had no reader. Values are not
7
+ * moved — that would switch on the plan-time reachability gate — so a value
8
+ * `planning.navigation` does not already carry is reported as a behaviour
9
+ * change instead.
10
+ */
11
+
12
+ import nodeFs from 'node:fs';
13
+ import {
14
+ AGENTRC_FILENAMES,
15
+ createRetireAgentrcKeyStep,
16
+ readAgentrcConfig,
17
+ } from '../helpers/retire-agentrc-key.js';
18
+
19
+ const BLOCK = ['delivery', 'quality', 'navigability'];
20
+
21
+ /** The planning.navigation sibling that now owns each key; null = no reader. */
22
+ const SUCCESSORS = Object.freeze({
23
+ routeGlobs: 'routeGlobs',
24
+ navRegistry: 'navRegistry',
25
+ journeySuite: null,
26
+ });
27
+
28
+ const retireBlock = createRetireAgentrcKeyStep({
29
+ version: '2.97.0',
30
+ description:
31
+ 'strip delivery.quality.navigability from .agentrc.json and ' +
32
+ '.agentrc.local.json — route globs and the nav registry live under ' +
33
+ 'planning.navigation, and journeySuite had no reader (Story #5850)',
34
+ keys: Object.keys(SUCCESSORS).map((key) => ({
35
+ path: [...BLOCK, key],
36
+ pruneDepth: 1,
37
+ })),
38
+ });
39
+
40
+ /**
41
+ * @param {string} filename
42
+ * @param {object} config
43
+ * @returns {string[]}
44
+ */
45
+ function reportLines(filename, config) {
46
+ const block = config?.delivery?.quality?.navigability;
47
+ if (!block || typeof block !== 'object') return [];
48
+ const planning = config?.planning?.navigation ?? {};
49
+ const lines = [];
50
+ for (const [key, successor] of Object.entries(SUCCESSORS)) {
51
+ if (!Object.hasOwn(block, key)) continue;
52
+ const dotted = `${BLOCK.join('.')}.${key}`;
53
+ const value = JSON.stringify(block[key]);
54
+ if (successor === null) {
55
+ lines.push(` removed ${filename} ${dotted}; it had no reader`);
56
+ } else if (JSON.stringify(planning[successor]) === value) {
57
+ lines.push(
58
+ ` removed ${filename} ${dotted}; planning.navigation.${successor} already carries it`,
59
+ );
60
+ } else {
61
+ lines.push(
62
+ ` behaviour change: ${filename} set ${dotted} = ${value}; set planning.navigation.${successor} to keep it`,
63
+ );
64
+ }
65
+ }
66
+ return lines;
67
+ }
68
+
69
+ export const retireQualityNavigability = {
70
+ ...retireBlock,
71
+ apply(ctx) {
72
+ const fsImpl = ctx?.fs ?? nodeFs;
73
+ const log = ctx?.log ?? console.log;
74
+ for (const filename of AGENTRC_FILENAMES) {
75
+ const config = readAgentrcConfig(ctx, filename, fsImpl);
76
+ for (const line of reportLines(filename, config)) log(line);
77
+ }
78
+ retireBlock.apply(ctx);
79
+ },
80
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mandrel",
3
- "version": "2.96.0",
3
+ "version": "2.98.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/",