@roomi-fields/grillhouse 0.24.6 → 0.24.8

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.
@@ -52,7 +52,8 @@
52
52
  // answers once, and what stays open goes to who decides. One session of the explorateur out of
53
53
  // the envelope, on Sonnet, its instruction from the sixth template (the ticket, its title,
54
54
  // description and notes, the context), writes the plan in its sheet: its criteria, the packages
55
- // to touch, and its open questions, each with its piece; it surveys the components the ticket
55
+ // to touch, and its open questions, each with why it goes up (its motif: the language, the
56
+ // architecture, a gap to the reference, or no answer) and its piece; it surveys the components the ticket
56
57
  // reaches by `npx grillhouse composants-affectes <ticket>` (scripts/composants-affectes.mjs),
57
58
  // which the circuit plays no more as a step. A package the repository does not hold, one named
58
59
  // twice, or a component of the survey of the plan (`releve`, which the circuit plays with no
@@ -72,7 +73,10 @@
72
73
  // at), AUCUNE or DÉSACCORD. On its questions, its disagreement as one, the explorateur's session
73
74
  // is resumed once, its instruction from the seventh template (the numbered questions): its sheet
74
75
  // answers each question, CHANGE (what the plan becomes) or GARDE (why it stays), and carries the
75
- // plan as it becomes, which the circuit writes at the ticket again. The exchange is written at
76
+ // plan as it becomes, which the circuit writes at the ticket again. A sheet without a line of
77
+ // `reponses` by question put (`reponsesAuxQuestions` of scripts/resultats.mjs) is refused and
78
+ // asked again once of the same session, the numbers that lack named; only after that resumption
79
+ // does a question without its line stay open. The exchange is written at
76
80
  // the ticket (`Circuit · plan : …`, `Circuit · questionnement : …`) and its end kept with the
77
81
  // circuit's results (`questionnement`: objet, the questions asked, `questions`, change, issue,
78
82
  // ouvertes, the plan's fingerprint). What stays open (the plan's own questions, and each
@@ -111,9 +115,11 @@
111
115
  // sheet read is kept with the ticket's sheets, `.claude/worktrees/<ticket>.fiches.jsonl` (`{
112
116
  // date, role, fiche }`, the lot a review read joined to its sheet, `lot`), beside the circuit's
113
117
  // own results: the report of each proof and check, which the reviewer receives, with its outcome
114
- // (`resultat`), each stop (`arret`), each developpeur resumed who changed nothing (`inchange`),
115
- // each session launched (`lancement`, its role and its session id), each end of a run on a
116
- // question (`montee`: its code, its stop and who must answer it), which the bilan reads; and each
118
+ // (`resultat`), each stop (`arret`), each developpeur session that changed no file of the plan
119
+ // and goes to the checks or stops at « sans-livraison » (`inchange`), each session launched
120
+ // (`lancement`, its role and its session id), each end of a run on a question (`montee`: its
121
+ // code, its stop and the supervisor's session that ran it, `superviseur`, the
122
+ // `CLAUDE_CODE_SESSION_ID` Claude Code gives the run), which the bilan reads; and each
117
123
  // of its discoveries (`decouvertes`) filed closed under the ticket (scripts/ticket.sh, label
118
124
  // `decouverte`). A session that ends without a sheet that conforms (none, one out of its schema,
119
125
  // a code other than 0) is resumed once, the same session, with the third template, which names
@@ -261,7 +267,12 @@
261
267
  // their test files, a finding of one of their guards, whatever file it aims at, or a failed test
262
268
  // or a finding on a file a reference of the project covers), mixed with other reds or not, or a
263
269
  // guard's note of a key of the debt inscribed above what it finds (`a-elaguer`, the pass green
264
- // or not), sends no developpeur: the gesture `regeneration`, once for that pass. The circuit
270
+ // or not), sends no developpeur: the gesture `regeneration`, once for that pass. Checks of the
271
+ // plan green but for reds of references call for it too, before the final pass, as make
272
+ // remakes a generated file before what reads it: the final pass that is due then plays once, on
273
+ // the regenerated tree, and does not regenerate again a reference regenerated on that same tree
274
+ // (BPScript 320.3.9: the ceiling of the words, red at the checks, left to the final pass, which
275
+ // played the same tests again on the same tree for 6.1 min before regenerating). The circuit
265
276
  // keeps the copy as a lot, runs the command of each reference concerned on the whole copy (the
266
277
  // debt lowered from the notes of the pass, its guards not played again), out of the envelope,
