@roomi-fields/grillhouse 0.29.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +769 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/bin/grillhouse.mjs +79 -18
  8. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  9. package/cadre/templates/projet/CLAUDE.md +5 -1
  10. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  11. package/cadre/templates/projet/package.json +2 -2
  12. package/charte.md +24 -0
  13. package/dist/temporal/acte.d.ts +24 -0
  14. package/dist/temporal/acte.js +139 -0
  15. package/dist/temporal/acte.js.map +1 -0
  16. package/dist/temporal/attributs.d.ts +6 -0
  17. package/dist/temporal/attributs.js +15 -0
  18. package/dist/temporal/attributs.js.map +1 -0
  19. package/dist/temporal/circuit/activites.d.ts +13 -0
  20. package/dist/temporal/circuit/activites.js +33 -0
  21. package/dist/temporal/circuit/activites.js.map +1 -0
  22. package/dist/temporal/circuit/client.d.ts +72 -0
  23. package/dist/temporal/circuit/client.js +247 -0
  24. package/dist/temporal/circuit/client.js.map +1 -0
  25. package/dist/temporal/circuit/commande.d.ts +2 -0
  26. package/dist/temporal/circuit/commande.js +238 -0
  27. package/dist/temporal/circuit/commande.js.map +1 -0
  28. package/dist/temporal/circuit/contrat.d.ts +305 -0
  29. package/dist/temporal/circuit/contrat.js +30 -0
  30. package/dist/temporal/circuit/contrat.js.map +1 -0
  31. package/dist/temporal/circuit/deroule.d.ts +3 -0
  32. package/dist/temporal/circuit/deroule.js +540 -0
  33. package/dist/temporal/circuit/deroule.js.map +1 -0
  34. package/dist/temporal/client.d.ts +47 -0
  35. package/dist/temporal/client.js +69 -0
  36. package/dist/temporal/client.js.map +1 -0
  37. package/dist/temporal/commande.d.ts +2 -0
  38. package/dist/temporal/commande.js +94 -0
  39. package/dist/temporal/commande.js.map +1 -0
  40. package/dist/temporal/deroules.d.ts +5 -0
  41. package/dist/temporal/deroules.js +10 -0
  42. package/dist/temporal/deroules.js.map +1 -0
  43. package/dist/temporal/etat.d.ts +33 -0
  44. package/dist/temporal/etat.js +59 -0
  45. package/dist/temporal/etat.js.map +1 -0
  46. package/dist/temporal/file/activites.d.ts +10 -0
  47. package/dist/temporal/file/activites.js +25 -0
  48. package/dist/temporal/file/activites.js.map +1 -0
  49. package/dist/temporal/file/client.d.ts +4 -0
  50. package/dist/temporal/file/client.js +6 -0
  51. package/dist/temporal/file/client.js.map +1 -0
  52. package/dist/temporal/file/contrat.d.ts +158 -0
  53. package/dist/temporal/file/contrat.js +14 -0
  54. package/dist/temporal/file/contrat.js.map +1 -0
  55. package/dist/temporal/file/deroule.d.ts +15 -0
  56. package/dist/temporal/file/deroule.js +235 -0
  57. package/dist/temporal/file/deroule.js.map +1 -0
  58. package/dist/temporal/installation.d.ts +120 -0
  59. package/dist/temporal/installation.js +386 -0
  60. package/dist/temporal/installation.js.map +1 -0
  61. package/dist/temporal/places/activites.d.ts +8 -0
  62. package/dist/temporal/places/activites.js +13 -0
  63. package/dist/temporal/places/activites.js.map +1 -0
  64. package/dist/temporal/places/client.d.ts +28 -0
  65. package/dist/temporal/places/client.js +64 -0
  66. package/dist/temporal/places/client.js.map +1 -0
  67. package/dist/temporal/places/contrat.d.ts +106 -0
  68. package/dist/temporal/places/contrat.js +21 -0
  69. package/dist/temporal/places/contrat.js.map +1 -0
  70. package/dist/temporal/places/deroule.d.ts +3 -0
  71. package/dist/temporal/places/deroule.js +198 -0
  72. package/dist/temporal/places/deroule.js.map +1 -0
  73. package/dist/temporal/sonde/activites.d.ts +6 -0
  74. package/dist/temporal/sonde/activites.js +52 -0
  75. package/dist/temporal/sonde/activites.js.map +1 -0
  76. package/dist/temporal/sonde/contrat.d.ts +35 -0
  77. package/dist/temporal/sonde/contrat.js +10 -0
  78. package/dist/temporal/sonde/contrat.js.map +1 -0
  79. package/dist/temporal/sonde/deroule.d.ts +3 -0
  80. package/dist/temporal/sonde/deroule.js +39 -0
  81. package/dist/temporal/sonde/deroule.js.map +1 -0
  82. package/dist/temporal/tickets/activites.d.ts +7 -0
  83. package/dist/temporal/tickets/activites.js +81 -0
  84. package/dist/temporal/tickets/activites.js.map +1 -0
  85. package/dist/temporal/tickets/client.d.ts +10 -0
  86. package/dist/temporal/tickets/client.js +31 -0
  87. package/dist/temporal/tickets/client.js.map +1 -0
  88. package/dist/temporal/tickets/contrat.d.ts +56 -0
  89. package/dist/temporal/tickets/contrat.js +13 -0
  90. package/dist/temporal/tickets/contrat.js.map +1 -0
  91. package/dist/temporal/tickets/deroule.d.ts +3 -0
  92. package/dist/temporal/tickets/deroule.js +94 -0
  93. package/dist/temporal/tickets/deroule.js.map +1 -0
  94. package/dist/temporal/travailleur.d.ts +2 -0
  95. package/dist/temporal/travailleur.js +69 -0
  96. package/dist/temporal/travailleur.js.map +1 -0
  97. package/docs/ARCHITECTURE.md +646 -87
  98. package/docs/CADRE.md +27 -0
  99. package/docs/INTERFACE.md +139 -42
  100. package/hooks/crochet.mjs +19 -2
  101. package/hooks/hooks.json +11 -0
  102. package/package.json +16 -4
  103. package/scripts/activites.mjs +2255 -0
  104. package/scripts/aiguillage.d.mts +37 -0
  105. package/scripts/aiguillage.mjs +40 -14
  106. package/scripts/avancement.mjs +155 -26
  107. package/scripts/bilan.mjs +137 -43
  108. package/scripts/cadre.mjs +16 -4
  109. package/scripts/circuit.mjs +993 -4075
  110. package/scripts/circuits-cles.d.mts +4 -0
  111. package/scripts/circuits-cles.mjs +21 -0
  112. package/scripts/circuits-du-serveur.mjs +105 -0
  113. package/scripts/codes-de-sortie.mjs +9 -0
  114. package/scripts/commandes-composees.mjs +45 -41
  115. package/scripts/commandes-du-path.d.mts +7 -0
  116. package/scripts/commandes-du-path.mjs +25 -0
  117. package/scripts/composants-affectes.mjs +64 -21
  118. package/scripts/composition-des-langages.mjs +18 -12
  119. package/scripts/conformite.mjs +56 -28
  120. package/scripts/copies-finies.mjs +52 -47
  121. package/scripts/depart-du-ticket.d.mts +53 -0
  122. package/scripts/depart-du-ticket.mjs +124 -0
  123. package/scripts/dependances-internes.mjs +121 -0
  124. package/scripts/dernier-vert.mjs +61 -34
  125. package/scripts/dette.mjs +32 -11
  126. package/scripts/donnees-cles.mjs +244 -0
  127. package/scripts/droits.mjs +51 -16
  128. package/scripts/effets.mjs +352 -0
  129. package/scripts/empreinte-d-etape.mjs +17 -0
  130. package/scripts/engendres.mjs +15 -5
  131. package/scripts/enveloppe/enveloppe.mjs +259 -55
  132. package/scripts/enveloppe/lancer.sh +14 -18
  133. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  134. package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
  135. package/scripts/etapes.mjs +5 -2
  136. package/scripts/faits-du-circuit.mjs +493 -0
  137. package/scripts/file-des-tickets.d.mts +21 -0
  138. package/scripts/file-des-tickets.mjs +58 -0
  139. package/scripts/flux-des-paquets.mjs +201 -0
  140. package/scripts/gardes-du-cadre.mjs +21 -5
  141. package/scripts/init.mjs +11 -4
  142. package/scripts/integration/file.mjs +544 -434
  143. package/scripts/integration/integrer.mjs +87 -43
  144. package/scripts/integration/rejeu.mjs +45 -13
  145. package/scripts/jointure.d.ts +151 -28
  146. package/scripts/langages/cargo/commandes.mjs +383 -124
  147. package/scripts/langages/cargo/composants.mjs +154 -42
  148. package/scripts/langages/cargo/exemples.mjs +12 -21
  149. package/scripts/langages/cargo/index.mjs +22 -8
  150. package/scripts/langages/cargo/sccache.mjs +8 -14
  151. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  152. package/scripts/langages/python/commandes.mjs +218 -100
  153. package/scripts/langages/python/composants.mjs +53 -21
  154. package/scripts/langages/python/exemples.mjs +6 -16
  155. package/scripts/langages/python/index.mjs +28 -8
  156. package/scripts/langages/python/lot.mjs +1 -36
  157. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  158. package/scripts/langages/typescript/composants.mjs +9 -3
  159. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  160. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  161. package/scripts/langages/typescript/construire.mjs +6 -163
  162. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  163. package/scripts/langages/typescript/exemples.mjs +3 -11
  164. package/scripts/langages/typescript/frontieres.mjs +66 -22
  165. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  166. package/scripts/langages/typescript/index.mjs +50 -61
  167. package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
  168. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  169. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  170. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  171. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  172. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  173. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
  174. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  175. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  176. package/scripts/langages/typescript/parcours.mjs +12 -4
  177. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  178. package/scripts/langages/typescript/resumes.mjs +9 -3
  179. package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
  180. package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
  181. package/scripts/langages/typescript/tests.mjs +40 -15
  182. package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
  183. package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
  184. package/scripts/langages/typescript/verdict.mjs +4 -2
  185. package/scripts/langages/typescript/verifier.mjs +58 -20
  186. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  187. package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
  188. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  189. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  190. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  191. package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
  192. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  193. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
  194. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
  195. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  196. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
  197. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  198. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  199. package/scripts/lint-des-scripts.mjs +58 -0
  200. package/scripts/mesure/base-de-passe.mjs +117 -25
  201. package/scripts/mesure/pression.mjs +12 -6
  202. package/scripts/mesure-de-la-machine.d.mts +21 -0
  203. package/scripts/mesure-de-la-machine.mjs +76 -0
  204. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  205. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  206. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  207. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
  208. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  209. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  210. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
  211. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  212. package/scripts/migrations.mjs +5 -0
  213. package/scripts/nuit.sh +25 -3
  214. package/scripts/outil.mjs +3 -1
  215. package/scripts/outils-cles.d.mts +24 -0
  216. package/scripts/outils-cles.mjs +18 -8
  217. package/scripts/paquet-npm.mjs +157 -0
  218. package/scripts/paquet.mjs +73 -4
  219. package/scripts/paquets.mjs +46 -10
  220. package/scripts/passe-de-la-machine.mjs +71 -0
  221. package/scripts/places-de-la-machine.mjs +414 -0
  222. package/scripts/places-du-serveur.mjs +170 -0
  223. package/scripts/prefixe-des-tickets.mjs +68 -0
  224. package/scripts/preparation.mjs +25 -8
  225. package/scripts/registre.mjs +9 -4
  226. package/scripts/regles-des-places.d.mts +36 -0
  227. package/scripts/regles-des-places.mjs +70 -0
  228. package/scripts/reponses-du-circuit.d.mts +6 -0
  229. package/scripts/reponses-du-circuit.mjs +28 -0
  230. package/scripts/reprise.mjs +66 -0
  231. package/scripts/resultats.mjs +112 -46
  232. package/scripts/retirer-les-copies-finies.mjs +25 -0
  233. package/scripts/sans-reponse.d.mts +4 -0
  234. package/scripts/sans-reponse.mjs +13 -0
  235. package/scripts/seances.mjs +936 -0
  236. package/scripts/services-du-noyau.mjs +27 -8
  237. package/scripts/session-start.sh +2 -2
  238. package/scripts/sortie.mjs +3 -3
  239. package/scripts/sous-commandes.mjs +41 -10
  240. package/scripts/style-a-l-ecriture.mjs +260 -0
  241. package/scripts/superviseur.mjs +122 -111
  242. package/scripts/tableau.mjs +180 -117
  243. package/scripts/taches-du-graphe.mjs +348 -0
  244. package/scripts/ticket-du-circuit.mjs +216 -0
  245. package/scripts/transitions.d.mts +148 -0
  246. package/scripts/transitions.mjs +1018 -0
  247. package/scripts/verrou-de-fichier.mjs +8 -4
  248. package/scripts/verrou-de-machine.mjs +150 -51
  249. package/scripts/verrous/commande.mjs +50 -17
  250. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  251. package/scripts/verrous/verrou.mjs +42 -14
  252. package/skills/explorateur/SKILL.md +9 -2
  253. package/skills/grill/SKILL.md +1 -1
  254. package/skills/mesure/SKILL.md +3 -0
  255. package/skills/pitmaster/SKILL.md +17 -18
  256. package/skills/pitmaster/references/consigne-agent.md +5 -1
  257. package/skills/release/SKILL.md +3 -3
  258. package/skills/relecteur/SKILL.md +5 -3
  259. package/skills/testwriter/SKILL.md +49 -31
  260. package/scripts/demon.mjs +0 -251
  261. package/scripts/integration/file-attente.mjs +0 -61
  262. package/scripts/langages/cargo/touches.mjs +0 -93
  263. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
