@roomi-fields/grillhouse 0.54.0 → 0.55.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 (237) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +75 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
  4. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
  5. package/cadre/templates/projet/CONTRIBUTING.md +0 -5
  6. package/cadre/templates/projet/README.md +0 -126
  7. package/cadre/templates/projet/_npmignore +1 -6
  8. package/cadre/templates/projet/package.json +5 -32
  9. package/cadre/templates/projet/tsconfig.json +4 -4
  10. package/cadre/templates/projet/vitest.config.cjs +3 -2
  11. package/charte/tests.md +14 -0
  12. package/dist/machine/part-par-sorte.d.ts +9 -9
  13. package/dist/machine/part-par-sorte.js +20 -24
  14. package/dist/machine/part-par-sorte.js.map +1 -1
  15. package/dist/machine/table-des-consommations.d.ts +65 -0
  16. package/dist/machine/table-des-consommations.js +94 -0
  17. package/dist/machine/table-des-consommations.js.map +1 -0
  18. package/dist/temporal/circuit/activites.d.ts +2 -0
  19. package/dist/temporal/circuit/activites.js +87 -3
  20. package/dist/temporal/circuit/activites.js.map +1 -1
  21. package/dist/temporal/circuit/client.js +9 -4
  22. package/dist/temporal/circuit/client.js.map +1 -1
  23. package/dist/temporal/circuit/contrat.d.ts +32 -4
  24. package/dist/temporal/circuit/deroule.js +54 -4
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/circuit/versions.d.ts +12 -0
  27. package/dist/temporal/circuit/versions.js +22 -0
  28. package/dist/temporal/circuit/versions.js.map +1 -0
  29. package/dist/temporal/consommation/activites.d.ts +2 -0
  30. package/dist/temporal/consommation/activites.js +9 -0
  31. package/dist/temporal/consommation/activites.js.map +1 -0
  32. package/dist/temporal/consommation/actualisation.d.ts +2 -0
  33. package/dist/temporal/consommation/actualisation.js +71 -0
  34. package/dist/temporal/consommation/actualisation.js.map +1 -0
  35. package/dist/temporal/consommation/client.d.ts +12 -0
  36. package/dist/temporal/consommation/client.js +28 -0
  37. package/dist/temporal/consommation/client.js.map +1 -0
  38. package/dist/temporal/consommation/commande.d.ts +5 -0
  39. package/dist/temporal/consommation/commande.js +32 -0
  40. package/dist/temporal/consommation/commande.js.map +1 -0
  41. package/dist/temporal/consommation/contrat.d.ts +15 -0
  42. package/dist/temporal/consommation/contrat.js +13 -0
  43. package/dist/temporal/consommation/contrat.js.map +1 -0
  44. package/dist/temporal/consommation/deroule.d.ts +2 -0
  45. package/dist/temporal/consommation/deroule.js +14 -0
  46. package/dist/temporal/consommation/deroule.js.map +1 -0
  47. package/dist/temporal/deroules.d.ts +2 -1
  48. package/dist/temporal/deroules.js +3 -2
  49. package/dist/temporal/deroules.js.map +1 -1
  50. package/dist/temporal/file/contrat.d.ts +2 -0
  51. package/dist/temporal/file/deroule.js +14 -4
  52. package/dist/temporal/file/deroule.js.map +1 -1
  53. package/dist/temporal/installation.d.ts +6 -0
  54. package/dist/temporal/installation.js +15 -0
  55. package/dist/temporal/installation.js.map +1 -1
  56. package/dist/temporal/nuits/activites.d.ts +2 -1
  57. package/dist/temporal/nuits/activites.js +127 -3
  58. package/dist/temporal/nuits/activites.js.map +1 -1
  59. package/dist/temporal/nuits/client.d.ts +19 -5
  60. package/dist/temporal/nuits/client.js +33 -23
  61. package/dist/temporal/nuits/client.js.map +1 -1
  62. package/dist/temporal/nuits/commande.js +16 -11
  63. package/dist/temporal/nuits/commande.js.map +1 -1
  64. package/dist/temporal/nuits/contrat.d.ts +29 -0
  65. package/dist/temporal/nuits/contrat.js +10 -0
  66. package/dist/temporal/nuits/contrat.js.map +1 -1
  67. package/dist/temporal/nuits/deroule.d.ts +5 -0
  68. package/dist/temporal/nuits/deroule.js +18 -1
  69. package/dist/temporal/nuits/deroule.js.map +1 -1
  70. package/dist/temporal/nuits/pc2.d.ts +72 -0
  71. package/dist/temporal/nuits/pc2.js +206 -0
  72. package/dist/temporal/nuits/pc2.js.map +1 -0
  73. package/dist/temporal/places/activites.d.ts +23 -1
  74. package/dist/temporal/places/activites.js +38 -2
  75. package/dist/temporal/places/activites.js.map +1 -1
  76. package/dist/temporal/places/client.d.ts +16 -0
  77. package/dist/temporal/places/client.js +25 -1
  78. package/dist/temporal/places/client.js.map +1 -1
  79. package/dist/temporal/places/contrat.d.ts +79 -14
  80. package/dist/temporal/places/contrat.js +7 -0
  81. package/dist/temporal/places/contrat.js.map +1 -1
  82. package/dist/temporal/places/deroule.js +159 -23
  83. package/dist/temporal/places/deroule.js.map +1 -1
  84. package/dist/temporal/places/reservation.d.ts +54 -0
  85. package/dist/temporal/places/reservation.js +69 -0
  86. package/dist/temporal/places/reservation.js.map +1 -0
  87. package/dist/temporal/planification.d.ts +6 -0
  88. package/dist/temporal/planification.js +26 -0
  89. package/dist/temporal/planification.js.map +1 -0
  90. package/dist/temporal/tickets/activites.d.ts +0 -2
  91. package/dist/temporal/tickets/activites.js +2 -52
  92. package/dist/temporal/tickets/activites.js.map +1 -1
  93. package/dist/temporal/tickets/contrat.d.ts +7 -26
  94. package/dist/temporal/tickets/deroule.js +35 -23
  95. package/dist/temporal/tickets/deroule.js.map +1 -1
  96. package/dist/temporal/travailleur.js +2 -0
  97. package/dist/temporal/travailleur.js.map +1 -1
  98. package/docs/ARCHITECTURE.md +2 -2
  99. package/docs/CADRE.md +1 -1
  100. package/docs/INTERFACE.md +16 -11
  101. package/docs/architecture/circuit.md +62 -58
  102. package/docs/architecture/entree.md +87 -63
  103. package/docs/architecture/greffon.md +32 -27
  104. package/docs/architecture/installation.md +43 -32
  105. package/docs/architecture/machine.md +48 -40
  106. package/docs/architecture/tests.md +37 -33
  107. package/docs/lexique.md +4 -3
  108. package/package.json +1 -1
  109. package/scripts/activites.mjs +351 -180
  110. package/scripts/aiguillage.mjs +1 -0
  111. package/scripts/attente-de-la-machine.mjs +3 -22
  112. package/scripts/avancement.mjs +21 -30
  113. package/scripts/bilan.mjs +22 -2
  114. package/scripts/branche-de-nuit.mjs +1 -1
  115. package/scripts/circuit.mjs +75 -39
  116. package/scripts/codes-de-sortie.mjs +0 -6
  117. package/scripts/consommation-des-passes.mjs +67 -31
  118. package/scripts/consommation.mjs +152 -24
  119. package/scripts/copies-finies.mjs +15 -35
  120. package/scripts/dernier-vert.mjs +4 -5
  121. package/scripts/dette.mjs +5 -3
  122. package/scripts/droits.mjs +2 -2
  123. package/scripts/echantillonneur-de-la-passe.mjs +7 -31
  124. package/scripts/engendres.mjs +5 -61
  125. package/scripts/enveloppe/enveloppe.mjs +30 -34
  126. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
  127. package/scripts/etapes.mjs +21 -7
  128. package/scripts/etat-du-depot.mjs +61 -0
  129. package/scripts/faits-du-circuit.mjs +7 -4
  130. package/scripts/fermeture-de-la-machine.d.mts +6 -4
  131. package/scripts/fermeture-de-la-machine.mjs +12 -16
  132. package/scripts/fichier-du-poste.d.mts +9 -0
  133. package/scripts/file-des-tickets.d.mts +0 -18
  134. package/scripts/file-des-tickets.mjs +0 -42
  135. package/scripts/fusion-du-changelog.mjs +1 -1
  136. package/scripts/greffons.mjs +282 -17
  137. package/scripts/grillhouse-maj.mjs +1 -1
  138. package/scripts/index-des-rouges.d.mts +40 -0
  139. package/scripts/index-des-rouges.mjs +104 -0
  140. package/scripts/integration/file.mjs +13 -63
  141. package/scripts/integration/integrer.mjs +157 -424
  142. package/scripts/integration/jugement.mjs +109 -0
  143. package/scripts/integration/rejeu.mjs +94 -71
  144. package/scripts/jointure.d.ts +34 -27
  145. package/scripts/journal-des-etats.d.mts +1 -1
  146. package/scripts/langages/c/commandes.mjs +27 -12
  147. package/scripts/langages/cargo/commandes.mjs +148 -94
  148. package/scripts/langages/cargo/index.mjs +2 -1
  149. package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
  150. package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
  151. package/scripts/langages/python/commandes.mjs +31 -15
  152. package/scripts/langages/python/index.mjs +2 -1
  153. package/scripts/langages/python/lectures-des-tests.mjs +148 -0
  154. package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
  155. package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
  156. package/scripts/langages/typescript/index.mjs +4 -0
  157. package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
  158. package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
  159. package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
  160. package/scripts/langages/typescript/tests.mjs +11 -37
  161. package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
  162. package/scripts/langages/typescript/verifier.mjs +74 -44
  163. package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
  164. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
  165. package/scripts/lectures-communes.mjs +234 -0
  166. package/scripts/machine.mjs +11 -18
  167. package/scripts/mesure/base-de-passe.mjs +1 -2
  168. package/scripts/mesure-de-la-machine.d.mts +40 -3
  169. package/scripts/mesure-de-la-machine.mjs +201 -11
  170. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
  171. package/scripts/migrations/nuit-yml-retire.mjs +25 -0
  172. package/scripts/migrations/part-retiree.mjs +31 -0
  173. package/scripts/migrations.mjs +4 -0
  174. package/scripts/montee.mjs +22 -1
  175. package/scripts/nuit-de-pc2.mjs +628 -0
  176. package/scripts/nuit.sh +8 -131
  177. package/scripts/paquets.mjs +1 -1
  178. package/scripts/passe-de-la-machine.mjs +340 -103
  179. package/scripts/place-du-circuit.d.mts +15 -0
  180. package/scripts/place-du-circuit.mjs +32 -0
  181. package/scripts/places-de-la-machine.mjs +148 -626
  182. package/scripts/places-du-serveur.mjs +26 -13
  183. package/scripts/plafond-de-la-machine.d.mts +8 -13
  184. package/scripts/plafond-de-la-machine.mjs +26 -56
  185. package/scripts/registre-des-entrees.mjs +57 -0
  186. package/scripts/regles-des-places.d.mts +82 -50
  187. package/scripts/regles-des-places.mjs +192 -156
  188. package/scripts/retirer-copie.sh +9 -2
  189. package/scripts/seances.mjs +181 -63
  190. package/scripts/secours.mjs +95 -0
  191. package/scripts/services-du-noyau.mjs +11 -19
  192. package/scripts/sous-commandes.mjs +1 -0
  193. package/scripts/sous-modules.sh +1 -1
  194. package/scripts/superviseur.mjs +98 -20
  195. package/scripts/table-des-consommations.d.mts +9 -0
  196. package/scripts/table-des-consommations.mjs +35 -0
  197. package/scripts/tableau.mjs +33 -19
  198. package/scripts/taches-du-graphe.mjs +124 -2
  199. package/scripts/transitions.d.mts +27 -5
  200. package/scripts/transitions.mjs +122 -104
  201. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  202. package/scripts/verdict-de-la-nuit.mjs +34 -7
  203. package/scripts/verrou-de-fichier.mjs +1 -2
  204. package/scripts/workflows-du-cadre.mjs +2 -2
  205. package/skills/developpeur/SKILL.md +8 -2
  206. package/skills/direct/SKILL.md +5 -0
  207. package/skills/explorateur/SKILL.md +10 -1
  208. package/skills/grill/SKILL.md +2 -4
  209. package/skills/pitmaster/SKILL.md +14 -7
  210. package/skills/pitmaster/references/consigne-agent.md +1 -1
  211. package/skills/relecteur/SKILL.md +4 -1
  212. package/skills/testwriter/SKILL.md +15 -2
  213. package/cadre/templates/projet/.env.example +0 -57
  214. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  215. package/cadre/templates/projet/deployment/README.md +0 -98
  216. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  217. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  218. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  219. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  220. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  221. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  222. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  223. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  224. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  225. package/cadre/templates/projet/src/config.ts +0 -68
  226. package/cadre/templates/projet/src/errors.ts +0 -102
  227. package/cadre/templates/projet/src/index.ts +0 -46
  228. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  229. package/cadre/templates/projet/src/types/index.ts +0 -24
  230. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  231. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  232. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  233. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  234. package/cadre/templates/projet/tsconfig.build.json +0 -14
  235. package/scripts/flux-de-la-nuit.mjs +0 -39
  236. package/scripts/garde-de-la-memoire.mjs +0 -231
  237. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -1,184 +0,0 @@
