@roomi-fields/grillhouse 0.47.1 → 0.49.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 (186) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +116 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +24 -38
  5. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -0
  6. package/cadre/templates/projet/.github/workflows/nuit.yml +14 -2
  7. package/cadre/templates/projet/CLAUDE.md +31 -10
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/turbo/paquets.json +3 -1
  10. package/cadre/templates/turbo/sans-paquets.json +3 -1
  11. package/charte.md +46 -13
  12. package/dist/temporal/circuit/appel.d.ts +4 -1
  13. package/dist/temporal/circuit/appel.js +15 -1
  14. package/dist/temporal/circuit/appel.js.map +1 -1
  15. package/dist/temporal/circuit/client.d.ts +7 -1
  16. package/dist/temporal/circuit/client.js +54 -1
  17. package/dist/temporal/circuit/client.js.map +1 -1
  18. package/dist/temporal/circuit/commande.js +35 -60
  19. package/dist/temporal/circuit/commande.js.map +1 -1
  20. package/dist/temporal/circuit/contrat.d.ts +2 -1
  21. package/dist/temporal/circuit/contrat.js +2 -1
  22. package/dist/temporal/circuit/contrat.js.map +1 -1
  23. package/dist/temporal/circuit/deroule.js +9 -2
  24. package/dist/temporal/circuit/deroule.js.map +1 -1
  25. package/dist/temporal/commande.js +2 -13
  26. package/dist/temporal/commande.js.map +1 -1
  27. package/dist/temporal/deroules.d.ts +1 -1
  28. package/dist/temporal/deroules.js +2 -2
  29. package/dist/temporal/deroules.js.map +1 -1
  30. package/dist/temporal/file/activites.d.ts +1 -4
  31. package/dist/temporal/file/activites.js +13 -14
  32. package/dist/temporal/file/activites.js.map +1 -1
  33. package/dist/temporal/file/contrat.d.ts +34 -91
  34. package/dist/temporal/file/contrat.js +33 -5
  35. package/dist/temporal/file/contrat.js.map +1 -1
  36. package/dist/temporal/file/deroule.d.ts +1 -9
  37. package/dist/temporal/file/deroule.js +57 -166
  38. package/dist/temporal/file/deroule.js.map +1 -1
  39. package/dist/temporal/installation.d.ts +26 -1
  40. package/dist/temporal/installation.js +111 -2
  41. package/dist/temporal/installation.js.map +1 -1
  42. package/dist/temporal/nuits/activites.d.ts +5 -10
  43. package/dist/temporal/nuits/activites.js +9 -57
  44. package/dist/temporal/nuits/activites.js.map +1 -1
  45. package/dist/temporal/nuits/choix.d.ts +15 -0
  46. package/dist/temporal/nuits/choix.js +20 -0
  47. package/dist/temporal/nuits/choix.js.map +1 -1
  48. package/dist/temporal/nuits/contrat.d.ts +11 -16
  49. package/dist/temporal/nuits/deroule.js +38 -67
  50. package/dist/temporal/nuits/deroule.js.map +1 -1
  51. package/dist/temporal/places/client.d.ts +9 -11
  52. package/dist/temporal/places/client.js +11 -19
  53. package/dist/temporal/places/client.js.map +1 -1
  54. package/dist/temporal/places/contrat.d.ts +25 -24
  55. package/dist/temporal/places/contrat.js +5 -7
  56. package/dist/temporal/places/contrat.js.map +1 -1
  57. package/dist/temporal/places/deroule.js +26 -36
  58. package/dist/temporal/places/deroule.js.map +1 -1
  59. package/dist/temporal/tickets/activites.js +4 -2
  60. package/dist/temporal/tickets/activites.js.map +1 -1
  61. package/dist/temporal/tickets/contrat.d.ts +2 -1
  62. package/docs/ARCHITECTURE.md +453 -133
  63. package/docs/CADRE.md +16 -13
  64. package/docs/INTERFACE.md +100 -25
  65. package/hooks/hooks.json +9 -0
  66. package/hooks/register.tsx +59 -5
  67. package/package.json +1 -1
  68. package/scripts/activites.mjs +319 -52
  69. package/scripts/aiguillage.mjs +5 -1
  70. package/scripts/attente-a-l-arret.mjs +2 -5
  71. package/scripts/attente-au-tour.mjs +2 -5
  72. package/scripts/bilan.mjs +125 -2
  73. package/scripts/branche-de-nuit.mjs +32 -44
  74. package/scripts/ci-de-main.mjs +215 -16
  75. package/scripts/circuit.mjs +275 -189
  76. package/scripts/circuits-cles.d.mts +3 -3
  77. package/scripts/circuits-cles.mjs +6 -5
  78. package/scripts/coeurs-dedies.mjs +4 -4
  79. package/scripts/commandes-composees.mjs +12 -5
  80. package/scripts/composition-des-langages.mjs +2 -0
  81. package/scripts/crochets.mjs +2 -2
  82. package/scripts/dette.d.ts +2 -1
  83. package/scripts/dette.mjs +49 -6
  84. package/scripts/direct.mjs +343 -0
  85. package/scripts/droits.mjs +19 -0
  86. package/scripts/effets.mjs +6 -5
  87. package/scripts/engendres.mjs +2 -1
  88. package/scripts/enveloppe/enveloppe.mjs +127 -18
  89. package/scripts/enveloppe/lancer.sh +14 -3
  90. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  91. package/scripts/enveloppe/travail-de-la-copie.mjs +121 -21
  92. package/scripts/etapes.mjs +14 -4
  93. package/scripts/etat-du-depot.mjs +23 -0
  94. package/scripts/faits-du-circuit.mjs +24 -34
  95. package/scripts/fermeture-de-la-machine.d.mts +27 -0
  96. package/scripts/fermeture-de-la-machine.mjs +98 -0
  97. package/scripts/fichiers-nommes.mjs +27 -1
  98. package/scripts/file-des-tickets.d.mts +18 -1
  99. package/scripts/file-des-tickets.mjs +63 -15
  100. package/scripts/greffons.mjs +1 -1
  101. package/scripts/grillhouse-maj.mjs +13 -25
  102. package/scripts/groupe-cles.d.mts +6 -0
  103. package/scripts/groupe-cles.mjs +29 -1
  104. package/scripts/integration/file.mjs +162 -48
  105. package/scripts/integration/integrer.mjs +2 -0
  106. package/scripts/jointure.d.ts +22 -3
  107. package/scripts/journal-des-etats.d.mts +16 -0
  108. package/scripts/journal-des-etats.mjs +44 -2
  109. package/scripts/journal.mjs +3 -0
  110. package/scripts/langages/c/commandes.mjs +5 -5
  111. package/scripts/langages/c/composants.mjs +13 -5
  112. package/scripts/langages/c/index.mjs +2 -0
  113. package/scripts/langages/c/squelette.mjs +1 -1
  114. package/scripts/langages/cargo/commandes.mjs +5 -6
  115. package/scripts/langages/cargo/index.mjs +2 -0
  116. package/scripts/langages/python/commandes.mjs +5 -5
  117. package/scripts/langages/python/composants.mjs +10 -2
  118. package/scripts/langages/python/index.mjs +2 -0
  119. package/scripts/langages/typescript/composants.mjs +10 -3
  120. package/scripts/langages/typescript/construire.mjs +2 -0
  121. package/scripts/langages/typescript/exemples.mjs +33 -1
  122. package/scripts/langages/typescript/index.mjs +22 -0
  123. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  124. package/scripts/langages/typescript/module-absent.mjs +24 -0
  125. package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
  126. package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
  127. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  128. package/scripts/langages/typescript/turbo-des-paquets.mjs +40 -5
  129. package/scripts/langages/typescript/verifier.mjs +3 -5
  130. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  131. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  132. package/scripts/langages/typescript/vitest-config/lances.mjs +3 -1
  133. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  134. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  135. package/scripts/langages.mjs +25 -3
  136. package/scripts/machine.mjs +103 -0
  137. package/scripts/matieres-cles.mjs +17 -0
  138. package/scripts/matieres-lues.mjs +104 -0
  139. package/scripts/mesure/base-de-passe.mjs +2 -1
  140. package/scripts/migrations/0.48.0-ci-declenchee-par-la-file.mjs +32 -0
  141. package/scripts/migrations/0.48.0-poussee-retiree.mjs +31 -0
  142. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  143. package/scripts/migrations.mjs +6 -0
  144. package/scripts/nuit.sh +113 -46
  145. package/scripts/paquet.mjs +16 -5
  146. package/scripts/paquets.d.ts +4 -0
  147. package/scripts/paquets.mjs +57 -0
  148. package/scripts/passe-de-la-machine.mjs +13 -14
  149. package/scripts/places-de-la-machine.mjs +120 -44
  150. package/scripts/places-du-serveur.mjs +29 -8
  151. package/scripts/plafond-de-la-machine.d.mts +7 -13
  152. package/scripts/plafond-de-la-machine.mjs +19 -35
  153. package/scripts/poussee-retiree.mjs +18 -0
  154. package/scripts/prefixe-des-tickets.mjs +1 -1
  155. package/scripts/references-changees.mjs +159 -0
  156. package/scripts/registre.d.mts +2 -2
  157. package/scripts/regles-des-places.d.mts +20 -12
  158. package/scripts/regles-des-places.mjs +27 -30
  159. package/scripts/repli-de-la-nuit.mjs +112 -0
  160. package/scripts/reponses-du-circuit.d.mts +4 -2
  161. package/scripts/reponses-du-circuit.mjs +44 -9
  162. package/scripts/reprise.mjs +27 -8
  163. package/scripts/resultats.mjs +61 -9
  164. package/scripts/seances.mjs +258 -40
  165. package/scripts/services-du-noyau.mjs +3 -0
  166. package/scripts/sous-commandes.mjs +37 -7
  167. package/scripts/superviseur.mjs +241 -88
  168. package/scripts/tableau.mjs +327 -131
  169. package/scripts/taches-du-graphe.mjs +84 -4
  170. package/scripts/ticket.mjs +345 -0
  171. package/scripts/transitions.d.mts +52 -0
  172. package/scripts/transitions.mjs +194 -16
  173. package/scripts/un-commit-par-ticket.mjs +4 -3
  174. package/scripts/verdict-de-la-nuit.mjs +47 -20
  175. package/scripts/verrou-de-fichier.mjs +2 -2
  176. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  177. package/scripts/verrous/verrou.mjs +17 -1
  178. package/skills/developpeur/SKILL.md +1 -1
  179. package/skills/direct/SKILL.md +57 -0
  180. package/skills/explorateur/SKILL.md +10 -6
  181. package/skills/pitmaster/SKILL.md +37 -14
  182. package/skills/pitmaster/references/consigne-agent.md +7 -1
  183. package/skills/relecteur/SKILL.md +11 -1
  184. package/skills/testwriter/SKILL.md +10 -0
  185. package/scripts/poussee-cles.mjs +0 -46
  186. package/scripts/ticket.sh +0 -25
