@roomi-fields/grillhouse 0.30.0 → 0.32.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 +48 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/dist/temporal/circuit/client.d.ts +2 -2
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +4 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +3 -3
- package/dist/temporal/circuit/contrat.js +8 -2
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +3 -3
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +5 -6
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +3 -6
- package/dist/temporal/installation.js +19 -38
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +1 -0
- package/dist/temporal/tickets/activites.js +5 -0
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +10 -0
- package/dist/temporal/tickets/deroule.js +8 -1
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +119 -27
- package/docs/CADRE.md +20 -0
- package/docs/INTERFACE.md +17 -4
- package/hooks/hooks.json +4 -0
- package/package.json +2 -2
- package/scripts/activites.mjs +155 -84
- package/scripts/aiguillage.mjs +35 -11
- package/scripts/attente-au-tour.mjs +99 -0
- package/scripts/avancement.mjs +27 -10
- package/scripts/base-des-workflows.mjs +57 -0
- package/scripts/bilan.mjs +101 -25
- package/scripts/cadre.mjs +5 -2
- package/scripts/circuit.mjs +173 -58
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +54 -19
- package/scripts/copies-finies.mjs +8 -1
- package/scripts/dependances-internes.mjs +9 -3
- package/scripts/dernier-vert.mjs +84 -23
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +24 -8
- package/scripts/droits.mjs +40 -15
- package/scripts/effets.mjs +9 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +141 -48
- package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
- package/scripts/etapes.mjs +1 -1
- package/scripts/faits-du-circuit.mjs +1 -1
- package/scripts/flux-des-paquets.mjs +21 -7
- package/scripts/gardes-du-cadre.mjs +9 -3
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +84 -29
- package/scripts/integration/integrer.mjs +70 -24
- package/scripts/integration/rejeu.mjs +26 -9
- package/scripts/jointure.d.ts +10 -1
- package/scripts/journal-des-etats.d.mts +41 -0
- package/scripts/journal-des-etats.mjs +273 -0
- package/scripts/journal.mjs +119 -0
- package/scripts/langages/cargo/commandes.mjs +97 -18
- package/scripts/langages/cargo/composants.mjs +24 -8
- package/scripts/langages/cargo/index.mjs +7 -0
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +3 -1
- package/scripts/langages/python/index.mjs +6 -0
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/frontieres.mjs +112 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +12 -3
- package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
- package/scripts/langages/typescript/tests.mjs +24 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
- package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
- package/scripts/langages/typescript/verdict.mjs +3 -1
- package/scripts/langages/typescript/verifier.mjs +61 -14
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +10 -2
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages.d.mts +20 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/matiere-de-test.d.ts +11 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +9 -3
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
- package/scripts/nuit.sh +24 -0
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.mjs +18 -7
- package/scripts/paquet-npm.mjs +15 -5
- package/scripts/paquets.mjs +12 -4
- package/scripts/passe-de-la-machine.mjs +7 -2
- package/scripts/places-de-la-machine.mjs +72 -12
- package/scripts/preparation.mjs +15 -5
- package/scripts/registre.mjs +6 -2
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +105 -37
- package/scripts/seances.mjs +22 -4
- package/scripts/services-du-noyau.mjs +1 -0
- package/scripts/sous-commandes.mjs +5 -1
- package/scripts/style-a-l-ecriture.mjs +48 -17
- package/scripts/superviseur.mjs +127 -75
- package/scripts/tableau.mjs +133 -10
- package/scripts/taches-du-graphe.mjs +33 -13
- package/scripts/ticket-du-circuit.mjs +40 -0
- package/scripts/transitions.mjs +159 -29
- package/scripts/verrou-de-fichier.mjs +6 -2
- package/scripts/verrou-de-machine.mjs +123 -39
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/explorateur/SKILL.md +8 -2
- package/skills/grill/SKILL.md +3 -57
- package/skills/grill/references/paquets.md +60 -0
- package/skills/mesure/SKILL.md +3 -0
- package/skills/pitmaster/SKILL.md +16 -27
- package/skills/questionneur/SKILL.md +1 -1
- package/skills/relecteur/SKILL.md +2 -2
- package/skills/testwriter/SKILL.md +19 -7
- package/skills/release/SKILL.md +0 -134
- package/skills/release/scripts/update-version.cjs +0 -92
package/scripts/outil.mjs
CHANGED
|
@@ -39,7 +39,9 @@ function versionAInstaller(racine, args) {
|
|
|
39
39
|
refus: `⛔ grillhouse outil : aucun package.json dans ${racine} ; la clé ${CLE} s'écrit au package.json racine du dépôt.\n`,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
if (args[0] !== undefined)
|
|
42
|
+
if (args[0] !== undefined) {
|
|
43
|
+
ecrireLaCle(racine, args[0]);
|
|
44
|
+
}
|
|
43
45
|
try {
|
|
44
46
|
const version = versionDeLOutil(racine);
|
|
45
47
|
return version === null
|
package/scripts/outils-cles.mjs
CHANGED
|
@@ -89,7 +89,9 @@ export function lireOutils(
|
|
|
89
89
|
{ maison = os.homedir(), existe = existsSync, reel = realpath, montages = [] } = {}
|
|
90
90
|
) {
|
|
91
91
|
const o = pkg?.grillhouse?.outils;
|
|
92
|
-
if (o === undefined || o === null)
|
|
92
|
+
if (o === undefined || o === null) {
|
|
93
|
+
return { outils: {}, fautes: [] };
|
|
94
|
+
}
|
|
93
95
|
if (typeof o !== 'object' || Array.isArray(o)) {
|
|
94
96
|
return {
|
|
95
97
|
outils: {},
|
|
@@ -117,10 +119,15 @@ export function lireOutils(
|
|
|
117
119
|
const cible = !refus && existe(chemin) ? reel(chemin) : chemin;
|
|
118
120
|
const refusDeLaCible =
|
|
119
121
|
cible !== chemin ? refusDuChemin(cle, cible, path.resolve(maison), montages) : null;
|
|
120
|
-
if (refus)
|
|
121
|
-
|
|
122
|
-
else if (
|
|
123
|
-
|
|
122
|
+
if (refus) {
|
|
123
|
+
fautes.push(refus);
|
|
124
|
+
} else if (refusDeLaCible) {
|
|
125
|
+
fautes.push(`${refusDeLaCible} (la cible du lien ${chemin})`);
|
|
126
|
+
} else if (existe(chemin)) {
|
|
127
|
+
outils[nom] = chemin;
|
|
128
|
+
} else {
|
|
129
|
+
fautes.push(`la clé ${cle} nomme ${chemin}, qui n'existe pas.`);
|
|
130
|
+
}
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
return { outils: fautes.length ? {} : outils, fautes };
|
|
@@ -151,12 +158,16 @@ export function arbrePrincipal(dir) {
|
|
|
151
158
|
export function outilsDe(dir, { montages = [] } = {}) {
|
|
152
159
|
const racine = arbrePrincipal(dir);
|
|
153
160
|
const f = path.join(racine, 'package.json');
|
|
154
|
-
if (!existsSync(f))
|
|
161
|
+
if (!existsSync(f)) {
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
155
164
|
const temporaires = [process.env.CLAUDE_CODE_TMPDIR, os.tmpdir(), '/tmp'].filter(Boolean);
|
|
156
165
|
const { outils, fautes } = lireOutils(JSON.parse(readFileSync(f, 'utf8')), {
|
|
157
166
|
montages: [racine, ...temporaires, ...montages],
|
|
158
167
|
});
|
|
159
|
-
if (fautes.length)
|
|
168
|
+
if (fautes.length) {
|
|
169
|
+
throw new Error(fautes.join('\n'));
|
|
170
|
+
}
|
|
160
171
|
return outils;
|
|
161
172
|
}
|
|
162
173
|
|
package/scripts/paquet-npm.mjs
CHANGED
|
@@ -47,11 +47,15 @@ export const nomDuManifeste = (langageNom, texte) => langage(langageNom).nomDuMa
|
|
|
47
47
|
function avecManifeste(dossier, manifeste, langageNom, exclus) {
|
|
48
48
|
const out = [];
|
|
49
49
|
for (const e of readdirSync(dossier, { withFileTypes: true })) {
|
|
50
|
-
if (!e.isDirectory() || e.name.startsWith('.') || exclus.has(e.name))
|
|
50
|
+
if (!e.isDirectory() || e.name.startsWith('.') || exclus.has(e.name)) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
51
53
|
const d = path.join(dossier, e.name);
|
|
52
54
|
const f = path.join(d, manifeste);
|
|
53
55
|
const paquet = existsSync(f) ? nomDuManifeste(langageNom, readFileSync(f, 'utf8')) : null;
|
|
54
|
-
if (paquet !== null)
|
|
56
|
+
if (paquet !== null) {
|
|
57
|
+
out.push({ dossier: d, nom: e.name, paquet });
|
|
58
|
+
}
|
|
55
59
|
out.push(...avecManifeste(d, manifeste, langageNom, exclus));
|
|
56
60
|
}
|
|
57
61
|
return out;
|
|
@@ -79,11 +83,17 @@ export function paquetsSansPackageJson(racine) {
|
|
|
79
83
|
const trouves = new Set();
|
|
80
84
|
for (const t of tableauxDesComposants(racine)) {
|
|
81
85
|
const colonne = colonneDesNoms(t.lignes, candidats, racine, t.colonne);
|
|
82
|
-
if (colonne < 0)
|
|
86
|
+
if (colonne < 0) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
83
89
|
for (const l of t.lignes) {
|
|
84
|
-
if (langageDeLaCellule(l.cellules[t.colonne]) !== langageNom)
|
|
90
|
+
if (langageDeLaCellule(l.cellules[t.colonne]) !== langageNom) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
85
93
|
for (const c of candidats) {
|
|
86
|
-
if (nomme(nomsDe(l.cellules[colonne]), c, racine))
|
|
94
|
+
if (nomme(nomsDe(l.cellules[colonne]), c, racine)) {
|
|
95
|
+
trouves.add(c);
|
|
96
|
+
}
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
}
|
package/scripts/paquets.mjs
CHANGED
|
@@ -32,11 +32,15 @@ const HORS_CADRE = 'docs/agents/hors-cadre.txt';
|
|
|
32
32
|
// The names listed in <racine>'s `docs/agents/hors-cadre.txt`: a Set, empty without the file.
|
|
33
33
|
export function horsCadre(racine) {
|
|
34
34
|
const liste = path.join(racine, HORS_CADRE);
|
|
35
|
-
if (!existsSync(liste))
|
|
35
|
+
if (!existsSync(liste)) {
|
|
36
|
+
return new Set();
|
|
37
|
+
}
|
|
36
38
|
const noms = new Set();
|
|
37
39
|
for (const ligne of readFileSync(liste, 'utf8').split('\n')) {
|
|
38
40
|
const mot = ligne.trim().split(/\s+/)[0];
|
|
39
|
-
if (mot && !mot.startsWith('#'))
|
|
41
|
+
if (mot && !mot.startsWith('#')) {
|
|
42
|
+
noms.add(mot);
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
return noms;
|
|
42
46
|
}
|
|
@@ -118,8 +122,12 @@ export function paquets(racine) {
|
|
|
118
122
|
for (const motif of motifs) {
|
|
119
123
|
for (const f of globSync(`${motif}/package.json`, { cwd: racine })) {
|
|
120
124
|
const dossier = path.dirname(f);
|
|
121
|
-
if (f.split(path.sep).includes('node_modules'))
|
|
122
|
-
|
|
125
|
+
if (f.split(path.sep).includes('node_modules')) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (nies.some(n => path.matchesGlob(dossier, n))) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
123
131
|
dossiers.add(dossier);
|
|
124
132
|
}
|
|
125
133
|
}
|
|
@@ -28,7 +28,9 @@ export function passeLourde({ args }) {
|
|
|
28
28
|
*/
|
|
29
29
|
export function lancementDeLaPasse({ lourde, cmd, args, env }) {
|
|
30
30
|
const { [VARIABLE_TRAVAILLEURS]: _herite, ...sansTravailleurs } = env;
|
|
31
|
-
if (lourde)
|
|
31
|
+
if (lourde) {
|
|
32
|
+
return { cmd, args, env: sansTravailleurs };
|
|
33
|
+
}
|
|
32
34
|
const [commande, ...arguments_] = sousNiceEtIonice([cmd, ...args]);
|
|
33
35
|
return {
|
|
34
36
|
cmd: commande,
|
|
@@ -48,7 +50,10 @@ export function lancementDeLaPasse({ lourde, cmd, args, env }) {
|
|
|
48
50
|
* borneMs?: number, rappelMs?: number } & Record<string, unknown>} options
|
|
49
51
|
* @returns {T}
|
|
50
52
|
*/
|
|
51
|
-
export function avecLaPasse(
|
|
53
|
+
export function avecLaPasse(
|
|
54
|
+
mesure,
|
|
55
|
+
{ lourde, env = process.env, racine, ticket, sorte, ...options }
|
|
56
|
+
) {
|
|
52
57
|
if (lourde) {
|
|
53
58
|
const { dire, borneMs, rappelMs, rang } = options;
|
|
54
59
|
return avecLaMachineEtUnePlace(mesure, {
|
|
@@ -39,6 +39,7 @@ import path from 'node:path';
|
|
|
39
39
|
import { departDe } from './mesure/base-de-passe.mjs';
|
|
40
40
|
import { A_REPASSER } from './codes-de-sortie.mjs';
|
|
41
41
|
import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
42
|
+
import { ecrireLaTrace, traceDesPlaces } from './journal-des-etats.mjs';
|
|
42
43
|
import { mesureDeLaMachine } from './mesure-de-la-machine.mjs';
|
|
43
44
|
import { AttenteDeLaMachine, avecLaMachine, borneDe } from './verrou-de-machine.mjs';
|
|
44
45
|
|
|
@@ -47,6 +48,8 @@ export const VARIABLE_ESPACEMENT = 'GRILLHOUSE_ESPACEMENT_MS';
|
|
|
47
48
|
export const VARIABLE_TRAVAILLEURS = 'GRILLHOUSE_TRAVAILLEURS';
|
|
48
49
|
/** The mark of a place held, which the children of its holder inherit. */
|
|
49
50
|
export const VARIABLE_TENUE = 'GRILLHOUSE_PLACE_TENUE';
|
|
51
|
+
/** The measure of the machine a trial fixes, in JSON `{ coeurs, charge, memoireLibre }`. */
|
|
52
|
+
export const VARIABLE_MESURE_D_ESSAI = 'GRILLHOUSE_MESURE_D_ESSAI';
|
|
50
53
|
// The server of the places of a trial machine.
|
|
51
54
|
const VARIABLE_ESSAI = 'GRILLHOUSE_PLACES_D_ESSAI';
|
|
52
55
|
|
|
@@ -66,11 +69,14 @@ const PONT = path.join(import.meta.dirname, 'places-du-serveur.mjs');
|
|
|
66
69
|
*/
|
|
67
70
|
export function plafondDe(env = process.env) {
|
|
68
71
|
const v = env[VARIABLE_PLACES];
|
|
69
|
-
if (v === undefined || v === '')
|
|
70
|
-
|
|
72
|
+
if (v === undefined || v === '') {
|
|
73
|
+
return PLAFOND_PAR_DEFAUT;
|
|
74
|
+
}
|
|
75
|
+
if (!/^[1-9]\d*$/.test(v)) {
|
|
71
76
|
throw new Error(
|
|
72
77
|
`${VARIABLE_PLACES} vaut « ${v} » : un entier positif est attendu (3 par défaut).`
|
|
73
78
|
);
|
|
79
|
+
}
|
|
74
80
|
return Number(v);
|
|
75
81
|
}
|
|
76
82
|
|
|
@@ -82,11 +88,14 @@ export function plafondDe(env = process.env) {
|
|
|
82
88
|
*/
|
|
83
89
|
export function espacementDe(env = process.env) {
|
|
84
90
|
const v = env[VARIABLE_ESPACEMENT];
|
|
85
|
-
if (v === undefined || v === '')
|
|
86
|
-
|
|
91
|
+
if (v === undefined || v === '') {
|
|
92
|
+
return ESPACEMENT_MS;
|
|
93
|
+
}
|
|
94
|
+
if (!/^\d+$/.test(v)) {
|
|
87
95
|
throw new Error(
|
|
88
96
|
`${VARIABLE_ESPACEMENT} vaut « ${v} » : un nombre de millisecondes est attendu.`
|
|
89
97
|
);
|
|
98
|
+
}
|
|
90
99
|
return Number(v);
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -113,9 +122,12 @@ export function travailleursDe({
|
|
|
113
122
|
*/
|
|
114
123
|
export function travailleursDeLaSeance(env = process.env) {
|
|
115
124
|
const v = env[VARIABLE_TRAVAILLEURS];
|
|
116
|
-
if (v === undefined || v === '')
|
|
117
|
-
|
|
125
|
+
if (v === undefined || v === '') {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
if (!/^[1-9]\d*$/.test(v)) {
|
|
118
129
|
throw new Error(`${VARIABLE_TRAVAILLEURS} vaut « ${v} » : un entier positif est attendu.`);
|
|
130
|
+
}
|
|
119
131
|
return Number(v);
|
|
120
132
|
}
|
|
121
133
|
|
|
@@ -127,7 +139,9 @@ export function travailleursDeLaSeance(env = process.env) {
|
|
|
127
139
|
* @returns {Record<string, string | undefined> | null}
|
|
128
140
|
*/
|
|
129
141
|
function surLeServeur(env) {
|
|
130
|
-
if (env.CI || paquetsDeLEnveloppe(env))
|
|
142
|
+
if (env.CI || paquetsDeLEnveloppe(env)) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
131
145
|
if (env.GRILLHOUSE_VERROU_MACHINE) {
|
|
132
146
|
return env[VARIABLE_ESSAI] ? { ...env, TEMPORAL_ADDRESS: env[VARIABLE_ESSAI] } : null;
|
|
133
147
|
}
|
|
@@ -193,6 +207,7 @@ export function prendreUnePlace({
|
|
|
193
207
|
borneMs = borneDe(env),
|
|
194
208
|
rappelMs = RAPPEL_MS,
|
|
195
209
|
dire = l => process.stdout.write(`${l}\n`),
|
|
210
|
+
racine = process.cwd(),
|
|
196
211
|
} = {}) {
|
|
197
212
|
const e = env[VARIABLE_TENUE] ? null : surLeServeur(env);
|
|
198
213
|
if (!e) {
|
|
@@ -208,12 +223,17 @@ export function prendreUnePlace({
|
|
|
208
223
|
};
|
|
209
224
|
const { code, lignes } = auServeur(e, ['prendre', JSON.stringify(demande)], borneMs + 60_000);
|
|
210
225
|
for (const l of lignes) {
|
|
211
|
-
if (l.dire)
|
|
226
|
+
if (l.dire) {
|
|
227
|
+
// The wait, said and dated in the journal of states, its reason the message said.
|
|
228
|
+
ecrireLaTrace(racine, traceDesPlaces({ evenement: 'attente', ticket, raison: l.dire }));
|
|
229
|
+
dire(l.dire);
|
|
230
|
+
}
|
|
212
231
|
}
|
|
213
232
|
if (code === A_REPASSER) {
|
|
214
233
|
throw new AttenteDeLaMachine(lignes.at(-1)?.dire ?? 'attente de place bornée', A_REPASSER);
|
|
215
234
|
}
|
|
216
235
|
const place = lignes.find(l => l.id);
|
|
236
|
+
ecrireLaTrace(racine, traceDesPlaces({ evenement: 'prise', ticket, place: place.id }));
|
|
217
237
|
return {
|
|
218
238
|
id: place.id,
|
|
219
239
|
rang: place.rang,
|
|
@@ -223,8 +243,11 @@ export function prendreUnePlace({
|
|
|
223
243
|
rendre: () => {
|
|
224
244
|
try {
|
|
225
245
|
auServeur(e, ['rendre', place.id]);
|
|
246
|
+
ecrireLaTrace(racine, traceDesPlaces({ evenement: 'rendue', ticket, place: place.id }));
|
|
226
247
|
} catch (x) {
|
|
227
|
-
if (!(x instanceof AttenteDeLaMachine))
|
|
248
|
+
if (!(x instanceof AttenteDeLaMachine)) {
|
|
249
|
+
throw x;
|
|
250
|
+
}
|
|
228
251
|
dire(
|
|
229
252
|
`⚠ la place ${place.id} ne se rend pas (${x.message}) : le déroulé de la machine la libère à la fin de son processus.`
|
|
230
253
|
);
|
|
@@ -286,7 +309,9 @@ export function surUnePlace(
|
|
|
286
309
|
try {
|
|
287
310
|
return avecUnePlace(place => passe(place.env), { env, dire });
|
|
288
311
|
} catch (e) {
|
|
289
|
-
if (!(e instanceof AttenteDeLaMachine))
|
|
312
|
+
if (!(e instanceof AttenteDeLaMachine)) {
|
|
313
|
+
throw e;
|
|
314
|
+
}
|
|
290
315
|
dire(e.message);
|
|
291
316
|
return e.code;
|
|
292
317
|
}
|
|
@@ -340,15 +365,50 @@ export function lirePlaces({ env = process.env } = {}) {
|
|
|
340
365
|
: { plafond: plafondDe(env), prises: [], attentes: [] };
|
|
341
366
|
}
|
|
342
367
|
|
|
368
|
+
/**
|
|
369
|
+
* The machine a trial fixes under <env> (GRILLHOUSE_MESURE_D_ESSAI, JSON `{ coeurs, charge,
|
|
370
|
+
* memoireLibre }`), or null without the variable.
|
|
371
|
+
* @param {Record<string, string | undefined>} env
|
|
372
|
+
* @returns {{ coeurs: number, charge: number, memoireLibre: number } | null}
|
|
373
|
+
* @throws {Error} naming GRILLHOUSE_MESURE_D_ESSAI when its value is not that JSON
|
|
374
|
+
*/
|
|
375
|
+
function mesureDEssai(env) {
|
|
376
|
+
const v = env[VARIABLE_MESURE_D_ESSAI];
|
|
377
|
+
if (v === undefined || v === '') {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
let m;
|
|
381
|
+
try {
|
|
382
|
+
m = JSON.parse(v);
|
|
383
|
+
} catch {
|
|
384
|
+
m = null;
|
|
385
|
+
}
|
|
386
|
+
if (
|
|
387
|
+
!m ||
|
|
388
|
+
typeof m !== 'object' ||
|
|
389
|
+
['coeurs', 'charge', 'memoireLibre'].some(
|
|
390
|
+
c => typeof m[c] !== 'number' || !Number.isFinite(m[c])
|
|
391
|
+
)
|
|
392
|
+
) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
`${VARIABLE_MESURE_D_ESSAI} vaut « ${v} » : un JSON { coeurs, charge, memoireLibre } de nombres est attendu.`
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
return { coeurs: m.coeurs, charge: m.charge, memoireLibre: m.memoireLibre };
|
|
398
|
+
}
|
|
399
|
+
|
|
343
400
|
/**
|
|
344
401
|
* The places as the board shows them: taken and ceiling, the load over one minute and the cores,
|
|
345
|
-
* the free memory in whole GB, and the waits (ticket, since when) in the order of arrival.
|
|
402
|
+
* the free memory in whole GB, and the waits (ticket, since when) in the order of arrival. The
|
|
403
|
+
* machine is the one GRILLHOUSE_MESURE_D_ESSAI fixes, else the real one (`mesurer`).
|
|
346
404
|
* @param {{ env?: Record<string, string | undefined>, mesurer?: () => { coeurs: number,
|
|
347
405
|
* charge: number, memoireLibre: number } }} [o]
|
|
406
|
+
* @throws {Error} naming GRILLHOUSE_MESURE_D_ESSAI when its value is faulty
|
|
348
407
|
*/
|
|
349
408
|
export function etatDesPlaces({ env = process.env, mesurer = mesureDeLaMachine } = {}) {
|
|
409
|
+
const fixee = mesureDEssai(env);
|
|
350
410
|
const { plafond, prises, attentes } = lirePlaces({ env });
|
|
351
|
-
const m = mesurer();
|
|
411
|
+
const m = fixee ?? mesurer();
|
|
352
412
|
return {
|
|
353
413
|
prises: prises.length,
|
|
354
414
|
plafond,
|
package/scripts/preparation.mjs
CHANGED
|
@@ -26,7 +26,9 @@ import { ecrireLePrefixe } from './prefixe-des-tickets.mjs';
|
|
|
26
26
|
|
|
27
27
|
// The prefix of the tickets: the one given, else the store's own, else the directory's name.
|
|
28
28
|
function prefixeDe(projet, donne) {
|
|
29
|
-
if (donne)
|
|
29
|
+
if (donne) {
|
|
30
|
+
return donne;
|
|
31
|
+
}
|
|
30
32
|
if (existsSync(path.join(projet, '.beads'))) {
|
|
31
33
|
const r = spawnSync('bd', ['config', 'get', 'issue_prefix'], {
|
|
32
34
|
cwd: projet,
|
|
@@ -34,7 +36,9 @@ function prefixeDe(projet, donne) {
|
|
|
34
36
|
maxBuffer: 256 * 1024 * 1024,
|
|
35
37
|
});
|
|
36
38
|
const existant = (r.stdout ?? '').trim();
|
|
37
|
-
if (r.status === 0 && existant !== '' && !existant.includes('('))
|
|
39
|
+
if (r.status === 0 && existant !== '' && !existant.includes('(')) {
|
|
40
|
+
return existant;
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
return path
|
|
40
44
|
.basename(projet)
|
|
@@ -49,7 +53,9 @@ const present = commande => trouverDansLePath(commande) !== null;
|
|
|
49
53
|
|
|
50
54
|
// A global tool of the preparation, installed by npm when absent.
|
|
51
55
|
function outil(commande, paquet) {
|
|
52
|
-
if (present(commande))
|
|
56
|
+
if (present(commande)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
53
59
|
try {
|
|
54
60
|
execFileSync('npm', ['install', '-g', paquet], { stdio: 'inherit' });
|
|
55
61
|
} catch {
|
|
@@ -69,7 +75,9 @@ export function preparer(projet, prefixe) {
|
|
|
69
75
|
}
|
|
70
76
|
outil('bd', '@beads/bd');
|
|
71
77
|
outil('codegraph', '@colbymchenry/codegraph');
|
|
72
|
-
if (!existsSync(path.join(projet, '.codegraph')))
|
|
78
|
+
if (!existsSync(path.join(projet, '.codegraph'))) {
|
|
79
|
+
lancer(projet, 'codegraph', ['init', projet]);
|
|
80
|
+
}
|
|
73
81
|
const lePrefixe = prefixeDe(projet, prefixe);
|
|
74
82
|
lancer(projet, 'bd', [
|
|
75
83
|
'init',
|
|
@@ -86,6 +94,8 @@ export function preparer(projet, prefixe) {
|
|
|
86
94
|
if ((r.stdout ?? '').trim() === '') {
|
|
87
95
|
lancer(projet, 'git', ['config', 'core.hooksPath', '.beads/hooks']);
|
|
88
96
|
}
|
|
89
|
-
if (existsSync(path.join(projet, 'package.json')))
|
|
97
|
+
if (existsSync(path.join(projet, 'package.json'))) {
|
|
98
|
+
lancer(projet, 'npm', ['install']);
|
|
99
|
+
}
|
|
90
100
|
return installerGreffons(projet);
|
|
91
101
|
}
|
package/scripts/registre.mjs
CHANGED
|
@@ -349,10 +349,14 @@ if (direct && process.argv.includes('--rattraper')) {
|
|
|
349
349
|
} else if (direct) {
|
|
350
350
|
try {
|
|
351
351
|
const input = JSON.parse(readFileSync(0, 'utf8'));
|
|
352
|
-
const retenu = Object.fromEntries(
|
|
352
|
+
const retenu = Object.fromEntries(
|
|
353
|
+
CHAMPS.filter(c => input[c] !== null && input[c] !== undefined).map(c => [c, input[c]])
|
|
354
|
+
);
|
|
353
355
|
// The directory the session opened in: the last directory of its shell (`cwd`) may lie where
|
|
354
356
|
// git finds no repository, a mount of the envelope, where git stops at the boundary.
|
|
355
|
-
if (process.env.CLAUDE_PROJECT_DIR)
|
|
357
|
+
if (process.env.CLAUDE_PROJECT_DIR) {
|
|
358
|
+
retenu.projet_dir = process.env.CLAUDE_PROJECT_DIR;
|
|
359
|
+
}
|
|
356
360
|
spawn(process.execPath, [process.argv[1], '--ecrire', JSON.stringify(retenu)], {
|
|
357
361
|
detached: true,
|
|
358
362
|
stdio: 'ignore',
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// The resumption of the circuit at the step that carries a red, with no input nor output (as
|
|
2
|
+
// scripts/transitions.mjs): the attribution of a red to the step that carries it and the step where
|
|
3
|
+
// `--depuis` resumes. Mature model: « Re-run failed jobs » of GitHub Actions (the red job and what
|
|
4
|
+
// depends on it replay). The fingerprint of a step, which hashes with `node:crypto`, is in
|
|
5
|
+
// scripts/empreinte-d-etape.mjs, on the side of the activities.
|
|
6
|
+
import { SUITE } from './etapes.mjs';
|
|
7
|
+
|
|
8
|
+
const etatDe = n => SUITE.find(e => e.numero === n).etat;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The step that carries the red whose places are <lieux> (`{ paquet, fichier, gardes }`), by the
|
|
12
|
+
* files the red names against what the testwriter (`portes.tests`) and the developpeur
|
|
13
|
+
* (`portes.code`) wrote: `{ etape, fichiers, motif? }`. A test file that a guard or the style
|
|
14
|
+
* refuses (`gardes` not empty) is the testwriter's, the earliest step (the developpeur replays
|
|
15
|
+
* after him); a test that fails (no guard) and a file of code are the developpeur's. A red that
|
|
16
|
+
* names no file, or a file nobody wrote, is never attributed (`etape` null, its `motif` said): it
|
|
17
|
+
* goes up.
|
|
18
|
+
*/
|
|
19
|
+
export function attribuerLeRouge({ lieux, portes }) {
|
|
20
|
+
const avecFichier = (lieux ?? []).filter(l => typeof l.fichier === 'string' && l.fichier);
|
|
21
|
+
const nommes = [...new Set(avecFichier.map(l => l.fichier))];
|
|
22
|
+
if (!nommes.length) {
|
|
23
|
+
return { etape: null, fichiers: [], motif: 'le rouge ne nomme aucun fichier' };
|
|
24
|
+
}
|
|
25
|
+
const tests = new Set(portes.tests);
|
|
26
|
+
const code = new Set(portes.code);
|
|
27
|
+
const inconnus = nommes.filter(f => !tests.has(f) && !code.has(f));
|
|
28
|
+
if (inconnus.length) {
|
|
29
|
+
return {
|
|
30
|
+
etape: null,
|
|
31
|
+
fichiers: [],
|
|
32
|
+
motif: `le rouge nomme ${inconnus.join(', ')}, que ni le testwriter ni le développeur ne portent`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const refuses = nommes.filter(
|
|
36
|
+
f => tests.has(f) && avecFichier.some(l => l.fichier === f && (l.gardes ?? []).length > 0)
|
|
37
|
+
);
|
|
38
|
+
return refuses.length
|
|
39
|
+
? { etape: 'testwriter', fichiers: refuses.length === nommes.length ? refuses : nommes }
|
|
40
|
+
: { etape: 'developpeur', fichiers: nommes };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The steps `--depuis` names, each with the state it resumes at.
|
|
44
|
+
const DEPARTS = {
|
|
45
|
+
testwriter: () => ({ etape: etatDe('2'), tentative: 1, finale: false }),
|
|
46
|
+
preuve: () => ({ etape: etatDe('2.1'), tentative: 1, finale: false }),
|
|
47
|
+
developpeur: () => ({ etape: etatDe('3'), tentative: 1, finale: false }),
|
|
48
|
+
controles: () => ({ etape: etatDe('3.1'), tentative: 0, finale: false }),
|
|
49
|
+
'passe-finale': () => ({ etape: etatDe('3.1'), tentative: 0, finale: true }),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** The steps `--depuis` names. */
|
|
53
|
+
export const ETAPES_DE_REPRISE = Object.keys(DEPARTS);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The state `--depuis <nom>` resumes at: that step and the ones after it, no fingerprint kept
|
|
57
|
+
* (`verts` empty), so nothing is read back.
|
|
58
|
+
*/
|
|
59
|
+
export function departDepuis(nom) {
|
|
60
|
+
if (!Object.hasOwn(DEPARTS, nom)) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`--depuis attend une étape du ticket : ${ETAPES_DE_REPRISE.join(', ')} (reçu « ${nom} »).`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return { ...DEPARTS[nom](), rapport: null, verts: {} };
|
|
66
|
+
}
|