@roomi-fields/grillhouse 0.28.2 → 0.29.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 (71) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/bin/grillhouse.mjs +55 -14
  3. package/cadre/templates/projet/CLAUDE.md +1 -1
  4. package/cadre/templates/projet/README.md +11 -11
  5. package/cadre/templates/projet/_gitignore +2 -5
  6. package/charte.md +24 -3
  7. package/docs/ARCHITECTURE.md +279 -31
  8. package/docs/INTERFACE.md +59 -11
  9. package/package.json +1 -1
  10. package/scripts/aiguillage.mjs +324 -0
  11. package/scripts/avancement.mjs +33 -50
  12. package/scripts/circuit.mjs +558 -146
  13. package/scripts/composition-des-langages.mjs +16 -1
  14. package/scripts/conformite.mjs +16 -0
  15. package/scripts/copies-finies.mjs +181 -29
  16. package/scripts/demon.mjs +134 -21
  17. package/scripts/enveloppe/enveloppe.mjs +8 -5
  18. package/scripts/enveloppe/lancer.sh +24 -15
  19. package/scripts/enveloppe/travail-de-la-copie.mjs +94 -11
  20. package/scripts/etapes.mjs +1 -1
  21. package/scripts/fusion-du-changelog.mjs +0 -1
  22. package/scripts/grillhouse-maj.mjs +16 -7
  23. package/scripts/integration/file.mjs +3 -3
  24. package/scripts/integration/integrer.mjs +3 -3
  25. package/scripts/jointure.d.ts +53 -17
  26. package/scripts/langages/cargo/commandes.mjs +152 -25
  27. package/scripts/langages/cargo/composants.mjs +94 -2
  28. package/scripts/langages/cargo/exemples.mjs +68 -1
  29. package/scripts/langages/cargo/index.mjs +21 -10
  30. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  31. package/scripts/langages/cargo/sccache.mjs +89 -6
  32. package/scripts/langages/cargo/squelette.mjs +72 -3
  33. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  34. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  35. package/scripts/langages/python/commandes.mjs +53 -9
  36. package/scripts/langages/python/composants.mjs +33 -3
  37. package/scripts/langages/python/exemples.mjs +19 -0
  38. package/scripts/langages/python/index.mjs +7 -2
  39. package/scripts/langages/python/squelette.mjs +119 -17
  40. package/scripts/langages/typescript/exemples.mjs +16 -0
  41. package/scripts/langages/typescript/index.mjs +6 -3
  42. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  43. package/scripts/langages/typescript/squelette.mjs +18 -2
  44. package/scripts/langages/typescript/tests-de-nuit.mjs +50 -20
  45. package/scripts/langages/typescript/verifier.mjs +82 -288
  46. package/scripts/langages/typescript/vitest-config/base.mjs +8 -9
  47. package/scripts/langages/typescript/vitest-config/cibles.mjs +92 -53
  48. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +11 -5
  49. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -1
  50. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  51. package/scripts/langages/typescript/vitest.nuit.config.mjs +18 -13
  52. package/scripts/lecture-unique.mjs +51 -0
  53. package/scripts/mesure/base-de-passe.mjs +202 -9
  54. package/scripts/mesure/pression.mjs +9 -7
  55. package/scripts/nuit.sh +19 -12
  56. package/scripts/outil.mjs +72 -0
  57. package/scripts/paquet.mjs +39 -10
  58. package/scripts/resultats.mjs +22 -5
  59. package/scripts/services-du-noyau.mjs +16 -10
  60. package/scripts/session-start.sh +10 -1
  61. package/scripts/sortie.mjs +20 -1
  62. package/scripts/sources.mjs +3 -3
  63. package/scripts/sous-commandes.mjs +2 -0
  64. package/scripts/superviseur.mjs +369 -14
  65. package/scripts/tableau.mjs +219 -58
  66. package/scripts/verrou-de-machine.mjs +425 -37
  67. package/skills/developpeur/SKILL.md +11 -3
  68. package/skills/pitmaster/SKILL.md +64 -23
  69. package/skills/pitmaster/references/consigne-agent.md +4 -0
  70. package/skills/relecteur/SKILL.md +18 -6
  71. package/skills/testwriter/SKILL.md +11 -15
@@ -23,10 +23,13 @@
23
23
  // names runs (`processus`, the same one by its start `depart`), and stands at the step of its
24
24
  // state, with its attempt, every step one for the whole ticket; while the explorateur or
