@roomi-fields/grillhouse 0.50.3 → 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 (131) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +48 -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/python/index.mjs +5 -2
  81. package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
  82. package/scripts/langages/typescript/index.mjs +4 -2
  83. package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
  84. package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
  85. package/scripts/langages/typescript/turbo-des-paquets.mjs +99 -36
  86. package/scripts/langages/typescript/verdict.mjs +29 -3
  87. package/scripts/langages/typescript/verifier.mjs +1 -1
  88. package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
  89. package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
  90. package/scripts/langages.mjs +54 -4
  91. package/scripts/matieres-lues.mjs +1 -1
  92. package/scripts/mesure/base-de-passe.mjs +32 -90
  93. package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
  94. package/scripts/migrations.mjs +21 -7
  95. package/scripts/paquets.d.ts +3 -0
  96. package/scripts/paquets.mjs +88 -1
  97. package/scripts/passe-de-la-machine.mjs +109 -36
  98. package/scripts/places-de-la-machine.mjs +81 -29
  99. package/scripts/plafond-de-la-machine.d.mts +2 -5
  100. package/scripts/plafond-de-la-machine.mjs +9 -9
  101. package/scripts/reprise.mjs +42 -13
  102. package/scripts/resultats.mjs +76 -54
  103. package/scripts/retirer-les-copies-finies.mjs +1 -1
  104. package/scripts/seances.mjs +426 -115
  105. package/scripts/services-du-noyau.mjs +9 -1
  106. package/scripts/session-start.sh +14 -1
  107. package/scripts/sortie.mjs +37 -6
  108. package/scripts/sous-commandes.mjs +0 -2
  109. package/scripts/superviseur.mjs +33 -13
  110. package/scripts/tableau.mjs +61 -16
  111. package/scripts/transitions.d.mts +25 -2
  112. package/scripts/transitions.mjs +137 -29
  113. package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
  114. package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
  115. package/skills/developpeur/SKILL.md +38 -15
  116. package/skills/direct/SKILL.md +29 -9
  117. package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
  118. package/skills/domain-modeling/SKILL.md +14 -12
  119. package/skills/explorateur/SKILL.md +30 -6
  120. package/skills/pitmaster/SKILL.md +12 -16
  121. package/skills/pitmaster/references/consigne-agent.md +12 -11
  122. package/skills/relecteur/SKILL.md +12 -5
  123. package/skills/systematic-debugging/SKILL.md +281 -0
  124. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  125. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  126. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  127. package/skills/systematic-debugging/find-polluter.sh +72 -0
  128. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  129. package/skills/testwriter/SKILL.md +35 -29
  130. package/scripts/verrous/commande.mjs +0 -214
  131. package/scripts/verrous/verrou.mjs +0 -311
