@roomi-fields/grillhouse 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +6 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +9 -2
  6. package/cadre/templates/projet/CLAUDE.md +9 -5
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/cadre/templates/turbo/paquets.json +3 -1
  9. package/cadre/templates/turbo/sans-paquets.json +3 -1
  10. package/charte.md +40 -14
  11. package/dist/temporal/circuit/appel.d.ts +4 -1
  12. package/dist/temporal/circuit/appel.js +15 -1
  13. package/dist/temporal/circuit/appel.js.map +1 -1
  14. package/dist/temporal/circuit/client.d.ts +7 -1
  15. package/dist/temporal/circuit/client.js +54 -1
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +30 -57
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +2 -1
  20. package/dist/temporal/circuit/contrat.js +2 -1
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +9 -2
  23. package/dist/temporal/circuit/deroule.js.map +1 -1
  24. package/dist/temporal/file/contrat.d.ts +16 -2
  25. package/dist/temporal/file/contrat.js +27 -3
  26. package/dist/temporal/file/contrat.js.map +1 -1
  27. package/dist/temporal/file/deroule.js +4 -4
  28. package/dist/temporal/file/deroule.js.map +1 -1
  29. package/dist/temporal/nuits/activites.d.ts +1 -15
  30. package/dist/temporal/nuits/activites.js +3 -62
  31. package/dist/temporal/nuits/activites.js.map +1 -1
  32. package/dist/temporal/nuits/contrat.d.ts +3 -21
  33. package/dist/temporal/nuits/deroule.js +38 -74
  34. package/dist/temporal/nuits/deroule.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +3 -16
  36. package/dist/temporal/places/client.js +3 -26
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/dist/temporal/places/contrat.d.ts +15 -51
  39. package/dist/temporal/places/contrat.js +3 -13
  40. package/dist/temporal/places/contrat.js.map +1 -1
  41. package/dist/temporal/places/deroule.js +11 -61
  42. package/dist/temporal/places/deroule.js.map +1 -1
  43. package/dist/temporal/tickets/activites.js +4 -2
  44. package/dist/temporal/tickets/activites.js.map +1 -1
  45. package/dist/temporal/tickets/contrat.d.ts +2 -1
  46. package/docs/ARCHITECTURE.md +310 -115
  47. package/docs/CADRE.md +16 -13
  48. package/docs/INTERFACE.md +90 -25
  49. package/hooks/hooks.json +9 -0
  50. package/hooks/register.tsx +59 -5
  51. package/package.json +1 -1
  52. package/scripts/activites.mjs +271 -42
  53. package/scripts/aiguillage.mjs +4 -1
  54. package/scripts/bilan.mjs +125 -2
  55. package/scripts/circuit.mjs +233 -159
  56. package/scripts/circuits-cles.d.mts +3 -3
  57. package/scripts/circuits-cles.mjs +6 -5
  58. package/scripts/coeurs-dedies.mjs +4 -4
  59. package/scripts/commandes-composees.mjs +12 -5
  60. package/scripts/dette.d.ts +2 -1
  61. package/scripts/dette.mjs +49 -6
  62. package/scripts/direct.mjs +343 -0
  63. package/scripts/droits.mjs +19 -0
  64. package/scripts/effets.mjs +4 -4
  65. package/scripts/engendres.mjs +2 -1
  66. package/scripts/enveloppe/enveloppe.mjs +67 -13
  67. package/scripts/enveloppe/lancer.sh +14 -3
  68. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  69. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  70. package/scripts/etapes.mjs +3 -3
  71. package/scripts/faits-du-circuit.mjs +12 -11
  72. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  73. package/scripts/fermeture-de-la-machine.mjs +10 -20
  74. package/scripts/fichiers-nommes.mjs +27 -1
  75. package/scripts/file-des-tickets.d.mts +18 -1
  76. package/scripts/file-des-tickets.mjs +63 -15
  77. package/scripts/grillhouse-maj.mjs +13 -25
  78. package/scripts/groupe-cles.d.mts +6 -0
  79. package/scripts/groupe-cles.mjs +29 -1
  80. package/scripts/integration/file.mjs +148 -37
  81. package/scripts/jointure.d.ts +17 -3
  82. package/scripts/journal-des-etats.d.mts +16 -0
  83. package/scripts/journal-des-etats.mjs +44 -2
  84. package/scripts/journal.mjs +3 -0
  85. package/scripts/langages/c/commandes.mjs +5 -5
  86. package/scripts/langages/c/composants.mjs +13 -5
  87. package/scripts/langages/cargo/commandes.mjs +5 -6
  88. package/scripts/langages/python/commandes.mjs +5 -5
  89. package/scripts/langages/python/composants.mjs +10 -2
  90. package/scripts/langages/typescript/composants.mjs +10 -3
  91. package/scripts/langages/typescript/construire.mjs +2 -0
  92. package/scripts/langages/typescript/exemples.mjs +33 -1
  93. package/scripts/langages/typescript/index.mjs +19 -0
  94. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  95. package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
  96. package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
  97. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  98. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  99. package/scripts/langages/typescript/verifier.mjs +3 -5
  100. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  101. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  102. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  103. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  104. package/scripts/machine.mjs +1 -1
  105. package/scripts/mesure/base-de-passe.mjs +2 -1
  106. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  107. package/scripts/migrations.mjs +2 -0
  108. package/scripts/nuit.sh +97 -2
  109. package/scripts/paquet.mjs +16 -5
  110. package/scripts/paquets.d.ts +4 -0
  111. package/scripts/paquets.mjs +57 -0
  112. package/scripts/passe-de-la-machine.mjs +4 -7
  113. package/scripts/places-de-la-machine.mjs +55 -42
  114. package/scripts/places-du-serveur.mjs +2 -2
  115. package/scripts/plafond-de-la-machine.d.mts +7 -13
  116. package/scripts/plafond-de-la-machine.mjs +19 -35
  117. package/scripts/prefixe-des-tickets.mjs +1 -1
  118. package/scripts/references-changees.mjs +159 -0
  119. package/scripts/regles-des-places.d.mts +8 -31
  120. package/scripts/regles-des-places.mjs +14 -64
  121. package/scripts/repli-de-la-nuit.mjs +112 -0
  122. package/scripts/reponses-du-circuit.d.mts +2 -2
  123. package/scripts/reponses-du-circuit.mjs +21 -12
  124. package/scripts/reprise.mjs +27 -8
  125. package/scripts/resultats.mjs +21 -9
  126. package/scripts/seances.mjs +258 -40
  127. package/scripts/services-du-noyau.mjs +3 -0
  128. package/scripts/sous-commandes.mjs +24 -7
  129. package/scripts/superviseur.mjs +185 -39
  130. package/scripts/tableau.mjs +220 -89
  131. package/scripts/taches-du-graphe.mjs +84 -4
  132. package/scripts/ticket.mjs +345 -0
  133. package/scripts/transitions.d.mts +44 -0
  134. package/scripts/transitions.mjs +173 -13
  135. package/scripts/un-commit-par-ticket.mjs +4 -3
  136. package/scripts/verdict-de-la-nuit.mjs +47 -20
  137. package/scripts/verrou-de-fichier.mjs +2 -2
  138. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  139. package/scripts/verrous/verrou.mjs +17 -1
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/direct/SKILL.md +57 -0
  142. package/skills/explorateur/SKILL.md +10 -6
  143. package/skills/pitmaster/SKILL.md +34 -14
  144. package/skills/pitmaster/references/consigne-agent.md +7 -1
  145. package/skills/relecteur/SKILL.md +8 -0
  146. package/skills/testwriter/SKILL.md +10 -0
  147. package/scripts/ticket.sh +0 -25
