@roomi-fields/grillhouse 0.25.4 → 0.26.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 (48) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/testwriter.md +1 -1
  3. package/bin/grillhouse.mjs +20 -3
  4. package/cadre/templates/cargo/package.json +3 -0
  5. package/cadre/templates/projet/.gitattributes +1 -0
  6. package/cadre/templates/projet/CLAUDE.md +6 -0
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/charte.md +10 -1
  9. package/docs/ARCHITECTURE.md +107 -19
  10. package/docs/INTERFACE.md +19 -5
  11. package/hooks/register.tsx +57 -16
  12. package/package.json +9 -3
  13. package/scripts/circuit.mjs +244 -66
  14. package/scripts/copies-finies.mjs +345 -0
  15. package/scripts/crochets.mjs +9 -3
  16. package/scripts/enveloppe/enveloppe.mjs +59 -17
  17. package/scripts/enveloppe/lancer.sh +15 -22
  18. package/scripts/enveloppe/travail-de-la-copie.mjs +188 -0
  19. package/scripts/etapes.mjs +1 -1
  20. package/scripts/fusion-du-changelog.mjs +120 -0
  21. package/scripts/grillhouse-maj.mjs +19 -0
  22. package/scripts/integration/file.mjs +196 -104
  23. package/scripts/jointure.d.ts +26 -1
  24. package/scripts/langages/cargo/binaires.json +2 -1
  25. package/scripts/langages/cargo/clippy.mjs +10 -2
  26. package/scripts/langages/cargo/commandes.mjs +77 -22
  27. package/scripts/langages/cargo/composants.mjs +236 -9
  28. package/scripts/langages/cargo/index.mjs +17 -8
  29. package/scripts/langages/cargo/sccache.mjs +143 -0
  30. package/scripts/langages/cargo/verdict.mjs +52 -11
  31. package/scripts/langages/typescript/consommateurs.mjs +10 -2
  32. package/scripts/langages/typescript/index.mjs +4 -2
  33. package/scripts/langages/typescript/lecteurs.mjs +13 -4
  34. package/scripts/langages/typescript/references-par-les-types.mjs +5 -1
  35. package/scripts/langages/typescript/regle-des-tests.mjs +37 -0
  36. package/scripts/nuit.sh +25 -0
  37. package/scripts/outils-cles.mjs +188 -0
  38. package/scripts/resultats.mjs +26 -7
  39. package/scripts/retirer-copie.sh +2 -1
  40. package/scripts/sous-commandes.mjs +16 -0
  41. package/scripts/verrou-de-machine.mjs +14 -13
  42. package/scripts/verrous/verrou.mjs +50 -14
  43. package/skills/developpeur/SKILL.md +14 -2
  44. package/skills/explorateur/SKILL.md +3 -1
  45. package/skills/pitmaster/SKILL.md +10 -3
  46. package/skills/pitmaster/references/consigne-agent.md +11 -10
  47. package/skills/relecteur/SKILL.md +13 -2
  48. package/skills/testwriter/SKILL.md +23 -6
@@ -15,7 +15,8 @@
15
15
  // imports the provider (the test file's path).
16
16
  // - By the types (scripts/langages/typescript/references-par-les-types.mjs): each element the text writes, resolved by
17
17
  // TypeScript's language service over the components' `tsconfig.json`.
18
- // - What each component reads (`lit`): its imports, and the providers of the elements it reads.
18
+ // - What each component reads (`lit`): its imports, and the providers of the elements it reads;
19
+ // what its tests read (`parLesTests`): the components its tests import.
19
20
  import { existsSync, readFileSync } from 'node:fs';
20
21
  import path from 'node:path';