@@ -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
@@ -227,6 +239,10 @@ export interface Composition {
227
239
  matieres(racine: string): Composant[];
228
240
  /** Whether the component plays tests: the runner of the language has tests to play in it. */
229
241
  joueDesTests(racine: string, composant: Composant): boolean;
242
+ /** The patterns the test files of the package in `dossier` (absolute) declare in the
243
+ * `// @lit` lines of their head, each a glob from the root, once, sorted; read on the disk
244
+ * alone. None for python and c, whose declarations are not read yet. */
245
+ lecturesDesTests(dossier: string): string[];
230
246
  /** The hashes of the inputs of the tests tasks of the components `noms` (their package names)
231
247
  * and of their dependents, `{ <paquet>: <hash> }`, as the task runner plans them (the hash of a
232
248
  * task covers the content of the files it reads and of what it waits for); null when the runner
@@ -245,7 +261,10 @@ export interface Composition {
245
261
  commandes(
246
262
  racine: string
247
263
  ): { tester: Commande; verifier: Commande; typer: Commande } & Record<string, Commande>;
248
- verdict(dossier: string): { rapports: RapportDeTest[]; taches: TacheJouee[] };
264
+ /** What a run left in its results directory `dossier`. With `racine`, the root of the run, the
265
+ * reports of a runner that writes none test by test too, read from the log of its task
266
+ * (typescript: `claude plugin test`). */
267
+ verdict(dossier: string, racine?: string): { rapports: RapportDeTest[]; taches: TacheJouee[] };
249
268
  /** Whether the log `texte` of a task shows a COMPILATION failure of the language, so the circuit
250
269
  * reads a test target that does not compile as a failed build (« construction de <crate> »),
251
270
  * 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)) {
@@ -48,6 +48,7 @@ import {
48
48
  estUnTest,
49
49
  joueDesTests,
50
50
  lecteurs,
51
+ lecturesDesTests,
51
52
  liensDuManifeste,
52
53
  manifestes,
53
54
  matieres,
@@ -77,9 +78,10 @@ export default {
77
78
  construireLesPaquets: () => {
78
79
  throw new Error('construction non prise en charge pour cargo');
79
80
  },
80
- // The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`), and
81
- // Turborepo, which plays the tasks of the crates (./commandes.mjs).
82
- outils: ['smol-toml', 'turbo'],
81
+ // The reader of TOML by which the judgment of a lot reads a Cargo.toml (./composants.mjs, `manifestes`), and
82
+ // Turborepo, which plays the tasks of the crates (./commandes.mjs); jsonc-parser, by which the
83
+ // generator of the graph reads and writes their turbo.json.
84
+ outils: ['jsonc-parser', 'smol-toml', 'turbo'],
83
85
  // The programs the installer of Temporal requires in the PATH of the workers: cargo's folder is
84
86
  // also rustc's, nextest's and sccache's (rustup, `cargo install`).
85
87
  executables: ['cargo'],
@@ -123,6 +125,7 @@ export default {
123
125
  composantDe: (racine, fichier) => composantDans(composants(racine), racine, fichier),
124
126
  matieres,
125
127
  joueDesTests,
128
+ lecturesDesTests,
126
129
  lecteurs,
127
130
  elementsDuLot,
128
131
  // The hashes of the inputs of the tests tasks of the crates and their dependents, as
@@ -72,8 +72,9 @@ export default {
72
72
  throw new Error('sortie non prise en charge pour python');
73
73
  },
74
74
  // The reader of TOML of a pyproject.toml, and Turborepo, which plays the tasks of the projects
75
- // (./commandes.mjs).
76
- outils: ['smol-toml', 'turbo'],
75
+ // (./commandes.mjs); jsonc-parser, by which the generator of the graph reads and writes their
76
+ // turbo.json.
77
+ outils: ['jsonc-parser', 'smol-toml', 'turbo'],
77
78
  // The programs the installer of Temporal requires in the PATH of the workers.
78
79
  executables: ['python3'],
79
80
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
@@ -94,6 +95,8 @@ export default {
94
95
  composantDe: (racine, fichier) => composantDans(composants(racine), racine, fichier),
95
96
  matieres: () => [],
96
97
  joueDesTests,
98
+ // No declaration of a test of Python is read yet: its comments open with `#`.
99
+ lecturesDesTests: () => [],
97
100
  lecteurs,
98
101
  elementsDuLot,
99
102
  // The hashes of the inputs of the tests tasks of the projects and their dependents, as
@@ -16,7 +16,7 @@
16
16
  // directory of tests, which the frame does not find in what the test reads nor under the
17
17
  // package's `grillhouse.lit` (`nonDeclares`): a script launched by a path built at run time
18
18
  // (`path.join(SCRIPTS, nom)`). The test writes the path whole (`path.resolve(__dirname,
19
- // '../scripts/verrous/verrou.mjs')`), or its package declares it in its `grillhouse.lit`.
19
+ // '../scripts/verrous/ecriture-hors-enveloppe.mjs')`), or its package declares it in its `grillhouse.lit`.
20
20
  // - The packages are those of the workspace, out of `docs/agents/hors-cadre.txt` (../../paquets.mjs);
21
21
  // a repository without one is its own package. A finding inscribed in the project's debt
22
22
  // (`grillhouse-dette.json`, ../../dette.mjs) passes: those that exist when the guard arrives are
@@ -25,8 +25,8 @@
25
25
  // removed in `afterAll`, and its guard: each run of Vitest plays under a base of its own,
26
26
  // named in TMPDIR, TMP and TEMP, and fails naming what its tests left there
27
27
  // (./vitest-config/base.mjs).
28
- // - The verdict: the summaries of Turborepo and the reports of Vitest of a results directory
29
- // (./verdict.mjs).
28
+ // - The verdict: the summaries of Turborepo and the reports of Vitest of a results directory, and
29
+ // the lines of the log of a runner without a report test by test (./verdict.mjs).
30
30
  // - The rule of a test file, the sibling of HEAD's version of a test file and what the testwriter
31
31
  // writes of the manifests (./regle-des-tests.mjs).
32
32
  // - The generated files, each its command, the guard that checks it and the names its findings
@@ -62,6 +62,7 @@ import { garderLesResumes, lireLesResumes, resumesDuLancement } from './resume-d
62
62
  import { miseAJour } from './mise-a-jour.mjs';
63
63
  import { squelette } from './squelette.mjs';
64
64
  import { estHorsDuJour } from './vitest-config/cibles.mjs';
65
+ import { lecturesDesTests } from './vitest-config/lances.mjs';
65
66
  import { moduleAbsent } from './module-absent.mjs';
66
67
  import * as configVitest from './migrations/0.23.0-config-vitest.mjs';
67
68
  import * as nomsDeclaresInutilises from './migrations/0.24.4-noms-declares-inutilises.mjs';
@@ -252,6 +253,7 @@ export default {
252
253
  matieres: racine =>
253
254
  matieres(racine).map(({ nom, dir, paquet }) => ({ nom, dossier: dir, paquet })),
254
255
  joueDesTests,
256
+ lecturesDesTests,
255
257
  lecteurs,
256
258
  elementsDuLot,
257
259
  // The hashes of the inputs of the tests tasks of the packages and their dependents, as
@@ -358,7 +358,7 @@ export const miseAJour = joueDesTests => ({
358
358
  generateurs: [
359
359
  { commande: 'frontieres', args: ['--ecrire'], sortie: '.dependency-cruiser.cjs' },
360
360
  { commande: 'index-interfaces', args: [], sortie: 'docs/agents/index-des-interfaces.md' },
361
- { commande: 'turbo-des-paquets', args: ['--ecrire'], sortie: null },
361
+ { commande: 'turbo-des-paquets', args: ['--ecrire'], sortie: null, importe: ['jsonc-parser'] },
362
362
  ],
363
363
  // No binary of the machine: nothing to install.
364
364
  installation: null,
@@ -0,0 +1,74 @@
1
+ // The test files of a runner that writes no report test by test, read from the lines it prints:
2
+ // `claude plugin test`, which plays the tests of a plugin (packages/grillhouse/docs/architecture/tests.md
3
+ // §3.3), which the verdict of the module reads (./verdict.mjs). As Bazel judges a test target that
4
+ // writes no test.xml by its exit code and its log, a task of such a runner is judged by both. The
5
+ // lines:
6
+ //
7
+ // <file, from the folder of the package>:
8
+ // (pass) <full name of the test> [<duration>]
9
+ // (fail) <full name of the test> [<duration>]
10
+ // <message, indented>
11
+ // (fail) the file did not load
12
+ // <reason, indented>
13
+ // Ran <n> tests across <m> files. [<duration>]
14
+ import path from 'node:path';
15
+
16
+ const FICHIER = /^(\S.*\.(?:test|spec)\.[cm]?[jt]sx?):$/;
17
+ const TEST = /^\((pass|fail|skip|todo)\) (.*?)(?: \[[\d.]+(?:ms|s)\])?$/;
18
+ const BILAN = /^Ran \d+ tests? across \d+ files?\./;
19
+ const NON_CHARGE = 'the file did not load';
20
+ const ETATS = { pass: 'passed', fail: 'failed', skip: 'skipped', todo: 'todo' };
21
+
22
+ /**
23
+ * The reports of the test files the lines &lt;texte&gt; of a task name, its package in the folder
24
+ * &lt;dossier&gt; (absolute), its exit code &lt;code&gt;: a file the runner did not load is failed, without a
25
+ * test, its reason its message. None when the lines prove nothing: the runner stopped before its
26
+ * last line, or a red code that no line explains.
27
+ * @param {string} texte
28
+ * @param {{ dossier: string, code: number }} tache
29
+ * @returns {import('../../jointure.js').RapportDeTest[]}
30
+ */
31
+ export function rapportsAuxLignes(texte, { dossier, code }) {
32
+ const rapports = [];
33
+ let rapport = null;
34
+ // What the indented lines that follow explain: the failed test, or the file not loaded.
35
+ let explique = null;
36
+ let fini = false;
37
+ for (const ligne of texte.split(/\r?\n/)) {
38
+ const fichier = FICHIER.exec(ligne);
39
+ const test = rapport && TEST.exec(ligne);
40
+ if (fichier) {
41
+ rapport = {
42
+ fichier: path.join(dossier, fichier[1]),
43
+ etat: 'passed',
44
+ message: '',
45
+ tests: [],
46
+ };
47
+ rapports.push(rapport);
48
+ explique = null;
49
+ } else if (test) {
50
+ const [, etat, nom] = test;
51
+ explique = null;
52
+ if (etat === 'fail') {
53
+ rapport.etat = 'failed';
54
+ }
55
+ if (etat === 'fail' && nom === NON_CHARGE) {
56
+ explique = rapport;
57
+ } else {
58
+ const t = { titre: nom.split(' > ').at(-1), nom, etat: ETATS[etat], message: '' };
59
+ rapport.tests.push(t);
60
+ explique = etat === 'fail' ? t : null;
61
+ }
62
+ } else if (BILAN.test(ligne)) {
63
+ fini = true;
64
+ rapport = null;
65
+ explique = null;
66
+ } else if (explique && /^\s/.test(ligne)) {
67
+ explique.message += `${explique.message ? '\n' : ''}${ligne.trim()}`;
68
+ } else {
69
+ explique = null;
70
+ }
71
+ }
72
+ const expliquee = code === 0 || rapports.some(r => r.etat === 'failed');
73
+ return fini && expliquee ? rapports : [];
74
+ }