@roomi-fields/grillhouse 0.28.1 → 0.28.3

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 (33) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/charte.md +13 -1
  3. package/docs/ARCHITECTURE.md +19 -2
  4. package/docs/INTERFACE.md +11 -2
  5. package/hooks/register.tsx +132 -161
  6. package/package.json +1 -1
  7. package/scripts/copies-finies.mjs +15 -4
  8. package/scripts/enveloppe/enveloppe.mjs +8 -5
  9. package/scripts/enveloppe/lancer.sh +12 -2
  10. package/scripts/enveloppe/travail-de-la-copie.mjs +13 -6
  11. package/scripts/jointure.d.ts +14 -0
  12. package/scripts/langages/cargo/composants.mjs +4 -0
  13. package/scripts/langages/cargo/index.mjs +4 -2
  14. package/scripts/langages/cargo/sccache.mjs +37 -6
  15. package/scripts/langages/python/commandes.mjs +9 -2
  16. package/scripts/langages/python/index.mjs +3 -2
  17. package/scripts/langages/typescript/consommateurs.mjs +3 -41
  18. package/scripts/langages/typescript/interfaces-contre-code.mjs +2 -1
  19. package/scripts/langages/typescript/lecteurs.mjs +2 -8
  20. package/scripts/langages/typescript/parcours.mjs +49 -0
  21. package/scripts/langages/typescript/references-par-les-types.mjs +2 -1
  22. package/scripts/langages/typescript/tests-de-nuit.mjs +10 -0
  23. package/scripts/langages/typescript/turbo-des-paquets.mjs +2 -1
  24. package/scripts/langages/typescript/vitest-config/lances.mjs +6 -15
  25. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +4 -1
  26. package/scripts/mesure/base-de-passe.mjs +202 -9
  27. package/scripts/services-du-noyau.mjs +9 -2
  28. package/scripts/sous-commandes.mjs +1 -0
  29. package/scripts/tableau.mjs +203 -77
  30. package/scripts/verrou-de-machine.mjs +147 -4
  31. package/skills/pitmaster/SKILL.md +6 -0
  32. package/skills/pitmaster/references/consigne-agent.md +4 -0
  33. package/types/index.d.ts +6 -14
@@ -43,7 +43,7 @@
43
43
  # the work in progress of the copy in the copy, never in git's stash, which every copy of the
44
44
  # repository shares: it is set aside as a lot, the copy fast-forwards, and the lot is applied
45
45
  # three ways, as the lot of a branch sent back is (scripts/enveloppe/travail-de-la-copie.mjs).
46
- # A refusal, such as commits of the agent on its branch or conflicts left unresolved, goes to
46
+ # A refusal, such as a branch that has left main or conflicts left unresolved, goes to
47
47
  # the log and stops the launch, CODE_COPIE; so does a reapplication that conflicts: the log
48
48
  # names the copy and each file in conflict, the conflicts stay marked in the copy's files and
49
49
  # unmerged in its index, and no agent starts on a half-merged copy. Its
@@ -80,7 +80,10 @@
80
80
  # --publie <plan>`, a command of the module of the copy's language, read in the prepared copy; a reading that fails stops the launch,
81
81
  # CODE_COPIE), then the
82
82
  # section « Ton dossier de travail », which names the session's working directory, where every
83
- # temporary file goes (`dossierDeTravail` of enveloppe.mjs, the envelope's TMPDIR), then the
83
+ # temporary file goes (`dossierDeTravail` of enveloppe.mjs, the envelope's TMPDIR, TMP and TEMP,
84
+ # in the temporary directory of the ticket, which the launcher opens once the call is judged and
85
+ # which stays from one session and one resumption to the next, removed when the ticket is
86
+ # closed, scripts/mesure/base-de-passe.mjs), then the
84
87
  # section « La construction échoue » when it fails. The prompt
85
88
  # carries « TON TICKET : <ticket> », which the role's locks read. The envelope is the sandbox, so
86
89
  # the session runs without permission prompts, under the rights and the context of its role
@@ -184,6 +187,13 @@ if node --input-type=module -e "import { lireEntrees } from '$ici/../integration
184
187
  echo "$refus" >&2
185
188
  exit "$CODE_COPIE"
186
189
  fi
