@roomi-fields/grillhouse 0.47.0 → 0.48.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 +54 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +18 -38
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +5 -0
- package/cadre/templates/projet/CLAUDE.md +23 -6
- package/charte.md +9 -2
- package/dist/temporal/circuit/commande.js +5 -3
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/commande.js +2 -13
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -1
- package/dist/temporal/deroules.js +2 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -4
- package/dist/temporal/file/activites.js +13 -14
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +20 -91
- package/dist/temporal/file/contrat.js +7 -3
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +1 -9
- package/dist/temporal/file/deroule.js +54 -163
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +26 -1
- package/dist/temporal/installation.js +111 -2
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +11 -2
- package/dist/temporal/nuits/activites.js +16 -5
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/choix.d.ts +15 -0
- package/dist/temporal/nuits/choix.js +20 -0
- package/dist/temporal/nuits/choix.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +16 -3
- package/dist/temporal/nuits/deroule.js +9 -2
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +13 -2
- package/dist/temporal/places/client.js +17 -2
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +41 -4
- package/dist/temporal/places/contrat.js +8 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +46 -6
- package/dist/temporal/places/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +166 -41
- package/docs/INTERFACE.md +13 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +48 -10
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-a-l-arret.mjs +2 -5
- package/scripts/attente-au-tour.mjs +2 -5
- package/scripts/branche-de-nuit.mjs +32 -44
- package/scripts/ci-de-main.mjs +221 -19
- package/scripts/circuit.mjs +47 -34
- package/scripts/commandes-composees.mjs +36 -6
- package/scripts/composition-des-langages.mjs +2 -0
- package/scripts/crochets.mjs +2 -2
- package/scripts/effets.mjs +2 -1
- package/scripts/enveloppe/enveloppe.mjs +61 -6
- package/scripts/enveloppe/travail-de-la-copie.mjs +2 -0
- package/scripts/etapes.mjs +11 -1
- package/scripts/etat-du-depot.mjs +23 -0
- package/scripts/faits-du-circuit.mjs +12 -23
- package/scripts/fermeture-de-la-machine.d.mts +27 -0
- package/scripts/fermeture-de-la-machine.mjs +108 -0
- package/scripts/greffons.mjs +1 -1
- package/scripts/integration/file.mjs +16 -13
- package/scripts/integration/integrer.mjs +2 -0
- package/scripts/jointure.d.ts +5 -0
- package/scripts/langages/c/index.mjs +2 -0
- package/scripts/langages/c/squelette.mjs +1 -1
- package/scripts/langages/cargo/index.mjs +2 -0
- package/scripts/langages/python/index.mjs +2 -0
- package/scripts/langages/typescript/index.mjs +3 -0
- package/scripts/langages/typescript/module-absent.mjs +24 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +19 -1
- package/scripts/langages/typescript/vitest-config/lances.mjs +3 -1
- package/scripts/langages.mjs +25 -3
- package/scripts/machine.mjs +103 -0
- package/scripts/matieres-cles.mjs +17 -0
- package/scripts/matieres-lues.mjs +104 -0
- package/scripts/migrations/0.48.0-ci-declenchee-par-la-file.mjs +32 -0
- package/scripts/migrations/0.48.0-poussee-retiree.mjs +31 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/nuit.sh +16 -44
- package/scripts/passe-de-la-machine.mjs +9 -7
- package/scripts/places-de-la-machine.mjs +74 -11
- package/scripts/places-du-serveur.mjs +29 -8
- package/scripts/poussee-retiree.mjs +18 -0
- package/scripts/registre.d.mts +2 -2
- package/scripts/regles-des-places.d.mts +36 -5
- package/scripts/regles-des-places.mjs +56 -9
- package/scripts/reponses-du-circuit.d.mts +2 -0
- package/scripts/reponses-du-circuit.mjs +26 -0
- package/scripts/resultats.mjs +40 -0
- package/scripts/sous-commandes.mjs +15 -2
- package/scripts/superviseur.mjs +64 -57
- package/scripts/tableau.mjs +132 -67
- package/scripts/transitions.d.mts +8 -0
- package/scripts/transitions.mjs +21 -3
- package/skills/pitmaster/SKILL.md +6 -3
- package/skills/relecteur/SKILL.md +3 -1
- package/scripts/poussee-cles.mjs +0 -46
package/scripts/ci-de-main.mjs
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// The CI of main, read after the lots entered, as Google's TAP plays the whole suite after the
|
|
2
2
|
// submit, by batches of changes, and a red looks for its culprit among the lots entered since the
|
|
3
3
|
// last green. A lot enters main on its final pass (scripts/integration/file.mjs); the CI plays on
|
|
4
|
-
// main
|
|
4
|
+
// main, started by the queue itself after a lot entered, one pass an hour at most, and this module
|
|
5
|
+
// starts it then reads it:
|
|
5
6
|
//
|
|
7
|
+
// - `declencherLaCiDeMain`: the start (`gh workflow run`), its delay and its fault kept in a file of
|
|
8
|
+
// the project; `alerteDeDeclenchement` tells the supervisor of a start GitHub refused.
|
|
6
9
|
// - `lireLaCiDeMain`: the latest finished pass of each workflow of the branch (`gh run list`),
|
|
7
|
-
// green when every one succeeded, red as soon as one failed (any conclusion but `success
|
|
8
|
-
// `cancelled`: a cancelled pass is replaced by a later one, the one before it
|
|
10
|
+
// green when every one succeeded, red as soon as one failed (any conclusion but `success`,
|
|
11
|
+
// `cancelled` and `skipped`: a cancelled pass is replaced by a later one, the one before it
|
|
12
|
+
// decides, and a skipped pass judged nothing, as the flow that alerts on a red one, which skips
|
|
13
|
+
// itself on a green), and not
|
|
9
14
|
// read, never silence, when gh fails, does not start, answers garbage or no pass at all.
|
|
10
15
|
// - `lotsDepuisLeVert`: the lots of the circuit between the last green and the tip, by git alone
|
|
11
16
|
// (the commits whose subject ends with « (<ticket>) »), no state kept.
|
|
@@ -18,6 +23,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
18
23
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
19
24
|
import path from 'node:path';
|
|
20
25
|
import { git, sortie } from './etat-du-depot.mjs';
|
|
26
|
+
import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
21
27
|
|
|
22
28
|
const COURT = 7;
|
|
23
29
|
const court = sha => String(sha).slice(0, COURT);
|
|
@@ -61,7 +67,8 @@ export function lireLaCiDeMain(o, { branche = 'main' } = {}) {
|
|
|
61
67
|
p?.databaseId &&
|
|
62
68
|
p.workflowName &&
|
|
63
69
|
p.status === 'completed' &&
|
|
64
|
-
p.conclusion !== 'cancelled'
|
|
70
|
+
p.conclusion !== 'cancelled' &&
|
|
71
|
+
p.conclusion !== 'skipped'
|
|
65
72
|
)
|
|
66
73
|
.sort((a, b) => b.databaseId - a.databaseId);
|
|
67
74
|
if (finis.length === 0) {
|
|
@@ -85,6 +92,127 @@ export function lireLaCiDeMain(o, { branche = 'main' } = {}) {
|
|
|
85
92
|
return { etat: 'verte', commit: tete.headSha, passage: String(tete.databaseId) };
|
|
86
93
|
}
|
|
87
94
|
|
|
95
|
+
const HEURE = 3_600_000;
|
|
96
|
+
const FLUX_DE_LA_CI = 'ci.yml';
|
|
97
|
+
const EN_ATTENTE = state => state !== 'completed';
|
|
98
|
+
|
|
99
|
+
const etatDuDeclenchement = racine =>
|
|
100
|
+
path.join(racine, '.claude', 'worktrees', 'ci-de-main-declenchee.json');
|
|
101
|
+
|
|
102
|
+
// What the queue keeps of its starts: `declenche` (the instant of the last start, which covers the
|
|
103
|
+
// delay before the pass shows), `entree` (a lot entered whose pass is not started yet) and `faute`
|
|
104
|
+
// (the reason of the last refused start, null when none).
|
|
105
|
+
function lireLEtat(racine) {
|
|
106
|
+
try {
|
|
107
|
+
const lu = JSON.parse(readFileSync(etatDuDeclenchement(racine), 'utf8'));
|
|
108
|
+
return {
|
|
109
|
+
declenche: Number.isFinite(lu?.declenche) ? lu.declenche : null,
|
|
110
|
+
entree: lu?.entree === true,
|
|
111
|
+
faute: typeof lu?.faute === 'string' ? lu.faute : null,
|
|
112
|
+
};
|
|
113
|
+
} catch {
|
|
114
|
+
return { declenche: null, entree: false, faute: null };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function ecrireLEtat(racine, etat) {
|
|
118
|
+
try {
|
|
119
|
+
const f = etatDuDeclenchement(racine);
|
|
120
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
121
|
+
writeFileSync(f, `${JSON.stringify(etat)}\n`);
|
|
122
|
+
} catch {
|
|
123
|
+
// not kept: the next quarter of an hour reads the passes again
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The fault of the last refused start of the CI of the project at <racine>, null when none. */
|
|
128
|
+
export const fauteDeDeclenchement = racine => lireLEtat(racine).faute;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* What the supervisor is told of a start of the CI that GitHub refused: `{ genre, cle, texte }`,
|
|
132
|
+
* a kind apart from « CI de main non lue » and from a red.
|
|
133
|
+
*/
|
|
134
|
+
export function alerteDeDeclenchement(faute) {
|
|
135
|
+
return {
|
|
136
|
+
genre: 'declenchement',
|
|
137
|
+
cle: 'declenchement',
|
|
138
|
+
texte: `La CI de main n'a pas pu être déclenchée : ${uneLigne(faute)} La file continue et retente au quart d'heure suivant.`,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The queue starts the CI of main itself, as the schedulers of Google's TAP and Chromium's LUCI
|
|
144
|
+
* start the pass after the submit, by batches: it reads the passes of the workflow ci.yml on main
|
|
145
|
+
* (whatever started them) with <o.gh> in <o.racine>, and starts it (`gh workflow run`) when the tip
|
|
146
|
+
* of main differs from the commit of the last pass, no pass is running or waiting, and the last
|
|
147
|
+
* pass or the last start is an hour old or more. Without any pass known, only a lot entered
|
|
148
|
+
* (<p.apresEntree>, kept until a start succeeds) starts it, never the sole start of the queue.
|
|
149
|
+
* `{ declenche }`, with `faute` when GitHub refused: the fault is kept for the alert, the next
|
|
150
|
+
* quarter of an hour tries again, and nothing throws.
|
|
151
|
+
*/
|
|
152
|
+
export function declencherLaCiDeMain(o, { apresEntree = false, maintenant = Date.now() } = {}) {
|
|
153
|
+
const { racine } = o;
|
|
154
|
+
const avant = lireLEtat(racine);
|
|
155
|
+
const entree = apresEntree || avant.entree;
|
|
156
|
+
const garder = suite => ecrireLEtat(racine, { ...avant, entree, ...suite });
|
|
157
|
+
const lu = o.gh([
|
|
158
|
+
'run',
|
|
159
|
+
'list',
|
|
160
|
+
'--workflow',
|
|
161
|
+
FLUX_DE_LA_CI,
|
|
162
|
+
'--branch',
|
|
163
|
+
'main',
|
|
164
|
+
'--limit',
|
|
165
|
+
'20',
|
|
166
|
+
'--json',
|
|
167
|
+
'databaseId,status,conclusion,headSha,event,createdAt',
|
|
168
|
+
]);
|
|
169
|
+
let passages;
|
|
170
|
+
try {
|
|
171
|
+
if (lu.error || lu.status !== 0) {
|
|
172
|
+
throw new Error('illisible');
|
|
173
|
+
}
|
|
174
|
+
passages = JSON.parse(lu.stdout || '[]');
|
|
175
|
+
if (!Array.isArray(passages)) {
|
|
176
|
+
throw new Error('illisible');
|
|
177
|
+
}
|
|
178
|
+
} catch {
|
|
179
|
+
garder({});
|
|
180
|
+
return { declenche: false };
|
|
181
|
+
}
|
|
182
|
+
const connus = passages
|
|
183
|
+
.filter(p => p?.headSha)
|
|
184
|
+
.sort(
|
|
185
|
+
(a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt) || b.databaseId - a.databaseId
|
|
186
|
+
);
|
|
187
|
+
if (connus.some(p => EN_ATTENTE(p.status))) {
|
|
188
|
+
garder({});
|
|
189
|
+
return { declenche: false };
|
|
190
|
+
}
|
|
191
|
+
const dernier = connus[0];
|
|
192
|
+
const pointe = sortie(racine, ['rev-parse', 'main']) || sortie(racine, ['rev-parse', 'HEAD']);
|
|
193
|
+
if (dernier ? dernier.headSha === pointe : !entree) {
|
|
194
|
+
garder({ entree: false });
|
|
195
|
+
return { declenche: false };
|
|
196
|
+
}
|
|
197
|
+
const instants = [dernier ? Date.parse(dernier.createdAt) : null, avant.declenche].filter(
|
|
198
|
+
Number.isFinite
|
|
199
|
+
);
|
|
200
|
+
if (instants.length > 0 && maintenant - Math.max(...instants) < HEURE) {
|
|
201
|
+
garder({});
|
|
202
|
+
return { declenche: false };
|
|
203
|
+
}
|
|
204
|
+
const r = o.gh(['workflow', 'run', FLUX_DE_LA_CI, '--ref', 'main']);
|
|
205
|
+
if (r.error || r.status !== 0) {
|
|
206
|
+
const faute = r.error
|
|
207
|
+
? `gh ne se lance pas (${r.error.code ?? r.error.message}).`
|
|
208
|
+
: `gh workflow run refuse : ${uneLigne(`${r.stderr ?? ''} ${r.stdout ?? ''}`)}`;
|
|
209
|
+
garder({ faute });
|
|
210
|
+
return { declenche: false, faute };
|
|
211
|
+
}
|
|
212
|
+
ecrireLEtat(racine, { declenche: maintenant, entree: false, faute: null });
|
|
213
|
+
return { declenche: true };
|
|
214
|
+
}
|
|
215
|
+
|
|
88
216
|
// The ticket a subject « … (<ticket>) » of the circuit's commits ends with, null otherwise.
|
|
89
217
|
const TICKET = /\(([A-Za-z0-9]+-[A-Za-z0-9.]+)\)\s*$/;
|
|
90
218
|
|
|
@@ -117,10 +245,12 @@ export function lotsDepuisLeVert(racine, { vert, pointe }) {
|
|
|
117
245
|
|
|
118
246
|
/**
|
|
119
247
|
* What a reading tells the supervisor: `{ genre, cle, texte }`, null for a green (the alert clears).
|
|
120
|
-
* A red names the workflow, its pass, its commit and each lot <lots> entered since the last green
|
|
121
|
-
*
|
|
248
|
+
* A red names the workflow, its pass, its commit and each lot <lots> entered since the last green,
|
|
249
|
+
* then its defect ticket <defaut> (`ouvrirLeDefautDeMain`): the ticket by its number, a ticket open
|
|
250
|
+
* with no number read, or the fault that kept it from opening (its own key, so that the alert with
|
|
251
|
+
* the ticket is given in its turn); a CI not read is the alert « CI de main non lue ».
|
|
122
252
|
*/
|
|
123
|
-
export function alerteDeLaCiDeMain(lecture, lots) {
|
|
253
|
+
export function alerteDeLaCiDeMain(lecture, lots, defaut) {
|
|
124
254
|
if (lecture.etat === 'verte') {
|
|
125
255
|
return null;
|
|
126
256
|
}
|
|
@@ -136,10 +266,18 @@ export function alerteDeLaCiDeMain(lecture, lots) {
|
|
|
136
266
|
? `Lots entrés depuis le dernier vert (${court(lecture.vert)}) : ${lots.map(l => l.ticket).join(', ')}.`
|
|
137
267
|
: `aucun lot du circuit entré depuis le dernier vert (${court(lecture.vert)}).`
|
|
138
268
|
: 'aucun vert connu pour ce flux : les lots entrés ne se nomment pas.';
|
|
269
|
+
const sans = Boolean(defaut?.faute);
|
|
270
|
+
const defautDit = !defaut
|
|
271
|
+
? ''
|
|
272
|
+
: sans
|
|
273
|
+
? ` Le ticket de défaut n'a pas pu s'ouvrir : ${uneLigne(defaut.faute)} Chaque relevé retente.`
|
|
274
|
+
: defaut.ticket
|
|
275
|
+
? ` La recherche du coupable est le ticket de défaut ${defaut.ticket}, ouvert pour le responsable.`
|
|
276
|
+
: ` Un ticket de défaut est ouvert pour le responsable (son numéro ne s'est pas lu).`;
|
|
139
277
|
return {
|
|
140
278
|
genre: 'rouge',
|
|
141
|
-
cle: `rouge ${lecture.passage}`,
|
|
142
|
-
texte: `CI de main rouge : ${lecture.flux}, passage ${lecture.passage} (commit ${court(lecture.commit)}). ${depuis} La file continue d'avancer main
|
|
279
|
+
cle: sans ? `rouge ${lecture.passage} sans ticket` : `rouge ${lecture.passage}`,
|
|
280
|
+
texte: `CI de main rouge : ${lecture.flux}, passage ${lecture.passage} (commit ${court(lecture.commit)}). ${depuis} La file continue d'avancer main.${defautDit}`,
|
|
143
281
|
};
|
|
144
282
|
}
|
|
145
283
|
|
|
@@ -161,13 +299,39 @@ const titreDuDefaut = l => `CI de main rouge — ${l.flux}, passage ${l.passage}
|
|
|
161
299
|
* The defect ticket a red <lecture> opens under `a-valider` with the tools <o> (`bd` of the
|
|
162
300
|
* project): its title names the workflow and the red pass, its description the commit and each
|
|
163
301
|
* candidate lot <lots>. One ticket per pass, closed or not: a pass that already has its ticket opens
|
|
164
|
-
* none
|
|
165
|
-
*
|
|
302
|
+
* none. The queue and the supervisor's reading both open it through this function, and the search
|
|
303
|
+
* of a doublon and the creation are played under a file lock of the project <o.racine>, so that
|
|
304
|
+
* two openings at once make one ticket. A green or a CI not read opens none (the alert says it, no
|
|
305
|
+
* defect is proven). `{ ouvert, ticket, faute? }`: `ticket` is the number of the ticket created
|
|
306
|
+
* (read on the output of the creation) or already holding the pass, null when none is readable; a
|
|
307
|
+
* creation Beads refuses is a fault named.
|
|
166
308
|
*/
|
|
167
309
|
export function ouvrirLeDefautDeMain(o, lecture, lots) {
|
|
168
310
|
if (lecture.etat !== 'rouge') {
|
|
169
|
-
return { ouvert: false };
|
|
311
|
+
return { ouvert: false, ticket: null };
|
|
170
312
|
}
|
|
313
|
+
const verrou = path.join(o.racine, '.claude', 'worktrees', 'ci-de-main-defaut.verrou');
|
|
314
|
+
try {
|
|
315
|
+
mkdirSync(path.dirname(verrou), { recursive: true });
|
|
316
|
+
} catch {
|
|
317
|
+
// the lock is then taken without its directory and fails: the creation goes on unlocked
|
|
318
|
+
}
|
|
319
|
+
let pris = false;
|
|
320
|
+
try {
|
|
321
|
+
pris = prendreVerrou(verrou, { attendre: true });
|
|
322
|
+
} catch {
|
|
323
|
+
// a lock that cannot be taken costs the race guard, not the ticket
|
|
324
|
+
}
|
|
325
|
+
try {
|
|
326
|
+
return ouvrirSousVerrou(o, lecture, lots);
|
|
327
|
+
} finally {
|
|
328
|
+
if (pris) {
|
|
329
|
+
lacherVerrou(verrou);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function ouvrirSousVerrou(o, lecture, lots) {
|
|
171
335
|
const titre = titreDuDefaut(lecture);
|
|
172
336
|
const existants = o.bd('list', '--all', '--label', A_VALIDER, '--limit', '0', '--json');
|
|
173
337
|
if (existants.status === 0) {
|
|
@@ -175,7 +339,7 @@ export function ouvrirLeDefautDeMain(o, lecture, lots) {
|
|
|
175
339
|
const l = JSON.parse(existants.stdout || '[]');
|
|
176
340
|
const deja = (Array.isArray(l) ? l : []).find(t => t?.title === titre);
|
|
177
341
|
if (deja) {
|
|
178
|
-
return { ouvert: false, doublon: deja.id };
|
|
342
|
+
return { ouvert: false, ticket: deja.id ?? null, doublon: deja.id };
|
|
179
343
|
}
|
|
180
344
|
} catch {
|
|
181
345
|
// A list that does not read opens the ticket: a doublon is the lesser fault.
|
|
@@ -206,12 +370,26 @@ export function ouvrirLeDefautDeMain(o, lecture, lots) {
|
|
|
206
370
|
if (r.status !== 0) {
|
|
207
371
|
return {
|
|
208
372
|
ouvert: false,
|
|
373
|
+
ticket: null,
|
|
209
374
|
faute: `bd create refuse : ${uneLigne(`${r.stderr ?? ''}${r.stdout ?? ''}`)}`,
|
|
210
375
|
};
|
|
211
376
|
}
|
|
212
|
-
|
|
377
|
+
const numero = /^([A-Za-z0-9]+-[A-Za-z0-9.]+)$/.exec(String(r.stdout ?? '').trim())?.[1];
|
|
378
|
+
return { ouvert: true, ticket: numero ?? null };
|
|
213
379
|
}
|
|
214
380
|
|
|
381
|
+
// `bd` run in the project at <racine>, found on the PATH as the project's own.
|
|
382
|
+
export const bdDans =
|
|
383
|
+
racine =>
|
|
384
|
+
(...args) =>
|
|
385
|
+
spawnSync('bd', args, {
|
|
386
|
+
cwd: racine,
|
|
387
|
+
env: process.env,
|
|
388
|
+
encoding: 'utf8',
|
|
389
|
+
timeout: 60_000,
|
|
390
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
391
|
+
});
|
|
392
|
+
|
|
215
393
|
// The GitHub CLI run in the main tree <racine>.
|
|
216
394
|
export const ghDans =
|
|
217
395
|
racine =>
|
|
@@ -225,7 +403,7 @@ export const ghDans =
|
|
|
225
403
|
});
|
|
226
404
|
|
|
227
405
|
// How long a reading of the CI of main stays as read, for the board and the greffon, which ask
|
|
228
|
-
// again and again: the CI plays
|
|
406
|
+
// again and again: the CI plays an hour apart at most, GitHub need not be asked at each refresh.
|
|
229
407
|
const VALIDITE_DE_LA_LECTURE = 5 * 60_000;
|
|
230
408
|
|
|
231
409
|
/**
|
|
@@ -263,11 +441,35 @@ export function ciDeMainGardee(
|
|
|
263
441
|
* The alert of a <lecture> of the CI of the project at <racine>, its lots named by git up to the
|
|
264
442
|
* tip of its main tree: `{ genre, cle, texte }`, null for a green.
|
|
265
443
|
*/
|
|
266
|
-
export function alerteDuProjet(racine, lecture) {
|
|
444
|
+
export function alerteDuProjet(racine, lecture, defaut) {
|
|
445
|
+
return alerteDeLaCiDeMain(lecture, lotsDuProjet(racine, lecture), defaut);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** The lots entered since the last green of a red <lecture>, up to the tip of the tree at <racine>. */
|
|
449
|
+
export function lotsDuProjet(racine, lecture) {
|
|
267
450
|
if (lecture.etat !== 'rouge') {
|
|
268
|
-
return
|
|
451
|
+
return [];
|
|
269
452
|
}
|
|
270
453
|
const pointe = sortie(racine, ['rev-parse', 'HEAD']);
|
|
271
|
-
|
|
272
|
-
|
|
454
|
+
return pointe ? lotsDepuisLeVert(racine, { vert: lecture.vert, pointe }) : [];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* The CI of main read for the supervisor at <racine>, its defect ticket opened by the same function
|
|
459
|
+
* as the queue's (`ouvrirLeDefautDeMain`, in this project, with its own Beads): the alert, null for
|
|
460
|
+
* a green, undefined for a project with no CI to read. Only the supervisor's reading calls it, the
|
|
461
|
+
* board reads `ciDeMainGardee` alone.
|
|
462
|
+
*/
|
|
463
|
+
export function lireEtOuvrirLeDefautDeMain(racine, { gh } = {}) {
|
|
464
|
+
const lecture = ciDeMainGardee(racine, gh ? { gh } : {});
|
|
465
|
+
if (!lecture) {
|
|
466
|
+
return undefined;
|
|
467
|
+
}
|
|
468
|
+
const defaut =
|
|
469
|
+
lecture.etat === 'rouge'
|
|
470
|
+
? ouvrirLeDefautDeMain({ racine, bd: bdDans(racine) }, lecture, lotsDuProjet(racine, lecture))
|
|
471
|
+
: undefined;
|
|
472
|
+
const alerte = alerteDuProjet(racine, lecture, defaut);
|
|
473
|
+
const faute = fauteDeDeclenchement(racine);
|
|
474
|
+
return alerte ?? (faute ? alerteDeDeclenchement(faute) : alerte);
|
|
273
475
|
}
|
package/scripts/circuit.mjs
CHANGED
|
@@ -606,7 +606,8 @@
|
|
|
606
606
|
// no reference writes, or whose command fails), 24 hors-plan (a testwriter or developpeur session its lock
|
|
607
607
|
// stops on a write out of the plan, `hors-plan` that lancer.sh ranges under the session's id), 25 inattendu
|
|
608
608
|
// (an act that fails, an exception no rule of the circuit settles: its message, its stack and its
|
|
609
|
-
// step in its question, `arretInattendu`), each a question for the supervisor;
|
|
609
|
+
// step in its question, `arretInattendu`), each a question for the supervisor; 26 limite-d-usage (a session the
|
|
610
|
+
// usage limit cuts: no question, the circuit reports itself to the hour the usage returns and resumes the step); 75 a-repasser (a check or the integration still at 75 once played again,
|
|
610
611
|
// or the branch still in the queue), the gesture `a-repasser`.
|
|
611
612
|
import { spawnSync } from 'node:child_process';
|
|
612
613
|
import { createHash } from 'node:crypto';
|
|
@@ -625,6 +626,7 @@ import path from 'node:path';
|
|
|
625
626
|
import { empreintesDe, outilsDe } from './outils-cles.mjs';
|
|
626
627
|
import { donneesDe } from './donnees-cles.mjs';
|
|
627
628
|
import { engendresDe } from './engendres.mjs';
|
|
629
|
+
import { matieresDeclareesDe } from './matieres-cles.mjs';
|
|
628
630
|
import { fluxDe } from './flux-des-paquets.mjs';
|
|
629
631
|
import {
|
|
630
632
|
AGENTS_DU_LOT,
|
|
@@ -648,6 +650,7 @@ import {
|
|
|
648
650
|
questionsPosees,
|
|
649
651
|
rapportDuRefus,
|
|
650
652
|
TESTS,
|
|
653
|
+
testwriterDemande,
|
|
651
654
|
} from './transitions.mjs';
|
|
652
655
|
import { departDepuis } from './reprise.mjs';
|
|
653
656
|
import {
|
|
@@ -703,9 +706,16 @@ import { ligneDEtape, transcriptionsDeLaCopie } from './registre.mjs';
|
|
|
703
706
|
import {
|
|
704
707
|
bloquantsDeLaFiche,
|
|
705
708
|
cleDuConstat,
|
|
709
|
+
estUneBascule,
|
|
710
|
+
estUnPlan,
|
|
711
|
+
ficheDuPlan,
|
|
706
712
|
reponsesAuxQuestions,
|
|
713
|
+
sorteDesFiches,
|
|
707
714
|
sorteDuPlan,
|
|
708
715
|
} from './resultats.mjs';
|
|
716
|
+
|
|
717
|
+
// The sheet of the plan that says a field, as scripts/resultats.mjs reads it.
|
|
718
|
+
export { ficheDuPlan };
|
|
709
719
|
import { preparer, rolesDuConflit } from './enveloppe/travail-de-la-copie.mjs';
|
|
710
720
|
import { refusArbitrage } from './integration/integrer.mjs';
|
|
711
721
|
import { prendreUnRang } from './places-de-la-machine.mjs';
|
|
@@ -1186,6 +1196,27 @@ export function engendresAuLancement(racine) {
|
|
|
1186
1196
|
}
|
|
1187
1197
|
}
|
|
1188
1198
|
|
|
1199
|
+
// The folders of test material the project declares (`grillhouse.matieres`,
|
|
1200
|
+
// scripts/matieres-cles.mjs), read at the launch of a run from its main tree: `{ matieres }`, or
|
|
1201
|
+
// `{ arret }`, the stop « lancement » that goes up to the supervisor before any session, the
|
|
1202
|
+
// faults of the key named.
|
|
1203
|
+
export function matieresAuLancement(racine) {
|
|
1204
|
+
try {
|
|
1205
|
+
return { matieres: matieresDeclareesDe(racine) };
|
|
1206
|
+
} catch (err) {
|
|
1207
|
+
const rapport = `La clé grillhouse.matieres du package.json est refusée :\n${err.message}`;
|
|
1208
|
+
return {
|
|
1209
|
+
arret: {
|
|
1210
|
+
code: ARRETS.lancement,
|
|
1211
|
+
nom: 'lancement',
|
|
1212
|
+
rapport,
|
|
1213
|
+
piece: `$ npm pkg get grillhouse.matieres\n${rapport}`,
|
|
1214
|
+
question: `${rapport}\nLa clé se corrige au package.json du projet, puis \`--reprendre\`.`,
|
|
1215
|
+
},
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1189
1220
|
// The flows of the CI the project declares (`grillhouse.flux`, scripts/flux-des-paquets.mjs), read
|
|
1190
1221
|
// at the launch of a run from its main tree: `{ flux }`, or `{ arret }`, the stop « lancement »
|
|
1191
1222
|
// that goes up to the supervisor before any session, the faults of the key named.
|
|
@@ -1293,39 +1324,9 @@ export function constatsOuverts(ctx, fiche, texte) {
|
|
|
1293
1324
|
return [...restes, ...neufs];
|
|
1294
1325
|
}
|
|
1295
1326
|
|
|
1296
|
-
// The
|
|
1297
|
-
//
|
|
1298
|
-
|
|
1299
|
-
// answers, so that the field survives the answer; null without a sheet of the plan.
|
|
1300
|
-
export function ficheDuPlan(plans, champ) {
|
|
1301
|
-
const derniere = plans.at(-1);
|
|
1302
|
-
if (!derniere) {
|
|
1303
|
-
return null;
|
|
1304
|
-
}
|
|
1305
|
-
if (derniere.reponse && !(champ in derniere.fiche) && plans.length > 1) {
|
|
1306
|
-
return plans.at(-2).fiche;
|
|
1307
|
-
}
|
|
1308
|
-
return derniere.fiche;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
// A sheet of the plan (the explorateur's, which holds criteria), and a line of the circuit that
|
|
1312
|
-
// turns the sort of the ticket on the same plan (`ecrireLaSorte`: the supervisor's `--mecanique`,
|
|
1313
|
-
// the reviewer's `comportement-change`).
|
|
1314
|
-
const estUnPlan = e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres);
|
|
1315
|
-
const estUneBascule = e =>
|
|
1316
|
-
e.role === AUTEUR_DU_CIRCUIT && typeof e.sorte === 'object' && e.sorte !== null;
|
|
1317
|
-
|
|
1318
|
-
// The sort of the ticket its plan says (`sorteDuPlan` of scripts/resultats.mjs): the sheet of the
|
|
1319
|
-
// plan that says it (`ficheDuPlan`), comportement without one (grillhouse-sos); a line that turns
|
|
1320
|
-
// the sort after the last sheet of the plan stands over it, the plan kept as it is.
|
|
1321
|
-
function sorteDuTicket(ctx) {
|
|
1322
|
-
const tous = lesFiches(ctx);
|
|
1323
|
-
const bascule = tous.findLastIndex(estUneBascule);
|
|
1324
|
-
if (bascule > tous.findLastIndex(estUnPlan)) {
|
|
1325
|
-
return tous[bascule].sorte;
|
|
1326
|
-
}
|
|
1327
|
-
return sorteDuPlan(ficheDuPlan(tous.filter(estUnPlan), 'sorte'));
|
|
1328
|
-
}
|
|
1327
|
+
// The sort of the ticket of <ctx>, read from its kept results (`sorteDesFiches` of
|
|
1328
|
+
// scripts/resultats.mjs).
|
|
1329
|
+
const sorteDuTicket = ctx => sorteDesFiches(lesFiches(ctx));
|
|
1329
1330
|
|
|
1330
1331
|
// Whether a testwriter or a developpeur has worked the lot since the last sheet of the plan or the
|
|
1331
1332
|
// last turn of its sort.
|
|
@@ -1674,6 +1675,12 @@ const laQuestion = (ticket, { arret, qui, ou, question }) =>
|
|
|
1674
1675
|
// the state <e> (null without one) on --reprendre, the integration or the queue played again on
|
|
1675
1676
|
// the same lot after their stop, as bors retries, else the testwriter, the run starting over.
|
|
1676
1677
|
function depart(ctx, e) {
|
|
1678
|
+
// The supervisor's command wins over the sort of the plan: the mark of his `--depuis testwriter`.
|
|
1679
|
+
ctx.testwriterDemande = testwriterDemande({
|
|
1680
|
+
depuis: ctx.depuis ?? null,
|
|
1681
|
+
reprendre: Boolean(ctx.reprendre),
|
|
1682
|
+
marque: Boolean(ctx.testwriterDemande),
|
|
1683
|
+
});
|
|
1677
1684
|
// A --depuis plays its step and the ones after it, no result read back: no fingerprint kept, no
|
|
1678
1685
|
// resumption at a red, no attribution counted.
|
|
1679
1686
|
if (ctx.depuis) {
|
|
@@ -2595,6 +2602,12 @@ async function avantLePlan(ctx, e) {
|
|
|
2595
2602
|
return { code: monter(ctx, { ...engendres.arret, etat: d }) };
|
|
2596
2603
|
}
|
|
2597
2604
|
ctx.engendres = engendres.engendres;
|
|
2605
|
+
// The folders of test material the project declares: refused at the launch when the key is
|
|
2606
|
+
// faulty, before any session.
|
|
2607
|
+
const matieres = matieresAuLancement(ctx.racine);
|
|
2608
|
+
if (matieres.arret) {
|
|
2609
|
+
return { code: monter(ctx, { ...matieres.arret, etat: d }) };
|
|
2610
|
+
}
|
|
2598
2611
|
// The flows of the CI, refused at the launch when their key is faulty: the reviewer's instruction
|
|
2599
2612
|
// reads those the lot touches (`consigneDesFlux`).
|
|
2600
2613
|
const flux = fluxAuLancement(ctx.racine);
|
|
@@ -21,10 +21,15 @@
|
|
|
21
21
|
// module takes is refused, named, and nothing plays (code 2).
|
|
22
22
|
// - The launcher's `construire --echec <fichier> <plan>` is one implementation for every language
|
|
23
23
|
// (scripts/taches-du-graphe.mjs): the first module plays it, once.
|
|
24
|
-
// - No
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
24
|
+
// - No module is given a green to defer: the last green (scripts/dernier-vert.mjs) is kept by the
|
|
25
|
+
// one pass of the verification, once, when every task of every language of the graph is green
|
|
26
|
+
// (scripts/langages/typescript/verifier.mjs). A module that plays after a red one gets
|
|
27
|
+
// `PASSE_ROUGE` in its environment: that pass keeps none. A project without a module of
|
|
28
|
+
// package.json (cargo alone, python alone) has no such pass: the composed `verifier` keeps the
|
|
29
|
+
// green itself then, on the tree the repository had before the modules played, when every module
|
|
30
|
+
// is green and the verification is whole (`garderSansLeGraphe`). Without it no tree of such a
|
|
31
|
+
// project was ever judged, and the pre-push hook let none of its commits go to main
|
|
32
|
+
// (open-synth-descriptors and osc-bridge, 2026-11-21).
|
|
28
33
|
// - `verifier`: the module of package.json plays last, and passes over the whole graph (every task
|
|
29
34
|
// of every language, once); the others play before it in their declared order and get
|
|
30
35
|
// `GRAPHE_JOUE` and play no task of it again (cargo: its `deny check` alone), so that nextest
|
|
@@ -35,6 +40,8 @@ import { spawnSync } from 'node:child_process';
|
|
|
35
40
|
import { constants } from 'node:os';
|
|
36
41
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
37
42
|
import { moduleDuFichier } from './composition-des-langages.mjs';
|
|
43
|
+
import { garderLeVert } from './dernier-vert.mjs';
|
|
44
|
+
import { etatDuDepot } from './etat-du-depot.mjs';
|
|
38
45
|
import { langagesDe } from './langages.mjs';
|
|
39
46
|
import { GRAPHE_JOUE, PASSE_ROUGE } from './taches-du-graphe.mjs';
|
|
40
47
|
|
|
@@ -96,13 +103,30 @@ function repartir(nom, args, modules, racine) {
|
|
|
96
103
|
};
|
|
97
104
|
}
|
|
98
105
|
|
|
106
|
+
// The options that make a verification partial: its green is kept by no one.
|
|
107
|
+
const PARTIELLE = /^(--gardes|--sans-tests|--tranche(=.*)?|--filter(=.*)?|-F)$/;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The state a composed `verifier` keeps as the last green when its modules are all green: the one
|
|
111
|
+
* of the repository at <racine> before they play, for a whole verification (<args>) of a project
|
|
112
|
+
* that has no module of package.json (<duGraphe>), whose pass keeps it otherwise; null when this
|
|
113
|
+
* command keeps none.
|
|
114
|
+
*/
|
|
115
|
+
function garderSansLeGraphe(nom, args, duGraphe, racine) {
|
|
116
|
+
if (nom !== 'verifier' || duGraphe || args.some(a => PARTIELLE.test(a))) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const etat = etatDuDepot(racine);
|
|
120
|
+
return etat.raison ? null : etat;
|
|
121
|
+
}
|
|
122
|
+
|
|
99
123
|
/**
|
|
100
124
|
* Plays the command <nom> with <args> in each module of <modules> that describes it, in the
|
|
101
125
|
* project at <racine>, under <env>: the joined exit code.
|
|
102
126
|
* @param {string} nom
|
|
103
127
|
* @param {string[]} args
|
|
104
128
|
* @param {{ racine?: string, modules?: import('./jointure.js').Langage[], env?: NodeJS.ProcessEnv,
|
|
105
|
-
* dire?: (ligne: string) => void }} [o]
|
|
129
|
+
* dire?: (ligne: string) => void, garder?: (etat: object) => void }} [o]
|
|
106
130
|
* @returns {number}
|
|
107
131
|
*/
|
|
108
132
|
export function jouer(
|
|
@@ -113,6 +137,7 @@ export function jouer(
|
|
|
113
137
|
modules = langagesDe(racine),
|
|
114
138
|
env = process.env,
|
|
115
139
|
dire = l => process.stderr.write(`${l}\n`),
|
|
140
|
+
garder = garderLeVert,
|
|
116
141
|
} = {}
|
|
117
142
|
) {
|
|
118
143
|
const avec = modules.filter(m => Object.hasOwn(m.commandes(racine), nom));
|
|
@@ -133,6 +158,7 @@ export function jouer(
|
|
|
133
158
|
nom === 'verifier' && duGraphe
|
|
134
159
|
? [...r.parts.filter(x => x.module !== duGraphe), ...r.parts.filter(x => x.module === duGraphe)]
|
|
135
160
|
: r.parts;
|
|
161
|
+
const aGarder = garderSansLeGraphe(nom, args, duGraphe, racine);
|
|
136
162
|
for (const { module, args: siens } of ordre) {
|
|
137
163
|
const c = module.commandes(racine)[nom];
|
|
138
164
|
dire(`▶ ${module.nom} : ${nom}`);
|
|
@@ -153,7 +179,11 @@ export function jouer(
|
|
|
153
179
|
codes.push(p.status ?? 128 + (constants.signals[p.signal ?? 'SIGTERM'] ?? 0));
|
|
154
180
|
}
|
|
155
181
|
}
|
|
156
|
-
|
|
182
|
+
const code = unir(codes);
|
|
183
|
+
if (code === 0 && aGarder && codes.length) {
|
|
184
|
+
garder(aGarder);
|
|
185
|
+
}
|
|
186
|
+
return code;
|
|
157
187
|
}
|
|
158
188
|
|
|
159
189
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
@@ -265,6 +265,8 @@ export function composer(modules) {
|
|
|
265
265
|
};
|
|
266
266
|
},
|
|
267
267
|
echecDeCompilation: texte => modules.some(m => m.echecDeCompilation?.(texte) ?? false),
|
|
268
|
+
moduleAbsent: (message, fichier) =>
|
|
269
|
+
modules.map(m => m.moduleAbsent?.(message, fichier) ?? null).find(Boolean) ?? null,
|
|
268
270
|
estUnTest: (chemin, racine) =>
|
|
269
271
|
premiereReponse(modules, racine, chemin, m => m.estUnTest(chemin, racine)),
|
|
270
272
|
horsDuJour: (chemin, racine) =>
|
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
|
|
10
|
+
// - pre-push: the judged main guard and the refusal of the retired key (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.
|
|
@@ -50,7 +50,7 @@ export const CROCHETS = {
|
|
|
50
50
|
'pre-push': {
|
|
51
51
|
garde: 'branche-de-nuit.mjs',
|
|
52
52
|
lignes: [
|
|
53
|
-
'#
|
|
53
|
+
'# Judged main guard (Grillhouse): main receives only a tree a final pass or a verification judged green; a project that carries the retired grillhouse.poussee is refused. Without the package @roomi-fields/grillhouse installed, nothing.',
|
|
54
54
|
COMMANDE,
|
|
55
55
|
'if [ -x "$_gh_commande" ]; then _gh_entree=$(mktemp) && cat > "$_gh_entree" && "$_gh_commande" hook pre-push "$@" < "$_gh_entree" || { rm -f "$_gh_entree"; exit 1; }; exec < "$_gh_entree"; rm -f "$_gh_entree"; fi',
|
|
56
56
|
],
|
package/scripts/effets.mjs
CHANGED
|
@@ -44,6 +44,7 @@ import { stripVTControlCharacters } from 'node:util';
|
|
|
44
44
|
import { ecrireLeBilan } from './bilan.mjs';
|
|
45
45
|
import { ecrireLaTrace } from './journal-des-etats.mjs';
|
|
46
46
|
import { ecrire as ecrireAuRegistre } from './registre.mjs';
|
|
47
|
+
import { AUTEUR_DU_CIRCUIT } from './etapes.mjs';
|
|
47
48
|
|
|
48
49
|
/** The line of HTML comment that carries the key <cle> in a text at a ticket. */
|
|
49
50
|
export const marqueDeCle = cle => `<!-- grillhouse : ${cle} -->`;
|
|
@@ -62,7 +63,7 @@ export const AVEC_CLE = new Set([
|
|
|
62
63
|
// git user.name, $USER »), each session's its role; the author of the circuit's own lines, and
|
|
63
64
|
// the start of each of them at a ticket.
|
|
64
65
|
export const ACTEUR = 'BEADS_ACTOR';
|
|
65
|
-
export
|
|
66
|
+
export { AUTEUR_DU_CIRCUIT };
|
|
66
67
|
export const PREFIXE = 'Circuit · ';
|
|
67
68
|
const TICKET_SH = path.join(import.meta.dirname, 'ticket.sh');
|
|
68
69
|
|