@roomi-fields/grillhouse 0.48.0 → 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 (147) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +6 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +9 -2
  6. package/cadre/templates/projet/CLAUDE.md +9 -5
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/cadre/templates/turbo/paquets.json +3 -1
  9. package/cadre/templates/turbo/sans-paquets.json +3 -1
  10. package/charte.md +40 -14
  11. package/dist/temporal/circuit/appel.d.ts +4 -1
  12. package/dist/temporal/circuit/appel.js +15 -1
  13. package/dist/temporal/circuit/appel.js.map +1 -1
  14. package/dist/temporal/circuit/client.d.ts +7 -1
  15. package/dist/temporal/circuit/client.js +54 -1
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +30 -57
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +2 -1
  20. package/dist/temporal/circuit/contrat.js +2 -1
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +9 -2
  23. package/dist/temporal/circuit/deroule.js.map +1 -1
  24. package/dist/temporal/file/contrat.d.ts +16 -2
  25. package/dist/temporal/file/contrat.js +27 -3
  26. package/dist/temporal/file/contrat.js.map +1 -1
  27. package/dist/temporal/file/deroule.js +4 -4
  28. package/dist/temporal/file/deroule.js.map +1 -1
  29. package/dist/temporal/nuits/activites.d.ts +1 -15
  30. package/dist/temporal/nuits/activites.js +3 -62
  31. package/dist/temporal/nuits/activites.js.map +1 -1
  32. package/dist/temporal/nuits/contrat.d.ts +3 -21
  33. package/dist/temporal/nuits/deroule.js +38 -74
  34. package/dist/temporal/nuits/deroule.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +3 -16
  36. package/dist/temporal/places/client.js +3 -26
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/dist/temporal/places/contrat.d.ts +15 -51
  39. package/dist/temporal/places/contrat.js +3 -13
  40. package/dist/temporal/places/contrat.js.map +1 -1
  41. package/dist/temporal/places/deroule.js +11 -61
  42. package/dist/temporal/places/deroule.js.map +1 -1
  43. package/dist/temporal/tickets/activites.js +4 -2
  44. package/dist/temporal/tickets/activites.js.map +1 -1
  45. package/dist/temporal/tickets/contrat.d.ts +2 -1
  46. package/docs/ARCHITECTURE.md +310 -115
  47. package/docs/CADRE.md +16 -13
  48. package/docs/INTERFACE.md +90 -25
  49. package/hooks/hooks.json +9 -0
  50. package/hooks/register.tsx +59 -5
  51. package/package.json +1 -1
  52. package/scripts/activites.mjs +271 -42
  53. package/scripts/aiguillage.mjs +4 -1
  54. package/scripts/bilan.mjs +125 -2
  55. package/scripts/circuit.mjs +233 -159
  56. package/scripts/circuits-cles.d.mts +3 -3
  57. package/scripts/circuits-cles.mjs +6 -5
  58. package/scripts/coeurs-dedies.mjs +4 -4
  59. package/scripts/commandes-composees.mjs +12 -5
  60. package/scripts/dette.d.ts +2 -1
  61. package/scripts/dette.mjs +49 -6
  62. package/scripts/direct.mjs +343 -0
  63. package/scripts/droits.mjs +19 -0
  64. package/scripts/effets.mjs +4 -4
  65. package/scripts/engendres.mjs +2 -1
  66. package/scripts/enveloppe/enveloppe.mjs +67 -13
  67. package/scripts/enveloppe/lancer.sh +14 -3
  68. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  69. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  70. package/scripts/etapes.mjs +3 -3
  71. package/scripts/faits-du-circuit.mjs +12 -11
  72. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  73. package/scripts/fermeture-de-la-machine.mjs +10 -20
  74. package/scripts/fichiers-nommes.mjs +27 -1
  75. package/scripts/file-des-tickets.d.mts +18 -1
  76. package/scripts/file-des-tickets.mjs +63 -15
  77. package/scripts/grillhouse-maj.mjs +13 -25
  78. package/scripts/groupe-cles.d.mts +6 -0
  79. package/scripts/groupe-cles.mjs +29 -1
  80. package/scripts/integration/file.mjs +148 -37
  81. package/scripts/jointure.d.ts +17 -3
  82. package/scripts/journal-des-etats.d.mts +16 -0
  83. package/scripts/journal-des-etats.mjs +44 -2
  84. package/scripts/journal.mjs +3 -0
  85. package/scripts/langages/c/commandes.mjs +5 -5
  86. package/scripts/langages/c/composants.mjs +13 -5
  87. package/scripts/langages/cargo/commandes.mjs +5 -6
  88. package/scripts/langages/python/commandes.mjs +5 -5
  89. package/scripts/langages/python/composants.mjs +10 -2
  90. package/scripts/langages/typescript/composants.mjs +10 -3
  91. package/scripts/langages/typescript/construire.mjs +2 -0
  92. package/scripts/langages/typescript/exemples.mjs +33 -1
  93. package/scripts/langages/typescript/index.mjs +19 -0
  94. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  95. package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
  96. package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
  97. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  98. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  99. package/scripts/langages/typescript/verifier.mjs +3 -5
  100. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  101. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  102. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  103. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  104. package/scripts/machine.mjs +1 -1
  105. package/scripts/mesure/base-de-passe.mjs +2 -1
  106. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  107. package/scripts/migrations.mjs +2 -0
  108. package/scripts/nuit.sh +97 -2
  109. package/scripts/paquet.mjs +16 -5
  110. package/scripts/paquets.d.ts +4 -0
  111. package/scripts/paquets.mjs +57 -0
  112. package/scripts/passe-de-la-machine.mjs +4 -7
  113. package/scripts/places-de-la-machine.mjs +55 -42
  114. package/scripts/places-du-serveur.mjs +2 -2
  115. package/scripts/plafond-de-la-machine.d.mts +7 -13
  116. package/scripts/plafond-de-la-machine.mjs +19 -35
  117. package/scripts/prefixe-des-tickets.mjs +1 -1
  118. package/scripts/references-changees.mjs +159 -0
  119. package/scripts/regles-des-places.d.mts +8 -31
  120. package/scripts/regles-des-places.mjs +14 -64
  121. package/scripts/repli-de-la-nuit.mjs +112 -0
  122. package/scripts/reponses-du-circuit.d.mts +2 -2
  123. package/scripts/reponses-du-circuit.mjs +21 -12
  124. package/scripts/reprise.mjs +27 -8
  125. package/scripts/resultats.mjs +21 -9
  126. package/scripts/seances.mjs +258 -40
  127. package/scripts/services-du-noyau.mjs +3 -0
  128. package/scripts/sous-commandes.mjs +24 -7
  129. package/scripts/superviseur.mjs +185 -39
  130. package/scripts/tableau.mjs +220 -89
  131. package/scripts/taches-du-graphe.mjs +84 -4
  132. package/scripts/ticket.mjs +345 -0
  133. package/scripts/transitions.d.mts +44 -0
  134. package/scripts/transitions.mjs +173 -13
  135. package/scripts/un-commit-par-ticket.mjs +4 -3
  136. package/scripts/verdict-de-la-nuit.mjs +47 -20
  137. package/scripts/verrou-de-fichier.mjs +2 -2
  138. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  139. package/scripts/verrous/verrou.mjs +17 -1
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/direct/SKILL.md +57 -0
  142. package/skills/explorateur/SKILL.md +10 -6
  143. package/skills/pitmaster/SKILL.md +34 -14
  144. package/skills/pitmaster/references/consigne-agent.md +7 -1
  145. package/skills/relecteur/SKILL.md +8 -0
  146. package/skills/testwriter/SKILL.md +10 -0
  147. package/scripts/ticket.sh +0 -25
