@roomi-fields/grillhouse 0.25.5 → 0.27.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 (83) 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 +13 -0
  7. package/cadre/templates/projet/docs/ARCHITECTURE.md +15 -0
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/python/package.json +18 -0
  10. package/charte.md +32 -1
  11. package/docs/ARCHITECTURE.md +146 -40
  12. package/docs/CADRE.md +7 -6
  13. package/docs/INTERFACE.md +108 -32
  14. package/hooks/register.tsx +57 -16
  15. package/package.json +9 -3
  16. package/scripts/circuit.mjs +165 -27
  17. package/scripts/commande-du-langage.mjs +2 -2
  18. package/scripts/commandes-composees.mjs +156 -0
  19. package/scripts/composition-des-langages.mjs +306 -0
  20. package/scripts/conformite.mjs +1 -3
  21. package/scripts/copies-finies.mjs +167 -28
  22. package/scripts/crochets.mjs +9 -3
  23. package/scripts/dernier-vert.mjs +15 -2
  24. package/scripts/engendres.mjs +170 -0
  25. package/scripts/enveloppe/enveloppe.mjs +59 -17
  26. package/scripts/enveloppe/lancer.sh +15 -22
  27. package/scripts/enveloppe/travail-de-la-copie.mjs +262 -0
  28. package/scripts/etapes.mjs +1 -1
  29. package/scripts/fusion-du-changelog.mjs +120 -0
  30. package/scripts/gardes-du-cadre.mjs +7 -4
  31. package/scripts/grillhouse-maj.mjs +171 -99
  32. package/scripts/index-interfaces.mjs +78 -0
  33. package/scripts/init.mjs +5 -5
  34. package/scripts/integration/file.mjs +270 -117
  35. package/scripts/integration/integrer.mjs +50 -62
  36. package/scripts/jointure.d.ts +48 -14
  37. package/scripts/langages/cargo/binaires.json +2 -1
  38. package/scripts/langages/cargo/binaires.mjs +29 -6
  39. package/scripts/langages/cargo/clippy.mjs +12 -2
  40. package/scripts/langages/cargo/commandes.mjs +60 -7
  41. package/scripts/langages/cargo/composants.mjs +229 -8
  42. package/scripts/langages/cargo/exemples.mjs +1 -15
  43. package/scripts/langages/cargo/index-interfaces.mjs +20 -3
  44. package/scripts/langages/cargo/index.mjs +25 -17
  45. package/scripts/langages/cargo/mise-a-jour.mjs +2 -1
  46. package/scripts/langages/cargo/sccache.mjs +172 -0
  47. package/scripts/langages/cargo/verdict.mjs +50 -10
  48. package/scripts/langages/python/binaires.json +3 -0
  49. package/scripts/langages/python/binaires.mjs +59 -0
  50. package/scripts/langages/python/commandes.mjs +411 -0
  51. package/scripts/langages/python/composants.mjs +272 -0
  52. package/scripts/langages/python/exemples.mjs +260 -0
  53. package/scripts/langages/python/index-interfaces.mjs +77 -0
  54. package/scripts/langages/python/index.mjs +94 -0
  55. package/scripts/langages/python/lot.mjs +76 -0
  56. package/scripts/langages/python/mise-a-jour.mjs +54 -0
  57. package/scripts/langages/python/tailles-des-tests.mjs +102 -0
  58. package/scripts/langages/python/verdict.mjs +85 -0
  59. package/scripts/langages/typescript/exemples.mjs +1 -20
  60. package/scripts/langages/typescript/index-interfaces.mjs +10 -3
  61. package/scripts/langages/typescript/index.mjs +15 -17
  62. package/scripts/langages/typescript/regle-des-tests.mjs +37 -0
  63. package/scripts/langages-des-paquets.mjs +171 -0
  64. package/scripts/langages.mjs +60 -41
  65. package/scripts/migrations/0.27.0-langages-dans-l-architecture.mjs +182 -0
  66. package/scripts/migrations.mjs +2 -0
  67. package/scripts/nuit.sh +15 -1
  68. package/scripts/outils-cles.mjs +188 -0
  69. package/scripts/resultats.mjs +22 -6
  70. package/scripts/session-start.sh +34 -9
  71. package/scripts/sources.mjs +2 -1
  72. package/scripts/sous-commandes.mjs +21 -3
  73. package/scripts/tableau-des-composants.mjs +138 -0
  74. package/scripts/verrou-de-machine.mjs +14 -13
  75. package/scripts/verrous/verrou.mjs +53 -16
  76. package/skills/developpeur/SKILL.md +4 -0
  77. package/skills/explorateur/SKILL.md +3 -1
  78. package/skills/grill/SKILL.md +9 -1
  79. package/skills/pitmaster/SKILL.md +12 -3
  80. package/skills/pitmaster/references/consigne-agent.md +3 -3
  81. package/skills/redacteur/references/documents-d-un-composant.md +12 -0
  82. package/skills/relecteur/SKILL.md +6 -2
  83. package/skills/testwriter/SKILL.md +29 -6
