@roomi-fields/grillhouse 0.24.6 → 0.24.7

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.
@@ -111,9 +111,11 @@
111
111
  // sheet read is kept with the ticket's sheets, `.claude/worktrees/<ticket>.fiches.jsonl` (`{
112
112
  // date, role, fiche }`, the lot a review read joined to its sheet, `lot`), beside the circuit's
113
113
  // own results: the report of each proof and check, which the reviewer receives, with its outcome
114
- // (`resultat`), each stop (`arret`), each developpeur resumed who changed nothing (`inchange`),
115
- // each session launched (`lancement`, its role and its session id), each end of a run on a
116
- // question (`montee`: its code, its stop and who must answer it), which the bilan reads; and each
114
+ // (`resultat`), each stop (`arret`), each developpeur session that changed no file of the plan
115
+ // and goes to the checks or stops at « sans-livraison » (`inchange`), each session launched
116
+ // (`lancement`, its role and its session id), each end of a run on a question (`montee`: its
117
+ // code, its stop and the supervisor's session that ran it, `superviseur`, the
118
+ // `CLAUDE_CODE_SESSION_ID` Claude Code gives the run), which the bilan reads; and each
117
119
  // of its discoveries (`decouvertes`) filed closed under the ticket (scripts/ticket.sh, label
118
120
  // `decouverte`). A session that ends without a sheet that conforms (none, one out of its schema,
119
121
  // a code other than 0) is resumed once, the same session, with the third template, which names
@@ -261,7 +263,12 @@
261
263
  // their test files, a finding of one of their guards, whatever file it aims at, or a failed test
262
264
  // or a finding on a file a reference of the project covers), mixed with other reds or not, or a
263
265
  // guard's note of a key of the debt inscribed above what it finds (`a-elaguer`, the pass green
264
- // or not), sends no developpeur: the gesture `regeneration`, once for that pass. The circuit
266
+ // or not), sends no developpeur: the gesture `regeneration`, once for that pass. Checks of the
267
+ // plan green but for reds of references call for it too, before the final pass, as make
268
+ // remakes a generated file before what reads it: the final pass that is due then plays once, on
269
+ // the regenerated tree, and does not regenerate again a reference regenerated on that same tree
270
+ // (BPScript 320.3.9: the ceiling of the words, red at the checks, left to the final pass, which
271
+ // played the same tests again on the same tree for 6.1 min before regenerating). The circuit
265
272
  // keeps the copy as a lot, runs the command of each reference concerned on the whole copy (the
266
273
  // debt lowered from the notes of the pass, its guards not played again), out of the envelope,
267
274
  // under the lock of the machine, its output added to the log, then, as make remakes the targets
@@ -493,7 +500,6 @@ import {
493
500
  QUESTIONNEUR,
494
501
  RESPONSABLE,
495
502
  SUITE,
496
- SUPERVISEUR,
497
503
  } from './etapes.mjs';
498
504
  import { paquets } from './paquets.mjs';
499
505
  import { releve } from './composants-affectes.mjs';
@@ -1185,9 +1191,11 @@ function consigne(valeurs, rang = 0) {
1185
1191
 
1186
1192
  // One session of <role> on the whole ticket: its sheet. A relaunch on its step (<tentative> past
1187
1193
  // 1) that is not the last (<derniere>) resumes the agent's session the circuit keeps
1188
- // (`ctx.reprise`, its author and id) with the short instruction (the fourth template); a
1189
- // resumption that fails (a code other than 0, or no sheet that conforms) falls back on a fresh and
1190
- // whole session, under a new id, which the circuit keeps. A fresh session's instruction (the first
1194
+ // (`ctx.reprise`, its author and id) with the short instruction (the fourth template); its sheet
1195
+ // refused is asked again once of that same session, as of a fresh one (`jusquALaFiche`), so the
1196
+ // question it carries goes up (BP 320.3.9); a resumption that ends in error (a code other than 0:
1197
+ // the session not found) falls back on a fresh and whole session, under a new id, which the
1198
+ // circuit keeps. A fresh session's instruction (the first
1191
1199
  // template) carries the ticket's description and notes as they are at its launch, the packages of
1192
1200
  // the plan, and the last handover of its author at the ticket. Every instruction, fresh or resumed,
1193
1201
  // carries the findings of the reviewer still open for its role (`ctx.constats`), all of them,
@@ -1213,14 +1221,17 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1213
1221
  rapport: rapport ?? 'aucun',
1214
1222
  constats,
1215
1223
  };