190
+ # The temporary directory of the ticket (`ouvrirBaseDuTicket`, scripts/mesure/base-de-passe.mjs):
191
+ # TMPDIR, TMP and TEMP of the rest of the launch and of the session, whose scratchpads and working
192
+ # directory lie in it. It stays from one session and one resumption of the ticket to the next, and
193
+ # goes when the ticket is closed (scripts/copies-finies.mjs).
194
+ temporaire=$(node "$ici/../mesure/base-de-passe.mjs" "$ticket" 2>> "$journal") \
195
+ || { echo "⛔ Le dossier temporaire du ticket n'a pas pu s'ouvrir : voir $journal." >&2; exit "$CODE_COPIE"; }
196
+ export TMPDIR="$temporaire" TMP="$temporaire" TEMP="$temporaire"
187
197
  # The output of the session's build, when it fails, behind its first line, which says what failed
188
198
  # and what was built: the module's command `construire` writes it.
189
199
  echec=$(mktemp)
@@ -23,11 +23,13 @@
23
23
  // - A copy whose lot still waits in its git directory (git refused it whole, as a deletion of
24
24
  // a file main changed) is not touched: the output names the file and how to take it back;
25
25
  // exit 1. So no relaunch loses it.
26
- // - A copy still in conflict (unmerged entries in its index) or whose branch carries commits
27
- // main has not (no fast-forward) is not touched; the output says why; exit 1. A fast-forward
28
- // that fails after the work is set aside (an untracked file in the way) gives the work back
29
- // on HEAD; exit 1.
30
- // - A copy at <cible> already, or without local work, simply fast-forwards; exit 0.
26
+ // - A copy still in conflict (unmerged entries in its index) or whose branch has left main
27
+ // (commits on both sides, no fast-forward) is not touched; the output says why; exit 1. A
28
+ // fast-forward that fails after the work is set aside (an untracked file in the way) gives
29
+ // the work back on HEAD; exit 1.
30
+ // - A copy at <cible> already, or ahead of it (<cible> an ancestor of its HEAD, as a branch
31
+ // whose commits main has not entered yet), is not touched, as `git merge --ff-only` answers
32
+ // « Already up to date »; a copy without local work simply fast-forwards; exit 0.
31
33
  // - Both: a generated file the project declares (`grillhouse.engendres`, scripts/engendres.mjs,
32
34
  // read from the main tree) is not merged, as npm writes package-lock.json again after a merge:
33
35
  // when the lot touches one of its files, or one it reads (the copy's untracked files counting),