21
22
  import {
@@ -97,12 +98,13 @@ function importe(texte, fichier, p) {
97
98
  // components <composants> of <racine> (`composants` of the module), the components the text
98
99
  // names <nommes>: `{ elements: [{ nom, fournisseur, lecteurs: [{ composant, par }] }],
99
100
  // sansFournisseur, types: { etat, raison, elements: [{ nom, declarations: [{ composant, publie }],
100
- // lecteurs: Map composant → Set of « par » }] }, lit: Map composant → Set of composants }`, each
101
- // component one of <composants>.
101
+ // lecteurs: Map composant → Set of « par » }] }, lit: Map composant → Set of composants,
102
+ // parLesTests: Map composant → Set of composants }`, each component one of <composants>.
102
103
  export function lecteurs(racine, { composants, noms, texte, nommes }) {
103
104
  const tous = composants.map(c => ({ nom: c.nom, dir: c.dossier, paquet: c.paquet, c }));
104
105
  const exterieur = i => i.c;
105
- const reel = utilise(racine, tous);
106
+ const testsLisent = new Map();
107
+ const reel = utilise(racine, tous, testsLisent);
106
108
  const ifaces = interfacesDe(racine, tous);
107
109
  const tests = new Map();
108
110
  const testsDuComposant = c => {
@@ -157,6 +159,12 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
157
159
  }
158
160
  }
159
161
  for (const e of elements) for (const l of e.lecteurs) lit.get(l.composant).add(e.fournisseur);
162
+ const parLesTests = new Map(composants.map(c => [c, new Set()]));
163
+ for (const [c, lus] of testsLisent) {
164
+ for (const p of lus) {
165
+ parLesTests.get(c.c).add(p.c);
166
+ }
167
+ }
160
168
  return {
161
169
  elements,
162
170
  sansFournisseur: sansFournisseur.filter(
@@ -175,5 +183,6 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
175
183
  })),
176
184
  },
177
185
  lit,
186
+ parLesTests,
178
187
  };
179
188
  }
