@sabaiway/agent-workflow-kit 14.38.0 → 14.40.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.
- package/CHANGELOG.md +61 -0
- package/README.md +2 -1
- package/SKILL.md +5 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/advisor-writers.md +1 -0
- package/references/modes/gates.md +1 -1
- package/references/modes/procedures.md +1 -1
- package/references/modes/recommendations.md +1 -1
- package/references/modes/rules.md +24 -0
- package/references/modes/upgrade.md +7 -7
- package/references/shared/composition-handoff.md +2 -2
- package/references/templates/architecture.md +5 -20
- package/tools/commands.mjs +7 -0
- package/tools/gates-init.mjs +17 -8
- package/tools/inject-methodology.mjs +16 -16
- package/tools/procedures.mjs +9 -2
- package/tools/project-rules/index.mjs +1 -0
- package/tools/project-rules/memory-map-row.mjs +62 -0
- package/tools/recommendations.mjs +25 -11
- package/tools/run-gates.mjs +13 -3
- package/tools/source-size/index.mjs +30 -0
- package/tools/source-size/layout.mjs +136 -0
- package/tools/source-size/limits.mjs +110 -0
- package/tools/source-size/record.mjs +143 -0
- package/tools/source-size-check.mjs +192 -127
- package/tools/source-size-config.mjs +92 -27
- package/tools/source-size-core.mjs +27 -0
- package/tools/source-size-judge.mjs +143 -77
- package/tools/source-size-refusal.mjs +8 -3
- package/tools/source-size-report.mjs +182 -46
- package/tools/source-size-scope.mjs +31 -6
- package/tools/write-lanes.mjs +1 -0
|
@@ -9,6 +9,8 @@
|
|
|
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
|
|
12
|
+
// • source-size/index.mjs — the door of the size check's module: the kit's limits and their
|
|
13
|
+
// lines, the band and the layout count, and the recorded ratchet as data
|
|
12
14
|
//
|
|
13
15
|
// Re-export only: a consumer imports the practice, never a particular half, so a later split moves
|
|
14
16
|
// code without touching a single call site.
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
export {
|
|
17
19
|
SOURCE_SIZE_CONFIG_REL,
|
|
18
20
|
SOURCE_SIZE_STOP,
|
|
21
|
+
SOURCE_SIZE_WARNING_PREFIX,
|
|
19
22
|
SOURCE_SIZE_WHY,
|
|
20
23
|
configFail,
|
|
21
24
|
configPathFor,
|
|
@@ -28,10 +31,12 @@ export {
|
|
|
28
31
|
export {
|
|
29
32
|
AUTHORED_KEYS,
|
|
30
33
|
INITIAL_ADOPTION_REASON,
|
|
34
|
+
LAYOUT_KEY,
|
|
31
35
|
MACHINE_KEYS,
|
|
32
36
|
REASON_MAX_BYTES,
|
|
33
37
|
SOURCE_SIZE_DEFAULTS,
|
|
34
38
|
SOURCE_SIZE_SCHEMA,
|
|
39
|
+
assertNoStoreRoot,
|
|
35
40
|
loadSourceSizeConfig,
|
|
36
41
|
practiceFacts,
|
|
37
42
|
reasonDefect,
|
|
@@ -46,6 +51,28 @@ export {
|
|
|
46
51
|
resolveScope,
|
|
47
52
|
} from './source-size-scope.mjs';
|
|
48
53
|
|
|
54
|
+
export {
|
|
55
|
+
KIT_LIMITS,
|
|
56
|
+
SCHEMA1_REASON,
|
|
57
|
+
SPEC_STORE_ROOT,
|
|
58
|
+
applyOverride,
|
|
59
|
+
bandOf,
|
|
60
|
+
changesFor,
|
|
61
|
+
isRaise,
|
|
62
|
+
layoutCounts,
|
|
63
|
+
layoutDefect,
|
|
64
|
+
limitLines,
|
|
65
|
+
limitsDefect,
|
|
66
|
+
materialize,
|
|
67
|
+
migrateSchema1,
|
|
68
|
+
ownEntry,
|
|
69
|
+
planRecord,
|
|
70
|
+
projectLayout,
|
|
71
|
+
resolveLimits,
|
|
72
|
+
serialize,
|
|
73
|
+
walkSpecStore,
|
|
74
|
+
} from './source-size/index.mjs';
|
|
75
|
+
|
|
49
76
|
export {
|
|
50
77
|
SOURCE_SIZE_GATE_ID,
|
|
51
78
|
SOURCE_SIZE_TOOL_PATH,
|
|
@@ -1,114 +1,180 @@
|
|
|
1
1
|
// source-size-judge.mjs — the verdict as FACTS, never as words, and the ONE projection everything
|
|
2
|
-
// else reads
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// checker can never demand something the regenerator would not do, nor pass a tree the regenerator
|
|
6
|
-
// would rewrite.
|
|
2
|
+
// else reads: every in-scope file and judged directory measured once, the record the regenerator
|
|
3
|
+
// WOULD write projected, and each difference against today's record stated — so the checker can
|
|
4
|
+
// never demand what the regenerator would not do, nor, on a present config, pass a tree whose regeneration would raise.
|
|
7
5
|
//
|
|
8
|
-
// The ratchet
|
|
9
|
-
//
|
|
10
|
-
// record
|
|
11
|
-
//
|
|
12
|
-
// a split or a rename visible instead of silent. The per-root budget rides the same rules over the
|
|
13
|
-
// summed LINES of the root — splitting one file into six buys no headroom at all.
|
|
6
|
+
// The ratchet (D-3, D-4): a recorded size is DEBT, not permission. Each limit is judged with its
|
|
7
|
+
// band; a finding STOPS exactly when the regeneration would RAISE (beyond the band with no record, a
|
|
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.
|
|
14
10
|
//
|
|
15
11
|
// Dependency-free, Node >= 22. No writes, no side effects on import.
|
|
16
12
|
|
|
17
|
-
import { measureFile, resolveScope } from './source-size-scope.mjs';
|
|
13
|
+
import { measureFile, resolveScope, specStoreEntries } from './source-size-scope.mjs';
|
|
14
|
+
import { scopeFail } from './source-size-refusal.mjs';
|
|
15
|
+
import { SPEC_STORE_ROOT, bandOf, changesFor, isRaise, layoutCounts, ownEntry, projectLayout } from './source-size/index.mjs';
|
|
18
16
|
|
|
19
17
|
export const DIMENSIONS = Object.freeze(['lines', 'maxLineBytes']);
|
|
18
|
+
const LAYOUT_DIMENSIONS = Object.freeze(['entries', 'depth']);
|
|
19
|
+
export const STOP = 'stop';
|
|
20
|
+
export const WARNING = 'warning';
|
|
20
21
|
|
|
21
|
-
// The
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// The kit limit each measured dimension is judged against.
|
|
23
|
+
const LIMIT_OF = Object.freeze({ lines: 'lines-per-file', maxLineBytes: 'bytes-per-line', entries: 'entries-per-directory', depth: 'depth' });
|
|
24
|
+
const ceilingOf = ({ value, tolerance }) => value + bandOf(value, tolerance);
|
|
25
|
+
const withinBand = (value, limit) => value > limit.value && value <= ceilingOf(limit);
|
|
24
26
|
|
|
25
|
-
// THE projection: a record exists for a dimension exactly while that dimension
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
DIMENSIONS.filter((dimension) => measured[dimension] > defaults[DEFAULT_KEY[dimension]])
|
|
27
|
+
// THE projection: a record exists for a dimension exactly while that dimension is beyond its band. A
|
|
28
|
+
// value within the band warns and carries no record, so a record of one is obsolete.
|
|
29
|
+
export const recordFor = (measured, limits) => Object.fromEntries(
|
|
30
|
+
DIMENSIONS.filter((dimension) => measured[dimension] > ceilingOf(limits[LIMIT_OF[dimension]]))
|
|
30
31
|
.map((dimension) => [dimension, measured[dimension]]),
|
|
31
32
|
);
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
// smaller — the whole class a human's reason is required for. Everything else lowers or removes.
|
|
35
|
-
export const isRaise = ({ from, to }) => to !== null && (from === null || to > from);
|
|
36
|
-
|
|
37
|
-
// A recorded entry is read by OWN key only. A declared root may legitimately be named like an
|
|
38
|
-
// Object.prototype member ("constructor", "toString"), and a plain lookup would then answer with an
|
|
39
|
-
// INHERITED value — which reads as "already recorded", so the raise goes unnoticed and the entry is
|
|
40
|
-
// written with no reason at all, producing a config this tool's own validator refuses.
|
|
41
|
-
export const ownEntry = (map, key) => (Object.hasOwn(map, key) ? map[key] : undefined);
|
|
42
|
-
|
|
43
|
-
// changesFor(target, projected, recorded) → the per-dimension old→new pairs that actually differ.
|
|
44
|
-
// The refusal, the printed delta and the reason an entry ends up with all read THIS.
|
|
45
|
-
export const changesFor = (target, projected, recorded) => DIMENSIONS
|
|
46
|
-
.map((dimension) => ({
|
|
47
|
-
target,
|
|
48
|
-
dimension,
|
|
49
|
-
from: recorded && Object.hasOwn(recorded, dimension) ? recorded[dimension] : null,
|
|
50
|
-
to: Object.hasOwn(projected, dimension) ? projected[dimension] : null,
|
|
51
|
-
}))
|
|
52
|
-
.filter(({ from, to }) => from !== to);
|
|
53
|
-
|
|
54
|
-
const GROWTH_KINDS = new Set(['over-default', 'grew', 'aggregate-grew', 'aggregate-unrecorded']);
|
|
55
|
-
|
|
34
|
+
const BAND_KINDS = new Set(['within-band', 'root-band', 'dir-band']);
|
|
56
35
|
// D-9: the unmechanizable question — real decomposition, or the same coupling spread thinner? — is
|
|
57
36
|
// asked exactly where a record went DOWN or disappeared, and the checker itself raises it there.
|
|
58
|
-
const LOWERED_KINDS = new Set(['stale', 'record-obsolete', 'entry-gone']);
|
|
37
|
+
const LOWERED_KINDS = new Set(['stale', 'record-obsolete', 'entry-gone', 'root-stale', 'root-gone', 'dir-stale', 'dir-obsolete', 'dir-gone']);
|
|
59
38
|
|
|
60
|
-
export const
|
|
39
|
+
export const stopsOf = (findings) => findings.filter((f) => f.severity === STOP);
|
|
40
|
+
export const warningsOf = (findings) => findings.filter((f) => f.severity === WARNING);
|
|
41
|
+
export const bandWarningsOf = (findings) => findings.filter((f) => BAND_KINDS.has(f.kind));
|
|
42
|
+
// The warnings a write leaves standing: a value within its band, one whose obsolete record it drops included.
|
|
43
|
+
const BAND_OF_OBSOLETE = Object.freeze({ 'record-obsolete': 'within-band', 'dir-obsolete': 'dir-band' });
|
|
44
|
+
export const standingWarningsOf = (findings) => findings.flatMap((f) => {
|
|
45
|
+
if (BAND_KINDS.has(f.kind)) return [f];
|
|
46
|
+
const kind = BAND_OF_OBSOLETE[f.kind];
|
|
47
|
+
return kind && f.dimension !== 'depth' && f.actual > f.allowed && f.actual <= f.ceiling ? [{ ...f, kind }] : [];
|
|
48
|
+
});
|
|
61
49
|
export const hasLoweredRecord = (findings) => findings.some((f) => LOWERED_KINDS.has(f.kind));
|
|
62
50
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
51
|
+
// One rule for every recorded number: a raise stops, any other change warns. `kinds` names no record
|
|
52
|
+
// yet, grew, lowered and no longer needed in the target's own vocabulary.
|
|
53
|
+
const changeFinding = (target, { dimension, from, to }, actual, limits, kinds) => ({
|
|
54
|
+
kind: kinds[from === null ? 0 : to === null ? 3 : to > from ? 1 : 2], severity: isRaise({ from, to }) ? STOP : WARNING, ...target, dimension,
|
|
55
|
+
actual, allowed: limits[LIMIT_OF[dimension]].value, ceiling: ceilingOf(limits[LIMIT_OF[dimension]]), ...(from === null ? {} : { recorded: from }),
|
|
56
|
+
});
|
|
57
|
+
const bandFinding = (kind, target, dimension, actual, limit) => ({ kind, severity: WARNING, ...target, dimension, actual, allowed: limit.value, ceiling: ceilingOf(limit) });
|
|
58
|
+
|
|
59
|
+
const FILE_KINDS = ['over-default', 'grew', 'stale', 'record-obsolete'];
|
|
60
|
+
const DIR_KINDS = ['dir-over', 'dir-grew', 'dir-stale', 'dir-obsolete'];
|
|
61
|
+
|
|
62
|
+
const fileFindings = (rel, measured, projected, recorded, limits) => {
|
|
63
|
+
const changes = changesFor(rel, projected, recorded);
|
|
64
|
+
return [
|
|
65
|
+
...changes.map((change) => changeFinding({ rel }, change, measured[change.dimension], limits, FILE_KINDS)),
|
|
66
|
+
...DIMENSIONS.filter((d) => withinBand(measured[d], limits[LIMIT_OF[d]]) && !changes.some((c) => c.dimension === d))
|
|
67
|
+
.map((d) => bandFinding('within-band', { rel }, d, measured[d], limits[LIMIT_OF[d]])),
|
|
68
|
+
];
|
|
72
69
|
};
|
|
73
70
|
|
|
74
71
|
const judgeAggregate = (rootLines, aggregate) => {
|
|
75
72
|
const findings = [];
|
|
76
73
|
for (const [root, actual] of rootLines) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
const value = aggregate[root].lines;
|
|
82
|
-
if (actual > value) findings.push({ kind: 'aggregate-grew', root, actual, recorded: value });
|
|
83
|
-
else if (actual < value) findings.push({ kind: 'aggregate-stale', root, actual, recorded: value });
|
|
74
|
+
const recorded = ownEntry(aggregate, root)?.lines;
|
|
75
|
+
if (recorded === undefined) findings.push({ kind: 'aggregate-unrecorded', severity: STOP, root, actual });
|
|
76
|
+
else if (actual > recorded) findings.push({ kind: 'aggregate-grew', severity: STOP, root, actual, recorded });
|
|
77
|
+
else if (actual < recorded) findings.push({ kind: 'aggregate-stale', severity: WARNING, root, actual, recorded });
|
|
84
78
|
}
|
|
85
|
-
// The recorded set must MIRROR the declared roots: a budget nobody declares any more
|
|
86
|
-
//
|
|
79
|
+
// The recorded set must MIRROR the declared roots: a budget nobody declares any more warns until
|
|
80
|
+
// the writer drops it, and deleting an entry must never be a way to disarm it.
|
|
87
81
|
for (const root of Object.keys(aggregate)) {
|
|
88
|
-
if (!rootLines.has(root)) findings.push({ kind: 'aggregate-root-gone', root, recorded: aggregate[root].lines });
|
|
82
|
+
if (!rootLines.has(root)) findings.push({ kind: 'aggregate-root-gone', severity: WARNING, root, recorded: aggregate[root].lines });
|
|
89
83
|
}
|
|
90
84
|
return findings;
|
|
91
85
|
};
|
|
92
86
|
|
|
93
|
-
//
|
|
94
|
-
// is
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
// A directory is keyed by its repo-relative path, a root's own by its declared name. A name that is
|
|
88
|
+
// not lossless UTF-8 is counted, and refused only once a record would have to carry it.
|
|
89
|
+
const measureLayout = (cwd, config, scope, deps) => {
|
|
90
|
+
const counted = config.roots.map((root) => [root, scope.layout.get(root)]);
|
|
91
|
+
const store = specStoreEntries(cwd, deps);
|
|
92
|
+
if (store !== null) counted.push([SPEC_STORE_ROOT, store]);
|
|
93
|
+
const roots = new Map();
|
|
94
|
+
const directories = new Map();
|
|
95
|
+
const undecodable = [];
|
|
96
|
+
for (const [root, entries] of counted) {
|
|
97
|
+
const counts = layoutCounts(entries);
|
|
98
|
+
roots.set(root, counts.files);
|
|
99
|
+
const base = Buffer.from(root, 'utf8').toString('latin1');
|
|
100
|
+
for (const [below, facts] of counts.directories) {
|
|
101
|
+
const bytes = Buffer.from(below === '' ? base : root === '.' ? below : `${base}/${below}`, 'latin1');
|
|
102
|
+
const key = bytes.toString('utf8');
|
|
103
|
+
if (Buffer.from(key, 'utf8').equals(bytes)) directories.set(key, facts);
|
|
104
|
+
else undecodable.push({ bytes, facts });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return { roots, directories, undecodable };
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// The absent config records nothing, so the roots' files a first write would record are no findings.
|
|
111
|
+
const rootFindings = (measured, projected, recorded, tolerance) => {
|
|
112
|
+
const findings = [];
|
|
113
|
+
for (const [root, actual] of measured.roots) {
|
|
114
|
+
const was = ownEntry(recorded.roots, root)?.files ?? null;
|
|
115
|
+
const ceiling = was === null ? undefined : was + bandOf(was, tolerance);
|
|
116
|
+
if (was === null) findings.push({ kind: 'root-unrecorded', severity: STOP, root, actual });
|
|
117
|
+
else if (projected.roots[root] > was) findings.push({ kind: 'root-grew', severity: STOP, root, actual, recorded: was, ceiling });
|
|
118
|
+
else if (projected.roots[root] < was) findings.push({ kind: 'root-stale', severity: WARNING, root, actual, recorded: was });
|
|
119
|
+
else if (actual > was) findings.push({ kind: 'root-band', severity: WARNING, root, actual, recorded: was, ceiling });
|
|
120
|
+
}
|
|
121
|
+
for (const [root, was] of Object.entries(recorded.roots)) {
|
|
122
|
+
if (!measured.roots.has(root)) findings.push({ kind: 'root-gone', severity: WARNING, root, recorded: was.files });
|
|
123
|
+
}
|
|
124
|
+
return findings;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// A recorded dimension is judged as a file's; within its band warns, depth one level past the value.
|
|
128
|
+
const directoryFindings = (directories, projected, recorded, limits) => {
|
|
129
|
+
const findings = [];
|
|
130
|
+
for (const dir of Object.keys(recorded).filter((key) => !directories.has(key))) {
|
|
131
|
+
findings.push({ kind: 'dir-gone', severity: WARNING, dir, recorded: recorded[dir] });
|
|
132
|
+
}
|
|
133
|
+
for (const [dir, facts] of directories) {
|
|
134
|
+
const was = ownEntry(recorded, dir);
|
|
135
|
+
const changes = changesFor(dir, projected[dir] ?? {}, was, LAYOUT_DIMENSIONS);
|
|
136
|
+
const actual = { entries: facts.entries, depth: facts.reach };
|
|
137
|
+
findings.push(...changes.map((change) => changeFinding({ dir }, change, actual[change.dimension], limits, DIR_KINDS)));
|
|
138
|
+
const entries = limits['entries-per-directory'];
|
|
139
|
+
if (withinBand(facts.entries, entries) && !(was && Object.hasOwn(was, 'entries'))) findings.push(bandFinding('dir-band', { dir }, 'entries', facts.entries, entries));
|
|
140
|
+
if (facts.depth === limits.depth.value + 1 && withinBand(facts.reach, limits.depth)) findings.push(bandFinding('dir-band', { dir }, 'depth', facts.reach, limits.depth));
|
|
141
|
+
}
|
|
142
|
+
return findings;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const judgeLayout = (cwd, config, scope, deps, { absent }) => {
|
|
146
|
+
const measured = measureLayout(cwd, config, scope, deps);
|
|
147
|
+
const { limits } = config;
|
|
148
|
+
const unkeyable = measured.undecodable.find(({ facts }) => facts.entries > ceilingOf(limits['entries-per-directory']) || facts.depth === ceilingOf(limits.depth) + 1);
|
|
149
|
+
if (unkeyable) throw scopeFail(`a judged directory's NAME is not valid UTF-8 (bytes ${unkeyable.bytes.toString('hex')}) and it is beyond its band — its record could not be keyed losslessly, so nothing is judged; rename it`);
|
|
150
|
+
const recorded = config.layout ?? { roots: {}, directories: {} };
|
|
151
|
+
const projected = projectLayout(measured, config.layout, limits);
|
|
152
|
+
const lossy = new Map(measured.undecodable.map(({ bytes, facts }) => [bytes.toString('utf8'), facts]));
|
|
153
|
+
const findings = [
|
|
154
|
+
...(absent ? [] : rootFindings(measured, projected, recorded, limits['files-per-root'].tolerance)),
|
|
155
|
+
...directoryFindings(measured.directories, projected.directories, recorded.directories, limits),
|
|
156
|
+
...directoryFindings(lossy, {}, {}, limits),
|
|
157
|
+
];
|
|
158
|
+
return { measured, projected, findings };
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// judgeTree(cwd, config, deps, { layout, absent }) → { scope, measured, projected, rootLines, layout,
|
|
162
|
+
// findings }. EVERY in-scope file is measured, recorded or not: an unreadable or non-UTF-8 file
|
|
163
|
+
// refuses even when its size is recorded debt. An absent config's aggregate is no finding.
|
|
164
|
+
export const judgeTree = (cwd, config, deps = {}, { layout = false, absent = false } = {}) => {
|
|
97
165
|
const scope = resolveScope(cwd, config, deps);
|
|
98
166
|
const measured = new Map(scope.files.map((rel) => [rel, measureFile(cwd, rel, deps)]));
|
|
99
|
-
const projected = new Map(scope.files.map((rel) => [rel, recordFor(measured.get(rel), config.
|
|
167
|
+
const projected = new Map(scope.files.map((rel) => [rel, recordFor(measured.get(rel), config.limits)]));
|
|
100
168
|
const baseline = config.baseline ?? {};
|
|
101
|
-
const findings =
|
|
102
|
-
for (const rel of scope.files) {
|
|
103
|
-
findings.push(...changesFor(rel, projected.get(rel), ownEntry(baseline, rel))
|
|
104
|
-
.map((change) => findingOfChange(rel, change, measured.get(rel), config.defaults)));
|
|
105
|
-
}
|
|
169
|
+
const findings = scope.files.flatMap((rel) => fileFindings(rel, measured.get(rel), projected.get(rel), ownEntry(baseline, rel), config.limits));
|
|
106
170
|
for (const rel of Object.keys(baseline)) {
|
|
107
|
-
if (!measured.has(rel)) findings.push({ kind: 'entry-gone', rel, recorded: baseline[rel] });
|
|
171
|
+
if (!measured.has(rel)) findings.push({ kind: 'entry-gone', severity: WARNING, rel, recorded: baseline[rel] });
|
|
108
172
|
}
|
|
109
173
|
const rootLines = new Map(
|
|
110
174
|
[...scope.perRoot].map(([root, files]) => [root, files.reduce((sum, rel) => sum + measured.get(rel).lines, 0)]),
|
|
111
175
|
);
|
|
112
|
-
findings.push(...judgeAggregate(rootLines, config.aggregate ?? {}));
|
|
113
|
-
|
|
176
|
+
if (!absent) findings.push(...judgeAggregate(rootLines, config.aggregate ?? {}));
|
|
177
|
+
const judged = layout ? judgeLayout(cwd, config, scope, deps, { absent }) : null;
|
|
178
|
+
if (judged) findings.push(...judged.findings);
|
|
179
|
+
return { scope, measured, projected, rootLines, layout: judged, findings };
|
|
114
180
|
};
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// as one raised by the config reader:
|
|
4
4
|
// • exit 2 — the INPUTS are unusable (usage, a malformed config, a failed enumeration); the
|
|
5
5
|
// practice could not judge anything, and no step it could name would change that.
|
|
6
|
-
// • exit 1 — the practice REFUSED: a
|
|
7
|
-
// file, or a declared state the reader must move
|
|
8
|
-
//
|
|
6
|
+
// • exit 1 — the practice REFUSED: a stop (beyond a band with no record, a record that grew, an
|
|
7
|
+
// unrecorded root), an unverifiable in-scope source file, or a declared state the reader must move
|
|
8
|
+
// on (an unminted config, a schema-1 one at --check, an absent one under --adopt and --override).
|
|
9
|
+
// Every one of these carries a step the reader can perform.
|
|
9
10
|
// • every refusal names the config of the project it ACTUALLY judged, absolute: under a foreign or
|
|
10
11
|
// relative --cwd a repo-relative name points at whatever directory the reader happens to be in.
|
|
11
12
|
// • the WHY rides the RENDERED refusals only — the ones the report composes (absent / unminted /
|
|
@@ -27,6 +28,10 @@ export const SOURCE_SIZE_CONFIG_REL = 'docs/ai/source-size.json';
|
|
|
27
28
|
// states the practice's FACTS instead — caps, recorded count, aggregate — and never this sentence.
|
|
28
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.';
|
|
29
30
|
|
|
31
|
+
// Every warning the check prints is one line under this anchored prefix, so the gate runner can echo
|
|
32
|
+
// a green check's warnings and nothing else of its output.
|
|
33
|
+
export const SOURCE_SIZE_WARNING_PREFIX = 'source-size: WARNING — ';
|
|
34
|
+
|
|
30
35
|
export const configPathFor = (cwd) => resolve(cwd, 'docs', 'ai', 'source-size.json');
|
|
31
36
|
|
|
32
37
|
export const SOURCE_SIZE_STOP = 'SOURCE_SIZE_STOP';
|