@roomi-fields/grillhouse 0.24.3 → 0.24.5
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.
- package/.claude-plugin/plugin.json +1 -1
- package/docs/ARCHITECTURE.md +31 -5
- package/package.json +1 -1
- package/scripts/bilan.mjs +32 -18
- package/scripts/circuit.mjs +162 -75
- package/scripts/consommateurs.mjs +32 -16
- package/scripts/dernier-vert.mjs +26 -0
- package/scripts/etapes.mjs +1 -1
- package/scripts/integration/integrer.mjs +20 -10
- package/scripts/migrations/0.24.4-noms-declares-inutilises.mjs +48 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/tableau.mjs +13 -3
- package/scripts/vitest-config/changements.mjs +60 -8
- package/skills/pitmaster/SKILL.md +29 -24
- package/skills/redacteur/references/documents-d-un-composant.md +7 -7
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -24,10 +24,17 @@ hit, replaying logs »), et cette relecture vaut un lancement. Une passe se mesu
|
|
|
24
24
|
dernier vert, l'arbre de la dernière passe verte de sa branche, celle de main pour une copie
|
|
25
25
|
qui n'en a pas encore, comme `vitest --changed` : un paquet que Turborepo rejoue joue les seuls tests que Vitest relie aux fichiers changés depuis,
|
|
26
26
|
et tous ses tests quand un changement sort du graphe de Vitest (un fichier supprimé, une
|
|
27
|
-
configuration, un fichier qu'aucun module n'importe,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
configuration, un fichier qu'aucun module n'importe, un fichier, changé ou supprimé, que lit
|
|
28
|
+
la construction d'un paquet dont il dépend, un chemin que ses tests déclarent lire,
|
|
29
|
+
`grillhouse.lit`) ; la construction d'un voisin lit les entrées du `build` de son turbo.json,
|
|
30
|
+
lues comme Turborepo les lit (`$TURBO_DEFAULT$` : tous les fichiers du paquet, `docs/`
|
|
31
|
+
compris ; `$TURBO_EXTENDS$` : les entrées du `build` de la racine), et, quand elles n'en
|
|
32
|
+
nomment aucune, son code et sa configuration hors de son `docs/` ; jamais un test ; sans vert
|
|
33
|
+
connu, la passe est complète, et `npm run verifier -- --tout` la joue pour de vrai, comme la
|
|
34
|
+
nuit. Un fichier que le commit du vert ne suit pas vit dans le seul arbre qui l'a gardé :
|
|
35
|
+
absent d'une copie mesurée contre le vert de main, il n'est pas supprimé, comme Nx et
|
|
36
|
+
Turborepo mesurent contre un commit. Ainsi un test ne tourne qu'une fois tant que rien ne
|
|
37
|
+
change, et corriger un test ne rejoue que lui.
|
|
31
38
|
|
|
32
39
|
**Tout se lit, le plan s'écrit** : un agent de rôle travaille dans l'enveloppe de sa copie
|
|
33
40
|
(`packages/grillhouse/scripts/enveloppe/`, un bac à sable bubblewrap) ; il lit toute la copie,
|
|
@@ -64,7 +71,15 @@ qu'il nomme (4.2), puis rejoue la passe finale restreinte à ce que la régéné
|
|
|
64
71
|
autres rouges restent, chacun à son propriétaire. Les références sont celles que le projet déclare
|
|
65
72
|
(`grillhouse.references`) et celles du cadre, dans chaque projet (`REFERENCES_DU_CADRE` de
|
|
66
73
|
`circuit.mjs`) : l'index des interfaces, les `turbo.json` des paquets et les rapports d'API, chacun
|
|
67
|
-
réécrit par son générateur
|
|
74
|
+
réécrit par son générateur, et la dette des gardes. Une référence, du projet comme du cadre, se
|
|
75
|
+
régénère sans que le plan la nomme, comme une genrule, et le relecteur lit sa différence. Comme
|
|
76
|
+
make refait une cible avec celles qui dépendent de ses sorties, chaque référence déclare ce
|
|
77
|
+
qu'elle lit d'une autre (`lit`) : une commande qui écrit un fichier qu'une autre lit la fait
|
|
78
|
+
jouer après elle (l'index des interfaces après les rapports d'API, qui écrivent la part générée
|
|
79
|
+
des `docs/INTERFACE.md`). Un arrêt de la régénération (une commande en échec, un fichier
|
|
80
|
+
qu'aucune référence n'écrit) porte ses écarts dans sa question et au ticket (BP 320.3.2.1 : l'index
|
|
81
|
+
oublié après les rapports d'API, un plafond refusé faute d'être nommé au plan, la liste des écarts
|
|
82
|
+
retrouvée en trois commandes). Le circuit ne lit pas
|
|
68
83
|
le code de sortie d'un générateur du cadre, qui juge aussi les rouges qu'il laisse (`npm run api`
|
|
69
84
|
refuse à côté d'eux) : il juge la régénération sur ce qu'elle écrit, puis sur la passe restreinte
|
|
70
85
|
qui suit, et seule une vraie panne l'arrête (la commande introuvable, ou tuée par un signal). La dette s'abaisse depuis les notes de la passe finale (une note
|
|
@@ -141,6 +156,17 @@ pas), il calcule le coût sur ses jetons, au tarif de son modèle (`TARIFS` de `
|
|
|
141
156
|
le bilan compte toutes les séances, et un sous-agent du superviseur coûte ce qu'il a dépensé (BP 320.8 : « 0 séances ; 0,00 $ » pour 25
|
|
142
157
|
séances et 20,36 $, et 0 $ pour un questionneur du superviseur).
|
|
143
158
|
|
|
159
|
+
**Le bilan juge sur ce qui s'est passé, face à une base refaite** : comme ccusage découpe une
|
|
160
|
+
transcription, un tour commence à son message entrant ; les opérations de file et le message sans
|
|
161
|
+
modèle qu'une reprise écrit avant lui ne prolongent pas le tour d'avant (`horsDuTour` de
|
|
162
|
+
`tableau.mjs`). Le circuit garde avec l'issue de chaque contrôle ses rouges, et deux contrôles
|
|
163
|
+
mesurent la même chose quand leur issue et leurs rouges sont les mêmes : la passe qui suit une
|
|
164
|
+
régénération, ses rouges autres, compte. Comme un banc de temps refait sa base, le bilan se compare
|
|
165
|
+
au dernier autre ticket du projet, son bilan recalculé par la version courante depuis ses sources,
|
|
166
|
+
et à rien quand elles n'en donnent plus. Le journal d'un ticket date chaque en-tête, d'étape ou de
|
|
167
|
+
séance, à l'heure locale avec son décalage (ISO 8601). Ainsi la perte dite est celle mesurée (BP
|
|
168
|
+
320.3.2.1 : 34 % dits pour 8,5 % mesurés, « séances 0 → 10 » face au bilan gardé de 320.8).
|
|
169
|
+
|
|
144
170
|
**Un fait porte sa pièce** : comme une revue de code cite la ligne qu'elle juge, chaque constat,
|
|
145
171
|
question ou montée d'une fiche porte sa `piece`, un seul format (`lirePiece` de `resultats.mjs`) :
|
|
146
172
|
`fichier:ligne` ou `fichier:ligne-ligne` depuis la racine de la copie, ou `$ commande` et sa
|
package/package.json
CHANGED
package/scripts/bilan.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// npx grillhouse bilan <ticket> [--garder]
|
|
8
8
|
//
|
|
9
9
|
// prints the bilan of <ticket>, read from the main tree of the current directory; `--garder` keeps
|
|
10
|
-
// it too, as the circuit does, so the next ticket's bilan
|
|
10
|
+
// it too, as the circuit does, so the next ticket's bilan names it as its base.
|
|
11
11
|
//
|
|
12
12
|
// - Its sources are structured results, never a text (tests/unit/circuit-sans-texte-libre.spec.ts):
|
|
13
13
|
// the register of finished agents (`~/.claude/grillhouse/registre.jsonl`, GRILLHOUSE_REGISTRE
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
// `.claude/worktrees/<ticket>.fiches.jsonl`, each with its time: the launch of each session the
|
|
18
18
|
// circuit opens or resumes (`lancement`: its role and its session id, the register line's
|
|
19
19
|
// `agent`), the sheet of each session (`{ role, fiche }`), the outcome of each proof
|
|
20
|
-
// (`resultat`: `ok`, its counts, `vide`) and of each check (`resultat`: `issue` vert, rouge or a-repasser, `finale`), each
|
|
21
|
-
// (`arret`, its name, `finale
|
|
20
|
+
// (`resultat`: `ok`, its counts, `vide`) and of each check (`resultat`: `issue` vert, rouge or a-repasser, `finale`, its reds `rouges`), each
|
|
21
|
+
// stop (`arret`, its name, `finale`, the outcome of the checks it stops), each developpeur resumed who changed nothing (`inchange`), the
|
|
22
22
|
// end of the questioning of the plan (`questionnement`: its `objet`, the questions the
|
|
23
23
|
// questionneur asked, `questions`, whether an answer changed the plan, `change`, its `issue`,
|
|
24
24
|
// AUCUNE, QUESTIONS or DÉSACCORD, and the questions left open, `ouvertes`), each end of a run on
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
// proof finds the lot of the proof before it (the same counts of reds, greens of the lot,
|
|
49
49
|
// broken files and greens of HEAD), after a refused proof, or no file of the lot (`vide`:
|
|
50
50
|
// reds that exist already or of a build alone, no green of the lot); that proof; checks that
|
|
51
|
-
// play the same
|
|
51
|
+
// play the same measure again (their outcome and their reds) with no delivery of the testwriter or the developpeur since the
|
|
52
52
|
// checks of their kind before (the final pass: since the final pass before);
|
|
53
53
|
// - questionnement: a session of the questionneur (kept: a look that did not write the plan, as
|
|
54
54
|
// a review);
|
|
@@ -73,8 +73,9 @@
|
|
|
73
73
|
// questions left open, the tokens, the cache reads and the cost (a session without a cost
|
|
74
74
|
// counts 0); a session's tokens go to its turns by their time.
|
|
75
75
|
// - It is kept in the main tree, `.claude/worktrees/<ticket>.bilan.json`, and compares itself with
|
|
76
|
-
// the latest
|
|
77
|
-
//
|
|
76
|
+
// the latest other ticket of the project whose bilan is kept, its bilan computed again by this
|
|
77
|
+
// version from its sources (`precedent`), or with nothing when they give none: no figure kept by
|
|
78
|
+
// an earlier version, and none of another project, is written here.
|
|
78
79
|
import { spawnSync } from 'node:child_process';
|
|
79
80
|
import { existsSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
80
81
|
import os from 'node:os';
|
|
@@ -176,6 +177,10 @@ const signature = r => [r.rouges, r.justifies + r.sans, r.casses, r.anciens].joi
|
|
|
176
177
|
const issue = e =>
|
|
177
178
|
e.arret ? (e.arret === 'a-repasser' ? 'a-repasser' : 'rouge') : (e.resultat?.issue ?? 'rouge');
|
|
178
179
|
|
|
180
|
+
// What the checks of the result <e> measured: their outcome and their reds (`rouges`, each one's
|
|
181
|
+
// place and text), in any order; checks of the same measure played the same thing again.
|
|
182
|
+
const laMesure = e => [issue(e), ...[...(e.resultat?.rouges ?? [])].sort()].join('\n');
|
|
183
|
+
|
|
179
184
|
// The length of the union of the intervals <l>.
|
|
180
185
|
function longueur(l) {
|
|
181
186
|
let total = 0;
|
|
@@ -304,8 +309,12 @@ export function bilan({
|
|
|
304
309
|
const change =
|
|
305
310
|
!avant || segments.some(x => livre(x) && x.d >= avant.f - JEU && x.f <= s.d + JEU);
|
|
306
311
|
const i = s.entree ? issue(s.entree) : 'rouge';
|
|
312
|
+
// The same measure again: the same outcome, and the same reds when the checks kept them.
|
|
313
|
+
const memeMesure =
|
|
314
|
+
avant?.entree &&
|
|
315
|
+
(s.entree ? laMesure(avant.entree) === laMesure(s.entree) : issue(avant.entree) === i);
|
|
307
316
|
s.categorie =
|
|
308
|
-
change || !
|
|
317
|
+
change || !memeMesure
|
|
309
318
|
? s.finale
|
|
310
319
|
? 'finales'
|
|
311
320
|
: 'automatique'
|
|
@@ -446,7 +455,7 @@ export const enBref = b =>
|
|
|
446
455
|
`Bilan : ${minutes(b.mur)} min, ${pourcent(b.perdu, b.mur)} % perdus, ${b.seances.total} séances, ${dollars(b.cout)} $.`;
|
|
447
456
|
|
|
448
457
|
// The text of the bilan <b> at the ticket, short and in figures, compared with the bilan
|
|
449
|
-
// <avant> (another ticket's, or null).
|
|
458
|
+
// <avant> (another ticket's, computed again, or null).
|
|
450
459
|
export function texteDuBilan(b, avant) {
|
|
451
460
|
const lesRoles = parRole =>
|
|
452
461
|
Object.entries(parRole)
|
|
@@ -478,7 +487,7 @@ export function texteDuBilan(b, avant) {
|
|
|
478
487
|
.map(([nom, n]) => `${n} ${nom}`)
|
|
479
488
|
.join(', ');
|
|
480
489
|
const base = avant
|
|
481
|
-
? `Face au bilan de ${avant.ticket} : mur ${minutes(avant.mur)} → ${minutes(b.mur)} min, perte ${pourcent(avant.perdu, avant.mur)} → ${pourcent(b.perdu, b.mur)} %, séances ${avant.seances.total} → ${b.seances.total}, coût ${dollars(avant.cout)} → ${dollars(b.cout)} $.`
|
|
490
|
+
? `Face au bilan de ${avant.ticket}, recalculé : mur ${minutes(avant.mur)} → ${minutes(b.mur)} min, perte ${pourcent(avant.perdu, avant.mur)} → ${pourcent(b.perdu, b.mur)} %, séances ${avant.seances.total} → ${b.seances.total}, coût ${dollars(avant.cout)} → ${dollars(b.cout)} $.`
|
|
482
491
|
: "Aucun bilan d'avant dans ce projet : pas de base.";
|
|
483
492
|
return [tete, ...lignes, `Arrêts : ${arrets || 'aucun'}.`, base].join('\n');
|
|
484
493
|
}
|
|
@@ -510,13 +519,18 @@ export function bilansGardes(racine) {
|
|
|
510
519
|
return out;
|
|
511
520
|
}
|
|
512
521
|
|
|
513
|
-
// The
|
|
522
|
+
// The base of the bilan of <ticket> in the main tree <racine>: the bilan of the latest other ticket
|
|
523
|
+
// whose bilan is kept, computed again by this version from its sources, as a bench of time remakes
|
|
524
|
+
// its base, never the figures kept by the version that wrote them; null when its sources give no
|
|
525
|
+
// bilan any more. The figures a base gives (wall time, loss, sessions, cost) hold whoever waited,
|
|
526
|
+
// the owner or the supervisor: its comments are not read, bd reading those of <ticket> alone.
|
|
514
527
|
export function precedent(racine, ticket) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
);
|
|
528
|
+
const avant = Object.values(bilansGardes(racine))
|
|
529
|
+
.filter(b => b.ticket !== ticket)
|
|
530
|
+
.sort((x, y) => Date.parse(y.calcule ?? 0) - Date.parse(x.calcule ?? 0))[0];
|
|
531
|
+
if (!avant) return null;
|
|
532
|
+
const b = calculer(racine, avant.ticket, { commentaires: false });
|
|
533
|
+
return b.mur > 0 ? b : null;
|
|
520
534
|
}
|
|
521
535
|
|
|
522
536
|
// The lines of the register <texte> of the project at <racine>: its project the main tree, or a
|
|
@@ -549,8 +563,8 @@ function commentairesDu(racine, ticket) {
|
|
|
549
563
|
}
|
|
550
564
|
|
|
551
565
|
// The bilan of <ticket> computed from the main tree <racine>: its register, the results its
|
|
552
|
-
// circuit kept, its circuit's state, the comments of the ticket.
|
|
553
|
-
function calculer(racine, ticket) {
|
|
566
|
+
// circuit kept, its circuit's state, and the comments of the ticket unless <commentaires> is false.
|
|
567
|
+
function calculer(racine, ticket, { commentaires = true } = {}) {
|
|
554
568
|
const registre =
|
|
555
569
|
process.env.GRILLHOUSE_REGISTRE ??
|
|
556
570
|
path.join(os.homedir(), '.claude', 'grillhouse', 'registre.jsonl');
|
|
@@ -578,7 +592,7 @@ function calculer(racine, ticket) {
|
|
|
578
592
|
entrees,
|
|
579
593
|
etat,
|
|
580
594
|
nuit: plageDeNuit(racine),
|
|
581
|
-
commentaires: commentairesDu(racine, ticket),
|
|
595
|
+
commentaires: commentaires ? commentairesDu(racine, ticket) : [],
|
|
582
596
|
});
|
|
583
597
|
}
|
|
584
598
|
|
package/scripts/circuit.mjs
CHANGED
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
// the sheet that ends each session, the summaries of Turborepo, the JSON reports of Vitest and the
|
|
41
41
|
// SARIF of the guards. It reads no comment, no answer and no log to decide (a guard holds it:
|
|
42
42
|
// tests/unit/circuit-sans-texte-libre.spec.ts); the handovers at the ticket are for the human and
|
|
43
|
-
// for the next session of their author, the log for the human.
|
|
43
|
+
// for the next session of their author, the log for the human. Each header of the log, a step's or
|
|
44
|
+
// a session's, dates it in local time with its offset (ISO 8601), one time for the whole log.
|
|
44
45
|
//
|
|
45
46
|
// - The plan is read in the ticket's title (`bd show <ticket> --json`), after its last « — »,
|
|
46
47
|
// separated by commas: each one a path (`packages/<nom>`, or `.`), or the name of a package,
|
|
@@ -250,33 +251,36 @@
|
|
|
250
251
|
// commande, fichiers, tests, gardes }`, its name, the shell command that writes it again from the
|
|
251
252
|
// root of the copy, the files it writes (paths, directories or glob patterns, `*` and `**`, from
|
|
252
253
|
// the root, as the inputs of Turborepo), the test files that judge it, as `rustc --bless` ties a
|
|
253
|
-
// test to its expected outputs,
|
|
254
|
-
// SARIF finding carries (its guard or its
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
//
|
|
258
|
-
//
|
|
254
|
+
// test to its expected outputs, `lit`, the files it reads that another reference writes, and the
|
|
255
|
+
// guards of the project that judge it, by the name their SARIF finding carries (its guard or its
|
|
256
|
+
// rule). The frame's references follow in every project (REFERENCES_DU_CADRE): the files the
|
|
257
|
+
// frame generates, each judged by a guard of the frame, by the names its findings carry (the
|
|
258
|
+
// index of the interfaces, which reads the interfaces, the turbo.json of the packages, the API
|
|
259
|
+
// reports, which write the generated part of the interfaces), and the known debt of the guards;
|
|
260
|
+
// a reference of the project whose first file is one of theirs replaces it. A final pass with a red of a reference (a failed test of one of
|
|
259
261
|
// their test files, a finding of one of their guards, whatever file it aims at, or a failed test
|
|
260
262
|
// or a finding on a file a reference of the project covers), mixed with other reds or not, or a
|
|
261
263
|
// guard's note of a key of the debt inscribed above what it finds (`a-elaguer`, the pass green
|
|
262
264
|
// or not), sends no developpeur: the gesture `regeneration`, once for that pass. The circuit
|
|
263
265
|
// keeps the copy as a lot, runs the command of each reference concerned on the whole copy (the
|
|
264
266
|
// debt lowered from the notes of the pass, its guards not played again), out of the envelope,
|
|
265
|
-
// under the lock of the machine, its output added to the log,
|
|
267
|
+
// under the lock of the machine, its output added to the log, then, as make remakes the targets
|
|
268
|
+
// that depend on an output, the command of each reference that reads a file one has just
|
|
269
|
+
// written, after it (the index after the API reports), keeps the copy again on that lot, then plays the final pass restricted to what the regeneration changed and its
|
|
266
270
|
// dependents (`--filter=...[<avant>...<après>] --filter=//`); each red of the pass before in a
|
|
267
271
|
// package that pass does not play again stands, and a regeneration that changes nothing plays no
|
|
268
272
|
// pass, every red of the pass before standing. What remains goes each to its owner, as any red
|
|
269
273
|
// of the final pass; a ceiling never rises (its command lowers it), so a lot beyond it stays red.
|
|
270
274
|
// That pass green after a whole one keeps its tree as verified. The files regenerated stay in
|
|
271
|
-
// the copy: the lot carries them,
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
//
|
|
275
|
+
// the copy: the lot carries them, without a word of the plan, as a genrule writes its output,
|
|
276
|
+
// and the reviewer reads them with the rest of the lot, the step's report among the circuit's. A
|
|
277
|
+
// file changed that the files of no reference run cover, or a command that fails stops at
|
|
278
|
+
// « references » (23): a command of
|
|
275
279
|
// the project at a code other than 0, one of the frame on a real failure alone (not found, killed
|
|
276
280
|
// by a signal), since its code also judges the reds it leaves (`npm run api` refuses beside
|
|
277
281
|
// them), which the pass that follows judges. The stop leaves the copy restored as it was before
|
|
278
|
-
// the regeneration, each
|
|
279
|
-
//
|
|
282
|
+
// the regeneration, a question for the supervisor that carries each deviation (the command and
|
|
283
|
+
// its code, the file), as the comment at the ticket does; the state keeps the references to regenerate and the reds of the
|
|
280
284
|
// pass before (`aRegenerer`), for a regeneration resumed.
|
|
281
285
|
// - The proof, the checks and the final pass are heavy passes: each holds the lock of the machine
|
|
282
286
|
// (scripts/verrou-de-machine.mjs), shared by every repository of the machine, and waits, the
|
|
@@ -439,9 +443,11 @@
|
|
|
439
443
|
// RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
|
|
440
444
|
// ticket), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
|
|
441
445
|
// sending to the testwriter), 20 besoin (a testwriter or developpeur whose sheet says BESOIN, a
|
|
442
|
-
// reviewer whose sheet carries a `question
|
|
443
|
-
//
|
|
444
|
-
//
|
|
446
|
+
// reviewer whose sheet carries a `question`, or a ticket labelled `arbitrage` whose arbitrage
|
|
447
|
+
// `refusArbitrage` of scripts/integration/integrer.mjs refuses, at the launch or a resumption,
|
|
448
|
+
// before any session), 22 questionnement (questions of the plan left open
|
|
449
|
+
// after the explorateur's answer), 23 references (a regeneration of 4.2 that changes a file
|
|
450
|
+
// no reference writes, or whose command fails), 24 hors-plan (a testwriter or developpeur session its lock
|
|
445
451
|
// stops on a write out of the plan, `<ticket>.hors-plan` that lancer.sh writes), each a question
|
|
446
452
|
// for the supervisor; 75 a-repasser (a check or the integration still at 75 once played again,
|
|
447
453
|
// or the branch still in the queue), the gesture `a-repasser`.
|
|
@@ -507,6 +513,7 @@ import {
|
|
|
507
513
|
} from './resultats.mjs';
|
|
508
514
|
import { AUTEUR_DE_LA_FILE } from './integration/file.mjs';
|
|
509
515
|
import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
|
|
516
|
+
import { refusArbitrage } from './integration/integrer.mjs';
|
|
510
517
|
import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
|
|
511
518
|
import { attendreUnPeu } from './verrou-de-fichier.mjs';
|
|
512
519
|
import { AttenteDeLaMachine, avecLaMachine } from './verrou-de-machine.mjs';
|
|
@@ -583,20 +590,24 @@ const generateur = (script, ...args) =>
|
|
|
583
590
|
// frame generates, each judged by a guard of the frame and written again by its generator, whose
|
|
584
591
|
// code the circuit does not read (a real failure aside): what it writes, then the pass that
|
|
585
592
|
// follows, judge it; and the known debt of the guards, lowered from the notes of the final pass (`dette.mjs --abaisser`,
|
|
586
|
-
// `abaisser`: its command names the file of those notes). Each `{ nom, commande, fichiers,
|
|
587
|
-
// gardes }`, `
|
|
588
|
-
// rule
|
|
593
|
+
// `abaisser`: its command names the file of those notes). Each `{ nom, commande, fichiers, lit,
|
|
594
|
+
// gardes }`, `lit` the files of the copy it reads that another reference writes (as the
|
|
595
|
+
// prerequisites of a rule of make: the index reads the interfaces, whose generated part the API
|
|
596
|
+
// reports write), `gardes` the names the findings its regeneration lifts carry (their guard or
|
|
597
|
+
// their rule).
|
|
589
598
|
const REFERENCES_DU_CADRE = [
|
|
590
599
|
{
|
|
591
600
|
nom: "l'index des interfaces",
|
|
592
601
|
commande: generateur('index-interfaces.mjs'),
|
|
593
602
|
fichiers: ['docs/agents/index-des-interfaces.md'],
|
|
603
|
+
lit: ['docs/INTERFACE.md', '**/docs/INTERFACE.md'],
|
|
594
604
|
gardes: ['index-interfaces'],
|
|
595
605
|
},
|
|
596
606
|
{
|
|
597
607
|
nom: 'les turbo.json des paquets',
|
|
598
608
|
commande: generateur('turbo-des-paquets.mjs', '--ecrire'),
|
|
599
609
|
fichiers: ['turbo.json', 'turbo.jsonc', '**/turbo.json'],
|
|
610
|
+
lit: [],
|
|
600
611
|
gardes: ['turbo-des-paquets'],
|
|
601
612
|
},
|
|
602
613
|
{
|
|
@@ -608,12 +619,14 @@ const REFERENCES_DU_CADRE = [
|
|
|
608
619
|
'**/docs/INTERFACE.api.md',
|
|
609
620
|
'**/docs/INTERFACE.md',
|
|
610
621
|
],
|
|
622
|
+
lit: [],
|
|
611
623
|
gardes: ['rapport-api', 'partie-generee'],
|
|
612
624
|
},
|
|
613
625
|
{
|
|
614
626
|
nom: 'la dette des gardes',
|
|
615
627
|
commande: generateur('dette.mjs', '--abaisser', '<notes>'),
|
|
616
628
|
fichiers: [DETTE],
|
|
629
|
+
lit: [],
|
|
617
630
|
gardes: [],
|
|
618
631
|
abaisser: true,
|
|
619
632
|
},
|
|
@@ -624,8 +637,8 @@ const GABARIT = path.join(GREFFON, 'skills', 'pitmaster', 'references', 'consign
|
|
|
624
637
|
|
|
625
638
|
// A stop of the circuit: its name (a key of ARRETS) and its report; for a stop of the checks, its
|
|
626
639
|
// reds read in the structured results (`{ paquet, texte, detail }`) and its motive, the report
|
|
627
|
-
// without their list; the outcome of the step it stops, when it has one (a proof's
|
|
628
|
-
// bilan reads; and what its montée carries beyond the question of its kind (scripts/etapes.mjs,
|
|
640
|
+
// without their list; the outcome of the step it stops, when it has one (a proof's, the checks'
|
|
641
|
+
// with their reds), which the bilan reads; and what its montée carries beyond the question of its kind (scripts/etapes.mjs,
|
|
629
642
|
// MONTEES): its `piece` (file:line, or command and output), its own `question`, and who must
|
|
630
643
|
// answer it (`qui`, the owner for the reviewer's question).
|
|
631
644
|
class Arret extends Error {
|
|
@@ -832,8 +845,9 @@ function lesCommentaires(ctx) {
|
|
|
832
845
|
}));
|
|
833
846
|
}
|
|
834
847
|
|
|
835
|
-
// The ticket's description (its criteria), notes and
|
|
836
|
-
// at the launch of each session: `{ description, notes, titre }`; a failed
|
|
848
|
+
// The ticket's description (its criteria), notes, title and labels as Beads holds them at this
|
|
849
|
+
// moment, read at the launch of each session: `{ description, notes, titre, labels }`; a failed
|
|
850
|
+
// read throws.
|
|
837
851
|
function leTicket(ctx) {
|
|
838
852
|
const r = ctx.bd('show', ctx.ticket, '--json');
|
|
839
853
|
if (r.status !== 0) {
|
|
@@ -846,6 +860,7 @@ function leTicket(ctx) {
|
|
|
846
860
|
description: String(t.description ?? ''),
|
|
847
861
|
notes: String(t.notes ?? ''),
|
|
848
862
|
titre: String(t.title ?? ''),
|
|
863
|
+
labels: Array.isArray(t.labels) ? t.labels.map(String) : [],
|
|
849
864
|
};
|
|
850
865
|
}
|
|
851
866
|
|
|
@@ -901,7 +916,7 @@ function commenter(ctx, etape, texte) {
|
|
|
901
916
|
// The report of a proof or of checks: its line at the ticket, and its report kept for the
|
|
902
917
|
// reviewer, <rapport> when the comment carries only its summary, beside its outcome <resultat>,
|
|
903
918
|
// which the bilan reads (scripts/bilan.mjs): for a proof `{ ok, rouges, justifies, sans, casses,
|
|
904
|
-
// anciens, vide }`, for checks `{ issue, finale }`.
|
|
919
|
+
// anciens, vide }`, for checks `{ issue, finale, rouges }`.
|
|
905
920
|
function ecrireRapport(ctx, etape, texte, resultat, rapport = texte) {
|
|
906
921
|
commenter(ctx, etape, texte);
|
|
907
922
|
inscrire(ctx, {
|
|
@@ -958,9 +973,19 @@ function inscrireEtape(ctx, { etape, debut }) {
|
|
|
958
973
|
}
|
|
959
974
|
}
|
|
960
975
|
|
|
961
|
-
// The
|
|
976
|
+
// The time <d> in local time with its offset, to the second, as ISO 8601 writes it and as the
|
|
977
|
+
// envelope dates the header of a session (`date -Iseconds`): « 2026-10-25T12:42:11+01:00 ».
|
|
978
|
+
function heureLocale(d = new Date()) {
|
|
979
|
+
const deux = n => String(n).padStart(2, '0');
|
|
980
|
+
const decalage = -d.getTimezoneOffset();
|
|
981
|
+
const a = Math.abs(decalage);
|
|
982
|
+
return `${d.getFullYear()}-${deux(d.getMonth() + 1)}-${deux(d.getDate())}T${deux(d.getHours())}:${deux(d.getMinutes())}:${deux(d.getSeconds())}${decalage < 0 ? '-' : '+'}${deux(Math.floor(a / 60))}:${deux(a % 60)}`;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// The header line of a step or a session in the ticket's log, in local time, as the envelope
|
|
986
|
+
// dates a session's.
|
|
962
987
|
const entete = (ctx, etape) =>
|
|
963
|
-
appendFileSync(ctx.journal, `=== ${
|
|
988
|
+
appendFileSync(ctx.journal, `=== ${heureLocale()} · circuit · ${etape} ===\n`);
|
|
964
989
|
|
|
965
990
|
// The latest moment a transcript of the copy moved, or 0.
|
|
966
991
|
function derniereTrace(dossier) {
|
|
@@ -1630,8 +1655,8 @@ function laPasseFinale(ctx) {
|
|
|
1630
1655
|
}
|
|
1631
1656
|
|
|
1632
1657
|
// The references of the circuit: those the project declares in the package.json of the copy
|
|
1633
|
-
// (`grillhouse.references`), each `{ nom, commande, fichiers, tests, gardes }` with a name, a
|
|
1634
|
-
// command and files, `tests` and `gardes` arrays when given, empty when not; then the frame's
|
|
1658
|
+
// (`grillhouse.references`), each `{ nom, commande, fichiers, tests, lit, gardes }` with a name, a
|
|
1659
|
+
// command and files, `tests`, `lit` and `gardes` arrays when given, empty when not; then the frame's
|
|
1635
1660
|
// (REFERENCES_DU_CADRE, `cadre`), each but one whose first file a reference of the project covers,
|
|
1636
1661
|
// which replaces it.
|
|
1637
1662
|
function lesReferences(ctx) {
|
|
@@ -1645,9 +1670,16 @@ function lesReferences(ctx) {
|
|
|
1645
1670
|
Array.isArray(r.fichiers) &&
|
|
1646
1671
|
r.fichiers.length > 0 &&
|
|
1647
1672
|
(r.tests === undefined || Array.isArray(r.tests)) &&
|
|
1673
|
+
(r.lit === undefined || Array.isArray(r.lit)) &&
|
|
1648
1674
|
(r.gardes === undefined || Array.isArray(r.gardes))
|
|
1649
1675
|
)
|
|
1650
|
-
.map(r => ({
|
|
1676
|
+
.map(r => ({
|
|
1677
|
+
...r,
|
|
1678
|
+
tests: r.tests ?? [],
|
|
1679
|
+
lit: r.lit ?? [],
|
|
1680
|
+
gardes: r.gardes ?? [],
|
|
1681
|
+
cadre: false,
|
|
1682
|
+
}));
|
|
1651
1683
|
const duCadre = REFERENCES_DU_CADRE.filter(
|
|
1652
1684
|
c => !duProjet.some(r => couvertPar(r.fichiers, c.fichiers[0]))
|
|
1653
1685
|
).map(c => ({ ...c, tests: [], cadre: true }));
|
|
@@ -1679,27 +1711,28 @@ function referencesDesRouges(ctx, lieux, aElaguer = false) {
|
|
|
1679
1711
|
);
|
|
1680
1712
|
}
|
|
1681
1713
|
|
|
1682
|
-
// The regeneration of the references named <noms> (4.2)
|
|
1683
|
-
//
|
|
1684
|
-
//
|
|
1685
|
-
//
|
|
1686
|
-
//
|
|
1687
|
-
//
|
|
1688
|
-
//
|
|
1689
|
-
//
|
|
1690
|
-
//
|
|
1691
|
-
//
|
|
1714
|
+
// The regeneration of the references named <noms> (4.2), as make remakes a target and then the
|
|
1715
|
+
// targets that depend on its outputs: the copy kept as a lot on the one the last review read (or
|
|
1716
|
+
// HEAD), each command run on the whole copy, in their order; a reference that reads (`lit`) a file
|
|
1717
|
+
// another one has just written runs after it, once for each reference whose writing calls for it;
|
|
1718
|
+
// then the copy kept again on that lot. `{ texte, regenerees, fichiers, restreinte }`: the report,
|
|
1719
|
+
// 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.
|
|
1692
1726
|
function regenerer(ctx, noms, notes = []) {
|
|
1693
1727
|
// The notes of the debt, in a file of the run, which the command that lowers it reads.
|
|
1694
1728
|
const fichierDesNotes = path.join(ctx.base.dossier, 'dette-a-abaisser.json');
|
|
1695
|
-
const
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
r
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
if (refs.some(r => r.abaisser)) writeFileSync(fichierDesNotes, `${JSON.stringify(notes)}\n`);
|
|
1729
|
+
const toutes = lesReferences(ctx).map(r =>
|
|
1730
|
+
r.abaisser
|
|
1731
|
+
? { ...r, commande: generateur('dette.mjs', '--abaisser', JSON.stringify(fichierDesNotes)) }
|
|
1732
|
+
: r
|
|
1733
|
+
);
|
|
1734
|
+
const aJouer = toutes.filter(r => noms.includes(r.nom));
|
|
1735
|
+
if (aJouer.some(r => r.abaisser)) writeFileSync(fichierDesNotes, `${JSON.stringify(notes)}\n`);
|
|
1703
1736
|
const avant = garderLeLot(ctx, relectureDAvant(ctx)?.lot.commit);
|
|
1704
1737
|
if (!avant) {
|
|
1705
1738
|
throw new Arret(
|
|
@@ -1710,47 +1743,62 @@ function regenerer(ctx, noms, notes = []) {
|
|
|
1710
1743
|
// The command of a reference of the frame is judged by what it writes, then by the pass that
|
|
1711
1744
|
// follows, never by its code, which also judges the reds it leaves (`npm run api` refuses beside
|
|
1712
1745
|
// them): a real failure alone counts; a reference of the project, by its code.
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
);
|
|
1746
|
+
const refs = [];
|
|
1747
|
+
const echecs = [];
|
|
1748
|
+
const appelees = new Set();
|
|
1749
|
+
let arbre = avant.arbre;
|
|
1750
|
+
while (aJouer.length) {
|
|
1751
|
+
const r = aJouer.shift();
|
|
1752
|
+
const x = commandeDeReference(ctx, r.commande);
|
|
1753
|
+
if (!refs.includes(r)) refs.push(r);
|
|
1754
|
+
if (x.panne || (!r.cadre && x.code !== 0)) {
|
|
1755
|
+
echecs.push(
|
|
1756
|
+
`- ${r.nom} : \`${r.commande}\` rend le code ${x.code}${x.panne ? ' (une panne)' : ''}.`
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
// The references that read a file this command wrote run after it.
|
|
1760
|
+
const suivant = arbreDeLaCopie(ctx);
|
|
1761
|
+
const ecrits = suivant ? differenceDesLots(ctx, arbre, suivant) : [];
|
|
1762
|
+
arbre = suivant ?? arbre;
|
|
1763
|
+
for (const s of toutes) {
|
|
1764
|
+
const appel = `${r.nom}\0${s.nom}`;
|
|
1765
|
+
if (s === r || appelees.has(appel) || !ecrits.some(f => couvertPar(s.lit, f))) continue;
|
|
1766
|
+
appelees.add(appel);
|
|
1767
|
+
if (!aJouer.includes(s)) aJouer.push(s);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1720
1770
|
const apres = garderLeLot(ctx, avant.commit);
|
|
1721
1771
|
const fichiers = apres ? differenceDesLots(ctx, avant.commit, apres.commit) : [];
|
|
1722
|
-
const description = leTicket(ctx).description;
|
|
1723
1772
|
const siens = r => fichiers.filter(f => couvertPar(r.fichiers, f));
|
|
1724
1773
|
const regenerees = refs.filter(r => siens(r).length);
|
|
1725
|
-
const nommee = r => r.cadre || [r.nom, ...r.fichiers].some(x => description.includes(x));
|
|
1726
1774
|
const horsDeclaration = fichiers.filter(f => !refs.some(r => couvertPar(r.fichiers, f)));
|
|
1727
1775
|
const ecarts = [
|
|
1728
1776
|
...echecs,
|
|
1729
1777
|
...(!apres ? ['- Le circuit ne garde pas la copie après la régénération (git échoue).'] : []),
|
|
1730
|
-
...regenerees
|
|
1731
|
-
.filter(r => !nommee(r))
|
|
1732
|
-
.map(
|
|
1733
|
-
r =>
|
|
1734
|
-
`- ${r.nom} change (${siens(r).join(', ')}), et le plan du ticket ne nomme pas ce changement (ni « ${r.nom} » ni ses fichiers).`
|
|
1735
|
-
),
|
|
1736
1778
|
...horsDeclaration.map(f => `- ${f} change, et aucune référence régénérée ne l'écrit.`),
|
|
1737
1779
|
];
|
|
1738
1780
|
if (ecarts.length) {
|
|
1739
1781
|
restaurer(ctx, avant.commit, fichiers);
|
|
1782
|
+
const difference =
|
|
1783
|
+
apres && fichiers.length
|
|
1784
|
+
? [
|
|
1785
|
+
`La différence, avant d'être rendue : \`git diff ${avant.commit} ${apres.commit}\`, dans la copie du ticket.`,
|
|
1786
|
+
]
|
|
1787
|
+
: [];
|
|
1740
1788
|
throw new Arret(
|
|
1741
1789
|
'references',
|
|
1742
1790
|
[
|
|
1743
|
-
`La régénération des références, sur la copie entière, s'arrête ; la copie est rendue telle qu'avant elle. Le superviseur fait
|
|
1791
|
+
`La régénération des références, sur la copie entière, s'arrête ; la copie est rendue telle qu'avant elle. Le superviseur fait corriger la référence ou le lot qui cause l'écart (\`--depuis developpeur\`), ou \`--reprendre\` une fois la cause levée.`,
|
|
1744
1792
|
'',
|
|
1745
1793
|
...ecarts,
|
|
1746
1794
|
'',
|
|
1747
|
-
...
|
|
1748
|
-
? [
|
|
1749
|
-
`La différence, avant d'être rendue : \`git diff ${avant.commit} ${apres.commit}\`, dans la copie du ticket.`,
|
|
1750
|
-
]
|
|
1751
|
-
: []),
|
|
1795
|
+
...difference,
|
|
1752
1796
|
`Le journal du ticket : ${ctx.journal}`,
|
|
1753
|
-
].join('\n')
|
|
1797
|
+
].join('\n'),
|
|
1798
|
+
{
|
|
1799
|
+
piece: [...ecarts, ...difference].join('\n'),
|
|
1800
|
+
question: `Les écarts de la régénération :\n${ecarts.join('\n')}`,
|
|
1801
|
+
}
|
|
1754
1802
|
);
|
|
1755
1803
|
}
|
|
1756
1804
|
if (!fichiers.length) {
|
|
@@ -2219,16 +2267,30 @@ function mesureDeLaPreuve(ctx, liste, fichiers) {
|
|
|
2219
2267
|
return runs;
|
|
2220
2268
|
}
|
|
2221
2269
|
|
|
2270
|
+
// The full name of a test <nom> with each separator between a group and what it holds, « > » or
|
|
2271
|
+
// « › » between blanks, read as the blank that Vitest's full name puts there.
|
|
2272
|
+
const sansSeparateur = nom =>
|
|
2273
|
+
String(nom ?? '')
|
|
2274
|
+
.replace(/\s+[>›]\s+/g, ' ')
|
|
2275
|
+
.trim();
|
|
2276
|
+
|
|
2222
2277
|
// The proof of the red, on every test of the lot: `{ ok, rouges, texte, resume }`, `texte` without
|
|
2223
2278
|
// the list of the justified greens, which only the whole report, written to its file, holds. A
|
|
2224
2279
|
// green test passes by the expected greens of the testwriter's sheets (`verts_attendus`), read at
|
|
2225
|
-
// each proof
|
|
2280
|
+
// each proof, a sheet without them justifying none; a test's full name is read whatever the
|
|
2281
|
+
// separator between its group and its title, a blank, or « > » as Vitest prints it, or « › » as
|
|
2282
|
+
// Jest and the report of the proof print it (`sansSeparateur`); the measure plays again only when
|
|
2283
|
+
// the copy changed (`mesureDeLaPreuve`).
|
|
2226
2284
|
function preuve(ctx) {
|
|
2227
2285
|
const fichiers = testsDuLot(ctx);
|
|
2228
2286
|
const verts = fichesDe(ctx, 'testwriter').flatMap(f => f.verts_attendus ?? []);
|
|
2229
2287
|
const raisonDuTest = (f, a) =>
|
|
2230
|
-
verts.find(
|
|
2231
|
-
|
|
2288
|
+
verts.find(
|
|
2289
|
+
v =>
|
|
2290
|
+
v.fichier === f &&
|
|
2291
|
+
v.test &&
|
|
2292
|
+
[a.nom, a.titre].some(n => sansSeparateur(v.test) === sansSeparateur(n))
|
|
2293
|
+
)?.raison ?? null;
|
|
2232
2294
|
const duFichier = f => verts.find(v => v.fichier === f && !v.test) ?? null;
|
|
2233
2295
|
const rouges = [];
|
|
2234
2296
|
// The reds of the files of the lot, apart from the existing ones and the builds.
|
|
@@ -2875,18 +2937,26 @@ async function derouler(ctx, debut) {
|
|
|
2875
2937
|
? { arbre: arbreDeLaCopie(ctx), restreinte: regeneration.restreinte }
|
|
2876
2938
|
: laPasseFinale(ctx);
|
|
2877
2939
|
const k = controles(ctx, passeFinale, passe.restreinte, regeneration?.reportes ?? null);
|
|
2878
|
-
|
|
2940
|
+
// The outcome the bilan reads (scripts/bilan.mjs): with the reds, each its place and its
|
|
2941
|
+
// text, by which it knows two checks that measured the same thing.
|
|
2942
|
+
const resultat = issue => ({
|
|
2943
|
+
issue,
|
|
2944
|
+
finale: passeFinale,
|
|
2945
|
+
rouges: k.rouges.map(r => `${r.paquet} : ${r.texte}`),
|
|
2946
|
+
});
|
|
2879
2947
|
rapport = k.texte;
|
|
2880
2948
|
// A developpeur who had nothing to deliver before these checks.
|
|
2881
2949
|
const rien = ctx.rienALivrer ?? null;
|
|
2882
2950
|
ctx.rienALivrer = null;
|
|
2883
|
-
// A stop of the checks: <phrase>, then the report, its reds also kept apart, as its piece
|
|
2951
|
+
// A stop of the checks: <phrase>, then the report, its reds also kept apart, as its piece;
|
|
2952
|
+
// the stop kept at the checks keeps their outcome.
|
|
2884
2953
|
const arreter = (nom, phrase, lieu = null) => {
|
|
2885
2954
|
const avant = phrase ? `${phrase}\n\n` : '';
|
|
2886
2955
|
throw new Arret(nom, `${avant}${k.complet}`, {
|
|
2887
2956
|
rouges: k.rouges,
|
|
2888
2957
|
motif: `${avant}${k.sansListe}`,
|
|
2889
2958
|
etape: lieu,
|
|
2959
|
+
resultat: lieu ? null : resultat(nom === 'a-repasser' ? 'a-repasser' : 'rouge'),
|
|
2890
2960
|
});
|
|
2891
2961
|
};
|
|
2892
2962
|
const suivante = tentative + 1;
|
|
@@ -3729,6 +3799,23 @@ export async function main(argv) {
|
|
|
3729
3799
|
const d = depart(ctx, e);
|
|
3730
3800
|
// A session a dead circuit left running ends before this run launches its own.
|
|
3731
3801
|
await attendreLaSeance(ctx, e?.seance);
|
|
3802
|
+
// A ticket labelled arbitrage starts and resumes only on the arbitrage its integration will
|
|
3803
|
+
// ask for: the integration's rule, before any session.
|
|
3804
|
+
const arbitrage = refusArbitrage({ id: ctx.ticket, ...leTicket(ctx) }, lesCommentaires(ctx));
|
|
3805
|
+
if (arbitrage) {
|
|
3806
|
+
return aLaFin(
|
|
3807
|
+
ctx,
|
|
3808
|
+
monter(ctx, {
|
|
3809
|
+
code: ARRETS.besoin,
|
|
3810
|
+
nom: 'besoin',
|
|
3811
|
+
rapport: arbitrage,
|
|
3812
|
+
piece: `$ bd show ${ctx.ticket} --json ; bd comments ${ctx.ticket} --json\n${arbitrage}`,
|
|
3813
|
+
question: `${arbitrage} L'arbitrage s'écrit au ticket (« ## Arbitrage — … », tranché ou répondu par le responsable), puis \`--reprendre\`.`,
|
|
3814
|
+
// From the testwriter, the plan comes first: the stop is at « 1 Plan ».
|
|
3815
|
+
etat: d.etape === TESTS ? { ...d, questionnement: { objet: 'plan' } } : d,
|
|
3816
|
+
})
|
|
3817
|
+
);
|
|
3818
|
+
}
|
|
3732
3819
|
// From the testwriter: the plan, which the explorateur writes and the questionneur reads once.
|
|
3733
3820
|
if (d.etape === TESTS) {
|
|
3734
3821
|
const arret = await lePlan(ctx);
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
// - `c` : *
|
|
9
9
|
//
|
|
10
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
|
|
12
|
-
// code
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
11
|
+
// refuses (exit 1) a use that the provider's interface does not declare, and a declared name that
|
|
12
|
+
// no code of its consumer uses, as ESLint's `no-unused-vars` refuses a name nothing uses (BP
|
|
13
|
+
// 320.3.2.1: « LEVEL_TYPES » declared for 020-loader, only reported, caught by its second review).
|
|
14
|
+
// `*` stands for a namespace, default, re-export-all or side-effect import. A refusal inscribed in
|
|
15
|
+
// the project's debt (`grillhouse-dette.json`, see `dette.mjs`) passes, keyed by the provider's
|
|
16
|
+
// interface and `usage-non-declare` or `declare-non-utilise` (`homonyme` for two components of one
|
|
17
|
+
// name, keyed by the first path). The debt of the new rule is inscribed once, when a project
|
|
18
|
+
// updates to it (scripts/migrations/0.24.4-noms-declares-inutilises.mjs); in a ticket, the name
|
|
19
|
+
// leaves its line.
|
|
16
20
|
//
|
|
17
21
|
// npx grillhouse consommateurs run from the repository root
|
|
18
22
|
//
|
|
@@ -244,6 +248,10 @@ export function utilise(racine, tous = composants(racine)) {
|
|
|
244
248
|
return out;
|
|
245
249
|
}
|
|
246
250
|
|
|
251
|
+
// The rule of a declared name that no code of its consumer uses; its finding names its consumer
|
|
252
|
+
// and the name, which the migration of 0.24.4 reports line by line.
|
|
253
|
+
export const DECLARE_NON_UTILISE = 'declare-non-utilise';
|
|
254
|
+
|
|
247
255
|
// The refusals of the components that share a name: one finding per name, both paths.
|
|
248
256
|
function homonymes(racine) {
|
|
249
257
|
const parNom = new Map();
|
|
@@ -259,15 +267,15 @@ function homonymes(racine) {
|
|
|
259
267
|
}));
|
|
260
268
|
}
|
|
261
269
|
|
|
262
|
-
// The refusals
|
|
263
|
-
// (`
|
|
264
|
-
// the frame is passed over: its code is
|
|
270
|
+
// The refusals, as findings `{ fichier, regle, message }` the debt (`dette.mjs`) judges: the uses
|
|
271
|
+
// no interface declares (`usage-non-declare`), and the declared names no code of their consumer
|
|
272
|
+
// uses (`declare-non-utilise`). A declared consumer out of the frame is passed over: its code is
|
|
273
|
+
// not read.
|
|
265
274
|
export function verifier(racine) {
|
|
266
275
|
const tous = composants(racine);
|
|
267
276
|
const hors = horsCadre(racine);
|
|
268
277
|
const reel = utilise(racine, tous);
|
|
269
278
|
const refus = homonymes(racine);
|
|
270
|
-
const signaux = [];
|
|
271
279
|
for (const p of tous) {
|
|
272
280
|
const iface = path.join(p.dir, 'docs', 'INTERFACE.md');
|
|
273
281
|
const rel = path.relative(racine, iface);
|
|
@@ -289,26 +297,34 @@ export function verifier(racine) {
|
|
|
289
297
|
const faits = utilises.get(consommateur) ?? new Set();
|
|
290
298
|
for (const n of noms) {
|
|
291
299
|
if (!faits.has(n))
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
300
|
+
refus.push({
|
|
301
|
+
fichier: rel,
|
|
302
|
+
regle: DECLARE_NON_UTILISE,
|
|
303
|
+
consommateur,
|
|
304
|
+
nom: n,
|
|
305
|
+
message: `${rel} déclare « ${n} » pour ${consommateur}, qu'aucun code de ${consommateur} n'utilise.`,
|
|
306
|
+
});
|
|
295
307
|
}
|
|
296
308
|
}
|
|
297
309
|
}
|
|
298
|
-
return { refus
|
|
310
|
+
return { refus };
|
|
299
311
|
}
|
|
300
312
|
|
|
301
313
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
302
314
|
const racine = process.cwd();
|
|
303
315
|
const verdict = verifier(racine);
|
|
304
316
|
const { refus, lignes } = trancher(racine, 'consommateurs', verdict.refus);
|
|
305
|
-
for (const s of verdict.signaux) process.stderr.write(`⚠️ ${s}\n`);
|
|
306
317
|
for (const r of refus) process.stderr.write(`⛔ ${r.message}\n`);
|
|
307
318
|
for (const l of lignes) process.stderr.write(`${l}\n`);
|
|
308
|
-
if (refus.
|
|
319
|
+
if (refus.some(r => r.regle !== DECLARE_NON_UTILISE)) {
|
|
309
320
|
process.stderr.write(
|
|
310
321
|
"Une consommation nouvelle se décide (le titre du ticket, sa section « Architecture » ou sa section « Noms publiés » qui la nomment, sinon l'arbitrage du superviseur), puis entre dans la section « Consommateurs » de l'interface du fournisseur.\n"
|
|
311
322
|
);
|
|
312
|
-
process.exitCode = 1;
|
|
313
323
|
}
|
|
324
|
+
if (refus.some(r => r.regle === DECLARE_NON_UTILISE)) {
|
|
325
|
+
process.stderr.write(
|
|
326
|
+
"Un nom que son consommateur n'utilise plus sort de sa ligne dans la section « Consommateurs » de l'interface du fournisseur.\n"
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
if (refus.length) process.exitCode = 1;
|
|
314
330
|
}
|
package/scripts/dernier-vert.mjs
CHANGED
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
// the repository. Then the changes are the files that differ between its tree and the tree of the
|
|
19
19
|
// working tree now (`git diff --raw --no-renames`): the files changed or added, and those
|
|
20
20
|
// removed. Any two trees compare: the ancestry keeps the measure to the history it belongs to.
|
|
21
|
+
// - A file the last green holds and its commit does not track (untracked, not ignored) lives in
|
|
22
|
+
// the working tree that kept it alone: measured against the last green of another branch (main's,
|
|
23
|
+
// from a copy or from the queue's detached replay), its absence is no removal, as Nx affected and
|
|
24
|
+
// Turborepo's `--filter=[ref]` measure against a commit. Against the branch's own, it is one: the
|
|
25
|
+
// copy created that file, then removed it. Witness: BPScript 320.3.2.1, 54 `.rapport-suite.json`
|
|
26
|
+
// untracked on main, each seen removed by every package of a copy, which played whole 264 times.
|
|
21
27
|
// - No last green counts without git, before the first commit, and while a submodule differs
|
|
22
28
|
// from the commit its parent records (its files changed, or its HEAD moved) or the changes
|
|
23
29
|
// reach a submodule: git's tree holds a submodule's commit, not its files. The pass is then
|
|
@@ -169,6 +175,21 @@ function difference(racine, avant, apres) {
|
|
|
169
175
|
return out;
|
|
170
176
|
}
|
|
171
177
|
|
|
178
|
+
// The files the commit <commit> of the repository at <racine> tracks that the tree <arbre> no longer
|
|
179
|
+
// holds, as a Set of paths from its top; null when git fails.
|
|
180
|
+
function supprimesDuCommit(racine, commit, arbre) {
|
|
181
|
+
const r = git(racine, [
|
|
182
|
+
'diff',
|
|
183
|
+
'--name-only',
|
|
184
|
+
'--no-renames',
|
|
185
|
+
'--diff-filter=D',
|
|
186
|
+
'-z',
|
|
187
|
+
commit,
|
|
188
|
+
arbre,
|
|
189
|
+
]);
|
|
190
|
+
return r.status === 0 ? new Set(r.stdout.split('\0').filter(Boolean)) : null;
|
|
191
|
+
}
|
|
192
|
+
|
|
172
193
|
// What a pass in <racine> measures itself against: `{ etat, env, ligne, retirer }`, the state to
|
|
173
194
|
// keep once green (null when none can count), the variables to add to the pass's environment (the
|
|
174
195
|
// changes since the last green, none for a complete pass), the line that says which, and the
|
|
@@ -192,6 +213,11 @@ export function mesure(racine, { tout = false, dans = os.tmpdir() } = {}) {
|
|
|
192
213
|
if (ch.sousModules.length) {
|
|
193
214
|
return { ...complete(`un sous-module a changé (${ch.sousModules[0]})`), etat: null };
|
|
194
215
|
}
|
|
216
|
+
if (vert.branche !== etat.branche) {
|
|
217
|
+
const suivis = supprimesDuCommit(etat.racine, vert.commit, etat.arbre);
|
|
218
|
+
if (!suivis) return complete('git échoue');
|
|
219
|
+
ch.supprimes = ch.supprimes.filter(f => suivis.has(f));
|
|
220
|
+
}
|
|
195
221
|
const dir = mkdtempSync(path.join(dans, 'grillhouse-changements-'));
|
|
196
222
|
const fichier = path.join(dir, 'changements.json');
|
|
197
223
|
writeFileSync(
|
package/scripts/etapes.mjs
CHANGED
|
@@ -254,7 +254,7 @@ export const MONTEES = Object.fromEntries(
|
|
|
254
254
|
questionnement:
|
|
255
255
|
'Des questions du plan restent ouvertes après la réponse de l’explorateur : le plan change-t-il (`bd update`), ou reste-t-il tel quel ? `--reprendre` le fait passer tel qu’il est alors.',
|
|
256
256
|
references:
|
|
257
|
-
'La régénération des références change
|
|
257
|
+
'La régénération des références change un fichier qu’aucune référence n’écrit, ou sa commande échoue (ses écarts ci-dessus) : qui corrige la référence ou le lot ?',
|
|
258
258
|
'hors-plan':
|
|
259
259
|
'La séance écrit hors du plan du ticket : le plan s’étend-il à ce paquet (`--etendre`), ou l’écriture est-elle refusée (`--reprendre` avec son contexte) ?',
|
|
260
260
|
}).map(([arret, question]) => [arret, { question: `${question} ${REPONSES}`, qui: SUPERVISEUR }])
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
// `RENDU` at the start of a comment of the author `relecteur`; another author's is none) and, when labelled `arbitrage`, each arbitrage
|
|
17
17
|
// (`estArbitrage`: a « ## Arbitrage » comment, the supervisor's) is settled
|
|
18
18
|
// (`arbitrageTranche`: `### Verdict — tranché`, or a « ## Réponse du
|
|
19
|
-
// responsable » comment after it)
|
|
19
|
+
// responsable » comment after it): `refusArbitrage`, the one rule of the label, which the
|
|
20
|
+
// circuit plays too at its launch and at each resumption (scripts/circuit.mjs);
|
|
20
21
|
// 2. the lots: the tests lot touches only what the testwriter writes (`isTesterFile`: test files
|
|
21
22
|
// and the shared test material), the code lot none of it;
|
|
22
23
|
// 3. the main tree: every file of the lots is unmodified there; the ticket's copy is on its
|
|
@@ -107,15 +108,24 @@ export function refusVerdicts(ticket, comments) {
|
|
|
107
108
|
if (verdictDe(dernier) !== 'ACCEPTÉ') {
|
|
108
109
|
return `${id} n'a pas le verdict ACCEPTÉ du relecteur pour dernier verdict.`;
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
return refusArbitrage(ticket, comments);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// The refusal for the arbitrage of one ticket, or null: a ticket labelled `arbitrage` holds a
|
|
115
|
+
// « ## Arbitrage » comment, and each one is settled or answered by the owner. The one rule of the
|
|
116
|
+
// label, which the integration plays after the verdict and the circuit at its launch and at each
|
|
117
|
+
// resumption (scripts/circuit.mjs), as a CI refuses a pull request without its required label
|
|
118
|
+
// before it runs a job. `ticket` and `comments` are Beads' JSON.
|
|
119
|
+
export function refusArbitrage(ticket, comments) {
|
|
120
|
+
if (!(ticket.labels ?? []).includes('arbitrage')) return null;
|
|
121
|
+
const id = ticket.id;
|
|
122
|
+
const arbitrages = comments.filter(c => estArbitrage(c.text));
|
|
123
|
+
if (arbitrages.length === 0)
|
|
124
|
+
return `${id} est étiqueté arbitrage sans commentaire « Arbitrage ».`;
|
|
125
|
+
for (const a of arbitrages) {
|
|
126
|
+
if (!arbitrageTranche(comments, a)) {
|
|
127
|
+
const titre = a.text.trim().split('\n')[0];
|
|
128
|
+
return `${id} : « ${titre} » n'est ni tranché ni répondu par le responsable.`;
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
return null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// From 0.24.4 the guard of the consumers refuses a declared name that no code of its consumer uses
|
|
2
|
+
// (`declare-non-utilise`, scripts/consommateurs.mjs), which it only reported before, as ESLint's
|
|
3
|
+
// `no-unused-vars` refuses a name nothing uses. A project that updates holds such names already
|
|
4
|
+
// (BPScript: 26 names on 11 lines of 4 interfaces), and its main would turn red at its next pass
|
|
5
|
+
// without a word. As a codemod reports what it leaves, the update names them, and the command that
|
|
6
|
+
// inscribes them as the project's known debt, once, at the passage of the rule (dette.mjs, as
|
|
7
|
+
// ESLint's `--suppress-all`); in a ticket afterwards, the guard says to take the name out of its
|
|
8
|
+
// line.
|
|
9
|
+
//
|
|
10
|
+
// - The migration changes no file (`migrer` returns no line): the project decides between the
|
|
11
|
+
// debt and the edit of its interfaces.
|
|
12
|
+
// - What stays to the project (`restes`): one line per line of a `## Consommateurs` section that
|
|
13
|
+
// declares names its consumer does not use, beyond what `grillhouse-dette.json` already inscribes
|
|
14
|
+
// (`juger` of dette.mjs), its interface, its consumer and those names; then the line of the
|
|
15
|
+
// command, `npm run grillhouse:dette:inscrire`. Nothing once the debt holds them, or once the
|
|
16
|
+
// names are gone.
|
|
17
|
+
import { juger, lire } from '../dette.mjs';
|
|
18
|
+
import { DECLARE_NON_UTILISE, verifier } from '../consommateurs.mjs';
|
|
19
|
+
|
|
20
|
+
export const version = '0.24.4';
|
|
21
|
+
export const nom = 'noms déclarés inutilisés';
|
|
22
|
+
|
|
23
|
+
/** The lines of the declared names the new rule refuses in the project at <projet>, and the command. */
|
|
24
|
+
export function restes(projet) {
|
|
25
|
+
const constats = verifier(projet).refus.filter(r => r.regle === DECLARE_NON_UTILISE);
|
|
26
|
+
const { refus } = juger(lire(projet), 'consommateurs', constats);
|
|
27
|
+
if (refus.length === 0) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const parLigne = new Map();
|
|
31
|
+
for (const r of refus) {
|
|
32
|
+
const cle = `${r.fichier}\0${r.consommateur}`;
|
|
33
|
+
parLigne.set(cle, [...(parLigne.get(cle) ?? []), r.nom]);
|
|
34
|
+
}
|
|
35
|
+
const lignes = [...parLigne].map(([cle, noms]) => {
|
|
36
|
+
const [fichier, consommateur] = cle.split('\0');
|
|
37
|
+
return `${fichier} § Consommateurs, \`${consommateur}\` : ${noms.join(', ')}, qu'aucun code de ${consommateur} n'utilise`;
|
|
38
|
+
});
|
|
39
|
+
return [
|
|
40
|
+
...lignes,
|
|
41
|
+
`la garde des consommateurs refuse désormais ces ${refus.length} noms : \`npm run grillhouse:dette:inscrire\` les inscrit dans grillhouse-dette.json, la dette connue du projet, ou chaque nom sort de sa ligne`,
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Changes nothing: the names are reported by `restes`. */
|
|
46
|
+
export function migrer() {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -26,6 +26,7 @@ import * as marcheDuProjet from './migrations/0.23.0-marche-du-projet.mjs';
|
|
|
26
26
|
import * as copiesDuCadre from './migrations/0.23.2-copies-du-cadre.mjs';
|
|
27
27
|
import * as circuitSimplifie from './migrations/0.24.0-circuit-simplifie.mjs';
|
|
28
28
|
import * as apiExtractorDuPaquet from './migrations/0.24.2-api-extractor-du-paquet.mjs';
|
|
29
|
+
import * as nomsDeclaresInutilises from './migrations/0.24.4-noms-declares-inutilises.mjs';
|
|
29
30
|
|
|
30
31
|
/** The migrations of the package. */
|
|
31
32
|
export const MIGRATIONS = [
|
|
@@ -36,6 +37,7 @@ export const MIGRATIONS = [
|
|
|
36
37
|
copiesDuCadre,
|
|
37
38
|
circuitSimplifie,
|
|
38
39
|
apiExtractorDuPaquet,
|
|
40
|
+
nomsDeclaresInutilises,
|
|
39
41
|
];
|
|
40
42
|
|
|
41
43
|
/**
|
package/scripts/tableau.mjs
CHANGED
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
// board reads no transcript older than 30 minutes: a shell agent whose transcript is older shows
|
|
48
48
|
// by its process alone.
|
|
49
49
|
// - Time: a transcript's working time is the union of its turns, each bounded by the earliest and
|
|
50
|
-
// the latest date of its events, whatever their order in the file
|
|
50
|
+
// the latest date of its events, whatever their order in the file, but those a resumption writes
|
|
51
|
+
// before its incoming message (`horsDuTour`); a transcript is read where the
|
|
51
52
|
// board stopped, its reading kept in the cache file. A ticket's working time adds the steps its
|
|
52
53
|
// circuit leads itself, with no agent (the proof, the checks, the final pass, the integration,
|
|
53
54
|
// the queue): the register's lines of the role `circuit`, which no block shows and no role of the
|
|
@@ -167,8 +168,9 @@ function entrant(e) {
|
|
|
167
168
|
// the cost (the total a session writes), the usage by model (which the register prices when the
|
|
168
169
|
// total lacks, scripts/registre.mjs) and the last tool call, and it is plain JSON, so the board keeps it between two
|
|
169
170
|
// measures and reads only what was appended. A turn is bounded by the earliest and the latest date
|
|
170
|
-
// of its events, whatever their order in the file
|
|
171
|
-
//
|
|
171
|
+
// of its events, whatever their order in the file, but those a resumption writes (`horsDuTour`);
|
|
172
|
+
// the first one holds the events before the first incoming message, each next one opens at an
|
|
173
|
+
// incoming message and holds the events up to the next.
|
|
172
174
|
const etatNeuf = () => ({
|
|
173
175
|
jetons: 0,
|
|
174
176
|
cache: 0,
|
|
@@ -200,6 +202,12 @@ function reunir(intervalles) {
|
|
|
200
202
|
return out;
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
// Whether the event <e> is written by Claude Code itself when a session resumes (`--resume`),
|
|
206
|
+
// before its incoming message and at the time of the resumption: an operation of its queue, or a
|
|
207
|
+
// message of no model (« No response requested. »). It bounds no turn: as ccusage cuts a
|
|
208
|
+
// transcript, a turn starts at its incoming message.
|
|
209
|
+
const horsDuTour = e => e.type === 'queue-operation' || e.message?.model === '<synthetic>';
|
|
210
|
+
|
|
203
211
|
// Adds the lines of `texte` to the state `etat`, which it returns.
|
|
204
212
|
function avancer(etat, texte) {
|
|
205
213
|
const vus = new Set(etat.vus);
|
|
@@ -224,6 +232,8 @@ function avancer(etat, texte) {
|
|
|
224
232
|
if (!Number.isNaN(t)) {
|
|
225
233
|
etat.premier = etat.premier === null ? t : Math.min(etat.premier, t);
|
|
226
234
|
etat.dernier = etat.dernier === null ? t : Math.max(etat.dernier, t);
|
|
235
|
+
}
|
|
236
|
+
if (!Number.isNaN(t) && !horsDuTour(e)) {
|
|
227
237
|
// The first incoming message continues the turn its earlier events opened.
|
|
228
238
|
const recoit = entrant(e);
|
|
229
239
|
const coupe = recoit && etat.recu;
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
// - The graph of a test is the test file and the modules it imports, statically or dynamically,
|
|
17
17
|
// node_modules left out (`getTestDependencies` of Vitest). Vitest does not see what lies out of
|
|
18
18
|
// it, and the package plays whole (`entier`) when a change lies there, the reason written:
|
|
19
|
-
// 1. a file removed
|
|
19
|
+
// 1. a file removed in the package: no graph of today holds it (one removed in a package it
|
|
20
|
+
// depends on, as 6 has it);
|
|
20
21
|
// 2. the frame's base configuration (this directory), which every configuration extends;
|
|
21
22
|
// 3. the configuration of the repository at its top: `package.json`, `package-lock.json`,
|
|
22
23
|
// `turbo.json`, `turbo.jsonc`, `tsconfig*.json`;
|
|
@@ -25,10 +26,18 @@
|
|
|
25
26
|
// `globalSetup`, which Vitest runs beside the graph;
|
|
26
27
|
// 5. a path its tests declare they read (`grillhouse.lit` of its package.json, from the top):
|
|
27
28
|
// a script they run, a file they read, as Bazel's `data`;
|
|
28
|
-
// 6. a file of a package it depends on (its
|
|
29
|
-
// `optionalDependencies` and `peerDependencies` that
|
|
30
|
-
//
|
|
31
|
-
// package built, not the source git follows
|
|
29
|
+
// 6. a file, changed or removed, that the build of a package it depends on reads (its
|
|
30
|
+
// `dependencies`, `devDependencies`, `optionalDependencies` and `peerDependencies` that
|
|
31
|
+
// resolve to a directory of the repository, out of node_modules, transitively): its tests read
|
|
32
|
+
// that package built, not the source git follows. As Turborepo hashes the inputs of a
|
|
33
|
+
// neighbour's `build` task and Bazel the `srcs` of its target, the build reads the inputs of
|
|
34
|
+
// the `build` of the neighbour's turbo.json, the one scripts/turbo-des-paquets.mjs generates,
|
|
35
|
+
// as Turborepo reads them: each pattern from the package, `$TURBO_ROOT$/…` from the top, `!…`
|
|
36
|
+
// an exclusion, `<x>/**` covering `<x>` itself, `$TURBO_DEFAULT$` every file of the package,
|
|
37
|
+
// `$TURBO_EXTENDS$` the inputs of the root's `build` (turbo.json or turbo.jsonc). When they
|
|
38
|
+
// name none (no turbo.json, no inputs), its files of code and configuration (the extension of
|
|
39
|
+
// a module), out of its `docs/`, its exclusions kept. A test file of the neighbour is never
|
|
40
|
+
// one: its build does not compile it;
|
|
32
41
|
// 7. a file of the package that no graph can hold, its extension not that of a module (`.js`,
|
|
33
42
|
// `.mjs`, `.cjs`, `.ts`, `.mts`, `.cts`, `.jsx`, `.tsx`, `.json`): data, a template, a
|
|
34
43
|
// script of the shell, a document, which a test reads without importing it.
|
|
@@ -39,8 +48,10 @@
|
|
|
39
48
|
// plays, changed or not. A package where none relates plays none and passes
|
|
40
49
|
// (`passWithNoTests`), as Vitest's `--changed` has it.
|
|
41
50
|
//
|
|
42
|
-
// This module uses Node alone.
|
|
51
|
+
// This module's top level uses Node alone (./cibles.mjs, scripts/tests.mjs import it); a
|
|
52
|
+
// turbo.json is read with jsonc-parser, the frame's reader of JSON with comments, loaded then.
|
|
43
53
|
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
54
|
+
import { createRequire } from 'node:module';
|
|
44
55
|
import path from 'node:path';
|
|
45
56
|
import { fileURLToPath } from 'node:url';
|
|
46
57
|
|
|
@@ -79,6 +90,46 @@ export function lireChangements(chemin) {
|
|
|
79
90
|
return c;
|
|
80
91
|
}
|
|
81
92
|
|
|
93
|
+
// The prefix of a pattern of Turborepo written from the top of the repository.
|
|
94
|
+
const DU_HAUT = '$TURBO_ROOT$/';
|
|
95
|
+
|
|
96
|
+
// The inputs of the `build` of the Turborepo configuration in <dir> (its <noms>, the first
|
|
97
|
+
// present): the patterns, an empty list when it names none or does not read.
|
|
98
|
+
function entreesDuBuild(dir, noms) {
|
|
99
|
+
const f = noms.map(n => path.join(dir, n)).find(n => existsSync(n));
|
|
100
|
+
if (!f) return [];
|
|
101
|
+
try {
|
|
102
|
+
const { parse } = createRequire(import.meta.url)('jsonc-parser');
|
|
103
|
+
const inputs = parse(readFileSync(f, 'utf8'), [], { allowTrailingComma: true })?.tasks?.build
|
|
104
|
+
?.inputs;
|
|
105
|
+
return Array.isArray(inputs) ? inputs.filter(m => typeof m === 'string') : [];
|
|
106
|
+
} catch {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Whether the build of the package at <d>, in the repository at <racine>, reads the file at the
|
|
112
|
+
// absolute path <a>, which lies in it (6 above).
|
|
113
|
+
function construit(racine, d, a) {
|
|
114
|
+
const r = path.relative(d, a);
|
|
115
|
+
if (TEST.test(r)) return false;
|
|
116
|
+
const motifs = entreesDuBuild(d, ['turbo.json']).flatMap(m =>
|
|
117
|
+
m === '$TURBO_EXTENDS$' ? entreesDuBuild(racine, ['turbo.json', 'turbo.jsonc']) : [m]
|
|
118
|
+
);
|
|
119
|
+
// <m> covers <rel>, `<x>/**` covering `<x>` as Turborepo has it.
|
|
120
|
+
const couvre = (rel, m) =>
|
|
121
|
+
path.matchesGlob(rel, m) || (m.endsWith('/**') && path.matchesGlob(rel, m.slice(0, -3)));
|
|
122
|
+
const lu = m =>
|
|
123
|
+
m === '$TURBO_DEFAULT$' ||
|
|
124
|
+
(m.startsWith(DU_HAUT)
|
|
125
|
+
? couvre(path.relative(racine, a), m.slice(DU_HAUT.length))
|
|
126
|
+
: couvre(r, m));
|
|
127
|
+
if (motifs.some(m => m.startsWith('!') && lu(m.slice(1)))) return false;
|
|
128
|
+
const positifs = motifs.filter(m => !m.startsWith('!'));
|
|
129
|
+
if (positifs.length) return positifs.some(lu);
|
|
130
|
+
return MODULE.test(r) && r.split(path.sep)[0] !== 'docs';
|
|
131
|
+
}
|
|
132
|
+
|
|
82
133
|
// The directories of the packages of the repository at <racine> that the package at <dossier>
|
|
83
134
|
// depends on, transitively, itself left out.
|
|
84
135
|
function dependances(racine, dossier) {
|
|
@@ -129,7 +180,8 @@ function paquetEntier(ch, dossier, test = {}) {
|
|
|
129
180
|
.filter(f => typeof f === 'string')
|
|
130
181
|
.map(f => path.resolve(dossier, f));
|
|
131
182
|
for (const f of ch.supprimes) {
|
|
132
|
-
|
|
183
|
+
const a = abs(f);
|
|
184
|
+
if (sous(a, dossier) || deps.some(d => sous(a, d) && construit(racine, d, a))) {
|
|
133
185
|
return { raison: 'un fichier supprimé, que le graphe des tests ne tient plus', fichier: f };
|
|
134
186
|
}
|
|
135
187
|
}
|
|
@@ -145,7 +197,7 @@ function paquetEntier(ch, dossier, test = {}) {
|
|
|
145
197
|
? 'un fichier de préparation des tests'
|
|
146
198
|
: lit.some(l => f === l || f.startsWith(`${l}/`))
|
|
147
199
|
? 'un chemin que ses tests déclarent lire (grillhouse.lit)'
|
|
148
|
-
: deps.some(d => sous(a, d)
|
|
200
|
+
: deps.some(d => sous(a, d) && construit(racine, d, a))
|
|
149
201
|
? 'le code d’un paquet dont il dépend, que ses tests lisent construit'
|
|
150
202
|
: sous(a, dossier) && !MODULE.test(f)
|
|
151
203
|
? 'un fichier qu’aucun module n’importe, qu’un test lit sans l’importer'
|
|
@@ -79,15 +79,17 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
|
|
|
79
79
|
2.1 la preuve du rouge sur tous les tests du lot), 3 Code (le développeur, une séance pour tout
|
|
80
80
|
le ticket, et 3.1 les contrôles du plan), 4 Passe finale et relecture (4.1 la passe
|
|
81
81
|
finale, 4.2 la régénération des références : celles que le projet déclare, `grillhouse.references`
|
|
82
|
-
de son `package.json`, chacune `{ nom, commande, fichiers, tests, gardes }`, ses fichiers en
|
|
83
|
-
chemins, dossiers ou motifs `*` et `**`, ses tests les fichiers de test qui la jugent,
|
|
84
|
-
les gardes du projet qui la jugent, par le
|
|
85
|
-
l'index des interfaces, les `turbo.json`, les
|
|
86
|
-
copie entière, dès qu'un rouge est le leur, mêlé
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
de son `package.json`, chacune `{ nom, commande, fichiers, tests, lit, gardes }`, ses fichiers en
|
|
83
|
+
chemins, dossiers ou motifs `*` et `**`, ses tests les fichiers de test qui la jugent, `lit` les
|
|
84
|
+
fichiers qu'elle lit d'une autre référence, ses gardes les gardes du projet qui la jugent, par le
|
|
85
|
+
nom que porte leur constat SARIF ; celles du cadre, l'index des interfaces, les `turbo.json`, les
|
|
86
|
+
rapports d'API et la dette des gardes ; sur la copie entière, dès qu'un rouge est le leur, mêlé
|
|
87
|
+
ou non à d'autres, ou que la dette baisse, chacune suivie de celles qui lisent ce qu'elle écrit
|
|
88
|
+
(l'index après les rapports d'API), sans que le plan les nomme, puis la passe finale restreinte
|
|
89
|
+
à ce qu'elles changent, les autres rouges allant chacun à son propriétaire : je ne les régénère
|
|
90
|
+
jamais à la main ; une commande en échec ou un fichier qu'aucune référence n'écrit arrête à
|
|
91
|
+
`references`, code 23, une question pour moi qui porte chaque écart : je fais corriger la
|
|
92
|
+
référence ou le lot, 4.3 le relecteur), 5 Intégration (5.1
|
|
91
93
|
le commit, 5.2 la file et la lecture de la CI) ; aucun composant n'est une unité du circuit, chaque
|
|
92
94
|
étape joue une fois pour tout le ticket, dans l'enveloppe de tous les paquets du plan ; je dis
|
|
93
95
|
où en est un ticket par son étape, « 3 Code » ; son en-tête dit ses arrêts et leurs codes. Ainsi
|
|
@@ -104,8 +106,8 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
|
|
|
104
106
|
la mienne, celle du responsable (la question de l'arrêt est la sienne, ou je la lui porte et sa
|
|
105
107
|
réponse s'écrit au ticket pendant l'attente) et la nuit (la
|
|
106
108
|
plage `grillhouse.plageDeNuit` du projet, 23 h – 8 h par défaut) ; les séances par rôle (celles
|
|
107
|
-
que le circuit lance ; les miennes à part), les arrêts, les jetons et le coût, face au bilan d'avant du projet ; la fiche du ticket au panneau en montre les chiffres clés.
|
|
108
|
-
`npx grillhouse bilan <ticket>` le recalcule, `--garder` le garde
|
|
109
|
+
que le circuit lance ; les miennes à part), les arrêts, les jetons et le coût, face au bilan d'avant du projet, recalculé par la version courante (aucune base quand ses sources manquent) ; la fiche du ticket au panneau en montre les chiffres clés.
|
|
110
|
+
`npx grillhouse bilan <ticket>` le recalcule, `--garder` le garde, et son ticket devient la base du suivant. Ainsi
|
|
109
111
|
l'analyse d'un ticket se fait seule.
|
|
110
112
|
- **Le circuit fait les gestes mécaniques** : comme une CI applique ses règles sans demander
|
|
111
113
|
(rejouer, régénérer, sauter une tâche sans objet), le circuit fait lui-même, sans séance, les
|
|
@@ -219,17 +221,18 @@ les tests du lot, trois essais au plus ; 3 Code, le `developpeur`, une séance p
|
|
|
219
221
|
et 3.1 Contrôles, auto, sur tout le plan, trois essais au plus ; 4 Passe finale et relecture :
|
|
220
222
|
4.1 Passe finale, auto, trois essais au plus, puis 4.2 Régénération des références, auto : celles
|
|
221
223
|
que le projet tire de la copie entière (`grillhouse.references` de son `package.json`, chacune
|
|
222
|
-
`{ nom, commande, fichiers, tests, gardes }` : `fichiers`, des chemins, des dossiers ou des
|
|
223
|
-
`*` et `**`, comme les entrées de Turborepo ; `tests`, les fichiers de test qui la jugent ;
|
|
224
|
-
`
|
|
225
|
-
du cadre dans chaque projet (l'index
|
|
226
|
-
|
|
227
|
-
finale qui est le leur (un de leurs tests, un
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
224
|
+
`{ nom, commande, fichiers, tests, lit, gardes }` : `fichiers`, des chemins, des dossiers ou des
|
|
225
|
+
motifs `*` et `**`, comme les entrées de Turborepo ; `tests`, les fichiers de test qui la jugent ;
|
|
226
|
+
`lit`, les fichiers qu'elle lit d'une autre référence ; `gardes`, les gardes du projet qui la
|
|
227
|
+
jugent, par le nom que porte leur constat SARIF), et celles du cadre dans chaque projet (l'index
|
|
228
|
+
des interfaces, les `turbo.json`, les rapports d'API, la dette des gardes), comme les genrules de
|
|
229
|
+
Bazel et `--update-snapshots` : un rouge de la passe finale qui est le leur (un de leurs tests, un
|
|
230
|
+
constat d'une de leurs gardes, quel que soit son fichier, ou un fichier qu'elles couvrent), mêlé
|
|
231
|
+
ou non à d'autres, ou une dette qui baisse, les régénère, chacune suivie, comme dans make, de
|
|
232
|
+
celles qui lisent ce qu'elle écrit, puis la passe finale rejoue restreinte à ce qu'elles changent,
|
|
233
|
+
les autres rouges allant chacun à son propriétaire ; la différence va au lot et au relecteur sans
|
|
234
|
+
que le plan la nomme, un plafond ne monte jamais, et une commande en échec ou un fichier
|
|
235
|
+
qu'aucune référence n'écrit arrête le circuit (`references`), ses écarts dans sa question, et 4.3 Relecture, le `relecteur`, trois tours au plus, qui rend une ligne de
|
|
233
236
|
conformité par élément que le lot ajoute, change ou supprime (la liste mécanique que le circuit
|
|
234
237
|
lui donne, chaque ligne avec sa règle : CADRE, INTERFACE ou ARCHITECTURE), un « non » rendant le
|
|
235
238
|
lot et un élément sans ligne refusant sa fiche, un lot rendu revenant à
|
|
@@ -318,8 +321,10 @@ Le circuit du ticket fait chaque commit après le verdict `ACCEPTÉ` du relecteu
|
|
|
318
321
|
```
|
|
319
322
|
|
|
320
323
|
Un verdict « tranché » se lit réglé par la garde des consommateurs et par l'intégration ; un
|
|
321
|
-
verdict qui monte attend la réponse du responsable.
|
|
322
|
-
|
|
324
|
+
verdict qui monte attend la réponse du responsable. Le circuit d'un ticket étiqueté
|
|
325
|
+
`arbitrage` ne part ni ne reprend sans cet arbitrage réglé, par la règle de l'intégration : il
|
|
326
|
+
me monte la question avant toute séance. Ainsi une question de conception se tranche hors de
|
|
327
|
+
l'urgence de débloquer l'agent.
|
|
323
328
|
|
|
324
329
|
- **Une donnée manque, son fournisseur rejoint le ticket** : quand la passation d'un agent dit
|
|
325
330
|
qu'une donnée manque chez un fournisseur, j'ajoute ce fournisseur en tête des composants du
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Un composant (le projet entier, ou un paquet d'un dépôt à plusieurs paquets) a trois documents,
|
|
4
4
|
chacun avec son lecteur et sa question :
|
|
5
5
|
|
|
6
|
-
| document
|
|
7
|
-
|
|
8
|
-
| `docs/CADRE.md`
|
|
9
|
-
| `docs/INTERFACE.md`
|
|
10
|
-
| `docs/ARCHITECTURE.md` | l'architecte, le développeur
|
|
6
|
+
| document | lecteur | sa question |
|
|
7
|
+
| ---------------------- | ------------------------------- | ------------------------------------------------- |
|
|
8
|
+
| `docs/CADRE.md` | l'agent qui travaille un ticket | quel est mon rôle, ma frontière, ce que je refuse |
|
|
9
|
+
| `docs/INTERFACE.md` | le composant voisin | quelles formes traversent, qui juge quelle faute |
|
|
10
|
+
| `docs/ARCHITECTURE.md` | l'architecte, le développeur | comment il est construit, et pourquoi |
|
|
11
11
|
|
|
12
12
|
**Une matière, un document** : une matière vit dans un seul de ces trois documents ; les deux
|
|
13
13
|
autres y renvoient. Ainsi chaque décision a une seule version, celle que le code suit.
|
|
@@ -49,9 +49,9 @@ voisin dit vrai.
|
|
|
49
49
|
**Les fautes se listent** sous « ## Les fautes » : leurs codes sont exactement ceux que le code du
|
|
50
50
|
composant produit.
|
|
51
51
|
**Les consommateurs sont déclarés** : une section `## Consommateurs` liste chaque composant qui
|
|
52
|
-
utilise l'interface, avec les éléments qu'il importe (
|
|
52
|
+
utilise l'interface, avec les éléments qu'il importe (``- `parser` : jeton, position``, `*` pour
|
|
53
53
|
un import entier). Le garde `packages/grillhouse/scripts/consommateurs.mjs` refuse un import qu'elle ne déclare pas, et
|
|
54
|
-
|
|
54
|
+
un nom déclaré qu'aucun code du consommateur n'emploie ; une ligne nouvelle entre avec son arbitrage
|
|
55
55
|
tranché au ticket, qui nomme le consommateur, ou avec le plan du ticket (son titre, sa section
|
|
56
56
|
« Architecture », sa section « Noms publiés »), qui nomme mot pour mot le consommateur et chaque élément que le lot ajoute à la
|
|
57
57
|
ligne, et le garde `packages/grillhouse/scripts/consommateurs-arbitres.mjs` refuse une ligne
|