@roomi-fields/grillhouse 0.27.0 → 0.28.1

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 (35) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/explorateur.md +1 -1
  3. package/cadre/templates/paquet/docs/CADRE.md +36 -0
  4. package/cadre/templates/paquet/docs/INTERFACE.md +10 -0
  5. package/charte.md +26 -1
  6. package/docs/ARCHITECTURE.md +76 -8
  7. package/docs/INTERFACE.md +17 -2
  8. package/hooks/register.tsx +205 -24
  9. package/package.json +11 -1
  10. package/scripts/circuit.mjs +412 -98
  11. package/scripts/enveloppe/lancer.sh +10 -6
  12. package/scripts/etapes.mjs +21 -8
  13. package/scripts/grillhouse-maj.mjs +10 -9
  14. package/scripts/jointure.d.ts +18 -0
  15. package/scripts/langages/cargo/index.mjs +3 -0
  16. package/scripts/langages/cargo/squelette.mjs +111 -0
  17. package/scripts/langages/python/index.mjs +3 -0
  18. package/scripts/langages/python/squelette.mjs +66 -0
  19. package/scripts/langages/typescript/frontieres.mjs +14 -1
  20. package/scripts/langages/typescript/index.mjs +3 -0
  21. package/scripts/langages/typescript/squelette.mjs +120 -0
  22. package/scripts/langages-des-paquets.mjs +1 -1
  23. package/scripts/paquet.mjs +261 -0
  24. package/scripts/resultats.mjs +76 -1
  25. package/scripts/sous-commandes.mjs +1 -0
  26. package/scripts/tableau-des-composants.mjs +5 -3
  27. package/scripts/tableau.mjs +20 -10
  28. package/skills/developpeur/SKILL.md +3 -0
  29. package/skills/explorateur/SKILL.md +42 -4
  30. package/skills/grill/SKILL.md +6 -1
  31. package/skills/pitmaster/SKILL.md +30 -4
  32. package/skills/pitmaster/references/consigne-agent.md +34 -5
  33. package/skills/relecteur/SKILL.md +12 -0
  34. package/skills/testwriter/SKILL.md +2 -1
  35. package/types/index.d.ts +17 -3
