@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.
Files changed (153) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +48 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/dist/temporal/circuit/client.d.ts +2 -2
  8. package/dist/temporal/circuit/client.js.map +1 -1
  9. package/dist/temporal/circuit/commande.js +4 -4
  10. package/dist/temporal/circuit/commande.js.map +1 -1
  11. package/dist/temporal/circuit/contrat.d.ts +3 -3
  12. package/dist/temporal/circuit/contrat.js +8 -2
  13. package/dist/temporal/circuit/contrat.js.map +1 -1
  14. package/dist/temporal/circuit/deroule.js +3 -3
  15. package/dist/temporal/circuit/deroule.js.map +1 -1
  16. package/dist/temporal/commande.js +5 -6
  17. package/dist/temporal/commande.js.map +1 -1
  18. package/dist/temporal/installation.d.ts +3 -6
  19. package/dist/temporal/installation.js +19 -38
  20. package/dist/temporal/installation.js.map +1 -1
  21. package/dist/temporal/tickets/activites.d.ts +1 -0
  22. package/dist/temporal/tickets/activites.js +5 -0
  23. package/dist/temporal/tickets/activites.js.map +1 -1
  24. package/dist/temporal/tickets/contrat.d.ts +10 -0
  25. package/dist/temporal/tickets/deroule.js +8 -1
  26. package/dist/temporal/tickets/deroule.js.map +1 -1
  27. package/docs/ARCHITECTURE.md +119 -27
  28. package/docs/CADRE.md +20 -0
  29. package/docs/INTERFACE.md +17 -4
  30. package/hooks/hooks.json +4 -0
  31. package/package.json +2 -2
  32. package/scripts/activites.mjs +155 -84
  33. package/scripts/aiguillage.mjs +35 -11
  34. package/scripts/attente-au-tour.mjs +99 -0
  35. package/scripts/avancement.mjs +27 -10
  36. package/scripts/base-des-workflows.mjs +57 -0
  37. package/scripts/bilan.mjs +101 -25
  38. package/scripts/cadre.mjs +5 -2
  39. package/scripts/circuit.mjs +173 -58
  40. package/scripts/composants-affectes.mjs +64 -21
  41. package/scripts/composition-des-langages.mjs +5 -3
  42. package/scripts/conformite.mjs +54 -19
  43. package/scripts/copies-finies.mjs +8 -1
  44. package/scripts/dependances-internes.mjs +9 -3
  45. package/scripts/dernier-vert.mjs +84 -23
  46. package/scripts/dette.mjs +32 -11
  47. package/scripts/donnees-cles.mjs +24 -8
  48. package/scripts/droits.mjs +40 -15
  49. package/scripts/effets.mjs +9 -0
  50. package/scripts/empreinte-d-etape.mjs +17 -0
  51. package/scripts/engendres.mjs +15 -5
  52. package/scripts/enveloppe/enveloppe.mjs +141 -48
  53. package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
  54. package/scripts/etapes.mjs +1 -1
  55. package/scripts/faits-du-circuit.mjs +1 -1
  56. package/scripts/flux-des-paquets.mjs +21 -7
  57. package/scripts/gardes-du-cadre.mjs +9 -3
  58. package/scripts/init.mjs +11 -4
  59. package/scripts/integration/file.mjs +84 -29
  60. package/scripts/integration/integrer.mjs +70 -24
  61. package/scripts/integration/rejeu.mjs +26 -9
  62. package/scripts/jointure.d.ts +10 -1
  63. package/scripts/journal-des-etats.d.mts +41 -0
  64. package/scripts/journal-des-etats.mjs +273 -0
  65. package/scripts/journal.mjs +119 -0
  66. package/scripts/langages/cargo/commandes.mjs +97 -18
  67. package/scripts/langages/cargo/composants.mjs +24 -8
  68. package/scripts/langages/cargo/index.mjs +7 -0
  69. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  70. package/scripts/langages/python/commandes.mjs +3 -1
  71. package/scripts/langages/python/index.mjs +6 -0
  72. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  73. package/scripts/langages/typescript/composants.mjs +9 -3
  74. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  75. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  76. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  77. package/scripts/langages/typescript/frontieres.mjs +112 -22
  78. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  79. package/scripts/langages/typescript/index.mjs +12 -3
  80. package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
  81. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  82. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  83. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  84. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  85. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
  86. package/scripts/langages/typescript/parcours.mjs +12 -4
  87. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  88. package/scripts/langages/typescript/resumes.mjs +9 -3
  89. package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
  90. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
  91. package/scripts/langages/typescript/tests.mjs +24 -8
  92. package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
  93. package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
  94. package/scripts/langages/typescript/verdict.mjs +3 -1
  95. package/scripts/langages/typescript/verifier.mjs +61 -14
  96. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  97. package/scripts/langages/typescript/vitest-config/base.mjs +10 -2
  98. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  99. package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
  100. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
  101. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
  102. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  103. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
  104. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  105. package/scripts/langages.d.mts +20 -0
  106. package/scripts/lint-des-scripts.mjs +58 -0
  107. package/scripts/matiere-de-test.d.ts +11 -0
  108. package/scripts/mesure/base-de-passe.mjs +117 -25
  109. package/scripts/mesure/pression.mjs +9 -3
  110. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  111. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  112. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  113. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
  114. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  115. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  116. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
  117. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
  118. package/scripts/nuit.sh +24 -0
  119. package/scripts/outil.mjs +3 -1
  120. package/scripts/outils-cles.mjs +18 -7
  121. package/scripts/paquet-npm.mjs +15 -5
  122. package/scripts/paquets.mjs +12 -4
  123. package/scripts/passe-de-la-machine.mjs +7 -2
  124. package/scripts/places-de-la-machine.mjs +72 -12
  125. package/scripts/preparation.mjs +15 -5
  126. package/scripts/registre.mjs +6 -2
  127. package/scripts/reprise.mjs +66 -0
  128. package/scripts/resultats.mjs +105 -37
  129. package/scripts/seances.mjs +22 -4
  130. package/scripts/services-du-noyau.mjs +1 -0
  131. package/scripts/sous-commandes.mjs +5 -1
  132. package/scripts/style-a-l-ecriture.mjs +48 -17
  133. package/scripts/superviseur.mjs +127 -75
  134. package/scripts/tableau.mjs +133 -10
  135. package/scripts/taches-du-graphe.mjs +33 -13
  136. package/scripts/ticket-du-circuit.mjs +40 -0
  137. package/scripts/transitions.mjs +159 -29
  138. package/scripts/verrou-de-fichier.mjs +6 -2
  139. package/scripts/verrou-de-machine.mjs +123 -39
  140. package/scripts/verrous/commande.mjs +50 -17
  141. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  142. package/scripts/verrous/verrou.mjs +42 -14
  143. package/skills/developpeur/SKILL.md +1 -1
  144. package/skills/explorateur/SKILL.md +8 -2
  145. package/skills/grill/SKILL.md +3 -57
  146. package/skills/grill/references/paquets.md +60 -0
  147. package/skills/mesure/SKILL.md +3 -0
  148. package/skills/pitmaster/SKILL.md +16 -27
  149. package/skills/questionneur/SKILL.md +1 -1
  150. package/skills/relecteur/SKILL.md +2 -2
  151. package/skills/testwriter/SKILL.md +19 -7
  152. package/skills/release/SKILL.md +0 -134
  153. 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) return { conflits: null };