@@ -178,7 +180,12 @@ export function avancer(copie, cible) {
178
180
  if (vise.status !== 0) {
179
181
  return { ok: false, message: `⛔ ${cible} ne nomme aucun commit : ${texte(vise)}` };
180
182
  }
181
- if (tete === String(vise.stdout).trim()) {
183
+ // At <cible>, or ahead of it (<cible> an ancestor of HEAD): nothing to move, as git's
184
+ // `merge --ff-only` answers « Already up to date ».
185
+ if (
186
+ tete === String(vise.stdout).trim() ||
187
+ git(copie, ['merge-base', '--is-ancestor', cible, 'HEAD']).status === 0
188
+ ) {
182
189
  return { ok: true, message: '' };
183
190
  }
184
191
  if (git(copie, ['merge-base', '--is-ancestor', 'HEAD', cible]).status !== 0) {
@@ -323,6 +323,18 @@ export function ecrireLaMesure(o: {
323
323
  }): void;
324
324
  /** Opens the base of a pass of the kind `genre` (scripts/mesure/base-de-passe.mjs). */
325
325
  export function ouvrirBase(genre: string, o?: { dans?: string }): unknown;
326
+ /** Whether `chemin` lies in a temporary directory under `env` (scripts/mesure/base-de-passe.mjs). */
327
+ export function dansLeTemporaire(chemin: string, env?: NodeJS.ProcessEnv): boolean;
328
+ /** The cache of compilation of `outil`, under `~/.cache/grillhouse/`, never in the temporary
329
+ * directory. */
330
+ export function cacheDeCompilation(outil: string, env?: NodeJS.ProcessEnv): string;
331
+ /** The cache of `outil` for the build rooted at `racine`, swept once `racine` is gone. */
332
+ export function cacheDeLaRacine(
333
+ outil: string,
334
+ racine: string,
335
+ env?: NodeJS.ProcessEnv,
336
+ o?: { creer?: boolean }
337
+ ): string;
326
338
  /** The line of the guard of a pass of tests, what its tests left in their temporary directory
327
339
  * named; null when they left nothing. */
328
340
  export function ligneDesRestes(restes: string[]): string | null;
@@ -354,6 +366,8 @@ export function mesure(racine: string, o?: { tout?: boolean; dans?: string }): u
354
366
  export class AttenteDeLaMachine extends Error {}
355
367
  /** Runs `faire` under the lock of the machine. */
356
368
  export function avecLaMachine(...args: unknown[]): unknown;
369
+ /** Waits for room in the temporary directory, as a heavy pass does before it plays. */
370
+ export function attendreDeLaPlace(o?: Record<string, unknown>): void;
357
371
  /** The source files of the project at `racine` under `dossier`, as paths from `racine`, what the
358
372
  * tools of its language write left out (scripts/sources.mjs). */
359
373
  export function sources(racine: string, dossier?: string): string[];
@@ -46,6 +46,7 @@ import { existsSync, readdirSync, statSync } from 'node:fs';
46
46
  import { createRequire } from 'node:module';
47
47
  import path from 'node:path';
48
48
  import { isDeepStrictEqual } from 'node:util';
49
+ import { cibleDeCompilation } from './sccache.mjs';
49
50
 
50
51
  // The loader of the optional peers this module reads when it needs them (smol-toml), under the
51
52
  // name by which knip reads a dependency.
@@ -63,8 +64,11 @@ export function metadonnees(racine) {
63
64
  if (!existsSync(path.join(racine, 'Cargo.toml'))) {
64
65
  return null;
65
66
  }
67
+ // The target directory cargo reports is the one the compilations use (./sccache.mjs), named
68
+ // without being made: a reading writes nothing in the home.
66
69
  const r = spawnSync('cargo', ['metadata', '--format-version', '1', '--no-deps', '--offline'], {
67
70
  cwd: racine,
71
+ env: { ...process.env, ...cibleDeCompilation(racine, process.env, { creer: false }) },
68
72
  encoding: 'utf8',
69
73
  maxBuffer: 256 * 1024 * 1024,
70
74
  });
@@ -48,7 +48,7 @@ import { elementsDuLot } from './elements-du-lot.mjs';
48
48
  import { enRetard, entreesDeLIndex, SORTIE } from './index-interfaces.mjs';
49
49
  import { miseAJour } from './mise-a-jour.mjs';
50
50
  import { squelette } from './squelette.mjs';
51
- import { CACHE } from './sccache.mjs';
51
+ import { CACHE, CIBLES } from './sccache.mjs';
52
52
  import { touches } from './touches.mjs';
53
53
  import { verdict } from './verdict.mjs';
54
54
 
@@ -70,7 +70,8 @@ export default {
70
70
  // registry's index and sources, the git dependencies, cargo-deny's advisories, and the files of
71
71
  // its locks and of the SQLite cache of its packages (`.package-cache`, `.package-cache-mutate`,
72
72
  // `.global-cache`), files without a trailing `/`; the cache of sccache, common to the copies
73
- // (./sccache.mjs), where a server of sccache the session starts writes. What it reads, read-only: its home, `~/.cargo`
73
+ // (./sccache.mjs), where a server of sccache the session starts writes; the targets of the
74
+ // workspaces rooted in the temporary directory, `~/.cache/grillhouse/cargo/` (./sccache.mjs). What it reads, read-only: its home, `~/.cargo`
74
75
  // (its binaries, its `env`, which the shells source, and its configuration stay unwritten), and
75
76
  // rustup's toolchains, `~/.rustup`. Measured on 2026-10-30: `cargo fetch --locked` of
76
77
  // osc-bridge in bwrap with these mounts alone, green, the cache of its packages written.
@@ -84,6 +85,7 @@ export default {
84
85
  '~/.cargo/.package-cache-mutate',
85
86
  '~/.cargo/.global-cache',
86
87
  CACHE,
88
+ CIBLES,
87
89
  ],
88
90
  propres: [],
89
91
  lues: ['~/.cargo/', '~/.rustup/'],
@@ -2,8 +2,14 @@
2
2
  // (`RUSTC_WRAPPER=sccache`) that Firefox and the CI of Rust use, which the update installs
3
3
  // (./binaires.json). Each copy keeps its own target directory, so that two compilations never wait
4
4
  // on the lock cargo takes on a target directory; sccache shares their compilations, its cache one
5
- // directory of the home (`SCCACHE_DIR`, ~/.cache/sccache, sccache's default on Linux, named so
6
- // that the envelope opens the same, ./index.mjs `sorties`), common to every copy of the machine.
5
+ // directory of the home (`SCCACHE_DIR`, ~/.cache/grillhouse/sccache, the frame's caches of
6
+ // compilation, `cacheDeCompilation` of scripts/mesure/base-de-passe.mjs, named so that the envelope
7
+ // opens the same, ./index.mjs `sorties`), common to every copy of the machine.
8
+ // - A workspace rooted in the temporary directory (a project of trial) builds out of it: its
9
+ // target directory is `CARGO_TARGET_DIR`, a cache of the root under ~/.cache/grillhouse/cargo/
10
+ // (`cacheDeLaRacine`), swept once the root is gone, as Bazel keeps its output_base under
11
+ // ~/.cache and never on a disk in memory; a `CARGO_TARGET_DIR` already set stays
12
+ // (`cibleDeCompilation`).
7
13
  // Every command of the module that compiles (tests, verification, typing, clippy) runs cargo
8
14
  // under this environment, in a copy as in an agent's envelope.
9
15
  //
@@ -37,12 +43,17 @@ import { accessSync, constants, readFileSync, readlinkSync, realpathSync } from
37
43
  import { createRequire } from 'node:module';
38
44
  import { homedir } from 'node:os';
39
45
  import path from 'node:path';
46
+ import { cacheDeCompilation, cacheDeLaRacine, dansLeTemporaire } from '../../services-du-noyau.mjs';
40
47
 
41
48
  // The loader of smol-toml, an optional peer of the package, a tool of this module.
42
49
  const require = createRequire(import.meta.url);
43
50
 
44
51
  /** The cache of sccache, from the home: what the envelope opens in writing. */
45
- export const CACHE = '~/.cache/sccache/';
52
+ export const CACHE = '~/.cache/grillhouse/sccache/';
53
+
54
+ /** The targets of the workspaces rooted in the temporary directory, from the home: what the
55
+ * envelope opens in writing (`cibleDeCompilation`). */
56
+ export const CIBLES = '~/.cache/grillhouse/cargo/';
46
57
 
47
58
  // The machine's temporary directory, short whatever the copy: the one the server of sccache starts
48
59
  // under (`demarrerLeServeur`), an empty one proper to the session in an envelope.
@@ -152,21 +163,41 @@ export function demarrerLeServeur(racine, env) {
152
163
  });
153
164
  }
154
165
 
166
+ /**
167
+ * The target directory of the workspace at <racine> under <env>, out of the temporary directory:
168
+ * `{ CARGO_TARGET_DIR }`, a cache of the root (`cacheDeLaRacine`), for a root in the temporary
169
+ * directory; nothing otherwise, or when <env> sets one already. With `creer` false, a reading
170
+ * (`cargo metadata`): the path alone, nothing written.
171
+ * @param {string} racine
172
+ * @param {NodeJS.ProcessEnv} env
173
+ * @param {{ creer?: boolean }} [options]
174
+ * @returns {{ CARGO_TARGET_DIR?: string }}
175
+ */
176
+ export function cibleDeCompilation(racine, env, { creer = true } = {}) {
177
+ if (env.CARGO_TARGET_DIR || !dansLeTemporaire(racine, env)) {
178
+ return {};
179
+ }
180
+ return { CARGO_TARGET_DIR: cacheDeLaRacine('cargo', racine, env, { creer }) };
181
+ }
182
+
155
183
  /**
156
184
  * <env> with rustc wrapped by sccache for the copy at <racine>, its cache the home's, its server
157
- * the copy's; <env> as it is when the project sets its own wrapper.
185
+ * the copy's, its target out of the temporary directory (`cibleDeCompilation`); without sccache
186
+ * when the project sets its own wrapper.
158
187
  * @param {string} racine
159
188
  * @param {NodeJS.ProcessEnv} env
160
189
  * @returns {NodeJS.ProcessEnv}
161
190
  */
162
191
  export function avecSccache(racine, env) {
192
+ const cible = cibleDeCompilation(racine, env);
163
193
  if (lanceurDuProjet(racine, env)) {
164
- return env;
194
+ return { ...env, ...cible };
165
195
  }
166
196
  return {
167
197
  ...env,
198
+ ...cible,
168
199
  RUSTC_WRAPPER: 'sccache',
169
- SCCACHE_DIR: path.join(env.HOME || homedir(), '.cache', 'sccache'),
200
+ SCCACHE_DIR: cacheDeCompilation('sccache', env),
170
201
  SCCACHE_SERVER_UDS: socketDuServeur(racine),
171
202
  };
172
203
  }
@@ -43,7 +43,8 @@
43
43
  // environment of each package under `.venv/<dossier>` at the root (UV_PROJECT_ENVIRONMENT), and
44
44
  // pytest its cache under `.pytest_cache/<dossier>` (`cache_dir`), where the envelope opens them
45
45
  // in writing, rather than in the package's folder, which a session whose plan does not write the
46
- // package could not write.
46
+ // package could not write; uv its cache under ~/.cache/grillhouse/uv (UV_CACHE_DIR), the frame's
47
+ // caches of compilation, never in the temporary directory.
47
48
  // - While the environment names a results directory (`GRILLHOUSE_RESULTATS`), the run writes
48
49
  // there what ./verdict.mjs reads: its tasks, each planned before it plays, and the JUnit report
49
50
  // of each run of pytest.
@@ -59,6 +60,7 @@ import { RESULTATS } from '../../resultats.mjs';
59
60
  import {
60
61
  AttenteDeLaMachine,
61
62
  avecLaMachine,
63
+ cacheDeCompilation,
62
64
  CHANGEMENTS,
63
65
  DEPUIS_LE_VERT,
64
66
  garderLeVert,
@@ -113,7 +115,12 @@ function passe(racine, env) {
113
115
  const id = `${Date.now()}-${process.pid}`;
114
116
  const taches = [];
115
117
  const rapports = {};
116
- const environnement = { ...env, PYTHONPYCACHEPREFIX: path.join(racine, PYCACHE) };
118
+ // uv keeps its cache with the frame's caches of compilation, out of the temporary directory.
119
+ const environnement = {
120
+ ...env,
121
+ PYTHONPYCACHEPREFIX: path.join(racine, PYCACHE),
122
+ UV_CACHE_DIR: cacheDeCompilation('uv', env),
123
+ };
117
124
  const ecrire = () => {
118
125
  if (!dossier) {
119
126
  return;
@@ -11,7 +11,8 @@
11
11
  // `.pytest_cache`, `__pycache__` (`ignorer`).
12
12
  // - Where they write, which the envelope opens to a session (`sorties`): in writing, `.venv` and
13
13
  // `.pytest_cache` at the root, where the commands make uv and pytest write for each package
14
- // (./commandes.mjs), and uv's cache, `~/.cache/uv`; proper to the session, the
14
+ // (./commandes.mjs), and uv's cache, `~/.cache/grillhouse/uv` (UV_CACHE_DIR, ./commandes.mjs: the
15
+ // frame's caches of compilation, never in the temporary directory); proper to the session, the
15
16
  // tree of the bytecode at the root, `__pycache__` (PYTHONPYCACHEPREFIX, ./commandes.mjs); read,
16
17
  // the Pythons uv installs, `~/.local/share/uv/python`. The version of Python is uv's choice, from
17
18
  // `requires-python` and `.python-version`. The rules that refuse a role that writes pytest run
@@ -56,7 +57,7 @@ export default {
56
57
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
57
58
  ignorer: ['.venv', '.pytest_cache', PYCACHE],
58
59
  sorties: {
59
- ecrites: ['.venv/', '.pytest_cache/', '~/.cache/uv/'],
60
+ ecrites: ['.venv/', '.pytest_cache/', '~/.cache/grillhouse/uv/'],
60
61
  propres: [PYCACHE],
61
62
  lues: ['~/.local/share/uv/python/'],
62
63
  },
@@ -35,7 +35,7 @@
35
35
  // writes its configuration). For the check of the uses, test files (under a folder `test/`,
36
36
  // `tests/` or `__tests__/`, or named `*.test.*`, `*.spec.*`) count only for their imports of a
37
37
  // package of the material; `dist/`, `docs/` and `node_modules/` are never read, nor are Vite's
38
- // temporary files, and a file gone between the walk and its read is passed over (`parcourir`).
38
+ // temporary files, and a file gone between the walk and its read is passed over (`parcourir`, ./parcours.mjs).
39
39
  // The identity of a component is its name: two directories of the same name, one under `packages/`
40
40
  // and one under `src/`, are refused, both paths named (the way npm workspaces, Nx and Cargo refuse
41
41
  // two projects of one name). Names differing by case are two names.
@@ -43,12 +43,13 @@
43
43
  // A project's guard imports `matieres` by the package's entry
44
44
  // `@roomi-fields/grillhouse/consommateurs`, its types in ./consommateurs.d.ts (docs/ARCHITECTURE.md,
45
45
  // the package's named entries).
46
- import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
46
+ import { existsSync, readFileSync } from 'node:fs';
47
47
  import path from 'node:path';
48
48
  import { pathToFileURL } from 'node:url';
49
49
  import { trancher } from '../../dette.mjs';
50
50
  import { horsCadre } from '../../paquets.mjs';
51
51
  import { composants, dossiers, matieres } from './composants.mjs';
52
+ import { lireSiPresent, parcourir } from './parcours.mjs';
52
53
 
53
54
  // The components and the packages of the shared material, read by ./composants.mjs; the entry
54
55
  // publishes `matieres` from here.
@@ -161,45 +162,6 @@ export function imports(source) {
161
162
  return out;
162
163
  }
163
164
 
164
- // The temporary file Vite writes beside a configuration it bundles, then removes
165
- // (`vitest.config.ts.timestamp-<n>-<hash>.mjs`).
166
- const TEMPORAIRE_DE_VITE = /\.timestamp-[^/\\]*\.mjs$/;
167
-
168
- // <f> read by <lire>, or <absent> when it no longer exists (ENOENT).
169
- function siPresent(lire, f, absent) {
170
- try {
171
- return lire(f);
172
- } catch (e) {
173
- if (e?.code === 'ENOENT') return absent;
174
- throw e;
175
- }
176
- }
177
-
178
- // The files under <chemin> (a directory, or a file), each its absolute path: an entry below it
179
- // whose path <sauter> keeps out is neither entered nor listed, and Vite's temporary files are
180
- // never listed. The guards of the frame walk the repository while other processes write in it
181
- // (`npm run verifier` plays them beside the tests): a file or a directory gone before the walk
182
- // reaches it is passed over. The walk of every guard of the frame.
183
- export function parcourir(chemin, sauter = () => false) {
184
- const out = [];
185
- const walk = (p, dossier) => {
186
- if (!dossier) {
187
- if (!TEMPORAIRE_DE_VITE.test(p)) out.push(p);
188
- return;
189
- }
190
- for (const e of siPresent(d => readdirSync(d, { withFileTypes: true }), p, [])) {
191
- const q = path.join(p, e.name);
192
- if (!sauter(q)) walk(q, e.isDirectory());
193
- }
194
- };
195
- const racine = siPresent(statSync, chemin, null);
196
- if (racine) walk(chemin, racine.isDirectory());
197
- return out;
198
- }
199
-
200
- // The text of the file <f> a walk listed, or null when it is gone since.
201
- export const lireSiPresent = f => siPresent(x => readFileSync(x, 'utf8'), f, null);
202
-
203
165
  // The source files under <dir>: [{ f, test }], `test` for a file under a test folder or of a test
204
166
  // name.
205
167
  function fichiers(dir) {
@@ -57,7 +57,8 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'no
57
57
  import { tmpdir } from 'node:os';
58
58
  import path from 'node:path';
59
59
  import { pathToFileURL } from 'node:url';
60
- import { composants, lireSiPresent, parcourir } from './consommateurs.mjs';
60
+ import { composants } from './consommateurs.mjs';
61
+ import { lireSiPresent, parcourir } from './parcours.mjs';
61
62
  import { paquetsDeLEnveloppe } from '../../services-du-noyau.mjs';
62
63
  import { trancher } from '../../dette.mjs';
63
64
 
@@ -19,14 +19,8 @@
19
19
  // what its tests read (`parLesTests`): the components its tests import.
20
20
  import { existsSync, readFileSync } from 'node:fs';
21
21
  import path from 'node:path';
22
- import {
23
- declares,
24
- imports,
25
- lireSiPresent,
26
- NOM_DE_TEST,
27
- parcourir,
28
- utilise,
29
- } from './consommateurs.mjs';
22
+ import { declares, imports, NOM_DE_TEST, utilise } from './consommateurs.mjs';
23
+ import { lireSiPresent, parcourir } from './parcours.mjs';
30
24
  import { lire } from './index-interfaces.mjs';
31
25
  import { elementsEcrits, parLesTypes } from './references-par-les-types.mjs';
32
26
 
@@ -0,0 +1,49 @@
1
+ // The walk of the repository every guard of the module typescript makes: the files under a path,
2
+ // Vite's temporary files never listed, a file or a directory gone before the walk reaches it
3
+ // passed over. The guards walk the repository while other processes write in it (`npm run
4
+ // verifier` plays them beside the tests). Node alone (./vitest-config/lances.mjs, which the
5
+ // configuration of Vitest loads, imports it).
6
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
7
+ import path from 'node:path';
8
+
9
+ // The temporary file Vite writes beside a configuration it bundles, then removes
10
+ // (`vitest.config.ts.timestamp-<n>-<hash>.mjs`).
11
+ const TEMPORAIRE_DE_VITE = /\.timestamp-[^/\\]*\.mjs$/;
12
+
13
+ // <f> read by <lire>, or <absent> when it no longer exists (ENOENT).
14
+ function siPresent(lire, f, absent) {
15
+ try {
16
+ return lire(f);
17
+ } catch (e) {
18
+ if (e?.code === 'ENOENT') return absent;
19
+ throw e;
20
+ }
21
+ }
22
+
23
+ /**
24
+ * The files under <chemin> (a directory, or a file), each its absolute path: an entry below it
25
+ * whose path <sauter> keeps out is neither entered nor listed, and Vite's temporary files are
26
+ * never listed.
27
+ * @param {string} chemin
28
+ * @param {(p: string) => boolean} [sauter]
29
+ * @returns {string[]}
30
+ */
31
+ export function parcourir(chemin, sauter = () => false) {
32
+ const out = [];
33
+ const walk = (p, dossier) => {
34
+ if (!dossier) {
35
+ if (!TEMPORAIRE_DE_VITE.test(p)) out.push(p);
36
+ return;
37
+ }
38
+ for (const e of siPresent(d => readdirSync(d, { withFileTypes: true }), p, [])) {
39
+ const q = path.join(p, e.name);
40
+ if (!sauter(q)) walk(q, e.isDirectory());
41
+ }
42
+ };
43
+ const racine = siPresent(statSync, chemin, null);
44
+ if (racine) walk(chemin, racine.isDirectory());
45
+ return out;
46
+ }
47
+
48
+ /** The text of the file <f> a walk listed, or null when it is gone since. */
49
+ export const lireSiPresent = f => siPresent(x => readFileSync(x, 'utf8'), f, null);
@@ -26,7 +26,8 @@
26
26
  import { existsSync } from 'node:fs';
27
27
  import { createRequire } from 'node:module';
28
28
  import path from 'node:path';
29
- import { lireSiPresent, NOM_DE_TEST } from './consommateurs.mjs';
29
+ import { NOM_DE_TEST } from './consommateurs.mjs';
30
+ import { lireSiPresent } from './parcours.mjs';
30
31
  import { sorties } from './frontieres.mjs';
31
32
 
32
33
  const requis = createRequire(import.meta.url);
@@ -13,10 +13,13 @@
13
13
  // the copy, a bench or a night test alone as well: `npx --no-install vitest run --root <copie>
14
14
  // --config <configuration>`. Its exit code is this command's: 75, « à repasser », when every
15
15
  // failure depended on a duration, one under load (./vitest-config/duree.reporter.mjs).
16
+ // - They play once the temporary directory has room, as every heavy pass
17
+ // (`attendreDeLaPlace` of scripts/verrou-de-machine.mjs): a wait that reaches its bound ends at 75.
16
18
  import { spawnSync } from 'node:child_process';
17
19
  import { readdirSync } from 'node:fs';
18
20
  import path from 'node:path';
19
21
  import { fileURLToPath, pathToFileURL } from 'node:url';
22
+ import { attendreDeLaPlace } from '../../services-du-noyau.mjs';
20
23
 
21
24
  const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.mjs', import.meta.url));
22
25
  const HORS = new Set(['node_modules', 'dist', '.git']);
@@ -44,6 +47,13 @@ export function testsDeNuit(racine) {
44
47
  if (!enTient(racine)) {
45
48
  return 0;
46
49
  }
50
+ try {
51
+ attendreDeLaPlace();
52
+ } catch (e) {
53
+ if (e?.name !== 'AttenteDeLaMachine') throw e;
54
+ process.stdout.write(`${e.message}\n`);
55
+ return e.code;
56
+ }
47
57
  const r = spawnSync(
48
58
  'npx',
49
59
  ['--no-install', 'vitest', 'run', '--root', racine, '--config', CONFIGURATION],
@@ -163,7 +163,8 @@ import path from 'node:path';
163
163
  import { pathToFileURL } from 'node:url';
164
164
  import { applyEdits, modify, parse } from 'jsonc-parser';
165
165
  import { AVANCEMENT, CHANGEMENTS, inscrireLePlan } from '../../services-du-noyau.mjs';
166
- import { matieres, parcourir } from './consommateurs.mjs';
166
+ import { matieres } from './consommateurs.mjs';
167
+ import { parcourir } from './parcours.mjs';
167
168
  import { paquets, TYPAGE } from '../../paquets.mjs';
168
169
  import { ecrireSarif, RESULTATS } from '../../resultats.mjs';
169
170
  import { SCRIPT_DES_TESTS as TESTS } from './script-des-tests.mjs';
@@ -47,11 +47,12 @@
47
47
  // takes from this module what a test file is, its material, its imports and their resolution.
48
48
  //
49
49
  // This module's top level uses Node alone (./changements.mjs imports it).
50
- import { existsSync, globSync, readdirSync, readFileSync, realpathSync, statSync } from 'node:fs';
50
+ import { existsSync, globSync, readFileSync, realpathSync, statSync } from 'node:fs';
51
51
  import { createRequire } from 'node:module';
52
52
  import path from 'node:path';
53
53
  import { matieres } from '../composants.mjs';
54
54
  import { paquets } from '../../../paquets.mjs';
55
+ import { parcourir } from '../parcours.mjs';
55
56
 
56
57
  /** A test file, as Vitest's default `include` names one. */
57
58
  export const TEST = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
@@ -121,20 +122,10 @@ const estDossier = f => {
121
122
  }
122
123
  };
123
124
 
124
- // The files under the directory <dir>, absolute, SAUTES left out.
125
- function fichiersSous(dir) {
126
- let entrees;
127
- try {
128
- entrees = readdirSync(dir, { withFileTypes: true });
129
- } catch {
130
- return [];
131
- }
132
- return entrees.flatMap(e => {
133
- if (SAUTES.has(e.name)) return [];
134
- const f = path.join(dir, e.name);
135
- return e.isDirectory() ? fichiersSous(f) : e.isFile() ? [f] : [];
136
- });
137
- }
125
+ // The files under the directory <dir>, absolute, SAUTES left out: the walk of the guards
126
+ // (../parcours.mjs), which never lists Vite's temporary files (the night of 2026-11-01,
127
+ // grillhouse-rm7: one, beside a configuration of another package, counted as a module).
128
+ const fichiersSous = dir => parcourir(dir, f => SAUTES.has(path.basename(f)));
138
129
 
139
130
  // The specifiers <texte> imports.
140
131
  const specifiers = texte =>
@@ -3,7 +3,9 @@
3
3
  // directory named after its process and a token, scripts/verrou-de-machine.mjs), which every
4
4
  // process it starts inherits: a `npm run verifier` or a circuit that a test plays in a repository
5
5
  // of trial neither waits for the lock of the machine nor holds it, and no test writes in the
6
- // user's cache. A lock already named in the environment stays.
6
+ // user's cache. A lock already named in the environment stays. Its heavy passes want no room in
7
+ // the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0): the room of the machine is the pass's
8
+ // that plays the file, which waited for it.
7
9
  import { randomUUID } from 'node:crypto';
8
10
  import { tmpdir } from 'node:os';
9
11
  import path from 'node:path';
@@ -12,3 +14,4 @@ process.env.GRILLHOUSE_VERROU_MACHINE ||= path.join(
12
14
  tmpdir(),
13
15
  `grillhouse-mesure-${process.pid}-${randomUUID()}.lock`
14
16
  );
17
+ process.env.GRILLHOUSE_TEMPORAIRE_LIBRE ||= '0';