@roomi-fields/grillhouse 0.50.3 → 0.52.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 (150) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -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/plan.md +47 -0
  13. package/charte/preuve.md +39 -0
  14. package/charte/superviseur.md +61 -0
  15. package/charte/tests.md +38 -0
  16. package/charte.md +39 -189
  17. package/dist/machine/part-par-sorte.d.ts +16 -0
  18. package/dist/machine/part-par-sorte.js +36 -0
  19. package/dist/machine/part-par-sorte.js.map +1 -0
  20. package/dist/temporal/circuit/appel.js +1 -1
  21. package/dist/temporal/circuit/appel.js.map +1 -1
  22. package/dist/temporal/circuit/client.d.ts +4 -4
  23. package/dist/temporal/circuit/client.js +38 -16
  24. package/dist/temporal/circuit/client.js.map +1 -1
  25. package/dist/temporal/circuit/contrat.d.ts +11 -7
  26. package/dist/temporal/circuit/contrat.js +5 -9
  27. package/dist/temporal/circuit/contrat.js.map +1 -1
  28. package/dist/temporal/circuit/deroule.js +18 -6
  29. package/dist/temporal/circuit/deroule.js.map +1 -1
  30. package/dist/temporal/commande.js +12 -3
  31. package/dist/temporal/commande.js.map +1 -1
  32. package/dist/temporal/installation.d.ts +54 -3
  33. package/dist/temporal/installation.js +187 -17
  34. package/dist/temporal/installation.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +5 -1
  36. package/dist/temporal/places/client.js +23 -11
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/docs/ARCHITECTURE.md +23 -2700
  39. package/docs/INTERFACE.md +26 -10
  40. package/docs/architecture/circuit.md +61 -14
  41. package/docs/architecture/entree.md +21 -8
  42. package/docs/architecture/greffon.md +49 -20
  43. package/docs/architecture/installation.md +46 -17
  44. package/docs/architecture/machine.md +79 -39
  45. package/docs/architecture/tests.md +59 -16
  46. package/docs/lexique.md +163 -0
  47. package/hooks/hooks.json +0 -10
  48. package/hooks/register.tsx +92 -4
  49. package/package.json +2 -1
  50. package/scripts/activites.mjs +105 -65
  51. package/scripts/aiguillage.mjs +15 -8
  52. package/scripts/attente-au-tour.mjs +2 -3
  53. package/scripts/attente-de-la-machine.mjs +4 -8
  54. package/scripts/avancement.mjs +12 -8
  55. package/scripts/bilan.mjs +126 -63
  56. package/scripts/bilans-gardes.mjs +37 -0
  57. package/scripts/branche-de-nuit.mjs +2 -2
  58. package/scripts/ci-de-main.mjs +18 -21
  59. package/scripts/circuit.mjs +89 -44
  60. package/scripts/circuits-du-serveur.mjs +5 -5
  61. package/scripts/composants-affectes.mjs +30 -12
  62. package/scripts/composition-des-langages.mjs +5 -3
  63. package/scripts/conformite.mjs +1 -1
  64. package/scripts/consommation-des-passes.mjs +8 -6
  65. package/scripts/copies-finies.mjs +3 -14
  66. package/scripts/depart-du-ticket.d.mts +8 -2
  67. package/scripts/depart-du-ticket.mjs +26 -8
  68. package/scripts/direct.mjs +158 -72
  69. package/scripts/droits.mjs +165 -208
  70. package/scripts/engendres.mjs +3 -14
  71. package/scripts/entree-de-seance.mjs +35 -0
  72. package/scripts/enveloppe/enveloppe.mjs +98 -46
  73. package/scripts/enveloppe/lancer.sh +90 -66
  74. package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
  75. package/scripts/enveloppe/travail-de-la-copie.mjs +192 -3
  76. package/scripts/etapes.mjs +84 -22
  77. package/scripts/faits-du-circuit.mjs +8 -2
  78. package/scripts/grillhouse-maj.mjs +43 -18
  79. package/scripts/groupe-cles.d.mts +15 -0
  80. package/scripts/groupe-cles.mjs +77 -2
  81. package/scripts/init.mjs +9 -2
  82. package/scripts/integration/rejeu.mjs +8 -1
  83. package/scripts/jointure.d.ts +24 -4
  84. package/scripts/langages/c/index.mjs +5 -2
  85. package/scripts/langages/cargo/commandes.mjs +35 -15
  86. package/scripts/langages/cargo/composants.mjs +45 -3
  87. package/scripts/langages/cargo/index.mjs +6 -3
  88. package/scripts/langages/python/commandes.mjs +50 -7
  89. package/scripts/langages/python/index.mjs +5 -2
  90. package/scripts/langages/python/squelette.mjs +2 -1
  91. package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
  92. package/scripts/langages/typescript/index.mjs +16 -14
  93. package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
  94. package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
  95. package/scripts/langages/typescript/turbo-des-paquets.mjs +151 -38
  96. package/scripts/langages/typescript/verdict.mjs +29 -3
  97. package/scripts/langages/typescript/verifier.mjs +28 -3
  98. package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
  99. package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
  100. package/scripts/langages.mjs +54 -4
  101. package/scripts/matieres-lues.mjs +1 -1
  102. package/scripts/mesure/base-de-passe.mjs +32 -90
  103. package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
  104. package/scripts/migrations/suivi-du-superviseur-retire.mjs +56 -0
  105. package/scripts/migrations.mjs +23 -7
  106. package/scripts/nuit.sh +3 -2
  107. package/scripts/paquet.mjs +1 -1
  108. package/scripts/paquets.d.ts +3 -0
  109. package/scripts/paquets.mjs +88 -1
  110. package/scripts/passe-de-la-machine.mjs +109 -36
  111. package/scripts/places-de-la-machine.mjs +81 -29
  112. package/scripts/plafond-de-la-machine.d.mts +2 -5
  113. package/scripts/plafond-de-la-machine.mjs +9 -9
  114. package/scripts/reprise.mjs +42 -13
  115. package/scripts/resultats.mjs +78 -56
  116. package/scripts/retirer-les-copies-finies.mjs +1 -1
  117. package/scripts/seances.mjs +471 -133
  118. package/scripts/services-du-noyau.mjs +9 -1
  119. package/scripts/session-start.sh +22 -7
  120. package/scripts/sortie-de-seance.mjs +70 -0
  121. package/scripts/sortie.mjs +37 -6
  122. package/scripts/sous-commandes.mjs +0 -3
  123. package/scripts/superviseur.mjs +400 -162
  124. package/scripts/tableau.mjs +188 -65
  125. package/scripts/transitions.d.mts +25 -2
  126. package/scripts/transitions.mjs +137 -29
  127. package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
  128. package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
  129. package/skills/developpeur/SKILL.md +38 -15
  130. package/skills/direct/SKILL.md +29 -9
  131. package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
  132. package/skills/domain-modeling/SKILL.md +14 -12
  133. package/skills/explorateur/SKILL.md +32 -8
  134. package/skills/grill/SKILL.md +3 -2
  135. package/skills/pitmaster/SKILL.md +80 -50
  136. package/skills/pitmaster/references/cadre.md +1 -1
  137. package/skills/pitmaster/references/consigne-agent.md +12 -11
  138. package/skills/pitmaster/references/tour.md +6 -5
  139. package/skills/relecteur/SKILL.md +13 -6
  140. package/skills/systematic-debugging/SKILL.md +281 -0
  141. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  142. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  143. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  144. package/skills/systematic-debugging/find-polluter.sh +72 -0
  145. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  146. package/skills/testwriter/SKILL.md +37 -31
  147. package/cadre/templates/projet/pitmaster/SUIVI.md +0 -22
  148. package/scripts/attente-a-l-arret.mjs +0 -114
  149. package/scripts/verrous/commande.mjs +0 -214
  150. package/scripts/verrous/verrou.mjs +0 -311