126
- if (conflits.length || !touches.length || !cles) return { conflits };
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) return { ok: false, message: cles.refus };
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) return { ok: false, message: `⛔ ${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) return { ok: false, message: cles.refus };
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) writeSync(sortie, r.stderr);
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) return echec(g, 'La garde des sous-modules');
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) return { ...a, partages: '' };
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) return echec(p, 'La pose des sous-modules');
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) return echec(m, 'Le montage des sous-modules partagés');
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) return echec(i, "L'installation");
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) process.stderr.write(`${r.message}\n`);
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`);
@@ -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
  {
@@ -98,7 +98,7 @@ import { Arret, geste } from './ticket-du-circuit.mjs';
98
98
  // the act is given (an answer's, a motive) is kept over it.
99
99
  const GARDEE = [
100
100
  ...MEMOIRE,
101
- 'reprise',
101
+ 'seanceReprise',
102
102
  'rang',
103
103
  'sorte',
104
104
  'outils',
@@ -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) return { flux: [], fautes: [] };
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)) return [];
91
+ if (!existsSync(f)) {
92
+ return [];
93
+ }
90
94
  const { flux, fautes } = lireFlux(lireJson(f));
91
- if (fautes.length) throw new Error(fautes.join('\n'));
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)) return [];
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) return out;
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)) raisons.push('le lot change le flux');
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) lignes.push(`- lis ${fichier} : ${raisons.join(' ; ')}`);
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) continue;
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) return 0;
75
- for (const r of rouges) dire(`⛔ garde rouge : ${r}`);
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()) renommer(f);
59
- else if (Object.hasOwn(RENOMMES, e.name)) renameSync(f, path.join(dossier, RENOMMES[e.name]));
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) process.stderr.write(`${l}\n`);
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) process.exitCode = 1;
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) return;
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) throw new Error(`motif sans fin : ${motif}`);
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) return true;
157
- if (typeof push !== 'object' || Array.isArray(push)) return true;
158
- if (push.paths || push['paths-ignore']) return true;
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) return true;
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)) dedans = !negatif;
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('!'))) return true;
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) return true;
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') return on === 'push';
191
- if (Array.isArray(on)) return on.includes('push');
192
- if (on && typeof on === 'object')
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) process.stderr.write(`bd ${a[0]} ${a[1] ?? ''} : ${r.stderr}`);
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) return { etat: SANS_CI };
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) return { etat: 'cherche' };
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) o.bd('reopen', ticket);
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) return { etat: 'rouvert', raison: `CI non relue : ${raison}` };
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) return { surOrigin: 'non', raison: null };
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) return { surOrigin: 'oui', raison: null };
448
- if (ancetre.status === 1) return { surOrigin: 'non', raison: null };
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)) spawnSync('git', ['-C', copie, 'rebase', '--abort'], { encoding: 'utf8' });
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) return { garde: 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) return { sortie: ['ses fichiers engendrés ne se régénèrent pas sur main.', 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) return { entre: { commit: livre } };
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) return r;
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) continue;
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(),