@roomi-fields/grillhouse 0.33.1 → 0.34.1
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 +81 -0
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/acte.d.ts +7 -0
- package/dist/temporal/acte.js +19 -2
- package/dist/temporal/acte.js.map +1 -1
- 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 +7 -0
- package/dist/temporal/circuit/client.js +20 -0
- 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 +19 -0
- package/dist/temporal/circuit/contrat.js +2 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +86 -11
- package/dist/temporal/circuit/deroule.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/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 +225 -57
- package/docs/CADRE.md +6 -1
- package/docs/INTERFACE.md +24 -8
- package/hooks/crochet.mjs +17 -2
- package/hooks/hooks.json +24 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +77 -14
- 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/ci-des-branches.mjs +4 -2
- package/scripts/circuit.mjs +57 -4
- package/scripts/circuits-du-serveur.mjs +34 -1
- package/scripts/commandes-composees.mjs +11 -4
- package/scripts/copies-finies.mjs +43 -29
- package/scripts/crochets.mjs +1 -1
- 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/etapes.mjs +6 -4
- 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 +308 -10
- package/scripts/jointure.d.ts +41 -2
- package/scripts/langages/cargo/commandes.mjs +81 -12
- 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 +14 -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 +92 -0
- package/scripts/langages/typescript/tests.mjs +1 -1
- package/scripts/langages/typescript/verdict.mjs +4 -60
- package/scripts/langages/typescript/verifier.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/changements.mjs +12 -7
- 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 +179 -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 +1 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +235 -56
- package/scripts/tableau.mjs +468 -267
- package/scripts/taches-du-graphe.mjs +49 -8
- 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 +18 -15
- 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
|
}
|
|
@@ -58,7 +58,8 @@ function principale(racine) {
|
|
|
58
58
|
/**
|
|
59
59
|
* `agent/**` added to the push of the CI of the lots of the project at <racine>: the workflows
|
|
60
60
|
* written, none when the project already listens or has no workflow that runs on a push to main
|
|
61
|
-
* with a list of branches to add it to.
|
|
61
|
+
* with a list of branches to add it to. A workflow filtered on paths (a documentation published
|
|
62
|
+
* when its sources change) is no CI of the lots, and is left.
|
|
62
63
|
*/
|
|
63
64
|
export function ajouterLesBranchesDeTicket(racine) {
|
|
64
65
|
const flux = lesFlux(racine);
|
|
@@ -70,7 +71,8 @@ export function ajouterLesBranchesDeTicket(racine) {
|
|
|
70
71
|
for (const { chemin, texte } of flux.filter(f => surMain.has(f.chemin))) {
|
|
71
72
|
const doc = parseDocument(texte);
|
|
72
73
|
const branches = doc.getIn(['on', 'push', 'branches'], true);
|
|
73
|
-
|
|
74
|
+
const chemins = ['paths', 'paths-ignore'].some(c => doc.hasIn(['on', 'push', c]));
|
|
75
|
+
if (chemins || !branches || typeof branches.add !== 'function') {
|
|
74
76
|
continue;
|
|
75
77
|
}
|
|
76
78
|
branches.add(doc.createNode(BRANCHES_DE_TICKET));
|
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
|
/**
|
|
@@ -104,3 +106,34 @@ export async function circuitsDuServeur(racine, options = {}) {
|
|
|
104
106
|
await c.fermer();
|
|
105
107
|
}
|
|
106
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/dette.mjs
CHANGED
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
30
30
|
import path from 'node:path';
|
|
31
31
|
import { pathToFileURL } from 'node:url';
|
|
32
|
-
import { A_ELAGUER, ecrireSarif } from './resultats.mjs';
|
|
32
|
+
import { A_ELAGUER, A_INSCRIRE, ecrireSarif } from './resultats.mjs';
|
|
33
|
+
|
|
34
|
+
// The environment variable that names the guards of the lot's base (main), a JSON list.
|
|
35
|
+
export const BASE = 'GRILLHOUSE_GARDES_DE_LA_BASE';
|
|
33
36
|
|
|
34
37
|
export const FICHIER = 'grillhouse-dette.json';
|
|
35
38
|
// The environment variable that names the mode of a run: `inscrire` or `elaguer`.
|
|
@@ -158,10 +161,50 @@ export function trancher(racine, garde, constats, mode = process.env[MODE] || un
|
|
|
158
161
|
trouve: c.trouve,
|
|
159
162
|
message: `${c.trouve} constat(s) pour ${c.inscrit} inscrit(s) dans ${FICHIER} : la dette s'abaisse.`,
|
|
160
163
|
}));
|
|
161
|
-
|
|
164
|
+
const lEnv = env ?? process.env;
|
|
165
|
+
ecrireSarif({
|
|
166
|
+
garde,
|
|
167
|
+
constats: [...refus, ...notes, ...aInscrire(garde, refus, lEnv)],
|
|
168
|
+
racine,
|
|
169
|
+
env: lEnv,
|
|
170
|
+
});
|
|
162
171
|
return { refus, lignes };
|
|
163
172
|
}
|
|
164
173
|
|
|
174
|
+
// The guards of the lot's base (main), a JSON list of names the circuit gives the run; undefined
|
|
175
|
+
// without it (a project's run) or when it is not a list.
|
|
176
|
+
function gardesDeLaBase(env) {
|
|
177
|
+
try {
|
|
178
|
+
const l = JSON.parse(env[BASE] ?? 'null');
|
|
179
|
+
return Array.isArray(l) ? l : undefined;
|
|
180
|
+
} catch {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// The notes « to inscribe » of <garde> when the base does not hold it: one per file and rule of
|
|
186
|
+
// its refusals, with its count. None for a guard of main, nor without a base to compare with.
|
|
187
|
+
function aInscrire(garde, refus, env) {
|
|
188
|
+
const base = gardesDeLaBase(env);
|
|
189
|
+
if (!base || base.includes(garde)) {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
const out = [];
|
|
193
|
+
for (const [fichier, regles] of compter(refus)) {
|
|
194
|
+
for (const [regle, trouve] of regles) {
|
|
195
|
+
out.push({
|
|
196
|
+
fichier,
|
|
197
|
+
regle,
|
|
198
|
+
niveau: 'note',
|
|
199
|
+
genre: A_INSCRIRE,
|
|
200
|
+
trouve,
|
|
201
|
+
message: `${trouve} constat(s) d'une garde que le lot ajoute : la dette de ${garde} s'inscrit dans ${FICHIER}.`,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
|
|
165
208
|
// Writes <dette> at <racine>, its guards sorted.
|
|
166
209
|
function ecrire(racine, dette) {
|
|
167
210
|
const triee = Object.fromEntries(
|
|
@@ -176,10 +219,18 @@ function ecrire(racine, dette) {
|
|
|
176
219
|
// `a-elaguer` of a pass, scripts/resultats.mjs): each key named comes down to what its guard
|
|
177
220
|
// found, and leaves at zero; a count never rises, no key is added. Written when it changes;
|
|
178
221
|
// returns whether it did.
|
|
179
|
-
function abaisser(racine, notes) {
|
|
222
|
+
export function abaisser(racine, notes) {
|
|
180
223
|
const avant = lire(racine);
|
|
181
224
|
const dette = JSON.parse(JSON.stringify(avant));
|
|
182
|
-
for (const { garde, fichier, regle, trouve } of notes) {
|
|
225
|
+
for (const { garde, fichier, regle, trouve, genre } of notes) {
|
|
226
|
+
if (genre === A_INSCRIRE) {
|
|
227
|
+
if (fichier && regle && Number.isInteger(trouve) && trouve > 0) {
|
|
228
|
+
dette[garde] ??= {};
|
|
229
|
+
dette[garde][fichier] ??= {};
|
|
230
|
+
dette[garde][fichier][regle] = { count: trouve };
|
|
231
|
+
}
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
183
234
|
const parRegle = dette[garde]?.[fichier];
|
|
184
235
|
const cle = parRegle?.[regle];
|
|
185
236
|
if (!cle || !Number.isInteger(trouve) || trouve >= cle.count) {
|