package/scripts/bilan.mjs CHANGED
@@ -26,7 +26,8 @@
26
26
  // conformed, `conforme`, its verdicts by kind, `verdicts`; its sessions, the launches of object
27
27
  // `tri`), each end of a run on
28
28
  // a stop (`montee`: its code, its stop and the supervisor's session that ran it, `superviseur`);
29
- // the circuit's state, `.claude/worktrees/<ticket>.circuit.json`, for where the circuit ended;
29
+ // where the circuit ended (`{ etape, raison, code }`), which the end of the circuit gives its
30
+ // bilan (the effect `bilan`, scripts/effets.mjs) and the command reads from the Temporal server;
30
31
  // the night the project declares in its package.json (`grillhouse.plageDeNuit`); the transcript
31
32
  // of each supervisor's session a stop names (`~/.claude/projects/<projet>/<séance>.jsonl`), of
32
33
  // which the origin and the time of each message, as ccusage measures from the transcripts. It
@@ -161,11 +162,15 @@ function nuits([d, f], nuit) {
161
162
  const a = new Date(jour);
162
163
  a.setHours(nuit.debut);
163
164
  const b = new Date(jour);
164
- if (nuit.fin < nuit.debut) b.setDate(b.getDate() + 1);
165
+ if (nuit.fin < nuit.debut) {
166
+ b.setDate(b.getDate() + 1);
167
+ }
165
168
  b.setHours(nuit.fin);
166
169
  const x = Math.max(a.getTime(), d);
167
170
  const y = Math.min(b.getTime(), f);
168
- if (y > x) out.push([x, y]);
171
+ if (y > x) {
172
+ out.push([x, y]);
173
+ }
169
174
  jour.setDate(jour.getDate() + 1);
170
175
  }