@@ -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[] },
@@ -4,14 +4,17 @@
4
4
  // their tickets that wait for a place leave by priority (scripts/regles-des-places.mjs), and
5
5
  // `grillhouse maj` writes the other projects of the group as the `external_projects` of the Beads
6
6
  // of each (`bd ship` and `external:<project>:<capability>` dependencies resolve through them).
7
- // Any other value is a fault, named by its key before any work.
7
+ // Any other value is a fault, named by its key before any work. The board and the start of a
8
+ // session signal each fault, and each path that leads to no project of the frame
9
+ // (`signalementsDuGroupe`).
8
10
  // The key is the project's: `groupeDe` reads it in the package.json of the main tree of the
9
11
  // repository, never of a copy, and resolves its relative paths from that tree, so that a command
10
12
  // launched in a copy of work reads the same group as one launched in the main tree.
11
- // Architecture: docs/architecture/machine.md (§5.4).
13
+ // Architecture: docs/architecture/machine.md (§5.4), greffon.md (§5.1).
12
14
  import { createHash } from 'node:crypto';
13
15
  import { existsSync, readFileSync } from 'node:fs';
14
16
  import path from 'node:path';
17
+ import { NOM_DU_PAQUET } from './aiguillage.mjs';
15
18
  import { arbrePrincipal } from './outils-cles.mjs';