@@ -25,6 +25,7 @@ export { poserLeGabaritAbsent } from './gabarit-absent.mjs';
25
25
  export {
26
26
  cheminsDeLaTache,
27
27
  construireDepuisLesArguments,
28
+ constructionDuGraphe,
28
29
  empreintesDesTaches,
29
30
  GRAPHE_JOUE,
30
31
  joueCeQuiNeSeDivisePas,
@@ -34,6 +35,8 @@ export {
34
35
  nomDuPaquet,
35
36
  PASSE_ROUGE,
36
37
  SCRIPT_DES_TESTS,
38
+ SCRIPTS_DE_GARDES,
39
+ tachesCoteACote,
37
40
  tachesDuVerdict,
38
41
  TESTS_CIBLES,
39
42
  testsCibles,
@@ -13,6 +13,11 @@
13
13
  // (scripts/langages.mjs); each other command it describes is a subcommand by its name
14
14
  // (`frontieres`, `index-interfaces`, `typer`, `construire`), as a backend of Pants brings its
15
15
  // goals.
16
+ // - `fusion-des-tranches` is a subcommand of every project (DE_TOUT_PROJET), which the frame's
17
+ // workflows call after the tranches of a pass, whatever the languages: the command of the
18
+ // modules that describe it (typescript, which merges Vitest's reports), else the composed
19
+ // command by its name, which finds no module to play and is green (cargo alone, python alone, c
20
+ // alone: no report of a tranche to merge, a red of theirs is the red of its tranche's job).
16
21
  // - `nuit` runs the build of src/temporal/nuits/commande.ts, which plays the night's pass
17
22
  // (`nuit.sh`) when called alone: the script it replaces is that pass (`PASSES`).
18
23
  // - `temporal` runs the build of src/temporal/commande.ts (dist/temporal/commande.js), the
@@ -39,6 +44,7 @@ export const SOUS_COMMANDES = {
39
44
  'composants-affectes': 'composants-affectes.mjs',
40
45
  consommation: 'consommation.mjs',
41
46
  'dependances-internes': 'dependances-internes.mjs',
47
+ direct: 'direct.mjs',
42
48
  droits: 'droits.mjs',
43
49
  enveloppe: 'enveloppe/enveloppe.mjs',
44
50
  'flux-des-paquets': 'flux-des-paquets.mjs',
@@ -74,10 +80,11 @@ export const SOUS_COMMANDES = {
74
80
  temporaire: 'mesure/base-de-passe.mjs',
75
81
  temporal: '../dist/temporal/commande.js',
76
82
  tests: { langage: 'tester' },
77
- ticket: 'ticket.sh',
83
+ ticket: 'ticket.mjs',
78
84
  'ticket-du-sous-agent': 'verrous/ticket-du-sous-agent.mjs',
79
85
  verifier: { langage: 'verifier' },
80
86
  verrou: 'verrous/verrou.mjs',
87
+ 'verrou-hors-enveloppe': 'verrous/ecriture-hors-enveloppe.mjs',
81
88
  };
82
89
 
83
90
  // The script a subcommand plays when called alone, where its command is a client of Temporal that
@@ -88,14 +95,23 @@ const PASSES = { nuit: 'nuit.sh' };
88
95
  // subcommand by their name: the ones `tests` and `verifier` run.
89
96
  const DU_NOYAU = new Set(['tester', 'verifier']);
90
97
 
98
+ // The commands of the modules that every project has as a subcommand, the frame's workflows
99
+ // calling them in each project: in a project no module of which describes one, the composed
100
+ // command plays it (scripts/commandes-composees.mjs), in no module, green.
101
+ const DE_TOUT_PROJET = ['fusion-des-tranches'];
102
+ const COMMANDES_COMPOSEES = path.join(SCRIPTS, 'commandes-composees.mjs');
103
+
91
104
  /**
92
- * The subcommands in the project at <racine>, sorted: the core's (SOUS_COMMANDES), and the
93
- * commands of the module of its language, each `{ langage }`, its name in `commandes`.
105
+ * The subcommands in the project at <racine>, sorted: the core's (SOUS_COMMANDES), the commands
106
+ * of the module of its language and those every project has (DE_TOUT_PROJET), each
107
+ * `{ langage }`, its name in `commandes`.
94
108
  * @param {string} [racine] the root of the project, the working directory by default
95
109
  * @returns {Record<string, string | { langage: string }>}
96
110
  */
97
111
  export function sousCommandes(racine = process.cwd()) {
98
- const du = Object.keys(langageDe(racine).commandes(racine)).filter(n => !DU_NOYAU.has(n));
112
+ const du = [
113
+ ...new Set([...Object.keys(langageDe(racine).commandes(racine)), ...DE_TOUT_PROJET]),
114
+ ].filter(n => !DU_NOYAU.has(n));
99
115
  return Object.fromEntries(
100
116
  [...Object.entries(SOUS_COMMANDES), ...du.map(n => [n, { langage: n }])].sort(([a], [b]) =>
101
117
  a.localeCompare(b, 'en')
@@ -105,7 +121,8 @@ export function sousCommandes(racine = process.cwd()) {
105
121
 
106
122
  /**
107
123
  * The command of the subcommand <nom> in the project at <racine>, the script absolute; null for a
108
- * name neither the core nor the module of its language has.
124
+ * name neither the core nor the module of its language has, unless every project has it
125
+ * (DE_TOUT_PROJET): the composed command by its name then.
109
126
  * @param {string} nom the subcommand
110
127
  * @param {string} [racine] the root of the project, the working directory by default
111
128
  * @returns {import('./jointure.js').Commande | null}
@@ -118,14 +135,14 @@ export function commandeDe(nom, racine = process.cwd()) {
118
135
  const commandes = langageDe(racine).commandes(racine);
119
136
  const n = s?.langage ?? (DU_NOYAU.has(nom) ? null : nom);
120
137
  if (n === null || !Object.hasOwn(commandes, n)) {
121
- return null;
138
+ return DE_TOUT_PROJET.includes(nom) ? { script: COMMANDES_COMPOSEES, args: [nom] } : null;
122
139
  }
123
140
  // The verification of a project whose one module is not the one of package.json (cargo alone,
124
141
  // python alone) goes by the composed command, which keeps its last green and its judged tree: no
125
142
  // pass of the graph does it there (scripts/commandes-composees.mjs, `garderSansLeGraphe`).
126
143
  const modules = langagesDe(racine);
127
144
  if (n === 'verifier' && modules.length === 1 && modules[0].manifeste !== 'package.json') {
128
- return { script: path.join(SCRIPTS, 'commandes-composees.mjs'), args: [n] };
145
+ return { script: COMMANDES_COMPOSEES, args: [n] };
129
146
  }
130
147
  return commandes[n];
131
148
  }
@@ -47,11 +47,17 @@
47
47
  // writes the message of the reading (`texteDesQuestions`) when `relever` gives something,
48
48
  // nothing otherwise; exit 1 and the fault on the error stream when `grillhouse.rappel` is at
49
49
  // fault. A reading is one reading: no process waits.
50
+ // - A question has three states the greffon keeps in the file of the stops gone up: sent (put in the
51
+ // message of the session by `relever`), read (a turn of the session started with that message,
52
+ // `superviseur --lue <dossier> <lueA> <envoyeesAvant>`, or the opening listed it), answered (it
53
+ // leaves the file). It comes back only once read, <rappelMs> after its reading, as SQS counts the
54
+ // visibility timeout of a message from its reception: one still in the queue is never sent again.
55
+ // `superviseur --chez-le-responsable <dossier> <ticket>` (the answer `--chez-le-responsable` of
56
+ // the circuit) marks a question carried to the owner: silent until the circuit answers.
50
57
  // - `relever` is the one function of the reading, of the re-presentation and of the file of the
51
- // stops gone up: each question of a circuit that never went up or whose last presentation is
52
- // <rappelMs> old (`grillhouse.rappel` minutes, 5 by default, scripts/circuits-cles.mjs) is given,
53
- // once per due time, whatever the state of the session, while its circuit stands on the same stop,
54
- // as SQS gives a message not acknowledged again after its visibility timeout; one answered (its
58
+ // stops gone up: each question of a circuit that never went up or that was read <rappelMs> ago
59
+ // (`grillhouse.rappel` minutes, 10 by default, scripts/circuits-cles.mjs) is given,
60
+ // once per due time, while its circuit stands on the same stop; one answered (its
55
61
  // circuit left the stop) leaves the file `.claude/worktrees/questions-remontees.json` and is not
56
62
  // given again. The stops are kept there each by its ticket, the run of its workflow, the rank of
57
63
  // its question in that run and its stop, with the time of the first going up and of the last
@@ -69,12 +75,24 @@ import { lireEtOuvrirLeDefautDeMain } from './ci-de-main.mjs';
69
75
  import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
70
76
  import { vivant } from './mesure/base-de-passe.mjs';
71
77
  import { circuitsDuServeur, ServeurMuet } from './circuits-du-serveur.mjs';
72
- import { attendLeSuperviseur, cleDe, lireLesRemontees, remonteesDe } from './tableau.mjs';
78
+ import {
79
+ attendLeSuperviseur,
80
+ cleDe,
81
+ estLue,
82
+ lireLesRemontees,
83
+ remonteesDe,
84
+ } from './tableau.mjs';
73
85
  import { rappelDuProjet, reglageDuRappel } from './circuits-cles.mjs';
74
86
  import { lireGroupe } from './groupe-cles.mjs';
75
87
  import { etapeDuCircuit, libelle, REPONSES, sansLesReponses, SUPERVISEUR } from './etapes.mjs';
76
88
  import { sigleDuProjet } from './sigle-du-projet.mjs';
77
- import { enFileSansArchitecture, lireLesTickets } from './file-des-tickets.mjs';
89
+ import {
90
+ enFileSansArchitecture,
91
+ enFileSurMain,
92
+ lireLesExternes,
93
+ lireLesTickets,
94
+ lotEstSurMain,
95
+ } from './file-des-tickets.mjs';
78
96
 
79
97
  const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
80
98
  const COQUILLES = new Set(['sh', 'bash', 'dash', 'zsh']);
@@ -271,6 +289,85 @@ function ecrireLesIntegrations(racine, depuis, rendues) {
271
289
  }
272
290
  }
273
291
 
292
+ // The file of the stops gone up as text: each stop with its key, its times, and its reading and its
293
+ // mark when it has them, sorted by key.
294
+ const enTexteDesRemontees = liste =>
295
+ `${JSON.stringify(
296
+ {
297
+ remontees: liste
298
+ .map(r => ({
299
+ cle: r.cle,
300
+ depuis: r.depuis,
301
+ presentee: r.presentee,
302
+ ...(Number.isFinite(r.lue) ? { lue: r.lue } : {}),
303
+ ...(Number.isFinite(r.chez) ? { chez: r.chez } : {}),
304
+ }))
305
+ .sort((a, b) => a.cle.localeCompare(b.cle, 'en')),
306
+ },
307
+ null,
308
+ 2
309
+ )}\n`;
310
+
311
+ // Writes the file of the stops gone up of <racine> as <ecrit> when it differs from what it holds
312
+ // (<rien>: nothing to write when no file yet), by a rename. Under the lock of the file.
313
+ function ecrireLesRemontees(racine, ecrit, rien = false) {
314
+ const f = remonteesDe(racine);
315
+ let enFichier = '';
316
+ try {
317
+ enFichier = readFileSync(f, 'utf8');
318
+ } catch {
319
+ // no file yet
320
+ }
321
+ if (ecrit !== enFichier && !rien) {
322
+ const provisoire = `${f}.${process.pid}`;
323
+ writeFileSync(provisoire, ecrit);
324
+ renameSync(provisoire, f);
325
+ }
326
+ }
327
+
328
+ // Changes the entries of the file of the stops gone up of <racine> by <change> (entry → entry), under
329
+ // its lock; nothing is written when no file holds a stop.
330
+ function changerLesRemontees(racine, change) {
331
+ const f = remonteesDe(racine);
332
+ if (!lireLesRemontees(racine, Date.now()).length) {
333
+ return;
334
+ }
335
+ mkdirSync(path.dirname(f), { recursive: true });
336
+ const verrou = `${f}.verrou`;
337
+ prendreVerrou(verrou, { attendre: true, perime: 30_000 });
338
+ try {
339
+ ecrireLesRemontees(racine, enTexteDesRemontees(lireLesRemontees(racine, Date.now()).map(change)));
340
+ } finally {
341
+ lacherVerrou(verrou);
342
+ }
343
+ }
344
+
345
+ /**
346
+ * A turn of the session read, at <lueA> ms, the messages sent up to <envoyeesAvant> ms: each stop of
347
+ * the file of the stops gone up of <racine> sent by then and not read since its last sending is
348
+ * read at <lueA>. A stop read keeps the time of its reading. The opening and the greffon's turn
349
+ * (`superviseur --lue`) call it.
350
+ * @param {string} racine
351
+ * @param {{ lueA: number, envoyeesAvant: number }} options
352
+ */
353
+ export function marquerLues(racine, { lueA, envoyeesAvant }) {
354
+ changerLesRemontees(racine, r =>
355
+ r.presentee <= envoyeesAvant && !estLue(r) ? { ...r, lue: lueA } : r
356
+ );
357
+ }
358
+
359
+ /**
360
+ * The supervisor carried the question of the stop <cle> to the owner, at <depuisA> ms: it is
361
+ * silent until the circuit answers (its stop leaves the file, and the mark with it).
362
+ * @param {string} racine
363
+ * @param {{ cle: string, depuisA: number }} options
364
+ * @returns {boolean} whether the file holds that stop (the question was sent)
365
+ */
366
+ export function marquerChezLeResponsable(racine, { cle, depuisA }) {
367
+ changerLesRemontees(racine, r => (r.cle === cle ? { ...r, chez: depuisA } : r));
368
+ return lireLesRemontees(racine, depuisA).some(r => r.cle === cle);
369
+ }
370
+
274
371
  /**
275
372
  * One reading of the circuits <circuits> (those integrated included) of the repository at <racine>,
276
373
  * at <maintenant> ms, under the lock of the file of the stops gone up; what the greffon of the
@@ -320,9 +417,16 @@ export function relever(
320
417
  circuits = circuits.filter(c => !c.integre);
321
418
  const avant = new Map(lireLesRemontees(racine, maintenant).map(r => [r.cle, r]));
322
419
  const debout = questionsEnAttente(racine, circuits, { fermes: aucunFerme });
420
+ // A question comes back from its reading, never from its sending: one read, not carried to the
421
+ // owner, whose delay has passed since its reading. One still in the queue (sent, unread) or
422
+ // carried to the owner is never given again.
323
423
  const aRendre = debout.filter(q => {
324
424
  const r = avant.get(q.cle);
325
- return toutes || !r || maintenant - r.presentee >= rappelMs;
425
+ return (
426
+ toutes ||
427
+ !r ||
428
+ (estLue(r) && r.chez === undefined && maintenant - r.lue >= rappelMs)
429
+ );
326
430
  });
327
431
  const fermesDe = aRendre.length
328
432
  ? fermes(
@@ -341,40 +445,22 @@ export function relever(
341
445
  // A question whose ticket is closed is not given, so not counted presented: it is given once
342
446
  // its ticket waits again.
343
447
  const presentes = new Set(rendu.map(q => q.cle));
344
- const enTexte = liste =>
345
- `${JSON.stringify(
346
- {
347
- remontees: liste
348
- .map(r => ({ cle: r.cle, depuis: r.depuis, presentee: r.presentee }))
349
- .sort((a, b) => a.cle.localeCompare(b.cle, 'en')),
350
- },
351
- null,
352
- 2
353
- )}\n`;
354
448
  // A question never presented, its ticket unread, is not written: the next reading gives it.
355
- const ecrit = enTexte(
449
+ // Sent now, it is sent: its reading (`lue`) is the turn's, and its mark (`chez`) the supervisor's.
450
+ const ecrit = enTexteDesRemontees(
356
451
  debout
357
452
  .filter(q => presentes.has(q.cle) || avant.has(q.cle))
358
453
  .map(q => {
359
454
  const r = avant.get(q.cle);
360
455
  return {
456
+ ...(r ?? {}),
361
457
  cle: q.cle,
362
458
  depuis: r?.depuis ?? maintenant,
363
459
  presentee: presentes.has(q.cle) ? maintenant : r.presentee,
364
460
  };
365
461
  })
366
462
  );
367
- let enFichier = '';
368
- try {
369
- enFichier = readFileSync(f, 'utf8');
370
- } catch {
371
- // no file yet
372
- }
373
- if (ecrit !== enFichier && !(debout.length === 0 && avant.size === 0)) {
374
- const provisoire = `${f}.${process.pid}`;
375
- writeFileSync(provisoire, ecrit);
376
- renameSync(provisoire, f);
377
- }
463
+ ecrireLesRemontees(racine, ecrit, debout.length === 0 && avant.size === 0);
378
464
  return [...rendu, ...integres, ...rouges];
379
465
  } finally {
380
466
  lacherVerrou(verrou);
@@ -487,7 +573,12 @@ const teteDe = (q, genre, { sigle } = {}) =>
487
573
  */
488
574
  export const ligneDeQuestion = (q, o = {}) => {
489
575
  if (q.representee) {
490
- return teteDe(q, 'Toujours sans réponse', o);
576
+ const tete = teteDe(q, 'Toujours sans réponse', o);
577
+ const commande = o.courte ? '' : commandeDe(q, o.dossier);
578
+ // The reminder names the answer of a question carried to the owner beside the command of the circuit.
579
+ return commande.endsWith('<réponse>')
580
+ ? `${tete}\n→ ${commande} ou --chez-le-responsable`
581
+ : tete;
491
582
  }
492
583
  const tete = teteDe(q, 'Question', o);
493
584
  const commande = commandeDe(q, o.dossier);
@@ -526,19 +617,27 @@ export function texteDesQuestions(questions, o = {}) {
526
617
  * their re-presentation. Last, « ## La
527
618
  * file des tickets » names the tickets of the queue without their section « ## Architecture »
528
619
  * (`enFileSansArchitecture` of scripts/file-des-tickets.mjs, the tickets read by <ticketsDe>,
529
- * `lireLesTickets` by default; a Beads that fails says nothing), which the queue never starts.
620
+ * `lireLesTickets` by default; a Beads that fails says nothing), which the queue never starts,
621
+ * then those whose lot is already on main (`enFileSurMain`, main read by <surMainDe>,
622
+ * `lotEstSurMain` by default), which it never starts again.
530
623
  * @param {string} racine the root of the repository
531
624
  * The circuits are read once, by <circuitsDe> (one call to the Temporal server,
532
625
  * scripts/circuits-du-serveur.mjs, by default); a server that does not answer is said, and no
533
626
  * question goes up.
534
627
  * @param {{ fermes?: (racine: string, ids: string[]) => Set<string> | null,
535
628
  * circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>,
536
- * ticketsDe?: (racine: string) => import('./file-des-tickets.mjs').TicketDeBeads[] }} options
629
+ * ticketsDe?: (racine: string) => import('./file-des-tickets.mjs').TicketDeBeads[],
630
+ * surMainDe?: (racine: string) => (id: string) => boolean }} options
537
631
  * @returns {Promise<string>}
538
632
  */
539
633
  export async function circuitsALOuverture(
540
634
  racine,
541
- { fermes = ticketsHorsAttente, circuitsDe = circuitsDuServeur, ticketsDe = lireLesTickets } = {}
635
+ {
636
+ fermes = ticketsHorsAttente,
637
+ circuitsDe = circuitsDuServeur,
638
+ ticketsDe = lireLesTickets,
639
+ surMainDe = lotEstSurMain,
640
+ } = {}
542
641
  ) {
543
642
  let circuits = null;
544
643
  let panne = null;
@@ -552,15 +651,19 @@ export async function circuitsALOuverture(
552
651
  : `Les circuits ne se lisent pas : ${message}.`;
553
652
  }
554
653
  ecrireLesIntegrations(racine, Date.now(), []);
654
+ const ouverteA = Date.now();
555
655
  const questions = circuits
556
656
  ? relever(racine, circuits, {
557
657
  fermes,
558
- maintenant: Date.now(),
658
+ maintenant: ouverteA,
559
659
  rappelMs: rappelDuProjet(racine) * 60_000,
560
660
  toutes: true,
561
661
  ciDeMain: ciDeMainDe(racine),
562
662
  }).filter(q => !q.integre)
563
663
  : [];
664
+ // The opening lists every question that waits: the session reads them, and their reminder runs
665
+ // from now (a question sent to a closed session, or whose message was never recognised, included).
666
+ marquerLues(racine, { lueA: ouverteA, envoyeesAvant: ouverteA });
564
667
  const tournent = enAttente(
565
668
  (circuits ?? []).filter(c => c.vivant),
566
669
  racine,
@@ -573,9 +676,15 @@ export async function circuitsALOuverture(
573
676
  : ligneDeQuestion(q),
574
677
  });
575
678
  let sansArchitecture = [];
679
+ let dejaSurMain = [];
576
680
  try {
577
- sansArchitecture = enFileSansArchitecture(ticketsDe(racine), {
578
- enCours: new Set((circuits ?? []).map(c => c.ticket)),
681
+ const tickets = ticketsDe(racine);
682
+ const enCours = new Set((circuits ?? []).map(c => c.ticket));
683
+ sansArchitecture = enFileSansArchitecture(tickets, { enCours }).map(t => t.id);
684
+ dejaSurMain = enFileSurMain(tickets, {
685
+ enCours,
686
+ externes: lireLesExternes(racine, tickets),
687
+ surMain: surMainDe(racine),
579
688
  }).map(t => t.id);
580
689
  } catch {
581
690
  // Beads fails: the board says it, the opening names no ticket.
@@ -585,17 +694,21 @@ export async function circuitsALOuverture(
585
694
  );
586
695
  return [
587
696
  '## Les questions des circuits',
588
- "Le greffon de ta séance pousse dans la file de tes messages chaque question neuve d'un circuit du dépôt, quel que soit son lanceur, et chaque fin de circuit, une fois ; il n'y a aucune attente à lancer. Une question sans réponse revient à intervalle réglable (`grillhouse.rappel`, 5 min par défaut) : ta réponse au circuit l'acquitte, et répondue elle ne revient plus. Tu ne te mets pas en attente du responsable tant qu'une question d'un circuit attend ta réponse : le crochet de fin de tour te le rappelle. Les questions en attente sont listées ci-dessous.",
697
+ "Le greffon de ta séance pousse dans la file de tes messages chaque question neuve d'un circuit du dépôt, quel que soit son lanceur, et chaque fin de circuit, une fois ; il n'y a aucune attente à lancer. Une question sans réponse revient une fois lue, à intervalle réglable depuis sa lecture (`grillhouse.rappel`, 10 min par défaut) : ta réponse au circuit l'acquitte, et répondue elle ne revient plus ; une question que tu as portée au responsable se tait par `npx grillhouse circuit <ticket> --chez-le-responsable`, jusqu'à la réponse du circuit. Tu ne te mets pas en attente du responsable tant qu'une question d'un circuit attend ta réponse : le crochet de fin de tour te le rappelle. Les questions en attente sont listées ci-dessous.",
589
698
  ...(panne ? ['', '## Les circuits du dépôt', panne] : []),
590
699
  ...(nommes.length ? ['', '## Les circuits du dépôt', ...nommes.map(n => n.ligne)] : []),
591
700
  ...(questions.length ? ['', `Les réponses à une question : ${REPONSES}`] : []),
701
+ ...(sansArchitecture.length || dejaSurMain.length ? ['', '## La file des tickets'] : []),
592
702
  ...(sansArchitecture.length
593
703
  ? [
594
- '',
595
- '## La file des tickets',
596
704
  `En file sans architecture : ${sansArchitecture.join(', ')}. La file ne démarre pas un ticket sans la section « ## Architecture » de sa description : écris-la (le modèle mûr, l'adresse, le mécanisme commun), puis la file le démarre.`,
597
705
  ]
598
706
  : []),
707
+ ...(dejaSurMain.length
708
+ ? [
709
+ `En file, lot déjà sur main : ${dejaSurMain.join(', ')}. La file ne relance pas un ticket dont le lot est sur main, resté ouvert ou rouvert : ferme-le (\`bd close <ticket> --reason "intégré : <commit>"\`, une dépendance ouverte levée d'abord), et ouvre un ticket neuf pour ce qui reste à faire.`,
710
+ ]
711
+ : []),
599
712
  ].join('\n');
600
713
  }
601
714
 
@@ -788,6 +901,39 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
788
901
  process.stderr.write(`${e.message}\n`);
789
902
  process.exitCode = 1;
790
903
  }
904
+ } else if (process.argv[2] === '--chez-le-responsable') {
905
+ // superviseur --chez-le-responsable <dossier> <ticket> : the question of the circuit of <ticket>
906
+ // is carried to the owner, now (`grillhouse circuit <ticket> --chez-le-responsable`); exit 2 and
907
+ // its reason on the error stream when the circuit waits for no question, or when the question
908
+ // is not in the file of the stops gone up.
909
+ const [, , , dossier, ticket] = process.argv;
910
+ const racine = racineDe(dossier ?? process.cwd());
911
+ const circuits = await circuitsDuServeur(racine);
912
+ const c = circuits.find(x => x.ticket === ticket);
913
+ if (!c || !attendLeSuperviseur(c)) {
914
+ process.stderr.write(`--chez-le-responsable : le circuit de ${ticket} n'attend aucune question.\n`);
915
+ process.exitCode = 2;
916
+ } else if (!marquerChezLeResponsable(racine, { cle: cleDe(c), depuisA: Date.now() })) {
917
+ process.stderr.write(
918
+ `--chez-le-responsable : la question de ${ticket} n'est pas encore remontée au superviseur.\n`
919
+ );
920
+ process.exitCode = 2;
921
+ }
922
+ } else if (process.argv[2] === '--lue') {
923
+ // superviseur --lue <dossier> <lueA> <envoyeesAvant> : the turn of the session that read, at
924
+ // <lueA> ms, the messages sent up to <envoyeesAvant> ms (the greffon's turn.start).
925
+ const [, , , dossier, lueA, envoyeesAvant] = process.argv;
926
+ if (!dossier || !Number.isFinite(Number(lueA)) || !Number.isFinite(Number(envoyeesAvant))) {
927
+ process.stderr.write('usage : superviseur --lue <dossier> <lueA> <envoyeesAvant>\n');
928
+ process.exitCode = 1;
929
+ } else {
930
+ const racine = racineDe(dossier);
931
+ const lues = { lueA: Number(lueA), envoyeesAvant: Number(envoyeesAvant) };
932
+ marquerLues(racine, lues);
933
+ for (const p of voisinsSansSuperviseur(racine)) {
934
+ marquerLues(p.chemin, lues);
935
+ }
936
+ }
791
937
  } else {
792
938
  const texte = await superviseur(process.argv[2] ?? process.cwd());
793
939
  if (texte) {