267
278
  // under the lock of the machine, its output added to the log, then, as make remakes the targets
@@ -493,7 +504,6 @@ import {
493
504
  QUESTIONNEUR,
494
505
  RESPONSABLE,
495
506
  SUITE,
496
- SUPERVISEUR,
497
507
  } from './etapes.mjs';
498
508
  import { paquets } from './paquets.mjs';
499
509
  import { releve } from './composants-affectes.mjs';
@@ -508,6 +518,7 @@ import {
508
518
  lireResumes,
509
519
  lireSarif,
510
520
  regleDeLaLigne,
521
+ reponsesAuxQuestions,
511
522
  RESULTATS,
512
523
  schemaDeFiche,
513
524
  } from './resultats.mjs';
@@ -1185,9 +1196,11 @@ function consigne(valeurs, rang = 0) {
1185
1196
 
1186
1197
  // One session of <role> on the whole ticket: its sheet. A relaunch on its step (<tentative> past
1187
1198
  // 1) that is not the last (<derniere>) resumes the agent's session the circuit keeps
1188
- // (`ctx.reprise`, its author and id) with the short instruction (the fourth template); a
1189
- // resumption that fails (a code other than 0, or no sheet that conforms) falls back on a fresh and
1190
- // whole session, under a new id, which the circuit keeps. A fresh session's instruction (the first
1199
+ // (`ctx.reprise`, its author and id) with the short instruction (the fourth template); its sheet
1200
+ // refused is asked again once of that same session, as of a fresh one (`jusquALaFiche`), so the
1201
+ // question it carries goes up (BP 320.3.9); a resumption that ends in error (a code other than 0:
1202
+ // the session not found) falls back on a fresh and whole session, under a new id, which the
1203
+ // circuit keeps. A fresh session's instruction (the first
1191
1204
  // template) carries the ticket's description and notes as they are at its launch, the packages of
1192
1205
  // the plan, and the last handover of its author at the ticket. Every instruction, fresh or resumed,
1193
1206
  // carries the findings of the reviewer still open for its role (`ctx.constats`), all of them,
@@ -1213,14 +1226,17 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1213
1226
  rapport: rapport ?? 'aucun',
1214
1227
  constats,
1215
1228
  };
1216
- const r = await lancer(ctx, role, consigne(courte, 3), { fort, reprend: reprise.seance });
1217
- seanceLancee(ctx, role, r);
1218
- const lu = r.seance === 0 ? lireSaFiche(ctx, role, r.sortie) : { erreur: `code ${r.seance}` };
1219
- if (lu.fiche) return garder(ctx, role, lu.fiche);
1229
+ const fiche = await jusquALaFiche(ctx, role, consigne(courte, 3), {
1230
+ fort,
1231
+ premiere: 'reprend',
1232
+ id: reprise.seance,
1233
+ repli: true,
1234
+ });
1235
+ if (fiche) return fiche;
1220
1236
  commenter(
1221
1237
  ctx,
1222
1238
  role,
1223
- `reprise de la séance ${reprise.seance} sans fiche conforme (${lu.erreur}) : séance neuve et entière.`
1239
+ `reprise de la séance ${reprise.seance} finie en erreur : séance neuve et entière.`
1224
1240
  );
1225
1241
  }
1226
1242
  const lots = testsDuLot(ctx);
@@ -1293,10 +1309,12 @@ function seanceLancee(ctx, role, r) {
1293
1309
  // 0) is resumed once, the same session, with the short instruction that names what lacks (the
1294
1310
  // third template). The session opens under the id <id> (a new one by default), or resumes it with
1295
1311
  // <premiere> « reprend »; with <neuve> (the testwriter or the developpeur), the circuit keeps that
1296
- // id for that author (`ctx.reprise`). Throws an Arret for a launch that stops before its session,
1312
+ // id for that author (`ctx.reprise`); with <repli> (a resumption), a session that ends in error
1313
+ // returns null, for a fresh session in its place. Throws an Arret for a launch that stops before its session,
1297
1314
  // a motionless session, or twice no sheet that conforms (« sans-fiche »). <avec> joins its fields
1298
- // to the sheet's entry (the lot a review read); <valider> names what makes a sheet out of
1299
- // conformity beyond its schema (an unknown package of a plan), or null.
1315
+ // to the sheet's entry (the lot a review read); <valider>(sheet, attempt) names what makes a sheet
1316
+ // out of conformity beyond its schema at that attempt (an unknown package of a plan, an answer
1317
+ // without a line for a question put), or null.
1300
1318
  async function jusquALaFiche(ctx, role, texte, options = {}) {
1301
1319
  const {
1302
1320
  neuve,
@@ -1304,6 +1322,7 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1304
1322
  id = randomUUID(),
1305
1323
  avec = {},
1306
1324
  valider = () => null,
1325
+ repli = false,
1307
1326
  ...reste
1308
1327
  } = options;
1309
1328
  if (neuve) ctx.reprise = { agent: neuve, seance: id };
@@ -1319,11 +1338,12 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1319
1338
  ...ouvrir(essai === 1 ? premiere : 'reprend'),
1320
1339
  });
