@roomi-fields/grillhouse 0.48.0 → 0.49.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 +90 -0
- package/agents/direct.md +9 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +11 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +15 -6
- package/cadre/templates/projet/CLAUDE.md +10 -6
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/turbo/paquets.json +3 -1
- package/cadre/templates/turbo/sans-paquets.json +3 -1
- package/charte.md +51 -14
- package/dist/temporal/acte.d.ts +9 -0
- package/dist/temporal/acte.js +43 -20
- package/dist/temporal/acte.js.map +1 -1
- package/dist/temporal/circuit/appel.d.ts +4 -1
- package/dist/temporal/circuit/appel.js +15 -1
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +7 -1
- package/dist/temporal/circuit/client.js +54 -1
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +30 -57
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +2 -1
- package/dist/temporal/circuit/contrat.js +2 -1
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +9 -2
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +16 -2
- package/dist/temporal/file/contrat.js +27 -3
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.js +4 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +1 -15
- package/dist/temporal/nuits/activites.js +3 -62
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +3 -21
- package/dist/temporal/nuits/deroule.js +38 -74
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +3 -16
- package/dist/temporal/places/client.js +3 -26
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +15 -51
- package/dist/temporal/places/contrat.js +3 -13
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +11 -61
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.js +4 -2
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +2 -1
- package/docs/ARCHITECTURE.md +337 -120
- package/docs/CADRE.md +16 -13
- package/docs/INTERFACE.md +90 -25
- package/hooks/hooks.json +9 -0
- package/hooks/register.tsx +59 -5
- package/package.json +1 -1
- package/scripts/activites.mjs +271 -42
- package/scripts/aiguillage.mjs +4 -1
- package/scripts/bilan.mjs +125 -2
- package/scripts/circuit.mjs +233 -159
- package/scripts/circuits-cles.d.mts +3 -3
- package/scripts/circuits-cles.mjs +6 -5
- package/scripts/coeurs-dedies.mjs +4 -4
- package/scripts/commandes-composees.mjs +12 -5
- package/scripts/dette.d.ts +2 -1
- package/scripts/dette.mjs +49 -6
- package/scripts/direct.mjs +343 -0
- package/scripts/droits.mjs +26 -4
- package/scripts/effets.mjs +4 -4
- package/scripts/engendres.mjs +2 -1
- package/scripts/enveloppe/enveloppe.mjs +119 -18
- package/scripts/enveloppe/lancer.sh +14 -3
- package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
- package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
- package/scripts/etapes.mjs +3 -3
- package/scripts/faits-du-circuit.mjs +12 -11
- package/scripts/fermeture-de-la-machine.d.mts +4 -4
- package/scripts/fermeture-de-la-machine.mjs +10 -20
- package/scripts/fichiers-nommes.mjs +27 -1
- package/scripts/file-des-tickets.d.mts +18 -1
- package/scripts/file-des-tickets.mjs +63 -15
- package/scripts/flux-de-la-nuit.mjs +38 -0
- package/scripts/grillhouse-maj.mjs +13 -25
- package/scripts/groupe-cles.d.mts +6 -0
- package/scripts/groupe-cles.mjs +29 -1
- package/scripts/integration/file.mjs +148 -37
- package/scripts/jointure.d.ts +20 -3
- package/scripts/journal-des-etats.d.mts +16 -0
- package/scripts/journal-des-etats.mjs +44 -2
- package/scripts/journal.mjs +3 -0
- package/scripts/langages/c/commandes.mjs +5 -5
- package/scripts/langages/c/composants.mjs +13 -5
- package/scripts/langages/cargo/commandes.mjs +5 -6
- package/scripts/langages/python/commandes.mjs +5 -5
- package/scripts/langages/python/composants.mjs +10 -2
- package/scripts/langages/typescript/composants.mjs +10 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +15 -3
- package/scripts/langages/typescript/construire.mjs +2 -0
- package/scripts/langages/typescript/exemples.mjs +33 -1
- package/scripts/langages/typescript/index.mjs +19 -0
- package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +158 -32
- package/scripts/langages/typescript/tests-du-poste.mjs +112 -32
- package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
- package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
- package/scripts/langages/typescript/verifier.mjs +3 -5
- package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
- package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
- package/scripts/machine.mjs +1 -1
- package/scripts/mesure/base-de-passe.mjs +2 -1
- package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/nuit.sh +129 -3
- package/scripts/paquet.mjs +16 -5
- package/scripts/paquets.d.ts +4 -0
- package/scripts/paquets.mjs +57 -0
- package/scripts/passe-de-la-machine.mjs +4 -7
- package/scripts/places-de-la-machine.mjs +55 -42
- package/scripts/places-du-serveur.mjs +2 -2
- package/scripts/plafond-de-la-machine.d.mts +7 -13
- package/scripts/plafond-de-la-machine.mjs +19 -35
- package/scripts/prefixe-des-tickets.mjs +1 -1
- package/scripts/references-changees.mjs +159 -0
- package/scripts/regles-des-places.d.mts +8 -31
- package/scripts/regles-des-places.mjs +14 -64
- package/scripts/repli-de-la-nuit.mjs +183 -0
- package/scripts/reponses-du-circuit.d.mts +2 -2
- package/scripts/reponses-du-circuit.mjs +21 -12
- package/scripts/reprise.mjs +27 -8
- package/scripts/resultats.mjs +21 -9
- package/scripts/seances.mjs +258 -40
- package/scripts/services-du-noyau.mjs +4 -0
- package/scripts/sous-commandes.mjs +24 -7
- package/scripts/superviseur.mjs +185 -39
- package/scripts/tableau.mjs +226 -94
- package/scripts/taches-du-graphe.mjs +84 -4
- package/scripts/ticket.mjs +348 -0
- package/scripts/transitions.d.mts +44 -0
- package/scripts/transitions.mjs +188 -17
- package/scripts/un-commit-par-ticket.mjs +4 -3
- package/scripts/verdict-de-la-nuit.mjs +47 -20
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
- package/scripts/verrous/verrou.mjs +17 -1
- package/skills/architecte/SKILL.md +203 -0
- package/skills/architecte/references/exemple-d-architecture.md +159 -0
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/direct/SKILL.md +57 -0
- package/skills/explorateur/SKILL.md +10 -6
- package/skills/pitmaster/SKILL.md +37 -14
- package/skills/pitmaster/references/consigne-agent.md +7 -1
- package/skills/redacteur/references/documents-d-un-composant.md +2 -1
- package/skills/relecteur/SKILL.md +8 -0
- package/skills/testwriter/SKILL.md +10 -0
- package/scripts/ticket.sh +0 -25
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// What the Nuit flow of a project plays (`.github/workflows/nuit.yml`), read from the flow's own
|
|
2
|
+
// commands and never from a word of it: the night of the poste (scripts/nuit.sh) leaves the flow
|
|
3
|
+
// what the flow declares it plays, and plays the rest (the frame's charter, « Une mesure de temps
|
|
4
|
+
// joue la nuit »: the measures of time play on dedicated cores, which a shared flow lacks unless it
|
|
5
|
+
// declares a job that plays them).
|
|
6
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
/** The path of the Nuit flow in a copy. */
|
|
11
|
+
export const FLUX_DE_LA_NUIT = '.github/workflows/nuit.yml';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether the flow written in <texte> plays the measures of time: one of its commands (a line that
|
|
15
|
+
* is not a comment) runs `tests-de-nuit` with `--mesures`.
|
|
16
|
+
* @param {string} texte
|
|
17
|
+
*/
|
|
18
|
+
export function leFluxJoueLesMesures(texte) {
|
|
19
|
+
return texte
|
|
20
|
+
.split('\n')
|
|
21
|
+
.filter(ligne => !ligne.trim().startsWith('#'))
|
|
22
|
+
.some(ligne => /\btests-de-nuit\b.*(?:^|\s)--mesures(?:\s|$)/.test(ligne));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether the Nuit flow of the copy at <racine> plays the measures of time; false without a flow.
|
|
27
|
+
* @param {string} racine
|
|
28
|
+
*/
|
|
29
|
+
export function fluxDuProjetJoueLesMesures(racine) {
|
|
30
|
+
const f = path.join(racine, FLUX_DE_LA_NUIT);
|
|
31
|
+
return existsSync(f) && leFluxJoueLesMesures(readFileSync(f, 'utf8'));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// node flux-de-la-nuit.mjs mesures <copie> exit 0 when the flow of the copy plays the measures
|
|
35
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
|
|
36
|
+
const [commande, copie] = process.argv.slice(2);
|
|
37
|
+
process.exitCode = commande === 'mesures' && copie && fluxDuProjetJoueLesMesures(copie) ? 0 : 1;
|
|
38
|
+
}
|
|
@@ -123,10 +123,11 @@
|
|
|
123
123
|
// as `npm install` brings what is installed to what is declared. A plugin that cannot be
|
|
124
124
|
// installed, or a mod left at another version, has its line naming the command to type; the
|
|
125
125
|
// update has finished its files, and the exit code is non-zero.
|
|
126
|
-
// - The group: when the package.json declares `grillhouse.groupe`
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
126
|
+
// - The group: when the package.json of the main tree of the project declares `grillhouse.groupe`
|
|
127
|
+
// (`groupeDe` of scripts/groupe-cles.mjs: the update launched in a copy of work reads the same
|
|
128
|
+
// group), the update sets in the Beads of the project each other project of the group as an
|
|
129
|
+
// `external_projects.<name>` (its path relative to the main tree), the ones already set left
|
|
130
|
+
// alone; a group badly declared is refused by its key before any work.
|
|
130
131
|
// - The generated files: after the package.json, each generator of the declared language
|
|
131
132
|
// (`miseAJour.generateurs` of its module) is run in the project by the project's command
|
|
132
133
|
// (`node_modules/.bin/grillhouse`, its installed package) for the file it writes when the project
|
|
@@ -161,8 +162,9 @@ import { poserCrochets } from './crochets.mjs';
|
|
|
161
162
|
import { ATTRIBUT } from './fusion-du-changelog.mjs';
|
|
162
163
|
import { fluxSansEntree } from './flux-des-paquets.mjs';
|
|
163
164
|
import { installerGreffons } from './greffons.mjs';
|
|
164
|
-
import {
|
|
165
|
+
import { groupeDe, projetsExternes } from './groupe-cles.mjs';
|
|
165
166
|
import { migrer, restesAuProjet } from './migrations.mjs';
|
|
167
|
+
import { arbrePrincipal } from './outils-cles.mjs';
|
|
166
168
|
import { langageDe, langagesDe } from './langages.mjs';
|
|
167
169
|
import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
|
|
168
170
|
import { CONFIG_BEADS, ecrireLePrefixe, prefixe, prefixeDuStore } from './prefixe-des-tickets.mjs';
|
|
@@ -343,30 +345,15 @@ export function versionDuProjet(projet) {
|
|
|
343
345
|
const jouerBd = (args, cwd) =>
|
|
344
346
|
spawnSync('bd', args, { cwd, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
|
|
345
347
|
|
|
346
|
-
// The group the package.json of <projet> declares (null without it); a fault throws, naming its
|
|
347
|
-
// key (`grillhouse.groupe`) and its value.
|
|
348
|
-
function lireDuGroupe(projet) {
|
|
349
|
-
const pkg = path.join(projet, 'package.json');
|
|
350
|
-
if (!existsSync(pkg)) {
|
|
351
|
-
return null;
|
|
352
|
-
}
|
|
353
|
-
const { groupe, fautes } = lireGroupe(lireJson(pkg, {}), projet);
|
|
354
|
-
if (fautes.length > 0) {
|
|
355
|
-
throw new Error(
|
|
356
|
-
`⛔ ${fautes.map(f => `${f.cle} vaut ${f.valeur}, pas un chemin de projet existant, une fois`).join(' ; ')}.`
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
return groupe;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
348
|
// The `external_projects` of the Beads of <projet>: the other projects of its <groupe>, each by its
|
|
363
|
-
// name and its path relative to <projet> (`projetsExternes`)
|
|
349
|
+
// name and its path relative to the main tree of <projet> (`projetsExternes`), which a copy shares
|
|
350
|
+
// with it; those it sets, by name (none when already set).
|
|
364
351
|
function poserLesProjetsExternes(projet, groupe, bd) {
|
|
365
352
|
if (groupe === null) {
|
|
366
353
|
return [];
|
|
367
354
|
}
|
|
368
355
|
const poses = [];
|
|
369
|
-
for (const [nom, chemin] of Object.entries(projetsExternes(groupe, projet))) {
|
|
356
|
+
for (const [nom, chemin] of Object.entries(projetsExternes(groupe, arbrePrincipal(projet)))) {
|
|
370
357
|
const cle = `external_projects.${nom}`;
|
|
371
358
|
const lu = bd(['config', 'get', cle], projet);
|
|
372
359
|
if (lu.status === 0 && `${lu.stdout ?? ''}`.trim() === chemin) {
|
|
@@ -399,8 +386,9 @@ function cleActive(projet) {
|
|
|
399
386
|
* none, the project keeping its own). Returns what changed.
|
|
400
387
|
*/
|
|
401
388
|
export function mettreAJour(projet, source, { inscrite = VERSION, bd = jouerBd } = {}) {
|
|
402
|
-
// The group
|
|
403
|
-
|
|
389
|
+
// The group the project declares, read in its main tree (`groupeDe`), refused by its key before
|
|
390
|
+
// any work.
|
|
391
|
+
const groupe = groupeDe(projet);
|
|
404
392
|
const bilan = {
|
|
405
393
|
projetsExternes: [],
|
|
406
394
|
dependances: [],
|
|
@@ -18,6 +18,12 @@ export function lireGroupe(
|
|
|
18
18
|
racine: string
|
|
19
19
|
): { groupe: GroupeDeclare | null; fautes: Array<{ cle: string; valeur: string }> };
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* The group of the project that holds <dir> (its main tree or a copy), read in the package.json of
|
|
23
|
+
* its main tree; null without the key. Throws the faults of the key.
|
|
24
|
+
*/
|
|
25
|
+
export function groupeDe(dir: string): GroupeDeclare | null;
|
|
26
|
+
|
|
21
27
|
/** The `external_projects` of the Beads of the project at <racine>: the other projects of its group. */
|
|
22
28
|
export function projetsExternes(
|
|
23
29
|
groupe: { projets: ProjetDuGroupe[] },
|
package/scripts/groupe-cles.mjs
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
// `grillhouse maj` writes the other projects of the group as the `external_projects` of the Beads
|
|
6
6
|
// of each (`bd ship` and `external:<project>:<capability>` dependencies resolve through them).
|
|
7
7
|
// Any other value is a fault, named by its key before any work.
|
|
8
|
+
// The key is the project's: `groupeDe` reads it in the package.json of the main tree of the
|
|
9
|
+
// repository, never of a copy, and resolves its relative paths from that tree, so that a command
|
|
10
|
+
// launched in a copy of work reads the same group as one launched in the main tree.
|
|
8
11
|
import { createHash } from 'node:crypto';
|
|
9
|
-
import { existsSync } from 'node:fs';
|
|
12
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
10
13
|
import path from 'node:path';
|
|
14
|
+
import { arbrePrincipal } from './outils-cles.mjs';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* The group a package.json <pkg> declares, read from the project at <racine>.
|
|
@@ -58,6 +62,30 @@ export function lireGroupe(pkg, racine) {
|
|
|
58
62
|
return { groupe: { id, projets }, fautes: [] };
|
|
59
63
|
}
|
|
60
64
|
|
|
65
|
+
/**
|
|
66
|
+
* The group of the project that holds <dir>, from the package.json of its main tree, its relative
|
|
67
|
+
* paths resolved from that tree; null without the key, or without a package.json that reads.
|
|
68
|
+
* @param {string} dir a directory of the project: its main tree or a copy
|
|
69
|
+
* @returns {{ id: string, projets: { nom: string, chemin: string }[] } | null}
|
|
70
|
+
* @throws {Error} the faults of the key, each named by its key and its value
|
|
71
|
+
*/
|
|
72
|
+
export function groupeDe(dir) {
|
|
73
|
+
const racine = arbrePrincipal(dir);
|
|
74
|
+
let pkg;
|
|
75
|
+
try {
|
|
76
|
+
pkg = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8'));
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const { groupe, fautes } = lireGroupe(pkg, racine);
|
|
81
|
+
if (fautes.length > 0) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
`⛔ ${fautes.map(f => `${f.cle} vaut ${f.valeur}, pas un chemin de projet existant, une fois`).join(' ; ')}.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return groupe;
|
|
87
|
+
}
|
|
88
|
+
|
|
61
89
|
/**
|
|
62
90
|
* The `external_projects` of the Beads of the project at <racine>: the other projects of its
|
|
63
91
|
* <groupe>, `{ <nom>: <chemin> }`, each path relative to <racine>, the root of its main tree:
|
|
@@ -40,14 +40,31 @@
|
|
|
40
40
|
// which plays nothing again. Green, the tree is kept judged and main moves forward onto the
|
|
41
41
|
// candidate (`avancerMain`, `merge --ff-only`), the tree the pass judged; main moved meanwhile, the
|
|
42
42
|
// workflow replaces the branch again and judges it again. Red, the ticket loses `en-file` and
|
|
43
|
-
// reopens
|
|
44
|
-
//
|
|
45
|
-
//
|
|
43
|
+
// reopens; main does not move, and the branch stays. To play again (75, the part of the machine
|
|
44
|
+
// awaited), the branch stays in the queue, the ticket told, neither reopened nor closed. A pass
|
|
45
|
+
// that is not green reports as the checks of the circuit do, and as a merge queue keeps the logs of
|
|
46
|
+
// the job that refuses a lot and lists its failed tests (bors, Zuul): its whole output is added to
|
|
47
|
+
// the journal of the ticket (`.claude/worktrees/<ticket>.log`, the circuit's own), under a header
|
|
48
|
+
// line (a copy that does not open plays no verification, and its header says so), and the comment
|
|
49
|
+
// names that file; the pass names a results directory (`GRILLHOUSE_RESULTATS`,
|
|
50
|
+
// scripts/resultats.mjs) in a base of its own (scripts/mesure/base-de-passe.mjs, genre `file`),
|
|
51
|
+
// removed at its end and swept by the next pass when its act was killed, as the passes of the
|
|
52
|
+
// circuit keep theirs in the base of their run; the comment of a red names each red read there
|
|
53
|
+
// (test, file, message; finding; failed task) by the reading of the checks (`rougesDUnePasse` of
|
|
54
|
+
// scripts/activites.mjs, which the act gives the queue's tools, built with it or refused), in
|
|
55
|
+
// every language, and the journal holds them all; the comment lists them up to a bound
|
|
56
|
+
// (`ROUGES_AU_COMMENTAIRE`), says their count and sends to the journal for the rest; the end of
|
|
57
|
+
// the output comes only when that reading names none. A flaky test has no path of its own: the red comment
|
|
46
58
|
// gives the charter's rule, a test known red goes into quarantine in the test itself, with the
|
|
47
59
|
// ticket that fixes it.
|
|
48
60
|
// At its entry on main (`fermerLEntree`), the branch's ticket closes « intégré : <commit> », loses
|
|
49
61
|
// `en-file`, and the branch is deleted; a branch git does not delete (its copy still in place) is
|
|
50
|
-
// written to the ticket, which closes all the same.
|
|
62
|
+
// written to the ticket, which closes all the same. A closure Beads refuses (a ticket an open
|
|
63
|
+
// dependency blocks) is a fault named, `fermeture`: its comment at the ticket says it whole, no
|
|
64
|
+
// capability is delivered, the working directory stays, main is pushed, and the workflow gives the
|
|
65
|
+
// circuit the issue « echec », on which it stops with its question; its resumption, once what
|
|
66
|
+
// holds the closure is lifted, plays the entry again, which closes the ticket; the queue of the
|
|
67
|
+
// tickets never starts again a ticket whose lot is on main (scripts/file-des-tickets.mjs). Then main is pushed to origin, to the branch
|
|
51
68
|
// main, which the pre-push hook lets go as the tree is judged (a main whose package.json carries the
|
|
52
69
|
// retired key `grillhouse.poussee` is refused by its name, nothing pushed); a refused push is written to the ticket and does not stop the
|
|
53
70
|
// queue. The working directory of its circuit (`.claude/worktrees/<ticket>.travail`,
|
|
@@ -55,7 +72,7 @@
|
|
|
55
72
|
// Every comment and change of the queue at a ticket is written under the author `file`, which bd
|
|
56
73
|
// reads in BEADS_ACTOR, as the circuit writes its own lines under `circuit`.
|
|
57
74
|
import { spawnSync } from 'node:child_process';
|
|
58
|
-
import { existsSync, rmSync } from 'node:fs';
|
|
75
|
+
import { appendFileSync, existsSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';
|
|
59
76
|
import path from 'node:path';
|
|
60
77
|
import {
|
|
61
78
|
aRejouer,
|
|
@@ -70,6 +87,8 @@ import { A_REPASSER } from '../codes-de-sortie.mjs';
|
|
|
70
87
|
import { BASE_DU_LOT } from '../dernier-vert.mjs';
|
|
71
88
|
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
72
89
|
import { matieresDeclareesDe } from '../matieres-cles.mjs';
|
|
90
|
+
import { ouvrirBase } from '../mesure/base-de-passe.mjs';
|
|
91
|
+
import { RESULTATS } from '../resultats.mjs';
|
|
73
92
|
import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
|
|
74
93
|
import { pousseeRetiree } from '../poussee-retiree.mjs';
|
|
75
94
|
import { ouvrirCopie } from './rejeu.mjs';
|
|
@@ -93,33 +112,61 @@ const commenterAu = (o, ticket, texte) =>
|
|
|
93
112
|
// circuit reads to name that commit (scripts/circuit.mjs, the tri of the discoveries).
|
|
94
113
|
export const INTEGRE = 'intégré : ';
|
|
95
114
|
|
|
96
|
-
// The lines of the end of the output of a pass the comment
|
|
115
|
+
// The lines of the end of the output of a pass, which the comment gives when no red is named.
|
|
97
116
|
const FIN_DE_LA_SORTIE = 60;
|
|
98
117
|
|
|
118
|
+
// The characters of the list of the reds a comment holds, one argument of `bd comments add`: the
|
|
119
|
+
// reds beyond are counted there and read in the journal.
|
|
120
|
+
const ROUGES_AU_COMMENTAIRE = 20000;
|
|
121
|
+
|
|
122
|
+
// The journal of the ticket <ticket> in the main tree <racine>, the one its circuit writes
|
|
123
|
+
// (scripts/circuit.mjs).
|
|
124
|
+
const journalDuTicket = (racine, ticket) =>
|
|
125
|
+
path.join(racine, '.claude', 'worktrees', `${ticket}.log`);
|
|
126
|
+
|
|
99
127
|
/**
|
|
100
|
-
* The final pass played in the queue's own copy (`.claude/worktrees/file`) on the commit <commit
|
|
101
|
-
* `{ code, sortie }`, the code of `npm run verifier` (0 green, 75
|
|
102
|
-
* its output
|
|
103
|
-
*
|
|
104
|
-
*
|
|
128
|
+
* The final pass played in the queue's own copy (`.claude/worktrees/file`) on the commit <commit>
|
|
129
|
+
* for the ticket <ticket>: `{ code, sortie, rouges }`, the code of `npm run verifier` (0 green, 75
|
|
130
|
+
* to play again, any other red), its output, and the lines of the reds of a red pass. The copy is
|
|
131
|
+
* made ready on <commit> by <ouvrir> (detached, its dependencies in agreement with the lock file),
|
|
132
|
+
* the pass measured against the tip of main (`GRILLHOUSE_BASE_DU_LOT`, the commit's base as the lot
|
|
133
|
+
* lies on it), as the pass of the circuit measures itself. The pass names a results directory
|
|
134
|
+
* (`GRILLHOUSE_RESULTATS`) in a base of its own (`ouvrirBase('file')`), where <rouges> reads the
|
|
135
|
+
* reds of a red pass (`{ copie, dossier, code, ticket, journal }` → their lines); the base is
|
|
136
|
+
* closed at the end of the pass, and swept by the next one when the act was killed. A copy that
|
|
137
|
+
* does not open plays no pass: 75, its refusal as the output, `refus` true.
|
|
105
138
|
*/
|
|
106
|
-
function passeDeLaFile(racine, principale, dire) {
|
|
107
|
-
return ({ commit }) => {
|
|
139
|
+
function passeDeLaFile(racine, principale, dire, { rouges, ouvrir }) {
|
|
140
|
+
return ({ commit, ticket }) => {
|
|
108
141
|
const copie = path.join(racine, '.claude', 'worktrees', 'file');
|
|
109
|
-
const ouverte =
|
|
142
|
+
const ouverte = ouvrir({ racine, copie, ref: commit, dire });
|
|
110
143
|
if (ouverte.refus) {
|
|
111
|
-
return { code: A_REPASSER, sortie: ouverte.refus };
|
|
144
|
+
return { code: A_REPASSER, sortie: ouverte.refus, rouges: [], refus: true };
|
|
112
145
|
}
|
|
113
146
|
const base = spawnSync('git', ['-C', racine, 'rev-parse', `refs/heads/${principale}`], {
|
|
114
147
|
encoding: 'utf8',
|
|
115
148
|
}).stdout.trim();
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
149
|
+
const laBase = ouvrirBase('file');
|
|
150
|
+
try {
|
|
151
|
+
const dossier = mkdtempSync(path.join(laBase.dossier, 'resultats-'));
|
|
152
|
+
const r = spawnSync('bash', ouverte.monter('npm', 'run', 'verifier'), {
|
|
153
|
+
cwd: copie,
|
|
154
|
+
encoding: 'utf8',
|
|
155
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
156
|
+
env: { ...process.env, [RESULTATS]: dossier, ...(base ? { [BASE_DU_LOT]: base } : {}) },
|
|
157
|
+
});
|
|
158
|
+
const code = r.status ?? 1;
|
|
159
|
+
const rouge = code !== 0 && code !== A_REPASSER;
|
|
160
|
+
return {
|
|
161
|
+
code,
|
|
162
|
+
sortie: `${r.stdout ?? ''}${r.stderr ?? ''}`,
|
|
163
|
+
rouges: rouge
|
|
164
|
+
? rouges({ copie, dossier, code, ticket, journal: journalDuTicket(racine, ticket) })
|
|
165
|
+
: [],
|
|
166
|
+
};
|
|
167
|
+
} finally {
|
|
168
|
+
laBase.fermer();
|
|
169
|
+
}
|
|
123
170
|
};
|
|
124
171
|
}
|
|
125
172
|
|
|
@@ -127,9 +174,21 @@ function passeDeLaFile(racine, principale, dire) {
|
|
|
127
174
|
* The tools of the queue on the main tree <racine>, its lines said by <dire>: `{ racine,
|
|
128
175
|
* principale, bd, passe, dire, avancement }`, bd run under the queue's author (BEADS_ACTOR), the
|
|
129
176
|
* branch of the main tree (null when it is on none), `passe` the final pass played in the queue's
|
|
130
|
-
* copy.
|
|
177
|
+
* copy. <ports> gives what the pass plays with: `rouges`, the reading of the reds of a red pass,
|
|
178
|
+
* without which the tools are refused, and `ouvrir`, which makes the queue's copy ready
|
|
179
|
+
* (`ouvrirCopie`).
|
|
131
180
|
*/
|
|
132
|
-
export function outilsDeLaFile(
|
|
181
|
+
export function outilsDeLaFile(
|
|
182
|
+
racine,
|
|
183
|
+
dire,
|
|
184
|
+
avancement = null,
|
|
185
|
+
{ rouges, ouvrir = ouvrirCopie } = {}
|
|
186
|
+
) {
|
|
187
|
+
if (typeof rouges !== 'function') {
|
|
188
|
+
throw new Error(
|
|
189
|
+
"Les outils de la file se bâtissent avec la lecture des rouges d'une passe (rouges)."
|
|
190
|
+
);
|
|
191
|
+
}
|
|
133
192
|
const bd = (...a) => {
|
|
134
193
|
const r = spawnSync('bd', a, {
|
|
135
194
|
cwd: racine,
|
|
@@ -150,7 +209,7 @@ export function outilsDeLaFile(racine, dire, avancement = null) {
|
|
|
150
209
|
racine,
|
|
151
210
|
principale,
|
|
152
211
|
bd,
|
|
153
|
-
passe: passeDeLaFile(racine, principale ?? 'main', dire),
|
|
212
|
+
passe: passeDeLaFile(racine, principale ?? 'main', dire, { rouges, ouvrir }),
|
|
154
213
|
dire,
|
|
155
214
|
avancement,
|
|
156
215
|
};
|
|
@@ -334,9 +393,10 @@ export function preparerLaBranche(o, entree) {
|
|
|
334
393
|
* The candidate <commit> of <entree> (`{ ticket, branche, commit }`) judged by the final pass with
|
|
335
394
|
* the tools <o>: `{ juge: true }`, green (or its tree already judged: nothing is played again), its
|
|
336
395
|
* tree kept judged (scripts/arbres-juges.mjs); or `{ issue }`, the issue for the circuit
|
|
337
|
-
* (src/temporal/file/deroule.ts): red, `rouvert`, the
|
|
396
|
+
* (src/temporal/file/deroule.ts): red, `rouvert`, the reds of the pass named in the comment (the end
|
|
397
|
+
* of its output when it names none), its whole output in the journal of the ticket,
|
|
338
398
|
* the ticket reopened without `en-file`; to play again (75), `en-file`, the ticket told, neither
|
|
339
|
-
* reopened nor closed. `o.passe({ commit })` gives `{ code, sortie }`.
|
|
399
|
+
* reopened nor closed. `o.passe({ commit, ticket })` gives `{ code, sortie, rouges }`.
|
|
340
400
|
*/
|
|
341
401
|
export function jugerLeCandidat(o, entree) {
|
|
342
402
|
const git = (...args) => spawnSync('git', ['-C', o.racine, ...args], { encoding: 'utf8' });
|
|
@@ -346,7 +406,12 @@ export function jugerLeCandidat(o, entree) {
|
|
|
346
406
|
o.dire(`✓ arbre de ${court} déjà jugé par une passe finale`);
|
|
347
407
|
return { juge: true };
|
|
348
408
|
}
|
|
349
|
-
const {
|
|
409
|
+
const {
|
|
410
|
+
code,
|
|
411
|
+
sortie,
|
|
412
|
+
rouges = [],
|
|
413
|
+
refus = false,
|
|
414
|
+
} = o.passe({ commit: entree.commit, ticket: entree.ticket });
|
|
350
415
|
if (code === 0) {
|
|
351
416
|
if (arbre) {
|
|
352
417
|
garderLArbreJuge(o.racine, arbre);
|
|
@@ -354,14 +419,42 @@ export function jugerLeCandidat(o, entree) {
|
|
|
354
419
|
o.dire(`✓ passe finale verte sur ${court}`);
|
|
355
420
|
return { juge: true };
|
|
356
421
|
}
|
|
357
|
-
const
|
|
422
|
+
const entiere = `${sortie ?? ''}`;
|
|
423
|
+
const fin = entiere.trim().split('\n').slice(-FIN_DE_LA_SORTIE).join('\n');
|
|
424
|
+
// The whole output, added to the journal of the ticket under its header line, then every red
|
|
425
|
+
// the pass read; a copy that did not open played no verification.
|
|
426
|
+
const journal = journalDuTicket(o.racine, entree.ticket);
|
|
427
|
+
mkdirSync(path.dirname(journal), { recursive: true });
|
|
428
|
+
const entete = refus
|
|
429
|
+
? `La copie de la file ne s'ouvre pas sur ${court} : aucune passe finale jouée (code ${code})`
|
|
430
|
+
: `$ npm run verifier — la passe finale de la file sur ${court} (code ${code})`;
|
|
431
|
+
const lesRouges = rouges.length
|
|
432
|
+
? `Les rouges de la passe finale de la file sur ${court} (${rouges.length}) :\n${rouges.map(r => `- ${r}`).join('\n')}\n`
|
|
433
|
+
: '';
|
|
434
|
+
appendFileSync(journal, `${entete}\n${entiere}${entiere.endsWith('\n') ? '' : '\n'}${lesRouges}`);
|
|
435
|
+
const saSortie = `Sa sortie entière : ${journal}`;
|
|
358
436
|
if (code === A_REPASSER) {
|
|
359
|
-
const texte = `## ${TITRE_PASSE_FINALE} à repasser\n\nLa passe finale de ${court} sur ${entree.branche} est à repasser (code ${code}) :\n\n${fin}\n\n${o.principale} n'avance pas sans son vert ; la branche reste en file, et la reprise du circuit la renvoie.`;
|
|
437
|
+
const texte = `## ${TITRE_PASSE_FINALE} à repasser\n\nLa passe finale de ${court} sur ${entree.branche} est à repasser (code ${code}) :\n\n${fin}\n\n${saSortie}\n\n${o.principale} n'avance pas sans son vert ; la branche reste en file, et la reprise du circuit la renvoie.`;
|
|
360
438
|
commenterAu(o, entree.ticket, texte);
|
|
361
439
|
o.dire(`⚠ passe finale de ${court} à repasser`);
|
|
362
440
|
return { issue: { etat: 'en-file', raison: texte } };
|
|
363
441
|
}
|
|
364
|
-
|
|
442
|
+
// The reds the pass read in its results, listed up to the bound of a comment, the first always,
|
|
443
|
+
// the others counted and left to the journal; or, when it names none, the end of its output.
|
|
444
|
+
const listes = [];
|
|
445
|
+
let taille = 0;
|
|
446
|
+
for (const r of rouges) {
|
|
447
|
+
taille += r.length;
|
|
448
|
+
if (listes.length && taille > ROUGES_AU_COMMENTAIRE) {
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
listes.push(`- ${r.slice(0, ROUGES_AU_COMMENTAIRE)}`);
|
|
452
|
+
}
|
|
453
|
+
const autres = rouges.length - listes.length;
|
|
454
|
+
const ce = rouges.length
|
|
455
|
+
? `Ses rouges (${rouges.length}) :\n\n${listes.join('\n')}${autres ? `\n\n… et ${autres} autre(s), au journal.` : ''}`
|
|
456
|
+
: `La fin de sa sortie :\n\n${fin}`;
|
|
457
|
+
const texte = `## ${TITRE_PASSE_FINALE} rouge\n\nLa passe finale de ${court} sur ${entree.branche}, le lot posé sur la pointe de ${o.principale}, est rouge (code ${code}). ${ce}\n\n${saSortie}\n\n${o.principale} n'avance pas et le ticket est rouvert : sa correction entre sous son numéro. Un test connu instable se met en quarantaine dans le test, avec le ticket qui le corrige.`;
|
|
365
458
|
commenterAu(o, entree.ticket, texte);
|
|
366
459
|
o.bd('update', entree.ticket, '--status', 'open', '--remove-label', 'en-file');
|
|
367
460
|
o.dire(`✗ passe finale de ${court} rouge : ${entree.ticket} rouvert`);
|
|
@@ -434,8 +527,11 @@ function livrerLesCapacites(o, ticket, labels) {
|
|
|
434
527
|
* removes the working directory of its circuit (`retirerLeTravail`). Each of its gestures replays
|
|
435
528
|
* without harm (a ticket closed is left closed, a branch gone stays gone, a commit pushed is pushed
|
|
436
529
|
* again as it is), and never reopens the ticket; its comments are effects (`commenterAu`), which
|
|
437
|
-
* the workflow of the queue writes once each. `{ poussee, raison }`: `main` once
|
|
438
|
-
* and why, in one line (`enUneLigne`), its comment at the ticket whole
|
|
530
|
+
* the workflow of the queue writes once each. `{ poussee, raison, fermeture }`: `main` once
|
|
531
|
+
* pushed, or null and why, in one line (`enUneLigne`), its comment at the ticket whole;
|
|
532
|
+
* `fermeture`, the fault of a `bd close` that fails, in one line (the command and Beads' reason),
|
|
533
|
+
* null without one: the ticket stays open, no capability is delivered and the working directory
|
|
534
|
+
* stays, for the circuit that stops on it, and the entry played again closes the ticket.
|
|
439
535
|
*/
|
|
440
536
|
export function fermerLEntree(o, entree) {
|
|
441
537
|
const { racine } = o;
|
|
@@ -444,23 +540,38 @@ export function fermerLEntree(o, entree) {
|
|
|
444
540
|
const commenter = texte => commenterAu(o, entree.ticket, texte);
|
|
445
541
|
const show = o.bd('show', entree.ticket, '--json');
|
|
446
542
|
const lu = show.status === 0 ? (JSON.parse(show.stdout)[0] ?? null) : null;
|
|
543
|
+
let fermeture = null;
|
|
447
544
|
if ((lu?.status ?? null) !== 'closed') {
|
|
448
545
|
o.bd('update', entree.ticket, '--remove-label', 'en-file');
|
|
449
|
-
o.bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
|
|
546
|
+
const r = o.bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
|
|
547
|
+
if (r.status !== 0) {
|
|
548
|
+
const raison = `${r.stderr ?? ''}`.trim() || `${r.stdout ?? ''}`.trim() || `code ${r.status}`;
|
|
549
|
+
commenter(
|
|
550
|
+
`Le ticket n'est pas fermé : son lot est sur ${o.principale} en ${court}, mais \`bd close ${entree.ticket}\` échoue :\n${raison}\n\nLève ce qui l'empêche, puis reprends son circuit (\`--reprendre\`) : il repasse par la file, qui ferme le ticket, livre ses capacités et retire son dossier de travail. La file ne relance pas un ticket dont le lot est sur ${o.principale}.`
|
|
551
|
+
);
|
|
552
|
+
o.dire(`⚠ bd close ${entree.ticket} échoue`);
|
|
553
|
+
fermeture = `bd close ${entree.ticket} échoue : ${enUneLigne(raison)}`;
|
|
554
|
+
}
|
|
450
555
|
}
|
|
451
556
|
// The capabilities the ticket exports (`export:<capability>`) are delivered once it is closed.
|
|
452
|
-
const ferme =
|
|
557
|
+
const ferme = {
|
|
558
|
+
...(fermeture ? { livraison: null } : livrerLesCapacites(o, entree.ticket, lu?.labels ?? [])),
|
|
559
|
+
fermeture,
|
|
560
|
+
};
|
|
453
561
|
o.dire(`✓ ${entree.branche} entre sur ${o.principale} : ${court}`);
|
|
454
562
|
if (git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).status === 0) {
|
|
455
563
|
const efface = git('branch', '-D', entree.branche);
|
|
456
564
|
if (efface.status !== 0) {
|
|
457
565
|
commenter(
|
|
458
|
-
`La branche ${entree.branche} reste en place après son entrée sur ${o.principale} (${efface.stderr.trim()}) : sa copie est encore en place
|
|
566
|
+
`La branche ${entree.branche} reste en place après son entrée sur ${o.principale} (${efface.stderr.trim()}) : sa copie est encore en place.${fermeture ? '' : ' Le ticket est fermé.'}`
|
|
459
567
|
);
|
|
460
568
|
o.dire(`⚠ ${entree.branche} n'est pas effacée`);
|
|
461
569
|
}
|
|
462
570
|
}
|
|
463
|
-
|
|
571
|
+
// The working directory lives as long as the ticket: one left open keeps it, for its circuit.
|
|
572
|
+
if (!fermeture) {
|
|
573
|
+
retirerLeTravail(o, entree.ticket);
|
|
574
|
+
}
|
|
464
575
|
const paquet = git('show', `refs/heads/${o.principale}:package.json`);
|
|
465
576
|
const retiree = pousseeRetiree(paquet.status === 0 ? JSON.parse(paquet.stdout) : null);
|
|
466
577
|
if (retiree) {
|
package/scripts/jointure.d.ts
CHANGED
|
@@ -409,6 +409,9 @@ export function avecLeFichierDuPoste<T extends Record<string, string | undefined
|
|
|
409
409
|
env: T,
|
|
410
410
|
o: { fichier: string; ajouts?: Record<string, string>; lire?: (f: string) => string | null }
|
|
411
411
|
): T;
|
|
412
|
+
/** Whether the Nuit flow of the copy at <racine> plays the measures of time itself: one of its
|
|
413
|
+
* commands runs `tests-de-nuit --mesures`; false without a flow (scripts/flux-de-la-nuit.mjs). */
|
|
414
|
+
export function fluxDuProjetJoueLesMesures(racine: string): boolean;
|
|
412
415
|
/** The path of the command <nom> in the PATH of <env>, or null (scripts/commandes-du-path.mjs). */
|
|
413
416
|
export function trouverDansLePath(nom: string, env?: NodeJS.ProcessEnv): string | null;
|
|
414
417
|
/**
|
|
@@ -486,7 +489,6 @@ export function surUnePart(
|
|
|
486
489
|
o?: {
|
|
487
490
|
env?: NodeJS.ProcessEnv;
|
|
488
491
|
racine?: string;
|
|
489
|
-
entiere?: boolean;
|
|
490
492
|
mesure?: boolean;
|
|
491
493
|
dire?: (l: string) => void;
|
|
492
494
|
}
|
|
@@ -523,7 +525,8 @@ export function nomDuPaquet(racine: string, dossier: string): string | null;
|
|
|
523
525
|
/** Runs the tasks `taches` of the packages `noms` (all when empty) with the task runner `outil`,
|
|
524
526
|
* each task whose dependencies succeed played to its end: the runner's exit code. `tests` is the
|
|
525
527
|
* content of the variable `TESTS_CIBLES` of the run; the variable of `env` never passes on. A
|
|
526
|
-
* red run names, through `dire`, each task whose code is not 0.
|
|
528
|
+
* red run names, through `dire`, each task whose code is not 0. `coteACote` bounds the tasks played
|
|
529
|
+
* side by side (`--concurrency`). */
|
|
527
530
|
export function lancerLesTaches(o: {
|
|
528
531
|
outil: string;
|
|
529
532
|
racine: string;
|
|
@@ -532,7 +535,15 @@ export function lancerLesTaches(o: {
|
|
|
532
535
|
tests?: { arguments: string[]; rejouer?: string };
|
|
533
536
|
env?: NodeJS.ProcessEnv;
|
|
534
537
|
dire?: (ligne: string) => void;
|
|
538
|
+
coteACote?: number;
|
|
535
539
|
}): number;
|
|
540
|
+
/** The tasks a run of the graph plays side by side on `coeurs` cores (the machine's by default):
|
|
541
|
+
* half of them, one at least; the bound `--concurrency` of the pass of the verification and of the
|
|
542
|
+
* build the guards wait for. */
|
|
543
|
+
export function tachesCoteACote(coeurs?: number): number;
|
|
544
|
+
/** The guard scripts of the root, and their tasks of the graph, in the order they play: the frame's
|
|
545
|
+
* controls, then the project's own guards. */
|
|
546
|
+
export const SCRIPTS_DE_GARDES: string[];
|
|
536
547
|
/** A task of the summary of the task runner, or one a module wrote: `code` null for a task that did not run. */
|
|
537
548
|
export interface TacheDuResume {
|
|
538
549
|
tache: string;
|
|
@@ -587,12 +598,18 @@ export function tracesDuPlan(
|
|
|
587
598
|
): string[];
|
|
588
599
|
/** The command `construire --echec <fichier> <plan>` of a module, run from the root of the copy:
|
|
589
600
|
* builds the plan and its providers with the task runner `outil`, `run build --filter=<paquet>…`
|
|
590
|
-
* (the whole copy for a plan with a path that is no package); its exit code.
|
|
601
|
+
* (the whole copy for a plan with a path that is no package); its exit code. `construire --gardes`
|
|
602
|
+
* plays what the guard tasks of the root wait for in the graph, read in the runner's plan of them. */
|
|
591
603
|
export function construireDepuisLesArguments(
|
|
592
604
|
outil: string,
|
|
593
605
|
args: string[],
|
|
594
606
|
racine?: string
|
|
595
607
|
): number;
|
|
608
|
+
/** Whether the arguments of a command `construire` ask for a build of the graph, the core's one
|
|
609
|
+
* for every language (`--echec <fichier> <plan>`, the launcher's; `--gardes`, what the guard tasks
|
|
610
|
+
* of the root wait for, which the checks of a plan play before its guards), and not for the build
|
|
611
|
+
* of one package. */
|
|
612
|
+
export function constructionDuGraphe(args: string[]): boolean;
|
|
596
613
|
/** What `lire` returns, read once under `cle` while the core holds a scope of readings done once
|
|
597
614
|
* (a sweep that asks many questions of a tree that does not move), at each call otherwise
|
|
598
615
|
* (scripts/lecture-unique.mjs). */
|
|
@@ -9,6 +9,17 @@ export interface LigneDuJournal {
|
|
|
9
9
|
boucle: number | null;
|
|
10
10
|
place: string | null;
|
|
11
11
|
raison: string;
|
|
12
|
+
/** The reservation of a place taken or given back. */
|
|
13
|
+
reservation?: Reservation;
|
|
14
|
+
/** The circuit or project a queued ticket waits for (a line `file` `attente`). */
|
|
15
|
+
autre?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** What a place reserves: cores, memory in GB, and who (ticket and role, or pass). */
|
|
19
|
+
export interface Reservation {
|
|
20
|
+
coeurs: number;
|
|
21
|
+
memoireGo: number;
|
|
22
|
+
qui: string;
|
|
12
23
|
}
|
|
13
24
|
|
|
14
25
|
/** A trace to write: a line, `ts` set when it already has its date. */
|
|
@@ -29,7 +40,12 @@ export function traceDesPlaces(e: {
|
|
|
29
40
|
ticket?: string | null;
|
|
30
41
|
place?: string | null;
|
|
31
42
|
raison?: string;
|
|
43
|
+
reservation?: Reservation;
|
|
32
44
|
}): Trace;
|
|
45
|
+
export function reservationsOuvertes(
|
|
46
|
+
lignes: LigneDuJournal[],
|
|
47
|
+
ts: string
|
|
48
|
+
): ({ place: string } & Reservation)[];
|
|
33
49
|
export function lireLeJournal(
|
|
34
50
|
racine: string,
|
|
35
51
|
plage?: { depuis?: string; jusquA?: string; ticket?: string }
|
|
@@ -82,6 +82,10 @@ function ligneEntiere(trace, ts) {
|
|
|
82
82
|
boucle: champ(trace.boucle),
|
|
83
83
|
place: champ(trace.place),
|
|
84
84
|
raison: trace.raison ?? '',
|
|
85
|
+
// The reservation of a place (`{ coeurs, memoireGo, qui }`) and the circuit a queued ticket
|
|
86
|
+
// waits for (`autre`) are written only when the trace carries them.
|
|
87
|
+
...(trace.reservation ? { reservation: trace.reservation } : {}),
|
|
88
|
+
...(trace.autre ? { autre: trace.autre } : {}),
|
|
85
89
|
};
|
|
86
90
|
let raison = Array.from(String(ligne.raison));
|
|
87
91
|
let texte = JSON.stringify(ligne);
|
|
@@ -133,8 +137,46 @@ export function traceDeLaFile({ ticket, evenement }) {
|
|
|
133
137
|
}
|
|
134
138
|
|
|
135
139
|
/** The trace of a place taken (`prise`), given back (`rendue`) or waited for (`attente`). */
|
|
136
|
-
export function traceDesPlaces({
|
|
137
|
-
|
|
140
|
+
export function traceDesPlaces({
|
|
141
|
+
evenement,
|
|
142
|
+
ticket = null,
|
|
143
|
+
place = null,
|
|
144
|
+
raison = '',
|
|
145
|
+
reservation = undefined,
|
|
146
|
+
}) {
|
|
147
|
+
return {
|
|
148
|
+
genre: 'places',
|
|
149
|
+
ticket,
|
|
150
|
+
etape: evenement,
|
|
151
|
+
boucle: null,
|
|
152
|
+
place,
|
|
153
|
+
raison,
|
|
154
|
+
...(reservation ? { reservation } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The reservations open at the instant <ts> from the lines of the journal alone: each place
|
|
160
|
+
* `prise` with a reservation and not yet `rendue`, in the order of the takings.
|
|
161
|
+
* @param {object[]} lignes
|
|
162
|
+
* @param {string} ts
|
|
163
|
+
* @returns {{ place: string, coeurs: number, memoireGo: number, qui: string }[]}
|
|
164
|
+
*/
|
|
165
|
+
export function reservationsOuvertes(lignes, ts) {
|
|
166
|
+
const t = instant(ts);
|
|
167
|
+
const ouvertes = new Map();
|
|
168
|
+
const triees = lignes
|
|
169
|
+
.map((l, i) => ({ l, i, t: instant(l.ts) }))
|
|
170
|
+
.filter(x => x.l.genre === 'places' && x.t <= t)
|
|
171
|
+
.sort((a, b) => a.t - b.t || a.i - b.i);
|
|
172
|
+
for (const { l } of triees) {
|
|
173
|
+
if (l.etape === 'prise' && l.reservation && l.place) {
|
|
174
|
+
ouvertes.set(l.place, { place: l.place, ...l.reservation });
|
|
175
|
+
} else if (l.etape === 'rendue' && l.place) {
|
|
176
|
+
ouvertes.delete(l.place);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return [...ouvertes.values()];
|
|
138
180
|
}
|
|
139
181
|
|
|
140
182
|
const instant = ts => Date.parse(ts);
|
package/scripts/journal.mjs
CHANGED
|
@@ -56,6 +56,9 @@ const ligneDe = l =>
|
|
|
56
56
|
l.etape ?? '-',
|
|
57
57
|
...(l.boucle === null || l.boucle === undefined ? [] : [`boucle ${l.boucle}`]),
|
|
58
58
|
...(l.place ? [`place ${l.place}`] : []),
|
|
59
|
+
...(l.reservation
|
|
60
|
+
? [`${l.reservation.coeurs} cœurs, ${l.reservation.memoireGo} Go, ${l.reservation.qui}`]
|
|
61
|
+
: []),
|
|
59
62
|
...(l.raison ? [`— ${l.raison}`] : []),
|
|
60
63
|
].join(' ');
|
|
61
64
|
|