@sabaiway/agent-workflow-kit 20.2.0 → 22.0.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 (98) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +7 -5
  3. package/SKILL.md +1 -1
  4. package/bin/install.mjs +10 -11
  5. package/capability.json +1 -1
  6. package/launchers/windsurf-workflow.md +3 -1
  7. package/migrations/3.0.0-hardened-core-loop.md +7 -6
  8. package/package.json +5 -2
  9. package/references/advisor-writers.md +1 -1
  10. package/references/contracts.md +11 -10
  11. package/references/modes/bootstrap.md +3 -3
  12. package/references/modes/commit-guard.md +1 -1
  13. package/references/modes/gates.md +2 -2
  14. package/references/modes/recommendations.md +3 -3
  15. package/references/modes/upgrade.md +6 -6
  16. package/references/scripts/{archive-caps.mjs → archives/archive-caps.mjs} +1 -1
  17. package/references/scripts/{archive-changelog.mjs → archives/archive-changelog.mjs} +7 -9
  18. package/references/scripts/{archive-decisions.mjs → archives/archive-decisions.mjs} +13 -10
  19. package/references/scripts/{archive-issues.mjs → archives/archive-issues.mjs} +7 -8
  20. package/references/scripts/{check-docs-size.mjs → docs-size/check-docs-size.mjs} +3 -4
  21. package/references/scripts/docs-size/index.mjs +2 -0
  22. package/references/scripts/family.json +45 -0
  23. package/references/scripts/family.mjs +90 -0
  24. package/references/scripts/gates/kit-command-gates.mjs +117 -0
  25. package/references/scripts/{migrate-gates.mjs → gates/migrate-gates.mjs} +263 -182
  26. package/references/scripts/{install-git-hooks.mjs → git-hooks/install-git-hooks.mjs} +50 -38
  27. package/references/scripts/run.mjs +90 -0
  28. package/references/scripts/shared/index.mjs +3 -0
  29. package/references/scripts/shared/project-root.mjs +11 -0
  30. package/references/scripts/spec-schema/index.mjs +2 -0
  31. package/references/scripts/test-reporter/reporter.mjs +130 -0
  32. package/references/shared/composition-handoff.md +1 -1
  33. package/references/shared/deploy-tail.md +2 -2
  34. package/references/templates/SPEC_TEMPLATE.md +1 -1
  35. package/references/templates/adr-record.md +3 -3
  36. package/tools/apply-danger-check.mjs +9 -5
  37. package/tools/atomic-write.mjs +3 -1
  38. package/tools/coverage-producer.mjs +76 -41
  39. package/tools/direct-run.mjs +2 -0
  40. package/tools/distribution-files/retired.mjs +99 -0
  41. package/tools/distribution-files/scripts.mjs +68 -52
  42. package/tools/ensure-configs.mjs +21 -21
  43. package/tools/ensure-ops.mjs +60 -18
  44. package/tools/ensure-specs.mjs +85 -47
  45. package/tools/ensure-vocabulary.mjs +4 -4
  46. package/tools/epic-shape-cli.mjs +1 -1
  47. package/tools/epic-shape-ledger.mjs +1 -1
  48. package/tools/epic-shape.mjs +1 -1
  49. package/tools/family-registry.mjs +3 -1
  50. package/tools/feedback-record-cli.mjs +1 -1
  51. package/tools/fold-scope.mjs +2 -2
  52. package/tools/gates-declaration.mjs +22 -14
  53. package/tools/gates-init.mjs +33 -17
  54. package/tools/git-hooks.mjs +90 -65
  55. package/tools/jev-connect.mjs +1 -1
  56. package/tools/jev-guide.mjs +1 -1
  57. package/tools/jev-skill.mjs +1 -1
  58. package/tools/known-footprint.mjs +7 -29
  59. package/tools/node-evidence.mjs +29 -15
  60. package/tools/now-cli.mjs +1 -1
  61. package/tools/payload-prune.mjs +53 -58
  62. package/tools/plan-shape-cli.mjs +1 -1
  63. package/tools/plan-shape.mjs +1 -1
  64. package/tools/project-rules/rules-record.mjs +1 -1
  65. package/tools/queue-audit-cli.mjs +1 -1
  66. package/tools/queue-audit.mjs +2 -2
  67. package/tools/queue-purge-archive.mjs +1 -1
  68. package/tools/queue-purge-cli.mjs +1 -1
  69. package/tools/queue-purge.mjs +1 -1
  70. package/tools/recommendations.mjs +37 -25
  71. package/tools/script-priors.mjs +31 -3
  72. package/tools/source-size/piles.mjs +1 -1
  73. package/tools/spec-adoption.mjs +1 -1
  74. package/tools/spec-check-ops.mjs +2 -2
  75. package/tools/spec-check.mjs +2 -2
  76. package/tools/spec-coverage.mjs +1 -1
  77. package/tools/tier-guide.mjs +1 -1
  78. package/tools/transition/index.mjs +1 -1
  79. package/tools/upgrade-runlist.mjs +3 -3
  80. package/tools/write-lanes.mjs +2 -2
  81. package/references/scripts/_expect-shim.mjs +0 -41
  82. package/references/scripts/archive-caps.test.mjs +0 -321
  83. package/references/scripts/archive-changelog.test.mjs +0 -560
  84. package/references/scripts/archive-conservation.test.mjs +0 -466
  85. package/references/scripts/archive-decisions.test.mjs +0 -1503
  86. package/references/scripts/archive-issues.test.mjs +0 -825
  87. package/references/scripts/archiver-structure.test.mjs +0 -84
  88. package/references/scripts/check-docs-size-cli.test.mjs +0 -325
  89. package/references/scripts/check-docs-size-ensure.test.mjs +0 -360
  90. package/references/scripts/check-docs-size.test.mjs +0 -395
  91. package/references/scripts/install-git-hooks-repo-exec.test.mjs +0 -185
  92. package/references/scripts/install-git-hooks.test.mjs +0 -241
  93. package/references/scripts/markdown-blocks.test.mjs +0 -310
  94. package/references/scripts/migrate-gates-branches.test.mjs +0 -302
  95. package/references/scripts/migrate-gates.test.mjs +0 -517
  96. package/references/scripts/spec-schema.test.mjs +0 -352
  97. /package/references/scripts/{markdown-blocks.mjs → shared/markdown-blocks.mjs} +0 -0
  98. /package/references/scripts/{spec-schema.mjs → spec-schema/spec-schema.mjs} +0 -0
