@roomi-fields/grillhouse 0.30.0 → 0.31.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 (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +30 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/dist/temporal/circuit/client.d.ts +2 -2
  8. package/dist/temporal/circuit/client.js.map +1 -1
  9. package/dist/temporal/circuit/commande.js +4 -4
  10. package/dist/temporal/circuit/commande.js.map +1 -1
  11. package/dist/temporal/circuit/contrat.d.ts +3 -3
  12. package/dist/temporal/circuit/contrat.js +8 -2
  13. package/dist/temporal/circuit/contrat.js.map +1 -1
  14. package/dist/temporal/circuit/deroule.js +3 -3
  15. package/dist/temporal/circuit/deroule.js.map +1 -1
  16. package/dist/temporal/commande.js +5 -6
  17. package/dist/temporal/commande.js.map +1 -1
  18. package/dist/temporal/installation.d.ts +0 -4
  19. package/dist/temporal/installation.js +12 -34
  20. package/dist/temporal/installation.js.map +1 -1
  21. package/docs/ARCHITECTURE.md +49 -19
  22. package/docs/CADRE.md +10 -0
  23. package/docs/INTERFACE.md +8 -3
  24. package/package.json +2 -2
  25. package/scripts/activites.mjs +150 -77
  26. package/scripts/aiguillage.mjs +33 -11
  27. package/scripts/avancement.mjs +27 -10
  28. package/scripts/bilan.mjs +101 -25
  29. package/scripts/cadre.mjs +5 -2
  30. package/scripts/circuit.mjs +153 -57
  31. package/scripts/composants-affectes.mjs +64 -21
  32. package/scripts/composition-des-langages.mjs +5 -3
  33. package/scripts/conformite.mjs +54 -19
  34. package/scripts/dependances-internes.mjs +9 -3
  35. package/scripts/dernier-vert.mjs +54 -19
  36. package/scripts/dette.mjs +32 -11
  37. package/scripts/donnees-cles.mjs +24 -8
  38. package/scripts/droits.mjs +40 -15
  39. package/scripts/empreinte-d-etape.mjs +17 -0
  40. package/scripts/engendres.mjs +15 -5
  41. package/scripts/enveloppe/enveloppe.mjs +141 -48
  42. package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
  43. package/scripts/faits-du-circuit.mjs +1 -1
  44. package/scripts/flux-des-paquets.mjs +21 -7
  45. package/scripts/gardes-du-cadre.mjs +9 -3
  46. package/scripts/init.mjs +11 -4
  47. package/scripts/integration/file.mjs +84 -29
  48. package/scripts/integration/integrer.mjs +70 -24
  49. package/scripts/integration/rejeu.mjs +26 -9
  50. package/scripts/jointure.d.ts +6 -1
  51. package/scripts/langages/cargo/commandes.mjs +97 -18
  52. package/scripts/langages/cargo/composants.mjs +24 -8
  53. package/scripts/langages/cargo/index.mjs +4 -0
  54. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  55. package/scripts/langages/python/commandes.mjs +3 -1
  56. package/scripts/langages/python/index.mjs +4 -0
  57. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  58. package/scripts/langages/typescript/composants.mjs +9 -3
  59. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  60. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  61. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  62. package/scripts/langages/typescript/frontieres.mjs +66 -22
  63. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  64. package/scripts/langages/typescript/index.mjs +10 -3
  65. package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
  66. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  67. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  68. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  69. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  70. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
  71. package/scripts/langages/typescript/parcours.mjs +12 -4
  72. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  73. package/scripts/langages/typescript/resumes.mjs +9 -3
  74. package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
  75. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
  76. package/scripts/langages/typescript/tests.mjs +24 -8
  77. package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
  78. package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
  79. package/scripts/langages/typescript/verdict.mjs +3 -1
  80. package/scripts/langages/typescript/verifier.mjs +28 -10
  81. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  82. package/scripts/langages/typescript/vitest-config/base.mjs +7 -2
  83. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  84. package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
  85. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
  86. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
  87. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  88. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
  89. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  90. package/scripts/lint-des-scripts.mjs +58 -0
  91. package/scripts/mesure/base-de-passe.mjs +117 -25
  92. package/scripts/mesure/pression.mjs +9 -3
  93. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  94. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  95. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  96. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
  97. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  98. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  99. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
  100. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
  101. package/scripts/nuit.sh +15 -0
  102. package/scripts/outil.mjs +3 -1
  103. package/scripts/outils-cles.mjs +18 -7
  104. package/scripts/paquet-npm.mjs +15 -5
  105. package/scripts/paquets.mjs +12 -4
  106. package/scripts/passe-de-la-machine.mjs +7 -2
  107. package/scripts/places-de-la-machine.mjs +66 -12
  108. package/scripts/preparation.mjs +15 -5
  109. package/scripts/registre.mjs +6 -2
  110. package/scripts/reprise.mjs +66 -0
  111. package/scripts/resultats.mjs +105 -37
  112. package/scripts/seances.mjs +22 -4
  113. package/scripts/services-du-noyau.mjs +1 -0
  114. package/scripts/sous-commandes.mjs +3 -1
  115. package/scripts/style-a-l-ecriture.mjs +48 -17
  116. package/scripts/tableau.mjs +34 -9
  117. package/scripts/taches-du-graphe.mjs +33 -13
  118. package/scripts/ticket-du-circuit.mjs +10 -0
  119. package/scripts/transitions.mjs +141 -24
  120. package/scripts/verrou-de-fichier.mjs +6 -2
  121. package/scripts/verrou-de-machine.mjs +123 -39
  122. package/scripts/verrous/commande.mjs +50 -17
  123. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  124. package/scripts/verrous/verrou.mjs +42 -14
  125. package/skills/explorateur/SKILL.md +7 -1
  126. package/skills/grill/SKILL.md +1 -1
  127. package/skills/mesure/SKILL.md +3 -0
  128. package/skills/relecteur/SKILL.md +1 -1
  129. package/skills/testwriter/SKILL.md +12 -6
@@ -504,25 +504,35 @@ export function sorteDuPlan(fiche) {
504
504
  function erreurs(schema, valeur, ou) {
505
505
  const nom = ou || 'la fiche';
506
506
  if (schema.type === 'object') {
507
- if (!valeur || typeof valeur !== 'object' || Array.isArray(valeur))
507
+ if (!valeur || typeof valeur !== 'object' || Array.isArray(valeur)) {
508
508
  return [`${nom} : un objet`];
509
+ }
509
510
  const out = [];
510
511
  for (const k of schema.required ?? []) {
511
- if (!(k in valeur)) out.push(`${ou ? `${ou}.` : ''}${k} : manque`);
512
+ if (!(k in valeur)) {
513
+ out.push(`${ou ? `${ou}.` : ''}${k} : manque`);
514
+ }
512
515
  }
513
516
  for (const [k, v] of Object.entries(valeur)) {
514
517
  const sous = schema.properties[k];
515
518
  const chemin = `${ou ? `${ou}.` : ''}${k}`;
516
- if (!sous) out.push(`${chemin} : hors du schéma`);
517
- else out.push(...erreurs(sous, v, chemin));
519
+ if (!sous) {
520
+ out.push(`${chemin} : hors du schéma`);
521
+ } else {
522
+ out.push(...erreurs(sous, v, chemin));
523
+ }
518
524
  }
519
525
  return out;
520
526
  }
521
527
  if (schema.type === 'array') {
522
- if (!Array.isArray(valeur)) return [`${nom} : une liste`];
528
+ if (!Array.isArray(valeur)) {
529
+ return [`${nom} : une liste`];
530
+ }
523
531
  return valeur.flatMap((v, i) => erreurs(schema.items, v, `${ou}[${i}]`));
524
532
  }
525
- if (typeof valeur !== 'string') return [`${nom} : un texte`];
533
+ if (typeof valeur !== 'string') {
534
+ return [`${nom} : un texte`];
535
+ }
526
536
  if (schema.enum && !schema.enum.includes(valeur)) {
527
537
  return [`${nom} : « ${valeur} » n'est pas l'un de ${schema.enum.join(', ')}`];
528
538
  }
@@ -561,13 +571,17 @@ export function conformiteDuLot(fiche, { elements, fichiers }) {
561
571
  const ids = new Set(elements.map(e => e.id));
562
572
  const hors = new Set(fichiers ?? []);
563
573
  const duLot = element => {
564
- if (ids.has(element) || hors.has(element)) return true;
574
+ if (ids.has(element) || hors.has(element)) {
575
+ return true;
576
+ }
565
577
  const diese = element.lastIndexOf('#');
566
578
  return diese > 0 && diese < element.length - 1 && hors.has(element.slice(0, diese));
567
579
  };
568
580
  const fautes = [];
569
581
  const sans = elements.filter(e => !lignes.some(l => l.element === e.id)).map(e => e.id);
570
- if (sans.length) fautes.push(`conformite : sans ligne pour ${sans.join(', ')}`);
582
+ if (sans.length) {
583
+ fautes.push(`conformite : sans ligne pour ${sans.join(', ')}`);
584
+ }
571
585
  for (const [i, l] of lignes.entries()) {
572
586
  if (!duLot(l.element)) {
573
587
  fautes.push(`conformite[${i}].element : ${l.element} n'est pas un élément du lot`);
@@ -610,10 +624,14 @@ export function cleDuConstat(titre) {
610
624
  // (<titres>), as the author answers in each thread of a review: a FAIT without the answer to one,
611
625
  // by its title (a BLOQUÉ or a BESOIN stops the circuit before any review). The fault, or null.
612
626
  export function reponsesAuxConstats(fiche, titres) {
613
- if (fiche.statut !== 'FAIT') return null;
627
+ if (fiche.statut !== 'FAIT') {
628
+ return null;
629
+ }
614
630
  const repondus = new Set((fiche.reponses ?? []).map(r => cleDuConstat(r.titre)));
615
631
  const sans = titres.filter(t => !repondus.has(t)).map(t => `« ${t} »`);
616
- if (!sans.length) return null;
632
+ if (!sans.length) {
633
+ return null;
634
+ }
617
635
  return `reponses : sans réponse ${sans.length > 1 ? 'aux constats' : 'au constat'} ${sans.join(', ')}`;
618
636
  }
619
637
 
@@ -629,7 +647,9 @@ export function suiviDesConstats(fiche, titres) {
629
647
  return `suivi : sans ligne pour ${sans.length > 1 ? 'les constats' : 'le constat'} ${liste(sans)}`;
630
648
  }
631
649
  const tenus = fiche.verdict === 'ACCEPTÉ' ? titres.filter(t => etats.get(t) !== 'levé') : [];
632
- if (!tenus.length) return null;
650
+ if (!tenus.length) {
651
+ return null;
652
+ }
633
653
  return `suivi : un ACCEPTÉ tient ${tenus.length > 1 ? 'les constats' : 'le constat'} ${liste(tenus)} non levé${tenus.length > 1 ? 's' : ''}`;
634
654
  }
635
655
 
@@ -641,10 +661,15 @@ export function conformiteDuTri(fiche, decouvertes) {
641
661
  const lignes = (fiche.verdicts ?? []).map(l => l.decouverte);
642
662
  const fautes = [];
643
663
  const sans = decouvertes.filter(d => !lignes.includes(d));
644
- if (sans.length) fautes.push(`verdicts : sans ligne pour ${sans.join(', ')}`);
664
+ if (sans.length) {
665
+ fautes.push(`verdicts : sans ligne pour ${sans.join(', ')}`);
666
+ }
645
667
  for (const d of new Set(lignes)) {
646
- if (!decouvertes.includes(d)) fautes.push(`verdicts : ${d} n'est pas une découverte du ticket`);
647
- else if (lignes.filter(x => x === d).length > 1) fautes.push(`verdicts : ${d} a deux lignes`);
668
+ if (!decouvertes.includes(d)) {
669
+ fautes.push(`verdicts : ${d} n'est pas une découverte du ticket`);
670
+ } else if (lignes.filter(x => x === d).length > 1) {
671
+ fautes.push(`verdicts : ${d} a deux lignes`);
672
+ }
648
673
  }
649
674
  return fautes.length ? fautes.join(' ; ') : null;
650
675
  }
@@ -661,7 +686,9 @@ export function conformiteDuTri(fiche, decouvertes) {
661
686
  export function lirePiece(texte) {
662
687
  const t = String(texte ?? '').trim();
663
688
  const ticket = /^ticket\s*,\s*/i.exec(t);
664
- if (ticket) return pieceDuTicket(t.slice(ticket[0].length));
689
+ if (ticket) {
690
+ return pieceDuTicket(t.slice(ticket[0].length));
691
+ }
665
692
  if (t.startsWith('$ ')) {
666
693
  const vrai = t.indexOf('\n');
667
694
  const saut = vrai < 0 ? t.indexOf('\\n') : vrai;
@@ -670,15 +697,25 @@ export function lirePiece(texte) {
670
697
  return commande && sortie ? { commande, sortie } : null;
671
698
  }
672
699
  let lieu = t.split(/\s/)[0];
673
- while (lieu && '`.,;:)'.includes(lieu.at(-1))) lieu = lieu.slice(0, -1);
674
- while (lieu.startsWith('`')) lieu = lieu.slice(1);
700
+ while (lieu && '`.,;:)'.includes(lieu.at(-1))) {
701
+ lieu = lieu.slice(0, -1);
702
+ }
703
+ while (lieu.startsWith('`')) {
704
+ lieu = lieu.slice(1);
705
+ }
675
706
  const deux = lieu.lastIndexOf(':');
676
707
  const [debut, fin, ...reste] = lieu.slice(deux + 1).split('-');
677
708
  const nombre = n => (/^\d+$/.test(n ?? '') && Number(n) >= 1 ? Number(n) : null);
678
709
  const ligne = nombre(debut);
679
- if (deux < 1 || !ligne || reste.length) return null;
680
- if (fin === undefined) return { fichier: lieu.slice(0, deux), ligne };
681
- if (!nombre(fin) || nombre(fin) < ligne) return null;
710
+ if (deux < 1 || !ligne || reste.length) {
711
+ return null;
712
+ }
713
+ if (fin === undefined) {
714
+ return { fichier: lieu.slice(0, deux), ligne };
715
+ }
716
+ if (!nombre(fin) || nombre(fin) < ligne) {
717
+ return null;
718
+ }
682
719
  return { fichier: lieu.slice(0, deux), ligne, fin: nombre(fin) };
683
720
  }
684
721
 
@@ -687,8 +724,12 @@ export function lirePiece(texte) {
687
724
  // piece cites one criterion: « critère 1 et 7 » is none.
688
725
  function pieceDuTicket(reste) {
689
726
  const critere = /^critère\s+([1-9]\d*)(?!\d)(?!\s*(?:et|,)\s*\d)(?:$|[\s.,;:])/i.exec(reste);
690
- if (critere) return { critere: Number(critere[1]) };
691
- if (!reste.startsWith('§')) return null;
727
+ if (critere) {
728
+ return { critere: Number(critere[1]) };
729
+ }
730
+ if (!reste.startsWith('§')) {
731
+ return null;
732
+ }
692
733
  const apres = reste.slice(1).trim();
693
734
  const cite = /^«\s*([^»]*?)\s*»/.exec(apres);
694
735
  const section = (cite ? cite[1] : apres.split(/\s:(?:\s|$)|:$/)[0]).trim();
@@ -712,7 +753,9 @@ function introuvables(f, copie) {
712
753
  const racine = path.resolve(copie);
713
754
  for (const [ou, p] of piecesDe(f)) {
714
755
  const lu = lirePiece(p);
715
- if (!lu?.fichier) continue;
756
+ if (!lu?.fichier) {
757
+ continue;
758
+ }
716
759
  const abs = path.resolve(racine, lu.fichier);
717
760
  const lieu = `${lu.fichier}:${lu.ligne}${lu.fin ? `-${lu.fin}` : ''}`;
718
761
  if (!abs.startsWith(`${racine}${path.sep}`) || !existsSync(abs) || !statSync(abs).isFile()) {
@@ -746,7 +789,9 @@ function horsDuTicket(f, description) {
746
789
  continue;
747
790
  }
748
791
  const numero = /^\s*(\d+)[.)]\s/.exec(ligne);
749
- if (dedans && numero) criteres.add(Number(numero[1]));
792
+ if (dedans && numero) {
793
+ criteres.add(Number(numero[1]));
794
+ }
750
795
  }
751
796
  const out = [];
752
797
  for (const [ou, p] of piecesDe(f)) {
@@ -776,8 +821,12 @@ function horsDuTicket(f, description) {
776
821
  function manques(role, f) {
777
822
  const out = [];
778
823
  const plein = k => typeof f[k] === 'string' && f[k].trim() !== '';
779
- if (f.statut === 'BLOQUÉ' && !plein('raison')) out.push('raison : manque, pour BLOQUÉ');
780
- if (f.statut === 'BESOIN' && !plein('question')) out.push('question : manque, pour BESOIN');
824
+ if (f.statut === 'BLOQUÉ' && !plein('raison')) {
825
+ out.push('raison : manque, pour BLOQUÉ');
826
+ }
827
+ if (f.statut === 'BESOIN' && !plein('question')) {
828
+ out.push('question : manque, pour BESOIN');
829
+ }
781
830
  if (['BLOQUÉ', 'BESOIN'].includes(f.statut) && !('piece' in f)) {
782
831
  out.push(`piece : manque, pour ${f.statut}`);
783
832
  }
@@ -829,7 +878,9 @@ function manques(role, f) {
829
878
  }
830
879
  }
831
880
  if (role === 'explorateur') {
832
- if (!(f.paquets ?? []).length) out.push('paquets : manque, pour un plan');
881
+ if (!(f.paquets ?? []).length) {
882
+ out.push('paquets : manque, pour un plan');
883
+ }
833
884
  for (const [i, r] of (f.reponses ?? []).entries()) {
834
885
  if (!/^[1-9]\d*$/.test(r.numero)) {
835
886
  out.push(`reponses[${i}].numero : « ${r.numero} » n'est pas le numéro d'une question`);
@@ -838,7 +889,9 @@ function manques(role, f) {
838
889
  }
839
890
  if (role === 'tri') {
840
891
  for (const [i, l] of (f.verdicts ?? []).entries()) {
841
- if (!l.texte.trim()) out.push(`verdicts[${i}].texte : manque, pour ${l.verdict}`);
892
+ if (!l.texte.trim()) {
893
+ out.push(`verdicts[${i}].texte : manque, pour ${l.verdict}`);
894
+ }
842
895
  if (VERDICTS_PROUVES.includes(l.verdict) && !('piece' in l)) {
843
896
  out.push(
844
897
  `verdicts[${i}].piece : manque, pour ${l.verdict} : « $ <commande> » rejouée sur main et sa sortie, ou fichier:ligne ; sans elle, le verdict est non-confirmee`
@@ -861,7 +914,9 @@ function manques(role, f) {
861
914
  // the description of the ticket, each piece of the ticket names a criterion or a section of it.
862
915
  export function lireFiche(role, sortie, { copie, ticket } = {}) {
863
916
  const schema = schemaDeFiche(role);
864
- if (!schema) return { erreur: `le rôle ${role} n'a pas de fiche` };
917
+ if (!schema) {
918
+ return { erreur: `le rôle ${role} n'a pas de fiche` };
919
+ }
865
920
  let resultat;
866
921
  try {
867
922
  resultat = JSON.parse(String(sortie ?? ''));
@@ -873,16 +928,26 @@ export function lireFiche(role, sortie, { copie, ticket } = {}) {
873
928
  }
874
929
  const fiche = resultat.structured_output;
875
930
  const fautes = erreurs(schema, fiche, '');
876
- if (!fautes.length) fautes.push(...manques(role, fiche));
877
- if (!fautes.length && copie) fautes.push(...introuvables(fiche, copie));
878
- if (!fautes.length && typeof ticket === 'string') fautes.push(...horsDuTicket(fiche, ticket));
879
- if (fautes.length) return { erreur: `fiche non conforme : ${fautes.join(' ; ')}` };
931
+ if (!fautes.length) {
932
+ fautes.push(...manques(role, fiche));
933
+ }
934
+ if (!fautes.length && copie) {
935
+ fautes.push(...introuvables(fiche, copie));
936
+ }
937
+ if (!fautes.length && typeof ticket === 'string') {
938
+ fautes.push(...horsDuTicket(fiche, ticket));
939
+ }
940
+ if (fautes.length) {
941
+ return { erreur: `fiche non conforme : ${fautes.join(' ; ')}` };
942
+ }
880
943
  return { fiche, seance: resultat.session_id ?? null };
881
944
  }
882
945
 
883
946
  // The directory of the package of <racine> that holds <fichier> (from the root), null for none.
884
947
  function paquetDe(racine, fichier) {
885
- if (!fichier) return null;
948
+ if (!fichier) {
949
+ return null;
950
+ }
886
951
  const p = paquets(racine)
887
952
  .filter(({ dossier }) => fichier === dossier || fichier.startsWith(`${dossier}/`))
888
953
  .sort((a, b) => b.dossier.length - a.dossier.length)[0];
@@ -932,7 +997,9 @@ let numero = 0;
932
997
  // its path, or null without the variable.
933
998
  export function ecrireSarif({ garde, constats, racine = process.cwd(), env = process.env }) {
934
999
  const dossier = env[RESULTATS];
935
- if (!dossier) return null;
1000
+ if (!dossier) {
1001
+ return null;
1002
+ }
936
1003
  const f = path.join(dossier, SARIF, `${garde}-${process.pid}-${++numero}.sarif`);
937
1004
  mkdirSync(path.dirname(f), { recursive: true });
938
1005
  writeFileSync(f, `${JSON.stringify(sarif({ garde, constats, racine }), null, 2)}\n`);
@@ -987,8 +1054,9 @@ export function lireSarif(dossier) {
987
1054
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
988
1055
  const [option, role] = process.argv.slice(2);
989
1056
  const schema = option === '--schema' ? schemaDeFiche(role) : null;
990
- if (schema) process.stdout.write(`${JSON.stringify(schema)}\n`);
991
- else {
1057
+ if (schema) {
1058
+ process.stdout.write(`${JSON.stringify(schema)}\n`);
1059
+ } else {
992
1060
  process.stderr.write(
993
1061
  option === '--schema'
994
1062
  ? `⛔ le rôle ${role} n'a pas de fiche.\n`
@@ -82,7 +82,10 @@ export class SeanceAnnulee extends Error {
82
82
  }
83
83
  }
84
84
 
85
- const FORT = ['--modele', 'opus', '--effort', 'high'];
85
+ // The model of each session under the envelope is named by the circuit, never taken from the
86
+ // account; no session fixes the effort, which stays adaptive.
87
+ const SONNET = ['--modele', 'sonnet'];
88
+ const FORT = ['--modele', 'opus'];
86
89
 
87
90
  const LANCEUR = path.join(import.meta.dirname, 'enveloppe', 'lancer.sh');
88
91
 
@@ -281,7 +284,7 @@ export async function lancer(
281
284
  args: [
282
285
  // GRILLHOUSE_LANCEUR names a launcher of trial in place of lancer.sh, as CLAUDE_BIN does claude.
283
286
  process.env.GRILLHOUSE_LANCEUR || LANCEUR,
284
- ...(fort ? FORT : []),
287
+ ...(fort ? FORT : SONNET),
285
288
  ...(ouvre ? ['--seance', ouvre] : []),
286
289
  ...(reprend ? ['--reprise', reprend] : []),
287
290
  // The schema of its sheet when it is not its role's (the explorateur's gesture).
@@ -560,7 +563,8 @@ export async function seance(
560
563
  role,
561
564
  {
562
565
  tentative,
563
- rapport,
566
+ rapport: rapportBrut,
567
+ fichiers = null,
564
568
  fort,
565
569
  derniere,
566
570
  change,
@@ -572,6 +576,11 @@ export async function seance(
572
576
  ...activite
573
577
  }
574
578
  ) {
579
+ // A resumption at the step that carries a red (`fichiers`, the files the red names): the session
580
+ // carries these files alone, the rest of the lot being green.
581
+ const rapport = fichiers?.length
582
+ ? `${rapportBrut ?? ''}\n\nCette séance ne porte que ${fichiers.join(', ')} : le reste du lot est vert et ne se touche pas.`.trim()
583
+ : rapportBrut;
575
584
  const nom = nomDuRole(role);
576
585
  const reprise = tentative > 1 && !derniere && gardee?.agent === role ? gardee : null;
577
586
  const { tache, ouverts, constats, valider, repondre } = constatsDeLaSeance(
@@ -628,7 +637,7 @@ export async function seance(
628
637
  `reprise de la séance ${reprise.seance} finie en erreur : séance neuve et entière.`
629
638
  );
630
639
  }
631
- const lots = lectures.lots();
640
+ const lots = fichiers?.length ? fichiers : lectures.lots();
632
641
  const { description, notes } = leTicket(ctx);
633
642
  // The last handover of this agent; for a developpeur without one yet, the testwriter's last.
634
643
  const passation =
@@ -756,6 +765,15 @@ export function seanceLancee(ctx, role, r) {
756
765
  `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)}`
757
766
  );
758
767
  }
768
+ // The envelope's refusal (a line of the error stream that begins with `bwrap: `) of a session
769
+ // that wrote no transcript: the launch died before its session, as bwrap says.
770
+ const refus = (r.erreur ?? '').split('\n').find(l => l.startsWith('bwrap: '));
771
+ if (refus !== undefined && r.seance !== 0 && derniereTrace(ctx.transcriptions) === 0) {
772
+ throw new Arret(
773
+ 'lancement',
774
+ `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)}`
775
+ );
776
+ }
759
777
  if (r.seance === null) {
760
778
  throw new Arret(
761
779
  'lancement',
@@ -21,6 +21,7 @@ export { paquetsSansPackageJson } from './paquet-npm.mjs';
21
21
  export {
22
22
  cheminsDeLaTache,
23
23
  construireDepuisLesArguments,
24
+ empreintesDesTaches,
24
25
  GRAPHE_JOUE,
25
26
  lancerLesTaches,
26
27
  nomDuPaquet,
@@ -97,7 +97,9 @@ export function sousCommandes(racine = process.cwd()) {
97
97
  */
98
98
  export function commandeDe(nom, racine = process.cwd()) {
99
99
  const s = Object.hasOwn(SOUS_COMMANDES, nom) ? SOUS_COMMANDES[nom] : null;
100
- if (typeof s === 'string') return { script: path.join(SCRIPTS, s), args: [] };
100
+ if (typeof s === 'string') {
101
+ return { script: path.join(SCRIPTS, s), args: [] };
102
+ }
101
103
  const commandes = langageDe(racine).commandes(racine);
102
104
  const n = s?.langage ?? (DU_NOYAU.has(nom) ? null : nom);
103
105
  return n !== null && Object.hasOwn(commandes, n) ? commandes[n] : null;
@@ -48,21 +48,32 @@ const AVEC_VALEUR = new Set([
48
48
  // The patterns and the extensions the script <script> names for the tool <outil> (`prettier` or
49
49
  // `eslint`), or null when the script does not run it.
50
50
  function motifsDuScript(script, outil) {
51
- if (typeof script !== 'string') return null;
51
+ if (typeof script !== 'string') {
52
+ return null;
53
+ }
52
54
  const mots = (script.match(/"[^"]*"|'[^']*'|\S+/g) ?? []).map(m =>
53
55
  m.replace(/^(["'])(.*)\1$/, '$2')
54
56
  );
55
57
  const i = mots.findIndex(m => m === outil || m.endsWith(`/${outil}`));
56
- if (i < 0) return null;
58
+ if (i < 0) {
59
+ return null;
60
+ }
57
61
  const motifs = [];
58
62
  const ext = [];
59
63
  for (let j = i + 1; j < mots.length; j++) {
60
64
  const m = mots[j];
61
- if (['&&', '||', ';', '|'].includes(m)) break;
62
- if (m === '--ext') ext.push(...String(mots[++j] ?? '').split(','));
63
- else if (m.startsWith('--ext=')) ext.push(...m.slice(6).split(','));
64
- else if (AVEC_VALEUR.has(m)) j++;
65
- else if (!m.startsWith('-')) motifs.push(m.replace(/^\.\//, ''));
65
+ if (['&&', '||', ';', '|'].includes(m)) {
66
+ break;
67
+ }
68
+ if (m === '--ext') {
69
+ ext.push(...String(mots[++j] ?? '').split(','));
70
+ } else if (m.startsWith('--ext=')) {
71
+ ext.push(...m.slice(6).split(','));
72
+ } else if (AVEC_VALEUR.has(m)) {
73
+ j++;
74
+ } else if (!m.startsWith('-')) {
75
+ motifs.push(m.replace(/^\.\//, ''));
76
+ }
66
77
  }
67
78
  return { motifs, ext: ext.filter(Boolean).map(e => (e.startsWith('.') ? e : `.${e}`)) };
68
79
  }
@@ -72,9 +83,13 @@ function motifsDuScript(script, outil) {
72
83
  // decides, when given, which files of a folder count).
73
84
  function couvre(rel, motifs, extension) {
74
85
  return motifs.some(m => {
75
- if (/[*?[\]{}]/.test(m)) return path.matchesGlob(rel, m);
86
+ if (/[*?[\]{}]/.test(m)) {
87
+ return path.matchesGlob(rel, m);
88
+ }
76
89
  const net = m.replace(/\/+$/, '');
77
- if (net === '.' || net === '') return extension(rel);
90
+ if (net === '.' || net === '') {
91
+ return extension(rel);
92
+ }
78
93
  return rel === net || (rel.startsWith(`${net}/`) && extension(rel));
79
94
  });
80
95
  }
@@ -91,7 +106,9 @@ function paquetDe(projet, fichier) {
91
106
  return null;
92
107
  }
93
108
  }
94
- if (dossier === projet || path.dirname(dossier) === dossier) return null;
109
+ if (dossier === projet || path.dirname(dossier) === dossier) {
110
+ return null;
111
+ }
95
112
  dossier = path.dirname(dossier);
96
113
  }
97
114
  }
@@ -106,9 +123,13 @@ async function main() {
106
123
  } catch {
107
124
  return [];
108
125
  }
109
- if (!['Write', 'Edit', 'MultiEdit'].includes(entree?.tool_name)) return [];
126
+ if (!['Write', 'Edit', 'MultiEdit'].includes(entree?.tool_name)) {
127
+ return [];
128
+ }
110
129
  const brut = entree.tool_input?.file_path;
111
- if (typeof brut !== 'string') return [];
130
+ if (typeof brut !== 'string') {
131
+ return [];
132
+ }
112
133
  const projet = realpathSync(process.env.CLAUDE_PROJECT_DIR || process.cwd());
113
134
  let fichier;
114
135
  try {
@@ -116,9 +137,13 @@ async function main() {
116
137
  } catch {
117
138
  return [];
118
139
  }
119
- if (!fichier.startsWith(`${projet}${path.sep}`)) return [];
140
+ if (!fichier.startsWith(`${projet}${path.sep}`)) {
141
+ return [];
142
+ }
120
143
  const paquet = paquetDe(projet, fichier);
121
- if (!paquet) return [];
144
+ if (!paquet) {
145
+ return [];
146
+ }
122
147
  const rel = path.relative(paquet.dossier, fichier).split(path.sep).join('/');
123
148
  const depuisRacine = path.relative(projet, fichier).split(path.sep).join('/');
124
149
 
@@ -149,9 +174,13 @@ async function main() {
149
174
  const eslint = fix => new ESLint({ cwd: paquet.dossier, fix });
150
175
  const juger = async fix => {
151
176
  const moteur = eslint(fix);
152
- if (await moteur.isPathIgnored(fichier)) return null;
177
+ if (await moteur.isPathIgnored(fichier)) {
178
+ return null;
179
+ }
153
180
  const [resultat] = await moteur.lintFiles([fichier]);
154
- if (fix) await ESLint.outputFixes([resultat]);
181
+ if (fix) {
182
+ await ESLint.outputFixes([resultat]);
183
+ }
155
184
  return resultat;
156
185
  };
157
186
  let dernier = null;
@@ -196,7 +225,9 @@ async function main() {
196
225
  for (const m of resultat?.messages ?? []) {
197
226
  if (m.severity === 2) {
198
227
  dit(m.line ?? 1, m.column ?? 1, m.ruleId ?? 'erreur', m.message);
199
- if (m.fatal) fatale = true;
228
+ if (m.fatal) {
229
+ fatale = true;
230
+ }
200
231
  }
201
232
  }
202
233
  } catch (e) {
@@ -685,12 +685,14 @@ export function lecture(t, prefix) {
685
685
  * repository (scripts/aiguillage.mjs `echecDeLOutil`); `places`, the places of the machine
686
686
  * (scripts/places-de-la-machine.mjs `etatDesPlaces`), whose line heads AGENTS; `muet`, the Temporal
687
687
  * server did not answer the reading of the circuits, which the first alert says; `faute`, any
688
- * other fault of that reading, said in the first alert as it is.
688
+ * other fault of that reading, said in the first alert as it is; `echecPrefixe`, the cause of a
689
+ * ticket prefix that did not read, named in an alert.
689
690
  * @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[], circuits?: any[],
690
691
  * verdicts?: Record<string, any>, maintenant: number, jour: number,
691
692
  * machine?: Machine | null, outil?: { version: string, raison: string } | null,
692
693
  * places?: { prises: number, plafond: number, charge: number, coeurs: number, memoireGo: number,
693
- * attentes: { ticket: string, depuis: number }[] } | null, muet?: boolean, faute?: string | null }} lu
694
+ * attentes: { ticket: string, depuis: number }[] } | null, muet?: boolean, faute?: string | null,
695
+ * echecPrefixe?: string | null }} lu
694
696
  */
695
697
  export function assembler({
696
698
  tous,
@@ -706,6 +708,7 @@ export function assembler({
706
708
  places: placesDeLaMachine = null,
707
709
  muet = false,
708
710
  faute = null,
711
+ echecPrefixe = null,
709
712
  }) {
710
713
  // A circuit's lines are its steps, no agent's passage.
711
714
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
@@ -742,8 +745,13 @@ export function assembler({
742
745
  for (const l of enfants.values()) {
743
746
  l.sort(ordre);
744
747
  }
745
- // The circuits of the open tickets; a ticket whose circuit runs is in progress.
746
- const parCircuit = new Map(circuits.filter(c => ouvert(c.ticket)).map(c => [c.ticket, c]));
748
+ // The circuits of the open tickets, and the running ones of the closed tickets (the queue closes
749
+ // a ticket before it reads the CI); a ticket whose circuit runs is in progress.
750
+ const parCircuit = new Map(
751
+ circuits
752
+ .filter(c => ouvert(c.ticket) || (c.vivant && parId.has(c.ticket)))
753
+ .map(c => [c.ticket, c])
754
+ );
747
755
  const actifs = new Set([
748
756
  ...enCoursMesures.map(v => v.ticket).filter(Boolean),
749
757
  ...[...parCircuit.values()].filter(c => c.vivant).map(c => c.ticket),
@@ -762,12 +770,12 @@ export function assembler({
762
770
  // A ticket's state: done, in progress, deferred, awaiting validation; else, with the owner's go,
763
771
  // waiting (ready) or blocked (an open ticket it depends on); without it, awaiting his go.
764
772
  const etat = t => {
765
- if (t.status === 'closed') {
766
- return 'fermes';
767
- }
768
773
  if (t.status === 'in_progress' || actifs.has(t.id)) {
769
774
  return 'enCours';
770
775
  }
776
+ if (t.status === 'closed') {
777
+ return 'fermes';
778
+ }
771
779
  if (t.status === 'deferred') {
772
780
  return 'reportes';
773
781
  }
@@ -990,7 +998,9 @@ export function assembler({
990
998
  }
991
999
  const debutJour = jour;
992
1000
  const faitsDuJour = tous
993
- .filter(t => travail(t) && t.closed_at && Date.parse(t.closed_at) >= debutJour)
1001
+ .filter(
1002
+ t => travail(t) && !actifs.has(t.id) && t.closed_at && Date.parse(t.closed_at) >= debutJour
1003
+ )
994
1004
  .sort((a, b) => Date.parse(b.closed_at) - Date.parse(a.closed_at))
995
1005
  .map(t => ({
996
1006
  id: t.id,
@@ -1008,6 +1018,10 @@ export function assembler({
1008
1018
  } else if (faute) {
1009
1019
  alertes.push({ niveau: 'rouge', texte: `Circuits illisibles : ${faute}` });
1010
1020
  }
1021
+ // The ticket prefix did not read: the project keeps its folder's name, and the alert says why.
1022
+ if (echecPrefixe) {
1023
+ alertes.push({ niveau: 'rouge', texte: `Préfixe des tickets illisible : ${echecPrefixe}` });
1024
+ }
1011
1025
  // A red night says the night it turned red, short enough to stand whole on its line: the local
1012
1026
  // day and month its ticket was opened, the night's date (scripts/nuit.sh), whatever its title names, a
1013
1027
  // commit in older ones.
@@ -1831,15 +1845,25 @@ function lire(
1831
1845
  racine,
1832
1846
  { home, maintenant, circuits, muet = false, faute = null, machine = null, places = null }
1833
1847
  ) {
1848
+ // The prefix is read once, with no delay of its own; a read that fails leaves it empty (the
1849
+ // project is labelled by its folder) and its cause is named in an alert (`echecPrefixe`).
1834
1850
  let prefix = '';
1851
+ let echecPrefixe = null;
1835
1852
  try {
1836
1853
  prefix = execFileSync('bd', ['config', 'get', 'issue_prefix'], {
1837
1854
  cwd: racine,
1838
1855
  encoding: 'utf8',
1856
+ stdio: ['ignore', 'pipe', 'pipe'],
1839
1857
  maxBuffer: 256 * 1024 * 1024,
1840
1858
  }).trim();
1841
- } catch {
1859
+ } catch (e) {
1842
1860
  prefix = '';
1861
+ const message = String(e?.stderr ?? '').trim() || String(e?.message ?? e);
1862
+ const ligne = message.split('\n')[0];
1863
+ echecPrefixe =
1864
+ e?.status === null || e?.status === undefined
1865
+ ? `${e?.code ?? 'échec'} ${ligne}`.trim()
1866
+ : `code ${e.status} ${ligne}`.trim();
1843
1867
  }
1844
1868
  let ps = '';
1845
1869
  try {
@@ -1920,6 +1944,7 @@ function lire(
1920
1944
  places,
1921
1945
  muet,
1922
1946
  faute,
1947
+ echecPrefixe,
1923
1948
  outil: echecDeLOutil(racine),
1924
1949
  });
1925
1950
  return { t, prefix, tous, vivants, commun };
@@ -82,25 +82,18 @@ export function nomDuPaquet(racine, dossier) {
82
82
  * tests?: { arguments: string[], rejouer?: string }, env?: NodeJS.ProcessEnv }} o
83
83
  * @returns {number}
84
84
  */
85
- export function lancerLesTaches({
86
- outil,
87
- racine,
88
- taches,
89
- noms = [],
90
- tests,
91
- env = process.env,
92
- }) {
85
+ export function lancerLesTaches({ outil, racine, taches, noms = [], tests, env = process.env }) {
93
86
  const e = { ...env };
94
87
  delete e[TESTS_CIBLES];
95
88
  if (tests) {
96
89
  e[TESTS_CIBLES] = JSON.stringify(tests);
97
90
  }
98
91
  const filtres = [...new Set(noms)].sort().map(n => `--filter=${n}`);
99
- const r = spawnSync(
100
- outil,
101
- ['run', ...taches, ...filtres, '--continue=dependencies-successful'],
102
- { cwd: racine, stdio: 'inherit', env: e }
103
- );
92
+ const r = spawnSync(outil, ['run', ...taches, ...filtres, '--continue=dependencies-successful'], {
93
+ cwd: racine,
94
+ stdio: 'inherit',
95
+ env: e,
96
+ });
104
97
  return r.status ?? 1;
105
98
  }
106
99
 
@@ -210,6 +203,33 @@ function plan(outil, racine, args) {
210
203
  return JSON.parse(r.stdout);
211
204
  }
212
205
 
206
+ /**
207
+ * The hashes of the inputs of the tests tasks of the packages <noms> (by their package name) and
208
+ * of their dependents, as the runner <outil> plans them in <racine> (the hash of a task covers the
209
+ * content of the files it reads and of the tasks it waits for): `{ <paquet>: <hash> }`; null when
210
+ * the runner gives no plan. The fingerprint of a step of the circuit reads it
211
+ * (scripts/reprise.mjs).
212
+ * @param {string} outil the task runner
213
+ * @param {string} racine
214
+ * @param {string[]} noms
215
+ * @returns {Record<string, string> | null}
216
+ */
217
+ export function empreintesDesTaches(outil, racine, noms) {
218
+ if (!noms.length) {
219
+ return {};
220
+ }
221
+ try {
222
+ const graphe = plan(outil, racine, [
223
+ 'run',
224
+ SCRIPT_DES_TESTS,
225
+ ...noms.map(n => `--filter=...${n}`),
226
+ ]);
227
+ return Object.fromEntries((graphe.tasks ?? []).map(t => [t.package, t.hash]));
228
+ } catch {
229
+ return null;
230
+ }
231
+ }
232
+
213
233
  // The build <args> in <racine>, its output in <echec> then on this process's: when it fails,
214
234
  // <echec> holds <ligne> then that output, and the warning <alerte> follows it.
215
235
  function construireJusquOuIlConstruit(outil, racine, args, echec, ligne, alerte) {