1216
- const r = await lancer(ctx, role, consigne(courte, 3), { fort, reprend: reprise.seance });
1217
- seanceLancee(ctx, role, r);
1218
- const lu = r.seance === 0 ? lireSaFiche(ctx, role, r.sortie) : { erreur: `code ${r.seance}` };
1219
- if (lu.fiche) return garder(ctx, role, lu.fiche);
1224
+ const fiche = await jusquALaFiche(ctx, role, consigne(courte, 3), {
1225
+ fort,
1226
+ premiere: 'reprend',
1227
+ id: reprise.seance,
1228
+ repli: true,
1229
+ });
1230
+ if (fiche) return fiche;
1220
1231
  commenter(
1221
1232
  ctx,
1222
1233
  role,
1223
- `reprise de la séance ${reprise.seance} sans fiche conforme (${lu.erreur}) : séance neuve et entière.`
1234
+ `reprise de la séance ${reprise.seance} finie en erreur : séance neuve et entière.`
1224
1235
  );
1225
1236
  }
1226
1237
  const lots = testsDuLot(ctx);
@@ -1293,7 +1304,8 @@ function seanceLancee(ctx, role, r) {
1293
1304
  // 0) is resumed once, the same session, with the short instruction that names what lacks (the
1294
1305
  // third template). The session opens under the id <id> (a new one by default), or resumes it with
1295
1306
  // <premiere> « reprend »; with <neuve> (the testwriter or the developpeur), the circuit keeps that
1296
- // id for that author (`ctx.reprise`). Throws an Arret for a launch that stops before its session,
1307
+ // id for that author (`ctx.reprise`); with <repli> (a resumption), a session that ends in error
1308
+ // returns null, for a fresh session in its place. Throws an Arret for a launch that stops before its session,
1297
1309
  // a motionless session, or twice no sheet that conforms (« sans-fiche »). <avec> joins its fields
1298
1310
  // to the sheet's entry (the lot a review read); <valider> names what makes a sheet out of
1299
1311
  // conformity beyond its schema (an unknown package of a plan), or null.
@@ -1304,6 +1316,7 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1304
1316
  id = randomUUID(),
1305
1317
  avec = {},
1306
1318
  valider = () => null,
1319
+ repli = false,
1307
1320
  ...reste
1308
1321
  } = options;
1309
1322
  if (neuve) ctx.reprise = { agent: neuve, seance: id };
@@ -1319,6 +1332,7 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1319
1332
  ...ouvrir(essai === 1 ? premiere : 'reprend'),
1320
1333
  });
1321
1334
  seanceLancee(ctx, role, r);
1335
+ if (repli && r.seance !== 0) return null;
1322
1336
  lu =
1323
1337
  r.seance === 0
1324
1338
  ? lireSaFiche(ctx, role, r.sortie)
