@roomi-fields/grillhouse 0.28.3 → 0.30.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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +128 -26
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/README.md +11 -11
  7. package/cadre/templates/projet/_gitignore +2 -5
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/projet/package.json +2 -2
  10. package/charte.md +37 -4
  11. package/dist/temporal/acte.d.ts +24 -0
  12. package/dist/temporal/acte.js +139 -0
  13. package/dist/temporal/acte.js.map +1 -0
  14. package/dist/temporal/attributs.d.ts +6 -0
  15. package/dist/temporal/attributs.js +15 -0
  16. package/dist/temporal/attributs.js.map +1 -0
  17. package/dist/temporal/circuit/activites.d.ts +13 -0
  18. package/dist/temporal/circuit/activites.js +33 -0
  19. package/dist/temporal/circuit/activites.js.map +1 -0
  20. package/dist/temporal/circuit/client.d.ts +72 -0
  21. package/dist/temporal/circuit/client.js +247 -0
  22. package/dist/temporal/circuit/client.js.map +1 -0
  23. package/dist/temporal/circuit/commande.d.ts +2 -0
  24. package/dist/temporal/circuit/commande.js +238 -0
  25. package/dist/temporal/circuit/commande.js.map +1 -0
  26. package/dist/temporal/circuit/contrat.d.ts +305 -0
  27. package/dist/temporal/circuit/contrat.js +24 -0
  28. package/dist/temporal/circuit/contrat.js.map +1 -0
  29. package/dist/temporal/circuit/deroule.d.ts +3 -0
  30. package/dist/temporal/circuit/deroule.js +540 -0
  31. package/dist/temporal/circuit/deroule.js.map +1 -0
  32. package/dist/temporal/client.d.ts +47 -0
  33. package/dist/temporal/client.js +69 -0
  34. package/dist/temporal/client.js.map +1 -0
  35. package/dist/temporal/commande.d.ts +2 -0
  36. package/dist/temporal/commande.js +95 -0
  37. package/dist/temporal/commande.js.map +1 -0
  38. package/dist/temporal/deroules.d.ts +5 -0
  39. package/dist/temporal/deroules.js +10 -0
  40. package/dist/temporal/deroules.js.map +1 -0
  41. package/dist/temporal/etat.d.ts +33 -0
  42. package/dist/temporal/etat.js +59 -0
  43. package/dist/temporal/etat.js.map +1 -0
  44. package/dist/temporal/file/activites.d.ts +10 -0
  45. package/dist/temporal/file/activites.js +25 -0
  46. package/dist/temporal/file/activites.js.map +1 -0
  47. package/dist/temporal/file/client.d.ts +4 -0
  48. package/dist/temporal/file/client.js +6 -0
  49. package/dist/temporal/file/client.js.map +1 -0
  50. package/dist/temporal/file/contrat.d.ts +158 -0
  51. package/dist/temporal/file/contrat.js +14 -0
  52. package/dist/temporal/file/contrat.js.map +1 -0
  53. package/dist/temporal/file/deroule.d.ts +15 -0
  54. package/dist/temporal/file/deroule.js +235 -0
  55. package/dist/temporal/file/deroule.js.map +1 -0
  56. package/dist/temporal/installation.d.ts +124 -0
  57. package/dist/temporal/installation.js +408 -0
  58. package/dist/temporal/installation.js.map +1 -0
  59. package/dist/temporal/places/activites.d.ts +8 -0
  60. package/dist/temporal/places/activites.js +13 -0
  61. package/dist/temporal/places/activites.js.map +1 -0
  62. package/dist/temporal/places/client.d.ts +28 -0
  63. package/dist/temporal/places/client.js +64 -0
  64. package/dist/temporal/places/client.js.map +1 -0
  65. package/dist/temporal/places/contrat.d.ts +106 -0
  66. package/dist/temporal/places/contrat.js +21 -0
  67. package/dist/temporal/places/contrat.js.map +1 -0
  68. package/dist/temporal/places/deroule.d.ts +3 -0
  69. package/dist/temporal/places/deroule.js +198 -0
  70. package/dist/temporal/places/deroule.js.map +1 -0
  71. package/dist/temporal/sonde/activites.d.ts +6 -0
  72. package/dist/temporal/sonde/activites.js +52 -0
  73. package/dist/temporal/sonde/activites.js.map +1 -0
  74. package/dist/temporal/sonde/contrat.d.ts +35 -0
  75. package/dist/temporal/sonde/contrat.js +10 -0
  76. package/dist/temporal/sonde/contrat.js.map +1 -0
  77. package/dist/temporal/sonde/deroule.d.ts +3 -0
  78. package/dist/temporal/sonde/deroule.js +39 -0
  79. package/dist/temporal/sonde/deroule.js.map +1 -0
  80. package/dist/temporal/tickets/activites.d.ts +7 -0
  81. package/dist/temporal/tickets/activites.js +81 -0
  82. package/dist/temporal/tickets/activites.js.map +1 -0
  83. package/dist/temporal/tickets/client.d.ts +10 -0
  84. package/dist/temporal/tickets/client.js +31 -0
  85. package/dist/temporal/tickets/client.js.map +1 -0
  86. package/dist/temporal/tickets/contrat.d.ts +56 -0
  87. package/dist/temporal/tickets/contrat.js +13 -0
  88. package/dist/temporal/tickets/contrat.js.map +1 -0
  89. package/dist/temporal/tickets/deroule.d.ts +3 -0
  90. package/dist/temporal/tickets/deroule.js +94 -0
  91. package/dist/temporal/tickets/deroule.js.map +1 -0
  92. package/dist/temporal/travailleur.d.ts +2 -0
  93. package/dist/temporal/travailleur.js +69 -0
  94. package/dist/temporal/travailleur.js.map +1 -0
  95. package/docs/ARCHITECTURE.md +813 -53
  96. package/docs/CADRE.md +17 -0
  97. package/docs/INTERFACE.md +161 -30
  98. package/hooks/crochet.mjs +19 -2
  99. package/hooks/hooks.json +11 -0
  100. package/package.json +16 -4
  101. package/scripts/activites.mjs +2182 -0
  102. package/scripts/aiguillage.d.mts +37 -0
  103. package/scripts/aiguillage.mjs +328 -0
  104. package/scripts/avancement.mjs +159 -64
  105. package/scripts/bilan.mjs +37 -19
  106. package/scripts/cadre.mjs +11 -2
  107. package/scripts/circuit.mjs +888 -3654
  108. package/scripts/circuits-cles.d.mts +4 -0
  109. package/scripts/circuits-cles.mjs +21 -0
  110. package/scripts/circuits-du-serveur.mjs +105 -0
  111. package/scripts/codes-de-sortie.mjs +9 -0
  112. package/scripts/commandes-composees.mjs +45 -41
  113. package/scripts/commandes-du-path.d.mts +7 -0
  114. package/scripts/commandes-du-path.mjs +25 -0
  115. package/scripts/composition-des-langages.mjs +30 -11
  116. package/scripts/conformite.mjs +19 -10
  117. package/scripts/copies-finies.mjs +188 -42
  118. package/scripts/depart-du-ticket.d.mts +53 -0
  119. package/scripts/depart-du-ticket.mjs +124 -0
  120. package/scripts/dependances-internes.mjs +115 -0
  121. package/scripts/dernier-vert.mjs +7 -15
  122. package/scripts/donnees-cles.mjs +228 -0
  123. package/scripts/droits.mjs +11 -1
  124. package/scripts/effets.mjs +352 -0
  125. package/scripts/enveloppe/enveloppe.mjs +119 -8
  126. package/scripts/enveloppe/lancer.sh +27 -32
  127. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  128. package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
  129. package/scripts/etapes.mjs +6 -3
  130. package/scripts/faits-du-circuit.mjs +493 -0
  131. package/scripts/file-des-tickets.d.mts +21 -0
  132. package/scripts/file-des-tickets.mjs +58 -0
  133. package/scripts/flux-des-paquets.mjs +187 -0
  134. package/scripts/fusion-du-changelog.mjs +0 -1
  135. package/scripts/gardes-du-cadre.mjs +12 -2
  136. package/scripts/grillhouse-maj.mjs +16 -7
  137. package/scripts/integration/file.mjs +477 -422
  138. package/scripts/integration/integrer.mjs +20 -22
  139. package/scripts/integration/rejeu.mjs +19 -4
  140. package/scripts/jointure.d.ts +168 -28
  141. package/scripts/langages/cargo/commandes.mjs +426 -119
  142. package/scripts/langages/cargo/composants.mjs +187 -3
  143. package/scripts/langages/cargo/exemples.mjs +75 -17
  144. package/scripts/langages/cargo/index.mjs +32 -13
  145. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  146. package/scripts/langages/cargo/sccache.mjs +62 -16
  147. package/scripts/langages/cargo/squelette.mjs +72 -3
  148. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  149. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  150. package/scripts/langages/python/commandes.mjs +232 -79
  151. package/scripts/langages/python/composants.mjs +65 -3
  152. package/scripts/langages/python/exemples.mjs +21 -12
  153. package/scripts/langages/python/index.mjs +25 -5
  154. package/scripts/langages/python/lot.mjs +1 -36
  155. package/scripts/langages/python/squelette.mjs +119 -17
  156. package/scripts/langages/typescript/construire.mjs +6 -163
  157. package/scripts/langages/typescript/exemples.mjs +19 -11
  158. package/scripts/langages/typescript/frontieres.mjs +1 -1
  159. package/scripts/langages/typescript/index.mjs +48 -63
  160. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  161. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  162. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  163. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  164. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  165. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  166. package/scripts/langages/typescript/squelette.mjs +18 -2
  167. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  168. package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
  169. package/scripts/langages/typescript/tests.mjs +17 -8
  170. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  171. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  172. package/scripts/langages/typescript/verdict.mjs +1 -1
  173. package/scripts/langages/typescript/verifier.mjs +110 -296
  174. package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
  175. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  176. package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
  177. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  178. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  179. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  180. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
  181. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
  182. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  183. package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
  184. package/scripts/lecture-unique.mjs +51 -0
  185. package/scripts/mesure/pression.mjs +11 -9
  186. package/scripts/mesure-de-la-machine.d.mts +21 -0
  187. package/scripts/mesure-de-la-machine.mjs +76 -0
  188. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  189. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  190. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  191. package/scripts/migrations.mjs +5 -0
  192. package/scripts/nuit.sh +29 -15
  193. package/scripts/outil.mjs +72 -0
  194. package/scripts/outils-cles.d.mts +24 -0
  195. package/scripts/outils-cles.mjs +0 -1
  196. package/scripts/paquet-npm.mjs +147 -0
  197. package/scripts/paquet.mjs +112 -14
  198. package/scripts/paquets.mjs +34 -6
  199. package/scripts/passe-de-la-machine.mjs +66 -0
  200. package/scripts/places-de-la-machine.mjs +360 -0
  201. package/scripts/places-du-serveur.mjs +170 -0
  202. package/scripts/prefixe-des-tickets.mjs +68 -0
  203. package/scripts/preparation.mjs +10 -3
  204. package/scripts/registre.mjs +3 -2
  205. package/scripts/regles-des-places.d.mts +36 -0
  206. package/scripts/regles-des-places.mjs +70 -0
  207. package/scripts/reponses-du-circuit.d.mts +6 -0
  208. package/scripts/reponses-du-circuit.mjs +28 -0
  209. package/scripts/resultats.mjs +29 -14
  210. package/scripts/retirer-les-copies-finies.mjs +25 -0
  211. package/scripts/sans-reponse.d.mts +4 -0
  212. package/scripts/sans-reponse.mjs +13 -0
  213. package/scripts/seances.mjs +918 -0
  214. package/scripts/services-du-noyau.mjs +28 -11
  215. package/scripts/session-start.sh +10 -1
  216. package/scripts/sortie.mjs +23 -4
  217. package/scripts/sources.mjs +3 -3
  218. package/scripts/sous-commandes.mjs +39 -9
  219. package/scripts/style-a-l-ecriture.mjs +229 -0
  220. package/scripts/superviseur.mjs +382 -16
  221. package/scripts/tableau.mjs +329 -130
  222. package/scripts/taches-du-graphe.mjs +328 -0
  223. package/scripts/ticket-du-circuit.mjs +206 -0
  224. package/scripts/transitions.d.mts +148 -0
  225. package/scripts/transitions.mjs +901 -0
  226. package/scripts/verrou-de-fichier.mjs +2 -2
  227. package/scripts/verrou-de-machine.mjs +322 -62
  228. package/skills/developpeur/SKILL.md +11 -3
  229. package/skills/explorateur/SKILL.md +2 -1
  230. package/skills/pitmaster/SKILL.md +62 -28
  231. package/skills/pitmaster/references/consigne-agent.md +5 -1
  232. package/skills/release/SKILL.md +3 -3
  233. package/skills/relecteur/SKILL.md +22 -8
  234. package/skills/testwriter/SKILL.md +47 -39
  235. package/scripts/demon.mjs +0 -138
  236. package/scripts/integration/file-attente.mjs +0 -61
  237. package/scripts/langages/cargo/touches.mjs +0 -93
  238. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -19,14 +19,17 @@
