@roomi-fields/grillhouse 0.24.9 → 0.24.11

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.
@@ -5,5 +5,5 @@
5
5
  "author": {
6
6
  "name": "Romain Peyrichou"
7
7
  },
8
- "version": "0.24.9"
8
+ "version": "0.24.11"
9
9
  }
@@ -15,8 +15,8 @@ rôle qui écrit les refusent, `droits.mjs`). `npm run verifier` joue, après la
15
15
  construction : les gardes du cadre,
16
16
  celles du projet (son script racine `gardes`, un nom que le cadre réserve ; une garde juge les
17
17
  fichiers de l'arbre de travail, que le cache de Turborepo compte, jamais l'index de git ; elle
18
- écrit ses constats en SARIF, chacun avec son fichier et sa ligne, par `ecrireSarif` de
19
- `packages/grillhouse/scripts/resultats.mjs`, dans le dossier que nomme `GRILLHOUSE_RESULTATS`, et sans eux son rouge
18
+ écrit ses constats en SARIF, chacun avec son fichier et sa ligne, par `ecrireSarif`, que
19
+ publie l'entrée `@roomi-fields/grillhouse/resultats`, dans le dossier que nomme `GRILLHOUSE_RESULTATS`, et sans eux son rouge
20
20
  ne revient à aucun composant) et les tests, côte à côte ; un rouge n'arrête pas la passe, qui joue tout ce que ses tâches
21
21
  préalables permettent et nomme chaque rouge ; `npm run verifier -- --gardes` joue les gardes
22
22
  seules, ce que le relecteur joue sur la copie du ticket. Une tâche dont
@@ -103,6 +103,15 @@ de sa sortie, dans la limite de ses séances. Ainsi le développeur reçoit le r
103
103
  320.10 : un mot de librairie écrit dans 030-binder, absent des trois rapports « Tes rouges », puis
104
104
  un arrêt `references` sur « le plafond ne monte pas »).
105
105
 
106
+ Comme SARIF 2.1.0 et GitHub code scanning, seul un constat de niveau `error`, le niveau par défaut,
107
+ est un rouge : un avertissement (`warning`) ou une note (`note`) n'entre ni dans « Tes rouges » ni
108
+ dans le compte des rouges, aux contrôles du plan comme à la passe finale ; le rapport des contrôles
109
+ les liste à part, sous « Les avertissements », sans les donner au développeur. Une tâche de gardes
110
+ rouge sans aucun constat `error` garde sa ligne de tâche rouge et son journal. Ainsi un avertissement
111
+ reste visible sans arrêter un lot (BP 320.17 : 8 avertissements sur le code du plan donnés au
112
+ développeur comme rouges, un arrêt `sans-livraison` à 3 Code, quand le seul `error` visait le
113
+ plafond, à régénérer).
114
+
106
115
  **L'explorateur écrit le plan, questionné une fois** : comme l'auteur d'une RFC l'écrit après
107
116
  avoir relevé l'existant, qu'une revue la lit une fois, que l'auteur répond une fois et que ce qui
108
117
  reste ouvert va à qui décide, l'étape 1 du circuit (1 Plan) lance l'explorateur hors de
@@ -301,7 +310,9 @@ nom et l'une de ses entrées (le champ `exports`), jamais par l'adresse d'un fic
301
310
  la fonction, sans réexport, avec sa déclaration de types à côté (`scripts/<module>.d.ts`) :
302
311
  `@roomi-fields/grillhouse/dette` (`trancher`, la dette connue d'une garde du projet),
303
312
  `@roomi-fields/grillhouse/consommateurs` (`matieres`, les paquets de la matière de test
304
- partagée), `@roomi-fields/grillhouse/paquets` (`horsCadre`, les paquets hors cadre), et la
313
+ partagée), `@roomi-fields/grillhouse/paquets` (`horsCadre`, les paquets hors cadre),
314
+ `@roomi-fields/grillhouse/resultats` (`ecrireSarif`, les constats d'une garde du projet en
315
+ SARIF), et la
305
316
  configuration de base de Vitest, `@roomi-fields/grillhouse/vitest-config` et
306
317
  `@roomi-fields/grillhouse/vitest-config/mesure`, et la base TSDoc,
307
318
  `@roomi-fields/grillhouse/tsdoc-base.json`, dont hérite le `tsdoc.json` d'un projet : elle hérite
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomi-fields/grillhouse",
3
- "version": "0.24.9",
3
+ "version": "0.24.11",
4
4
  "description": "Roomi's Grillhouse: the frame's scripts, called by one command, grillhouse <sous-commande>",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,6 +43,10 @@
43
43
  "types": "./scripts/paquets.d.ts",