@@ -0,0 +1,261 @@
1
+ #!/usr/bin/env node
2
+ // The creation of a package, out of the circuit: the third of the four times of a package's birth
3
+ // (the common charter, « La naissance d'un paquet »: the grill, the writing of its row and its
4
+ // documents, this command, then a ticket of code), as the generators of Nx (`nx g @nx/js:lib`,
5
+ // after `nx add` installs the tools of its plugin), `turbo gen workspace` and `cargo new --lib`
6
+ // added to the members of the workspace write one. A skeleton has neither behaviour nor test: it
7
+ // does not pass by the circuit, which works on a package that exists.
8
+ //
9
+ // npx grillhouse paquet <chemin> from the root of the project, <chemin> from it
10
+ //
11
+ // - The row first: a row of a table of the components of docs/ARCHITECTURE.md
12
+ // (./tableau-des-composants.mjs) names <chemin> when one name of its cell of the names is the
13
+ // path, or else the folder's name, as the guard of the languages reads a component; a row that
14
+ // names the path itself comes first. Refused, by its name, and nothing written: a path no row
15
+ // names; a row whose cell of the column « Langage » is empty; a language out of the frame's
16
+ // list; a folder that already holds the manifest of its language (`manifeste` of its module). A
17
+ // folder that holds docs/ alone, the documents of the second time, is accepted, as `cargo init`
18
+ // takes a folder without its Cargo.toml.
19
+ // - The skeleton: the module of the row's language gives the files of the package and the entry
20
+ // of the workspace (`squelette`, scripts/jointure.d.ts), the versions of its tools from its
21
+ // template (`miseAJour.gabarit`); the documents of the package, docs/CADRE.md and
22
+ // docs/INTERFACE.md, come from the frame's template of a package (`templates/paquet/`), its name
23
+ // and its language written in. Each file absent is written, a file present stays; the manifest
24
+ // of the workspace receives the entry. The command commits nothing: the second and the third
25
+ // times enter one commit, after a green verification.
26
+ // - The tools of the language, as `nx add` installs them before the first generator: the share
27
+ // of the update of each declared language (`mettreAJour` of ./grillhouse-maj.mjs: its tools at
28
+ // its template's versions, its scripts, its files, `turbo.json` for typescript), then `npm
29
+ // install` when the update asks it, the module's command that locks the versions of the new
30
+ // package (`verrouiller`), the binaries of the declared languages (`installerBinaires`), and the
31
+ // generators (`regenerer`), those of the package's language whatever files the project holds:
32
+ // the first package of a language receives its boundaries' configuration and its index.
33
+ // - The report: each file written, then the lines of the update; on the error stream, each
34
+ // command that fails, named with its output. The exit code: 0; 1 for a refusal (⛔ and its
35
+ // reason) or a command that fails; 2 for the usage.
36
+ import { spawnSync } from 'node:child_process';
37
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
38
+ import path from 'node:path';
39
+ import { pathToFileURL } from 'node:url';
40
+ import { CADRE } from './cadre.mjs';
41
+ import {
42
+ aInstaller,
43
+ installerBinaires,
44
+ mettreAJour,
45
+ rapport,
46
+ regenerer,
47
+ } from './grillhouse-maj.mjs';
48
+ import { LANGAGES, langage } from './langages.mjs';
49
+ import {
50
+ ARCHITECTURE,
51
+ colonneDesNoms,
52
+ COLONNE,
53
+ langageDeLaCellule,
54
+ nomme,
55
+ nomsDe,
56
+ tableauxDesComposants,
57
+ } from './tableau-des-composants.mjs';
58
+
59
+ /** The frame's template of the documents of a package, from the frame's files. */
60
+ export const GABARIT_DU_PAQUET = 'templates/paquet';
61
+ const DOCUMENTS = ['docs/CADRE.md', 'docs/INTERFACE.md'];
62
+
63
+ /** A refusal of the command, its message the reason. */
64
+ export class Refus extends Error {}
65
+
66
+ // <chemin> from the root of the project at <racine>, `/` its separator, without `./` nor a
67
+ // trailing `/`; refused out of the project or at its root.
68
+ function normaliser(racine, chemin) {
69
+ const rel = path.relative(racine, path.resolve(racine, chemin)).split(path.sep).join('/');
70
+ if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) {
71
+ throw new Refus(`${chemin} : un paquet vit dans un dossier du projet, sous sa racine.`);
72
+ }
73
+ return rel;
74
+ }
75
+
76
+ /**
77
+ * The row of the tables of the components of the project at <racine> that names the package at
78
+ * <rel> (from the root): `{ ligne, langage }`, `ligne` its number in docs/ARCHITECTURE.md, `langage`
79
+ * its cell of the column « Langage » (empty for none); null when no row names it.
80
+ * @param {string} racine
81
+ * @param {string} rel
82
+ */
83
+ export function ligneDuPaquet(racine, rel) {
84
+ const virtuel = { dossier: path.join(racine, rel), nom: path.posix.basename(rel), paquet: null };
85
+ const trouvees = tableauxDesComposants(racine).flatMap(t => {
86
+ const colonne = colonneDesNoms(t.lignes, [virtuel], racine, t.colonne);
87
+ return colonne < 0
88
+ ? []
89
+ : t.lignes
90
+ .filter(l => nomme(nomsDe(l.cellules[colonne]), virtuel, racine))
91
+ .map(l => ({
92
+ exacte: nomsDe(l.cellules[colonne]).includes(rel),
93
+ ligne: l.index + 1,
94
+ langage: langageDeLaCellule(l.cellules[t.colonne]),
95
+ }));
96
+ });
97
+ const l = trouvees.find(x => x.exacte) ?? trouvees[0];
98
+ return l ? { ligne: l.ligne, langage: l.langage } : null;
99
+ }
100
+
101
+ const lireJson = f => (existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')) : {});
102
+
103
+ /**
104
+ * The plan of the package at <chemin> of the project at <racine>, nothing written: `{ chemin,
105
+ * langage, fichiers, espace, verrouiller }`, `fichiers` the skeleton of its language and its
106
+ * documents (path from the root → text), `espace` the manifest of the workspace with its entry
107
+ * (null when it holds it), `verrouiller` the command that locks its versions. Throws a Refus, by
108
+ * its name, for a path no row names, a row without language, a language out of the frame's list,
109
+ * or a folder that holds the manifest of its language.
110
+ * @param {string} racine the root of the project
111
+ * @param {string} chemin the package's folder, from the root
112
+ * @param {{ source?: string }} [o] the frame's files (CADRE)
113
+ */
114
+ export function planDuPaquet(racine, chemin, { source = CADRE } = {}) {
115
+ const rel = normaliser(racine, chemin);
116
+ const l = ligneDuPaquet(racine, rel);
117
+ if (!l) {
118
+ throw new Refus(
119
+ `${rel} : aucune ligne d'un tableau des composants de ${ARCHITECTURE} ne le nomme ; le grill tranche le paquet, puis sa ligne s'y écrit avec son langage (colonne « ${COLONNE} »), avant la commande.`
120
+ );
121
+ }
122
+ const ou = `${ARCHITECTURE}:${l.ligne}`;
123
+ if (!l.langage) {
124
+ throw new Refus(
125
+ `${rel} : sa ligne (${ou}) ne nomme pas son langage ; la colonne « ${COLONNE} » le déclare (les langages du cadre : ${Object.keys(LANGAGES).join(', ')}).`
126
+ );
127
+ }
128
+ if (!Object.hasOwn(LANGAGES, l.langage)) {
129
+ throw new Refus(
130
+ `${rel} : langage inconnu du cadre, ${l.langage} (${ou}) ; les langages du cadre : ${Object.keys(LANGAGES).join(', ')}.`
131
+ );
132
+ }
133
+ const m = langage(l.langage);
134
+ if (existsSync(path.join(racine, rel, m.manifeste))) {
135
+ throw new Refus(
136
+ `${rel} : le dossier porte déjà son ${m.manifeste} ; le paquet existe, un ticket de code le travaille par le circuit.`
137
+ );
138
+ }
139
+ const modele = lireJson(path.join(source, m.miseAJour.gabarit, 'package.json'));
140
+ let s;
141
+ try {
142
+ s = m.squelette(racine, { chemin: rel, modele });
143
+ } catch (e) {
144
+ throw new Refus(e.message);
145
+ }
146
+ const nom = path.posix.basename(rel);
147
+ const documents = Object.fromEntries(
148
+ DOCUMENTS.map(d => [
149
+ `${rel}/${d}`,
150
+ readFileSync(path.join(source, GABARIT_DU_PAQUET, d), 'utf8')
151
+ .replaceAll('<nom>', nom)
152
+ .replaceAll('<langage>', l.langage),
153
+ ])
154
+ );
155
+ return {
156
+ chemin: rel,
157
+ langage: m,
158
+ fichiers: { ...s.fichiers, ...documents },
159
+ espace: s.espace,
160
+ verrouiller: s.verrouiller,
161
+ };
162
+ }
163
+
164
+ /**
165
+ * Writes the plan <plan> (`planDuPaquet`) in the project at <racine>: each file absent, then the
166
+ * manifest of the workspace. Returns the files written, from the root.
167
+ * @param {string} racine
168
+ * @param {ReturnType<typeof planDuPaquet>} plan
169
+ */
170
+ export function ecrireLePaquet(racine, plan) {
171
+ const ecrits = [];
172
+ for (const [f, texte] of Object.entries(plan.fichiers)) {
173
+ const abs = path.join(racine, f);
174
+ if (existsSync(abs)) {
175
+ continue;
176
+ }
177
+ mkdirSync(path.dirname(abs), { recursive: true });
178
+ writeFileSync(abs, texte);
179
+ ecrits.push(f);
180
+ }
181
+ if (plan.espace) {
182
+ writeFileSync(path.join(racine, plan.espace.fichier), plan.espace.texte);
183
+ ecrits.push(plan.espace.fichier);
184
+ }
185
+ return ecrits;
186
+ }
187
+
188
+ // Runs <commande> <args> in <dossier>, its output this process's error stream; its code.
189
+ const lancer = (commande, args, dossier) =>
190
+ spawnSync(commande, args, { cwd: dossier, stdio: ['ignore', 2, 2] }).status ?? 1;
191
+
192
+ /**
193
+ * Creates the package at <chemin> of the project at <racine>: its plan written, then the tools of
194
+ * its language (see the header). Returns `{ ecrits, lignes, echecs }`: the files written, the
195
+ * lines of the report, the lines of each command that fails. Throws a Refus as `planDuPaquet`.
196
+ * @param {string} racine
197
+ * @param {string} chemin
198
+ * @param {{ source?: string, executer?: (commande: string, args: string[], dossier: string) => number }} [o]
199
+ */
200
+ export function creerPaquet(racine, chemin, { source = CADRE, executer = lancer } = {}) {
201
+ const plan = planDuPaquet(racine, chemin, { source });
202
+ const ecrits = ecrireLePaquet(racine, plan);
203
+ const b = mettreAJour(racine, source);
204
+ const echecs = [];
205
+ const vus = new Set();
206
+ const jouer = (commande, args, dossier) => {
207
+ const cle = JSON.stringify([commande, ...args, dossier]);
208
+ if (vus.has(cle)) {
209
+ return;
210
+ }
211
+ vus.add(cle);
212
+ const code = executer(commande, args, path.join(racine, dossier));
213
+ if (code !== 0) {
214
+ echecs.push(
215
+ `\`${[commande, ...args].join(' ')}\` (${dossier}) échoue, code ${code} ; lance-le, puis \`npx grillhouse maj\`.`
216
+ );
217
+ }
218
+ };
219
+ if (aInstaller(b)) {
220
+ jouer('npm', ['install'], '.');
221
+ }
222
+ const v = plan.verrouiller;
223
+ jouer(v.commande, v.args, v.dossier);
224
+ const binaires = installerBinaires(racine);
225
+ echecs.push(...binaires.lignes, ...regenerer(racine, { langage: plan.langage.nom }));
226
+ const lignes = rapport(b)
227
+ .split('\n')
228
+ .filter(Boolean)
229
+ .concat(
230
+ binaires.installes.length ? [`Binaires installés : ${binaires.installes.join(', ')}.`] : []
231
+ );
232
+ return { ecrits, lignes, echecs };
233
+ }
234
+
235
+ const USAGE =
236
+ 'Usage : npx grillhouse paquet <chemin> crée le paquet que sa ligne de docs/ARCHITECTURE.md déclare\n';
237
+
238
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
239
+ const args = process.argv.slice(2);
240
+ if (args.length !== 1 || args[0].startsWith('-')) {
241
+ process.stderr.write(USAGE);
242
+ process.exitCode = 2;
243
+ } else {
244
+ try {
245
+ const { ecrits, lignes, echecs } = creerPaquet(process.cwd(), args[0]);
246
+ process.stdout.write(
247
+ `Paquet ${args[0]} : ${ecrits.join(', ') || 'aucun fichier'} écrits ; rien n'est commité.\n${lignes.map(l => `${l}\n`).join('')}`
248
+ );
249
+ for (const l of echecs) {
250
+ process.stderr.write(`${l}\n`);
251
+ }
252
+ process.exitCode = echecs.length ? 1 : 0;
253
+ } catch (e) {
254
+ if (!(e instanceof Refus)) {
255
+ throw e;
256
+ }
257
+ process.stderr.write(`⛔ ${e.message}\n`);
258
+ process.exitCode = 1;
259
+ }
260
+ }
261
+ }
@@ -11,7 +11,8 @@
11
11
  // exists only when a reader reads it:
12
12
  // - `statut` (FAIT, BLOQUÉ, BESOIN), with `raison` for BLOQUÉ and `question` for BESOIN, each
13
13
  // with its `piece`: the circuit goes on, or stops at « hors-portee » or « besoin », the piece
14
- // with the stop (testwriter, developpeur);
14
+ // with the stop (testwriter, developpeur, and the explorateur's gesture of a mechanical ticket,
15
+ // its own schema, `geste`);
15
16
  // - `verts_attendus` (`fichier` from the root, `test` its full name, or none for every green of a
16
17
  // file HEAD holds, `raison`): the proof of the red (testwriter);
17
18
  // - `renvoi` (`role` testwriter): the circuit relaunches the testwriter, then the proof and the
@@ -64,9 +65,23 @@
64
65
  // a removal of a criterion written among them, go up to the supervisor, each naming why: the
65
66
  // language, the architecture, a gap to the reference, or no answer (BP 328: a question the
66
67
  // ticket settled stopped the plan) (explorateur);
68
+ // - `sorte` (`genre` mécanique or comportement, its `raison`, the `commande` a mechanical ticket
69
+ // plays, and, for a comportement, `comportement` changé or inchangé): as Google's large-scale
70
+ // changes let a tool make a change that a verification and a review judge (Rosie, ClangMR),
71
+ // a ticket the plan says mechanical skips the testwriter, the proof and the developpeur, and
72
+ // under a plan « comportement inchangé » every green of the proof is expected and the
73
+ // developpeur writes the code; a sort
74
+ // absent, out of its kinds, or without its reason or its command is comportement, the whole
75
+ // circuit (`sorteDuPlan`, grillhouse-sos) (explorateur);
67
76
  // - `ecartes` (`composant`, `raison`): the components of the survey the plan does not touch,