25
25
  // the questionneur works on its plan (its state names that work, `questionnement`, of the
26
- // plan), it stands at the plan (1); stopped on a question for the supervisor (its state names it,
27
- // `question`), it stands under the stopped step after a line « ⤷ Question · <qui> », who must
28
- // answer it, the supervisor or the owner; its card opens on that question, or on the stop (its
29
- // name and code) and the first line of its reason. A ticket with a circuit waits in no block.
26
+ // plan), it stands at the plan (1); waiting for the supervisor (`attendLeSuperviseur`, the one
27
+ // rule the opening and the wait of the questions read too: stopped, « à repasser » included, but
28
+ // by the supervisor's « arrete », or dead without a final state), it stands under the stopped
29
+ // step after a line « ⤷ Question · <qui> », who must answer it, the supervisor or the owner, the
30
+ // supervisor when its state names no question; its card opens on that question, or on the stop
31
+ // (its name and code) and the first line of its reason. A ticket with a circuit waits in no
32
+ // block.
30
33
  // - Bilans: the card of a ticket whose circuit kept its bilan (scripts/bilan.mjs,
31
34
  // `.claude/worktrees/<ticket>.bilan.json`) opens on its key figures: wall time, share lost,
32
35
  // sessions, cost.
@@ -64,14 +67,23 @@
64
67
  // never the figures); the queue (5.2), the steps of its CI. Past FIGEE
65
68
  // without a sign, « ⚠ figée <durée> · faits/prévus », the time since its last sign, in the
66
69
  // tone of an alert.
67
- // A measure out of a ticket that holds the lock of the machine (a supervisor's or an
68
- // integration's `npm run verifier`) stands at the head of AGENTS:
69
- // « ⏳ Mesure · <dépôt> · faits/prévus · <durée> », since its start,
70
- // « ⚠ Mesure figée <durée> · … » past FIGEE. Such a line is marked `avancement`, which the
71
- // pane measures again more often.
72
- // - Alerts: one red alert per open night ticket (its subject, then its number), tickets awaiting
73
- // the responsable, a shell agent silent for 10 minutes, a ticket in progress without anything
74
- // running for 30 minutes.
70
+ // - The lock of the machine (scripts/verrou-de-machine.mjs, read by `lireLaMesure`), as lslocks
71
+ // names who holds a lock and cargo says what its wait waits for, at the head of AGENTS: its
72
+ // holder, whoever it is (a pass out of a ticket, the circuit of a ticket, of any project of the
73
+ // machine), « 🔒 <sorte> · <projet> · <ticket> · faits/prévus · <durée> » since it took the
74
+ // lock, « ⚠ <sorte> figée <durée> · … » past FIGEE without a sign of its progress; then each
75
+ // pass that waits for the lock or for room under /tmp, the oldest first, « ⏳ <sorte> ·
76
+ // <projet> · <ticket> · attend · <durée> ». The ticket shows without its prefix and its epic
77
+ // (`courtDuTicket`). Such a line is marked `avancement`, which the pane measures again more
78
+ // often. A circuit that waits shows ⏳ on its ticket's line, ▶ while it waits for nothing.
79
+ // - Signs: each sign keeps one sense (the owner's decision of 2026-11-01): ▶ in progress, ⏸ a
80
+ // stopped circuit, 🔒 the holder of the lock, ⏳ a wait for it or for room, 💤 a ticket claimed
81
+ // with nothing running, 🌙 a red night, ⚠ the alerts without a kind of their own. A sign two
82
+ // columns wide stands as the others, a sign then a space; the width of a line counts its
83
+ // columns (`colonnes`), ⏳ two.
84
+ // - Alerts: one red alert per open night ticket (🌙, its subject, then its number), tickets
85
+ // awaiting the responsable, a shell agent silent for 10 minutes, a ticket in progress without
86
+ // anything running for 30 minutes (💤).
75
87
  import { execFileSync } from 'node:child_process';
