@roomi-fields/grillhouse 0.29.0 → 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 (222) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +79 -18
  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/docs/agents/issue-tracker.md +1 -1
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +24 -0
  9. package/dist/temporal/acte.d.ts +24 -0
  10. package/dist/temporal/acte.js +139 -0
  11. package/dist/temporal/acte.js.map +1 -0
  12. package/dist/temporal/attributs.d.ts +6 -0
  13. package/dist/temporal/attributs.js +15 -0
  14. package/dist/temporal/attributs.js.map +1 -0
  15. package/dist/temporal/circuit/activites.d.ts +13 -0
  16. package/dist/temporal/circuit/activites.js +33 -0
  17. package/dist/temporal/circuit/activites.js.map +1 -0
  18. package/dist/temporal/circuit/client.d.ts +72 -0
  19. package/dist/temporal/circuit/client.js +247 -0
  20. package/dist/temporal/circuit/client.js.map +1 -0
  21. package/dist/temporal/circuit/commande.d.ts +2 -0
  22. package/dist/temporal/circuit/commande.js +238 -0
  23. package/dist/temporal/circuit/commande.js.map +1 -0
  24. package/dist/temporal/circuit/contrat.d.ts +305 -0
  25. package/dist/temporal/circuit/contrat.js +24 -0
  26. package/dist/temporal/circuit/contrat.js.map +1 -0
  27. package/dist/temporal/circuit/deroule.d.ts +3 -0
  28. package/dist/temporal/circuit/deroule.js +540 -0
  29. package/dist/temporal/circuit/deroule.js.map +1 -0
  30. package/dist/temporal/client.d.ts +47 -0
  31. package/dist/temporal/client.js +69 -0
  32. package/dist/temporal/client.js.map +1 -0
  33. package/dist/temporal/commande.d.ts +2 -0
  34. package/dist/temporal/commande.js +95 -0
  35. package/dist/temporal/commande.js.map +1 -0
  36. package/dist/temporal/deroules.d.ts +5 -0
  37. package/dist/temporal/deroules.js +10 -0
  38. package/dist/temporal/deroules.js.map +1 -0
  39. package/dist/temporal/etat.d.ts +33 -0
  40. package/dist/temporal/etat.js +59 -0
  41. package/dist/temporal/etat.js.map +1 -0
  42. package/dist/temporal/file/activites.d.ts +10 -0
  43. package/dist/temporal/file/activites.js +25 -0
  44. package/dist/temporal/file/activites.js.map +1 -0
  45. package/dist/temporal/file/client.d.ts +4 -0
  46. package/dist/temporal/file/client.js +6 -0
  47. package/dist/temporal/file/client.js.map +1 -0
  48. package/dist/temporal/file/contrat.d.ts +158 -0
  49. package/dist/temporal/file/contrat.js +14 -0
  50. package/dist/temporal/file/contrat.js.map +1 -0
  51. package/dist/temporal/file/deroule.d.ts +15 -0
  52. package/dist/temporal/file/deroule.js +235 -0
  53. package/dist/temporal/file/deroule.js.map +1 -0
  54. package/dist/temporal/installation.d.ts +124 -0
  55. package/dist/temporal/installation.js +408 -0
  56. package/dist/temporal/installation.js.map +1 -0
  57. package/dist/temporal/places/activites.d.ts +8 -0
  58. package/dist/temporal/places/activites.js +13 -0
  59. package/dist/temporal/places/activites.js.map +1 -0
  60. package/dist/temporal/places/client.d.ts +28 -0
  61. package/dist/temporal/places/client.js +64 -0
  62. package/dist/temporal/places/client.js.map +1 -0
  63. package/dist/temporal/places/contrat.d.ts +106 -0
  64. package/dist/temporal/places/contrat.js +21 -0
  65. package/dist/temporal/places/contrat.js.map +1 -0
  66. package/dist/temporal/places/deroule.d.ts +3 -0
  67. package/dist/temporal/places/deroule.js +198 -0
  68. package/dist/temporal/places/deroule.js.map +1 -0
  69. package/dist/temporal/sonde/activites.d.ts +6 -0
  70. package/dist/temporal/sonde/activites.js +52 -0
  71. package/dist/temporal/sonde/activites.js.map +1 -0
  72. package/dist/temporal/sonde/contrat.d.ts +35 -0
  73. package/dist/temporal/sonde/contrat.js +10 -0
  74. package/dist/temporal/sonde/contrat.js.map +1 -0
  75. package/dist/temporal/sonde/deroule.d.ts +3 -0
  76. package/dist/temporal/sonde/deroule.js +39 -0
  77. package/dist/temporal/sonde/deroule.js.map +1 -0
  78. package/dist/temporal/tickets/activites.d.ts +7 -0
  79. package/dist/temporal/tickets/activites.js +81 -0
  80. package/dist/temporal/tickets/activites.js.map +1 -0
  81. package/dist/temporal/tickets/client.d.ts +10 -0
  82. package/dist/temporal/tickets/client.js +31 -0
  83. package/dist/temporal/tickets/client.js.map +1 -0
  84. package/dist/temporal/tickets/contrat.d.ts +56 -0
  85. package/dist/temporal/tickets/contrat.js +13 -0
  86. package/dist/temporal/tickets/contrat.js.map +1 -0
  87. package/dist/temporal/tickets/deroule.d.ts +3 -0
  88. package/dist/temporal/tickets/deroule.js +94 -0
  89. package/dist/temporal/tickets/deroule.js.map +1 -0
  90. package/dist/temporal/travailleur.d.ts +2 -0
  91. package/dist/temporal/travailleur.js +69 -0
  92. package/dist/temporal/travailleur.js.map +1 -0
  93. package/docs/ARCHITECTURE.md +609 -80
  94. package/docs/CADRE.md +17 -0
  95. package/docs/INTERFACE.md +134 -42
  96. package/hooks/crochet.mjs +19 -2
  97. package/hooks/hooks.json +11 -0
  98. package/package.json +16 -4
  99. package/scripts/activites.mjs +2182 -0
  100. package/scripts/aiguillage.d.mts +37 -0
  101. package/scripts/aiguillage.mjs +7 -3
  102. package/scripts/avancement.mjs +128 -16
  103. package/scripts/bilan.mjs +37 -19
  104. package/scripts/cadre.mjs +11 -2
  105. package/scripts/circuit.mjs +881 -4059
  106. package/scripts/circuits-cles.d.mts +4 -0
  107. package/scripts/circuits-cles.mjs +21 -0
  108. package/scripts/circuits-du-serveur.mjs +105 -0
  109. package/scripts/codes-de-sortie.mjs +9 -0
  110. package/scripts/commandes-composees.mjs +45 -41
  111. package/scripts/commandes-du-path.d.mts +7 -0
  112. package/scripts/commandes-du-path.mjs +25 -0
  113. package/scripts/composition-des-langages.mjs +16 -12
  114. package/scripts/conformite.mjs +6 -13
  115. package/scripts/copies-finies.mjs +52 -47
  116. package/scripts/depart-du-ticket.d.mts +53 -0
  117. package/scripts/depart-du-ticket.mjs +124 -0
  118. package/scripts/dependances-internes.mjs +115 -0
  119. package/scripts/dernier-vert.mjs +7 -15
  120. package/scripts/donnees-cles.mjs +228 -0
  121. package/scripts/droits.mjs +11 -1
  122. package/scripts/effets.mjs +352 -0
  123. package/scripts/enveloppe/enveloppe.mjs +119 -8
  124. package/scripts/enveloppe/lancer.sh +14 -18
  125. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  126. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -1
  127. package/scripts/etapes.mjs +5 -2
  128. package/scripts/faits-du-circuit.mjs +493 -0
  129. package/scripts/file-des-tickets.d.mts +21 -0
  130. package/scripts/file-des-tickets.mjs +58 -0
  131. package/scripts/flux-des-paquets.mjs +187 -0
  132. package/scripts/gardes-du-cadre.mjs +12 -2
  133. package/scripts/integration/file.mjs +475 -420
  134. package/scripts/integration/integrer.mjs +17 -19
  135. package/scripts/integration/rejeu.mjs +19 -4
  136. package/scripts/jointure.d.ts +145 -27
  137. package/scripts/langages/cargo/commandes.mjs +289 -109
  138. package/scripts/langages/cargo/composants.mjs +130 -34
  139. package/scripts/langages/cargo/exemples.mjs +12 -21
  140. package/scripts/langages/cargo/index.mjs +18 -8
  141. package/scripts/langages/cargo/sccache.mjs +8 -14
  142. package/scripts/langages/python/commandes.mjs +216 -100
  143. package/scripts/langages/python/composants.mjs +53 -21
  144. package/scripts/langages/python/exemples.mjs +6 -16
  145. package/scripts/langages/python/index.mjs +24 -8
  146. package/scripts/langages/python/lot.mjs +1 -36
  147. package/scripts/langages/typescript/construire.mjs +6 -163
  148. package/scripts/langages/typescript/exemples.mjs +3 -11
  149. package/scripts/langages/typescript/frontieres.mjs +1 -1
  150. package/scripts/langages/typescript/index.mjs +43 -61
  151. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  152. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  153. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  154. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  155. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  156. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  157. package/scripts/langages/typescript/tests-de-nuit.mjs +12 -9
  158. package/scripts/langages/typescript/tests.mjs +17 -8
  159. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  160. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  161. package/scripts/langages/typescript/verdict.mjs +1 -1
  162. package/scripts/langages/typescript/verifier.mjs +31 -11
  163. package/scripts/langages/typescript/vitest-config/base.mjs +22 -1
  164. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  165. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  166. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  167. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  168. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  169. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +49 -63
  170. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +3 -0
  171. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  172. package/scripts/mesure/pression.mjs +3 -3
  173. package/scripts/mesure-de-la-machine.d.mts +21 -0
  174. package/scripts/mesure-de-la-machine.mjs +76 -0
  175. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  176. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  177. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  178. package/scripts/migrations.mjs +5 -0
  179. package/scripts/nuit.sh +10 -3
  180. package/scripts/outils-cles.d.mts +24 -0
  181. package/scripts/outils-cles.mjs +0 -1
  182. package/scripts/paquet-npm.mjs +147 -0
  183. package/scripts/paquet.mjs +73 -4
  184. package/scripts/paquets.mjs +34 -6
  185. package/scripts/passe-de-la-machine.mjs +66 -0
  186. package/scripts/places-de-la-machine.mjs +360 -0
  187. package/scripts/places-du-serveur.mjs +170 -0
  188. package/scripts/prefixe-des-tickets.mjs +68 -0
  189. package/scripts/preparation.mjs +10 -3
  190. package/scripts/registre.mjs +3 -2
  191. package/scripts/regles-des-places.d.mts +36 -0
  192. package/scripts/regles-des-places.mjs +70 -0
  193. package/scripts/reponses-du-circuit.d.mts +6 -0
  194. package/scripts/reponses-du-circuit.mjs +28 -0
  195. package/scripts/resultats.mjs +7 -9
  196. package/scripts/retirer-les-copies-finies.mjs +25 -0
  197. package/scripts/sans-reponse.d.mts +4 -0
  198. package/scripts/sans-reponse.mjs +13 -0
  199. package/scripts/seances.mjs +918 -0
  200. package/scripts/services-du-noyau.mjs +26 -8
  201. package/scripts/session-start.sh +2 -2
  202. package/scripts/sortie.mjs +3 -3
  203. package/scripts/sous-commandes.mjs +38 -9
  204. package/scripts/style-a-l-ecriture.mjs +229 -0
  205. package/scripts/superviseur.mjs +122 -111
  206. package/scripts/tableau.mjs +148 -110
  207. package/scripts/taches-du-graphe.mjs +328 -0
  208. package/scripts/ticket-du-circuit.mjs +206 -0
  209. package/scripts/transitions.d.mts +148 -0
  210. package/scripts/transitions.mjs +901 -0
  211. package/scripts/verrou-de-fichier.mjs +2 -2
  212. package/scripts/verrou-de-machine.mjs +28 -13
  213. package/skills/explorateur/SKILL.md +2 -1
  214. package/skills/pitmaster/SKILL.md +17 -18
  215. package/skills/pitmaster/references/consigne-agent.md +5 -1
  216. package/skills/release/SKILL.md +3 -3
  217. package/skills/relecteur/SKILL.md +4 -2
  218. package/skills/testwriter/SKILL.md +36 -24
  219. package/scripts/demon.mjs +0 -251
  220. package/scripts/integration/file-attente.mjs +0 -61
  221. package/scripts/langages/cargo/touches.mjs +0 -93
  222. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -19,15 +19,15 @@
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); 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
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
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
30
+ // supervisor when it names no question; its card opens on that question, or on the stop
31
31
  // (its name and code) and the first line of its reason. A ticket with a circuit waits in no