@@ -1717,13 +1731,14 @@ function referencesDesRouges(ctx, lieux, aElaguer = false) {
1717
1731
  // another one has just written runs after it, once for each reference whose writing calls for it;
1718
1732
  // then the copy kept again on that lot. `{ texte, regenerees, fichiers, restreinte }`: the report,
1719
1733
  // the names of the references changed, the files changed, and the range of the final pass that
1720
- // follows (null when nothing changed: no pass plays again, and the reds stand). A file a reference
1721
- // writes follows from the lot, as the output of a genrule, without a word of the plan, and the
1722
- // reviewer reads its difference; a file changed that none of the references run declares, or a
1723
- // command that fails (a reference of the project at another code than 0, one of the frame on a
1724
- // real failure alone) restores the copy as it was and stops at « references », each deviation in
1725
- // its question.
1726
- function regenerer(ctx, noms, notes = []) {
1734
+ // follows (null when nothing changed: no pass plays again, and the reds stand); with
1735
+ // <avantLaPasse>, the regeneration the checks of the plan call for, the final pass that is due
1736
+ // follows, whole or since the last review. A file a reference writes follows from the lot, as
1737
+ // the output of a genrule, without a word of the plan, and the reviewer reads its difference; a
1738
+ // file changed that none of the references run declares, or a command that fails (a reference of
1739
+ // the project at another code than 0, one of the frame on a real failure alone) restores the copy
1740
+ // as it was and stops at « references », each deviation in its question.
1741
+ function regenerer(ctx, noms, notes = [], avantLaPasse = false) {
1727
1742
  // The notes of the debt, in a file of the run, which the command that lowers it reads.
1728
1743
  const fichierDesNotes = path.join(ctx.base.dossier, 'dette-a-abaisser.json');
1729
1744
  const toutes = lesReferences(ctx).map(r =>
@@ -1803,7 +1818,7 @@ function regenerer(ctx, noms, notes = []) {
1803
1818
  }
1804
1819
  if (!fichiers.length) {
1805
1820
  return {
1806
- texte: `La régénération (${refs.map(r => `${r.nom}, \`${r.commande}\``).join(' ; ')}) ne change aucun fichier : aucune passe ne rejoue, et les rouges de la passe finale restent, chacun à son propriétaire.`,
1821
+ texte: `La régénération (${refs.map(r => `${r.nom}, \`${r.commande}\``).join(' ; ')}) ne change aucun fichier : ${avantLaPasse ? 'la passe finale juge le lot tel quel' : 'aucune passe ne rejoue, et les rouges de la passe finale restent, chacun à son propriétaire'}.`,
1807
1822
  regenerees: [],
1808
1823
  fichiers,
1809
1824
  restreinte: null,
@@ -1811,7 +1826,7 @@ function regenerer(ctx, noms, notes = []) {
1811
1826
  }
1812
1827
  return {
1813
1828
  texte: [
1814
- `Les références régénérées sur la copie entière : ${regenerees.map(r => r.nom).join(', ')} ; le lot porte leurs fichiers, puis la passe finale restreinte à ce qu'elles changent.`,
1829
+ `Les références régénérées sur la copie entière : ${regenerees.map(r => r.nom).join(', ')} ; le lot porte leurs fichiers, puis la passe finale${avantLaPasse ? '' : " restreinte à ce qu'elles changent"}.`,
1815
1830
  '',
1816
1831
  ...regenerees.map(r => `- ${r.nom} (\`${r.commande}\`) : ${siens(r).join(', ')}`),
1817
1832
  '',
@@ -2552,8 +2567,10 @@ const ligneDeCommande = c =>
2552
2567
  // in a package of the plan; `horsTitre` the packages out of the plan that hold a red; `arbitrer`
2553
2568
  // when every red of the plan is a finding to settle; `lieux` the place of each red, `{ fichier,
2554
2569
  // gardes }`, its file (null for a red without one) and the names its finding carries (none for a
2555
- // test or a task); `tous` every red as it was read; `notes`, at the final pass, each key of the debt
2556
- // a guard wrote inscribed above what it finds, `{ garde, fichier, regle, trouve }`.
2570
+ // test or a task); `references`, out of the final pass, the references whose reds the checks saw,
2571
+ // which their regeneration lifts before the final pass; `tous` every red as it was read; `notes`,
2572
+ // at the final pass, each key of the debt a guard wrote inscribed above what it finds, `{ garde,
2573
+ // fichier, regle, trouve }`.
2557
2574
  function controles(ctx, finale, restreinte = null, reportes = null) {
2558
2575
  const liste = paquets(ctx.copie).filter(p => !p.hors);
2559
2576
  const filtres = restreinte
@@ -2584,14 +2601,17 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2584
2601
  r => !reportes.rejouee || (Boolean(r.joue) && !joues.has(r.joue))
2585
2602
  ),
2586
2603
  ];
2587
- // Out of the final pass, the reds of the plan are the developpeur's; the others (the root, a red
2588
- // no file situates, a package out of the plan, a red of a reference, which its regeneration
2589
- // lifts, 4.2) wait for it.
2590
- const deReference = r =>
2591
- referencesDesRouges(ctx, [{ fichier: r.fichier ?? null, gardes: r.gardes ?? [] }]).length > 0;
2604
+ // Out of the final pass, the reds of the plan are the developpeur's; a red of a reference goes to
2605
+ // its regeneration (4.2), before the final pass; the others (the root, a red no file situates, a
2606
+ // package out of the plan) wait for the final pass.
2607
+ const lieu = r => ({ fichier: r.fichier ?? null, gardes: r.gardes ?? [] });
2608
+ const deReference = r => referencesDesRouges(ctx, [lieu(r)]).length > 0;
2592
2609
  const siens = r => finale || (r.dansLePlan && !deReference(r));
2593
2610
  const rouges = tous.filter(siens);
2594
- const laisses = tous.filter(r => !siens(r));
2611
+ const references = finale
2612
+ ? []
2613
+ : referencesDesRouges(ctx, tous.filter(r => !siens(r) && deReference(r)).map(lieu));
2614
+ const laisses = tous.filter(r => !siens(r) && (finale || !deReference(r)));
2595
2615
  const aRepasser = resultats.filter(r => r.code === A_REPASSER);
2596
2616
  const nommer = r => `${ligneDeCommande(r)} (code ${r.code})`;
2597
2617
  const enEchec = resultats.filter(r => r.code !== 0 && r.code !== A_REPASSER);
@@ -2609,6 +2629,10 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2609
2629
  laisses.length
2610
2630
  ? ` ; laissés à la passe finale, ${laisses.length} rouge(s) hors du plan`
2611
2631
  : ''
2632
+ }${
2633
+ references.length
2634
+ ? ` ; des rouges sont ceux de références, à leur régénération avant la passe finale (${references.map(r => r.nom).join(', ')})`
2635
+ : ''
2612
2636
  }`;
2613
2637
  // Where the checks played: the final pass out of the envelope, on the whole copy or restricted
2614
2638
  // to what changed since the last review; the checks of the plan, its tests and packages, its
@@ -2662,7 +2686,8 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2662
2686
  rouges: rouges.map(r => ({ paquet: nomDuPaquet(r), texte: r.texte, detail: r.detail })),
2663
2687
  resume,
2664
2688
  horsTitre: [...new Set(rouges.map(r => r.horsTitre).filter(Boolean))].sort(),
2665
- lieux: rouges.map(r => ({ fichier: r.fichier ?? null, gardes: r.gardes ?? [] })),
2689
+ lieux: rouges.map(lieu),
2690
+ references,
2666
2691
  tous,
2667
2692
  notes: finale
2668
2693
  ? resultats.flatMap(r =>
@@ -2881,6 +2906,9 @@ async function derouler(ctx, debut) {
2881
2906
  // the testwriter, the sending and the handover as its report, then the proof and the
2882
2907
  // developpeur.
2883
2908
  if (ctx.renvoiAuTestwriter) {
2909
+ if (empreinte(ctx) === avant) {
2910
+ inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, etape: CODE, inchange: true });
2911
+ }
2884
2912
  throw new Arret(
2885
2913
  'sans-livraison',
2886
2914
  `La fiche de la séance ${tentative} du développeur renvoie une deuxième fois de suite au testwriter, sans contrôles verts depuis le premier renvoi : le testwriter n'a pas levé ce rouge.\n\n${renvoi}`
@@ -2961,11 +2989,16 @@ async function derouler(ctx, debut) {
2961
2989
  };
2962
2990
  const suivante = tentative + 1;
2963
2991
  // A final pass with a red of a reference, mixed with others or not, or a debt the lot
2964
- // lowers: their regeneration, once for this pass; the reds that remain then go each to
2965
- // its owner.
2992
+ // lowers: their regeneration, once for this pass, but for a reference the checks had
2993
+ // regenerated on this same tree, whose inputs have not changed since; the reds that remain
2994
+ // then go each to its owner.
2995
+ const dejaRegenerees =
2996
+ ctx.regenereSur && ctx.regenereSur.arbre === passe.arbre ? ctx.regenereSur.noms : [];
2966
2997
  const aRegenerer =
2967
2998
  passeFinale && !regeneration && (k.rouge || k.notes.length > 0)
2968
- ? referencesDesRouges(ctx, k.lieux, k.notes.length > 0)
2999
+ ? referencesDesRouges(ctx, k.lieux, k.notes.length > 0).filter(
3000
+ r => !dejaRegenerees.includes(r.nom)
3001
+ )
2969
3002
  : [];
2970
3003
  if (aRegenerer.length) {
2971
3004
  const noms = aRegenerer.map(r => r.nom);
@@ -3012,6 +3045,21 @@ async function derouler(ctx, debut) {
3012
3045
  arreter('controles', null);
3013
3046
  } else if (k.aRepasser) {
3014
3047
  arreter('a-repasser', null);
3048
+ } else if (!passeFinale && k.references.length) {
3049
+ // The checks green but for reds of references: their regeneration, then the final pass,
3050
+ // which plays once, on the regenerated tree, as make remakes a generated file before
3051
+ // what reads it.
3052
+ geste(ctx, 'regeneration');
3053
+ ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3054
+ ctx.renvoiAuTestwriter = false;
3055
+ ctx.aRegenerer = {
3056
+ noms: k.references.map(r => r.nom),
3057
+ notes: [],
3058
+ avantLaPasse: true,
3059
+ };
3060
+ etape = REFERENCES;
3061
+ tentative = 0;
3062
+ finale = true;
3015
3063
  } else {
3016
3064
  ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3017
3065
  // Green checks: a sending of the developpeur to the testwriter may come again.
@@ -3045,16 +3093,22 @@ async function derouler(ctx, debut) {
3045
3093
  "L'état du circuit ne garde pas les références à régénérer : la passe finale les redonne (`--depuis developpeur`)."
3046
3094
  );
3047
3095
  }
3048
- const g = regenerer(ctx, a.noms, a.notes);
3096
+ const g = regenerer(ctx, a.noms, a.notes, Boolean(a.avantLaPasse));
3049
3097
  ecrireRapport(ctx, 'references', g.texte, {
3050
3098
  regenerees: g.regenerees,
3051
3099
  fichiers: g.fichiers,
3052
3100
  });
3053
- ctx.regeneration = {
3054
- restreinte: g.restreinte,
3055
- entiere: a.entiere,
3056
- reportes: { rouges: a.rouges, rejouee: g.fichiers.length > 0 },
3057
- };
3101
+ // After the checks, the final pass that is due, on the regenerated tree, which does not
3102
+ // regenerate again the references just regenerated on it; after a final pass, the pass
3103
+ // restricted to what the regeneration changed, with the reds of the pass before.
3104
+ ctx.regenereSur = a.avantLaPasse ? { arbre: arbreDeLaCopie(ctx), noms: a.noms } : null;
3105
+ ctx.regeneration = a.avantLaPasse
3106
+ ? null
3107
+ : {
3108
+ restreinte: g.restreinte,
3109
+ entiere: a.entiere,
3110
+ reportes: { rouges: a.rouges, rejouee: g.fichiers.length > 0 },
3111
+ };
3058
3112
  ctx.aRegenerer = null;
3059
3113
  etape = CONTROLES;
3060
3114
  finale = true;
@@ -3270,19 +3324,20 @@ function depart(ctx, e) {
3270
3324
  }
3271
3325
 
3272
3326
  // The end of the run, its exit code <code>: an end on a stop kept with the circuit's results
3273
- // (`montee`: its code, its stop and who must answer its question, the supervisor for a stop
3274
- // without one, as an end at 75 he replays), from which the
3275
- // bilan measures the wait to the run that answers it, then the ticket's bilan at the ticket
3327
+ // (`montee`: its code, its stop and the supervisor's session that ran it, `superviseur`, when
3328
+ // Claude Code names it), from which the bilan measures the wait to the run that answers it, the
3329
+ // owner's when he writes in that session meanwhile, then the ticket's bilan at the ticket
3276
3330
  // (scripts/bilan.mjs); a bilan it cannot write leaves the code as it is.
3277
3331
  function aLaFin(ctx, code) {
3278
3332
  try {
3279
3333
  if (code !== 0) {
3334
+ const superviseur = process.env.CLAUDE_CODE_SESSION_ID;
3280
3335
  inscrire(ctx, {
3281
3336
  role: AUTEUR_DU_CIRCUIT,
3282
3337
  montee: {
3283
3338
  code,
3284
3339
  raison: ctx.courant?.raison ?? null,
3285
- qui: ctx.courant?.question?.qui ?? SUPERVISEUR,
3340
+ ...(superviseur ? { superviseur } : {}),
3286
3341
  },
3287
3342
  });
3288
3343
  }
@@ -29,7 +29,8 @@
29
29
  // dependencies (the `deps` and `data` of Bazel, the `implicitDependencies` of Nx).
30
30
  // - The readers of an element are the other components that: its provider's `## Consommateurs`
31
31
  // declares for it, or for `*` (`consommateurs`); import it, or the whole provider, in their
32
- // production code (`import`, the uses of scripts/consommateurs.mjs); hold a test file that names
32
+ // production code, or in their tests for a package of the shared test material (`import`, the
33
+ // uses of scripts/consommateurs.mjs); hold a test file that names
33
34
  // it, as a whole word, and imports the provider (the test file's path).
34
35
  // - By the types (scripts/references-par-les-types.mjs): each element, a member of a type
35
36
  // included, resolved by TypeScript's language service over the components' `tsconfig.json`;
@@ -7,8 +7,9 @@
7
7
  // - `a` : duree, tempo
8
8
  // - `c` : *
9
9
  //
10
- // This check reads what the production code of every component imports from every other, and
11
- // refuses (exit 1) a use that the provider's interface does not declare, and a declared name that
10
+ // This check reads what the production code of every component imports from every other, and what
11
+ // its tests import from a package of the shared test material (`matieres`), whose only readers are
12
+ // tests, as knip counts test files as entries out of its `--production` mode; it refuses (exit 1) a use that the provider's interface does not declare, and a declared name that
12
13
  // no code of its consumer uses, as ESLint's `no-unused-vars` refuses a name nothing uses (BP
13
14
  // 320.3.2.1: « LEVEL_TYPES » declared for 020-loader, only reported, caught by its second review).
14
15
  // `*` stands for a namespace, default, re-export-all or side-effect import, and for a dynamic
@@ -20,7 +21,8 @@
20
21
  // `usage-non-declare`, `declare-non-utilise` or `ligne-mal-formee` (`homonyme` for two components
21
22
  // of one name, keyed by the first path). The debt of a new rule is inscribed once, when a project
22
23
  // updates to it (scripts/migrations/0.24.4-noms-declares-inutilises.mjs,
23
- // scripts/migrations/0.24.6-lignes-mal-formees.mjs); in a ticket, the name leaves its line, and a
24
+ // scripts/migrations/0.24.6-lignes-mal-formees.mjs,
25
+ // scripts/migrations/0.24.7-matiere-dans-les-tests.mjs); in a ticket, the name leaves its line, and a
24
26
  // line of prose is written as a list of names.
25
27
  //
26
28
  // npx grillhouse consommateurs run from the repository root
@@ -30,8 +32,9 @@
30
32
  // `docs/agents/hors-cadre.txt`: neither read nor checked, as provider or as consumer. Every check
31
33
  // of the frame enumerates the components through `composants`. In a repository of packages, such a
32
34
  // package stays a workspace, and Turborepo plays none of its tasks (scripts/turbo-des-paquets.mjs
33
- // writes its configuration). For the check of the uses, test files,
34
- // `dist/`, `docs/` and `node_modules/` are not production code and are not read; nor are Vite's
35
+ // writes its configuration). For the check of the uses, test files (under a folder `test/`,
36
+ // `tests/` or `__tests__/`, or named `*.test.*`, `*.spec.*`) count only for their imports of a
37
+ // package of the material; `dist/`, `docs/` and `node_modules/` are never read, nor are Vite's
35
38
  // temporary files, and a file gone between the walk and its read is passed over (`parcourir`).
36
39
  // The identity of a component is its name: two directories of the same name, one under `packages/`
37
40
  // and one under `src/`, are refused, both paths named (the way npm workspaces, Nx and Cargo refuse
@@ -255,13 +258,18 @@ export function parcourir(chemin, sauter = () => false) {
255
258
  // The text of the file <f> a walk listed, or null when it is gone since.
256
259
  export const lireSiPresent = f => siPresent(x => readFileSync(x, 'utf8'), f, null);
257
260
 
258
- // The production source files under <dir>: test folders and test files left out.
261
+ // The source files under <dir>: [{ f, test }], `test` for a file under a test folder or of a test
262
+ // name.
259
263
  function fichiers(dir) {
260
264
  const nom = p => path.basename(p);
261
- return parcourir(
262
- dir,
263
- p => SKIP.has(nom(p)) || nom(p).startsWith('.') || TEST_DIR.has(nom(p))
264
- ).filter(p => SOURCE.test(nom(p)) && !isTest(nom(p)));
265
+ const sousTest = p =>
266
+ path
267
+ .relative(dir, path.dirname(p))
268
+ .split(path.sep)
269
+ .some(s => TEST_DIR.has(s));
270
+ return parcourir(dir, p => SKIP.has(nom(p)) || nom(p).startsWith('.'))
271
+ .filter(p => SOURCE.test(nom(p)))
272
+ .map(f => ({ f, test: isTest(nom(f)) || sousTest(f) }));
265
273
  }
266
274
 
267
275
  // The component an import specifier reaches from <fichier>, other than <soi>, or null.
@@ -279,14 +287,16 @@ function fournisseur(spec, fichier, tous, soi) {
279
287
  );
280
288
  }
281
289
 
282
- // What each component really uses of the others: Map provider → Map consumer → Set of names.
290
+ // What each component really uses of the others: Map provider → Map consumer → Set of names. Its
291
+ // production code counts for every provider, its tests for a package of the material only.
283
292
  export function utilise(racine, tous = composants(racine)) {
284
293
  const out = new Map();
294
+ const matiere = new Set(matieres(racine).map(m => m.nom));
285
295
  for (const c of tous) {
286
- for (const f of fichiers(c.dir)) {
296
+ for (const { f, test } of fichiers(c.dir)) {
287
297
  for (const { spec, noms } of imports(lireSiPresent(f) ?? '')) {
288
298
  const p = fournisseur(spec, f, tous, c);
289
- if (!p) continue;
299
+ if (!p || (test && !matiere.has(p.nom))) continue;
290
300
  if (!out.has(p.nom)) out.set(p.nom, new Map());
291
301
  const parConsommateur = out.get(p.nom);
292
302
  if (!parConsommateur.has(c.nom)) parConsommateur.set(c.nom, new Set());
@@ -92,6 +92,9 @@ const LIRE_GIT = [
92
92
  'Bash(git -C * ls-files*)',
93
93
  'Bash(git -C * grep*)',
94
94
  ];
95
+ // The test tool run directly, Vitest or Turborepo that plays it (charter, « Aucun agent ne lance
96
+ // l'outil de test directement »): `npm test` and `npm run verifier` play it with what it depends on.
97
+ // `turbo *` ends on a word, so `npx grillhouse turbo-des-paquets` stays open.
95
98
  const TEST_DIRECT = [
96
99
  'Bash(vitest*)',
97
100
  'Bash(npx vitest*)',
@@ -99,6 +102,12 @@ const TEST_DIRECT = [
99
102
  'Bash(npm exec vitest*)',
100
103
  'Bash(npm exec * vitest*)',
101
104
  'Bash(node_modules/.bin/vitest*)',
105
+ 'Bash(turbo *)',
106
+ 'Bash(npx turbo *)',
107
+ 'Bash(npx * turbo *)',
108
+ 'Bash(npm exec turbo *)',
109
+ 'Bash(npm exec * turbo *)',
110
+ 'Bash(node_modules/.bin/turbo *)',
102
111
  ];
103
112
  // The skills Claude Code keeps listed when its own are off (`disableBundledSkills`), measured on
104
113
  // Claude Code 2.1.305.
@@ -197,10 +197,10 @@ export const GESTES = [
197
197
  {
198
198
  genre: 'regeneration',
199
199
  geste:
200
- 'à la régénération des références (4.2), puis la passe finale restreinte à ce qu’elle change',
200
+ 'à la régénération des références (4.2), puis la passe finale : celle qui est due, après les contrôles ; restreinte à ce qu’elle change, après une passe finale',
201
201
  regle:
202
- 'un rouge de la passe finale est celui d’une référence, même mêlé à d’autres : une que le projet déclare (`grillhouse.references`), ou un fichier que le cadre engendre (l’index des interfaces, les turbo.json, les rapports d’API) ; ou la passe abaisse la dette des gardes (`dette.mjs --abaisser`, depuis ses notes)',
203
- cas: 'BP 320.9 : 292 min autour des références, dont 163 min d’attente pour régénérer à la main l’index des interfaces, le plafond et l’empreinte, des rouges de références mêlés à d’autres',
202
+ 'un rouge de la passe finale est celui d’une référence, même mêlé à d’autres, ou les contrôles du plan sont verts hors des rouges de références : une que le projet déclare (`grillhouse.references`), ou un fichier que le cadre engendre (l’index des interfaces, les turbo.json, les rapports d’API) ; ou la passe abaisse la dette des gardes (`dette.mjs --abaisser`, depuis ses notes)',
203
+ cas: 'BP 320.9 : 292 min autour des références, dont 163 min d’attente pour régénérer à la main l’index des interfaces, le plafond et l’empreinte, des rouges de références mêlés à d’autres ; BP 320.3.9 : le plafond rouge aux contrôles, laissé à une passe finale qui rejoue les mêmes tests sur le même arbre (6,1 min)',
204
204
  },
205
205
  {
206
206
  genre: 'rien-a-livrer',
@@ -15,15 +15,18 @@
15
15
  // the project's settings stay untouched; the source is `repo` for github, `url` for git and url,
16
16
  // `path` for directory and file, any other type is a failure); then each declared plugin not
17
17
  // installed for the project is installed by `claude plugin install <id> --scope project`, run
18
- // from the project's root. `claude` rewrites `.claude/settings.json` in its own key order; once
18
+ // from the project's root; last, the frame's mod installed for the project at a version behind
19
+ // the package's (see `ecart` below) is updated by `claude plugin update <id> --scope <its
20
+ // scope>`, from the project's root, and read again. `claude` rewrites `.claude/settings.json` in its own key order; once
19
21
  // the installs are done, the file holds the keys in the order it had before them (the keys
20
22
  // claude added after), and its exact text when the JSON value is the same.
21
23
  // - A plugin is installed for the project when `claude plugin list --json` has an entry for it of
22
24
  // scope user, or of scope project or local whose `projectPath` is the project's root (both paths
23
25
  // resolved); the entry's state (enabled, errors) is not read.
24
26
  // - A failure has its line on the error output, naming the plugin and the command that installs it
25
- // (a failed add: the marketplace's command, then the plugin's); the others are still tried and the
26
- // code is 1. A state reading that fails installs nothing. Without `claude`, each plugin has its line.
27
+ // (a failed add: the marketplace's command, then the plugin's; a mod left at another version than
28
+ // the package's, after its update or ahead of the package: both versions and the command of its
29
+ // `ecart` line); the others are still tried and the code is 1. A state reading that fails installs nothing. Without `claude`, each plugin has its line.
27
30
  // - `--absents` prints `claude` (the command is missing), `greffon <id>` per declared plugin not
28
31
  // installed for the project, or `lecture <reason>` when the state cannot be read; each claude
29
32
  // call stops after 5 s. It also prints `ecart <id> <mod's version> <package's version>
@@ -238,7 +241,30 @@ function installer(projet) {
238
241
  lignes.push(`${id} : l'installation échoue ; lance \`${commandeGreffon(id)}\`.`);
239
242
  }
240
243
  }
241
- return lignes;
244
+ return [...lignes, ...aligner(racine, d.plugins)];
245
+ }
246
+
247
+ // Brings the frame's mod, installed for the project, to the package's version: behind it, the mod
248
+ // is updated at its scope from the project's root (`claude plugin update`, its source's latest),
249
+ // then read again. Returns the line of a mod that stays at another version, with the command that
250
+ // aligns it (`ecart`); none when the versions agree or compare nothing.
251
+ function aligner(racine, declares) {
252
+ const lecture = lireListe(['plugin', 'list'], undefined);
253
+ const avant = lecture.liste ? ecart(lecture.liste, declares, racine) : null;
254
+ if (!avant) {
255
+ return [];
256
+ }
257
+ let reste = avant;
258
+ if (avant.derriere) {
259
+ const r = claude(['plugin', 'update', avant.id, '--scope', avant.scope], { cwd: racine });
260
+ const relue = r.ok ? lireListe(['plugin', 'list'], undefined) : {};
261
+ reste = relue.liste ? ecart(relue.liste, declares, racine) : avant;
262
+ }
263
+ return reste
264
+ ? [
265
+ `${reste.id} : le greffon est en ${reste.greffon}, le paquet ${NOM_DU_PAQUET} en ${reste.paquet} ; lance \`${reste.commande}\`.`,
266
+ ]
267
+ : [];
242
268
  }
243
269
 
244
270
  /**
@@ -263,8 +289,11 @@ export function greffonsAbsents(projet) {
263
289
  return [`lecture ${lecture.erreur}`];
264
290
  }
265
291
  const absents = d.plugins.filter(id => !installePourLeProjet(lecture.liste, id, racine));
266
- const ecart = ecartDeVersions(lecture.liste, d.plugins, racine);
267
- return [...absents.map(id => `greffon ${id}`), ...(ecart ? [ecart] : [])];
292
+ const e = ecart(lecture.liste, d.plugins, racine);
293
+ return [
294
+ ...absents.map(id => `greffon ${id}`),
295
+ ...(e ? [`ecart ${e.id} ${e.greffon} ${e.paquet} ${e.commande}`] : []),
296
+ ];
268
297
  }
269
298
 
270
299
  // The frame's mod and its package: one version, the `version` of the package.json beside this
@@ -282,12 +311,12 @@ function versionDuPaquet() {
282
311
  }
283
312
  }
284
313
 
285
- // The line `ecart <id> <mod's version> <package's version> <command>` when the frame's mod,
286
- // declared and installed for the project (its entry of scope local, else project, else user, as
287
- // Claude Code applies them), carries another version than the package; null otherwise. The command
288
- // aligns the one behind: the mod's update at its scope, or the package's install at the mod's
289
- // version.
290
- function ecartDeVersions(entrees, declares, racine) {
314
+ // The frame's mod, declared and installed for the project (its entry of scope local, else
315
+ // project, else user, as Claude Code applies them), when it carries another version than the
316
+ // package: `{ id, scope, greffon, paquet, derriere, commande }`, the command aligning the one
317
+ // behind (the mod's update at its scope, or the package's install at the mod's version); null
318
+ // otherwise.
319
+ function ecart(entrees, declares, racine) {
291
320
  const paquet = versionDuPaquet();
292
321
  const id = declares.find(x => x.slice(0, x.indexOf('@')) === GREFFON_DU_CADRE);
293
322
  if (!paquet || !id) {
@@ -301,10 +330,11 @@ function ecartDeVersions(entrees, declares, racine) {
301
330
  if (typeof greffon !== 'string' || !X_Y_Z.test(greffon) || greffon === paquet) {
302
331
  return null;
303
332
  }
304
- const commande = plusAncienne(greffon, paquet)
333
+ const derriere = plusAncienne(greffon, paquet);
334
+ const commande = derriere
305
335
  ? `claude plugin update ${id} --scope ${entree.scope}`
306
336
  : `npm install -D ${NOM_DU_PAQUET}@${greffon}`;
307
- return `ecart ${id} ${greffon} ${paquet} ${commande}`;
337
+ return { id, scope: entree.scope, greffon, paquet, derriere, commande };
308
338
  }
309
339
 
310
340
  // True when version <a> comes before version <b> (x.y.z, numbers compared in order).