76
88
  import {
77
89
  closeSync,
@@ -99,6 +111,7 @@ import {
99
111
  SUITE,
100
112
  SUPERVISEUR,
101
113
  } from './etapes.mjs';
114
+ import { echecDeLOutil } from './aiguillage.mjs';
102
115
  import { bilansGardes, enBref } from './bilan.mjs';
103
116
  import { verdictDe } from './integration/verdict.mjs';
104
117
  import { lireAvancement, lireLaMesure } from './avancement.mjs';
@@ -591,8 +604,12 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
591
604
  // under way (`plan`), null without one, `question` the whole question of a circuit ended on one
592
605
  // and `qui` who must answer it (`superviseur` or `responsable`), null without one,
593
606
  // the counters of its bounded loops (`boucles`, by their key), the progress of the automatic pass under way (`avancement`, read in the directory its state
594
- // names, scripts/avancement.mjs: `{ faits, prevus, dernier }`, null without one). A state that
595
- // does not parse is left out.
607
+ // names, scripts/avancement.mjs: `{ faits, prevus, dernier }`, null without one), and `interrompu`
608
+ // for a circuit dead without a final state (its process gone, neither a stop nor a code written,
609
+ // as a circuit killed with the group of control that held it, grillhouse-mwz): its question, to
610
+ // the supervisor, gives the command that resumes it; `processus` and `depart` as the state names
611
+ // them, null without them, which tell one run of a circuit from the next. A state that does not
612
+ // parse is left out.
596
613
  export function lireCircuits({ racine }) {
597
614
  const dossier = path.join(racine, '.claude', 'worktrees');
598
615
  const out = [];
@@ -607,6 +624,8 @@ export function lireCircuits({ racine }) {
607
624
  continue;
608
625
  }
609
626
  const ticket = path.basename(f, '.circuit.json');
627
+ const vivant = leMemeVivant(e.processus, e.depart);
628
+ const interrompu = !vivant && (e.code ?? null) === null && !e.raison;
610
629
  out.push({
611
630
  ticket,
612
631
  etape: e.etape ?? null,
@@ -615,19 +634,38 @@ export function lireCircuits({ racine }) {
615
634
  code: e.code ?? null,
616
635
  arret: e.raison ?? null,
617
636
  raison: premiereLigne(e.rapport),
618
- question: String(e.question?.question ?? '').trim() || null,
619
- qui: e.question ? String(e.question.qui ?? SUPERVISEUR) : null,
637
+ question: interrompu
638
+ ? `Le circuit est mort sans état final : son processus est parti, aucun arrêt écrit. \`npx grillhouse circuit ${ticket} --reprendre\` le reprend.`
639
+ : String(e.question?.question ?? '').trim() || null,
640
+ qui: interrompu ? SUPERVISEUR : e.question ? String(e.question.qui ?? SUPERVISEUR) : null,
620
641
  questionnement: e.questionnement?.objet ?? null,
621
642
  boucles: e.boucles && typeof e.boucles === 'object' ? e.boucles : {},
622
643
  mene:
623
644
  typeof e.mene === 'string' && !Number.isNaN(Date.parse(e.mene)) ? Date.parse(e.mene) : null,
624
645
  avancement:
625
646
  typeof e.avancement?.dossier === 'string' ? lireAvancement(e.avancement.dossier) : null,
626
- vivant: leMemeVivant(e.processus, e.depart),
647
+ vivant,
648
+ interrompu,
649
+ processus: e.processus ?? null,
650
+ depart: e.depart ?? null,
627
651
  });
628
652
  }
629
653
  return out;
630
654
  }
655
+
656
+ /**
657
+ * Whether the circuit <c>, as `lireCircuits` reads it, waits for the supervisor: its process gone,
658
+ * dead without a final state, on a question, or stopped (any stop but the supervisor's own
659
+ * « arrete », « à repasser » included: the supervisor resumes it once the machine is free). The
660
+ * one rule of the questions that wait for the supervisor (grillhouse-pq6), which the board reads,
661
+ * and `questionsEnAttente` of scripts/superviseur.mjs, the one source of the opening and of the
662
+ * wait of the questions.
663
+ * @param {{ vivant: boolean, interrompu: boolean, question: string | null, arret: string | null }} c
664
+ * @returns {boolean}
665
+ */
666
+ export const attendLeSuperviseur = c =>
667
+ !c.vivant && Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
668
+
631
669
  // The first line of a report that is not blank, or null.
632
670
  const premiereLigne = r =>
633
671
  String(r ?? '')
@@ -693,7 +731,23 @@ export function lecture(t, prefix) {
693
731
  return { numero: brut, sujet: t.title ?? t.id, composant: '' };
694
732
  }
695
733
 
696
- // The board, from what was read. Pure: every source comes in, the time included.
734
+ /**
735
+ * Who holds the lock of the machine, or waits for it, as the board shows it (`lireLaMesure` of
736
+ * scripts/avancement.mjs, its project named as the board names it, `nommerLesProjets`).
737
+ * @typedef {{ depot?: string | null, projet: string, ticket: string | null, sorte: string,
738
+ * depuis: number | null, quoi?: string,
739
+ * avancement?: { faits: number, prevus: number, debut?: number, dernier: number } | null }} DuVerrou
740
+ * @typedef {{ detenteur: DuVerrou | null, attentes: DuVerrou[] }} Machine
741
+ */
742
+
743
+ /**
744
+ * The board, from what was read. Pure: every source comes in, the time included; `machine`, the
745
+ * lock of the machine; `outil`, the failed installation of the published version that leads the
746
+ * repository (scripts/aiguillage.mjs `echecDeLOutil`).
747
+ * @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[], circuits?: any[],
748
+ * verdicts?: Record<string, any>, maintenant: number, jour: number,
749
+ * machine?: Machine | null, outil?: { version: string, raison: string } | null }} lu
750
+ */
697
751
  export function assembler({
698
752
  tous,
699
753
  prefix = '',
@@ -703,7 +757,8 @@ export function assembler({
703
757
  verdicts = {},
704
758
  maintenant,
705
759
  jour,
706
- horsTicket = null,
760
+ machine = null,
761
+ outil = null,
707
762
  }) {
708
763
  // A circuit's lines are its steps, no agent's passage.
709
764
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
@@ -1009,7 +1064,23 @@ export function assembler({
1009
1064
  /^La nuit est rouge\b/.test(titreLu) && !Number.isNaN(ouvert)
1010
1065
  ? `Nuit rouge depuis le ${jourEtMois(ouvert)}`
1011
1066
  : titreLu;
1012
- alertes.push({ niveau: 'rouge', texte: `${sujet} ${n}`, sujet, numero: n, id: t.id });
1067
+ alertes.push({
1068
+ niveau: 'rouge',
1069
+ signe: '🌙',
1070
+ texte: `${sujet} ${n}`,
1071
+ sujet,
1072
+ numero: n,
1073
+ id: t.id,
1074
+ });
1075
+ }
1076
+ // The published version that leads the repository cannot be installed: the orchestration runs on
1077
+ // the code of the repository (scripts/aiguillage.mjs).
1078
+ if (outil) {
1079
+ alertes.push({
1080
+ niveau: 'orange',
1081
+ signe: '🧰',
1082
+ texte: `Outil ${outil.version} non installable : code du dépôt`,
1083
+ });
1013
1084
  }
1014
1085
  for (const b of blocs) {
1015
1086
  for (const x of b.enCours) {
@@ -1041,7 +1112,11 @@ export function assembler({
1041
1112
  t.started_at &&
1042
1113
  maintenant - Date.parse(t.started_at) > SANS_AGENT
1043
1114
  ) {
1044
- alertes.push({ niveau: 'orange', texte: `${numero(t.id)} en cours sans rien qui tourne` });
1115
+ alertes.push({
1116
+ niveau: 'orange',
1117
+ signe: '💤',
1118
+ texte: `${numero(t.id)} en cours sans rien qui tourne`,
1119
+ });
1045
1120
  }
1046
1121
  }
1047
1122
  // Each ticket's own measures: its agents' working time and tokens, running agents included.
@@ -1065,7 +1140,7 @@ export function assembler({
1065
1140
  autres,
1066
1141
  agents: blocs,
1067
1142
  maintenant,
1068
- horsTicket,
1143
+ machine,
1069
1144
  faitsDuJour,
1070
1145
  etats,
1071
1146
  parTicket,
@@ -1124,14 +1199,30 @@ function temoinDe(c, maintenant) {
1124
1199
  const conso = (ms, jetons) =>
1125
1200
  Math.round(ms / MINUTE) === 0 && !jetons ? '' : `${duree(ms)} · ${k(jetons)}`;
1126
1201
 
1202
+ // The columns <s> takes in a terminal: a character one, ⏳ two, as the signs out of the basic
1203
+ // plane (🔒 💤 🌙), which count two code units, take two.
1204
+ const colonnes = s => s.length + (s.match(/⏳/g)?.length ?? 0);
1205
+ // The start of <s> that holds in <n> columns, a sign out of the basic plane never split.
1206
+ const debutDe = (s, n) => {
1207
+ let out = '';
1208
+ for (const c of s) {
1209
+ if (colonnes(out + c) > n) {
1210
+ break;
1211
+ }
1212
+ out += c;
1213
+ }
1214
+ return out;
1215
+ };
1127
1216
  // A line of `largeur` columns: the left part cut to leave the right part whole.
1128
1217
  const couper = (gauche, droite, largeur) => {
1129
1218
  if (!droite) {
1130
- return gauche.length > largeur ? `${gauche.slice(0, largeur - 1)}…` : gauche;
1219
+ return colonnes(gauche) > largeur ? `${debutDe(gauche, largeur - 1)}…` : gauche;
1131
1220
  }
1132
- const place = largeur - droite.length - 1;
1221
+ const place = largeur - colonnes(droite) - 1;
1133
1222
  const g =
1134
- gauche.length > place ? `${gauche.slice(0, Math.max(place - 1, 0))}…` : gauche.padEnd(place);
1223
+ colonnes(gauche) > place
1224
+ ? `${debutDe(gauche, Math.max(place - 1, 0))}…`
1225
+ : `${gauche}${' '.repeat(place - colonnes(gauche))}`;
1135
1226
  return `${g} ${droite}`;
1136
1227
  };
1137
1228
  // A line of `largeur` columns whose left part ends with `suite`, kept whole: what comes before it
@@ -1140,10 +1231,20 @@ const couperAvant = (gauche, suite, droite, largeur) => {
1140
1231
  if (!suite) {
1141
1232
  return couper(gauche, droite, largeur);
1142
1233
  }
1143
- const place = (droite ? largeur - droite.length - 1 : largeur) - suite.length;
1144
- const g = gauche.length > place ? `${gauche.slice(0, Math.max(place - 1, 0))}…` : gauche;
1234
+ const place = (droite ? largeur - colonnes(droite) - 1 : largeur) - colonnes(suite);
1235
+ const g = colonnes(gauche) > place ? `${debutDe(gauche, Math.max(place - 1, 0))}…` : gauche;
1145
1236
  return couper(`${g}${suite}`, droite, largeur);
1146
1237
  };
1238
+ // The sign of the alert <a>: its kind's (`signe`: 🌙 a red night, 💤 a ticket claimed with
1239
+ // nothing running), ⚠ for the others.
1240
+ const signeDe = a => a.signe ?? '⚠';
1241
+ // A ticket's short name on the line of the lock, whatever its project: its id after the prefix,
1242
+ // without the epic's part when it has children's numbers, « bp-mono-vbwf.320.11 » → « 320.11 »,
1243
+ // « grillhouse-wui » → « wui ».
1244
+ const courtDuTicket = id => {
1245
+ const n = id.slice(id.lastIndexOf('-') + 1);
1246
+ return n.includes('.') ? n.slice(n.indexOf('.') + 1) : n;
1247
+ };
1147
1248
  // The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
1148
1249
  // discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
1149
1250
  // ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
@@ -1215,36 +1316,39 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1215
1316
  const droite = plusieurs ? (a.id ?? a.numero) : a.numero;
1216
1317
  L(
1217
1318
  droite
1218
- ? cadre(`⚠ ${duProjet(a)}${a.sujet}`, droite, largeur)
1219
- : cadre(`⚠ ${duProjet(a)}${a.texte}`, '', largeur),
1319
+ ? cadre(`${signeDe(a)} ${duProjet(a)}${a.sujet}`, droite, largeur)
1320
+ : cadre(`${signeDe(a)} ${duProjet(a)}${a.texte}`, '', largeur),
1220
1321
  a.niveau === 'rouge' ? 'alerte' : 'attention'
1221
1322
  );
1222
1323
  }
1223
1324
 
1224
1325
  L('', undefined);
1225
1326
  L('AGENTS ▶ en cours · en attente', 'titre');
1226
- // A measure out of a ticket that holds the lock of the machine (scripts/avancement.mjs), at the
1227
- // head: « ⏳ Mesure · <dépôt> · faits/prévus · <durée> », or past FIGEE without a sign
1228
- // « ⚠ Mesure figée <durée> · <dépôt> · faits/prévus », in the tone of an alert; the repository
1229
- // is cut, never the figures.
1327
+ // The lock of the machine (scripts/avancement.mjs `lireLaMesure`), at the head: its holder,
1328
+ // whoever it is, « 🔒 <sorte> · <projet> · <ticket> · faits/prévus · <durée> », the time since it
1329
+ // took the lock, the ticket and the figures when it has them; past FIGEE without a sign of its
1330
+ // progress « ⚠ <sorte> figée <durée> · <projet> · <ticket> · faits/prévus », in the tone of an
1331
+ // alert. Then each wait, the oldest first, « ⏳ <sorte> · <projet> · <ticket> · attend ·
1332
+ // <durée> ». The project and the ticket are cut, never the figures nor the time.
1230
1333
  const maintenant = t.maintenant ?? Date.now();
1231
- if (t.horsTicket) {
1232
- const m = t.horsTicket;
1233
- const age = maintenant - m.dernier;
1234
- const compte = m.faits || m.prevus ? `${m.faits}/${m.prevus}` : '';
1334
+ const deQui = x => `${x.sorte} · ${x.projet}${x.ticket ? ` · ${courtDuTicket(x.ticket)}` : ''}`;
1335
+ const tenu = t.machine?.detenteur;
1336
+ if (tenu) {
1337
+ const a = tenu.avancement;
1338
+ const age = a ? maintenant - a.dernier : 0;
1339
+ const compte = a && (a.faits || a.prevus) ? `${a.faits}/${a.prevus}` : '';
1235
1340
  const fige = age > FIGEE;
1236
- const quoi = m.depot;
1237
1341
  poser({
1238
1342
  texte: fige
1239
1343
  ? couperAvant(
1240
- `⚠ Mesure figée ${ilYa(age)} · ${quoi}`,
1344
+ `⚠ ${tenu.sorte} figée ${ilYa(age)} · ${deQui(tenu).slice(tenu.sorte.length + 3)}`,
1241
1345
  compte ? ` · ${compte}` : '',
1242
1346
  '',
1243
1347
  largeur
1244
1348
  )
1245
1349
  : couperAvant(
1246
- `⏳ Mesure · ${quoi}`,
1247
- ` · ${compte ? `${compte} · ` : ''}${ilYa(maintenant - (m.debut || m.dernier))}`,
1350
+ `🔒 ${deQui(tenu)}`,
1351
+ ` · ${compte ? `${compte} · ` : ''}${ilYa(maintenant - (tenu.depuis ?? maintenant))}`,
1248
1352
  '',
1249
1353
  largeur
1250
1354
  ),
@@ -1252,14 +1356,28 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1252
1356
  avancement: true,
1253
1357
  });
1254
1358
  }
1359
+ for (const w of [...(t.machine?.attentes ?? [])].sort((x, y) => x.depuis - y.depuis)) {
1360
+ poser({
1361
+ texte: couperAvant(
1362
+ `⏳ ${deQui(w)}`,
1363
+ ` · attend · ${ilYa(maintenant - w.depuis)}`,
1364
+ '',
1365
+ largeur
1366
+ ),
1367
+ ton: 'actif',
1368
+ avancement: true,
1369
+ });
1370
+ }
1371
+ // The tickets whose circuit waits for the lock or for room.
1372
+ const enAttente = new Set((t.machine?.attentes ?? []).map(w => w.ticket).filter(Boolean));
1255
1373
  // The tree of the steps (scripts/etapes.mjs), in its order, as a pipeline of GitLab CI shows its
1256
1374
  // stages and folds the jobs of a stage that has nothing: a step with sub-steps is folded
1257
1375
  // (« ▸ 2 · Composants ») while none of them holds a ticket, unfolded (« ▾ ») once one does, all
1258
1376
  // its sub-steps then shown, indented, the empty ones in the discreet tone; a step without
1259
1377
  // sub-steps stands on one line « number · title · who », discreet when empty, a title with its
1260
1378
  // tickets under it. A circuit's ticket stands on one line, at the step of its state, and nowhere
1261
- // else in AGENTS: the work on the plan at its step; stopped on a question for the
1262
- // supervisor (its state's `question`), under its step after a line « ⤷ Question · <qui> », who
1379
+ // else in AGENTS: the work on the plan at its step; waiting for the supervisor
1380
+ // (`attendLeSuperviseur`), under its step after a line « ⤷ Question · <qui> », who
1263
1381
  // must answer it, the supervisor or the owner, which unfolds the step, its counters those of its
1264
1382
  // step; a stopped circuit at no step of the list stands under that line after the steps. A
1265
1383
  // circuit's line gives its subject (`texte`), then the counters of the bounded loops of its step
@@ -1284,8 +1402,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1284
1402
  // The block of the circuits at no step of the list, after the steps.
1285
1403
  const ailleurs = { numero: null, titre: '', qui: '', enCours: [], attend: [] };
1286
1404
  const etapeDe = c => etapeDuCircuit({ ...c, raison: c.arret });
1287
- // A circuit stopped on a question: who must answer it.
1288
- const enQuestion = c => (!c.vivant && c.question ? (c.qui ?? SUPERVISEUR) : null);
1405
+ // A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
1406
+ // its question, the supervisor when its stop names no one.
1407
+ const enQuestion = c => (attendLeSuperviseur(c) ? (c.qui ?? SUPERVISEUR) : null);
1289
1408
  const blocDuCircuit = c => {
1290
1409
  const e = etapeDe(c);
1291
1410
  return e ? blocDe(e) : !c.vivant ? ailleurs : undefined;
@@ -1305,7 +1424,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1305
1424
  const droiteDe = (signe, droite) =>
1306
1425
  plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
1307
1426
  const ligneDuCircuit = c => {
1308
- const signe = c.vivant ? '▶' : '■';
1427
+ const signe = !c.vivant ? '⏸' : enAttente.has(c.id) ? '⏳' : '▶';
1309
1428
  const droite = droiteDe(
1310
1429
  signe,
1311
1430
  conso(t.parTicket?.[c.id]?.travail ?? 0, t.parTicket?.[c.id]?.jetons ?? 0)
@@ -1319,7 +1438,8 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1319
1438
  const temoin = c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null;
1320
1439
  // The progress after the counters of the loops while the subject keeps its room beside them,
1321
1440
  // in their place otherwise.
1322
- const reste = avec => largeur - (droite ? droite.length + 1 : 0) - tete.length - avec.length;
1441
+ const reste = avec =>
1442
+ largeur - (droite ? colonnes(droite) + 1 : 0) - colonnes(tete) - colonnes(avec);
1323
1443
  const suite = !temoin
1324
1444
  ? boucles
1325
1445
  : reste(`${boucles}${temoin.texte}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
@@ -1598,14 +1718,14 @@ export function lignesEtats(t, largeur = LARGEUR) {
1598
1718
  return out;
1599
1719
  }
1600
1720
 
1601
- // Where the stopped circuit <c> is: its step by number and title, its attempt, and its stop
1602
- // (« interrompu » for a circuit dead without a stop written).
1721
+ // Where the stopped circuit <c> is: its step by number and title, its attempt, and its stop, with
1722
+ // its code when it has one.
1603
1723
  const ouEnEst = c => {
1604
1724
  const e = etapeDuCircuit({ ...c, raison: c.arret });
1605
1725
  const ou = [e ? libelle(e) : c.etape, c.tentative ?? null]
1606
1726
  .filter(x => x !== null && x !== undefined)
1607
1727
  .join(' ');
1608
- const arret = c.code === null ? 'interrompu' : `arrêt ${c.arret ?? '?'} (${c.code})`;
1728
+ const arret = `arrêt ${c.arret ?? '?'}${c.code === null ? '' : ` (${c.code})`}`;
1609
1729
  return `${ou}, ${arret}`;
1610
1730
  };
1611
1731
 
@@ -1686,9 +1806,20 @@ export function dernierBouge(tous, lignesDuTableau, vivants = [], maintenant = D
1686
1806
  return dernier;
1687
1807
  }
1688
1808
 
1689
- // The status line: the chantier in progress, alerts first.
1809
+ // The status line: the chantier in progress; first the alerts, counted by their signs as the board
1810
+ // shows them (🌙, 💤, ⚠), then the holder of the lock of the machine, « 🔒 <sorte> · <projet> »,
1811
+ // and the count of its waits, « ⏳ <n> ».
1690
1812
  export function ligneEtat(t) {
1691
- const alerte = t.alertes.length ? `⚠ ${t.alertes.length} · ` : '';
1813
+ const signes = t.alertes.map(signeDe);
1814
+ const tenu = t.machine?.detenteur;
1815
+ const attentes = t.machine?.attentes?.length ?? 0;
1816
+ const alerte = [
1817
+ ...[...new Set(signes)].map(s => `${s} ${signes.filter(x => x === s).length}`),
1818
+ ...(tenu ? [`🔒 ${tenu.sorte} · ${tenu.projet}`] : []),
1819
+ ...(attentes ? [`⏳ ${attentes}`] : []),
1820
+ ]
1821
+ .map(x => `${x} · `)
1822
+ .join('');
1692
1823
  const ch = t.chantiers[0];
1693
1824
  const c = t.global.compteurs;
1694
1825
  if (!ch) {
@@ -1714,7 +1845,7 @@ const bdJson = (racine, ...args) => {
1714
1845
 
1715
1846
  // What the board reads of the repository at <racine>: its tickets, its prefix, its running agents
1716
1847
  // and its assembled board (`t`), with the folder git keeps its shared files in (`commun`).
1717
- function lire(racine, { home, maintenant, horsTicket = null }) {
1848
+ function lire(racine, { home, maintenant, machine = null }) {
1718
1849
  let prefix = '';
1719
1850
  try {
1720
1851
  prefix = execFileSync('bd', ['config', 'get', 'issue_prefix'], {
@@ -1801,7 +1932,8 @@ function lire(racine, { home, maintenant, horsTicket = null }) {
1801
1932
  verdicts,
1802
1933
  maintenant,
1803
1934
  jour: minuit.getTime(),
1804
- horsTicket,
1935
+ machine,
1936
+ outil: echecDeLOutil(racine),
1805
1937
  });
1806
1938
  return { t, prefix, tous, vivants, commun };
1807
1939
  }
@@ -1836,7 +1968,7 @@ export function ensemble(lus) {
1836
1968
  return { ...b, enCours: de('enCours'), attend: de('attend') };
1837
1969
  }),
1838
1970
  maintenant: premier.t.maintenant,
1839
- horsTicket: premier.t.horsTicket,
1971
+ machine: premier.t.machine,
1840
1972
  faitsDuJour: tous('faitsDuJour'),
1841
1973
  etats: premier.t.etats.map(e => ({
1842
1974
  ...e,
@@ -1861,6 +1993,25 @@ function lireUnAutre(dossier, o) {
1861
1993
  }
1862
1994
  }
1863
1995
 
1996
+ /**
1997
+ * The lock of the machine <machine> with each project named as the board names it: <noms> gives
1998
+ * the name of each project of the board by the root of its main tree (`depot`); a project out of
1999
+ * the board keeps its folder's name.
2000
+ * @param {Machine | null} machine
2001
+ * @param {Map<string, string>} noms
2002
+ * @returns {Machine | null}
2003
+ */
2004
+ export function nommerLesProjets(machine, noms) {
2005
+ if (!machine) {
2006
+ return machine;
2007
+ }
2008
+ const nommer = x => ({ ...x, projet: (x.depot && noms.get(x.depot)) || x.projet });
2009
+ return {
2010
+ detenteur: machine.detenteur && nommer(machine.detenteur),
2011
+ attentes: machine.attentes.map(nommer),
2012
+ };
2013
+ }
2014
+
1864
2015
  // The board of the repository at <racine>; with <projets>, the folders of other projects, the
1865
2016
  // board of them all (`ensemble`), named « <dépôt> + <projet> + … », with the folder of each
1866
2017
  // ticket's project (`dossiers`), where the pane runs Beads for it. The status line is the
@@ -1871,8 +2022,20 @@ export function tableau(
1871
2022
  ) {
1872
2023
  const ici = {
1873
2024
  dossier: racine,
1874
- ...lire(racine, { home, maintenant, horsTicket: lireLaMesure(process.env) }),
2025
+ ...lire(racine, { home, maintenant, machine: lireLaMesure(process.env) }),
1875
2026
  };
2027
+ const lus = [ici, ...projets.map(d => lireUnAutre(d, { home, maintenant }))];
2028
+ const etiquette = l => l.prefix || path.basename(l.dossier);
2029
+ // The lock of the machine names each project of the board as the board does: the session's by
2030
+ // its folder, another by its label; the root of its main tree, its common git directory's parent.
2031
+ ici.t.machine = nommerLesProjets(
2032
+ ici.t.machine,
2033
+ new Map(
2034
+ lus
2035
+ .filter(l => l.commun)
2036
+ .map(l => [path.dirname(l.commun), l === ici ? path.basename(racine) : etiquette(l)])
2037
+ )
2038
+ );
1876
2039
  const etat = ligneEtat(ici.t);
1877
2040
  try {
1878
2041
  if (ici.commun) {
@@ -1881,8 +2044,6 @@ export function tableau(
1881
2044
  } catch {
1882
2045
  // A read-only place keeps the board working, without its status line.
1883
2046
  }
1884
- const lus = [ici, ...projets.map(d => lireUnAutre(d, { home, maintenant }))];
1885
- const etiquette = l => l.prefix || path.basename(l.dossier);
1886
2047
  const t = projets.length
1887
2048
  ? ensemble(lus.map(l => ({ etiquette: etiquette(l), t: l.t, erreur: l.erreur })))
1888
2049
  : ici.t;