1321
1340
  seanceLancee(ctx, role, r);
1341
+ if (repli && r.seance !== 0) return null;
1322
1342
  lu =
1323
1343
  r.seance === 0
1324
1344
  ? lireSaFiche(ctx, role, r.sortie)
1325
1345
  : { erreur: `la séance finit en erreur (code ${r.seance})` };
1326
- const faute = lu.fiche ? valider(lu.fiche) : null;
1346
+ const faute = lu.fiche ? valider(lu.fiche, essai) : null;
1327
1347
  if (faute) lu = { erreur: `fiche non conforme : ${faute}` };
1328
1348
  if (lu.fiche) return garder(ctx, role, lu.fiche, avec);
1329
1349
  if (essai === 1) {
@@ -1528,7 +1548,7 @@ async function relire(ctx) {
1528
1548
  horsEnveloppe: true,
1529
1549
  droits: horsDeLEnveloppe(ctx, 'relecteur', 'opus'),
1530
1550
  avec: lot ? { lot: { ...lot, fichiers: [...tests, ...code] } } : {},
1531
- valider: f => conformiteDuLot(f, liste.elements),
1551
+ valider: f => conformiteDuLot(f, liste),
1532
1552
  });
1533
1553
  const texte = texteDuVerdict(fiche);
1534
1554
  const r = ctx.bdSous(AUTEUR_DU_VERDICT, 'comments', 'add', ctx.ticket, texte);
