@roomi-fields/grillhouse 0.33.1 → 0.34.1

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 (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +81 -0
  3. package/cadre/templates/projet/CLAUDE.md +9 -3
  4. package/charte.md +23 -6
  5. package/dist/temporal/acte.d.ts +7 -0
  6. package/dist/temporal/acte.js +19 -2
  7. package/dist/temporal/acte.js.map +1 -1
  8. package/dist/temporal/circuit/activites.d.ts +3 -1
  9. package/dist/temporal/circuit/activites.js +25 -1
  10. package/dist/temporal/circuit/activites.js.map +1 -1
  11. package/dist/temporal/circuit/appel.d.ts +19 -0
  12. package/dist/temporal/circuit/appel.js +93 -0
  13. package/dist/temporal/circuit/appel.js.map +1 -0
  14. package/dist/temporal/circuit/client.d.ts +7 -0
  15. package/dist/temporal/circuit/client.js +20 -0
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +27 -87
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +19 -0
  20. package/dist/temporal/circuit/contrat.js +2 -0
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +86 -11
  23. package/dist/temporal/circuit/deroule.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/nuits/contrat.d.ts +2 -0
  32. package/dist/temporal/nuits/deroule.js +3 -0
  33. package/dist/temporal/nuits/deroule.js.map +1 -1
  34. package/dist/temporal/places/activites.d.ts +8 -0
  35. package/dist/temporal/places/activites.js +12 -1
  36. package/dist/temporal/places/activites.js.map +1 -1
  37. package/dist/temporal/places/client.d.ts +8 -1
  38. package/dist/temporal/places/client.js +25 -2
  39. package/dist/temporal/places/client.js.map +1 -1
  40. package/dist/temporal/places/contrat.d.ts +35 -3
  41. package/dist/temporal/places/contrat.js +5 -4
  42. package/dist/temporal/places/contrat.js.map +1 -1
  43. package/dist/temporal/places/deroule.js +55 -9
  44. package/dist/temporal/places/deroule.js.map +1 -1
  45. package/dist/temporal/tickets/activites.d.ts +3 -0
  46. package/dist/temporal/tickets/activites.js +73 -4
  47. package/dist/temporal/tickets/activites.js.map +1 -1
  48. package/dist/temporal/tickets/contrat.d.ts +31 -0
  49. package/dist/temporal/tickets/deroule.js +61 -10
  50. package/dist/temporal/tickets/deroule.js.map +1 -1
  51. package/docs/ARCHITECTURE.md +225 -57
  52. package/docs/CADRE.md +6 -1
  53. package/docs/INTERFACE.md +24 -8
  54. package/hooks/crochet.mjs +17 -2
  55. package/hooks/hooks.json +24 -0
  56. package/package.json +1 -1
  57. package/scripts/activites.mjs +77 -14
  58. package/scripts/aiguillage.mjs +2 -0
  59. package/scripts/attente-a-l-arret.mjs +141 -0
  60. package/scripts/attente-au-tour.mjs +32 -16
  61. package/scripts/avancement.mjs +5 -3
  62. package/scripts/branche-de-nuit.mjs +63 -3
  63. package/scripts/ci-des-branches.mjs +4 -2
  64. package/scripts/circuit.mjs +57 -4
  65. package/scripts/circuits-du-serveur.mjs +34 -1
  66. package/scripts/commandes-composees.mjs +11 -4
  67. package/scripts/copies-finies.mjs +43 -29
  68. package/scripts/crochets.mjs +1 -1
  69. package/scripts/dette.mjs +55 -4
  70. package/scripts/disque-des-copies.d.mts +28 -0
  71. package/scripts/disque-des-copies.mjs +155 -0
  72. package/scripts/droits.mjs +2 -0
  73. package/scripts/etapes.mjs +6 -4
  74. package/scripts/faits-du-circuit.mjs +24 -0
  75. package/scripts/file-des-tickets.d.mts +16 -0
  76. package/scripts/file-des-tickets.mjs +65 -7
  77. package/scripts/gardes-du-cadre.mjs +4 -2
  78. package/scripts/integration/file.mjs +308 -10
  79. package/scripts/jointure.d.ts +41 -2
  80. package/scripts/langages/cargo/commandes.mjs +81 -12
  81. package/scripts/langages/cargo/composants.mjs +12 -4
  82. package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
  83. package/scripts/langages/cargo/exemples.mjs +17 -3
  84. package/scripts/langages/cargo/index.mjs +8 -3
  85. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
  86. package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
  87. package/scripts/langages/cargo/squelette.mjs +8 -3
  88. package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
  89. package/scripts/langages/cargo/tests-de-head.mjs +12 -9
  90. package/scripts/langages/cargo/verdict.mjs +40 -14
  91. package/scripts/langages/python/commandes.mjs +14 -2
  92. package/scripts/langages/python/index.mjs +12 -4
  93. package/scripts/langages/python/verdict.mjs +8 -1
  94. package/scripts/langages/typescript/index.mjs +9 -2
  95. package/scripts/langages/typescript/resume-du-lanceur.mjs +92 -0
  96. package/scripts/langages/typescript/tests.mjs +1 -1
  97. package/scripts/langages/typescript/verdict.mjs +4 -60
  98. package/scripts/langages/typescript/verifier.mjs +1 -1
  99. package/scripts/langages/typescript/vitest-config/changements.mjs +12 -7
  100. package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
  101. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
  102. package/scripts/messages-non-lus.mjs +166 -0
  103. package/scripts/mesure-de-la-machine.mjs +7 -4
  104. package/scripts/migrations-des-gardes.mjs +179 -0
  105. package/scripts/places-de-la-machine.mjs +44 -40
  106. package/scripts/places-du-serveur.mjs +82 -14
  107. package/scripts/plafond-de-la-machine.d.mts +18 -0
  108. package/scripts/plafond-de-la-machine.mjs +45 -0
  109. package/scripts/recommencer.d.mts +4 -0
  110. package/scripts/recommencer.mjs +29 -0
  111. package/scripts/regles-des-places.d.mts +35 -0
  112. package/scripts/regles-des-places.mjs +82 -1
  113. package/scripts/resultats.mjs +38 -4
  114. package/scripts/retirer-les-copies-finies.mjs +11 -7
  115. package/scripts/seances.mjs +1 -1
  116. package/scripts/services-du-noyau.mjs +1 -0
  117. package/scripts/sous-commandes.mjs +2 -0
  118. package/scripts/superviseur.mjs +235 -56
  119. package/scripts/tableau.mjs +468 -267
  120. package/scripts/taches-du-graphe.mjs +49 -8
  121. package/scripts/ticket-du-circuit.mjs +25 -0
  122. package/scripts/transitions.d.mts +27 -1
  123. package/scripts/transitions.mjs +96 -4
  124. package/scripts/verrou-de-machine.mjs +41 -17
  125. package/skills/explorateur/SKILL.md +8 -2
  126. package/skills/pitmaster/SKILL.md +18 -15
  127. package/skills/pitmaster/references/tour.md +3 -1
  128. package/skills/questionneur/SKILL.md +5 -1
  129. package/skills/testwriter/SKILL.md +32 -6
@@ -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
  },
