@roomi-fields/grillhouse 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +46 -0
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +101 -0
- package/cadre/templates/projet/CLAUDE.md +22 -5
- package/charte.md +45 -15
- package/dist/temporal/circuit/appel.d.ts +7 -0
- package/dist/temporal/circuit/appel.js +17 -0
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +14 -0
- package/dist/temporal/circuit/client.js +17 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +16 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +22 -2
- package/dist/temporal/circuit/contrat.js +76 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +68 -11
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +3 -0
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/installation.d.ts +5 -0
- package/dist/temporal/installation.js +23 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +1 -0
- package/dist/temporal/tickets/activites.js +37 -2
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +14 -0
- package/dist/temporal/tickets/deroule.js +16 -3
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +204 -55
- package/docs/INTERFACE.md +8 -5
- package/hooks/register.tsx +30 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +64 -15
- package/scripts/attente-a-l-arret.mjs +29 -52
- package/scripts/attente-au-tour.mjs +8 -26
- package/scripts/circuit.mjs +204 -64
- package/scripts/circuits-cles.d.mts +9 -0
- package/scripts/circuits-cles.mjs +38 -0
- package/scripts/coeurs-dedies.mjs +4 -3
- package/scripts/dernier-vert.mjs +66 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -2
- package/scripts/etapes.mjs +6 -1
- package/scripts/faits-du-circuit.mjs +22 -3
- package/scripts/fichiers-nommes.mjs +55 -0
- package/scripts/file-des-tickets.d.mts +17 -0
- package/scripts/file-des-tickets.mjs +39 -0
- package/scripts/grillhouse-maj.mjs +20 -1
- package/scripts/integration/file.mjs +11 -5
- package/scripts/integration/integrer.mjs +4 -2
- package/scripts/langages/cargo/clippy.mjs +16 -9
- package/scripts/langages/cargo/commandes.mjs +7 -2
- package/scripts/langages/cargo/sccache.mjs +19 -6
- package/scripts/langages/typescript/tests.mjs +31 -5
- package/scripts/langages/typescript/turbo-des-paquets.mjs +51 -3
- package/scripts/langages/typescript/vitest-config/changements.mjs +32 -3
- package/scripts/langages/typescript/vitest-config/lances.mjs +16 -0
- package/scripts/limite-d-usage.mjs +88 -0
- package/scripts/outils-cles.d.mts +13 -5
- package/scripts/outils-cles.mjs +157 -17
- package/scripts/passe-de-la-machine.mjs +26 -2
- package/scripts/places-de-la-machine.mjs +52 -6
- package/scripts/plafond-de-la-machine.d.mts +10 -2
- package/scripts/plafond-de-la-machine.mjs +39 -13
- package/scripts/reponses-du-circuit.d.mts +16 -0
- package/scripts/reponses-du-circuit.mjs +39 -3
- package/scripts/resultats.mjs +32 -11
- package/scripts/seances.mjs +211 -59
- package/scripts/session-start.sh +2 -2
- package/scripts/sous-commandes.mjs +5 -2
- package/scripts/superviseur.mjs +178 -226
- package/scripts/tableau.mjs +50 -37
- package/scripts/transitions.d.mts +22 -1
- package/scripts/transitions.mjs +111 -13
- package/scripts/workflows-du-cadre.mjs +21 -1
- package/skills/explorateur/SKILL.md +34 -13
- package/skills/pitmaster/SKILL.md +24 -20
- package/skills/relecteur/SKILL.md +6 -0
- package/skills/testwriter/SKILL.md +4 -0
|
@@ -73,7 +73,6 @@ import {
|
|
|
73
73
|
ecrireEtat,
|
|
74
74
|
finirLOuverture,
|
|
75
75
|
lireLeFait,
|
|
76
|
-
MEMOIRE,
|
|
77
76
|
monter,
|
|
78
77
|
ouvrirJusquAuPlan,
|
|
79
78
|
publierLArret,
|
|
@@ -97,7 +96,8 @@ import {
|
|
|
97
96
|
import { avancementDeLaCI } from './avancement.mjs';
|
|
98
97
|
|
|
99
98
|
import { ecrireLEffet } from './effets.mjs';
|
|
100
|
-
import { Arret, geste } from './ticket-du-circuit.mjs';
|
|
99
|
+
import { Arret, commenter, geste } from './ticket-du-circuit.mjs';
|
|
100
|
+
import { arretDeLaLimiteDUsage, MEMOIRE } from './transitions.mjs';
|
|
101
101
|
|
|
102
102
|
// What the workflow keeps of the circuit's memory besides the decisions': the session a relaunch
|
|
103
103
|
// resumes, the rank of arrival, the sort of the ticket, what the opening reads of the project's
|
|
@@ -197,6 +197,14 @@ const optionsDe = reponse => {
|
|
|
197
197
|
destinataire: ['testwriter', 'developpeur'].includes(reponse.role) ? reponse.role : null,
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
+
if (reponse.genre === 'mecanique') {
|
|
201
|
+
// The gesture written by hand goes to the developpeur, who gets the reason as his context.
|
|
202
|
+
return {
|
|
203
|
+
mecanique: { commande: reponse.commande ?? null },
|
|
204
|
+
contexte: contexteDuSuperviseur,
|
|
205
|
+
destinataire: reponse.commande ? null : 'developpeur',
|
|
206
|
+
};
|
|
207
|
+
}
|
|
200
208
|
return { etendre: reponse.paquets, contexte: contexteDuSuperviseur, destinataire: null };
|
|
201
209
|
};
|
|
202
210
|
|
|
@@ -289,7 +297,9 @@ const ACTES = {
|
|
|
289
297
|
const avec = fait === 'seance' ? { ...parametres, precedent, annulation } : parametres;
|
|
290
298
|
try {
|
|
291
299
|
const valeur = await lireLeFait(ctx, fait, avec, faits);
|
|
292
|
-
|
|
300
|
+
// The plan as the fact leaves it: a session may extend it (a write in a file the ticket
|
|
301
|
+
// names), which the workflow keeps for the acts after.
|
|
302
|
+
return { valeur: valeur ?? null, memoire: laMemoire(ctx), paquets: ctx.paquets };
|
|
293
303
|
} catch (e) {
|
|
294
304
|
if (!(e instanceof Arret)) {
|
|
295
305
|
throw e;
|
|
@@ -298,6 +308,7 @@ const ACTES = {
|
|
|
298
308
|
return {
|
|
299
309
|
leve: { nom, rapport, rouges, motif, resultat, piece, question, qui, etape },
|
|
300
310
|
memoire: laMemoire(ctx),
|
|
311
|
+
paquets: ctx.paquets,
|
|
301
312
|
};
|
|
302
313
|
}
|
|
303
314
|
});
|
|
@@ -317,6 +328,14 @@ const ACTES = {
|
|
|
317
328
|
return rendre(ctx, () => {
|
|
318
329
|
const a = publierLArret(ctx, erreurDe(ctx, arret), etat);
|
|
319
330
|
finirLEtape(ctx, menee ?? null);
|
|
331
|
+
if (a.nom === 'limite-d-usage' && !aMonter) {
|
|
332
|
+
// The usage limit is no question: the circuit reports itself (the workflow waits for the
|
|
333
|
+
// hour the usage returns), the report said at the ticket.
|
|
334
|
+
const l = arretDeLaLimiteDUsage(a.etat, arret.leve.resultat);
|
|
335
|
+
commenter(ctx, 'limite-d-usage', l.commentaire);
|
|
336
|
+
aLaFin(ctx, l.code);
|
|
337
|
+
return { code: l.code, nom: l.nom, question: null, etat: l.etat };
|
|
338
|
+
}
|
|
320
339
|
if (a.nom === 'a-repasser' && !aMonter) {
|
|
321
340
|
geste(ctx, 'a-repasser');
|
|
322
341
|
aLaFin(ctx, a.code);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// The files a ticket's description names: a path written from the root, between backticks or bare,
|
|
2
|
+
// in its « Architecture » section or in an acceptance criterion. A file named there is one the
|
|
3
|
+
// ticket's plan covers by its own word: a write out of the plan in it extends the plan, with the
|
|
4
|
+
// piece that names it. A parent directory, a base name alone, another section, and the documents
|
|
5
|
+
// the responsable owns (ARCHITECTURE.md, CADRE.md, INTERFACE.md) are not named.
|
|
6
|
+
|
|
7
|
+
const DOCUMENTS_DU_RESPONSABLE = /(^|\/)(ARCHITECTURE|CADRE|INTERFACE)\.md$/;
|
|
8
|
+
|
|
9
|
+
// The path <chemin> as a token of <ligne>: delimited by a space, a backtick, a quote, a bracket or
|
|
10
|
+
// a comma around it, or by a closing full stop, a colon or a semicolon after it.
|
|
11
|
+
function figureDans(ligne, chemin) {
|
|
12
|
+
const echappe = chemin.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
13
|
+
return new RegExp(`(^|[\\s\`'"(\\[,])${echappe}($|[\\s\`'")\\],;:]|\\.(\\s|$))`).test(ligne);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The piece (`{ piece }`, « ticket, § Architecture » or « ticket, critère N ») by which the
|
|
18
|
+
* description <description> names the file <chemin>, or null when it does not.
|
|
19
|
+
*/
|
|
20
|
+
export function fichierNommeAuTicket(description, chemin) {
|
|
21
|
+
if (!chemin || DOCUMENTS_DU_RESPONSABLE.test(chemin)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
let section = null;
|
|
25
|
+
let critere = null;
|
|
26
|
+
for (const ligne of String(description ?? '').split('\n')) {
|
|
27
|
+
const titre = /^#{1,6}\s+(.*?)\s*$/.exec(ligne);
|
|
28
|
+
if (titre) {
|
|
29
|
+
const t = titre[1].toLowerCase();
|
|
30
|
+
section = t.startsWith('architecture')
|
|
31
|
+
? 'architecture'
|
|
32
|
+
: t.startsWith('crit')
|
|
33
|
+
? 'criteres'
|
|
34
|
+
: null;
|
|
35
|
+
critere = null;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (section === 'criteres') {
|
|
39
|
+
const numero = /^\s{0,3}(\d+)[.)]\s/.exec(ligne);
|
|
40
|
+
if (numero) {
|
|
41
|
+
critere = numero[1];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!figureDans(ligne, chemin)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (section === 'architecture') {
|
|
48
|
+
return { piece: 'ticket, § Architecture' };
|
|
49
|
+
}
|
|
50
|
+
if (section === 'criteres' && critere) {
|
|
51
|
+
return { piece: `ticket, critère ${critere}` };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
@@ -31,6 +31,23 @@ export function attentesExternes(
|
|
|
31
31
|
o?: { enCours?: Set<string>; externes?: Record<string, TicketDeBeads[]> }
|
|
32
32
|
): Array<{ ticket: string; attend: string; faute: string | null }>;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The circuits that hold a place in the limit of the project: those that work, those resumed and
|
|
36
|
+
* waiting for their place of the machine, and those stopped on a question to the supervisor (no
|
|
37
|
+
* recipient, or « superviseur »); the question to the owner, the ticket deferred and the wait for
|
|
38
|
+
* another project release it. `superviseur`: those of `tenant` that wait for the supervisor.
|
|
39
|
+
*/
|
|
40
|
+
export function circuitsDeLaLimite(
|
|
41
|
+
circuits: Array<{
|
|
42
|
+
ticket: string;
|
|
43
|
+
etape?: string | null;
|
|
44
|
+
question?: { qui?: string } | null;
|
|
45
|
+
report?: object | null;
|
|
46
|
+
}>,
|
|
47
|
+
tous: TicketDeBeads[],
|
|
48
|
+
o?: { externes?: Record<string, TicketDeBeads[]> }
|
|
49
|
+
): { tenant: string[]; superviseur: string[] };
|
|
50
|
+
|
|
34
51
|
/** The tickets of <tous> in the queue that never start for want of their section « ## Architecture ». */
|
|
35
52
|
export function enFileSansArchitecture<T extends TicketDeBeads>(
|
|
36
53
|
tous: T[],
|
|
@@ -143,6 +143,45 @@ export function fermesHorsCircuit(tous, circuits) {
|
|
|
143
143
|
.sort();
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* The circuits of <circuits> that hold a place in the limit of the project (`grillhouse.circuits`),
|
|
148
|
+
* as a Kanban limit of work in progress keeps a blocked card in it: a circuit that works, one
|
|
149
|
+
* resumed and waiting for its place of the machine, and one stopped on a question to the
|
|
150
|
+
* supervisor (no recipient, or `qui` « superviseur »). A question to the owner, a ticket deferred
|
|
151
|
+
* (`--reporter`) and a wait for another project release their place. Each circuit is judged by
|
|
152
|
+
* its own memo, read again at every wake of the queue.
|
|
153
|
+
* @param {Array<{ ticket: string, etape?: string | null, question?: { qui?: string } | null }>} circuits
|
|
154
|
+
* the circuits alive, each with its memo
|
|
155
|
+
* @param {Parameters<typeof ticketsAPartir>[0]} tous every ticket of the project
|
|
156
|
+
* @param {{ externes?: Record<string, typeof tous> }} [o]
|
|
157
|
+
* @returns {{ tenant: string[], superviseur: string[] }} the circuits that hold the limit, and
|
|
158
|
+
* among them those that wait for the supervisor, each sorted
|
|
159
|
+
*/
|
|
160
|
+
export function circuitsDeLaLimite(circuits, tous, { externes } = {}) {
|
|
161
|
+
const parId = new Map(tous.map(t => [t.id, t]));
|
|
162
|
+
const tenant = [];
|
|
163
|
+
const superviseur = [];
|
|
164
|
+
for (const c of circuits) {
|
|
165
|
+
const t = parId.get(c.ticket);
|
|
166
|
+
if (t && (t.status === 'deferred' || attendDeLAutreProjet(t, externes).length > 0)) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
// A circuit reported for the usage limit (its kept report) waits for an hour, as a ticket
|
|
170
|
+
// deferred does: it releases its place.
|
|
171
|
+
if (c.report) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (c.question) {
|
|
175
|
+
if (c.question.qui === 'responsable') {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
superviseur.push(c.ticket);
|
|
179
|
+
}
|
|
180
|
+
tenant.push(c.ticket);
|
|
181
|
+
}
|
|
182
|
+
return { tenant: tenant.sort(), superviseur: superviseur.sort() };
|
|
183
|
+
}
|
|
184
|
+
|
|
146
185
|
/**
|
|
147
186
|
* The tickets of <tous> in the queue that never start for want of their section
|
|
148
187
|
* « ## Architecture », their dependencies open or closed, sorted by id.
|
|
@@ -166,7 +166,13 @@ import { migrer, restesAuProjet } from './migrations.mjs';
|
|
|
166
166
|
import { langageDe, langagesDe } from './langages.mjs';
|
|
167
167
|
import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
|
|
168
168
|
import { CONFIG_BEADS, ecrireLePrefixe, prefixe, prefixeDuStore } from './prefixe-des-tickets.mjs';
|
|
169
|
-
import {
|
|
169
|
+
import { paquets } from './paquets.mjs';
|
|
170
|
+
import {
|
|
171
|
+
NOM_MACHINE_VIERGE,
|
|
172
|
+
poserLesWorkflows,
|
|
173
|
+
poseraLaMachineVierge,
|
|
174
|
+
WORKFLOWS,
|
|
175
|
+
} from './workflows-du-cadre.mjs';
|
|
170
176
|
|
|
171
177
|
const SCRIPTS = {
|
|
172
178
|
tableau: 'grillhouse tableau --texte',
|
|
@@ -507,6 +513,19 @@ export function mettreAJour(projet, source, { inscrite = VERSION, bd = jouerBd }
|
|
|
507
513
|
sansVerifier: bilan.duLangage.sansVerifier ?? part.sansVerifier,
|
|
508
514
|
};
|
|
509
515
|
}
|
|
516
|
+
// The workflow « machine vierge » that the update poses is declared with every package of the
|
|
517
|
+
// project's graph; an entry already declared stays as it is.
|
|
518
|
+
const fichierVierge = `${WORKFLOWS}/${NOM_MACHINE_VIERGE}`;
|
|
519
|
+
if (
|
|
520
|
+
p.grillhouse?.flux?.[fichierVierge] === undefined &&
|
|
521
|
+
poseraLaMachineVierge(projet, source)
|
|
522
|
+
) {
|
|
523
|
+
const noms = [...new Set(paquets(projet).map(q => q.pkg.name))].sort();
|
|
524
|
+
p.grillhouse = {
|
|
525
|
+
...(p.grillhouse ?? {}),
|
|
526
|
+
flux: { ...(p.grillhouse?.flux ?? {}), [fichierVierge]: noms },
|
|
527
|
+
};
|
|
528
|
+
}
|
|
510
529
|
writeFileSync(pkg, `${JSON.stringify(p, null, 2)}\n`);
|
|
511
530
|
// The flows of the CI without entry in `grillhouse.flux` (the guard's read), with the entries
|
|
512
531
|
// already declared, which the command of the report keeps.
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
regenerer,
|
|
84
84
|
} from '../engendres.mjs';
|
|
85
85
|
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
86
|
-
import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
|
|
86
|
+
import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
|
|
87
87
|
import { lireCommit } from '../poussee-cles.mjs';
|
|
88
88
|
import { ouvrirCopie } from './rejeu.mjs';
|
|
89
89
|
import { lotSurMain } from './integrer.mjs';
|
|
@@ -659,7 +659,8 @@ export function situerLeLot(o, ticket) {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
// The branch at <tip> replaced on the main <tete> in the queue's own copy, with the tools <o>:
|
|
662
|
-
// { nouveau } (the replaced commit), or { sortie: [titre, détail] } (it leaves the queue
|
|
662
|
+
// { nouveau } (the replaced commit), or { sortie: [titre, détail] } (it leaves the queue; with
|
|
663
|
+
// `conflit: true` when it does not replay on main), or
|
|
663
664
|
// { garde } (it stays, the reason).
|
|
664
665
|
function remplacer(o, tip, tete) {
|
|
665
666
|
const { racine, dire } = o;
|
|
@@ -672,7 +673,10 @@ function remplacer(o, tip, tete) {
|
|
|
672
673
|
let env;
|
|
673
674
|
try {
|
|
674
675
|
engendres = engendresDe(racine);
|
|
675
|
-
env = avecLesDonnees(
|
|
676
|
+
env = avecLesDonnees(
|
|
677
|
+
donneesDe(racine),
|
|
678
|
+
avecLesOutils(outilsDe(racine), process.env, empreintesDe(racine))
|
|
679
|
+
);
|
|
676
680
|
} catch (e) {
|
|
677
681
|
return { garde: `une clé grillhouse du package.json est refusée :\n${e.message}` };
|
|
678
682
|
}
|
|
@@ -702,6 +706,7 @@ function remplacer(o, tip, tete) {
|
|
|
702
706
|
if (!engendresSeuls) {
|
|
703
707
|
dansCopie('rebase', '--abort');
|
|
704
708
|
return {
|
|
709
|
+
conflit: true,
|
|
705
710
|
sortie: [
|
|
706
711
|
'elle ne se replace pas sur main.',
|
|
707
712
|
conflits.length
|
|
@@ -941,7 +946,8 @@ export function fermerLEntree(o, entree) {
|
|
|
941
946
|
* What the outcome <r> of `preparerLaBranche` or `avancerMain` for <entree> says to its ticket,
|
|
942
947
|
* with the tools <o>: a branch out of the queue reopens it, its files named; a branch set aside
|
|
943
948
|
* loses `en-file`, the ticket left open; a branch kept, the reason. `{ etat, raison }`: `rouvert`
|
|
944
|
-
* or `en-file`, as the circuit
|
|
949
|
+
* (with `conflit: true` for a branch that does not replay on main) or `en-file`, as the circuit
|
|
950
|
+
* reads the queue.
|
|
945
951
|
*/
|
|
946
952
|
export function direLIssue(o, entree, r) {
|
|
947
953
|
const commenter = texte => commenterAu(o, entree.ticket, texte);
|
|
@@ -951,7 +957,7 @@ export function direLIssue(o, entree, r) {
|
|
|
951
957
|
o.bd('update', entree.ticket, '--status', 'open', '--remove-label', 'en-file');
|
|
952
958
|
commenter(texte);
|
|
953
959
|
o.dire(`✗ ${entree.branche} sort de la file : ${titre}`);
|
|
954
|
-
return { etat: 'rouvert', raison: texte };
|
|
960
|
+
return { etat: 'rouvert', raison: texte, ...(r.conflit ? { conflit: true } : {}) };
|
|
955
961
|
}
|
|
956
962
|
if (r.ecartee) {
|
|
957
963
|
const texte = `## Sortie de la file\n\nLa branche ${entree.branche} n'a rien en avance sur ${o.principale} : elle n'entre pas, et le ticket reste ouvert.`;
|
|
@@ -98,7 +98,7 @@ import { langageDe } from '../langages.mjs';
|
|
|
98
98
|
import { prefixe } from '../prefixe-des-tickets.mjs';
|
|
99
99
|
import { commitsDelivering, gitLog } from '../un-commit-par-ticket.mjs';
|
|
100
100
|
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
101
|
-
import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
|
|
101
|
+
import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
|
|
102
102
|
import { lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
|
|
103
103
|
import { ouvrirCopie, RETIRER_COPIE } from './rejeu.mjs';
|
|
104
104
|
import { verdictDe } from './verdict.mjs';
|
|
@@ -374,10 +374,12 @@ function main(argv) {
|
|
|
374
374
|
// 0. The keys of the project, before any work.
|
|
375
375
|
let engendres;
|
|
376
376
|
let outils;
|
|
377
|
+
let empreintes;
|
|
377
378
|
let donnees;
|
|
378
379
|
try {
|
|
379
380
|
engendres = engendresDe(racine);
|
|
380
381
|
outils = outilsDe(racine);
|
|
382
|
+
empreintes = empreintesDe(racine);
|
|
381
383
|
donnees = donneesDe(racine);
|
|
382
384
|
} catch (e) {
|
|
383
385
|
return refuser(`Une clé grillhouse du package.json est refusée :\n${e.message}`);
|
|
@@ -514,7 +516,7 @@ function main(argv) {
|
|
|
514
516
|
}
|
|
515
517
|
const aRejouer = part.rejouees;
|
|
516
518
|
if (aRejouer.length) {
|
|
517
|
-
const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env));
|
|
519
|
+
const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env, empreintes));
|
|
518
520
|
const refus = regenerer({
|
|
519
521
|
refs: aRejouer,
|
|
520
522
|
dansCopie,
|
|
@@ -85,15 +85,22 @@ export function commande(racine, { env = process.env } = {}) {
|
|
|
85
85
|
process.stderr.write(`${absent}\n`);
|
|
86
86
|
return 1;
|
|
87
87
|
}
|
|
88
|
-
demarrerLeServeur(racine, env);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
const serveur = demarrerLeServeur(racine, env);
|
|
89
|
+
// A server that does not answer is a finding refused, cargo never run.
|
|
90
|
+
const r = serveur
|
|
91
|
+
? null
|
|
92
|
+
: spawnSync('cargo', ARGS, {
|
|
93
|
+
cwd: racine,
|
|
94
|
+
env: avecSccache(racine, env),
|
|
95
|
+
encoding: 'utf8',
|
|
96
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
97
|
+
});
|
|
98
|
+
const constats = serveur
|
|
99
|
+
? [{ message: serveur.replace(/^⛔ /, '') }]
|
|
100
|
+
: r.error
|
|
101
|
+
? []
|
|
102
|
+
: constatsDeClippy(r.stdout ?? '', racine);
|
|
103
|
+
if (r && (r.error || (r.status !== 0 && constats.length === 0))) {
|
|
97
104
|
const fin = r.error?.message ?? (r.stderr ?? '').trim().split('\n').at(-1) ?? '';
|
|
98
105
|
constats.push({ message: `cargo clippy rouge (code ${r.status ?? r.signal}) : ${fin}` });
|
|
99
106
|
}
|
|
@@ -311,8 +311,13 @@ function passe(racine, env) {
|
|
|
311
311
|
rmSync(junit, { force: true });
|
|
312
312
|
}
|
|
313
313
|
// The server of sccache, started under a short temporary directory (./sccache.mjs).
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
// A server that does not answer stops the task before cargo, the line printed.
|
|
315
|
+
const serveur = COMPILATIONS.includes(args[0]) ? demarrerLeServeur(racine, env) : null;
|
|
316
|
+
if (serveur) {
|
|
317
|
+
process.stderr.write(`${serveur}\n`);
|
|
318
|
+
t.code = 1;
|
|
319
|
+
ecrire();
|
|
320
|
+
return t.code;
|
|
316
321
|
}
|
|
317
322
|
const banc = t.script === BUDGET;
|
|
318
323
|
const avant = banc ? pression() : null;
|
|
@@ -159,18 +159,31 @@ export function sccacheAbsent(racine, env) {
|
|
|
159
159
|
/**
|
|
160
160
|
* Starts the server of sccache of the copy at <racine> under <env> (`avecSccache`), under the
|
|
161
161
|
* machine's temporary directory (`COURT`), unless the project sets its own wrapper; a server
|
|
162
|
-
* already running stays, and its refusal of a second one is no failure.
|
|
162
|
+
* already running stays, and its refusal of a second one is no failure. The server is judged
|
|
163
|
+
* reachable by what sccache answers: after the start, `sccache --show-stats` under the same
|
|
164
|
+
* environment interrogates it.
|
|
163
165
|
* @param {string} racine
|
|
164
166
|
* @param {NodeJS.ProcessEnv} env the environment before `avecSccache`
|
|
167
|
+
* @returns {string | null} the line that refuses the run, naming the start of the server and
|
|
168
|
+
* carrying the outputs of the start and of the interrogation; null when the server answers, or
|
|
169
|
+
* when the project sets its own wrapper
|
|
165
170
|
*/
|
|
166
171
|
export function demarrerLeServeur(racine, env) {
|
|
167
172
|
if (lanceurDuProjet(racine, env)) {
|
|
168
|
-
return;
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const sous = { env: { ...avecSccache(racine, env), TMPDIR: COURT }, encoding: 'utf8' };
|
|
176
|
+
const demarrage = spawnSync('sccache', ['--start-server'], sous);
|
|
177
|
+
const interrogation = spawnSync('sccache', ['--show-stats'], sous);
|
|
178
|
+
if (!interrogation.error && interrogation.status === 0) {
|
|
179
|
+
return null;
|
|
169
180
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
181
|
+
const dit = (nom, r) =>
|
|
182
|
+
`${nom} (code ${r.status ?? r.signal}) : ${[r.error?.message, r.stdout, r.stderr]
|
|
183
|
+
.filter(Boolean)
|
|
184
|
+
.join(' ')
|
|
185
|
+
.trim()}`;
|
|
186
|
+
return `⛔ démarrage du serveur sccache refusé : le serveur ne répond pas ; ${dit('--start-server', demarrage)} ; ${dit('--show-stats', interrogation)}`;
|
|
174
187
|
}
|
|
175
188
|
|
|
176
189
|
/**
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
// counts them in the hash of every task of the run (its documentation, « Caching »: « including
|
|
24
24
|
// dependencies of `build` that did not receive `--arg=value` »), where a variable of a task's
|
|
25
25
|
// `env` enters that task's hash alone. So a run with paths is one Turborepo run of the tests with
|
|
26
|
-
// what they depend on (`turbo run test:unit --filter=<name>`)
|
|
26
|
+
// what they depend on (`turbo run test:unit --filter=<name>`); a package named whole (the exact
|
|
27
|
+
// folder of a package) carries no path: it plays under the hash of the complete pass, and a run
|
|
28
|
+
// that mixes it with files of another package is two runs, the code the first that is not 0:
|
|
29
|
+
// the builds and the traces they
|
|
27
30
|
// wait for play first, from the cache when nothing moved, whatever paths are named, and the hash
|
|
28
31
|
// of the tests holds theirs, as Bazel's key of a target holds its transitive inputs; a change to
|
|
29
32
|
// a package the tests import, or to what they read, plays them again. Every other run of
|
|
@@ -230,6 +233,9 @@ const lancer = () => {
|
|
|
230
233
|
const refus = [];
|
|
231
234
|
const noms = new Set();
|
|
232
235
|
const absolus = [];
|
|
236
|
+
// The packages named whole (the exact folder of a package): they play under the hash of the
|
|
237
|
+
// complete pass, as Bazel's `//pkg/...` shares the cache of `//...`.
|
|
238
|
+
const entiers = new Set();
|
|
233
239
|
for (const chemin of chemins) {
|
|
234
240
|
const abs = path.resolve(racine, chemin);
|
|
235
241
|
const p = liste.find(({ dossier }) =>
|
|
@@ -246,6 +252,10 @@ const lancer = () => {
|
|
|
246
252
|
} else if (typeof p.pkg.scripts?.[SCRIPT_DES_TESTS] !== 'string') {
|
|
247
253
|
refus.push(`⛔ ${chemin} : ${p.dossier} n'a pas de script ${SCRIPT_DES_TESTS}.`);
|
|
248
254
|
} else {
|
|
255
|
+
if (abs === path.join(racine, p.dossier)) {
|
|
256
|
+
entiers.add(p.pkg.name);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
249
259
|
noms.add(p.pkg.name);
|
|
250
260
|
// A directory ends with « / »: Vitest matches the start of a path, and packages/a is the start
|
|
251
261
|
// of packages/ab.
|
|
@@ -259,10 +269,26 @@ const lancer = () => {
|
|
|
259
269
|
}
|
|
260
270
|
return 2;
|
|
261
271
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
)
|
|
272
|
+
// The whole packages play with no path in the variable (only the options and the moment of
|
|
273
|
+
// `--force`); the files play in a run of their own. The code is the first that is not 0.
|
|
274
|
+
const codes = [];
|
|
275
|
+
if (entiers.size) {
|
|
276
|
+
codes.push(
|
|
277
|
+
cibles(
|
|
278
|
+
[...entiers].sort().map(n => `--filter=${n}`),
|
|
279
|
+
options
|
|
280
|
+
)
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (noms.size) {
|
|
284
|
+
codes.push(
|
|
285
|
+
cibles(
|
|
286
|
+
[...noms].sort().map(n => `--filter=${n}`),
|
|
287
|
+
[...absolus, ...options]
|
|
288
|
+
)
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return codes.find(c => c !== 0) ?? 0;
|
|
266
292
|
};
|
|
267
293
|
|
|
268
294
|
try {
|
|
@@ -324,14 +324,30 @@ const POURQUOI = {
|
|
|
324
324
|
};
|
|
325
325
|
// The variables of the tools of the project at <racine> (`grillhouse.outils` of its package.json,
|
|
326
326
|
// scripts/outils-cles.mjs), in the order it declares them: the paths of tools outside the
|
|
327
|
-
// repository its tests demand, which the run passes to every task without hashing them
|
|
328
|
-
//
|
|
327
|
+
// repository its tests demand, which the run passes to every task without hashing them; a tool
|
|
328
|
+
// declared hashed by content (`{ chemin, contenu: true }`) is not among them: its fingerprint is
|
|
329
|
+
// (`empreintesDOutils`). A key that is no variable name is the guard of the tools' (`grillhouse
|
|
330
|
+
// outil`), not this one's.
|
|
329
331
|
function variablesDOutils(racine) {
|
|
332
|
+
return lesOutils(racine).filter(([, haché]) => !haché).map(([n]) => n);
|
|
333
|
+
}
|
|
334
|
+
// The variables `<VARIABLE>_EMPREINTE` of the tools of the project at <racine> declared hashed by
|
|
335
|
+
// content, in the order the key declares them: the root's `globalEnv` names them, Turborepo
|
|
336
|
+
// hashing the value of a variable it declares (the value scripts/outils-cles.mjs gives each pass).
|
|
337
|
+
function empreintesDOutils(racine) {
|
|
338
|
+
return lesOutils(racine)
|
|
339
|
+
.filter(([, haché]) => haché)
|
|
340
|
+
.map(([n]) => `${n}_EMPREINTE`);
|
|
341
|
+
}
|
|
342
|
+
// The tools of the project at <racine>, `[variable, hashed by content]` in the order of the key.
|
|
343
|
+
function lesOutils(racine) {
|
|
330
344
|
try {
|
|
331
345
|
const o = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).grillhouse
|
|
332
346
|
?.outils;
|
|
333
347
|
return o && typeof o === 'object' && !Array.isArray(o)
|
|
334
|
-
? Object.
|
|
348
|
+
? Object.entries(o)
|
|
349
|
+
.filter(([n]) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(n))
|
|
350
|
+
.map(([n, v]) => [n, v !== null && typeof v === 'object' && v.contenu === true])
|
|
335
351
|
: [];
|
|
336
352
|
} catch {
|
|
337
353
|
return [];
|
|
@@ -913,6 +929,19 @@ function passagesManquants(racine) {
|
|
|
913
929
|
return manques.length ? { f: r.f, attendu: [...actuel, ...manques], manques } : null;
|
|
914
930
|
}
|
|
915
931
|
|
|
932
|
+
// The `globalEnv` the root's turbo.json at <racine> must hold, the fingerprint of each tool hashed
|
|
933
|
+
// by content it lacks added to the project's: { f, attendu, manques }; null when it holds them,
|
|
934
|
+
// without a root configuration, and when it is no JSON.
|
|
935
|
+
function empreintesManquantes(racine) {
|
|
936
|
+
const r = confRacine(racine);
|
|
937
|
+
if (!r) {
|
|
938
|
+
return null;
|
|
939
|
+
}
|
|
940
|
+
const actuel = Array.isArray(r.conf.globalEnv) ? r.conf.globalEnv : [];
|
|
941
|
+
const manques = empreintesDOutils(racine).filter(v => !actuel.includes(v));
|
|
942
|
+
return manques.length ? { f: r.f, attendu: [...actuel, ...manques], manques } : null;
|
|
943
|
+
}
|
|
944
|
+
|
|
916
945
|
// The inputs of the root's turbo.json at <racine> that can reach the `.git` of a submodule its
|
|
917
946
|
// .gitmodules declares (a pattern under `$TURBO_ROOT$/` of a task, or a global dependency, whose
|
|
918
947
|
// fixed part is the submodule or holds it, then a glob) without its exclusion beside them:
|
|
@@ -1019,6 +1048,19 @@ export function ecrire(racine) {
|
|
|
1019
1048
|
ecrits.push(passage.f);
|
|
1020
1049
|
}
|
|
1021
1050
|
}
|
|
1051
|
+
const empreintes = empreintesManquantes(racine);
|
|
1052
|
+
if (empreintes) {
|
|
1053
|
+
const abs = path.join(racine, empreintes.f);
|
|
1054
|
+
const texte = readFileSync(abs, 'utf8');
|
|
1055
|
+
const chemin = ['globalEnv'];
|
|
1056
|
+
writeFileSync(
|
|
1057
|
+
abs,
|
|
1058
|
+
applyEdits(texte, modify(texte, chemin, empreintes.attendu, MISE_EN_FORME))
|
|
1059
|
+
);
|
|
1060
|
+
if (!ecrits.includes(empreintes.f)) {
|
|
1061
|
+
ecrits.push(empreintes.f);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1022
1064
|
const gits = gitsAbsents(racine);
|
|
1023
1065
|
if (gits) {
|
|
1024
1066
|
const abs = path.join(racine, gits.f);
|
|
@@ -1220,6 +1262,12 @@ export function verifier(racine) {
|
|
|
1220
1262
|
`⛔ ${passage.f} : \`globalPassThroughEnv\` doit nommer ${v}, ${POURQUOI[v] ?? (variablesDeDonnees(racine).includes(v) ? "la donnée d'un paquet (`grillhouse.donnees`) que ses tests exigent" : "l'outil du projet (`grillhouse.outils`) que ses tests exigent")} ; \`${COMMANDE}\` l'ajoute.`
|
|
1221
1263
|
);
|
|
1222
1264
|
}
|
|
1265
|
+
const empreintes = empreintesManquantes(racine);
|
|
1266
|
+
for (const v of empreintes?.manques ?? []) {
|
|
1267
|
+
refus.push(
|
|
1268
|
+
`⛔ ${empreintes.f} : \`globalEnv\` doit nommer ${v}, l'empreinte du contenu d'un outil du projet déclaré haché (\`grillhouse.outils\`, \`contenu: true\`), dont Turborepo hache la valeur ; \`${COMMANDE}\` l'ajoute.`
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1223
1271
|
for (const { cle, attendu, present } of gardesEcartees(racine)?.ecarts ?? []) {
|
|
1224
1272
|
const f = fichierRacine(racine);
|
|
1225
1273
|
refus.push(
|
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
// 7. a file of the package that no graph can hold, its extension not that of a module (`.js`,
|
|
47
47
|
// `.mjs`, `.cjs`, `.ts`, `.mts`, `.cts`, `.jsx`, `.tsx`, `.json`): data, a template, a
|
|
48
48
|
// script of the shell, a document, which a test reads without importing it.
|
|
49
|
+
// A file the measure classes without effect (`sansEffet`, scripts/dernier-vert.mjs: a document, or
|
|
50
|
+
// a file of code whose isolated transpilation, comments removed, is identical to the last
|
|
51
|
+
// green's) relates no test through the graph and triggers neither 6 nor 7, as Gradle's compile
|
|
52
|
+
// avoidance stops a build whose output is identical; 5, the tests that declare they read it
|
|
53
|
+
// (`@lit`) and, out of the mark `cible`, the tests that read it by its path keep their rule.
|
|
49
54
|
// Vitest's own `forceRerunTriggers` (a configuration's, or its default) still apply, as with
|
|
50
55
|
// `--changed`. Under the mark `cible`, 5 and 7 do not play the package whole, and no test is
|
|
51
56
|
// related by the paths it reads (`testsQuiLancent`): the tests Vitest relates alone, the tests
|
|
@@ -70,7 +75,7 @@ import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
|
70
75
|
import { createRequire } from 'node:module';
|
|
71
76
|
import path from 'node:path';
|
|
72
77
|
import { fileURLToPath } from 'node:url';
|
|
73
|
-
import { testsQuiDeclarent, testsQuiLancent } from './lances.mjs';
|
|
78
|
+
import { testsQuiDeclarent, testsQuiLancent, testsQuiNomment } from './lances.mjs';
|
|
74
79
|
|
|
75
80
|
// This directory, the frame's base configuration.
|
|
76
81
|
const BASE = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -107,6 +112,7 @@ export function lireChangements(chemin) {
|
|
|
107
112
|
typeof c.racine !== 'string' ||
|
|
108
113
|
!liste(c.fichiers) ||
|
|
109
114
|
!liste(c.supprimes) ||
|
|
115
|
+
(c.sansEffet !== undefined && !liste(c.sansEffet)) ||
|
|
110
116
|
(c.cible !== undefined && typeof c.cible !== 'boolean')
|
|
111
117
|
) {
|
|
112
118
|
return null;
|
|
@@ -240,6 +246,15 @@ function paquetEntier(ch, dossier, test = {}) {
|
|
|
240
246
|
return { raison, fichier: f };
|
|
241
247
|
}
|
|
242
248
|
}
|
|
249
|
+
// A file without effect on the output keeps rule 5 alone: a test that declares it reads the
|
|
250
|
+
// path reads its text, not its output.
|
|
251
|
+
if (!ch.cible) {
|
|
252
|
+
for (const f of ch.sansEffet ?? []) {
|
|
253
|
+
if (lit.some(l => f === l || f.startsWith(`${l}/`))) {
|
|
254
|
+
return { raison: 'un chemin que ses tests déclarent lire (grillhouse.lit)', fichier: f };
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
243
258
|
return null;
|
|
244
259
|
}
|
|
245
260
|
|
|
@@ -254,8 +269,22 @@ export function restreindre(test, dossier, ch, nommes, dire) {
|
|
|
254
269
|
return;
|
|
255
270
|
}
|
|
256
271
|
const changes = ch.fichiers.map(f => path.join(ch.racine, f));
|
|
257
|
-
|
|
258
|
-
|
|
272
|
+
// A file without effect relates no test through the graph, yet the tests that read its text keep
|
|
273
|
+
// their rule.
|
|
274
|
+
const sansEffet = ch.sansEffet ?? [];
|
|
275
|
+
const lanceurs = ch.cible
|
|
276
|
+
? []
|
|
277
|
+
: [
|
|
278
|
+
...new Set([
|
|
279
|
+
...testsQuiLancent(dossier, ch.racine, changes),
|
|
280
|
+
...testsQuiNomment(
|
|
281
|
+
dossier,
|
|
282
|
+
ch.racine,
|
|
283
|
+
sansEffet.map(f => path.join(ch.racine, f))
|
|
284
|
+
),
|
|
285
|
+
]),
|
|
286
|
+
];
|
|
287
|
+
const declarants = testsQuiDeclarent(dossier, [...ch.fichiers, ...ch.supprimes, ...sansEffet]);
|
|
259
288
|
test.related = [...new Set([...changes, ...nommes, ...lanceurs, ...declarants])];
|
|
260
289
|
test.passWithNoTests = true;
|
|
261
290
|
dire(
|
|
@@ -465,6 +465,22 @@ export function testsQuiLancent(dossier, racine, changes) {
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
+
/**
|
|
469
|
+
* The test files of the package at <dossier>, in the repository at <racine>, that name one of the
|
|
470
|
+
* files <changes> (absolute) by its path (`nommesPar`): the tests that read its text, not those
|
|
471
|
+
* that import it or reach it through a file they read; sorted.
|
|
472
|
+
*/
|
|
473
|
+
export function testsQuiNomment(dossier, racine, changes) {
|
|
474
|
+
const cibles = new Set(changes.map(f => reel(f) ?? f));
|
|
475
|
+
if (cibles.size === 0) {
|
|
476
|
+
return [];
|
|
477
|
+
}
|
|
478
|
+
const memo = new Map();
|
|
479
|
+
return testsDuPaquet(dossier).filter(t =>
|
|
480
|
+
[...nommesPar(t, dossier, racine, memo)].some(f => cibles.has(f))
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
468
484
|
// The tag of a test that declares the files it reads: a line `// @lit <motif> …` of the comment at
|
|
469
485
|
// the head of the file, before its first line of code, as the tag `@poste` (./cibles.mjs).
|
|
470
486
|
const ETIQUETTE_DE_LECTURE = /^\/\/\s*@lit\b(.*)$/;
|