32
32
  // block.
33
33
  // - Bilans: the card of a ticket whose circuit kept its bilan (scripts/bilan.mjs,
@@ -73,7 +73,7 @@
73
73
  // machine), « 🔒 <sorte> · <projet> · <ticket> · faits/prévus · <durée> » since it took the
74
74
  // lock, « ⚠ <sorte> figée <durée> · … » past FIGEE without a sign of its progress; then each
75
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
76
+ // <projet> · <ticket> · attend · <durée> ». The ticket shows without its prefix
77
77
  // (`courtDuTicket`). Such a line is marked `avancement`, which the pane measures again more
78
78
  // often. A circuit that waits shows ⏳ on its ticket's line, ▶ while it waits for nothing.
79
79
  // - Signs: each sign keeps one sense (the owner's decision of 2026-11-01): ▶ in progress, ⏸ a
@@ -114,8 +114,9 @@ import {
114
114
  import { echecDeLOutil } from './aiguillage.mjs';
115
115
  import { bilansGardes, enBref } from './bilan.mjs';
116
116
  import { verdictDe } from './integration/verdict.mjs';
117
- import { lireAvancement, lireLaMesure } from './avancement.mjs';
118
- 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';
119
120
 
120
121
  const MINUTE = 60_000;
121
122
  export const SILENCE = 10 * MINUTE;
@@ -597,66 +598,11 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
597
598
  return vivants;
598
599
  }