@@ -1541,7 +1561,7 @@ async function relire(ctx) {
1541
1561
  // in a bounded review (<bornee>: `{ touches, lignes }`, the ids the difference touches, null for
1542
1562
  // every one, and the lines of the review before by element), each marked to judge again, or to
1543
1563
  // take up with its line before; then the changed sources the language service does not read,
1544
- // whose elements he surveys himself, and why.
1564
+ // whose elements he surveys himself, one line of conformity each as `<fichier>#<nom>`, and why.
1545
1565
  function texteDesElements(liste, bornee = null) {
1546
1566
  if (liste.etat !== 'fait') {
1547
1567
  return `aucun : la liste n'a pas pu être calculée (${liste.raison}) ; tu relèves toi-même chaque élément du lot.`;
@@ -1563,7 +1583,7 @@ function texteDesElements(liste, bornee = null) {
1563
1583
  ? `le service de langage n'a pas pu tourner : ${liste.service}`
1564
1584
  : 'aucun tsconfig.json ne les lit';
1565
1585
  lignes.push(
1566
- `- Hors du service de langage (${pourquoi}), tu relèves toi-même leurs éléments : ${liste.horsDuService.join(', ')}.`
1586
+ `- Hors du service de langage (${pourquoi}), tu relèves toi-même leurs éléments, une ligne de conformité chacun, son élément \`<fichier>#<nom>\` : ${liste.horsDuService.join(', ')}.`
1567
1587
  );
1568
1588
  }
1569
1589
  return lignes.join('\n') || 'aucun : le lot ne change aucun élément du code.';
@@ -1717,13 +1737,14 @@ function referencesDesRouges(ctx, lieux, aElaguer = false) {
1717
1737
  // another one has just written runs after it, once for each reference whose writing calls for it;
1718
1738
  // then the copy kept again on that lot. `{ texte, regenerees, fichiers, restreinte }`: the report,
1719
1739
  // the names of the references changed, the files changed, and the range of the final pass that
1720
- // follows (null when nothing changed: no pass plays again, and the reds stand). A file a reference
1721
- // writes follows from the lot, as the output of a genrule, without a word of the plan, and the
1722
- // reviewer reads its difference; a file changed that none of the references run declares, or a
1723
- // command that fails (a reference of the project at another code than 0, one of the frame on a
1724
- // real failure alone) restores the copy as it was and stops at « references », each deviation in
1725
- // its question.
1726
- function regenerer(ctx, noms, notes = []) {
1740
+ // follows (null when nothing changed: no pass plays again, and the reds stand); with
1741
+ // <avantLaPasse>, the regeneration the checks of the plan call for, the final pass that is due
1742
+ // follows, whole or since the last review. A file a reference writes follows from the lot, as
1743
+ // the output of a genrule, without a word of the plan, and the reviewer reads its difference; a
1744
+ // file changed that none of the references run declares, or a command that fails (a reference of
1745
+ // the project at another code than 0, one of the frame on a real failure alone) restores the copy
1746
+ // as it was and stops at « references », each deviation in its question.
1747
+ function regenerer(ctx, noms, notes = [], avantLaPasse = false) {
1727
1748
  // The notes of the debt, in a file of the run, which the command that lowers it reads.
1728
1749
  const fichierDesNotes = path.join(ctx.base.dossier, 'dette-a-abaisser.json');
1729
1750
  const toutes = lesReferences(ctx).map(r =>
@@ -1803,7 +1824,7 @@ function regenerer(ctx, noms, notes = []) {
1803
1824
  }
1804
1825
  if (!fichiers.length) {
1805
1826
  return {
1806
- texte: `La régénération (${refs.map(r => `${r.nom}, \`${r.commande}\``).join(' ; ')}) ne change aucun fichier : aucune passe ne rejoue, et les rouges de la passe finale restent, chacun à son propriétaire.`,
1827
+ texte: `La régénération (${refs.map(r => `${r.nom}, \`${r.commande}\``).join(' ; ')}) ne change aucun fichier : ${avantLaPasse ? 'la passe finale juge le lot tel quel' : 'aucune passe ne rejoue, et les rouges de la passe finale restent, chacun à son propriétaire'}.`,
1807
1828
  regenerees: [],
1808
1829
  fichiers,
1809
1830
  restreinte: null,
@@ -1811,7 +1832,7 @@ function regenerer(ctx, noms, notes = []) {
1811
1832
  }
1812
1833
  return {
1813
1834
  texte: [
1814
- `Les références régénérées sur la copie entière : ${regenerees.map(r => r.nom).join(', ')} ; le lot porte leurs fichiers, puis la passe finale restreinte à ce qu'elles changent.`,
1835
+ `Les références régénérées sur la copie entière : ${regenerees.map(r => r.nom).join(', ')} ; le lot porte leurs fichiers, puis la passe finale${avantLaPasse ? '' : " restreinte à ce qu'elles changent"}.`,
1815
1836
  '',
1816
1837
  ...regenerees.map(r => `- ${r.nom} (\`${r.commande}\`) : ${siens(r).join(', ')}`),
1817
1838
  '',
@@ -2552,8 +2573,10 @@ const ligneDeCommande = c =>
2552
2573
  // in a package of the plan; `horsTitre` the packages out of the plan that hold a red; `arbitrer`
2553
2574
  // when every red of the plan is a finding to settle; `lieux` the place of each red, `{ fichier,
2554
2575
  // gardes }`, its file (null for a red without one) and the names its finding carries (none for a
2555
- // test or a task); `tous` every red as it was read; `notes`, at the final pass, each key of the debt
2556
- // a guard wrote inscribed above what it finds, `{ garde, fichier, regle, trouve }`.
2576
+ // test or a task); `references`, out of the final pass, the references whose reds the checks saw,
2577
+ // which their regeneration lifts before the final pass; `tous` every red as it was read; `notes`,
2578
+ // at the final pass, each key of the debt a guard wrote inscribed above what it finds, `{ garde,
2579
+ // fichier, regle, trouve }`.
2557
2580
  function controles(ctx, finale, restreinte = null, reportes = null) {
2558
2581
  const liste = paquets(ctx.copie).filter(p => !p.hors);
2559
2582
  const filtres = restreinte
@@ -2584,14 +2607,17 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2584
2607
  r => !reportes.rejouee || (Boolean(r.joue) && !joues.has(r.joue))
2585
2608
  ),
2586
2609
  ];
2587
- // Out of the final pass, the reds of the plan are the developpeur's; the others (the root, a red
2588
- // no file situates, a package out of the plan, a red of a reference, which its regeneration
2589
- // lifts, 4.2) wait for it.
2590
- const deReference = r =>
2591
- referencesDesRouges(ctx, [{ fichier: r.fichier ?? null, gardes: r.gardes ?? [] }]).length > 0;
2610
+ // Out of the final pass, the reds of the plan are the developpeur's; a red of a reference goes to
2611
+ // its regeneration (4.2), before the final pass; the others (the root, a red no file situates, a
2612
+ // package out of the plan) wait for the final pass.
2613
+ const lieu = r => ({ fichier: r.fichier ?? null, gardes: r.gardes ?? [] });
2614
+ const deReference = r => referencesDesRouges(ctx, [lieu(r)]).length > 0;
2592
2615
  const siens = r => finale || (r.dansLePlan && !deReference(r));
2593
2616
  const rouges = tous.filter(siens);
2594
- const laisses = tous.filter(r => !siens(r));
2617
+ const references = finale
2618
+ ? []
2619
+ : referencesDesRouges(ctx, tous.filter(r => !siens(r) && deReference(r)).map(lieu));
2620
+ const laisses = tous.filter(r => !siens(r) && (finale || !deReference(r)));
2595
2621
  const aRepasser = resultats.filter(r => r.code === A_REPASSER);
2596
2622
  const nommer = r => `${ligneDeCommande(r)} (code ${r.code})`;
2597
2623
  const enEchec = resultats.filter(r => r.code !== 0 && r.code !== A_REPASSER);
@@ -2609,6 +2635,10 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2609
2635
  laisses.length
2610
2636
  ? ` ; laissés à la passe finale, ${laisses.length} rouge(s) hors du plan`
2611
2637
  : ''
2638
+ }${
2639
+ references.length
2640
+ ? ` ; des rouges sont ceux de références, à leur régénération avant la passe finale (${references.map(r => r.nom).join(', ')})`
2641
+ : ''
2612
2642
  }`;
2613
2643
  // Where the checks played: the final pass out of the envelope, on the whole copy or restricted
2614
2644
  // to what changed since the last review; the checks of the plan, its tests and packages, its
@@ -2662,7 +2692,8 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2662
2692
  rouges: rouges.map(r => ({ paquet: nomDuPaquet(r), texte: r.texte, detail: r.detail })),
2663
2693
  resume,
2664
2694
  horsTitre: [...new Set(rouges.map(r => r.horsTitre).filter(Boolean))].sort(),
2665
- lieux: rouges.map(r => ({ fichier: r.fichier ?? null, gardes: r.gardes ?? [] })),
2695
+ lieux: rouges.map(lieu),
2696
+ references,
2666
2697
  tous,
2667
2698
  notes: finale
2668
2699
  ? resultats.flatMap(r =>
@@ -2881,6 +2912,9 @@ async function derouler(ctx, debut) {
2881
2912
  // the testwriter, the sending and the handover as its report, then the proof and the
2882
2913
  // developpeur.
2883
2914
  if (ctx.renvoiAuTestwriter) {
2915
+ if (empreinte(ctx) === avant) {
2916
+ inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, etape: CODE, inchange: true });
2917
+ }
2884
2918
  throw new Arret(
2885
2919
  'sans-livraison',
2886
2920
  `La fiche de la séance ${tentative} du développeur renvoie une deuxième fois de suite au testwriter, sans contrôles verts depuis le premier renvoi : le testwriter n'a pas levé ce rouge.\n\n${renvoi}`
@@ -2961,11 +2995,16 @@ async function derouler(ctx, debut) {
2961
2995
  };
2962
2996
  const suivante = tentative + 1;
2963
2997
  // A final pass with a red of a reference, mixed with others or not, or a debt the lot
2964
- // lowers: their regeneration, once for this pass; the reds that remain then go each to
2965
- // its owner.
2998
+ // lowers: their regeneration, once for this pass, but for a reference the checks had
2999
+ // regenerated on this same tree, whose inputs have not changed since; the reds that remain
3000
+ // then go each to its owner.
3001
+ const dejaRegenerees =
3002
+ ctx.regenereSur && ctx.regenereSur.arbre === passe.arbre ? ctx.regenereSur.noms : [];
2966
3003
  const aRegenerer =
2967
3004
  passeFinale && !regeneration && (k.rouge || k.notes.length > 0)
2968
- ? referencesDesRouges(ctx, k.lieux, k.notes.length > 0)
3005
+ ? referencesDesRouges(ctx, k.lieux, k.notes.length > 0).filter(
3006
+ r => !dejaRegenerees.includes(r.nom)
3007
+ )
2969
3008
  : [];
2970
3009
  if (aRegenerer.length) {
2971
3010
  const noms = aRegenerer.map(r => r.nom);
@@ -3012,6 +3051,21 @@ async function derouler(ctx, debut) {
3012
3051
  arreter('controles', null);
3013
3052
  } else if (k.aRepasser) {
3014
3053
  arreter('a-repasser', null);
3054
+ } else if (!passeFinale && k.references.length) {
3055
+ // The checks green but for reds of references: their regeneration, then the final pass,
3056
+ // which plays once, on the regenerated tree, as make remakes a generated file before
3057
+ // what reads it.
3058
+ geste(ctx, 'regeneration');
3059
+ ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3060
+ ctx.renvoiAuTestwriter = false;
3061
+ ctx.aRegenerer = {
3062
+ noms: k.references.map(r => r.nom),
3063
+ notes: [],
3064
+ avantLaPasse: true,
3065
+ };
3066
+ etape = REFERENCES;
3067
+ tentative = 0;
3068
+ finale = true;
3015
3069
  } else {
3016
3070
  ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3017
3071
  // Green checks: a sending of the developpeur to the testwriter may come again.
@@ -3045,16 +3099,22 @@ async function derouler(ctx, debut) {
3045
3099
  "L'état du circuit ne garde pas les références à régénérer : la passe finale les redonne (`--depuis developpeur`)."
3046
3100
  );
3047
3101
  }
3048
- const g = regenerer(ctx, a.noms, a.notes);
3102
+ const g = regenerer(ctx, a.noms, a.notes, Boolean(a.avantLaPasse));
3049
3103
  ecrireRapport(ctx, 'references', g.texte, {
3050
3104
  regenerees: g.regenerees,
3051
3105
  fichiers: g.fichiers,
3052
3106
  });
3053
- ctx.regeneration = {
3054
- restreinte: g.restreinte,
3055
- entiere: a.entiere,
3056
- reportes: { rouges: a.rouges, rejouee: g.fichiers.length > 0 },
3057
- };
3107
+ // After the checks, the final pass that is due, on the regenerated tree, which does not
3108
+ // regenerate again the references just regenerated on it; after a final pass, the pass
3109
+ // restricted to what the regeneration changed, with the reds of the pass before.
3110
+ ctx.regenereSur = a.avantLaPasse ? { arbre: arbreDeLaCopie(ctx), noms: a.noms } : null;
3111
+ ctx.regeneration = a.avantLaPasse
3112
+ ? null
3113
+ : {
3114
+ restreinte: g.restreinte,
3115
+ entiere: a.entiere,
3116
+ reportes: { rouges: a.rouges, rejouee: g.fichiers.length > 0 },
3117
+ };
3058
3118
  ctx.aRegenerer = null;
3059
3119
  etape = CONTROLES;
3060
3120
  finale = true;
@@ -3270,19 +3330,20 @@ function depart(ctx, e) {
3270
3330
  }
3271
3331
 
3272
3332
  // The end of the run, its exit code <code>: an end on a stop kept with the circuit's results
3273
- // (`montee`: its code, its stop and who must answer its question, the supervisor for a stop
3274
- // without one, as an end at 75 he replays), from which the
3275
- // bilan measures the wait to the run that answers it, then the ticket's bilan at the ticket
3333
+ // (`montee`: its code, its stop and the supervisor's session that ran it, `superviseur`, when
3334
+ // Claude Code names it), from which the bilan measures the wait to the run that answers it, the
3335
+ // owner's when he writes in that session meanwhile, then the ticket's bilan at the ticket
3276
3336
  // (scripts/bilan.mjs); a bilan it cannot write leaves the code as it is.
3277
3337
  function aLaFin(ctx, code) {
3278
3338
  try {
3279
3339
  if (code !== 0) {
3340
+ const superviseur = process.env.CLAUDE_CODE_SESSION_ID;
3280
3341
  inscrire(ctx, {
3281
3342
  role: AUTEUR_DU_CIRCUIT,
3282
3343
  montee: {
3283
3344
  code,
3284
3345
  raison: ctx.courant?.raison ?? null,
3285
- qui: ctx.courant?.question?.qui ?? SUPERVISEUR,
3346
+ ...(superviseur ? { superviseur } : {}),
3286
3347
  },
3287
3348
  });
3288
3349
  }
@@ -3298,10 +3359,12 @@ function aLaFin(ctx, code) {
3298
3359
  const lignesDesQuestions = questions =>
3299
3360
  (questions ?? []).map((q, i) => `${i + 1}. (${q.vise}) ${q.question}`).join('\n');
3300
3361
 
3301
- // The open questions <questions> of a plan (`{ question, piece }`), one per line, each with its
3302
- // piece.
3362
+ // The open questions <questions> of a plan (`{ question, motif, piece }`), one per line, each with
3363
+ // why it goes up, when the explorateur wrote it, and its piece.
3303
3364
  const lignesOuvertes = questions =>
3304
- questions.map((q, i) => `${i + 1}. ${q.question} (${q.piece})`).join('\n');
3365
+ questions
3366
+ .map((q, i) => `${i + 1}. ${q.motif ? `(${q.motif}) ` : ''}${q.question} (${q.piece})`)
3367
+ .join('\n');
3305
3368
 
3306
3369
  // The rubric « ## <titre> » of the project's charter (CLAUDE.md of the main tree), up to the next
3307
3370
  // `##` heading, or what stands in its place.
@@ -3469,8 +3532,9 @@ const ecartsDe = fiche =>
3469
3532
  // explorateur, out of the envelope, writes the plan in its sheet (its criteria, the packages to
3470
3533
  // touch, its open questions), which the circuit writes at the ticket (`ecrireLePlan`); one session
3471
3534
  // of the questionneur reads it once; on its questions (its disagreement as one), the explorateur's
3472
- // session, resumed, answers once, CHANGE or GARDE by question, its sheet the plan as it becomes. A
3473
- // question it leaves without an answer stays open with its own. Each session's work is named in
3535
+ // session, resumed, answers once, CHANGE or GARDE by question, its sheet the plan as it becomes; a
3536
+ // sheet without a line by question put is asked again once of that session, and a question it
3537
+ // still leaves without an answer stays open with its own. Each session's work is named in
3474
3538
  // the state while it runs (`questionnement`); the exchange is written at the ticket and its end
3475
3539
  // kept with the circuit's results (`questionnement`, which the bilan counts). A plan that has
3476
3540
  // passed, its title and criteria unchanged since (`empreinteDuPlan`), passes. Null when nothing
@@ -3577,7 +3641,14 @@ async function lePlan(ctx) {
3577
3641
  },
3578
3642
  6
3579
3643
  ),
3580
- { ...explorateur, premiere: 'reprend' }
3644
+ {
3645
+ ...explorateur,
3646
+ premiere: 'reprend',
3647
+ // A line of `reponses` by question put, asked again once; after it, a question without
3648
+ // its line stays open.
3649
+ valider: (f, essai) =>
3650
+ explorateur.valider(f) ?? (essai === 1 ? reponsesAuxQuestions(f, posees.length) : null),
3651
+ }
3581
3652
  );
3582
3653
  reponses = plan.reponses ?? [];
3583
3654
  const lignes = reponses.map(r => `${r.numero}. ${r.reponse} — ${r.texte}`).join('\n');
@@ -29,7 +29,8 @@
29
29
  // dependencies (the `deps` and `data` of Bazel, the `implicitDependencies` of Nx).
30
30
  // - The readers of an element are the other components that: its provider's `## Consommateurs`
31
31
  // declares for it, or for `*` (`consommateurs`); import it, or the whole provider, in their
32
- // production code (`import`, the uses of scripts/consommateurs.mjs); hold a test file that names
32
+ // production code, or in their tests for a package of the shared test material (`import`, the
33
+ // uses of scripts/consommateurs.mjs); hold a test file that names
33
34
  // it, as a whole word, and imports the provider (the test file's path).
34
35
  // - By the types (scripts/references-par-les-types.mjs): each element, a member of a type
35
36
  // included, resolved by TypeScript's language service over the components' `tsconfig.json`;
@@ -7,8 +7,9 @@
7
7
  // - `a` : duree, tempo
8
8
  // - `c` : *
9
9
  //
10
- // This check reads what the production code of every component imports from every other, and
11
- // refuses (exit 1) a use that the provider's interface does not declare, and a declared name that
10
+ // This check reads what the production code of every component imports from every other, and what
11
+ // its tests import from a package of the shared test material (`matieres`), whose only readers are
12
+ // tests, as knip counts test files as entries out of its `--production` mode; it refuses (exit 1) a use that the provider's interface does not declare, and a declared name that
12
13
  // no code of its consumer uses, as ESLint's `no-unused-vars` refuses a name nothing uses (BP
13
14
  // 320.3.2.1: « LEVEL_TYPES » declared for 020-loader, only reported, caught by its second review).
14
15
  // `*` stands for a namespace, default, re-export-all or side-effect import, and for a dynamic
@@ -20,7 +21,8 @@
20
21
  // `usage-non-declare`, `declare-non-utilise` or `ligne-mal-formee` (`homonyme` for two components
21
22
  // of one name, keyed by the first path). The debt of a new rule is inscribed once, when a project
22
23
  // updates to it (scripts/migrations/0.24.4-noms-declares-inutilises.mjs,
23
- // scripts/migrations/0.24.6-lignes-mal-formees.mjs); in a ticket, the name leaves its line, and a
24
+ // scripts/migrations/0.24.6-lignes-mal-formees.mjs,
25
+ // scripts/migrations/0.24.7-matiere-dans-les-tests.mjs); in a ticket, the name leaves its line, and a
24
26
  // line of prose is written as a list of names.
25
27
  //
26
28
  // npx grillhouse consommateurs run from the repository root
@@ -30,8 +32,9 @@
30
32
  // `docs/agents/hors-cadre.txt`: neither read nor checked, as provider or as consumer. Every check
31
33
  // of the frame enumerates the components through `composants`. In a repository of packages, such a
32
34
  // package stays a workspace, and Turborepo plays none of its tasks (scripts/turbo-des-paquets.mjs
33
- // writes its configuration). For the check of the uses, test files,
34
- // `dist/`, `docs/` and `node_modules/` are not production code and are not read; nor are Vite's
35
+ // writes its configuration). For the check of the uses, test files (under a folder `test/`,
36
+ // `tests/` or `__tests__/`, or named `*.test.*`, `*.spec.*`) count only for their imports of a
37
+ // package of the material; `dist/`, `docs/` and `node_modules/` are never read, nor are Vite's
35
38
  // temporary files, and a file gone between the walk and its read is passed over (`parcourir`).
36
39
  // The identity of a component is its name: two directories of the same name, one under `packages/`
37
40
  // and one under `src/`, are refused, both paths named (the way npm workspaces, Nx and Cargo refuse
@@ -255,13 +258,18 @@ export function parcourir(chemin, sauter = () => false) {
255
258
  // The text of the file <f> a walk listed, or null when it is gone since.
256
259
  export const lireSiPresent = f => siPresent(x => readFileSync(x, 'utf8'), f, null);
257
260
 
258
- // The production source files under <dir>: test folders and test files left out.
261
+ // The source files under <dir>: [{ f, test }], `test` for a file under a test folder or of a test
262
+ // name.
259
263
  function fichiers(dir) {
260
264
  const nom = p => path.basename(p);
261
- return parcourir(
262
- dir,
263
- p => SKIP.has(nom(p)) || nom(p).startsWith('.') || TEST_DIR.has(nom(p))
264
- ).filter(p => SOURCE.test(nom(p)) && !isTest(nom(p)));
265
+ const sousTest = p =>
266
+ path
267
+ .relative(dir, path.dirname(p))
268
+ .split(path.sep)
269
+ .some(s => TEST_DIR.has(s));
270
+ return parcourir(dir, p => SKIP.has(nom(p)) || nom(p).startsWith('.'))
271
+ .filter(p => SOURCE.test(nom(p)))
272
+ .map(f => ({ f, test: isTest(nom(f)) || sousTest(f) }));
265
273
  }
266
274
 
267
275
  // The component an import specifier reaches from <fichier>, other than <soi>, or null.
@@ -279,14 +287,16 @@ function fournisseur(spec, fichier, tous, soi) {
279
287
  );
280
288
  }
281
289
 
282
- // What each component really uses of the others: Map provider → Map consumer → Set of names.
290
+ // What each component really uses of the others: Map provider → Map consumer → Set of names. Its
291
+ // production code counts for every provider, its tests for a package of the material only.
283
292
  export function utilise(racine, tous = composants(racine)) {
284
293
  const out = new Map();
294
+ const matiere = new Set(matieres(racine).map(m => m.nom));
285
295
  for (const c of tous) {
286
- for (const f of fichiers(c.dir)) {
296
+ for (const { f, test } of fichiers(c.dir)) {
287
297
  for (const { spec, noms } of imports(lireSiPresent(f) ?? '')) {
288
298
  const p = fournisseur(spec, f, tous, c);
289
- if (!p) continue;
299
+ if (!p || (test && !matiere.has(p.nom))) continue;
290
300
  if (!out.has(p.nom)) out.set(p.nom, new Map());
291
301
  const parConsommateur = out.get(p.nom);
292
302
  if (!parConsommateur.has(c.nom)) parConsommateur.set(c.nom, new Set());