@roomi-fields/grillhouse 0.43.0 → 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.0"
8
+ "version": "0.43.2"
9
9
  }
package/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ 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
+
13
+ ## [0.43.1] - 2026-11-17
14
+
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`).
16
+
9
17
  ## [0.43.0] - 2026-11-17
10
18
 
11
19
  - **The day of the board counts the tokens since the day's marker, as it counts the time** (grillhouse-38t): a session still open counted in the day the part of its turns since the marker, but all the tokens of its transcript — a supervisor's session opened days ago read « jour 6 min · 37,0 M » right after `/grillhouse newday` (OSC Bridge). A measure that holds its tokens by minute now counts in the day those of the minutes since the marker (`jetonsDuJour`); a register line without them counts whole in the day it ended, as before. And the time of the supervisor's own session counts neither in the day nor in the cumul, its tokens still do: open for weeks, each of its turns counted from the request to the end of the answer, its waits included — 2 025 h of « travail » for one session of OSC Bridge, where SyntHub's whole cumul read 135 h; the time of the two figures is now the work of the agents and of the circuits. **Action for projects**: none.
@@ -59,8 +59,9 @@ interface publiée…>. Le cadre et l'architecture montent toujours (charte comm
59
59
  chaque motif depuis la racine : un fichier qu'un lecteur ne peut pas construire, une page lue
60
60
  sur GitHub ou une somme de contrôle publiée ; l'intégration, la file et l'avance d'une copie
61
61
  sur main ne le fusionnent pas, elles prennent la version de main et rejouent sa commande sur le
62
- lot appliqué ; lue dans l'arbre principal ; une clé sans commande, sans fichiers ou avec un
63
- motif hors du dépôt est refusée par son nom avant tout travail).
62
+ lot appliqué ; lue dans l'arbre principal ; une entrée que le lot retire de la clé n'est plus
63
+ rejouée, et ses fichiers suivent le lot, leur suppression comprise ; une clé sans commande, sans
64
+ fichiers ou avec un motif hors du dépôt est refusée par son nom avant tout travail).
64
65
  - Le nombre de circuits à la fois : la clé `grillhouse.circuits` du `package.json` (un entier
65
66
  ≥ 1, **1** quand elle est absente : les circuits actifs du projet à la fois, que la file des
66
67
  tickets tient ; un circuit arrêté sur une question rend sa place, et repris, la redemande avant
@@ -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
@@ -298,7 +300,8 @@ L'intégration, la file qui replace une branche sur main et l'avance d'une copie
298
300
  (`travail-de-la-copie.mjs`, comme le report d'une branche renvoyée) ne fusionnent pas ces
299
301
  fichiers : un lot qui touche l'un d'eux ou ce qu'il lit prend la version de main, puis la commande
300
302
  rejoue hors de l'enveloppe, avec les outils du projet, sur le lot appliqué, et ce qu'elle écrit
301
- entre dans le lot ; la passe finale (4.2) ne les régénère que si un rouge d'une passe tombe
303
+ entre dans le lot ; une entrée que le lot retire de la clé ne se rejoue pas, et ses fichiers
304
+ suivent le lot, leur suppression comprise, comme un genrule de Bazel retiré avec sa sortie ; la passe finale (4.2) ne les régénère que si un rouge d'une passe tombe
302
305
  dans leurs fichiers. L'intégration régénère aussi une référence du cadre dès que le lot touche ce
303
306
  qu'elle lit : l'index des interfaces se refait quand un `INTERFACE.md` change. Un conflit sur tout autre fichier
304
307
  refuse le lot ; une commande en échec, sa commande et sa sortie nommées, ou un fichier changé
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomi-fields/grillhouse",
3
- "version": "0.43.0",
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.`
@@ -22,6 +22,10 @@
22
22
  // (scripts/integration/file.mjs) and the move of a copy onto main
23
23
  // (scripts/enveloppe/travail-de-la-copie.mjs) call it on the tree where they applied the lot,
24
24
  // main's version of each file taken.
25
+ // - `encoreDeclares` keeps the generated files the tree where the lot is applied still declares, by
26
+ // their names: as a genrule of Bazel removed with its output in one change plays no more, the
27
+ // one a lot removes from the key is not played, and its files follow the lot, their deletion
28
+ // too. The command line stays main's: a lot removes one, it writes none.
25
29
  import { existsSync, readFileSync } from 'node:fs';
26
30
  import path from 'node:path';
27
31
  import { arbrePrincipal } from './outils-cles.mjs';