@@ -52,9 +52,9 @@ export const UPGRADE_RUNLIST = Object.freeze([
52
52
  ),
53
53
  entry(
54
54
  'gates-migration',
55
- 'node ${CLAUDE_SKILL_DIR}/references/scripts/migrate-gates.mjs --kit-tools ${CLAUDE_SKILL_DIR}/tools --cwd <project>',
56
- 'preview first — apply only on an explicit yes, re-run with --apply',
57
- ['preview', 'INERT', 'CUSTOMIZED'],
55
+ 'node ${CLAUDE_SKILL_DIR}/references/scripts/gates/migrate-gates.mjs --kit-tools ${CLAUDE_SKILL_DIR}/tools --cwd <project> --apply',
56
+ 'the coverage-check add alone: on the user\'s explicit yes, run its printed OFFER line, the same command with --apply --add-checker',
57
+ ['SWITCH', 'EXTEND', 'REMOVE', 'KEPT', 'CUSTOMIZED', 'OFFER'],
58
58
  ),
59
59
  entry(
60
60
  'bridges',
@@ -2,7 +2,7 @@ import { join, resolve } from 'node:path';
2
2
  import { dirCovers } from './declared-paths.mjs';
3
3
  import { claudeDirOf, quoteArg, skillTargets } from './jev-facts.mjs';
4
4
  import { targetsFor } from './jev-connect.mjs';
5
- import { BUNDLED_SCRIPT_NAMES, INSTALLER_REL, SCRIPTS_DIR } from './node-evidence.mjs';
5
+ import { DEPLOYED_SCRIPTS, INSTALLER_REL } from './node-evidence.mjs';
6
6
  import { dqUnsafePath } from './checker-claim.mjs';
7
7
  import { isLineUnsafe } from './source-size-refusal.mjs';
8
8
  import { SOURCE_SIZE_GATE_ID } from './source-size-gate-cmd.mjs';
@@ -112,7 +112,7 @@ const getStartupPaths = ({ env, home, platform }) => targetsFor({
112
112
  }).filter(({ path }) => path !== null).map(({ path }) => path);
113
113
 
114
114
  const preCommitOf = (facts) => join(facts.hooksDir ?? join(facts.root, '.git', 'hooks'), 'pre-commit');
115
- const getEnforcementPaths = (facts) => [...BUNDLED_SCRIPT_NAMES.map((name) => join(facts.root, SCRIPTS_DIR, name)), preCommitOf(facts)];
115
+ const getEnforcementPaths = (facts) => [...DEPLOYED_SCRIPTS.map(({ deployed }) => join(facts.root, deployed)), preCommitOf(facts)];
116
116
  const getGuardPaths = (facts) => [preCommitOf(facts), join(facts.root, INSTALLER_REL)];
117
117
 
118
118
  const formatCommand = (argv) => argv.map(quoteArg).join(' ');
@@ -1,41 +0,0 @@
1
- // Minimal dependency-free `expect` shim mapping the Vitest matchers used by the
2
- // kernel's *.test.mjs onto node:assert, so the suite runs under `node --test` with
3
- // zero dependencies. Supports only the matchers these tests use.
4
- import assert from 'node:assert/strict';
5
-
6
- const has = (actual, expected) => {
7
- if (typeof actual === 'string') return actual.includes(expected);
8
- if (Array.isArray(actual)) return actual.includes(expected);
9
- return false;
10
- };
11
-
12
- const matchers = (actual, negate) => ({
13
- toBe: (expected) =>
14
- negate ? assert.notStrictEqual(actual, expected) : assert.strictEqual(actual, expected),
15
- toEqual: (expected) =>
16
- negate ? assert.notDeepStrictEqual(actual, expected) : assert.deepStrictEqual(actual, expected),
17
- toContain: (expected) =>
18
- assert.ok(
19
- negate ? !has(actual, expected) : has(actual, expected),
20
- `expected ${JSON.stringify(actual)} ${negate ? 'not ' : ''}to contain ${JSON.stringify(expected)}`,
21
- ),
22
- toMatch: (re) => (negate ? assert.doesNotMatch(actual, re) : assert.match(actual, re)),
23
- toHaveLength: (n) =>
24
- negate ? assert.notStrictEqual(actual.length, n) : assert.strictEqual(actual.length, n),
25
- toBeNull: () => (negate ? assert.notStrictEqual(actual, null) : assert.strictEqual(actual, null)),
26
- toBeInstanceOf: (Ctor) =>
27
- assert.ok(
28
- negate ? !(actual instanceof Ctor) : actual instanceof Ctor,
29
- `expected value ${negate ? 'not ' : ''}to be instance of ${Ctor.name}`,
30
- ),
31
- toBeGreaterThan: (n) =>
32
- assert.ok(negate ? !(actual > n) : actual > n, `expected ${actual} ${negate ? 'not ' : ''}> ${n}`),
33
- toBeLessThan: (n) =>
34
- assert.ok(negate ? !(actual < n) : actual < n, `expected ${actual} ${negate ? 'not ' : ''}< ${n}`),
35
- });
36
-
37
- export const expect = (actual) => {
38
- const api = matchers(actual, false);
39
- api.not = matchers(actual, true);
40
- return api;
41
- };
@@ -1,321 +0,0 @@
1
- import { describe, it } from 'node:test';
2
- import { readFileSync, writeFileSync, mkdirSync, mkdtempSync, rmSync, readdirSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { tmpdir } from 'node:os';
5
- import { expect } from './_expect-shim.mjs';
6
- import { runCli } from './archive-changelog.mjs';
7
-
8
- // RED-FIRST, and deliberately a DYNAMIC import: `archive-caps.mjs` does not exist when these arms
9
- // are first recorded, and a STATIC import of an absent module makes the WHOLE file unloadable — every
10
- // arm would then be recorded as "unresolvable" rather than as failing, which proves nothing about the
11
- // behaviour it pins. Imported this way the file still loads and each arm fails on its own missing
12
- // symbol.
13
- const caps = await import('./archive-caps.mjs').catch(() => ({}));
14
-
15
- // The tier table, restated here on purpose. A test that imports the table it is checking agrees with
16
- // the source by construction and pins nothing; these three rows are the frozen contract, and moving a
17
- // number in the module must break this file.
18
- const TABLE = [
19
- ['cold', 1500, 3000],
20
- ['warm', 3500, 7000],
21
- ['meta', 1500, 3000],
22
- ];
23
-
24
- // Every arm builds its own corpus under a temp root and passes a fixed `--today`, so nothing here
25
- // reads the project's own `docs/ai` — these pass in a clean checkout where that tree is absent.
26
- const TODAY = '2026-06-15';
27
- const FM = '---\ntype: history\nlastUpdated: 2026-06-15\nscope: permanent\nstaleAfter: never\nowner: none\nmaxLines: 700\n---\n';
28
-
29
- const makeRoot = () => {
30
- const root = mkdtempSync(join(tmpdir(), 'archive-caps-'));
31
- mkdirSync(join(root, 'docs', 'ai', 'history'), { recursive: true });
32
- return root;
33
- };
34
-
35
- // TALL entries carry a files block and a metric, so compression keeps eight lines of them; MINIMAL
36
- // entries keep three. The difference is how a tier is driven to a chosen size: COLD/WARM need height,
37
- // META needs COUNT (one line per archived entry) with every month's own COLD file left small.
38
- const entryBlock = (dateStr, n, tall) =>
39
- tall
40
- ? `## ${dateStr} — synthetic ${n}\n\n**Goal:** synthetic session ${n}.\n\n**Files:**\n- \`src/f${n}.mjs\`\n\n**Result:** ${n} tests\n`
41
- : `## ${dateStr} — synthetic ${n}\n\n**Goal:** synthetic session ${n}.\n`;
42
-
43
- const seed = (root, dates, tall = true) => {
44
- const body = dates.map((d, i) => entryBlock(d, i + 1, tall)).join('\n');
45
- writeFileSync(join(root, 'docs', 'ai', 'changelog.md'), `${FM}\n# Changelog\n\n${body}`, 'utf8');
46
- };
47
-
48
- const day = (i) => String((i % 28) + 1).padStart(2, '0');
49
-
50
- // One month, well behind the WARM cutoff — everything lands in that month's COLD file.
51
- const oneMonth = (count) => Array.from({ length: count }, (_, i) => `2026.03.${day(i)}`);
52
-
53
- // Inside the WARM window (older than today-3, newer than today-30 = 2026-05-16).
54
- const warmWindow = (count) =>
55
- Array.from({ length: count }, (_, i) => `2026.05.${String(17 + (i % 14)).padStart(2, '0')}`);
56
-
57
- // Spread across many CLOSED months so META grows by count while no single COLD file gets near its
58
- // own ceiling — the only shape in which META can be the tier that refuses.
59
- const manyMonths = (months, perMonth) => {
60
- const dates = [];
61
- for (let m = 0; m < months; m += 1) {
62
- const year = 2019 + Math.floor(m / 12);
63
- const month = String((m % 12) + 1).padStart(2, '0');
64
- for (let i = 0; i < perMonth; i += 1) dates.push(`${year}.${month}.${day(i)}`);
65
- }
66
- return dates;
67
- };
68
-
69
- const run = (root, argv) => {
70
- const out = [];
71
- const err = [];
72
- const code = runCli([...argv, `--today=${TODAY}`], {
73
- root,
74
- log: (m) => out.push(String(m)),
75
- logError: (m) => err.push(String(m)),
76
- });
77
- return { code, out: out.join('\n'), err: err.join('\n') };
78
- };
79
-
80
- const historyDir = (root) => join(root, 'docs', 'ai', 'history');
81
- const emitted = (root, name) => readFileSync(join(historyDir(root), name), 'utf8');
82
-
83
- // A refusal must leave the tree BYTE-unchanged, and "the history dir is still empty" does not say
84
- // that: it would miss a rewritten changelog.md. Snapshot every file under docs/ai instead.
85
- // Built with fromCharCode, not an escape literal: the separator only has to be deterministic, and
86
- // spelling it in code points keeps a stray byte out of a file the NUL guard scans.
87
- const SEP = String.fromCharCode(10, 64, 64, 10);
88
- const snapshot = (root) => {
89
- const base = join(root, 'docs', 'ai');
90
- const walk = (dir, prefix) =>
91
- readdirSync(dir, { withFileTypes: true })
92
- .sort((a, b) => a.name.localeCompare(b.name))
93
- .flatMap((entry) =>
94
- entry.isDirectory()
95
- ? walk(join(dir, entry.name), `${prefix}${entry.name}/`)
96
- : [`${prefix}${entry.name}:${readFileSync(join(dir, entry.name), 'utf8')}`],
97
- );
98
- return walk(base, '').join(SEP);
99
- };
100
- const stampOf = (text) => Number(/^maxLines: (\d+)$/m.exec(text)[1]);
101
- const countOf = (text) => text.split('\n').length - (text.endsWith('\n') ? 1 : 0);
102
-
103
- const refusal = (fn) => {
104
- try {
105
- fn();
106
- return null;
107
- } catch (err) {
108
- return err;
109
- }
110
- };
111
-
112
- const withRoot = (body) => {
113
- const root = makeRoot();
114
- try {
115
- body(root);
116
- } finally {
117
- rmSync(root, { recursive: true, force: true });
118
- }
119
- };
120
-
121
- describe('capFor — the frozen tier table', () => {
122
- for (const [tier, floor, ceiling] of TABLE) {
123
- it(`capFor: ${tier} stamps the floor below it, its own count inside the band, and the ceiling itself`, () => {
124
- expect(caps.capFor({ tier, count: 0 })).toBe(floor);
125
- expect(caps.capFor({ tier, count: floor - 1 })).toBe(floor);
126
- expect(caps.capFor({ tier, count: floor })).toBe(floor);
127
- expect(caps.capFor({ tier, count: floor + 1 })).toBe(floor + 1);
128
- expect(caps.capFor({ tier, count: ceiling - 1 })).toBe(ceiling - 1);
129
- // The boundary ACCEPTS. A cap equal to the count is a cap the file honours, so the ceiling is
130
- // the LAST count that can be stamped, never the first that refuses — and stamping the count
131
- // (not the ceiling) here is what separates this from a `Math.min(count, ceiling)` that would
132
- // pass the boundary arm while getting the whole band wrong.
133
- expect(caps.capFor({ tier, count: ceiling })).toBe(ceiling);
134
- });
135
-
136
- it(`capFor: ${tier} refuses one line past its ceiling`, () => {
137
- const err = refusal(() => caps.capFor({ tier, count: ceiling + 1 }));
138
- expect(err).not.toBeNull();
139
- expect(err.message).toContain(`${ceiling}-line ceiling`);
140
- expect(err.exitCode).toBe(1);
141
- });
142
- }
143
-
144
- it('capFor: an unknown tier and a nonsense count both refuse rather than stamp a default', () => {
145
- expect(refusal(() => caps.capFor({ tier: 'lukewarm', count: 10 })).message).toContain('unknown archive tier');
146
- expect(refusal(() => caps.capFor({ tier: 'cold', count: -1 })).message).toContain('non-negative integer');
147
- expect(refusal(() => caps.capFor({ tier: 'cold', count: 1.5 })).message).toContain('non-negative integer');
148
- });
149
-
150
- it('countLines: counts the docs gate its own way — a trailing newline ends a line, it never opens one', () => {
151
- expect(caps.countLines('a\nb\n')).toBe(2);
152
- expect(caps.countLines('a\nb')).toBe(2);
153
- expect(caps.countLines('a\n')).toBe(1);
154
- expect(caps.countLines('a\n\n')).toBe(2);
155
- });
156
-
157
- it('shardingWarning: silent under the floor, and past it names the tier, the count and the remedy', () => {
158
- expect(caps.shardingWarning({ tier: 'meta', count: 1500 })).toBeNull();
159
- const warning = caps.shardingWarning({ tier: 'meta', count: 1501 });
160
- expect(warning).toContain('1501');
161
- expect(warning).toContain('1500-line floor');
162
- expect(warning).toContain('condensed-index-YYYY.md');
163
- });
164
- });
165
-
166
- describe('the archiver stamps a cap it can honour', () => {
167
- it('cold: a band-sized month stamps its own count and round-trips byte-identically', () => {
168
- withRoot((root) => {
169
- seed(root, oneMonth(160));
170
- expect(run(root, []).code).toBe(0);
171
-
172
- const first = emitted(root, '2026-03.md');
173
- const count = countOf(first);
174
- // Strictly inside the band: below the floor the tier would stamp the floor and this arm would
175
- // pin nothing; at or above the ceiling it would refuse.
176
- expect(count).toBeGreaterThan(1500);
177
- expect(count).toBeLessThan(3001);
178
- expect(stampOf(first)).toBe(count);
179
-
180
- // The byte fixed point, under the new stamp: run two re-reads what run one wrote — including
181
- // the cap it stamped — and must reproduce it exactly.
182
- expect(run(root, []).code).toBe(0);
183
- expect(emitted(root, '2026-03.md')).toBe(first);
184
- });
185
- });
186
-
187
- it('warm: a band-sized window stamps its own count and round-trips byte-identically', () => {
188
- withRoot((root) => {
189
- seed(root, warmWindow(400));
190
- expect(run(root, []).code).toBe(0);
191
-
192
- const first = emitted(root, 'recent.md');
193
- const count = countOf(first);
194
- expect(count).toBeGreaterThan(3500);
195
- expect(count).toBeLessThan(7001);
196
- expect(stampOf(first)).toBe(count);
197
-
198
- expect(run(root, []).code).toBe(0);
199
- expect(emitted(root, 'recent.md')).toBe(first);
200
- });
201
- });
202
-
203
- it('meta: a band-sized corpus stamps its own count and round-trips byte-identically', () => {
204
- withRoot((root) => {
205
- seed(root, manyMonths(32, 50), false);
206
- expect(run(root, []).code).toBe(0);
207
-
208
- const first = emitted(root, 'condensed-index.md');
209
- const count = countOf(first);
210
- expect(count).toBeGreaterThan(1500);
211
- expect(count).toBeLessThan(3001);
212
- expect(stampOf(first)).toBe(count);
213
-
214
- expect(run(root, []).code).toBe(0);
215
- expect(emitted(root, 'condensed-index.md')).toBe(first);
216
- });
217
- });
218
-
219
- it('a tier under its floor still stamps the floor — the cap never shrinks to the corpus', () => {
220
- withRoot((root) => {
221
- seed(root, oneMonth(4));
222
- expect(run(root, []).code).toBe(0);
223
- const cold = emitted(root, '2026-03.md');
224
- expect(countOf(cold)).toBeLessThan(1500);
225
- expect(stampOf(cold)).toBe(1500);
226
- });
227
- });
228
- });
229
-
230
- describe('the archiver refuses past a ceiling, identically in every mode', () => {
231
- // The refusal has to fire in --check and --dry-run as well as the default run, or the standing
232
- // `--check` gate would go green on a corpus the next real run cannot write. That is only true if
233
- // every output is BUILT before the mode branch — which is what these three arms pin.
234
- const modes = [[], ['--dry-run'], ['--check']];
235
-
236
- // Each mode gets its OWN fixture: sharing one root lets an earlier mode's write hide inside a
237
- // later mode's assertion. And the tree is compared WHOLE before and after, so a rewritten
238
- // changelog.md is caught as well as a written archive.
239
- const refusesInEveryMode = (dates, tall, ceiling) => {
240
- for (const argv of modes) {
241
- withRoot((root) => {
242
- seed(root, dates, tall);
243
- const before = snapshot(root);
244
- const result = run(root, argv);
245
- expect(result.code).toBe(1);
246
- expect(result.err).toContain(`${ceiling}-line ceiling`);
247
- expect(snapshot(root)).toBe(before);
248
- });
249
- }
250
- };
251
-
252
- it('cold: a month past the ceiling refuses in all three modes', () => {
253
- refusesInEveryMode(oneMonth(400), true, 3000);
254
- });
255
-
256
- it('warm: a window past the ceiling refuses in all three modes', () => {
257
- refusesInEveryMode(warmWindow(700), true, 7000);
258
- });
259
-
260
- it('meta: a corpus past the ceiling refuses in all three modes', () => {
261
- refusesInEveryMode(manyMonths(62, 50), false, 3000);
262
- });
263
-
264
- // Two arms, deliberately separate: this one pins that a refusal is ACTIONABLE at all — it names
265
- // the tier, the measured size and a remedy clause, rather than a bare number the reader has to
266
- // interpret.
267
- it('the refusal names the tier and the remedy, not just the number', () => {
268
- withRoot((root) => {
269
- seed(root, oneMonth(400));
270
- const cold = run(root, ['--check']);
271
- expect(cold.err).toContain('cold archive is');
272
- expect(cold.err).toContain('-line ceiling');
273
- expect(cold.err).toContain('Remedy:');
274
- });
275
- });
276
-
277
- // And this one pins that the remedy is RIGHT for the tier it is printed for. One piece of advice
278
- // would be wrong for two of the three: COLD is already one file per month, and WARM's size is a
279
- // flag rather than a layout. A remedy must also never name a layout the archiver cannot read back.
280
- it('the refusal names the tier and a remedy that fits THAT tier', () => {
281
- withRoot((root) => {
282
- seed(root, oneMonth(400));
283
- const cold = run(root, ['--check']);
284
- expect(cold.err).toContain('already one file per month');
285
- expect(cold.err).toContain('NOT implemented');
286
- });
287
- withRoot((root) => {
288
- seed(root, warmWindow(700));
289
- const warm = run(root, ['--check']);
290
- expect(warm.err).toContain('warm archive is');
291
- expect(warm.err).toContain('--warm-days');
292
- });
293
- withRoot((root) => {
294
- seed(root, manyMonths(62, 50), false);
295
- const meta = run(root, ['--check']);
296
- expect(meta.err).toContain('meta archive is');
297
- expect(meta.err).toContain('condensed-index-YYYY.md');
298
- });
299
- });
300
- });
301
-
302
- describe('the sharding tripwire', () => {
303
- it('meta past its floor warns while still passing, so the remedy lands before the ceiling', () => {
304
- withRoot((root) => {
305
- seed(root, manyMonths(32, 50), false);
306
- const result = run(root, []);
307
- expect(result.code).toBe(0);
308
- expect(result.err).toContain('past its 1500-line floor');
309
- expect(result.err).toContain('condensed-index-YYYY.md');
310
- });
311
- });
312
-
313
- it('meta under its floor says nothing at all', () => {
314
- withRoot((root) => {
315
- seed(root, oneMonth(4));
316
- const result = run(root, []);
317
- expect(result.code).toBe(0);
318
- expect(result.err).not.toMatch(/floor/);
319
- });
320
- });
321
- });