@roomi-fields/grillhouse 0.33.0 → 0.34.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 (132) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +73 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +35 -2
  4. package/cadre/templates/projet/CLAUDE.md +9 -3
  5. package/charte.md +23 -6
  6. package/dist/temporal/circuit/activites.d.ts +3 -1
  7. package/dist/temporal/circuit/activites.js +25 -1
  8. package/dist/temporal/circuit/activites.js.map +1 -1
  9. package/dist/temporal/circuit/appel.d.ts +19 -0
  10. package/dist/temporal/circuit/appel.js +93 -0
  11. package/dist/temporal/circuit/appel.js.map +1 -0
  12. package/dist/temporal/circuit/client.d.ts +17 -3
  13. package/dist/temporal/circuit/client.js +28 -4
  14. package/dist/temporal/circuit/client.js.map +1 -1
  15. package/dist/temporal/circuit/commande.js +27 -87
  16. package/dist/temporal/circuit/commande.js.map +1 -1
  17. package/dist/temporal/circuit/contrat.d.ts +29 -0
  18. package/dist/temporal/circuit/contrat.js +33 -0
  19. package/dist/temporal/circuit/contrat.js.map +1 -1
  20. package/dist/temporal/circuit/deroule.js +115 -34
  21. package/dist/temporal/circuit/deroule.js.map +1 -1
  22. package/dist/temporal/commande.js +13 -3
  23. package/dist/temporal/commande.js.map +1 -1
  24. package/dist/temporal/file/activites.d.ts +3 -0
  25. package/dist/temporal/file/activites.js +9 -0
  26. package/dist/temporal/file/activites.js.map +1 -1
  27. package/dist/temporal/file/contrat.d.ts +58 -0
  28. package/dist/temporal/file/deroule.d.ts +8 -1
  29. package/dist/temporal/file/deroule.js +100 -2
  30. package/dist/temporal/file/deroule.js.map +1 -1
  31. package/dist/temporal/installation.d.ts +15 -1
  32. package/dist/temporal/installation.js +57 -15
  33. package/dist/temporal/installation.js.map +1 -1
  34. package/dist/temporal/nuits/contrat.d.ts +2 -0
  35. package/dist/temporal/nuits/deroule.js +3 -0
  36. package/dist/temporal/nuits/deroule.js.map +1 -1
  37. package/dist/temporal/places/activites.d.ts +8 -0
  38. package/dist/temporal/places/activites.js +12 -1
  39. package/dist/temporal/places/activites.js.map +1 -1
  40. package/dist/temporal/places/client.d.ts +8 -1
  41. package/dist/temporal/places/client.js +25 -2
  42. package/dist/temporal/places/client.js.map +1 -1
  43. package/dist/temporal/places/contrat.d.ts +35 -3
  44. package/dist/temporal/places/contrat.js +5 -4
  45. package/dist/temporal/places/contrat.js.map +1 -1
  46. package/dist/temporal/places/deroule.js +55 -9
  47. package/dist/temporal/places/deroule.js.map +1 -1
  48. package/dist/temporal/tickets/activites.d.ts +3 -0
  49. package/dist/temporal/tickets/activites.js +73 -4
  50. package/dist/temporal/tickets/activites.js.map +1 -1
  51. package/dist/temporal/tickets/contrat.d.ts +31 -0
  52. package/dist/temporal/tickets/deroule.js +61 -10
  53. package/dist/temporal/tickets/deroule.js.map +1 -1
  54. package/docs/ARCHITECTURE.md +240 -60
  55. package/docs/CADRE.md +6 -1
  56. package/docs/INTERFACE.md +25 -8
  57. package/hooks/crochet.mjs +17 -2
  58. package/hooks/hooks.json +24 -0
  59. package/package.json +1 -1
  60. package/scripts/activites.mjs +96 -15
  61. package/scripts/aiguillage.mjs +2 -0
  62. package/scripts/attente-a-l-arret.mjs +141 -0
  63. package/scripts/attente-au-tour.mjs +32 -16
  64. package/scripts/avancement.mjs +5 -3
  65. package/scripts/branche-de-nuit.mjs +63 -3
  66. package/scripts/circuit.mjs +57 -4
  67. package/scripts/circuits-du-serveur.mjs +38 -4
  68. package/scripts/commandes-composees.mjs +11 -4
  69. package/scripts/copies-finies.mjs +43 -29
  70. package/scripts/crochets.mjs +1 -1
  71. package/scripts/dernier-vert.mjs +31 -10
  72. package/scripts/dette.mjs +55 -4
  73. package/scripts/disque-des-copies.d.mts +28 -0
  74. package/scripts/disque-des-copies.mjs +155 -0
  75. package/scripts/droits.mjs +2 -0
  76. package/scripts/faits-du-circuit.mjs +24 -0
  77. package/scripts/file-des-tickets.d.mts +16 -0
  78. package/scripts/file-des-tickets.mjs +65 -7
  79. package/scripts/gardes-du-cadre.mjs +4 -2
  80. package/scripts/integration/file.mjs +302 -5
  81. package/scripts/jointure.d.ts +33 -1
  82. package/scripts/langages/cargo/commandes.mjs +71 -10
  83. package/scripts/langages/cargo/composants.mjs +12 -4
  84. package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
  85. package/scripts/langages/cargo/exemples.mjs +17 -3
  86. package/scripts/langages/cargo/index.mjs +8 -3
  87. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
  88. package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
  89. package/scripts/langages/cargo/squelette.mjs +8 -3
  90. package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
  91. package/scripts/langages/cargo/tests-de-head.mjs +12 -9
  92. package/scripts/langages/cargo/verdict.mjs +40 -14
  93. package/scripts/langages/python/commandes.mjs +11 -2
  94. package/scripts/langages/python/index.mjs +12 -4
  95. package/scripts/langages/python/verdict.mjs +8 -1
  96. package/scripts/langages/typescript/index.mjs +9 -2
  97. package/scripts/langages/typescript/resume-du-lanceur.mjs +86 -0
  98. package/scripts/langages/typescript/tests.mjs +9 -3
  99. package/scripts/langages/typescript/verdict.mjs +4 -60
  100. package/scripts/langages/typescript/verifier.mjs +11 -4
  101. package/scripts/langages/typescript/vitest-config/changements.mjs +32 -15
  102. package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
  103. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
  104. package/scripts/messages-non-lus.mjs +166 -0
  105. package/scripts/mesure-de-la-machine.mjs +7 -4
  106. package/scripts/migrations-des-gardes.mjs +168 -0
  107. package/scripts/places-de-la-machine.mjs +44 -40
  108. package/scripts/places-du-serveur.mjs +82 -14
  109. package/scripts/plafond-de-la-machine.d.mts +18 -0
  110. package/scripts/plafond-de-la-machine.mjs +45 -0
  111. package/scripts/recommencer.d.mts +4 -0
  112. package/scripts/recommencer.mjs +29 -0
  113. package/scripts/regles-des-places.d.mts +35 -0
  114. package/scripts/regles-des-places.mjs +82 -1
  115. package/scripts/resultats.mjs +38 -4
  116. package/scripts/retirer-les-copies-finies.mjs +11 -7
  117. package/scripts/seances.mjs +1 -1
  118. package/scripts/services-du-noyau.mjs +2 -1
  119. package/scripts/session-start.sh +12 -0
  120. package/scripts/sous-commandes.mjs +2 -0
  121. package/scripts/superviseur.mjs +283 -59
  122. package/scripts/tableau.mjs +390 -250
  123. package/scripts/taches-du-graphe.mjs +32 -5
  124. package/scripts/ticket-du-circuit.mjs +25 -0
  125. package/scripts/transitions.d.mts +27 -1
  126. package/scripts/transitions.mjs +96 -4
  127. package/scripts/verrou-de-machine.mjs +41 -17
  128. package/skills/explorateur/SKILL.md +8 -2
  129. package/skills/pitmaster/SKILL.md +26 -18
  130. package/skills/pitmaster/references/tour.md +3 -1
  131. package/skills/questionneur/SKILL.md +5 -1
  132. package/skills/testwriter/SKILL.md +32 -6
