@sabaiway/agent-workflow-kit 23.9.0 → 23.11.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 (39) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +1 -1
  4. package/bridges/codex-cli-bridge/SKILL.md +5 -5
  5. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +3 -2
  6. package/bridges/codex-cli-bridge/bin/codex-exec.sh +6 -6
  7. package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +5 -5
  8. package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +29 -29
  9. package/bridges/codex-cli-bridge/bin/codex-review-jev.test.mjs +3 -2
  10. package/bridges/codex-cli-bridge/bin/codex-review.sh +6 -6
  11. package/bridges/codex-cli-bridge/bin/codex-review.test.mjs +6 -6
  12. package/bridges/codex-cli-bridge/capability.json +4 -4
  13. package/bridges/codex-cli-bridge/references/driving-codex.md +1 -1
  14. package/bridges/codex-cli-bridge/references/sandbox-and-flags.md +2 -2
  15. package/bridges/codex-cli-bridge/setup/README.md +1 -1
  16. package/capability.json +1 -1
  17. package/package.json +1 -1
  18. package/references/modes/bridge-settings.md +2 -2
  19. package/references/modes/gates.md +1 -1
  20. package/references/modes/now.md +1 -1
  21. package/references/modes/procedures.md +1 -1
  22. package/references/modes/recommendations.md +2 -2
  23. package/tools/gates-init.mjs +3 -3
  24. package/tools/now-render.mjs +1 -1
  25. package/tools/procedures.mjs +5 -11
  26. package/tools/recommendations.mjs +4 -4
  27. package/tools/source-size/help.mjs +8 -7
  28. package/tools/source-size/index.mjs +1 -0
  29. package/tools/source-size/limits.mjs +8 -2
  30. package/tools/source-size/piles.mjs +2 -2
  31. package/tools/source-size/reason.mjs +0 -1
  32. package/tools/source-size/record.mjs +6 -13
  33. package/tools/source-size/setup.mjs +2 -2
  34. package/tools/source-size-config.mjs +29 -41
  35. package/tools/source-size-core.mjs +3 -2
  36. package/tools/source-size-judge.mjs +11 -28
  37. package/tools/source-size-refusal.mjs +1 -1
  38. package/tools/source-size-report.mjs +24 -27
  39. package/tools/source-size-runs.mjs +31 -24
@@ -1,17 +1,18 @@
1
1
  // source-size-config.mjs — the practice's declaration: what docs/ai/source-size.json may say, which
2
- // of its four states it is in, and how it is read back. Nothing here touches the tree.
2
+ // of its three states it is in, and how it is read back. Nothing here touches the tree.
3
3
  //
4
- // • CONFIG STATES — ABSENT (no entry at the path) / AUTHORED (authored keys, machine keys absent) /
5
- // INCOMPLETE (one machine key without the other — a hand-edited half, which routes to the mint
6
- // lane) / MINTED (both machine keys). A malformed or unknown-keyed config is a loud STOP
4
+ // • CONFIG STATES — ABSENT (no entry at the path) / AUTHORED (no `baseline`) / MINTED (`baseline`
5
+ // present). A malformed or unknown-keyed config is a loud STOP
7
6
  // (exit 2), never a guess, and the template placeholders are REFUSED until replaced, so a
8
7
  // printed authoring template can never be pasted into an empty-green scope.
9
8
  // • A RECORDED size is debt, not permission: every entry carries a reason, and the reason lands
10
9
  // verbatim in the JSON, the commit message and the release CHANGELOG — so it is validated as the
11
10
  // single line those three surfaces can carry.
12
- // • SCHEMAS — 2 is the shape: the kit's limits live in its code (tools/source-size/), the config
13
- // holds the scope, the record and a project's reasoned overrides. 1 is still read strictly and
14
- // resolved in memory by the very transform the writer moves it with; a read writes nothing.
11
+ // • SCHEMAS — 3 is the shape: the kit's limits live in its code (tools/source-size/), the config
12
+ // holds the scope, the record and a project's reasoned overrides. 2 is read as 3, the per-root
13
+ // line sum it recorded (`aggregate`) judged by nothing and dropped by the next regeneration. 1 is
14
+ // still read strictly and resolved in memory by the very transform the writer moves it with; a
15
+ // read writes nothing.
15
16
  //
16
17
  // Dependency-free, Node >= 22. No side effects on import.
17
18
 
@@ -20,7 +21,8 @@ import { isAbsolute } from 'node:path';
20
21
  import { SOURCE_SIZE_CONFIG_REL, configFail, configPathFor, isLineUnsafe } from './source-size-refusal.mjs';
21
22
  import { KIT_LIMITS, SPEC_STORE_ROOT, layoutDefect, limitsDefect, migrateSchema1, resolveLimits } from './source-size/index.mjs';
22
23
 
