@roomi-fields/grillhouse 0.27.0 → 0.28.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.
@@ -90,6 +90,25 @@
90
90
  // passes (`plan`, its fingerprint: its title and its criteria); a plan that passed, its title
91
91
  // and criteria unchanged since, passes with no session, whatever else of its description
92
92
  // changed.
93
+ // - The sheet of the plan says the sort of the ticket (`sorte`, read by `sorteDuPlan` of
94
+ // scripts/resultats.mjs, from the explorateur's last sheet of the plan), which the circuit
95
+ // writes in the description (« ## Sorte », after the criteria) and at the ticket with the plan:
96
+ // mechanical, a gesture without new behaviour, with its reason and the command that makes it;
97
+ // comportement, with its reason, the plan « comportement inchangé » when the lot changes no
98
+ // behaviour; absent or unreadable, comportement, the whole circuit (grillhouse-sos, BPScript
99
+ // 320.16: 38 tools moved by mv through the testwriter and the developpeur, 117 comments). As
100
+ // Google's large-scale changes (Rosie, ClangMR) let a tool make the change that a verification
101
+ // and a review judge, with no new test, a mechanical ticket (`cheminMecanique`: no `--depuis`,
102
+ // no testwriter nor developpeur since the plan) skips the testwriter, the proof and the
103
+ // developpeur, the gesture `mecanique`: at 1.1 one session of the explorateur in the envelope
104
+ // of the plan (lancer.sh `--fiche geste`, its sheet the schema `geste`, its instruction the
105
+ // ninth template) plays in the copy the command the plan names; its BLOQUÉ or BESOIN goes up as
106
+ // any agent's, and a copy that then holds no change of the plan stops at « sans-livraison ». A
107
+ // `--reprendre` at 1.1 whose copy already holds a change of the plan (the supervisor played the
108
+ // command himself) plays no session. Then the checks, the final pass, the review and the
109
+ // integration, as for any lot; a red of the checks or of the final pass that no regeneration
110
+ // lifts stops at « controles », and a RENDU at « relecture-arret » (`arretDuGesteMecanique`),
111
+ // a question for the supervisor, who has the lot corrected (`--depuis developpeur`) or stops.
93
112
  // - Each session is a launch of scripts/enveloppe/lancer.sh, a child process the circuit waits
94
113
  // for, in its own process group, its errors written to a file: a session outlives the death of
95
114
  // its circuit, and the state names its group while it runs. Its plan, the packages it writes (`--paquets`, the envelope's list), is the plan of the
@@ -212,11 +231,15 @@
212
231
  // not told apart. The proof passes with a red (of the lot, existing or of a build), even without
213
232
  // a file of the lot: a testwriter with no new test to write says so in his handover, the existing
214
233
  // reds are enough. It fails with neither a file of the lot nor a red, with a broken file of the
215
- // lot, or with a green of the lot no expected green justifies. A failed proof relaunches the
234
+ // lot, or with a green of the lot no expected green justifies; under a plan « comportement
235
+ // inchangé », nothing has to turn red and every green of the lot is expected, so only a broken
236
+ // file fails it (`preuveReussie`). A failed proof relaunches the
216
237
  // testwriter with its report, twice at most. The report (reds, justified greens) is written at
217
238
  // the ticket. A proof with a red launches the developpeur, and so does a proof without a red
218
- // when a finding of the reviewer still open names him; else it skips him: the lot is a lot of
219
- // tests alone.
239
+ // when a finding of the reviewer still open names him, or under a plan « comportement inchangé »,
240
+ // whose lot has code to write though nothing turns red; else it skips him (`apresLaPreuve`): the
241
+ // lot is a lot of tests alone, and the checks and the review judge it with no session of the
242
+ // developpeur.
220
243
  // - A developpeur is launched on a red, of a proof or of a check, on a finding of the reviewer, or
221
244
  // on a plan without tests: a session that changes no file of the plan (`git status --porcelain`
222
245
  // of its paths and the content of each file it lists, taken before and after the session; the
@@ -449,7 +472,7 @@
449
472
  // 22 of /proc/<pid>/stat), which together name it, a number alone being reused; `questionnement` the work
450
473
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
451
474
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
452
- // the process (scripts/etapes.mjs: testwriter 2, preuve 2.1, developpeur 3, controles 3.1, or 4.1
475
+ // the process (scripts/etapes.mjs: geste 1.1, testwriter 2, preuve 2.1, developpeur 3, controles 3.1, or 4.1
453
476
  // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2, tri
454
477
  // 5.3), or
455
478
  // integre at the end; `raison` names the stop (« arrete » once the supervisor stopped the
@@ -609,6 +632,7 @@ import {
609
632
  reponsesAuxQuestions,
610
633
  RESULTATS,
611
634
  schemaDeFiche,
635
+ sorteDuPlan,
612
636
  VERDICTS_DU_TRI,
613
637
  VERDICTS_ROUVERTS,
614
638
  } from './resultats.mjs';
@@ -645,7 +669,8 @@ const SEANCES_DEVELOPPEUR = boucle('code').max;
645
669
  const RELECTURES = boucle('relecture').max;
646
670
  // The steps of the circuit's state, read from the list of the steps.