1
- // The fallback of the night (packages/grillhouse/docs/architecture/entree.md §3.1 « Repli de la
2
- // nuit », §5.3 « Les deux parts »): the night of PC3 (scripts/nuit.sh) reads, by `gh`, the jobs
3
- // of the day's Nuit flow, and decides tranche by tranche what PC3 plays in place of PC2, as a queue
4
- // of agents falls back on another capacity (Buildkite) when no agent takes the job in time.
5
- //
6
- // - A tranche finished on PC2, green or red, is never replayed.
7
- // - A tranche whose job has not started 60 minutes after the hour of the flow is cancelled and
8
- // played on PC3, on its part; a tranche started then interrupted (cancelled, a runner lost, never
9
- // started) counts as not played and plays whole again.
10
- // - A tranche that runs, or waits for less than 60 minutes, stays at PC2.
11
- // - The statement says which tranches played where: `pc2` the finished ones, `pc3` the replayed.
12
- // - The measures of time: when the project's flow declares a job that plays them (`mesures`, see
13
- // scripts/flux-de-la-nuit.mjs), the statement says its state (`mesures`: `verte`, `rouge`, `en-cours`,
14
- // or `a-rejouer` when the job was interrupted or never came and the flow is over: PC3 plays them).
15
- // - The flow read is the one of the commit the night plays: a run of another commit counts for none,
16
- // and with no run of that commit every tranche, and the measures, play on PC3.
17
- //
18
- // node repli-de-la-nuit.mjs <dépôt owner/nom> <nombre de tranches> [<identifiant du flux>] [<commit>] the
19
- // decision as JSON, the run cancelled (`gh run cancel`) when a tranche waited too long; a run that
20
- // waits for its group of concurrence, with no job yet, counts every tranche as not started
21
- import { spawnSync } from 'node:child_process';
22
- import { fileURLToPath } from 'node:url';
23
- import path from 'node:path';
24
-
25
- /** The minutes a tranche may wait for its job to start before PC3 plays it. */
26
- export const ATTENTE_MAX_MINUTES = 60;
27
-
28
- const MESURES = /^mesures\b/;
29
- const TRANCHE = /^tranches\b.*?(\d+)\)\s*$/;
30
- // The conclusions of a job that started or was cancelled without finishing its tranche.
31
- const INTERROMPUES = new Set(['cancelled', 'skipped', 'startup_failure']);
32
-
33
- /**
34
- * The decision on the tranches of a Nuit flow.
35
- * @param {{ jobs: { name: string, status: string, conclusion: string | null, startedAt: string | null }[], heureDuFlux: string, maintenant: string, fluxTermine?: boolean }} o
36
- * `jobs` the jobs of the run as `gh run view --json jobs` gives them, `heureDuFlux` the hour the
37
- * flow was created, `maintenant` the present hour, both ISO, `fluxTermine` whether the run is over.
38
- * @returns {{ aRejouer: number[], aAnnuler: number[], enAttente: number[], pc2: number[], pc3: number[], mesures: 'verte' | 'rouge' | 'en-cours' | 'a-rejouer' }}
39
- */
40
- export function choisirLeRepli({ jobs, heureDuFlux, maintenant, fluxTermine = false }) {
41
- const attente = Date.parse(maintenant) - Date.parse(heureDuFlux);
42
- const d = {
43
- aRejouer: [],
44
- aAnnuler: [],
45
- enAttente: [],
46
- enCours: [],
47
- rouges: [],
48
- pc2: [],
49
- pc3: [],
50
- };
51
- const tranches = jobs
52
- .map(j => ({ j, n: Number(TRANCHE.exec(j.name)?.[1]) }))
53
- .filter(({ n }) => Number.isInteger(n) && n > 0)
54
- .sort((a, b) => a.n - b.n);
55
- for (const { j, n } of tranches) {
56
- if (j.status === 'completed') {
57
- if (INTERROMPUES.has(j.conclusion ?? '')) {
58
- d.aRejouer.push(n);
59
- } else {
60
- d.pc2.push(n);
61
- if (j.conclusion !== 'success') {
62
- d.rouges.push(n);
63
- }
64
- }
65
- } else if (j.startedAt || j.status === 'in_progress') {
66
- d.pc2.push(n);
67
- d.enCours.push(n);
68
- } else if (attente >= ATTENTE_MAX_MINUTES * 60_000) {
69
- d.aAnnuler.push(n);
70
- d.aRejouer.push(n);
71
- } else {
72
- d.enAttente.push(n);
73
- }
74
- }
75
- d.pc3 = [...d.aRejouer];
76
- d.mesures = etatDesMesures(
77
- jobs.find(j => MESURES.test(j.name)),
78
- d.aAnnuler.length > 0 || fluxTermine
79
- );
80
- return d;
81
- }
82
-
83
- // The state of the measures job <j> of the flow: its verdict once finished, `en-cours` while it
84
- // waits or runs, `a-rejouer` when it was interrupted, or never came and <termine> (the flow is over
85
- // or cancelled).
86
- function etatDesMesures(j, termine) {
87
- if (!j) {
88
- return termine ? 'a-rejouer' : 'en-cours';
89
- }
90
- if (j.status !== 'completed') {
91
- return termine ? 'a-rejouer' : 'en-cours';
92
- }
93
- if (INTERROMPUES.has(j.conclusion ?? '')) {
94
- return 'a-rejouer';
95
- }
96
- return j.conclusion === 'success' ? 'verte' : 'rouge';
97
- }
98
-
99
- function gh(args) {
100
- const r = spawnSync('gh', args, { encoding: 'utf8' });
101
- if (r.status !== 0) {
102
- throw new Error(`gh ${args.join(' ')} : ${r.stderr || r.error?.message || r.status}`);
103
- }
104
- return r.stdout;
105
- }
106
-
107
- /**
108
- * The id of the latest Nuit run of <commit> (any latest run when <commit> is empty), undefined when
109
- * the flow has none for it.
110
- */
111
- function fluxDuCommit(depot, commit) {
112
- const runs = JSON.parse(
113
- gh([
114
- 'run',
115
- 'list',
116
- '-R',
117
- depot,
118
- '--workflow',
119
- 'nuit.yml',
120
- '--limit',
121
- '20',
122
- '--json',
123
- 'databaseId,headSha',
124
- ])
125
- );
126
- return runs.find(r => !commit || r.headSha === commit)?.databaseId;
127
- }
128
-
129
- if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
130
- const [depot, tranches, identifiant, commit] = process.argv.slice(2);
131
- const n = Number(tranches) || 0;
132
- // No run of the commit the night plays: the flow played none of it, PC3 plays every tranche.
133
- const rien = () => {
134
- const toutes = Array.from({ length: n }, (_, i) => i + 1);
135
- return {
136
- aRejouer: toutes,
137
- aAnnuler: [],
138
- enAttente: [],
139
- enCours: [],
140
- rouges: [],
141
- pc2: [],
142
- pc3: toutes,
143
- mesures: 'a-rejouer',
144
- };
145
- };
146
- try {
147
- const id = identifiant || fluxDuCommit(depot, commit);
148
- if (!id) {
149
- process.stdout.write(`${JSON.stringify({ ...rien(), flux: null })}\n`);
150
- } else {
151
- const run = JSON.parse(
152
- gh(['run', 'view', String(id), '-R', depot, '--json', 'jobs,createdAt,status,headSha'])
153
- );
154
- if (commit && run.headSha !== commit) {
155
- process.stdout.write(`${JSON.stringify({ ...rien(), flux: null })}\n`);
156
- } else {
157
- // A run that waits for the group of concurrence has no job yet: each of its tranches is
158
- // a job not started.
159
- const jobs =
160
- run.jobs.length === 0 && run.status !== 'completed'
161
- ? Array.from({ length: Number(tranches) || 0 }, (_, i) => ({
162
- name: `tranches (26.x, ${i + 1})`,
163
- status: 'queued',
164
- conclusion: null,
165
- startedAt: null,
166
- }))
167
- : run.jobs;
168
- const d = choisirLeRepli({
169
- jobs,
170
- heureDuFlux: run.createdAt,
171
- maintenant: new Date().toISOString(),
172
- fluxTermine: run.status === 'completed',
173
- });
174
- if (d.aAnnuler.length > 0) {
175
- gh(['run', 'cancel', String(id), '-R', depot]);
176
- }
177
- process.stdout.write(`${JSON.stringify({ ...d, flux: id })}\n`);
178
- }
179
- }
180
- } catch (e) {
181
- process.stderr.write(`⛔ repli de la nuit : ${e.message}\n`);
182
- process.exitCode = 1;
183
- }
184
- }