@roomi-fields/grillhouse 0.47.0 → 0.48.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 (102) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +54 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +18 -38
  4. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +5 -0
  6. package/cadre/templates/projet/CLAUDE.md +23 -6
  7. package/charte.md +9 -2
  8. package/dist/temporal/circuit/commande.js +5 -3
  9. package/dist/temporal/circuit/commande.js.map +1 -1
  10. package/dist/temporal/commande.js +2 -13
  11. package/dist/temporal/commande.js.map +1 -1
  12. package/dist/temporal/deroules.d.ts +1 -1
  13. package/dist/temporal/deroules.js +2 -2
  14. package/dist/temporal/deroules.js.map +1 -1
  15. package/dist/temporal/file/activites.d.ts +1 -4
  16. package/dist/temporal/file/activites.js +13 -14
  17. package/dist/temporal/file/activites.js.map +1 -1
  18. package/dist/temporal/file/contrat.d.ts +20 -91
  19. package/dist/temporal/file/contrat.js +7 -3
  20. package/dist/temporal/file/contrat.js.map +1 -1
  21. package/dist/temporal/file/deroule.d.ts +1 -9
  22. package/dist/temporal/file/deroule.js +54 -163
  23. package/dist/temporal/file/deroule.js.map +1 -1
  24. package/dist/temporal/installation.d.ts +26 -1
  25. package/dist/temporal/installation.js +111 -2
  26. package/dist/temporal/installation.js.map +1 -1
  27. package/dist/temporal/nuits/activites.d.ts +11 -2
  28. package/dist/temporal/nuits/activites.js +16 -5
  29. package/dist/temporal/nuits/activites.js.map +1 -1
  30. package/dist/temporal/nuits/choix.d.ts +15 -0
  31. package/dist/temporal/nuits/choix.js +20 -0
  32. package/dist/temporal/nuits/choix.js.map +1 -1
  33. package/dist/temporal/nuits/contrat.d.ts +16 -3
  34. package/dist/temporal/nuits/deroule.js +9 -2
  35. package/dist/temporal/nuits/deroule.js.map +1 -1
  36. package/dist/temporal/places/client.d.ts +13 -2
  37. package/dist/temporal/places/client.js +17 -2
  38. package/dist/temporal/places/client.js.map +1 -1
  39. package/dist/temporal/places/contrat.d.ts +41 -4
  40. package/dist/temporal/places/contrat.js +8 -0
  41. package/dist/temporal/places/contrat.js.map +1 -1
  42. package/dist/temporal/places/deroule.js +46 -6
  43. package/dist/temporal/places/deroule.js.map +1 -1
  44. package/docs/ARCHITECTURE.md +166 -41
  45. package/docs/INTERFACE.md +13 -3
  46. package/package.json +1 -1
  47. package/scripts/activites.mjs +48 -10
  48. package/scripts/aiguillage.mjs +1 -0
  49. package/scripts/attente-a-l-arret.mjs +2 -5
  50. package/scripts/attente-au-tour.mjs +2 -5
  51. package/scripts/branche-de-nuit.mjs +32 -44
  52. package/scripts/ci-de-main.mjs +221 -19
  53. package/scripts/circuit.mjs +47 -34
  54. package/scripts/commandes-composees.mjs +36 -6
  55. package/scripts/composition-des-langages.mjs +2 -0
  56. package/scripts/crochets.mjs +2 -2
  57. package/scripts/effets.mjs +2 -1
  58. package/scripts/enveloppe/enveloppe.mjs +61 -6
  59. package/scripts/enveloppe/travail-de-la-copie.mjs +2 -0
  60. package/scripts/etapes.mjs +11 -1
  61. package/scripts/etat-du-depot.mjs +23 -0
  62. package/scripts/faits-du-circuit.mjs +12 -23
  63. package/scripts/fermeture-de-la-machine.d.mts +27 -0
  64. package/scripts/fermeture-de-la-machine.mjs +108 -0
  65. package/scripts/greffons.mjs +1 -1
  66. package/scripts/integration/file.mjs +16 -13
  67. package/scripts/integration/integrer.mjs +2 -0
  68. package/scripts/jointure.d.ts +5 -0
  69. package/scripts/langages/c/index.mjs +2 -0
  70. package/scripts/langages/c/squelette.mjs +1 -1
  71. package/scripts/langages/cargo/index.mjs +2 -0
  72. package/scripts/langages/python/index.mjs +2 -0
  73. package/scripts/langages/typescript/index.mjs +3 -0
  74. package/scripts/langages/typescript/module-absent.mjs +24 -0
  75. package/scripts/langages/typescript/turbo-des-paquets.mjs +19 -1
  76. package/scripts/langages/typescript/vitest-config/lances.mjs +3 -1
  77. package/scripts/langages.mjs +25 -3
  78. package/scripts/machine.mjs +103 -0
  79. package/scripts/matieres-cles.mjs +17 -0
  80. package/scripts/matieres-lues.mjs +104 -0
  81. package/scripts/migrations/0.48.0-ci-declenchee-par-la-file.mjs +32 -0
  82. package/scripts/migrations/0.48.0-poussee-retiree.mjs +31 -0
  83. package/scripts/migrations.mjs +4 -0
  84. package/scripts/nuit.sh +16 -44
  85. package/scripts/passe-de-la-machine.mjs +9 -7
  86. package/scripts/places-de-la-machine.mjs +74 -11
  87. package/scripts/places-du-serveur.mjs +29 -8
  88. package/scripts/poussee-retiree.mjs +18 -0
  89. package/scripts/registre.d.mts +2 -2
  90. package/scripts/regles-des-places.d.mts +36 -5
  91. package/scripts/regles-des-places.mjs +56 -9
  92. package/scripts/reponses-du-circuit.d.mts +2 -0
  93. package/scripts/reponses-du-circuit.mjs +26 -0
  94. package/scripts/resultats.mjs +40 -0
  95. package/scripts/sous-commandes.mjs +15 -2
  96. package/scripts/superviseur.mjs +64 -57
  97. package/scripts/tableau.mjs +132 -67
  98. package/scripts/transitions.d.mts +8 -0
  99. package/scripts/transitions.mjs +21 -3
  100. package/skills/pitmaster/SKILL.md +6 -3
  101. package/skills/relecteur/SKILL.md +3 -1
  102. package/scripts/poussee-cles.mjs +0 -46