16
19
 
17
20
  /**
@@ -87,6 +90,78 @@ export function groupeDe(dir) {
87
90
  return groupe;
88
91
  }
89
92
 
93
+ // The package.json of the directory <dossier>; null when none reads.
94
+ function paquetDe(dossier) {
95
+ try {
96
+ return JSON.parse(readFileSync(path.join(dossier, 'package.json'), 'utf8'));
97
+ } catch {
98
+ return null;
99
+ }
100
+ }
101
+
102
+ // A project of the frame: its package.json declares the frame's package, as the greffon's mod
103
+ // recognises one.
104
+ function estUnProjetDuCadre(dossier) {
105
+ const p = paquetDe(dossier);
106
+ return [p?.dependencies, p?.devDependencies].some(d => Object.hasOwn(d ?? {}, NOM_DU_PAQUET));
107
+ }
108
+
109
+ /**
110
+ * What the key of the project that holds <dir> gets wrong, read in the package.json of its main
111
+ * tree: each entry whose path leads to no project of the frame, the project itself apart (`motif`
112
+ * « sans-projet »), and each other fault of the key (« refusee »: a duplicate, a malformed value),
113
+ * in the order of the entries. `ignore` is true when the reading refuses the entry, which drops the
114
+ * whole group; false for a folder that exists and is no project of the frame. Empty without the
115
+ * key, or without a package.json that reads.
116
+ * @param {string} dir a directory of the project: its main tree or a copy
117
+ * @returns {{ cle: string, valeur: string, motif: 'sans-projet' | 'refusee', ignore: boolean }[]}
118
+ */
119
+ export function signalementsDuGroupe(dir) {
120
+ const racine = arbrePrincipal(dir);
121
+ const pkg = paquetDe(racine);
122
+ const refusees = new Map(lireGroupe(pkg, racine).fautes.map(f => [f.cle, f.valeur]));
123
+ const liste = pkg?.grillhouse?.groupe;
124
+ if (!Array.isArray(liste) || liste.length === 0) {
125
+ return [...refusees].map(([cle, valeur]) => ({ cle, valeur, motif: 'refusee', ignore: true }));
126
+ }
127
+ return liste.flatMap((v, i) => {
128
+ const cle = `grillhouse.groupe[${i}]`;
129
+ const chemin = typeof v === 'string' && v.trim() !== '' ? path.resolve(racine, v) : null;
130
+ const sansProjet =
131
+ chemin !== null && chemin !== path.resolve(racine) && !estUnProjetDuCadre(chemin);
132
+ const ignore = refusees.has(cle);
133
+ if (!sansProjet && !ignore) {
134
+ return [];
135
+ }
136
+ return [
137
+ {
138
+ cle,
139
+ valeur: refusees.get(cle) ?? JSON.stringify(v),
140
+ motif: sansProjet ? 'sans-projet' : 'refusee',
141
+ ignore,
142
+ },
143
+ ];
144
+ });
145
+ }
146
+
147
+ /**
148
+ * The line the start of a session says for each of `signalementsDuGroupe`.
149
+ * @param {string} dir
150
+ * @returns {string[]}
151
+ */
152
+ export function lignesDuGroupe(dir) {
153
+ return signalementsDuGroupe(dir).map(({ cle, valeur, motif, ignore }) => {
154
+ const constat =
155
+ motif === 'sans-projet'
156
+ ? 'ce chemin ne mène à aucun projet du cadre'
157
+ : 'la valeur est refusée (un chemin de projet existant, une fois)';
158
+ const effet = ignore
159
+ ? 'le groupe entier est ignoré (ni les questions de ses projets, ni leur ordre de places)'
160
+ : "aucune question de circuit n'en vient";
161
+ return `⚠️ ${cle} vaut ${valeur} : ${constat} ; ${effet}. Corrige la clé dans le package.json de la racine.`;
162
+ });
163
+ }
164
+
90
165
  /**
91
166
  * The `external_projects` of the Beads of the project at <racine>: the other projects of its
92
167
  * <groupe>, `{ <nom>: <chemin> }`, each path relative to <racine>, the root of its main tree:
package/scripts/init.mjs CHANGED
@@ -11,6 +11,8 @@
11
11
  // scripts/cadre.mjs) at its own path; `_gitignore` and `_npmignore` become `.gitignore` and
12
12
  // `.npmignore`, the names npm neither publishes nor reads in a package, as create-vite names its
13
13
  // templates' files.
14
+ // - Its .mcp.json declares the servers of the index, codegraph and rtfm, as the migration that
15
+ // brings them to a project writes them (scripts/migrations/serveurs-de-l-index.mjs).
14
16
  // - Its package.json declares the frame's package, `@roomi-fields/grillhouse` at `^<version>` of
15
17
  // this package, in its devDependencies.
16
18
  // - The preparation (scripts/preparation.mjs): git, Beads and its ticket store under the prefix
@@ -38,6 +40,7 @@ import path from 'node:path';
38
40
  import { pathToFileURL } from 'node:url';
39
41
  import { CADRE, VERSION } from './cadre.mjs';
40
42
  import { mettreAJour, regenerer } from './grillhouse-maj.mjs';
43
+ import * as serveursDeLIndex from './migrations/serveurs-de-l-index.mjs';
41
44
  import { preparer } from './preparation.mjs';
42
45
 
43
46
  /** The frame's package, as a project declares it. */