package/scripts/dette.mjs CHANGED
@@ -29,7 +29,10 @@
29
29
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
30
30
  import path from 'node:path';
31
31
  import { pathToFileURL } from 'node:url';
32
- import { A_ELAGUER, ecrireSarif } from './resultats.mjs';
32
+ import { A_ELAGUER, A_INSCRIRE, ecrireSarif } from './resultats.mjs';
33
+
34
+ // The environment variable that names the guards of the lot's base (main), a JSON list.
35
+ export const BASE = 'GRILLHOUSE_GARDES_DE_LA_BASE';
33
36
 
34
37
  export const FICHIER = 'grillhouse-dette.json';
35
38
  // The environment variable that names the mode of a run: `inscrire` or `elaguer`.
@@ -158,10 +161,50 @@ export function trancher(racine, garde, constats, mode = process.env[MODE] || un
158
161
  trouve: c.trouve,
159
162
  message: `${c.trouve} constat(s) pour ${c.inscrit} inscrit(s) dans ${FICHIER} : la dette s'abaisse.`,
160
163
  }));
161
- ecrireSarif({ garde, constats: [...refus, ...notes], racine, env: env ?? process.env });
164
+ const lEnv = env ?? process.env;
165
+ ecrireSarif({
166
+ garde,
167
+ constats: [...refus, ...notes, ...aInscrire(garde, refus, lEnv)],
168
+ racine,
169
+ env: lEnv,
170
+ });
162
171
  return { refus, lignes };