@@ -65,19 +65,15 @@ import { spawnSync } from 'node:child_process';
65
65
  import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
66
66
  import path from 'node:path';
67
67
  import { pathToFileURL } from 'node:url';
68
- import { alerteDuProjet, ciDeMainGardee } from './ci-de-main.mjs';
68
+ import { lireEtOuvrirLeDefautDeMain } from './ci-de-main.mjs';
69
69
  import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
70
70
  import { vivant } from './mesure/base-de-passe.mjs';
71
71
  import { circuitsDuServeur, ServeurMuet } from './circuits-du-serveur.mjs';
72
- import {
73
- attendLeSuperviseur,
74
- cleDe,
75
- lireLesRemontees,
76
- remonteesDe,
77
- } from './tableau.mjs';
72
+ import { attendLeSuperviseur, cleDe, lireLesRemontees, remonteesDe } from './tableau.mjs';
78
73
  import { rappelDuProjet, reglageDuRappel } from './circuits-cles.mjs';
79
74
  import { lireGroupe } from './groupe-cles.mjs';
80
- import { etapeDuCircuit, libelle, SUPERVISEUR } from './etapes.mjs';
75
+ import { etapeDuCircuit, libelle, REPONSES, sansLesReponses, SUPERVISEUR } from './etapes.mjs';
76
+ import { sigleDuProjet } from './sigle-du-projet.mjs';
81
77
  import { enFileSansArchitecture, lireLesTickets } from './file-des-tickets.mjs';
82
78
 
83
79
  const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