68
77
  // which the circuit writes at the ticket; each other component of the survey the circuit
69
78
  // plays is in the packages (explorateur);
79
+ // - `noms_publies` (`fournisseur`, `consommateur`, `noms`): the names a component publishes to
80
+ // another, which the lot adds to the provider's « Consommateurs » lines; as a code owner's
81
+ // approval covers what it reviewed, the circuit writes them in the description (« ## Noms
82
+ // publiés »), which scripts/langages/typescript/consommateurs-arbitres.mjs reads (BP
83
+ // 320.14.2.10: a criterion alone named them, the guard refused the lot) (grillhouse-la3)
84
+ // (explorateur);
70
85
  // - `reponses` (`numero` of the question, `reponse` CHANGE or GARDE, `texte`): the explorateur's
71
86
  // one answer to the questionneur, which the circuit writes at the ticket; a question without
72
87
  // an answer stays open (explorateur);
@@ -186,6 +201,10 @@ export const VERDICTS_ROUVERTS = ['a-porter', 'non-confirmee'];
186
201
  // The verdicts whose piece is a command played again on main and its output, or file:line.
187
202
  const VERDICTS_PROUVES = ['traitee', 'a-porter'];
188
203
 
204
+ // The sorts of a ticket the explorateur judges at the plan (grillhouse-sos): a gesture without new
205
+ // behaviour, which its command makes, or a change of behaviour, which the circuit of code makes.
206
+ export const SORTES = ['mécanique', 'comportement'];
207
+
189
208
  // The schema of the sheet of each role the circuit leads, and of the tri of the discoveries
190
209
  // (`tri`), the explorateur's after the queue.