@@ -0,0 +1,182 @@
1
+ // From 0.27.0 the language of each package is declared at the design, in the column « Langage »
2
+ // of the table of the components of docs/ARCHITECTURE.md (decision D8 of grillhouse-1zu, as the
3
+ // BUILD file of Bazel names the rule of each target): the architecture is the one source of the
4
+ // languages, and the key `grillhouse.langages` of the package.json, which named them before,
5
+ // disappears.
6
+ //
7
+ // - A project whose package.json holds the key: the declaration is written in the column when it
8
+ // lacks, then the key is removed (the section `grillhouse` with it, when it held nothing else).
9
+ // A table whose column holds a language already: the key alone is removed.
10
+ // - The table: the first table of docs/ARCHITECTURE.md where a cell names a component of the
11
+ // modules of the key (./tableau-des-composants.mjs), as the project wrote it (BPScript's names
12
+ // the phase before the package, SyntHub's the crates of other repositories). The column is added
13
+ // at the end of its header, of its separator, in their style, and of each row: the language of
14
+ // the component the row names, empty for a row that names none. A package of the modules (its
15
+ // manifest in its folder) that no row names goes to a section « Les paquets » that ends the
16
+ // document (written when absent), a table `Paquet | Langage`, one row each: a table that says
17
+ // « each stage does a step » (BPScript's) receives no row without its step. A language of the
18
+ // key that no package carries has a row naming the root, `.`, there. The text of the document is
19
+ // kept otherwise.
20
+ // - `aReporter`: whether a project holds the former declaration, which the session start names
21
+ // with `npx grillhouse maj`, which reports it.
22
+ // - A key that names a language the frame lacks, or whose modules claim one folder twice, is left
23
+ // to the project (`aFaire`), nothing written.
24
+ // - A project without the key, or already migrated, is not written: a second pass changes nothing.
25
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
26
+ import path from 'node:path';
27
+ import { composantsRanges } from '../composition-des-langages.mjs';
28
+ import { LANGAGES, langage } from '../langages.mjs';
29
+ import {
30
+ ARCHITECTURE,
31
+ COLONNE,
32
+ colonneDesNoms,
33
+ nomme,
34
+ nomsDe,
35
+ tableauxDesComposants,
36
+ tableaux,
37
+ } from '../tableau-des-composants.mjs';
38
+
39
+ export const version = '0.27.0';
40
+ export const nom = 'langages dans l’architecture';
41
+
42
+ const lireJson = f => JSON.parse(readFileSync(f, 'utf8'));
43
+ const ecrireJson = (f, v) => writeFileSync(f, `${JSON.stringify(v, null, 2)}\n`);
44
+
45
+ // A row of Markdown of <cellules>, an empty cell a single space.
46
+ const ligne = cellules => `|${cellules.map(c => (c ? ` ${c} ` : ' ')).join('|')}|`;
47
+
48
+ // <texte> of a line of a table, <ajout> cells added at its end (each a text, empty for none),
49
+ // padded first to <largeur> cells; a separator <sep> takes its own style.
50
+ function prolonger(texte, nombre, largeur, ajout, sep = null) {
51
+ const base = texte.replace(/\s+$/, '');
52
+ const ferme = base.endsWith('|') ? base : `${base} |`;
53
+ const vides = Array.from({ length: Math.max(0, largeur - nombre) }, () => '');
54
+ const cellules = [...vides, ...ajout];
55
+ if (sep !== null) {
56
+ return ferme + cellules.map(() => `${sep}|`).join('');
57
+ }
58
+ return ferme + cellules.map(c => (c ? ` ${c} |` : ' |')).join('');
59
+ }
60
+
61
+ // Removes the key from the package.json <f>, its read <p>.
62
+ function retirerLaCle(f, p) {
63
+ const { langages: _, ...reste } = p.grillhouse;
64
+ const out = { ...p };
65
+ if (Object.keys(reste).length) {
66
+ out.grillhouse = reste;
67
+ } else {
68
+ delete out.grillhouse;
69
+ }
70
+ ecrireJson(f, out);
71
+ }
72
+
73
+ // The former declaration of the project at <projet>, the list of its package.json; null without.
74
+ function cleDe(projet) {
75
+ const f = path.join(projet, 'package.json');
76
+ if (!existsSync(f)) {
77
+ return null;
78
+ }
79
+ const cle = lireJson(f).grillhouse?.langages;
80
+ return Array.isArray(cle) ? cle : null;
81
+ }
82
+
83
+ /** Whether the project at <projet> holds the former declaration, which `maj` reports. */
84
+ export const aReporter = projet => cleDe(projet) !== null;
85
+
86
+ export function migrer(projet) {
87
+ const cle = cleDe(projet);
88
+ if (cle === null) {
89
+ return [];
90
+ }
91
+ const f = path.join(projet, 'package.json');
92
+ const p = lireJson(f);
93
+ const ecrites = tableauxDesComposants(projet).some(x =>
94
+ x.lignes.some(l => (l.cellules[x.colonne] ?? '').trim())
95
+ );
96
+ if (ecrites) {
97
+ retirerLaCle(f, p);
98
+ return [
99
+ `grillhouse.langages retiré du package.json : ${ARCHITECTURE} déclare les langages (colonne « ${COLONNE} »).`,
100
+ ];
101
+ }
102
+ const inconnus = cle.filter(n => !Object.hasOwn(LANGAGES, n));
103
+ if (inconnus.length) {
104
+ return [
105
+ {
106
+ aFaire: `grillhouse.langages nomme ${inconnus.join(', ')}, que le cadre n'a pas (ses langages : ${Object.keys(LANGAGES).join(', ')}) ; écrire le langage de chaque paquet dans la colonne « ${COLONNE} » de ${ARCHITECTURE}, puis retirer la clé.`,
107
+ },
108
+ ];
109
+ }
110
+ let ranges;
111
+ try {
112
+ ranges = composantsRanges(cle.map(langage), projet);
113
+ } catch (e) {
114
+ return [{ aFaire: e.message.replace(/^⛔ /, '') }];
115
+ }
116
+ const doc = path.join(projet, ARCHITECTURE);
117
+ const texte = existsSync(doc) ? readFileSync(doc, 'utf8') : '# Architecture\n';
118
+ const composants = ranges.map(r => r.composant);
119
+ const paquets = ranges.filter(r =>
120
+ existsSync(path.join(r.composant.dossier, r.module.manifeste))
121
+ );
122
+ const nommes = new Set();
123
+ const lignes = texte.split('\n');
124
+ const table = tableaux(texte).find(x => colonneDesNoms(x.lignes, composants, projet) >= 0);
125
+ const nomDe = c => `\`${c.nom}\``;
126
+ if (table) {
127
+ const colonne = colonneDesNoms(table.lignes, composants, projet);
128
+ const largeur = Math.max(table.entete.length, ...table.lignes.map(l => l.cellules.length));
129
+ const sep = lignes[table.ligneEntete + 1].includes(' -') ? ' --- ' : '---';
130
+ lignes[table.ligneEntete] = prolonger(lignes[table.ligneEntete], table.entete.length, largeur, [
131
+ COLONNE,
132
+ ]);
133
+ lignes[table.ligneEntete + 1] = prolonger(
134
+ lignes[table.ligneEntete + 1],
135
+ table.entete.length,
136
+ largeur,
137
+ [''],
138
+ sep
139
+ );
140
+ for (const l of table.lignes) {
141
+ const r = ranges.find(x => nomme(nomsDe(l.cellules[colonne]), x.composant, projet));
142
+ if (r) {
143
+ nommes.add(r);
144
+ }
145
+ lignes[l.index] = prolonger(lignes[l.index], l.cellules.length, largeur, [
146
+ r ? r.module.nom : '',
147
+ ]);
148
+ }
149
+ }
150
+ const ajout = [
151
+ ...paquets
152
+ .filter(r => !nommes.has(r))
153
+ .map(r => ({ nom: nomDe(r.composant), langage: r.module.nom })),
154
+ ...racines(cle, [...nommes, ...paquets]),
155
+ ];
156
+ if (ajout.length) {
157
+ while (lignes.length && lignes.at(-1).trim() === '') {
158
+ lignes.pop();
159
+ }
160
+ lignes.push(
161
+ '',
162
+ '## Les paquets',
163
+ '',
164
+ `Les paquets qu’aucun tableau ne nomme, et leur langage (colonne « ${COLONNE} »).`,
165
+ '',
166
+ ligne(['Paquet', COLONNE]),
167
+ ligne(['---', '---']),
168
+ ...ajout.map(r => ligne([r.nom, r.langage])),
169
+ ''
170
+ );
171
+ }
172
+ mkdirSync(path.dirname(doc), { recursive: true });
173
+ writeFileSync(doc, lignes.join('\n'));
174
+ retirerLaCle(f, p);
175
+ return [
176
+ `${ARCHITECTURE} : la colonne « ${COLONNE} » déclare le langage de chaque paquet (${cle.join(', ')}), grillhouse.langages retiré du package.json.`,
177
+ ];
178
+ }
179
+
180
+ // The rows naming the root, `.`, for each language of <cle> that none of <portes> carries.
181
+ const racines = (cle, portes) =>
182
+ cle.filter(n => !portes.some(r => r.module.nom === n)).map(n => ({ nom: '`.`', langage: n }));
@@ -31,6 +31,7 @@ import * as circuitSimplifie from './migrations/0.24.0-circuit-simplifie.mjs';
31
31
  import * as apiExtractorDuPaquet from './migrations/0.24.2-api-extractor-du-paquet.mjs';