44
44
  "default": "./scripts/paquets.mjs"
45
45
  },
46
+ "./resultats": {
47
+ "types": "./scripts/resultats.d.ts",
48
+ "default": "./scripts/resultats.mjs"
49
+ },
46
50
  "./vitest-config": {
47
51
  "types": "./scripts/vitest-config/base.d.ts",
48
52
  "default": "./scripts/vitest-config/base.mjs"
@@ -224,9 +224,13 @@
224
224
  // script `test:vitest` plays only when the lot touches it), `npm test -- <test files of the lot>`
225
225
  // that none of them holds, each test played once, then the guards in the envelope of the plan (`GRILLHOUSE_ENVELOPPE=<plan> npm run
226
226
  // grillhouse:gardes`, and `npm run gardes` when the project has it). Each red is read in the
227
- // results of its command: a failed test of the reports of Vitest, a finding of the guards'
228
- // SARIF, a failed build or task of the summary; a red check none of them situates is one red of
229
- // the command. A red a path of the plan holds is the developpeur's; the others (one without a
227
+ // results of its command: a failed test of the reports of Vitest, a finding of level error of
228
+ // the guards' SARIF, a failed build or task of the summary; a red check none of them situates is
229
+ // one red of the command. As SARIF 2.1.0 and GitHub code scanning, a warning or a note shows
230
+ // without failing: the report of the checks lists them apart, under their own title, and gives
231
+ // them to no developpeur; a guards' task red without a finding of level error keeps its line of
232
+ // a red task, with its log (BPScript 320.17: 8 warnings on the code of the plan, given as reds,
233
+ // stopped at « sans-livraison » a lot whose one error was the ceiling's, to regenerate). A red a path of the plan holds is the developpeur's; the others (one without a
230
234
  // file, the root's or a project's guard without SARIF, in a package out of the plan, or a red of
231
235
  // a reference, which its regeneration lifts) wait for the final pass. Green,
232
236
  // the checks lead to the final pass.
@@ -2505,8 +2509,21 @@ function situer(ctx, liste, chemin) {
2505
2509
  // and that package again when it is out of the plan, whether it is a finding to settle
2506
2510
  // (`a-arbitrer`), and the package whose task gave it, as Turborepo names it (« // » for the
2507
2511
  // root's guards; null for a red of the command).
2512
+ // As SARIF 2.1.0 and GitHub code scanning, a finding of level error fails, a warning or a note
2513
+ // shows without failing: `{ rouges, avertissements }`, `avertissements` the lines of the findings
2514
+ // of another level, which the report lists apart. A guards' task red without a finding of level
2515
+ // error keeps its line of a red task, with its log.
2508
2516
  function rougesDe(ctx, liste, c) {
2509
- if (c.code === 0 || c.code === A_REPASSER) return [];
2517
+ const lus = lireSarif(c.dossier).constats.filter(k => k.genre !== A_ELAGUER);
2518
+ const vert = c.code === 0 || c.code === A_REPASSER;
2519
+ const duCadre = k => NOMS_DES_GARDES.includes(k.garde);
2520
+ const rouge = k => k.niveau === 'error';
2521
+ const ligneDe = k => {
2522
+ const ou = k.fichier ? ` ${k.fichier}${k.ligne ? `:${k.ligne}` : ''}` : '';
2523
+ return `${k.garde}${ou} — ${k.message}${k.genre === 'a-arbitrer' ? ' (à arbitrer)' : ''}`;
2524
+ };
2525
+ const avertissements = lus.filter(k => !rouge(k)).map(k => `${k.niveau} ${ligneDe(k)}`);
2526
+ if (vert) return { rouges: [], avertissements };
2510
2527
  const out = [];
2511
2528
  const testes = new Set();
2512
2529
  for (const res of lireRapportsVitest(c.dossier)) {
@@ -2532,11 +2549,10 @@ function rougesDe(ctx, liste, c) {
2532
2549
  }
2533
2550
  }
2534
2551
  // A key of the debt to lower (`a-elaguer`, scripts/dette.mjs) is a note, not a red.
2535
- const constats = lireSarif(c.dossier).constats.filter(k => k.genre !== A_ELAGUER);
2552
+ const constats = lus.filter(rouge);
2536
2553
  for (const k of constats) {
2537
- const ou = k.fichier ? ` ${k.fichier}${k.ligne ? `:${k.ligne}` : ''}` : '';
2538
2554
  out.push({
2539
- texte: `constat ${k.garde}${ou} — ${k.message}${k.genre === 'a-arbitrer' ? ' (à arbitrer)' : ''}`,
2555
+ texte: `constat ${ligneDe(k)}`,
2540
2556
  fichier: k.fichier ?? null,
2541
2557
  gardes: [k.garde, k.regle].filter(Boolean),
2542
2558
  ...situer(ctx, liste, k.fichier),
@@ -2545,7 +2561,7 @@ function rougesDe(ctx, liste, c) {
2545
2561
  });
2546
2562
  }
2547
2563
  // The guards of the project wrote findings when one comes from a guard out of the frame's.
2548
- const duProjet = constats.some(k => !NOMS_DES_GARDES.includes(k.garde));
2564
+ const duProjet = constats.some(k => !duCadre(k));
2549
2565
  for (const t of lireResumes(c.dossier)) {
2550
2566
  if (t.code === null || t.code === 0 || t.code === A_REPASSER) continue;
2551
2567
  if (t.script === 'test:vitest' && testes.has(t.dossier)) continue;
@@ -2574,7 +2590,7 @@ function rougesDe(ctx, liste, c) {
2574
2590
  horsTitre: null,
2575
2591
  });
2576
2592
  }
2577
- return out;
2593
+ return { rouges: out, avertissements };
2578
2594
  }
2579
2595
 
2580
2596
  const ligneDeCommande = c =>
@@ -2590,8 +2606,10 @@ const ligneDeCommande = c =>
2590
2606
  // package the pass restricted to the regeneration does not play again stands, as a CI keeps the
2591
2607
  // verdict of a job it does not run again; when the regeneration changes nothing (`rejouee`
2592
2608
  // false), no command plays, and they all stand. `{ rouge, aRepasser, arbitrer, auDeveloppeur,
2593
- // texte, complet, resume, horsTitre, lieux, tous, notes }`: `texte` the report for the
2594
- // developpeur, his reds first; `complet` every red, for a stop; `auDeveloppeur` whether a red lies
2609
+ // texte, complet, resume, horsTitre, lieux, tous, notes, avertissements }`: `texte` the report for
2610
+ // the developpeur, his reds first; `complet` every red, for a stop, and the warnings;
2611
+ // `avertissements` the section of the warnings and notes of the guards, which are no reds, for the
2612
+ // report of the checks (empty without one); `auDeveloppeur` whether a red lies
2595
2613
  // in a package of the plan; `horsTitre` the packages out of the plan that hold a red; `arbitrer`
2596
2614
  // when every red of the plan is a finding to settle; `lieux` the place of each red, `{ fichier,
2597
2615
  // gardes, dansLePlan }`, its file (null for a red without one), the names its finding carries
@@ -2619,7 +2637,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2619
2637
  r = npm(ctx, 'controles', args, env);
2620
2638
  }
2621
2639
  const c = { args, env, ...r };
2622
- return { ...c, rouges: rougesDe(ctx, liste, c) };
2640
+ return { ...c, ...rougesDe(ctx, liste, c) };
2623
2641
  });