@@ -124,6 +128,134 @@ export function engendresDe(dir) {
124
128
  return engendres;
125
129
  }
126
130
 
131
+ // The names the text <texte> of a package.json declares under `grillhouse.engendres`, or null when
132
+ // it does not read.
133
+ function nomsDeclares(texte) {
134
+ try {
135
+ const declares = JSON.parse(texte)?.grillhouse?.engendres;
136
+ return new Set(
137
+ declares && typeof declares === 'object' && !Array.isArray(declares)
138
+ ? Object.keys(declares)
139
+ : []
140
+ );
141
+ } catch {
142
+ return null;
143
+ }
144
+ }
145
+
146
+ /**
147
+ * The generated files of <engendres> that the package.json of the tree <arbre>, where a lot is
148
+ * applied, still declares under their names. When it does not read (absent, or in conflict), the
149
+ * two versions of the conflict decide (<etages>, `{ base, lot }`, the text of the package.json
150
+ * before the lot and with it): the lot removes the ones its base declares and it does not. All of
151
+ * them when nothing reads.
152
+ * @template {{ nom: string }} E
153
+ * @param {E[]} engendres
154
+ * @param {string} arbre
155
+ * @param {(() => { base: string, lot: string }) | null} [etages]
156
+ * @returns {E[]}
157
+ */
158
+ export function encoreDeclares(engendres, arbre, etages = null) {
159
+ let texte = null;
160
+ try {
161
+ texte = readFileSync(path.join(arbre, 'package.json'), 'utf8');
162
+ } catch {
163
+ return engendres;
164
+ }
165
+ const noms = nomsDeclares(texte);
166
+ if (noms) {
167
+ return engendres.filter(e => noms.has(e.nom));
168
+ }
169
+ const { base, lot } = etages?.() ?? { base: '', lot: '' };
170
+ const avant = nomsDeclares(base);
171
+ const avec = nomsDeclares(lot);
172
+ return avant && avec ? engendres.filter(e => !avant.has(e.nom) || avec.has(e.nom)) : engendres;
173
+ }
174
+
175
+ /**
176
+ * What the lots applied in the tree <arbre> ask of the references <references> (`{ nom, entiers }`,
177
+ * those of the project, <duProjet>, among them): `suivis`, the files of <entiers> (the files of
178
+ * the lots a reference writes in full, left out of their application) that follow the lots, the
179
+ * ones no reference still declared writes; `rejouees`, the references of <touchees> (those the
180
+ * lots touch) still declared, whose commands play. A reference of the frame is always declared.
181
+ * @template {{ nom: string, entiers: string[] }} R
182
+ * @param {{ references: R[], duProjet: R[], entiers: string[], touchees: R[], arbre: string }} o
183
+ * @returns {{ suivis: string[], rejouees: R[] }}
184
+ */
185
+ export function partDesLots({ references, duProjet, entiers, touchees, arbre }) {
186
+ const declares = encoreDeclares(duProjet, arbre);
187
+ const retire = r => duProjet.includes(r) && !declares.includes(r);
188
+ return {
189
+ suivis: entiers.filter(f => !references.some(r => !retire(r) && couvertPar(r.entiers, f))),
190
+ rejouees: touchees.filter(r => !retire(r)),
191
+ };
192
+ }
193
+
194
+ /**
195
+ * The generated files of <engendres> still declared in the tree <arbre> that the lot of
196
+ * <fichiers> touches: those whose commands play once the lot is applied there.
197
+ * @template {{ nom: string, entiers: string[], lit: string[] }} E
198
+ * @param {E[]} engendres
199
+ * @param {string} arbre
200
+ * @param {string[]} fichiers
201
+ * @returns {E[]}
202
+ */
203
+ export const aRejouer = (engendres, arbre, fichiers) =>
204
+ touchesPar(encoreDeclares(engendres, arbre), fichiers);
205
+
206
+ /**
207
+ * Applies to the tree of <dansCopie> (git in the tree) the files <fichiers> of the lots <lots>
208
+ * (patch files) that an earlier application left out, those of a generated file the lots remove
209
+ * from the key: a deletion is done whatever main's version is, any other change is applied three
210
+ * ways, to the index too. Null, or the refusal.
211
+ * @param {{ lots: string[], fichiers: string[], dansCopie: (...args: string[]) => import('node:child_process').SpawnSyncReturns<string> }} o
212
+ * @returns {string | null}
213
+ */
214
+ export function poserLesRetires({ lots, fichiers, dansCopie }) {
215
+ if (!fichiers.length) {
216
+ return null;
217
+ }
218
+ const seuls = fichiers.map(f => `--include=${f}`);
219
+ for (const p of lots) {
220
+ const supprimes = dansCopie('apply', '--summary', ...seuls, p)
221
+ .stdout.split('\n')
222
+ .map(l => /^ delete mode \d+ (.+)$/.exec(l)?.[1])
223
+ .filter(f => f !== undefined && fichiers.includes(f));
224
+ if (
225
+ supprimes.length &&
226
+ dansCopie('rm', '-q', '-f', '--ignore-unmatch', '--', ...supprimes).status !== 0
227
+ ) {
228
+ return `Les fichiers que le lot ${p} supprime ne se retirent pas :\n${supprimes.map(f => ` ${f}`).join('\n')}`;
229
+ }
230
+ const restent = fichiers.filter(f => !supprimes.includes(f)).map(f => `--include=${f}`);
231
+ if (restent.length) {
232
+ const r = dansCopie('apply', '--3way', '--index', '--allow-empty', ...restent, p);
233
+ if (r.status !== 0) {
234
+ return `Le lot ${p} ne s'applique pas :\n${r.stdout}${r.stderr}`;
235
+ }
236
+ }
237
+ }
238
+ return null;
239
+ }
240
+
241
+ /**
242
+ * Resolves the conflicts <conflits> of a rebase stopped in the tree of <dansCopie>, each on a file
243
+ * a generated file writes in full: main's version (`--ours`, the base of the rebase) for one of
244
+ * <vivants>, the generated files the tree still declares; the branch's version, its deletion too,
245
+ * for the others. Whether every conflict is resolved.
246
+ * @param {{ conflits: string[], vivants: { entiers: string[] }[], dansCopie: (...args: string[]) => import('node:child_process').SpawnSyncReturns<string> }} o
247
+ */
248
+ export function prendreLesEngendres({ conflits, vivants, dansCopie }) {
249
+ const prendre = (cote, f) =>
250
+ dansCopie('checkout', cote, '--', f).status === 0 && dansCopie('add', '--', f).status === 0;
251
+ return conflits.every(f =>
252
+ vivants.some(e => couvertPar(e.entiers, f))
253
+ ? prendre('--ours', f)
254
+ : prendre('--theirs', f) ||
255
+ dansCopie('rm', '-q', '-f', '--ignore-unmatch', '--', f).status === 0
256
+ );
257
+ }
258
+
127
259
  /**
128
260
  * The generated files of <engendres> the lot of <fichiers> touches: one of the files it writes in
129
261
  * full, or one it reads.
@@ -70,7 +70,7 @@ import { spawnSync } from 'node:child_process';
70
70
  import { existsSync, readFileSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
71
71
  import path from 'node:path';
72
72
  import { pathToFileURL } from 'node:url';
73
- import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
73
+ import { couvertPar, encoreDeclares, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
74
74
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
75
75
  import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
76
76
 
@@ -121,7 +121,9 @@ function lesCles(copie) {
121
121
  * deletion of a file main changed), whose patches are `restant`. With <cles> (`lesCles`), the
122
122
  * generated files the lot (or one of <autres>, the copy's untracked files) touches are left out,
123
123
  * then written again by their command once the lot applies without conflict; `refus`, a command
124
- * that fails.
124
+ * that fails. A generated file the lot removes from the key (`encoreDeclares`) follows the lot
125
+ * instead: its deletion is done, any other change applied as a file of the lot, its command not
126
+ * played.
125
127
  * @param {string} copie
126
128
  * @param {Buffer} lot
127
129
  * @param {{ engendres: any[], env: NodeJS.ProcessEnv } | null} [cles]
@@ -136,14 +138,11 @@ function appliquer(copie, lot, cles = null, autres = []) {
136
138
  const conflits = [];
137
139
  const enAttente = [];
138
140
  const gardes = [];
139
- for (const morceau of morceauxDuLot(lot)) {
140
- const noms = fichiersDuLot(copie, morceau);
141
- if (noms.length && noms.every(f => exclus.includes(f))) {
142
- continue;
143
- }
141
+ const laisses = [];
142
+ const poser = (morceau, noms) => {
144
143
  const r = git(copie, ['apply', '--3way', '--allow-empty', '-'], morceau);
145
144
  if (r.status === 0) {
146
- continue;
145
+ return;
147
146
  }
148
147
  const marques = enConflit(copie).filter(f => noms.includes(f));
149
148
  if (marques.length) {
@@ -152,13 +151,38 @@ function appliquer(copie, lot, cles = null, autres = []) {
152
151
  enAttente.push(...noms.slice(-1));
153
152
  gardes.push(morceau);
154
153
  }
154
+ };
155
+ for (const morceau of morceauxDuLot(lot)) {
156
+ const noms = fichiersDuLot(copie, morceau);
157
+ if (noms.length && noms.every(f => exclus.includes(f))) {
158
+ laisses.push({ morceau, noms });
159
+ continue;
160
+ }
161
+ poser(morceau, noms);
162
+ }
163
+ // The generated files the lot removes from the key follow the lot: main's version is not kept.
164
+ // A package.json left in conflict is read at the two versions of its conflict in the index.
165
+ const etage = n => String(git(copie, ['show', `:${n}:package.json`]).stdout);
166
+ const vivants = encoreDeclares(touches, copie, () => ({ base: etage(1), lot: etage(3) }));
167
+ for (const { morceau, noms } of laisses) {
168
+ if (noms.every(f => vivants.some(e => couvertPar(e.entiers, f)))) {
169
+ continue;
170
+ }
171
+ if (/^deleted file mode /m.test(morceau.toString('latin1'))) {
172
+ if (git(copie, ['rm', '-q', '-f', '--ignore-unmatch', '--', ...noms]).status !== 0) {
173
+ enAttente.push(...noms.slice(-1));
174
+ gardes.push(morceau);
175
+ }
176
+ } else {
177
+ poser(morceau, noms);
178
+ }
155
179
  }
156
180
  const restant = Buffer.concat(gardes);
157
- if (conflits.length || enAttente.length || !touches.length || !cles) {
181
+ if (conflits.length || enAttente.length || !vivants.length || !cles) {
158
182
  return { conflits, enAttente, restant };
159
183
  }
160
184
  const refus = regenerer({
161
- refs: touches.map(e => ({ ...e, cadre: false })),
185
+ refs: vivants.map(e => ({ ...e, cadre: false })),
162
186
  lancer: commande =>
163
187
  spawnSync('bash', ['-c', commande], {
164
188
  cwd: copie,
@@ -74,7 +74,14 @@ import { spawnSync } from 'node:child_process';
74
74
  import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
75
75
  import { createRequire } from 'node:module';
76
76
  import path from 'node:path';
77
- import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
77
+ import {
78
+ aRejouer,
79
+ couvertPar,
80
+ encoreDeclares,
81
+ engendresDe,
82
+ prendreLesEngendres,
83
+ regenerer,
84
+ } from '../engendres.mjs';
78
85
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
79
86
  import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
80
87
  import { lireCommit } from '../poussee-cles.mjs';
@@ -672,7 +679,9 @@ function remplacer(o, tip, tete) {
672
679
  return { garde: `la copie ne prend pas ${tip.slice(0, 7)}` };
673
680
  }
674
681
  // A conflict on generated files the project declares only is no conflict: main's version is
675
- // taken, and their command writes them again once the branch is replaced (below).
682
+ // taken, and their command writes them again once the branch is replaced (below). One the branch
683
+ // removes from the key (`encoreDeclares`, read in the copy) takes the branch's version, its
684
+ // deletion too, and its command is not played.
676
685
  let rebase = dansCopie('rebase', tete);
677
686
  let tours = Number(dansCopie('rev-list', '--count', `${tete}..${tip}`).stdout.trim()) || 1;
678
687
  while (rebase.status !== 0) {
@@ -683,8 +692,7 @@ function remplacer(o, tip, tete) {
683
692
  tours-- > 0 &&
684
693
  conflits.length > 0 &&
685
694
  conflits.every(f => engendres.some(e => couvertPar(e.entiers, f))) &&
686
- dansCopie('checkout', '--ours', '--', ...conflits).status === 0 &&
687
- dansCopie('add', '--', ...conflits).status === 0;
695
+ prendreLesEngendres({ conflits, vivants: encoreDeclares(engendres, copie), dansCopie });
688
696
  if (!engendresSeuls) {
689
697
  dansCopie('rebase', '--abort');
690
698
  return {
@@ -702,8 +710,9 @@ function remplacer(o, tip, tete) {
702
710
  if (installation) {
703
711
  return { sortie: [installation, "Le verrou de la branche replacée ne s'installe pas."] };
704
712
  }
705
- const touches = touchesPar(
713
+ const touches = aRejouer(
706
714
  engendres,
715
+ copie,
707
716
  dansCopie('diff', '--name-only', '--no-renames', '-z', tete, 'HEAD')
708
717
  .stdout.split('\0')
709
718
  .filter(Boolean)
@@ -64,7 +64,9 @@
64
64
  // of synthhub and open-synth-descriptors). A command of the project at another code than 0, one of
65
65
  // the frame on a real failure (126, 127, a signal), or a file it changes that its `fichiers` do not
66
66
  // cover, refuses the lot, the command, its code and its output named. A conflict on any other file
67
- // refuses it, as the three-way application says.
67
+ // refuses it, as the three-way application says. A generated file of the project the lot removes
68
+ // from the key (`encoreDeclares` of scripts/engendres.mjs, read in the copy once the lots are
69
+ // applied) follows the lot: its deletion is done, any other change applied, its command not played.
68
70
  //
69
71
  // What steps 2, 3 and 5 read of a lot is its files: each file added, modified or deleted, a
70
72
  // rename counting its source and its destination (named as the file is, not as git quotes it in
@@ -84,7 +86,14 @@ import { existsSync, readFileSync } from 'node:fs';
84
86
  import path from 'node:path';
85
87
  import { pathToFileURL } from 'node:url';
86
88
  import { arbitrageTranche, estArbitrage } from '../arbitrages.mjs';
87
- import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
89
+ import {
90
+ couvertPar,
91
+ engendresDe,
92
+ partDesLots,
93
+ poserLesRetires,
94
+ regenerer,
95
+ touchesPar,
96
+ } from '../engendres.mjs';
88
97
  import { langageDe } from '../langages.mjs';
89
98
  import { prefixe } from '../prefixe-des-tickets.mjs';
90
99
  import { commitsDelivering, gitLog } from '../un-commit-par-ticket.mjs';
@@ -427,10 +436,8 @@ function main(argv) {
427
436
  return refuser(`Les références ${o.references} ne se lisent pas : ${e.message}`);
428
437
  }
429
438
  }
430
- const references = [
431
- ...engendres.map(e => ({ ...e, cadre: false })),
432
- ...duCircuit.map(r => ({ ...r, lit: r.lit ?? [] })),
433
- ];
439
+ const duProjet = engendres.map(e => ({ ...e, cadre: false }));
440
+ const references = [...duProjet, ...duCircuit.map(r => ({ ...r, lit: r.lit ?? [] }))];
434
441
  // The files of the lot a reference writes in full, and the references the lot touches.
435
442
  const entiers = fichiers.filter(f => references.some(r => couvertPar(r.entiers, f)));
436
443
  const aRegenerer = touchesPar(references, fichiers);
@@ -482,6 +489,18 @@ function main(argv) {
482
489
  return refuser(`Le lot ${p} ne s'applique pas :\n${r.stdout}${r.stderr}`);
483
490
  }
484
491
  }
492
+ // The generated files the lots remove from the key follow the lots: main's version is not kept.
493
+ const part = partDesLots({
494
+ references,
495
+ duProjet,
496
+ entiers,
497
+ touchees: aRegenerer,
498
+ arbre: copie,
499
+ });
500
+ const suivis = poserLesRetires({ lots, fichiers: part.suivis, dansCopie });
501
+ if (suivis) {
502
+ return refuser(suivis);
503
+ }
485
504
  const divergents = avecCopie ? differents(copieTicket, lots, fichiers, tmp) : [];
486
505
  if (divergents.length) {
487
506
  return refuser(
@@ -493,10 +512,11 @@ function main(argv) {
493
512
  if (installation) {
494
513
  return refuser(installation);
495
514
  }
496
- if (aRegenerer.length) {
515
+ const aRejouer = part.rejouees;
516
+ if (aRejouer.length) {
497
517
  const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env));
498
518
  const refus = regenerer({
499
- refs: aRegenerer,
519
+ refs: aRejouer,
500
520
  dansCopie,
501
521
  lancer: commande =>
502
522
  spawnSync('bash', monter('sh', '-c', commande), {
@@ -509,7 +529,7 @@ function main(argv) {
509
529
  if (refus) {
510
530
  return refuser(refus);
511
531
  }
512
- dire(`✓ références régénérées sur main à jour : ${aRegenerer.map(r => r.nom).join(', ')}`);
532
+ dire(`✓ références régénérées sur main à jour : ${aRejouer.map(r => r.nom).join(', ')}`);
513
533
  }
514
534
 
515
535
  // 6. The commit, in the copy: the commit committed is the commit the CI of the branch judges.
@@ -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,