@@ -49,8 +52,11 @@ const RENOMMES = { _gitignore: '.gitignore', _npmignore: '.npmignore' };
49
52
  const lancer = (projet, commande, args) =>
50
53
  execFileSync(commande, args, { cwd: projet, stdio: 'inherit' });
51
54
 
52
- // Copies the template of a project into <projet>, its files renamed (RENOMMES).
53
- function copierLeGabarit(projet) {
55
+ /**
56
+ * Copies the template of a project into <projet>, its files renamed (RENOMMES), its package.json
57
+ * declaring the frame's package, its .mcp.json the servers of the index.
58
+ */
59
+ export function copierLeGabarit(projet) {
54
60
  const gabarit = path.join(CADRE, 'templates', 'projet');
55
61
  cpSync(gabarit, projet, { recursive: true });
56
62
  const renommer = dossier => {
@@ -72,6 +78,7 @@ function copierLeGabarit(projet) {
72
78
  )
73
79
  );
74
80
  writeFileSync(fichier, `${JSON.stringify(p, null, 2)}\n`);
81
+ serveursDeLIndex.migrer(projet);
75
82
  }
76
83
 
77
84
  /** Creates the project at <dossier>; returns the lines of failure once it is created. */
@@ -15,6 +15,9 @@
15
15
  // `scripts/sous-modules.sh monter`: each submodule the preparation linked is read-only, by the
16
16
  // list the pose printed, whatever a command rewrites afterwards. With a link and no possible
17
17
  // mount (bwrap absent or refused), the copy refuses before any command runs.
18
+ // - A copy's node_modules is its own: a symbolic link found there at the opening is removed, never
19
+ // the directory it names, before any command plays, as `npm ci` would empty that directory and
20
+ // `npm install --package-lock-only` write into it.
18
21
  // - The dependencies follow the lock file and the manifests of the moment. One function (`accorder`,
19
22
  // which `ouvrirCopie` hands out as `installer`) compares the fingerprint of the lock file and of
20
23
  // the manifests (every `package.json` git tracks) with the key
@@ -30,7 +33,7 @@
30
33
  // refreshes for its own account.
31
34
  import { spawnSync } from 'node:child_process';
32
35
  import { createHash } from 'node:crypto';
33
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
36
+ import { existsSync, lstatSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
34
37
  import path from 'node:path';
35
38
  import { fileURLToPath } from 'node:url';
36
39
 
@@ -74,6 +77,10 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
74
77
  if (!prete) {
75
78
  return `La copie ${copie} ne se prépare pas.`;
76
79
  }
80
+ const modules = path.join(copie, 'node_modules');
81
+ if (lstatSync(modules, { throwIfNoEntry: false })?.isSymbolicLink()) {
82
+ unlinkSync(modules);
83
+ }
77
84
  const poses = spawnSync('bash', [SOUS_MODULES, 'pose', copie], { encoding: 'utf8' });
78
85
  if (poses.status !== 0) {
79
86
  return `La copie ne pose pas ses sous-modules : ${poses.stderr.trim()}`;
@@ -67,7 +67,14 @@ export interface FichierEngendre {
67
67
  /** What the testwriter writes in a file: a test the runner plays (`joue`), a test file or a file of
68
68
  * a folder of tests (`test`), a file of the shared test material (`matiere`); null for a file it
69
69
  * does not write. */
70
- export type ClasseDeTest = { joue: boolean; test: boolean; matiere: boolean } | null;
70
+ export type ClasseDeTest = {
71
+ joue: boolean;
72
+ test: boolean;
73
+ matiere: boolean;
74
+ /** For a file the runner plays within another, as a module of an executable of tests: the file
75
+ * it plays for it, from the root. The proof of the red names that file. */
76
+ jouePar?: string;
77
+ } | null;
71
78
 
72
79
  /** What the testwriter writes of the manifests, as the author of a test of Bazel declares the deps
73
80
  * of its target: the part of a component's manifest that declares what its tests depend on, and
@@ -134,7 +141,8 @@ export interface ElementsDuLot {
134
141
 
135
142
  /** A migration of a project from one version of the frame to the next (scripts/migrations.mjs). */
136
143
  export interface Migration {
137
- version: string;
144
+ /** The version of the package that brings it; null until that release. */
145
+ version: string | null;
138
146
  nom: string;
139
147
  migrer(projet: string): (string | { aFaire: string })[];
140
148
  restes?(projet: string): string[];
@@ -149,6 +157,10 @@ export interface Generateur {
149
157
  * project `grillhouse init` creates); null, it runs in every project whose package.json declares
150
158
  * `workspaces`. */
151
159
  sortie: string | null;
160
+ /** The tools of the project it imports (`outils`): while one is not installed in the project
161
+ * (no `node_modules/<tool>/package.json`), the update does not run it, and its line asks for
162
+ * `npm install` then its command; absent, it imports none. */
163
+ importe?: string[];
152
164
  }
153
165
 
154
166
  /** What the module brings to the update of a project (`grillhouse maj`), as each plugin of Nx
@@ -206,7 +218,8 @@ export interface Composition {
206
218
  * out, the update writes them in the project's `.gitignore`, and the removal of the finished
207
219
  * copies removes them from a kept copy whose ticket is closed (scripts/copies-finies.mjs). */
208
220
  ignorer: string[];
209
- /** Where a run of the language's tools writes, which the envelope opens to a session. */
221
+ /** Where a run of the language's tools writes, which the envelope opens to a session;
222
+ * Turborepo's outputs are the core's, which no module declares. */
210
223
  sorties: {
211
224
  /** Opened in writing: from the root of the copy, from the home (`~/…`), or from the main
212
225
  * tree (`//…`), a store shared by every copy; each created before the session, a directory
@@ -227,6 +240,10 @@ export interface Composition {
227
240
  matieres(racine: string): Composant[];
228
241
  /** Whether the component plays tests: the runner of the language has tests to play in it. */
229
242
  joueDesTests(racine: string, composant: Composant): boolean;
243
+ /** The patterns the test files of the package in `dossier` (absolute) declare in the
244
+ * `// @lit` lines of their head, each a glob from the root, once, sorted; read on the disk
245
+ * alone. None for python and c, whose declarations are not read yet. */
246
+ lecturesDesTests(dossier: string): string[];
230
247
  /** The hashes of the inputs of the tests tasks of the components `noms` (their package names)
231
248
  * and of their dependents, `{ <paquet>: <hash> }`, as the task runner plans them (the hash of a
232
249
  * task covers the content of the files it reads and of what it waits for); null when the runner
@@ -245,7 +262,10 @@ export interface Composition {
245
262
  commandes(
246
263
  racine: string
247
264
  ): { tester: Commande; verifier: Commande; typer: Commande } & Record<string, Commande>;
248
- verdict(dossier: string): { rapports: RapportDeTest[]; taches: TacheJouee[] };
265
+ /** What a run left in its results directory `dossier`. With `racine`, the root of the run, the
266
+ * reports of a runner that writes none test by test too, read from the log of its task
267
+ * (typescript: `claude plugin test`). */
268
+ verdict(dossier: string, racine?: string): { rapports: RapportDeTest[]; taches: TacheJouee[] };
249
269
  /** Whether the log `texte` of a task shows a COMPILATION failure of the language, so the circuit
250
270
  * reads a test target that does not compile as a failed build (« construction de <crate> »),
251
271
  * whatever the task that bears it — the build task, or the test task with no report
@@ -59,8 +59,9 @@ export default {
59
59
  sortieDuPaquet: () => {
60
60
  throw new Error('sortie non prise en charge pour c');
61
61
  },
62
- // Turborepo, which plays the tasks of the projects (./commandes.mjs).
63
- outils: ['turbo'],
62
+ // Turborepo, which plays the tasks of the projects (./commandes.mjs), and jsonc-parser, by which
63
+ // the generator of the graph reads and writes their turbo.json.
64
+ outils: ['jsonc-parser', 'turbo'],
64
65
  // The programs the installer of Temporal requires in the PATH of the workers, and the poste.
65
66
  executables: ['cmake', 'ctest'],
66
67
  // uv at the version of the module python's file (one source), first, then the clang tools.
@@ -85,6 +86,8 @@ export default {
85
86
  composantDe: (racine, fichier) => composantDans(composants(racine), racine, fichier),
86
87
  matieres: () => [],
87
88
  joueDesTests,
89
+ // No declaration of a test of C is read yet.
90
+ lecturesDesTests: () => [],
88
91
  lecteurs,
89
92
  elementsDuLot,
90
93
  // The remote cache of Turborepo on the poste, as the other modules play by Turborepo.
@@ -90,7 +90,9 @@
90
90
  // a failed test included, never a path built by hand under `std::env::temp_dir()`.
91
91
  // - `tests-de-nuit`: the night tests then the benches of each crate that holds some; none, nothing
92
92
  // plays and the code is 0. The night (scripts/nuit.sh) runs it after the full pass, and plays it
93
- // again at rest after a 75.
93
+ // again at rest after a 75. Out of the poste (`--hors-du-poste`), a crate whose night tests are
94
+ // all tagged away leaves nextest none to run (its code 4): green, said (« aucun test hors du
95
+ // poste »), as a Bazel shard without a test passes; said too when no crate is left to play.
94
96
  // - `typer`: `cargo check --all-targets`.
95
97
  // - Cargo runs with rustc wrapped by sccache, its cache common to the copies of the machine
96
98
  // (./sccache.mjs), in a copy as in an agent's envelope, its server started under the machine's
@@ -162,6 +164,7 @@ import {
162
164
  } from '../../services-du-noyau.mjs';
163
165
  import {
164
166
  BANC,
167
+ cibleDuModule,
165
168
  composantDans,
166
169
  crates,
167
170
  DE_NUIT,
@@ -186,6 +189,10 @@ export const NOMS = [
186
189
  // The task runner of the graph of the packages.
187
190
  const OUTIL = 'turbo';
188
191
  const A_REPASSER = 75;
192
+ // The exit code of nextest when its filter keeps no test (NO_TESTS_RUN).
193
+ const AUCUN_TEST = 4;
194
+ // What the night out of the poste says of a filter that keeps no test: green.
195
+ const AUCUN_HORS_DU_POSTE = 'aucun test hors du poste';
189
196
  const RACINE = '//';
190
197
  // The task of the time budget benches of a crate.
191
198
  const BUDGET = 'budget';
@@ -310,6 +317,7 @@ function passe(racine, env) {
310
317
  programme = 'cargo',
311
318
  temporaire = {},
312
319
  executables = null,
320
+ videVert = false,
313
321
  } = {}
314
322
  ) {
315
323
  // A report of an earlier run is no report of this one, which may write none.
@@ -363,6 +371,10 @@ function passe(racine, env) {
363
371
  const suffixe = t.script === 'nextest' ? '' : `-${t.script}`;
364
372
  copyFileSync(junit, path.join(dossier, JUNIT, `${id}-${t.paquet}${suffixe}.xml`));
365
373
  }
374
+ if (videVert && t.code === AUCUN_TEST) {
375
+ process.stderr.write(`↳ ${t.paquet} : ${AUCUN_HORS_DU_POSTE}.\n`);
376
+ t.code = 0;
377
+ }
366
378
  if (banc && t.code !== 0) {
367
379
  sousCharge(t, [avant, pression()]);
368
380
  }
@@ -448,8 +460,17 @@ export const partitionDeNextest = tranche =>
448
460
  // crate's other tasks not played. The benches named, each crate's in a task `budget`, are
449
461
  // planned with the rest and played by the function this one returns, after the other tests.
450
462
  // In a tranche <tranche>, nextest plays its part (`partitionDeNextest`); the doctests and the
451
- // benches, which nextest does not split, play in the first tranche alone.
452
- function jouerLesTests(racine, p, choix, options, temporaire = () => ({}), tranche = null) {
463
+ // benches, which nextest does not split, play in the first tranche alone. With <videVert>, a run
464
+ // of nextest whose filter keeps no test is green, and said.
465
+ function jouerLesTests(
466
+ racine,
467
+ p,
468
+ choix,
469
+ options,
470
+ temporaire = () => ({}),
471
+ tranche = null,
472
+ videVert = false
473
+ ) {
453
474
  const m = metadonnees(racine);
454
475
  // Nextest's store is `target/nextest` under the workspace's root (its default `store.dir`),
455
476
  // whatever the target directory of the compilations (./sccache.mjs).
@@ -519,7 +540,7 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({}), tranc
519
540
  ];
520
541
  prevues.push([
521
542
  p.prevoir(nom, d, 'nextest', true, args),
522
- { junit, temporaire: temporaire(nom) },
543
+ { junit, temporaire: temporaire(nom), videVert },
523
544
  ]);
524
545
  }
525
546
  if (desBancs.length && indivisible) {
@@ -591,23 +612,20 @@ function duJour(c) {
591
612
  // The refusal of a night test named in a targeted run: the night alone plays it.
592
613
  const REFUS_DE_NUIT = 'un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)';
593
614
 
594
- // The target `tests/<dossier>/main.rs` of the crate <crate> whose module is the file <abs> (out
595
- // of `tests/common/` and of the target's root), and the module's path in the executable
596
- // (`tests/it/foo.rs` and `tests/it/foo/mod.rs` → `foo`, `tests/it/foo/sous.rs` → `foo::sous`):
597
- // `{ cible, module }`, null for any other file.
615
+ // The test target of the crate <crate> whose module is the file <abs> (`cibleDuModule`), and the
616
+ // module's path in the executable (`tests/it/foo.rs` and `tests/it/foo/mod.rs` → `foo`,
617
+ // `tests/it/foo/sous.rs` → `foo::sous`): `{ cible, module }`, null for any other file.
598
618
  function moduleDeCible(crate, abs) {
599
- const parts = path.relative(crate.composant.dossier, abs).split(path.sep);
600
- if (parts.length < 3 || parts[0] !== 'tests' || parts[1] === 'common' || !abs.endsWith('.rs')) {
619
+ const cible = cibleDuModule(crate, abs);
620
+ if (!cible) {
601
621
  return null;
602
622
  }
603
- const racine = path.join(crate.composant.dossier, 'tests', parts[1], 'main.rs');
604
- const cible = crate.cibles.find(t => t.kind.includes('test') && t.src === racine);
605
- const module = parts.slice(2);
623
+ const module = path.relative(path.dirname(cible.src), abs).split(path.sep);
606
624
  module[module.length - 1] = module[module.length - 1].replace(/\.rs$/, '');
607
625
  if (module.at(-1) === 'mod') {
608
626
  module.pop();
609
627
  }
610
- return cible && module.length ? { cible, module: module.join('::') } : null;
628
+ return module.length ? { cible, module: module.join('::') } : null;
611
629
  }
612
630
 
613
631
  // The filterset of nextest that plays, of the targets <noms> of the crate <nom>, the modules
@@ -1066,8 +1084,10 @@ function testsDeNuit(racine, tous, env, parPaquet, args = []) {
1066
1084
  })
1067
1085
  .filter(x => x.cibles.length);
1068
1086
  if (choix.length) {
1069
- jouerLesTests(racine, p, choix, [], parPaquet.temporaire)();
1087
+ jouerLesTests(racine, p, choix, [], parPaquet.temporaire, null, nuit.horsDuPoste)();
1070
1088
  restesParPaquet(p, choix, parPaquet);
1089
+ } else if (nuit.horsDuPoste) {
1090
+ process.stderr.write(`↳ cargo : ${AUCUN_HORS_DU_POSTE}.\n`);
1071
1091
  }
1072
1092
  return p.code();
1073
1093
  }
@@ -47,6 +47,7 @@ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
47
47
  import { createRequire } from 'node:module';
48
48
  import path from 'node:path';
49
49
  import { isDeepStrictEqual } from 'node:util';
50
+ import { lecturesDeclarees } from '../../paquets.mjs';
50
51
  import { luUneFois } from '../../services-du-noyau.mjs';
51
52
  import { cibleDeCompilation } from './sccache.mjs';
52
53
 
@@ -164,6 +165,27 @@ export function joueDesTests(_racine, composant) {
164
165
  );
165
166
  }
166
167
 
168
+ /**
169
+ * The patterns the test files of the crate in <dossier> (absolute) declare they read (`// @lit` at
170
+ * their head), each once, sorted: its integration tests, the `.rs` files under `tests/`, and its
171
+ * unit tests, the ones under `src/` (`unitaire`). Read on the disk alone.
172
+ * @param {string} dossier
173
+ */
174
+ export function lecturesDesTests(dossier) {
175
+ const motifs = ['tests', 'src'].flatMap(racine => {
176
+ const d = path.join(dossier, racine);
177
+ if (!existsSync(d)) {
178
+ return [];
179
+ }
180
+ return readdirSync(d, { recursive: true, withFileTypes: true })
181
+ .filter(e => e.isFile() && e.name.endsWith('.rs'))
182
+ .map(e => path.join(e.parentPath, e.name))
183
+ .filter(f => racine === 'tests' || unitaire(path.relative(dossier, f).split(path.sep)))
184
+ .flatMap(f => lecturesDeclarees(readFileSync(f, 'utf8')));
185
+ });
186
+ return [...new Set(motifs)].sort();
187
+ }
188
+
167
189
  /**
168
190
  * The readers, by their manifests, of the crates <noms> among <composants> of <racine>: each a
169
191
  * reader `{ composant, par }`, `par` the kinds of its dependencies on it; what each crate reads
@@ -224,9 +246,26 @@ const sous = (fichier, dir) => {
224
246
  return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
225
247
  };
226
248
 
249
+ /**
250
+ * The test target `tests/<dossier>/main.rs` of the crate <crate> (an entry of `crates`) whose
251
+ * module is the file <abs>: a `.rs` file under that folder, `tests/common/` and the root of the
252
+ * target apart; undefined for any other file.
253
+ */
254
+ export function cibleDuModule(crate, abs) {
255
+ const parts = path.relative(crate.composant.dossier, abs).split(path.sep);
256
+ if (parts.length < 3 || parts[0] !== 'tests' || parts[1] === 'common' || !abs.endsWith('.rs')) {
257
+ return undefined;
258
+ }
259
+ const racine = path.join(crate.composant.dossier, 'tests', parts[1], 'main.rs');
260
+ return abs === racine
261
+ ? undefined
262
+ : crate.cibles.find(t => t.kind.includes('test') && t.src === racine);
263
+ }
264
+
227
265
  /**
228
266
  * What the testwriter writes in <chemin>, absolute or from the root <racine>: `{ joue, test,
229
- * matiere }`, or null for a file he does not write.
267
+ * matiere }`, with `jouePar` (from the root) for a module of a test target, the file the runner
268
+ * plays for it; null for a file he does not write.
230
269
  */
231
270
  export function estUnTest(chemin, racine) {
232
271
  const abs = path.resolve(racine, chemin);
@@ -239,7 +278,8 @@ export function estUnTest(chemin, racine) {
239
278
  if (!c) {
240
279
  return null;
241
280
  }
242
- const matiere = tous.find(x => x.composant === c).matiere;
281
+ const crate = tous.find(x => x.composant === c);
282
+ const { matiere } = crate;
243
283
  const parts = path.relative(c.dossier, abs).split(path.sep);
244
284
  if (parts[0] === 'tests' && sous(abs, path.join(c.dossier, 'tests'))) {
245
285
  if (parts[1] === 'common' && parts.length > 2) {
@@ -249,7 +289,9 @@ export function estUnTest(chemin, racine) {
249
289
  const joue =
250
290
  (parts.length === 2 && parts[1].endsWith('.rs')) ||
251
291
  (parts.length === 3 && parts[2] === 'main.rs');
252
- return { joue, test: true, matiere };
292
+ const cible = cibleDuModule(crate, abs);
293
+ const jouePar = cible && path.relative(path.resolve(racine), cible.src);
294
+ return { joue, test: true, matiere, ...(jouePar ? { jouePar } : {}) };
253
295
  }
254
296
  // The unit tests near their module, compiled with it: `tests.rs`, the files of `tests/`.
255
297
  if (unitaire(parts)) {