@roomi-fields/grillhouse 0.48.0 → 0.49.1

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 (155) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +90 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +11 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +15 -6
  6. package/cadre/templates/projet/CLAUDE.md +10 -6
  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 +51 -14
  11. package/dist/temporal/acte.d.ts +9 -0
  12. package/dist/temporal/acte.js +43 -20
  13. package/dist/temporal/acte.js.map +1 -1
  14. package/dist/temporal/circuit/appel.d.ts +4 -1
  15. package/dist/temporal/circuit/appel.js +15 -1
  16. package/dist/temporal/circuit/appel.js.map +1 -1
  17. package/dist/temporal/circuit/client.d.ts +7 -1
  18. package/dist/temporal/circuit/client.js +54 -1
  19. package/dist/temporal/circuit/client.js.map +1 -1
  20. package/dist/temporal/circuit/commande.js +30 -57
  21. package/dist/temporal/circuit/commande.js.map +1 -1
  22. package/dist/temporal/circuit/contrat.d.ts +2 -1
  23. package/dist/temporal/circuit/contrat.js +2 -1
  24. package/dist/temporal/circuit/contrat.js.map +1 -1
  25. package/dist/temporal/circuit/deroule.js +9 -2
  26. package/dist/temporal/circuit/deroule.js.map +1 -1
  27. package/dist/temporal/file/contrat.d.ts +16 -2
  28. package/dist/temporal/file/contrat.js +27 -3
  29. package/dist/temporal/file/contrat.js.map +1 -1
  30. package/dist/temporal/file/deroule.js +4 -4
  31. package/dist/temporal/file/deroule.js.map +1 -1
  32. package/dist/temporal/nuits/activites.d.ts +1 -15
  33. package/dist/temporal/nuits/activites.js +3 -62
  34. package/dist/temporal/nuits/activites.js.map +1 -1
  35. package/dist/temporal/nuits/contrat.d.ts +3 -21
  36. package/dist/temporal/nuits/deroule.js +38 -74
  37. package/dist/temporal/nuits/deroule.js.map +1 -1
  38. package/dist/temporal/places/client.d.ts +3 -16
  39. package/dist/temporal/places/client.js +3 -26
  40. package/dist/temporal/places/client.js.map +1 -1
  41. package/dist/temporal/places/contrat.d.ts +15 -51
  42. package/dist/temporal/places/contrat.js +3 -13
  43. package/dist/temporal/places/contrat.js.map +1 -1
  44. package/dist/temporal/places/deroule.js +11 -61
  45. package/dist/temporal/places/deroule.js.map +1 -1
  46. package/dist/temporal/tickets/activites.js +4 -2
  47. package/dist/temporal/tickets/activites.js.map +1 -1
  48. package/dist/temporal/tickets/contrat.d.ts +2 -1
  49. package/docs/ARCHITECTURE.md +337 -120
  50. package/docs/CADRE.md +16 -13
  51. package/docs/INTERFACE.md +90 -25
  52. package/hooks/hooks.json +9 -0
  53. package/hooks/register.tsx +59 -5
  54. package/package.json +1 -1
  55. package/scripts/activites.mjs +271 -42
  56. package/scripts/aiguillage.mjs +4 -1
  57. package/scripts/bilan.mjs +125 -2
  58. package/scripts/circuit.mjs +233 -159
  59. package/scripts/circuits-cles.d.mts +3 -3
  60. package/scripts/circuits-cles.mjs +6 -5
  61. package/scripts/coeurs-dedies.mjs +4 -4
  62. package/scripts/commandes-composees.mjs +12 -5
  63. package/scripts/dette.d.ts +2 -1
  64. package/scripts/dette.mjs +49 -6
  65. package/scripts/direct.mjs +343 -0
  66. package/scripts/droits.mjs +26 -4
  67. package/scripts/effets.mjs +4 -4
  68. package/scripts/engendres.mjs +2 -1
  69. package/scripts/enveloppe/enveloppe.mjs +119 -18
  70. package/scripts/enveloppe/lancer.sh +14 -3
  71. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  72. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  73. package/scripts/etapes.mjs +3 -3
  74. package/scripts/faits-du-circuit.mjs +12 -11
  75. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  76. package/scripts/fermeture-de-la-machine.mjs +10 -20
  77. package/scripts/fichiers-nommes.mjs +27 -1
  78. package/scripts/file-des-tickets.d.mts +18 -1
  79. package/scripts/file-des-tickets.mjs +63 -15
  80. package/scripts/flux-de-la-nuit.mjs +38 -0
  81. package/scripts/grillhouse-maj.mjs +13 -25
  82. package/scripts/groupe-cles.d.mts +6 -0
  83. package/scripts/groupe-cles.mjs +29 -1
  84. package/scripts/integration/file.mjs +148 -37
  85. package/scripts/jointure.d.ts +20 -3
  86. package/scripts/journal-des-etats.d.mts +16 -0
  87. package/scripts/journal-des-etats.mjs +44 -2
  88. package/scripts/journal.mjs +3 -0
  89. package/scripts/langages/c/commandes.mjs +5 -5
  90. package/scripts/langages/c/composants.mjs +13 -5
  91. package/scripts/langages/cargo/commandes.mjs +5 -6
  92. package/scripts/langages/python/commandes.mjs +5 -5
  93. package/scripts/langages/python/composants.mjs +10 -2
  94. package/scripts/langages/typescript/composants.mjs +10 -3
  95. package/scripts/langages/typescript/consommateurs-arbitres.mjs +15 -3
  96. package/scripts/langages/typescript/construire.mjs +2 -0
  97. package/scripts/langages/typescript/exemples.mjs +33 -1
  98. package/scripts/langages/typescript/index.mjs +19 -0
  99. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  100. package/scripts/langages/typescript/tests-de-nuit.mjs +158 -32
  101. package/scripts/langages/typescript/tests-du-poste.mjs +112 -32
  102. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  103. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  104. package/scripts/langages/typescript/verifier.mjs +3 -5
  105. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  106. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  107. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  108. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  109. package/scripts/machine.mjs +1 -1
  110. package/scripts/mesure/base-de-passe.mjs +2 -1
  111. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  112. package/scripts/migrations.mjs +2 -0
  113. package/scripts/nuit.sh +129 -3
  114. package/scripts/paquet.mjs +16 -5
  115. package/scripts/paquets.d.ts +4 -0
  116. package/scripts/paquets.mjs +57 -0
  117. package/scripts/passe-de-la-machine.mjs +4 -7
  118. package/scripts/places-de-la-machine.mjs +55 -42
  119. package/scripts/places-du-serveur.mjs +2 -2
  120. package/scripts/plafond-de-la-machine.d.mts +7 -13
  121. package/scripts/plafond-de-la-machine.mjs +19 -35
  122. package/scripts/prefixe-des-tickets.mjs +1 -1
  123. package/scripts/references-changees.mjs +159 -0
  124. package/scripts/regles-des-places.d.mts +8 -31
  125. package/scripts/regles-des-places.mjs +14 -64
  126. package/scripts/repli-de-la-nuit.mjs +183 -0
  127. package/scripts/reponses-du-circuit.d.mts +2 -2
  128. package/scripts/reponses-du-circuit.mjs +21 -12
  129. package/scripts/reprise.mjs +27 -8
  130. package/scripts/resultats.mjs +21 -9
  131. package/scripts/seances.mjs +258 -40
  132. package/scripts/services-du-noyau.mjs +4 -0
  133. package/scripts/sous-commandes.mjs +24 -7
  134. package/scripts/superviseur.mjs +185 -39
  135. package/scripts/tableau.mjs +226 -94
  136. package/scripts/taches-du-graphe.mjs +84 -4
  137. package/scripts/ticket.mjs +348 -0
  138. package/scripts/transitions.d.mts +44 -0
  139. package/scripts/transitions.mjs +188 -17
  140. package/scripts/un-commit-par-ticket.mjs +4 -3
  141. package/scripts/verdict-de-la-nuit.mjs +47 -20
  142. package/scripts/verrou-de-fichier.mjs +2 -2
  143. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  144. package/scripts/verrous/verrou.mjs +17 -1
  145. package/skills/architecte/SKILL.md +203 -0
  146. package/skills/architecte/references/exemple-d-architecture.md +159 -0
  147. package/skills/developpeur/SKILL.md +1 -1
  148. package/skills/direct/SKILL.md +57 -0
  149. package/skills/explorateur/SKILL.md +10 -6
  150. package/skills/pitmaster/SKILL.md +37 -14
  151. package/skills/pitmaster/references/consigne-agent.md +7 -1
  152. package/skills/redacteur/references/documents-d-un-composant.md +2 -1
  153. package/skills/relecteur/SKILL.md +8 -0
  154. package/skills/testwriter/SKILL.md +10 -0
  155. package/scripts/ticket.sh +0 -25