647
671
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
648
- const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
672
+ const [GESTE, TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
673
+ '1.1',
649
674
  '2',
650
675
  '2.1',
651
676
  '3',
@@ -1183,6 +1208,8 @@ function lancer(
1183
1208
  ...(fort ? FORT : []),
1184
1209
  ...(ouvre ? ['--seance', ouvre] : []),
1185
1210
  ...(reprend ? ['--reprise', reprend] : []),
1211
+ // The schema of its sheet when it is not its role's (the explorateur's gesture).
1212
+ ...(sorte ? ['--fiche', sorte] : []),
1186
1213
  // The plan of the session: the packages of the title, which it writes; its component the
1187
1214
  // whole copy, which it reads.
1188
1215
  '--paquets',
@@ -1295,7 +1322,7 @@ async function attendreLaSeance(ctx, groupe) {
1295
1322
  // reviewer's, 2 any session's on a sheet absent or out of its schema, 3 the testwriter's and the
1296
1323
  // developpeur's on a resumption, 4 the questionneur's on the plan, 5 the explorateur's on the plan,
1297
1324
  // 6 the explorateur's on the questions of the plan, 7 the explorateur's on the tri of the
1298
- // discoveries), filled with <valeurs>.
1325
+ // discoveries, 8 the explorateur's on the gesture of a mechanical ticket), filled with <valeurs>.
1299
1326
  export function consigne(valeurs, rang = 0) {
1300
1327
  const texte = readFileSync(GABARIT, 'utf8');
1301
1328
  const bloc = [...texte.matchAll(/```text\n([\s\S]*?)\n```/g)][rang];
@@ -2274,6 +2301,87 @@ export function arretDuTestwriterSaute(ctx, texte) {
2274
2301
  );
2275
2302
  }
2276
2303
 
2304
+ // The sheet of the plan that says the sort among the explorateur's sheets of the plan <plans>, in
2305
+ // their order (`{ fiche, reponse }` entries): the last one, or, when it is his answer to the
2306
+ // questionneur (`reponse`) and says none, the plan it answers, so that the sort survives the
2307
+ // answer; null without a sheet of the plan.
2308
+ export function ficheDeLaSorte(plans) {
2309
+ const derniere = plans.at(-1);
2310
+ if (!derniere) return null;
2311
+ if (derniere.reponse && !('sorte' in derniere.fiche) && plans.length > 1) {
2312
+ return plans.at(-2).fiche;
2313
+ }
2314
+ return derniere.fiche;
2315
+ }
2316
+
2317
+ // The sort of the ticket its plan says (`sorteDuPlan` of scripts/resultats.mjs): the sheet of the
2318
+ // plan that says it (`ficheDeLaSorte`), comportement without one (grillhouse-sos).
2319
+ const sorteDuTicket = ctx =>
2320
+ sorteDuPlan(
2321
+ ficheDeLaSorte(
2322
+ lesFiches(ctx).filter(e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres))
2323
+ )
2324
+ );
2325
+
2326
+ // Whether a testwriter or a developpeur has worked the lot since the last sheet of the plan.
2327
+ function lotTravaille(ctx) {
2328
+ const tous = lesFiches(ctx);
2329
+ const plan = tous.findLastIndex(e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres));
2330
+ return tous.slice(plan + 1).some(e => AGENTS_DU_LOT.includes(e.role));
2331
+ }
2332
+
2333
+ // Whether the ticket of <ctx> goes the mechanical path, as Google's large-scale changes (Rosie,
2334
+ // ClangMR) let a tool make the change that a verification and a review judge: its plan says it
2335
+ // mechanical (`ctx.sorte`), no `--depuis` sends its lot to an agent, and no testwriter nor
2336
+ // developpeur has worked it since the plan (grillhouse-sos).
2337
+ export const cheminMecanique = ctx =>
2338
+ ctx.sorte?.genre === 'mécanique' && !ctx.depuis && !lotTravaille(ctx);
2339
+
2340
+ // The step after the plan of sort <sorte> (null when the path is not mechanical): the gesture of
2341
+ // a mechanical ticket (1.1), in place of the testwriter, the proof and the developpeur; the
2342
+ // developpeur of a plan without tests (<sansTests>); else the testwriter.
2343
+ export const etapeApresLePlan = ({ sorte, sansTests }) =>
2344
+ sorte?.genre === 'mécanique' ? GESTE : sansTests ? CODE : TESTS;
2345
+
2346
+ // The step after a proof that passes: the developpeur on a red (<rouges>), on a finding of the
2347
+ // reviewer still open for him (<pourLeDeveloppeur>), or under a plan « comportement inchangé »
2348
+ // (<inchange>), whose lot has code to write though nothing turns red, as a reorganisation does
2349
+ // (decision 3, amended by the owner on 2026-11-01); else the checks, a lot of tests alone, with
2350
+ // no session of the developpeur.
2351
+ export const apresLaPreuve = ({ rouges, pourLeDeveloppeur, inchange }) =>
2352
+ rouges > 0 || pourLeDeveloppeur || inchange ? CODE : CONTROLES;
2353
+
2354
+ // Whether a proof of the counts <compte> passes: no file of the lot that does not load, no green
2355
+ // without its expected green, and a red or a green justified or held by HEAD among the files of
2356
+ // the lot or a red without one. Under a plan « comportement inchangé » (<inchange>), nothing has
2357
+ // to turn red and every green is expected: a proof passes with no file of the lot that does not
2358
+ // load, its reds going to the developpeur.
2359
+ export function preuveReussie(
2360
+ { fichiers, rouges, casses, injustifies, justifies, anciens },
2361
+ { inchange }
2362
+ ) {
2363
+ if (casses > 0) return false;
2364
+ if (inchange) return true;
2365
+ return (fichiers > 0 || rouges > 0) && injustifies === 0 && rouges + justifies + anciens > 0;
2366
+ }
2367
+
2368
+ // The stop for a RENDU of a mechanical lot (`cheminMecanique`), or null: no testwriter nor
2369
+ // developpeur wrote it, so no relaunch treats its findings. An Arret `relecture-arret`, the
2370
+ // verdict <texte> in its report, the findings' pieces as its piece; its question, have the lot
2371
+ // corrected by the developpeur or stop the circuit.
2372
+ export function arretDuGesteMecanique(ctx, texte) {
2373
+ if (!cheminMecanique(ctx)) return null;
2374
+ const pieces = (ctx.constats ?? []).map(c => c.piece ?? c.titre).join('\n');
2375
+ return new Arret(
2376
+ 'relecture-arret',
2377
+ `Le relecteur rend un lot mécanique (${ctx.sorte.raison}), que la commande du plan a fait sans testwriter ni développeur : le circuit ne relance personne.\n\nLe verdict :\n\n${texte}`,
2378
+ {
2379
+ piece: pieces || null,
2380
+ question: `Le lot mécanique est rendu : le faire corriger par le développeur (\`--depuis developpeur --contexte\`), ou arrêter le circuit (\`--arreter\`) et changer le plan.`,
2381
+ }
2382
+ );
2383
+ }
2384
+
2277
2385
  // The integration of the lot: its two patches, its message and the references that write files in
2278
2386
  // full (`--references`, from `lesReferences`, the one list), written from the copy, then
2279
2387
  // scripts/integration/integrer.mjs from the main tree, its output added to the log. A run « à
@@ -2819,6 +2927,8 @@ function preuve(ctx) {
2819
2927
  let anciens = 0;
2820
2928
  const reportes = [];
2821
2929
  const mesure = mesureDeLaPreuve(ctx, liste, fichiers);
2930
+ // A plan « comportement inchangé »: every green of the lot is expected.
2931
+ const inchange = Boolean(ctx.sorte?.inchange);
2822
2932
  for (const { groupe, entier, avant, code, resultats, constructions } of mesure) {
2823
2933
  for (const { nom, erreur } of constructions) {
2824
2934
  if (reportes.includes(nom)) continue;
@@ -2880,6 +2990,8 @@ function preuve(ctx) {
2880
2990
  justifies.push(`${f} › ${a.nom} — ${raison}`);
2881
2991
  } else if (duF && avant.has(f)) {
2882
2992
  justifies.push(`${f} › ${a.nom} — ${duF.raison} (par le vert attendu du fichier)`);
2993
+ } else if (inchange) {
2994
+ justifies.push(`${f} › ${a.nom} — le plan dit « comportement inchangé »`);
2883
2995
  } else {
2884
2996
  injustifies.push(`${f} › ${a.nom}`);
2885
2997
  }
@@ -2889,11 +3001,17 @@ function preuve(ctx) {
2889
3001
  }
2890
3002
  const section = (titre, l) =>
2891
3003
  l.length ? [`${titre} (${l.length}) :`, ...l.map(x => `- ${x}`), ''] : [];
2892
- const ok =
2893
- (fichiers.length > 0 || rouges.length > 0) &&
2894
- casses.length === 0 &&
2895
- injustifies.length === 0 &&
2896
- rouges.length + justifies.length + anciens > 0;
3004
+ const ok = preuveReussie(
3005
+ {
3006
+ fichiers: fichiers.length,
3007
+ rouges: rouges.length,
3008
+ casses: casses.length,
3009
+ injustifies: injustifies.length,
3010
+ justifies: justifies.length,
3011
+ anciens,
3012
+ },
3013
+ { inchange }
3014
+ );
2897
3015
  const resume = `${rouges.length} rouge(s), ${justifies.length} vert(s) justifié(s), ${injustifies.length} vert(s) sans vert attendu, ${casses.length} fichier(s) qui ne se charge(nt) pas, ${anciens} test(s) vert(s) que HEAD tient déjà, laissé(s) de côté`;
2898
3016
  const ecrit = (...sections) =>
2899
3017
  [
@@ -2904,7 +3022,12 @@ function preuve(ctx) {
2904
3022
  '',
2905
3023
  ...(fichiers.length || rouges.length
2906
3024
  ? []
2907
- : ['Aucun fichier de test du lot dans le plan : rien ne prouve le rouge.', '']),
3025
+ : inchange
3026
+ ? [
3027
+ 'Aucun fichier de test du lot : le plan dit « comportement inchangé », rien à prouver.',
3028
+ '',
3029
+ ]
3030
+ : ['Aucun fichier de test du lot dans le plan : rien ne prouve le rouge.', '']),
2908
3031
  ...section('Rouges', rouges),
2909
3032
  ...sections,
2910
3033
  ...section(
@@ -3381,7 +3504,59 @@ async function derouler(ctx, debut) {
3381
3504
  const menee = MENEES.has(etape) ? { etape, debut: new Date().toISOString() } : null;
3382
3505
  ecrireEtat(ctx, { ...etat, mene: menee?.debut ?? null });
3383
3506
  try {
3384
- if (etape === TESTS && sansTests(ctx)) {
3507
+ // After the plan: the gesture of a mechanical ticket, the developpeur of a plan without
3508
+ // tests, else the testwriter.
3509
+ const route =
3510
+ etape === TESTS
3511
+ ? etapeApresLePlan({
3512
+ sorte: cheminMecanique(ctx) ? ctx.sorte : null,
3513
+ sansTests: sansTests(ctx),
3514
+ })
3515
+ : null;
3516
+ if (route === GESTE) {
3517
+ geste(ctx, 'mecanique');
3518
+ etape = GESTE;
3519
+ tentative = 1;
3520
+ } else if (etape === GESTE) {
3521
+ if (reprend && livre(ctx)) {
3522
+ // The copy already carries the gesture (the supervisor played the command himself).
3523
+ commenter(
3524
+ ctx,
3525
+ 'mecanique',
3526
+ 'la copie porte déjà un changement du plan : le geste ne rejoue pas, aux contrôles.'
3527
+ );
3528
+ } else {
3529
+ const { description } = leTicket(ctx);
3530
+ const fiche = await jusquALaFiche(
3531
+ ctx,
3532
+ EXPLORATEUR,
3533
+ consigne(
3534
+ {
3535
+ depot: ctx.racine,
3536
+ ticket: ctx.ticket,
3537
+ sujet: ctx.sujet,
3538
+ paquets: ctx.paquets.join(', '),
3539
+ raison: ctx.sorte.raison,
3540
+ commande: ctx.sorte.commande,
3541
+ description: description.trim() || 'aucune',
3542
+ },
3543
+ 8
3544
+ ),
3545
+ { fiche: 'geste', objet: 'geste' }
3546
+ );
3547
+ if (fiche.statut !== 'FAIT') throw arretDuStatut(ctx, EXPLORATEUR, tentative, fiche);
3548
+ if (!livre(ctx)) {
3549
+ throw new Arret(
3550
+ 'sans-livraison',
3551
+ `Le geste mécanique ne change aucun fichier du plan (${ctx.paquets.join(', ')}) : la commande du plan, \`${ctx.sorte.commande}\`, n'a rien changé dans la copie.`,
3552
+ { piece: `$ ${ctx.sorte.commande}\naucun fichier du plan changé dans ${ctx.copie}` }
3553
+ );
3554
+ }
3555
+ commenter(ctx, 'mecanique', 'la commande du plan a joué dans la copie : aux contrôles.');
3556
+ }
3557
+ etape = CONTROLES;
3558
+ tentative = 0;
3559
+ } else if (route === CODE) {
3385
3560
  commenter(
3386
3561
  ctx,
3387
3562
  'testwriter',
@@ -3413,12 +3588,19 @@ async function derouler(ctx, debut) {
3413
3588
  if (p.ok) {
3414
3589
  // A finding of the reviewer still open for the developpeur launches him, red or not.
3415
3590
  const pourLui = ouverts(ctx, 'developpeur').length > 0;
3416
- const auDeveloppeur = p.rouges > 0 || pourLui;
3591
+ const auDeveloppeur =
3592
+ apresLaPreuve({
3593
+ rouges: p.rouges,
3594
+ pourLeDeveloppeur: pourLui,
3595
+ inchange: Boolean(ctx.sorte?.inchange),
3596
+ }) === CODE;
3417
3597
  const suite = p.rouges
3418
3598
  ? 'au développeur'
3419
3599
  : pourLui
3420
3600
  ? 'aucun rouge ; au développeur, que nomme un constat du relecteur'
3421
- : 'aucun rouge : un lot de tests seul, aux contrôles';
3601
+ : ctx.sorte?.inchange
3602
+ ? 'aucun rouge : le plan dit « comportement inchangé », au développeur'
3603
+ : 'aucun rouge : un lot de tests seul, aux contrôles';
3422
3604
  ecrireRapport(ctx, 'preuve', `${p.resume} ; ${suite}.\n\n${p.texte}`, p.resultat);
3423
3605
  etape = auDeveloppeur ? CODE : CONTROLES;
3424
3606
  tentative = auDeveloppeur ? 1 : 0;
@@ -3616,6 +3798,12 @@ async function derouler(ctx, debut) {
3616
3798
  'controles',
3617
3799
  'Les rouges du plan sont des constats à arbitrer : aucun développeur ne les tranche.'
3618
3800
  );
3801
+ } else if (k.rouge && cheminMecanique(ctx)) {
3802
+ // A mechanical lot: no testwriter nor developpeur lifts the red of its command.
3803
+ arreter(
3804
+ 'controles',
3805
+ `Le ticket est mécanique (${ctx.sorte.raison}) : ni testwriter ni développeur ne lève ce rouge du lot de sa commande. Le superviseur fait corriger le lot (\`--depuis developpeur\`, le rouge en \`--contexte\`), corrige le geste dans la copie puis \`--reprendre\`, ou arrête le circuit (\`--arreter\`).`
3806
+ );
3619
3807
  } else if (k.rouge && rien) {
3620
3808
  // The stop stands at the developpeur's step, which a resumption plays again.
3621
3809
  arreter('sans-livraison', rien, CODE);
@@ -3772,7 +3960,7 @@ async function derouler(ctx, debut) {
3772
3960
  );
3773
3961
  }
3774
3962
  ctx.constats = constatsOuverts(ctx, v.fiche, v.texte);
3775
- const saute = arretDuTestwriterSaute(ctx, v.texte);
3963
+ const saute = arretDuTestwriterSaute(ctx, v.texte) ?? arretDuGesteMecanique(ctx, v.texte);
3776
3964
  if (saute) throw saute;
3777
3965
  const auTestwriter = ouverts(ctx, 'testwriter').length > 0;
3778
3966
  etape = auTestwriter ? TESTS : CODE;
@@ -4064,6 +4252,14 @@ const planPasse = (ctx, empreinte) =>
4064
4252
 
4065
4253
  // The heading of the section of the open questions in a plan's description.
4066
4254
  const QUESTIONS_OUVERTES = '## Questions ouvertes';
4255
+ // The heading of the section of the sort of the ticket in a plan's description (grillhouse-sos).
4256
+ const SORTE = '## Sorte';
4257
+
4258
+ // The sort <sorte> (`sorteDuPlan`) in words: its kind, then its reason.
4259
+ const texteDeLaSorte = sorte =>
4260
+ sorte.raison
4261
+ ? `${sorte.genre}${sorte.inchange ? ' inchangé' : ''} — ${sorte.raison}`
4262
+ : `${sorte.genre} — la fiche ne dit pas sa sorte lisiblement : le circuit entier`;
4067
4263
 
4068
4264
  // The sections of the description <description>: the text before its first `##` heading, then
4069
4265
  // each heading with its lines.
@@ -4088,13 +4284,17 @@ function numerotee(ligne) {
4088
4284
  }
4089
4285
 
4090
4286
  // The ticket's description <description> as it was before the plan, with the criteria the plan adds
4091
- // <criteres> in its section of criteria (a section « ## Critères » at its end without one) and its
4092
- // open questions <questions> in their section after it, absent without one; the rest of it as it
4093
- // was. The criteria already written stay as they are, the decision of the owner: each criterion the
4094
- // plan adds follows them, numbered after them. Written again from the description before the plan,
4095
- // the description holds the criteria of the explorateur's last sheet alone.
4096
- function decrireLePlan(description, criteres, questions) {
4097
- const gardees = sectionsDe(description).filter(s => s.tete !== QUESTIONS_OUVERTES);
4287
+ // <criteres> in its section of criteria (a section « ## Critères » at its end without one), the sort
4288
+ // of the ticket <sorte> in its section after it, its reason and the command of a mechanical ticket
4289
+ // (absent when the sheet says none), and its open questions <questions> in their section after
4290
+ // them, absent without one; the rest of it as it was. The criteria already written stay as they
4291
+ // are, the decision of the owner: each criterion the plan adds follows them, numbered after them.
4292
+ // Written again from the description before the plan, the description holds the criteria and the
4293
+ // sort of the explorateur's last sheet alone.
4294
+ export function decrireLePlan(description, criteres, questions, sorte = null) {
4295
+ const gardees = sectionsDe(description).filter(
4296
+ s => s.tete !== QUESTIONS_OUVERTES && s.tete !== SORTE
4297
+ );
4098
4298
  let i = gardees.findIndex(deCriteres);
4099
4299
  if (i < 0) {
4100
4300
  gardees.at(-1).lignes.push('');
@@ -4110,12 +4310,25 @@ function decrireLePlan(description, criteres, questions) {
4110
4310
  tete: gardees[i].tete,
4111
4311
  lignes: [...(avant.length ? avant : ['']), ...liste, ''],
4112
4312
  };
4113
- if (questions.length) {
4114
- gardees.splice(i + 1, 0, {
4115
- tete: QUESTIONS_OUVERTES,
4116
- lignes: ['', lignesOuvertes(questions), ''],
4117
- });
4118
- }
4313
+ const apres = [
4314
+ ...(sorte
4315
+ ? [
4316
+ {
4317
+ tete: SORTE,
4318
+ lignes: [
4319
+ '',
4320
+ texteDeLaSorte(sorte),
4321
+ ...(sorte.commande ? ['', `Commande : \`${sorte.commande}\``] : []),
4322
+ '',
4323
+ ],
4324
+ },
4325
+ ]
4326
+ : []),
4327
+ ...(questions.length
4328
+ ? [{ tete: QUESTIONS_OUVERTES, lignes: ['', lignesOuvertes(questions), ''] }]
4329
+ : []),
4330
+ ];
4331
+ gardees.splice(i + 1, 0, ...apres);
4119
4332
  return gardees
4120
4333
  .flatMap(s => (s.tete ? [s.tete, ...s.lignes] : s.lignes))
4121
4334
  .join('\n')
@@ -4178,6 +4391,10 @@ function fautesDesPaquets(ctx, fiche, description) {
4178
4391
  : null;
4179
4392
  }
4180
4393
 
4394
+ // The sort the sheet of the plan <fiche> writes in the description: the one it says, read
4395
+ // (`sorteDuPlan`), or none when the sheet says none.
4396
+ const sorteEcrite = fiche => ('sorte' in fiche ? sorteDuPlan(fiche) : null);
4397
+
4181
4398
  // The components the sheet <fiche> of the explorateur sets apart, each with its reason, as the
4182
4399
  // circuit writes them at the ticket; empty without one.
4183
4400
  const ecartsDe = fiche =>
@@ -4247,12 +4464,12 @@ async function lePlan(ctx) {
4247
4464
  ecrireLePlan(
4248
4465
  ctx,
4249
4466
  plan.paquets.map(ctx.resoudre),
4250
- decrireLePlan(t.description, plan.criteres, plan.questions)
4467
+ decrireLePlan(t.description, plan.criteres, plan.questions, sorteEcrite(plan))
4251
4468
  );
4252
4469
  const ouvertesDuPlan = plan.questions.length ? `\n${lignesOuvertes(plan.questions)}` : 'aucune';
4253
4470
  dire(
4254
4471
  'plan',
4255
- `l'explorateur écrit le plan — paquets : ${plan.paquets.join(', ')}${ecartsDe(plan)} ; ${plan.criteres.length} critère(s) ajouté(s) ; questions ouvertes : ${ouvertesDuPlan}`
4472
+ `l'explorateur écrit le plan — paquets : ${plan.paquets.join(', ')}${ecartsDe(plan)} ; sorte : ${texteDeLaSorte(sorteDuPlan(plan))} ; ${plan.criteres.length} critère(s) ajouté(s) ; questions ouvertes : ${ouvertesDuPlan}`
4256
4473
  );
4257
4474
  const ecrit = leTicket(ctx);
4258
4475
  const lu = await session(
@@ -4289,6 +4506,8 @@ async function lePlan(ctx) {
4289
4506
  : `le plan — Les questions du questionneur :\n${lignesDesQuestions(lu.questions)}`
4290
4507
  );
4291
4508
  let reponses = [];
4509
+ // The plan the answer answers, whose sort the answer keeps when it says none.
4510
+ const premier = plan;
4292
4511
  if (posees.length) {
4293
4512
  plan = await session(
4294
4513
  EXPLORATEUR,
@@ -4303,6 +4522,8 @@ async function lePlan(ctx) {
4303
4522
  {
4304
4523
  ...explorateur,
4305
4524
  premiere: 'reprend',
4525
+ // The answer, apart from the plan it answers (`ficheDeLaSorte`).
4526
+ avec: { reponse: true },
4306
4527
  // A line of `reponses` by question put, asked again once; after it, a question without
4307
4528
  // its line stays open.
4308
4529
  valider: (f, essai) =>
@@ -4327,7 +4548,12 @@ async function lePlan(ctx) {
4327
4548
  ecrireLePlan(
4328
4549
  ctx,
4329
4550
  plan.paquets.map(ctx.resoudre),
4330
- decrireLePlan(t.description, plan.criteres, ouvertes)
4551
+ decrireLePlan(
4552
+ t.description,
4553
+ plan.criteres,
4554
+ ouvertes,
4555
+ sorteEcrite(ficheDeLaSorte([{ fiche: premier }, { fiche: plan, reponse: true }]))
4556
+ )
4331
4557
  );
4332
4558
  }
4333
4559
  const empreinte = empreinteDuPlan(leTicket(ctx));
@@ -4585,6 +4811,8 @@ export async function main(argv) {
4585
4811
  const arret = await lePlan(ctx);
4586
4812
  if (arret !== null) return aLaFin(ctx, arret);
4587
4813
  }
4814
+ // The sort of the ticket its plan says, which the run reads at each step.
4815
+ ctx.sorte = sorteDuTicket(ctx);
4588
4816
  return aLaFin(ctx, await conduire(ctx, d));
4589
4817
  } catch (e) {
4590
4818
  if (!(e instanceof Usage)) throw e;
@@ -3,7 +3,7 @@
3
3
  # plan, the packages it writes (one session of the testwriter or the developpeur for the whole
4
4
  # ticket, `.` as its component and the plan as `--paquets`, grillhouse-3uv.95.6). The supervisor runs it in the background and is told when the session ends.
5
5
  #
6
- # npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] <ticket> <rôle> <composant> <fichier de consigne>
6
+ # npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] [--fiche <sorte>] <ticket> <rôle> <composant> <fichier de consigne>
7
7
  #
8
8
  # - <composant> is the component's path from the root (`packages/<nom>`, or `.` for the whole
9
9
  # repository). It is judged before the copy is prepared, by the envelope's rule
@@ -91,7 +91,9 @@
91
91
  # locks), its tools and the servers of the index, for the reading of the whole copy.
92
92
  # - A role that ends on a sheet (scripts/resultats.mjs: the testwriter, the developpeur) runs with
93
93
  # `--output-format json --json-schema <its schema>` (`npx grillhouse resultats --schema
94
- # <rôle>`): claude's JSON result, its sheet in `structured_output`, goes to
94
+ # <rôle>`); --fiche <sorte> names the schema of a sheet that is not its role's (`geste`, the
95
+ # explorateur's gesture of a mechanical ticket, grillhouse-sos), taking a value as --modele does:
96
+ # claude's JSON result, its sheet in `structured_output`, goes to
95
97
  # .claude/worktrees/<ticket>.resultat.json, which a launch removes first and the circuit reads,
96
98
  # then to the log; its errors go to the log.
97
99
  # - Its output, and an envelope refusal (CODE_REFUS), are added to .claude/worktrees/<ticket>.log,
@@ -111,12 +113,12 @@
111
113
  set -euo pipefail
112
114
  ici="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
113
115
  eval "$(node "$ici/codes.mjs")"
114
- usage="usage: npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] <ticket> <rôle> <composant> <fichier de consigne>"
116
+ usage="usage: npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] [--fiche <sorte>] <ticket> <rôle> <composant> <fichier de consigne>"
115
117
  refus_usage() { echo "$usage" >&2; exit "$CODE_USAGE"; }
116
- modele="" effort="" seance="" reprise="" liste="" surcharge=()
118
+ modele="" effort="" seance="" reprise="" liste="" sorte="" surcharge=()
117
119
  while [ $# -gt 0 ]; do
118
120
  case "$1" in
119
- --modele|--effort|--seance|--reprise|--paquets)
121
+ --modele|--effort|--seance|--reprise|--paquets|--fiche)
120
122
  [ $# -ge 2 ] && [ -n "$2" ] && [[ "$2" != --* ]] || refus_usage
121
123
  if [ "$1" = --modele ]; then
122
124
  modele=$2
@@ -126,6 +128,8 @@ while [ $# -gt 0 ]; do
126
128
  reprise=$2
127
129
  elif [ "$1" = --paquets ]; then
128
130
  liste=$2
131
+ elif [ "$1" = --fiche ]; then
132
+ sorte=$2
129
133
  else
130
134
  case "$2" in low|medium|high|xhigh|max) effort=$2 ;; *) refus_usage ;; esac
131
135
  fi
@@ -260,7 +264,7 @@ mapfile -t droits_du_role <<<"$droits"
260
264
  # The schema of the role's end-of-session sheet (scripts/resultats.mjs), for a role that has one:
261
265
  # the session ends on it, which claude writes in its JSON result, on the standard output.
262
266
  fiche=()
263
- schema=$(node "$ici/../resultats.mjs" --schema "$role" 2> /dev/null) || schema=
267
+ schema=$(node "$ici/../resultats.mjs" --schema "${sorte:-$role}" 2> /dev/null) || schema=
264
268
  [ -z "$schema" ] || fiche=(--output-format json --json-schema "$schema")
265
269
 
266
270
  # An envelope in error does not stop the launcher (set -e): its code is kept for the exit.
@@ -13,8 +13,10 @@
13
13
  // The plan (1) is read elsewhere in the state: by the work on the plan under way
14
14
  // (`questionnement`, the explorateur's or the questionneur's session) and by its stop (`arrets`).
15
15
  // The tri of the discoveries (5.3) is the explorateur's too, once the queue has brought the lot
16
- // onto main, as Chromium and Mozilla give each new report a verdict before it is filed; the
17
- // role's own step stays the plan (`etapeDuRole`).
16
+ // onto main, as Chromium and Mozilla give each new report a verdict before it is filed; so is the
17
+ // gesture of a mechanical ticket (1.1), the command its plan names played in the copy, as Rosie
18
+ // and ClangMR let a tool make a large-scale change at Google (grillhouse-sos); the role's own step
19
+ // stays the plan (`etapeDuRole`).
18
20
  // SUITE is the tree in its order, each step before its sub-steps.
19
21
  // - A step carries as many bounded loops as it needs (`boucles`), each spanning the step and its
20
22
  // sub-steps: each its key (`cle`, which keys its count in the state's `boucles`), its label and
@@ -46,6 +48,9 @@ export const ETAPES = [
46
48
  etat: null,
47
49
  questionnement: 'plan',
48
50
  arrets: ['questionnement'],
51
+ // The gesture of a mechanical ticket, in the copy, in place of the testwriter and the
52
+ // developpeur (grillhouse-sos).
53
+ sous: [{ numero: '1.1', titre: 'Geste mécanique', qui: [EXPLORATEUR], etat: 'geste' }],
49
54
  },
50
55
  {
51
56
  numero: '2',
@@ -215,6 +220,14 @@ export const GESTES = [
215
220
  'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison) ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
216
221
  cas: 'BP 320.9 : 995-tools n’a rien à livrer, 4 montées et 49 min (B5)',
217
222
  },
223
+ {
224
+ genre: 'mecanique',
225
+ geste:
226
+ 'ni testwriter, ni preuve du rouge, ni développeur : l’explorateur joue dans la copie la commande que le plan nomme (1.1), puis les contrôles, la passe finale, la relecture et l’intégration',
227
+ regle:
228
+ 'le plan dit le ticket mécanique, avec sa raison et sa commande (`sorte` de la fiche de l’explorateur) : un geste sans comportement neuf ; tant qu’aucun testwriter ni développeur n’a travaillé le lot, un rouge des contrôles ou un RENDU monte, sans relancer personne',
229
+ cas: 'BP 320.16 : 38 outils déplacés par mv, 117 commentaires ; BP 320.40.1 : une variable inutilisée, 4 séances ; BP 322.11.1 : l’outil de test monté sur 31 paquets',
230
+ },
218
231
  ];
219
232
 
220
233
  // The gesture of name <genre>, or null.
@@ -247,11 +260,11 @@ export const MONTEES = Object.fromEntries(
247
260
  preuve:
248
261
  'La troisième preuve du rouge refuse le lot de tests : quel contexte donner au testwriter, ou le plan doit-il changer ?',
249
262
  controles:
250
- 'Un rouge reste, que le circuit ne rend pas au développeur (hors du plan, sans fichier, à arbitrer), ou que trois séances n’ont pas levé : avec quel contexte le lever, ou le plan doit-il s’étendre ?',
263
+ 'Un rouge reste, que le circuit ne rend pas au développeur (hors du plan, sans fichier, à arbitrer, le lot d’un geste mécanique), ou que trois séances n’ont pas levé : avec quel contexte le lever, ou le plan doit-il s’étendre ?',
251
264
  'sans-livraison':
252
- 'Le développeur ne change rien et le rouge reste : avec quel contexte le lever, ou le plan doit-il changer ?',
265
+ 'Le développeur ne change rien et le rouge reste, ou le geste mécanique ne change aucun fichier du plan : avec quel contexte le lever, ou le plan doit-il changer ?',
253
266
  'relecture-arret':
254
- 'La relecture ne rend pas le lot à un agent (un constat sans destinataire valide, un constat au testwriter que le plan saute, un critère en cause, ou la troisième relecture rendue) : que devient le plan, et qui reprend ?',
267
+ 'La relecture ne rend pas le lot à un agent (un constat sans destinataire valide, un constat au testwriter que le plan saute, un lot mécanique rendu, un critère en cause, ou la troisième relecture rendue) : que devient le plan, et qui reprend ?',
255
268
  integration:
256
269
  'L’intégration refuse le lot, ou la file rouvre le ticket : que corrige le lot, et qui le reprend ?',
257
270
  'hors-portee':
@@ -486,24 +486,25 @@ function installerLesBinairesDe(projet, langage) {
486
486
 
487
487
  /**
488
488
  * Runs each generator of the languages of the project (`miseAJour.generateurs` of each module,
489
- * each once) whose output the project holds (every one with `tous`, for a project `grillhouse init` creates);
489
+ * each once) whose output the project holds (every one with `tous`, for a project `grillhouse init` creates;
490
+ * every one of the module <langage>, for the first package of a language `grillhouse paquet` creates);
490
491
  * returns the lines of failure.
491
492
  */
492
- export function regenerer(projet, { tous = false } = {}) {
493
+ export function regenerer(projet, { tous = false, langage = null } = {}) {
493
494
  const lignes = [];
494
495
  const grillhouse = path.join(projet, 'node_modules', '.bin', 'grillhouse');
495
496
  const aPaquets = lireJson(path.join(projet, 'package.json'), {})?.workspaces !== undefined;
496
497
  const vus = new Set();
497
- for (const g of langagesDe(projet).flatMap(m => m.miseAJour.generateurs)) {
498
+ for (const { g, m } of langagesDe(projet).flatMap(m =>
499
+ m.miseAJour.generateurs.map(g => ({ g, m }))
500
+ )) {
498
501
  const cle = JSON.stringify([g.commande, ...g.args]);
499
- if (vus.has(cle)) {
502
+ const absente =
503
+ g.sortie !== null && !tous && m.nom !== langage && !existsSync(path.join(projet, g.sortie));
504
+ if (vus.has(cle) || (g.sortie === null ? !aPaquets : absente)) {
500
505
  continue;
501
506
  }
502
507
  vus.add(cle);
503
- const absente = g.sortie !== null && !tous && !existsSync(path.join(projet, g.sortie));
504
- if (g.sortie === null ? !aPaquets : absente) {
505
- continue;
506
- }
507
508
  if (g.sortie !== null) {
508
509
  mkdirSync(path.dirname(path.join(projet, g.sortie)), { recursive: true });
509
510
  }
@@ -548,7 +549,7 @@ export function rapport(b) {
548
549
 
549
550
  // Whether the bilan <b> of `mettreAJour` asks for `npm install` (a tool or what the language's
550
551
  // share declares), which the verification needs first.
551
- const aInstaller = b => b.dependances.length > 0 || b.duLangage.installer;
552
+ export const aInstaller = b => b.dependances.length > 0 || b.duLangage.installer;
552
553
 
553
554
  // The project's verification, the last step of the update (see the header): `{ code, ligne,
554
555
  // erreur }`, the code of `npm run verifier` (null when it is not played), the line of the report,
@@ -256,6 +256,24 @@ export interface Langage extends Composition {
256
256
  * several languages (scripts/index-interfaces.mjs). */
257
257
  entreesDeLIndex(racine: string): { rel: string; lignes: string[] }[];
258
258
  miseAJour: MiseAJour;
259
+ /** The skeleton of a new package of this language at `chemin` (from the root) of the project at
260
+ * `racine`, without behaviour nor test, as `cargo new --lib` or `nx g @nx/js:lib` writes one
261
+ * (`grillhouse paquet`, scripts/paquet.mjs): `fichiers`, each file of the package from the root
262
+ * and its text (its manifest, the configuration of its tests and of its typing, a file of code,
263
+ * its folder of tests), which the core writes where absent; `espace`, the manifest of the
264
+ * workspace with the package's entry, from the root and its new text, null when it holds it
265
+ * already; `verrouiller`, the command, run in `dossier` (from the root), that brings the lock of
266
+ * the versions in line with the new package. `modele`: the package.json of the module's template
267
+ * (`miseAJour.gabarit`), the versions of its tools. Throws, named, for a path where the module
268
+ * holds no package. */
269
+ squelette(
270
+ racine: string,
271
+ o: { chemin: string; modele: Record<string, unknown> }
272
+ ): {
273
+ fichiers: Record<string, string>;
274
+ espace: { fichier: string; texte: string } | null;
275
+ verrouiller: { commande: string; args: string[]; dossier: string };
276
+ };
259
277
  }
260
278
 
261
279
  /** The frame's languages, each its module. */