@@ -40,14 +40,31 @@
40
40
  // which plays nothing again. Green, the tree is kept judged and main moves forward onto the
41
41
  // candidate (`avancerMain`, `merge --ff-only`), the tree the pass judged; main moved meanwhile, the
42
42
  // workflow replaces the branch again and judges it again. Red, the ticket loses `en-file` and
43
- // reopens, its comment giving the end of the output of the pass; main does not move, and the branch
44
- // stays. To play again (75, the part of the machine awaited), the branch stays in the queue, the
45
- // ticket told, neither reopened nor closed. A flaky test has no path of its own: the red comment
43
+ // reopens; main does not move, and the branch stays. To play again (75, the part of the machine
44
+ // awaited), the branch stays in the queue, the ticket told, neither reopened nor closed. A pass
45
+ // that is not green reports as the checks of the circuit do, and as a merge queue keeps the logs of
46
+ // the job that refuses a lot and lists its failed tests (bors, Zuul): its whole output is added to
47
+ // the journal of the ticket (`.claude/worktrees/<ticket>.log`, the circuit's own), under a header
48
+ // line (a copy that does not open plays no verification, and its header says so), and the comment
49
+ // names that file; the pass names a results directory (`GRILLHOUSE_RESULTATS`,
50
+ // scripts/resultats.mjs) in a base of its own (scripts/mesure/base-de-passe.mjs, genre `file`),
51
+ // removed at its end and swept by the next pass when its act was killed, as the passes of the
52
+ // circuit keep theirs in the base of their run; the comment of a red names each red read there
53
+ // (test, file, message; finding; failed task) by the reading of the checks (`rougesDUnePasse` of
54
+ // scripts/activites.mjs, which the act gives the queue's tools, built with it or refused), in
55
+ // every language, and the journal holds them all; the comment lists them up to a bound
56
+ // (`ROUGES_AU_COMMENTAIRE`), says their count and sends to the journal for the rest; the end of
57
+ // the output comes only when that reading names none. A flaky test has no path of its own: the red comment
46
58
  // gives the charter's rule, a test known red goes into quarantine in the test itself, with the
47
59
  // ticket that fixes it.
48
60
  // At its entry on main (`fermerLEntree`), the branch's ticket closes « intégré : <commit> », loses
49
61
  // `en-file`, and the branch is deleted; a branch git does not delete (its copy still in place) is
50
- // written to the ticket, which closes all the same. Then main is pushed to origin, to the branch
62
+ // written to the ticket, which closes all the same. A closure Beads refuses (a ticket an open
63
+ // dependency blocks) is a fault named, `fermeture`: its comment at the ticket says it whole, no
64
+ // capability is delivered, the working directory stays, main is pushed, and the workflow gives the
65
+ // circuit the issue « echec », on which it stops with its question; its resumption, once what
66
+ // holds the closure is lifted, plays the entry again, which closes the ticket; the queue of the
67
+ // tickets never starts again a ticket whose lot is on main (scripts/file-des-tickets.mjs). Then main is pushed to origin, to the branch
51
68
  // main, which the pre-push hook lets go as the tree is judged (a main whose package.json carries the
52
69
  // retired key `grillhouse.poussee` is refused by its name, nothing pushed); a refused push is written to the ticket and does not stop the
53
70
  // queue. The working directory of its circuit (`.claude/worktrees/<ticket>.travail`,
@@ -55,7 +72,7 @@
55
72
  // Every comment and change of the queue at a ticket is written under the author `file`, which bd
56
73
  // reads in BEADS_ACTOR, as the circuit writes its own lines under `circuit`.
57
74
  import { spawnSync } from 'node:child_process';