163
172
  }
164
173
 
174
+ // The guards of the lot's base (main), a JSON list of names the circuit gives the run; undefined
175
+ // without it (a project's run) or when it is not a list.
176
+ function gardesDeLaBase(env) {
177
+ try {
178
+ const l = JSON.parse(env[BASE] ?? 'null');
179
+ return Array.isArray(l) ? l : undefined;
180
+ } catch {
181
+ return undefined;
182
+ }
183
+ }
184
+
185
+ // The notes « to inscribe » of <garde> when the base does not hold it: one per file and rule of
186
+ // its refusals, with its count. None for a guard of main, nor without a base to compare with.
187
+ function aInscrire(garde, refus, env) {
188
+ const base = gardesDeLaBase(env);
189
+ if (!base || base.includes(garde)) {
190
+ return [];
191
+ }
192
+ const out = [];
193
+ for (const [fichier, regles] of compter(refus)) {
194
+ for (const [regle, trouve] of regles) {
195
+ out.push({
196
+ fichier,
197
+ regle,
198
+ niveau: 'note',
199
+ genre: A_INSCRIRE,
200
+ trouve,
201
+ message: `${trouve} constat(s) d'une garde que le lot ajoute : la dette de ${garde} s'inscrit dans ${FICHIER}.`,
202
+ });
203
+ }
204
+ }
205
+ return out;
206
+ }
207
+
165
208
  // Writes <dette> at <racine>, its guards sorted.
