@roomi-fields/grillhouse 0.43.1 → 0.43.2

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.
@@ -5,5 +5,5 @@
5
5
  "author": {
6
6
  "name": "Romain Peyrichou"
7
7
  },
8
- "version": "0.43.1"
8
+ "version": "0.43.2"
9
9
  }
package/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.43.2] - 2026-11-18
10
+
11
+ - **A guard that reads a part of the repository lowers the debt of what it read only** (grillhouse-8if): in the envelope of a plan, the check of the interfaces, the one of the consumers' arbitrations and the one of the summaries read the components of the plan alone (`aVerifier`), but the known debt judged their findings against the whole section of the guard: every key of a component they did not read counted « 0 constat(s) pour N inscrit(s) », became a note « à élaguer », and the circuit, lowering the debt from the notes of its checks, removed the debt of every other package (BPScript, 320.42: 246 lines of `grillhouse-dette.json`, then a final pass red on 169 findings out of the plan). Such a guard now says which files it read (`mesureDe`, the sixth argument of `trancher` of `scripts/dette.mjs`), as a baseline of PHPStan is pruned of the files analysed only: the keys of the others are neither judged corrected, nor pruned, nor written again. **Action for projects**: a `grillhouse-dette.json` a circuit emptied this way is restored from main, then `npm run grillhouse:dette:elaguer` out of any envelope.
12
+
9
13
  ## [0.43.1] - 2026-11-17
10
14
 
11
15
  - **A lot that removes a generated file with its command enters main** (grillhouse-1k7): the integration, the queue and the move of a copy onto main played the command of every generated file a lot touches, read in main's `package.json`, even when the lot removes that file, its script and its entry of `grillhouse.engendres`: the command, whose script the lot deletes, failed, and the lot was refused (SyntHub, SH-br0.3, « python3 scripts/build_device_index.py … can't open file »). An entry the tree where the lot is applied no longer declares (`encoreDeclares` of `scripts/engendres.mjs`) is not played, and its files follow the lot: a deletion is done whatever main wrote since, any other change is applied as a file of the lot (`poserLesRetires`, `prendreLesEngendres`). The command line stays main's: a lot removes one, it writes none. **Action for projects**: none; a circuit stopped on that refusal resumes (`--reprendre`).
@@ -251,7 +251,9 @@ le code de sortie d'un générateur du cadre, qui juge aussi les rouges qu'il la
251
251
  refuse à côté d'eux) : il juge la régénération sur ce qu'elle écrit, puis sur la passe restreinte
252
252
  qui suit, et seule une vraie panne l'arrête (la commande introuvable, ou tuée par un signal). La dette s'abaisse depuis les notes de la passe finale et depuis celles des contrôles du plan