599
600
 
600
- // The circuits of the repository at <racine>: each state `.claude/worktrees/<ticket>.circuit.json`
601
- // scripts/circuit.mjs writes, but those at « integre », with `vivant` when the process its state
602
- // names lives (`processus`, the same one by its start `depart`: a circuit is a daemon, apart from
603
- // the command that launched it), `questionnement` the object of the work on the plan
604
- // under way (`plan`), null without one, `question` the whole question of a circuit ended on one
605
- // and `qui` who must answer it (`superviseur` or `responsable`), null without one,
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
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.
613
- export function lireCircuits({ racine }) {
614
- const dossier = path.join(racine, '.claude', 'worktrees');
615
- const out = [];
616
- for (const f of fichiers(dossier, '.circuit.json')) {
617
- let e;
618
- try {
619
- e = JSON.parse(readFileSync(f, 'utf8'));
620
- } catch {
621
- continue;
622
- }
623
- if (!e || e.etape === 'integre') {
624
- continue;
625
- }
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;
629
- out.push({
630
- ticket,
631
- etape: e.etape ?? null,
632
- tentative: e.tentative ?? null,
633
- finale: e.finale === true,
634
- code: e.code ?? null,
635
- arret: e.raison ?? null,
636
- raison: premiereLigne(e.rapport),
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,
641
- questionnement: e.questionnement?.objet ?? null,
642
- boucles: e.boucles && typeof e.boucles === 'object' ? e.boucles : {},
643
- mene:
644
- typeof e.mene === 'string' && !Number.isNaN(Date.parse(e.mene)) ? Date.parse(e.mene) : null,
645
- avancement:
646
- typeof e.avancement?.dossier === 'string' ? lireAvancement(e.avancement.dossier) : null,
647
- vivant,
648
- interrompu,
649
- processus: e.processus ?? null,
650
- depart: e.depart ?? null,
651
- });
652
- }
653
- return out;
654
- }
655
-
656
601
  /**
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
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
660
606
  * one rule of the questions that wait for the supervisor (grillhouse-pq6), which the board reads,
661
607
  * and `questionsEnAttente` of scripts/superviseur.mjs, the one source of the opening and of the
662
608
  * wait of the questions.
@@ -666,13 +612,6 @@ export function lireCircuits({ racine }) {
666
612
  export const attendLeSuperviseur = c =>
667
613
  !c.vivant && Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
668
614
 
669
- // The first line of a report that is not blank, or null.
670
- const premiereLigne = r =>
671
- String(r ?? '')
672
- .split('\n')
673
- .map(x => x.trim())
674
- .find(Boolean) ?? null;
675
-
676
615
  // The reviewer's last verdict among a ticket's comments (verdictDe: a comment of the reviewer's
677
616
  // author), or null.
678
617
  export function verdict(commentaires) {
@@ -743,10 +682,15 @@ export function lecture(t, prefix) {
743
682
  /**
744
683
  * The board, from what was read. Pure: every source comes in, the time included; `machine`, the
745
684
  * lock of the machine; `outil`, the failed installation of the published version that leads the
746
- * repository (scripts/aiguillage.mjs `echecDeLOutil`).
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.
747
689
  * @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[], circuits?: any[],
748
690
  * verdicts?: Record<string, any>, maintenant: number, jour: number,
749
- * machine?: Machine | null, outil?: { version: string, raison: string } | null }} lu
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
750
694
  */
