@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
|
@@ -122,8 +122,12 @@ function appliquer(copie, lot, cles = null, autres = []) {
|
|
|
122
122
|
lot
|
|
123
123
|
);
|
|
124
124
|
const conflits = enConflit(copie);
|
|
125
|
-
if (r.status !== 0 && !conflits.length)
|
|
126
|
-
|
|
125
|
+
if (r.status !== 0 && !conflits.length) {
|
|
126
|
+
return { conflits: null };
|
|
127
|
+
}
|
|
128
|
+
if (conflits.length || !touches.length || !cles) {
|
|
129
|
+
return { conflits };
|
|
130
|
+
}
|
|
127
131
|
const refus = regenerer({
|
|
128
132
|
refs: touches.map(e => ({ ...e, cadre: false })),
|
|
129
133
|
lancer: commande =>
|
|
@@ -149,13 +153,17 @@ export function reporter(copie, { base, pointe }) {
|
|
|
149
153
|
return { ok: false, message: `⛔ Le lot de ${base} à ${pointe} ne se lit pas : ${texte(d)}` };
|
|
150
154
|
}
|
|
151
155
|
const cles = lesCles(copie);
|
|
152
|
-
if (cles.refus !== undefined)
|
|
156
|
+
if (cles.refus !== undefined) {
|
|
157
|
+
return { ok: false, message: cles.refus };
|
|
158
|
+
}
|
|
153
159
|
const a = appliquer(copie, d.stdout, cles);
|
|
154
160
|
if (a.conflits === null) {
|
|
155
161
|
return { ok: false, message: `⛔ Le lot ne s'applique pas à la copie ${copie}.` };
|
|
156
162
|
}
|
|
157
163
|
const r = git(copie, ['reset', '-q']);
|
|
158
|
-
if (a.refus)
|
|
164
|
+
if (a.refus) {
|
|
165
|
+
return { ok: false, message: `⛔ ${a.refus}` };
|
|
166
|
+
}
|
|
159
167
|
return r.status === 0 ? { ok: true, message: '' } : { ok: false, message: texte(r) };
|
|
160
168
|
}
|
|
161
169
|
|
|
@@ -190,7 +198,9 @@ export function avancer(copie, cible) {
|
|
|
190
198
|
};
|
|
191
199
|
}
|
|
192
200
|
const cles = lesCles(copie);
|
|
193
|
-
if (cles.refus !== undefined)
|
|
201
|
+
if (cles.refus !== undefined) {
|
|
202
|
+
return { ok: false, message: cles.refus };
|
|
203
|
+
}
|
|
194
204
|
const tete = String(git(copie, ['rev-parse', 'HEAD']).stdout).trim();
|
|
195
205
|
const vise = git(copie, ['rev-parse', '--verify', `${cible}^{commit}`]);
|
|
196
206
|
if (vise.status !== 0) {
|
|
@@ -286,7 +296,9 @@ export function preparer(copie, cible, { env = process.env, sortie = 2 } = {}) {
|
|
|
286
296
|
stdio,
|
|
287
297
|
maxBuffer: 64 * 1024 * 1024,
|
|
288
298
|
});
|
|
289
|
-
if (r.status === 0 && r.stderr?.length)
|
|
299
|
+
if (r.status === 0 && r.stderr?.length) {
|
|
300
|
+
writeSync(sortie, r.stderr);
|
|
301
|
+
}
|
|
290
302
|
return r;
|
|
291
303
|
};
|
|
292
304
|
const echec = (r, quoi) => ({
|
|
@@ -296,18 +308,26 @@ export function preparer(copie, cible, { env = process.env, sortie = 2 } = {}) {
|
|
|
296
308
|
});
|
|
297
309
|
if (cible !== null) {
|
|
298
310
|
const g = bash(['garde', copie], ['ignore', sortie, 'pipe']);
|
|
299
|
-
if (g.status !== 0)
|
|
311
|
+
if (g.status !== 0) {
|
|
312
|
+
return echec(g, 'La garde des sous-modules');
|
|
313
|
+
}
|
|
300
314
|
const a = avancer(copie, cible);
|
|
301
|
-
if (!a.ok)
|
|
315
|
+
if (!a.ok) {
|
|
316
|
+
return { ...a, partages: '' };
|
|
317
|
+
}
|
|
302
318
|
}
|
|
303
319
|
const p = bash(['pose', copie], ['ignore', 'pipe', 'pipe']);
|
|
304
|
-
if (p.status !== 0)
|
|
320
|
+
if (p.status !== 0) {
|
|
321
|
+
return echec(p, 'La pose des sous-modules');
|
|
322
|
+
}
|
|
305
323
|
// As `$(…)` reads it: the final newlines dropped.
|
|
306
324
|
const partages = String(p.stdout).replace(/\n+$/, '');
|
|
307
325
|
const monter = (...commande) =>
|
|
308
326
|
bash(['monter', copie, '--partages', partages, ...commande], ['ignore', sortie, 'pipe']);
|
|
309
327
|
const m = monter('true');
|
|
310
|
-
if (m.status !== 0)
|
|
328
|
+
if (m.status !== 0) {
|
|
329
|
+
return echec(m, 'Le montage des sous-modules partagés');
|
|
330
|
+
}
|
|
311
331
|
if (existsSync(path.join(copie, 'package.json'))) {
|
|
312
332
|
// As `[ lock -nt installed ]`: the lock newer than the installation, or no installation.
|
|
313
333
|
const verrou = path.join(copie, 'package-lock.json');
|
|
@@ -327,7 +347,9 @@ export function preparer(copie, cible, { env = process.env, sortie = 2 } = {}) {
|
|
|
327
347
|
'--no-fund',
|
|
328
348
|
'--silent'
|
|
329
349
|
);
|
|
330
|
-
if (i.status !== 0)
|
|
350
|
+
if (i.status !== 0) {
|
|
351
|
+
return echec(i, "L'installation");
|
|
352
|
+
}
|
|
331
353
|
}
|
|
332
354
|
}
|
|
333
355
|
return { ok: true, message: '', partages };
|
|
@@ -347,7 +369,9 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
347
369
|
};
|
|
348
370
|
// `preparer` prints the list its pose fixes on stdout, its messages on stderr.
|
|
349
371
|
if (geste === 'preparer') {
|
|
350
|
-
if (r.message)
|
|
372
|
+
if (r.message) {
|
|
373
|
+
process.stderr.write(`${r.message}\n`);
|
|
374
|
+
}
|
|
351
375
|
process.stdout.write(r.partages ?? '');
|
|
352
376
|
} else if (r.message) {
|
|
353
377
|
process.stdout.write(`${r.message}\n`);
|
package/scripts/etapes.mjs
CHANGED
|
@@ -218,7 +218,7 @@ export const GESTES = [
|
|
|
218
218
|
genre: 'rien-a-livrer',
|
|
219
219
|
geste: 'aux contrôles, qui jugent le lot',
|
|
220
220
|
regle:
|
|
221
|
-
'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison) ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
|
|
221
|
+
'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison), sauf le rouge d’une référence que le lot fait baisser, la dette des gardes, qui se régénère au lieu d’arrêter ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
|
|
222
222
|
cas: 'BP 320.9 : 995-tools n’a rien à livrer, 4 montées et 49 min (B5)',
|
|
223
223
|
},
|
|
224
224
|
{
|
|
@@ -43,7 +43,9 @@ const CLE = 'grillhouse.flux';
|
|
|
43
43
|
*/
|
|
44
44
|
export function lireFlux(pkg) {
|
|
45
45
|
const f = pkg?.grillhouse?.flux;
|
|
46
|
-
if (f === undefined || f === null)
|
|
46
|
+
if (f === undefined || f === null) {
|
|
47
|
+
return { flux: [], fautes: [] };
|
|
48
|
+
}
|
|
47
49
|
if (typeof f !== 'object' || Array.isArray(f)) {
|
|
48
50
|
return {
|
|
49
51
|
flux: [],
|
|
@@ -86,16 +88,22 @@ const lireJson = f => {
|
|
|
86
88
|
*/
|
|
87
89
|
export function fluxDe(dir) {
|
|
88
90
|
const f = path.join(arbrePrincipal(dir), 'package.json');
|
|
89
|
-
if (!existsSync(f))
|
|
91
|
+
if (!existsSync(f)) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
90
94
|
const { flux, fautes } = lireFlux(lireJson(f));
|
|
91
|
-
if (fautes.length)
|
|
95
|
+
if (fautes.length) {
|
|
96
|
+
throw new Error(fautes.join('\n'));
|
|
97
|
+
}
|
|
92
98
|
return flux;
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
// The workflow files of <racine>: the .yml and .yaml under .github/workflows, from the root.
|
|
96
102
|
function fichiersDeFlux(racine) {
|
|
97
103
|
const d = path.join(racine, DOSSIER);
|
|
98
|
-
if (!existsSync(d))
|
|
104
|
+
if (!existsSync(d)) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
99
107
|
return readdirSync(d, { withFileTypes: true })
|
|
100
108
|
.filter(e => e.isFile() && /\.ya?ml$/.test(e.name))
|
|
101
109
|
.map(e => `${DOSSIER}/${e.name}`)
|
|
@@ -111,7 +119,9 @@ export function constats(racine) {
|
|
|
111
119
|
const pkg = lireJson(path.join(racine, 'package.json'));
|
|
112
120
|
const { flux, fautes } = lireFlux(pkg);
|
|
113
121
|
const out = fautes.map(message => ({ fichier: 'package.json', message }));
|
|
114
|
-
if (fautes.length)
|
|
122
|
+
if (fautes.length) {
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
115
125
|
const connus = new Set(paquets(racine).map(p => p.pkg.name));
|
|
116
126
|
const declares = new Set(flux.map(f => f.fichier));
|
|
117
127
|
for (const f of fichiersDeFlux(racine)) {
|
|
@@ -159,14 +169,18 @@ export function consigneDesFlux(racine, fichiers) {
|
|
|
159
169
|
const lignes = [];
|
|
160
170
|
for (const { fichier, paquets: noms } of flux) {
|
|
161
171
|
const raisons = [];
|
|
162
|
-
if (fichiers.includes(fichier))
|
|
172
|
+
if (fichiers.includes(fichier)) {
|
|
173
|
+
raisons.push('le lot change le flux');
|
|
174
|
+
}
|
|
163
175
|
for (const n of noms) {
|
|
164
176
|
const d = dossiers.get(n);
|
|
165
177
|
if (d !== undefined && fichiers.some(f => sous(f, d))) {
|
|
166
178
|
raisons.push(`le lot touche le paquet ${n}`);
|
|
167
179
|
}
|
|
168
180
|
}
|
|
169
|
-
if (raisons.length)
|
|
181
|
+
if (raisons.length) {
|
|
182
|
+
lignes.push(`- lis ${fichier} : ${raisons.join(' ; ')}`);
|
|
183
|
+
}
|
|
170
184
|
}
|
|
171
185
|
return lignes.length ? lignes.join('\n') : 'aucun : le lot ne touche aucun flux de la CI.';
|
|
172
186
|
}
|
|
@@ -59,7 +59,9 @@ export function jouerLesGardes({
|
|
|
59
59
|
for (const garde of gardes) {
|
|
60
60
|
const avant = env[RESULTATS] ? nombre() : 0;
|
|
61
61
|
const r = spawnSync(process.execPath, garde, { cwd: racine, env, stdio: 'inherit' });
|
|
62
|
-
if (r.status === 0)
|
|
62
|
+
if (r.status === 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
63
65
|
const code = `code ${r.status ?? r.signal}`;
|
|
64
66
|
rouges.push(`${libelle(garde)} (${code})`);
|
|
65
67
|
if (env[RESULTATS] && nombre() === avant) {
|
|
@@ -71,8 +73,12 @@ export function jouerLesGardes({
|
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
|
-
if (rouges.length === 0)
|
|
75
|
-
|
|
76
|
+
if (rouges.length === 0) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
for (const r of rouges) {
|
|
80
|
+
dire(`⛔ garde rouge : ${r}`);
|
|
81
|
+
}
|
|
76
82
|
return 1;
|
|
77
83
|
}
|
|
78
84
|
|
package/scripts/init.mjs
CHANGED
|
@@ -55,8 +55,11 @@ function copierLeGabarit(projet) {
|
|
|
55
55
|
const renommer = dossier => {
|
|
56
56
|
for (const e of readdirSync(dossier, { withFileTypes: true })) {
|
|
57
57
|
const f = path.join(dossier, e.name);
|
|
58
|
-
if (e.isDirectory())
|
|
59
|
-
|
|
58
|
+
if (e.isDirectory()) {
|
|
59
|
+
renommer(f);
|
|
60
|
+
} else if (Object.hasOwn(RENOMMES, e.name)) {
|
|
61
|
+
renameSync(f, path.join(dossier, RENOMMES[e.name]));
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
65
|
renommer(projet);
|
|
@@ -105,11 +108,15 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
105
108
|
} else {
|
|
106
109
|
try {
|
|
107
110
|
const lignes = initialiser(dossier, prefixe);
|
|
108
|
-
for (const l of lignes)
|
|
111
|
+
for (const l of lignes) {
|
|
112
|
+
process.stderr.write(`${l}\n`);
|
|
113
|
+
}
|
|
109
114
|
process.stdout.write(
|
|
110
115
|
`Projet créé dans ${dossier}. Ouvre Claude Code dans ce dossier : la première séance propose le grill d'initialisation.\n`
|
|
111
116
|
);
|
|
112
|
-
if (lignes.length > 0)
|
|
117
|
+
if (lignes.length > 0) {
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
}
|
|
113
120
|
} catch (e) {
|
|
114
121
|
process.stderr.write(`⛔ ${e.message}\n`);
|
|
115
122
|
process.exitCode = 1;
|
|
@@ -99,7 +99,9 @@ export const INTEGRE = 'intégré : ';
|
|
|
99
99
|
// The steps done over planned of the view <vue> of a run (`gh run view --json jobs`), written to
|
|
100
100
|
// the progress directory <avancement> as the record `etapes-de-la-ci`; nothing without one.
|
|
101
101
|
function ecrireLesEtapes(avancement, vue) {
|
|
102
|
-
if (!avancement)
|
|
102
|
+
if (!avancement) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
103
105
|
const etapes = (Array.isArray(vue?.jobs) ? vue.jobs : []).flatMap(j =>
|
|
104
106
|
Array.isArray(j?.steps) ? j.steps : []
|
|
105
107
|
);
|
|
@@ -137,7 +139,9 @@ function motifDeGitHub(motif) {
|
|
|
137
139
|
re += c;
|
|
138
140
|
} else if (c === '[') {
|
|
139
141
|
const fin = motif.indexOf(']', i + 1);
|
|
140
|
-
if (fin < 0)
|
|
142
|
+
if (fin < 0) {
|
|
143
|
+
throw new Error(`motif sans fin : ${motif}`);
|
|
144
|
+
}
|
|
141
145
|
re += motif.slice(i, fin + 1);
|
|
142
146
|
i = fin;
|
|
143
147
|
} else {
|
|
@@ -153,23 +157,35 @@ function motifDeGitHub(motif) {
|
|
|
153
157
|
// `tags` or `tags-ignore` alone run on no branch. A filter on the paths, or a form the queue does
|
|
154
158
|
// not judge, counts as one that runs.
|
|
155
159
|
function pousseeSurLaBranche(push, branche) {
|
|
156
|
-
if (push === null || push === undefined)
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
if (push === null || push === undefined) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
if (typeof push !== 'object' || Array.isArray(push)) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
if (push.paths || push['paths-ignore']) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
159
169
|
const { branches, 'branches-ignore': ignorees } = push;
|
|
160
|
-
if (branches && ignorees)
|
|
170
|
+
if (branches && ignorees) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
161
173
|
const motifs = l => (Array.isArray(l) ? l : [l]).map(String);
|
|
162
174
|
if (branches) {
|
|
163
175
|
let dedans = false;
|
|
164
176
|
for (const m of motifs(branches)) {
|
|
165
177
|
const negatif = m.startsWith('!');
|
|
166
|
-
if (motifDeGitHub(negatif ? m.slice(1) : m).test(branche))
|
|
178
|
+
if (motifDeGitHub(negatif ? m.slice(1) : m).test(branche)) {
|
|
179
|
+
dedans = !negatif;
|
|
180
|
+
}
|
|
167
181
|
}
|
|
168
182
|
return dedans;
|
|
169
183
|
}
|
|
170
184
|
if (ignorees) {
|
|
171
185
|
const l = motifs(ignorees);
|
|
172
|
-
if (l.some(m => m.startsWith('!')))
|
|
186
|
+
if (l.some(m => m.startsWith('!'))) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
173
189
|
return !l.some(m => motifDeGitHub(m).test(branche));
|
|
174
190
|
}
|
|
175
191
|
return !(push.tags || push['tags-ignore']);
|
|
@@ -181,16 +197,23 @@ function pousseeSurLaBranche(push, branche) {
|
|
|
181
197
|
export function fluxDeLaBranche(fichiers, branche) {
|
|
182
198
|
return fichiers
|
|
183
199
|
.filter(({ texte }) => {
|
|
184
|
-
if (texte === null)
|
|
200
|
+
if (texte === null) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
185
203
|
try {
|
|
186
204
|
// Loaded only for a workflow to read: a project without one, or before its `npm install`,
|
|
187
205
|
// runs its queue without the library (which, absent, counts the workflow as one that runs).
|
|
188
206
|
const require = createRequire(import.meta.url);
|
|
189
207
|
const on = require('yaml').parse(texte)?.on;
|
|
190
|
-
if (typeof on === 'string')
|
|
191
|
-
|
|
192
|
-
|
|
208
|
+
if (typeof on === 'string') {
|
|
209
|
+
return on === 'push';
|
|
210
|
+
}
|
|
211
|
+
if (Array.isArray(on)) {
|
|
212
|
+
return on.includes('push');
|
|
213
|
+
}
|
|
214
|
+
if (on && typeof on === 'object') {
|
|
193
215
|
return 'push' in on && pousseeSurLaBranche(on.push, branche);
|
|
216
|
+
}
|
|
194
217
|
return false;
|
|
195
218
|
} catch {
|
|
196
219
|
return true;
|
|
@@ -242,7 +265,9 @@ export function outilsDeLaFile(racine, dire, avancement = null) {
|
|
|
242
265
|
maxBuffer: 256 * 1024 * 1024,
|
|
243
266
|
env: { ...process.env, [ACTEUR]: AUTEUR_DE_LA_FILE },
|
|
244
267
|
});
|
|
245
|
-
if (r.status !== 0)
|
|
268
|
+
if (r.status !== 0) {
|
|
269
|
+
process.stderr.write(`bd ${a[0]} ${a[1] ?? ''} : ${r.stderr}`);
|
|
270
|
+
}
|
|
246
271
|
return r;
|
|
247
272
|
};
|
|
248
273
|
const principale =
|
|
@@ -265,7 +290,9 @@ export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
|
|
|
265
290
|
const { gh } = o;
|
|
266
291
|
let id = passage;
|
|
267
292
|
if (id === null) {
|
|
268
|
-
if (fluxDuCommit(o.racine, sha, branche).length === 0)
|
|
293
|
+
if (fluxDuCommit(o.racine, sha, branche).length === 0) {
|
|
294
|
+
return { etat: SANS_CI };
|
|
295
|
+
}
|
|
269
296
|
const r = gh(['run', 'list', '--commit', sha, '--json', 'databaseId,status,conclusion']);
|
|
270
297
|
if (r.error) {
|
|
271
298
|
return { etat: NON_LUE, raison: `gh ne se lance pas (${r.error.code ?? r.error.message}).` };
|
|
@@ -283,7 +310,9 @@ export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
|
|
|
283
310
|
};
|
|
284
311
|
}
|
|
285
312
|
const trouve = passages.find(x => x?.databaseId);
|
|
286
|
-
if (!trouve)
|
|
313
|
+
if (!trouve) {
|
|
314
|
+
return { etat: 'cherche' };
|
|
315
|
+
}
|
|
287
316
|
id = String(trouve.databaseId);
|
|
288
317
|
}
|
|
289
318
|
const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
|
|
@@ -359,7 +388,9 @@ export function conclureLaCI(
|
|
|
359
388
|
`## CI rouge\n\nLa CI de ${court} sur ${o.principale} est rouge : ${url}\n\nLa fin de gh run view ${passage} --log-failed :\n\n${journal}\n\nLe ticket est rouvert : sa correction entre sous son numéro. Un rejeu vert de la même CI (\`gh run rerun ${passage} --failed\`), puis \`--reprendre\` du circuit, le ferme ; un test connu instable se met en quarantaine dans le test, avec le ticket qui le corrige.`
|
|
360
389
|
);
|
|
361
390
|
o.dire(`✗ CI de ${court} rouge (passage ${passage}) : ${ticket} rouvert`);
|
|
362
|
-
if (!relue)
|
|
391
|
+
if (!relue) {
|
|
392
|
+
o.bd('reopen', ticket);
|
|
393
|
+
}
|
|
363
394
|
return { etat: 'rouvert', raison: `La CI de ${court} est rouge : ${url}` };
|
|
364
395
|
}
|
|
365
396
|
if (!relue) {
|
|
@@ -370,7 +401,9 @@ export function conclureLaCI(
|
|
|
370
401
|
verdict === NON_LUE ? `${INTEGRE}${court} ; CI non lue : ${raison}` : `${INTEGRE}${court}`,
|
|
371
402
|
};
|
|
372
403
|
}
|
|
373
|
-
if (verdict === NON_LUE)
|
|
404
|
+
if (verdict === NON_LUE) {
|
|
405
|
+
return { etat: 'rouvert', raison: `CI non relue : ${raison}` };
|
|
406
|
+
}
|
|
374
407
|
o.bd('close', ticket, '--reason', `${INTEGRE}${court}`);
|
|
375
408
|
if (passage) {
|
|
376
409
|
commenter(
|
|
@@ -439,13 +472,19 @@ function surOrigin(o, commit, branche) {
|
|
|
439
472
|
return { surOrigin: 'inconnu', raison: `git ls-remote origin ${branche} : ${raison}` };
|
|
440
473
|
}
|
|
441
474
|
const pointe = ls.stdout.split(/\s/)[0] ?? '';
|
|
442
|
-
if (!pointe)
|
|
475
|
+
if (!pointe) {
|
|
476
|
+
return { surOrigin: 'non', raison: null };
|
|
477
|
+
}
|
|
443
478
|
// `--is-ancestor` answers 0 (an ancestor) or 1 (not one); any other code (the tip of origin
|
|
444
479
|
// unknown here, 128) does not say: « inconnu », its reason named.
|
|
445
480
|
const git = (...a) => spawnSync('git', ['-C', o.racine, ...a], { encoding: 'utf8' });
|
|
446
481
|
const ancetre = git('merge-base', '--is-ancestor', commit, pointe);
|
|
447
|
-
if (ancetre.status === 0)
|
|
448
|
-
|
|
482
|
+
if (ancetre.status === 0) {
|
|
483
|
+
return { surOrigin: 'oui', raison: null };
|
|
484
|
+
}
|
|
485
|
+
if (ancetre.status === 1) {
|
|
486
|
+
return { surOrigin: 'non', raison: null };
|
|
487
|
+
}
|
|
449
488
|
const raison =
|
|
450
489
|
`${ancetre.stderr ?? ''}`.trim().split('\n')[0] ||
|
|
451
490
|
ancetre.error?.message ||
|
|
@@ -477,7 +516,9 @@ function lotSurMain(o, ticket) {
|
|
|
477
516
|
function rejouer(o, tip, tete, ticketRejoue = null) {
|
|
478
517
|
const { racine, dire } = o;
|
|
479
518
|
const copie = path.join(racine, '.claude', 'worktrees', 'file');
|
|
480
|
-
if (existsSync(copie))
|
|
519
|
+
if (existsSync(copie)) {
|
|
520
|
+
spawnSync('git', ['-C', copie, 'rebase', '--abort'], { encoding: 'utf8' });
|
|
521
|
+
}
|
|
481
522
|
// The keys of the project, before any work: its generated files and its tools.
|
|
482
523
|
let engendres;
|
|
483
524
|
let env;
|
|
@@ -488,10 +529,13 @@ function rejouer(o, tip, tete, ticketRejoue = null) {
|
|
|
488
529
|
return { garde: `une clé grillhouse du package.json est refusée :\n${e.message}` };
|
|
489
530
|
}
|
|
490
531
|
const ouverte = ouvrirCopie({ racine, copie, ref: tete, dire });
|
|
491
|
-
if (ouverte.refus)
|
|
532
|
+
if (ouverte.refus) {
|
|
533
|
+
return { garde: ouverte.refus };
|
|
534
|
+
}
|
|
492
535
|
const { dansCopie, monter, installer, tester } = ouverte;
|
|
493
|
-
if (dansCopie('checkout', '-q', '--detach', tip).status !== 0)
|
|
536
|
+
if (dansCopie('checkout', '-q', '--detach', tip).status !== 0) {
|
|
494
537
|
return { garde: `la copie ne prend pas ${tip.slice(0, 7)}` };
|
|
538
|
+
}
|
|
495
539
|
// A conflict on generated files the project declares only is no conflict: main's version is
|
|
496
540
|
// taken, and their command writes them again once the branch is replaced (below).
|
|
497
541
|
let rebase = dansCopie('rebase', tete);
|
|
@@ -541,7 +585,9 @@ function rejouer(o, tip, tete, ticketRejoue = null) {
|
|
|
541
585
|
env,
|
|
542
586
|
}),
|
|
543
587
|
});
|
|
544
|
-
if (refus)
|
|
588
|
+
if (refus) {
|
|
589
|
+
return { sortie: ['ses fichiers engendrés ne se régénèrent pas sur main.', refus] };
|
|
590
|
+
}
|
|
545
591
|
if (dansCopie('diff', '--cached', '--quiet').status !== 0) {
|
|
546
592
|
const corrige = dansCopie('commit', '-q', '--amend', '--no-edit', '--no-verify');
|
|
547
593
|
if (corrige.status !== 0) {
|
|
@@ -581,8 +627,9 @@ export function avancerMain(o, entree) {
|
|
|
581
627
|
const tip = git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).stdout.trim();
|
|
582
628
|
const livre = lotSurMain(o, entree.ticket);
|
|
583
629
|
// A lot on main whose branch is gone (a closure that failed after its deletion) is entered.
|
|
584
|
-
if (!tip)
|
|
630
|
+
if (!tip) {
|
|
585
631
|
return livre ? { entre: { commit: livre } } : { sortie: ["la branche n'existe plus.", ''] };
|
|
632
|
+
}
|
|
586
633
|
const enAvance = Number(git('rev-list', '--count', `${refPrincipale}..${tip}`).stdout.trim());
|
|
587
634
|
// The lot is on main when the branch points at the commit of main that delivers the ticket
|
|
588
635
|
// (main moved onto it by fast-forward), or when each commit of the branch has its equivalent on
|
|
@@ -591,21 +638,29 @@ export function avancerMain(o, entree) {
|
|
|
591
638
|
if (livre) {
|
|
592
639
|
const cerise = git('cherry', refPrincipale, tip).stdout.split('\n').filter(Boolean);
|
|
593
640
|
const rejeu = enAvance > 0 && cerise.length > 0 && cerise.every(l => l.startsWith('- '));
|
|
594
|
-
if (tip === livre || rejeu)
|
|
641
|
+
if (tip === livre || rejeu) {
|
|
642
|
+
return { entre: { commit: livre } };
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (enAvance === 0) {
|
|
646
|
+
return { ecartee: true };
|
|
595
647
|
}
|
|
596
|
-
if (enAvance === 0) return { ecartee: true };
|
|
597
648
|
for (let essai = 0; essai < ESSAIS_PAR_BRANCHE; essai++) {
|
|
598
649
|
const tete = git('rev-parse', refPrincipale).stdout.trim();
|
|
599
650
|
let nouveau = tip;
|
|
600
651
|
if (git('merge-base', '--is-ancestor', tete, tip).status !== 0) {
|
|
601
652
|
const r = rejouer(o, tip, tete, entree.ticket);
|
|
602
|
-
if (!r.nouveau)
|
|
653
|
+
if (!r.nouveau) {
|
|
654
|
+
return r;
|
|
655
|
+
}
|
|
603
656
|
nouveau = r.nouveau;
|
|
604
657
|
}
|
|
605
658
|
if (nouveau !== tete) {
|
|
606
659
|
const avance = git('merge', '-q', '--ff-only', nouveau);
|
|
607
660
|
if (avance.status !== 0) {
|
|
608
|
-
if (git('rev-parse', refPrincipale).stdout.trim() !== tete)
|
|
661
|
+
if (git('rev-parse', refPrincipale).stdout.trim() !== tete) {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
609
664
|
return {
|
|
610
665
|
garde:
|
|
611
666
|
`${o.principale} n'avance pas sur ${nouveau.slice(0, 7)} :\n${avance.stdout}${avance.stderr}`.trim(),
|