253
253
  (3.1), qui lisent leurs notes `a-elaguer` (une note du SARIF d'une garde, chaque clé inscrite
254
- au-dessus de ce qu'elle trouve) et régénèrent la dette, par
254
+ au-dessus de ce qu'elle trouve, parmi les fichiers qu'elle a mesurés : une garde qui lit une
255
+ partie du dépôt, les composants du plan sous l'enveloppe, ne note rien des autres, comme une ligne
256
+ de base de PHPStan ne s'élague que des fichiers analysés) et régénèrent la dette, par
255
257
  `dette.mjs --abaisser`, sans rejouer les gardes. Elle inscrit aussi la dette d'une garde que le lot
256
258
  ajoute, absente des gardes de main (le circuit les nomme à la passe par `GRILLHOUSE_GARDES_DE_LA_BASE`) :
257
259
  chaque fichier et règle de ses constats est une note `a-inscrire`, au compte trouvé, que la
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomi-fields/grillhouse",
3
- "version": "0.43.1",
3
+ "version": "0.43.2",
4
4
  "description": "Roomi's Grillhouse: the frame's scripts, called by one command, grillhouse <sous-commande>",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -12,12 +12,14 @@ export type Constat = {
12
12
  /**
13
13
  * Judges the findings of `garde` at `racine` against `grillhouse-dette.json`, in the mode `mode`
14
14
  * (`GRILLHOUSE_DETTE` by default): `refus` the findings to print as refusals, `lignes` the lines
15
- * to print after them.
15
+ * to print after them. A guard that reads a part of the repository gives `mesure`, whether it read
16
+ * a file (from the root): the keys of the other files stay as they are.
16
17
  */
17
18
  export function trancher(
18
19
  racine: string,
19
20
  garde: string,
20
21
  constats: Constat[],
21
22
  mode?: string,
22
- env?: Record<string, string | undefined>
23
+ env?: Record<string, string | undefined>,
24
+ mesure?: (fichier: string) => boolean
23
25
  ): { refus: Constat[]; lignes: string[] };
package/scripts/dette.mjs CHANGED
@@ -80,22 +80,42 @@ export function lire(racine) {
80
80
  }
81
81
  }
82
82
 
83
- // <dette> with the section of <garde> replaced by what <constats> count; the guard leaves the file
84
- // when it finds nothing.
85
- export function inscrire(dette, garde, constats) {
86
- const reste = { ...dette };
87
- delete reste[garde];
88
- const comptes = compter(constats);
83
+ // Every file is measured: the answer of a guard that reads the whole repository.
84
+ const TOUT = () => true;
85
+
86
+ // The keys of the section <ancienne> of a guard, as counts, that a run did not measure (<mesure>,
87
+ // whether it read a file): a guard that reads a part of the repository (the components of a plan,
88
+ // in an envelope) knows nothing of the others, as a baseline of PHPStan is pruned of the files
89
+ // analysed only.
90
+ function nonMesurees(ancienne, mesure) {
91
+ const out = new Map();
92
+ for (const [fichier, regles] of Object.entries(ancienne)) {
93
+ if (!mesure(fichier)) {
94
+ out.set(fichier, new Map(Object.entries(regles).map(([regle, { count }]) => [regle, count])));
95
+ }
96
+ }
97
+ return out;
98
+ }
99
+
100
+ // <dette> with the section of <garde> replaced by what <constats> count, the keys of the files the
101
+ // run did not measure (<mesure>) kept; the guard leaves the file when nothing remains.
102
+ export function inscrire(dette, garde, constats, mesure = TOUT) {
103
+ const { [garde]: ancienne = {}, ...reste } = dette;
104
+ const comptes = new Map([...nonMesurees(ancienne, mesure), ...compter(constats)]);
89
105
  return comptes.size ? { ...reste, [garde]: section(comptes) } : reste;
90
106
  }
91
107
 
92
108
  // <dette> with each count of <garde> lowered to what <constats> count, the keys at zero dropped;
93
- // a count never rises and no key is added.
94
- export function elaguer(dette, garde, constats) {
109
+ // a count never rises and no key is added. The keys of the files the run did not measure
110
+ // (<mesure>) stay as they are.
111
+ export function elaguer(dette, garde, constats, mesure = TOUT) {
95
112
  const { [garde]: ancienne = {}, ...reste } = dette;
96
113
  const comptes = compter(constats);
97
- const garde2 = new Map();
114
+ const garde2 = nonMesurees(ancienne, mesure);
98
115
  for (const [fichier, regles] of Object.entries(ancienne)) {
116
+ if (!mesure(fichier)) {
117
+ continue;
118
+ }
99
119
  for (const [regle, { count }] of Object.entries(regles)) {
100
120
  const n = Math.min(count, comptes.get(fichier)?.get(regle) ?? 0);
101
121
  if (n === 0) {
@@ -112,9 +132,9 @@ export function elaguer(dette, garde, constats) {
112
132
 
113
133
  // <constats> of <garde> judged against <dette>: `refus` the findings the guard refuses (those
114
134
  // without key, and every finding of a key beyond its count), `depasses` the keys beyond a non-zero
115
- // count, `corriges` the keys inscribed above what is found, `tus` the number of findings the debt
116
- // covers.
117
- export function juger(dette, garde, constats) {
135
+ // count, `corriges` the keys inscribed above what is found, among the files the run measured
136
+ // (<mesure>), `tus` the number of findings the debt covers.
137
+ export function juger(dette, garde, constats, mesure = TOUT) {
118
138
  const inscrite = dette[garde] ?? {};
119
139
  const comptes = compter(constats);
120
140
  const permis = (fichier, regle) => inscrite[fichier]?.[regle]?.count ?? 0;
@@ -132,6 +152,9 @@ export function juger(dette, garde, constats) {
132
152
  }
133
153
  const corriges = [];
134
154
  for (const [fichier, regles] of Object.entries(inscrite)) {
155
+ if (!mesure(fichier)) {
156
+ continue;
157
+ }
135
158
  for (const [regle, { count }] of Object.entries(regles)) {
136
159
  const trouve = comptes.get(fichier)?.get(regle) ?? 0;
137
160
  if (trouve < count) {
@@ -150,9 +173,18 @@ export function juger(dette, garde, constats) {
150
173
  // guard's findings in SARIF too, under the results directory <env> names (scripts/resultats.mjs),
151
174
  // each with its file, its line when the guard gives one, and its rule; beside them, each key
152
175
  // inscribed above what the guard finds is a note (`a-elaguer`, level `note`), no red, by which the
153
- // circuit lowers the debt d'office at the final pass (scripts/circuit.mjs, 4.2).
154
- export function trancher(racine, garde, constats, mode = process.env[MODE] || undefined, env) {
155
- const { refus, lignes, corriges } = juge(racine, garde, constats, mode);
176
+ // circuit lowers the debt d'office at the final pass (scripts/circuit.mjs, 4.2). A guard that
177
+ // reads a part of the repository gives <mesure>, whether it read a file (from the root): the keys
178
+ // of the others are neither judged corrected, nor pruned, nor written again.
179
+ export function trancher(
180
+ racine,
181
+ garde,
182
+ constats,
183
+ mode = process.env[MODE] || undefined,
184
+ env,
185
+ mesure = TOUT
186
+ ) {
187
+ const { refus, lignes, corriges } = juge(racine, garde, constats, mode, mesure);
156
188
  const notes = corriges.map(c => ({
157
189
  fichier: c.fichier,
158
190
  regle: c.regle,
@@ -255,7 +287,7 @@ export function abaisser(racine, notes) {
255
287
  return change;
256
288
  }
257
289
 
258
- function juge(racine, garde, constats, mode) {
290
+ function juge(racine, garde, constats, mode, mesure) {
259
291
  let avant;
260
292
  try {
261
293
  if (mode !== undefined && !MODES.has(mode)) {
@@ -269,7 +301,9 @@ function juge(racine, garde, constats, mode) {
269
301
  const lignes = [];
270
302
  if (mode) {
271
303
  dette =
272
- mode === 'inscrire' ? inscrire(avant, garde, constats) : elaguer(avant, garde, constats);
304
+ mode === 'inscrire'
305
+ ? inscrire(avant, garde, constats, mesure)
306
+ : elaguer(avant, garde, constats, mesure);
273
307
  if (JSON.stringify(dette) !== JSON.stringify(avant)) {
274
308
  ecrire(racine, dette);
275
309
  lignes.push(
@@ -277,7 +311,7 @@ function juge(racine, garde, constats, mode) {
277
311
  );
278
312
  }
279
313
  }
280
- const { refus, depasses, corriges, tus } = juger(dette, garde, constats);
314
+ const { refus, depasses, corriges, tus } = juger(dette, garde, constats, mesure);
281
315
  for (const d of depasses) {
282
316
  lignes.push(
283
317
  `⛔ ${garde} : ${d.fichier} · ${d.regle} — ${d.trouve} constat(s) pour ${d.inscrit} inscrit(s) dans ${FICHIER} : un constat est neuf.`
@@ -41,7 +41,7 @@ import { pathToFileURL } from 'node:url';
41
41
  import { lireLigne } from './consommateurs.mjs';
42
42
  import { trancher } from '../../dette.mjs';
43
43
  import { arbitrageTranche, estArbitrage } from '../../services-du-noyau.mjs';
44
- import { aVerifier, marques } from './interfaces-contre-code.mjs';
44
+ import { aVerifier, marques, mesureDe } from './interfaces-contre-code.mjs';
45
45
 
46
46
  const REGLE = 'consommateur-sans-arbitrage';
47
47
 
@@ -244,7 +244,14 @@ export function juger(ticket, interfaces, commentaires, ticketLu) {
244
244
 
245
245
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
246
246
  const racine = process.cwd();
247
- const { refus, lignes } = trancher(racine, 'consommateurs-arbitres', verifier(racine));
247
+ const { refus, lignes } = trancher(
248
+ racine,
249
+ 'consommateurs-arbitres',
250
+ verifier(racine),
251
+ undefined,
252
+ undefined,
253
+ mesureDe(racine)
254
+ );
248
255
  for (const r of refus) {
249
256
  process.stderr.write(`⛔ ${r.message}\n`);
250
257
  }
@@ -602,6 +602,25 @@ export function aVerifier(racine, env = process.env) {
602
602
  return siens.length ? siens : tous;
603
603
  }
604
604
 
605
+ /**
606
+ * Whether a run at <racine> in <env> read the file <fichier> (from the root), for the known debt
607
+ * (`trancher` of scripts/dette.mjs): a file of a component it reads (`aVerifier`). Undefined when
608
+ * it reads every component.
609
+ * @param {string} racine
610
+ * @param {NodeJS.ProcessEnv} [env]
611
+ * @returns {((fichier: string) => boolean) | undefined}
612
+ */
613
+ export function mesureDe(racine, env = process.env) {
614
+ const lus = aVerifier(racine, env).map(c => path.resolve(c.dir));
615
+ if (lus.length === composants(racine).length) {
616
+ return undefined;
617
+ }
618
+ return fichier => {
619
+ const f = path.resolve(racine, fichier);
620
+ return lus.some(d => f === d || f.startsWith(d + path.sep));
621
+ };
622
+ }
623
+
605
624
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
606
625
  const racine = process.cwd();
607
626
  const ecrire = process.argv.includes('--ecrire');
@@ -613,7 +632,14 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
613
632
  }
614
633
  constats.push(...refus);
615
634
  }
616
- const { refus, lignes } = trancher(racine, 'interfaces-contre-code', constats);
635
+ const { refus, lignes } = trancher(
636
+ racine,
637
+ 'interfaces-contre-code',
638
+ constats,
639
+ undefined,
640
+ undefined,
641
+ mesureDe(racine)
642
+ );
617
643
  for (const r of refus) {
618
644
  process.stderr.write(`⛔ ${r.message}\n`);
619
645
  }
@@ -15,13 +15,14 @@
15
15
  // written in the documentation comment of the export, and `npm run api` carries it over.
16
16
  // - A refusal inscribed in the project's debt (`grillhouse-dette.json`, see `dette.mjs`) passes,
17
17
  // keyed by the interface and `resume-trop-long`.
18
- // - In an envelope (`GRILLHOUSE_ENVELOPPE`), the components of its plan alone are judged.
18
+ // - In an envelope (`GRILLHOUSE_ENVELOPPE`), the components of its plan alone are judged, and the
19
+ // debt of the others is left as it is (`mesureDe`).
19
20
  import { existsSync, readFileSync } from 'node:fs';
20
21
  import path from 'node:path';
21
22
  import { pathToFileURL } from 'node:url';
22
23
  import { MODE, trancher } from '../../dette.mjs';
23
24
  import { lire } from './index-interfaces.mjs';
24
- import { aVerifier } from './interfaces-contre-code.mjs';
25
+ import { aVerifier, mesureDe } from './interfaces-contre-code.mjs';
25
26
 
26
27
  // The longest first sentence of a summary, in characters.
27
28
  export const LONGUEUR_MAX = 80;
@@ -57,7 +58,14 @@ export function verifier(racine, env = process.env) {
57
58
  // `trancher` under the results directory <env> names (scripts/resultats.mjs); without it none is
58
59
  // written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
59
60
  export function rapport(racine, env = process.env) {
60
- const { refus, lignes } = trancher(racine, 'resumes', verifier(racine, env), env[MODE] || undefined, env);
61
+ const { refus, lignes } = trancher(
62
+ racine,
63
+ 'resumes',
64
+ verifier(racine, env),
65
+ env[MODE] || undefined,
66
+ env,
67
+ mesureDe(racine, env)
68
+ );
61
69
  return {
62
70
  lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes],
63
71
  code: refus.length ? 1 : 0,