@roomi-fields/grillhouse 0.33.0 → 0.34.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 +73 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +35 -2
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/circuit/activites.d.ts +3 -1
- package/dist/temporal/circuit/activites.js +25 -1
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/appel.d.ts +19 -0
- package/dist/temporal/circuit/appel.js +93 -0
- package/dist/temporal/circuit/appel.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +17 -3
- package/dist/temporal/circuit/client.js +28 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +27 -87
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +29 -0
- package/dist/temporal/circuit/contrat.js +33 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +115 -34
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +13 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +3 -0
- package/dist/temporal/file/activites.js +9 -0
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +58 -0
- package/dist/temporal/file/deroule.d.ts +8 -1
- package/dist/temporal/file/deroule.js +100 -2
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -1
- package/dist/temporal/installation.js +57 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +2 -0
- package/dist/temporal/nuits/deroule.js +3 -0
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +12 -1
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +8 -1
- package/dist/temporal/places/client.js +25 -2
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +35 -3
- package/dist/temporal/places/contrat.js +5 -4
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +55 -9
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +3 -0
- package/dist/temporal/tickets/activites.js +73 -4
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +31 -0
- package/dist/temporal/tickets/deroule.js +61 -10
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +240 -60
- package/docs/CADRE.md +6 -1
- package/docs/INTERFACE.md +25 -8
- package/hooks/crochet.mjs +17 -2
- package/hooks/hooks.json +24 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +96 -15
- package/scripts/aiguillage.mjs +2 -0
- package/scripts/attente-a-l-arret.mjs +141 -0
- package/scripts/attente-au-tour.mjs +32 -16
- package/scripts/avancement.mjs +5 -3
- package/scripts/branche-de-nuit.mjs +63 -3
- package/scripts/circuit.mjs +57 -4
- package/scripts/circuits-du-serveur.mjs +38 -4
- package/scripts/commandes-composees.mjs +11 -4
- package/scripts/copies-finies.mjs +43 -29
- package/scripts/crochets.mjs +1 -1
- package/scripts/dernier-vert.mjs +31 -10
- package/scripts/dette.mjs +55 -4
- package/scripts/disque-des-copies.d.mts +28 -0
- package/scripts/disque-des-copies.mjs +155 -0
- package/scripts/droits.mjs +2 -0
- package/scripts/faits-du-circuit.mjs +24 -0
- package/scripts/file-des-tickets.d.mts +16 -0
- package/scripts/file-des-tickets.mjs +65 -7
- package/scripts/gardes-du-cadre.mjs +4 -2
- package/scripts/integration/file.mjs +302 -5
- package/scripts/jointure.d.ts +33 -1
- package/scripts/langages/cargo/commandes.mjs +71 -10
- package/scripts/langages/cargo/composants.mjs +12 -4
- package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
- package/scripts/langages/cargo/exemples.mjs +17 -3
- package/scripts/langages/cargo/index.mjs +8 -3
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
- package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
- package/scripts/langages/cargo/squelette.mjs +8 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
- package/scripts/langages/cargo/tests-de-head.mjs +12 -9
- package/scripts/langages/cargo/verdict.mjs +40 -14
- package/scripts/langages/python/commandes.mjs +11 -2
- package/scripts/langages/python/index.mjs +12 -4
- package/scripts/langages/python/verdict.mjs +8 -1
- package/scripts/langages/typescript/index.mjs +9 -2
- package/scripts/langages/typescript/resume-du-lanceur.mjs +86 -0
- package/scripts/langages/typescript/tests.mjs +9 -3
- package/scripts/langages/typescript/verdict.mjs +4 -60
- package/scripts/langages/typescript/verifier.mjs +11 -4
- package/scripts/langages/typescript/vitest-config/changements.mjs +32 -15
- package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
- package/scripts/messages-non-lus.mjs +166 -0
- package/scripts/mesure-de-la-machine.mjs +7 -4
- package/scripts/migrations-des-gardes.mjs +168 -0
- package/scripts/places-de-la-machine.mjs +44 -40
- package/scripts/places-du-serveur.mjs +82 -14
- package/scripts/plafond-de-la-machine.d.mts +18 -0
- package/scripts/plafond-de-la-machine.mjs +45 -0
- package/scripts/recommencer.d.mts +4 -0
- package/scripts/recommencer.mjs +29 -0
- package/scripts/regles-des-places.d.mts +35 -0
- package/scripts/regles-des-places.mjs +82 -1
- package/scripts/resultats.mjs +38 -4
- package/scripts/retirer-les-copies-finies.mjs +11 -7
- package/scripts/seances.mjs +1 -1
- package/scripts/services-du-noyau.mjs +2 -1
- package/scripts/session-start.sh +12 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +283 -59
- package/scripts/tableau.mjs +390 -250
- package/scripts/taches-du-graphe.mjs +32 -5
- package/scripts/ticket-du-circuit.mjs +25 -0
- package/scripts/transitions.d.mts +27 -1
- package/scripts/transitions.mjs +96 -4
- package/scripts/verrou-de-machine.mjs +41 -17
- package/skills/explorateur/SKILL.md +8 -2
- package/skills/pitmaster/SKILL.md +26 -18
- package/skills/pitmaster/references/tour.md +3 -1
- package/skills/questionneur/SKILL.md +5 -1
- package/skills/testwriter/SKILL.md +32 -6
|
@@ -31,6 +31,34 @@ function tenant(racine) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The root of the repository whose session of supervision works in <dossier>: null out of a git
|
|
36
|
+
* repository, in an agent's copy (a worktree) and in the session of a role that the circuit
|
|
37
|
+
* launches (BEADS_ACTOR set). The hooks of the supervisor's session read it (this one, and
|
|
38
|
+
* scripts/attente-a-l-arret.mjs).
|
|
39
|
+
* @param {string} dossier
|
|
40
|
+
* @param {Record<string, string | undefined>} env
|
|
41
|
+
* @returns {string | null}
|
|
42
|
+
*/
|
|
43
|
+
export function racineDeLaSupervision(dossier, env = process.env) {
|
|
44
|
+
if (env.BEADS_ACTOR) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const r = spawnSync(
|
|
48
|
+
'git',
|
|
49
|
+
['-C', dossier, 'rev-parse', '--path-format=absolute', '--git-dir', '--git-common-dir'],
|
|
50
|
+
{ encoding: 'utf8' }
|
|
51
|
+
);
|
|
52
|
+
if (r.status !== 0) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const [dossierGit, commun] = r.stdout.trim().split('\n');
|
|
56
|
+
if (path.resolve(dossierGit) !== path.resolve(commun)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return path.dirname(commun);
|
|
60
|
+
}
|
|
61
|
+
|
|
34
62
|
/**
|
|
35
63
|
* What the session of supervision in <dossier> reads at its turn: the circuits that wait for the
|
|
36
64
|
* supervisor, each with its ticket, its question and the command that answers it, then the wait to
|
|
@@ -45,22 +73,10 @@ export async function attenteAuTour(
|
|
|
45
73
|
dossier,
|
|
46
74
|
{ env = process.env, fermes = ticketsFermes, circuitsDe = circuitsDuServeur } = {}
|
|
47
75
|
) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
const r = spawnSync(
|
|
52
|
-
'git',
|
|
53
|
-
['-C', dossier, 'rev-parse', '--path-format=absolute', '--git-dir', '--git-common-dir'],
|
|
54
|
-
{ encoding: 'utf8' }
|
|
55
|
-
);
|
|
56
|
-
if (r.status !== 0) {
|
|
57
|
-
return '';
|
|
58
|
-
}
|
|
59
|
-
const [dossierGit, commun] = r.stdout.trim().split('\n');
|
|
60
|
-
if (path.resolve(dossierGit) !== path.resolve(commun)) {
|
|
76
|
+
const racine = racineDeLaSupervision(dossier, env);
|
|
77
|
+
if (!racine) {
|
|
61
78
|
return '';
|
|
62
79
|
}
|
|
63
|
-
const racine = path.dirname(commun);
|
|
64
80
|
const vit = tenant(racine);
|
|
65
81
|
if (vit && vivant(vit)) {
|
|
66
82
|
return '';
|
|
@@ -78,7 +94,7 @@ export async function attenteAuTour(
|
|
|
78
94
|
return [
|
|
79
95
|
questions.length > 1
|
|
80
96
|
? '## Circuits en attente du superviseur'
|
|
81
|
-
:
|
|
97
|
+
: '## Circuit en attente du superviseur',
|
|
82
98
|
...questions.map(q =>
|
|
83
99
|
q.interrompu
|
|
84
100
|
? `- ${q.ticket} a fini sans son issue, à ${q.etape} : \`${q.commande}\`.`
|
|
@@ -87,7 +103,7 @@ export async function attenteAuTour(
|
|
|
87
103
|
` La réponse : \`${q.commande}\`.`,
|
|
88
104
|
].join('\n')
|
|
89
105
|
),
|
|
90
|
-
|
|
106
|
+
'Aucune attente de fond ne vit : lance-la en arrière-plan (`run_in_background`), sans tube ni veille à durée, et relance-la après chaque lot traité : `npx grillhouse superviseur --attendre`.',
|
|
91
107
|
].join('\n');
|
|
92
108
|
}
|
|
93
109
|
|
package/scripts/avancement.mjs
CHANGED
|
@@ -302,10 +302,10 @@ export function garderLeTotal(dossier) {
|
|
|
302
302
|
/**
|
|
303
303
|
* Who holds the lock of the machine under <env> and who waits for it, as the board shows them
|
|
304
304
|
* (scripts/tableau.mjs): `detenteur`, its repository (`depot`, the root of its main tree, and
|
|
305
|
-
* `projet`, its folder), ticket, kind, since when and progress
|
|
305
|
+
* `projet`, its folder), its working tree (`copie`, the main tree or a copy), ticket, kind, since when and progress
|
|
306
306
|
* (`avancement`, its files done and planned and its last sign; null while it names no progress
|
|
307
307
|
* directory, or that directory does not read), null when the lock is free or its process gone;
|
|
308
|
-
* `attentes`, each live wait, the oldest first, its project, ticket, kind, what it waits for
|
|
308
|
+
* `attentes`, each live wait, the oldest first, its project, copy, ticket, kind, what it waits for
|
|
309
309
|
* (`quoi`) and since when (`lireLeVerrou` of scripts/verrou-de-machine.mjs).
|
|
310
310
|
* @param {Record<string, string | undefined>} [env]
|
|
311
311
|
*/
|
|
@@ -314,14 +314,16 @@ export function lireLaMesure(env = process.env) {
|
|
|
314
314
|
return {
|
|
315
315
|
detenteur: d && {
|
|
316
316
|
depot: d.depot,
|
|
317
|
+
copie: d.copie ?? null,
|
|
317
318
|
projet: d.projet,
|
|
318
319
|
ticket: d.ticket,
|
|
319
320
|
sorte: d.sorte,
|
|
320
321
|
depuis: d.depuis,
|
|
321
322
|
avancement: typeof d.dossier === 'string' ? lireAvancement(d.dossier) : null,
|
|
322
323
|
},
|
|
323
|
-
attentes: attentes.map(({ depot, projet, ticket, sorte, quoi, depuis }) => ({
|
|
324
|
+
attentes: attentes.map(({ depot, copie, projet, ticket, sorte, quoi, depuis }) => ({
|
|
324
325
|
depot,
|
|
326
|
+
copie: copie ?? null,
|
|
325
327
|
projet,
|
|
326
328
|
ticket,
|
|
327
329
|
sorte,
|
|
@@ -12,11 +12,63 @@
|
|
|
12
12
|
// - The night makes itself known by GRILLHOUSE_NUIT=1, which scripts/nuit.sh sets for its push
|
|
13
13
|
// alone. It is a mark, not a secret: a human who sets it is trusted.
|
|
14
14
|
// - Exit 0 lets the push go on; exit 1 refuses it, the reason on the standard error.
|
|
15
|
-
|
|
15
|
+
//
|
|
16
|
+
// The judged main: in a project whose CI runs on the ticket branches (`agent/**`,
|
|
17
|
+
// scripts/ci-des-branches.mjs), a push to origin of the branch main is pushed to
|
|
18
|
+
// (`grillhouse.poussee.commit`, `main` by default) carries only a commit a run of the CI concluded
|
|
19
|
+
// green on a ticket branch, as bors and the merge queues enter only a tree already judged
|
|
20
|
+
// (`refusSurMain`). The queue pushes such a commit; any other change goes by its ticket branch
|
|
21
|
+
// first. The ruleset of the repository on GitHub holds the same rule on the server; a reading of
|
|
22
|
+
// the runs that fails lets the push go, the server judging it.
|
|
23
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
16
24
|
import { existsSync, readFileSync } from 'node:fs';
|
|
17
25
|
import path from 'node:path';
|
|
18
26
|
import { pathToFileURL } from 'node:url';
|
|
19
|
-
import {
|
|
27
|
+
import { ecouteLesBranchesDeTicket } from './ci-des-branches.mjs';
|
|
28
|
+
import { lireCommit, lirePoussee } from './poussee-cles.mjs';
|
|
29
|
+
|
|
30
|
+
// A sha of zeros: the deletion of the remote branch.
|
|
31
|
+
const SUPPRESSION = /^0+$/;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The refusals for a push to `remote` of `refs` to the branch `principale` of a project that
|
|
35
|
+
* `ecoute` the ticket branches: each commit <jugee(sha)> does not say judged green on a ticket
|
|
36
|
+
* branch is refused, named.
|
|
37
|
+
* @param {string} remote
|
|
38
|
+
* @param {{ sha: string, distante: string }[]} refs
|
|
39
|
+
* @param {{ principale: string | null, ecoute: boolean, jugee: (sha: string) => boolean }} o
|
|
40
|
+
* @returns {string[]}
|
|
41
|
+
*/
|
|
42
|
+
export function refusSurMain(remote, refs, { principale, ecoute, jugee }) {
|
|
43
|
+
if (remote !== 'origin' || !ecoute || !principale) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return refs
|
|
47
|
+
.filter(r => r.distante === `refs/heads/${principale}` && !SUPPRESSION.test(r.sha))
|
|
48
|
+
.filter(r => !jugee(r.sha))
|
|
49
|
+
.map(
|
|
50
|
+
r =>
|
|
51
|
+
`⛔ ${r.sha.slice(0, 8)} n'est jugé vert par la CI d'aucune branche de ticket : main n'avance que sur un arbre jugé. Pousse d'abord sur agent/<ticket>, attends sa CI verte, puis avance main sur ce commit.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Whether a run of the CI concluded green on the commit <sha> on a ticket branch, read by gh in
|
|
56
|
+
// <racine>; true when gh does not answer (the server's ruleset judges then).
|
|
57
|
+
function jugeeParGh(racine, sha) {
|
|
58
|
+
const r = spawnSync(
|
|
59
|
+
'gh',
|
|
60
|
+
['run', 'list', '--commit', sha, '--status', 'success', '--json', 'headBranch'],
|
|
61
|
+
{ cwd: racine, encoding: 'utf8', timeout: 30_000 }
|
|
62
|
+
);
|
|
63
|
+
if (r.status !== 0) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(r.stdout || '[]').some(x => String(x.headBranch).startsWith('agent/'));
|
|
68
|
+
} catch {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
20
72
|
|
|
21
73
|
// The refusals for a push to `remote` of `refs` (the lines git writes) given the package.json
|
|
22
74
|
// object `pkg`; an empty list lets the push go on.
|
|
@@ -51,7 +103,15 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
51
103
|
const racine = execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim();
|
|
52
104
|
const fichier = path.join(racine, 'package.json');
|
|
53
105
|
const pkg = existsSync(fichier) ? JSON.parse(readFileSync(fichier, 'utf8')) : null;
|
|
54
|
-
const
|
|
106
|
+
const refs = lireRefs(readFileSync(0, 'utf8'));
|
|
107
|
+
const lignes = [
|
|
108
|
+
...refus(process.argv[2], refs, pkg),
|
|
109
|
+
...refusSurMain(process.argv[2], refs, {
|
|
110
|
+
principale: pkg ? lireCommit(pkg).commit : null,
|
|
111
|
+
ecoute: ecouteLesBranchesDeTicket(racine),
|
|
112
|
+
jugee: sha => jugeeParGh(racine, sha),
|
|
113
|
+
}),
|
|
114
|
+
];
|
|
55
115
|
for (const l of lignes) {
|
|
56
116
|
process.stderr.write(`${l}\n`);
|
|
57
117
|
}
|
package/scripts/circuit.mjs
CHANGED
|
@@ -642,6 +642,7 @@ import {
|
|
|
642
642
|
import {
|
|
643
643
|
CODE,
|
|
644
644
|
CONTROLES,
|
|
645
|
+
correctionsDuPlan,
|
|
645
646
|
ouvertesDuPlan,
|
|
646
647
|
pasDuPlan,
|
|
647
648
|
questionsPosees,
|
|
@@ -1553,7 +1554,7 @@ export function monter(ctx, a) {
|
|
|
1553
1554
|
const piece =
|
|
1554
1555
|
String(a.piece ?? '').trim() ||
|
|
1555
1556
|
rouges ||
|
|
1556
|
-
`Le journal du ticket, ${ctx.journal} :\n${fin(lire(ctx.journal), 20)}`;
|
|
1557
|
+
`Le journal du ticket, ${ctx.journal} (il se cite en pièce, \`${ctx.ticket}.log:<ligne>\`) :\n${fin(lire(ctx.journal), 20)}`;
|
|
1557
1558
|
const question = a.question ? `${a.question}\n\n${m.question}` : m.question;
|
|
1558
1559
|
const qui = a.qui ?? m.qui;
|
|
1559
1560
|
ecrireEtat(ctx, {
|
|
@@ -1685,6 +1686,26 @@ export function aLaFin(ctx, code) {
|
|
|
1685
1686
|
const lignesDesQuestions = questions =>
|
|
1686
1687
|
(questions ?? []).map((q, i) => `${i + 1}. (${q.vise}) ${q.question}`).join('\n');
|
|
1687
1688
|
|
|
1689
|
+
// The corrections of criteria <corrections> the circuit accepted, one per line: the criterion, its
|
|
1690
|
+
// corrected text, its piece and the extract that proves it.
|
|
1691
|
+
export const lignesDesCorrections = corrections =>
|
|
1692
|
+
corrections
|
|
1693
|
+
.map(
|
|
1694
|
+
c =>
|
|
1695
|
+
`- critère ${c.critere} corrigé : « ${c.texte} » — pièce ${c.piece}, extrait « ${c.extrait} »`
|
|
1696
|
+
)
|
|
1697
|
+
.join('\n');
|
|
1698
|
+
|
|
1699
|
+
// The line <ligne> (from 1) of the file <fichier> of the copy, null when the file or the line is absent.
|
|
1700
|
+
const ligneDeLaCopie = (ctx, fichier, ligne) => {
|
|
1701
|
+
const base = path.resolve(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
|
|
1702
|
+
const chemin = path.resolve(base, fichier);
|
|
1703
|
+
if (!chemin.startsWith(`${base}${path.sep}`) || !existsSync(chemin)) {
|
|
1704
|
+
return null;
|
|
1705
|
+
}
|
|
1706
|
+
return readFileSync(chemin, 'utf8').split('\n')[ligne - 1] ?? null;
|
|
1707
|
+
};
|
|
1708
|
+
|
|
1688
1709
|
// The open questions <questions> of a plan (`{ question, motif, piece }`), one per line, each with
|
|
1689
1710
|
// why it goes up, when the explorateur wrote it, and its piece.
|
|
1690
1711
|
const lignesOuvertes = questions =>
|
|
@@ -1790,7 +1811,16 @@ function numerotee(ligne) {
|
|
|
1790
1811
|
// stay as they are, the decision of the owner: each criterion the plan adds follows them, numbered
|
|
1791
1812
|
// after them. Written again from the description before the plan, the description holds the
|
|
1792
1813
|
// criteria, the sort and the names of the explorateur's last sheet alone.
|
|
1793
|
-
|
|
1814
|
+
// A correction accepted (`{ critere, texte }`) replaces the text of the criterion it names, in place;
|
|
1815
|
+
// one whose criterion the description does not hold changes nothing.
|
|
1816
|
+
export function decrireLePlan(
|
|
1817
|
+
description,
|
|
1818
|
+
criteres,
|
|
1819
|
+
questions,
|
|
1820
|
+
sorte = null,
|
|
1821
|
+
noms = undefined,
|
|
1822
|
+
corrections = []
|
|
1823
|
+
) {
|
|
1794
1824
|
const gardees = sectionsDe(description).filter(
|
|
1795
1825
|
s =>
|
|
1796
1826
|
s.tete !== QUESTIONS_OUVERTES &&
|
|
@@ -1803,6 +1833,16 @@ export function decrireLePlan(description, criteres, questions, sorte = null, no
|
|
|
1803
1833
|
gardees.push({ tete: '## Critères', lignes: [] });
|
|
1804
1834
|
i = gardees.length - 1;
|
|
1805
1835
|
}
|
|
1836
|
+
gardees[i] = {
|
|
1837
|
+
tete: gardees[i].tete,
|
|
1838
|
+
lignes: gardees[i].lignes.map(ligne => {
|
|
1839
|
+
const c =
|
|
1840
|
+
numerotee(ligne) === null
|
|
1841
|
+
? undefined
|
|
1842
|
+
: corrections.find(k => ligne.trim().startsWith(`${k.critere}. `));
|
|
1843
|
+
return c ? `${c.critere}. ${c.texte.trim()}` : ligne;
|
|
1844
|
+
}),
|
|
1845
|
+
};
|
|
1806
1846
|
const ecrits = gardees[i].lignes.map(numerotee).filter(c => c !== null);
|
|
1807
1847
|
const ajouts = criteres.map(c => c.trim());
|
|
1808
1848
|
const avant = [...gardees[i].lignes];
|
|
@@ -2112,7 +2152,12 @@ const PAS_DU_PLAN = {
|
|
|
2112
2152
|
async conclure(ctx, e) {
|
|
2113
2153
|
const { plan, premier, lu, posees } = e;
|
|
2114
2154
|
const reponses = e.reponse?.reponses ?? [];
|
|
2115
|
-
const
|
|
2155
|
+
const { acceptees, refusees } = correctionsDuPlan(
|
|
2156
|
+
lu.issue === 'QUESTIONS' ? lu.questions : [],
|
|
2157
|
+
reponses,
|
|
2158
|
+
(fichier, ligne) => ligneDeLaCopie(ctx, fichier, ligne)
|
|
2159
|
+
);
|
|
2160
|
+
const ouvertes = ouvertesDuPlan(plan, posees, reponses, refusees);
|
|
2116
2161
|
if (posees.length) {
|
|
2117
2162
|
const plans = [{ fiche: premier }, { fiche: plan, reponse: true }];
|
|
2118
2163
|
ecrireLePlan(
|
|
@@ -2123,10 +2168,18 @@ const PAS_DU_PLAN = {
|
|
|
2123
2168
|
plan.criteres,
|
|
2124
2169
|
ouvertes,
|
|
2125
2170
|
sorteEcrite(ficheDuPlan(plans, 'sorte')),
|
|
2126
|
-
ficheDuPlan(plans, 'noms_publies').noms_publies
|
|
2171
|
+
ficheDuPlan(plans, 'noms_publies').noms_publies,
|
|
2172
|
+
acceptees
|
|
2127
2173
|
)
|
|
2128
2174
|
);
|
|
2129
2175
|
}
|
|
2176
|
+
if (acceptees.length) {
|
|
2177
|
+
commenter(
|
|
2178
|
+
ctx,
|
|
2179
|
+
'questionnement',
|
|
2180
|
+
`corrections de critères acceptées, la pièce de la question les prouve :\n${lignesDesCorrections(acceptees)}`
|
|
2181
|
+
);
|
|
2182
|
+
}
|
|
2130
2183
|
const empreinte = empreinteDuPlan(leTicket(ctx));
|
|
2131
2184
|
inscrire(ctx, {
|
|
2132
2185
|
role: AUTEUR_DU_CIRCUIT,
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// (scripts/superviseur.mjs) read them: one call to the Temporal server (src/temporal/circuit/
|
|
3
3
|
// client.ts `lireLesCircuits`, the memo and the status of each workflow, no worker living), as the
|
|
4
4
|
// UI of Temporal lists its workflows, and the progress of the pass under way of each one that runs,
|
|
5
|
-
// read in its working directory (scripts/avancement.mjs `avancementDuTravail`)
|
|
5
|
+
// read in its working directory (scripts/avancement.mjs `avancementDuTravail`); and the night
|
|
6
|
+
// under way on the machine, by the query of the workflow of the nights (`nuitDuServeur`).
|
|
6
7
|
import { existsSync } from 'node:fs';
|
|
7
8
|
import path from 'node:path';
|
|
8
9
|
import { avancementDuTravail } from './avancement.mjs';
|
|
10
|
+
import { surLeServeur } from './places-de-la-machine.mjs';
|
|
9
11
|
import { sansReponseEn } from './sans-reponse.mjs';
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -75,13 +77,14 @@ const sansReponse = e =>
|
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* The circuits of the repository at <racine>, read from the Temporal server of the environment in
|
|
78
|
-
* one call, with their progress (`avecLeurAvancement`) and the page of each one's workflow on the
|
|
80
|
+
* one call (the integrated ones too when <integres> asks for them, `lireLesCircuits`), with their progress (`avecLeurAvancement`) and the page of each one's workflow on the
|
|
79
81
|
* web UI of the server (`lienDuTableauWeb`). A server that does not answer within
|
|
80
82
|
* DELAI_MS throws `ServeurMuet`, which its caller tells from a repository without circuits and
|
|
81
83
|
* from any other fault, thrown as it is; a client not built throws `ClientNonConstruit`.
|
|
82
84
|
* @param {string} racine
|
|
85
|
+
* @param {{ integres?: boolean }} [options]
|
|
83
86
|
*/
|
|
84
|
-
export async function circuitsDuServeur(racine) {
|
|
87
|
+
export async function circuitsDuServeur(racine, options = {}) {
|
|
85
88
|
if (!existsSync(CONSTRUIT)) {
|
|
86
89
|
throw new ClientNonConstruit();
|
|
87
90
|
}
|
|
@@ -91,7 +94,7 @@ export async function circuitsDuServeur(racine) {
|
|
|
91
94
|
const c = ouvrirLeClient();
|
|
92
95
|
try {
|
|
93
96
|
const lus = await c.client.connection.withDeadline(Date.now() + DELAI_MS, () =>
|
|
94
|
-
lireLesCircuits(c.client, racine)
|
|
97
|
+
lireLesCircuits(c.client, racine, options)
|
|
95
98
|
);
|
|
96
99
|
return avecLeurAvancement(racine, lus).map(x => ({
|
|
97
100
|
...x,
|
|
@@ -103,3 +106,34 @@ export async function circuitsDuServeur(racine) {
|
|
|
103
106
|
await c.fermer();
|
|
104
107
|
}
|
|
105
108
|
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The night under way on the machine, read by the query of the workflow of the nights
|
|
112
|
+
* (src/temporal/nuits/client.ts `lireLesNuits`) under <env>: `{ racine, depuis }`, its project's
|
|
113
|
+
* root and when it started (null from a worker that does not give it), or null without one. Where
|
|
114
|
+
* the server of the machine is not read (`surLeServeur`: the CI, an agent's envelope, a trial
|
|
115
|
+
* machine without its server), null without a call. A reading that fails throws, as
|
|
116
|
+
* `circuitsDuServeur` does; the board shows no night then.
|
|
117
|
+
* @param {Record<string, string | undefined>} [env]
|
|
118
|
+
* @returns {Promise<{ racine: string, depuis: number | null } | null>}
|
|
119
|
+
*/
|
|
120
|
+
export async function nuitDuServeur(env = process.env) {
|
|
121
|
+
const e = surLeServeur(env);
|
|
122
|
+
if (!e) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (!existsSync(CONSTRUIT)) {
|
|
126
|
+
throw new ClientNonConstruit();
|
|
127
|
+
}
|
|
128
|
+
const { ouvrirLeClient } = await import('../dist/temporal/client.js');
|
|
129
|
+
const { lireLesNuits } = await import('../dist/temporal/nuits/client.js');
|
|
130
|
+
const c = ouvrirLeClient({ adresse: e.TEMPORAL_ADDRESS || undefined });
|
|
131
|
+
try {
|
|
132
|
+
const vue = await c.client.connection.withDeadline(Date.now() + DELAI_MS, () =>
|
|
133
|
+
lireLesNuits(c.client)
|
|
134
|
+
);
|
|
135
|
+
return vue.enCours ? { racine: vue.enCours, depuis: vue.depuis ?? null } : null;
|
|
136
|
+
} finally {
|
|
137
|
+
await c.fermer();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
// (scripts/dernier-vert.mjs) is kept by the one pass of the verification, once, when every task
|
|
26
26
|
// of every language of the graph is green (scripts/langages/typescript/verifier.mjs). A module
|
|
27
27
|
// that plays after a red one gets `PASSE_ROUGE` in its environment: that pass keeps none.
|
|
28
|
-
// - `verifier`: the module of package.json passes over the whole graph (every task
|
|
29
|
-
// language, once); the others
|
|
30
|
-
// `deny check` alone), so that nextest
|
|
28
|
+
// - `verifier`: the module of package.json plays last, and passes over the whole graph (every task
|
|
29
|
+
// of every language, once); the others play before it in their declared order and get
|
|
30
|
+
// `GRAPHE_JOUE` and play no task of it again (cargo: its `deny check` alone), so that nextest
|
|
31
|
+
// and pytest play once.
|
|
31
32
|
// - The exit code: 0 when every module is green, 75 when the only reds are « à repasser », else the
|
|
32
33
|
// first other code; 128 plus the number of a signal that ended a module.
|
|
33
34
|
import { spawnSync } from 'node:child_process';
|
|
@@ -126,7 +127,13 @@ export function jouer(
|
|
|
126
127
|
// keeps no green then.
|
|
127
128
|
const codes = [];
|
|
128
129
|
const duGraphe = r.parts.find(x => x.module.manifeste === 'package.json')?.module;
|
|
129
|
-
|
|
130
|
+
// `verifier`: the module of the graph plays last, so that its pass, the one that keeps the last
|
|
131
|
+
// green, knows the verdict of every other module; the others keep their relative order.
|
|
132
|
+
const ordre =
|
|
133
|
+
nom === 'verifier' && duGraphe
|
|
134
|
+
? [...r.parts.filter(x => x.module !== duGraphe), ...r.parts.filter(x => x.module === duGraphe)]
|
|
135
|
+
: r.parts;
|
|
136
|
+
for (const { module, args: siens } of ordre) {
|
|
130
137
|
const c = module.commandes(racine)[nom];
|
|
131
138
|
dire(`▶ ${module.nom} : ${nom}`);
|
|
132
139
|
const rouge = codes.some(x => x !== 0);
|
|
@@ -35,14 +35,18 @@
|
|
|
35
35
|
// progress that do not read, or not within a minute, hold every copy: none is removed. They are
|
|
36
36
|
// read only when a copy is left to judge: a repository with no copy but the night's calls no bd.
|
|
37
37
|
// A locked copy (`git worktree lock`, as Claude Code locks the copy of a live agent) stays too.
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
38
|
+
// The owner of a `<copie>.travail` is the circuit the Temporal server holds, as it runs or waits
|
|
39
|
+
// an answer (its caller gives their tickets, `tenus`), as `git worktree prune` removes what no
|
|
40
|
+
// owner holds. A copy whose circuit the server no longer holds, its ticket still open, stays,
|
|
41
|
+
// its code and commits untouched, and its line says so with the place it holds and that of each
|
|
42
|
+
// of its tools' outputs (« son circuit ne tourne plus ; target y tient 5,1 Go ; son code et ses
|
|
43
|
+
// commits restent »): 5.2 GB of SyntHub's SH-cgi.8.2 were kept so under the words of a running
|
|
44
|
+
// circuit (grillhouse-k5y). Its ticket closed (delivered directly, or its circuit stopped), its
|
|
45
|
+
// `.travail` holds it no more: no circuit will remove it (grillhouse-4nr.29: 9 copies, 4.3 GB,
|
|
46
|
+
// kept so), and the copy is judged as any other; removed, its `.travail` goes with it, its
|
|
47
|
+
// balance (`<ticket>.bilan.json`) kept. Without the circuits the server holds (the server
|
|
48
|
+
// unread, or the end of a circuit, whose act reads no server), its line says only that its
|
|
49
|
+
// circuit has its working directory.
|
|
46
50
|
// - The count of what holds the disk of a copy (`occupantsDesCopies`), which the wait for room of
|
|
47
51
|
// a heavy pass names (scripts/verrou-de-machine.mjs): the copies of its repository, the five
|
|
48
52
|
// largest first, each with its ticket (the copy's folder, but the frame's copies that last and
|
|
@@ -128,14 +132,17 @@ function lesCopies(racine) {
|
|
|
128
132
|
}));
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
// What holds the copy <chemin> for a
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
// its
|
|
135
|
-
|
|
135
|
+
// What holds the copy <chemin> for a circuit or a live process (its lock), or null. <tenus> names
|
|
136
|
+
// the tickets whose circuit the server holds (it runs, or waits an answer), null when unread. A
|
|
137
|
+
// copy beside its `.travail` whose ticket is out of <tenus> and closed (<fermes>, read once) is
|
|
138
|
+
// held by its `.travail` no more: no circuit will ever remove it, and the copy is judged as any
|
|
139
|
+
// other. Its ticket open, it stays held, and its line names the place its tools' outputs
|
|
140
|
+
// (<ignorer>) hold there.
|
|
141
|
+
function tenue({ chemin, verrou: raison }, enCours, commun, ignorer, tenus, fermes) {
|
|
136
142
|
const nom = path.basename(chemin);
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
const sansCircuit = Boolean(tenus) && !tenus.has(nom);
|
|
144
|
+
if (existsSync(`${chemin}.travail`) && !(sansCircuit && fermes().has(nom))) {
|
|
145
|
+
if (sansCircuit) {
|
|
139
146
|
const sorties = placeDesSorties(chemin, ignorer).map(s => ` ; ${s}`);
|
|
140
147
|
return `son circuit ne tourne plus${sorties.join('')} ; son code et ses commits restent`;
|
|
141
148
|
}
|
|
@@ -336,17 +343,19 @@ function elaguer(chemin, ignorer) {
|
|
|
336
343
|
* wrote there (<ignorer>, the directories the module of the language names, and `node_modules`).
|
|
337
344
|
* <elaguer> names copies left out too, whose owner has played its pass (the night's own): each
|
|
338
345
|
* loses its tools' outputs, its install kept; so does a copy of the integration or of the queue
|
|
339
|
-
* kept that no lock holds. <
|
|
340
|
-
* (null when its caller does not read them): a copy beside its
|
|
341
|
-
*
|
|
346
|
+
* kept that no lock holds. <tenus> names the tickets whose circuit the Temporal server holds, as
|
|
347
|
+
* it runs or waits an answer (null when its caller does not read them): a copy beside its
|
|
348
|
+
* `.travail` whose ticket is out of them stays while its ticket is open, its line saying its
|
|
349
|
+
* circuit no longer runs, with the place of its tools' outputs; its ticket closed, it is judged as
|
|
350
|
+
* any other copy and, removed, its `.travail` goes with it.
|
|
342
351
|
* @param {string} racine
|
|
343
352
|
* @param {{ garder?: string[], elaguer?: string[], lireEnCours: () => Set<string> | null,
|
|
344
|
-
* lireFermes: () => Set<string> | null, ignorer: string[],
|
|
353
|
+
* lireFermes: () => Set<string> | null, ignorer: string[], tenus?: Set<string> | null }} o
|
|
345
354
|
* @returns {string[]}
|
|
346
355
|
*/
|
|
347
356
|
export function retirerLesCopiesFinies(
|
|
348
357
|
racine,
|
|
349
|
-
{ garder = [], elaguer: aElaguer = [], lireEnCours, lireFermes, ignorer,
|
|
358
|
+
{ garder = [], elaguer: aElaguer = [], lireEnCours, lireFermes, ignorer, tenus = null }
|
|
350
359
|
) {
|
|
351
360
|
const [principale, ...listees] = lesCopies(racine);
|
|
352
361
|
const ici = reel(racine);
|
|
@@ -381,6 +390,8 @@ export function retirerLesCopiesFinies(
|
|
|
381
390
|
).stdout.trim();
|
|
382
391
|
const copies = lesCopies(racine).slice(1);
|
|
383
392
|
let fermes;
|
|
393
|
+
// The closed tickets, read once, none when they do not read (each copy then stays held).
|
|
394
|
+
const lesFermes = () => (fermes ??= lireFermes() ?? new Set());
|
|
384
395
|
// The line of the copy <chemin> kept for <raison>: what it lost when its ticket is closed, or,
|
|
385
396
|
// for the copy of the integration or of the queue, its tools' outputs, which its next
|
|
386
397
|
// preparation removes; then the place it holds.
|
|
@@ -396,8 +407,7 @@ export function retirerLesCopiesFinies(
|
|
|
396
407
|
: '';
|
|
397
408
|
return `· copie gardée : ${vu(chemin)} (${place(chemin)}) : ${raison}${perte}`;
|
|
398
409
|
}
|
|
399
|
-
|
|
400
|
-
const perdues = fermes.has(nom) ? retirerLesSorties(chemin, ignorer) : [];
|
|
410
|
+
const perdues = lesFermes().has(nom) ? retirerLesSorties(chemin, ignorer) : [];
|
|
401
411
|
const perte = perdues.length ? ` ; son ticket est fermé : ${perdues.join(', ')} retirés` : '';
|
|
402
412
|
return `· copie gardée : ${vu(chemin)} (${place(chemin)}) : ${raison}${perte}`;
|
|
403
413
|
};
|
|
@@ -406,7 +416,7 @@ export function retirerLesCopiesFinies(
|
|
|
406
416
|
if (ecartees.has(reel(chemin))) {
|
|
407
417
|
continue;
|
|
408
418
|
}
|
|
409
|
-
const raison = tenue(copie, enCours, commun, ignorer,
|
|
419
|
+
const raison = tenue(copie, enCours, commun, ignorer, tenus, lesFermes);
|
|
410
420
|
if (raison) {
|
|
411
421
|
lignes.push(`· copie gardée : ${vu(chemin)} (${place(chemin)}) : ${raison}.`);
|
|
412
422
|
continue;
|
|
@@ -422,6 +432,7 @@ export function retirerLesCopiesFinies(
|
|
|
422
432
|
if (lstatSync(lien, { throwIfNoEntry: false })?.isSymbolicLink() && seulLeLien(chemin)) {
|
|
423
433
|
rmSync(lien);
|
|
424
434
|
}
|
|
435
|
+
const travail = existsSync(`${chemin}.travail`);
|
|
425
436
|
const r = lancer(racine, 'bash', [RETIRER, chemin]);
|
|
426
437
|
if (r.status !== 0) {
|
|
427
438
|
const refus = String(r.stderr || r.stdout)
|
|
@@ -431,6 +442,9 @@ export function retirerLesCopiesFinies(
|
|
|
431
442
|
continue;
|
|
432
443
|
}
|
|
433
444
|
let ligne = `✓ copie retirée : ${vu(chemin)}`;
|
|
445
|
+
if (travail) {
|
|
446
|
+
ligne += ` ; son dossier ${path.basename(chemin)}.travail retiré`;
|
|
447
|
+
}
|
|
434
448
|
if (branche && branche !== PRINCIPALE) {
|
|
435
449
|
const tenante = lesCopies(racine).find(c => c.branche === branche);
|
|
436
450
|
if (tenante) {
|
|
@@ -481,17 +495,17 @@ function ignoresDuLangage(racine) {
|
|
|
481
495
|
* The removal of the copies of the repository at <racine> (`retirerLesCopiesFinies`), the copy of
|
|
482
496
|
* the night left out, the copies <finies> left out and pruned, their owner having played its pass
|
|
483
497
|
* in them (the night's own, which scripts/nuit.sh names), the tickets read by bd, the tickets
|
|
484
|
-
* whose circuit
|
|
485
|
-
* tickets (`balayerLesTickets`): what the night and the end of each circuit
|
|
486
|
-
* run. Its lines.
|
|
498
|
+
* whose circuit the server holds <tenus> (null when unread), then of the temporary directories of
|
|
499
|
+
* its closed tickets (`balayerLesTickets`): what the night and the end of each circuit
|
|
500
|
+
* (scripts/circuit.mjs) run. Its lines.
|
|
487
501
|
* @param {string} racine the main tree
|
|
488
502
|
* @param {string[]} [finies]
|
|
489
|
-
* @param {Set<string> | null} [
|
|
503
|
+
* @param {Set<string> | null} [tenus]
|
|
490
504
|
* @returns {string[]}
|
|
491
505
|
*/
|
|
492
|
-
export function retirerLesCopiesDuDepot(racine, finies = [],
|
|
506
|
+
export function retirerLesCopiesDuDepot(racine, finies = [], tenus = null) {
|
|
493
507
|
const lignes = retirerLesCopiesFinies(racine, {
|
|
494
|
-
|
|
508
|
+
tenus,
|
|
495
509
|
garder: [path.join(racine, NUIT)],
|
|
496
510
|
elaguer: finies,
|
|
497
511
|
lireEnCours: () => tickets(racine, 'in_progress'),
|
package/scripts/crochets.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// npx grillhouse hooks --absents [<project>] prints the name of each absent hook, one per line
|
|
8
8
|
//
|
|
9
9
|
// - commit-msg: « un ticket fermé garde sa livraison ; un ticket rouvert reçoit ses corrections » (scripts/un-commit-par-ticket.mjs).
|
|
10
|
-
// - pre-push: the night branch guard (scripts/branche-de-nuit.mjs).
|
|
10
|
+
// - pre-push: the night branch guard and the judged main (scripts/branche-de-nuit.mjs).
|
|
11
11
|
// - A hook lives in the folder git reads for the project (`git rev-parse --git-path hooks`, which
|
|
12
12
|
// follows `core.hooksPath`, Beads' `.beads/hooks` included); `core.hooksPath` is never changed
|
|
13
13
|
// here. The update of the frame (scripts/grillhouse-maj.mjs) places them by the same function.
|
package/scripts/dernier-vert.mjs
CHANGED
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
// removes at its end.
|
|
35
35
|
// - `npm test` measures itself against the last green under the circuit's mark,
|
|
36
36
|
// `GRILLHOUSE_DEPUIS_LE_VERT` (scripts/langages/typescript/tests.mjs, scripts/circuit.mjs); it never keeps one.
|
|
37
|
+
// - The circuit's passes, in a project whose CI runs on a ticket's branch, measure themselves
|
|
38
|
+
// against the base of their lot (`lot`, the variable `GRILLHOUSE_BASE_DU_LOT` that the circuit
|
|
39
|
+
// gives to `npm test` and `npm run verifier`): the copy's HEAD, which main reached green by that
|
|
40
|
+
// CI, as Google's presubmit plays the tests a change affects. Their changes carry the mark
|
|
41
|
+
// `cible`: each package plays the tests Vitest relates to them, a file out of its graph playing
|
|
42
|
+
// neither the whole package nor the tests that read it by its path
|
|
43
|
+
// (scripts/langages/typescript/vitest-config/changements.mjs); the complete pass is the CI's and
|
|
44
|
+
// the night's. Such a pass keeps no green.
|
|
37
45
|
// - Only the measure of the changed files and the keeping of the green live here: the files go to
|
|
38
46
|
// `vitest --changed`, and no module of language chooses the packages it plays by the last green
|
|
39
47
|
// (the tests of a crate or a Python project are tasks of Turborepo, which its cache selects).
|
|
@@ -56,6 +64,9 @@ import path from 'node:path';
|
|
|
56
64
|
// tests of the module of the language reads in each package.
|
|
57
65
|
export const CHANGEMENTS = 'GRILLHOUSE_CHANGEMENTS';
|
|
58
66
|
export const DEPUIS_LE_VERT = 'GRILLHOUSE_DEPUIS_LE_VERT';
|
|
67
|
+
// The variable that gives a pass of the circuit the base of its lot, against which it measures
|
|
68
|
+
// itself, targeted.
|
|
69
|
+
export const BASE_DU_LOT = 'GRILLHOUSE_BASE_DU_LOT';
|
|
59
70
|
const SHA = /^[0-9a-f]{40,64}$/;
|
|
60
71
|
|
|
61
72
|
const git = (racine, args, env = process.env) =>
|
|
@@ -244,10 +255,11 @@ function supprimesDuCommit(racine, commit, arbre) {
|
|
|
244
255
|
// What a pass in <racine> measures itself against: `{ etat, env, ligne, retirer }`, the state to
|
|
245
256
|
// keep once green (null when none can count), the variables to add to the pass's environment (the
|
|
246
257
|
// changes since the last green, none for a complete pass), the line that says which, and the
|
|
247
|
-
// function that removes the file of the changes. <tout> asks for the complete pass;
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
|
|
258
|
+
// function that removes the file of the changes. <tout> asks for the complete pass; <base>, a base
|
|
259
|
+
// given (`verifier --base`); <lot>, the base of a lot of the circuit, measured targeted (`cible`),
|
|
260
|
+
// <base> taking precedence; the file lies in <dans>, the base of the pass
|
|
261
|
+
// (scripts/mesure/base-de-passe.mjs), which a killed pass leaves to the next one to sweep.
|
|
262
|
+
export function mesure(racine, { tout = false, base, lot, dans = os.tmpdir() } = {}) {
|
|
251
263
|
const etat = etatDuDepot(racine);
|
|
252
264
|
const complete = raison => ({
|
|
253
265
|
etat: etat.raison ? null : etat,
|
|
@@ -261,8 +273,10 @@ export function mesure(racine, { tout = false, base, dans = os.tmpdir() } = {})
|
|
|
261
273
|
if (tout) {
|
|
262
274
|
return complete('demandée');
|
|
263
275
|
}
|
|
264
|
-
// A base given takes precedence over the last green: the pass keeps no
|
|
265
|
-
|
|
276
|
+
// A base given, or the base of a lot, takes precedence over the last green: the pass keeps no
|
|
277
|
+
// green of its own.
|
|
278
|
+
const cible = base === undefined && Boolean(lot);
|
|
279
|
+
const donnee = base !== undefined ? lireLaBase(etat, base) : cible ? lireLaBase(etat, lot) : null;
|
|
266
280
|
if (donnee?.raison) {
|
|
267
281
|
return complete(donnee.raison);
|
|
268
282
|
}
|
|
@@ -288,15 +302,22 @@ export function mesure(racine, { tout = false, base, dans = os.tmpdir() } = {})
|
|
|
288
302
|
const fichier = path.join(dir, 'changements.json');
|
|
289
303
|
writeFileSync(
|
|
290
304
|
fichier,
|
|
291
|
-
JSON.stringify({
|
|
305
|
+
JSON.stringify({
|
|
306
|
+
racine: etat.racine,
|
|
307
|
+
fichiers: ch.fichiers,
|
|
308
|
+
supprimes: ch.supprimes,
|
|
309
|
+
...(cible ? { cible: true } : {}),
|
|
310
|
+
})
|
|
292
311
|
);
|
|
293
312
|
const n = ch.fichiers.length + ch.supprimes.length;
|
|
294
313
|
return {
|
|
295
314
|
etat: donnee ? null : etat,
|
|
296
315
|
env: { [CHANGEMENTS]: fichier },
|
|
297
|
-
ligne:
|
|
298
|
-
? `↳ depuis la base ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`
|
|
299
|
-
:
|
|
316
|
+
ligne: cible
|
|
317
|
+
? `↳ depuis la base du lot ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent, la passe complète à la CI de la branche et à la nuit.`
|
|
318
|
+
: donnee
|
|
319
|
+
? `↳ depuis la base ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`
|
|
320
|
+
: `↳ depuis le dernier vert de ${vert.branche} (${vert.commit.slice(0, 12)}, arbre ${vert.arbre.slice(0, 12)}) : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`,
|
|
300
321
|
retirer: () => rmSync(dir, { recursive: true, force: true }),
|
|
301
322
|
};
|
|
302
323
|
}
|