@roomi-fields/grillhouse 0.50.2 → 0.51.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 (132) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/agents/developpeur.md +1 -1
  4. package/agents/direct.md +1 -1
  5. package/agents/explorateur.md +1 -1
  6. package/agents/questionneur.md +1 -1
  7. package/agents/relecteur.md +1 -1
  8. package/agents/testwriter.md +1 -1
  9. package/cadre/templates/c/package.json +1 -0
  10. package/cadre/templates/cargo/package.json +1 -0
  11. package/cadre/templates/python/package.json +1 -0
  12. package/charte.md +17 -12
  13. package/dist/machine/part-par-sorte.d.ts +16 -0
  14. package/dist/machine/part-par-sorte.js +36 -0
  15. package/dist/machine/part-par-sorte.js.map +1 -0
  16. package/dist/temporal/circuit/appel.js +1 -1
  17. package/dist/temporal/circuit/appel.js.map +1 -1
  18. package/dist/temporal/circuit/client.d.ts +5 -4
  19. package/dist/temporal/circuit/client.js +39 -16
  20. package/dist/temporal/circuit/client.js.map +1 -1
  21. package/dist/temporal/circuit/contrat.d.ts +11 -7
  22. package/dist/temporal/circuit/contrat.js +5 -9
  23. package/dist/temporal/circuit/contrat.js.map +1 -1
  24. package/dist/temporal/circuit/deroule.js +18 -6
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/commande.js +12 -3
  27. package/dist/temporal/commande.js.map +1 -1
  28. package/dist/temporal/installation.d.ts +54 -3
  29. package/dist/temporal/installation.js +187 -17
  30. package/dist/temporal/installation.js.map +1 -1
  31. package/dist/temporal/places/client.d.ts +5 -1
  32. package/dist/temporal/places/client.js +23 -11
  33. package/dist/temporal/places/client.js.map +1 -1
  34. package/docs/ARCHITECTURE.md +23 -2700
  35. package/docs/INTERFACE.md +23 -8
  36. package/docs/architecture/circuit.md +59 -12
  37. package/docs/architecture/entree.md +20 -7
  38. package/docs/architecture/greffon.md +6 -2
  39. package/docs/architecture/installation.md +30 -11
  40. package/docs/architecture/machine.md +50 -37
  41. package/docs/architecture/tests.md +52 -14
  42. package/docs/lexique.md +154 -0
  43. package/hooks/register.tsx +1 -1
  44. package/package.json +1 -1
  45. package/scripts/activites.mjs +85 -60
  46. package/scripts/aiguillage.mjs +15 -7
  47. package/scripts/attente-de-la-machine.mjs +4 -8
  48. package/scripts/avancement.mjs +12 -8
  49. package/scripts/bilan.mjs +10 -7
  50. package/scripts/branche-de-nuit.mjs +2 -2
  51. package/scripts/ci-de-main.mjs +18 -21
  52. package/scripts/circuit.mjs +86 -43
  53. package/scripts/circuits-du-serveur.mjs +5 -5
  54. package/scripts/composants-affectes.mjs +30 -12
  55. package/scripts/composition-des-langages.mjs +5 -3
  56. package/scripts/conformite.mjs +1 -1
  57. package/scripts/consommation-des-passes.mjs +8 -6
  58. package/scripts/copies-finies.mjs +3 -14
  59. package/scripts/depart-du-ticket.d.mts +8 -2
  60. package/scripts/depart-du-ticket.mjs +26 -8
  61. package/scripts/direct.mjs +158 -72
  62. package/scripts/droits.mjs +63 -185
  63. package/scripts/engendres.mjs +3 -14
  64. package/scripts/enveloppe/enveloppe.mjs +75 -30
  65. package/scripts/enveloppe/lancer.sh +59 -45
  66. package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
  67. package/scripts/enveloppe/travail-de-la-copie.mjs +115 -3
  68. package/scripts/etapes.mjs +84 -22
  69. package/scripts/faits-du-circuit.mjs +8 -2
  70. package/scripts/grillhouse-maj.mjs +43 -18
  71. package/scripts/groupe-cles.d.mts +15 -0
  72. package/scripts/groupe-cles.mjs +77 -2
  73. package/scripts/init.mjs +9 -2
  74. package/scripts/integration/rejeu.mjs +8 -1
  75. package/scripts/jointure.d.ts +22 -3
  76. package/scripts/langages/c/index.mjs +5 -2
  77. package/scripts/langages/cargo/commandes.mjs +35 -15
  78. package/scripts/langages/cargo/composants.mjs +45 -3
  79. package/scripts/langages/cargo/index.mjs +6 -3
  80. package/scripts/langages/cargo/sccache.mjs +10 -3
  81. package/scripts/langages/python/index.mjs +5 -2
  82. package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
  83. package/scripts/langages/typescript/index.mjs +4 -2
  84. package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
  85. package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
  86. package/scripts/langages/typescript/turbo-des-paquets.mjs +99 -36
  87. package/scripts/langages/typescript/verdict.mjs +29 -3
  88. package/scripts/langages/typescript/verifier.mjs +1 -1
  89. package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
  90. package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
  91. package/scripts/langages.mjs +54 -4
  92. package/scripts/matieres-lues.mjs +1 -1
  93. package/scripts/mesure/base-de-passe.mjs +32 -90
  94. package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
  95. package/scripts/migrations.mjs +21 -7
  96. package/scripts/paquets.d.ts +3 -0
  97. package/scripts/paquets.mjs +88 -1
  98. package/scripts/passe-de-la-machine.mjs +109 -36
  99. package/scripts/places-de-la-machine.mjs +81 -29
  100. package/scripts/plafond-de-la-machine.d.mts +2 -5
  101. package/scripts/plafond-de-la-machine.mjs +9 -9
  102. package/scripts/reprise.mjs +42 -13
  103. package/scripts/resultats.mjs +76 -54
  104. package/scripts/retirer-les-copies-finies.mjs +1 -1
  105. package/scripts/seances.mjs +426 -115
  106. package/scripts/services-du-noyau.mjs +9 -1
  107. package/scripts/session-start.sh +14 -1
  108. package/scripts/sortie.mjs +37 -6
  109. package/scripts/sous-commandes.mjs +0 -2
  110. package/scripts/superviseur.mjs +33 -13
  111. package/scripts/tableau.mjs +61 -16
  112. package/scripts/transitions.d.mts +25 -2
  113. package/scripts/transitions.mjs +137 -29
  114. package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
  115. package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
  116. package/skills/developpeur/SKILL.md +38 -15
  117. package/skills/direct/SKILL.md +29 -9
  118. package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
  119. package/skills/domain-modeling/SKILL.md +14 -12
  120. package/skills/explorateur/SKILL.md +30 -6
  121. package/skills/pitmaster/SKILL.md +12 -16
  122. package/skills/pitmaster/references/consigne-agent.md +12 -11
  123. package/skills/relecteur/SKILL.md +12 -5
  124. package/skills/systematic-debugging/SKILL.md +281 -0
  125. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  126. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  127. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  128. package/skills/systematic-debugging/find-polluter.sh +72 -0
  129. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  130. package/skills/testwriter/SKILL.md +35 -29
  131. package/scripts/verrous/commande.mjs +0 -214
  132. package/scripts/verrous/verrou.mjs +0 -311