171
176
  return out;
@@ -200,7 +205,9 @@ function longueur(l) {
200
205
  let total = 0;
201
206
  let fin = -Infinity;
202
207
  for (const [d, f] of [...l].sort((x, y) => x[0] - y[0])) {
203
- if (f <= fin) continue;
208
+ if (f <= fin) {
209
+ continue;
210
+ }
204
211
  total += f - Math.max(d, fin);
205
212
  fin = f;
206
213
  }
@@ -231,9 +238,13 @@ export function bilan({
231
238
  const derniere = new Map();
232
239
  for (const x of lignes) {
233
240
  const l = { ...x, role: roleDeLAgent(x.role) };
234
- if (l.ticket !== ticket || (l.role !== CIRCUIT && !ROLES.has(l.role))) continue;
241
+ if (l.ticket !== ticket || (l.role !== CIRCUIT && !ROLES.has(l.role))) {
242
+ continue;
243
+ }
235
244
  const avant = derniere.get(l.agent);
236
- if (!avant || Date.parse(l.fin) > Date.parse(avant.fin)) derniere.set(l.agent, l);
245
+ if (!avant || Date.parse(l.fin) > Date.parse(avant.fin)) {
246
+ derniere.set(l.agent, l);
247
+ }
237
248
  }
238
249
  const hors = [...derniere.values()].filter(l => l.role !== CIRCUIT && !lancees.has(l.agent));
239
250
  const agents = [...derniere.values()].filter(l => !hors.includes(l));
@@ -280,13 +291,17 @@ export function bilan({
280
291
  }
281
292
  const etapes = segments.filter(s => s.role === CIRCUIT);
282
293
  const preuves = etapes.filter(s => s.etape === 'preuve');
283
- for (const p of preuves) p.preuve = p.entree?.resultat ?? null;
294
+ for (const p of preuves) {
295
+ p.preuve = p.entree?.resultat ?? null;
296
+ }
284
297
  // A proof and the category it gives the testwriter before it: the lot unchanged since the proof
285
298
  // before, or none.
286
299
  const avantLa = p => preuves.findLast(x => x.f <= p.d);
287
300
  const parLaPreuve = p => {
288
301
  const avant = avantLa(p);
289
- if (!p.preuve) return null;
302
+ if (!p.preuve) {
303
+ return null;
304
+ }
290
305
  if (avant?.preuve && signature(avant.preuve) === signature(p.preuve)) {
291
306
  return avant.preuve.ok ? 'rejeu' : 'sansEffet';
292
307
  }
@@ -300,13 +315,16 @@ export function bilan({
300
315
 
301
316
  // The sessions first: the checks read what they delivered.
302
317
  for (const s of segments.filter(x => x.role !== CIRCUIT)) {
303
- if (s.role === QUESTIONNEUR) s.categorie = 'questionnement';
304
- else if (s.role === 'developpeur') {
318
+ if (s.role === QUESTIONNEUR) {
319
+ s.categorie = 'questionnement';
320
+ } else if (s.role === 'developpeur') {
305
321
  s.categorie = inchangee(s) ? 'sansEffet' : 'travail';
306
322
  } else if (s.role === 'testwriter') {
307
323
  const p = preuves.find(x => x.d >= s.f - JEU);
308
324
  s.categorie = p ? (parLaPreuve(p) ?? (p.preuve?.vide ? 'sansEffet' : 'travail')) : 'travail';
309
- } else s.categorie = 'travail';
325
+ } else {
326
+ s.categorie = 'travail';
327
+ }
310
328
  }
311
329
  // A session that changed the lot: the testwriter's or the developpeur's, that delivered.
312
330
  const livre = s => AGENTS_DU_LOT.includes(s.role) && s.categorie === 'travail';
@@ -331,7 +349,9 @@ export function bilan({
331
349
  : i === 'vert'
332
350
  ? 'rejeu'
333
351
  : 'sansEffet';
334
- } else s.categorie = 'automatique';
352
+ } else {
353
+ s.categorie = 'automatique';
354
+ }
335
355
  }
336
356
 
337
357
  // The waits: from each end of a run on a stop to the answer, the run after; the owner's when he
@@ -343,7 +363,9 @@ export function bilan({
343
363
  const f = Math.min(tour, suivant, fin);
344
364
  const ecrit = duResponsable.some(t => t > e.t && t <= f);
345
365
  const qui = ecrit ? RESPONSABLE : SUPERVISEUR;
346
- if (f > e.t) lesAttentes.push({ i: [e.t, f], qui, nuit: nuits([e.t, f], nuit) });
366
+ if (f > e.t) {
367
+ lesAttentes.push({ i: [e.t, f], qui, nuit: nuits([e.t, f], nuit) });
368
+ }
347
369
  }
348
370
  const attentes = lesAttentes.map(a => a.i);
349
371
 
@@ -359,7 +381,9 @@ export function bilan({
359
381
  const fenetre = s => [Math.max(s.d, debut), Math.min(s.f, fin)];
360
382
  for (const s of segments) {
361
383
  const [d, f] = fenetre(s);
362
- if (f <= d) continue;
384
+ if (f <= d) {
385
+ continue;
386
+ }
363
387
  const ms = f - d - commun([d, f], attentes);
364
388
  const c = categories[s.categorie];
365
389
  c.ms += ms;
@@ -388,7 +412,9 @@ export function bilan({
388
412
  const out = {};
389
413
  for (const role of new Set(SUITE.flatMap(e => e.qui))) {
390
414
  const n = l.filter(x => x.role === role).length;
391
- if (n) out[role] = n;
415
+ if (n) {
416
+ out[role] = n;
417
+ }
392
418
  }
393
419
  return out;
394
420
  };
@@ -399,7 +425,9 @@ export function bilan({
399
425
  parEtape[titre] = (parEtape[titre] ?? 0) + 1;
400
426
  }
401
427
  const arrets = {};
402
- for (const e of duCircuit.filter(x => x.arret)) arrets[e.arret] = (arrets[e.arret] ?? 0) + 1;
428
+ for (const e of duCircuit.filter(x => x.arret)) {
429
+ arrets[e.arret] = (arrets[e.arret] ?? 0) + 1;
430
+ }
403
431
  // The ends of the questionings of the plan: the questions asked, the plans an answer changed, the
404
432
  // questions left open.
405
433
  const fins = duCircuit.map(e => e.questionnement).filter(Boolean);
@@ -421,6 +449,31 @@ export function bilan({
421
449
  verdicts: finDuTri.verdicts ?? {},
422
450
  }
423
451
  : null;
452
+ // The time replayed after a red and the time read back without replaying, apart, by step
453
+ // (« passe-finale » for the checks once final): a step that plays again after a pass of its own
454
+ // that ended red adds its duration to the first; a step the circuit read back (the result
455
+ // `relue`) adds the duration of its last green, which the reading spared, to the second. A
456
+ // ticket without a red replays nothing.
457
+ const nomDeLEtape = (etape, finale) => (etape === 'controles' && finale ? 'passe-finale' : etape);
458
+ const reprise = { rejoue: { ms: 0, parEtape: {} }, relu: { ms: 0, parEtape: {} } };
459
+ const ajouter = (c, nom, ms) => {
460
+ c.ms += ms;
461
+ c.parEtape[nom] = (c.parEtape[nom] ?? 0) + ms;
462
+ };
463
+ for (const s of etapes) {
464
+ const memes = x => x.etape === s.etape && Boolean(x.finale) === Boolean(s.finale);
465
+ const avant = etapes.findLast(x => memes(x) && x.f <= s.d);
466
+ if (!avant?.entree || issue(avant.entree) === 'vert') {
467
+ continue;
468
+ }
469
+ const [d, f] = fenetre(s);
470
+ if (f > d) {
471
+ ajouter(reprise.rejoue, nomDeLEtape(s.etape, s.finale), f - d - commun([d, f], attentes));
472
+ }
473
+ }
474
+ for (const e of duCircuit.filter(x => x.relue)) {
475
+ ajouter(reprise.relu, nomDeLEtape(e.etape, e.finale), e.relue.ms ?? 0);
476
+ }
424
477
  const somme = k => sessions.reduce((m, l) => m + (l[k] ?? 0), 0);
425
478
  const perdu = CATEGORIES.filter(([k]) => !GARDE.has(k)).reduce(
426
479
  (m, [k]) => m + categories[k].ms,
@@ -437,6 +490,7 @@ export function bilan({
437
490
  perdu,
438
491
  perduHorsAttentes: perdu - ATTENTES.reduce((m, k) => m + categories[k].ms, 0),
439
492
  categories,
493
+ reprise,
440
494
  seances: {
441
495
  total: sessions.length,
442
496
  parRole: parRoleDe(sessions),
@@ -458,8 +512,12 @@ export function bilan({
458
512
 
459
513
  // Where the circuit of the state <etat> ended, in words.
460
514
  function statutDe(etat) {
461
- if (etat?.etape === 'integre') return 'intégré';
462
- if (etat?.raison) return `arrêt ${etat.raison}${etat.code != null ? ` (${etat.code})` : ''}`;
515
+ if (etat?.etape === 'integre') {
516
+ return 'intégré';
517
+ }
518
+ if (etat?.raison) {
519
+ return `arrêt ${etat.raison}${etat.code !== null && etat.code !== undefined ? ` (${etat.code})` : ''}`;
520
+ }
463
521
  return 'en cours';
464
522
  }
465
523
 
@@ -518,7 +576,12 @@ export function texteDuBilan(b, avant) {
518
576
  const base = avant
519
577
  ? `Face au bilan de ${avant.ticket}, recalculé : mur ${minutes(avant.mur)} → ${minutes(b.mur)} min, perte ${pourcent(avant.perdu, avant.mur)} → ${pourcent(b.perdu, b.mur)} %, séances ${avant.seances.total} → ${b.seances.total}, coût ${dollars(avant.cout)} → ${dollars(b.cout)} $.`
520
578
  : "Aucun bilan d'avant dans ce projet : pas de base.";
521
- return [tete, ...lignes, ...tri, `Arrêts : ${arrets || 'aucun'}.`, base].join('\n');
579
+ const parEtape = c =>
580
+ Object.entries(c.parEtape)
581
+ .map(([nom, ms]) => `${nom} ${minutes(ms)} min`)
582
+ .join(', ');
583
+ const reprise = `Reprise après un rouge : ${minutes(b.reprise.rejoue.ms)} min rejouées${b.reprise.rejoue.ms ? ` (${parEtape(b.reprise.rejoue)})` : ''}, ${minutes(b.reprise.relu.ms)} min relues sans rejouer${b.reprise.relu.ms ? ` (${parEtape(b.reprise.relu)})` : ''}.`;
584
+ return [tete, ...lignes, ...tri, reprise, `Arrêts : ${arrets || 'aucun'}.`, base].join('\n');
522
585
  }
523
586
 
524
587
  const dossier = racine => path.join(racine, '.claude', 'worktrees');
@@ -536,11 +599,15 @@ export function garder(racine, b) {
536
599
  export function bilansGardes(racine) {
537
600
  const d = dossier(racine);
538
601
  const out = {};
539
- if (!existsSync(d)) return out;
602
+ if (!existsSync(d)) {
603
+ return out;
604
+ }
540
605
  for (const n of readdirSync(d).filter(x => x.endsWith(SUFFIXE))) {
541
606
  try {
542
607
  const b = JSON.parse(readFileSync(path.join(d, n), 'utf8'));
543
- if (b?.ticket) out[b.ticket] = b;
608
+ if (b?.ticket) {
609
+ out[b.ticket] = b;
610
+ }
544
611
  } catch {
545
612
  // A torn bilan counts nothing.
546
613
  }
@@ -557,7 +624,9 @@ export function precedent(racine, ticket) {
557
624
  const avant = Object.values(bilansGardes(racine))
558
625
  .filter(b => b.ticket !== ticket)
559
626
  .sort((x, y) => Date.parse(y.calcule ?? 0) - Date.parse(x.calcule ?? 0))[0];
560
- if (!avant) return null;
627
+ if (!avant) {
628
+ return null;
629
+ }
561
630
  const b = calculer(racine, avant.ticket, { responsable: false });
562
631
  return b.mur > 0 ? b : null;
563
632
  }
@@ -582,11 +651,15 @@ export function messagesDuResponsable(texte) {
582
651
  const out = [];
583
652
  for (const l of texte.split('\n')) {
584
653
  // Only a line that names the person can be his message: the others are not parsed.
585
- if (!l.includes('"human"')) continue;
654
+ if (!l.includes('"human"')) {
655
+ continue;
656
+ }
586
657
  try {
587
658
  const e = JSON.parse(l);
588
659
  const t = Date.parse(e.timestamp ?? '');
589
- if (e.type === 'user' && e.origin?.kind === 'human' && !Number.isNaN(t)) out.push(t);
660
+ if (e.type === 'user' && e.origin?.kind === 'human' && !Number.isNaN(t)) {
661
+ out.push(t);
662
+ }
590
663
  } catch {
591
664
  // A torn line holds no message.
592
665
  }
@@ -607,7 +680,9 @@ function messagesDeLaSeance(seance) {
607
680
  .map(d => path.join(projets, d, `${seance}.jsonl`))
608
681
  .find(g => existsSync(g))
609
682
  : null;
610
- if (!f) return [];
683
+ if (!f) {
684
+ return [];
685
+ }
611
686
  const out = [];
612
687
  const decodeur = new StringDecoder('utf8');
613
688
  const tampon = Buffer.alloc(MORCEAU);
@@ -628,9 +703,9 @@ function messagesDeLaSeance(seance) {
628
703
  }
629
704
 
630
705
  // The bilan of <ticket> computed from the main tree <racine>: its register, the results its
631
- // circuit kept, its circuit's state, and the owner's messages in the supervisor's sessions its
632
- // stops name unless <responsable> is false.
633
- function calculer(racine, ticket, { responsable = true } = {}) {
706
+ // circuit kept, where its circuit ended (<fin>, `{ etape, raison, code }`, null while it runs), and
707
+ // the owner's messages in the supervisor's sessions its stops name unless <responsable> is false.
708
+ function calculer(racine, ticket, fin, { responsable = true } = {}) {
634
709
  const registre =
635
710
  process.env.GRILLHOUSE_REGISTRE ??
636
711
  path.join(os.homedir(), '.claude', 'grillhouse', 'registre.jsonl');
@@ -645,33 +720,48 @@ function calculer(racine, ticket, { responsable = true } = {}) {
645
720
  return [];
646
721
  }
647
722
  });
648
- const f = path.join(dossier(racine), `${ticket}.circuit.json`);
649
- let etat = null;
650
- try {
651
- etat = existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')) : null;
652
- } catch {
653
- etat = null;
654
- }
655
723
  const seances = new Set(entrees.map(e => e.montee?.superviseur).filter(Boolean));
656
724
  return bilan({
657
725
  ticket,
658
726
  lignes,
659
727
  entrees,
660
- etat,
728
+ etat: fin,
661
729
  nuit: plageDeNuit(racine),
662
730
  duResponsable: responsable ? [...seances].flatMap(s => messagesDeLaSeance(String(s))) : [],
663
731
  });
664
732
  }
665
733
 
666
- // The bilan of <ticket> computed, kept in the main tree <racine>, and its text, compared with the
667
- // bilan before it: what the circuit writes at the ticket.
668
- export function ecrireLeBilan(racine, ticket) {
669
- const b = calculer(racine, ticket);
734
+ // The bilan of <ticket> computed, where its circuit ended <fin> (`calculer`), kept in the main tree
735
+ // <racine>, and its text, compared with the bilan before it: what the circuit writes at the ticket.
736
+ export function ecrireLeBilan(racine, ticket, fin) {
737
+ const b = calculer(racine, ticket, fin);
670
738
  const avant = precedent(racine, ticket);
671
739
  garder(racine, b);
672
740
  return texteDuBilan(b, avant);
673
741
  }
674
742
 
743
+ // Where the circuit of <ticket> in the repository at <racine> ended, as its workflow's memo on the
744
+ // Temporal server gives it (the summary of its last state, src/temporal/circuit/deroule.ts); null
745
+ // while it runs on its own (no question awaited), or when the server does not give it within 5 s.
746
+ async function finSurLeServeur(racine, ticket) {
747
+ const { lireLeDeroule, ouvrirLeClient } = await import('../dist/temporal/client.js');
748
+ const { idDuCircuit } = await import('../dist/temporal/circuit/contrat.js');
749
+ const c = ouvrirLeClient();
750
+ try {
751
+ const d = await c.client.connection.withDeadline(Date.now() + 5_000, () =>
752
+ lireLeDeroule(c.client, idDuCircuit(racine, ticket))
753
+ );
754
+ const e = d.memo?.etat;
755
+ return !e || (d.statut === 'RUNNING' && !d.memo?.question)
756
+ ? null
757
+ : { etape: e.etape ?? null, raison: e.raison ?? null, code: e.code ?? null };
758
+ } catch {
759
+ return null;
760
+ } finally {
761
+ await c.fermer();
762
+ }
763
+ }
764
+
675
765
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
676
766
  const [ticket, ...options] = process.argv.slice(2);
677
767
  if (!ticket || ticket.startsWith('-')) {
@@ -682,8 +772,12 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
682
772
  encoding: 'utf8',
683
773
  });
684
774
  const racine = commun.status === 0 ? path.dirname(commun.stdout.trim()) : process.cwd();
685
- const b = calculer(racine, ticket);
686
- process.stdout.write(`${texteDuBilan(b, precedent(racine, ticket))}\n`);
687
- if (options.includes('--garder')) garder(racine, b);
775
+ void finSurLeServeur(racine, ticket).then(fin => {
776
+ const b = calculer(racine, ticket, fin);
777
+ process.stdout.write(`${texteDuBilan(b, precedent(racine, ticket))}\n`);
778
+ if (options.includes('--garder')) {
779
+ garder(racine, b);
780
+ }
781
+ });
688
782
  }
689
783
  }
package/scripts/cadre.mjs CHANGED
@@ -41,9 +41,18 @@ export const FICHIERS_DU_CADRE = ['templates'];
41
41
 
42
42
  /**
43
43
  * The entries the package publishes of its own; `docs/` holds the architecture the charter names,
44
- * `tsdoc-base.json` the TSDoc base a project's tsdoc.json extends.
44
+ * `dist/` the build of src/ (the account's Temporal, src/temporal/), `tsdoc-base.json` the TSDoc
45
+ * base a project's tsdoc.json extends.
45
46
  */
46
- export const PROPRES_DU_PAQUET = ['bin', 'cadre', 'docs', 'scripts', 'tsdoc-base.json'];
47
+ export const PROPRES_DU_PAQUET = [
48
+ 'CHANGELOG.md',
49
+ 'bin',
50
+ 'cadre',
51
+ 'dist',
52
+ 'docs',
53
+ 'scripts',
54
+ 'tsdoc-base.json',
55
+ ];
47
56
 
48
57
  /** The entries of the plugin's source the package leaves out. */
49
58
  export const HORS_DU_GREFFON = ['tests', 'tsconfig.json'];
@@ -87,15 +96,18 @@ function empaqueter() {
87
96
  );
88
97
  for (const f of FICHIERS_DU_CADRE) {
89
98
  const source = path.join(DEPOT, f);
90
- if (!existsSync(source)) throw new Error(`${f} manque au dépôt du cadre (${DEPOT})`);
99
+ if (!existsSync(source)) {
100
+ throw new Error(`${f} manque au dépôt du cadre (${DEPOT})`);
101
+ }
91
102
  cpSync(source, path.join(COPIE, f), { recursive: true });
92
103
  }
93
104
  }
94
105
 
95
106
  // Removes the copies of the plugin and cadre/.
96
107
  function nettoyer() {
97
- for (const e of ELEMENTS_DU_GREFFON)
108
+ for (const e of ELEMENTS_DU_GREFFON) {
98
109
  rmSync(path.join(PAQUET, e), { recursive: true, force: true });
110
+ }
99
111
  rmSync(COPIE, { recursive: true, force: true });
100
112
  }
101
113