58
- import { existsSync, rmSync } from 'node:fs';
75
+ import { appendFileSync, existsSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';
59
76
  import path from 'node:path';
60
77
  import {
61
78
  aRejouer,
@@ -70,6 +87,8 @@ import { A_REPASSER } from '../codes-de-sortie.mjs';
70
87
  import { BASE_DU_LOT } from '../dernier-vert.mjs';
71
88
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
72
89
  import { matieresDeclareesDe } from '../matieres-cles.mjs';
90
+ import { ouvrirBase } from '../mesure/base-de-passe.mjs';
91
+ import { RESULTATS } from '../resultats.mjs';
73
92
  import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
74
93
  import { pousseeRetiree } from '../poussee-retiree.mjs';
75
94
  import { ouvrirCopie } from './rejeu.mjs';
@@ -93,33 +112,61 @@ const commenterAu = (o, ticket, texte) =>
93
112
  // circuit reads to name that commit (scripts/circuit.mjs, the tri of the discoveries).
94
113
  export const INTEGRE = 'intégré : ';
95
114
 
96
- // The lines of the end of the output of a pass the comment of a red gives.
115
+ // The lines of the end of the output of a pass, which the comment gives when no red is named.
97
116
  const FIN_DE_LA_SORTIE = 60;
98
117
 
118
+ // The characters of the list of the reds a comment holds, one argument of `bd comments add`: the
119
+ // reds beyond are counted there and read in the journal.
120
+ const ROUGES_AU_COMMENTAIRE = 20000;
121
+
122
+ // The journal of the ticket <ticket> in the main tree <racine>, the one its circuit writes
123
+ // (scripts/circuit.mjs).
124
+ const journalDuTicket = (racine, ticket) =>
125
+ path.join(racine, '.claude', 'worktrees', `${ticket}.log`);
126
+
99
127
  /**
100
- * The final pass played in the queue's own copy (`.claude/worktrees/file`) on the commit <commit>:
101
- * `{ code, sortie }`, the code of `npm run verifier` (0 green, 75 to play again, any other red) and
102
- * its output. The copy is made ready on <commit> (detached, its dependencies in agreement with the
103
- * lock file), the pass measured against the tip of main (`GRILLHOUSE_BASE_DU_LOT`, the commit's base
104
- * as the lot lies on it), as the pass of the circuit measures itself.
128
+ * The final pass played in the queue's own copy (`.claude/worktrees/file`) on the commit <commit>
129
+ * for the ticket <ticket>: `{ code, sortie, rouges }`, the code of `npm run verifier` (0 green, 75
130
+ * to play again, any other red), its output, and the lines of the reds of a red pass. The copy is
131
+ * made ready on <commit> by <ouvrir> (detached, its dependencies in agreement with the lock file),
132
+ * the pass measured against the tip of main (`GRILLHOUSE_BASE_DU_LOT`, the commit's base as the lot
133
+ * lies on it), as the pass of the circuit measures itself. The pass names a results directory
134
+ * (`GRILLHOUSE_RESULTATS`) in a base of its own (`ouvrirBase('file')`), where <rouges> reads the
135
+ * reds of a red pass (`{ copie, dossier, code, ticket, journal }` → their lines); the base is
136
+ * closed at the end of the pass, and swept by the next one when the act was killed. A copy that
137
+ * does not open plays no pass: 75, its refusal as the output, `refus` true.
105
138
  */
106
- function passeDeLaFile(racine, principale, dire) {
107
- return ({ commit }) => {
139
+ function passeDeLaFile(racine, principale, dire, { rouges, ouvrir }) {
140
+ return ({ commit, ticket }) => {
108
141
  const copie = path.join(racine, '.claude', 'worktrees', 'file');
109
- const ouverte = ouvrirCopie({ racine, copie, ref: commit, dire });
142
+ const ouverte = ouvrir({ racine, copie, ref: commit, dire });
110
143
  if (ouverte.refus) {
111
- return { code: A_REPASSER, sortie: ouverte.refus };
144
+ return { code: A_REPASSER, sortie: ouverte.refus, rouges: [], refus: true };
112
145
  }
113
146
  const base = spawnSync('git', ['-C', racine, 'rev-parse', `refs/heads/${principale}`], {
114
147
  encoding: 'utf8',
115
148
  }).stdout.trim();
116
- const r = spawnSync('bash', ouverte.monter('npm', 'run', 'verifier'), {
117
- cwd: copie,
118
- encoding: 'utf8',
119
- maxBuffer: 256 * 1024 * 1024,
120
- env: base ? { ...process.env, [BASE_DU_LOT]: base } : process.env,
121
- });
122
- return { code: r.status ?? 1, sortie: `${r.stdout ?? ''}${r.stderr ?? ''}` };
149
+ const laBase = ouvrirBase('file');
150
+ try {
151
+ const dossier = mkdtempSync(path.join(laBase.dossier, 'resultats-'));
152
+ const r = spawnSync('bash', ouverte.monter('npm', 'run', 'verifier'), {
153
+ cwd: copie,
154
+ encoding: 'utf8',
155
+ maxBuffer: 256 * 1024 * 1024,
156
+ env: { ...process.env, [RESULTATS]: dossier, ...(base ? { [BASE_DU_LOT]: base } : {}) },
157
+ });
158
+ const code = r.status ?? 1;
159
+ const rouge = code !== 0 && code !== A_REPASSER;
160
+ return {
161
+ code,
162
+ sortie: `${r.stdout ?? ''}${r.stderr ?? ''}`,
163
+ rouges: rouge
164
+ ? rouges({ copie, dossier, code, ticket, journal: journalDuTicket(racine, ticket) })
165
+ : [],
166
+ };
167
+ } finally {
168
+ laBase.fermer();
169
+ }
123
170
  };
124
171
  }
125
172
 
@@ -127,9 +174,21 @@ function passeDeLaFile(racine, principale, dire) {
127
174
  * The tools of the queue on the main tree <racine>, its lines said by <dire>: `{ racine,
128
175
  * principale, bd, passe, dire, avancement }`, bd run under the queue's author (BEADS_ACTOR), the
129
176
  * branch of the main tree (null when it is on none), `passe` the final pass played in the queue's
130
- * copy.
177
+ * copy. <ports> gives what the pass plays with: `rouges`, the reading of the reds of a red pass,
178
+ * without which the tools are refused, and `ouvrir`, which makes the queue's copy ready
179
+ * (`ouvrirCopie`).
131
180
  */
132
- export function outilsDeLaFile(racine, dire, avancement = null) {
181
+ export function outilsDeLaFile(
182
+ racine,
183
+ dire,
184
+ avancement = null,
185
+ { rouges, ouvrir = ouvrirCopie } = {}
186
+ ) {
187
+ if (typeof rouges !== 'function') {
188
+ throw new Error(
189
+ "Les outils de la file se bâtissent avec la lecture des rouges d'une passe (rouges)."
190
+ );
191
+ }
133
192
  const bd = (...a) => {
134
193
  const r = spawnSync('bd', a, {
135
194
  cwd: racine,
@@ -150,7 +209,7 @@ export function outilsDeLaFile(racine, dire, avancement = null) {
150
209
  racine,
151
210
  principale,
152
211
  bd,
153
- passe: passeDeLaFile(racine, principale ?? 'main', dire),
212
+ passe: passeDeLaFile(racine, principale ?? 'main', dire, { rouges, ouvrir }),
154
213
  dire,
155
214
  avancement,
156
215
  };
@@ -334,9 +393,10 @@ export function preparerLaBranche(o, entree) {
334
393
  * The candidate <commit> of <entree> (`{ ticket, branche, commit }`) judged by the final pass with
335
394
  * the tools <o>: `{ juge: true }`, green (or its tree already judged: nothing is played again), its
336
395
  * tree kept judged (scripts/arbres-juges.mjs); or `{ issue }`, the issue for the circuit
337
- * (src/temporal/file/deroule.ts): red, `rouvert`, the end of the output of the pass in the comment,
396
+ * (src/temporal/file/deroule.ts): red, `rouvert`, the reds of the pass named in the comment (the end
397
+ * of its output when it names none), its whole output in the journal of the ticket,
338
398
  * the ticket reopened without `en-file`; to play again (75), `en-file`, the ticket told, neither
339
- * reopened nor closed. `o.passe({ commit })` gives `{ code, sortie }`.
399
+ * reopened nor closed. `o.passe({ commit, ticket })` gives `{ code, sortie, rouges }`.
340
400
  */
341
401
  export function jugerLeCandidat(o, entree) {
342
402
  const git = (...args) => spawnSync('git', ['-C', o.racine, ...args], { encoding: 'utf8' });
@@ -346,7 +406,12 @@ export function jugerLeCandidat(o, entree) {
346
406
  o.dire(`✓ arbre de ${court} déjà jugé par une passe finale`);
347
407
  return { juge: true };
348
408
  }
349
- const { code, sortie } = o.passe({ commit: entree.commit });
409
+ const {
410
+ code,
411
+ sortie,
412
+ rouges = [],
413
+ refus = false,
414
+ } = o.passe({ commit: entree.commit, ticket: entree.ticket });
350
415
  if (code === 0) {
351
416
  if (arbre) {
352
417
  garderLArbreJuge(o.racine, arbre);
@@ -354,14 +419,42 @@ export function jugerLeCandidat(o, entree) {
354
419
  o.dire(`✓ passe finale verte sur ${court}`);
355
420
  return { juge: true };
356
421
  }
357
- const fin = `${sortie ?? ''}`.trim().split('\n').slice(-FIN_DE_LA_SORTIE).join('\n');
422
+ const entiere = `${sortie ?? ''}`;
423
+ const fin = entiere.trim().split('\n').slice(-FIN_DE_LA_SORTIE).join('\n');
424
+ // The whole output, added to the journal of the ticket under its header line, then every red
425
+ // the pass read; a copy that did not open played no verification.
426
+ const journal = journalDuTicket(o.racine, entree.ticket);
427
+ mkdirSync(path.dirname(journal), { recursive: true });
428
+ const entete = refus
429
+ ? `La copie de la file ne s'ouvre pas sur ${court} : aucune passe finale jouée (code ${code})`
430
+ : `$ npm run verifier — la passe finale de la file sur ${court} (code ${code})`;
431
+ const lesRouges = rouges.length
432
+ ? `Les rouges de la passe finale de la file sur ${court} (${rouges.length}) :\n${rouges.map(r => `- ${r}`).join('\n')}\n`
433
+ : '';
434
+ appendFileSync(journal, `${entete}\n${entiere}${entiere.endsWith('\n') ? '' : '\n'}${lesRouges}`);
435
+ const saSortie = `Sa sortie entière : ${journal}`;
358
436
  if (code === A_REPASSER) {
359
- const texte = `## ${TITRE_PASSE_FINALE} à repasser\n\nLa passe finale de ${court} sur ${entree.branche} est à repasser (code ${code}) :\n\n${fin}\n\n${o.principale} n'avance pas sans son vert ; la branche reste en file, et la reprise du circuit la renvoie.`;
437
+ const texte = `## ${TITRE_PASSE_FINALE} à repasser\n\nLa passe finale de ${court} sur ${entree.branche} est à repasser (code ${code}) :\n\n${fin}\n\n${saSortie}\n\n${o.principale} n'avance pas sans son vert ; la branche reste en file, et la reprise du circuit la renvoie.`;
360
438
  commenterAu(o, entree.ticket, texte);
361
439
  o.dire(`⚠ passe finale de ${court} à repasser`);
362
440
  return { issue: { etat: 'en-file', raison: texte } };
363
441
  }
364
- const texte = `## ${TITRE_PASSE_FINALE} rouge\n\nLa passe finale de ${court} sur ${entree.branche}, le lot posé sur la pointe de ${o.principale}, est rouge (code ${code}). La fin de sa sortie :\n\n${fin}\n\n${o.principale} n'avance pas et le ticket est rouvert : sa correction entre sous son numéro. Un test connu instable se met en quarantaine dans le test, avec le ticket qui le corrige.`;
442
+ // The reds the pass read in its results, listed up to the bound of a comment, the first always,
443
+ // the others counted and left to the journal; or, when it names none, the end of its output.
444
+ const listes = [];
445
+ let taille = 0;
446
+ for (const r of rouges) {
447
+ taille += r.length;
448
+ if (listes.length && taille > ROUGES_AU_COMMENTAIRE) {
449
+ break;
450
+ }
451
+ listes.push(`- ${r.slice(0, ROUGES_AU_COMMENTAIRE)}`);
452
+ }
453
+ const autres = rouges.length - listes.length;
454
+ const ce = rouges.length
455
+ ? `Ses rouges (${rouges.length}) :\n\n${listes.join('\n')}${autres ? `\n\n… et ${autres} autre(s), au journal.` : ''}`
456
+ : `La fin de sa sortie :\n\n${fin}`;
457
+ const texte = `## ${TITRE_PASSE_FINALE} rouge\n\nLa passe finale de ${court} sur ${entree.branche}, le lot posé sur la pointe de ${o.principale}, est rouge (code ${code}). ${ce}\n\n${saSortie}\n\n${o.principale} n'avance pas et le ticket est rouvert : sa correction entre sous son numéro. Un test connu instable se met en quarantaine dans le test, avec le ticket qui le corrige.`;
365
458
  commenterAu(o, entree.ticket, texte);
366
459
  o.bd('update', entree.ticket, '--status', 'open', '--remove-label', 'en-file');
367
460
  o.dire(`✗ passe finale de ${court} rouge : ${entree.ticket} rouvert`);
@@ -434,8 +527,11 @@ function livrerLesCapacites(o, ticket, labels) {
434
527
  * removes the working directory of its circuit (`retirerLeTravail`). Each of its gestures replays
435
528
  * without harm (a ticket closed is left closed, a branch gone stays gone, a commit pushed is pushed
436
529
  * again as it is), and never reopens the ticket; its comments are effects (`commenterAu`), which
437
- * the workflow of the queue writes once each. `{ poussee, raison }`: `main` once pushed, or null
438
- * and why, in one line (`enUneLigne`), its comment at the ticket whole.
530
+ * the workflow of the queue writes once each. `{ poussee, raison, fermeture }`: `main` once
531
+ * pushed, or null and why, in one line (`enUneLigne`), its comment at the ticket whole;
532
+ * `fermeture`, the fault of a `bd close` that fails, in one line (the command and Beads' reason),
533
+ * null without one: the ticket stays open, no capability is delivered and the working directory
534
+ * stays, for the circuit that stops on it, and the entry played again closes the ticket.
439
535
  */
440
536
  export function fermerLEntree(o, entree) {
441
537
  const { racine } = o;
@@ -444,23 +540,38 @@ export function fermerLEntree(o, entree) {
444
540
  const commenter = texte => commenterAu(o, entree.ticket, texte);
445
541
  const show = o.bd('show', entree.ticket, '--json');
446
542
  const lu = show.status === 0 ? (JSON.parse(show.stdout)[0] ?? null) : null;
543
+ let fermeture = null;
447
544
  if ((lu?.status ?? null) !== 'closed') {
448
545
  o.bd('update', entree.ticket, '--remove-label', 'en-file');
449
- o.bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
546
+ const r = o.bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
547
+ if (r.status !== 0) {
548
+ const raison = `${r.stderr ?? ''}`.trim() || `${r.stdout ?? ''}`.trim() || `code ${r.status}`;
549
+ commenter(
550
+ `Le ticket n'est pas fermé : son lot est sur ${o.principale} en ${court}, mais \`bd close ${entree.ticket}\` échoue :\n${raison}\n\nLève ce qui l'empêche, puis reprends son circuit (\`--reprendre\`) : il repasse par la file, qui ferme le ticket, livre ses capacités et retire son dossier de travail. La file ne relance pas un ticket dont le lot est sur ${o.principale}.`
551
+ );
552
+ o.dire(`⚠ bd close ${entree.ticket} échoue`);
553
+ fermeture = `bd close ${entree.ticket} échoue : ${enUneLigne(raison)}`;
554
+ }
450
555
  }
451
556
  // The capabilities the ticket exports (`export:<capability>`) are delivered once it is closed.
452
- const ferme = livrerLesCapacites(o, entree.ticket, lu?.labels ?? []);
557
+ const ferme = {
558
+ ...(fermeture ? { livraison: null } : livrerLesCapacites(o, entree.ticket, lu?.labels ?? [])),
559
+ fermeture,
560
+ };
453
561
  o.dire(`✓ ${entree.branche} entre sur ${o.principale} : ${court}`);
454
562
  if (git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).status === 0) {
455
563
  const efface = git('branch', '-D', entree.branche);
456
564
  if (efface.status !== 0) {
457
565
  commenter(
458
- `La branche ${entree.branche} reste en place après son entrée sur ${o.principale} (${efface.stderr.trim()}) : sa copie est encore en place. Le ticket est fermé.`
566
+ `La branche ${entree.branche} reste en place après son entrée sur ${o.principale} (${efface.stderr.trim()}) : sa copie est encore en place.${fermeture ? '' : ' Le ticket est fermé.'}`
459
567
  );
460
568
  o.dire(`⚠ ${entree.branche} n'est pas effacée`);
461
569
  }
462
570
  }
463
- retirerLeTravail(o, entree.ticket);
571
+ // The working directory lives as long as the ticket: one left open keeps it, for its circuit.
572
+ if (!fermeture) {
573
+ retirerLeTravail(o, entree.ticket);
574
+ }
464
575
  const paquet = git('show', `refs/heads/${o.principale}:package.json`);
465
576
  const retiree = pousseeRetiree(paquet.status === 0 ? JSON.parse(paquet.stdout) : null);
466
577
  if (retiree) {
@@ -486,7 +486,6 @@ export function surUnePart(
486
486
  o?: {
487
487
  env?: NodeJS.ProcessEnv;
488
488
  racine?: string;
489
- entiere?: boolean;
490
489
  mesure?: boolean;
491
490
  dire?: (l: string) => void;
492
491
  }
@@ -523,7 +522,8 @@ export function nomDuPaquet(racine: string, dossier: string): string | null;
523
522
  /** Runs the tasks `taches` of the packages `noms` (all when empty) with the task runner `outil`,
524
523
  * each task whose dependencies succeed played to its end: the runner's exit code. `tests` is the
525
524
  * content of the variable `TESTS_CIBLES` of the run; the variable of `env` never passes on. A
526
- * red run names, through `dire`, each task whose code is not 0. */
525
+ * red run names, through `dire`, each task whose code is not 0. `coteACote` bounds the tasks played
526
+ * side by side (`--concurrency`). */
527
527
  export function lancerLesTaches(o: {
528
528
  outil: string;
529
529
  racine: string;
@@ -532,7 +532,15 @@ export function lancerLesTaches(o: {
532
532
  tests?: { arguments: string[]; rejouer?: string };
533
533
  env?: NodeJS.ProcessEnv;
534
534
  dire?: (ligne: string) => void;
535
+ coteACote?: number;
535
536
  }): number;
537
+ /** The tasks a run of the graph plays side by side on `coeurs` cores (the machine's by default):
538
+ * half of them, one at least; the bound `--concurrency` of the pass of the verification and of the
539
+ * build the guards wait for. */
540
+ export function tachesCoteACote(coeurs?: number): number;
541
+ /** The guard scripts of the root, and their tasks of the graph, in the order they play: the frame's
542
+ * controls, then the project's own guards. */
543
+ export const SCRIPTS_DE_GARDES: string[];
536
544
  /** A task of the summary of the task runner, or one a module wrote: `code` null for a task that did not run. */
537
545
  export interface TacheDuResume {
538
546
  tache: string;
@@ -587,12 +595,18 @@ export function tracesDuPlan(
587
595
  ): string[];
588
596
  /** The command `construire --echec <fichier> <plan>` of a module, run from the root of the copy:
589
597
  * builds the plan and its providers with the task runner `outil`, `run build --filter=<paquet>…`
590
- * (the whole copy for a plan with a path that is no package); its exit code. */
598
+ * (the whole copy for a plan with a path that is no package); its exit code. `construire --gardes`
599
+ * plays what the guard tasks of the root wait for in the graph, read in the runner's plan of them. */
591
600
  export function construireDepuisLesArguments(
592
601
  outil: string,
593
602
  args: string[],
594
603
  racine?: string
595
604
  ): number;
605
+ /** Whether the arguments of a command `construire` ask for a build of the graph, the core's one
606
+ * for every language (`--echec <fichier> <plan>`, the launcher's; `--gardes`, what the guard tasks
607
+ * of the root wait for, which the checks of a plan play before its guards), and not for the build
608
+ * of one package. */
609
+ export function constructionDuGraphe(args: string[]): boolean;
596
610
  /** What `lire` returns, read once under `cle` while the core holds a scope of readings done once
597
611
  * (a sweep that asks many questions of a tree that does not move), at each call otherwise
598
612
  * (scripts/lecture-unique.mjs). */
@@ -9,6 +9,17 @@ export interface LigneDuJournal {
9
9
  boucle: number | null;
10
10
  place: string | null;
11
11
  raison: string;
12
+ /** The reservation of a place taken or given back. */
13
+ reservation?: Reservation;
14
+ /** The circuit or project a queued ticket waits for (a line `file` `attente`). */
15
+ autre?: string;
16
+ }
17
+
18
+ /** What a place reserves: cores, memory in GB, and who (ticket and role, or pass). */
19
+ export interface Reservation {
20
+ coeurs: number;
21
+ memoireGo: number;
22
+ qui: string;
12
23
  }
13
24
 
14
25
  /** A trace to write: a line, `ts` set when it already has its date. */
@@ -29,7 +40,12 @@ export function traceDesPlaces(e: {
29
40
  ticket?: string | null;
30
41
  place?: string | null;
31
42
  raison?: string;
43
+ reservation?: Reservation;
32
44
  }): Trace;
45
+ export function reservationsOuvertes(
46
+ lignes: LigneDuJournal[],
47
+ ts: string
48
+ ): ({ place: string } & Reservation)[];
33
49
  export function lireLeJournal(
34
50
  racine: string,
35
51
  plage?: { depuis?: string; jusquA?: string; ticket?: string }
@@ -82,6 +82,10 @@ function ligneEntiere(trace, ts) {
82
82
  boucle: champ(trace.boucle),
83
83
  place: champ(trace.place),
84
84
  raison: trace.raison ?? '',
85
+ // The reservation of a place (`{ coeurs, memoireGo, qui }`) and the circuit a queued ticket
86
+ // waits for (`autre`) are written only when the trace carries them.
87
+ ...(trace.reservation ? { reservation: trace.reservation } : {}),
88
+ ...(trace.autre ? { autre: trace.autre } : {}),
85
89
  };
86
90
  let raison = Array.from(String(ligne.raison));
87
91
  let texte = JSON.stringify(ligne);
@@ -133,8 +137,46 @@ export function traceDeLaFile({ ticket, evenement }) {
133
137
  }
134
138
 
135
139
  /** The trace of a place taken (`prise`), given back (`rendue`) or waited for (`attente`). */
136
- export function traceDesPlaces({ evenement, ticket = null, place = null, raison = '' }) {
137
- return { genre: 'places', ticket, etape: evenement, boucle: null, place, raison };
140
+ export function traceDesPlaces({
141
+ evenement,
142
+ ticket = null,
143
+ place = null,
144
+ raison = '',
145
+ reservation = undefined,
146
+ }) {
147
+ return {
148
+ genre: 'places',
149
+ ticket,
150
+ etape: evenement,
151
+ boucle: null,
152
+ place,
153
+ raison,
154
+ ...(reservation ? { reservation } : {}),
155
+ };
156
+ }
157
+
158
+ /**
159
+ * The reservations open at the instant <ts> from the lines of the journal alone: each place
160
+ * `prise` with a reservation and not yet `rendue`, in the order of the takings.
161
+ * @param {object[]} lignes
162
+ * @param {string} ts
163
+ * @returns {{ place: string, coeurs: number, memoireGo: number, qui: string }[]}
164
+ */
165
+ export function reservationsOuvertes(lignes, ts) {
166
+ const t = instant(ts);
167
+ const ouvertes = new Map();
168
+ const triees = lignes
169
+ .map((l, i) => ({ l, i, t: instant(l.ts) }))
170
+ .filter(x => x.l.genre === 'places' && x.t <= t)
171
+ .sort((a, b) => a.t - b.t || a.i - b.i);
172
+ for (const { l } of triees) {
173
+ if (l.etape === 'prise' && l.reservation && l.place) {
174
+ ouvertes.set(l.place, { place: l.place, ...l.reservation });
175
+ } else if (l.etape === 'rendue' && l.place) {
176
+ ouvertes.delete(l.place);
177
+ }
178
+ }
179
+ return [...ouvertes.values()];
138
180
  }
139
181
 
140
182
  const instant = ts => Date.parse(ts);
@@ -56,6 +56,9 @@ const ligneDe = l =>
56
56
  l.etape ?? '-',
57
57
  ...(l.boucle === null || l.boucle === undefined ? [] : [`boucle ${l.boucle}`]),
58
58
  ...(l.place ? [`place ${l.place}`] : []),
59
+ ...(l.reservation
60
+ ? [`${l.reservation.coeurs} cœurs, ${l.reservation.memoireGo} Go, ${l.reservation.qui}`]
61
+ : []),
59
62
  ...(l.raison ? [`— ${l.raison}`] : []),
60
63
  ].join(' ');
61
64
 
@@ -46,6 +46,7 @@ import {
46
46
  avecLaPasse,
47
47
  cheminsDeLaTache,
48
48
  construireDepuisLesArguments,
49
+ constructionDuGraphe,
49
50
  GRAPHE_JOUE,
50
51
  joueCeQuiNeSeDivisePas,
51
52
  lancerLesTaches,
@@ -54,6 +55,7 @@ import {
54
55
  ouvrirBase,
55
56
  retirerALInterruption,
56
57
  SCRIPT_DES_TESTS,
58
+ SCRIPTS_DE_GARDES,
57
59
  surUnePart,
58
60
  testsCibles,
59
61
  travailleursDeLaSeance,
@@ -411,9 +413,6 @@ function verifier(racine, args, env) {
411
413
  return code === 0 ? 0 : 1;
412
414
  }
413
415
 
414
- // The scripts of guards of the project, in the order they play: the frame's, then its own.
415
- const SCRIPTS_DE_GARDES = ['grillhouse:gardes', 'gardes'];
416
-
417
416
  // The pass of `verifier --gardes` in <racine>: each script of SCRIPTS_DE_GARDES the root
418
417
  // package.json holds, a task of the root; no test.
419
418
  function gardes(racine, p) {
@@ -486,8 +485,9 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
486
485
  }
487
486
  }
488
487
  // The launcher's `construire` (`--echec <fichier> <plan>`) builds the copy for a session, the
489
- // plan and its providers, as every language's.
490
- if (nom === 'construire' && args.includes('--echec')) {
488
+ // plan and its providers, as every language's; `construire --gardes`, what the guard tasks wait
489
+ // for.
490
+ if (nom === 'construire' && constructionDuGraphe(args)) {
491
491
  return construireDepuisLesArguments(OUTIL, args, racine);
492
492
  }
493
493
  if (nom === 'typer' || nom === 'construire') {
@@ -3,7 +3,8 @@
3
3
  // `lecteurs`, `estUnTest`, `manifestes`, `entreesDeLIndex`).
4
4
  //
5
5
  // - A component is a folder whose CMakeLists.txt calls `project(<nom>`, found under the root, the
6
- // folders whose name begins with a dot (`.build-cmake` included) and those of LAISSES left out:
6
+ // folders whose name begins with a dot (`.build-cmake` included) and those of LAISSES left out,
7
+ // and a CMakeLists.txt git ignores (the local clone of another repository) left out too:
7
8
  // its folder, its name and its package the name `project()` gives. The CMakeLists.txt of
8
9
  // `tests/`, which calls no `project(`, is the package's matter, never a component. `project(` is
9
10
  // read in any case, after the comments (`#`) are cut, a space before the parenthesis allowed,
@@ -22,6 +23,7 @@
22
23
  // `docs/INTERFACE.md`, and the root's, as the module python's.
23
24
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
24
25
  import path from 'node:path';
26
+ import { ignoresParGit } from '../../paquets.mjs';
25
27
  import { luUneFois } from '../../services-du-noyau.mjs';
26
28
 
27
29
  export const MANIFESTE = 'CMakeLists.txt';
@@ -63,11 +65,17 @@ function dossiersAvecProjet(dossier) {
63
65
  /** The components of the project at <racine>, sorted by folder; read once in a scope of the core
64
66
  * (`luUneFois`): a sweep asks it of every file of a folder. */
65
67
  export function composants(racine) {
66
- return luUneFois(`c composants ${path.resolve(racine)}`, () =>
67
- dossiersAvecProjet(racine)
68
+ return luUneFois(`c composants ${path.resolve(racine)}`, () => {
69
+ const trouves = dossiersAvecProjet(racine);
70
+ const ignores = ignoresParGit(
71
+ racine,
72
+ trouves.map(t => path.join(t.dossier, MANIFESTE))
73
+ );
74
+ return trouves
75
+ .filter(t => !ignores.has(path.join(t.dossier, MANIFESTE)))
68
76
  .sort((a, b) => (a.dossier < b.dossier ? -1 : a.dossier > b.dossier ? 1 : 0))
69
- .map(({ dossier, nom }) => ({ dossier, nom, paquet: nom }))
70
- );
77
+ .map(({ dossier, nom }) => ({ dossier, nom, paquet: nom }));
78
+ });
71
79
  }
72
80
 
73
81
  /** The component of <liste> that holds <fichier> (absolute, or from <racine>), the longest folder. */
@@ -141,6 +141,7 @@ import {
141
141
  avecLaPasse,
142
142
  cheminsDeLaTache,
143
143
  construireDepuisLesArguments,
144
+ constructionDuGraphe,
144
145
  ecrirePression,
145
146
  GRAPHE_JOUE,
146
147
  joueCeQuiNeSeDivisePas,
@@ -151,6 +152,7 @@ import {
151
152
  ouvrirBase,
152
153
  retirerALInterruption,
153
154
  SCRIPT_DES_TESTS,
155
+ SCRIPTS_DE_GARDES,
154
156
  SEUIL_PRESSION,
155
157
  testsCibles,
156
158
  travailleursDeLaSeance,
@@ -740,10 +742,6 @@ function verifier(racine, args, env) {
740
742
  return verdict;
741
743
  }
742
744
 
743
- // The scripts of guards of the project, in the order they play, as the module typescript's
744
- // `--gardes` plays its tasks: the frame's, then the project's own.
745
- const SCRIPTS_DE_GARDES = ['grillhouse:gardes', 'gardes'];
746
-
747
745
  // The pass of `verifier --gardes` in <racine>, the run <p>: each script of SCRIPTS_DE_GARDES the
748
746
  // root package.json holds, a task of the root, whatever the verdict of the one before; no test.
749
747
  function gardes(racine, p) {
@@ -843,8 +841,9 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
843
841
  // `cargo check -p`), as Turborepo's task of one package; `typer` alone checks the workspace.
844
842
  let crate = null;
845
843
  // The launcher's `construire` (`--echec <fichier> <plan>`, scripts/enveloppe/lancer.sh) builds
846
- // the copy for a session, the plan and its providers, as every language's.
847
- if (nom === 'construire' && args.includes('--echec')) {
844
+ // the copy for a session, the plan and its providers, as every language's; `construire --gardes`,
845
+ // what the guard tasks wait for.
846
+ if (nom === 'construire' && constructionDuGraphe(args)) {
848
847
  return construireDepuisLesArguments(OUTIL, args, racine);
849
848
  }
850
849
  if (nom === 'construire' || (nom === 'typer' && args.length)) {
@@ -92,6 +92,7 @@ import {
92
92
  cacheDeCompilation,
93
93
  cheminsDeLaTache,
94
94
  construireDepuisLesArguments,
95
+ constructionDuGraphe,
95
96
  GRAPHE_JOUE,
96
97
  joueCeQuiNeSeDivisePas,
97
98
  lancerLesTaches,
@@ -100,6 +101,7 @@ import {
100
101
  ouvrirBase,
101
102
  retirerALInterruption,
102
103
  SCRIPT_DES_TESTS,
104
+ SCRIPTS_DE_GARDES,
103
105
  testsCibles,
104
106
  travailleursDeLaSeance,
105
107
  } from '../../services-du-noyau.mjs';
@@ -442,9 +444,6 @@ const typerLePaquet = (p, c) =>
442
444
  ])
443
445
  );
444
446
 
445
- // The scripts of guards of the project, in the order they play: the frame's, then its own.
446
- const SCRIPTS_DE_GARDES = ['grillhouse:gardes', 'gardes'];
447
-
448
447
  // The pass of `verifier --gardes` in <racine>: each script of SCRIPTS_DE_GARDES the root
449
448
  // package.json holds, a task of the root; no test.
450
449
  function gardes(racine, p) {
@@ -532,8 +531,9 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
532
531
  }
533
532
  }
534
533
  // The launcher's `construire` (`--echec <fichier> <plan>`, scripts/enveloppe/lancer.sh) builds
535
- // the copy for a session, the plan and its providers, as every language's.
536
- if (nom === 'construire' && args.includes('--echec')) {
534
+ // the copy for a session, the plan and its providers, as every language's; `construire --gardes`,
535
+ // what the guard tasks wait for.
536
+ if (nom === 'construire' && constructionDuGraphe(args)) {
537
537
  return construireDepuisLesArguments(OUTIL, args, racine);
538
538
  }
539
539
  if (nom === 'typer' || nom === 'construire') {
@@ -4,7 +4,8 @@
4
4
  // `entreesDeLIndex`).
5
5
  //
6
6
  // - A component is a folder that holds a pyproject.toml, found under the root, the folders whose
7
- // name begins with a dot and those of LAISSES left out: its folder, its name the folder's, its
7
+ // name begins with a dot and those of LAISSES left out, and a pyproject.toml git ignores (the
8
+ // local clone of another repository) left out too: its folder, its name the folder's, its
8
9
  // package the `name` of its table `[project]`, null without one. The language of a package is
9
10
  // declared in the architecture (decision D2 of grillhouse-1zu); its pyproject.toml, its group
10
11
  // `test` and its uv.lock are there because uv asks them.
@@ -32,6 +33,7 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs';
32
33
  import { createRequire } from 'node:module';
33
34
  import path from 'node:path';
34
35
  import { isDeepStrictEqual } from 'node:util';
36
+ import { ignoresParGit } from '../../paquets.mjs';
35
37
  import { luUneFois } from '../../services-du-noyau.mjs';
36
38
 
37
39
  const require = createRequire(import.meta.url);
@@ -83,7 +85,13 @@ export function composants(racine) {
83
85
 
84
86
  // The components of `composants`, read at each call.
85
87
  function lireLesComposants(racine) {
86
- return dossiersAvecManifeste(racine)
88
+ const trouves = dossiersAvecManifeste(racine);
89
+ const ignores = ignoresParGit(
90
+ racine,
91
+ trouves.map(d => path.join(d, MANIFESTE))
92
+ );
93
+ return trouves
94
+ .filter(d => !ignores.has(path.join(d, MANIFESTE)))
87
95
  .sort()
88
96
  .map(dossier => ({
89
97
  dossier,