@roomi-fields/grillhouse 0.30.0 → 0.31.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 (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +30 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/dist/temporal/circuit/client.d.ts +2 -2
  8. package/dist/temporal/circuit/client.js.map +1 -1
  9. package/dist/temporal/circuit/commande.js +4 -4
  10. package/dist/temporal/circuit/commande.js.map +1 -1
  11. package/dist/temporal/circuit/contrat.d.ts +3 -3
  12. package/dist/temporal/circuit/contrat.js +8 -2
  13. package/dist/temporal/circuit/contrat.js.map +1 -1
  14. package/dist/temporal/circuit/deroule.js +3 -3
  15. package/dist/temporal/circuit/deroule.js.map +1 -1
  16. package/dist/temporal/commande.js +5 -6
  17. package/dist/temporal/commande.js.map +1 -1
  18. package/dist/temporal/installation.d.ts +0 -4
  19. package/dist/temporal/installation.js +12 -34
  20. package/dist/temporal/installation.js.map +1 -1
  21. package/docs/ARCHITECTURE.md +49 -19
  22. package/docs/CADRE.md +10 -0
  23. package/docs/INTERFACE.md +8 -3
  24. package/package.json +2 -2
  25. package/scripts/activites.mjs +150 -77
  26. package/scripts/aiguillage.mjs +33 -11
  27. package/scripts/avancement.mjs +27 -10
  28. package/scripts/bilan.mjs +101 -25
  29. package/scripts/cadre.mjs +5 -2
  30. package/scripts/circuit.mjs +153 -57
  31. package/scripts/composants-affectes.mjs +64 -21
  32. package/scripts/composition-des-langages.mjs +5 -3
  33. package/scripts/conformite.mjs +54 -19
  34. package/scripts/dependances-internes.mjs +9 -3
  35. package/scripts/dernier-vert.mjs +54 -19
  36. package/scripts/dette.mjs +32 -11
  37. package/scripts/donnees-cles.mjs +24 -8
  38. package/scripts/droits.mjs +40 -15
  39. package/scripts/empreinte-d-etape.mjs +17 -0
  40. package/scripts/engendres.mjs +15 -5
  41. package/scripts/enveloppe/enveloppe.mjs +141 -48
  42. package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
  43. package/scripts/faits-du-circuit.mjs +1 -1
  44. package/scripts/flux-des-paquets.mjs +21 -7
  45. package/scripts/gardes-du-cadre.mjs +9 -3
  46. package/scripts/init.mjs +11 -4
  47. package/scripts/integration/file.mjs +84 -29
  48. package/scripts/integration/integrer.mjs +70 -24
  49. package/scripts/integration/rejeu.mjs +26 -9
  50. package/scripts/jointure.d.ts +6 -1
  51. package/scripts/langages/cargo/commandes.mjs +97 -18
  52. package/scripts/langages/cargo/composants.mjs +24 -8
  53. package/scripts/langages/cargo/index.mjs +4 -0
  54. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  55. package/scripts/langages/python/commandes.mjs +3 -1
  56. package/scripts/langages/python/index.mjs +4 -0
  57. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  58. package/scripts/langages/typescript/composants.mjs +9 -3
  59. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  60. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  61. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  62. package/scripts/langages/typescript/frontieres.mjs +66 -22
  63. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  64. package/scripts/langages/typescript/index.mjs +10 -3
  65. package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
  66. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  67. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  68. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  69. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  70. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
  71. package/scripts/langages/typescript/parcours.mjs +12 -4
  72. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  73. package/scripts/langages/typescript/resumes.mjs +9 -3
  74. package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
  75. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
  76. package/scripts/langages/typescript/tests.mjs +24 -8
  77. package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
  78. package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
  79. package/scripts/langages/typescript/verdict.mjs +3 -1
  80. package/scripts/langages/typescript/verifier.mjs +28 -10
  81. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  82. package/scripts/langages/typescript/vitest-config/base.mjs +7 -2
  83. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  84. package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
  85. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
  86. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
  87. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  88. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
  89. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  90. package/scripts/lint-des-scripts.mjs +58 -0
  91. package/scripts/mesure/base-de-passe.mjs +117 -25
  92. package/scripts/mesure/pression.mjs +9 -3
  93. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  94. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  95. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  96. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
  97. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  98. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  99. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
  100. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
  101. package/scripts/nuit.sh +15 -0
  102. package/scripts/outil.mjs +3 -1
  103. package/scripts/outils-cles.mjs +18 -7
  104. package/scripts/paquet-npm.mjs +15 -5
  105. package/scripts/paquets.mjs +12 -4
  106. package/scripts/passe-de-la-machine.mjs +7 -2
  107. package/scripts/places-de-la-machine.mjs +66 -12
  108. package/scripts/preparation.mjs +15 -5
  109. package/scripts/registre.mjs +6 -2
  110. package/scripts/reprise.mjs +66 -0
  111. package/scripts/resultats.mjs +105 -37
  112. package/scripts/seances.mjs +22 -4
  113. package/scripts/services-du-noyau.mjs +1 -0
  114. package/scripts/sous-commandes.mjs +3 -1
  115. package/scripts/style-a-l-ecriture.mjs +48 -17
  116. package/scripts/tableau.mjs +34 -9
  117. package/scripts/taches-du-graphe.mjs +33 -13
  118. package/scripts/ticket-du-circuit.mjs +10 -0
  119. package/scripts/transitions.mjs +141 -24
  120. package/scripts/verrou-de-fichier.mjs +6 -2
  121. package/scripts/verrou-de-machine.mjs +123 -39
  122. package/scripts/verrous/commande.mjs +50 -17
  123. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  124. package/scripts/verrous/verrou.mjs +42 -14
  125. package/skills/explorateur/SKILL.md +7 -1
  126. package/skills/grill/SKILL.md +1 -1
  127. package/skills/mesure/SKILL.md +3 -0
  128. package/skills/relecteur/SKILL.md +1 -1
  129. package/skills/testwriter/SKILL.md +12 -6
@@ -99,7 +99,9 @@ export const INTEGRE = 'intégré : ';
99
99
  // The steps done over planned of the view <vue> of a run (`gh run view --json jobs`), written to
100
100
  // the progress directory <avancement> as the record `etapes-de-la-ci`; nothing without one.
101
101
  function ecrireLesEtapes(avancement, vue) {
102
- if (!avancement) return;
102
+ if (!avancement) {
103
+ return;
104
+ }
103
105
  const etapes = (Array.isArray(vue?.jobs) ? vue.jobs : []).flatMap(j =>
104
106
  Array.isArray(j?.steps) ? j.steps : []
105
107
  );
@@ -137,7 +139,9 @@ function motifDeGitHub(motif) {
137
139
  re += c;
138
140
  } else if (c === '[') {
139
141
  const fin = motif.indexOf(']', i + 1);
140
- if (fin < 0) throw new Error(`motif sans fin : ${motif}`);
142
+ if (fin < 0) {
143
+ throw new Error(`motif sans fin : ${motif}`);
144
+ }
141
145
  re += motif.slice(i, fin + 1);
142
146
  i = fin;
143
147
  } else {
@@ -153,23 +157,35 @@ function motifDeGitHub(motif) {
153
157
  // `tags` or `tags-ignore` alone run on no branch. A filter on the paths, or a form the queue does
154
158
  // not judge, counts as one that runs.
155
159
  function pousseeSurLaBranche(push, branche) {
156
- if (push === null || push === undefined) return true;
157
- if (typeof push !== 'object' || Array.isArray(push)) return true;
158
- if (push.paths || push['paths-ignore']) return true;
160
+ if (push === null || push === undefined) {
161
+ return true;
162
+ }
163
+ if (typeof push !== 'object' || Array.isArray(push)) {
164
+ return true;
165
+ }
166
+ if (push.paths || push['paths-ignore']) {
167
+ return true;
168
+ }
159
169
  const { branches, 'branches-ignore': ignorees } = push;
160
- if (branches && ignorees) return true;
170
+ if (branches && ignorees) {
171
+ return true;
172
+ }
161
173
  const motifs = l => (Array.isArray(l) ? l : [l]).map(String);
162
174
  if (branches) {
163
175
  let dedans = false;
164
176
  for (const m of motifs(branches)) {
165
177
  const negatif = m.startsWith('!');
166
- if (motifDeGitHub(negatif ? m.slice(1) : m).test(branche)) dedans = !negatif;
178
+ if (motifDeGitHub(negatif ? m.slice(1) : m).test(branche)) {
179
+ dedans = !negatif;
180
+ }
167
181
  }
168
182
  return dedans;
169
183
  }
170
184
  if (ignorees) {
171
185
  const l = motifs(ignorees);
172
- if (l.some(m => m.startsWith('!'))) return true;
186
+ if (l.some(m => m.startsWith('!'))) {
187
+ return true;
188
+ }
173
189
  return !l.some(m => motifDeGitHub(m).test(branche));
174
190
  }
175
191
  return !(push.tags || push['tags-ignore']);
@@ -181,16 +197,23 @@ function pousseeSurLaBranche(push, branche) {
181
197
  export function fluxDeLaBranche(fichiers, branche) {
182
198
  return fichiers
183
199
  .filter(({ texte }) => {
184
- if (texte === null) return true;
200
+ if (texte === null) {
201
+ return true;
202
+ }
185
203
  try {
186
204
  // Loaded only for a workflow to read: a project without one, or before its `npm install`,
187
205
  // runs its queue without the library (which, absent, counts the workflow as one that runs).
188
206
  const require = createRequire(import.meta.url);
189
207
  const on = require('yaml').parse(texte)?.on;
190
- if (typeof on === 'string') return on === 'push';
191
- if (Array.isArray(on)) return on.includes('push');
192
- if (on && typeof on === 'object')
208
+ if (typeof on === 'string') {
209
+ return on === 'push';
210
+ }
211
+ if (Array.isArray(on)) {
212
+ return on.includes('push');
213
+ }
214
+ if (on && typeof on === 'object') {
193
215
  return 'push' in on && pousseeSurLaBranche(on.push, branche);
216
+ }
194
217
  return false;
195
218
  } catch {
196
219
  return true;
@@ -242,7 +265,9 @@ export function outilsDeLaFile(racine, dire, avancement = null) {
242
265
  maxBuffer: 256 * 1024 * 1024,
243
266
  env: { ...process.env, [ACTEUR]: AUTEUR_DE_LA_FILE },
244
267
  });
245
- if (r.status !== 0) process.stderr.write(`bd ${a[0]} ${a[1] ?? ''} : ${r.stderr}`);
268
+ if (r.status !== 0) {
269
+ process.stderr.write(`bd ${a[0]} ${a[1] ?? ''} : ${r.stderr}`);
270
+ }
246
271
  return r;
247
272
  };
248
273
  const principale =
@@ -265,7 +290,9 @@ export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
265
290
  const { gh } = o;
266
291
  let id = passage;
267
292
  if (id === null) {
268
- if (fluxDuCommit(o.racine, sha, branche).length === 0) return { etat: SANS_CI };
293
+ if (fluxDuCommit(o.racine, sha, branche).length === 0) {
294
+ return { etat: SANS_CI };
295
+ }
269
296
  const r = gh(['run', 'list', '--commit', sha, '--json', 'databaseId,status,conclusion']);
270
297
  if (r.error) {
271
298
  return { etat: NON_LUE, raison: `gh ne se lance pas (${r.error.code ?? r.error.message}).` };
@@ -283,7 +310,9 @@ export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
283
310
  };
284
311
  }
285
312
  const trouve = passages.find(x => x?.databaseId);
286
- if (!trouve) return { etat: 'cherche' };
313
+ if (!trouve) {
314
+ return { etat: 'cherche' };
315
+ }
287
316
  id = String(trouve.databaseId);
288
317
  }
289
318
  const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
@@ -359,7 +388,9 @@ export function conclureLaCI(
359
388
  `## CI rouge\n\nLa CI de ${court} sur ${o.principale} est rouge : ${url}\n\nLa fin de gh run view ${passage} --log-failed :\n\n${journal}\n\nLe ticket est rouvert : sa correction entre sous son numéro. Un rejeu vert de la même CI (\`gh run rerun ${passage} --failed\`), puis \`--reprendre\` du circuit, le ferme ; un test connu instable se met en quarantaine dans le test, avec le ticket qui le corrige.`
360
389
  );
361
390
  o.dire(`✗ CI de ${court} rouge (passage ${passage}) : ${ticket} rouvert`);
362
- if (!relue) o.bd('reopen', ticket);
391
+ if (!relue) {
392
+ o.bd('reopen', ticket);
393
+ }
363
394
  return { etat: 'rouvert', raison: `La CI de ${court} est rouge : ${url}` };
364
395
  }
365
396
  if (!relue) {
@@ -370,7 +401,9 @@ export function conclureLaCI(
370
401
  verdict === NON_LUE ? `${INTEGRE}${court} ; CI non lue : ${raison}` : `${INTEGRE}${court}`,
371
402
  };
372
403
  }
373
- if (verdict === NON_LUE) return { etat: 'rouvert', raison: `CI non relue : ${raison}` };
404
+ if (verdict === NON_LUE) {
405
+ return { etat: 'rouvert', raison: `CI non relue : ${raison}` };
406
+ }
374
407
  o.bd('close', ticket, '--reason', `${INTEGRE}${court}`);
375
408
  if (passage) {
376
409
  commenter(
@@ -439,13 +472,19 @@ function surOrigin(o, commit, branche) {
439
472
  return { surOrigin: 'inconnu', raison: `git ls-remote origin ${branche} : ${raison}` };
440
473
  }
441
474
  const pointe = ls.stdout.split(/\s/)[0] ?? '';
442
- if (!pointe) return { surOrigin: 'non', raison: null };
475
+ if (!pointe) {
476
+ return { surOrigin: 'non', raison: null };
477
+ }
443
478
  // `--is-ancestor` answers 0 (an ancestor) or 1 (not one); any other code (the tip of origin
444
479
  // unknown here, 128) does not say: « inconnu », its reason named.
445
480
  const git = (...a) => spawnSync('git', ['-C', o.racine, ...a], { encoding: 'utf8' });
446
481
  const ancetre = git('merge-base', '--is-ancestor', commit, pointe);
447
- if (ancetre.status === 0) return { surOrigin: 'oui', raison: null };
448
- if (ancetre.status === 1) return { surOrigin: 'non', raison: null };
482
+ if (ancetre.status === 0) {
483
+ return { surOrigin: 'oui', raison: null };
484
+ }
485
+ if (ancetre.status === 1) {
486
+ return { surOrigin: 'non', raison: null };
487
+ }
449
488
  const raison =
450
489
  `${ancetre.stderr ?? ''}`.trim().split('\n')[0] ||
451
490
  ancetre.error?.message ||
@@ -477,7 +516,9 @@ function lotSurMain(o, ticket) {
477
516
  function rejouer(o, tip, tete, ticketRejoue = null) {
478
517
  const { racine, dire } = o;
479
518
  const copie = path.join(racine, '.claude', 'worktrees', 'file');
480
- if (existsSync(copie)) spawnSync('git', ['-C', copie, 'rebase', '--abort'], { encoding: 'utf8' });
519
+ if (existsSync(copie)) {
520
+ spawnSync('git', ['-C', copie, 'rebase', '--abort'], { encoding: 'utf8' });
521
+ }
481
522
  // The keys of the project, before any work: its generated files and its tools.
482
523
  let engendres;
483
524
  let env;
@@ -488,10 +529,13 @@ function rejouer(o, tip, tete, ticketRejoue = null) {
488
529
  return { garde: `une clé grillhouse du package.json est refusée :\n${e.message}` };
489
530
  }
490
531
  const ouverte = ouvrirCopie({ racine, copie, ref: tete, dire });
491
- if (ouverte.refus) return { garde: ouverte.refus };
532
+ if (ouverte.refus) {
533
+ return { garde: ouverte.refus };
534
+ }
492
535
  const { dansCopie, monter, installer, tester } = ouverte;
493
- if (dansCopie('checkout', '-q', '--detach', tip).status !== 0)
536
+ if (dansCopie('checkout', '-q', '--detach', tip).status !== 0) {
494
537
  return { garde: `la copie ne prend pas ${tip.slice(0, 7)}` };
538
+ }
495
539
  // A conflict on generated files the project declares only is no conflict: main's version is
496
540
  // taken, and their command writes them again once the branch is replaced (below).
497
541
  let rebase = dansCopie('rebase', tete);
@@ -541,7 +585,9 @@ function rejouer(o, tip, tete, ticketRejoue = null) {
541
585
  env,
542
586
  }),
543
587
  });
544
- if (refus) return { sortie: ['ses fichiers engendrés ne se régénèrent pas sur main.', refus] };
588
+ if (refus) {
589
+ return { sortie: ['ses fichiers engendrés ne se régénèrent pas sur main.', refus] };
590
+ }
545
591
  if (dansCopie('diff', '--cached', '--quiet').status !== 0) {
546
592
  const corrige = dansCopie('commit', '-q', '--amend', '--no-edit', '--no-verify');
547
593
  if (corrige.status !== 0) {
@@ -581,8 +627,9 @@ export function avancerMain(o, entree) {
581
627
  const tip = git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).stdout.trim();
582
628
  const livre = lotSurMain(o, entree.ticket);
583
629
  // A lot on main whose branch is gone (a closure that failed after its deletion) is entered.
584
- if (!tip)
630
+ if (!tip) {
585
631
  return livre ? { entre: { commit: livre } } : { sortie: ["la branche n'existe plus.", ''] };
632
+ }
586
633
  const enAvance = Number(git('rev-list', '--count', `${refPrincipale}..${tip}`).stdout.trim());
587
634
  // The lot is on main when the branch points at the commit of main that delivers the ticket
588
635
  // (main moved onto it by fast-forward), or when each commit of the branch has its equivalent on
@@ -591,21 +638,29 @@ export function avancerMain(o, entree) {
591
638
  if (livre) {
592
639
  const cerise = git('cherry', refPrincipale, tip).stdout.split('\n').filter(Boolean);
593
640
  const rejeu = enAvance > 0 && cerise.length > 0 && cerise.every(l => l.startsWith('- '));
594
- if (tip === livre || rejeu) return { entre: { commit: livre } };
641
+ if (tip === livre || rejeu) {
642
+ return { entre: { commit: livre } };
643
+ }
644
+ }
645
+ if (enAvance === 0) {
646
+ return { ecartee: true };
595
647
  }
596
- if (enAvance === 0) return { ecartee: true };
597
648
  for (let essai = 0; essai < ESSAIS_PAR_BRANCHE; essai++) {
598
649
  const tete = git('rev-parse', refPrincipale).stdout.trim();
599
650
  let nouveau = tip;
600
651
  if (git('merge-base', '--is-ancestor', tete, tip).status !== 0) {
601
652
  const r = rejouer(o, tip, tete, entree.ticket);
602
- if (!r.nouveau) return r;
653
+ if (!r.nouveau) {
654
+ return r;
655
+ }
603
656
  nouveau = r.nouveau;
604
657
  }
605
658
  if (nouveau !== tete) {
606
659
  const avance = git('merge', '-q', '--ff-only', nouveau);
607
660
  if (avance.status !== 0) {
608
- if (git('rev-parse', refPrincipale).stdout.trim() !== tete) continue;
661
+ if (git('rev-parse', refPrincipale).stdout.trim() !== tete) {
662
+ continue;
663
+ }
609
664
  return {
610
665
  garde:
611
666
  `${o.principale} n'avance pas sur ${nouveau.slice(0, 7)} :\n${avance.stdout}${avance.stderr}`.trim(),
@@ -104,7 +104,9 @@ import { ouvrirBase } from '../mesure/base-de-passe.mjs';
104
104
  // backslash or a control character comes between quotes with C escapes (`\303\251` for `é`).
105
105
  // Returns the name itself.
106
106
  function nomDeGit(ecrit) {
107
- if (!ecrit.startsWith('"')) return ecrit;
107
+ if (!ecrit.startsWith('"')) {
108
+ return ecrit;
109
+ }
108
110
  const octets = [];
109
111
  const echappes = { n: 10, t: 9, r: 13, a: 7, b: 8, f: 12, v: 11 };
110
112
  const corps = Buffer.from(ecrit.slice(1, -1), 'utf8');
@@ -142,11 +144,14 @@ export function refusVerdicts(ticket, comments) {
142
144
  // resumption (scripts/circuit.mjs), as a CI refuses a pull request without its required label
143
145
  // before it runs a job. `ticket` and `comments` are Beads' JSON.
144
146
  export function refusArbitrage(ticket, comments) {
145
- if (!(ticket.labels ?? []).includes('arbitrage')) return null;
147
+ if (!(ticket.labels ?? []).includes('arbitrage')) {
148
+ return null;
149
+ }
146
150
  const id = ticket.id;
147
151
  const arbitrages = comments.filter(c => estArbitrage(c.text));
148
- if (arbitrages.length === 0)
152
+ if (arbitrages.length === 0) {
149
153
  return `${id} est étiqueté arbitrage sans commentaire « Arbitrage ».`;
154
+ }
150
155
  for (const a of arbitrages) {
151
156
  if (!arbitrageTranche(comments, a)) {
152
157
  const titre = a.text.trim().split('\n')[0];
@@ -162,10 +167,13 @@ export function refusLots(tests, code, racine) {
162
167
  const langage = langageDe(racine);
163
168
  const testwriter = f => langage.estUnTest(f, racine) !== null;
164
169
  const horsTests = tests.filter(f => !testwriter(f));
165
- if (horsTests.length) return `Le lot de tests touche du code : ${horsTests.join(', ')}.`;
170
+ if (horsTests.length) {
171
+ return `Le lot de tests touche du code : ${horsTests.join(', ')}.`;
172
+ }
166
173
  const duTestwriter = code.filter(testwriter);
167
- if (duTestwriter.length)
174
+ if (duTestwriter.length) {
168
175
  return `Le lot de code touche des fichiers du testwriter (tests ou matière de test partagée) : ${duTestwriter.join(', ')}.`;
176
+ }
169
177
  return null;
170
178
  }
171
179
 
@@ -176,10 +184,11 @@ function lire(argv) {
176
184
  const v = argv[i + 1];
177
185
  switch (argv[i]) {
178
186
  case '--ticket':
179
- if (o.ticket !== null)
187
+ if (o.ticket !== null) {
180
188
  return {
181
189
  faute: `un seul --ticket : ${v} en est un second, et une livraison est un ticket.`,
182
190
  };
191
+ }
183
192
  o.ticket = v;
184
193
  i++;
185
194
  break;
@@ -203,7 +212,9 @@ function lire(argv) {
203
212
  return { faute: null };
204
213
  }
205
214
  }
206
- if (!o.ticket || !o.message || !(o.tests || o.code)) return { faute: null };
215
+ if (!o.ticket || !o.message || !(o.tests || o.code)) {
216
+ return { faute: null };
217
+ }
207
218
  return o;
208
219
  }
209
220
 
@@ -215,7 +226,9 @@ function horsLot(copieTicket, fichiers) {
215
226
  ['-C', copieTicket, 'status', '--porcelain=v1', '-z', '-uall', '--no-renames'],
216
227
  { encoding: 'utf8' }
217
228
  );
218
- if (r.status !== 0) return null;
229
+ if (r.status !== 0) {
230
+ return null;
231
+ }
219
232
  const dans = new Set(fichiers);
220
233
  return r.stdout
221
234
  .split('\0')
@@ -232,10 +245,18 @@ function differents(copieTicket, lots, fichiers, tmp) {
232
245
  const env = { ...process.env, GIT_INDEX_FILE: index };
233
246
  const dansCopie = (...args) =>
234
247
  spawnSync('git', ['-C', copieTicket, ...args], { encoding: 'utf8', env });
235
- if (dansCopie('read-tree', 'HEAD').status !== 0) return fichiers;
236
- for (const p of lots) if (dansCopie('apply', '--cached', p).status !== 0) return fichiers;
248
+ if (dansCopie('read-tree', 'HEAD').status !== 0) {
249
+ return fichiers;
250
+ }
251
+ for (const p of lots) {
252
+ if (dansCopie('apply', '--cached', p).status !== 0) {
253
+ return fichiers;
254
+ }
255
+ }
237
256
  const r = dansCopie('diff', '--name-only', '--no-renames', '-z', '--', ...fichiers);
238
- if (r.status !== 0) return fichiers;
257
+ if (r.status !== 0) {
258
+ return fichiers;
259
+ }
239
260
  return r.stdout.split('\0').filter(Boolean);
240
261
  }
241
262
 
@@ -288,17 +309,22 @@ function main(argv) {
288
309
  // 1. The verdict.
289
310
  const show = bd('show', o.ticket, '--json');
290
311
  const comments = bd('comments', o.ticket, '--json');
291
- if (show.status !== 0 || comments.status !== 0)
312
+ if (show.status !== 0 || comments.status !== 0) {
292
313
  return refuser(`Ticket ${o.ticket} illisible : ${show.stderr}${comments.stderr}`);
314
+ }
293
315
  const r1 = refusVerdicts(JSON.parse(show.stdout)[0], JSON.parse(comments.stdout || '[]'));
294
- if (r1) return refuser(r1);
316
+ if (r1) {
317
+ return refuser(r1);
318
+ }
295
319
  dire('✓ verdicts');
296
320
 
297
321
  // 2. The lots.
298
322
  const lots = [o.tests, o.code].filter(Boolean).map(absolu);
299
323
  const fichiersDe = p => {
300
324
  const r = git('apply', '--numstat', '-z', p);
301
- if (r.status !== 0) return null;
325
+ if (r.status !== 0) {
326
+ return null;
327
+ }
302
328
  const destinations = r.stdout
303
329
  .split('\0')
304
330
  .map(l => l.split('\t')[2])
@@ -312,9 +338,13 @@ function main(argv) {
312
338
  };
313
339
  const tests = o.tests ? fichiersDe(absolu(o.tests)) : [];
314
340
  const code = o.code ? fichiersDe(absolu(o.code)) : [];
315
- if (!tests || !code) return refuser('Un patch du lot est illisible.');
341
+ if (!tests || !code) {
342
+ return refuser('Un patch du lot est illisible.');
343
+ }
316
344
  const r2 = refusLots(tests, code, racine);
317
- if (r2) return refuser(r2);
345
+ if (r2) {
346
+ return refuser(r2);
347
+ }
318
348
  const fichiers = [...new Set([...tests, ...code])];
319
349
  dire(`✓ lots : ${fichiers.length} fichiers`);
320
350
  let duCircuit = [];
@@ -336,7 +366,9 @@ function main(argv) {
336
366
  // 3. The main tree: the lots' files are free there, so the queue can bring them. The ticket's
337
367
  // copy holds the lot and nothing else.
338
368
  const tenus = git('status', '--porcelain', '--', ...fichiers).stdout.trim();
339
- if (tenus) return refuser(`Des fichiers du lot sont modifiés dans l'arbre :\n${tenus}`);
369
+ if (tenus) {
370
+ return refuser(`Des fichiers du lot sont modifiés dans l'arbre :\n${tenus}`);
371
+ }
340
372
  dire('✓ arbre principal libre');
341
373
  const branche = `agent/${o.ticket}`;
342
374
  const copieTicket = path.join(racine, '.claude', 'worktrees', o.ticket);
@@ -352,7 +384,9 @@ function main(argv) {
352
384
  return refuser(`La copie du ticket ${copieTicket} n'est pas sur la branche ${branche}.`);
353
385
  }
354
386
  const autres = horsLot(copieTicket, fichiers);
355
- if (autres === null) return refuser(`L'état de la copie ${copieTicket} ne se lit pas.`);
387
+ if (autres === null) {
388
+ return refuser(`L'état de la copie ${copieTicket} ne se lit pas.`);
389
+ }
356
390
  if (autres.length) {
357
391
  return refuser(
358
392
  `La copie du ticket porte autre chose que le lot :\n${autres.map(f => ` ${f}`).join('\n')}`
@@ -365,7 +399,9 @@ function main(argv) {
365
399
  // are kept only while the lock file and the manifests are the same (a CI cache keyed by them).
366
400
  const copie = path.join(racine, '.claude', 'worktrees', 'integration');
367
401
  const ouverte = ouvrirCopie({ racine, copie, ref: 'HEAD', dire });
368
- if (ouverte.refus) return refuser(ouverte.refus);
402
+ if (ouverte.refus) {
403
+ return refuser(ouverte.refus);
404
+ }
369
405
  const { dansCopie, monter, installer, tester } = ouverte;
370
406
 
371
407
  // 5. The lots, applied in the copy without the files a reference writes in full, then
@@ -373,7 +409,9 @@ function main(argv) {
373
409
  const sansEntiers = entiers.map(f => `--exclude=${f}`);
374
410
  for (const p of lots) {
375
411
  const r = dansCopie('apply', '--3way', '--index', ...sansEntiers, p);
376
- if (r.status !== 0) return refuser(`Le lot ${p} ne s'applique pas :\n${r.stdout}${r.stderr}`);
412
+ if (r.status !== 0) {
413
+ return refuser(`Le lot ${p} ne s'applique pas :\n${r.stdout}${r.stderr}`);
414
+ }
377
415
  }
378
416
  const divergents = avecCopie ? differents(copieTicket, lots, fichiers, tmp) : [];
379
417
  if (divergents.length) {
@@ -383,7 +421,9 @@ function main(argv) {
383
421
  }
384
422
  dire('✓ lots appliqués');
385
423
  const installation = installer();
386
- if (installation) return refuser(installation);
424
+ if (installation) {
425
+ return refuser(installation);
426
+ }
387
427
  if (aRegenerer.length) {
388
428
  const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env));
389
429
  const refus = regenerer({
@@ -397,7 +437,9 @@ function main(argv) {
397
437
  env,
398
438
  }),
399
439
  });
400
- if (refus) return refuser(refus);
440
+ if (refus) {
441
+ return refuser(refus);
442
+ }
401
443
  dire(`✓ références régénérées sur main à jour : ${aRegenerer.map(r => r.nom).join(', ')}`);
402
444
  }
403
445
 
@@ -410,7 +452,9 @@ function main(argv) {
410
452
  );
411
453
  return A_REPASSER;
412
454
  }
413
- if (verdict !== 0) return refuser('Les tests refusent le lot (sortie ci-dessus).');
455
+ if (verdict !== 0) {
456
+ return refuser('Les tests refusent le lot (sortie ci-dessus).');
457
+ }
414
458
  dire('✓ tests');
415
459
 
416
460
  // 7. The commit, in the copy: the commit validated is the commit that enters.
@@ -424,7 +468,9 @@ function main(argv) {
424
468
  env: { ...process.env, GRILLHOUSE_INTEGRATION: '1' },
425
469
  }
426
470
  );
427
- if (c.status !== 0) return refuser(`Le commit est refusé :\n${c.stdout}${c.stderr}`);
471
+ if (c.status !== 0) {
472
+ return refuser(`Le commit est refusé :\n${c.stdout}${c.stderr}`);
473
+ }
428
474
  const commit = dansCopie('rev-parse', 'HEAD').stdout.trim();
429
475
 
430
476
  // 8. The branch of the ticket takes the commit; the ticket's copy follows it (it carried the
@@ -59,7 +59,9 @@ function empreinteDesDependances(copie, verrou, dansCopie) {
59
59
  .filter(Boolean)
60
60
  .sort();
61
61
  const h = createHash('sha256').update(readFileSync(verrou));
62
- for (const f of suivis) h.update(`\0${f}\0`).update(readFileSync(path.join(copie, f)));
62
+ for (const f of suivis) {
63
+ h.update(`\0${f}\0`).update(readFileSync(path.join(copie, f)));
64
+ }
63
65
  return h.digest('hex');
64
66
  }
65
67
 
@@ -91,9 +93,13 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
91
93
  ? dansCopie('checkout', '-q', '--detach', '--force', tete).status === 0 &&
92
94
  dansCopie('clean', '-q', '-f', '-d', '-x', '-e', 'node_modules').status === 0
93
95
  : git('worktree', 'add', '-q', '--detach', copie, tete).status === 0;
94
- if (!prete) return `La copie ${copie} ne se prépare pas.`;
96
+ if (!prete) {
97
+ return `La copie ${copie} ne se prépare pas.`;
98
+ }
95
99
  const poses = spawnSync('bash', [SOUS_MODULES, 'pose', copie], { encoding: 'utf8' });
96
- if (poses.status !== 0) return `La copie ne pose pas ses sous-modules : ${poses.stderr.trim()}`;
100
+ if (poses.status !== 0) {
101
+ return `La copie ne pose pas ses sous-modules : ${poses.stderr.trim()}`;
102
+ }
97
103
  partages = poses.stdout;
98
104
  return null;
99
105
  };
@@ -109,7 +115,9 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
109
115
  }
110
116
  refus = preparer();
111
117
  }
112
- if (refus) return { refus };
118
+ if (refus) {
119
+ return { refus };
120
+ }
113
121
  const monter = (...commande) => [
114
122
  SOUS_MODULES,
115
123
  'monter',
@@ -119,7 +127,9 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
119
127
  ...commande,
120
128
  ];
121
129
  const montage = spawnSync('bash', monter('true'), { encoding: 'utf8' });
122
- if (montage.status !== 0) return { refus: montage.stderr.trim() };
130
+ if (montage.status !== 0) {
131
+ return { refus: montage.stderr.trim() };
132
+ }
123
133
  const lancer = (commande, args, envPlus = null) => {
124
134
  const r = spawnSync('bash', monter(commande, ...args), {
125
135
  cwd: copie,
@@ -140,17 +150,24 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
140
150
  // differ, the key is written again. Null when they agree, else the refusal.
141
151
  const accorder = () => {
142
152
  const verrouNpm = path.join(copie, VERROU);
143
- if (!existsSync(verrouNpm)) return null;
153
+ if (!existsSync(verrouNpm)) {
154
+ return null;
155
+ }
144
156
  const cle = path.join(copie, 'node_modules', '.integration-lock');
145
157
  const empreinte = empreinteDesDependances(copie, verrouNpm, dansCopie);
146
- if (existsSync(cle) && readFileSync(cle, 'utf8') === empreinte) return null;
147
- if (npm(['ci', '--no-audit', '--no-fund', '--silent']).status !== 0)
158
+ if (existsSync(cle) && readFileSync(cle, 'utf8') === empreinte) {
159
+ return null;
160
+ }
161
+ if (npm(['ci', '--no-audit', '--no-fund', '--silent']).status !== 0) {
148
162
  return DEPENDANCES_REFUSEES;
163
+ }
149
164
  writeFileSync(cle, empreinte);
150
165
  return null;
151
166
  };
152
167
  const refusOuverture = accorder();
153
- if (refusOuverture) return { refus: refusOuverture };
168
+ if (refusOuverture) {
169
+ return { refus: refusOuverture };
170
+ }
154
171
  dire(`✓ copie propre sur ${tete.slice(0, 7)}`);
155
172
 
156
173
  // The checks of the copy: its preparation, then its verification; the first that is not green
@@ -226,6 +226,11 @@ export interface Composition {
226
226
  matieres(racine: string): Composant[];
227
227
  /** Whether the component plays tests: the runner of the language has tests to play in it. */
228
228
  joueDesTests(racine: string, composant: Composant): boolean;
229
+ /** The hashes of the inputs of the tests tasks of the components `noms` (their package names)
230
+ * and of their dependents, `{ <paquet>: <hash> }`, as the task runner plans them (the hash of a
231
+ * task covers the content of the files it reads and of what it waits for); null when the runner
232
+ * gives no plan. The fingerprint of a step of the circuit reads them. */
233
+ empreintes(racine: string, noms: string[]): Record<string, string> | null;
229
234
  lecteurs(
230
235
  racine: string,
231
236
  o: { composants: Composant[]; noms: string[]; texte: string; nommes: Composant[] }
@@ -397,7 +402,7 @@ export function cacheDeLaRacine(
397
402
  ): string;
398
403
  /** The line of the guard of a pass of tests, what its tests left in their temporary directory
399
404
  * named; null when they left nothing. */
400
- export function ligneDesRestes(restes: string[]): string | null;
405
+ export function ligneDesRestes(restes: string[], paquet?: string): string | null;
401
406
  /** Runs `retirer` when the process is interrupted, then lets the signal end it; the removal of
402
407
  * the handlers. */
403
408
  export function retirerALInterruption(retirer: () => void): () => void;