19
19
  // roles of the flow that ran on it and the reviewer's last verdict (`ACCEPTÉ` or `RENDU` at the
20
20
  // start of a comment).
21
21
  // - Circuits: one entry per open ticket whose circuit (scripts/circuit.mjs) runs or stopped, read
22
- // in its state `.claude/worktrees/<ticket>.circuit.json`: it runs while the process its state
23
- // names runs (`processus`, the same one by its start `depart`), and stands at the step of its
24
- // state, with its attempt, every step one for the whole ticket; while the explorateur or
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.
22
+ // from the Temporal server in one call (scripts/circuits-du-serveur.mjs, the memo of its
23
+ // workflow): it runs while its workflow runs with no question awaited, and stands at the step of
24
+ // its last state, with its attempt, every step one for the whole ticket; while the explorateur
25
+ // or the questionneur works on its plan (`questionnement`, of the plan), it stands at the plan
26
+ // (1); waiting for the supervisor (`attendLeSuperviseur`, the one rule the opening and the wait
27
+ // of the questions read too: stopped, « à repasser » included, but by the supervisor's
28
+ // « arrete », or ended without its issue), 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 it 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
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,10 +111,12 @@ 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
- import { lireAvancement, lireLaMesure } from './avancement.mjs';
105
- import { leMemeVivant } from './mesure/base-de-passe.mjs';
117
+ import { lireLaMesure } from './avancement.mjs';
118
+ import { SANS_REPONSE_EN, ServeurMuet, circuitsDuServeur } from './circuits-du-serveur.mjs';
119
+ import { etatDesPlaces } from './places-de-la-machine.mjs';
106
120
 