@@ -261,8 +261,12 @@ export function leService(racine, tous) {
261
261
  // components the ticket names (<contexte>: `{ fichiers, composants }`, Sets of file names and of
262
262
  // components), when it has some: `{ etat: 'fait', raison: null, elements: [{ nom, ecrit,
263
263
  // declarations: [{ c, publie }], lecteurs: Map component → Set of « par » }] }`, or
264
- // `{ etat: 'impossible', raison, elements: [] }` when it cannot run.
264
+ // `{ etat: 'impossible', raison, elements: [] }` when it cannot run. Without any element, the
265
+ // survey is done at once: no language service is built.
265
266
  export function parLesTypes(racine, tous, ecrits, contexte = {}) {
267
+ if (ecrits.length === 0) {
268
+ return { etat: 'fait', raison: null, elements: [] };
269
+ }
266
270
  try {
267
271
  return releveParLesTypes(racine, tous, ecrits, contexte);
268
272
  } catch (e) {
@@ -10,7 +10,15 @@
10
10
  // whose package exports `./test-fixtures` (`matieres` of scripts/langages/typescript/consommateurs.mjs).
11
11
  //
12
12
  // Any other file is none of them: null.
13
+ //
14
+ // What the testwriter writes of the manifests (`manifestes`): the field that declares what the
15
+ // tests of a package depend on, `devDependencies` of its package.json (npm's docs,
16
+ // « devDependencies »), as the author of a test of Bazel declares the deps of its target; and
17
+ // package-lock.json at the root, which npm brings in line with it. A change of any other field is
18
+ // named by it; the root package.json is no package's.
13
19
  import path from 'node:path';
20
+ import { isDeepStrictEqual } from 'node:util';
21
+ import { dossiers } from './composants.mjs';
14
22
  import { matieres, NOM_DE_TEST } from './consommateurs.mjs';
15
23
 
16
24
  const DOSSIERS = new Set(['test', 'tests', '__tests__']);
@@ -37,3 +45,32 @@ export function estUnTest(chemin, racine) {
37
45
  const matiere = matieres(racine).some(m => isInside(abs, m.dir));
38
46
  return joue || test || matiere ? { joue, test, matiere } : null;
39
47
  }
48
+
49
+ // The field of a manifest that declares what its tests depend on.
50
+ const DES_TESTS = 'devDependencies';
51
+
52
+ // The fields of the package.json of a package at <chemin>, absolute or from <racine>, that change
53
+ // from <avant> (null: no file) to <apres> out of the field of its tests; null when <chemin> is the
54
+ // manifest of no package.
55
+ function horsDesTests(chemin, racine, avant, apres) {
56
+ const abs = path.resolve(racine, chemin);
57
+ if (!dossiers(racine).some(d => path.join(d.dir, 'package.json') === abs)) return null;
58
+ const lire = texte => {
59
+ try {
60
+ const v = texte === null ? {} : JSON.parse(texte);
61
+ return v !== null && typeof v === 'object' && !Array.isArray(v)
62
+ ? { valeur: v }
63
+ : { faute: 'le manifeste entier, qui n’est pas un objet' };
64
+ } catch (e) {
65
+ return { faute: `le manifeste entier, illisible (${e.message})` };
66
+ }
67
+ };
68
+ const [a, b] = [lire(avant), lire(apres)];
69
+ if (a.faute || b.faute) return [a.faute ?? b.faute];
70
+ return [...new Set([...Object.keys(a.valeur), ...Object.keys(b.valeur)])]
71
+ .filter(k => k !== DES_TESTS && !isDeepStrictEqual(a.valeur[k], b.valeur[k]))
72
+ .sort();
73
+ }
74
+
75
+ // What the testwriter writes of the manifests (scripts/jointure.d.ts, `manifestes`).
76
+ export const manifestes = { verrous: ['package-lock.json'], horsDesTests };
package/scripts/nuit.sh CHANGED
@@ -34,6 +34,10 @@
34
34
  # read-only, its working tree and its git repository (the list the preparation's pose printed,
35
35
  # whatever a command rewrites afterwards): a write into it fails. With a shared submodule and no possible mount (bwrap absent
36
36
  # or refused), the night turns red, the log saying so, before any command runs.
37
+ # - The tools of the project: `grillhouse.outils` in the package.json of the main tree
38
+ # (scripts/outils-cles.mjs) gives each command of the project its variables, each set to its
39
+ # path, whatever the environment of the night's launcher; a faulty key turns the night red, the
40
+ # log naming it, and nothing runs.
37
41
  # - The night tests: after the full pass, the night tests and the time budget benches, which
38
42
  # `npm test` and the integration leave out, played by the command `tests-de-nuit` of the module
39
43
  # of the copy's language (the module typescript's: the files `*.nuit.test.*`, `*.nuit.spec.*`,
@@ -63,6 +67,16 @@
63
67
  # the night ticket « La poussée de la nuit est refusée sur <commit> vers « origin/<branch> » »
64
68
  # (or comments the open one that names « origin/<branch> »), and exits 1; a remote already at
65
69
  # the commit accepts the push.
70
+ # - The copies whose content is on main: once its steps are played, whatever their verdict, the
71
+ # night passes each copy `git worktree list` names, the main tree and its own left out, through
72
+ # scripts/retirer-copie.sh without `--jetable` (scripts/copies-finies.mjs), as a CI cleans its
73
+ # workspaces at the end of a pipeline: a copy whose commits and local work have all entered
74
+ # main by their content goes, and its branch (main and a branch another copy holds stay); a copy
75
+ # refused (commits or work not entered, a lock) or held by a running circuit (its ticket in progress, its
76
+ # `<copie>.travail`, the lock of the integration or of the queue) stays, its log line naming
77
+ # why and the place it holds, a kept copy whose ticket is closed losing what the tools of its
78
+ # languages wrote there. The removal never changes the night's verdict; the end of each
79
+ # circuit runs it too (scripts/circuit.mjs).
66
80
  # - It takes no lock of the integration or of the queue (scripts/integration/file.mjs): an
67
81
  # integration and the queue run during the night, each in its own copy.
68
82
  # - Its log is <git common dir>/nuit/<date>.log. Green: HEAD becomes the last green commit
@@ -197,6 +211,14 @@ jouer() {
197
211
  esac
198
212
  done <<< "$lecture"
199
213
  [ "$faute" -eq 0 ] || return 1
214
+ # The tools of the project, one `export VARIABLE='chemin'` each (exportsDesOutils of
215
+ # outils-cles.mjs), evaluated for every command.
216
+ local outils
217
+ if ! outils=$(node "$ici/outils-cles.mjs" "$copie"); then
218
+ echo "✗ la clé grillhouse.outils est refusée : rien n'est joué."
219
+ return 1
220
+ fi
221
+ eval "$outils"
200
222
  if [ -f "$copie/package-lock.json" ] && ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"; then
201
223
  monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
202
224
  cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
@@ -265,6 +287,9 @@ fin() {
265
287
  }
266
288
  jouer >> "$journal" 2>&1
267
289
  verdict=$?
290
+ # The copies whose content is on main go once the steps are played, the night's own kept; their
291
+ # removal never changes the verdict.
292
+ (cd "$racine" && node "$ici/copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
268
293
 
269
294
  if [ "$verdict" -eq 75 ]; then
270
295
  echo "⏱ à repasser : ${tete:0:7} n'est ni vert ni rouge, la machine est restée chargée ; le dernier vert reste, aucun ticket, la nuit suivante rejoue." >> "$journal"
@@ -0,0 +1,188 @@
1
+ #!/usr/bin/env node
2
+ // The reading of the `grillhouse.outils` key of a package.json, the tools of the project, as Bazel
3
+ // declares what an action sees out of its sandbox (--sandbox_add_mount_pair) and the environment
4
+ // it gets (--action_env): `{ "<VARIABLE>": "<chemin>" }`, each path absolute or under `~`. The
5
+ // envelope (scripts/enveloppe/enveloppe.mjs) mounts each path read-only and passes each variable to
6
+ // the session; the circuit's passes (scripts/circuit.mjs), `npm run verifier`
7
+ // (bin/grillhouse.mjs) and the night (scripts/nuit.sh) play with the same variables, so that every
8
+ // one of them sees the same tool, whatever its launcher's environment.
9
+ //
10
+ // - The key is absent, null or an object; each name is a variable's (`[A-Za-z_][A-Za-z0-9_]*`),
11
+ // each value a string, a path absolute or under `~` (the home), that exists. Every fault is named
12
+ // with its key; a faulty key gives no variable.
13
+ // - A tool never undoes the envelope: a path is refused, its variable and its path named, when it
14
+ // is `/`, the home or a path that holds it, a path that holds a mount of the envelope (the main
15
+ // tree and its copies, `/tmp` and the temporary directories, and the mounts the envelope names:
16
+ // `~/.claude`, the scratchpads, the npm cache, the session directories), or a path under a hidden
17
+ // directory of the first level of the home (`~/.ssh`, `~/.gnupg`, `~/.aws`, `~/.config`…), where
18
+ // the machine keeps its credentials, but `~/.local` and `~/.cache`; nor under or holding
19
+ // `~/.local/share/keyrings`, the keyrings of the machine's credentials. A path that is a link is
20
+ // judged by its target too, which the envelope mounts with it.
21
+ // - The key is read from the package.json of the main tree of the repository (`outilsDe`), never of
22
+ // a copy: an agent never opens a path for its next session.
23
+ // - `node outils-cles.mjs <dir>` writes one line `export VARIABLE='chemin'` per tool of the project
24
+ // that holds <dir>, the path resolved and quoted for the shell (`exportsDesOutils`), which the
25
+ // night evaluates, exit 0; a faulty key writes its faults on stderr, exit 1.
26
+ import { spawnSync } from 'node:child_process';
27
+ import { existsSync, readFileSync, realpathSync } from 'node:fs';
28
+ import os from 'node:os';
29
+ import path from 'node:path';
30
+ import { pathToFileURL } from 'node:url';
31
+
32
+ const NOM = /^[A-Za-z_][A-Za-z0-9_]*$/;
33
+ // The hidden directories of the first level of the home that a tool may lie under.
34
+ const CACHES_PERMIS = ['.local', '.cache'];
35
+ // The keyrings of credentials inside them, as paths relative to the home.
36
+ const TROUSSEAUX = ['.local/share/keyrings'];
37
+
38
+ // Whether <enfant> is <parent> or lies under it.
39
+ const sous = (enfant, parent) => {
40
+ const rel = path.relative(parent, enfant);
41
+ return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
42
+ };
43
+
44
+ // The refusal of the path <chemin> of the tool <cle>, or null, the home <maison> and the mounts
45
+ // <montages> of the envelope (see the header).
46
+ function refusDuChemin(cle, chemin, maison, montages) {
47
+ if (chemin === path.parse(chemin).root) {
48
+ return `la clé ${cle} nomme ${chemin}, la racine : un outil ne montre pas toute la machine.`;
49
+ }
50
+ if (sous(maison, chemin)) {
51
+ return `la clé ${cle} nomme ${chemin}, qui contient la maison ${maison} : un outil ne montre pas ses identifiants.`;
52
+ }
53
+ const couvert = montages.find(m => sous(path.resolve(m), chemin));
54
+ if (couvert) {
55
+ return `la clé ${cle} nomme ${chemin}, qui contient ${path.resolve(couvert)}, un montage de l'enveloppe.`;
56
+ }
57
+ const premier = sous(chemin, maison) ? path.relative(maison, chemin).split(path.sep)[0] : '';
58
+ if (premier.startsWith('.') && !CACHES_PERMIS.includes(premier)) {
59
+ return `la clé ${cle} nomme ${chemin}, sous ~/${premier}, un dossier caché de la maison où la machine garde ses identifiants (seuls ~/.local et ~/.cache portent un outil).`;
60
+ }
61
+ const trousseau = TROUSSEAUX.map(t => path.join(maison, t)).find(
62
+ t => sous(chemin, t) || sous(t, chemin)
63
+ );
64
+ if (trousseau) {
65
+ return `la clé ${cle} nomme ${chemin}, qui touche ${trousseau}, le trousseau où la machine garde ses identifiants.`;
66
+ }
67
+ return null;
68
+ }
69
+
70
+ // The real path of <p>, its links followed; <p> itself when it does not resolve.
71
+ const realpath = p => {
72
+ try {
73
+ return realpathSync(p);
74
+ } catch {
75
+ return p;
76
+ }
77
+ };
78
+
79
+ /**
80
+ * The tools that the package.json <pkg> declares: `outils`, each variable and its path resolved
81
+ * (`~` from <maison>), none when a fault is found; `fautes`, one sentence per fault, naming its key.
82
+ * <montages> are the paths a tool must not hold (see the header); a path that exists is judged
83
+ * again by its real path, `reel` (its links followed), which the envelope mounts with it.
84
+ * @param {any} pkg the parsed package.json
85
+ * @param {{ maison?: string, existe?: (p: string) => boolean, reel?: (p: string) => string, montages?: string[] }} [o]
86
+ * @returns {{ outils: Record<string, string>, fautes: string[] }}
87
+ */
88
+ export function lireOutils(
89
+ pkg,
90
+ { maison = os.homedir(), existe = existsSync, reel = realpath, montages = [] } = {}
91
+ ) {
92
+ const o = pkg?.grillhouse?.outils;
93
+ if (o === undefined || o === null) return { outils: {}, fautes: [] };
94
+ if (typeof o !== 'object' || Array.isArray(o)) {
95
+ return {
96
+ outils: {},
97
+ fautes: [
98
+ `la clé grillhouse.outils vaut ${JSON.stringify(o)}, pas un objet { VARIABLE: chemin }.`,
99
+ ],
100
+ };
101
+ }
102
+ /** @type {string[]} */
103
+ const fautes = [];
104
+ /** @type {Record<string, string>} */
105
+ const outils = {};
106
+ for (const [nom, v] of Object.entries(o)) {
107
+ const cle = `grillhouse.outils.${nom}`;
108
+ if (!NOM.test(nom)) {
109
+ fautes.push(`la clé grillhouse.outils nomme « ${nom} », pas un nom de variable.`);
110
+ } else if (typeof v !== 'string') {
111
+ fautes.push(`la clé ${cle} vaut ${JSON.stringify(v)}, pas un chemin.`);
112
+ } else if (!path.isAbsolute(v) && v !== '~' && !v.startsWith('~/')) {
113
+ fautes.push(`la clé ${cle} vaut « ${v} », ni un chemin absolu ni un chemin sous ~.`);
114
+ } else {
115
+ const chemin = path.resolve(v.startsWith('~') ? path.join(maison, v.slice(1)) : v);
116
+ const refus = refusDuChemin(cle, chemin, path.resolve(maison), montages);
117
+ // The envelope mounts what a link leads to: its target is judged as the path.
118
+ const cible = !refus && existe(chemin) ? reel(chemin) : chemin;
119
+ const refusDeLaCible =
120
+ cible !== chemin ? refusDuChemin(cle, cible, path.resolve(maison), montages) : null;
121
+ if (refus) fautes.push(refus);
122
+ else if (refusDeLaCible) fautes.push(`${refusDeLaCible} (la cible du lien ${chemin})`);
123
+ else if (existe(chemin)) outils[nom] = chemin;
124
+ else fautes.push(`la clé ${cle} nomme ${chemin}, qui n'existe pas.`);
125
+ }
126
+ }
127
+ return { outils: fautes.length ? {} : outils, fautes };
128
+ }
129
+
130
+ // The main tree of the repository that holds <dir>, from git's common directory; <dir> itself out
131
+ // of a repository.
132
+ function arbrePrincipal(dir) {
133
+ const r = spawnSync(
134
+ 'git',
135
+ ['-C', dir, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
136
+ {
137
+ encoding: 'utf8',
138
+ }
139
+ );
140
+ return r.status === 0 ? path.dirname(r.stdout.trim()) : path.resolve(dir);
141
+ }
142
+
143
+ /**
144
+ * The tools of the project that holds <dir>, from the package.json of its main tree, never of a
145
+ * copy, so that an agent never opens a path for its next session (none without one); no path
146
+ * holding the main tree, `/tmp`, the temporary directories, nor one of <montages>.
147
+ * @param {string} dir a directory of the project: its main tree or a copy
148
+ * @param {{ montages?: string[] }} [o]
149
+ * @returns {Record<string, string>}
150
+ * @throws {Error} the faults of the key, one per line
151
+ */
152
+ export function outilsDe(dir, { montages = [] } = {}) {
153
+ const racine = arbrePrincipal(dir);
154
+ const f = path.join(racine, 'package.json');
155
+ if (!existsSync(f)) return {};
156
+ const temporaires = [process.env.CLAUDE_CODE_TMPDIR, os.tmpdir(), '/tmp'].filter(Boolean);
157
+ const { outils, fautes } = lireOutils(JSON.parse(readFileSync(f, 'utf8')), {
158
+ montages: [racine, ...temporaires, ...montages],
159
+ });
160
+ if (fautes.length) throw new Error(fautes.join('\n'));
161
+ return outils;
162
+ }
163
+
164
+ /**
165
+ * The environment <env> of a pass with the tools <outils> (`outilsDe`), the tools winning.
166
+ * @param {Record<string, string>} outils
167
+ * @param {Record<string, string | undefined>} env
168
+ */
169
+ export function avecLesOutils(outils, env) {
170
+ return { ...env, ...outils };
171
+ }
172
+
173
+ // The shell's text that exports the tools <outils> (`outilsDe`), one `export VARIABLE='chemin'`
174
+ // per line, each path quoted for the shell: what the night evaluates before its commands.
175
+ export const exportsDesOutils = outils =>
176
+ Object.entries(outils)
177
+ .map(([n, c]) => `export ${n}='${c.replaceAll("'", "'\\''")}'\n`)
178
+ .join('');
179
+
180
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
181
+ try {
182
+ const outils = outilsDe(path.resolve(process.argv[2] ?? '.'));
183
+ process.stdout.write(exportsDesOutils(outils));
184
+ } catch (e) {
185
+ process.stderr.write(`${/** @type {Error} */ (e).message}\n`);
186
+ process.exitCode = 1;
187
+ }
188
+ }
@@ -23,8 +23,12 @@
23
23
  // the circuit does not read, fell at the review) (developpeur);
24
24
  // - `reponses` (`titre` of the finding, `etat` levé or contesté, `raison` for a contesté,
25
25
  // `piece`): as the author answers in each thread of a review on GitHub or Gerrit, a FAIT
26
- // answers each finding of the reviewer open for him, by its title, and the circuit refuses a
27
- // sheet without the answer to one (`reponsesAuxConstats`) and gives the next review each answer
26
+ // answers each finding of the reviewer open for him, by its title (the number « Constat N — »
27
+ // its instruction heads it with recognised, `cleDuConstat`), and the circuit refuses a
28
+ // sheet without the answer to one (`reponsesAuxConstats`), save in a run where the supervisor
29
+ // gives the task (`--contexte`, the findings open at the run's launch then its context, the
30
+ // ones a RENDU states within it still its task: `constatsDeLaSeance` of
31
+ // scripts/circuit.mjs), and gives the next review each answer
28
32
  // under its finding (BP 320.21: the cause of his choice in a handover the circuit does not
29
33
  // read, three RENDU, then the stop) (developpeur);
30
34
  // - `ecarts` (`sujet`, `texte`): the body of the commit message, written by the circuit, each
@@ -47,8 +51,9 @@
47
51
  // element out of the list, a file the lot changes named alone or as `<fichier>#<nom>`
48
52
  // (`conformiteDuLot`) (reviewer);
49
53
  // - `suivi` (`titre`, `etat` levé or non levé, `preuve`): after a review sent back, each finding
50
- // before it judged on the difference of the lot, which the circuit writes at the ticket with
51
- // the verdict, for the human (reviewer);
54
+ // before it judged on the difference of the lot, by its title (its number « Constat N — »
55
+ // recognised, `cleDuConstat`), which the circuit writes at the ticket with the verdict, for
56
+ // the human (reviewer);
52
57
  // - `question`, with its `piece` (reviewer): what goes up to the owner, a real word of the
53
58
  // language written in the code; the circuit stops at « besoin » before it commits or
54
59
  // relaunches anyone;
@@ -277,7 +282,9 @@ const FICHES = {
277
282
  reponses: liste(
278
283
  objet(
279
284
  {
280
- titre: texte('Le titre du constat, tel que ta consigne l’écrit.'),
285
+ titre: texte(
286
+ 'Le titre du constat, tel que ta consigne l’écrit, sans son numéro « Constat N — ».'
287
+ ),
281
288
  etat: {
282
289
  type: 'string',
283
290
  enum: ['levé', 'contesté'],
@@ -353,7 +360,7 @@ const FICHES = {
353
360
  suivi: liste(
354
361
  objet(
355
362
  {
356
- titre: texte('Le titre du constat d’avant.'),
363
+ titre: texte('Le titre du constat d’avant, sans son numéro « Constat N — ».'),
357
364
  etat: { type: 'string', enum: ['levé', 'non levé'] },
358
365
  preuve: texte('Ce que la différence du lot en montre.'),
359
366
  },
@@ -513,12 +520,24 @@ export function reponsesAuxQuestions(fiche, posees) {
513
520
  return sans.length ? `reponses : sans ligne pour les questions ${sans.join(', ')}` : null;
514
521
  }
515
522
 
523
+ // The finding an answer's title <titre> names: the title itself, or the title as the instruction
524
+ // heads it, numbered, « Constat N — <titre> » (`texteDesOuverts` of scripts/circuit.mjs), as a review
525
+ // attaches a reply to its thread by its identifier, never by a copy of its display.
526
+ export function cleDuConstat(titre) {
527
+ const tiret = ' — ';
528
+ const fin = titre.indexOf(tiret);
529
+ const numero = titre.slice('Constat '.length, fin);
530
+ return titre.startsWith('Constat ') && fin > 0 && String(Number.parseInt(numero, 10)) === numero
531
+ ? titre.slice(fin + tiret.length)
532
+ : titre;
533
+ }
534
+
516
535
  // What makes the developpeur's sheet <fiche> out of conformity with the findings open for him
517
536
  // (<titres>), as the author answers in each thread of a review: a FAIT without the answer to one,
518
537
  // by its title (a BLOQUÉ or a BESOIN stops the circuit before any review). The fault, or null.
519
538
  export function reponsesAuxConstats(fiche, titres) {
520
539
  if (fiche.statut !== 'FAIT') return null;
521
- const repondus = new Set((fiche.reponses ?? []).map(r => r.titre));
540
+ const repondus = new Set((fiche.reponses ?? []).map(r => cleDuConstat(r.titre)));
522
541
  const sans = titres.filter(t => !repondus.has(t)).map(t => `« ${t} »`);
523
542
  if (!sans.length) return null;
524
543
  return `reponses : sans réponse ${sans.length > 1 ? 'aux constats' : 'au constat'} ${sans.join(', ')}`;
@@ -2,7 +2,8 @@
2
2
  # The removal of a working copy, called by the three places that end one: the agent copy (by
3
3
  # scripts/integration/integrer.mjs once its lot is committed, and by the supervisor for a ticket
4
4
  # closed without integration), the integration copy (by the same script) and the night copy
5
- # (scripts/nuit.sh), the last two when their existing copy does not get ready.
5
+ # (scripts/nuit.sh), the last two when their existing copy does not get ready; and by the night
6
+ # for every other copy once its steps are played (scripts/copies-finies.mjs), without `--jetable`.
6
7
  #
7
8
  # npx grillhouse retirer-copie [--jetable] [--garder-travail] <copie>
8
9
  #
@@ -14,6 +14,7 @@
14
14
  import path from 'node:path';
15
15
  import { fileURLToPath } from 'node:url';
16
16
  import { langageDe } from './langages.mjs';
17
+ import { avecLesOutils, outilsDe } from './outils-cles.mjs';
17
18
 
18
19
  const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
19
20
 
@@ -27,6 +28,7 @@ export const SOUS_COMMANDES = {
27
28
  droits: 'droits.mjs',
28
29
  enveloppe: 'enveloppe/enveloppe.mjs',
29
30
  file: 'integration/file.mjs',
31
+ 'fusion-du-changelog': 'fusion-du-changelog.mjs',
30
32
  'gardes-du-cadre': 'gardes-du-cadre.mjs',
31
33
  greffons: 'greffons.mjs',
32
34
  hook: 'crochet.mjs',
@@ -88,6 +90,20 @@ export function commandeDe(nom, racine = process.cwd()) {
88
90
  return n !== null && Object.hasOwn(commandes, n) ? commandes[n] : null;
89
91
  }
90
92
 
93
+ /**
94
+ * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>:
95
+ * `verifier` gets the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs), each
96
+ * variable set to its path, whatever <env> holds; every other subcommand gets <env>.
97
+ * @param {string} nom the subcommand
98
+ * @param {string} [racine] the root of the project, the working directory by default
99
+ * @param {Record<string, string | undefined>} [env]
100
+ * @returns {Record<string, string | undefined>}
101
+ * @throws {Error} the faults of the key, for `verifier`
102
+ */
103
+ export function environnementDe(nom, racine = process.cwd(), env = process.env) {
104
+ return nom === 'verifier' ? avecLesOutils(outilsDe(racine), env) : env;
105
+ }
106
+
91
107
  // The script of each subcommand in the project at <racine>, where a former copy of the frame lay
92
108
  // (`scripts/<script>`): what the migrations name, a former copy becoming its subcommand. A script
93
109
  // of the core is named from `scripts/`, one of a module of language by its file's name, where the
@@ -38,12 +38,13 @@
38
38
  // `--experimental_local_test_priority` orders the tests that wait for the machine. A measure
39
39
  // played in the frame's own repository (one whose workspaces hold the package
40
40
  // @roomi-fields/grillhouse in development, its agent copies included: `rangDeLaMesure`) is of
41
- // the second rank; a project's (a circuit, a `npm run verifier`) is of the first. A measure of
42
- // the first rank that waits names itself in the directory `<lock>.premier-rang/` (one file per
43
- // waiting process, named by its number, removed once it holds the lock or stops); a measure of
44
- // the second rank does not take the lock, even free, while a live process waits there, so a
45
- // project's circuit never waits behind the frame's own checks (BPScript 320.9: 208 min of its
46
- // wait went to the checks of the frame's agent copies). A waiting file whose process is gone
41
+ // the first rank, « mesure du cadre »; a project's (a circuit, a `npm run verifier`) is of the
42
+ // second, « mesure d'un projet ». A measure of the first rank that waits names itself in the
43
+ // directory `<lock>.premier-rang/` (one file per waiting process, named by its number, removed
44
+ // once it holds the lock or stops); a measure of the second rank does not take the lock, even
45
+ // free, while a live process waits there, so a check of the frame, whose next version every
46
+ // project waits for, never waits behind the projects' measures (the verification of 0.26.0
47
+ // waited 61 min behind five measures of two projects). A waiting file whose process is gone
47
48
  // names no one and goes. Between measures of one rank, the first to find the lock free takes
48
49
  // it. The bound of the wait is the same for both ranks, and the wait says its rank.
49
50
  // - The lock is let go at the end of the measure, whether it succeeds or throws.
@@ -69,20 +70,20 @@ const VARIABLE_VERROU = 'GRILLHOUSE_VERROU_MACHINE';
69
70
  const VARIABLE_TENUE = 'GRILLHOUSE_MESURE_TENUE';
70
71
  const VARIABLE_ATTENTE = 'GRILLHOUSE_ATTENTE_MACHINE_MS';
71
72
 
72
- // The name of the frame's package, which a repository of the second rank develops.
73
+ // The name of the frame's package, which a repository of the first rank develops.
73
74
  const CADRE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).name;
74
75
 
75
76
  /**
76
- * The rank of a measure played at <racine>: 2 in the frame's own repository (its workspaces hold
77
- * the package @roomi-fields/grillhouse in development), 1 elsewhere.
77
+ * The rank of a measure played at <racine>: 1 in the frame's own repository (its workspaces hold
78
+ * the package @roomi-fields/grillhouse in development), 2 elsewhere.
78
79
  * @param {string} racine the root of the repository the measure plays in
79
80
  * @returns {1 | 2}
80
81
  */
81
82
  export function rangDeLaMesure(racine) {
82
- return paquets(racine).some(p => p.pkg.name === CADRE) ? 2 : 1;
83
+ return paquets(racine).some(p => p.pkg.name === CADRE) ? 1 : 2;
83
84
  }
84
85
 
85
- const RANGS = { 1: 'mesure de premier rang', 2: 'mesure de second rang (le dépôt du cadre)' };
86
+ const RANGS = { 1: 'mesure du cadre', 2: "mesure d'un projet" };
86
87
 
87
88
  /** The longest wait for the lock of the machine, in ms, unless GRILLHOUSE_ATTENTE_MACHINE_MS names another. */
88
89
  export const ATTENTE_MACHINE_MS = 60 * 60_000;
@@ -203,8 +204,8 @@ function attendus(verrou, rang) {
203
204
  const avant = !premiers.length
204
205
  ? ''
205
206
  : premiers.length === 1
206
- ? ` ; une mesure de premier rang attend aussi et passe d'abord : ${processus(premiers[0])}`
207
- : ` ; ${premiers.length} mesures de premier rang attendent aussi et passent d'abord : ${premiers.map(processus).join(' ; ')}`;
207
+ ? ` ; une mesure du cadre attend aussi et passe d'abord : ${processus(premiers[0])}`
208
+ : ` ; ${premiers.length} mesures du cadre attendent aussi et passent d'abord : ${premiers.map(processus).join(' ; ')}`;
208
209
  return `le verrou de la mesure lourde (${verrou}) est ${tenu}${avant}`;
209
210
  }
210
211