@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
@@ -111,6 +111,7 @@ export const DU_CODE_EN_COURS = new Set([
111
111
  'hook',
112
112
  'hooks',
113
113
  'langages-des-paquets',
114
+ 'nuit-de-pc2',
114
115
  'style-a-l-ecriture',
115
116
  'temporaire',
116
117
  'tests',
@@ -1,5 +1,5 @@
1
1
  // The waits of a pass for the room of the machine, and the stop they end on: what a pass wants
2
- // before it plays, besides its part of the budget (scripts/places-de-la-machine.mjs).
2
+ // before it plays, besides its reservation of the arbiter (scripts/places-de-la-machine.mjs).
3
3
  // Architecture: docs/architecture/machine.md (§5.1, §6 « Le disque »).
4
4
  //
5
5
  // - A pass first wants room in the temporary directory (`os.tmpdir()` under its environment):
@@ -17,17 +17,12 @@
17
17
  // (`occupantsDesCopies` of scripts/copies-finies.mjs).
18
18
  // - The stop of a wait is an AttenteDeLaMachine: `code` 75 at the bound, 1 for a server of the
19
19
  // places that does not answer.
20
- // - A pass has a rank: one played in the frame's own repository (one whose workspaces hold the
21
- // package @roomi-fields/grillhouse in development, its agent copies included: `rangDeLaMesure`)
22
- // is of the first rank, « mesure du cadre »; a project's is of the second, « mesure d'un
23
- // projet ».
24
20
  import { spawnSync } from 'node:child_process';
25
- import { lstatSync, readdirSync, readFileSync, statfsSync } from 'node:fs';
21
+ import { lstatSync, readdirSync, statfsSync } from 'node:fs';
26
22
  import { tmpdir } from 'node:os';
27
23
  import path from 'node:path';
28
24
  import { A_REPASSER } from './codes-de-sortie.mjs';
29
25
  import { occupantsDesCopies } from './copies-finies.mjs';
30
- import { paquets } from './paquets.mjs';
31
26
  import { duree } from './regles-des-places.mjs';
32
27
  import { attendreUnPeu } from './verrou-de-fichier.mjs';
33
28
 
@@ -44,19 +39,6 @@ export const ATTENTE_MACHINE_MS = 60 * 60_000;
44
39
  // The gap between two lines that say the wait goes on.
45
40
  const RAPPEL_MS = 30_000;
46
41
 
47
- // The name of the frame's package, which a repository of the first rank develops.
48
- const CADRE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).name;
49
-
50
- /**
51
- * The rank of a pass played at <racine>: 1 in the frame's own repository (its workspaces hold
52
- * the package @roomi-fields/grillhouse in development), 2 elsewhere.
53
- * @param {string} racine the root of the repository the pass plays in
54
- * @returns {1 | 2}
55
- */
56
- export function rangDeLaMesure(racine) {
57
- return paquets(racine).some(p => p.pkg.name === CADRE) ? 1 : 2;
58
- }
59
-
60
42
  /** The stop of a wait of the machine: `code` is 75 at the bound, 1 for a server that fails. */
61
43
  export class AttenteDeLaMachine extends Error {
62
44
  /**
@@ -98,8 +80,7 @@ export function racineDuDepot(racine) {
98
80
 
99
81
  /**
100
82
  * The bound of a wait under <env>, in ms (GRILLHOUSE_ATTENTE_MACHINE_MS, else ATTENTE_MACHINE_MS);
101
- * the wait for a place of the machine (scripts/places-de-la-machine.mjs) and for a part has the
102
- * same.
83
+ * the wait for a reservation of the machine (scripts/places-de-la-machine.mjs) has the same.
103
84
  * @param {Record<string, string | undefined>} env
104
85
  * @returns {number}
105
86
  */
@@ -22,10 +22,10 @@
22
22
  // copies included, beside the last green (scripts/dernier-vert.mjs): `{ passes, taches }`, the
23
23
  // total of the last pass of each kind and the files planned of each task by its hash (the
24
24
  // latest TACHES_GARDEES); each pass keeps its own at its end (`garderLeTotal`).
25
- // - Each pass that holds a part of the machine (scripts/places-de-la-machine.mjs: a measure out of
26
- // a ticket, `npm run verifier` of a supervisor, or a pass of the circuit of a ticket) names its
27
- // progress directory in the file of its part (`nommerLAvancement`); the board reads the parts
28
- // held with their progress, and the waits for a part or for room (`lireLaMesure`).
25
+ // - The board reads the passes the arbiter holds or keeps waiting, in its view
26
+ // (scripts/places-de-la-machine.mjs `lirePlaces`: a measure out of a ticket, `npm run verifier`
27
+ // of a supervisor, or a pass of the circuit of a ticket), with their project, ticket, sort,
28
+ // cores and memory (`lireLaMesure`); that view names no progress directory.
29
29
  //
30
30
  // The mechanism: docs/architecture/tests.md §3.1 and §4.2.
31
31
  import { spawnSync } from 'node:child_process';
@@ -33,8 +33,7 @@ import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node
33
33
  import { tmpdir } from 'node:os';
34
34
  import path from 'node:path';
35
35
  import { AVANCEMENT, ecrireAtomique, TACHES } from './mesure/avancement.mjs';
36
- import { budgetDeLaPasse, dossierDesParts, lireLesParts } from './places-de-la-machine.mjs';
37
-
36
+ import { budgetDeLaPasse, lirePlaces } from './places-de-la-machine.mjs';
38
37
  const PASSE = 'passe.json';
39
38
  const PLAN = 'plan';
40
39
  // The name of a progress directory starts so (`ouvrirAvancement`).
@@ -265,19 +264,18 @@ export function garderLeTotal(dossier) {
265
264
  }
266
265
 
267
266
  /**
268
- * The parts of the machine under <env>, as the board shows them (scripts/tableau.mjs): `budget`
269
- * (the cores and the memory the parts share, null when the reserve of the user is faulty, `faute`
270
- * then naming it), `prises`, each pass that holds a part (its repository `depot`, the root of its
271
- * main tree, and `projet`, its folder; its working tree `copie`; ticket, kind, `coeurs`,
272
- * `memoire` and `limite` of its part, since when, what it consumes beyond its part `depasse`,
273
- * and its progress `avancement`: its files done and planned and its last sign, null while it
274
- * names no progress directory, or that directory does not read), and `attentes`, each live wait
275
- * in the order of its rank, with the part it asks for and what it waits for (`raison`)
276
- * (`lireLesParts` of scripts/places-de-la-machine.mjs).
267
+ * The passes of the machine under <env>, as the board shows them (scripts/tableau.mjs), read from
268
+ * the view of the arbiter alone: `budget` (the cores and the memory the reservations share, null
269
+ * when the reserve of the user is faulty, `faute` then naming it), `prises`, each reservation held
270
+ * (its repository `depot`, the root of its project, and `projet`, its folder; ticket, sort, `coeurs`
271
+ * and `memoire`, since when), and `attentes`, each wait in the order of its rank, with what it asks
272
+ * for and what it waits for (`raison`). <lues> is the view, `lirePlaces` by default.
277
273
  * @param {Record<string, string | undefined>} [env]
274
+ * @param {{ lues?: { prises?: object[], attentes?: object[] } }} [o]
278
275
  */
279
- export function lireLaMesure(env = process.env) {
280
- const { prises, attentes } = lireLesParts(dossierDesParts(env));
276
+ export function lireLaMesure(env = process.env, { lues = lirePlaces({ env }) } = {}) {
277
+ const prises = lues.prises ?? [];
278
+ const attentes = [...(lues.attentes ?? [])].sort((a, b) => a.rang - b.rang);
281
279
  let budget = null;
282
280
  let faute = null;
283
281
  try {
@@ -285,27 +283,20 @@ export function lireLaMesure(env = process.env) {
285
283
  } catch (e) {
286
284
  faute = e.message;
287
285
  }
288
- // What a pass holds or asks for; `limite`, where its group is cut (null, a session; absent from
289
- // a part that names none).
290
- const nom = ({ depot, copie, projet, ticket, sorte, depuis, coeurs, memoire, limite }) => ({
291
- depot,
292
- copie: copie ?? null,
293
- projet,
286
+ // What a pass holds or asks for; a request without a root names no project.
287
+ const nom = ({ racine, ticket, sorte, depuis, coeurs, memoire }) => ({
288
+ depot: racine ?? null,
289
+ projet: racine ? path.basename(racine) : null,
294
290
  ticket: ticket ?? null,
295
- sorte,
291
+ sorte: sorte ?? null,
296
292
  depuis,
297
293
  coeurs,
298
294
  memoire,
299
- limite,
300
295
  });
301
296
  return {
302
297
  budget,
303
298
  faute,
304
- prises: prises.map(p => ({
305
- ...nom(p),
306
- depasse: p.depasse ?? null,
307
- avancement: typeof p.dossier === 'string' ? lireAvancement(p.dossier) : null,
308
- })),
299
+ prises: prises.map(p => nom(p)),
309
300
  attentes: attentes.map(a => ({ ...nom(a), rang: a.rang, raison: a.raison ?? '' })),
310
301
  };
311
302
  }
package/scripts/bilan.mjs CHANGED
@@ -5,6 +5,7 @@
5
5
  // figures on the ticket's card.
6
6
  //
7
7
  // npx grillhouse bilan <ticket> [--garder]
8
+ // npx grillhouse bilan --file
8
9
  //
9
10
  // prints the bilan of <ticket>, read from the main tree of the current directory; `--garder` keeps
10
11
  // it too, as the circuit does, so the next ticket's bilan names it as its base.
@@ -103,6 +104,7 @@ import {
103
104
  tousLesRolesDe,
104
105
  } from './etapes.mjs';
105
106
  import { lireFichier } from './tableau.mjs';
107
+ import { tauxDeRejeu } from './registre-des-entrees.mjs';
106
108
 
107
109
  export { bilansGardes, enBref } from './bilans-gardes.mjs';
108
110
 
@@ -950,10 +952,28 @@ async function finSurLeServeur(racine, ticket) {
950
952
  }
951
953
  }
952
954
 
955
+ /**
956
+ * The bilan of the queue of the project <racine>: its rate of replay, read in the registry of its
957
+ * entries (`rejeu : 3 entrées sur 12 (25 %)`), the measure that decides later whether the lots
958
+ * waiting are grouped.
959
+ */
960
+ export function bilanDeLaFile(racine) {
961
+ const { rejeux, entrees, pourcent } = tauxDeRejeu(racine);
962
+ return pourcent === null
963
+ ? 'rejeu : aucune entrée relevée'
964
+ : `rejeu : ${rejeux} entrée${rejeux > 1 ? 's' : ''} sur ${entrees} (${pourcent} %)`;
965
+ }
966
+
953
967
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
954
968
  const [ticket, ...options] = process.argv.slice(2);
955
- if (!ticket || ticket.startsWith('-')) {
956
- process.stderr.write('usage: bilan.mjs <ticket> [--garder]\n');
969
+ if (ticket === '--file') {
970
+ const commun = spawnSync('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], {
971
+ encoding: 'utf8',
972
+ });
973
+ const racine = commun.status === 0 ? path.dirname(commun.stdout.trim()) : process.cwd();
974
+ process.stdout.write(`${bilanDeLaFile(racine)}\n`);
975
+ } else if (!ticket || ticket.startsWith('-')) {
976
+ process.stderr.write('usage: bilan.mjs <ticket> [--garder] | --file\n');
957
977
  process.exitCode = 2;
958
978
  } else {
959
979
  const commun = spawnSync('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], {
@@ -40,7 +40,7 @@ export function refusSurMain(remote, refs, { jugee, tete, ecarts }) {
40
40
  .filter(r => r.distante === 'refs/heads/main' && !SUPPRESSION.test(r.sha))
41
41
  .filter(r => !jugee(r.sha))
42
42
  .map(r => {
43
- const base = `⛔ ${r.sha.slice(0, 8)} n'est jugé vert par aucune passe finale ni vérification de lot : main n'avance que sur un arbre jugé. Joue \`npm run verifier\` sur ce commit (vérification de la voie de secours), ou laisse la file du circuit jouer sa passe finale.`;
43
+ const base = `⛔ ${r.sha.slice(0, 8)} n'entre pas sur main : l'arbre du commit n'est au registre d'aucun jugement, et main n'avance que sur un arbre jugé. Ce qui inscrit un arbre : la passe finale de la file du circuit, et hors du circuit deux voies seulement, la voie de secours (\`npm run verifier -- --secours <ticket>\`, réservée aux pannes du moteur) et la montée (\`npx grillhouse maj <x.y.z>\`).`;
44
44
  const fichiers = tete === r.sha && ecarts ? ecarts() : [];
45
45
  return fichiers.length
46
46
  ? `${base} Le dossier diffère du commit par : ${fichiers.join(', ')} (commite-les ou restaure-les).`
@@ -61,9 +61,13 @@
61
61
  // lot>`, `npm exec --no -- grillhouse construire --gardes`, then the guards
62
62
  // (`GRILLHOUSE_ENVELOPPE=<plan> npm run grillhouse:gardes`, and `npm run gardes` when the project
63
63
  // has it). A warning or a note of the SARIF is listed apart and given to no developpeur.
64
- // - The final pass plays the band of the lot (`laPasseFinale`: the copy kept as a commit,
65
- // `npm run verifier -- --filter=...[<base>...<copie>] --filter=//`) and marks the lot verified
66
- // (`verifie`, read as a mark, never re-hashed).
64
+ // - The final pass commits the lot on the tip of main in the copy (`commiterLeLot`, after the
65
+ // references written in full that the lot touches), then plays the band of the lot
66
+ // (`laPasseFinale`, `npm run verifier -- --filter=...[<base>...<commit>] --filter=//`), keeps
67
+ // the tree of a green pass in the registry of the trees judged (scripts/arbres-juges.mjs) and
68
+ // marks the lot verified (`verifie`, read as a mark, never re-hashed). A refused commit stops at
69
+ // « integration » (17). The commit goes back to local work before a session, the proof, the checks
70
+ // or a regeneration changes the lot (scripts/etat-du-depot.mjs).
67
71
  // - The references (4.2) are the frame's (`referencesDuCadre`), the project's
68
72
  // (`grillhouse.references`: { nom, commande, fichiers, tests, gardes, lit }) and its generated
69
73
  // files (`grillhouse.engendres`, scripts/engendres.mjs); a command that fails, or a file changed
@@ -71,17 +75,15 @@
71
75
  // - The reviewer is `claude -p --agent relecteur --session-id <uuid>` (CLAUDE_BIN replaces claude)
72
76
  // on Sonnet; its sheet needs a `conformite` line per element of the lot (`conformiteDuLot`,
73
77
  // scripts/resultats.mjs); a blocking finding names its agent; the third RENDU since the last
74
- // ACCEPTÉ stops at « relecture-arret ». The ACCEPTÉ ↔ final pass cycle is bounded
75
- // (`TOURS_DE_LA_PASSE_FINALE`).
76
- // - The integration builds the lot from the copy (the testwriter's files, `estUnTest`, in one
77
- // patch, the others in another; message `<type>(<paquets>): <sujet> (<ticket>)`, the type read
78
- // from the ticket's type: bug fix, chore, docs, else feat) and runs
79
- // scripts/integration/integrer.mjs: 0 commits on agent/<ticket> and labels the ticket `en-file`,
80
- // 75 plays it once more (`rejeu`) then stops at « a-repasser », any other code is a refusal
81
- // (« integration »), but a lot that does not apply while main moved past the copy, which goes
82
- // back to the pass that judges it (gesture `conflit-de-l-avance`). The queue is the workflow `file:<racine>` (src/temporal/file/deroule.ts).
83
- // A branch it reopens on a conflict goes back the same way, its copy made again at the base of
84
- // the lot, the lot as local work (`remettreEnTravail`).
78
+ // ACCEPTÉ stops at « relecture-arret »; a verdict ACCEPTÉ always sends the lot to the integration.
79
+ // - The integration writes the final message of the commit judged (`<type>(<paquets>): <sujet>
80
+ // (<ticket>)`, the type read from the ticket's type: bug fix, chore, docs, else feat) and runs
81
+ // scripts/integration/integrer.mjs: 0 amends that commit, its tree unchanged, labels the ticket
82
+ // `en-file` and removes the copy; any other code is a refusal (« integration »). A copy that does
83
+ // not hold that commit as judged goes back to the final pass. The queue is the workflow
84
+ // `file:<racine>` (src/temporal/file/deroule.ts). A branch it reopens on a conflict goes back to
85
+ // the pass that judges it, its copy made again at the base of the lot, the lot as local work
86
+ // (`remettreEnTravail`, gesture `conflit-de-l-avance`).
85
87
  // - The tri of the discoveries (5.3, `trier`) never stops the circuit nor undoes the integration.
86
88
  // - The working files live beside the copy: `.claude/worktrees/<ticket>.travail` (instructions,
87
89
  // results, errors, patches), `.log`, `.fiches.jsonl` (`{ date, role, fiche }`), `.bilan.json`
@@ -128,6 +130,8 @@ import path from 'node:path';
128
130
  import { empreintesDe, outilsDe } from './outils-cles.mjs';
129
131
  import { donneesDe } from './donnees-cles.mjs';
130
132
  import { engendresDe } from './engendres.mjs';
133
+ import { arbreEstJuge, garderLArbreJuge } from './arbres-juges.mjs';
134
+ import { commitDuLot, rendreEnTravail, reposerLeCommit, sortie } from './etat-du-depot.mjs';
131
135
  import { matieresDeclareesDe } from './matieres-cles.mjs';
132
136
  import { fluxDe } from './flux-des-paquets.mjs';
133
137
  import {
@@ -175,6 +179,7 @@ import {
175
179
  environnementDeLaPasse,
176
180
  horsDeLEnveloppe,
177
181
  integrer,
182
+ commiterLeLot,
178
183
  laPasseFinale,
179
184
  leLotAccepte,
180
185
  leLotGarde,
@@ -344,7 +349,7 @@ export function contexte(o) {
344
349
  const duTitre = titre => leTitre(o.ticket, titre, resoudre);
345
350
  // The working directory of the circuit is the ticket's, `<copie>.travail` beside its copy: what
346
351
  // the circuit hands its sessions (their instructions, results and errors, the reviewer's
347
- // statements, the integration's patches and message), which a session out of the envelope reads
352
+ // statements, the message of the commit), which a session out of the envelope reads
348
353
  // even when its circuit is killed. As the workspace of a pipeline (Jenkins, GitLab), it lives as
349
354
  // long as the ticket: no sweep touches it, a circuit relaunched takes it up again, each session
350
355
  // numbering its files after those it finds (`prochainNumero` of scripts/seances.mjs), and the queue removes it at the ticket's closure, or the removal of
@@ -592,7 +597,6 @@ export function ecrireEtat(ctx, etat) {
592
597
  paquets: ctx.paquets,
593
598
  constats: ctx.constats ?? [],
594
599
  verifie: ctx.verifie ?? null,
595
- toursDeLaPasseFinale: ctx.toursDeLaPasseFinale ?? null,
596
600
  seanceReprise: ctx.seanceReprise ?? null,
597
601
  verts: ctx.verts ?? null,
598
602
  reprise: ctx.reprise ?? null,
@@ -742,6 +746,17 @@ export function avantLaPasse(
742
746
  };
743
747
  }
744
748
 
749
+ // The tree of the commit of the lot of the copy, or null.
750
+ function arbreDuLotCommite(ctx) {
751
+ const commit = commitDuLot(ctx.copie);
752
+ return commit ? sortie(ctx.copie, ['rev-parse', `${commit}^{tree}`]) : null;
753
+ }
754
+
755
+ const leCommitEstJuge = ctx => {
756
+ const arbre = arbreDuLotCommite(ctx);
757
+ return Boolean(arbre) && arbreEstJuge(ctx.racine, arbre);
758
+ };
759
+
745
760
  /**
746
761
  * What the circuit keeps of the conflict <conflit> (`avantLaPasse`) its pass at the state <etat>
747
762
  * met: the role relaunched, the first of `conflit.roles`, and the memory: the roles relaunched,
@@ -1097,6 +1112,7 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1097
1112
  case 'livre':
1098
1113
  return livre(ctx);
1099
1114
  case 'seanceDuGeste': {
1115
+ rendreEnTravail(ctx.copie);
1100
1116
  const { description } = leTicket(ctx);
1101
1117
  return jusquALaFiche(
1102
1118
  ctx,
@@ -1123,6 +1139,8 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1123
1139
  );
1124
1140
  }
1125
1141
  case 'seance': {
1142
+ // The lot changes: local work again.
1143
+ rendreEnTravail(ctx.copie);
1126
1144
  const { role, ...options } = parametres;
1127
1145
  // The session reads the findings and the session to resume the circuit keeps, and gives back
1128
1146
  // what the circuit keeps of them.
@@ -1146,6 +1164,7 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1146
1164
  case 'lecture':
1147
1165
  return rougeDeLecture(ctx);
1148
1166
  case 'preuve': {
1167
+ rendreEnTravail(ctx.copie);
1149
1168
  // The measure of the last proof, kept in the working directory of the ticket, which the next
1150
1169
  // proof on the same tree judges again without playing it: each act plays in a process of its
1151
1170
  // own, and a measure is too large for the memory of the workflow.
@@ -1161,7 +1180,11 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1161
1180
  return { ...p, empreinte: empreinteDeLEtape(ctx, 'preuve'), ms: Date.now() - debut };
1162
1181
  }
1163
1182
  case 'empreinteEtape':
1164
- return empreinteDeLEtape(ctx, parametres.etape);
1183
+ // The green kept of the final pass is read back only while the tree of the commit of the lot
1184
+ // is in the registry of the trees judged.
1185
+ return parametres.etape === 'passe-finale' && !leCommitEstJuge(ctx)
1186
+ ? null
1187
+ : empreinteDeLEtape(ctx, parametres.etape);
1165
1188
  case 'portes':
1166
1189
  return portesDuRouge(ctx, parametres.lieux);
1167
1190
  case 'etendreAuxEcartes':
@@ -1180,9 +1203,15 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1180
1203
  case 'arbreAvant':
1181
1204
  case 'arbreApres':
1182
1205
  return arbreDeLaCopie(ctx);
1183
- case 'passeFinale':
1184
- return laPasseFinale(ctx);
1206
+ case 'passeFinale': {
1207
+ const refus = commiterLeLot(ctx);
1208
+ return refus ? { refus } : laPasseFinale(ctx);
1209
+ }
1185
1210
  case 'controles': {
1211
+ // The checks of the plan read the lot as local work.
1212
+ if (!parametres.finale) {
1213
+ rendreEnTravail(ctx.copie);
1214
+ }
1186
1215
  const debut = Date.now();
1187
1216
  const k = controles(
1188
1217
  ctx,
@@ -1192,13 +1221,21 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1192
1221
  parametres.fichiers
1193
1222
  );
1194
1223
  const ms = Date.now() - debut;
1224
+ // The final pass green on the whole band of the commit of the lot keeps its tree in the
1225
+ // registry of the trees judged: nothing else does.
1226
+ const juge = faits.passeFinale?.arbre;
1227
+ if (parametres.finale && juge && !k.rouge && !k.aRepasser && arbreDuLotCommite(ctx) === juge) {
1228
+ garderLArbreJuge(ctx.racine, juge);
1229
+ }
1195
1230
  // The fingerprint of a green step, which its next pass on the same inputs reads back.
1196
1231
  return {
1197
1232
  ...k,
1198
1233
  empreinte:
1199
- k.rouge || k.aRepasser
1200
- ? null
1201
- : empreinteDeLEtape(ctx, parametres.finale ? 'passe-finale' : 'controles'),
1234
+ k.rouge
1235
+ ? k.empreinte
1236
+ : k.aRepasser
1237
+ ? null
1238
+ : empreinteDeLEtape(ctx, parametres.finale ? 'passe-finale' : 'controles'),
1202
1239
  ms,
1203
1240
  };
1204
1241
  }
@@ -1207,10 +1244,22 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1207
1244
  case 'lotAccepte':
1208
1245
  return leLotAccepte(ctx, parametres.arbre);
1209
1246
  case 'regeneration':
1210
- // The copy kept before it, which the regeneration restores first.
1247
+ // The lot changes: local work again. The copy kept before it, which the regeneration restores
1248
+ // first.
1249
+ rendreEnTravail(ctx.copie);
1211
1250
  return regenerer(ctx, { ...parametres, avant: leLotGarde(ctx).lot });
1212
- case 'relecture':
1213
- return relire(ctx, { constats: ctx.constats ?? [] });
1251
+ case 'relecture': {
1252
+ // The reviewer reads the lot against its base, as local work; the commit judged is posed again
1253
+ // after him.
1254
+ const commit = rendreEnTravail(ctx.copie);
1255
+ try {
1256
+ return await relire(ctx, { constats: ctx.constats ?? [] });
1257
+ } finally {
1258
+ if (commit) {
1259
+ reposerLeCommit(ctx.copie, commit);
1260
+ }
1261
+ }
1262
+ }
1214
1263
  case 'rendus':
1215
1264
  return rendusDepuisAccepte(ctx);
1216
1265
  case 'constatsDeLaDemande':
@@ -1234,21 +1283,9 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1234
1283
  code: r.code,
1235
1284
  sortie: sansCouleurs(r.sortie),
1236
1285
  commande: r.commande,
1286
+ ...(r.rejuger ? { rejuger: r.rejuger } : {}),
1237
1287
  };
1238
1288
  }
1239
- case 'mainAvancee': {
1240
- // Whether the main tree's HEAD holds a commit the copy does not, which its advance brings.
1241
- const tete = spawnSync('git', ['-C', ctx.racine, 'rev-parse', 'HEAD'], { encoding: 'utf8' });
1242
- const r = spawnSync('git', [
1243
- '-C',
1244
- ctx.copie,
1245
- 'merge-base',
1246
- '--is-ancestor',
1247
- tete.stdout.trim(),
1248
- 'HEAD',
1249
- ]);
1250
- return r.status === 1;
1251
- }
1252
1289
  case 'remiseEnTravail': {
1253
1290
  const branche = `agent/${ctx.ticket}`;
1254
1291
  const r = remettreEnTravail({ racine: ctx.racine, copie: ctx.copie, branche });
@@ -2191,7 +2228,6 @@ export async function arreter(ctx, e) {
2191
2228
  ctx.circuit = ctx.circuit ?? lu.circuit;
2192
2229
  ctx.constats = [...(lu.constats ?? [])];
2193
2230
  ctx.verifie = lu.verifie ?? null;
2194
- ctx.toursDeLaPasseFinale = lu.toursDeLaPasseFinale ?? null;
2195
2231
  ctx.seanceReprise = lu.seanceReprise ?? null;
2196
2232
  ctx.verts = lu.verts ?? null;
2197
2233
  ctx.reprise = lu.reprise ?? null;
@@ -7,9 +7,3 @@
7
7
  // wait for the part of the machine at its bound (scripts/places-de-la-machine.mjs), a stop of the
8
8
  // circuit that a gesture settles (scripts/etapes.mjs, ARRETS; circuit.md §5.5).
9
9
  export const A_REPASSER = 75;
10
-
11
- /**
12
- * The file a pass cut by the watch of its memory (scripts/garde-de-la-memoire.mjs) leaves in its
13
- * results directory, its reason inside: its 75 is no wait of the machine, and counts as a replay.
14
- */
15
- export const MEMOIRE_COUPEE = 'memoire-coupee.txt';
@@ -13,7 +13,7 @@
13
13
  // of the launch, else not at all.
14
14
  // - The rest of the dedicated cores: the load of those cores alone, read from /proc/stat.
15
15
  import { readFileSync } from 'node:fs';
16
- import { availableParallelism } from 'node:os';
16
+ import { coeursDeLaMachine } from './mesure-de-la-machine.mjs';
17
17
  import { spawnSync } from 'node:child_process';
18
18
  import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
19
19
  import { COEURS_PAR_DEFAUT } from './plafond-de-la-machine.mjs';
@@ -103,7 +103,7 @@ const lireUnFichier = chemin => {
103
103
  * reading of a file of the system (null when it does not read), for a trial
104
104
  * @returns {{ lisible: boolean, coeurs: { fils: number[], noeud: number }[] }}
105
105
  */
106
- export function lireLaTopologie({ lire = lireUnFichier, nombreDeFils = availableParallelism() } = {}) {
106
+ export function lireLaTopologie({ lire = lireUnFichier, nombreDeFils = coeursDeLaMachine() } = {}) {
107
107
  const cpu = n => `/sys/devices/system/cpu/cpu${n}/topology/thread_siblings_list`;
108
108
  const groupes = new Map();
109
109
  let lisible = true;
@@ -339,6 +339,23 @@ export function ecartDesProgrammes({ dedies, fils: tous }) {
339
339
  };
340
340
  }
341
341
 
342
+ /**
343
+ * Lifts the restriction a measure set on the programs out of the frame (`AllowedCPUs` of
344
+ * `app.slice`): the group may use every core again. Called at the end of a measure, interrupted
345
+ * one included, by the next measure, and when the arbiter opens, so that the restriction of a
346
+ * dead measure never outlives it. True when the system took it.
347
+ * @param {{ lancer?: (cmd: string, args: string[]) => number | null }} [o] the command, for a trial
348
+ * @returns {boolean}
349
+ */
350
+ export function leverLaRestriction({
351
+ lancer = (cmd, args) => spawnSync(cmd, args, { stdio: 'ignore', timeout: 20_000 }).status,
352
+ } = {}) {
353
+ // An empty value resets the group to every core of the machine.
354
+ return (
355
+ lancer('systemctl', ['--user', 'set-property', '--runtime', 'app.slice', 'AllowedCPUs=']) === 0
356
+ );
357
+ }
358
+
342
359
  /**
343
360
  * The busy and the total time of each thread, from the text of /proc/stat (hundredths of a
344
361
  * second): busy is user, nice, system, irq, softirq and steal; idle and iowait are rest. Null