191
210
  const FICHES = {
@@ -199,6 +218,28 @@ const FICHES = {
199
218
  texte('Un paquet, comme le titre le nomme : le nom de son paquet, ou son chemin.'),
200
219
  'Les paquets à toucher, le fournisseur d’abord ; le circuit les écrit au titre, et chaque séance n’écrit qu’eux.'
201
220
  ),
221
+ sorte: objet(
222
+ {
223
+ genre: {
224
+ type: 'string',
225
+ enum: SORTES,
226
+ description:
227
+ 'mécanique : un geste sans comportement neuf (montée du cadre, documents seuls, renommage ou déplacement, montée de dépendance, configuration seule, correction de style, seuil relevé), que sa commande fait ; comportement : tout autre ticket, et tout doute.',
228
+ },
229
+ raison: texte('Pourquoi le ticket est de cette sorte.'),
230
+ commande: texte(
231
+ 'mécanique : la commande ou l’outil qui fait le geste, tel qu’il se lance à la racine de la copie.'
232
+ ),
233
+ comportement: {
234
+ type: 'string',
235
+ enum: ['changé', 'inchangé'],
236
+ description:
237
+ 'comportement : inchangé quand le lot ne change aucun comportement que ses tests mesurent (un test adapté, un seuil relevé dans un test) ; changé sinon.',
238
+ },
239
+ },
240
+ ['genre', 'raison'],
241
+ 'La sorte du ticket, et sa raison ; un ticket mécanique saute le testwriter, la preuve du rouge et le développeur. Une sorte absente vaut comportement.'
242
+ ),
202
243
  ecartes: liste(
203
244
  objet(
204
245
  {
@@ -209,6 +250,22 @@ const FICHES = {
209
250
  ),
210
251
  'Les composants du relevé que le plan ne touche pas, chacun avec sa raison ; chaque autre composant du relevé est dans tes paquets.'
211
252
  ),
253
+ noms_publies: liste(
254
+ objet(
255
+ {
256
+ fournisseur: texte('Le composant qui publie, comme le titre le nomme.'),
257
+ consommateur: texte(
258
+ 'Le composant qui les lit, comme sa ligne « Consommateurs » de l’INTERFACE du fournisseur le nomme.'
259
+ ),
260
+ noms: liste(
261
+ texte('Un nom publié, tel que la ligne « Consommateurs » l’écrit.'),
262
+ 'Les noms que le lot ajoute à la ligne de ce consommateur.'
263
+ ),
264
+ },
265
+ ['fournisseur', 'consommateur', 'noms']
266
+ ),
267
+ 'Les noms qu’un composant publie à un autre et que le lot ajoute aux lignes « Consommateurs » de l’INTERFACE du fournisseur, un par consommateur ; le circuit les écrit dans « ## Noms publiés », que la garde des consommateurs lit. Une liste vide efface la section ; sans le champ, le circuit garde celle que la description porte.'
268
+ ),
212
269
  questions: liste(
213
270
  objet(
214
271
  {
@@ -240,6 +297,8 @@ const FICHES = {
240
297
  },
241
298
  ['criteres', 'paquets', 'questions']
242
299
  ),
300
+ // The explorateur's sheet after the gesture of a mechanical ticket (1.1), in the copy.
301
+ geste: objet({ ...STATUT, ...DECOUVERTES }, ['statut']),
243
302
  testwriter: objet(
244
303
  {
245
304
  ...STATUT,
@@ -426,6 +485,22 @@ const FICHES = {
426
485
  // The schema of the sheet of <role>, or null for a role the circuit does not lead.
427
486
  export const schemaDeFiche = role => FICHES[role] ?? null;
428
487
 
488
+ // The sort of the ticket the explorateur's sheet of the plan <fiche> says (`sorte`): `{ genre:
489
+ // 'mécanique', raison, commande }` for a mechanical ticket with its reason and its command; else
490
+ // `{ genre: 'comportement', raison, inchange }`, `inchange` for a plan « comportement inchangé »
491
+ // with its reason. A sort absent, out of its kinds or without what it needs is comportement, the
492
+ // whole circuit, as a doubt goes to the circuit (grillhouse-sos).
493
+ export function sorteDuPlan(fiche) {
494
+ const s = fiche?.sorte;
495
+ const plein = v => typeof v === 'string' && v.trim() !== '';
496
+ const raison = s && typeof s === 'object' && plein(s.raison) ? s.raison.trim() : null;
497
+ if (raison && s.genre === 'mécanique' && plein(s.commande)) {
498
+ return { genre: 'mécanique', raison, commande: s.commande.trim() };
499
+ }
500
+ const inchange = Boolean(raison) && s.genre === 'comportement' && s.comportement === 'inchangé';
501
+ return { genre: 'comportement', raison, inchange };
502
+ }
503
+
429
504
  // The errors of <valeur> against <schema>, each naming its field by its path <ou>.
430
505
  function erreurs(schema, valeur, ou) {
431
506
  const nom = ou || 'la fiche';
@@ -41,6 +41,7 @@ export const SOUS_COMMANDES = {
41
41
  'ligne-etat': 'ligne-etat/ligne-etat.mjs',
42
42
  maj: 'grillhouse-maj.mjs',
43
43
  nuit: 'nuit.sh',
44
+ paquet: 'paquet.mjs',
44
45
  pression: 'mesure/pression.mjs',
45
46
  registre: 'registre.mjs',
46
47
  resultats: 'resultats.mjs',
@@ -5,7 +5,7 @@
5
5
  // (./migrations/0.27.0-langages-dans-l-architecture.mjs).
6
6
  //
7
7
  // - A table of the components is a table of Markdown of docs/ARCHITECTURE.md whose header holds a
8
- // column « Langage » (COLONNE): BPScript's table of the stages, and its section « Les paquets »
8
+ // column « Langage » (COLONNE), or « Language » in a document written in English: BPScript's table of the stages, and its section « Les paquets »
9
9
  // for the packages that table does not name; each counts, in the order of the document. A row
10
10
  // declares a package when its cell of that column is not empty: the language is that cell, its backquotes and its case left out. A row
11
11
  // with an empty cell names a part that is no package of the project (a crate of another
@@ -23,8 +23,10 @@ import path from 'node:path';
23
23
 
24
24
  /** The document that holds the table, from the root of the project. */
25
25
  export const ARCHITECTURE = 'docs/ARCHITECTURE.md';
26
- /** The header of the column of the languages. */
26
+ /** The header of the column of the languages, as the migration writes it. */
27
27
  export const COLONNE = 'Langage';
28
+ // The headers read as that column: the document's language names it, French or English.
29
+ const NOMS = [COLONNE, 'Language'].map(n => n.toLowerCase());
28
30
 
29
31
  // The cells of the row <ligne> of a table, its outer pipes left out.
30
32
  export function cellules(ligne) {
@@ -76,7 +78,7 @@ export function tableaux(texte) {
76
78
 
77
79
  /** The index of the column of the languages in the header <entete>, -1 without one. */
78
80
  export const colonneDesLangages = entete =>
79
- entete.findIndex(c => c.replace(/[`*]/g, '').trim().toLowerCase() === COLONNE.toLowerCase());
81
+ entete.findIndex(c => NOMS.includes(c.replace(/[`*]/g, '').trim().toLowerCase()));
80
82
 
81
83
  /**
82
84
  * The tables of the components of the project at <racine> (each table whose header holds the
@@ -1145,7 +1145,9 @@ const couperAvant = (gauche, suite, droite, largeur) => {
1145
1145
  // The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
1146
1146
  // discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
1147
1147
  // ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
1148
- // `chantier`. The head belongs to agents, the first section; a blank line belongs to the section
1148
+ // `chantier`. A ticket's line in AGENTS names the step it stands under (`etape`: its `numero`,
1149
+ // null after the steps, and `titre`) and, stopped on a question, who must answer it (`question`):
1150
+ // the pane that fuses several projects' boards sorts their tickets by it. The head belongs to agents, the first section; a blank line belongs to the section
1149
1151
  // of the title after it. A chantier's « sans go » and « reporté » groups, its « à valider » group
1150
1152
  // past SEUIL_REPLI tickets, and the other chantiers beside one in progress fold to their title and
1151
1153
  // count: the folded title carries its group's key (`groupe`), and `groupes` receives, under that
@@ -1267,7 +1269,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1267
1269
  ...[...(t.circuits ?? []), ...montres].map(x => String(x.numero).length)
1268
1270
  );
1269
1271
  const numero = n => String(n).padEnd(colonne);
1270
- const ligneDuCircuit = c => {
1272
+ // The step a ticket's line stands under, as data: its number (null after the steps) and title.
1273
+ const etapeDuBloc = b => ({ numero: b.numero, titre: b.titre });
1274
+ const ligneDuCircuit = (c, b, qui) => {
1271
1275
  const droite = conso(t.parTicket?.[c.id]?.travail ?? 0, t.parTicket?.[c.id]?.jetons ?? 0);
1272
1276
  const etape = etapeDe(c);
1273
1277
  const boucles = (etape ? bouclesDe(etape) : [])
@@ -1288,6 +1292,8 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1288
1292
  texte: couperAvant(`${tete}${c.sujet}`, suite, droite, largeur),
1289
1293
  ton: temoin?.fige ? 'alerte' : c.vivant ? 'actif' : 'attention',
1290
1294
  ticket: c.id,
1295
+ etape: etapeDuBloc(b),
1296
+ ...(qui ? { question: qui } : {}),
1291
1297
  ...(temoin ? { avancement: true } : {}),
1292
1298
  });
1293
1299
  };
@@ -1316,14 +1322,15 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1316
1322
  const tickets = (b, retrait) => {
1317
1323
  const { circuits, enQuestions, enCours, attend } = contenus.get(b);
1318
1324
  for (const c of circuits) {
1319
- ligneDuCircuit(c);
1325
+ ligneDuCircuit(c, b);
1320
1326
  }
1321
1327
  for (const x of enCours) {
1322
- L(
1323
- cadre(`▶ ${numero(x.numero)} ${x.sujet}`, conso(x.travail, x.jetons), largeur),
1324
- 'actif',
1325
- x.id
1326
- );
1328
+ poser({
1329
+ texte: cadre(`▶ ${numero(x.numero)} ${x.sujet}`, conso(x.travail, x.jetons), largeur),
1330
+ ton: 'actif',
1331
+ ticket: x.id,
1332
+ etape: etapeDuBloc(b),
1333
+ });
1327
1334
  }
1328
1335
  const attente = x => ({
1329
1336
  texte: cadre(
@@ -1333,12 +1340,13 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1333
1340
  ),
1334
1341
  ton: 'discret',
1335
1342
  ticket: x.id,
1343
+ etape: etapeDuBloc(b),
1336
1344
  });
1337
1345
  poser(...attend.map(attente));
1338
1346
  for (const [qui, l] of enQuestions) {
1339
1347
  L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur), 'titre');
1340
1348
  for (const c of l) {
1341
- ligneDuCircuit(c);
1349
+ ligneDuCircuit(c, b, qui);
1342
1350
  }
1343
1351
  }
1344
1352
  };
@@ -1668,7 +1676,8 @@ const bdJson = (racine, ...args) => {
1668
1676
  }
1669
1677
  };
1670
1678
 
1671
- // The board of the repository at <racine>.
1679
+ // The board of the repository at <racine>, with its ticket prefix (`prefixe`), which labels its
1680
+ // lines in a pane that fuses several projects.
1672
1681
  export function tableau(racine, { home = os.homedir(), maintenant = Date.now() } = {}) {
1673
1682
  let prefix = '';
1674
1683
  try {
@@ -1773,6 +1782,7 @@ export function tableau(racine, { home = os.homedir(), maintenant = Date.now() }
1773
1782
  }
1774
1783
  return {
1775
1784
  ...t,
1785
+ prefixe: prefix,
1776
1786
  lignes: l,
1777
1787
  vueEtats: vue,
1778
1788
  groupes,
@@ -145,6 +145,9 @@ son adresse) : le circuit la consigne fermée sous ton ticket, et tu continues.
145
145
  projet déclare, un plafond par exemple. Leur rouge n'est pas le tien : ta séance ne s'arrête pas sur elles,
146
146
  et ta fiche finit FAIT sur ta part. Exemple : en 320.8 de BPScript, un développeur aux tests
147
147
  verts s'est arrêté sur le plafond des mots, la dette et l'index, que 4.2 a régénérés ensuite.
148
+ Le circuit les régénère avant de te rendre tes rouges : un test qui les lit, sous « Tes rouges »,
149
+ a déjà été jugé sur elles régénérées. Exemple : en 320.6.5 de BPScript, un test qui lisait les
150
+ `turbo.json` périmés est allé au développeur, qui ne pouvait pas les écrire.
148
151
  Un constat de leur garde sur ton code reste le tien, sous « Tes rouges », comme le refus de leur
149
152
  commande qu'il cause : un plafond ne monte jamais. Exemple : en 320.10 de BPScript, le mot
150
153
  « door » écrit dans 030-binder dépassait le plafond des mots. Ainsi le geste mécanique reste au
@@ -1,20 +1,22 @@
1
1
  ---
2
2
  name: explorateur
3
- description: "L'explorateur : écrire le plan d'un ticket à l'étape 1 de son circuit — ses critères, les paquets à toucher, ses questions ouvertes — et répondre une fois au questionneur ; trier ses découvertes à l'étape 5.3, une fois son lot sur main ; ou mener un ticket d'exploration — relever l'état réel du code, lister les décisions à prendre, proposer les tickets de réalisation. Chargé par l'agent explorateur, que lance le circuit ou le superviseur ; n'écrit aucun code."
3
+ description: "L'explorateur : écrire le plan d'un ticket à l'étape 1 de son circuit — ses critères, les paquets à toucher, ses questions ouvertes — et répondre une fois au questionneur ; jouer le geste d'un ticket mécanique à l'étape 1.1 ; trier ses découvertes à l'étape 5.3, une fois son lot sur main ; ou mener un ticket d'exploration — relever l'état réel du code, lister les décisions à prendre, proposer les tickets de réalisation. Chargé par l'agent explorateur, que lance le circuit ou le superviseur ; n'écrit aucun code."
4
4
  ---
5
5
 
6
6
  # Explorateur — relever avant de réaliser
7
7
 
8
8
  Je suis l'auteur du plan, comme l'auteur d'une RFC : je relève l'existant, j'écris le plan, une
9
9
  revue le lit une fois, je réponds une fois, et ce qui reste ouvert va à qui décide. Je n'écris
10
- aucun code ; le dépôt reste tel que je l'ai trouvé. Ainsi le découpage se décide avant le code, et
10
+ aucun code ; le dépôt reste tel que je l'ai trouvé, hors de la copie d'un ticket mécanique, où la
11
+ commande que mon plan nomme fait le geste. Ainsi le découpage se décide avant le code, et
11
12
  chaque réalisation part petite et testable.
12
13
 
13
14
  Je travaille de deux façons :
14
15
 
15
16
  - **Dans le circuit d'un ticket**, à l'étape 1 Plan (`packages/grillhouse/scripts/etapes.mjs`),
16
17
  avant le premier testwriter : j'écris le plan, puis je réponds une fois aux questions du
17
- questionneur. Ma consigne porte le ticket. À l'étape 5.3, son lot entré sur main, je mène le
18
+ questionneur. Ma consigne porte le ticket. À l'étape 1.1, sur un ticket que mon plan dit
19
+ mécanique, je joue sa commande dans la copie. À l'étape 5.3, son lot entré sur main, je mène le
18
20
  tri des découvertes du ticket.
19
21
  - **Sur un ticket d'exploration**, en sous-agent du superviseur : je relève, je liste les
20
22
  décisions, je propose les tickets de réalisation.
@@ -64,10 +66,32 @@ change, et ceux qu'il peut casser.
64
66
  - `paquets` : les paquets à toucher, le fournisseur d'abord, puis ses lecteurs, chacun comme le
65
67
  titre le nomme (le nom de son paquet, ou son chemin) ; le circuit les écrit au titre, et
66
68
  chaque séance du ticket n'écrit qu'eux ;
69
+ - `sorte` : la sorte du ticket, et sa `raison`. `mécanique` pour un geste sans comportement
70
+ neuf (montée du cadre, documents seuls, renommage ou déplacement, montée de dépendance,
71
+ configuration seule, correction de style, seuil relevé), avec sa `commande`, la commande ou
72
+ l'outil qui fait le geste, telle qu'elle se lance à la racine de la copie, comme Rosie et
73
+ ClangMR font un grand changement chez Google, Renovate une montée de dépendance, `nx migrate`
74
+ une montée du cadre, `eslint --fix` une correction de style : le circuit saute alors le
75
+ testwriter, la preuve du rouge et le développeur. Une configuration dont une garde mesure
76
+ l'effet, et le texte qui accompagne un changement de comportement, restent au circuit ;
77
+ un doute va au circuit : `comportement`. Un ticket de comportement dont le lot ne change
78
+ aucun comportement que ses tests mesurent (un test adapté, un seuil relevé dans un test)
79
+ porte `comportement` `inchangé`, le plan « comportement inchangé » : sa preuve accepte chaque
80
+ vert de son lot, puis le développeur écrit le code (une réorganisation en a), les contrôles
81
+ et la relecture. Une sorte absente, ou sans sa raison, ou mécanique sans sa commande, vaut
82
+ `comportement` : le circuit entier ;
67
83
  - `ecartes` : chaque composant du relevé que le plan ne touche pas, avec sa raison (il n'a
68
84
  rien à changer, par exemple) ; le circuit l'écrit au ticket. Le circuit rejoue le relevé sur
69
85
  mon plan : un composant qui n'est ni dans `paquets` ni dans `ecartes` rend ma fiche non
70
86
  conforme ;
87
+ - `noms_publies` : quand le lot ajoute un nom à une ligne « Consommateurs » de l'INTERFACE d'un
88
+ fournisseur (un composant publie un nom neuf à un autre, ou un consommateur lit un nom de
89
+ plus), une entrée par consommateur : le `fournisseur`, le `consommateur` comme sa ligne le
90
+ nomme, et ses `noms` tels que la ligne les écrit. Le circuit les écrit dans
91
+ « ## Noms publiés » de la description, réécrite à chaque plan, et la garde des consommateurs
92
+ laisse entrer ces lignes sans arbitrage ; un nom qu'un critère seul nomme reste refusé. Je
93
+ reprends ceux que la section porte déjà. Une liste vide efface la section ; sans le champ,
94
+ le circuit garde la section que la description porte ;
71
95
  - `questions` : seulement ce que je ne sais pas trancher, ou ce qui revient au responsable. Ce
72
96
  que je sais trancher et recommande, je l'applique au plan (écarter un paquet qui n'a rien à
73
97
  changer, par exemple) et je le dis dans ma fiche. Chaque question : chacune avec ses options, ma recommandation et sa
@@ -83,7 +107,8 @@ change, et ceux qu'il peut casser.
83
107
  3. **La réponse.** Le circuit reprend ma séance avec les questions du questionneur, numérotées. Je
84
108
  réponds une seule fois, à chacune : CHANGE, et ce que le plan devient, ou GARDE, et pourquoi il
85
109
  reste tel quel. Ma fiche porte aussi le plan tel qu'il devient, ses `questions` ouvertes
86
- comprises. Chaque question posée a sa ligne dans mes `reponses`, même quand je réponds par des
110
+ et sa `sorte` comprises ; sans `sorte`, le circuit garde celle de mon plan, et sans
111
+ `noms_publies`, ceux de mon plan. Chaque question posée a sa ligne dans mes `reponses`, même quand je réponds par des
87
112
  critères ajoutés : une fiche sans elle est refusée, et le circuit me la redemande une fois avec
88
113
  les numéros qui manquent ; après, une question sans ligne reste ouverte. _Fini quand_ chaque
89
114
  question a sa ligne.
@@ -91,6 +116,19 @@ change, et ceux qu'il peut casser.
91
116
  Je n'écris ni fichier ni plan au ticket : le circuit l'écrit depuis ma fiche. Ainsi le plan a une
92
117
  seule source, et les paquets un seul format.
93
118
 
119
+ ## Dans le circuit : le geste mécanique
120
+
121
+ À l'étape 1.1, sur un ticket que mon plan dit mécanique, le circuit me lance une fois dans la copie
122
+ du ticket, dans l'enveloppe de ses paquets, avec la commande du plan. Je lance la commande telle
123
+ que le plan la nomme, à la racine de la copie, puis je lis ce qu'elle change (son état et sa
124
+ différence, par git). Je n'écris rien à la main : ni code, ni test, ni document. Ma fiche, le
125
+ schéma `geste` : `statut` FAIT quand la commande a joué ; BLOQUÉ avec sa `raison` et sa `piece`
126
+ (« $ <commande> » et sa sortie) quand elle échoue ou ne fait pas le geste que dit le plan ;
127
+ BESOIN avec ma `question` quand une réponse me manque. Le circuit juge le lot ensuite : les
128
+ contrôles du plan, la passe finale, la relecture et l'intégration ; une copie que la commande
129
+ laisse sans changement du plan l'arrête. _Fini quand_ la commande a joué, ou que ma fiche dit
130
+ pourquoi elle ne joue pas.
131
+
94
132
  ## Dans le circuit : le tri des découvertes
95
133
 
96
134
  À l'étape 5.3, une fois le lot du ticket entré sur main, le circuit me lance sur les découvertes
@@ -133,7 +133,12 @@ remplace jamais le grill. Les branches de l'arbre :
133
133
  le reprend (`**Langage** : <nom>`). La garde `grillhouse langages-des-paquets` refuse un paquet
134
134
  que le tableau ne déclare pas, un paquet dont le manifeste suit un autre langage (un
135
135
  `package.json` pour `typescript`, un `Cargo.toml` pour `cargo`, un `pyproject.toml` pour
136
- `python`), un dossier déclaré sans ce manifeste, et une interface qui en nomme un autre. **Plusieurs paquets,
136
+ `python`), un dossier déclaré sans ce manifeste, et une interface qui en nomme un autre.
137
+ **Un paquet neuf naît en quatre temps, hors du circuit** (charte commune) : ce grill tranche
138
+ son rôle, sa frontière, ses refus, son interface et son langage (1) ; le superviseur écrit sa
139
+ ligne et ses documents, relus par le responsable (2) ; `npx grillhouse paquet <chemin>` bâtit
140
+ son squelette et, pour le premier paquet d'un langage, les outils de ce langage (3), dans le
141
+ même commit que 2 ; son code part en ticket ordinaire (4). **Plusieurs paquets,
137
142
  une forme publiée** : chaque paquet publie son entrée dans le champ `exports` de son
138
143
  `package.json`, construite dans `dist/` ; ses tests et leurs données restent dans le paquet.
139
144
  **Les outils du projet, un paquet** : les scripts propres au projet (son typage, ses gardes, ses