@roomi-fields/grillhouse 0.30.0 → 0.31.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 +30 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/dist/temporal/circuit/client.d.ts +2 -2
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +4 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +3 -3
- package/dist/temporal/circuit/contrat.js +8 -2
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +3 -3
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +5 -6
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +0 -4
- package/dist/temporal/installation.js +12 -34
- package/dist/temporal/installation.js.map +1 -1
- package/docs/ARCHITECTURE.md +49 -19
- package/docs/CADRE.md +10 -0
- package/docs/INTERFACE.md +8 -3
- package/package.json +2 -2
- package/scripts/activites.mjs +150 -77
- package/scripts/aiguillage.mjs +33 -11
- package/scripts/avancement.mjs +27 -10
- package/scripts/bilan.mjs +101 -25
- package/scripts/cadre.mjs +5 -2
- package/scripts/circuit.mjs +153 -57
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +54 -19
- package/scripts/dependances-internes.mjs +9 -3
- package/scripts/dernier-vert.mjs +54 -19
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +24 -8
- package/scripts/droits.mjs +40 -15
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +141 -48
- package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
- package/scripts/faits-du-circuit.mjs +1 -1
- package/scripts/flux-des-paquets.mjs +21 -7
- package/scripts/gardes-du-cadre.mjs +9 -3
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +84 -29
- package/scripts/integration/integrer.mjs +70 -24
- package/scripts/integration/rejeu.mjs +26 -9
- package/scripts/jointure.d.ts +6 -1
- package/scripts/langages/cargo/commandes.mjs +97 -18
- package/scripts/langages/cargo/composants.mjs +24 -8
- package/scripts/langages/cargo/index.mjs +4 -0
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +3 -1
- package/scripts/langages/python/index.mjs +4 -0
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +10 -3
- package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
- package/scripts/langages/typescript/tests.mjs +24 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
- package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
- package/scripts/langages/typescript/verdict.mjs +3 -1
- package/scripts/langages/typescript/verifier.mjs +28 -10
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +9 -3
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
- package/scripts/nuit.sh +15 -0
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.mjs +18 -7
- package/scripts/paquet-npm.mjs +15 -5
- package/scripts/paquets.mjs +12 -4
- package/scripts/passe-de-la-machine.mjs +7 -2
- package/scripts/places-de-la-machine.mjs +66 -12
- package/scripts/preparation.mjs +15 -5
- package/scripts/registre.mjs +6 -2
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +105 -37
- package/scripts/seances.mjs +22 -4
- package/scripts/services-du-noyau.mjs +1 -0
- package/scripts/sous-commandes.mjs +3 -1
- package/scripts/style-a-l-ecriture.mjs +48 -17
- package/scripts/tableau.mjs +34 -9
- package/scripts/taches-du-graphe.mjs +33 -13
- package/scripts/ticket-du-circuit.mjs +10 -0
- package/scripts/transitions.mjs +141 -24
- package/scripts/verrou-de-fichier.mjs +6 -2
- package/scripts/verrou-de-machine.mjs +123 -39
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +7 -1
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- package/skills/relecteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +12 -6
package/scripts/engendres.mjs
CHANGED
|
@@ -54,7 +54,9 @@ const motifs = v => Array.isArray(v) && v.every(m => typeof m === 'string' && m
|
|
|
54
54
|
*/
|
|
55
55
|
export function lireEngendres(pkg) {
|
|
56
56
|
const e = pkg?.grillhouse?.engendres;
|
|
57
|
-
if (e === undefined || e === null)
|
|
57
|
+
if (e === undefined || e === null) {
|
|
58
|
+
return { engendres: [], fautes: [] };
|
|
59
|
+
}
|
|
58
60
|
if (typeof e !== 'object' || Array.isArray(e)) {
|
|
59
61
|
return {
|
|
60
62
|
engendres: [],
|
|
@@ -112,9 +114,13 @@ export function lireEngendres(pkg) {
|
|
|
112
114
|
*/
|
|
113
115
|
export function engendresDe(dir) {
|
|
114
116
|
const f = path.join(arbrePrincipal(dir), 'package.json');
|
|
115
|
-
if (!existsSync(f))
|
|
117
|
+
if (!existsSync(f)) {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
116
120
|
const { engendres, fautes } = lireEngendres(JSON.parse(readFileSync(f, 'utf8')));
|
|
117
|
-
if (fautes.length)
|
|
121
|
+
if (fautes.length) {
|
|
122
|
+
throw new Error(fautes.join('\n'));
|
|
123
|
+
}
|
|
118
124
|
return engendres;
|
|
119
125
|
}
|
|
120
126
|
|
|
@@ -143,7 +149,9 @@ export function regenerer({ refs, lancer, dansCopie, ecrire = s => process.stdou
|
|
|
143
149
|
return r.status === 0 ? r.stdout.split('\0').filter(Boolean) : null;
|
|
144
150
|
};
|
|
145
151
|
const avant = etat();
|
|
146
|
-
if (avant === null)
|
|
152
|
+
if (avant === null) {
|
|
153
|
+
return "L'état de l'arbre ne se lit pas.";
|
|
154
|
+
}
|
|
147
155
|
for (const r of refs) {
|
|
148
156
|
const x = lancer(r.commande);
|
|
149
157
|
const sortie = `${x.stdout ?? ''}${x.stderr ?? ''}`;
|
|
@@ -156,7 +164,9 @@ export function regenerer({ refs, lancer, dansCopie, ecrire = s => process.stdou
|
|
|
156
164
|
ecrire(sortie);
|
|
157
165
|
}
|
|
158
166
|
const apres = etat();
|
|
159
|
-
if (apres === null)
|
|
167
|
+
if (apres === null) {
|
|
168
|
+
return "L'état de l'arbre ne se lit pas.";
|
|
169
|
+
}
|
|
160
170
|
const deja = new Set(avant);
|
|
161
171
|
const ecrits = apres.filter(l => !deja.has(l)).map(l => l.slice(3));
|
|
162
172
|
const horsDeclaration = ecrits.filter(f => !refs.some(r => couvertPar(r.fichiers, f)));
|
|
@@ -65,8 +65,9 @@
|
|
|
65
65
|
// (`VARIABLES_DE_CHEMIN`) enters only when its path is in sight inside the envelope, tested there
|
|
66
66
|
// before the command runs. The session has its own process space: it reads the environment of
|
|
67
67
|
// no process of the machine.
|
|
68
|
-
// - A declared path that is a symbolic link
|
|
69
|
-
// (`avecLiens`)
|
|
68
|
+
// - A declared path that is a symbolic link, or that holds one among its components, comes back as
|
|
69
|
+
// that link, and its target with it (`avecLiens`); a store, a read or a written output is mounted
|
|
70
|
+
// at its real path, never at a link, by that same mechanism.
|
|
70
71
|
// - A worktree of the repository under an emptied directory (the home, `/tmp`) comes back
|
|
71
72
|
// read-only, `.git` included; the copy's packages of the plan and the tickets base are then
|
|
72
73
|
// written as above.
|
|
@@ -353,26 +354,56 @@ export function montagesDeLaSeance({
|
|
|
353
354
|
// an emptied directory and under no other declared path comes back with the link's rights, so a
|
|
354
355
|
// launcher finds its package beside its real path. A target the root shows needs no mount.
|
|
355
356
|
// `lien(path)` gives the text of the link at <path>, or null when <path> is not a link.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
// A declared path whose chain breaks (a target that does not exist, a link broken along the way, a
|
|
358
|
+
// loop of links) is not mounted, and nothing is raised. A component of the path that is a link is
|
|
359
|
+
// followed as well as the path itself, and the real path is mounted where the path was, never at a
|
|
360
|
+
// link: bwrap cannot mount over one. Each link of the chain that an emptied directory hides, and
|
|
361
|
+
// no other declared path holds, is made again; the real path is mounted when it lies in an emptied
|
|
362
|
+
// directory, is written, or is marked `monter` (a store, a read, a written output). `contexte`
|
|
363
|
+
// lists mounts beyond <montages> that also hold a link; `existe(path)` tells a real path that is
|
|
364
|
+
// there. The steps keep every other property of the mount they come from.
|
|
365
|
+
function avecLiens(montages, lien, existe = () => true, contexte = []) {
|
|
366
|
+
const videes = [...montages, ...contexte].filter(m => m.vide).map(m => m.chemin);
|
|
367
|
+
const declares = [...montages, ...contexte].filter(m => !m.vide && !m.lien).map(m => m.chemin);
|
|
368
|
+
const decouper = p => p.split('/').filter(Boolean);
|
|
359
369
|
return montages.flatMap(m => {
|
|
360
|
-
if (m.vide || m.lien || (m.source ?? m.chemin) !== m.chemin)
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
let
|
|
365
|
-
|
|
366
|
-
while (
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
if (m.vide || m.lien || (m.source ?? m.chemin) !== m.chemin) {
|
|
371
|
+
return [m];
|
|
372
|
+
}
|
|
373
|
+
const chaine = [];
|
|
374
|
+
let courant = '/';
|
|
375
|
+
let restants = decouper(m.chemin);
|
|
376
|
+
while (restants.length > 0) {
|
|
377
|
+
const [nom, ...reste] = restants;
|
|
378
|
+
const suivant = path.join(courant, nom);
|
|
379
|
+
const texte = lien(suivant);
|
|
380
|
+
if (texte === null) {
|
|
381
|
+
courant = suivant;
|
|
382
|
+
restants = reste;
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (chaine.length >= 40) {
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
chaine.push({ chemin: suivant, lien: texte });
|
|
389
|
+
restants = [...decouper(path.resolve(courant, texte)), ...reste];
|
|
390
|
+
courant = '/';
|
|
391
|
+
}
|
|
392
|
+
if (chaine.length === 0) {
|
|
393
|
+
return [m];
|
|
374
394
|
}
|
|
375
|
-
|
|
395
|
+
if (!existe(courant)) {
|
|
396
|
+
return [];
|
|
397
|
+
}
|
|
398
|
+
const liens = chaine
|
|
399
|
+
.filter(
|
|
400
|
+
({ chemin }) =>
|
|
401
|
+
videes.some(v => inside(chemin, v)) &&
|
|
402
|
+
!declares.some(d => d !== m.chemin && d !== chemin && inside(chemin, d))
|
|
403
|
+
)
|
|
404
|
+
.map(({ chemin, lien: texte }) => ({ chemin, lien: texte }));
|
|
405
|
+
const cachee = videes.some(v => inside(courant, v));
|
|
406
|
+
return cachee || m.ecriture || m.monter ? [...liens, { ...m, chemin: courant }] : liens;
|
|
376
407
|
});
|
|
377
408
|
}
|
|
378
409
|
|
|
@@ -465,7 +496,9 @@ const inside = (child, parent) => {
|
|
|
465
496
|
// in the copy.
|
|
466
497
|
export function jugerComposant({ depot, composant, paquets = [] }, fs) {
|
|
467
498
|
const propre = path.join(depot, composant);
|
|
468
|
-
if (fs.existe(propre))
|
|
499
|
+
if (fs.existe(propre)) {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
469
502
|
const nomme =
|
|
470
503
|
paquets.find(p => p.pkg?.name === composant) ??
|
|
471
504
|
paquets.find(p => path.basename(p.dossier) === composant);
|
|
@@ -492,8 +525,8 @@ export function jugerComposant({ depot, composant, paquets = [] }, fs) {
|
|
|
492
525
|
// exist is not mounted. `sorties` lists, from the root of the copy,
|
|
493
526
|
// where a run of the language's tools writes (`sortiesDuLangage`): `ecrites` in writing, `propres`
|
|
494
527
|
// an empty directory proper to the session, there and in each package of the material the role
|
|
495
|
-
// does not write; one that does not exist,
|
|
496
|
-
// mounted. `fs` gives `existe(path)`, and `lien(path)`, the text of a link or null, so the plan is
|
|
528
|
+
// does not write; one that does not exist is not mounted, and one that a symbolic link carries out
|
|
529
|
+
// of the copy is mounted at its real path as a store, whatever the plan writes. `fs` gives `existe(path)`, and `lien(path)`, the text of a link or null, so the plan is
|
|
497
530
|
// testable without disk.
|
|
498
531
|
/**
|
|
499
532
|
* @param {{
|
|
@@ -539,7 +572,9 @@ export function plan(
|
|
|
539
572
|
}
|
|
540
573
|
for (const p of paquets) {
|
|
541
574
|
const refus = jugerComposant({ depot: copie, composant: p, paquets: paquetsDeLaCopie }, fs);
|
|
542
|
-
if (refus)
|
|
575
|
+
if (refus) {
|
|
576
|
+
return { refus };
|
|
577
|
+
}
|
|
543
578
|
}
|
|
544
579
|
const ecrits = ecritsDuPlan(paquets, paquetsDeLaCopie);
|
|
545
580
|
const toute = ecrits.includes('.');
|
|
@@ -559,14 +594,47 @@ export function plan(
|
|
|
559
594
|
'/proc',
|
|
560
595
|
];
|
|
561
596
|
for (const { chemin, source = chemin, ecriture, vide, lien } of montages) {
|
|
562
|
-
if (vide)
|
|
563
|
-
|
|
564
|
-
else if (
|
|
597
|
+
if (vide) {
|
|
598
|
+
args.push('--tmpfs', chemin);
|
|
599
|
+
} else if (lien !== undefined) {
|
|
600
|
+
args.push('--symlink', lien, chemin);
|
|
601
|
+
} else if (fs.existe(source)) {
|
|
602
|
+
args.push(ecriture ? '--bind' : '--ro-bind', source, chemin);
|
|
603
|
+
}
|
|
565
604
|
}
|
|
566
|
-
// A
|
|
605
|
+
// A declared path (read, store, written output) is mounted at its real path, never at a link,
|
|
606
|
+
// by the one mechanism the session's mounts use (`avecLiens`): the links of its chain that an
|
|
607
|
+
// emptied directory hides, and no declared path holds, are made again before the emptied
|
|
608
|
+
// directories are sealed. A written output of the copy is mounted as a store when a link carries
|
|
609
|
+
// it out of the copy, whether the plan writes one package or the whole copy.
|
|
610
|
+
const lienDe = fs.lien ?? (() => null);
|
|
567
611
|
const videes = montages.filter(m => m.vide).map(m => m.chemin);
|
|
612
|
+
const declarees = [
|
|
613
|
+
...lectures.map(chemin => ({ chemin, ecriture: false, monter: true, genre: 'lu' })),
|
|
614
|
+
...magasins.map(chemin => ({ chemin, ecriture: true, monter: true, genre: 'ecrit' })),
|
|
615
|
+
...sorties.ecrites.map(s => ({
|
|
616
|
+
chemin: path.join(copie, s),
|
|
617
|
+
ecriture: true,
|
|
618
|
+
monter: true,
|
|
619
|
+
genre: 'sortie',
|
|
620
|
+
})),
|
|
621
|
+
];
|
|
622
|
+
const suivis = avecLiens(declarees, lienDe, fs.existe, montages);
|
|
623
|
+
const refaits = suivis.filter(m => m.lien !== undefined);
|
|
624
|
+
const reels = genre =>
|
|
625
|
+
suivis.flatMap(m =>
|
|
626
|
+
m.lien === undefined && m.genre === genre && fs.existe(m.chemin) ? [m.chemin] : []
|
|
627
|
+
);
|
|
628
|
+
const reelsLus = reels('lu');
|
|
629
|
+
const reelsEcrits = [...reels('ecrit'), ...reels('sortie').filter(c => !inside(c, copie))];
|
|
630
|
+
for (const { chemin, lien } of refaits) {
|
|
631
|
+
args.push('--symlink', lien, chemin);
|
|
632
|
+
}
|
|
633
|
+
// A worktree that an emptied directory covers comes back read-only, before the copy is written.
|
|
568
634
|
for (const t of trees) {
|
|
569
|
-
if (videes.some(v => inside(t, v)) && fs.existe(t))
|
|
635
|
+
if (videes.some(v => inside(t, v)) && fs.existe(t)) {
|
|
636
|
+
args.push('--ro-bind', t, t);
|
|
637
|
+
}
|
|
570
638
|
}
|
|
571
639
|
// The copy is mounted after them: an emptied /tmp does not hide it. It is read-only, and the
|
|
572
640
|
// packages of the plan come back in writing below, as a sandbox of Bazel opens only what the
|
|
@@ -575,24 +643,34 @@ export function plan(
|
|
|
575
643
|
// root writes the whole copy. Its .git stays read-only.
|
|
576
644
|
args.push(toute ? '--bind' : '--ro-bind', copie, copie);
|
|
577
645
|
if (!toute) {
|
|
578
|
-
for (const s of sortiesDe(copie, sorties.propres, fs.lien))
|
|
579
|
-
if (fs.existe(s))
|
|
580
|
-
|
|
581
|
-
|
|
646
|
+
for (const s of sortiesDe(copie, sorties.propres, fs.lien)) {
|
|
647
|
+
if (fs.existe(s)) {
|
|
648
|
+
args.push('--tmpfs', s);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
for (const s of sortiesDe(copie, sorties.ecrites, fs.lien)) {
|
|
652
|
+
if (fs.existe(s)) {
|
|
653
|
+
args.push('--bind', s, s);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
582
656
|
}
|
|
583
657
|
const gitDeLaCopie = path.join(copie, '.git');
|
|
584
|
-
if (fs.existe(gitDeLaCopie))
|
|
658
|
+
if (fs.existe(gitDeLaCopie)) {
|
|
659
|
+
args.push('--ro-bind', gitDeLaCopie, gitDeLaCopie);
|
|
660
|
+
}
|
|
585
661
|
// What the language's tools read (cargo's home) comes back read-only; then the stores inside it
|
|
586
662
|
// or beside it (Turborepo's cache, cargo's registry and locks) are written by the agent's runs,
|
|
587
663
|
// as by every copy's.
|
|
588
|
-
for (const l of
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
664
|
+
for (const l of reelsLus) {
|
|
665
|
+
args.push('--ro-bind', l, l);
|
|
666
|
+
}
|
|
667
|
+
for (const m of reelsEcrits) {
|
|
668
|
+
args.push('--bind', m, m);
|
|
592
669
|
}
|
|
593
|
-
for (const m of magasins) if (fs.existe(m)) args.push('--bind', m, m);
|
|
594
670
|
const tickets = trees.length > 0 ? path.join(trees[0], '.beads') : null;
|
|
595
|
-
if (tickets && fs.existe(tickets))
|
|
671
|
+
if (tickets && fs.existe(tickets)) {
|
|
672
|
+
args.push('--bind', tickets, tickets);
|
|
673
|
+
}
|
|
596
674
|
if (!toute) {
|
|
597
675
|
for (const e of ecrits) {
|
|
598
676
|
const d = path.join(copie, e);
|
|
@@ -601,19 +679,28 @@ export function plan(
|
|
|
601
679
|
// The lock files of the versions, which a run of the testwriter's tests brings in line with
|
|
602
680
|
// the dependencies of his tests, are written by him alone.
|
|
603
681
|
for (const v of verrous.map(v => path.join(copie, v))) {
|
|
604
|
-
if (role === ROLE_MATIERE && fs.existe(v))
|
|
682
|
+
if (role === ROLE_MATIERE && fs.existe(v)) {
|
|
683
|
+
args.push('--bind', v, v);
|
|
684
|
+
}
|
|
605
685
|
}
|
|
606
686
|
}
|
|
607
687
|
for (const m of matieres.map(m => path.join(copie, m))) {
|
|
608
688
|
args.push(role === ROLE_MATIERE ? '--bind' : '--ro-bind', m, m);
|
|
609
689
|
// What a run of its tests writes goes, for a role that does not write it, to an empty
|
|
610
690
|
// directory proper to the session, as Bazel writes a test's logs out of its source.
|
|
611
|
-
if (role === ROLE_MATIERE)
|
|
612
|
-
|
|
613
|
-
|
|
691
|
+
if (role === ROLE_MATIERE) {
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
for (const s of sortiesDe(m, sorties.propres, fs.lien)) {
|
|
695
|
+
if (fs.existe(s)) {
|
|
696
|
+
args.push('--tmpfs', s);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
614
699
|
}
|
|
615
700
|
// The emptied directories close behind the mounts: nothing new is written there.
|
|
616
|
-
for (const { chemin } of montages.filter(m => m.scelle))
|
|
701
|
+
for (const { chemin } of montages.filter(m => m.scelle)) {
|
|
702
|
+
args.push('--remount-ro', chemin);
|
|
703
|
+
}
|
|
617
704
|
args.push('--chdir', copie);
|
|
618
705
|
return { args };
|
|
619
706
|
}
|
|
@@ -636,7 +723,9 @@ function cacheDeLaVersionPubliee(copie) {
|
|
|
636
723
|
} catch {
|
|
637
724
|
return null;
|
|
638
725
|
}
|
|
639
|
-
if (version === null)
|
|
726
|
+
if (version === null) {
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
640
729
|
try {
|
|
641
730
|
installer(version);
|
|
642
731
|
} catch (e) {
|
|
@@ -704,7 +793,9 @@ function envelopper(argv) {
|
|
|
704
793
|
// killed (../mesure/base-de-passe.mjs).
|
|
705
794
|
const temporaire = ouvrirBase('enveloppe');
|
|
706
795
|
const etatJetable = path.join(temporaire.dossier, 'claude.json');
|
|
707
|
-
if (existsSync(`${claude}.json`))
|
|
796
|
+
if (existsSync(`${claude}.json`)) {
|
|
797
|
+
copyFileSync(`${claude}.json`, etatJetable);
|
|
798
|
+
}
|
|
708
799
|
const montages = avecLiens(
|
|
709
800
|
montagesDeLaSeance({
|
|
710
801
|
cacheNpm,
|
|
@@ -787,7 +878,9 @@ function envelopper(argv) {
|
|
|
787
878
|
donnees,
|
|
788
879
|
});
|
|
789
880
|
const r = spawnSync(lancement.cmd, lancement.args, { stdio: 'inherit', env: lancement.env });
|
|
790
|
-
if (r.error)
|
|
881
|
+
if (r.error) {
|
|
882
|
+
process.stderr.write(`⛔ ENVELOPPE IMPOSSIBLE — ${r.error.message}\n`);
|
|
883
|
+
}
|
|
791
884
|
code = r.error ? CODE_REFUS : (r.status ?? 1);
|
|
792
885
|
}
|
|
793
886
|
temporaire.fermer();
|
|
@@ -122,8 +122,12 @@ function appliquer(copie, lot, cles = null, autres = []) {
|
|
|
122
122
|
lot
|
|
123
123
|
);
|
|
124
124
|
const conflits = enConflit(copie);
|
|
125
|
-
if (r.status !== 0 && !conflits.length)
|
|
126
|
-
|
|
125
|
+
if (r.status !== 0 && !conflits.length) {
|
|
126
|
+
return { conflits: null };
|
|
127
|
+
}
|
|
128
|
+
if (conflits.length || !touches.length || !cles) {
|
|
129
|
+
return { conflits };
|
|
130
|
+
}
|
|
127
131
|
const refus = regenerer({
|
|
128
132
|
refs: touches.map(e => ({ ...e, cadre: false })),
|
|
129
133
|
lancer: commande =>
|
|
@@ -149,13 +153,17 @@ export function reporter(copie, { base, pointe }) {
|
|
|
149
153
|
return { ok: false, message: `⛔ Le lot de ${base} à ${pointe} ne se lit pas : ${texte(d)}` };
|
|
150
154
|
}
|
|
151
155
|
const cles = lesCles(copie);
|
|
152
|
-
if (cles.refus !== undefined)
|
|
156
|
+
if (cles.refus !== undefined) {
|
|
157
|
+
return { ok: false, message: cles.refus };
|
|
158
|
+
}
|
|
153
159
|
const a = appliquer(copie, d.stdout, cles);
|
|
154
160
|
if (a.conflits === null) {
|
|
155
161
|
return { ok: false, message: `⛔ Le lot ne s'applique pas à la copie ${copie}.` };
|
|
156
162
|
}
|
|
157
163
|
const r = git(copie, ['reset', '-q']);
|
|
158
|
-
if (a.refus)
|
|
164
|
+
if (a.refus) {
|
|
165
|
+
return { ok: false, message: `⛔ ${a.refus}` };
|
|
166
|
+
}
|
|
159
167
|
return r.status === 0 ? { ok: true, message: '' } : { ok: false, message: texte(r) };
|
|
160
168
|
}
|
|
161
169
|
|
|
@@ -190,7 +198,9 @@ export function avancer(copie, cible) {
|
|
|
190
198
|
};
|
|
191
199
|
}
|
|
192
200
|
const cles = lesCles(copie);
|
|
193
|
-
if (cles.refus !== undefined)
|
|
201
|
+
if (cles.refus !== undefined) {
|
|
202
|
+
return { ok: false, message: cles.refus };
|
|
203
|
+
}
|
|
194
204
|
const tete = String(git(copie, ['rev-parse', 'HEAD']).stdout).trim();
|
|
195
205
|
const vise = git(copie, ['rev-parse', '--verify', `${cible}^{commit}`]);
|
|
196
206
|
if (vise.status !== 0) {
|
|
@@ -286,7 +296,9 @@ export function preparer(copie, cible, { env = process.env, sortie = 2 } = {}) {
|
|
|
286
296
|
stdio,
|
|
287
297
|
maxBuffer: 64 * 1024 * 1024,
|
|
288
298
|
});
|
|
289
|
-
if (r.status === 0 && r.stderr?.length)
|
|
299
|
+
if (r.status === 0 && r.stderr?.length) {
|
|
300
|
+
writeSync(sortie, r.stderr);
|
|
301
|
+
}
|
|
290
302
|
return r;
|
|
291
303
|
};
|
|
292
304
|
const echec = (r, quoi) => ({
|
|
@@ -296,18 +308,26 @@ export function preparer(copie, cible, { env = process.env, sortie = 2 } = {}) {
|
|
|
296
308
|
});
|
|
297
309
|
if (cible !== null) {
|
|
298
310
|
const g = bash(['garde', copie], ['ignore', sortie, 'pipe']);
|
|
299
|
-
if (g.status !== 0)
|
|
311
|
+
if (g.status !== 0) {
|
|
312
|
+
return echec(g, 'La garde des sous-modules');
|
|
313
|
+
}
|
|
300
314
|
const a = avancer(copie, cible);
|
|
301
|
-
if (!a.ok)
|
|
315
|
+
if (!a.ok) {
|
|
316
|
+
return { ...a, partages: '' };
|
|
317
|
+
}
|
|
302
318
|
}
|
|
303
319
|
const p = bash(['pose', copie], ['ignore', 'pipe', 'pipe']);
|
|
304
|
-
if (p.status !== 0)
|
|
320
|
+
if (p.status !== 0) {
|
|
321
|
+
return echec(p, 'La pose des sous-modules');
|
|
322
|
+
}
|
|
305
323
|
// As `$(…)` reads it: the final newlines dropped.
|
|
306
324
|
const partages = String(p.stdout).replace(/\n+$/, '');
|
|
307
325
|
const monter = (...commande) =>
|
|
308
326
|
bash(['monter', copie, '--partages', partages, ...commande], ['ignore', sortie, 'pipe']);
|
|
309
327
|
const m = monter('true');
|
|
310
|
-
if (m.status !== 0)
|
|
328
|
+
if (m.status !== 0) {
|
|
329
|
+
return echec(m, 'Le montage des sous-modules partagés');
|
|
330
|
+
}
|
|
311
331
|
if (existsSync(path.join(copie, 'package.json'))) {
|
|
312
332
|
// As `[ lock -nt installed ]`: the lock newer than the installation, or no installation.
|
|
313
333
|
const verrou = path.join(copie, 'package-lock.json');
|
|
@@ -327,7 +347,9 @@ export function preparer(copie, cible, { env = process.env, sortie = 2 } = {}) {
|
|
|
327
347
|
'--no-fund',
|
|
328
348
|
'--silent'
|
|
329
349
|
);
|
|
330
|
-
if (i.status !== 0)
|
|
350
|
+
if (i.status !== 0) {
|
|
351
|
+
return echec(i, "L'installation");
|
|
352
|
+
}
|
|
331
353
|
}
|
|
332
354
|
}
|
|
333
355
|
return { ok: true, message: '', partages };
|
|
@@ -347,7 +369,9 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
347
369
|
};
|
|
348
370
|
// `preparer` prints the list its pose fixes on stdout, its messages on stderr.
|
|
349
371
|
if (geste === 'preparer') {
|
|
350
|
-
if (r.message)
|
|
372
|
+
if (r.message) {
|
|
373
|
+
process.stderr.write(`${r.message}\n`);
|
|
374
|
+
}
|
|
351
375
|
process.stdout.write(r.partages ?? '');
|
|
352
376
|
} else if (r.message) {
|
|
353
377
|
process.stdout.write(`${r.message}\n`);
|
|
@@ -43,7 +43,9 @@ const CLE = 'grillhouse.flux';
|
|
|
43
43
|
*/
|
|
44
44
|
export function lireFlux(pkg) {
|
|
45
45
|
const f = pkg?.grillhouse?.flux;
|
|
46
|
-
if (f === undefined || f === null)
|
|
46
|
+
if (f === undefined || f === null) {
|
|
47
|
+
return { flux: [], fautes: [] };
|
|
48
|
+
}
|
|
47
49
|
if (typeof f !== 'object' || Array.isArray(f)) {
|
|
48
50
|
return {
|
|
49
51
|
flux: [],
|
|
@@ -86,16 +88,22 @@ const lireJson = f => {
|
|
|
86
88
|
*/
|
|
87
89
|
export function fluxDe(dir) {
|
|
88
90
|
const f = path.join(arbrePrincipal(dir), 'package.json');
|
|
89
|
-
if (!existsSync(f))
|
|
91
|
+
if (!existsSync(f)) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
90
94
|
const { flux, fautes } = lireFlux(lireJson(f));
|
|
91
|
-
if (fautes.length)
|
|
95
|
+
if (fautes.length) {
|
|
96
|
+
throw new Error(fautes.join('\n'));
|
|
97
|
+
}
|
|
92
98
|
return flux;
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
// The workflow files of <racine>: the .yml and .yaml under .github/workflows, from the root.
|
|
96
102
|
function fichiersDeFlux(racine) {
|
|
97
103
|
const d = path.join(racine, DOSSIER);
|
|
98
|
-
if (!existsSync(d))
|
|
104
|
+
if (!existsSync(d)) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
99
107
|
return readdirSync(d, { withFileTypes: true })
|
|
100
108
|
.filter(e => e.isFile() && /\.ya?ml$/.test(e.name))
|
|
101
109
|
.map(e => `${DOSSIER}/${e.name}`)
|
|
@@ -111,7 +119,9 @@ export function constats(racine) {
|
|
|
111
119
|
const pkg = lireJson(path.join(racine, 'package.json'));
|
|
112
120
|
const { flux, fautes } = lireFlux(pkg);
|
|
113
121
|
const out = fautes.map(message => ({ fichier: 'package.json', message }));
|
|
114
|
-
if (fautes.length)
|
|
122
|
+
if (fautes.length) {
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
115
125
|
const connus = new Set(paquets(racine).map(p => p.pkg.name));
|
|
116
126
|
const declares = new Set(flux.map(f => f.fichier));
|
|
117
127
|
for (const f of fichiersDeFlux(racine)) {
|
|
@@ -159,14 +169,18 @@ export function consigneDesFlux(racine, fichiers) {
|
|
|
159
169
|
const lignes = [];
|
|
160
170
|
for (const { fichier, paquets: noms } of flux) {
|
|
161
171
|
const raisons = [];
|
|
162
|
-
if (fichiers.includes(fichier))
|
|
172
|
+
if (fichiers.includes(fichier)) {
|
|
173
|
+
raisons.push('le lot change le flux');
|
|
174
|
+
}
|
|
163
175
|
for (const n of noms) {
|
|
164
176
|
const d = dossiers.get(n);
|
|
165
177
|
if (d !== undefined && fichiers.some(f => sous(f, d))) {
|
|
166
178
|
raisons.push(`le lot touche le paquet ${n}`);
|
|
167
179
|
}
|
|
168
180
|
}
|
|
169
|
-
if (raisons.length)
|
|
181
|
+
if (raisons.length) {
|
|
182
|
+
lignes.push(`- lis ${fichier} : ${raisons.join(' ; ')}`);
|
|
183
|
+
}
|
|
170
184
|
}
|
|
171
185
|
return lignes.length ? lignes.join('\n') : 'aucun : le lot ne touche aucun flux de la CI.';
|
|
172
186
|
}
|
|
@@ -59,7 +59,9 @@ export function jouerLesGardes({
|
|
|
59
59
|
for (const garde of gardes) {
|
|
60
60
|
const avant = env[RESULTATS] ? nombre() : 0;
|
|
61
61
|
const r = spawnSync(process.execPath, garde, { cwd: racine, env, stdio: 'inherit' });
|
|
62
|
-
if (r.status === 0)
|
|
62
|
+
if (r.status === 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
63
65
|
const code = `code ${r.status ?? r.signal}`;
|
|
64
66
|
rouges.push(`${libelle(garde)} (${code})`);
|
|
65
67
|
if (env[RESULTATS] && nombre() === avant) {
|
|
@@ -71,8 +73,12 @@ export function jouerLesGardes({
|
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
|
-
if (rouges.length === 0)
|
|
75
|
-
|
|
76
|
+
if (rouges.length === 0) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
for (const r of rouges) {
|
|
80
|
+
dire(`⛔ garde rouge : ${r}`);
|
|
81
|
+
}
|
|
76
82
|
return 1;
|
|
77
83
|
}
|
|
78
84
|
|
package/scripts/init.mjs
CHANGED
|
@@ -55,8 +55,11 @@ function copierLeGabarit(projet) {
|
|
|
55
55
|
const renommer = dossier => {
|
|
56
56
|
for (const e of readdirSync(dossier, { withFileTypes: true })) {
|
|
57
57
|
const f = path.join(dossier, e.name);
|
|
58
|
-
if (e.isDirectory())
|
|
59
|
-
|
|
58
|
+
if (e.isDirectory()) {
|
|
59
|
+
renommer(f);
|
|
60
|
+
} else if (Object.hasOwn(RENOMMES, e.name)) {
|
|
61
|
+
renameSync(f, path.join(dossier, RENOMMES[e.name]));
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
65
|
renommer(projet);
|
|
@@ -105,11 +108,15 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
105
108
|
} else {
|
|
106
109
|
try {
|
|
107
110
|
const lignes = initialiser(dossier, prefixe);
|
|
108
|
-
for (const l of lignes)
|
|
111
|
+
for (const l of lignes) {
|
|
112
|
+
process.stderr.write(`${l}\n`);
|
|
113
|
+
}
|
|
109
114
|
process.stdout.write(
|
|
110
115
|
`Projet créé dans ${dossier}. Ouvre Claude Code dans ce dossier : la première séance propose le grill d'initialisation.\n`
|
|
111
116
|
);
|
|
112
|
-
if (lignes.length > 0)
|
|
117
|
+
if (lignes.length > 0) {
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
}
|
|
113
120
|
} catch (e) {
|
|
114
121
|
process.stderr.write(`⛔ ${e.message}\n`);
|
|
115
122
|
process.exitCode = 1;
|