32
32
  import * as triDesDecouvertes from './migrations/0.24.12-tri-des-decouvertes.mjs';
33
33
  import * as scriptDesTests from './migrations/0.25.0-script-des-tests.mjs';
34
+ import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
34
35
 
35
36
  /** The migrations of the core. */
36
37
  export const MIGRATIONS = [
@@ -42,6 +43,7 @@ export const MIGRATIONS = [
42
43
  apiExtractorDuPaquet,
43
44
  triDesDecouvertes,
44
45
  scriptDesTests,
46
+ langagesDansLArchitecture,
45
47
  ];
46
48
 
47
49
  /**
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.*`,
@@ -70,7 +74,9 @@
70
74
  # main by their content goes, and its branch (main and a branch another copy holds stay); a copy
71
75
  # refused (commits or work not entered, a lock) or held by a running circuit (its ticket in progress, its
72
76
  # `<copie>.travail`, the lock of the integration or of the queue) stays, its log line naming
73
- # why. The removal never changes the night's verdict.
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).
74
80
  # - It takes no lock of the integration or of the queue (scripts/integration/file.mjs): an
75
81
  # integration and the queue run during the night, each in its own copy.
76
82
  # - Its log is <git common dir>/nuit/<date>.log. Green: HEAD becomes the last green commit
@@ -205,6 +211,14 @@ jouer() {
205
211
  esac
206
212
  done <<< "$lecture"
207
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"
208
222
  if [ -f "$copie/package-lock.json" ] && ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"; then
209
223
  monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
210
224
  cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
@@ -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
+ export 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,7 +23,8 @@
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
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
27
28
  // sheet without the answer to one (`reponsesAuxConstats`), save in a run where the supervisor
28
29
  // gives the task (`--contexte`, the findings open at the run's launch then its context, the
29
30
  // ones a RENDU states within it still its task: `constatsDeLaSeance` of
@@ -50,8 +51,9 @@
50
51
  // element out of the list, a file the lot changes named alone or as `<fichier>#<nom>`
51
52
  // (`conformiteDuLot`) (reviewer);
52
53
  // - `suivi` (`titre`, `etat` levé or non levé, `preuve`): after a review sent back, each finding
53
- // before it judged on the difference of the lot, which the circuit writes at the ticket with
54
- // 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);
55
57
  // - `question`, with its `piece` (reviewer): what goes up to the owner, a real word of the
56
58
  // language written in the code; the circuit stops at « besoin » before it commits or
57
59
  // relaunches anyone;
@@ -280,7 +282,9 @@ const FICHES = {
280
282
  reponses: liste(
281
283
  objet(
282
284
  {
283
- 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
+ ),
284
288
  etat: {
285
289
  type: 'string',
286
290
  enum: ['levé', 'contesté'],
@@ -356,7 +360,7 @@ const FICHES = {
356
360
  suivi: liste(
357
361
  objet(
358
362
  {
359
- titre: texte('Le titre du constat d’avant.'),
363
+ titre: texte('Le titre du constat d’avant, sans son numéro « Constat N — ».'),
360
364
  etat: { type: 'string', enum: ['levé', 'non levé'] },
361
365
  preuve: texte('Ce que la différence du lot en montre.'),
362
366
  },
@@ -516,12 +520,24 @@ export function reponsesAuxQuestions(fiche, posees) {
516
520
  return sans.length ? `reponses : sans ligne pour les questions ${sans.join(', ')}` : null;
517
521
  }
518
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
+
519
535
  // What makes the developpeur's sheet <fiche> out of conformity with the findings open for him
520
536
  // (<titres>), as the author answers in each thread of a review: a FAIT without the answer to one,
521
537
  // by its title (a BLOQUÉ or a BESOIN stops the circuit before any review). The fault, or null.
522
538
  export function reponsesAuxConstats(fiche, titres) {
523
539
  if (fiche.statut !== 'FAIT') return null;
524
- const repondus = new Set((fiche.reponses ?? []).map(r => r.titre));
540
+ const repondus = new Set((fiche.reponses ?? []).map(r => cleDuConstat(r.titre)));
525
541
  const sans = titres.filter(t => !repondus.has(t)).map(t => `« ${t} »`);
526
542
  if (!sans.length) return null;
527
543
  return `reponses : sans réponse ${sans.length > 1 ? 'aux constats' : 'au constat'} ${sans.join(', ')}`;
@@ -11,8 +11,13 @@
11
11
  # written; the session start goes on. Without the key (or with null), nothing runs; a value that is
12
12
  # not a non-blank string runs nothing and adds a line that says so. An agent's copy does not play it.
13
13
  #
14
- # The project's language: a package.json without `grillhouse.langages` (scripts/langages.mjs)
15
- # joins « Manque » as « la déclaration du langage », with `npx grillhouse maj`, which writes it.
14
+ # The project's languages: a project whose docs/ARCHITECTURE.md declares none (the column
15
+ # « Langage » of its table of the components, scripts/langages.mjs) joins « Manque » as « le
16
+ # langage de chaque paquet », with the grill, which writes it, or with `npx grillhouse maj` for a
17
+ # project that holds the declaration of a former version, which it reports. A document of the project that holds
18
+ # a field <…> of its template (the template's docs/ARCHITECTURE.md declares its language, its
19
+ # other fields left to the grill) is not yet written: it stays under « Pas encore renseignés », and
20
+ # the line of the night waits for it.
16
21
  #
17
22
  # The frame's plugins: scripts/greffons.mjs --absents reads `.claude/settings.json` and
18
23
  # `claude plugin list --json` (each call stopped after 5 s). Each declared plugin not installed for
@@ -69,10 +74,23 @@ if [ -z "$copie_agent" ]; then
69
74
  [ -d "$root/.codegraph" ] || missing+=("l'index CodeGraph du code (\`codegraph init .\`)")
70
75
  fi
71
76
  [ ! -f "$root/package.json" ] || [ -d "$root/node_modules" ] || missing+=("les dépendances npm (\`npm install\`)")
72
- # The project's language (scripts/langages.mjs): a package.json without `grillhouse.langages` is
73
- # refused by the frame's scripts and locks until the update writes it.
74
- if [ -f "$root/package.json" ] && ! node -e 'const l=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8"))?.grillhouse?.langages;process.exit(Array.isArray(l)&&l.length>0?0:1)' "$root/package.json" 2>/dev/null; then
75
- missing+=("la déclaration du langage (grillhouse.langages du package.json : \`npx grillhouse maj\` l'écrit)")
77
+ # The project's languages (scripts/langages.mjs): a project whose docs/ARCHITECTURE.md declares
78
+ # none (the column « Langage » of its table of the components) is refused by the frame's scripts
79
+ # and locks until the grill writes it, or, for a project that holds the declaration of a former
80
+ # version (the migration of 0.27.0, `aReporter`), until `npx grillhouse maj` reports it. The
81
+ # reading gives « declare », « maj » or « grill ».
82
+ if [ -f "$root/package.json" ]; then
83
+ langues="$(node --input-type=module -e '
84
+ const { pathToFileURL } = await import("node:url");
85
+ const { langagesDeclares } = await import(pathToFileURL(process.argv[1]).href);
86
+ const { aReporter } = await import(pathToFileURL(process.argv[2]).href);
87
+ process.stdout.write(langagesDeclares(process.argv[3]).length > 0 ? "declare" : aReporter(process.argv[3]) ? "maj" : "grill");
88
+ ' "$ici/langages.mjs" "$ici/migrations/0.27.0-langages-dans-l-architecture.mjs" "$root" 2>/dev/null)"
89
+ case "$langues" in
90
+ declare) ;;
91
+ maj) missing+=("le langage de chaque paquet (colonne « Langage » du tableau des composants de docs/ARCHITECTURE.md : \`npx grillhouse maj\` y reporte la déclaration du package.json)") ;;
92
+ *) missing+=("le langage de chaque paquet (colonne « Langage » du tableau des composants de docs/ARCHITECTURE.md : le grill l'écrit, branche 8)") ;;
93
+ esac
76
94
  fi
77
95
  # The frame's plugins not installed for the project (scripts/greffons.mjs): the plugins are the
78
96
  # machine's installation for the project, so an agent's copy does not read them.
@@ -97,12 +115,19 @@ command -v bwrap >/dev/null || missing+=("bubblewrap (bwrap), l'enveloppe des ag
97
115
 
98
116
  # The key elements the skills read; each one still empty is proposed for a grill.
99
117
  pending=()
118
+ # Whether the document <$1> holds a field <…> of its template, outside code spans.
119
+ a_des_champs() {
120
+ node -e 'const t=require("fs").readFileSync(process.argv[1],"utf8").replace(/`[^`]*`/g,"");process.exit(/<[^<>\n]+>/.test(t)?0:1)' "$1"
121
+ }
122
+ # Whether the document <$1> is written: present, without a field of its template (the template's
123
+ # docs/ARCHITECTURE.md holds the declaration of its language, its fields left to the grill).
124
+ ecrit() { [ -f "$1" ] && ! a_des_champs "$1"; }
100
125
  charter="$root/CLAUDE.md"
101
126
  if [ ! -f "$charter" ]; then
102
127
  pending+=("la charte (CLAUDE.md)")
103
128
  else
104
129
  # an unfilled field of the charter template: <…> outside code spans
105
- node -e 'const t=require("fs").readFileSync(process.argv[1],"utf8").replace(/`[^`]*`/g,"");process.exit(/<[^<>\n]+>/.test(t)?0:1)' "$charter" \
130
+ a_des_champs "$charter" \
106
131
  && pending+=("les champs <…> encore vides de la charte (CLAUDE.md)")
107
132
  # the arbitration criteria: a heading about arbitration in the charter or a reference document
108
133
  grep -qiE '^#+ .*(arbitr)' "$charter" "$root"/docs/*.md 2>/dev/null \
@@ -129,7 +154,7 @@ if ls -d "$root"/packages/*/ >/dev/null 2>&1; then
129
154
  done
130
155
  else
131
156
  for doc in ARCHITECTURE CADRE INTERFACE; do
132
- [ -f "$root/docs/$doc.md" ] || pending+=("docs/$doc.md")
157
+ ecrit "$root/docs/$doc.md" || pending+=("docs/$doc.md")
133
158
  done
134
159
  fi
135
160
  [ -f "$root/CONTEXT.md" ] || pending+=("le lexique du domaine (CONTEXT.md)")
@@ -182,7 +207,7 @@ fi
182
207
  # (the frame's script before the package, 0.24.0; a relative path after `cd <root>`), is named
183
208
  # with the line that replaces it, as brew doctor names a configuration that aims at a missing path.
184
209
  nuit_absente=
185
- if [ -f "$root/docs/ARCHITECTURE.md" ]; then
210
+ if ecrit "$root/docs/ARCHITECTURE.md"; then
186
211
  noeud="$(dirname "$(command -v node)")"
187
212
  table="$(crontab -l 2>/dev/null | grep -v '^[[:space:]]*#')"
188
213
  if ! printf '%s\n' "$table" | grep -F "cd $root && node_modules/.bin/grillhouse nuit" | grep -qF "PATH=$noeud:"; then
@@ -6,7 +6,8 @@
6
6
  // dist, coverage, .claude, .beads, .codegraph, .rtfm), and what the tools of the project's
7
7
  // language write (`ignorer` of its module, scripts/jointure.d.ts: typescript's `.turbo`, cargo's
8
8
  // `target`), as git leaves out what a `.gitignore` names. A project that declares no language
9
- // (`grillhouse.langages`) leaves out what every language of the frame writes.
9
+ // (the column « Langage » of its docs/ARCHITECTURE.md) leaves out what every language of the
10
+ // frame writes.
10
11
  import { readdirSync } from 'node:fs';
11
12
  import path from 'node:path';
12
13
  import { LANGAGES, langage, langageDe, langagesDeclares } from './langages.mjs';
@@ -7,13 +7,15 @@
7
7
  // (`circuit`, `tableau`); `maj` runs `grillhouse-maj.mjs`, whose name already says the frame's;
8
8
  // `hooks` (`crochets.mjs`, which places the git hooks) and `hook` (`crochet.mjs`, which runs one)
9
9
  // take Husky's names, which a project's `prepare` and its git hooks call.
10
- // - `tests` and `verifier` run the commands the module of the project's language describes
11
- // (`commandes`, scripts/jointure.d.ts: `tester` and `verifier`), the project being the working
12
- // directory (scripts/langages.mjs); each other command it describes but `typer` is a subcommand
10
+ // - `tests` and `verifier` run the commands the modules of the project's languages describe
11
+ // (`commandes`, scripts/jointure.d.ts: `tester` and `verifier`; for several languages, the
12
+ // composed command, scripts/commandes-composees.mjs), the project being the working directory
13
+ // (scripts/langages.mjs); each other command it describes but `typer` is a subcommand
13
14
  // by its name (`frontieres`, `index-interfaces`), as a backend of Pants brings its goals.
14
15
  import path from 'node:path';
15
16
  import { fileURLToPath } from 'node:url';
16
17
  import { langageDe } from './langages.mjs';
18
+ import { avecLesOutils, outilsDe } from './outils-cles.mjs';
17
19
 
18
20
  const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
19
21
 
@@ -27,11 +29,13 @@ export const SOUS_COMMANDES = {
27
29
  droits: 'droits.mjs',
28
30
  enveloppe: 'enveloppe/enveloppe.mjs',
29
31
  file: 'integration/file.mjs',
32
+ 'fusion-du-changelog': 'fusion-du-changelog.mjs',
30
33
  'gardes-du-cadre': 'gardes-du-cadre.mjs',
31
34
  greffons: 'greffons.mjs',
32
35
  hook: 'crochet.mjs',
33
36
  hooks: 'crochets.mjs',
34
37
  init: 'init.mjs',
38
+ 'langages-des-paquets': 'langages-des-paquets.mjs',
35
39
  integrer: 'integration/integrer.mjs',
36
40
  lancer: 'enveloppe/lancer.sh',
37
41
  'ligne-etat': 'ligne-etat/ligne-etat.mjs',
@@ -88,6 +92,20 @@ export function commandeDe(nom, racine = process.cwd()) {
88
92
  return n !== null && Object.hasOwn(commandes, n) ? commandes[n] : null;
89
93
  }
90
94
 
95
+ /**
96
+ * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>:
97
+ * `verifier` gets the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs), each
98
+ * variable set to its path, whatever <env> holds; every other subcommand gets <env>.
99
+ * @param {string} nom the subcommand
100
+ * @param {string} [racine] the root of the project, the working directory by default
101
+ * @param {Record<string, string | undefined>} [env]
102
+ * @returns {Record<string, string | undefined>}
103
+ * @throws {Error} the faults of the key, for `verifier`
104
+ */
105
+ export function environnementDe(nom, racine = process.cwd(), env = process.env) {
106
+ return nom === 'verifier' ? avecLesOutils(outilsDe(racine), env) : env;
107
+ }
108
+
91
109
  // The script of each subcommand in the project at <racine>, where a former copy of the frame lay
92
110
  // (`scripts/<script>`): what the migrations name, a former copy becoming its subcommand. A script
93
111
  // of the core is named from `scripts/`, one of a module of language by its file's name, where the