166
209
  function ecrire(racine, dette) {
167
210
  const triee = Object.fromEntries(
@@ -176,10 +219,18 @@ function ecrire(racine, dette) {
176
219
  // `a-elaguer` of a pass, scripts/resultats.mjs): each key named comes down to what its guard
177
220
  // found, and leaves at zero; a count never rises, no key is added. Written when it changes;
178
221
  // returns whether it did.
179
- function abaisser(racine, notes) {
222
+ export function abaisser(racine, notes) {
180
223
  const avant = lire(racine);
181
224
  const dette = JSON.parse(JSON.stringify(avant));
182
- for (const { garde, fichier, regle, trouve } of notes) {
225
+ for (const { garde, fichier, regle, trouve, genre } of notes) {
226
+ if (genre === A_INSCRIRE) {
227
+ if (fichier && regle && Number.isInteger(trouve) && trouve > 0) {
228
+ dette[garde] ??= {};
229
+ dette[garde][fichier] ??= {};
230
+ dette[garde][fichier][regle] = { count: trouve };
231
+ }
232
+ continue;
233
+ }
183
234
  const parRegle = dette[garde]?.[fichier];
184
235
  const cle = parRegle?.[regle];
185
236
  if (!cle || !Number.isInteger(trouve) || trouve >= cle.count) {
@@ -0,0 +1,28 @@
1
+ // The types of the disk of the copies of a project (./disque-des-copies.mjs), which the
2
+ // activities of the queue of the tickets and of the circuit (src/temporal/) import.
3
+
4
+ /** The expected size of a copy of a project that declares no language, before any measure. */
5
+ export const TAILLE_PAR_DEFAUT: number;
6
+
7
+ /** The directory of the copies of the project at <racine>. */
8
+ export function dossierDesCopies(racine: string): string;
9
+
10
+ /** Measures the copy of <ticket> once and keeps its size beside it; null without a copy. */
11
+ export function mesurerLaCopie(racine: string, ticket: string): number | null;
12
+
13
+ /** The sizes kept of the copies of the project, and whether each copy is still there. */
14
+ export function taillesGardees(
15
+ racine: string
16
+ ): Array<{ ticket: string; octets: number; presente: boolean }>;
17
+
18
+ /** The disk of the copies: its room, the room a start wants, what holds it, why a start waits. */
19
+ export function disqueDesCopies(
20
+ racine: string,
21
+ o?: { libre?: (chemin: string) => number; tailles?: (racine: string) => number[] }
22
+ ): {
23
+ chemin: string;
24
+ libre: number;
25
+ requis: number;
26
+ occupe: Array<{ ticket: string; octets: number }>;
27
+ raison: string | null;
28
+ };
@@ -0,0 +1,155 @@
1
+ // The disk of the copies of a project, which a circuit's start consumes (its copy, its
2
+ // dependencies, its compilation), as Nomad reserves the disk of a client (`client.reserved.disk`):
3
+ // the queue of the tickets admits a circuit only when the disk of the project's copies
4
+ // (`<racine>/.claude/worktrees`) has the room of one more copy, and says otherwise what holds it.
5
+ //
6
+ // - The size of a copy is measured once, when its circuit pauses on a question or ends
7
+ // (`mesurerLaCopie`), and kept beside it (`<ticket>.taille`, JSON `{ octets, mesure }`), as the
8
+ // bilan is kept: never a `du` at each judgement.
9
+ // - The room a start wants: the expected size of a copy of the project (the largest kept, else the
10
+ // largest `tailleDUneCopie` of the modules of the languages it declares, scripts/jointure.d.ts,
11
+ // 1 GB without one) and the margin of the charter (LIBRE_MIN, 4 GB).
12
+ // - What holds the disk: the copies present with their kept size, the largest first.
13
+ import {
14
+ existsSync,
15
+ lstatSync,
16
+ readFileSync,
17
+ readdirSync,
18
+ statfsSync,
19
+ writeFileSync,
20
+ } from 'node:fs';
21
+ import path from 'node:path';
22
+ import { langagesDe } from './langages.mjs';
23
+ import { LIBRE_MIN } from './verrou-de-machine.mjs';
24
+
25
+ const GO = 1024 ** 3;
26
+ /** The expected size of a copy of a project that declares no language, before any measure. */
27
+ export const TAILLE_PAR_DEFAUT = GO;
28
+ const SUFFIXE = '.taille';
29
+
30
+ /** The directory of the copies of the project at <racine>. */
31
+ export const dossierDesCopies = racine => path.join(racine, '.claude', 'worktrees');
32
+
33
+ // « 7,3 Go ».
34
+ const go = n => `${(n / GO).toFixed(1).replace('.', ',')} Go`;
35
+
36
+ // The room the tree at <dossier> takes on its disk, as `du` counts it: the blocks of each entry,
37
+ // links not followed; an entry that vanishes meanwhile counts none.
38
+ function occupation(dossier) {
39
+ let octets = 0;
40
+ const pile = [dossier];
41
+ while (pile.length) {
42
+ const d = pile.pop();
43
+ try {
44
+ octets += lstatSync(d).blocks * 512;
45
+ for (const e of readdirSync(d, { withFileTypes: true })) {
46
+ const chemin = path.join(d, e.name);
47
+ if (e.isDirectory()) {
48
+ pile.push(chemin);
49
+ } else {
50
+ octets += lstatSync(chemin).blocks * 512;
51
+ }
52
+ }
53
+ } catch {
54
+ // Gone meanwhile.
55
+ }
56
+ }
57
+ return octets;
58
+ }
59
+
60
+ /**
61
+ * Measures the copy of <ticket> once (the room its tree takes, as `du`) and keeps its size beside
62
+ * it; null when the copy is absent or does not read.
63
+ * @param {string} racine
64
+ * @param {string} ticket
65
+ * @returns {number | null}
66
+ */
67
+ export function mesurerLaCopie(racine, ticket) {
68
+ const copie = path.join(dossierDesCopies(racine), ticket);
69
+ if (!existsSync(copie)) {
70
+ return null;
71
+ }
72
+ let octets;
73
+ try {
74
+ octets = occupation(copie);
75
+ } catch {
76
+ return null;
77
+ }
78
+ writeFileSync(
79
+ `${copie}${SUFFIXE}`,
80
+ `${JSON.stringify({ octets, mesure: new Date().toISOString() })}\n`
81
+ );
82
+ return octets;
83
+ }
84
+
85
+ /**
86
+ * The sizes kept of the copies of the project at <racine>: each its ticket, its size, and whether
87
+ * the copy is still there.
88
+ * @param {string} racine
89
+ * @returns {Array<{ ticket: string, octets: number, presente: boolean }>}
90
+ */
91
+ export function taillesGardees(racine) {
92
+ const dossier = dossierDesCopies(racine);
93
+ let noms;
94
+ try {
95
+ noms = readdirSync(dossier).filter(n => n.endsWith(SUFFIXE));
96
+ } catch {
97
+ return [];
98
+ }
99
+ return noms.flatMap(n => {
100
+ try {
101
+ const { octets } = JSON.parse(readFileSync(path.join(dossier, n), 'utf8'));
102
+ const ticket = n.slice(0, -SUFFIXE.length);
103
+ return Number.isFinite(octets)
104
+ ? [{ ticket, octets, presente: existsSync(path.join(dossier, ticket)) }]
105
+ : [];
106
+ } catch {
107
+ return [];
108
+ }
109
+ });
110
+ }
111
+
112
+ /**
113
+ * The disk of the copies of the project at <racine>: its path, its free room, the room a start
114
+ * wants, what holds it, and the reason a start waits (null when the room is there).
115
+ * @param {string} racine
116
+ * @param {{ libre?: (chemin: string) => number, tailles?: (racine: string) => number[] }} [o]
117
+ * @returns {{ chemin: string, libre: number, requis: number,
118
+ * occupe: Array<{ ticket: string, octets: number }>, raison: string | null }}
119
+ */
120
+ export function disqueDesCopies(racine, o = {}) {
121
+ const libreDe =
122
+ o.libre ??
123
+ (c => {
124
+ const s = statfsSync(c);
125
+ return s.bavail * s.bsize;
126
+ });
127
+ const parLangage = o.tailles ?? (r => langagesDe(r).map(l => l.tailleDUneCopie));
128
+ const dossier = dossierDesCopies(racine);
129
+ const chemin = existsSync(dossier) ? dossier : racine;
130
+ const tailles = taillesGardees(racine);
131
+ let declarees = [];
132
+ try {
133
+ declarees = parLangage(racine);
134
+ } catch {
135
+ declarees = [];
136
+ }
137
+ const attendue = tailles.length
138
+ ? Math.max(...tailles.map(t => t.octets))
139
+ : Math.max(TAILLE_PAR_DEFAUT, ...declarees);
140
+ const requis = attendue + LIBRE_MIN;
141
+ const libre = libreDe(chemin);
142
+ const occupe = tailles
143
+ .filter(t => t.presente)
144
+ .sort((a, b) => b.octets - a.octets)
145
+ .map(({ ticket, octets }) => ({ ticket, octets }));
146
+ const raison =
147
+ libre >= requis
148
+ ? null
149
+ : `disque des copies (${chemin}) : ${go(libre)} libres, ${go(requis)} requis${
150
+ occupe.length
151
+ ? ` ; copies en pause : ${occupe.map(c => `${c.ticket} ${go(c.octets)}`).join(', ')}`
152
+ : ''
153
+ }`;
154
+ return { chemin, libre, requis, occupe, raison };
155
+ }
@@ -166,6 +166,8 @@ export const ROLES = {
166
166
  'Bash(npm test *)',
167
167
  // The removal of a file of its tests, by a script of its temporary directory.
168
168
  'Bash(node $TMPDIR/*)',
169
+ // The size guard on its batch before it hands back its sheet: no argument, the whole repository.
170
+ 'Bash(npx grillhouse tailles-des-tests)',
169
171
  ...LIRE_L_INDEX,
170
172
  ]),
171
173
  },
@@ -86,12 +86,16 @@ import {
86
86
  conclureLaCI,
87
87
  direLIssue,
88
88
  fermerLEntree,
89
+ inscrireLesFluxDeMain,
90
+ lireLesPassagesDeLaCI,
91
+ relireLesLecturesDues,
89
92
  lireUneFoisLaCI,
90
93
  outilsDeLaFile,
91
94
  preparerLaBranche,
92
95
  situerLeLot,
93
96
  } from './integration/file.mjs';
94
97
  import { avancementDeLaCI } from './avancement.mjs';
98
+
95
99
  import { ecrireLEffet } from './effets.mjs';
96
100
  import { Arret, geste } from './ticket-du-circuit.mjs';
97
101
 
@@ -444,6 +448,26 @@ Object.assign(ACTES, {
444
448
  const avancement = avancementDeLaCI(travail, { nouvelle: passage === null });
445
449
  return lireUneFoisLaCI(laFile(racine, avancement), { sha, branche, passage });
446
450
  },
451
+ // A reading of the CI of every expected workflow of the commit (`lireLesPassagesDeLaCI`), its
452
+ // steps written to the progress directory of the ticket.
453
+ async passages({ racine, ticket, sha, branche }) {
454
+ const travail = path.join(racine, '.claude', 'worktrees', `${ticket}.travail`);
455
+ const avancement = avancementDeLaCI(travail);
456
+ return lireLesPassagesDeLaCI(laFile(racine, avancement), { sha, branche });
457
+ },
458
+ // The reading of the workflows of main recorded as due after the push of a lot (nothing read).
459
+ async 'inscrire-flux-de-main'({ racine, ...e }) {
460
+ inscrireLesFluxDeMain(laFile(racine), e);
461
+ return null;
462
+ },
463
+ // Every reading due of the workflows of main read once, without waiting; its comments given back.
464
+ async 'relire-flux-de-main'({ racine, maintenant, ci }) {
465
+ const o = laFile(racine);
466
+ return {
467
+ ...relireLesLecturesDues(o, { maintenant, ci }),
468
+ effets: o.rendus,
469
+ };
470
+ },
447
471
  async conclure({ racine, ...e }) {
448
472
  const o = laFile(racine);
449
473
  return { ...conclureLaCI(o, e), effets: o.rendus };
@@ -8,6 +8,7 @@ export interface TicketDeBeads {
8
8
  priority?: number;
9
9
  labels?: string[];
10
10
  created_at?: string;
11
+ description?: string;
11
12
  dependencies?: Array<{ type: string; depends_on_id: string }>;
12
13
  }
13
14
 
@@ -17,5 +18,20 @@ export function ticketsAPartir<T extends TicketDeBeads>(
17
18
  o?: { enCours?: Set<string> }
18
19
  ): T[];
19
20
 
21
+ /** The tickets of <tous> in the queue that never start for want of their section « ## Architecture ». */
22
+ export function enFileSansArchitecture<T extends TicketDeBeads>(
23
+ tous: T[],
24
+ o?: { enCours?: Set<string> }
25
+ ): T[];
26
+
27
+ /**
28
+ * The tickets of <circuits> (alive, each with the step of its state, null before its first) closed
29
+ * in <tous> outside their circuit: closed, the circuit before its integration.
30
+ */
31
+ export function fermesHorsCircuit(
32
+ tous: Array<{ id: string; status: string }>,
33
+ circuits: Array<{ ticket: string; etape: string | null }>
34
+ ): string[];
35
+
20
36
  /** Every ticket of the project at <racine>, the closed ones too, as Beads gives them; throws on a Beads that fails. */
21
37
  export function lireLesTickets(racine: string): TicketDeBeads[];
@@ -3,29 +3,51 @@
3
3
  // the merge queues start a change once what it depends on has merged. The queue of the tickets
4
4
  // under Temporal (src/temporal/tickets/) reads the tickets and applies this rule.
5
5
  //
6
- // - A ticket starts when it is open, labelled `circuit`, with no circuit already on it, and when
7
- // every dependency of the type `blocks` is closed: a dependency out of the list read (an unknown
6
+ // - A ticket starts when it is open, labelled `circuit`, with no circuit already on it, its
7
+ // description holds its section « ## Architecture » (a line that begins so), and every
8
+ // dependency of the type `blocks` is closed: a dependency out of the list read (an unknown
8
9
  // ticket) holds it back, a `parent-child` or `related` link does not.
10
+ // - A ticket of the queue without its section never starts, as a merge queue admits only a change
11
+ // that passes its checks of entry: `enFileSansArchitecture` names it, for the board and the
12
+ // opening of the supervisor, who writes it.
13
+ // - A ticket labelled `direct` is led out of the circuit, by hand: it never starts, even labelled
14
+ // `circuit` too (a label `bd create --parent` copies from its epic).
9
15
  // - The order is the Beads priority (0 first), then the creation (the oldest first).
16
+ // - A circuit alive whose ticket was closed outside it (delivered directly) holds no place: the
17
+ // queue stops it (`fermesHorsCircuit`).
10
18
  // - A ticket whose dependency is open stays: the board says « attend <ticket> » (scripts/tableau.mjs).
11
19
  import { spawnSync } from 'node:child_process';
20
+ import { ETAPES } from './etapes.mjs';
21
+
22
+ // Whether the description of <t> holds its section « ## Architecture ».
23
+ const aSonArchitecture = t => /^## Architecture\b/m.test(t.description ?? '');
24
+
25
+ // The tickets of <tous> in the queue: open, labelled `circuit` and not `direct`, those of
26
+ // <enCours> aside.
27
+ const enFile = (tous, enCours) =>
28
+ tous.filter(
29
+ t =>
30
+ t.status === 'open' &&
31
+ (t.labels ?? []).includes('circuit') &&
32
+ !(t.labels ?? []).includes('direct') &&
33
+ !enCours.has(t.id)
34
+ );
12
35
 
13
36
  /**
14
37
  * The tickets of <tous> that start now, in the order they start.
15
38
  * @param {Array<{ id: string, status: string, priority?: number, labels?: string[],
16
- * created_at?: string, dependencies?: Array<{ type: string, depends_on_id: string }> }>} tous
39
+ * created_at?: string, description?: string,
40
+ * dependencies?: Array<{ type: string, depends_on_id: string }> }>} tous
17
41
  * every ticket of the project, the closed ones too
18
42
  * @param {{ enCours?: Set<string> }} [o] `enCours`, the tickets whose circuit already runs
19
43
  * @returns {typeof tous}
20
44
  */
21
45
  export function ticketsAPartir(tous, { enCours = new Set() } = {}) {
22
46
  const fermes = new Set(tous.filter(t => t.status === 'closed').map(t => t.id));
23
- return tous
47
+ return enFile(tous, enCours)
24
48
  .filter(
25
49
  t =>
26
- t.status === 'open' &&
27
- (t.labels ?? []).includes('circuit') &&
28
- !enCours.has(t.id) &&
50
+ aSonArchitecture(t) &&
29
51
  (t.dependencies ?? []).every(d => d.type !== 'blocks' || fermes.has(d.depends_on_id))
30
52
  )
31
53
  .sort(
@@ -36,6 +58,42 @@ export function ticketsAPartir(tous, { enCours = new Set() } = {}) {
36
58
  );
37
59
  }
38
60
 
61
+ // The states of the steps of the integration (5.1, 5.2, 5.3): the circuit's own queue closes the
62
+ // ticket at 5.2, then the circuit sorts its discoveries and ends.
63
+ const DE_L_INTEGRATION = new Set(
64
+ (ETAPES.find(e => e.numero === '5')?.sous ?? []).map(s => s.etat).concat('integre')
65
+ );
66
+
67
+ /**
68
+ * The tickets of <circuits> (the circuits alive, each its ticket and the step of the state it last
69
+ * wrote, null before its first) closed in <tous> outside their circuit, as Zuul drops from its
70
+ * pipeline a change abandoned or merged: a closed ticket whose circuit stands before its
71
+ * integration. A circuit at its integration closed its ticket itself, and stays.
72
+ * @param {Array<{ id: string, status: string }>} tous every ticket of the project
73
+ * @param {Array<{ ticket: string, etape: string | null }>} circuits
74
+ * @returns {string[]}
75
+ */
76
+ export function fermesHorsCircuit(tous, circuits) {
77
+ const fermes = new Set(tous.filter(t => t.status === 'closed').map(t => t.id));
78
+ return circuits
79
+ .filter(c => fermes.has(c.ticket) && !DE_L_INTEGRATION.has(c.etape ?? ''))
80
+ .map(c => c.ticket)
81
+ .sort();
82
+ }
83
+
84
+ /**
85
+ * The tickets of <tous> in the queue that never start for want of their section
86
+ * « ## Architecture », their dependencies open or closed, sorted by id.
87
+ * @param {Parameters<typeof ticketsAPartir>[0]} tous every ticket of the project
88
+ * @param {{ enCours?: Set<string> }} [o] `enCours`, the tickets whose circuit already runs
89
+ * @returns {typeof tous}
90
+ */
91
+ export function enFileSansArchitecture(tous, { enCours = new Set() } = {}) {
92
+ return enFile(tous, enCours)
93
+ .filter(t => !aSonArchitecture(t))
94
+ .sort((a, b) => a.id.localeCompare(b.id, 'en', { numeric: true }));
95
+ }
96
+
39
97
  /**
40
98
  * Every ticket of the project at <racine>, the closed ones too, as Beads gives them; a Beads that
41
99
  * fails or a list that does not parse throws, its reason named (`bd list`), never an empty list.
@@ -26,8 +26,9 @@ import { pathToFileURL } from 'node:url';
26
26
  import { SCRIPT as DEPENDANCES_INTERNES } from './dependances-internes.mjs';
27
27
  import { SCRIPT as LANGAGES_DES_PAQUETS } from './langages-des-paquets.mjs';
28
28
  import { SCRIPT as FLUX_DES_PAQUETS } from './flux-des-paquets.mjs';
29
+ import { SCRIPT as MIGRATIONS_DES_GARDES } from './migrations-des-gardes.mjs';
29
30
  import { langageDe } from './langages.mjs';
30
- import { A_ELAGUER, ecrireSarif, lireSarif, RESULTATS } from './resultats.mjs';
31
+ import { ecrireSarif, estNoteDeDette, lireSarif, RESULTATS } from './resultats.mjs';
31
32
 
32
33
  // The guards of the frame in the repository at <racine>, each its script and its arguments, in
33
34
  // the order they play: the core's, then the languages'.
@@ -36,6 +37,7 @@ export function gardesDuCadre(racine) {
36
37
  [LANGAGES_DES_PAQUETS],
37
38
  [DEPENDANCES_INTERNES],
38
39
  [FLUX_DES_PAQUETS],
40
+ [MIGRATIONS_DES_GARDES],
39
41
  ...langageDe(racine).gardes(racine),
40
42
  ];
41
43
  }
@@ -55,7 +57,7 @@ export function jouerLesGardes({
55
57
  }) {
56
58
  const rouges = [];
57
59
  // The findings under the results directory, the notes of the debt left out.
58
- const nombre = () => lireSarif(env[RESULTATS]).constats.filter(k => k.genre !== A_ELAGUER).length;
60
+ const nombre = () => lireSarif(env[RESULTATS]).constats.filter(k => !estNoteDeDette(k)).length;
59
61
  for (const garde of gardes) {
60
62
  const avant = env[RESULTATS] ? nombre() : 0;
61
63
  const r = spawnSync(process.execPath, garde, { cwd: racine, env, stdio: 'inherit' });