751
695
  export function assembler({
752
696
  tous,
@@ -759,6 +703,9 @@ export function assembler({
759
703
  jour,
760
704
  machine = null,
761
705
  outil = null,
706
+ places: placesDeLaMachine = null,
707
+ muet = false,
708
+ faute = null,
762
709
  }) {
763
710
  // A circuit's lines are its steps, no agent's passage.
764
711
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
@@ -1054,6 +1001,13 @@ export function assembler({
1054
1001
 
1055
1002
  // Alerts.
1056
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
+ }
1057
1011
  // A red night says the night it turned red, short enough to stand whole on its line: the local
1058
1012
  // day and month its ticket was opened, the night's date (scripts/nuit.sh), whatever its title names, a
1059
1013
  // commit in older ones.
@@ -1141,6 +1095,7 @@ export function assembler({
1141
1095
  agents: blocs,
1142
1096
  maintenant,
1143
1097
  machine,
1098
+ places: placesDeLaMachine,
1144
1099
  faitsDuJour,
1145
1100
  etats,
1146
1101
  parTicket,
@@ -1238,13 +1193,10 @@ const couperAvant = (gauche, suite, droite, largeur) => {
1238
1193
  // The sign of the alert <a>: its kind's (`signe`: 🌙 a red night, 💤 a ticket claimed with
1239
1194
  // nothing running), ⚠ for the others.
1240
1195
  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
- };
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);
1248
1200
  // The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
1249
1201
  // discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
1250
1202
  // ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
@@ -1331,6 +1283,21 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1331
1283
  // alert. Then each wait, the oldest first, « ⏳ <sorte> · <projet> · <ticket> · attend ·
1332
1284
  // <durée> ». The project and the ticket are cut, never the figures nor the time.
1333
1285
  const maintenant = t.maintenant ?? Date.now();
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
+ }
1334
1301
  const deQui = x => `${x.sorte} · ${x.projet}${x.ticket ? ` · ${courtDuTicket(x.ticket)}` : ''}`;
1335
1302
  const tenu = t.machine?.detenteur;
1336
1303
  if (tenu) {
@@ -1370,6 +1337,11 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1370
1337
  }
1371
1338
  // The tickets whose circuit waits for the lock or for room.
1372
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
+ }
1373
1345
  // The tree of the steps (scripts/etapes.mjs), in its order, as a pipeline of GitLab CI shows its
1374
1346
  // stages and folds the jobs of a stage that has nothing: a step with sub-steps is folded
1375
1347
  // (« ▸ 2 · Composants ») while none of them holds a ticket, unfolded (« ▾ ») once one does, all
@@ -1440,11 +1412,14 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1440
1412
  // in their place otherwise.
1441
1413
  const reste = avec =>
1442
1414
  largeur - (droite ? colonnes(droite) + 1 : 0) - colonnes(tete) - colonnes(avec);
1443
- const suite = !temoin
1444
- ? boucles
1445
- : reste(`${boucles}${temoin.texte}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
1446
- ? `${boucles}${temoin.texte}`
1447
- : temoin.texte;
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}`;
1448
1423
  poser({
1449
1424
  texte: couperAvant(`${tete}${c.sujet}`, suite, droite, largeur),
1450
1425
  ton: temoin?.fige ? 'alerte' : c.vivant ? 'actif' : 'attention',
@@ -1743,6 +1718,7 @@ export function fiches(
1743
1718
  bilans = {}
1744
1719
  ) {
1745
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]));
1746
1722
  const ids = new Set(lignesDuTableau.map(l => l.ticket).filter(Boolean));
1747
1723
  const out = {};
1748
1724
  for (const t of tous) {
@@ -1755,15 +1731,20 @@ export function fiches(
1755
1731
  .filter(x => x && !x.startsWith('#'))
1756
1732
  .join(' ');
1757
1733
  // A stopped circuit's card opens on its question and who must answer it, or on where it
1758
- // 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.
1759
1736
  const a = arretes.get(t.id);
1737
+ const reprise = a?.sansIssue && a.reponse ? ` \`${a.reponse}\` le reprend.` : '';
1760
1738
  const tete = a?.question
1761
- ? `Question · ${a.qui ?? SUPERVISEUR} : ${a.question.replace(/\s+/g, ' ')} `
1739
+ ? `Question · ${a.qui ?? SUPERVISEUR} : ${a.question.replace(/\s+/g, ' ')}${reprise} `
1762
1740
  : a
1763
1741
  ? `Circuit arrêté en ${ouEnEst(a)} : ${a.raison ?? 'le circuit ne tourne plus'} `
1764
1742
  : '';
1765
1743
  const chiffres = bilans[t.id] ? `${enBref(bilans[t.id])} ` : '';
1766
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)}` : '';
1767
1748
  out[t.id] = {
1768
1749
  numero: lecture(t, prefix).numero,
1769
1750
  titre: lecture(t, prefix).sujet,
@@ -1771,7 +1752,7 @@ export function fiches(
1771
1752
  statut: t.status,
1772
1753
  travail: mesures[t.id]?.travail ?? 0,
1773
1754
  jetons: mesures[t.id]?.jetons ?? 0,
1774
- resume: texte.length > 400 ? `${texte.slice(0, 399)}…` : texte,
1755
+ resume: `${texte.length > 400 ? `${texte.slice(0, 399)}…` : texte}${lien}`,
1775
1756
  };
1776
1757
  }
1777
1758
  return out;
@@ -1843,9 +1824,13 @@ const bdJson = (racine, ...args) => {
1843
1824
  }
1844
1825
  };
1845
1826
 
1846
- // What the board reads of the repository at <racine>: its tickets, its prefix, its running agents
1847
- // and its assembled board (`t`), with the folder git keeps its shared files in (`commun`).
1848
- function lire(racine, { home, maintenant, machine = 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
+ ) {
1849
1834
  let prefix = '';
1850
1835
  try {
1851
1836
  prefix = execFileSync('bd', ['config', 'get', 'issue_prefix'], {
@@ -1910,7 +1895,6 @@ function lire(racine, { home, maintenant, machine = null }) {
1910
1895
  ps,
1911
1896
  cache,
1912
1897
  });
1913
- const circuits = lireCircuits({ racine });
1914
1898
  try {
1915
1899
  if (fichierCache) {
1916
1900
  writeFileSync(
@@ -1933,11 +1917,25 @@ function lire(racine, { home, maintenant, machine = null }) {
1933
1917
  maintenant,
1934
1918
  jour: minuit.getTime(),
1935
1919
  machine,
1920
+ places,
1921
+ muet,
1922
+ faute,
1936
1923
  outil: echecDeLOutil(racine),
1937
1924
  });
1938
1925
  return { t, prefix, tous, vivants, commun };
1939
1926
  }
1940
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
+
1941
1939
  // The boards of several projects as one (grillhouse-erp.1), as the multi-root explorer of VS Code
1942
1940
  // keeps one view and files each root under its name: <lus> holds each project's label
1943
1941
  // (`etiquette`, its ticket prefix) and its board (`t`) or the fault that keeps it out (`erreur`),
@@ -1969,6 +1967,7 @@ export function ensemble(lus) {
1969
1967
  }),
1970
1968
  maintenant: premier.t.maintenant,
1971
1969
  machine: premier.t.machine,
1970
+ places: premier.t.places,
1972
1971
  faitsDuJour: tous('faitsDuJour'),
1973
1972
  etats: premier.t.etats.map(e => ({
1974
1973
  ...e,
@@ -1982,17 +1981,32 @@ export function ensemble(lus) {
1982
1981
 
1983
1982
  // A project beside the session's, read in its folder <dossier>: its board, or the fault that keeps
1984
1983
  // it out, on one line.
1985
- function lireUnAutre(dossier, o) {
1984
+ async function lireUnAutre(dossier, { circuitsDe, ...o }) {
1986
1985
  try {
1987
1986
  if (!existsSync(dossier)) {
1988
1987
  throw new Error('dossier introuvable');
1989
1988
  }
1990
- return { dossier, ...lire(dossier, o) };
1989
+ return {
1990
+ dossier,
1991
+ ...lire(dossier, { ...o, circuits: (await lesCircuits(circuitsDe, dossier)).circuits }),
1992
+ };
1991
1993
  } catch (e) {
1992
1994
  return { dossier, erreur: String(e.message ?? e).split('\n')[0] };
1993
1995
  }
1994
1996
  }
1995
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
+
1996
2010
  /**
1997
2011
  * The lock of the machine <machine> with each project named as the board names it: <noms> gives
1998
2012
  * the name of each project of the board by the root of its main tree (`depot`); a project out of
@@ -2015,16 +2029,39 @@ export function nommerLesProjets(machine, noms) {
2015
2029
  // The board of the repository at <racine>; with <projets>, the folders of other projects, the
2016
2030
  // board of them all (`ensemble`), named « <dépôt> + <projet> + … », with the folder of each
2017
2031
  // ticket's project (`dossiers`), where the pane runs Beads for it. The status line is the
2018
- // session's project's alone.
2019
- 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(
2020
2040
  racine,
2021
- { home = os.homedir(), maintenant = Date.now(), projets = [] } = {}
2041
+ {
2042
+ home = os.homedir(),
2043
+ maintenant = Date.now(),
2044
+ projets = [],
2045
+ circuitsDe = circuitsDuServeur,
2046
+ } = {}
2022
2047
  ) {
2048
+ const [{ circuits, muet, faute }, ...autres] = await Promise.all([
2049
+ lesCircuits(circuitsDe, racine),
2050
+ ...projets.map(d => lireUnAutre(d, { home, maintenant, circuitsDe })),
2051
+ ]);
2023
2052
  const ici = {
2024
2053
  dossier: racine,
2025
- ...lire(racine, { home, maintenant, machine: 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
+ }),
2026
2063
  };
2027
- const lus = [ici, ...projets.map(d => lireUnAutre(d, { home, maintenant }))];
2064
+ const lus = [ici, ...autres];
2028
2065
  const etiquette = l => l.prefix || path.basename(l.dossier);
2029
2066
  // The lock of the machine names each project of the board as the board does: the session's by
2030
2067
  // its folder, another by its label; the root of its main tree, its common git directory's parent.
@@ -2087,10 +2124,11 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
2087
2124
  .slice(2)
2088
2125
  .filter(a => a !== '--texte')
2089
2126
  .map(d => path.resolve(d));
2090
- const t = tableau(process.cwd(), { projets });
2091
- process.stdout.write(
2092
- process.argv.includes('--texte')
2093
- ? `${t.lignes.map(l => l.texte).join('\n')}\n`
2094
- : 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
+ )
2095
2133
  );
2096
2134
  }