@@ -211,13 +207,9 @@ function lireLesIntegrations(racine, maintenant) {
211
207
  // supervisor: `{ cle, texte }` for a red or a CI not read, null for a green (the alert clears),
212
208
  // undefined for a project with no CI to read. The lots entered since the last green are named by
213
209
  // git; nothing is kept but the reading, for five minutes.
214
- export function ciDeMainDe(racine) {
215
- const lecture = ciDeMainGardee(racine);
216
- if (!lecture) {
217
- return undefined;
218
- }
219
- const a = alerteDuProjet(racine, lecture);
220
- return a ? { cle: a.cle, texte: a.texte } : null;
210
+ export function ciDeMainDe(racine, o = {}) {
211
+ const a = lireEtOuvrirLeDefautDeMain(racine, o);
212
+ return a ? { cle: a.cle, texte: a.texte } : a;
221
213
  }
222
214
 
223
215
  // The alert of the CI of main given by the waits of the repository at <racine>, its key: kept while
@@ -311,14 +303,18 @@ export function relever(
311
303
  try {
312
304
  const { depuis: depuisIntegrations, rendues } = lireLesIntegrations(racine, maintenant);
313
305
  const integres = circuits
314
- .filter(c => c.integre && c.fin !== null && c.fin >= depuisIntegrations && !rendues.has(cleDe(c)))
306
+ .filter(
307
+ c => c.integre && c.fin !== null && c.fin >= depuisIntegrations && !rendues.has(cleDe(c))
308
+ )
315
309
  .map(enFin)
316
310
  .sort((a, b) => a.ticket.localeCompare(b.ticket, 'en'));
317
311
  const fins = new Map(circuits.map(c => [cleDe(c), c.fin]));
318
312
  ecrireLesIntegrations(
319
313
  racine,
320
314
  maintenant,
321
- [...rendues, ...integres.map(i => i.cle)].filter(k => (fins.get(k) ?? -Infinity) >= maintenant)
315
+ [...rendues, ...integres.map(i => i.cle)].filter(
316
+ k => (fins.get(k) ?? -Infinity) >= maintenant
317
+ )
322
318
  );
323
319
  const rouges = ciDeMain === undefined ? [] : releverLaCiDeMain(racine, ciDeMain, toutes);
324
320
  circuits = circuits.filter(c => !c.integre);
@@ -459,13 +455,46 @@ export function questionsEnAttente(
459
455
  // No ticket closed: the questions read without asking bd.
460
456
  const aucunFerme = () => new Set();
461
457
 
462
- // The lines of one question in the one rendering of the questions, shared by the message of the
463
- // greffon, the opening and the hooks of the session.
464
- export const ligneDeQuestion = q =>
458
+ // The command that answers the question <q>, played from <dossier> when it is another project's:
459
+ // the command of the circuit of its ticket, its answer left to the supervisor (the answers are
460
+ // listed once, at the opening of the session), or the command of a question of no circuit (the CI
461
+ // of main), as it is.
462
+ const commandeDe = (q, dossier) => {
463
+ const duCircuit = `npx grillhouse circuit ${q.ticket}`;
464
+ const commande = String(q.commande ?? '').startsWith(`${duCircuit} `)
465
+ ? `${duCircuit} <réponse>`
466
+ : String(q.commande ?? '');
467
+ return commande && dossier ? `env -C ${dossier} ${commande}` : commande;
468
+ };
469
+
470
+ // The head of the line of <q>: what it is, its ticket, its step, its stop, and who answers it when
471
+ // it is not the supervisor; under the sigle of its project (<o.sigle>) when it is another one's.
472
+ const teteDe = (q, genre, { sigle } = {}) =>
465
473
  [
466
- `- ${q.ticket}, à ${q.etape}, au ${q.qui}${q.representee ? ' (toujours sans réponse)' : ''} : ${q.question.replace(/\n/g, '\n ')}`,
467
- ` La réponse : \`${q.commande}\`.`,
468
- ].join('\n');
474
+ `${sigle ? `[${sigle}] ` : ''}${genre}`,
475
+ q.ticket,
476
+ q.etape,
477
+ ...(q.arret ? [q.arret] : []),
478
+ ...(q.qui && q.qui !== SUPERVISEUR ? [`au ${q.qui}`] : []),
479
+ ].join(' · ');
480
+
481
+ /**
482
+ * The lines of one question in the one rendering of the questions, shared by the message of the
483
+ * greffon, the opening and the hooks of the session: its head, its question without the list of
484
+ * the answers, and the command that answers it. A question presented again (`representee`) is its
485
+ * head alone, and one that waits at a hook of the session too (<o.courte>). <o.sigle> and
486
+ * <o.dossier> name the project of the question when it is not the session's.
487
+ */
488
+ export const ligneDeQuestion = (q, o = {}) => {
489
+ if (q.representee) {
490
+ return teteDe(q, 'Toujours sans réponse', o);
491
+ }
492
+ const tete = teteDe(q, 'Question', o);
493
+ const commande = commandeDe(q, o.dossier);
494
+ return o.courte
495
+ ? tete
496
+ : [tete, sansLesReponses(q.question), ...(commande ? [`→ ${commande}`] : [])].join('\n');
497
+ };
469
498
 
470
499
  /**
471
500
  * The message the greffon submits to the session of supervision for the questions <questions> of
@@ -476,33 +505,12 @@ export const ligneDeQuestion = q =>
476
505
  * @param {{ ticket: string, etape: string, question: string, qui: string, commande: string, representee?: boolean, integre?: boolean }[]} questions
477
506
  * @returns {string}
478
507
  */
479
- export function texteDesQuestions(questions) {
508
+ export function texteDesQuestions(questions, o = {}) {
480
509
  const fins = questions.filter(q => q.integre);
481
510
  const attente = questions.filter(q => !q.integre);
482
- const neuves = attente.filter(q => !q.representee);
483
- const titre = neuves.length
484
- ? attente.length > 1
485
- ? '## Questions neuves des circuits'
486
- : "## Question neuve d'un circuit"
487
- : attente.length > 1
488
- ? '## Questions toujours sans réponse'
489
- : '## Question toujours sans réponse';
490
- const enQuestions = attente.length
491
- ? [
492
- titre,
493
- ...attente.map(ligneDeQuestion),
494
- ]
495
- : [];
496
- const enFins = fins.length
497
- ? [
498
- fins.length > 1 ? '## Circuits intégrés' : '## Circuit intégré',
499
- ...fins.map(q => `- ${q.ticket} est intégré, à ${q.etape} : son lot est sur main.`),
500
- ]
501
- : [];
502
511
  return [
503
- ...enQuestions,
504
- ...(enQuestions.length && enFins.length ? [''] : []),
505
- ...enFins,
512
+ ...attente.map(q => ligneDeQuestion(q, o)),
513
+ ...fins.map(q => `${o.sigle ? `[${o.sigle}] ` : ''}Intégré · ${q.ticket}`),
506
514
  ].join('\n');
507
515
  }
508
516
 
@@ -580,6 +588,7 @@ export async function circuitsALOuverture(
580
588
  "Le greffon de ta séance pousse dans la file de tes messages chaque question neuve d'un circuit du dépôt, quel que soit son lanceur, et chaque fin de circuit, une fois ; il n'y a aucune attente à lancer. Une question sans réponse revient à intervalle réglable (`grillhouse.rappel`, 5 min par défaut) : ta réponse au circuit l'acquitte, et répondue elle ne revient plus. Tu ne te mets pas en attente du responsable tant qu'une question d'un circuit attend ta réponse : le crochet de fin de tour te le rappelle. Les questions en attente sont listées ci-dessous.",
581
589
  ...(panne ? ['', '## Les circuits du dépôt', panne] : []),
582
590
  ...(nommes.length ? ['', '## Les circuits du dépôt', ...nommes.map(n => n.ligne)] : []),
591
+ ...(questions.length ? ['', `Les réponses à une question : ${REPONSES}`] : []),
583
592
  ...(sansArchitecture.length
584
593
  ? [
585
594
  '',
@@ -693,15 +702,9 @@ export async function releverPourLeGreffon(
693
702
  }
694
703
  const parts = [await leReleveDe(racine, circuitsDe)];
695
704
  for (const p of voisinsSansSuperviseur(racine)) {
696
- const texte = await leReleveDe(p.chemin, circuitsDe);
705
+ const texte = await leReleveDe(p.chemin, circuitsDe, true);
697
706
  if (texte) {
698
- parts.push(
699
- [
700
- `# Projet ${p.nom} (${p.chemin})`,
701
- `Ses réponses se jouent dans son dossier : \`env -C ${p.chemin} <la réponse>\`.`,
702
- texte,
703
- ].join('\n')
704
- );
707
+ parts.push(texte);
705
708
  }
706
709
  }
707
710
  return parts.filter(Boolean).join('\n\n');
@@ -719,7 +722,7 @@ function paquetDe(racine) {
719
722
  // The message of one reading of the project at <racine>, under its own interval
720
723
  // (`grillhouse.rappel`) and its own state of the questions presented; empty when it gives nothing
721
724
  // or when its circuits do not read. A faulty interval throws, the project named.
722
- async function leReleveDe(racine, circuitsDe) {
725
+ async function leReleveDe(racine, circuitsDe, voisin = false) {
723
726
  const { minutes, faute } = reglageDuRappel(paquetDe(racine));
724
727
  if (faute) {
725
728
  throw new Error(`${path.basename(racine)} : ${faute}`);
@@ -736,7 +739,11 @@ async function leReleveDe(racine, circuitsDe) {
736
739
  rappelMs: minutes * 60_000,
737
740
  ciDeMain: ciDeMainDe(racine),
738
741
  });
739
- return lot.length ? texteDesQuestions(lot) : '';
742
+ // Another project's part bears its sigle, and its commands the folder they are played in.
743
+ const projet = voisin
744
+ ? { sigle: sigleDuProjet(racine).sigle ?? path.basename(racine), dossier: racine }
745
+ : {};
746
+ return lot.length ? texteDesQuestions(lot, projet) : '';
740
747
  }
741
748
 
742
749
  // The other projects of the group of the project at <racine> (`grillhouse.groupe`) that no other
@@ -90,7 +90,8 @@
90
90
  // its prefix (`courtDuTicket`). Such a line is marked `avancement`, which the pane measures
91
91
  // again more often.
92
92
  // - Signs: each sign keeps one sense (the owner's decisions of 2026-11-01 and 2026-11-12). A
93
- // ticket's line in AGENTS takes one of three, by the tone of its state: ▶ its step works (cyan),
93
+ // ticket's line in AGENTS takes one of three, by the tone of its state: ▶ its step works (cyan,
94
+ // the hollow ▷ in a short circuit, counted with it),
94
95
  // a ticket led in direct included; ⏸ it waits, under the step about to be launched, the reason
95
96
  // on its right (« attend une place », « verrou », « disque », « démarre » in grey, the
96
97
  // circuit waiting for the machine; « question au superviseur », « question au responsable »,
@@ -140,7 +141,12 @@ import { maxDuProjet } from './circuits-cles.mjs';
140
141
  import { bilansGardes, enBref } from './bilan.mjs';
141
142
  import { REGISTRE } from './adresse-du-registre.mjs';
142
143
  import { lireLaMesure } from './avancement.mjs';
143
- import { ciDeMainGardee, ligneDeLaCiDeMain } from './ci-de-main.mjs';
144
+ import {
145
+ alerteDeDeclenchement,
146
+ ciDeMainGardee,
147
+ fauteDeDeclenchement,
148
+ ligneDeLaCiDeMain,
149
+ } from './ci-de-main.mjs';
144
150
  import {
145
151
  SANS_REPONSE_EN,
146
152
  ServeurMuet,
@@ -155,8 +161,23 @@ import {
155
161
  lireLesExternes,
156
162
  } from './file-des-tickets.mjs';
157
163
  import { etatDesPlaces } from './places-de-la-machine.mjs';
164
+ import { duree as dureeDeLaFermeture } from './regles-des-places.mjs';
158
165
  import { prefixe as prefixeDeLaRacine } from './prefixe-des-tickets.mjs';
159
166
  import { sigleDuProjet } from './sigle-du-projet.mjs';
167
+ import { versionDuPaquet } from './greffons.mjs';
168
+ import { estLeCircuitCourt, sorteDesFiches } from './resultats.mjs';
169
+
170
+ // The version of the package whose code draws the panel, « v0.47.1 », read once, at the first
171
+ // request, and kept: a long-lived process keeps the loaded code's version after an upgrade. Only
172
+ // an x.y.z version shows; any other, or none, is null.
173
+ let versionAffichee;
174
+ const versionDuPanneau = () => {
175
+ if (versionAffichee === undefined) {
176
+ const v = versionDuPaquet();
177
+ versionAffichee = typeof v === 'string' && /^\d+\.\d+\.\d+$/.test(v) ? `v${v}` : null;
178
+ }
179
+ return versionAffichee;
180
+ };
160
181
 
161
182
  const MINUTE = 60_000;
162
183
  export const SILENCE = 10 * MINUTE;
@@ -877,7 +898,8 @@ export function lignesDesParts({
877
898
  * places?: { prises: number, plafond: number, faute?: string | null, charge: number,
878
899
  * coeurs: number, memoireGo: number, memoireTotaleGo: number,
879
900
  * tenues?: { ticket: string | null, racine?: string | null }[], attentes: { ticket: string,
880
- * depuis: number, disque?: string | null }[], nuit?: 'attend' | 'en cours' | null } | null,
901
+ * depuis: number, disque?: string | null }[], nuit?: 'attend' | 'en cours' | null,
902
+ * fermeture?: { auteur: 'nuit' | 'superviseur', depuis: number, phase: string } | null } | null,
881
903
  * nuit?: { racine: string, depuis: number | null } | null, muet?: boolean, faute?: string | null,
882
904
  * echecPrefixe?: string | null, voies?: Record<string, 'complet' | 'court'> }} lu
883
905
  */
@@ -1239,7 +1261,7 @@ export function assembler({
1239
1261
  }
1240
1262
  const debutJour = jour;
1241
1263
  // The way of a ticket done (grillhouse-592): `direct` when labelled so; else the way its kept
1242
- // results give (`voies`, `voiesDesCircuits`: `court` through 1.1, else `complet`); else
1264
+ // results give (`voies`, `voiesDesCircuits`: `court` for the short circuit, else `complet`); else
1243
1265
  // `complet` when a circuit led a step of it (the register) or is read for it; else `direct`,
1244
1266
  // closed with no circuit.
1245
1267
  const parUnCircuit = new Set([...etapesFinies.map(r => r.ticket), ...parCircuit.keys()]);
@@ -1473,6 +1495,8 @@ export function assembler({
1473
1495
  .map(c => ({
1474
1496
  ...c,
1475
1497
  id: c.ticket,
1498
+ // Its way so far, read from its kept results (`voiesDesCircuits`).
1499
+ court: voies[c.ticket] === 'court',
1476
1500
  numero: numero(c.ticket),
1477
1501
  sujet: titre(parId.get(c.ticket)).sujet,
1478
1502
  }));
@@ -1509,7 +1533,9 @@ export function assembler({
1509
1533
  machine,
1510
1534
  places: placesDeLaMachine && {
1511
1535
  ...placesDeLaMachine,
1512
- noms: nommerLesPrises(placesDeLaMachine.tenues ?? [], { racine, prefix }),
1536
+ siennes: (placesDeLaMachine.tenues ?? []).filter(
1537
+ x => x.racine && racine && path.resolve(x.racine) === path.resolve(racine)
1538
+ ).length,
1513
1539
  },
1514
1540
  nuit: nuitEnCours,
1515
1541
  faitsDuJour,
@@ -1572,16 +1598,18 @@ function temoinDe(c, maintenant) {
1572
1598
  }
1573
1599
 
1574
1600
  // A ticket's time and tokens, « 12 min · 310 k »; nothing when both are zero.
1575
- // The sign of a ticket done by its way (grillhouse-592): a full circuit, a short one (1.1 Geste
1576
- // mécanique), a ticket led directly.
1601
+ // The sign of a ticket done by its way (grillhouse-592): a full circuit, a short one (its gesture
1602
+ // played by a command, 1.1, or written by hand), a ticket led directly.
1577
1603
  export const SIGNE_DE_LA_VOIE = Object.freeze({ complet: '●', court: '○', direct: '✎' });
1578
1604
 
1579
1605
  /**
1580
1606
  * The way of the circuit each ticket of <tickets> went, read from its kept results in the main tree
1581
1607
  * <racine> (`.claude/worktrees/<ticket>.fiches.jsonl`, which the circuit writes and keeps once the
1582
- * ticket is done): `court` when the launch of a session carries the object `geste` (1.1 Geste
1583
- * mécanique), else `complet`; a ticket without the file has no entry. A line that does not parse
1584
- * counts nothing.
1608
+ * ticket is done): `court` when the sort of the ticket (`sorteDesFiches` of scripts/resultats.mjs:
1609
+ * its plan's, or the one a turn gave it since) is the short circuit's, its gesture played by a
1610
+ * command (1.1 Geste mécanique) or written by hand by the developpeur (`estLeCircuitCourt`), else
1611
+ * `complet`: a ticket that turned bears the way it ended on. A ticket without the file has no
1612
+ * entry. A line that does not parse counts nothing.
1585
1613
  * @param {string} racine
1586
1614
  * @param {string[]} tickets
1587
1615
  * @returns {Record<string, 'complet' | 'court'>}
@@ -1595,14 +1623,15 @@ export function voiesDesCircuits(racine, tickets) {
1595
1623
  } catch {
1596
1624
  continue;
1597
1625
  }
1598
- const geste = texte.split('\n').some(l => {
1626
+ const fiches = texte.split('\n').flatMap(l => {
1599
1627
  try {
1600
- return JSON.parse(l)?.lancement?.objet === 'geste';
1628
+ const e = JSON.parse(l);
1629
+ return e && typeof e === 'object' ? [e] : [];
1601
1630
  } catch {
1602
- return false;
1631
+ return [];
1603
1632
  }
1604
1633
  });
1605
- out[id] = geste ? 'court' : 'complet';
1634
+ out[id] = estLeCircuitCourt(sorteDesFiches(fiches)) ? 'court' : 'complet';
1606
1635
  }
1607
1636
  return out;
1608
1637
  }
@@ -1654,32 +1683,12 @@ const signeDe = a => a.signe ?? '⚠';
1654
1683
  // « SH-ae6.5 » → « ae6.5 ».
1655
1684
  const courtDuTicket = id => id.slice(id.lastIndexOf('-') + 1);
1656
1685
 
1657
- // Who holds each place of the machine, in the order of the places: the project of the board (the
1658
- // root <racine> of its main tree, its ticket prefix <prefix>) by the short number of its ticket,
1659
- // another project by « <sigle> <short number> » (its sigle and its prefix read from its own root),
1660
- // a place with no ticket « passe »; a place with no root (a state of before) is the board's.
1661
- function nommerLesPrises(tenues, { racine, prefix }) {
1662
- return tenues.map(({ ticket, racine: deLaPrise }) => {
1663
- const ici = !deLaPrise || (racine && path.resolve(deLaPrise) === path.resolve(racine));
1664
- let prefixeDuProjet = prefix;
1665
- if (!ici) {
1666
- try {
1667
- prefixeDuProjet = prefixeDeLaRacine(deLaPrise);
1668
- } catch {
1669
- prefixeDuProjet = '';
1670
- }
1671
- }
1672
- const numero = !ticket
1673
- ? 'passe'
1674
- : prefixeDuProjet && ticket.startsWith(`${prefixeDuProjet}-`)
1675
- ? ticket.slice(prefixeDuProjet.length + 1)
1676
- : courtDuTicket(ticket);
1677
- return ici ? numero : `${sigleDuProjet(deLaPrise).sigle ?? path.basename(deLaPrise)} ${numero}`;
1678
- });
1679
- }
1680
1686
  // The sign of a ticket's line in AGENTS, by the tone of its state: ▶ what runs, ⛔ what asks for a
1681
1687
  // correction, ⏸ a wait, for the machine (grey) or for someone (yellow).
1682
- const signeDuTon = ton => (ton === TONS.enCours ? '▶' : ton === 'alerte' ? '⛔' : '⏸');
1688
+ // A circuit that runs bears the full triangle, the hollow one in a short circuit (<court>), as
1689
+ // its line of FAITS AUJOURD'HUI bears the full or the hollow round (`SIGNE_DE_LA_VOIE`).
1690
+ const signeDuTon = (ton, court = false) =>
1691
+ ton === TONS.enCours ? (court ? '▷' : '▶') : ton === 'alerte' ? '⛔' : '⏸';
1683
1692
  // The step of the circuit <c>, by its state or its stop.
1684
1693
  const etapeDuCircuitLu = c => etapeDuCircuit({ ...c, raison: c.arret });
1685
1694
  // A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
@@ -1775,7 +1784,13 @@ export function etatsDAgents(t) {
1775
1784
  partDe.get(c.id) ??
1776
1785
  (c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
1777
1786
  const [etat, raison] = etatDuCircuit(c, temoin);
1778
- circuits.set(c.id, { etat, raison, ton: TONS[etat], signe: signeDuTon(TONS[etat]), temoin });
1787
+ circuits.set(c.id, {
1788
+ etat,
1789
+ raison,
1790
+ ton: TONS[etat],
1791
+ signe: signeDuTon(TONS[etat], c.court),
1792
+ temoin,
1793
+ });
1779
1794
  }
1780
1795
  const ligne = (x, signe) => ({ id: x.id, projet: x.projet, signe });
1781
1796
  return {
@@ -1797,7 +1812,7 @@ export function etatsDAgents(t) {
1797
1812
  export function comptesDAgents(t, projet) {
1798
1813
  const l = etatsDAgents(t).lignes.filter(x => projet === undefined || x.projet === projet);
1799
1814
  const n = s => l.filter(x => x.signe === s).length;
1800
- return { enCours: n('▶'), enAttente: n('⏸'), arretes: n('⛔') };
1815
+ return { enCours: n('▶') + n('▷'), enAttente: n('⏸'), arretes: n('⛔') };
1801
1816
  }
1802
1817
 
1803
1818
  // The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
@@ -1825,7 +1840,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1825
1840
  // The labels' column of the head and of AGENTS, « [OB] », « [OSD] ».
1826
1841
  const large = Math.max(0, ...(t.projets ?? []).map(p => p.etiquette.length + 3));
1827
1842
  const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
1828
- L(nom.toUpperCase(), TONS.titre);
1843
+ // The first line: the project's name, the frame's version at its right edge.
1844
+ const version = versionDuPanneau();
1845
+ L(version ? couper(nom.toUpperCase(), version, largeur) : nom.toUpperCase(), TONS.titre);
1829
1846
  // The state of each ticket's line of AGENTS, which AGENTS draws and the head counts.
1830
1847
  const etats = etatsDAgents(t);
1831
1848
  // The three lines of the head, grouped by who acts, each with its tone from TONS; an absent
@@ -1931,32 +1948,21 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1931
1948
  L('AGENTS ▶ en cours · en attente', TONS.titre);
1932
1949
  const maintenant = t.maintenant ?? Date.now();
1933
1950
  // The places of the machine (scripts/places-de-la-machine.mjs), the first line of AGENTS:
1934
- // « Places 3/3 · charge 11,2/12 · mémoire 9/30 Go », the places taken of the ceiling, the load
1951
+ // « Places 2/9/10 · charge 11,2/12 · mémoire 9/30 Go », the places of circuits the board's
1952
+ // projects hold, those held on the machine and the ceiling, the load
1935
1953
  // over one minute of the cores, the free memory of the total; a value of the ceiling the poste names and the
1936
1954
  // server refused, in place of the load and the memory, by its name.
1937
1955
  const p = t.places;
1938
1956
  if (p) {
1939
1957
  const nb = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.', ','));
1940
- // Who holds each place stands between the count and the load: the most names that keep the
1941
- // line within the width, the others counted « +n ».
1942
- const noms = p.noms ?? [];
1943
1958
  const suite = p.faute
1944
1959
  ? `plafond refusé : ${p.faute}`
1945
1960
  : `charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo}/${p.memoireTotaleGo} Go`;
1946
- const ligne = k =>
1947
- `Places ${p.prises}/${p.plafond} · ${
1948
- noms.length
1949
- ? `${[noms.slice(0, k).join(', '), ...(k < noms.length ? [`+${noms.length - k}`] : [])]
1950
- .filter(Boolean)
1951
- .join(' ')} · `
1952
- : ''
1953
- }${suite}`;
1954
- let k = noms.length;
1955
- while (k > 0 && colonnes(ligne(k)) > largeur) {
1956
- k--;
1957
- }
1961
+ // The places of circuits: the board's own (its project's, its projects' on a board of several),
1962
+ // those held on the whole machine, the ceiling.
1963
+ const ligne = `Places ${p.siennes ?? 0}/${p.prises}/${p.plafond} · ${suite}`;
1958
1964
  poser({
1959
- texte: cadre(ligne(k), '', largeur),
1965
+ texte: cadre(ligne, '', largeur),
1960
1966
  ton: p.faute ? TONS.plafondRefuse : p.charge >= p.coeurs ? TONS.machineChargee : TONS.mesure,
1961
1967
  });
1962
1968
  // A ticket that waits for the disk of its project's copies: what holds it, the ticket named.
@@ -1979,6 +1985,32 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1979
1985
  ton: p.nuit === 'attend' ? TONS.attendLeDisque : TONS.nuitEnCours,
1980
1986
  });
1981
1987
  }
1988
+ // The machine closed (`fermeture` of the places: its author, `superviseur` or `nuit`, since
1989
+ // when, its phase): said, with how long it has lasted, so a closure forgotten is seen.
1990
+ if (p.fermeture) {
1991
+ const { auteur, depuis, phase } = p.fermeture;
1992
+ const duJour = auteur === 'superviseur';
1993
+ poser({
1994
+ texte: couperAvant(
1995
+ `machine fermée par ${duJour ? 'le superviseur' : 'la nuit'}`,
1996
+ ` · depuis ${dureeDeLaFermeture(maintenant - depuis)}`,
1997
+ '',
1998
+ largeur
1999
+ ),
2000
+ ton: duJour ? TONS.attendLeDisque : TONS.nuitEnCours,
2001
+ });
2002
+ // The closure of the supervisor holds no place itself: it says what its places still do.
2003
+ if (duJour) {
2004
+ poser({
2005
+ texte: cadre(
2006
+ phase === 'vide' ? 'la machine est vide' : 'attend la fin des étapes en cours',
2007
+ '',
2008
+ largeur
2009
+ ),
2010
+ ton: TONS.attendLeDisque,
2011
+ });
2012
+ }
2013
+ }
1982
2014
  }
1983
2015
  // A project at its limit of circuits (`grillhouse.circuits`) names the circuits that hold it
1984
2016
  // waiting for the supervisor: « Limite 2/2 · en attente du superviseur : 11, 12 ».
@@ -2354,10 +2386,17 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
2354
2386
  const n = t.faitsDuJour.length;
2355
2387
  const temps = t.faitsDuJour.reduce((s, x) => s + x.travail, 0);
2356
2388
  const jetons = t.faitsDuJour.reduce((s, x) => s + x.jetons, 0);
2389
+ // The tickets of the day that took the short circuit.
2390
+ const courts = t.faitsDuJour.filter(x => x.voie === 'court').length;
2357
2391
  L(
2358
2392
  cadre(
2359
2393
  "FAITS AUJOURD'HUI",
2360
- `${n} ticket${n > 1 ? 's' : ''} · ${duree(temps)} · ${k(jetons)}`,
2394
+ [
2395
+ `${n} ticket${n > 1 ? 's' : ''}`,
2396
+ ...(courts ? [`${courts} court${courts > 1 ? 's' : ''}`] : []),
2397
+ duree(temps),
2398
+ k(jetons),
2399
+ ].join(' · '),
2361
2400
  largeur
2362
2401
  ),
2363
2402
  TONS.titre
@@ -2742,11 +2781,12 @@ function lire(
2742
2781
  // A read-only place keeps the board working, without its cache.
2743
2782
  }
2744
2783
  const jour = jourLu;
2745
- // The kept results of the circuits of the tickets done since the day's marker, in the main tree.
2746
- const voies = voiesDesCircuits(
2747
- commun ? path.dirname(commun) : racine,
2748
- tous.filter(x => x.closed_at && Date.parse(x.closed_at) >= jour).map(x => x.id)
2749
- );
2784
+ // The kept results of the circuits of the tickets done since the day's marker, and of the
2785
+ // circuits read, in the main tree.
2786
+ const voies = voiesDesCircuits(commun ? path.dirname(commun) : racine, [
2787
+ ...tous.filter(x => x.closed_at && Date.parse(x.closed_at) >= jour).map(x => x.id),
2788
+ ...lesCircuitsLus.liste.map(c => c.ticket),
2789
+ ]);
2750
2790
  const t = assembler({
2751
2791
  tous,
2752
2792
  prefix,
@@ -2789,7 +2829,8 @@ function lireLesPlaces() {
2789
2829
 
2790
2830
  // The boards of several projects as one (grillhouse-erp.1), as the multi-root explorer of VS Code
2791
2831
  // keeps one view and files each root under its name: <lus> holds each project's label
2792
- // (`etiquette`, its ticket prefix) and its board (`t`) or the fault that keeps it out (`erreur`),
2832
+ // (`etiquette`, its ticket prefix), the root of its main tree (`racine`, by which the places of
2833
+ // its circuits are counted) and its board (`t`) or the fault that keeps it out (`erreur`),
2793
2834
  // the session's project first. Each ticket, alert and chantier is marked with its project's label
2794
2835
  // (`projet`), the agents' blocks hold every project's tickets at their step, and `projets` gives
2795
2836
  // each project's counters or fault, which the head shows one line each.
@@ -2830,7 +2871,14 @@ export function ensemble(lus) {
2830
2871
  }),
2831
2872
  maintenant: premier.t.maintenant,
2832
2873
  machine: premier.t.machine,
2833
- places: premier.t.places,
2874
+ places: premier.t.places && {
2875
+ ...premier.t.places,
2876
+ siennes: (premier.t.places.tenues ?? []).filter(
2877
+ x =>
2878
+ x.racine &&
2879
+ lisibles.some(l => l.racine && path.resolve(l.racine) === path.resolve(x.racine))
2880
+ ).length,
2881
+ },
2834
2882
  nuit: premier.t.nuit,
2835
2883
  faitsDuJour: tous('faitsDuJour'),
2836
2884
  decouvertes: lisibles.reduce(
@@ -2970,6 +3018,15 @@ export async function tableau(
2970
3018
  ici.t.alertes.push({ etat: 'panne', ton: TONS.panne, texte: ligneDeLaCiDeMain(ci) });
2971
3019
  }
2972
3020
  }
3021
+ // A start of the CI that GitHub refused is an alert apart (scripts/ci-de-main.mjs), until a start succeeds.
3022
+ const fauteDeLaCi = ici.t && ci ? fauteDeDeclenchement(racine) : null;
3023
+ if (fauteDeLaCi) {
3024
+ ici.t.alertes.push({
3025
+ etat: 'panne',
3026
+ ton: TONS.panne,
3027
+ texte: alerteDeDeclenchement(fauteDeLaCi).texte,
3028
+ });
3029
+ }
2973
3030
  // A project is labelled by its sigle (scripts/sigle-du-projet.mjs: the key `grillhouse.sigle`, else
2974
3031
  // its ticket prefix), as the line of the places names it; a project with neither keeps its
2975
3032
  // folder's name. A faulty key is said in an alert, the prefix staying the sigle; two projects of
@@ -3009,7 +3066,15 @@ export async function tableau(
3009
3066
  );
3010
3067
  const etat = ligneEtat(ici.t, autres.map(l => l.t).filter(Boolean));
3011
3068
  const t = projets.length
3012
- ? ensemble(lus.map(l => ({ etiquette: etiquette(l), t: l.t, erreur: l.erreur })))
3069
+ ? ensemble(
3070
+ lus.map(l => ({
3071
+ etiquette: etiquette(l),
3072
+ // The root of the project's main tree, which each place of a circuit carries.
3073
+ racine: l.commun ? path.dirname(l.commun) : l.dossier,
3074
+ t: l.t,
3075
+ erreur: l.erreur,
3076
+ }))
3077
+ )
3013
3078
  : ici.t;
3014
3079
  // The project is named by its repository's folder, as a shell prompt names it.
3015
3080
  const nom = [path.basename(racine), ...lus.slice(1).map(etiquette)].join(' + ');
@@ -166,8 +166,16 @@ export function refusDeLaFile(issue?: { raison?: string | null; conflit?: boolea
166
166
  export function etapeApresLePlan(e: {
167
167
  sorte?: { genre?: string; comportement?: string } | null;
168
168
  sansTests?: boolean;
169
+ demande?: boolean;
169
170
  }): string;
170
171
 
172
+ /** The mark « the supervisor asked the testwriter » after a start: set by `--depuis testwriter`, kept by a `--reprendre` without `--depuis`, dropped otherwise. */
173
+ export function testwriterDemande(e: {
174
+ depuis?: string | null;
175
+ reprendre?: boolean;
176
+ marque?: boolean;
177
+ }): boolean;
178
+
171
179
  /** The step after a proof that passes: the developpeur, or the checks. */
172
180
  export function apresLaPreuve(e: {
173
181
  rouges: number;
@@ -52,8 +52,16 @@ export const MEMOIRE = [
52
52
  'conflitsRelances',
53
53
  'fichiersDuConflit',
54
54
  'retourDuConflit',
55
+ 'testwriterDemande',
55
56
  ];
56
57
 
58
+ // The mark « the supervisor asked the testwriter » after a start: set by `--depuis testwriter`, kept
59
+ // by a `--reprendre` without `--depuis`, dropped by any other start (a new plan, no `--depuis`, a
60
+ // `--depuis` of another step). As an operator replays a named step whatever the automatic rule
61
+ // would have chosen.
62
+ export const testwriterDemande = ({ depuis, reprendre, marque }) =>
63
+ depuis === 'testwriter' || Boolean(!depuis && reprendre && marque);
64
+
57
65
  // The steps of the circuit's state, read from the list of the steps.
58
66
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
59
67
  export const [
@@ -91,7 +99,7 @@ export const rapportDuRefus = refus =>
91
99
  `L’intégration refuse ce lot : son refus, ci-dessous, est le rouge à lever ; les contrôles de ta copie, verts, ne le voient pas, et le lot ne repasse à l’intégration qu’avec un changement.\n\n${refus.rapport}`;
92
100
 
93
101
  // The stop of a ticket the queue reopens on its issue `{ raison, conflit }`, as it gives the circuit
94
- // (`direLIssue`, `conclureLaCI` of scripts/integration/file.mjs): `motif`, whose first line, the
102
+ // (`direLIssue` of scripts/integration/file.mjs): `motif`, whose first line, the
95
103
  // fact of the question gone up, says why (the first line of the reason that is not a title), the
96
104
  // whole reason after it; `question`, for a branch that does not replay on main (its conflict), the
97
105
  // answer that serves, null for any other reason.
@@ -111,10 +119,11 @@ export function refusDeLaFile({ raison, conflit = false } = {}) {
111
119
  // developpeur of a plan without tests (<sansTests>) or of a plan whose `comportement` is inchangé
112
120
  // (a gesture written by hand: no test can turn red, the existing suite proves it); else the
113
121
  // testwriter, for changé and tests-adaptés alike.
114
- export const etapeApresLePlan = ({ sorte, sansTests }) =>
122
+ // The supervisor's `--depuis testwriter` (<demande>) wins over `inchangé`: the testwriter plays.
123
+ export const etapeApresLePlan = ({ sorte, sansTests, demande = false }) =>
115
124
  sorte?.genre === 'mécanique'
116
125
  ? GESTE
117
- : sansTests || sorte?.comportement === 'inchangé'
126
+ : sansTests || (sorte?.comportement === 'inchangé' && !demande)
118
127
  ? CODE
119
128
  : TESTS;
120
129
 
@@ -463,8 +472,17 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
463
472
  sorte:
464
473
  lire('mecanique') || ticket.sorte?.comportement === 'inchangé' ? ticket.sorte : null,
465
474
  sansTests: lire('sansTests'),
475
+ demande: Boolean(m('testwriterDemande')),
466
476
  })
467
477
  : null;
478
+ const demandeDuSuperviseur =
479
+ Boolean(m('testwriterDemande')) && ticket.sorte?.comportement === 'inchangé';
480
+ if (etape === TESTS && route === TESTS && demandeDuSuperviseur) {
481
+ commenter(
482
+ 'testwriter',
483
+ 'plan « comportement inchangé » : le superviseur a demandé la séance du testwriter (`--depuis testwriter`), qui l’emporte sur la sorte du plan.'
484
+ );
485
+ }
468
486
  if (route === GESTE) {
469
487
  geste('mecanique');
470
488
  etape = GESTE;