@roomi-fields/grillhouse 0.25.5 → 0.27.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/agents/testwriter.md +1 -1
- package/bin/grillhouse.mjs +20 -3
- package/cadre/templates/cargo/package.json +3 -0
- package/cadre/templates/projet/.gitattributes +1 -0
- package/cadre/templates/projet/CLAUDE.md +13 -0
- package/cadre/templates/projet/docs/ARCHITECTURE.md +15 -0
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/python/package.json +18 -0
- package/charte.md +32 -1
- package/docs/ARCHITECTURE.md +146 -40
- package/docs/CADRE.md +7 -6
- package/docs/INTERFACE.md +108 -32
- package/hooks/register.tsx +57 -16
- package/package.json +9 -3
- package/scripts/circuit.mjs +165 -27
- package/scripts/commande-du-langage.mjs +2 -2
- package/scripts/commandes-composees.mjs +156 -0
- package/scripts/composition-des-langages.mjs +306 -0
- package/scripts/conformite.mjs +1 -3
- package/scripts/copies-finies.mjs +167 -28
- package/scripts/crochets.mjs +9 -3
- package/scripts/dernier-vert.mjs +15 -2
- package/scripts/engendres.mjs +170 -0
- package/scripts/enveloppe/enveloppe.mjs +59 -17
- package/scripts/enveloppe/lancer.sh +15 -22
- package/scripts/enveloppe/travail-de-la-copie.mjs +262 -0
- package/scripts/etapes.mjs +1 -1
- package/scripts/fusion-du-changelog.mjs +120 -0
- package/scripts/gardes-du-cadre.mjs +7 -4
- package/scripts/grillhouse-maj.mjs +171 -99
- package/scripts/index-interfaces.mjs +78 -0
- package/scripts/init.mjs +5 -5
- package/scripts/integration/file.mjs +270 -117
- package/scripts/integration/integrer.mjs +50 -62
- package/scripts/jointure.d.ts +48 -14
- package/scripts/langages/cargo/binaires.json +2 -1
- package/scripts/langages/cargo/binaires.mjs +29 -6
- package/scripts/langages/cargo/clippy.mjs +12 -2
- package/scripts/langages/cargo/commandes.mjs +60 -7
- package/scripts/langages/cargo/composants.mjs +229 -8
- package/scripts/langages/cargo/exemples.mjs +1 -15
- package/scripts/langages/cargo/index-interfaces.mjs +20 -3
- package/scripts/langages/cargo/index.mjs +25 -17
- package/scripts/langages/cargo/mise-a-jour.mjs +2 -1
- package/scripts/langages/cargo/sccache.mjs +172 -0
- package/scripts/langages/cargo/verdict.mjs +50 -10
- package/scripts/langages/python/binaires.json +3 -0
- package/scripts/langages/python/binaires.mjs +59 -0
- package/scripts/langages/python/commandes.mjs +411 -0
- package/scripts/langages/python/composants.mjs +272 -0
- package/scripts/langages/python/exemples.mjs +260 -0
- package/scripts/langages/python/index-interfaces.mjs +77 -0
- package/scripts/langages/python/index.mjs +94 -0
- package/scripts/langages/python/lot.mjs +76 -0
- package/scripts/langages/python/mise-a-jour.mjs +54 -0
- package/scripts/langages/python/tailles-des-tests.mjs +102 -0
- package/scripts/langages/python/verdict.mjs +85 -0
- package/scripts/langages/typescript/exemples.mjs +1 -20
- package/scripts/langages/typescript/index-interfaces.mjs +10 -3
- package/scripts/langages/typescript/index.mjs +15 -17
- package/scripts/langages/typescript/regle-des-tests.mjs +37 -0
- package/scripts/langages-des-paquets.mjs +171 -0
- package/scripts/langages.mjs +60 -41
- package/scripts/migrations/0.27.0-langages-dans-l-architecture.mjs +182 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/nuit.sh +15 -1
- package/scripts/outils-cles.mjs +188 -0
- package/scripts/resultats.mjs +22 -6
- package/scripts/session-start.sh +34 -9
- package/scripts/sources.mjs +2 -1
- package/scripts/sous-commandes.mjs +21 -3
- package/scripts/tableau-des-composants.mjs +138 -0
- package/scripts/verrou-de-machine.mjs +14 -13
- package/scripts/verrous/verrou.mjs +53 -16
- package/skills/developpeur/SKILL.md +4 -0
- package/skills/explorateur/SKILL.md +3 -1
- package/skills/grill/SKILL.md +9 -1
- package/skills/pitmaster/SKILL.md +12 -3
- package/skills/pitmaster/references/consigne-agent.md +3 -3
- package/skills/redacteur/references/documents-d-un-composant.md +12 -0
- package/skills/relecteur/SKILL.md +6 -2
- package/skills/testwriter/SKILL.md +29 -6
package/scripts/circuit.mjs
CHANGED
|
@@ -283,7 +283,10 @@
|
|
|
283
283
|
// the root, as the inputs of Turborepo), the test files that judge it, as `rustc --bless` ties a
|
|
284
284
|
// test to its expected outputs, `lit`, the files it reads that another reference writes, and the
|
|
285
285
|
// guards of the project that judge it, by the name their SARIF finding carries (its guard or its
|
|
286
|
-
// rule). The
|
|
286
|
+
// rule). The generated files it keeps committed, `grillhouse.engendres` (scripts/engendres.mjs,
|
|
287
|
+
// read from the main tree at the launch, a faulty key the stop « lancement »), follow as
|
|
288
|
+
// references written in full, which the integration regenerates instead of merging them. The
|
|
289
|
+
// frame's references follow in every project (`referencesDuCadre`): the files the
|
|
287
290
|
// frame generates, each judged by a guard of the frame, by the names its findings carry (the
|
|
288
291
|
// index of the interfaces, which reads the interfaces, the turbo.json of the packages, the API
|
|
289
292
|
// reports, which write the generated part of the interfaces), and the known debt of the guards;
|
|
@@ -388,7 +391,11 @@
|
|
|
388
391
|
// handover the circuit does not read, three RENDU, then the stop); the rest of the lot it does not read again (its skill, « La relecture
|
|
389
392
|
// bornée »). A blocking finding without a valid agent, or one that puts its criterion in
|
|
390
393
|
// question (`critere_en_cause`), stops at « relecture-arret »; so does the third RENDU since the
|
|
391
|
-
// ticket's last ACCEPT
|
|
394
|
+
// ticket's last ACCEPTÉ, and a RENDU whose finding goes to the testwriter when the plan skips
|
|
395
|
+
// him (`sansTests`), at that verdict, as a CI fails fast on a step it cannot run
|
|
396
|
+
// (`arretDuTestwriterSaute`; OSC Bridge SH-13y.1: three RENDU « Agent : testwriter » on a
|
|
397
|
+
// package whose tests no command of the frame plays, the developpeur relaunched on an empty
|
|
398
|
+
// diff each time); its question, declare the tests of the package or settle the finding.
|
|
392
399
|
// - ACCEPTÉ: the integration, once the whole final pass has played on the lot accepted (its tree
|
|
393
400
|
// is `verifie`); else that pass first, once, its red going to the developpeur and the lot then
|
|
394
401
|
// to the reviewer again. The circuit builds the lot from the copy: the files the copy changes
|
|
@@ -399,7 +406,8 @@
|
|
|
399
406
|
// chore, docs, else feat), its body written once from the final state: the criteria of the plan,
|
|
400
407
|
// then each deviation the sheets of the developpeur and of the reviewer name (`ecarts`), once by
|
|
401
408
|
// its subject, from the last sheet that carries it, with the trailer Co-Authored-By; and the
|
|
402
|
-
// references that write files in full (`--references
|
|
409
|
+
// frame's references that write files in full (`--references`; the project's generated files,
|
|
410
|
+
// the integration reads itself), which the integration regenerates on
|
|
403
411
|
// main of the moment instead of applying their files from the lot. It runs
|
|
404
412
|
// scripts/integration/integrer.mjs from the main tree, its output added to the log: 0 is the
|
|
405
413
|
// commit on agent/<ticket> (which the circuit names from git), the copy removed, the branch in
|
|
@@ -412,6 +420,9 @@
|
|
|
412
420
|
// sorts the discoveries (below), then ends at « integre », exit 0 (the queue's last word at the
|
|
413
421
|
// ticket named with it, a CI it could not read); reopened (out of the queue, or a red CI), it stops at « integration », the queue's
|
|
414
422
|
// last word as its reason; still in the queue, it stops at « a-repasser », the queue's reason.
|
|
423
|
+
// The branch out of the queue and its ticket open, as `--reprendre` finds it after a red CI, the
|
|
424
|
+
// queue reads the CI of the ticket's commit on main again (`file.mjs --ci <ticket>`): a rerun
|
|
425
|
+
// green (`gh run rerun <id> --failed`) closes the ticket, as an entry does.
|
|
415
426
|
// - Then the tri of the discoveries (step 5.3, `trier`), as Chromium and Mozilla give each new
|
|
416
427
|
// report a verdict before it is filed: each discovery a sheet filed is kept with the circuit's
|
|
417
428
|
// results (`decouverte`: its id, its subject); without one, no session. Else one session of the
|
|
@@ -513,7 +524,8 @@
|
|
|
513
524
|
// ticket in one short comment, `Circuit · bilan : …`, compared with the bilan before it in the
|
|
514
525
|
// project.
|
|
515
526
|
// - Exit codes: 0 at « integre »; 2 a malformed call; a stop, by its name (ARRETS):
|
|
516
|
-
// 10 lancement (lancer.sh stopped before the session
|
|
527
|
+
// 10 lancement (lancer.sh stopped before the session, or the tools of the project,
|
|
528
|
+
// `grillhouse.outils`, refused at the launch or a resumption, before any session), 11 bloqué (a motionless transcript),
|
|
517
529
|
// 12 sans-fiche (twice no sheet that conforms), 13 preuve (the third proof fails), 14 controles
|
|
518
530
|
// (the third developpeur of the checks or of the final pass leaves a red check, a red of the
|
|
519
531
|
// final pass out of the plan or that no package of the plan holds, or reds to settle),
|
|
@@ -522,8 +534,8 @@
|
|
|
522
534
|
// second developpeur session that `--depuis developpeur` launched on the lot the integration
|
|
523
535
|
// refused and that changes nothing; or
|
|
524
536
|
// the developpeur's same sending to the testwriter twice in a row, on the same red output of the
|
|
525
|
-
// checks, no green checks between them), 16 relecture-arret (a finding without a valid agent, one
|
|
526
|
-
// RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
|
|
537
|
+
// checks, no green checks between them), 16 relecture-arret (a finding without a valid agent, one to the testwriter the plan skips,
|
|
538
|
+
// one on a criterion, the third RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
|
|
527
539
|
// ticket), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
|
|
528
540
|
// sending to the testwriter, or a developpeur's FAIT with criteria out of the plan), 20 besoin (a testwriter or developpeur whose sheet says BESOIN, a
|
|
529
541
|
// reviewer whose sheet carries a `question`, or a ticket labelled `arbitrage` whose arbitrage
|
|
@@ -557,6 +569,8 @@ import { pathToFileURL } from 'node:url';
|
|
|
557
569
|
import { stripVTControlCharacters } from 'node:util';
|
|
558
570
|
import { ecrireLeBilan } from './bilan.mjs';
|
|
559
571
|
import { DEPUIS_LE_VERT } from './dernier-vert.mjs';
|
|
572
|
+
import { avecLesOutils, outilsDe } from './outils-cles.mjs';
|
|
573
|
+
import { couvertPar, engendresDe } from './engendres.mjs';
|
|
560
574
|
import { commandesPermises, optionsDuRole } from './droits.mjs';
|
|
561
575
|
import {
|
|
562
576
|
ecrireLaListe,
|
|
@@ -585,6 +599,7 @@ import { FICHIER as DETTE } from './dette.mjs';
|
|
|
585
599
|
import {
|
|
586
600
|
A_ELAGUER,
|
|
587
601
|
bloquantsDeLaFiche,
|
|
602
|
+
cleDuConstat,
|
|
588
603
|
conformiteDuLot,
|
|
589
604
|
conformiteDuTri,
|
|
590
605
|
lireFiche,
|
|
@@ -599,7 +614,7 @@ import {
|
|
|
599
614
|
} from './resultats.mjs';
|
|
600
615
|
import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
|
|
601
616
|
import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
|
|
602
|
-
import {
|
|
617
|
+
import { refusArbitrage } from './integration/integrer.mjs';
|
|
603
618
|
import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
|
|
604
619
|
import { attendreUnPeu } from './verrou-de-fichier.mjs';
|
|
605
620
|
import { AttenteDeLaMachine, avecLaMachine } from './verrou-de-machine.mjs';
|
|
@@ -612,6 +627,7 @@ import { A_REPASSER } from './mesure/pression.mjs';
|
|
|
612
627
|
import { departDe, leMemeVivant, ouvrirBase, vivant } from './mesure/base-de-passe.mjs';
|
|
613
628
|
import { GREFFON } from './cadre.mjs';
|
|
614
629
|
import { executerEnDemon } from './demon.mjs';
|
|
630
|
+
import { retirerLesCopiesDuDepot } from './copies-finies.mjs';
|
|
615
631
|
|
|
616
632
|
// The time a session's transcripts may stand still before the circuit stops it.
|
|
617
633
|
export const IMMOBILE_MS = 20 * 60 * 1000;
|
|
@@ -1430,10 +1446,10 @@ export const auLancement = (contexte, constats) =>
|
|
|
1430
1446
|
});
|
|
1431
1447
|
|
|
1432
1448
|
// The findings <constats>, each finding of the developpeur that his sheet <fiche> answers (by its
|
|
1433
|
-
// title) with its answer `{ etat, raison, piece }`, as a thread
|
|
1434
|
-
// reply under its comment.
|
|
1449
|
+
// title, numbered or not: `cleDuConstat`) with its answer `{ etat, raison, piece }`, as a thread
|
|
1450
|
+
// of a review keeps the author's reply under its comment.
|
|
1435
1451
|
function avecLesReponses(constats, fiche) {
|
|
1436
|
-
const parTitre = new Map((fiche.reponses ?? []).map(r => [r.titre, r]));
|
|
1452
|
+
const parTitre = new Map((fiche.reponses ?? []).map(r => [cleDuConstat(r.titre), r]));
|
|
1437
1453
|
return (constats ?? []).map(c => {
|
|
1438
1454
|
const r = c.role === 'developpeur' ? parTitre.get(c.titre) : undefined;
|
|
1439
1455
|
if (!r) return c;
|
|
@@ -1868,8 +1884,10 @@ function laPasseFinale(ctx) {
|
|
|
1868
1884
|
// The references of the circuit: those the project declares in the package.json of the copy
|
|
1869
1885
|
// (`grillhouse.references`), each `{ nom, commande, fichiers, tests, lit, gardes }` with a name, a
|
|
1870
1886
|
// command and files, `tests`, `lit` and `gardes` arrays when given, empty when not, `entiers` empty;
|
|
1871
|
-
// then
|
|
1872
|
-
//
|
|
1887
|
+
// then its generated files (`grillhouse.engendres`, read at the launch, `ctx.engendres`), each
|
|
1888
|
+
// written in full (`entiers`), which the integration regenerates itself; then the frame's
|
|
1889
|
+
// (`referencesDuCadre`, `cadre`), each but one whose first file a reference of the project covers,
|
|
1890
|
+
// which replaces it.
|
|
1873
1891
|
function lesReferences(ctx) {
|
|
1874
1892
|
const l = lireJson(path.join(existsSync(ctx.copie) ? ctx.copie : ctx.racine, 'package.json'))
|
|
1875
1893
|
?.grillhouse?.references;
|
|
@@ -1891,7 +1909,8 @@ function lesReferences(ctx) {
|
|
|
1891
1909
|
gardes: r.gardes ?? [],
|
|
1892
1910
|
entiers: [],
|
|
1893
1911
|
cadre: false,
|
|
1894
|
-
}))
|
|
1912
|
+
}))
|
|
1913
|
+
.concat((ctx.engendres ?? []).map(e => ({ ...e, tests: [], cadre: false })));
|
|
1895
1914
|
const duCadre = referencesDuCadre(existsSync(ctx.copie) ? ctx.copie : ctx.racine)
|
|
1896
1915
|
.filter(c => !duProjet.some(r => couvertPar(r.fichiers, c.fichiers[0])))
|
|
1897
1916
|
.map(c => ({ ...c, tests: [], cadre: true }));
|
|
@@ -2037,11 +2056,60 @@ function regenerer(ctx, noms, notes = [], avantLaPasse = false, refusAuLot = fal
|
|
|
2037
2056
|
};
|
|
2038
2057
|
}
|
|
2039
2058
|
|
|
2059
|
+
// The environment of a pass of the circuit (the proof, the checks, the final pass, a command of a
|
|
2060
|
+
// reference): <base>, the launcher's under the lock of the machine, with the tools of the project
|
|
2061
|
+
// (`ctx.outils`, `grillhouse.outils`, read at the launch) whatever <base> holds, then <env>.
|
|
2062
|
+
export const environnementDeLaPasse = (ctx, base, env = {}) => ({
|
|
2063
|
+
...avecLesOutils(ctx.outils ?? {}, base),
|
|
2064
|
+
...env,
|
|
2065
|
+
});
|
|
2066
|
+
|
|
2067
|
+
// The tools of the project whose main tree is <racine>, read at the launch of a run:
|
|
2068
|
+
// `{ outils }`, or `{ arret }`, the stop « lancement » that goes up to the supervisor before any
|
|
2069
|
+
// session (its code, name, report, piece and question), the faults of the key named.
|
|
2070
|
+
export function outilsAuLancement(racine) {
|
|
2071
|
+
try {
|
|
2072
|
+
return { outils: outilsDe(racine) };
|
|
2073
|
+
} catch (err) {
|
|
2074
|
+
const rapport = `La clé grillhouse.outils du package.json est refusée :\n${err.message}`;
|
|
2075
|
+
return {
|
|
2076
|
+
arret: {
|
|
2077
|
+
code: ARRETS.lancement,
|
|
2078
|
+
nom: 'lancement',
|
|
2079
|
+
rapport,
|
|
2080
|
+
piece: `$ npm pkg get grillhouse.outils\n${rapport}`,
|
|
2081
|
+
question: `${rapport}\nLa clé se corrige au package.json du projet, puis \`--reprendre\`.`,
|
|
2082
|
+
},
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
// The generated files the project declares (`grillhouse.engendres`, scripts/engendres.mjs), read
|
|
2088
|
+
// at the launch of a run from its main tree: `{ engendres }`, or `{ arret }`, the stop « lancement »
|
|
2089
|
+
// that goes up to the supervisor before any session, the faults of the key named.
|
|
2090
|
+
export function engendresAuLancement(racine) {
|
|
2091
|
+
try {
|
|
2092
|
+
return { engendres: engendresDe(racine) };
|
|
2093
|
+
} catch (err) {
|
|
2094
|
+
const rapport = `La clé grillhouse.engendres du package.json est refusée :\n${err.message}`;
|
|
2095
|
+
return {
|
|
2096
|
+
arret: {
|
|
2097
|
+
code: ARRETS.lancement,
|
|
2098
|
+
nom: 'lancement',
|
|
2099
|
+
rapport,
|
|
2100
|
+
piece: `$ npm pkg get grillhouse.engendres\n${rapport}`,
|
|
2101
|
+
question: `${rapport}\nLa clé se corrige au package.json du projet, puis \`--reprendre\`.`,
|
|
2102
|
+
},
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2040
2107
|
// One command of a reference, run by the shell at the root of the copy, out of the envelope,
|
|
2041
2108
|
// under the lock of the machine, its output added to the log: `{ code, panne, sortie }`, its exit
|
|
2042
2109
|
// code, whether it failed for real, whatever it judges (the command not found or not executable,
|
|
2043
2110
|
// 126, 127, as the shell says it; killed by a signal, the shell's 128 + its number; or the lock of
|
|
2044
|
-
// the machine not taken), and what it wrote to the log.
|
|
2111
|
+
// the machine not taken), and what it wrote to the log. It runs in the environment of a pass
|
|
2112
|
+
// (`environnementDeLaPasse`).
|
|
2045
2113
|
function commandeDeReference(ctx, commande) {
|
|
2046
2114
|
entete(ctx, 'references');
|
|
2047
2115
|
appendFileSync(ctx.journal, `$ ${commande}\n`);
|
|
@@ -2050,7 +2118,12 @@ function commandeDeReference(ctx, commande) {
|
|
|
2050
2118
|
const fd = openSync(ctx.journal, 'a');
|
|
2051
2119
|
try {
|
|
2052
2120
|
const r = avecLaMachine(
|
|
2053
|
-
env =>
|
|
2121
|
+
env =>
|
|
2122
|
+
spawnSync('sh', ['-c', commande], {
|
|
2123
|
+
cwd: ctx.copie,
|
|
2124
|
+
stdio: ['ignore', fd, fd],
|
|
2125
|
+
env: environnementDeLaPasse(ctx, env),
|
|
2126
|
+
}),
|
|
2054
2127
|
{ racine: ctx.copie, dire: l => appendFileSync(ctx.journal, `${l}\n`) }
|
|
2055
2128
|
);
|
|
2056
2129
|
const code = r.status ?? 1;
|
|
@@ -2172,13 +2245,35 @@ export function constatsOuverts(ctx, fiche, texte) {
|
|
|
2172
2245
|
}
|
|
2173
2246
|
return { titre: c.titre, regle: c.regle, role: c.role, corps: c.corps, piece: c.piece };
|
|
2174
2247
|
});
|
|
2175
|
-
const leves = new Set(
|
|
2248
|
+
const leves = new Set(
|
|
2249
|
+
(fiche.suivi ?? []).filter(s => s.etat === 'levé').map(s => cleDuConstat(s.titre))
|
|
2250
|
+
);
|
|
2176
2251
|
const restes = (ctx.constats ?? [])
|
|
2177
2252
|
.filter(c => !leves.has(c.titre) && !neufs.some(n => n.titre === c.titre))
|
|
2178
2253
|
.map(c => Object.fromEntries(Object.entries(c).filter(([k]) => k !== 'reponse')));
|
|
2179
2254
|
return [...restes, ...neufs];
|
|
2180
2255
|
}
|
|
2181
2256
|
|
|
2257
|
+
// The stop for the findings open in <ctx> that go to the testwriter when the plan skips him
|
|
2258
|
+
// (`sansTests`), or null: no new pass treats them, as a CI fails fast on a step it cannot run
|
|
2259
|
+
// (grillhouse-26x). An Arret `relecture-arret` whose report names each finding, the role skipped
|
|
2260
|
+
// and why, then the verdict <texte>; its piece, the findings' pieces; its question, declare the
|
|
2261
|
+
// tests of the package or settle the finding.
|
|
2262
|
+
export function arretDuTestwriterSaute(ctx, texte) {
|
|
2263
|
+
const auTestwriter = ouverts(ctx, 'testwriter');
|
|
2264
|
+
if (!auTestwriter.length || !sansTests(ctx)) return null;
|
|
2265
|
+
const titres = auTestwriter.map(c => `« ${c.titre} »`).join(', ');
|
|
2266
|
+
const plan = ctx.paquets.join(', ');
|
|
2267
|
+
return new Arret(
|
|
2268
|
+
'relecture-arret',
|
|
2269
|
+
`Le relecteur adresse au testwriter ${titres}, quand le plan saute le testwriter : aucun paquet du plan ne joue de tests (${plan}).\n\nLe verdict :\n\n${texte}`,
|
|
2270
|
+
{
|
|
2271
|
+
piece: auTestwriter.map(c => c.piece ?? c.titre).join('\n'),
|
|
2272
|
+
question: `Le constat ${titres} va au testwriter, que le plan (${plan}) saute : déclarer les tests du paquet au cadre, puis \`--reprendre\`, ou trancher le constat (\`--depuis developpeur --contexte\`, ou \`--arreter\`).`,
|
|
2273
|
+
}
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2182
2277
|
// The integration of the lot: its two patches, its message and the references that write files in
|
|
2183
2278
|
// full (`--references`, from `lesReferences`, the one list), written from the copy, then
|
|
2184
2279
|
// scripts/integration/integrer.mjs from the main tree, its output added to the log. A run « à
|
|
@@ -2209,12 +2304,14 @@ function integrer(ctx) {
|
|
|
2209
2304
|
const message = path.join(ctx.tmp, 'message');
|
|
2210
2305
|
writeFileSync(message, messageDeCommit(ctx));
|
|
2211
2306
|
args.push('--message', message);
|
|
2307
|
+
// The project's generated files, the integration reads from the main tree itself.
|
|
2212
2308
|
const entieres = lesReferences(ctx)
|
|
2213
|
-
.filter(r => r.entiers.length)
|
|
2214
|
-
.map(({ nom, commande, fichiers, entiers, cadre }) => ({
|
|
2309
|
+
.filter(r => r.cadre && r.entiers.length)
|
|
2310
|
+
.map(({ nom, commande, fichiers, lit, entiers, cadre }) => ({
|
|
2215
2311
|
nom,
|
|
2216
2312
|
commande,
|
|
2217
2313
|
fichiers,
|
|
2314
|
+
lit,
|
|
2218
2315
|
entiers,
|
|
2219
2316
|
cadre,
|
|
2220
2317
|
}));
|
|
@@ -2243,18 +2340,35 @@ function integrer(ctx) {
|
|
|
2243
2340
|
return r;
|
|
2244
2341
|
}
|
|
2245
2342
|
|
|
2343
|
+
// The arguments of the queue at 5.2 for the ticket <ticket>, whether its branch is in the queue
|
|
2344
|
+
// (<enFile>) and its status in Beads (<statut>): none, the queue as it is, while the branch waits
|
|
2345
|
+
// in it or once the ticket is closed; `--ci <ticket>` for a branch out of the queue and a ticket
|
|
2346
|
+
// open, a red CI reopened it, which the queue reads again (`relireCI` of
|
|
2347
|
+
// scripts/integration/file.mjs), as a merge queue judges the last attempt of the checks.
|
|
2348
|
+
export const argumentsDeLaFile = ({ ticket, enFile, statut }) =>
|
|
2349
|
+
enFile || statut === 'closed' ? [] : ['--ci', ticket];
|
|
2350
|
+
|
|
2246
2351
|
// The queue (scripts/integration/file.mjs), launched from the main tree and waited for, its output
|
|
2247
2352
|
// added to the log; then the state it leaves to the ticket: `{ etat, raison }`, `etat` ferme (the
|
|
2248
2353
|
// ticket closed, its branch on main and its CI read), en-file (the branch still in the queue, the
|
|
2249
2354
|
// queue's reason) or rouvert (out of the queue, or a red CI, the queue's last comment). A queue
|
|
2250
|
-
// already running exits 0 at once: it takes the branch, and the state is read at its end too.
|
|
2355
|
+
// already running exits 0 at once: it takes the branch, and the state is read at its end too. A
|
|
2356
|
+
// branch out of the queue with its ticket open (a red CI reopened it, then `--reprendre`) runs the
|
|
2357
|
+
// queue's reading of the CI again instead (`argumentsDeLaFile`).
|
|
2251
2358
|
function file(ctx) {
|
|
2252
2359
|
const motsDeLaFile = () => passations(ctx).filter(c => c.author === AUTEUR_DE_LA_FILE);
|
|
2253
2360
|
const avant = motsDeLaFile().length;
|
|
2361
|
+
const branche = `agent/${ctx.ticket}`;
|
|
2362
|
+
const avantLaFile = ctx.bd('show', ctx.ticket, '--json');
|
|
2363
|
+
const args = argumentsDeLaFile({
|
|
2364
|
+
ticket: ctx.ticket,
|
|
2365
|
+
enFile: lireEntrees(ctx.racine).some(e => e.branche === branche),
|
|
2366
|
+
statut: avantLaFile.status === 0 ? (JSON.parse(avantLaFile.stdout)[0]?.status ?? null) : null,
|
|
2367
|
+
});
|
|
2254
2368
|
entete(ctx, 'file');
|
|
2255
|
-
appendFileSync(ctx.journal, `$ node ${FILE}\n`);
|
|
2369
|
+
appendFileSync(ctx.journal, `$ node ${[FILE, ...args].join(' ')}\n`);
|
|
2256
2370
|
const x = avecAvancement(ctx, null, avancement =>
|
|
2257
|
-
spawnSync(process.execPath, [FILE], {
|
|
2371
|
+
spawnSync(process.execPath, [FILE, ...args], {
|
|
2258
2372
|
cwd: ctx.racine,
|
|
2259
2373
|
encoding: 'utf8',
|
|
2260
2374
|
maxBuffer: 256 * 1024 * 1024,
|
|
@@ -2262,7 +2376,6 @@ function file(ctx) {
|
|
|
2262
2376
|
})
|
|
2263
2377
|
);
|
|
2264
2378
|
appendFileSync(ctx.journal, `${x.stdout ?? ''}${x.stderr ?? ''}`);
|
|
2265
|
-
const branche = `agent/${ctx.ticket}`;
|
|
2266
2379
|
// Another queue that runs takes the branch: the circuit waits for its end.
|
|
2267
2380
|
while (lireEntrees(ctx.racine).some(e => e.branche === branche) && fileEnCours(ctx)) {
|
|
2268
2381
|
attendreUnPeu(5_000);
|
|
@@ -2534,7 +2647,8 @@ function paquetDe(liste, fichier) {
|
|
|
2534
2647
|
// (scripts/verrou-de-machine.mjs), its wait written to the log, and passes it to the
|
|
2535
2648
|
// `npm run verifier` it runs. A wait that stops (its bound, 75; a lock held by an ancestor, 1) is
|
|
2536
2649
|
// the command's code, its message in the log. Once it holds the lock, the pass plays under a
|
|
2537
|
-
// progress directory of its own (`avancement`), of the kind `genreDeLaPasse` names.
|
|
2650
|
+
// progress directory of its own (`avancement`), of the kind `genreDeLaPasse` names. It plays in
|
|
2651
|
+
// the environment of a pass (`environnementDeLaPasse`).
|
|
2538
2652
|
function npm(ctx, etape, args, env = {}) {
|
|
2539
2653
|
entete(ctx, etape);
|
|
2540
2654
|
const dossier = mkdtempSync(path.join(ctx.base.dossier, 'resultats-'));
|
|
@@ -2548,13 +2662,12 @@ function npm(ctx, etape, args, env = {}) {
|
|
|
2548
2662
|
spawnSync('npm', args, {
|
|
2549
2663
|
cwd: ctx.copie,
|
|
2550
2664
|
stdio: ['ignore', fd, fd],
|
|
2551
|
-
env: {
|
|
2552
|
-
...envMachine,
|
|
2665
|
+
env: environnementDeLaPasse(ctx, envMachine, {
|
|
2553
2666
|
...env,
|
|
2554
2667
|
[RESULTATS]: dossier,
|
|
2555
2668
|
[AVANCEMENT]: avancement,
|
|
2556
2669
|
...(args[0] === 'test' ? { [DEPUIS_LE_VERT]: '1' } : {}),
|
|
2557
|
-
},
|
|
2670
|
+
}),
|
|
2558
2671
|
})
|
|
2559
2672
|
),
|
|
2560
2673
|
{ racine: ctx.copie, dire: l => appendFileSync(ctx.journal, `${l}\n`) }
|
|
@@ -3659,6 +3772,8 @@ async function derouler(ctx, debut) {
|
|
|
3659
3772
|
);
|
|
3660
3773
|
}
|
|
3661
3774
|
ctx.constats = constatsOuverts(ctx, v.fiche, v.texte);
|
|
3775
|
+
const saute = arretDuTestwriterSaute(ctx, v.texte);
|
|
3776
|
+
if (saute) throw saute;
|
|
3662
3777
|
const auTestwriter = ouverts(ctx, 'testwriter').length > 0;
|
|
3663
3778
|
etape = auTestwriter ? TESTS : CODE;
|
|
3664
3779
|
tentative = 1;
|
|
@@ -3865,7 +3980,10 @@ function depart(ctx, e) {
|
|
|
3865
3980
|
// (`montee`: its code, its stop and the supervisor's session that ran it, `superviseur`, when
|
|
3866
3981
|
// Claude Code names it), from which the bilan measures the wait to the run that answers it, the
|
|
3867
3982
|
// owner's when he writes in that session meanwhile, then the ticket's bilan at the ticket
|
|
3868
|
-
// (scripts/bilan.mjs); a bilan it cannot write leaves the code as it is.
|
|
3983
|
+
// (scripts/bilan.mjs); a bilan it cannot write leaves the code as it is. Then the removal of the
|
|
3984
|
+
// finished copies of the repository (scripts/copies-finies.mjs), as a CI cleans its workspaces at
|
|
3985
|
+
// the end of each pipeline, not only the night's: its lines added to the log and written on the
|
|
3986
|
+
// error stream, each kept copy with the place it holds; it never changes the code.
|
|
3869
3987
|
function aLaFin(ctx, code) {
|
|
3870
3988
|
try {
|
|
3871
3989
|
if (code !== 0) {
|
|
@@ -3884,6 +4002,15 @@ function aLaFin(ctx, code) {
|
|
|
3884
4002
|
} catch (e) {
|
|
3885
4003
|
process.stderr.write(`⚠️ bilan non écrit au ticket : ${e.message}\n`);
|
|
3886
4004
|
}
|
|
4005
|
+
try {
|
|
4006
|
+
const lignes = retirerLesCopiesDuDepot(ctx.racine);
|
|
4007
|
+
if (lignes.length) {
|
|
4008
|
+
appendFileSync(ctx.journal, `${lignes.join('\n')}\n`);
|
|
4009
|
+
process.stderr.write(`${lignes.join('\n')}\n`);
|
|
4010
|
+
}
|
|
4011
|
+
} catch (e) {
|
|
4012
|
+
process.stderr.write(`⚠️ copies finies non retirées : ${e.message}\n`);
|
|
4013
|
+
}
|
|
3887
4014
|
return code;
|
|
3888
4015
|
}
|
|
3889
4016
|
|
|
@@ -4442,6 +4569,17 @@ export async function main(argv) {
|
|
|
4442
4569
|
})
|
|
4443
4570
|
);
|
|
4444
4571
|
}
|
|
4572
|
+
// The tools of the project, which every pass of the circuit plays with: a faulty key stops the
|
|
4573
|
+
// run before any session, by its name.
|
|
4574
|
+
const lancement = outilsAuLancement(ctx.racine);
|
|
4575
|
+
if (lancement.arret) return aLaFin(ctx, monter(ctx, { ...lancement.arret, etat: d }));
|
|
4576
|
+
ctx.outils = lancement.outils;
|
|
4577
|
+
// The generated files the project declares: references of the circuit, which 4.2 regenerates
|
|
4578
|
+
// only when a red of a pass lies in their files (`referencesDesRouges`); the integration
|
|
4579
|
+
// regenerates them whenever the lot touches their files or what they read.
|
|
4580
|
+
const engendres = engendresAuLancement(ctx.racine);
|
|
4581
|
+
if (engendres.arret) return aLaFin(ctx, monter(ctx, { ...engendres.arret, etat: d }));
|
|
4582
|
+
ctx.engendres = engendres.engendres;
|
|
4445
4583
|
// From the testwriter: the plan, which the explorateur writes and the questionneur reads once.
|
|
4446
4584
|
if (d.etape === TESTS) {
|
|
4447
4585
|
const arret = await lePlan(ctx);
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
// - The command is the subcommand <nom> of the module (`commandeDe` of ./sous-commandes.mjs), run
|
|
10
10
|
// by Node with its arguments then these, in the working directory, this process's standard
|
|
11
11
|
// streams; its exit code is this command's, 128 plus the number of a signal that ended it.
|
|
12
|
-
// - A project that declares no language (
|
|
13
|
-
// command <nom>, plays nothing: exit 0.
|
|
12
|
+
// - A project that declares no language (the column « Langage » of its docs/ARCHITECTURE.md),
|
|
13
|
+
// or whose module describes no command <nom>, plays nothing: exit 0.
|
|
14
14
|
// - A name of the core (`grillhouse <nom>`), or none, is refused, exit 2.
|
|
15
15
|
import { spawnSync } from 'node:child_process';
|
|
16
16
|
import { constants } from 'node:os';
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// A command of a project of several languages (./composition-des-langages.mjs, `commandes`):
|
|
3
|
+
// each declared module that describes it plays it with its own tool, one after the other, and the
|
|
4
|
+
// verdicts join into one, as Bazel runs each target with the rule of its language and one red
|
|
5
|
+
// fails the build. `grillhouse tests`, `grillhouse verifier` and every command of a module run it
|
|
6
|
+
// in such a project; the circuit, the queue and the night reach it by them.
|
|
7
|
+
//
|
|
8
|
+
// node commandes-composees.mjs <nom> [arguments…] from the root of the project
|
|
9
|
+
//
|
|
10
|
+
// - The modules are the project's (scripts/langages.mjs, `langagesDe`), in the order of the
|
|
11
|
+
// declaration; each one that describes the command <nom> plays it, by Node, its arguments then
|
|
12
|
+
// these, in the working directory, with this process's standard streams and environment, its
|
|
13
|
+
// results directory included (`GRILLHOUSE_RESULTATS`), where each module writes under names of
|
|
14
|
+
// its own. A line on the error stream names each module before it plays, so that what a
|
|
15
|
+
// command prints on its standard output stays its own.
|
|
16
|
+
// - `tester`: an argument that begins with « - » is an option, given to every module; any other is
|
|
17
|
+
// a path from the root, given to the module of the component that holds it
|
|
18
|
+
// (`moduleDuFichier`), or out of every component to the first module whose rule of a test file
|
|
19
|
+
// judges it (`estUnTest`). With paths, the modules that receive none do not play. A path no
|
|
20
|
+
// module takes is refused, named, and nothing plays (code 2).
|
|
21
|
+
// - The last green (scripts/dernier-vert.mjs) is kept once, after the last module: while the
|
|
22
|
+
// modules play, a module green defers its own (`VERT_DIFFERE`); when every module played green
|
|
23
|
+
// and each deferred one, the first deferred is kept, the state of the repository when the pass
|
|
24
|
+
// began. A pass with one module red keeps none, so that the next pass plays its changes again.
|
|
25
|
+
// - The exit code: 0 when every module is green, 75 when the only reds are « à repasser », else the
|
|
26
|
+
// first other code; 128 plus the number of a signal that ended a module.
|
|
27
|
+
import { spawnSync } from 'node:child_process';
|
|
28
|
+
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
29
|
+
import { constants, tmpdir } from 'node:os';
|
|
30
|
+
import path from 'node:path';
|
|
31
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
32
|
+
import { moduleDuFichier } from './composition-des-langages.mjs';
|
|
33
|
+
import { garderLeVert, VERT_DIFFERE } from './dernier-vert.mjs';
|
|
34
|
+
import { langagesDe } from './langages.mjs';
|
|
35
|
+
|
|
36
|
+
/** This script, the one every composed command runs. */
|
|
37
|
+
export const SCRIPT = fileURLToPath(import.meta.url);
|
|
38
|
+
const A_REPASSER = 75;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The verdict of the codes <codes> joined: 0 when every code is 0, 75 when the others are 75,
|
|
42
|
+
* else the first other.
|
|
43
|
+
* @param {number[]} codes
|
|
44
|
+
*/
|
|
45
|
+
export const unir = codes =>
|
|
46
|
+
codes.find(c => c !== 0 && c !== A_REPASSER) ??
|
|
47
|
+
(codes.some(c => c === A_REPASSER) ? A_REPASSER : 0);
|
|
48
|
+
|
|
49
|
+
// The arguments of each module of <modules> for the command <nom>: `{ parts: [{ module, args }] }`,
|
|
50
|
+
// or `{ refus }`, the paths no module takes.
|
|
51
|
+
function repartir(nom, args, modules, racine) {
|
|
52
|
+
if (nom !== 'tester') {
|
|
53
|
+
return { parts: modules.map(module => ({ module, args })) };
|
|
54
|
+
}
|
|
55
|
+
const estChemin = a => !a.startsWith('-');
|
|
56
|
+
if (!args.some(estChemin)) {
|
|
57
|
+
return { parts: modules.map(module => ({ module, args })) };
|
|
58
|
+
}
|
|
59
|
+
const parModule = new Map();
|
|
60
|
+
const refus = [];
|
|
61
|
+
for (const a of args.filter(estChemin)) {
|
|
62
|
+
const m =
|
|
63
|
+
moduleDuFichier(modules, racine, a) ??
|
|
64
|
+
modules.find(x => x.estUnTest(a, racine) !== null) ??
|
|
65
|
+
null;
|
|
66
|
+
if (m) {
|
|
67
|
+
parModule.set(m, [...(parModule.get(m) ?? []), a]);
|
|
68
|
+
} else {
|
|
69
|
+
refus.push(a);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (refus.length) {
|
|
73
|
+
return { refus };
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
parts: modules
|
|
77
|
+
.filter(m => parModule.has(m))
|
|
78
|
+
.map(module => ({
|
|
79
|
+
module,
|
|
80
|
+
args: args.filter(a => !estChemin(a) || parModule.get(module).includes(a)),
|
|
81
|
+
})),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Plays the command <nom> with <args> in each module of <modules> that describes it, in the
|
|
87
|
+
* project at <racine>, under <env>: the joined exit code.
|
|
88
|
+
* @param {string} nom
|
|
89
|
+
* @param {string[]} args
|
|
90
|
+
* @param {{ racine?: string, modules?: import('./jointure.js').Langage[], env?: NodeJS.ProcessEnv,
|
|
91
|
+
* dire?: (ligne: string) => void }} [o]
|
|
92
|
+
* @returns {number}
|
|
93
|
+
*/
|
|
94
|
+
export function jouer(
|
|
95
|
+
nom,
|
|
96
|
+
args,
|
|
97
|
+
{
|
|
98
|
+
racine = process.cwd(),
|
|
99
|
+
modules = langagesDe(racine),
|
|
100
|
+
env = process.env,
|
|
101
|
+
dire = l => process.stderr.write(`${l}\n`),
|
|
102
|
+
} = {}
|
|
103
|
+
) {
|
|
104
|
+
const avec = modules.filter(m => Object.hasOwn(m.commandes(racine), nom));
|
|
105
|
+
const r = repartir(nom, args, avec, racine);
|
|
106
|
+
if (r.refus) {
|
|
107
|
+
for (const a of r.refus) {
|
|
108
|
+
process.stderr.write(`⛔ ${a} : aucun composant ne le tient, d'aucun langage du projet.\n`);
|
|
109
|
+
}
|
|
110
|
+
return 2;
|
|
111
|
+
}
|
|
112
|
+
const dossier = mkdtempSync(path.join(tmpdir(), 'grillhouse-vert-differe-'));
|
|
113
|
+
const differe = path.join(dossier, 'verts');
|
|
114
|
+
try {
|
|
115
|
+
const codes = r.parts.map(({ module, args: siens }) => {
|
|
116
|
+
const c = module.commandes(racine)[nom];
|
|
117
|
+
dire(`▶ ${module.nom} : ${nom}`);
|
|
118
|
+
const p = spawnSync(process.execPath, [c.script, ...c.args, ...siens], {
|
|
119
|
+
cwd: racine,
|
|
120
|
+
stdio: 'inherit',
|
|
121
|
+
env: { ...env, [VERT_DIFFERE]: differe },
|
|
122
|
+
});
|
|
123
|
+
if (p.error) {
|
|
124
|
+
process.stderr.write(`⛔ ${module.nom} : ${nom} : ${p.error.message}\n`);
|
|
125
|
+
return 1;
|
|
126
|
+
}
|
|
127
|
+
return p.status ?? 128 + (constants.signals[p.signal ?? 'SIGTERM'] ?? 0);
|
|
128
|
+
});
|
|
129
|
+
const code = unir(codes);
|
|
130
|
+
let verts = [];
|
|
131
|
+
try {
|
|
132
|
+
verts = readFileSync(differe, 'utf8')
|
|
133
|
+
.split('\n')
|
|
134
|
+
.filter(Boolean)
|
|
135
|
+
.map(l => JSON.parse(l));
|
|
136
|
+
} catch {
|
|
137
|
+
verts = [];
|
|
138
|
+
}
|
|
139
|
+
if (code === 0 && verts.length > 0 && verts.length === r.parts.length) {
|
|
140
|
+
garderLeVert(verts[0], {});
|
|
141
|
+
}
|
|
142
|
+
return code;
|
|
143
|
+
} finally {
|
|
144
|
+
rmSync(dossier, { recursive: true, force: true });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
149
|
+
const [nom, ...args] = process.argv.slice(2);
|
|
150
|
+
try {
|
|
151
|
+
process.exitCode = jouer(nom, args);
|
|
152
|
+
} catch (e) {
|
|
153
|
+
process.stderr.write(`${e.message}\n`);
|
|
154
|
+
process.exitCode = 1;
|
|
155
|
+
}
|
|
156
|
+
}
|