@@ -8,11 +8,14 @@ import { SUITE } from './etapes.mjs';
8
8
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
9
9
 
10
10
  /**
11
- * The step that carries the red whose places are <lieux> (`{ paquet, fichier, gardes,
11
+ * The step that carries the red whose places are <lieux> (`{ paquet, fichier, gardes, nommes,
12
12
  * dansLePlan }`), by the files the red names against what the testwriter (`portes.tests`) and the
13
- * developpeur (`portes.code`) wrote: `{ etape, fichiers, motif? }`. A test file that a guard or
14
- * the style refuses (`gardes` not empty) is the testwriter's, the earliest step (the developpeur
15
- * replays after him); a test that fails (no guard) and a file of code are the developpeur's. A red
13
+ * developpeur (`portes.code`) wrote: `{ etape, fichiers, motif? }`. A test file of the lot that a
14
+ * guard or the style refuses (`gardes` not empty), or that the message of a failed test out of
15
+ * the lot names (`nommes`, a guard written as a test, which lists what it finds), is the testwriter's, the
16
+ * earliest step (the developpeur replays after him): a red goes to who writes the file it names,
17
+ * as Gerrit gives a failed check back to the author of the file. A test that fails and names no
18
+ * test file of the lot (no guard) and a file of code are the developpeur's. A red
16
19
  * that names no file but lies in a package of the plan (a red task: lint, format check, typing,
17
20
  * build) is the developpeur's, no file named, as a red job of a CI goes back to its author (the
18
21
  * owner's decision on grillhouse-4nr.14.1); one out of the plan, or a file nobody wrote, is never
@@ -36,11 +39,27 @@ export function attribuerLeRouge({ lieux, portes }) {
36
39
  motif: `le rouge nomme ${inconnus.join(', ')}, que ni le testwriter ni le développeur ne portent`,
37
40
  };
38
41
  }
39
- const refuses = nommes.filter(
40
- f => tests.has(f) && avecFichier.some(l => l.fichier === f && (l.gardes ?? []).length > 0)
41
- );
42
+ // The test files of the lot the message of a failed test out of the lot names.
43
+ const designes = avecFichier
44
+ .filter(l => !tests.has(l.fichier))
45
+ .flatMap(l => l.nommes ?? [])
46
+ .filter(f => tests.has(f));
47
+ // A test file of a reader package extended to its tests (`portes.lecteurs`): the testwriter
48
+ // alone writes it, the developpeur's lock refuses it.
49
+ const lecteurs = new Set(portes.lecteurs ?? []);
50
+ const refuses = [
51
+ ...new Set([
52
+ ...nommes.filter(
53
+ f =>
54
+ tests.has(f) &&
55
+ (lecteurs.has(f) || avecFichier.some(l => l.fichier === f && (l.gardes ?? []).length > 0))
56
+ ),
57
+ ...designes,
58
+ ]),
59
+ ];
60
+ const tous = [...new Set([...nommes, ...designes])];
42
61
  return refuses.length
43
- ? { etape: 'testwriter', fichiers: refuses.length === nommes.length ? refuses : nommes }
62
+ ? { etape: 'testwriter', fichiers: refuses.length === tous.length ? refuses : tous }
44
63
  : { etape: 'developpeur', fichiers: nommes };
45
64
  }
46
65
 
@@ -76,9 +76,10 @@
76
76
  // hand) the developpeur alone writes, no testwriter; a sort
77
77
  // absent, out of its kinds, or without its reason or its command is comportement, the whole
78
78
  // circuit (`sorteDuPlan`, grillhouse-sos) (explorateur);
79
- // - `ecartes` (`composant`, `raison`): the components of the survey the plan does not touch,
80
- // which the circuit writes at the ticket; each other component of the survey the circuit
81
- // plays is in the packages (explorateur);
79
+ // - `ecartes` (`composant`, `raison`): the components of the survey, and those the title of
80
+ // the ticket names, that the plan does not touch, which the circuit writes at the ticket; each
81
+ // other component of the survey the circuit plays, and of the title, is in the packages; a
82
+ // component set apart without its reason makes the sheet out of conformity (explorateur);
82
83
  // - `noms_publies` (`fournisseur`, `consommateur`, `noms`): the names a component publishes to
83
84
  // another, which the lot adds to the provider's « Consommateurs » lines; as a code owner's
84
85
  // approval covers what it reviewed, the circuit writes them in the description (« ## Noms
@@ -258,12 +259,14 @@ const FICHES = {
258
259
  ecartes: liste(
259
260
  objet(
260
261
  {
261
- composant: texte('Un composant du relevé, comme le relevé le nomme.'),
262
+ composant: texte(
263
+ 'Un composant du relevé ou du titre, comme le relevé ou le titre le nomme (« . » la racine).'
264
+ ),
262
265
  raison: texte('Pourquoi le plan n’y touche pas.'),
263
266
  },
264
267
  ['composant', 'raison']
265
268
  ),
266
- 'Les composants du relevé que le plan ne touche pas, chacun avec sa raison ; chaque autre composant du relevé est dans tes paquets.'
269
+ 'Les composants du relevé, et ceux que le titre du ticket nomme, que le plan ne touche pas, chacun avec sa raison ; chaque autre composant du relevé ou du titre est dans tes paquets, comme un composant du titre dont le ticket nomme un fichier.'
267
270
  ),
268
271
  noms_publies: liste(
269
272
  objet(
@@ -645,11 +648,13 @@ export const bloquantsDeLaFiche = fiche => [
645
648
  // its entry in the INTERFACE of its package. A line on a changed file, a source or not, names it
646
649
  // alone or one of its parts, `<fichier>#<nom>`, as a review on GitHub or Gerrit accepts a comment
647
650
  // on any line of any changed file (BP 320.17: lines on an INTERFACE.md, a CADRE.md and a ceiling
648
- // the commit changes, refused); a changed file asks no line. The fault, or null.
649
- export function conformiteDuLot(fiche, { elements, fichiers }) {
651
+ // the commit changes, refused); a changed file asks no line, but a reference file the lot changes
652
+ // (<references>, their paths, `differencesDesReferences`) asks one, its `element` its path. The
653
+ // fault, or null.
654
+ export function conformiteDuLot(fiche, { elements, fichiers, references = [] }) {
650
655
  const lignes = fiche.conformite ?? [];
651
656
  const ids = new Set(elements.map(e => e.id));
652
- const hors = new Set(fichiers ?? []);
657
+ const hors = new Set([...(fichiers ?? []), ...references]);
653
658
  const duLot = element => {
654
659
  if (ids.has(element) || hors.has(element)) {
655
660
  return true;
@@ -658,7 +663,9 @@ export function conformiteDuLot(fiche, { elements, fichiers }) {
658
663
  return diese > 0 && diese < element.length - 1 && hors.has(element.slice(0, diese));
659
664
  };
660
665
  const fautes = [];
661
- const sans = elements.filter(e => !lignes.some(l => l.element === e.id)).map(e => e.id);
666
+ const sans = [...elements.map(e => e.id), ...references].filter(
667
+ id => !lignes.some(l => l.element === id)
668
+ );
662
669
  if (sans.length) {
663
670
  fautes.push(`conformite : sans ligne pour ${sans.join(', ')}`);
664
671
  }
@@ -971,6 +978,11 @@ function manques(role, f) {
971
978
  if (!(f.paquets ?? []).length) {
972
979
  out.push('paquets : manque, pour un plan');
973
980
  }
981
+ for (const [i, e] of (f.ecartes ?? []).entries()) {
982
+ if (!(typeof e.raison === 'string' && e.raison.trim())) {
983
+ out.push(`ecartes[${i}].raison : manque, pour un composant écarté`);
984
+ }
985
+ }
974
986
  for (const [i, r] of (f.reponses ?? []).entries()) {
975
987
  if (!/^[1-9]\d*$/.test(r.numero)) {
976
988
  out.push(`reponses[${i}].numero : « ${r.numero} » n'est pas le numéro d'une question`);
@@ -23,15 +23,19 @@ import {
23
23
  statSync,
24
24
  writeFileSync,
25
25
  } from 'node:fs';
26
+ import os from 'node:os';
26
27
  import path from 'node:path';
27
28
  import { GREFFON } from './cadre.mjs';
28
29
  import { avecLeFichierDuPoste, configurationDuPoste } from './fichier-du-poste.mjs';
29
- import { ecrireLaListe } from './enveloppe/paquets-du-plan.mjs';
30
+ import { ecrireLaListe, VARIABLE_TESTS_ETENDUS } from './enveloppe/paquets-du-plan.mjs';
31
+ import { ecritPar, marquesRestantes } from './enveloppe/travail-de-la-copie.mjs';
32
+ import { langageDe } from './langages.mjs';
30
33
  import { nomDuRole } from './etapes.mjs';
31
34
  import { departDe } from './mesure/base-de-passe.mjs';
32
35
  import { groupeVivant, signalerGroupe } from './mesure-de-la-machine.mjs';
33
36
  import { lancementDeLaPasse } from './passe-de-la-machine.mjs';
34
37
  import { prendreUnePlace } from './places-de-la-machine.mjs';
38
+ import { transcriptionsDeLaCopie } from './registre.mjs';
35
39
  import { cleDuConstat, lireFiche, reponsesAuxConstats, schemaDeFiche } from './resultats.mjs';
36
40
  import {
37
41
  ACTEUR,
@@ -128,7 +132,8 @@ const mtime = f => {
128
132
  /**
129
133
  * Where the session <id> of <ctx> keeps its result, in the working directory of the ticket
130
134
  * (`<copie>.travail/seances/<id>/`, as lancer.sh writes it): its exit code (`fin`), claude's JSON
131
- * result (`resultat.json`) and the reason of a write out of the plan (`hors-plan`).
135
+ * result (`resultat.json`), the reason of a write out of the plan (`hors-plan`) and the witness
136
+ * that the envelope started its command (`demarree`).
132
137
  */
