@roomi-fields/grillhouse 0.54.1 → 0.55.2

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 (238) 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 +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 +18 -2
  77. package/dist/temporal/places/client.js +28 -3
  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 +24 -21
  104. package/docs/architecture/installation.md +35 -30
  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/coeurs-dedies.mjs +19 -2
  118. package/scripts/consommation-des-passes.mjs +67 -35
  119. package/scripts/consommation.mjs +152 -24
  120. package/scripts/copies-finies.mjs +15 -35
  121. package/scripts/dernier-vert.mjs +4 -5
  122. package/scripts/dette.mjs +5 -3
  123. package/scripts/droits.mjs +2 -2
  124. package/scripts/echantillonneur-de-la-passe.mjs +7 -31
  125. package/scripts/engendres.mjs +5 -61
  126. package/scripts/enveloppe/enveloppe.mjs +30 -34
  127. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
  128. package/scripts/etapes.mjs +21 -7
  129. package/scripts/etat-du-depot.mjs +61 -0
  130. package/scripts/faits-du-circuit.mjs +7 -4
  131. package/scripts/fermeture-de-la-machine.d.mts +6 -4
  132. package/scripts/fermeture-de-la-machine.mjs +12 -16
  133. package/scripts/fichier-du-poste.d.mts +9 -0
  134. package/scripts/file-des-tickets.d.mts +0 -18
  135. package/scripts/file-des-tickets.mjs +0 -42
  136. package/scripts/fusion-du-changelog.mjs +1 -1
  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 +43 -3
  169. package/scripts/mesure-de-la-machine.mjs +209 -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/table-des-consommations.mjs +36 -0
  174. package/scripts/migrations.mjs +6 -0
  175. package/scripts/montee.mjs +9 -0
  176. package/scripts/nuit-de-pc2.mjs +628 -0
  177. package/scripts/nuit.sh +8 -131
  178. package/scripts/paquets.mjs +1 -1
  179. package/scripts/passe-de-la-machine.mjs +365 -105
  180. package/scripts/place-du-circuit.d.mts +15 -0
  181. package/scripts/place-du-circuit.mjs +32 -0
  182. package/scripts/places-de-la-machine.mjs +148 -627
  183. package/scripts/places-du-serveur.mjs +43 -16
  184. package/scripts/plafond-de-la-machine.d.mts +8 -13
  185. package/scripts/plafond-de-la-machine.mjs +37 -69
  186. package/scripts/registre-des-entrees.mjs +57 -0
  187. package/scripts/regles-des-places.d.mts +84 -50
  188. package/scripts/regles-des-places.mjs +200 -156
  189. package/scripts/retirer-copie.sh +2 -2
  190. package/scripts/seances.mjs +181 -63
  191. package/scripts/secours.mjs +95 -0
  192. package/scripts/services-du-noyau.mjs +11 -19
  193. package/scripts/sous-commandes.mjs +1 -0
  194. package/scripts/sous-modules.sh +1 -1
  195. package/scripts/superviseur.mjs +16 -7
  196. package/scripts/table-des-consommations.d.mts +9 -0
  197. package/scripts/table-des-consommations.mjs +35 -0
  198. package/scripts/tableau.mjs +33 -19
  199. package/scripts/taches-du-graphe.mjs +124 -2
  200. package/scripts/transitions.d.mts +27 -5
  201. package/scripts/transitions.mjs +125 -104
  202. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  203. package/scripts/verdict-de-la-nuit.mjs +34 -7
  204. package/scripts/verrou-de-fichier.mjs +1 -2
  205. package/scripts/workflows-du-cadre.mjs +2 -2
  206. package/skills/developpeur/SKILL.md +8 -2
  207. package/skills/direct/SKILL.md +5 -0
  208. package/skills/explorateur/SKILL.md +10 -1
  209. package/skills/grill/SKILL.md +2 -4
  210. package/skills/pitmaster/SKILL.md +7 -5
  211. package/skills/pitmaster/references/consigne-agent.md +1 -1
  212. package/skills/relecteur/SKILL.md +4 -1
  213. package/skills/testwriter/SKILL.md +15 -2
  214. package/cadre/templates/projet/.env.example +0 -57
  215. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  216. package/cadre/templates/projet/deployment/README.md +0 -98
  217. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  218. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  219. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  220. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  221. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  222. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  223. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  224. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  225. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  226. package/cadre/templates/projet/src/config.ts +0 -68
  227. package/cadre/templates/projet/src/errors.ts +0 -102
  228. package/cadre/templates/projet/src/index.ts +0 -46
  229. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  230. package/cadre/templates/projet/src/types/index.ts +0 -24
  231. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  232. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  233. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  234. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  235. package/cadre/templates/projet/tsconfig.build.json +0 -14
  236. package/scripts/flux-de-la-nuit.mjs +0 -39
  237. package/scripts/garde-de-la-memoire.mjs +0 -231
  238. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -1,12 +1,13 @@
1
1
  // What a heavy pass consumes, kept with the project: the transient scope of the user's systemd
2
2
  // manager a pass runs in (`scopeSystemd`, read for `CPUUsageNSec` and `MemoryPeak`), the