23
- export const SOURCE_SIZE_SCHEMA = 2;
24
+ export const SOURCE_SIZE_SCHEMA = 3;
25
+ const READ_SCHEMAS = Object.freeze([1, 2, SOURCE_SIZE_SCHEMA]);
24
26
  export const SOURCE_SIZE_DEFAULTS = Object.freeze({
25
27
  maxLines: KIT_LIMITS['lines-per-file'].value,
26
28
  maxLineBytes: KIT_LIMITS['bytes-per-line'].value,
@@ -34,8 +36,11 @@ export const KIT_FOLDER_ROOT = 'scripts/agent-workflow';
34
36
 
35
37
  export const AUTHORED_KEYS = Object.freeze(['_README', 'schema', 'roots', 'exclude', 'extensions', 'limits']);
36
38
  const SCHEMA1_AUTHORED_KEYS = Object.freeze(['_README', 'schema', 'defaults', 'roots', 'exclude', 'extensions']);
37
- export const MACHINE_KEYS = Object.freeze(['baseline', 'aggregate']);
38
- // The layout record is a machine key of its own, and no part of the state: MINTED means the two above.
39
+ // The machine key that decides the state: MINTED means it is present.
40
+ export const MACHINE_KEYS = Object.freeze(['baseline']);
41
+ // The per-root line sum schemas 1 and 2 recorded: a known key, read and judged by nothing.
42
+ export const RETIRED_SUM_KEY = 'aggregate';
43
+ // The layout record is a machine key of its own, and no part of the state.
39
44
  export const LAYOUT_KEY = 'layout';
40
45
  const ENTRY_KEYS = Object.freeze(['lines', 'maxLineBytes', 'reason']);
41
46
 
@@ -93,16 +98,13 @@ export const segmentPrefixOf = (prefix, path) => prefix === WHOLE_TREE_ROOT || p
93
98
  // practiceFacts(config) → the numbers every surface that SPEAKS for the practice states: the caps,
94
99
  // how much is declared, and how much is recorded. Derived in ONE place so the plan-time render and
95
100
  // the checker's own green line can never state two different counts of the same tree.
96
- // `recordedFiles` / `aggregateLines` are null while that machine half is absent — "not recorded at
97
- // all" is a different fact from "recorded as zero", and the two states read differently to a human.
101
+ // `recordedFiles` is null while `baseline` is absent — "not recorded at all" is a different fact
102
+ // from "recorded as zero", and the two states read differently to a human.
98
103
  export const practiceFacts = (config) => ({
99
104
  maxLines: config.defaults.maxLines,
100
105
  maxLineBytes: config.defaults.maxLineBytes,
101
106
  roots: config.roots.length,
102
107
  recordedFiles: config.baseline === null ? null : Object.keys(config.baseline).length,
103
- aggregateLines: config.aggregate === null
104
- ? null
105
- : Object.values(config.aggregate).reduce((sum, entry) => sum + entry.lines, 0),
106
108
  });
107
109
 
108
110
  // `requiredDimensions: 'any'` — a per-file record may pin EITHER dimension or both, because only the
@@ -161,16 +163,16 @@ const validateSchema1 = (parsed) => {
161
163
  // The keys each schema may carry. A key of the other schema is a stop named as such: a `defaults` on
162
164
  // schema 2 would be a second home for a kit value, and a `limits` on schema 1 a shape no writer made.
163
165
  const keysDefect = (parsed) => {
164
- if (parsed.schema === 2 && Object.hasOwn(parsed, 'defaults')) {
166
+ if (parsed.schema !== 1 && Object.hasOwn(parsed, 'defaults')) {
165
167
  return '"defaults" is a schema-1 key — the kit\'s limits live in the kit\'s code, and a project states its own number as a reasoned override under "limits"';
166
168
  }
167
169
  if (parsed.schema === 1 && Object.hasOwn(parsed, 'limits')) {
168
- return '"limits" is a schema-2 key — a schema-1 config states its numbers under "defaults"; --write-baseline moves it to schema 2';
170
+ return '"limits" is no schema-1 key — a schema-1 config states its numbers under "defaults"; --write-baseline moves it off schema 1';
169
171
  }
170
172
  if (parsed.schema === 1 && Object.hasOwn(parsed, LAYOUT_KEY)) {
171
- return '"layout" is a schema-2 key — a schema-1 config records no layout; --write-baseline moves it to schema 2';
173
+ return '"layout" is no schema-1 key — a schema-1 config records no layout; --write-baseline moves it off schema 1';
172
174
  }
173
- const known = new Set([...(parsed.schema === 1 ? SCHEMA1_AUTHORED_KEYS : [...AUTHORED_KEYS, LAYOUT_KEY]), ...MACHINE_KEYS]);
175
+ const known = new Set([...(parsed.schema === 1 ? SCHEMA1_AUTHORED_KEYS : [...AUTHORED_KEYS, LAYOUT_KEY]), ...MACHINE_KEYS, RETIRED_SUM_KEY]);
174
176
  const unknown = Object.keys(parsed).filter((k) => !known.has(k));
175
177
  return unknown.length === 0 ? null : `${SOURCE_SIZE_CONFIG_REL} carries unknown key(s): ${unknown.join(', ')} — known keys are ${[...known].join(', ')}`;
176
178
  };
@@ -179,8 +181,8 @@ const keysDefect = (parsed) => {
179
181
  // cannot judge — an unknown key included, because a typo'd key would otherwise disarm a rule.
180
182
  export const validateSourceSizeConfig = (parsed) => {
181
183
  if (!isPlainObject(parsed)) throw configFail(`${SOURCE_SIZE_CONFIG_REL} must contain a JSON object`);
182
- if (parsed.schema !== 1 && parsed.schema !== SOURCE_SIZE_SCHEMA) {
183
- throw configFail(`"schema" must be 1 or ${SOURCE_SIZE_SCHEMA}, got ${JSON.stringify(parsed.schema)}`);
184
+ if (!READ_SCHEMAS.includes(parsed.schema)) {
185
+ throw configFail(`"schema" must be one of ${READ_SCHEMAS.join(', ')}, got ${JSON.stringify(parsed.schema)}`);
184
186
  }
185
187
  const keys = keysDefect(parsed);
186
188
  if (keys) throw configFail(keys);
@@ -210,7 +212,7 @@ export const validateSourceSizeConfig = (parsed) => {
210
212
  for (const outer of roots) {
211
213
  for (const inner of roots) {
212
214
  if (outer !== inner && segmentPrefixOf(outer, inner)) {
213
- throw configFail(`"roots" entries overlap: "${inner}" sits inside "${outer}" — an overlapping root double-counts its files in the aggregate`);
215
+ throw configFail(`"roots" entries overlap: "${inner}" sits inside "${outer}" — an overlapping root counts its files twice in the layout record`);
214
216
  }
215
217
  }
216
218
  }
@@ -262,11 +264,9 @@ export const validateSourceSizeConfig = (parsed) => {
262
264
  };
263
265
  };
264
266
 
265
- // loadSourceSizeConfig(cwd) → { state, path, config, parsed, text, missingMachineKeys }. The states:
266
- // ABSENT (no file) / AUTHORED (no machine key) / INCOMPLETE (one machine key without the other — a
267
- // hand-edited half) / MINTED (both). `config` is null only in the ABSENT state; every other state
268
- // carries a fully validated config, INCOMPLETE included: the key that IS there is judged by the same
269
- // rules as ever. `parsed` and `text` are the file as written — the writer copies the authored VALUES
267
+ // loadSourceSizeConfig(cwd) → { state, path, config, parsed, text }. The states: ABSENT (no file) /
268
+ // AUTHORED (no `baseline`) / MINTED (`baseline` present). `config` is null only in the ABSENT state;
269
+ // every other state carries a fully validated config. `parsed` and `text` are the file as written — the writer copies the authored VALUES
270
270
  // (and their order) from `parsed`, and compares its own bytes against `text` to know whether it
271
271
  // actually changed anything.
272
272
  export const loadSourceSizeConfig = (cwd, deps = {}) => {
@@ -296,18 +296,6 @@ export const loadSourceSizeConfig = (cwd, deps = {}) => {
296
296
  throw configFail(`${path} is not valid JSON (${err.message}) — fix it by hand; a malformed config is a STOP, never a guess`);
297
297
  }
298
298
  const config = validateSourceSizeConfig(parsed);
299
- const present = MACHINE_KEYS.filter((key) => Object.hasOwn(parsed, key));
300
- // MINTED means the WHOLE machine half. A file carrying one machine key without the other is a
301
- // state no regenerator produces — it was hand-edited into it — so it is INCOMPLETE and routes to
302
- // the mint lane, which writes both. Refusing it as a config error would deadlock the only
303
- // self-service lane, because the regenerator reads its config through this very function.
304
- const state = present.length === MACHINE_KEYS.length ? 'minted' : present.length === 0 ? 'authored' : 'incomplete';
305
- return {
306
- state,
307
- path,
308
- config,
309
- parsed,
310
- text: raw,
311
- missingMachineKeys: MACHINE_KEYS.filter((key) => !present.includes(key)),
312
- };
299
+ const state = MACHINE_KEYS.every((key) => Object.hasOwn(parsed, key)) ? 'minted' : 'authored';
300
+ return { state, path, config, parsed, text: raw };
313
301
  };
@@ -5,7 +5,7 @@
5
5
  //
6
6
  // The halves, each holding ONE rule set and each within the cap this practice declares:
7
7
  // • source-size-refusal.mjs — the two exit classes, and the absolute config path every refusal names
8
- // • source-size-config.mjs — the config file: its grammar, its four states, its reader
8
+ // • source-size-config.mjs — the config file: its grammar, its three states, its reader
9
9
  // • source-size-scope.mjs — which files are judged (D-6) and how big each one is (D-7)
10
10
  // • source-size-gate-cmd.mjs — whether a declared gate cmd IS this checker (the canonical matcher),
11
11
  // and which of the three tool claims it makes when it is not
@@ -64,6 +64,7 @@ export {
64
64
  SCHEMA1_REASON,
65
65
  SPEC_STORE_ROOT,
66
66
  applyOverride,
67
+ atSchema,
67
68
  bandOf,
68
69
  changesFor,
69
70
  isRaise,
@@ -115,7 +116,7 @@ export { CHECKER_CLAIM } from './checker-claim.mjs';
115
116
 
116
117
  // readLayoutSetup(root, deps) → the layout setup's answer for a project, the one bound form the advisor
117
118
  // and the git-hooks leaf ask: the loader, the tree judge and its stop filter, the absent config the
118
- // check judges (schema 2 under the kit's values) and the reason the record's first entries take.
119
+ // check judges (the current schema under the kit's values) and the reason the record's first entries take.
119
120
  export const readLayoutSetup = (root, deps = {}) => layoutSetupOf(root, {
120
121
  loadSourceSizeConfig,
121
122
  judgeTree,
@@ -6,7 +6,8 @@
6
6
  // The ratchet (D-3, D-4): a recorded size is DEBT, not permission. Each limit is judged with its
7
7
  // band; a finding STOPS exactly when the regeneration would RAISE (beyond the band with no record, a
8
8
  // record that grew, an unrecorded root) and WARNS otherwise (within the band, a record above the
9
- // tree, no longer needed or gone). Each root's summed LINES ride the same ratchet with no band.
9
+ // tree, no longer needed or gone). No per-root line sum is judged: one an earlier schema recorded
10
+ // warns until the regeneration drops it.
10
11
  //
11
12
  // Dependency-free, Node >= 22. No writes, no side effects on import.
12
13
 
@@ -49,8 +50,9 @@ export const standingWarningsOf = (findings) => findings.flatMap((f) => {
49
50
  return kind && f.dimension !== 'depth' && f.actual > f.allowed && f.actual <= f.ceiling ? [{ ...f, kind }] : [];
50
51
  });
51
52
  export const hasLoweredRecord = (findings) => findings.some((f) => LOWERED_KINDS.has(f.kind));
52
- // The spec store's files count, recorded before files per root left the store: no decomposition, so no focus line.
53
- export const hasStoreRecord = (findings) => findings.some((f) => f.kind === 'store-record');
53
+ // Records nothing judges any more, the spec store's files count and an earlier schema's per-root line sum: no decomposition, so no focus line.
54
+ const DROPPED_KINDS = new Set(['store-record', 'sum-record']);
55
+ export const hasDroppedRecord = (findings) => findings.some((f) => DROPPED_KINDS.has(f.kind));
54
56
 
55
57
  // One rule for every recorded number: a raise stops, any other change warns. `kinds` names no record
56
58
  // yet, grew, lowered and no longer needed in the target's own vocabulary.
@@ -72,22 +74,6 @@ const fileFindings = (rel, measured, projected, recorded, limits) => {
72
74
  ];
73
75
  };
74
76
 
75
- const judgeAggregate = (rootLines, aggregate) => {
76
- const findings = [];
77
- for (const [root, actual] of rootLines) {
78
- const recorded = ownEntry(aggregate, root)?.lines;
79
- if (recorded === undefined) findings.push({ kind: 'aggregate-unrecorded', severity: STOP, root, actual });
80
- else if (actual > recorded) findings.push({ kind: 'aggregate-grew', severity: STOP, root, actual, recorded });
81
- else if (actual < recorded) findings.push({ kind: 'aggregate-stale', severity: WARNING, root, actual, recorded });
82
- }
83
- // The recorded set must MIRROR the declared roots: a budget nobody declares any more warns until
84
- // the writer drops it, and deleting an entry must never be a way to disarm it.
85
- for (const root of Object.keys(aggregate)) {
86
- if (!rootLines.has(root)) findings.push({ kind: 'aggregate-root-gone', severity: WARNING, root, recorded: aggregate[root].lines });
87
- }
88
- return findings;
89
- };
90
-
91
77
  // A directory is keyed by its repo-relative path, a root's own by its declared name. A name that is
92
78
  // not lossless UTF-8 is counted, and refused only once a record would have to carry it.
93
79
  const measureLayout = (cwd, config, scope, deps) => {
@@ -136,7 +122,7 @@ const directoryFindings = (directories, projected, recorded, limits) => {
136
122
  }
137
123
  for (const [dir, facts] of directories) {
138
124
  const was = ownEntry(recorded, dir);
139
- const changes = changesFor(dir, projected[dir] ?? {}, was, LAYOUT_DIMENSIONS);
125
+ const changes = changesFor(dir, ownEntry(projected, dir) ?? {}, was, LAYOUT_DIMENSIONS);
140
126
  const actual = { entries: facts.entries, depth: facts.reach };
141
127
  findings.push(...changes.map((change) => changeFinding({ dir }, change, actual[change.dimension], limits, DIR_KINDS)));
142
128
  const entries = limits['entries-per-directory'];
@@ -162,9 +148,9 @@ const judgeLayout = (cwd, config, scope, deps, { absent }) => {
162
148
  return { measured, projected, findings };
163
149
  };
164
150
 
165
- // judgeTree(cwd, config, deps, { layout, absent }) → { scope, measured, projected, rootLines, layout,
166
- // findings }. EVERY in-scope file is measured, recorded or not: an unreadable or non-UTF-8 file
167
- // refuses even when its size is recorded debt. An absent config's aggregate is no finding.
151
+ // judgeTree(cwd, config, deps, { layout, absent }) → { scope, measured, projected, layout, findings }.
152
+ // EVERY in-scope file is measured, recorded or not: an unreadable or non-UTF-8 file refuses even
153
+ // when its size is recorded debt.
168
154
  export const judgeTree = (cwd, config, deps = {}, { layout = false, absent = false } = {}) => {
169
155
  const scope = resolveScope(cwd, config, deps);
170
156
  const bytes = new Map();
@@ -175,14 +161,11 @@ export const judgeTree = (cwd, config, deps = {}, { layout = false, absent = fal
175
161
  for (const rel of Object.keys(baseline)) {
176
162
  if (!measured.has(rel)) findings.push({ kind: 'entry-gone', severity: WARNING, rel, recorded: baseline[rel] });
177
163
  }
178
- const rootLines = new Map(
179
- [...scope.perRoot].map(([root, files]) => [root, files.reduce((sum, rel) => sum + measured.get(rel).lines, 0)]),
180
- );
181
- if (!absent) findings.push(...judgeAggregate(rootLines, config.aggregate ?? {}));
164
+ if (config.aggregate !== null) findings.push({ kind: 'sum-record', severity: WARNING, roots: Object.keys(config.aggregate).length, schema: config.schema });
182
165
  const judged = layout ? judgeLayout(cwd, config, scope, deps, { absent }) : null;
183
166
  if (judged) findings.push(...judged.findings);
184
167
  const tree = workTreeOf(cwd, config, { scope, bytes, layout }, deps);
185
168
  findings.push(...Object.entries(WORK_TREE_KINDS).filter(([part]) => tree[part].length > 0)
186
169
  .map(([part, kind]) => ({ kind, severity: WARNING, paths: tree[part] })));
187
- return { scope, measured, projected, rootLines, layout: judged, findings };
170
+ return { scope, measured, projected, layout: judged, findings };
188
171
  };
@@ -25,7 +25,7 @@ export const SOURCE_SIZE_CONFIG_REL = 'docs/ai/source-size.json';
25
25
 
26
26
  // Quoted VERBATIM by every surface that explains the practice: the plan-time render, the checker's
27
27
  // rendered refusals, the constraints row a grounded review payload carries. The checker's GREEN line
28
- // states the practice's FACTS instead — caps, recorded count, aggregate — and never this sentence.
28
+ // states the practice's FACTS instead — caps, recorded count — and never this sentence.
29
29
  export const SOURCE_SIZE_WHY = 'A module you can hold whole is the unit of review, test pairing and safe edit; the caps turn size drift into recorded, reasoned debt instead of invisible growth.';
30
30
 
31
31
  // Every warning the check prints is one line under this anchored prefix, so the gate runner can echo
@@ -18,7 +18,7 @@
18
18
  import { SOURCE_SIZE_CONFIG_REL, SOURCE_SIZE_WARNING_PREFIX, SOURCE_SIZE_WHY, configPathFor, escapeForLine, isLineUnsafe, jsonForLine } from './source-size-refusal.mjs';
19
19
  import { KIT_FOLDER_ROOT, SOURCE_SIZE_SCHEMA, practiceFacts } from './source-size-config.mjs';
20
20
  import { SOURCE_SIZE_TOOL_PATH, dqUnsafePath } from './source-size-gate-cmd.mjs';
21
- import { hasLoweredRecord, hasStoreRecord, stopsOf, warningsOf } from './source-size-judge.mjs';
21
+ import { hasDroppedRecord, hasLoweredRecord, stopsOf, warningsOf } from './source-size-judge.mjs';
22
22
  import { GROWTH_REASON_PLACEHOLDER, INITIAL_ADOPTION_REASON, helpText, isRaise, limitLines, mintReasonOf } from './source-size/index.mjs';
23
23
 
24
24
  export { GROWTH_REASON_PLACEHOLDER };
@@ -28,11 +28,13 @@ export { GROWTH_REASON_PLACEHOLDER };
28
28
  // filesystem path the writer opens.
29
29
  const namedConfig = (cwd) => escapeForLine(configPathFor(cwd));
30
30
 
31
- // The `_README` the kit's schema-1 template carried, frozen: the move replaces a `_README` byte-equal
32
- // to it with the schema-2 text and carries any other verbatim.
31
+ // The `_README` texts the kit's schema-1 and schema-2 templates carried, frozen: a write replaces a
32
+ // `_README` byte-equal to one of them with the text of the schema it writes and carries any other verbatim.
33
33
  export const SCHEMA1_TEMPLATE_README = 'Source-size practice: declared scope + thresholds + the recorded ratchet. Authored keys: schema, defaults, roots, exclude, extensions. Machine keys: baseline, aggregate — each recorded entry carries a reason, and a recorded size is debt, not permission. Strict JSON — unknown keys refused.';
34
- export const TEMPLATE_README = 'Source-size practice: declared scope + the recorded ratchet; the limits are the kit\'s, kept in its code. Authored keys: schema, roots, exclude, extensions, limits (a project\'s reasoned overrides of a kit limit). Machine keys: baseline, aggregate, layout — each recorded entry carries a reason, and a recorded size is debt, not permission. Strict JSON — unknown keys refused.';
35
- export const TEMPLATE_READMES = Object.freeze({ schema1: SCHEMA1_TEMPLATE_README, schema2: TEMPLATE_README });
34
+ export const SCHEMA2_TEMPLATE_README = 'Source-size practice: declared scope + the recorded ratchet; the limits are the kit\'s, kept in its code. Authored keys: schema, roots, exclude, extensions, limits (a project\'s reasoned overrides of a kit limit). Machine keys: baseline, aggregate, layout — each recorded entry carries a reason, and a recorded size is debt, not permission. Strict JSON — unknown keys refused.';
35
+ export const TEMPLATE_README = 'Source-size practice: declared scope + the recorded ratchet; the limits are the kit\'s, kept in its code. Authored keys: schema, roots, exclude, extensions, limits (a project\'s reasoned overrides of a kit limit). Machine keys: baseline, layout — each recorded entry carries a reason, and a recorded size is debt, not permission. Strict JSON — unknown keys refused.';
36
+ export const TEMPLATE_READMES = Object.freeze({ schema1: SCHEMA1_TEMPLATE_README, schema2: SCHEMA2_TEMPLATE_README });
37
+ export const EARLIER_TEMPLATE_READMES = Object.freeze([SCHEMA1_TEMPLATE_README, SCHEMA2_TEMPLATE_README]);
36
38
 
37
39
  // The authoring template (D-5): GENERIC, and INERT by construction — its roots/extensions carry
38
40
  // placeholders the validator refuses, so it can never be pasted into an empty-green scope.
@@ -104,7 +106,7 @@ const refusal = (lines) => [...lines, WHY_LINE];
104
106
  // absent one records nothing to summarize.
105
107
  const practiceLine = (config) => {
106
108
  const facts = practiceFacts(config);
107
- return `source-size: practice — caps ${facts.maxLines} lines · ${facts.maxLineBytes} bytes per line over ${facts.roots} declared root(s) · ${facts.recordedFiles} file(s) carry a recorded size (debt, not permission) · aggregate ${facts.aggregateLines} line(s): growth past a record takes a reasoned bump, and a record above the tree or gone warns until the regeneration lowers or removes it.`;
109
+ return `source-size: practice — caps ${facts.maxLines} lines · ${facts.maxLineBytes} bytes per line over ${facts.roots} declared root(s) · ${facts.recordedFiles} file(s) carry a recorded size (debt, not permission): growth past a record takes a reasoned bump, and a record above the tree or gone warns until the regeneration lowers or removes it.`;
108
110
  };
109
111
 
110
112
  export const absentRefusalLines = (cwd) => refusal([
@@ -114,30 +116,26 @@ export const absentRefusalLines = (cwd) => refusal([
114
116
  authoringTemplate(),
115
117
  ]);
116
118
 
117
- // Both not-yet-MINTED states route to the same lane — the regenerator writes the machine half — so
118
- // they differ only in what they say happened: AUTHORED is the state a human creates, INCOMPLETE is a
119
- // machine half no regenerator produces, which means the file was hand-edited into it.
120
- const unmintedSentence = (cwd, { state, missing }) => state === 'incomplete'
121
- ? `${namedConfig(cwd)} is INCOMPLETE: it carries a machine half no regenerator produces (missing ${missing.map((key) => `"${key}"`).join(', ')}), so the ratchet holds only part of this tree.`
122
- : `${namedConfig(cwd)} is AUTHORED but not yet MINTED (it records no size yet), so there is nothing for the ratchet to hold.`;
119
+ // The one not-yet-MINTED state: no `baseline`, whatever else the file holds.
120
+ const unmintedSentence = (cwd) => `${namedConfig(cwd)} is AUTHORED but not yet MINTED (it holds no "baseline", the per-file record), so the ratchet holds no file of this tree.`;
123
121
  const MINT_LINE = 'Mint it — the regenerator records what this tree already carries; recording a value for the first time is a raise, so it takes a reason';
124
122
  const unmintedLane = (reason) => `Run source-size-check.mjs --write-baseline --reason "${reason}" with the working directory set to this project.`;
125
123
 
126
- export const unmintedRefusalLines = (cwd, { state, missing, config }) => {
124
+ export const unmintedRefusalLines = (cwd, { config }) => {
127
125
  const reason = mintReasonOf(config);
128
126
  const { command, withheld } = regenerator(cwd, reason);
129
127
  return refusal([
130
- `source-size: REFUSED — ${unmintedSentence(cwd, { state, missing })}`,
128
+ `source-size: REFUSED — ${unmintedSentence(cwd)}`,
131
129
  `${MINT_LINE}:`,
132
130
  command === null ? `${withheld} ${unmintedLane(reason)}` : ` ${command}`,
133
131
  ]);
134
132
  };
135
133
 
136
- export const unmintedStopBlock = (cwd, { state, missing, config }) => {
134
+ export const unmintedStopBlock = (cwd, { config }) => {
137
135
  const reason = mintReasonOf(config);
138
136
  const { command, withheld } = regenerator(cwd, reason);
139
137
  return {
140
- failed: escapeLeadingSpace(unmintedSentence(cwd, { state, missing }).slice(0, -1)),
138
+ failed: escapeLeadingSpace(unmintedSentence(cwd).slice(0, -1)),
141
139
  findings: [{ place: SOURCE_SIZE_CONFIG_REL, text: MINT_LINE }],
142
140
  remedies: [command ?? unmintedLane(reason)],
143
141
  after: refusal(command === null ? [withheld] : []),
@@ -157,6 +155,8 @@ const lineSafeFinding = (finding) => ({
157
155
  ...(finding.dir === undefined ? {} : { dir: escapeForLine(finding.dir) }),
158
156
  });
159
157
 
158
+ // Said before a write that moves the schema, in the deployed sum's warning, and after it, in the move line.
159
+ const PREDATING_KIT_STOPS = (schema) => `a kit that predates schema ${schema} stops by name until that copy is upgraded`;
160
160
  const BAND = (f) => `over the limit ${f.allowed} but within its band (up to ${f.ceiling})`;
161
161
  const NAMED_PATHS = 3;
162
162
  const namedPaths = (paths) => `${paths.slice(0, NAMED_PATHS).map(escapeForLine).join(', ')}${paths.length > NAMED_PATHS ? ` and ${paths.length - NAMED_PATHS} more` : ''}`;
@@ -165,8 +165,6 @@ const namedPaths = (paths) => `${paths.slice(0, NAMED_PATHS).map(escapeForLine).
165
165
  const FINDING_LINE = Object.freeze({
166
166
  'over-default': (f) => `${f.rel}: ${f.dimension} ${f.actual} exceeds the declared default ${f.allowed} beyond its band (up to ${f.ceiling})`,
167
167
  grew: (f) => `${f.rel}: ${f.dimension} ${f.actual} exceeds its recorded baseline ${f.recorded} — recorded debt is not permission to grow`,
168
- 'aggregate-grew': (f) => `${f.root}: aggregate lines ${f.actual} exceeds the recorded budget ${f.recorded} — splitting a file buys no aggregate headroom`,
169
- 'aggregate-unrecorded': (f) => `${f.root}: declared root carries NO recorded aggregate budget (${f.actual} lines measured) — the record must mirror the declared roots exactly`,
170
168
  'root-unrecorded': (f) => `${f.root}: declared root carries NO recorded files count (${f.actual} files measured) — the layout record must mirror the declared roots exactly`,
171
169
  'root-grew': (f) => `${f.root}: files ${f.actual} exceeds its recorded ${f.recorded} beyond its band (up to ${f.ceiling})`,
172
170
  'dir-over': (f) => `${f.dir}: ${f.dimension} ${f.actual} exceeds the limit ${f.allowed} beyond its band (up to ${f.ceiling})`,
@@ -179,8 +177,7 @@ const WARNING_LINE = Object.freeze({
179
177
  stale: (f) => `${f.rel}: ${f.dimension} ${f.actual} is under the recorded ${f.recorded} — the regeneration lowers it`,
180
178
  'record-obsolete': (f) => `${f.rel}: ${f.dimension} ${f.actual} is within its band (up to ${f.ceiling}), so its record is obsolete — the regeneration removes it`,
181
179
  'entry-gone': (f) => `${f.rel}: recorded in "baseline" but no longer in scope — split, renamed or deleted; the regeneration removes it`,
182
- 'aggregate-stale': (f) => `${f.root}: aggregate lines ${f.actual} is under the recorded budget ${f.recorded} — the regeneration lowers it`,
183
- 'aggregate-root-gone': (f) => `${f.root}: recorded in "aggregate" but no longer a declared root — the regeneration removes it`,
180
+ 'sum-record': (f) => `"aggregate" records a line sum for ${f.roots} root(s), which the check no longer judges or records — the regeneration removes it${f.schema === SOURCE_SIZE_SCHEMA ? '' : ` and writes schema ${SOURCE_SIZE_SCHEMA}, on which ${PREDATING_KIT_STOPS(SOURCE_SIZE_SCHEMA)}`}`,
184
181
  'root-band': (f) => `${f.root}: files ${f.actual} is over its recorded ${f.recorded} but within its band (up to ${f.ceiling}) — past ${f.ceiling} it stops`,
185
182
  'root-stale': (f) => `${f.root}: files ${f.actual} is under the recorded ${f.recorded} — the regeneration lowers it`,
186
183
  'root-gone': (f) => `${f.root}: recorded in "layout"."roots" but no longer a declared root — the regeneration removes it`,
@@ -243,7 +240,7 @@ export const checkStopBlock = ({ cwd, verdict, absent = false }) => {
243
240
  // A lowered or removed record warns with the paste-ready regeneration, which needs no reason.
244
241
  const tightenLine = (cwd) => {
245
242
  const { command, withheld } = regenerator(cwd);
246
- return `${SOURCE_SIZE_WARNING_PREFIX}a record above is lower or gone, so regenerating lowers or removes it with no reason: ${command ?? `${withheld} ${WITHHELD_LANE}`}`;
243
+ return `${SOURCE_SIZE_WARNING_PREFIX}a record above is lower, gone or no longer judged, so regenerating lowers or removes it with no reason: ${command ?? `${withheld} ${WITHHELD_LANE}`}`;
247
244
  };
248
245
 
249
246
  // A passing check keeps its notes, warnings and green line in that order.
@@ -252,7 +249,7 @@ export const checkReportLines = ({ cwd, config, verdict, absent = false }) => {
252
249
  const warnings = warningsOf(verdict.findings);
253
250
  lines.push(...warningLines(warnings));
254
251
  const lowered = hasLoweredRecord(warnings);
255
- if (lowered || hasStoreRecord(warnings)) lines.push(tightenLine(cwd));
252
+ if (lowered || hasDroppedRecord(warnings)) lines.push(tightenLine(cwd));
256
253
  if (lowered) lines.push(SPLIT_QUALITY_FOCUS);
257
254
  lines.push(warnings.length === 0
258
255
  ? `source-size: PASS — ${verdict.scope.files.length} in-scope file(s) within the declared caps`
@@ -289,15 +286,15 @@ export const schema1StopBlock = (cwd) => {
289
286
  const { command, withheld } = regenerator(cwd);
290
287
  return {
291
288
  failed: escapeLeadingSpace(`${namedConfig(cwd)} is schema 1, which the check no longer judges`),
292
- findings: [{ place: SOURCE_SIZE_CONFIG_REL, text: '--write-baseline moves it to schema 2 in its one write (a raise riding it still takes --reason)' }],
289
+ findings: [{ place: SOURCE_SIZE_CONFIG_REL, text: '--write-baseline moves it off schema 1 (a raise riding it still takes --reason)' }],
293
290
  remedies: [command ?? 'Run source-size-check.mjs --write-baseline with the working directory set to this project.'],
294
291
  after: refusal(command === null ? [withheld] : []),
295
292
  };
296
293
  };
297
294
 
298
295
  // Claims only what holds of every written file.
299
- export const schema1MovedLines = (cwd) => [
300
- `source-size: ${namedConfig(cwd)} moved from schema 1 to schema 2 in this write.`,
296
+ export const schemaMovedLines = (cwd, from, to) => [
297
+ `source-size: ${namedConfig(cwd)} ${from === null ? 'written at' : `moved from schema ${from} to`} schema ${to} in this write; ${PREDATING_KIT_STOPS(to)}.`,
301
298
  ];
302
299
 
303
300
  // The record must hold before an override is written, so its reason never lands on drift it did not
@@ -370,11 +367,11 @@ export const gateRefusedLines = (rel, message) => refusal([
370
367
  ]);
371
368
 
372
369
  // `changed` is decided by comparing the serialized bytes with the file's own — never by the delta
373
- // count alone: completing a half-written machine record changes the file while raising nothing, and
370
+ // count alone: a schema move or a re-serialization changes the file while raising nothing, and
374
371
  // reporting that as "unchanged" would hide a write that happened.
375
372
  export const writtenLines = ({ cwd, deltas, reason, changed }) => {
376
373
  if (!changed) return [`source-size: baseline unchanged — ${namedConfig(cwd)} already records this tree`];
377
- if (deltas.length === 0) return [`source-size: baseline rewritten — no recorded value changed; ${namedConfig(cwd)} was completed or re-serialized`];
374
+ if (deltas.length === 0) return [`source-size: baseline rewritten — no recorded value changed; ${namedConfig(cwd)} was re-serialized`];
378
375
  return [
379
376
  `source-size: baseline regenerated — ${deltas.length} change(s) in ${namedConfig(cwd)}:`,
380
377
  ...deltaLines(deltas),
@@ -6,8 +6,7 @@
6
6
  // What --check judges: every in-scope file against the resolved limits with their bands, layout
7
7
  // where it is recorded or the config is absent, and every RECORDED size against the ratchet — a
8
8
  // record may not grow, and one above the tree or gone warns until the regeneration lowers or removes
9
- // it. Each declared root carries the same exact ratchet over its summed lines, so splitting one big
10
- // file into six buys no headroom. An absent config is judged under the kit's values.
9
+ // it. No per-root line sum is judged or recorded. An absent config is judged under the kit's values.
11
10
  //
12
11
  // What --write-baseline does: regenerates the machine keys from the tree, and ONLY the machine keys.
13
12
  // The authored half is copied through with its VALUES and their ORDER preserved exactly; the file
@@ -20,12 +19,12 @@
20
19
  // What --adopt does: mints the record and declares the gate — the whole adoption as ONE consented
21
20
  // line, because the alternative is a two-step ceremony whose halves can be left half-done. It
22
21
  // composes the two writers it already has (this module's mint, the fill's consented apply restricted
23
- // to this one id) and owns no write of its own, but for the schema-1 move of a minted config, which
24
- // carries both records verbatim.
22
+ // to this one id) and owns no write of its own, but for the verbatim move of a minted schema-1 config,
23
+ // which carries the file record, and the line sum where the file holds one.
25
24
  //
26
25
  // What --override does: once a regeneration under the current limits would raise nothing, writes or
27
26
  // removes one reasoned override of a kit limit and regenerates the machine keys under the new limits
28
- // in the same write. Every write here moves a schema-1 config to schema 2; --check stops on one.
27
+ // in the same write. Every write here moves a schema-1 config off schema 1; --check stops on one.
29
28
  //
30
29
  //
31
30
  // Dependency-free, Node >= 22. No side effects on import.
@@ -39,6 +38,7 @@ import {
39
38
  SOURCE_SIZE_SCHEMA,
40
39
  applyOverride,
41
40
  assertNoStoreRoot,
41
+ atSchema,
42
42
  checkTargetOf,
43
43
  isRaise,
44
44
  loadSourceSizeConfig,
@@ -55,6 +55,7 @@ import { bandWarningsOf, judgeTree, standingWarningsOf, stopsOf } from './source
55
55
  import { GATES_REL, loadDeclaration } from './gates-declaration.mjs';
56
56
  import { applyFill } from './gates-init.mjs';
57
57
  import {
58
+ EARLIER_TEMPLATE_READMES,
58
59
  TEMPLATE_README,
59
60
  TEMPLATE_READMES,
60
61
  absentRefusalLines,
@@ -70,7 +71,7 @@ import {
70
71
  reasonRequiredLines,
71
72
  recordNoLongerHoldsLines,
72
73
  recordRecognizedLines,
73
- schema1MovedLines, schema1StopBlock,
74
+ schema1StopBlock, schemaMovedLines,
74
75
  unmintedRefusalLines, unmintedStopBlock,
75
76
  warningLines,
76
77
  writtenLines,
@@ -83,7 +84,7 @@ export const usageFail = (message) => Object.assign(new Error(`${ERROR_PREFIX}${
83
84
  const RECORD_NOUN = 'the source-size record';
84
85
  const LAYOUT_GROWTH_LEAD = 'source-size: --layout REFUSED — it starts the layout record and raises nothing else, but the record no longer holds for this tree, so that growth takes --write-baseline --reason first; no record was regenerated.';
85
86
 
86
- // What an absent config is judged as: schema 2 under the kit's values, layout over "." and the store.
87
+ // What an absent config is judged as: the current schema under the kit's values, layout over "." and the store.
87
88
  const ABSENT = Object.freeze({ _README: TEMPLATE_README, schema: SOURCE_SIZE_SCHEMA });
88
89
 
89
90
  // Every run returns the config it resolved, so the CLI states the limits that run judged, and the
@@ -92,7 +93,7 @@ export const runCheck = ({ cwd, deps = {} }) => {
92
93
  const target = checkTargetOf({ loaded: loadSourceSizeConfig(cwd, deps), absentConfig: validateSourceSizeConfig(ABSENT) });
93
94
  const { config, judged } = target;
94
95
  if (target.stop === 'schema-1') return { code: 1, block: schema1StopBlock(cwd), config };
95
- if (target.stop === 'unminted') return { code: 1, block: unmintedStopBlock(cwd, { state: target.state, missing: target.missing, config }), config };
96
+ if (target.stop === 'unminted') return { code: 1, block: unmintedStopBlock(cwd, { config }), config };
96
97
  const verdict = judgeTree(cwd, config, deps, judged);
97
98
  const report = { cwd, config, verdict, absent: judged.absent };
98
99
  return stopsOf(verdict.findings).length > 0 ? { code: 1, block: checkStopBlock(report), config, judged, scope: verdict.scope }
@@ -102,11 +103,14 @@ export const runCheck = ({ cwd, deps = {} }) => {
102
103
  // ── the writer ────────────────────────────────────────────────────────────────────────────────────
103
104
 
104
105
  // A schema-1 config is moved by the one transform, the kit's old template `_README` replaced by the
105
- // new one; every write of this module goes through it, so no writer ever writes schema 1 back.
106
+ // schema-2 one; every write of this module goes through it, so no writer ever writes schema 1 back.
106
107
  const schema2Of = (parsed) => (parsed.schema === 1 ? migrateSchema1(parsed, TEMPLATE_READMES) : parsed);
107
108
 
108
- // What a move says it did, read off the moved config itself.
109
- const movedLines = (cwd, parsed) => (parsed.schema === 1 ? schema1MovedLines(cwd) : []);
109
+ // What a regeneration writes: the current schema, an earlier template `_README` replaced by today's.
110
+ const currentOf = (parsed) => atSchema(schema2Of(parsed), SOURCE_SIZE_SCHEMA, { earlier: EARLIER_TEMPLATE_READMES, current: TEMPLATE_README });
111
+
112
+ // What a write says of the schema it left, read off the file as loaded (null where none was) and the schema written.
113
+ const movedLines = (cwd, from, to = SOURCE_SIZE_SCHEMA) => (from === to ? [] : schemaMovedLines(cwd, from, to));
110
114
 
111
115
  const writeRecord = (cwd, body, deps) =>
112
116
  writeDocsAiFileAtomic(cwd, SOURCE_SIZE_CONFIG_REL, body, deps, { stop: scopeFail, noun: RECORD_NOUN });
@@ -147,13 +151,13 @@ export const runWriteBaseline = ({ cwd, reason, layout = false, deps = {} }) =>
147
151
  const moved = minted && config.schema === 1 ? moveMinted(cwd, parsed, deps) : [];
148
152
  return { code: 1, lines: [...bandWarnings, ...moved, ...refused], config, judged, scope };
149
153
  }
150
- const body = serialize(schema2Of(parsed), materialize(plan, reason));
151
- // Whether anything was written is decided by the BYTES, not by the delta count: completing a
152
- // hand-edited half record changes the file while raising nothing at all.
154
+ const body = serialize(currentOf(parsed), materialize(plan, reason));
155
+ // Whether anything was written is decided by the BYTES, not by the delta count: a schema move
156
+ // changes the file while raising nothing at all.
153
157
  const changed = body !== loaded.text;
154
158
  if (changed) writeRecord(cwd, body, deps);
155
159
  const written = writtenLines({ cwd, deltas: plan.deltas, reason: plan.raises.length > 0 ? reason : undefined, changed });
156
- return { code: 0, lines: [...warnings, ...movedLines(cwd, parsed), ...written], config, judged, scope };
160
+ return { code: 0, lines: [...warnings, ...movedLines(cwd, absent ? null : parsed.schema), ...written], config, judged, scope };
157
161
  };
158
162
 
159
163
  // --override: the projection under the CURRENT limits comes first, so an override's reason never
@@ -161,9 +165,9 @@ export const runWriteBaseline = ({ cwd, reason, layout = false, deps = {} }) =>
161
165
  // under the new limits, in the same atomic write.
162
166
  export const runOverride = ({ cwd, id, value, tolerance, kitDefault, reason, deps = {} }) => {
163
167
  assertDocsAiDeployment(cwd, deps, { stop: scopeFail, rel: SOURCE_SIZE_CONFIG_REL, noun: RECORD_NOUN });
164
- const { state, config, parsed, text, missingMachineKeys } = loadSourceSizeConfig(cwd, deps);
168
+ const { state, config, parsed, text } = loadSourceSizeConfig(cwd, deps);
165
169
  if (state === 'absent') return { code: 1, lines: absentRefusalLines(cwd) };
166
- if (state !== 'minted') return { code: 1, lines: unmintedRefusalLines(cwd, { state, missing: missingMachineKeys, config }), config };
170
+ if (state !== 'minted') return { code: 1, lines: unmintedRefusalLines(cwd, { config }), config };
167
171
  const judged = { absent: false, layout: config.layout !== null };
168
172
  const current = judgeForWrite(cwd, config, deps, judged);
169
173
  const scope = current.verdict.scope;
@@ -174,7 +178,7 @@ export const runOverride = ({ cwd, id, value, tolerance, kitDefault, reason, dep
174
178
  if (filled !== null && filled.tolerance === kit.tolerance && (kit.value === null || filled.value === kit.value)) {
175
179
  throw usageFail(`--override ${id} equals the kit's own numbers — pass --kit-default to return to them; the writer never writes an override equal to the kit's`);
176
180
  }
177
- const next = applyOverride(schema2Of(parsed), id, filled);
181
+ const next = applyOverride(currentOf(parsed), id, filled);
178
182
  const nextConfig = validateSourceSizeConfig(next);
179
183
  const { plan, warnings } = judgeForWrite(cwd, nextConfig, deps, judged);
180
184
  const body = serialize(next, materialize(plan, reason));
@@ -187,7 +191,7 @@ export const runOverride = ({ cwd, id, value, tolerance, kitDefault, reason, dep
187
191
  lines: [
188
192
  ...warnings,
189
193
  ...overrideWrittenLines({ cwd, id, removed: kitDefault, reason }),
190
- ...movedLines(cwd, parsed),
194
+ ...movedLines(cwd, parsed.schema),
191
195
  ...(plan.deltas.length === 0 ? [] : writtenLines({ cwd, deltas: plan.deltas, reason: plan.raises.length > 0 ? reason : undefined, changed: true })),
192
196
  ],
193
197
  config: nextConfig,
@@ -248,12 +252,15 @@ const recognizeRecord = ({ cwd, deps }) => {
248
252
  return { code: 0, lines: recordRecognizedLines(cwd) };
249
253
  };
250
254
 
251
- // A MINTED schema-1 config is moved in its own write before adoption reads it as schema 2: the
252
- // authored half transformed, both machine records carried verbatim, nothing regenerated — so the
253
- // adoption reason can never ride a raise. An authored or incomplete one is moved by the mint itself.
255
+ // A MINTED schema-1 config is moved in its own write before adoption reads it: the
256
+ // authored half transformed, the file record and the line sum carried verbatim, nothing regenerated —
257
+ // so the adoption reason can never ride a raise. It writes schema 2, the last schema that holds the
258
+ // sum, exactly where the file holds one, and the current schema where it holds none; an authored one is
259
+ // moved by the mint itself.
254
260
  const moveMinted = (cwd, parsed, deps) => {
255
- writeRecord(cwd, serialize(schema2Of(parsed), { baseline: parsed.baseline, aggregate: parsed.aggregate }), deps);
256
- return movedLines(cwd, parsed);
261
+ const carriesSum = Object.hasOwn(parsed, 'aggregate');
262
+ writeRecord(cwd, serialize(carriesSum ? schema2Of(parsed) : currentOf(parsed), { baseline: parsed.baseline, ...(carriesSum ? { aggregate: parsed.aggregate } : {}) }), deps);
263
+ return movedLines(cwd, parsed.schema, carriesSum ? 2 : SOURCE_SIZE_SCHEMA);
257
264
  };
258
265
 
259
266
  // A stop after the move still prints the move: the write happened, and no stop may hide it.