133
138
  export function rangDeLaSeance(ctx, id) {
134
139
  const dossier = path.join(ctx.tmp, 'seances', id);
@@ -138,11 +143,13 @@ export function rangDeLaSeance(ctx, id) {
138
143
  resultat: path.join(dossier, 'resultat.json'),
139
144
  horsPlan: path.join(dossier, 'hors-plan'),
140
145
  horsPlanFait: path.join(dossier, 'hors-plan.json'),
146
+ demarree: path.join(dossier, 'demarree'),
141
147
  };
142
148
  }
143
149
 
144
- // The result the session ranged at <rang> left, or null without its end file.
145
- function resultatRange(rang, id) {
150
+ // The result the session ranged at <rang> left, or null without its end file; <horsEnveloppe>, a
151
+ // session no envelope holds, has no witness of its start.
152
+ function resultatRange(rang, id, { horsEnveloppe = false } = {}) {
146
153
  if (!existsSync(rang.fin)) {
147
154
  return null;
148
155
  }
@@ -155,13 +162,15 @@ function resultatRange(rang, id) {
155
162
  erreur: null,
156
163
  sortie: lire(rang.resultat).trim(),
157
164
  id,
165
+ demarree: horsEnveloppe ? null : existsSync(rang.demarree),
158
166
  };
159
167
  }
160
168
 
161
- // One launch of a session: `{ code, seance, bloque, erreur, sortie, id }`, `seance` the session's
162
- // exit code (from lancer.sh's end file for a session in the envelope), null when the launch
163
- // stopped before it, `sortie` claude's JSON result, its sheet in `structured_output`, `id` the
164
- // session whose result it is. Every
169
+ // One launch of a session: `{ code, seance, bloque, erreur, sortie, id, demarree }`, `seance` the
170
+ // session's exit code (from lancer.sh's end file for a session in the envelope), null when the
171
+ // launch stopped before it, `sortie` claude's JSON result, its sheet in `structured_output`, `id`
172
+ // the session whose result it is, `demarree` whether the envelope started its command (the
173
+ // witness lancer.sh ranges; null for a session no envelope holds). Every
165
174
  // session runs with the author of its role (BEADS_ACTOR). A session in the envelope, on the whole
166
175
  // ticket (`.` its component, the plan its `--paquets`), opens under the id <ouvre> (lancer.sh
167
176
  // --seance), or resumes the session <reprend> (lancer.sh --reprise); its result is the file
@@ -233,7 +242,9 @@ export async function lancer(
233
242
  // attempt made last (its sign of life names it and its session), takes the result that session
234
243
  // ranged: no second session. Dead without a result, it is launched anew, under this id.
235
244
  if ((ctx.essaiDeLActe ?? 1) > 1 && precedent?.lancement === identite && precedent.seanceId) {
236
- const mort = resultatRange(rangDeLaSeance(ctx, precedent.seanceId), precedent.seanceId);
245
+ const mort = resultatRange(rangDeLaSeance(ctx, precedent.seanceId), precedent.seanceId, {
246
+ horsEnveloppe,
247
+ });
237
248
  if (mort) {
238
249
  // The launch line of the dead attempt died in memory with it: written now, under its
239
250
  // session, which the bilan counts as the circuit's.
@@ -250,6 +261,7 @@ export async function lancer(
250
261
  rmSync(rang.resultat, { force: true });
251
262
  rmSync(rang.horsPlan, { force: true });
252
263
  rmSync(rang.horsPlanFait, { force: true });
264
+ rmSync(rang.demarree, { force: true });
253
265
  inscrire(ctx, {
254
266
  role: AUTEUR_DU_CIRCUIT,
255
267
  lancement: { role, seance: id, ...(objet ? { objet } : {}) },
@@ -342,7 +354,12 @@ export async function lancer(
342
354
  // A session out of the envelope (the relecteur, which plays tests) plays them on its share of
343
355
  // the cores, under nice and ionice; the launcher of an enveloped one does it in the envelope.
344
356
  const jouer = async base => {
345
- const env = { ...base, ...place.env, [ACTEUR]: role };
357
+ // The reader packages the plan extended to their tests: the testwriter alone is given them.
358
+ const testsEtendus =
359
+ role === 'testwriter' && ctx.testsEtendus?.length
360
+ ? { [VARIABLE_TESTS_ETENDUS]: ecrireLaListe(ctx.testsEtendus) }
361
+ : {};
362
+ const env = { ...base, ...place.env, ...testsEtendus, [ACTEUR]: role };
346
363
  const lancement = horsEnveloppe
347
364
  ? lancementDeLaPasse({ lourde: false, cmd: commande.cmd, args: commande.args, env })
348
365
  : { cmd: commande.cmd, args: commande.args, env };
@@ -424,6 +441,7 @@ export async function lancer(
424
441
  erreur: r.erreur ?? lire(erreurs),
425
442
  sortie,
426
443
  id,
444
+ demarree: horsEnveloppe ? null : existsSync(rang.demarree),
427
445
  };
428
446
  }
429
447
 
@@ -649,9 +667,14 @@ export function consigne(valeurs, rang = 0) {
649
667
  // <change> says what changed on a resumption, when it is not the proof or the checks (the
650
668
  // integration's refusal of the lot, `refus`). Returns the sheet and the findings it leaves,
651
669
  // which the circuit keeps: the activity writes nothing of the circuit's memory.
670
+ // A file left with the marks of a conflict never closes the copy, as git refuses to record an
671
+ // unmerged path and pre-commit's check-merge-conflict a file that carries a marker
672
+ // (`marquesDuRole`): the instruction names the files of the role that carry marks, and its sheet
673
+ // FAIT is refused while one of them does, the file named, as a sheet out of conformity (a sheet
674
+ // BLOQUÉ or BESOIN goes up as it is).
652
675
  // Throws an Arret for a launch that stops before its session, a motionless session, or
653
676
  // a session that ends twice without a sheet that conforms.
654
- export async function seance(
677
+ async function uneSeance(
655
678
  ctx,
656
679
  role,
657
680
  {
@@ -666,22 +689,40 @@ export async function seance(
666
689
  constats: gardes = [],
667
690
  reprise: gardee = null,
668
691
  retenir = () => {},
692
+ estUnTest = rouleDeTest(ctx),
693
+ evenement = 'neuve',
669
694
  ...activite
670
695
  }
671
696
  ) {
672
697
  // A resumption at the step that carries a red (`fichiers`, the files the red names): the session
673
698
  // carries these files alone, the rest of the lot being green.
674
- const rapport = fichiers?.length
699
+ const porte = fichiers?.length
675
700
  ? `${rapportBrut ?? ''}\n\nCette séance ne porte que ${fichiers.join(', ')} : le reste du lot est vert et ne se touche pas.`.trim()
676
701
  : rapportBrut;
702
+ // The files seen with marks stay looked at, whatever the index says of them afterwards.
703
+ const vus = new Set(ctx.fichiersDuConflit ?? []);
704
+ const marques = () => {
705
+ const { siens } = marquesDuRole(ctx, role, estUnTest, [...vus]);
706
+ siens.forEach(f => vus.add(f));
707
+ return siens;
708
+ };
709
+ const enConflit = marques();
710
+ const rapport = enConflit.length
711
+ ? `${porte ?? ''}\n\nLa copie garde un conflit non résolu dans ces fichiers de ton rôle : ${enConflit.join(', ')}. ${RESOUDRE}`.trim()
712
+ : porte;
677
713
  const nom = nomDuRole(role);
678
714
  const reprise = tentative > 1 && !derniere && gardee?.agent === role ? gardee : null;
679
- const { tache, ouverts, constats, valider, repondre } = constatsDeLaSeance(
680
- ctx.contexte,
681
- gardes,
682
- role,
683
- ctx.destinataire ?? null
684
- );
715
+ const {
716
+ tache,
717
+ ouverts,
718
+ constats,
719
+ valider: repond,
720
+ repondre,
721
+ } = constatsDeLaSeance(ctx.contexte, gardes, role, ctx.destinataire ?? null);
722
+ const valider = f =>
723
+ [repond(f), f.statut === 'FAIT' ? fauteDesMarques(marques()) : null]
724
+ .filter(Boolean)
725
+ .join(' ; ') || null;
685
726
  // The last sign of life of a launch of this session, which a fresh session after a failed
686
727
  // resumption waits for while its group runs.
687
728
  let dernierSigne = activite.precedent ?? null;
@@ -770,13 +811,131 @@ export async function seance(
770
811
  fort,
771
812
  valider,
772
813
  id: seanceId,
773
- evenement: 'neuve',
814
+ evenement,
774
815
  ...suivie,
775
816
  precedent: dernierSigne,
776
817
  })
777
818
  );
778
819
  }
779
820
 
821
+ // How a file in conflict is resolved, as every instruction that names one says it.
822
+ const RESOUDRE =
823
+ 'Les marques de conflit sont dans la copie (`<<<<<<<`, `=======`, `>>>>>>>`) : tu résous chaque fichier, marques retirées.';
824
+
825
+ /**
826
+ * The rule of a test file of the module of the language of the copy of <ctx> (`estUnTest`); a copy
827
+ * the module does not read judges every file the developpeur's.
828
+ * @param {{ copie: string }} ctx
829
+ */
830
+ export function rouleDeTest(ctx) {
831
+ return fichier => {
832
+ try {
833
+ return langageDe(ctx.copie).estUnTest(fichier, ctx.copie);
834
+ } catch {
835
+ return null;
836
+ }
837
+ };
838
+ }
839
+
840
+ // The files of the copy of <ctx> that still carry the marks of a conflict (`marquesRestantes`, the
841
+ // files of the conflict the circuit keeps among them), by who writes them: `siens`, those <role>
842
+ // writes (`ecritPar`), `autres`, the other role's. A role that writes no file has none.
843
+ function marquesDuRole(ctx, role, estUnTest, suspects = ctx.fichiersDuConflit ?? []) {
844
+ const ecrit = ecritPar(role, estUnTest);
845
+ if (!ecrit) {
846
+ return { siens: [], autres: [] };
847
+ }
848
+ const marques = marquesRestantes(ctx.copie, suspects);
849
+ return { siens: marques.filter(f => ecrit(f)), autres: marques.filter(f => !ecrit(f)) };
850
+ }
851
+
852
+ // What refuses a sheet whose session leaves <fichiers> with the marks of a conflict, or null.
853
+ const fauteDesMarques = fichiers =>
854
+ fichiers.length
855
+ ? `conflit non résolu : ${fichiers.join(', ')} ${fichiers.length > 1 ? 'portent' : 'porte'} encore des marques de conflit (\`<<<<<<<\`, \`=======\`, \`>>>>>>>\`), à retirer en résolvant ${fichiers.length > 1 ? 'chaque fichier' : 'le fichier'}`
856
+ : null;
857
+
858
+ /**
859
+ * The session of <role> on the whole ticket (`uneSeance`), the role that can lift a conflict
860
+ * always launched, as GitHub leaves the resolution to who can write the file: a launch the
861
+ * launcher refuses (the stop « lancement ») while files of the other role carry the marks of a
862
+ * conflict (the launcher accepts only the role that writes one of them,
863
+ * scripts/enveloppe/travail-de-la-copie.mjs `--role`) goes to that role first, a fresh session
864
+ * whose report names these files as the conflict it resolves, as the relaunch before a pass names
865
+ * them (scripts/circuit.mjs `avantLaPasse`), under an id and an event of its own (« conflit »):
866
+ * an attempt played again never takes its sheet for the one of <role>. Its sheet BLOQUÉ or BESOIN
867
+ * goes up as its own (`arretDuStatut`); on FAIT, the session of <role> launches again, once: a
868
+ * second refusal goes up.
869
+ */
870
+ export async function seance(ctx, role, options) {
871
+ try {
872
+ return await uneSeance(ctx, role, options);
873
+ } catch (e) {
874
+ const { autres } =
875
+ e instanceof Arret && e.nom === 'lancement'
876
+ ? marquesDuRole(ctx, role, options.estUnTest ?? rouleDeTest(ctx))
877
+ : { autres: [] };
878
+ if (!autres.length) {
879
+ throw e;
880
+ }
881
+ const autre = role === 'testwriter' ? 'developpeur' : 'testwriter';
882
+ commenter(
883
+ ctx,
884
+ role,
885
+ `lancement refusé sur un conflit dans des fichiers du ${nomDuRole(autre)} (${autres.join(', ')}) : sa séance d'abord, puis celle-ci.`
886
+ );
887
+ const { fiche, constats } = await uneSeance(ctx, autre, {
888
+ ...options,
889
+ tentative: 1,
890
+ reprise: null,
891
+ retenir: () => {},
892
+ change: undefined,
893
+ fichiers: null,
894
+ rapport: `Le lancement de la séance du ${nomDuRole(role)} s'arrête sur un conflit de la copie dans des fichiers de ton rôle, nommés ci-dessous : ta séance ne porte que leur résolution, puis la sienne se relance.`,
895
+ seanceId: idDeSeance(ctx, `conflit:${autre}`),
896
+ evenement: 'conflit',
897
+ });
898
+ if (fiche.statut !== 'FAIT') {
899
+ throw arretDuStatut(
900
+ ctx,
901
+ autre,
902
+ 1,
903
+ fiche,
904
+ `Sa séance devait lever un conflit de la copie (${autres.join(', ')}) avant celle du ${nomDuRole(role)}.`
905
+ );
906
+ }
907
+ return uneSeance(ctx, role, { ...options, constats });
908
+ }
909
+ }
910
+
911
+ /**
912
+ * The stop for the sheet <fiche> of the session <tentative> of <role>, BLOQUÉ (« hors-portee »)
913
+ * or BESOIN (« besoin »): its reason or question first, then its handover; the sheet's piece as
914
+ * its own, and the agent's question as its own. <suite> says what follows a BLOQUÉ.
915
+ */
916
+ export function arretDuStatut(
917
+ ctx,
918
+ role,
919
+ tentative,
920
+ fiche,
921
+ suite = 'Le circuit ne le relance pas sur ce rouge.'
922
+ ) {
923
+ const passation = derniereDe(ctx, role)?.text ?? 'aucune';
924
+ const qui = `Le ${nomDuRole(role)}`;
925
+ const { piece } = fiche;
926
+ return fiche.statut === 'BESOIN'
927
+ ? new Arret(
928
+ 'besoin',
929
+ `${qui} attend une réponse (séance ${tentative}) : ${fiche.question}\n\nSa passation :\n\n${passation}`,
930
+ { piece, question: `${qui} demande : ${fiche.question}` }
931
+ )
932
+ : new Arret(
933
+ 'hors-portee',
934
+ `${qui} se déclare bloqué (séance ${tentative}) : ${fiche.raison}\n\n${suite} Sa passation :\n\n${passation}`,
935
+ { piece }
936
+ );
937
+ }
938
+
780
939
  // The findings of the reviewer open for <role> among <constats>, as a session of the run whose
781
940
  // supervisor's context is <contexte> (`--contexte`, with `--depuis`, `--reprendre` or
782
941
  // `--etendre`) receives them, as a review its author relaunches on a change he frames keeps its
@@ -882,6 +1041,20 @@ export function seanceLancee(ctx, role, r) {
882
1041
  etendre: { paquet: ecriture.paquet, chemin: ecriture.chemin, piece: nomme.piece },
883
1042
  };
884
1043
  }
1044
+ // A test file of a reader package, written by the testwriter, extends the plan to the tests of
1045
+ // that package alone, without a stop: its code stays out of the plan, and no other role writes it.
1046
+ if (role === 'testwriter' && ecriture && !ecriture.racine) {
1047
+ const classe = rouleDeTest(ctx)(ecriture.chemin);
1048
+ if (classe?.test && !classe.matiere) {
1049
+ return {
1050
+ etendreTests: {
1051
+ paquet: ecriture.paquet,
1052
+ chemin: ecriture.chemin,
1053
+ piece: `${ecriture.chemin} est un fichier de test de ${ecriture.paquet}, un paquet lecteur que le lot fait rougir`,
1054
+ },
1055
+ };
1056
+ }
1057
+ }
885
1058
  const nom = ecriture ? (ecriture.racine ? 'la racine du dépôt' : ecriture.paquet) : null;
886
1059
  const dit = ecriture ? `${ecriture.chemin} est dans ${nom}` : null;
887
1060
  const question = !ecriture
@@ -902,13 +1075,14 @@ export function seanceLancee(ctx, role, r) {
902
1075
  `La transcription de la séance du ${role} n'a pas bougé en ${minutes ? `${minutes} min` : `${ctx.immobileMs} ms`} : la séance est arrêtée. Les dernières lignes du journal :\n\n${fin(lire(ctx.journal), 40)}`
903
1076
  );
904
1077
  }
905
- // The envelope's refusal (a line of the error stream that begins with `bwrap: `) of a session
906
- // that wrote no transcript: the launch died before its session, as bwrap says.
907
- const refus = (r.erreur ?? '').split('\n').find(l => l.startsWith('bwrap: '));
908
- if (refus !== undefined && r.seance !== 0 && derniereTrace(ctx.transcriptions) === 0) {
1078
+ // The envelope's refusal: it ended on a code other than 0 without the witness that its command
1079
+ // started (`demarree`, a state, never a text of the log): the launch died before its session,
1080
+ // whether the ticket already holds transcripts or not. The end of the log, where the envelope
1081
+ // says why, is cited in the report.
1082
+ if (r.demarree === false && r.seance !== null && r.seance !== 0) {
909
1083
  throw new Arret(
910
1084
  'lancement',
911
- `L'enveloppe refuse le lancement de la séance du ${role} (code ${r.seance ?? r.code}).\n${refus.trim()}\n\n${fin(lire(ctx.journal), 20)}`
1085
+ `L'enveloppe refuse le lancement de la séance du ${role} (code ${r.seance}) : sa commande n'a pas démarré.\n\n${fin(lire(ctx.journal), 20)}`
912
1086
  );
913
1087
  }
914
1088
  if (r.seance === null) {
@@ -950,6 +1124,15 @@ function relanceDeLaMorte(ctx, evenement, precedent) {
950
1124
  return precedent.lancement === `lancement:${evenement}:2` ? 2 : 1;
951
1125
  }
952
1126
 
1127
+ // Whether claude holds a conversation under the session <id> of <ctx>: its transcript,
1128
+ // `<id>.jsonl`, among those of the ticket's copy (`ctx.transcriptions`), or among those of the
1129
+ // main tree, where a session out of the envelope runs before the copy exists.
1130
+ function conversationOuverte(ctx, id) {
1131
+ return [ctx.transcriptions, transcriptionsDeLaCopie(ctx.racine, os.homedir())].some(d =>
1132
+ existsSync(path.join(d, `${id}.jsonl`))
1133
+ );
1134
+ }
1135
+
953
1136
  // The session of <role> with the instruction <texte>, its sheet read in its result
954
1137
  // (scripts/resultats.mjs): the sheet, kept with the ticket's sheets, its discoveries filed. A
955
1138
  // session that ends without a sheet that conforms (none, one out of its schema, a code other than
@@ -957,7 +1140,12 @@ function relanceDeLaMorte(ctx, evenement, precedent) {
957
1140
  // third template). The session opens under the id <id>, which its caller gives (a caller that plays
958
1141
  // an attempt again gives the same, and the session resumes), or resumes it with <premiere>
959
1142
  // « reprend »; with <repli> (a resumption), a session that ends in error returns null, for a
960
- // fresh session in its place. Throws an Arret for a launch that stops before its session, a
1143
+ // fresh session in its place. A session it opened is resumed only when claude holds its
1144
+ // conversation (`conversationOuverte`, its transcript): without one (its launch ended in error
1145
+ // before claude opened it), there is nothing to resume, as a cache
1146
+ // missed is built again, and the session launches afresh under the same id, once, with <texte>,
1147
+ // the whole instruction of its role, said at the ticket, and keeps its own resumption.
1148
+ // Throws an Arret for a launch that stops before its session, a
961
1149
  // motionless session, or twice no sheet that conforms (« sans-fiche »). <avec> joins its fields
962
1150
  // to the sheet's entry (the lot a review read); <valider>(sheet, attempt) names what makes a sheet
963
1151
  // out of conformity beyond its schema at that attempt (an unknown package of a plan, an answer
@@ -1010,22 +1198,43 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
1010
1198
  // The instruction of a resumption after the plan extended to a package the ticket names: the
1011
1199
  // session goes on where its lock stopped it, and the launch is neither a first nor a second.
1012
1200
  let etendu = null;
1201
+ // Whether the session already launched afresh for want of a conversation to resume, and
1202
+ // whether this call launched it: the launch of a dead attempt is taken up as it is (`lancer`).
1203
+ let repartie = false;
1204
+ let lancee = false;
1013
1205
  for (let essai = premier; essai <= 2; essai++) {
1014
1206
  const courte = () => consigne({ ticket: ctx.ticket, sujet: ctx.sujet, erreur: lu.erreur }, 2);
1015
1207
  const avantLeJournal = tailleDuJournal(ctx);
1016
- const r = await lancer(
1017
- ctx,
1018
- role,
1019
- etendu ?? (essai === 1 || !lu ? texte : courte()),
1020
- {
1021
- ...reste,
1022
- precedent: derniere,
1023
- evenement,
1024
- relance: essai,
1025
- signeDeVie,
1026
- ...ouvrir(etendu || essai > 1 ? 'reprend' : premiere),
1027
- }
1028
- );
1208
+ let mode = etendu || essai > 1 ? 'reprend' : premiere;
1209
+ // The session this call opened has no conversation to resume: it launches afresh, its first
1210
+ // launch again, with its whole instruction.
1211
+ if (
1212
+ mode === 'reprend' &&
1213
+ premiere === 'ouvre' &&
1214
+ !etendu &&
1215
+ lancee &&
1216
+ !repartie &&
1217
+ !conversationOuverte(ctx, courante)
1218
+ ) {
1219
+ repartie = true;
1220
+ commenter(
1221
+ ctx,
1222
+ role,
1223
+ `aucune conversation à reprendre sous la séance ${courante} : séance neuve et entière.`
1224
+ );
1225
+ lu = null;
1226
+ essai = 1;
1227
+ mode = 'ouvre';
1228
+ }
1229
+ const r = await lancer(ctx, role, etendu ?? (essai === 1 || !lu ? texte : courte()), {
1230
+ ...reste,
1231
+ precedent: derniere,
1232
+ evenement,
1233
+ relance: essai,
1234
+ signeDeVie,
1235
+ ...ouvrir(mode),
1236
+ });
1237
+ lancee = true;
1029
1238
  etendu = null;
1030
1239
  // The usage limit stops a session that does not end on its own: neither a sheet missing nor a
1031
1240
  // sheet to resume, the circuit waits for the hour the usage returns (« limite-d-usage »).
@@ -1036,11 +1245,20 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
1036
1245
  if (limite) {
1037
1246
  throw new Arret(
1038
1247
  'limite-d-usage',
1039
- `La séance du ${nomDuRole(role)} est arrêtée par la limite d'usage ; elle reprend ${limite.lisible ? `à l'heure que la limite donne (${new Date(limite.reprise).toISOString()})` : "dans une heure, la limite ne donne aucune heure lisible"}.`,
1248
+ `La séance du ${nomDuRole(role)} est arrêtée par la limite d'usage ; elle reprend ${limite.lisible ? `à l'heure que la limite donne (${new Date(limite.reprise).toISOString()})` : 'dans une heure, la limite ne donne aucune heure lisible'}.`,
1040
1249
  { resultat: limite }
1041
1250
  );
1042
1251
  }
1043
- const extension =seanceLancee(ctx, role, r)?.etendre;
1252
+ const suite = seanceLancee(ctx, role, r);
1253
+ const extensionDesTests = suite?.etendreTests;
1254
+ if (extensionDesTests) {
1255
+ ctx.etendreTestsEnVol(extensionDesTests);
1256
+ courante = r.id ?? courante;
1257
+ etendu = `Le plan du ticket s'étend aux tests de ${extensionDesTests.paquet} (${extensionDesTests.piece}) : le crochet qui t'a arrêté sur ${extensionDesTests.chemin} le laisse maintenant passer, les fichiers de test de ce paquet seuls ; son code reste hors du plan. Reprends ta tâche là où il t'a arrêté.`;
1258
+ essai--;
1259
+ continue;
1260
+ }
1261
+ const extension = suite?.etendre;
1044
1262
  if (extension) {
1045
1263
  ctx.etendreEnVol(extension);
1046
1264
  courante = r.id ?? courante;
@@ -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,
@@ -42,6 +45,7 @@ export {
42
45
  } from './taches-du-graphe.mjs';
43
46
  export { luUneFois } from './lecture-unique.mjs';
44
47
  export { avecLeFichierDuPoste } from './fichier-du-poste.mjs';
48
+ export { fluxDuProjetJoueLesMesures } from './flux-de-la-nuit.mjs';
45
49
  export { BASE_DU_LOT, CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
46
50
  export {
47
51
  consignerLesRegressions,