2624
2642
  // The packages the commands played (the root's tasks under « // »), whose reds are read again.
2625
2643
  const joues = new Set(resultats.flatMap(r => lireResumes(r.dossier).map(t => t.paquet)));
@@ -2677,6 +2695,15 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2677
2695
  const ligne = r => [`- ${r.texte}`, ...(r.detail ? ['', r.detail, ''] : [])];
2678
2696
  const nomDuPaquet = r => r.paquet ?? 'hors des paquets';
2679
2697
  const journal = `Le journal du ticket, pour le détail des commandes : ${ctx.journal}`;
2698
+ // The warnings and notes of the guards, apart from the reds: shown, given to no one to correct.
2699
+ const signales = resultats.flatMap(r => r.avertissements);
2700
+ const avertissements = signales.length
2701
+ ? [
2702
+ `Les avertissements (${signales.length}), qui ne sont pas des rouges :`,
2703
+ ...signales.map(l => `- ${l}`),
2704
+ '',
2705
+ ]
2706
+ : [];
2680
2707
  const texte = [
2681
2708
  `${ou} : ${resume}.`,
2682
2709
  '',
@@ -2703,6 +2730,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2703
2730
  '',
2704
2731
  ]
2705
2732
  : []),
2733
+ ...avertissements,
2706
2734
  journal,
2707
2735
  ].join('\n');