3
3
  // register under `<git common dir>/grillhouse/` where each measure is a line added
4
- // (`garderLaConsommation`), and the figures per kind of pass (`bilanDeLaConsommation`). The pass
4
+ // (`garderLaConsommation`), and the figures per kind of heavy pass (`bilanDeLaConsommation`). A
5
+ // line names its `phase` (the step of the circuit, or the pass out of it), the `execution` its
6
+ // commands of one step share, and `lourde: false` for a pass that is not heavy. The pass
5
7
  // itself is `avecLaPasse` (./passe-de-la-machine.mjs). Architecture: docs/architecture/machine.md
6
8
  // (§3.1, §5.6).
7
9
  import { spawn, spawnSync } from 'node:child_process';
8
10
  import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
9
- import { cpus } from 'node:os';
10
11
  import path from 'node:path';
11
12
  import { fileURLToPath } from 'node:url';
12
13
 
@@ -15,7 +16,9 @@ const TRANCHE_DU_CADRE = 'grillhouse.slice';
15
16
  const REGISTRE = 'consommation.jsonl';
16
17
  // The client of the D-Bus of the user's systemd manager, which starts the transient scope.
17
18
  const CLIENT_DBUS = 'busctl';
18
- const SAMPLEUR =fileURLToPath(new URL('./echantillonneur-de-la-passe.mjs', import.meta.url));
19
+ import { uniteDeLEtape } from './mesure-de-la-machine.mjs';
20
+
21
+ const SAMPLEUR = fileURLToPath(new URL('./echantillonneur-de-la-passe.mjs', import.meta.url));
19
22
  // systemd's "infinity" for a 64-bit counter.
20
23
  const INFINI = 2n ** 64n - 1n;
21
24
 
@@ -54,7 +57,19 @@ export function fichierDeConsommation(racine) {
54
57
  }
55
58
 
56
59
  /**
57
- * Adds <ligne> (`{ sorte, ticket?, dureeMs, cpuNs, memoirePic, coeurs, issue, fin }`) to the
60
+ * What a line of the register says of its pass beside its figures: its `phase`, the `execution`
61
+ * of its step, and `lourde: false` for a pass that is not heavy.
62
+ * @param {{ phase?: string | null, execution?: string, lourde?: boolean }} o
63
+ */
64
+ export const marquesDeLaPasse = ({ phase, execution, lourde }) => ({
65
+ ...(phase ? { phase } : {}),
66
+ ...(execution ? { execution } : {}),
67
+ ...(lourde === false ? { lourde: false } : {}),
68
+ });
69
+
70
+ /**
71
+ * Adds <ligne> (`{ sorte, phase, execution?, lourde?, ticket?, dureeMs, cpuNs, memoirePic, coeurs,
72
+ * issue, fin }`) to the
58
73
  * register of <racine>; nothing out of git.
59
74
  * @param {string} racine
60
75
  * @param {Record<string, unknown>} ligne
@@ -103,9 +118,10 @@ const mediane = valeurs => {
103
118
  };
104
119
 
105
120
  /**
106
- * Per kind of pass, in the order of first appearance: the number of passes, the median and the
107
- * maximum of the cores occupied (processor time ÷ duration) and of the peak of memory. A line
108
- * whose processor time is unreadable, or whose duration is nil, is left out.
121
+ * Per kind of heavy pass, in the order of first appearance: the number of passes, the median and
122
+ * the maximum of the cores occupied (processor time ÷ duration) and of the peak of memory. A line
123
+ * of a pass that is not heavy, whose processor time is unreadable, or whose duration is nil, is
124
+ * left out.
109
125
  * @param {Record<string, any>[]} lignes
110
126
  * @returns {{ sorte: string, passes: number, coeursMediane: number, coeursMax: number,
111
127
  * memoireMediane: number, memoireMax: number }[]}
@@ -113,7 +129,7 @@ const mediane = valeurs => {
113
129
  export function bilanDeLaConsommation(lignes) {
114
130
  const parSorte = new Map();
115
131
  for (const l of lignes) {
116
- if (typeof l.cpuNs !== 'number' || !(l.dureeMs > 0)) {
132
+ if (l.lourde === false || typeof l.cpuNs !== 'number' || !(l.dureeMs > 0)) {
117
133
  continue;
118
134
  }
119
135
  const liste = parSorte.get(l.sorte) ?? [];
@@ -148,9 +164,6 @@ export function sorteDeLaPasse(nom) {
148
164
  .replace(/^-|-$/g, '');
149
165
  }
150
166
 
151
- /** The cores of the machine. */
152
- export const coeursDeLaMachine = () => cpus().length;
153
-
154
167
  /**
155
168
  * What the scope <unite> reports now (`lireLeScope` of `systemctl --user show`); null when the
156
169
  * manager does not answer, the scope gone.
@@ -204,10 +217,9 @@ export const DEPASSEMENT = 1.5;
204
217
  export const SEUIL_DE_DEPASSEMENT_MS = 5_000;
205
218
 
206
219
  // Starts the sampler of a pass outside its group (./echantillonneur-de-la-passe.mjs): it reads the
207
- // group <unite> while the pass lives, notes its last reading beside the marker, and, given the part
208
- // of the pass, says in the file of the part when the pass exceeds it. Without a register for the
209
- // project, nothing is started.
210
- function demarrerLEchantillonneur({ racine, sorte, ticket, coeurs, part, unite, id }) {
220
+ // group <unite> while the pass lives and notes its last reading beside the marker. Without a
221
+ // register for the project, nothing is started.
222
+ function demarrerLEchantillonneur({ racine, sorte, marques, ticket, coeurs, unite, id }) {
211
223
  const registre = fichierDeConsommation(racine);
212
224
  const marqueur = registre === null ? null : path.join(path.dirname(registre), `${id}.fin`);
213
225
  if (marqueur === null) {
@@ -223,8 +235,7 @@ function demarrerLEchantillonneur({ racine, sorte, ticket, coeurs, part, unite,
223
235
  pid: process.pid,
224
236
  racine,
225
237
  marqueur,
226
- part,
227
- base: { sorte, ...(ticket ? { ticket } : {}), coeurs, debut: Date.now() },
238
+ base: { sorte, ...marques, ...(ticket ? { ticket } : {}), coeurs, debut: Date.now() },
228
239
  }),
229
240
  ],
230
241
  { detached: true, stdio: 'ignore' }
@@ -238,21 +249,31 @@ function demarrerLEchantillonneur({ racine, sorte, ticket, coeurs, part, unite,
238
249
  * ./passe-de-la-machine.mjs): `ouvrir()` starts the sampler, which reads the group named after the
239
250
  * part of the pass while its command runs, and returns `{ unite, lire, clore }`: `lire()` the last
240
251
  * reading the sampler noted, null without one.
241
- * @param {{ racine: string, sorte: string, ticket?: string, coeurs: number,
242
- * part: { id: string, coeurs: number, memoire: number, dossier: string }, mesurer?: boolean }} o
252
+ * @param {{ racine: string, sorte: string, phase?: string | null, execution?: string,
253
+ * lourde?: boolean, ticket?: string, coeurs: number,
254
+ * part: { id: string, coeurs: number, memoire: number, limite?: number } }} o
243
255
  */