@@ -201,8 +201,7 @@ export const GESTES = [
201
201
  {
202
202
  genre: 'rejeu',
203
203
  geste: 'la commande joue une seconde fois',
204
- regle:
205
- 'une commande des contrôles hors de la passe finale à 75 rejoue une fois avant l’arrêt',
204
+ regle: 'une commande des contrôles hors de la passe finale à 75 rejoue une fois avant l’arrêt',
206
205
  cas: 'A12 : un contrôle à 75, rejoué avant de conclure à la charge',
207
206
  },
208
207
  {
@@ -258,13 +257,16 @@ const REPONSES =
258
257
  'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), ou `--arreter`.';
259
258
 
260
259
  // The question of each stop no gesture settles, as a CI calls a person only for what no rule
261
- // settles (the approval of a review): every stop of ARRETS but « a-repasser », a gesture. The
260
+ // settles (the approval of a review): every stop of ARRETS, « a-repasser » once the circuit has
261
+ // played it again as often as it may (a gesture until then). The
262
262
  // circuit ends on the stop, its state carrying the question (`question`: `{ arret, fait, piece,
263
263
  // question, qui }`: the fact, its piece, file:line or command and output, the question and who must
264
264
  // answer it), for the supervisor, who answers by a command of the circuit and carries to the owner
265
265
  // what is his (`qui` responsable: the reviewer's question on a real word of the language).
266
266
  export const MONTEES = Object.fromEntries(
267
267
  Object.entries({
268
+ 'a-repasser':
269
+ 'L’étape à repasser (une passe sous charge, une CI non lue, une file qui n’avance pas) a été rejouée autant de fois que le circuit le fait, sans aboutir : sa cause se lève-t-elle, pour reprendre, ou le circuit s’arrête-t-il ?',
268
270
  lancement:
269
271
  'Le lanceur s’arrête avant la séance, ou la copie n’avance pas sur la pointe de main avant une passe : la machine ou la copie se répare-t-elle, pour reprendre ?',
270
272
  bloqué:
@@ -299,5 +301,5 @@ export const MONTEES = Object.fromEntries(
299
301
  }).map(([arret, question]) => [arret, { question: `${question} ${REPONSES}`, qui: SUPERVISEUR }])
300
302
  );
301
303
 
302
- // The question of the stop <arret>, `{ question, qui }`, or null for a gesture.
304
+ // The question of the stop <arret>, `{ question, qui }`, or null for a stop of no circuit.
303
305
  export const monteeDe = arret => MONTEES[arret] ?? null;
@@ -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' });