107
121
  const MINUTE = 60_000;
108
122
  export const SILENCE = 10 * MINUTE;
@@ -584,56 +598,19 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
584
598
  return vivants;
585
599
  }
586
600
 
587
- // The circuits of the repository at <racine>: each state `.claude/worktrees/<ticket>.circuit.json`
588
- // scripts/circuit.mjs writes, but those at « integre », with `vivant` when the process its state
589
- // names lives (`processus`, the same one by its start `depart`: a circuit is a daemon, apart from
590
- // the command that launched it), `questionnement` the object of the work on the plan
591
- // under way (`plan`), null without one, `question` the whole question of a circuit ended on one
592
- // and `qui` who must answer it (`superviseur` or `responsable`), null without one,
593
- // 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.
596
- export function lireCircuits({ racine }) {
597
- const dossier = path.join(racine, '.claude', 'worktrees');
598
- const out = [];
599
- for (const f of fichiers(dossier, '.circuit.json')) {
600
- let e;
601
- try {
602
- e = JSON.parse(readFileSync(f, 'utf8'));
603
- } catch {
604
- continue;
605
- }
606
- if (!e || e.etape === 'integre') {
607
- continue;
608
- }
609
- const ticket = path.basename(f, '.circuit.json');
610
- out.push({
611
- ticket,
612
- etape: e.etape ?? null,
613
- tentative: e.tentative ?? null,
614
- finale: e.finale === true,
615
- code: e.code ?? null,
616
- arret: e.raison ?? null,
617
- raison: premiereLigne(e.rapport),
618
- question: String(e.question?.question ?? '').trim() || null,
619
- qui: e.question ? String(e.question.qui ?? SUPERVISEUR) : null,
620
- questionnement: e.questionnement?.objet ?? null,
621
- boucles: e.boucles && typeof e.boucles === 'object' ? e.boucles : {},
622
- mene:
623
- typeof e.mene === 'string' && !Number.isNaN(Date.parse(e.mene)) ? Date.parse(e.mene) : null,
624
- avancement:
625
- typeof e.avancement?.dossier === 'string' ? lireAvancement(e.avancement.dossier) : null,
626
- vivant: leMemeVivant(e.processus, e.depart),
627
- });
628
- }
629
- return out;
630
- }
631
- // The first line of a report that is not blank, or null.
632
- const premiereLigne = r =>
633
- String(r ?? '')
634
- .split('\n')
635
- .map(x => x.trim())
636
- .find(Boolean) ?? null;
601
+ /**
602
+ * Whether the circuit <c>, as scripts/circuits-du-serveur.mjs reads it, waits for the supervisor:
603
+ * not running on its own, and ended without its issue, on a question, or stopped (any stop but the
604
+ * supervisor's own « arrete », « à repasser » included: the supervisor resumes it once the machine
605
+ * is free). The
606
+ * one rule of the questions that wait for the supervisor (grillhouse-pq6), which the board reads,
607
+ * and `questionsEnAttente` of scripts/superviseur.mjs, the one source of the opening and of the
608
+ * wait of the questions.
609
+ * @param {{ vivant: boolean, interrompu: boolean, question: string | null, arret: string | null }} c
610
+ * @returns {boolean}
611
+ */
612
+ export const attendLeSuperviseur = c =>
613
+ !c.vivant && Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
637
614
 
638
615
  // The reviewer's last verdict among a ticket's comments (verdictDe: a comment of the reviewer's
639
616
  // author), or null.
@@ -693,7 +670,28 @@ export function lecture(t, prefix) {
693
670
  return { numero: brut, sujet: t.title ?? t.id, composant: '' };
694
671
  }
695
672
 