2708
2736
  return {
@@ -2713,6 +2741,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2713
2741
  texte,
2714
2742
  complet,
2715
2743
  sansListe,
2744
+ avertissements: avertissements.length ? `\n\n${avertissements.join('\n').trimEnd()}` : '',
2716
2745
  // The reds of the stop, each with where it lies: the plan's, or at the final pass all of them;
2717
2746
  // never those left to the final pass.
2718
2747
  rouges: rouges.map(r => ({ paquet: nomDuPaquet(r), texte: r.texte, detail: r.detail })),
@@ -3040,7 +3069,7 @@ async function derouler(ctx, debut) {
3040
3069
  'controles',
3041
3070
  `${k.resume} ; ${k.rouge ? 'des rouges sont ceux de références' : 'la dette des gardes baisse'} (${noms.join(', ')}) : à leur régénération.`,
3042
3071
  resultat(k.rouge ? 'rouge' : 'vert'),
3043
- k.texte
3072
+ `${k.texte}${k.avertissements}`
3044
3073
  );
3045
3074
  // The report of the reds of the plan, which go to the developpeur when a command of the
3046
3075
  // project refuses the lot.
@@ -3077,7 +3106,7 @@ async function derouler(ctx, debut) {
3077
3106
  'controles',
3078
3107
  `${k.resume} ; développeur relancé (séance ${suivante}).`,
3079
3108
  resultat('rouge'),
3080
- k.texte
3109
+ `${k.texte}${k.avertissements}`
3081
3110
  );
3082
3111
  etape = CODE;
3083
3112
  tentative = suivante;
@@ -3090,7 +3119,13 @@ async function derouler(ctx, debut) {
3090
3119
  // which plays once, on the regenerated tree, as make remakes a generated file before
3091
3120
  // what reads it.
3092
3121
  geste(ctx, 'regeneration');
3093
- ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3122
+ ecrireRapport(
3123
+ ctx,
3124
+ 'controles',
3125
+ `${k.resume}.`,
3126
+ resultat('vert'),
3127
+ `${k.resume}.${k.avertissements}`
3128
+ );
3094
3129
  ctx.renvoiAuTestwriter = false;
3095
3130
  ctx.aRegenerer = {
3096
3131
  noms: k.references.map(r => r.nom),
@@ -3101,7 +3136,13 @@ async function derouler(ctx, debut) {
3101
3136
  tentative = 0;
3102
3137
  finale = true;
3103
3138
  } else {
3104
- ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3139
+ ecrireRapport(
3140
+ ctx,
3141
+ 'controles',
3142
+ `${k.resume}.`,
3143
+ resultat('vert'),
3144
+ `${k.resume}.${k.avertissements}`
3145
+ );
3105
3146
  // Green checks: a sending of the developpeur to the testwriter may come again.
3106
3147
  ctx.renvoiAuTestwriter = false;
3107
3148
  if (!passeFinale) {
@@ -0,0 +1,28 @@
1
+ // The types of ./resultats.mjs as the entry `@roomi-fields/grillhouse/resultats` publishes it, for
2
+ // a project's guard that writes its findings in SARIF.
3
+
4
+ /**
5
+ * A finding of a guard: its `fichier` (from the root) and its `ligne` (from 1) place it, `regle`
6
+ * is the guard's own rule, `niveau` the SARIF level (`error` by default) and `genre` who settles
7
+ * it (`a-corriger`, the default, or `a-arbitrer`, a person, never a developpeur).
8
+ */
9
+ export type Constat = {
10
+ fichier?: string;
11
+ ligne?: number;
12
+ message: string;
13
+ regle?: string;
14
+ niveau?: 'error' | 'warning' | 'note' | 'none';
15
+ genre?: 'a-corriger' | 'a-arbitrer';
16
+ };
17
+
18
+ /**
19
+ * Writes the SARIF 2.1.0 of the findings `constats` of `garde` at `racine` under the results
20
+ * directory `GRILLHOUSE_RESULTATS` of `env` (`process.env` by default): its path, or null without
21
+ * the variable. A green guard writes its run too, `constats` empty.
22
+ */
23
+ export function ecrireSarif(options: {
24
+ garde: string;
25
+ constats: Constat[];
26
+ racine?: string;
27
+ env?: Record<string, string | undefined>;
28
+ }): string | null;
@@ -82,7 +82,8 @@
82
82
  // nothing without it; a green guard writes its run, empty, so a reader knows it played. The
83
83
  // frame's guards write through the known debt (scripts/dette.mjs), their runner
84
84
  // (scripts/gardes-du-cadre.mjs) writes for a red guard that wrote none a finding without
85
- // location, and a project's guards (its script `gardes`) import `ecrireSarif` from this module.
85
+ // location, and a project's guards (its script `gardes`) import `ecrireSarif` by the package's
86
+ // entry `@roomi-fields/grillhouse/resultats`, whose types (./resultats.d.ts) declare it alone.
86
87
  // - The summary of a run of Turborepo (`turbo run … --summarize`, `.turbo/runs/<id>.json`):
87
88
  // `garderLesResumes` moves the summaries a run wrote into `<dossier>/turbo/`, and `lireResumes`
88
89
  // gives each task, its package and directory, its script, its exit code, its cache status and