@@ -9,7 +9,11 @@
9
9
  //
10
10
  // node scripts/enveloppe/travail-de-la-copie.mjs reporter <copie> <base> <pointe>
11
11
  // node scripts/enveloppe/travail-de-la-copie.mjs preparer <copie> [<cible>]
12
+ // node scripts/enveloppe/travail-de-la-copie.mjs photographier <copie>
12
13
  //
14
+ // - `photographier`: the tree <copie> holds, on stdout in JSON, which the launcher takes once the
15
+ // copy is prepared, before the session: the state its lot is read from (scripts/seances.mjs,
16
+ // « le jugement du lot »).
13
17
  // - `preparer`: the one preparation of a copy, which the launcher plays before each session and
14
18
  // the circuit before each pass that judges the lot. With <cible> (an existing copy), the guard
15
19
  // of its submodules (scripts/sous-modules.sh `garde`), then `avancer`; then, for every copy,
@@ -80,7 +84,18 @@
80
84
  // declared) is advanced all the same, its references merged as files written by hand, and the
81
85
  // fault is said: on stderr, in the log of the preparation for the circuit.
82
86
  import { spawnSync } from 'node:child_process';
83
- import { existsSync, readFileSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
87
+ import {
88
+ copyFileSync,
89
+ existsSync,
90
+ mkdtempSync,
91
+ readFileSync,
92
+ rmSync,
93
+ statSync,
94
+ utimesSync,
95
+ writeFileSync,
96
+ writeSync,
97
+ } from 'node:fs';
98
+ import { tmpdir } from 'node:os';
84
99
  import path from 'node:path';
85
100
  import { pathToFileURL } from 'node:url';
86
101
  import { couvertPar, encoreDeclares, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
@@ -354,6 +369,101 @@ export function ecritPar(role, estUnTest) {
354
369
  return undefined;
355
370
  }
356
371
 
372
+ // The paths a session's lot leaves out: the tickets' store, and the copies of the tickets the main
373
+ // tree holds, which the circuit brings.
374
+ const HORS_DU_LOT = ['.beads/', '.claude/worktrees/'];
375
+
376
+ // The output of the read `git <args>` in <depot>; a read that fails throws, its error named.
377
+ function lireGit(depot, args, env = process.env) {
378
+ const r = spawnSync('git', ['-C', depot, '--literal-pathspecs', ...args], {
379
+ env,
380
+ maxBuffer: 256 * 1024 * 1024,
381
+ });
382
+ if (r.status !== 0) {
383
+ throw new Error(`git ${args.join(' ')} échoue dans ${depot} : ${String(r.stderr ?? '').trim()}`);
384
+ }
385
+ return String(r.stdout);
386
+ }
387
+
388
+ /**
389
+ * The tree <depot> holds now, `{ arbre, tete }`: the git tree of every file that git does not
390
+ * ignore, as it lies on disk, written through an index of its own (the index of <depot> is left as
391
+ * it is), and the commit of HEAD; null out of git.
392
+ * @param {string} depot
393
+ * @returns {{ arbre: string, tete: string } | null}
394
+ */
395
+ export function photographier(depot) {
396
+ const g = spawnSync('git', ['-C', depot, 'rev-parse', '--absolute-git-dir'], { encoding: 'utf8' });
397
+ if (g.status !== 0) {
398
+ return null;
399
+ }
400
+ const dossier = mkdtempSync(path.join(tmpdir(), 'grillhouse-photo-'));
401
+ try {
402
+ const index = path.join(dossier, 'index');
403
+ const sien = path.join(g.stdout.trim(), 'index');
404
+ if (existsSync(sien)) {
405
+ // Its time with it: git reads it to judge a file written in the same instant as the index.
406
+ const { atime, mtime } = statSync(sien);
407
+ copyFileSync(sien, index);
408
+ utimesSync(index, atime, mtime);
409
+ }
410
+ const env = { ...process.env, GIT_INDEX_FILE: index };
411
+ lireGit(depot, ['add', '-A'], env);
412
+ return {
413
+ arbre: lireGit(depot, ['write-tree'], env).trim(),
414
+ tete: lireGit(depot, ['rev-parse', 'HEAD']).trim(),
415
+ };
416
+ } finally {
417
+ rmSync(dossier, { recursive: true, force: true });
418
+ }
419
+ }
420
+
421
+ /**
422
+ * The files that differ between the trees (or commits) <avant> and <apres> of <depot>, the paths a
423
+ * lot leaves out aside: `{ chemin, avant, apres }`, each state « <mode> <objet> », null without the
424
+ * file.
425
+ * @param {string} depot
426
+ * @param {string} avant
427
+ * @param {string} apres
428
+ * @returns {{ chemin: string, avant: string | null, apres: string | null }[]}
429
+ */
430
+ export function changements(depot, avant, apres) {
431
+ const mots = lireGit(depot, ['diff-tree', '-r', '-z', '--no-renames', avant, apres]).split('\0');
432
+ const out = [];
433
+ for (let i = 0; i + 1 < mots.length; i += 2) {
434
+ const [modeA, modeB, a, b] = mots[i].slice(1).split(' ');
435
+ const etat = (mode, objet) => (/^0+$/.test(mode) ? null : `${mode} ${objet}`);
436
+ out.push({ chemin: mots[i + 1], avant: etat(modeA, a), apres: etat(modeB, b) });
437
+ }
438
+ return out.filter(c => !HORS_DU_LOT.some(d => c.chemin.startsWith(d)));
439
+ }
440
+
441
+ /**
442
+ * The state of the file <chemin> in the tree (or commit) <arbre> of <depot>, as `changements` gives
443
+ * it.
444
+ * @param {string} depot
445
+ * @param {string} arbre
446
+ * @param {string} chemin
447
+ * @returns {string | null}
448
+ */
449
+ export function etatDuFichier(depot, arbre, chemin) {
450
+ const ligne = lireGit(depot, ['ls-tree', '-z', arbre, '--', chemin]).split('\0')[0];
451
+ if (!ligne) {
452
+ return null;
453
+ }
454
+ const [mode, , objet] = ligne.split('\t')[0].split(' ');
455
+ return `${mode} ${objet}`;
456
+ }
457
+
458
+ /**
459
+ * The text of the file of state <etat> in <depot>, null without a file.
460
+ * @param {string} depot
461
+ * @param {string | null} etat
462
+ * @returns {string | null}
463
+ */
464
+ export const texteDeLEtat = (depot, etat) =>
465
+ etat === null ? null : lireGit(depot, ['cat-file', 'blob', etat.split(' ')[1]]);
466
+
357
467
  /**
358
468
  * The lot from <base> to <pointe> as local work of <copie>; returns `{ ok, message }`. <dire>
359
469
  * receives a fault that does not refuse the lot, and the output of the command of a generated file
@@ -646,14 +756,16 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
646
756
  ecrit = ecritPar(role, f => langageDeLaCopie(copie).estUnTest(f, copie));
647
757
  }
648
758
  const r =
649
- geste === 'reporter' && reste.length === 2
759
+ geste === 'photographier' && reste.length === 0
760
+ ? { ok: true, message: JSON.stringify(photographier(copie)) }
761
+ : geste === 'reporter' && reste.length === 2
650
762
  ? reporter(copie, { base: reste[0], pointe: reste[1] })
651
763
  : geste === 'preparer' && reste.length <= 1
652
764
  ? preparer(copie, reste[0] ?? null, { ecrit })
653
765
  : {
654
766
  ok: false,
655
767
  message:
656
- 'usage: travail-de-la-copie.mjs reporter <copie> <base> <pointe> | preparer <copie> [<cible>] [--role <role>]',
768
+ 'usage: travail-de-la-copie.mjs reporter <copie> <base> <pointe> | preparer <copie> [<cible>] [--role <role>] | photographier <copie>',
657
769
  };
658
770
  // `preparer` prints the list its pose fixes on stdout, its messages on stderr.
659
771
  if (geste === 'preparer') {
@@ -2,11 +2,12 @@
2
2
  // which the circuit (scripts/circuit.mjs), the board (scripts/tableau.mjs), the bilan
3
3
  // (scripts/bilan.mjs) and the texts read. The list of the steps is told here and at circuit.md
4
4
  // §5.1 alone; the gestures and the stops, at §5.4 and §5.5. The code today holds the long and the
5
- // short circuits; the direct one is a target (circuit.md §9.1).
5
+ // short circuits; of the direct one, it holds the steps and their rule.
6
6
  //
7
- // - A step (ETAPES): its number (« 2 », « 4.1 »), its title, who works there (`qui`: the role
8
- // agents, or AUTO for a step the circuit leads itself; none for a step that only holds its
9
- // sub-steps), its sub-steps (`sous`), and the step of the circuit's state it is (`etat`: the
7
+ // - A step (ETAPES): its number (« 2 », « 4.1 »), its title, the circuits that play it
8
+ // (`circuits`: long, court, direct, `joue`), who works there (`qui`: the role agents, or AUTO for
9
+ // a step the circuit leads itself; none for a step that only holds its sub-steps; a circuit whose
10
+ // roles differ names them in `quiAuCircuit`, `rolesDe`), its sub-steps (`sous`), and the step of the circuit's state it is (`etat`: the
10
11
  // `etape` of the state the circuit writes, which the workflow of its ticket holds, the final pass being the checks once
11
12
  // `finale`). Every step runs once for the whole ticket, as a merge request has one author of
12
13
  // its tests and one of its code, one CI on the whole and one review: one session of the
@@ -22,7 +23,9 @@
22
23
  // - A step carries as many bounded loops as it needs (`boucles`), each spanning the step and its
23
24
  // sub-steps: each its key (`cle`, which keys its count in the state's `boucles`), its label and
24
25
  // its maximum (`max`, the pass that stops it): the testwriter's sessions after a refused proof,
25
- // the developpeur's sessions with their checks, the reviews. The circuit stops each loop at its
26
+ // the developpeur's sessions with their checks, the reviews. A loop a circuit alone runs at a
27
+ // further step stands in `bouclesAuCircuit`: in a direct circuit, which plays no checks (3.1),
28
+ // the sessions of the code still count at the final pass. The circuit stops each loop at its
26
29
  // maximum and writes its count in its state; the board shows « <label> <n>/<max> » on the
27
30
  // ticket's line from the second pass.
28
31
  // - The stops of the circuit, each by its name and its exit code (ARRETS): the circuit ends on one
@@ -43,44 +46,68 @@ export const EXPLORATEUR = 'explorateur';
43
46
  export const AUTEUR_DU_CIRCUIT = 'circuit';
44
47
  export const QUESTIONNEUR = 'questionneur';
45
48
 
49
+ // The circuits of a ticket: the paths through the list.
50
+ const TOUS = ['long', 'court', 'direct'];
51
+ const AVEC_PLAN = ['long', 'court'];
52
+
53
+ // The role of the agent who writes tests and code together in a direct circuit.
54
+ const DIRECT = 'direct';
55
+
56
+ // The sessions of the author of the code, with the passes that judge them.
57
+ const BOUCLE_DU_CODE = { cle: 'code', libelle: 'essai', max: 3 };
58
+
46
59
  export const ETAPES = [
47
60
  {
48
61
  numero: '1',
49
62
  titre: 'Plan',
63
+ circuits: AVEC_PLAN,
50
64
  qui: ['explorateur', 'questionneur'],
51
65
  etat: null,
52
66
  questionnement: 'plan',
53
67
  arrets: ['questionnement'],
54
68
  // The gesture of a mechanical ticket, in the copy, in place of the testwriter and the
55
69
  // developpeur.
56
- sous: [{ numero: '1.1', titre: 'Geste mécanique', qui: [EXPLORATEUR], etat: 'geste' }],
70
+ sous: [{ numero: '1.1', titre: 'Geste mécanique', circuits: ['court'], qui: [EXPLORATEUR], etat: 'geste' }],
57
71
  },
58
72
  {
59
73
  numero: '2',
60
74
  titre: 'Tests',
75
+ circuits: ['long'],
61
76
  qui: ['testwriter'],
62
77
  etat: 'testwriter',
63
78
  boucles: [{ cle: 'tests', libelle: 'essai', max: 3 }],
64
- sous: [{ numero: '2.1', titre: 'Preuve du rouge', qui: [AUTO], etat: 'preuve' }],
79
+ sous: [{ numero: '2.1', titre: 'Preuve du rouge', circuits: ['long'], qui: [AUTO], etat: 'preuve' }],
65
80
  },
66
81
  {
67
82
  numero: '3',
68
83
  titre: 'Code',
84
+ circuits: TOUS,
69
85
  qui: ['developpeur'],
86
+ quiAuCircuit: { direct: [DIRECT] },
70
87
  etat: 'developpeur',
71
- boucles: [{ cle: 'code', libelle: 'essai', max: 3 }],
72
- sous: [{ numero: '3.1', titre: 'Contrôles', qui: [AUTO], etat: 'controles' }],
88
+ boucles: [BOUCLE_DU_CODE],
89
+ sous: [{ numero: '3.1', titre: 'Contrôles', circuits: AVEC_PLAN, qui: [AUTO], etat: 'controles' }],
73
90
  },
74
91
  {
75
92
  numero: '4',
76
93
  titre: 'Passe finale et relecture',
94
+ circuits: TOUS,
77
95
  qui: [],
78
96
  etat: null,
79
97
  sous: [
80
- { numero: '4.1', titre: 'Passe finale', qui: [AUTO], etat: 'controles', finale: true },
98
+ {
99
+ numero: '4.1',
100
+ titre: 'Passe finale',
101
+ circuits: TOUS,
102
+ qui: [AUTO],
103
+ etat: 'controles',
104
+ finale: true,
105
+ bouclesAuCircuit: { direct: [BOUCLE_DU_CODE] },
106
+ },
81
107
  {
82
108
  numero: '4.2',
83
109
  titre: 'Régénération des références',
110
+ circuits: TOUS,
84
111
  qui: [AUTO],
85
112
  etat: 'references',
86
113
  arrets: ['references'],
@@ -88,6 +115,7 @@ export const ETAPES = [
88
115
  {
89
116
  numero: '4.3',
90
117
  titre: 'Relecture',
118
+ circuits: TOUS,
91
119
  qui: ['relecteur'],
92
120
  etat: 'relecture',
93
121
  boucles: [{ cle: 'relecture', libelle: 'tour', max: 3 }],
@@ -97,13 +125,14 @@ export const ETAPES = [
97
125
  {
98
126
  numero: '5',
99
127
  titre: 'Intégration',
128
+ circuits: TOUS,
100
129
  qui: [],
101
130
  etat: null,
102
131
  sous: [
103
- { numero: '5.1', titre: 'Commit', qui: [AUTO], etat: 'integration' },
104
- { numero: '5.2', titre: 'File : passe finale, main', qui: [AUTO], etat: 'file' },
132
+ { numero: '5.1', titre: 'Commit', circuits: TOUS, qui: [AUTO], etat: 'integration' },
133
+ { numero: '5.2', titre: 'File : passe finale, main', circuits: TOUS, qui: [AUTO], etat: 'file' },
105
134
  // The tri of the discoveries of the ticket, on the lot entered on main.
106
- { numero: '5.3', titre: 'Tri des découvertes', qui: [EXPLORATEUR], etat: 'tri' },
135
+ { numero: '5.3', titre: 'Tri des découvertes', circuits: TOUS, qui: [EXPLORATEUR], etat: 'tri' },
107
136
  ],
108
137
  },
109
138
  ];
@@ -114,16 +143,49 @@ export const SUITE = ETAPES.flatMap(e => [e, ...(e.sous ?? [])]);
114
143
  // The bounded loop of key <cle>.
115
144
  export const boucle = cle => SUITE.flatMap(e => e.boucles ?? []).find(b => b.cle === cle) ?? null;
116
145
 
117
- // The loops that run at the step <etape>: its own and its parent's.
118
- export const bouclesDe = etape => {
146
+ // The loops that run at the step <etape> in the circuit <circuit>: its own, its parent's, and those
147
+ // the circuit alone runs there.
148
+ export const bouclesDe = (etape, circuit) => {
119
149
  const parent = ETAPES.find(e => e === etape || e.sous?.includes(etape));
120
- return [...new Set([parent, etape])].flatMap(e => e?.boucles ?? []);
150
+ return [...new Set([parent, etape])].flatMap(e => [
151
+ ...(e?.boucles ?? []),
152
+ ...(e?.bouclesAuCircuit?.[circuit] ?? []),
153
+ ]);
121
154
  };
122
155
 
123
- // The agents who write the lot, the testwriter its tests and the developpeur its code: the roles a
124
- // blocking finding of the reviewer names.
156
+ // Whether the circuit <circuit> plays the step of number <numero>.
157
+ export const joue = (numero, circuit) =>
158
+ Boolean(SUITE.find(e => e.numero === numero)?.circuits.includes(circuit));
159
+
160
+ // The roles of the step <e> in the circuit <circuit> (the long one when none is said); none when
161
+ // the circuit does not play it.
162
+ export const rolesDe = (e, circuit) =>
163
+ e.circuits.includes(circuit ?? 'long') ? (e.quiAuCircuit?.[circuit] ?? e.qui) : [];
164
+
165
+ // The roles of the step <e> in any circuit.
166
+ export const tousLesRolesDe = e => [
167
+ ...new Set([...e.qui, ...Object.values(e.quiAuCircuit ?? {}).flat()]),
168
+ ];
169
+
170
+ // The agent who writes the code (3) in the circuit <circuit>.
171
+ export const auteurDuCode = circuit =>
172
+ rolesDe(
173
+ SUITE.find(e => e.numero === '3'),
174
+ circuit
175
+ )[0];
176
+
177
+ // The agents who write the lot of a long or short circuit, the testwriter its tests and the
178
+ // developpeur its code.
125
179
  export const AGENTS_DU_LOT = ['testwriter', 'developpeur'];
126
180
 
181
+ // The agents who write the lot of the circuit <circuit>: the roles a blocking finding of the
182
+ // reviewer names.
183
+ export const agentsDuLot = circuit =>
184
+ circuit === DIRECT ? [auteurDuCode(circuit)] : AGENTS_DU_LOT;
185
+
186
+ // Every agent who writes the lot of a circuit.
187
+ export const AUTEURS_DE_LOT = [...AGENTS_DU_LOT, DIRECT];
188
+
127
189
  // The exit code of each stop of the circuit.
128
190
  export const ARRETS = {
129
191
  lancement: 10,
@@ -143,7 +205,6 @@ export const ARRETS = {
143
205
  besoin: 20,
144
206
  questionnement: 22,
145
207
  references: 23,
146
- 'hors-plan': 24,
147
208
  inattendu: 25,
148
209
  // A session the usage limit stops: the circuit reports itself to the hour the usage returns and
149
210
  // resumes the step, no question gone up.
@@ -161,6 +222,9 @@ export const roleDeLAgent = nom =>
161
222
  const NOMS = { developpeur: 'développeur' };
162
223
  export const nomDuRole = role => NOMS[role] ?? role;
163
224
 
225
+ // A role as the subject of a sentence, « Le développeur », « L’agent direct ».
226
+ export const leRole = role => (role === DIRECT ? 'L’agent direct' : `Le ${nomDuRole(role)}`);
227
+
164
228
  // Who works at the step <e>, in words: its roles' names.
165
229
  export const quiDe = e => e.qui.map(nomDuRole).join(' ⇄ ');
166
230
 
@@ -268,7 +332,7 @@ export const RESPONSABLE = 'responsable';
268
332
  // The commands by which the supervisor answers a question (scripts/circuit.mjs): resume, extend
269
333
  // the plan, stop.
270
334
  export const REPONSES =
271
- 'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--mecanique [<commande>]` (avec `--contexte` : à l’arrêt du testwriter qui ne trouve aucun comportement à tester, ou de la preuve du rouge qui refuse le lot de tests, le ticket bascule en circuit court sur le même plan, vers 1.1 avec sa commande, vers le développeur sans elle), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), `--reporter <heure>` (la question se tait jusqu’à l’heure, le circuit en attente), ou `--arreter`.';
335
+ 'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--depuis direct` dans un circuit direct (avec `--contexte`), `--mecanique [<commande>]` (avec `--contexte` : à l’arrêt du testwriter qui ne trouve aucun comportement à tester, ou de la preuve du rouge qui refuse le lot de tests, le ticket bascule en circuit court sur le même plan, vers 1.1 avec sa commande, vers le développeur sans elle), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), `--reporter <heure>` (la question se tait jusqu’à l’heure, le circuit en attente), ou `--arreter`.';
272
336
 
273
337
  // The question of each stop no gesture settles, as a CI calls a person only for what no rule
274
338
  // settles (the approval of a review): every stop of ARRETS, « a-repasser » once the circuit has
@@ -308,8 +372,6 @@ export const MONTEES = Object.fromEntries(
308
372
  'Des questions du plan restent ouvertes après la réponse de l’explorateur : le plan change-t-il (`bd update`), ou reste-t-il tel quel ? `--reprendre` le fait passer tel qu’il est alors.',
309
373
  references:
310
374
  'La régénération des références change un fichier qu’aucune référence n’écrit, ou sa commande échoue (ses écarts ci-dessus) : qui corrige la référence ou le lot ?',
311
- 'hors-plan':
312
- 'La séance écrit hors du plan du ticket : le plan s’étend-il à ce paquet (`--etendre`), ou l’écriture est-elle refusée (`--reprendre` avec son contexte) ?',
313
375
  inattendu:
314
376
  'Une exception que le circuit ne prévoit pas (une lecture de la copie, une commande, un fichier illisible) l’a arrêté : sa cause se lève-t-elle, pour reprendre (`--reprendre`, qui écrit de nouveau cet arrêt si la cause reste), ou le circuit s’arrête-t-il ?',
315
377
  'limite-d-usage':
@@ -66,6 +66,7 @@ import {
66
66
  arretDe,
67
67
  arreter,
68
68
  avantLaPasse,
69
+ circuitSansTrace,
69
70
  contexte,
70
71
  ecrireEtat,
71
72
  finirLOuverture,
@@ -98,10 +99,11 @@ import {
98
99
  import { rougesDUnePasse } from './activites.mjs';
99
100
  import { ecrireLEffet } from './effets.mjs';
100
101
  import { Arret, commenter, geste } from './ticket-du-circuit.mjs';
102
+ import { AUTEURS_DE_LOT } from './etapes.mjs';
101
103
  import { arretDeLaLimiteDUsage, MEMOIRE } from './transitions.mjs';
102
104
 
103
105
  // What the workflow keeps of the circuit's memory besides the decisions': the session a relaunch
104
- // resumes, the rank of arrival, the sort of the ticket, what the opening reads of the project's
106
+ // resumes, the rank of arrival, the circuit and the sort of the ticket, what the opening reads of the project's
105
107
  // package.json (its tools, its data, its generated files), which every pass of a later act plays
106
108
  // with, each act in a process of its own, and the supervisor's context of the
107
109
  // run (`contexte`), which each session of the run reads at the head of its instruction, with the
@@ -111,6 +113,7 @@ const GARDEE = [
111
113
  ...MEMOIRE,
112
114
  'seanceReprise',
113
115
  'rang',
116
+ 'circuit',
114
117
  'sorte',
115
118
  'outils',
116
119
  'donnees',
@@ -200,7 +203,7 @@ export const optionsDe = reponse => {
200
203
  return {
201
204
  depuis: reponse.role,
202
205
  contexte: contexteDuSuperviseur,
203
- destinataire: ['testwriter', 'developpeur'].includes(reponse.role) ? reponse.role : null,
206
+ destinataire: AUTEURS_DE_LOT.includes(reponse.role) ? reponse.role : null,
204
207
  };
205
208
  }
206
209
  if (reponse.genre === 'mecanique') {
@@ -332,6 +335,8 @@ const ACTES = {
332
335
  async arret({ ticket, memoire, arret, etat, monter: aMonter, paquets, menee }) {
333
336
  const ctx = leContexte(ticket, memoire, { paquets });
334
337
  return rendre(ctx, () => {
338
+ // A stop of an opening that failed before its first state still says its circuit.
339
+ ctx.circuit ??= circuitSansTrace(ctx);
335
340
  const a = publierLArret(ctx, erreurDe(ctx, arret), etat);
336
341
  finirLEtape(ctx, menee ?? null);
337
342
  if (a.nom === 'limite-d-usage' && !aMonter) {
@@ -432,6 +437,7 @@ const lOuverture = (ctx, debut) => ({
432
437
  paquets: ctx.paquets,
433
438
  sorte: ctx.sorte ?? null,
434
439
  copie: ctx.copie,
440
+ circuit: ctx.circuit ?? null,
435
441
  },
436
442
  });
437
443
 
@@ -41,9 +41,13 @@
41
41
  // not yet ignored. The `.gitattributes` line `CHANGELOG.md merge=grillhouse-changelog` (scripts/fusion-du-changelog.mjs)
42
42
  // and the git hooks (scripts/crochets.mjs: `commit-msg`, `pre-push`, in `core.hooksPath` or the
43
43
  // default folder; the project's own lines stay, the frame's former ones give way).
44
- // - The generators of the declared language (`miseAJour.generateurs`), run by the project's
44
+ // - The generators of the declared language (`miseAJour.generateurs`) and the generator of the
45
+ // graph, which every project has (`generateursDe`, scripts/langages.mjs), run by the project's
45
46
  // `node_modules/.bin/grillhouse` for each file the project holds (all, in a project `init`
46
47
  // creates); a failing one, or a missing command, has its line saying to run it after `npm install`.
48
+ // One that imports a tool the project has not installed (`importe`: the graph's, jsonc-parser) is
49
+ // not run, as `nx migrate` installs before it runs a migration: its line asks for `npm install`,
50
+ // then its command.
47
51
  // - The binaries of the language (`binaires`; cargo: nextest, cargo-deny): installed when missing
48
52
  // or at another version by `miseAJour.installation`; one that fails has its line, exit code non-zero.
49
53
  // `npx grillhouse binaires` plays the same alone (scripts/binaires.mjs).
@@ -64,13 +68,14 @@ import { pathToFileURL } from 'node:url';
64
68
  import { CADRE, VERSION } from './cadre.mjs';
65
69
  import { installerBinaires } from './binaires.mjs';
66
70
  import { poserCrochets } from './crochets.mjs';
71
+ import { SORTE_DE_LA_MONTEE } from './places-de-la-machine.mjs';
67
72
  import { ATTRIBUT } from './fusion-du-changelog.mjs';
68
73
  import { fluxSansEntree } from './flux-des-paquets.mjs';
69
74
  import { installerGreffons } from './greffons.mjs';
70
75
  import { groupeDe, projetsExternes } from './groupe-cles.mjs';
71
76
  import { migrer, restesAuProjet } from './migrations.mjs';
72
77
  import { arbrePrincipal } from './outils-cles.mjs';
73
- import { langageDe, langagesDe } from './langages.mjs';
78
+ import { generateursDe, langageDe, langagesDe } from './langages.mjs';
74
79
  import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
75
80
  import { CONFIG_BEADS, ecrireLePrefixe, prefixe, prefixeDuStore } from './prefixe-des-tickets.mjs';
76
81
  import { paquets } from './paquets.mjs';
@@ -442,18 +447,17 @@ export function mettreAJour(projet, source, { inscrite = VERSION, bd = jouerBd }
442
447
 
443
448
  /**
444
449
  * Runs each generator of the languages of the project (`miseAJour.generateurs` of each module,
445
- * each once) whose output the project holds (every one with `tous`, for a project `grillhouse init` creates;
450
+ * and the generator of the graph, `generateursDe`, each once) whose output the project holds (every one with `tous`, for a project `grillhouse init` creates;
446
451
  * every one of the module <langage>, for the first package of a language `grillhouse paquet` creates);
447
- * returns the lines of failure.
452
+ * one that imports a tool not installed in the project (`importe`) is not run. Returns the lines of
453
+ * failure, one for each generator not run among them.
448
454
  */
449
455
  export function regenerer(projet, { tous = false, langage = null } = {}) {
450
456
  const lignes = [];
451
457
  const grillhouse = path.join(projet, 'node_modules', '.bin', 'grillhouse');
452
458
  const aPaquets = lireJson(path.join(projet, 'package.json'), {})?.workspaces !== undefined;
453
459
  const vus = new Set();
454
- for (const { g, m } of langagesDe(projet).flatMap(m =>
455
- m.miseAJour.generateurs.map(g => ({ g, m }))
456
- )) {
460
+ for (const { g, m } of generateursDe(langagesDe(projet))) {
457
461
  const cle = JSON.stringify([g.commande, ...g.args]);
458
462
  const absente =
459
463
  g.sortie !== null && !tous && m.nom !== langage && !existsSync(path.join(projet, g.sortie));
@@ -461,13 +465,23 @@ export function regenerer(projet, { tous = false, langage = null } = {}) {
461
465
  continue;
462
466
  }
463
467
  vus.add(cle);
468
+ const geste = `npx grillhouse ${[g.commande, ...g.args].join(' ')}`;
469
+ const manquants = (g.importe ?? []).filter(
470
+ nom => !existsSync(path.join(projet, 'node_modules', nom, 'package.json'))
471
+ );
472
+ if (manquants.length > 0) {
473
+ lignes.push(
474
+ `${g.sortie ?? g.commande} : non joué, ${manquants.join(', ')} n’est pas installé ; lance \`npm install\`, puis \`${geste}\`.`
475
+ );
476
+ continue;
477
+ }
464
478
  if (g.sortie !== null) {
465
479
  mkdirSync(path.dirname(path.join(projet, g.sortie)), { recursive: true });
466
480
  }
467
481
  const r = spawnSync(grillhouse, [g.commande, ...g.args], { cwd: projet, encoding: 'utf8' });
468
482
  if (r.status !== 0) {
469
483
  lignes.push(
470
- `${g.sortie ?? g.commande} : \`npx grillhouse ${[g.commande, ...g.args].join(' ')}\` échoue ; lance-le après \`npm install\`, qui installe les outils du cadre. ${(r.stderr ?? '').trim()}`.trim()
484
+ `${g.sortie ?? g.commande} : \`${geste}\` échoue ; lance-le après \`npm install\`, qui installe les outils du cadre. ${(r.stderr ?? '').trim()}`.trim()
471
485
  );
472
486
  }
473
487
  }
@@ -538,13 +552,15 @@ export const aInstaller = b => b.dependances.length > 0 || b.duLangage.installer
538
552
  // erreur }`, the code of `npm run verifier` (null when it is not played), the line of the report,
539
553
  // and whether it goes on the error stream. <sansVerifier>: the language's line on a project
540
554
  // without script `verifier`.
541
- function verifier(projet, { fichiersAFinir, installer, sansVerifier }) {
555
+ export function verifier(projet, { fichiersAFinir, installer, sansVerifier }) {
542
556
  const VERT_INTACT = 'le dernier vert reste où il était';
557
+ // The verification left to the supervisor, under the closed machine too.
558
+ const POSTE_FERME = ` Machine fermée : \`GRILLHOUSE_VERIFICATION_SORTE=${SORTE_DE_LA_MONTEE} npm run verifier\`.`;
543
559
  if (fichiersAFinir) {
544
560
  return {
545
561
  code: null,
546
562
  erreur: true,
547
- ligne: `Vérification non jouée : la mise à jour laisse à faire ci-dessus ; ${VERT_INTACT}. Fais-le, puis \`npm run verifier\`.`,
563
+ ligne: `Vérification non jouée : la mise à jour laisse à faire ci-dessus ; ${VERT_INTACT}. Fais-le, puis \`npm run verifier\`.${POSTE_FERME}`,
548
564
  };
549
565
  }
550
566
  if (typeof lireJson(path.join(projet, 'package.json'), {})?.scripts?.verifier !== 'string') {
@@ -560,10 +576,16 @@ function verifier(projet, { fichiersAFinir, installer, sansVerifier }) {
560
576
  return {
561
577
  code: null,
562
578
  erreur: false,
563
- ligne: `Vérification non jouée : \`npm install\` d’abord, qui installe ce que la mise à jour déclare, puis \`npm run verifier\` ; ${VERT_INTACT}.`,
579
+ ligne: `Vérification non jouée : \`npm install\` d’abord, qui installe ce que la mise à jour déclare, puis \`npm run verifier\` ; ${VERT_INTACT}.${POSTE_FERME}`,
564
580
  };
565
581
  }
566
- const r = spawnSync('npm', ['run', 'verifier'], { cwd: projet, stdio: 'inherit' });
582
+ // The update is a gesture of the maintenance window of the machine closed by the supervisor
583
+ // (`grillhouse machine fermer`): its pass is of the sort « Montée », which the closure does not refuse.
584
+ const r = spawnSync('npm', ['run', 'verifier'], {
585
+ cwd: projet,
586
+ stdio: 'inherit',
587
+ env: { ...process.env, GRILLHOUSE_VERIFICATION_SORTE: SORTE_DE_LA_MONTEE },
588
+ });
567
589
  const code = r.status ?? 1;
568
590
  if (code === 0) {
569
591
  return {
@@ -577,7 +599,7 @@ function verifier(projet, { fichiersAFinir, installer, sansVerifier }) {
577
599
  return {
578
600
  code,
579
601
  erreur: true,
580
- ligne: `Vérification : \`npm run verifier\` à repasser (code 75) ; ni vert ni rouge, ${VERT_INTACT}. Relance \`npm run verifier\` plus tard.`,
602
+ ligne: `Vérification : \`npm run verifier\` à repasser (code 75) ; ni vert ni rouge, ${VERT_INTACT}. Relance \`npm run verifier\` plus tard.${POSTE_FERME}`,
581
603
  };
582
604
  }
583
605
  const cause = r.error ? ` (${r.error.message})` : '';
@@ -614,6 +636,11 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
614
636
  }
615
637
  }
616
638
 
639
+ // A migration as the report names it: its version, none before the release that numbers it.
640
+ function titre(version, nom) {
641
+ return `Migration ${version ?? 'de la prochaine sortie'} (${nom})`;
642
+ }
643
+
617
644
  // The update of the project at <projet>, its languages declared (declarerLesLangages), <premiere>
618
645
  // what the migration of its languages did, null for nothing.
619
646
  function mettreAJourLeProjet(projet, premiere) {
@@ -623,12 +650,10 @@ function mettreAJourLeProjet(projet, premiere) {
623
650
  const b = mettreAJour(projet, CADRE, resteAFaire ? { inscrite: null } : {});
624
651
  process.stdout.write(`${LIGNE_DU_CADRE}\n`);
625
652
  for (const { version, nom, lignes, aFaire } of migrations) {
626
- process.stdout.write(
627
- `Migration ${version} (${nom}) :\n${lignes.map(l => `- ${l}\n`).join('')}`
628
- );
653
+ process.stdout.write(`${titre(version, nom)} :\n${lignes.map(l => `- ${l}\n`).join('')}`);
629
654
  if (aFaire.length > 0) {
630
655
  process.stderr.write(
631
- `Migration ${version} (${nom}), à faire :\n${aFaire.map(l => `- ${l}\n`).join('')}`
656
+ `${titre(version, nom)}, à faire :\n${aFaire.map(l => `- ${l}\n`).join('')}`
632
657
  );
633
658
  process.exitCode = 1;
634
659
  }
@@ -657,7 +682,7 @@ function mettreAJourLeProjet(projet, premiere) {
657
682
  }
658
683
  for (const { version, nom, lignes } of restesAuProjet(projet, depuis)) {
659
684
  process.stdout.write(
660
- `Migration ${version} (${nom}), reste au projet :\n${lignes.map(l => `- ${l}\n`).join('')}`
685
+ `${titre(version, nom)}, reste au projet :\n${lignes.map(l => `- ${l}\n`).join('')}`
661
686
  );
662
687
  }
663
688
  const v = verifier(projet, {
@@ -24,6 +24,21 @@ export function lireGroupe(
24
24
  */
25
25
  export function groupeDe(dir: string): GroupeDeclare | null;
26
26
 
27
+ /** A fault of the key, or a path of it that leads to no project of the frame. */
28
+ export interface SignalementDuGroupe {
29
+ cle: string;
30
+ valeur: string;
31
+ motif: 'sans-projet' | 'refusee';
32
+ /** The reading refuses the entry, which drops the whole group. */
33
+ ignore: boolean;
34
+ }
35
+
36
+ /** Each signalement of the key of the project that holds <dir>, read in its main tree. */
37
+ export function signalementsDuGroupe(dir: string): SignalementDuGroupe[];
38
+
39
+ /** The line the start of a session says for each signalement. */
40
+ export function lignesDuGroupe(dir: string): string[];
41
+
27
42
  /** The `external_projects` of the Beads of the project at <racine>: the other projects of its group. */
28
43
  export function projetsExternes(
29
44
  groupe: { projets: ProjetDuGroupe[] },