696
- // The board, from what was read. Pure: every source comes in, the time included.
673
+ /**
674
+ * Who holds the lock of the machine, or waits for it, as the board shows it (`lireLaMesure` of
675
+ * scripts/avancement.mjs, its project named as the board names it, `nommerLesProjets`).
676
+ * @typedef {{ depot?: string | null, projet: string, ticket: string | null, sorte: string,
677
+ * depuis: number | null, quoi?: string,
678
+ * avancement?: { faits: number, prevus: number, debut?: number, dernier: number } | null }} DuVerrou
679
+ * @typedef {{ detenteur: DuVerrou | null, attentes: DuVerrou[] }} Machine
680
+ */
681
+
682
+ /**
683
+ * The board, from what was read. Pure: every source comes in, the time included; `machine`, the
684
+ * lock of the machine; `outil`, the failed installation of the published version that leads the
685
+ * repository (scripts/aiguillage.mjs `echecDeLOutil`); `places`, the places of the machine
686
+ * (scripts/places-de-la-machine.mjs `etatDesPlaces`), whose line heads AGENTS; `muet`, the Temporal
687
+ * server did not answer the reading of the circuits, which the first alert says; `faute`, any
688
+ * other fault of that reading, said in the first alert as it is.
689
+ * @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[], circuits?: any[],
690
+ * verdicts?: Record<string, any>, maintenant: number, jour: number,
691
+ * machine?: Machine | null, outil?: { version: string, raison: string } | null,
692
+ * places?: { prises: number, plafond: number, charge: number, coeurs: number, memoireGo: number,
693
+ * attentes: { ticket: string, depuis: number }[] } | null, muet?: boolean, faute?: string | null }} lu
694
+ */
697
695
  export function assembler({
698
696
  tous,
699
697
  prefix = '',
@@ -703,7 +701,11 @@ export function assembler({
703
701
  verdicts = {},
704
702
  maintenant,
705
703
  jour,
706
- horsTicket = null,
704
+ machine = null,
705
+ outil = null,
706
+ places: placesDeLaMachine = null,
707
+ muet = false,
708
+ faute = null,
707
709
  }) {
708
710
  // A circuit's lines are its steps, no agent's passage.
709
711
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
@@ -999,6 +1001,13 @@ export function assembler({
999
1001
 
1000
1002
  // Alerts.
1001
1003
  const alertes = [];
1004
+ // The Temporal server does not answer: the board shows the tickets without their circuits, and
1005
+ // its first alert names the command that tells the state of the service.
1006
+ if (muet) {
1007
+ alertes.push({ niveau: 'rouge', texte: `${SANS_REPONSE_EN} · temporal etat` });
1008
+ } else if (faute) {
1009
+ alertes.push({ niveau: 'rouge', texte: `Circuits illisibles : ${faute}` });
1010
+ }
1002
1011
  // A red night says the night it turned red, short enough to stand whole on its line: the local
1003
1012
  // day and month its ticket was opened, the night's date (scripts/nuit.sh), whatever its title names, a
1004
1013
  // commit in older ones.
@@ -1009,7 +1018,23 @@ export function assembler({
1009
1018
  /^La nuit est rouge\b/.test(titreLu) && !Number.isNaN(ouvert)
1010
1019
  ? `Nuit rouge depuis le ${jourEtMois(ouvert)}`
1011
1020
  : titreLu;
1012
- alertes.push({ niveau: 'rouge', texte: `${sujet} ${n}`, sujet, numero: n, id: t.id });
1021
+ alertes.push({
1022
+ niveau: 'rouge',
1023
+ signe: '🌙',
1024
+ texte: `${sujet} ${n}`,
1025
+ sujet,
1026
+ numero: n,
1027
+ id: t.id,
1028
+ });
1029
+ }
1030
+ // The published version that leads the repository cannot be installed: the orchestration runs on
1031
+ // the code of the repository (scripts/aiguillage.mjs).
1032
+ if (outil) {
1033
+ alertes.push({
1034
+ niveau: 'orange',
1035
+ signe: '🧰',
1036
+ texte: `Outil ${outil.version} non installable : code du dépôt`,
1037
+ });
1013
1038
  }
1014
1039
  for (const b of blocs) {
1015
1040
  for (const x of b.enCours) {
@@ -1041,7 +1066,11 @@ export function assembler({
1041
1066
  t.started_at &&
1042
1067
  maintenant - Date.parse(t.started_at) > SANS_AGENT
1043
1068
  ) {
1044
- alertes.push({ niveau: 'orange', texte: `${numero(t.id)} en cours sans rien qui tourne` });
1069
+ alertes.push({
1070
+ niveau: 'orange',
1071
+ signe: '💤',
1072
+ texte: `${numero(t.id)} en cours sans rien qui tourne`,
1073
+ });
1045
1074
  }
1046
1075
  }
1047
1076
  // Each ticket's own measures: its agents' working time and tokens, running agents included.
@@ -1065,7 +1094,8 @@ export function assembler({
1065
1094
  autres,
1066
1095
  agents: blocs,
1067
1096
  maintenant,
1068
- horsTicket,
1097
+ machine,
1098
+ places: placesDeLaMachine,
1069
1099
  faitsDuJour,
1070
1100
  etats,
1071
1101
  parTicket,
@@ -1124,14 +1154,30 @@ function temoinDe(c, maintenant) {
1124
1154
  const conso = (ms, jetons) =>
1125
1155
  Math.round(ms / MINUTE) === 0 && !jetons ? '' : `${duree(ms)} · ${k(jetons)}`;
1126
1156
 
1157
+ // The columns <s> takes in a terminal: a character one, ⏳ two, as the signs out of the basic
1158
+ // plane (🔒 💤 🌙), which count two code units, take two.
1159
+ const colonnes = s => s.length + (s.match(/⏳/g)?.length ?? 0);
1160
+ // The start of <s> that holds in <n> columns, a sign out of the basic plane never split.
1161
+ const debutDe = (s, n) => {
1162
+ let out = '';
1163
+ for (const c of s) {
1164
+ if (colonnes(out + c) > n) {
1165
+ break;
1166
+ }
1167
+ out += c;
1168
+ }
1169
+ return out;
1170
+ };
1127
1171
  // A line of `largeur` columns: the left part cut to leave the right part whole.
1128
1172
  const couper = (gauche, droite, largeur) => {
1129
1173
  if (!droite) {
1130
- return gauche.length > largeur ? `${gauche.slice(0, largeur - 1)}…` : gauche;
1174
+ return colonnes(gauche) > largeur ? `${debutDe(gauche, largeur - 1)}…` : gauche;
1131
1175
  }
1132
- const place = largeur - droite.length - 1;
1176
+ const place = largeur - colonnes(droite) - 1;
1133
1177
  const g =
1134
- gauche.length > place ? `${gauche.slice(0, Math.max(place - 1, 0))}…` : gauche.padEnd(place);
1178
+ colonnes(gauche) > place
1179
+ ? `${debutDe(gauche, Math.max(place - 1, 0))}…`
1180
+ : `${gauche}${' '.repeat(place - colonnes(gauche))}`;
1135
1181
  return `${g} ${droite}`;
1136
1182
  };
1137
1183
  // A line of `largeur` columns whose left part ends with `suite`, kept whole: what comes before it
@@ -1140,10 +1186,17 @@ const couperAvant = (gauche, suite, droite, largeur) => {
1140
1186
  if (!suite) {
1141
1187
  return couper(gauche, droite, largeur);
1142
1188
  }
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;
1189
+ const place = (droite ? largeur - colonnes(droite) - 1 : largeur) - colonnes(suite);
1190
+ const g = colonnes(gauche) > place ? `${debutDe(gauche, Math.max(place - 1, 0))}…` : gauche;
1145
1191
  return couper(`${g}${suite}`, droite, largeur);
1146
1192
  };
1193
+ // The sign of the alert <a>: its kind's (`signe`: 🌙 a red night, 💤 a ticket claimed with
1194
+ // nothing running), ⚠ for the others.
1195
+ const signeDe = a => a.signe ?? '⚠';
1196
+ // A ticket's short name on the line of the lock, whatever its project: its id without the
1197
+ // project's prefix, which the line already names, « bp-mono-vbwf.320.11 » → « vbwf.320.11 »,
1198
+ // « SH-ae6.5 » → « ae6.5 ».
1199
+ const courtDuTicket = id => id.slice(id.lastIndexOf('-') + 1);
1147
1200
  // The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
1148
1201
  // discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
1149
1202
  // ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
@@ -1215,36 +1268,54 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1215
1268
  const droite = plusieurs ? (a.id ?? a.numero) : a.numero;
1216
1269
  L(
1217
1270
  droite
1218
- ? cadre(`⚠ ${duProjet(a)}${a.sujet}`, droite, largeur)
1219
- : cadre(`⚠ ${duProjet(a)}${a.texte}`, '', largeur),
1271
+ ? cadre(`${signeDe(a)} ${duProjet(a)}${a.sujet}`, droite, largeur)
1272
+ : cadre(`${signeDe(a)} ${duProjet(a)}${a.texte}`, '', largeur),
1220
1273
  a.niveau === 'rouge' ? 'alerte' : 'attention'
1221
1274
  );
1222
1275
  }
1223
1276
 
1224
1277
  L('', undefined);
1225
1278
  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.
1279
+ // The lock of the machine (scripts/avancement.mjs `lireLaMesure`), at the head: its holder,
1280
+ // whoever it is, « 🔒 <sorte> · <projet> · <ticket> · faits/prévus · <durée> », the time since it
1281
+ // took the lock, the ticket and the figures when it has them; past FIGEE without a sign of its
1282
+ // progress « ⚠ <sorte> figée <durée> · <projet> · <ticket> · faits/prévus », in the tone of an
1283
+ // alert. Then each wait, the oldest first, « ⏳ <sorte> · <projet> · <ticket> · attend ·
1284
+ // <durée> ». The project and the ticket are cut, never the figures nor the time.
1230
1285
  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}` : '';
1286
+ // The places of the machine (scripts/places-de-la-machine.mjs), the first line of AGENTS:
1287
+ // « Places 3/3 · charge 11,2/12 · mémoire 9 Go », the places taken of the ceiling, the load over
1288
+ // one minute of the cores, the free memory.
1289
+ const p = t.places;
1290
+ if (p) {
1291
+ const nb = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.', ','));
1292
+ poser({
1293
+ texte: cadre(
1294
+ `Places ${p.prises}/${p.plafond} · charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo} Go`,
1295
+ '',
1296
+ largeur
1297
+ ),
1298
+ ton: p.charge >= p.coeurs ? 'attention' : 'discret',
1299
+ });
1300
+ }
1301
+ const deQui = x => `${x.sorte} · ${x.projet}${x.ticket ? ` · ${courtDuTicket(x.ticket)}` : ''}`;
1302
+ const tenu = t.machine?.detenteur;
1303
+ if (tenu) {
1304
+ const a = tenu.avancement;
1305
+ const age = a ? maintenant - a.dernier : 0;
1306
+ const compte = a && (a.faits || a.prevus) ? `${a.faits}/${a.prevus}` : '';
1235
1307
  const fige = age > FIGEE;
1236
- const quoi = m.depot;
1237
1308
  poser({
1238
1309
  texte: fige
1239
1310
  ? couperAvant(
1240
- `⚠ Mesure figée ${ilYa(age)} · ${quoi}`,
1311
+ `⚠ ${tenu.sorte} figée ${ilYa(age)} · ${deQui(tenu).slice(tenu.sorte.length + 3)}`,
1241
1312
  compte ? ` · ${compte}` : '',
1242
1313
  '',
1243
1314
  largeur
1244
1315
  )
1245
1316
  : couperAvant(
1246
- `⏳ Mesure · ${quoi}`,
1247
- ` · ${compte ? `${compte} · ` : ''}${ilYa(maintenant - (m.debut || m.dernier))}`,
1317
+ `🔒 ${deQui(tenu)}`,
1318
+ ` · ${compte ? `${compte} · ` : ''}${ilYa(maintenant - (tenu.depuis ?? maintenant))}`,
1248
1319
  '',
1249
1320
  largeur
1250
1321
  ),
@@ -1252,14 +1323,33 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1252
1323
  avancement: true,
1253
1324
  });
1254
1325
  }
1326
+ for (const w of [...(t.machine?.attentes ?? [])].sort((x, y) => x.depuis - y.depuis)) {
1327
+ poser({
1328
+ texte: couperAvant(
1329
+ `⏳ ${deQui(w)}`,
1330
+ ` · attend · ${ilYa(maintenant - w.depuis)}`,
1331
+ '',
1332
+ largeur
1333
+ ),
1334
+ ton: 'actif',
1335
+ avancement: true,
1336
+ });
1337
+ }
1338
+ // The tickets whose circuit waits for the lock or for room.
1339
+ const enAttente = new Set((t.machine?.attentes ?? []).map(w => w.ticket).filter(Boolean));
1340
+ // The tickets whose circuit waits for a place of the machine.
1341
+ const attendUnePlace = new Set((p?.attentes ?? []).map(w => w.ticket).filter(Boolean));
1342
+ for (const id of attendUnePlace) {
1343
+ enAttente.add(id);
1344
+ }
1255
1345
  // The tree of the steps (scripts/etapes.mjs), in its order, as a pipeline of GitLab CI shows its
1256
1346
  // stages and folds the jobs of a stage that has nothing: a step with sub-steps is folded
1257
1347
  // (« ▸ 2 · Composants ») while none of them holds a ticket, unfolded (« ▾ ») once one does, all
1258
1348
  // its sub-steps then shown, indented, the empty ones in the discreet tone; a step without
1259
1349
  // sub-steps stands on one line « number · title · who », discreet when empty, a title with its
1260
1350
  // 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
1351
+ // else in AGENTS: the work on the plan at its step; waiting for the supervisor
1352
+ // (`attendLeSuperviseur`), under its step after a line « ⤷ Question · <qui> », who
1263
1353
  // must answer it, the supervisor or the owner, which unfolds the step, its counters those of its
1264
1354
  // step; a stopped circuit at no step of the list stands under that line after the steps. A
1265
1355
  // circuit's line gives its subject (`texte`), then the counters of the bounded loops of its step
@@ -1284,8 +1374,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1284
1374
  // The block of the circuits at no step of the list, after the steps.
1285
1375
  const ailleurs = { numero: null, titre: '', qui: '', enCours: [], attend: [] };
1286
1376
  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);
1377
+ // A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
1378
+ // its question, the supervisor when its stop names no one.
1379
+ const enQuestion = c => (attendLeSuperviseur(c) ? (c.qui ?? SUPERVISEUR) : null);
1289
1380
  const blocDuCircuit = c => {
1290
1381
  const e = etapeDe(c);
1291
1382
  return e ? blocDe(e) : !c.vivant ? ailleurs : undefined;
@@ -1305,7 +1396,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1305
1396
  const droiteDe = (signe, droite) =>
1306
1397
  plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
1307
1398
  const ligneDuCircuit = c => {
1308
- const signe = c.vivant ? '▶' : '■';
1399
+ const signe = !c.vivant ? '⏸' : enAttente.has(c.id) ? '⏳' : '▶';
1309
1400
  const droite = droiteDe(
1310
1401
  signe,
1311
1402
  conso(t.parTicket?.[c.id]?.travail ?? 0, t.parTicket?.[c.id]?.jetons ?? 0)
@@ -1319,12 +1410,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1319
1410
  const temoin = c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null;
1320
1411
  // The progress after the counters of the loops while the subject keeps its room beside them,
1321
1412
  // in their place otherwise.
1322
- const reste = avec => largeur - (droite ? droite.length + 1 : 0) - tete.length - avec.length;
1323
- const suite = !temoin
1324
- ? boucles
1325
- : reste(`${boucles}${temoin.texte}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
1326
- ? `${boucles}${temoin.texte}`
1327
- : temoin.texte;
1413
+ const reste = avec =>
1414
+ largeur - (droite ? colonnes(droite) + 1 : 0) - colonnes(tete) - colonnes(avec);
1415
+ const place = attendUnePlace.has(c.id) ? ' · attend une place' : '';
1416
+ const suite = `${
1417
+ !temoin
1418
+ ? boucles
1419
+ : reste(`${boucles}${temoin.texte}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
1420
+ ? `${boucles}${temoin.texte}`
1421
+ : temoin.texte
1422
+ }${place}`;
1328
1423
  poser({
1329
1424
  texte: couperAvant(`${tete}${c.sujet}`, suite, droite, largeur),
1330
1425
  ton: temoin?.fige ? 'alerte' : c.vivant ? 'actif' : 'attention',
@@ -1598,14 +1693,14 @@ export function lignesEtats(t, largeur = LARGEUR) {
1598
1693
  return out;
1599
1694
  }
1600
1695
 
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).
1696
+ // Where the stopped circuit <c> is: its step by number and title, its attempt, and its stop, with
1697
+ // its code when it has one.
1603
1698
  const ouEnEst = c => {
1604
1699
  const e = etapeDuCircuit({ ...c, raison: c.arret });
1605
1700
  const ou = [e ? libelle(e) : c.etape, c.tentative ?? null]
1606
1701
  .filter(x => x !== null && x !== undefined)
1607
1702
  .join(' ');
1608
- const arret = c.code === null ? 'interrompu' : `arrêt ${c.arret ?? '?'} (${c.code})`;
1703
+ const arret = `arrêt ${c.arret ?? '?'}${c.code === null ? '' : ` (${c.code})`}`;
1609
1704
  return `${ou}, ${arret}`;
1610
1705
  };
1611
1706
 
@@ -1623,6 +1718,7 @@ export function fiches(
1623
1718
  bilans = {}
1624
1719
  ) {
1625
1720
  const arretes = new Map(circuits.filter(c => !c.vivant).map(c => [c.ticket, c]));
1721
+ const liens = new Map(circuits.filter(c => c.lien).map(c => [c.ticket, c.lien]));
1626
1722
  const ids = new Set(lignesDuTableau.map(l => l.ticket).filter(Boolean));
1627
1723
  const out = {};
1628
1724
  for (const t of tous) {
@@ -1635,15 +1731,20 @@ export function fiches(
1635
1731
  .filter(x => x && !x.startsWith('#'))
1636
1732
  .join(' ');
1637
1733
  // A stopped circuit's card opens on its question and who must answer it, or on where it
1638
- // stopped and why.
1734
+ // stopped and why; a circuit whose workflow ended without its issue, on the answers the client
1735
+ // accepts (`reponse`), named once.
1639
1736
  const a = arretes.get(t.id);
1737
+ const reprise = a?.sansIssue && a.reponse ? ` \`${a.reponse}\` le reprend.` : '';
1640
1738
  const tete = a?.question
1641
- ? `Question · ${a.qui ?? SUPERVISEUR} : ${a.question.replace(/\s+/g, ' ')} `
1739
+ ? `Question · ${a.qui ?? SUPERVISEUR} : ${a.question.replace(/\s+/g, ' ')}${reprise} `
1642
1740
  : a
1643
1741
  ? `Circuit arrêté en ${ouEnEst(a)} : ${a.raison ?? 'le circuit ne tourne plus'} `
1644
1742
  : '';
1645
1743
  const chiffres = bilans[t.id] ? `${enBref(bilans[t.id])} ` : '';
1646
1744
  const texte = `${tete}${chiffres}${resume}`;
1745
+ // The card of a ticket with a circuit ends on the page of its workflow on the web UI of the
1746
+ // server, whole, after the text.
1747
+ const lien = liens.has(t.id) ? `\nTemporal : ${liens.get(t.id)}` : '';
1647
1748
  out[t.id] = {
1648
1749
  numero: lecture(t, prefix).numero,
1649
1750
  titre: lecture(t, prefix).sujet,
@@ -1651,7 +1752,7 @@ export function fiches(
1651
1752
  statut: t.status,
1652
1753
  travail: mesures[t.id]?.travail ?? 0,
1653
1754
  jetons: mesures[t.id]?.jetons ?? 0,
1654
- resume: texte.length > 400 ? `${texte.slice(0, 399)}…` : texte,
1755
+ resume: `${texte.length > 400 ? `${texte.slice(0, 399)}…` : texte}${lien}`,
1655
1756
  };
1656
1757
  }
1657
1758
  return out;
@@ -1686,9 +1787,20 @@ export function dernierBouge(tous, lignesDuTableau, vivants = [], maintenant = D
1686
1787
  return dernier;
1687
1788
  }
1688
1789
 
1689
- // The status line: the chantier in progress, alerts first.
1790
+ // The status line: the chantier in progress; first the alerts, counted by their signs as the board
1791
+ // shows them (🌙, 💤, ⚠), then the holder of the lock of the machine, « 🔒 <sorte> · <projet> »,
1792
+ // and the count of its waits, « ⏳ <n> ».
1690
1793
  export function ligneEtat(t) {
1691
- const alerte = t.alertes.length ? `⚠ ${t.alertes.length} · ` : '';
1794
+ const signes = t.alertes.map(signeDe);
1795
+ const tenu = t.machine?.detenteur;
1796
+ const attentes = t.machine?.attentes?.length ?? 0;
1797
+ const alerte = [
1798
+ ...[...new Set(signes)].map(s => `${s} ${signes.filter(x => x === s).length}`),
1799
+ ...(tenu ? [`🔒 ${tenu.sorte} · ${tenu.projet}`] : []),
1800
+ ...(attentes ? [`⏳ ${attentes}`] : []),
1801
+ ]
1802
+ .map(x => `${x} · `)
1803
+ .join('');
1692
1804
  const ch = t.chantiers[0];
1693
1805
  const c = t.global.compteurs;
1694
1806
  if (!ch) {
@@ -1712,9 +1824,13 @@ const bdJson = (racine, ...args) => {
1712
1824
  }
1713
1825
  };
1714
1826
 
1715
- // What the board reads of the repository at <racine>: its tickets, its prefix, its running agents
1716
- // and its assembled board (`t`), with the folder git keeps its shared files in (`commun`).
1717
- function lire(racine, { home, maintenant, horsTicket = null }) {
1827
+ // What the board reads of the repository at <racine>, its circuits <circuits> read: its tickets,
1828
+ // its prefix, its running agents and its assembled board (`t`), with the folder git keeps its
1829
+ // shared files in (`commun`).
1830
+ function lire(
1831
+ racine,
1832
+ { home, maintenant, circuits, muet = false, faute = null, machine = null, places = null }
1833
+ ) {
1718
1834
  let prefix = '';
1719
1835
  try {
1720
1836
  prefix = execFileSync('bd', ['config', 'get', 'issue_prefix'], {
@@ -1779,7 +1895,6 @@ function lire(racine, { home, maintenant, horsTicket = null }) {
1779
1895
  ps,
1780
1896
  cache,
1781
1897
  });
1782
- const circuits = lireCircuits({ racine });
1783
1898
  try {
1784
1899
  if (fichierCache) {
1785
1900
  writeFileSync(
@@ -1801,11 +1916,26 @@ function lire(racine, { home, maintenant, horsTicket = null }) {
1801
1916
  verdicts,
1802
1917
  maintenant,
1803
1918
  jour: minuit.getTime(),
1804
- horsTicket,
1919
+ machine,
1920
+ places,
1921
+ muet,
1922
+ faute,
1923
+ outil: echecDeLOutil(racine),
1805
1924
  });
1806
1925
  return { t, prefix, tous, vivants, commun };
1807
1926
  }
1808
1927
 
1928
+ // The places of the machine as the board shows them (`etatDesPlaces`), null when they do not read
1929
+ // (a faulty GRILLHOUSE_PLACES, a server of the places that does not answer): the board then shows
1930
+ // no line of places.
1931
+ function lireLesPlaces() {
1932
+ try {
1933
+ return etatDesPlaces();
1934
+ } catch {
1935
+ return null;
1936
+ }
1937
+ }
1938
+
1809
1939
  // The boards of several projects as one (grillhouse-erp.1), as the multi-root explorer of VS Code
1810
1940
  // keeps one view and files each root under its name: <lus> holds each project's label
1811
1941
  // (`etiquette`, its ticket prefix) and its board (`t`) or the fault that keeps it out (`erreur`),
@@ -1836,7 +1966,8 @@ export function ensemble(lus) {
1836
1966
  return { ...b, enCours: de('enCours'), attend: de('attend') };
1837
1967
  }),
1838
1968
  maintenant: premier.t.maintenant,
1839
- horsTicket: premier.t.horsTicket,
1969
+ machine: premier.t.machine,
1970
+ places: premier.t.places,
1840
1971
  faitsDuJour: tous('faitsDuJour'),
1841
1972
  etats: premier.t.etats.map(e => ({
1842
1973
  ...e,
@@ -1850,29 +1981,98 @@ export function ensemble(lus) {
1850
1981
 
1851
1982
  // A project beside the session's, read in its folder <dossier>: its board, or the fault that keeps
1852
1983
  // it out, on one line.
1853
- function lireUnAutre(dossier, o) {
1984
+ async function lireUnAutre(dossier, { circuitsDe, ...o }) {
1854
1985
  try {
1855
1986
  if (!existsSync(dossier)) {
1856
1987
  throw new Error('dossier introuvable');
1857
1988
  }
1858
- return { dossier, ...lire(dossier, o) };
1989
+ return {
1990
+ dossier,
1991
+ ...lire(dossier, { ...o, circuits: (await lesCircuits(circuitsDe, dossier)).circuits }),
1992
+ };
1859
1993
  } catch (e) {
1860
1994
  return { dossier, erreur: String(e.message ?? e).split('\n')[0] };
1861
1995
  }
1862
1996
  }
1863
1997
 
1998
+ // The circuits of the repository at <racine> by the reader <circuitsDe>; none when the reading
1999
+ // fails, the board shows the rest: the server stayed silent (`muet`, `ServeurMuet`), or another
2000
+ // fault, a client not built among them, by the first line of its message (`faute`).
2001
+ async function lesCircuits(circuitsDe, racine) {
2002
+ try {
2003
+ return { circuits: await circuitsDe(racine), muet: false, faute: null };
2004
+ } catch (e) {
2005
+ const muet = e instanceof ServeurMuet;
2006
+ return { circuits: [], muet, faute: muet ? null : String(e?.message ?? e).split('\n')[0] };
2007
+ }
2008
+ }
2009
+
2010
+ /**
2011
+ * The lock of the machine <machine> with each project named as the board names it: <noms> gives
2012
+ * the name of each project of the board by the root of its main tree (`depot`); a project out of
2013
+ * the board keeps its folder's name.
2014
+ * @param {Machine | null} machine
2015
+ * @param {Map<string, string>} noms
2016
+ * @returns {Machine | null}
2017
+ */
2018
+ export function nommerLesProjets(machine, noms) {
2019
+ if (!machine) {
2020
+ return machine;
2021
+ }
2022
+ const nommer = x => ({ ...x, projet: (x.depot && noms.get(x.depot)) || x.projet });
2023
+ return {
2024
+ detenteur: machine.detenteur && nommer(machine.detenteur),
2025
+ attentes: machine.attentes.map(nommer),
2026
+ };
2027
+ }
2028
+
1864
2029
  // The board of the repository at <racine>; with <projets>, the folders of other projects, the
1865
2030
  // board of them all (`ensemble`), named « <dépôt> + <projet> + … », with the folder of each
1866
2031
  // ticket's project (`dossiers`), where the pane runs Beads for it. The status line is the
1867
- // session's project's alone.
1868
- export function tableau(
2032
+ // session's project's alone. Each project's circuits are read by <circuitsDe> (one call to the
2033
+ // Temporal server, scripts/circuits-du-serveur.mjs, by default).
2034
+ /**
2035
+ * @param {string} racine
2036
+ * @param {{ home?: string, maintenant?: number, projets?: string[],
2037
+ * circuitsDe?: (racine: string) => Promise<object[]> }} [o]
2038
+ */
2039
+ export async function tableau(
1869
2040
  racine,
1870
- { home = os.homedir(), maintenant = Date.now(), projets = [] } = {}
2041
+ {
2042
+ home = os.homedir(),
2043
+ maintenant = Date.now(),
2044
+ projets = [],
2045
+ circuitsDe = circuitsDuServeur,
2046
+ } = {}
1871
2047
  ) {
2048
+ const [{ circuits, muet, faute }, ...autres] = await Promise.all([
2049
+ lesCircuits(circuitsDe, racine),
2050
+ ...projets.map(d => lireUnAutre(d, { home, maintenant, circuitsDe })),
2051
+ ]);
1872
2052
  const ici = {
1873
2053
  dossier: racine,
1874
- ...lire(racine, { home, maintenant, horsTicket: lireLaMesure(process.env) }),
2054
+ ...lire(racine, {
2055
+ home,
2056
+ maintenant,
2057
+ circuits,
2058
+ muet,
2059
+ faute,
2060
+ machine: lireLaMesure(process.env),
2061
+ places: lireLesPlaces(),
2062
+ }),
1875
2063
  };
2064
+ const lus = [ici, ...autres];
2065
+ const etiquette = l => l.prefix || path.basename(l.dossier);
2066
+ // The lock of the machine names each project of the board as the board does: the session's by
2067
+ // its folder, another by its label; the root of its main tree, its common git directory's parent.
2068
+ ici.t.machine = nommerLesProjets(
2069
+ ici.t.machine,
2070
+ new Map(
2071
+ lus
2072
+ .filter(l => l.commun)
2073
+ .map(l => [path.dirname(l.commun), l === ici ? path.basename(racine) : etiquette(l)])
2074
+ )
2075
+ );
1876
2076
  const etat = ligneEtat(ici.t);
1877
2077
  try {
1878
2078
  if (ici.commun) {
@@ -1881,8 +2081,6 @@ export function tableau(
1881
2081
  } catch {
1882
2082
  // A read-only place keeps the board working, without its status line.
1883
2083
  }
1884
- const lus = [ici, ...projets.map(d => lireUnAutre(d, { home, maintenant }))];
1885
- const etiquette = l => l.prefix || path.basename(l.dossier);
1886
2084
  const t = projets.length
1887
2085
  ? ensemble(lus.map(l => ({ etiquette: etiquette(l), t: l.t, erreur: l.erreur })))
1888
2086
  : ici.t;
@@ -1926,10 +2124,11 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
1926
2124
  .slice(2)
1927
2125
  .filter(a => a !== '--texte')
1928
2126
  .map(d => path.resolve(d));
1929
- const t = tableau(process.cwd(), { projets });
1930
- process.stdout.write(
1931
- process.argv.includes('--texte')
1932
- ? `${t.lignes.map(l => l.texte).join('\n')}\n`
1933
- : JSON.stringify(t)
2127
+ void tableau(process.cwd(), { projets }).then(t =>
2128
+ process.stdout.write(
2129
+ process.argv.includes('--texte')
2130
+ ? `${t.lignes.map(l => l.texte).join('\n')}\n`
2131
+ : JSON.stringify(t)
2132
+ )
1934
2133
  );
1935
2134
  }