244
- export function scopeDeCommande({ racine, sorte, ticket, coeurs, part, mesurer = true }) {
256
+ export function scopeDeCommande({ racine, sorte, ticket, coeurs, part, ...passe }) {
257
+ const marques = marquesDeLaPasse(passe);
245
258
  return {
246
259
  ouvrir() {
247
- const unite = `grillhouse-passe-${part.id}.scope`;
248
- const { marqueur } = mesurer
249
- ? demarrerLEchantillonneur({ racine, sorte, ticket, coeurs, part, unite, id: part.id })
250
- : { marqueur: null };
260
+ const unite = uniteDeLEtape(part.id);
261
+ const { marqueur } = demarrerLEchantillonneur({
262
+ racine,
263
+ sorte,
264
+ marques,
265
+ ticket,
266
+ coeurs,
267
+ unite,
268
+ id: part.id,
269
+ });
251
270
  return {
252
271
  unite,
253
272
  lire: () => {
254
273
  try {
255
- return marqueur === null ? null : JSON.parse(readFileSync(`${marqueur}.lecture`, 'utf8'));
274
+ return marqueur === null
275
+ ? null
276
+ : JSON.parse(readFileSync(`${marqueur}.lecture`, 'utf8'));
256
277
  } catch {
257
278
  return null;
258
279
  }
@@ -271,11 +292,12 @@ export function scopeDeCommande({ racine, sorte, ticket, coeurs, part, mesurer =
271
292
  * The real scope of a pass that is the process itself: `ouvrir()` moves this process into a
272
293
  * transient scope of the user's systemd manager (`StartTransientUnit` with its PID, which its
273
294
  * children inherit), the CPU weight and the memory bound of its part among its properties, after
274
- * having started the sampler outside it (<mesurer>), and returns `{ lire, clore }`; `{ raison }`
295
+ * having started the sampler outside it, and returns `{ lire, clore }`; `{ raison }`
275
296
  * when no manager of the user is reachable. The scope goes when empty.
276
- * @param {{ racine: string, sorte: string, ticket?: string, coeurs: number,
277
- * part?: { id: string, coeurs: number, memoire: number, dossier: string } | null,
278
- * mesurer?: boolean }} o
297
+ * @param {{ racine: string, sorte: string, phase?: string | null, execution?: string,
298
+ * lourde?: boolean, ticket?: string, coeurs: number,
299
+ * part?: { id: string, coeurs: number, memoire: number, limite?: number } | null,
300
+ * fils?: number[] | null }} o
279
301
  * @returns {{ ouvrir: () => { lire: () => ({ cpuNs: number | null, memoirePic: number | null } | null),
280
302
  * clore: () => void } | { raison: string } }}
281
303
  */
@@ -285,9 +307,10 @@ export function scopeSystemd({
285
307
  ticket,
286
308
  coeurs,
287
309
  part = null,
288
- mesurer = true,
289
310
  fils = null,
311
+ ...passe
290
312
  }) {
313
+ const marques = marquesDeLaPasse(passe);
291
314
  // `AllowedCPUs` of systemd is a bit mask of the threads, a byte array, the first byte the
292
315
  // threads 0 to 7.
293
316
  const masque = (() => {
@@ -296,7 +319,7 @@ export function scopeSystemd({
296
319
  }
297
320
  const octets = new Array(Math.floor(Math.max(...fils) / 8) + 1).fill(0);
298
321
  for (const f of fils) {
299
- octets[Math.floor(f / 8)] |= 1 << f % 8;
322
+ octets[Math.floor(f / 8)] |= 1 << (f % 8);
300
323
  }
301
324
  return octets.map(String);
302
325
  })();
@@ -304,9 +327,15 @@ export function scopeSystemd({
304
327
  ouvrir() {
305
328
  const id = `${process.pid}-${Date.now()}`;
306
329
  const unite = `grillhouse-passe-${id}.scope`;
307
- const { marqueur, echantillonneur } = mesurer
308
- ? demarrerLEchantillonneur({ racine, sorte, ticket, coeurs, part, unite, id })
309
- : { marqueur: null, echantillonneur: null };
330
+ const { marqueur, echantillonneur } = demarrerLEchantillonneur({
331
+ racine,
332
+ sorte,
333
+ marques,
334
+ ticket,
335
+ coeurs,
336
+ unite,
337
+ id,
338
+ });
310
339
  const r = spawnSync(
311
340
  CLIENT_DBUS,
312
341
  [
@@ -319,7 +348,7 @@ export function scopeSystemd({
319
348
  'ssa(sv)a(sa(sv))',
320
349
  unite,
321
350
  'fail',
322
- String(4 + (part ? 2 : 0) + (masque.length > 0 ? 2 : 0)),
351
+ String(4 + (part ? 3 : 0) + (masque.length > 0 ? 2 : 0)),
323
352
  'PIDs',
324
353
  'au',
325
354
  '1',
@@ -341,6 +370,9 @@ export function scopeSystemd({
341
370
  'MemoryMax',
342
371
  't',
343
372
  String(Math.floor(part.limite ?? part.memoire)),
373
+ 'CPUQuotaPerSecUSec',
374
+ 't',
375
+ String((part.limiteCoeurs ?? part.coeurs) * 1_000_000),
344
376
  ]
345
377
  : []),
346
378
  // Under the framework slice, whose cores are not those withdrawn from the user's `app.slice`.
@@ -1,44 +1,172 @@
1
- // `grillhouse consommation [--json]`: what the heavy passes of the project consume, per kind of
2
- // pass, read from its register (./consommation-des-passes.mjs): the number of passes, the median
3
- // and the maximum of the cores occupied (processor time ÷ duration) and of the peak of memory.
4
- // Architecture: docs/architecture/machine.md (§5.6).
1
+ // `grillhouse consommation`, from the register of the consumptions of the project
2
+ // (./consommation-des-passes.mjs): what its heavy passes consume, per kind of pass (the number of
3
+ // passes, the median and the maximum of the cores occupied, processor time ÷ duration, and of the
4
+ // peak of memory), and the table of the consumptions, per phase
5
+ // (src/machine/table-des-consommations.ts, from the build; ./table-des-consommations.mjs).
6
+ //
7
+ // grillhouse consommation the figures per kind, then the table computed again and
8
+ // its difference with the written one, which stands
9
+ // grillhouse consommation --ecrire the same, the table written
10
+ // grillhouse consommation --actualiser writes the table and says each phase whose reservation
11
+ // changes by more than a quarter
12
+ // grillhouse consommation --json the figures per kind alone, in JSON
13
+ // grillhouse consommation --planifier creates or updates the one schedule of the machine that
14
+ // plays `--actualiser` in each of its projects every day
15
+ //
16
+ // Another argument, or two gestures at once, is refused (exit 2). Architecture:
17
+ // docs/architecture/machine.md (§4.2, §5.6).
18
+ import { mkdirSync } from 'node:fs';
19
+ import { createRequire } from 'node:module';
20
+ import path from 'node:path';
5
21
  import { pathToFileURL } from 'node:url';
22
+ import { AttenteDeLaMachine } from './attente-de-la-machine.mjs';
6
23
  import { bilanDeLaConsommation, lireLaConsommation } from './consommation-des-passes.mjs';
24
+ import { ecrireAtomique } from './mesure/avancement.mjs';
25
+ import { budgetDeLaPasse } from './places-de-la-machine.mjs';
26
+ import { partDe, plafondDe } from './plafond-de-la-machine.mjs';
27
+ import { fichierDeLaTable, lireLaTable } from './table-des-consommations.mjs';
7
28
 
8
29
  const GO = 1024 ** 3;
9
30
  const go = o => `${(o / GO).toFixed(1)} Go`;
10
31
  const coeurs = c => c.toFixed(1);
11
32
 
33
+ const GESTES = ['--json', '--ecrire', '--actualiser', '--planifier'];
34
+ const USAGE =
35
+ 'Usage : grillhouse consommation [--json | --ecrire | --actualiser | --planifier]\n';
36
+
37
+ // The modules this command loads from the build of the package's TypeScript, typed by their sources:
38
+ // the computation of the table, and the client of its schedule, loaded when it is asked for.
39
+ /**
40
+ * @returns {{
41
+ * tableDesPhases: typeof import('../src/machine/table-des-consommations.js').tableDesPhases,
42
+ * reservationsChangees:
43
+ * typeof import('../src/machine/table-des-consommations.js').reservationsChangees }}
44
+ */
45
+ const calculDeLaTable = () =>
46
+ createRequire(import.meta.url)('../dist/machine/table-des-consommations.js');
47
+ /**
48
+ * @returns {Promise<{ planifierLeRecalcul:
49
+ * typeof import('../src/temporal/consommation/commande.js').planifierLeRecalcul }>}
50
+ */
51
+ const commandeDeLaPlanification = () => import('../dist/temporal/consommation/commande.js');
52
+
53
+ // The table of the project at <racine> computed again, its `veille` the written one.
54
+ function recalculer(racine, lignes) {
55
+ return calculDeLaTable().tableDesPhases(lignes, {
56
+ budget: budgetDeLaPasse(process.env),
57
+ defaut: partDe({ budget: budgetDeLaPasse(process.env), places: plafondDe(process.env) }),
58
+ maintenant: Date.now(),
59
+ veille: lireLaTable(racine),
60
+ });
61
+ }
62
+
63
+ function ecrireLaTable(racine, table) {
64
+ const f = fichierDeLaTable(racine);
65
+ if (f === null) {
66
+ throw new AttenteDeLaMachine(`✗ ${racine} n'est pas un dépôt git : aucune table.`, 1);
67
+ }
68
+ mkdirSync(path.dirname(f), { recursive: true });
69
+ ecrireAtomique(f, table);
70
+ return f;
71
+ }
72
+
73
+ const reservation = p => `${p.coeurs} cœurs, ${go(p.memoire)}`;
74
+
75
+ // The table <table> beside the one it replaces, a line per phase.
76
+ function direLaTable(table, ecrire) {
77
+ const { jours, minimum } = table.fenetre;
78
+ ecrire(`table des consommations, recalculée sur ${jours} jours :\n`);
79
+ const phases = Object.entries(table.phases).sort(([a], [b]) => a.localeCompare(b));
80
+ if (phases.length === 0) {
81
+ ecrire('aucune phase mesurée\n');
82
+ }
83
+ for (const [phase, p] of phases) {
84
+ const defaut = p.mesures < minimum ? ` (moins de ${minimum} mesures : la part du projet)` : '';
85
+ const ecrite = p.veille
86
+ ? `table écrite : ${reservation(p.veille)}, limite ${go(p.veille.limite)}`
87
+ : 'absente de la table écrite';
88
+ ecrire(
89
+ `${phase} : ${p.mesures} mesures, réserve ${reservation(p)}, limite ${go(p.limite)}${defaut} ; ${ecrite}\n`
90
+ );
91
+ }
92
+ }
93
+
94
+ function direLeBilan(lignes, rangs, ecrire) {
95
+ if (rangs.length === 0) {
96
+ ecrire('aucune mesure\n');
97
+ return;
98
+ }
99
+ for (const r of rangs) {
100
+ // The passes of this kind that consumed clearly more than their part, the last one said.
101
+ const depassent = lignes.filter(l => l.sorte === r.sorte && l.depasse);
102
+ const depasse = depassent.length
103
+ ? ` ; ⚠ ${depassent.length} dépassent leur part (la dernière, ${depassent.at(-1).depasse})`
104
+ : '';
105
+ ecrire(
106
+ `${r.sorte} : ${r.passes} passes, cœurs occupés médiane ${coeurs(r.coeursMediane)} max ${coeurs(r.coeursMax)}, ` +
107
+ `pic de mémoire médiane ${go(r.memoireMediane)} max ${go(r.memoireMax)}${depasse}\n`
108
+ );
109
+ }
110
+ }
111
+
12
112
  /**
13
- * Writes the figures of the project at <racine> through <ecrire>; returns the exit code (0).
14
- * @param {{ args: string[], racine: string, ecrire: (texte: string) => void }} o
15
- * @returns {number}
113
+ * Plays `grillhouse consommation` with <args> on the project at <racine>, written through <ecrire>,
114
+ * a fault through <signaler>: the exit code, a promise of it for `--planifier`.
115
+ * @param {{ args: string[], racine: string, ecrire: (texte: string) => void,
116
+ * signaler?: (texte: string) => void }} o
117
+ * @returns {number | Promise<number>}
16
118
  */
17
- export function consommation({ args, racine, ecrire }) {
119
+ export function consommation({
120
+ args,
121
+ racine,
122
+ ecrire,
123
+ signaler = t => process.stderr.write(t),
124
+ }) {
125
+ if (args.length > 1 || args.some(a => !GESTES.includes(a))) {
126
+ signaler(`⛔ grillhouse consommation : « ${args.join(' ')} » ne se comprend pas.\n${USAGE}`);
127
+ return 2;
128
+ }
129
+ const [geste] = args;
130
+ if (geste === '--planifier') {
131
+ return commandeDeLaPlanification().then(m => m.planifierLeRecalcul(ecrire, signaler));
132
+ }
18
133
  const lignes = lireLaConsommation(racine);
19
134
  const rangs = bilanDeLaConsommation(lignes);
20
- if (args.includes('--json')) {
135
+ if (geste === '--json') {
21
136
  ecrire(`${JSON.stringify(rangs)}\n`);
22
- } else if (rangs.length === 0) {
23
- ecrire('aucune mesure\n');
24
- } else {
25
- for (const r of rangs) {
26
- // The passes of this kind that consumed clearly more than their part, the last one said.
27
- const depassent = lignes.filter(l => l.sorte === r.sorte && l.depasse);
28
- const depasse = depassent.length
29
- ? ` ; ⚠ ${depassent.length} dépassent leur part (la dernière, ${depassent.at(-1).depasse})`
30
- : '';
31
- ecrire(
32
- `${r.sorte} : ${r.passes} passes, cœurs occupés médiane ${coeurs(r.coeursMediane)} max ${coeurs(r.coeursMax)}, ` +
33
- `pic de mémoire médiane ${go(r.memoireMediane)} max ${go(r.memoireMax)}${depasse}\n`
34
- );
137
+ return 0;
138
+ }
139
+ if (geste !== '--actualiser') {
140
+ direLeBilan(lignes, rangs, ecrire);
141
+ }
142
+ try {
143
+ const table = recalculer(racine, lignes);
144
+ if (geste !== '--actualiser') {
145
+ direLaTable(table, ecrire);
146
+ }
147
+ if (geste === undefined) {
148
+ return 0;
149
+ }
150
+ const f = ecrireLaTable(racine, table);
151
+ if (geste === '--actualiser') {
152
+ for (const phase of calculDeLaTable().reservationsChangees(table)) {
153
+ const p = table.phases[phase];
154
+ ecrire(`${phase} : réservation ${reservation(p.veille)} → ${reservation(p)}\n`);
155
+ }
156
+ }
157
+ ecrire(`table des consommations écrite : ${f}\n`);
158
+ return 0;
159
+ } catch (e) {
160
+ if (!(e instanceof AttenteDeLaMachine)) {
161
+ throw e;
35
162
  }
163
+ signaler(`${e.message}\n`);
164
+ return e.code;
36
165
  }
37
- return 0;
38
166
  }
39
167
 
40
168
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
41
- process.exitCode = consommation({
169
+ process.exitCode = await consommation({
42
170
  args: process.argv.slice(2),
43
171
  racine: process.cwd(),
44
172
  ecrire: t => process.stdout.write(t),
@@ -15,9 +15,9 @@
15
15
  // is left out too, and pruned: its owner has played its pass in it, so it loses what the tools
16
16
  // of its languages wrote there (`ignorer`), its install (`node_modules`) kept, as its next
17
17
  // preparation would (`git clean -x -e node_modules`). Its line names each output removed with
18
- // the place it held (« target retiré (2,9 Go) »). The copy of the integration and that of the
19
- // queue, kept that no lock holds, lose them the same way: a copy that lasts holds between its
20
- // passes none of the outputs its next pass would remove anyway, and at most one pass's.
18
+ // the place it held (« target retiré (2,9 Go) »). The queue's copy, kept, loses them the same
19
+ // way: a copy that lasts holds between its passes none of the outputs its next pass would remove
20
+ // anyway, and at most one pass's.
21
21
  // The night's copy named by no one is never touched: a night may play in it.
22
22
  // - First `git worktree prune`: a copy whose folder is gone leaves the list. Then each copy
23
23
  // `git worktree list` names, the main tree and the copies named on the command line (the
@@ -28,9 +28,7 @@
28
28
  // progress (the copy's folder bears the ticket's id, `.claude/worktrees/<ticket>`, as the
29
29
  // circuit and the launcher name it; read by `bd list --status in_progress`), the working
30
30
  // directory of its circuit (`<copie>.travail`, which lives as long as the ticket,
31
- // scripts/circuit.mjs), or, for the integration copy (`.claude/worktrees/integration`), its
32
- // lock in git's common directory (`integration.lock`, scripts/integration/integrer.mjs). The
33
- // queue copy (`.claude/worktrees/file`) always stays: the workflow of the queue plays in it
31
+ // scripts/circuit.mjs). The queue copy (`.claude/worktrees/file`) always stays: the workflow of the queue plays in it
34
32
  // without a lock, one entry at a time, and prepares it again before each replay. Tickets in
35
33
  // progress that do not read, or not within a minute, hold every copy: none is removed. They are
36
34
  // read only when a copy is left to judge: a repository with no copy but the night's calls no bd.
@@ -82,8 +80,6 @@ import { nettoyerLeJournal } from './journal-des-etats.mjs';
82
80
 
83
81
  const RETIRER = path.join(import.meta.dirname, 'retirer-copie.sh');
84
82
  const PRINCIPALE = 'main';
85
- // The copies of the integration and of the queue, each held while its lock stands.
86
- const VERROUS = { integration: 'integration.lock' };
87
83
  // The queue copy, which the workflow of the queue holds without a lock (src/temporal/file/).
88
84
  const DE_LA_FILE = 'file';
89
85
  // The install of a copy: a link to the main tree's, or its own directory.
@@ -93,9 +89,9 @@ const COPIES = path.join('.claude', 'worktrees');
93
89
  // The copy of the night, its own to prepare and to remove (scripts/nuit.sh).
94
90
  const NUIT = path.join(COPIES, 'nuit');
95
91
  // The frame's copies that last, each prepared again before its pass, every untracked file removed
96
- // (`git clean -x`, scripts/nuit.sh and scripts/integration/rejeu.mjs): the night's, the
97
- // integration's, the queue's. Their folder bears no ticket.
98
- const DURABLES = new Set(['nuit', DE_LA_FILE, ...Object.keys(VERROUS)]);
92
+ // (`git clean -x`, scripts/nuit.sh and scripts/integration/rejeu.mjs): the night's and the
93
+ // queue's. Their folder bears no ticket.
94
+ const DURABLES = new Set(['nuit', DE_LA_FILE]);
99
95
 
100
96
  const lancer = (dossier, cmd, args) =>
101
97
  spawnSync(cmd, args, { cwd: dossier, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
@@ -117,7 +113,7 @@ const lesCopies = racine => copiesDe(git(racine, 'worktree', 'list', '--porcelai
117
113
  // held by its `.travail` no more: no circuit will ever remove it, and the copy is judged as any
118
114
  // other. Its ticket open, it stays held, and its line names the place its tools' outputs
119
115
  // (<ignorer>) hold there.
120
- function tenue({ chemin, verrou: raison }, enCours, commun, ignorer, tenus, fermes) {
116
+ function tenue({ chemin, verrou: raison }, enCours, ignorer, tenus, fermes) {
121
117
  const nom = path.basename(chemin);
122
118
  const sansCircuit = Boolean(tenus) && !tenus.has(nom);
123
119
  if (existsSync(`${chemin}.travail`) && !(sansCircuit && fermes().has(nom))) {
@@ -133,14 +129,8 @@ function tenue({ chemin, verrou: raison }, enCours, commun, ignorer, tenus, ferm
133
129
  if (raison !== null) {
134
130
  return `elle est verrouillée${raison ? ` (${raison})` : ''}`;
135
131
  }
136
- const verrou = VERROUS[nom];
137
- if (path.dirname(chemin).endsWith(path.join('.claude', 'worktrees'))) {
138
- if (nom === DE_LA_FILE) {
139
- return 'la file y rejoue ses entrées';
140
- }
141
- if (verrou && existsSync(path.join(commun, verrou))) {
142
- return `le verrou ${verrou} est posé`;
143
- }
132
+ if (nom === DE_LA_FILE && path.dirname(chemin).endsWith(COPIES)) {
133
+ return 'la file y rejoue ses entrées';
144
134
  }
145
135
  return null;
146
136
  }
@@ -321,8 +311,7 @@ function elaguer(chemin, ignorer) {
321
311
  * that no circuit holds. A copy kept whose ticket is closed loses what the tools of its languages
322
312
  * wrote there (<ignorer>, the directories the module of the language names, and `node_modules`).
323
313
  * <elaguer> names copies left out too, whose owner has played its pass (the night's own): each
324
- * loses its tools' outputs, its install kept; so does a copy of the integration or of the queue
325
- * kept that no lock holds. <tenus> names the tickets whose circuit the Temporal server holds, as
314
+ * loses its tools' outputs, its install kept; so does the queue's copy, kept. <tenus> names the tickets whose circuit the Temporal server holds, as
326
315
  * it runs or waits an answer (null when its caller does not read them): a copy beside its
327
316
  * `.travail` whose ticket is out of them stays while its ticket is open, its line saying its
328
317
  * circuit no longer runs, with the place of its tools' outputs; its ticket closed, it is judged as
@@ -361,25 +350,16 @@ export function retirerLesCopiesFinies(
361
350
  ];
362
351
  }
363
352
  git(racine, 'worktree', 'prune');
364
- const commun = git(
365
- racine,
366
- 'rev-parse',
367
- '--path-format=absolute',
368
- '--git-common-dir'
369
- ).stdout.trim();
370
353
  const copies = lesCopies(racine).slice(1);
371
354
  let fermes;
372
355
  // The closed tickets, read once, none when they do not read (each copy then stays held).
373
356
  const lesFermes = () => (fermes ??= lireFermes() ?? new Set());
374
357
  // The line of the copy <chemin> kept for <raison>: what it lost when its ticket is closed, or,
375
- // for the copy of the integration or of the queue, its tools' outputs, which its next
376
- // preparation removes; then the place it holds.
358
+ // for the queue's copy, its tools' outputs, which its next preparation removes; then the place
359
+ // it holds.
377
360
  const gardee = (chemin, raison) => {
378
361
  const nom = path.basename(chemin);
379
- if (
380
- (Object.hasOwn(VERROUS, nom) || nom === DE_LA_FILE) &&
381
- path.dirname(chemin).endsWith(COPIES)
382
- ) {
362
+ if (nom === DE_LA_FILE && path.dirname(chemin).endsWith(COPIES)) {
383
363
  const retirees = elaguer(chemin, ignorer);
384
364
  const perte = retirees.length
385
365
  ? ` ; sa prochaine préparation l'efface : ${retirees.join(', ')}`
@@ -395,7 +375,7 @@ export function retirerLesCopiesFinies(
395
375
  if (ecartees.has(reel(chemin))) {
396
376
  continue;
397
377
  }
398
- const raison = tenue(copie, enCours, commun, ignorer, tenus, lesFermes);
378
+ const raison = tenue(copie, enCours, ignorer, tenus, lesFermes);
399
379
  if (raison) {
400
380
  lignes.push(`· copie gardée : ${vu(chemin)} (${place(chemin)}) : ${raison}.`);
401
381
  continue;
@@ -51,7 +51,6 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'nod
51
51
  import { createRequire } from 'node:module';
52
52
  import os from 'node:os';
53
53
  import path from 'node:path';
54
- import { garderLArbreJuge } from './arbres-juges.mjs';
55
54
  import { etatDuDepot, fichierSous, git, SHA, sortie } from './etat-du-depot.mjs';
56
55
  // The variable that names the file of the changes since the last green, which the runner of the
57
56
  // tests of the module of the language reads in each package.
@@ -123,11 +122,11 @@ function lireLaBase(etat, base) {
123
122
  return { commit, arbre, branche: null };
124
123
  }
125
124
 
126
- // Keeps <etat> (etatDuDepot) as the last green of its branch, of main when HEAD is detached; its
127
- // tree is judged too (scripts/arbres-juges.mjs): the complete verification of a lot of the direct
128
- // way is what lets its commit go to main.
125
+ // Keeps <etat> (etatDuDepot) as the last green of its branch, of main when HEAD is detached: the
126
+ // base of the next passes' measure. It judges no tree and never lets a lot enter main: the registry
127
+ // of the trees judged (scripts/arbres-juges.mjs) is written by the final pass of the queue, the
128
+ // rescue way (scripts/secours.mjs) and the rise (scripts/montee.mjs).
129
129
  export function garderLeVert(etat) {
130
- garderLArbreJuge(etat.racine, etat.arbre);
131
130
  const branche = etat.branche ?? etat.main;
132
131
  const f = branche ? fichierDuVert(etat.racine, branche) : null;
133
132
  if (!f) {
package/scripts/dette.mjs CHANGED
@@ -38,6 +38,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'no
38
38
  import { tmpdir } from 'node:os';
39
39
  import path from 'node:path';
40
40
  import { pathToFileURL } from 'node:url';
41
+ import { baseDuLot } from './etat-du-depot.mjs';
41
42
  import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
42
43
  import { A_DEPLACER, A_ELAGUER, A_INSCRIRE, ecrireSarif } from './resultats.mjs';
43
44
 
@@ -274,7 +275,7 @@ export function scriptDeLaBase(racine, script, env = process.env) {
274
275
  return false;
275
276
  }
276
277
  return (
277
- spawnSync('git', ['-C', racine, 'cat-file', '-e', `HEAD:${rel.split(path.sep).join('/')}`], {
278
+ spawnSync('git', ['-C', racine, 'cat-file', '-e', `${baseDuLot(racine)}:${rel.split(path.sep).join('/')}`], {
278
279
  env,
279
280
  stdio: 'ignore',
280
281
  }).status === 0
@@ -324,10 +325,11 @@ export function renommesDuCommit(racine) {
324
325
  const env = { ...process.env, GIT_INDEX_FILE: path.join(dossier, 'index') };
325
326
  const git = (...a) =>
326
327
  spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8', env, maxBuffer: 256 * 1024 * 1024 });
327
- if (git('read-tree', 'HEAD').status !== 0 || git('add', '-A').status !== 0) {
328
+ const base = baseDuLot(racine);
329
+ if (!base || git('read-tree', base).status !== 0 || git('add', '-A').status !== 0) {
328
330
  return {};
329
331
  }
330
- const r = git('diff', '--cached', '-M', '--name-status', '-z', 'HEAD');
332
+ const r = git('diff', '--cached', '-M', '--name-status', '-z', base);
331
333
  if (r.status !== 0) {
332
334
  return {};
333
335
  }
@@ -166,7 +166,7 @@ export const ROLES = {
166
166
  modules: [],
167
167
  metacadre: true,
168
168
  debogage: true,
169
- competences: ['mesure', 'redacteur', 'writing-for-agents'],
169
+ competences: ['mesure', 'redacteur', 'writing-for-agents', 'architecte'],
170
170
  ecrit: true,
171
171
  index: true,
172
172
  porteSonTicket: true,
@@ -177,7 +177,7 @@ export const ROLES = {
177
177
  direct: {
178
178
  modules: ['preuve', 'tests'],
179
179
  debogage: true,
180
- competences: ['mesure', 'redacteur', 'writing-for-agents'],
180
+ competences: ['mesure', 'redacteur', 'writing-for-agents', 'architecte'],
181
181
  ecrit: true,
182
182
  index: true,
183
183
  porteSonTicket: true,