@@ -54,7 +54,8 @@ const PAQUET_QUI_TOURNE = path.resolve(import.meta.dirname, '..');
54
54
  /**
55
55
  * The subcommands of the orchestration, which the published version runs: the circuit, the
56
56
  * supervisor, the night, the board and the status line, the hooks of Claude Code, the locks and
57
- * the rights of the sessions, the envelope and its launcher, the integration, the
57
+ * the rights of the sessions, the direct (its agent and its reviewer), the envelope and its
58
+ * launcher, the integration, the
58
59
  * results, the removal of a copy and the balance, even when the supervisor runs one by hand.
59
60
  */
60
61
  export const REDIRIGEES = new Set([
@@ -64,12 +65,14 @@ export const REDIRIGEES = new Set([
64
65
  'circuit',
65
66
  'commande',
66
67
  'consommation',
68
+ 'direct',
67
69
  'droits',
68
70
  'enveloppe',
69
71
  'integrer',
70
72
  'journal',
71
73
  'lancer',
72
74
  'ligne-etat',
75
+ 'machine',
73
76
  'messages-non-lus',
74
77
  'newday',
75
78
  'nuit',
@@ -82,6 +85,7 @@ export const REDIRIGEES = new Set([
82
85
  'tableau',
83
86
  'ticket-du-sous-agent',
84
87
  'verrou',
88
+ 'verrou-hors-enveloppe',
85
89
  ]);
86
90
 
87
91
  /**
@@ -26,7 +26,7 @@ import path from 'node:path';
26
26
  import { pathToFileURL } from 'node:url';
27
27
  import { racineDeLaSupervision } from './attente-au-tour.mjs';
28
28
  import { circuitsDuServeur } from './circuits-du-serveur.mjs';
29
- import { questionsEnAttente, ticketsHorsAttente } from './superviseur.mjs';
29
+ import { ligneDeQuestion, questionsEnAttente, ticketsHorsAttente } from './superviseur.mjs';
30
30
 
31
31
  // The note of what blocked the stop in the repository at <racine>.
32
32
  const noteDe = racine => path.join(racine, '.claude', 'worktrees', 'signale-a-l-arret.json');
@@ -96,10 +96,7 @@ export async function attenteALArret(
96
96
  ...neuves.map(q =>
97
97
  q.interrompu
98
98
  ? `- ${q.ticket} a fini sans son issue, à ${q.etape} : \`${q.commande}\`.`
99
- : [
100
- `- ${q.ticket}, à ${q.etape}, au ${q.qui} : ${q.question.replace(/\n/g, '\n ')}`,
101
- ` La réponse : \`${q.commande}\`.`,
102
- ].join('\n')
99
+ : ligneDeQuestion(q)
103
100
  ),
104
101
  ].join('\n');
105
102
  }
@@ -16,7 +16,7 @@ import { spawnSync } from 'node:child_process';
16
16
  import path from 'node:path';
17
17
  import { pathToFileURL } from 'node:url';
18
18
  import { circuitsDuServeur } from './circuits-du-serveur.mjs';
19
- import { questionsEnAttente, ticketsHorsAttente } from './superviseur.mjs';
19
+ import { ligneDeQuestion, questionsEnAttente, ticketsHorsAttente } from './superviseur.mjs';
20
20
 
21
21
  /**
22
22
  * The root of the repository whose session of supervision works in <dossier>: null out of a git
@@ -81,10 +81,7 @@ export async function attenteAuTour(
81
81
  ...questions.map(q =>
82
82
  q.interrompu
83
83
  ? `- ${q.ticket} a fini sans son issue, à ${q.etape} : \`${q.commande}\`.`
84
- : [
85
- `- ${q.ticket}, à ${q.etape} : ${q.question.replace(/\n/g, '\n ')}`,
86
- ` La réponse : \`${q.commande}\`.`,
87
- ].join('\n')
84
+ : `- ${ligneDeQuestion(q, { courte: true })}`
88
85
  ),
89
86
  ].join('\n');
90
87
  }
package/scripts/bilan.mjs CHANGED
@@ -98,6 +98,7 @@ import path from 'node:path';
98
98
  import { StringDecoder } from 'node:string_decoder';
99
99
  import { REGISTRE } from './adresse-du-registre.mjs';
100
100
  import { lireLaConsommation } from './consommation-des-passes.mjs';
101
+ import { lireLeJournal } from './journal-des-etats.mjs';
101
102
  import { pathToFileURL } from 'node:url';
102
103
  import {
103
104
  AGENTS_DU_LOT,
@@ -219,6 +220,81 @@ function longueur(l) {
219
220
  const commun = ([d, f], l) =>
220
221
  longueur(l.map(([a, b]) => [Math.max(a, d), Math.min(b, f)]).filter(([a, b]) => b > a));
221
222
 
223
+ // The disjoint intervals of the union of <l>, in order.
224
+ function fusion(l) {
225
+ const out = [];
226
+ for (const [d, f] of [...l].filter(([a, b]) => b > a).sort((x, y) => x[0] - y[0])) {
227
+ const dernier = out.at(-1);
228
+ if (dernier && d <= dernier[1]) {
229
+ dernier[1] = Math.max(dernier[1], f);
230
+ } else {
231
+ out.push([d, f]);
232
+ }
233
+ }
234
+ return out;
235
+ }
236
+ // The parts of the disjoint intervals <a> that lie in the intervals <b>.
237
+ const dans = (a, b) =>
238
+ fusion(
239
+ a.flatMap(([d, f]) => b.map(([x, y]) => [Math.max(d, x), Math.min(f, y)]).filter(([x, y]) => y > x))
240
+ );
241
+ // The parts of the intervals <a> outside the intervals <b>.
242
+ function sansLes(a, b) {
243
+ const sans = fusion(b);
244
+ return a.flatMap(([d, f]) => {
245
+ const out = [];
246
+ let x = d;
247
+ for (const [y, z] of sans) {
248
+ if (z <= x || y >= f) {
249
+ continue;
250
+ }
251
+ if (y > x) {
252
+ out.push([x, y]);
253
+ }
254
+ x = Math.max(x, z);
255
+ }
256
+ if (x < f) {
257
+ out.push([x, f]);
258
+ }
259
+ return out;
260
+ });
261
+ }
262
+
263
+ // The intervals of the traces of <journal> (the lines of the ticket's journal of states) by cause:
264
+ // the waits for a place (`places` `attente` to the next `prise`, the reason naming another circuit
265
+ // included), the waits of the queue (`file` `attente` to the next line `file`, those a line gives
266
+ // `autre` apart). A wait never closed counts nothing.
267
+ function tracesDuJournal(journal, ticket) {
268
+ const lignes = journal
269
+ .filter(l => l.ticket === ticket && Number.isFinite(Date.parse(l.ts)))
270
+ .map((l, i) => ({ l, i, t: Date.parse(l.ts) }))
271
+ .sort((x, y) => x.t - y.t || x.i - y.i);
272
+ const place = [];
273
+ const autre = [];
274
+ const file = [];
275
+ let attendPlace = null;
276
+ let attendFile = null;
277
+ for (const { l, t } of lignes) {
278
+ if (l.genre === 'places') {
279
+ if (l.etape === 'attente') {
280
+ attendPlace ??= t;
281
+ } else if (l.etape === 'prise' && attendPlace !== null) {
282
+ place.push([attendPlace, t]);
283
+ attendPlace = null;
284
+ }
285
+ } else if (l.genre === 'file') {
286
+ if (attendFile) {
287
+ (attendFile.autre ? autre : file).push([attendFile.t, t]);
288
+ attendFile = null;
289
+ }
290
+ if (l.etape === 'attente') {
291
+ attendFile = { t, autre: Boolean(l.autre) };
292
+ }
293
+ }
294
+ }
295
+ return { place, autre, file };
296
+ }
297
+
222
298
  // The bilan of <ticket> from the register's lines <lignes> (of its project), the results the
223
299
  // circuit kept <entrees> (`<ticket>.fiches.jsonl`), the circuit's state <etat> (or null), the
224
300
  // project's night <nuit> and the times of the owner's messages in the supervisor's sessions the
@@ -230,6 +306,7 @@ export function bilan({
230
306
  etat = null,
231
307
  nuit = NUIT,
232
308
  duResponsable = [],
309
+ journal = [],
233
310
  maintenant = Date.now(),
234
311
  }) {
235
312
  // The sessions the circuit launched, by their id.
@@ -403,6 +480,40 @@ export function bilan({
403
480
  0,
404
481
  mur - longueur([...segments.map(fenetre).filter(([d, f]) => f > d), ...attentes])
405
482
  );
483
+ // The causes of « entre deux étapes »: each instant of the gaps goes to the first cause of the
484
+ // list that a trace covers (a session starting, a place or cores, another circuit, the queue),
485
+ // the rest unattributed.
486
+ const trous = sansLes(
487
+ mur ? [[debut, fin]] : [],
488
+ [...segments.map(fenetre), ...attentes.map(([d, f]) => [Math.max(d, debut), Math.min(f, fin)])]
489
+ );
490
+ const traces = tracesDuJournal(journal, ticket);
491
+ const demarrages = entrees
492
+ .filter(e => e.role === CIRCUIT && e.lancement)
493
+ .flatMap(e => {
494
+ const d = Date.parse(e.date ?? '');
495
+ const s = derniere.get(e.lancement.seance);
496
+ const f = s ? Date.parse(s.debut) : NaN;
497
+ return f > d ? [[d, f]] : [];
498
+ });
499
+ let reste = trous;
500
+ const causes = {};
501
+ for (const [cause, l] of [
502
+ ['seance', demarrages],
503
+ ['place', traces.place],
504
+ ['autre', traces.autre],
505
+ ['file', traces.file],
506
+ ]) {
507
+ const pris = dans(reste, fusion(l));
508
+ causes[cause] = longueur(pris);
509
+ reste = sansLes(reste, pris);
510
+ }
511
+ const attribue = Object.values(causes).reduce((m, x) => m + x, 0);
512
+ causes.nonAttribue = Math.max(0, categories.intervalles.ms - attribue);
513
+ categories.intervalles.causes = causes;
514
+ // Whether the journal holds a line of the ticket: without one (a journal from before the lot),
515
+ // the text keeps its lines as they were.
516
+ categories.intervalles.journale = journal.some(l => l.ticket === ticket);
406
517
  for (const c of Object.values(categories)) {
407
518
  c.jetons = Math.round(c.jetons);
408
519
  c.cache = Math.round(c.cache);
@@ -563,7 +674,18 @@ export function texteDuBilan(b, avant, depassent = []) {
563
674
  const paye = new Set(['travail', 'sansEffet', 'questionnement']);
564
675
  const q = b.questionnement;
565
676
  const pluriel = (n, mot) => `${n} ${mot}${n > 1 ? 's' : ''}`;
566
- const lignes = CATEGORIES.map(([k, nom]) => {
677
+ const causes = b.categories.intervalles.causes;
678
+ const sousLignes =
679
+ causes && b.categories.intervalles.journale
680
+ ? [
681
+ ["démarrage d'une séance", 'seance'],
682
+ ['cœurs ou place', 'place'],
683
+ ['autre circuit ou projet', 'autre'],
684
+ ['file', 'file'],
685
+ ['non attribué', 'nonAttribue'],
686
+ ].map(([nom, k]) => ` - ${nom} : ${minutes(causes[k])} min`)
687
+ : [];
688
+ const lignes = CATEGORIES.flatMap(([k, nom]) => {
567
689
  const c = b.categories[k];
568
690
  const plus =
569
691
  (k === SUPERVISEUR || k === RESPONSABLE) && c.n
@@ -573,7 +695,7 @@ export function texteDuBilan(b, avant, depassent = []) {
573
695
  : paye.has(k)
574
696
  ? `, ${dollars(c.cout)} $`
575
697
  : '';
576
- return `- ${nom} : ${minutes(c.ms)} min${plus}`;
698
+ return [`- ${nom} : ${minutes(c.ms)} min${plus}`, ...(k === 'intervalles' ? sousLignes : [])];
577
699
  });
578
700
  const t = b.tri;
579
701
  const verdicts = t
@@ -752,6 +874,7 @@ function calculer(racine, ticket, fin, { responsable = true } = {}) {
752
874
  etat: fin,
753
875
  nuit: plageDeNuit(racine),
754
876
  duResponsable: responsable ? [...seances].flatMap(s => messagesDeLaSeance(String(s))) : [],
877
+ journal: lireLeJournal(racine, { ticket }).lignes,
755
878
  });
756
879
  }
757
880
 
@@ -1,70 +1,57 @@
1
1
  #!/usr/bin/env node
2
- // The night branch guard: refuses a push to origin that reaches the branch named by
3
- // `grillhouse.poussee.nuit`, unless the night makes the push. Run by the pre-push hook of the
4
- // frame with git's arguments (remote name, remote URL) and, on the standard input, the lines
2
+ // The judged main guard: a push to origin of the branch main carries only a commit whose tree a
3
+ // final pass of the circuit, or the verification of a lot of the direct way, judged green
4
+ // (scripts/arbres-juges.mjs), as bors and the merge queues enter only a tree already judged
5
+ // (`refusSurMain`), in every project. Run by the pre-push hook of the frame with git's arguments
6
+ // (remote name, remote URL) and, on the standard input, the lines
5
7
  // « <local ref> <local sha> <remote ref> <remote sha> » git writes.
6
8
  //
7
- // - Only the remote `origin` is watched, the one the night pushes to. A push of several refs one
8
- // of which reaches the branch, and the deletion of that remote branch, are refused whole.
9
- // - The key is read as written in the package.json at the root of the working tree the push starts
10
- // from; without the key (or null) nothing is refused. An invalid value (see
11
- // scripts/poussee-cles.mjs) refuses the push, with a line that cites the key.
12
- // - The night makes itself known by GRILLHOUSE_NUIT=1, which scripts/nuit.sh sets for its push
13
- // alone. It is a mark, not a secret: a human who sets it is trusted.
9
+ // - Only the remote `origin` is watched. Main is the one branch that receives the lots; the queue
10
+ // pushes such a commit, and the CI of main plays after, by batches. No CI of a ticket's branch is
11
+ // asked.
12
+ // - A project whose package.json carries the retired key `grillhouse.poussee` is refused by its
13
+ // name (scripts/poussee-retiree.mjs), whatever its value.
14
14
  // - Exit 0 lets the push go on; exit 1 refuses it, the reason on the standard error.
15
- //
16
- // The judged main: a push to origin of the branch main is pushed to (`grillhouse.poussee.commit`,
17
- // `main` by default) carries only a commit whose tree a final pass of the circuit, or the
18
- // verification of a lot of the direct way, judged green (scripts/arbres-juges.mjs), as bors and the
19
- // merge queues enter only a tree already judged (`refusSurMain`), in every project. The queue
20
- // pushes such a commit; the CI of main plays after, by batches. No CI of a ticket's branch is asked.
21
15
  import { execFileSync } from 'node:child_process';
22
16
  import { existsSync, readFileSync } from 'node:fs';
23
17
  import path from 'node:path';
24
18
  import { pathToFileURL } from 'node:url';
25
19
  import { commitEstJuge } from './arbres-juges.mjs';
26
- import { lireCommit, lirePoussee } from './poussee-cles.mjs';
20
+ import { ecartsDuDossier } from './etat-du-depot.mjs';
21
+ import { pousseeRetiree } from './poussee-retiree.mjs';
27
22
 
28
23
  // A sha of zeros: the deletion of the remote branch.
29
24
  const SUPPRESSION = /^0+$/;
30
25
 
31
26
  /**
32
- * The refusals for a push to `remote` of `refs` to the branch `principale`: each commit
33
- * <jugee(sha)> does not say judged by a final pass or a verification is refused, named.
27
+ * The refusals for a push to `remote` of `refs` to main: each commit <jugee(sha)> does not say
28
+ * judged by a final pass or a verification is refused, named.
34
29
  * @param {string} remote
35
30
  * @param {{ sha: string, distante: string }[]} refs
36
- * @param {{ principale: string | null, jugee: (sha: string) => boolean }} o
31
+ * @param {{ jugee: (sha: string) => boolean }} o
37
32
  * @returns {string[]}
38
33
  */
39
- export function refusSurMain(remote, refs, { principale, jugee }) {
40
- if (remote !== 'origin' || !principale) {
34
+ export function refusSurMain(remote, refs, { jugee, tete, ecarts }) {
35
+ if (remote !== 'origin') {
41
36
  return [];
42
37
  }
43
38
  return refs
44
- .filter(r => r.distante === `refs/heads/${principale}` && !SUPPRESSION.test(r.sha))
39
+ .filter(r => r.distante === 'refs/heads/main' && !SUPPRESSION.test(r.sha))
45
40
  .filter(r => !jugee(r.sha))
46
- .map(
47
- r =>
48
- `⛔ ${r.sha.slice(0, 8)} n'est jugé vert par aucune passe finale ni vérification de lot : main n'avance que sur un arbre jugé. Joue \`npm run verifier\` sur ce commit (lot direct), ou laisse la file du circuit jouer sa passe finale.`
49
- );
41
+ .map(r => {
42
+ const base = `⛔ ${r.sha.slice(0, 8)} n'est jugé vert par aucune passe finale ni vérification de lot : main n'avance que sur un arbre jugé. Joue \`npm run verifier\` sur ce commit (lot direct), ou laisse la file du circuit jouer sa passe finale.`;
43
+ const fichiers = tete === r.sha && ecarts ? ecarts() : [];
44
+ return fichiers.length
45
+ ? `${base} Le dossier diffère du commit par : ${fichiers.join(', ')} (commite-les ou restaure-les).`
46
+ : base;
47
+ });
50
48
  }
51
49
 
52
- // The refusals for a push to `remote` of `refs` (the lines git writes) given the package.json
53
- // object `pkg`; an empty list lets the push go on.
54
- export function refus(remote, refs, pkg, env = process.env) {
55
- if (remote !== 'origin' || env.GRILLHOUSE_NUIT === '1' || !pkg) {
56
- return [];
57
- }
58
- const { nuit, fautes } = lirePoussee(pkg);
59
- if (fautes.length) {
60
- return fautes.map(
61
- f => `⛔ La clé ${f.cle} vaut ${f.valeur} : valeur invalide, la poussée est refusée.`
62
- );
63
- }
64
- if (nuit && refs.some(r => r.distante === `refs/heads/${nuit}`)) {
65
- return [`⛔ Seule la nuit pousse origin/${nuit} (grillhouse.poussee.nuit), après son vert.`];
66
- }
67
- return [];
50
+ // The refusals for a push to `remote` of `refs` given the package.json object `pkg`: the retired
51
+ // key `grillhouse.poussee` refuses it by its name; an empty list lets the push go on.
52
+ export function refus(remote, refs, pkg) {
53
+ const ligne = remote === 'origin' ? pousseeRetiree(pkg) : null;
54
+ return ligne ? [`⛔ ${ligne}`] : [];
68
55
  }
69
56
 
70
57
  // The pushed refs of git's standard input.
@@ -86,8 +73,9 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
86
73
  const lignes = [
87
74
  ...refus(process.argv[2], refs, pkg),
88
75
  ...refusSurMain(process.argv[2], refs, {
89
- principale: pkg ? lireCommit(pkg).commit : null,
90
76
  jugee: sha => commitEstJuge(racine, sha),
77
+ tete: execFileSync('git', ['-C', racine, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(),
78
+ ecarts: () => ecartsDuDossier(racine),
91
79
  }),
92
80
  ];
93
81
  for (const l of lignes) {