@roomi-fields/grillhouse 0.29.0 → 0.30.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 (222) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +79 -18
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +24 -0
  9. package/dist/temporal/acte.d.ts +24 -0
  10. package/dist/temporal/acte.js +139 -0
  11. package/dist/temporal/acte.js.map +1 -0
  12. package/dist/temporal/attributs.d.ts +6 -0
  13. package/dist/temporal/attributs.js +15 -0
  14. package/dist/temporal/attributs.js.map +1 -0
  15. package/dist/temporal/circuit/activites.d.ts +13 -0
  16. package/dist/temporal/circuit/activites.js +33 -0
  17. package/dist/temporal/circuit/activites.js.map +1 -0
  18. package/dist/temporal/circuit/client.d.ts +72 -0
  19. package/dist/temporal/circuit/client.js +247 -0
  20. package/dist/temporal/circuit/client.js.map +1 -0
  21. package/dist/temporal/circuit/commande.d.ts +2 -0
  22. package/dist/temporal/circuit/commande.js +238 -0
  23. package/dist/temporal/circuit/commande.js.map +1 -0
  24. package/dist/temporal/circuit/contrat.d.ts +305 -0
  25. package/dist/temporal/circuit/contrat.js +24 -0
  26. package/dist/temporal/circuit/contrat.js.map +1 -0
  27. package/dist/temporal/circuit/deroule.d.ts +3 -0
  28. package/dist/temporal/circuit/deroule.js +540 -0
  29. package/dist/temporal/circuit/deroule.js.map +1 -0
  30. package/dist/temporal/client.d.ts +47 -0
  31. package/dist/temporal/client.js +69 -0
  32. package/dist/temporal/client.js.map +1 -0
  33. package/dist/temporal/commande.d.ts +2 -0
  34. package/dist/temporal/commande.js +95 -0
  35. package/dist/temporal/commande.js.map +1 -0
  36. package/dist/temporal/deroules.d.ts +5 -0
  37. package/dist/temporal/deroules.js +10 -0
  38. package/dist/temporal/deroules.js.map +1 -0
  39. package/dist/temporal/etat.d.ts +33 -0
  40. package/dist/temporal/etat.js +59 -0
  41. package/dist/temporal/etat.js.map +1 -0
  42. package/dist/temporal/file/activites.d.ts +10 -0
  43. package/dist/temporal/file/activites.js +25 -0
  44. package/dist/temporal/file/activites.js.map +1 -0
  45. package/dist/temporal/file/client.d.ts +4 -0
  46. package/dist/temporal/file/client.js +6 -0
  47. package/dist/temporal/file/client.js.map +1 -0
  48. package/dist/temporal/file/contrat.d.ts +158 -0
  49. package/dist/temporal/file/contrat.js +14 -0
  50. package/dist/temporal/file/contrat.js.map +1 -0
  51. package/dist/temporal/file/deroule.d.ts +15 -0
  52. package/dist/temporal/file/deroule.js +235 -0
  53. package/dist/temporal/file/deroule.js.map +1 -0
  54. package/dist/temporal/installation.d.ts +124 -0
  55. package/dist/temporal/installation.js +408 -0
  56. package/dist/temporal/installation.js.map +1 -0
  57. package/dist/temporal/places/activites.d.ts +8 -0
  58. package/dist/temporal/places/activites.js +13 -0
  59. package/dist/temporal/places/activites.js.map +1 -0
  60. package/dist/temporal/places/client.d.ts +28 -0
  61. package/dist/temporal/places/client.js +64 -0
  62. package/dist/temporal/places/client.js.map +1 -0
  63. package/dist/temporal/places/contrat.d.ts +106 -0
  64. package/dist/temporal/places/contrat.js +21 -0
  65. package/dist/temporal/places/contrat.js.map +1 -0
  66. package/dist/temporal/places/deroule.d.ts +3 -0
  67. package/dist/temporal/places/deroule.js +198 -0
  68. package/dist/temporal/places/deroule.js.map +1 -0
  69. package/dist/temporal/sonde/activites.d.ts +6 -0
  70. package/dist/temporal/sonde/activites.js +52 -0
  71. package/dist/temporal/sonde/activites.js.map +1 -0
  72. package/dist/temporal/sonde/contrat.d.ts +35 -0
  73. package/dist/temporal/sonde/contrat.js +10 -0
  74. package/dist/temporal/sonde/contrat.js.map +1 -0
  75. package/dist/temporal/sonde/deroule.d.ts +3 -0
  76. package/dist/temporal/sonde/deroule.js +39 -0
  77. package/dist/temporal/sonde/deroule.js.map +1 -0
  78. package/dist/temporal/tickets/activites.d.ts +7 -0
  79. package/dist/temporal/tickets/activites.js +81 -0
  80. package/dist/temporal/tickets/activites.js.map +1 -0
  81. package/dist/temporal/tickets/client.d.ts +10 -0
  82. package/dist/temporal/tickets/client.js +31 -0
  83. package/dist/temporal/tickets/client.js.map +1 -0
  84. package/dist/temporal/tickets/contrat.d.ts +56 -0
  85. package/dist/temporal/tickets/contrat.js +13 -0
  86. package/dist/temporal/tickets/contrat.js.map +1 -0
  87. package/dist/temporal/tickets/deroule.d.ts +3 -0
  88. package/dist/temporal/tickets/deroule.js +94 -0
  89. package/dist/temporal/tickets/deroule.js.map +1 -0
  90. package/dist/temporal/travailleur.d.ts +2 -0
  91. package/dist/temporal/travailleur.js +69 -0
  92. package/dist/temporal/travailleur.js.map +1 -0
  93. package/docs/ARCHITECTURE.md +609 -80
  94. package/docs/CADRE.md +17 -0
  95. package/docs/INTERFACE.md +134 -42
  96. package/hooks/crochet.mjs +19 -2
  97. package/hooks/hooks.json +11 -0
  98. package/package.json +16 -4
  99. package/scripts/activites.mjs +2182 -0
  100. package/scripts/aiguillage.d.mts +37 -0
  101. package/scripts/aiguillage.mjs +7 -3
  102. package/scripts/avancement.mjs +128 -16
  103. package/scripts/bilan.mjs +37 -19
  104. package/scripts/cadre.mjs +11 -2
  105. package/scripts/circuit.mjs +881 -4059
  106. package/scripts/circuits-cles.d.mts +4 -0
  107. package/scripts/circuits-cles.mjs +21 -0
  108. package/scripts/circuits-du-serveur.mjs +105 -0
  109. package/scripts/codes-de-sortie.mjs +9 -0
  110. package/scripts/commandes-composees.mjs +45 -41
  111. package/scripts/commandes-du-path.d.mts +7 -0
  112. package/scripts/commandes-du-path.mjs +25 -0
  113. package/scripts/composition-des-langages.mjs +16 -12
  114. package/scripts/conformite.mjs +6 -13
  115. package/scripts/copies-finies.mjs +52 -47
  116. package/scripts/depart-du-ticket.d.mts +53 -0
  117. package/scripts/depart-du-ticket.mjs +124 -0
  118. package/scripts/dependances-internes.mjs +115 -0
  119. package/scripts/dernier-vert.mjs +7 -15
  120. package/scripts/donnees-cles.mjs +228 -0
  121. package/scripts/droits.mjs +11 -1
  122. package/scripts/effets.mjs +352 -0
  123. package/scripts/enveloppe/enveloppe.mjs +119 -8
  124. package/scripts/enveloppe/lancer.sh +14 -18
  125. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  126. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -1
  127. package/scripts/etapes.mjs +5 -2
  128. package/scripts/faits-du-circuit.mjs +493 -0
  129. package/scripts/file-des-tickets.d.mts +21 -0
  130. package/scripts/file-des-tickets.mjs +58 -0
  131. package/scripts/flux-des-paquets.mjs +187 -0
  132. package/scripts/gardes-du-cadre.mjs +12 -2
  133. package/scripts/integration/file.mjs +475 -420
  134. package/scripts/integration/integrer.mjs +17 -19
  135. package/scripts/integration/rejeu.mjs +19 -4
  136. package/scripts/jointure.d.ts +145 -27
  137. package/scripts/langages/cargo/commandes.mjs +289 -109
  138. package/scripts/langages/cargo/composants.mjs +130 -34
  139. package/scripts/langages/cargo/exemples.mjs +12 -21
  140. package/scripts/langages/cargo/index.mjs +18 -8
  141. package/scripts/langages/cargo/sccache.mjs +8 -14
  142. package/scripts/langages/python/commandes.mjs +216 -100
  143. package/scripts/langages/python/composants.mjs +53 -21
  144. package/scripts/langages/python/exemples.mjs +6 -16
  145. package/scripts/langages/python/index.mjs +24 -8
  146. package/scripts/langages/python/lot.mjs +1 -36
  147. package/scripts/langages/typescript/construire.mjs +6 -163
  148. package/scripts/langages/typescript/exemples.mjs +3 -11
  149. package/scripts/langages/typescript/frontieres.mjs +1 -1
  150. package/scripts/langages/typescript/index.mjs +43 -61
  151. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  152. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  153. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  154. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  155. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  156. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  157. package/scripts/langages/typescript/tests-de-nuit.mjs +12 -9
  158. package/scripts/langages/typescript/tests.mjs +17 -8
  159. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  160. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  161. package/scripts/langages/typescript/verdict.mjs +1 -1
  162. package/scripts/langages/typescript/verifier.mjs +31 -11
  163. package/scripts/langages/typescript/vitest-config/base.mjs +22 -1
  164. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  165. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  166. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  167. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  168. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  169. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +49 -63
  170. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +3 -0
  171. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  172. package/scripts/mesure/pression.mjs +3 -3
  173. package/scripts/mesure-de-la-machine.d.mts +21 -0
  174. package/scripts/mesure-de-la-machine.mjs +76 -0
  175. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  176. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  177. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  178. package/scripts/migrations.mjs +5 -0
  179. package/scripts/nuit.sh +10 -3
  180. package/scripts/outils-cles.d.mts +24 -0
  181. package/scripts/outils-cles.mjs +0 -1
  182. package/scripts/paquet-npm.mjs +147 -0
  183. package/scripts/paquet.mjs +73 -4
  184. package/scripts/paquets.mjs +34 -6
  185. package/scripts/passe-de-la-machine.mjs +66 -0
  186. package/scripts/places-de-la-machine.mjs +360 -0
  187. package/scripts/places-du-serveur.mjs +170 -0
  188. package/scripts/prefixe-des-tickets.mjs +68 -0
  189. package/scripts/preparation.mjs +10 -3
  190. package/scripts/registre.mjs +3 -2
  191. package/scripts/regles-des-places.d.mts +36 -0
  192. package/scripts/regles-des-places.mjs +70 -0
  193. package/scripts/reponses-du-circuit.d.mts +6 -0
  194. package/scripts/reponses-du-circuit.mjs +28 -0
  195. package/scripts/resultats.mjs +7 -9
  196. package/scripts/retirer-les-copies-finies.mjs +25 -0
  197. package/scripts/sans-reponse.d.mts +4 -0
  198. package/scripts/sans-reponse.mjs +13 -0
  199. package/scripts/seances.mjs +918 -0
  200. package/scripts/services-du-noyau.mjs +26 -8
  201. package/scripts/session-start.sh +2 -2
  202. package/scripts/sortie.mjs +3 -3
  203. package/scripts/sous-commandes.mjs +38 -9
  204. package/scripts/style-a-l-ecriture.mjs +229 -0
  205. package/scripts/superviseur.mjs +122 -111
  206. package/scripts/tableau.mjs +148 -110
  207. package/scripts/taches-du-graphe.mjs +328 -0
  208. package/scripts/ticket-du-circuit.mjs +206 -0
  209. package/scripts/transitions.d.mts +148 -0
  210. package/scripts/transitions.mjs +901 -0
  211. package/scripts/verrou-de-fichier.mjs +2 -2
  212. package/scripts/verrou-de-machine.mjs +28 -13
  213. package/skills/explorateur/SKILL.md +2 -1
  214. package/skills/pitmaster/SKILL.md +17 -18
  215. package/skills/pitmaster/references/consigne-agent.md +5 -1
  216. package/skills/release/SKILL.md +3 -3
  217. package/skills/relecteur/SKILL.md +4 -2
  218. package/skills/testwriter/SKILL.md +36 -24
  219. package/scripts/demon.mjs +0 -251
  220. package/scripts/integration/file-attente.mjs +0 -61
  221. package/scripts/langages/cargo/touches.mjs +0 -93
  222. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -0,0 +1,37 @@
1
+ // The types of ./aiguillage.mjs, for the frame's TypeScript (src/temporal/installation.ts) and its
2
+ // tests.
3
+
4
+ /** The key of the project's package.json that names its version of the frame. */
5
+ export const CLE: string;
6
+ /** The name of the frame's package. */
7
+ export const NOM_DU_PAQUET: string;
8
+ /** A version x.y.z. */
9
+ export const X_Y_Z: RegExp;
10
+ /** The subcommands of the orchestration, which the published version runs. */
11
+ export const REDIRIGEES: Set<string>;
12
+ /** The subcommands of the code that runs, the ticket's copy for a session of the circuit. */
13
+ export const DU_CODE_EN_COURS: Set<string>;
14
+ /** The tools of the repository. */
15
+ export const OUTILS_DU_DEPOT: Set<string>;
16
+
17
+ /** The cache of the versions installed under the home <maison>, ~/.cache/grillhouse/outil by default. */
18
+ export function cacheDesOutils(maison?: string): string;
19
+ /** The folder of the version <version> under <cache>. */
20
+ export function dossierDeLOutil(version: string, cache?: string): string;
21
+ /** The version the project at <racine> names, or null; throws on a value that is no version. */
22
+ export function versionDeLOutil(racine?: string): string | null;
23
+ /** Where the subcommand <nom> runs in the project at <racine>, or null for the code that runs. */
24
+ export function aiguillage(
25
+ nom: string,
26
+ options?: { racine?: string; cache?: string; paquet?: string }
27
+ ): { version: string; dossier: string; commande: string } | null;
28
+ /** The failed installation of the version the project at <racine> names, or null. */
29
+ export function echecDeLOutil(
30
+ racine?: string,
31
+ options?: { cache?: string }
32
+ ): { version: string; raison: string; date: string } | null;
33
+ /** Installs the published version <version> under <cache>: its folder, and whether it laid it down. */
34
+ export function installer(
35
+ version: string,
36
+ options?: { cache?: string; npm?: string; retenue?: number }
37
+ ): { dossier: string; installe: boolean };
@@ -54,7 +54,7 @@ const PAQUET_QUI_TOURNE = path.resolve(import.meta.dirname, '..');
54
54
  /**
55
55
  * The subcommands of the orchestration, which the published version runs: the circuit, the
56
56
  * supervisor, the night, the board and the status line, the hooks of Claude Code, the locks and
57
- * the rights of the sessions, the envelope and its launcher, the integration and the queue, the
57
+ * the rights of the sessions, the envelope and its launcher, the integration, the
58
58
  * results, the removal of a copy and the balance, even when the supervisor runs one by hand.
59
59
  */
60
60
  export const REDIRIGEES = new Set([
@@ -63,7 +63,6 @@ export const REDIRIGEES = new Set([
63
63
  'commande',
64
64
  'droits',
65
65
  'enveloppe',
66
- 'file',
67
66
  'integrer',
68
67
  'lancer',
69
68
  'ligne-etat',
@@ -86,11 +85,14 @@ export const REDIRIGEES = new Set([
86
85
  */
87
86
  export const DU_CODE_EN_COURS = new Set([
88
87
  'composants-affectes',
88
+ 'dependances-internes',
89
+ 'flux-des-paquets',
89
90
  'fusion-du-changelog',
90
91
  'gardes-du-cadre',
91
92
  'hook',
92
93
  'hooks',
93
94
  'langages-des-paquets',
95
+ 'style-a-l-ecriture',
94
96
  'temporaire',
95
97
  'tests',
96
98
  'verifier',
@@ -106,6 +108,7 @@ export const OUTILS_DU_DEPOT = new Set([
106
108
  'pression',
107
109
  'sortie',
108
110
  'sous-modules',
111
+ 'temporal',
109
112
  'ticket',
110
113
  ]);
111
114
 
@@ -113,7 +116,8 @@ export const OUTILS_DU_DEPOT = new Set([
113
116
  const RETENUE_MS = 5 * 60 * 1000;
114
117
 
115
118
  // The cache of the published versions: ~/.cache/grillhouse/outil.
116
- const cacheDesOutils = () => path.join(os.homedir(), '.cache', 'grillhouse', 'outil');
119
+ export const cacheDesOutils = (maison = os.homedir()) =>
120
+ path.join(maison, '.cache', 'grillhouse', 'outil');
117
121
 
118
122
  /** The folder of the version <version> under <cache>. */
119
123
  export const dossierDeLOutil = (version, cache = cacheDesOutils()) => path.join(cache, version);
@@ -4,12 +4,19 @@
4
4
  //
5
5
  // - A pass has its progress directory, which the variable GRILLHOUSE_AVANCEMENT (AVANCEMENT of
6
6
  // scripts/mesure/avancement.mjs) names to its commands: the circuit opens one for each
7
- // automatic pass and names it in its state (scripts/circuit.mjs), `npm run verifier` opens its own when it
8
- // receives none (scripts/langages/typescript/verifier.mjs). The directory holds `passe.json` (`{ genre, debut,
9
- // precedent }`: its kind, its start, the total of the previous pass of that kind), the records
10
- // of its tasks (`taches/`, written by the reporter of progress of the base configuration, one
7
+ // automatic pass in its working directory, `<copie>.travail`, where the board reads it
8
+ // (`avancementDuTravail`), `npm run verifier` opens its own when it receives none
9
+ // (scripts/langages/typescript/verifier.mjs). The directory holds `passe.json` (`{ genre, debut,
10
+ // precedent, totaux }`: its kind, its start, the total of the previous pass of that kind, and
11
+ // the file of the totals where its end keeps its own), the records of its tasks (`taches/`, written by the reporter of progress of the base configuration, one
11
12
  // per run of Vitest, and by the queue for the steps of its CI, scripts/integration/file.mjs),
12
13
  // and the plans of its runs of Turborepo (`plan/`).
14
+ // - The CI of a ticket's commit is read by one act at a time, each a process of its own: its
15
+ // readings share one progress directory in the working directory of the ticket,
16
+ // `avancement-ci` (`avancementDeLaCI`), opened by the first and emptied when a reading looks
17
+ // for a run again (another CI, after a reopening), where the board reads the steps
18
+ // of the run done over planned while the circuit waits for it; the next pass of the circuit
19
+ // removes it with the others (`avecLAvancementDuTravail`).
13
20
  // - The reading adds the records: the files done, and the files planned of the tasks started;
14
21
  // while every task the plans name has not started, the total of the previous pass of the same
15
22
  // kind stands when it is greater (a pass without a plan never knows all its tasks started).
@@ -28,14 +35,16 @@
28
35
  // board reads the holder with its progress, and the waits for the lock or for room
29
36
  // (`lireLaMesure`).
30
37
  import { spawnSync } from 'node:child_process';
31
- import { mkdtempSync, readdirSync, readFileSync } from 'node:fs';
38
+ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs';
32
39
  import { tmpdir } from 'node:os';
33
40
  import path from 'node:path';
34
- import { ecrireAtomique, TACHES } from './mesure/avancement.mjs';
41
+ import { AVANCEMENT, ecrireAtomique, TACHES } from './mesure/avancement.mjs';
35
42
  import { lireLeVerrou } from './verrou-de-machine.mjs';
36
43
 
37
44
  const PASSE = 'passe.json';
38
45
  const PLAN = 'plan';
46
+ // The name of a progress directory starts so (`ouvrirAvancement`).
47
+ const PREFIXE = 'avancement-';
39
48
  const TACHES_GARDEES = 2_000;
40
49
 
41
50
  const lireJson = f => {
@@ -64,21 +73,26 @@ function fichierDesTotaux(racine) {
64
73
  );
65
74
  return r.status === 0 ? path.join(r.stdout.trim(), 'grillhouse', 'avancement.json') : null;
66
75
  }
67
- const lireLesTotaux = racine => {
68
- const f = fichierDesTotaux(racine);
76
+ // The totals read in the file <f>, empty without one.
77
+ const totauxDe = f => {
69
78
  const t = f ? lireJson(f) : null;
70
79
  return { fichier: f, passes: t?.passes ?? {}, taches: t?.taches ?? {} };
71
80
  };
81
+ // The totals of the repository at <racine>.
82
+ const lireLesTotaux = racine => totauxDe(fichierDesTotaux(racine));
72
83
 
73
84
  /**
74
85
  * Opens the progress directory of a pass of kind <genre> (null: a pass whose total is not kept)
75
- * in the repository at <racine>, made under <dans>, its start <debut>; its path.
86
+ * in the repository at <racine>, made under <dans>, its start <debut>; its path. The file of the
87
+ * totals is resolved now and kept in `passe.json` (`totaux`): the integration removes the ticket's
88
+ * copy before its pass ends, and its total goes to the same repository.
76
89
  * @param {{ racine: string, genre?: string | null, dans?: string, debut?: number }} o
77
90
  */
78
91
  export function ouvrirAvancement({ racine, genre = null, dans = tmpdir(), debut = Date.now() }) {
79
- const dossier = mkdtempSync(path.join(dans, 'avancement-'));
80
- const precedent = genre ? (lireLesTotaux(racine).passes[genre] ?? null) : null;
81
- ecrireAtomique(path.join(dossier, PASSE), { genre, debut, precedent });
92
+ const dossier = mkdtempSync(path.join(dans, PREFIXE));
93
+ const totaux = lireLesTotaux(racine);
94
+ const precedent = genre ? (totaux.passes[genre] ?? null) : null;
95
+ ecrireAtomique(path.join(dossier, PASSE), { genre, debut, precedent, totaux: totaux.fichier });
82
96
  return dossier;
83
97
  }
84
98
 
@@ -154,16 +168,114 @@ export function lireAvancement(dossier) {
154
168
  return { faits, prevus, debut, dernier };
155
169
  }
156
170
 
171
+ /**
172
+ * The progress of the pass under way in the working directory <travail> of a circuit, where each
173
+ * automatic pass of the circuit opens its progress directory (`avecLAvancementDuTravail`, one
174
+ * pass at a time): the latest started that reads, null without one.
175
+ * @param {string} travail
176
+ * @returns {{ faits: number, prevus: number, debut: number, dernier: number } | null}
177
+ */
178
+ export function avancementDuTravail(travail) {
179
+ let noms = [];
180
+ try {
181
+ noms = readdirSync(travail).filter(f => f.startsWith(PREFIXE));
182
+ } catch {
183
+ return null;
184
+ }
185
+ return (
186
+ noms
187
+ .map(f => lireAvancement(path.join(travail, f)))
188
+ .filter(Boolean)
189
+ .sort((a, b) => b.debut - a.debut)[0] ?? null
190
+ );
191
+ }
192
+
193
+ /**
194
+ * The progress directory of the readings of the CI of a ticket's commit, in the working directory
195
+ * <travail> of its circuit, where the board reads it (`avancementDuTravail`): one for all its
196
+ * readings, opened by the first, emptied when <nouvelle> (a reading that looks for its run, the
197
+ * records of another run gone); null when the circuit has no working directory.
198
+ * @param {string} travail
199
+ * @param {{ nouvelle?: boolean, debut?: number }} [o]
200
+ * @returns {string | null}
201
+ */
202
+ export function avancementDeLaCI(travail, { nouvelle = false, debut = Date.now() } = {}) {
203
+ if (!existsSync(travail)) {
204
+ return null;
205
+ }
206
+ const dossier = path.join(travail, `${PREFIXE}ci`);
207
+ try {
208
+ if (nouvelle) {
209
+ rmSync(dossier, { recursive: true, force: true });
210
+ }
211
+ if (!existsSync(path.join(dossier, PASSE))) {
212
+ mkdirSync(dossier, { recursive: true });
213
+ ecrireAtomique(path.join(dossier, PASSE), { genre: null, debut, precedent: null });
214
+ }
215
+ } catch {
216
+ // A directory that does not write leaves the queue going, without its progress.
217
+ return null;
218
+ }
219
+ return dossier;
220
+ }
221
+
222
+ /**
223
+ * Runs <passe> under a progress directory of the kind <genre> (null: none kept) opened in the
224
+ * working directory <travail> of a ticket's circuit, where the board reads it
225
+ * (`avancementDuTravail`): each automatic pass of the circuit (scripts/activites.mjs) and the
226
+ * replay of the ticket's branch by the queue (scripts/faits-du-circuit.mjs `avancer`), one pass at
227
+ * a time. The directories a killed pass left there go first, a lot that goes through the queue
228
+ * again included. The directory is given to <passe> and named to it and its children by
229
+ * GRILLHOUSE_AVANCEMENT (`AVANCEMENT`); then its total is kept in the repository at <racine> and
230
+ * it is removed, unless <garder> holds for what <passe> returns: a lot entered on main keeps it
231
+ * until the queue is done with the ticket closed, which removes the working directory whole
232
+ * (`retirerLeTravail` of scripts/integration/file.mjs), as the circuit kept its progress for its
233
+ * whole step of the queue. Without the working directory, <passe> runs without one (null).
234
+ * Returns what <passe> returns.
235
+ * @template T
236
+ * @param {string} travail
237
+ * @param {{ racine: string, genre: string | null, garder?: (valeur: T) => boolean }} o
238
+ * @param {(dossier: string | null) => T} passe
239
+ * @returns {T}
240
+ */
241
+ export function avecLAvancementDuTravail(travail, { racine, genre, garder = () => false }, passe) {
242
+ if (!existsSync(travail)) {
243
+ return passe(null);
244
+ }
245
+ for (const f of readdirSync(travail).filter(n => n.startsWith(PREFIXE))) {
246
+ rmSync(path.join(travail, f), { recursive: true, force: true });
247
+ }
248
+ const dossier = ouvrirAvancement({ racine, genre, dans: travail });
249
+ const avant = process.env[AVANCEMENT];
250
+ process.env[AVANCEMENT] = dossier;
251
+ let garde = false;
252
+ try {
253
+ const valeur = passe(dossier);
254
+ garde = garder(valeur);
255
+ return valeur;
256
+ } finally {
257
+ if (avant === undefined) {
258
+ delete process.env[AVANCEMENT];
259
+ } else {
260
+ process.env[AVANCEMENT] = avant;
261
+ }
262
+ garderLeTotal(dossier);
263
+ if (!garde) {
264
+ rmSync(dossier, { recursive: true, force: true });
265
+ }
266
+ }
267
+ }
268
+
157
269
  /**
158
270
  * Keeps, at the end of the pass whose directory is <dossier>, its total under its kind and the
159
- * files planned of each task it played, in the totals of the repository at <racine>.
271
+ * files planned of each task it played, in the totals its opening named (`totaux` of its
272
+ * `passe.json`); none out of git.
160
273
  * @param {string} dossier
161
- * @param {string} racine
162
274
  */
163
- export function garderLeTotal(dossier, racine) {
275
+ export function garderLeTotal(dossier) {
164
276
  const passe = lireJson(path.join(dossier, PASSE));
165
277
  if (!passe) return;
166
- const t = lireLesTotaux(racine);
278
+ const t = totauxDe(passe.totaux ?? null);
167
279
  if (!t.fichier) return;
168
280
  const liste = enregistrements(dossier);
169
281
  if (passe.genre && liste.length) t.passes[passe.genre] = liste.reduce((s, e) => s + e.prevus, 0);
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
@@ -628,9 +629,9 @@ function messagesDeLaSeance(seance) {
628
629
  }
629
630
 
630
631
  // 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 } = {}) {
632
+ // circuit kept, where its circuit ended (<fin>, `{ etape, raison, code }`, null while it runs), and
633
+ // the owner's messages in the supervisor's sessions its stops name unless <responsable> is false.
634
+ function calculer(racine, ticket, fin, { responsable = true } = {}) {
634
635
  const registre =
635
636
  process.env.GRILLHOUSE_REGISTRE ??
636
637
  path.join(os.homedir(), '.claude', 'grillhouse', 'registre.jsonl');
@@ -645,33 +646,48 @@ function calculer(racine, ticket, { responsable = true } = {}) {
645
646
  return [];
646
647
  }
647
648
  });
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
649
  const seances = new Set(entrees.map(e => e.montee?.superviseur).filter(Boolean));
656
650
  return bilan({
657
651
  ticket,
658
652
  lignes,
659
653
  entrees,
660
- etat,
654
+ etat: fin,
661
655
  nuit: plageDeNuit(racine),
662
656
  duResponsable: responsable ? [...seances].flatMap(s => messagesDeLaSeance(String(s))) : [],
663
657
  });
664
658
  }
665
659
 
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);
660
+ // The bilan of <ticket> computed, where its circuit ended <fin> (`calculer`), kept in the main tree
661
+ // <racine>, and its text, compared with the bilan before it: what the circuit writes at the ticket.
662
+ export function ecrireLeBilan(racine, ticket, fin) {
663
+ const b = calculer(racine, ticket, fin);
670
664
  const avant = precedent(racine, ticket);
671
665
  garder(racine, b);
672
666
  return texteDuBilan(b, avant);
673
667
  }
674
668
 
669
+ // Where the circuit of <ticket> in the repository at <racine> ended, as its workflow's memo on the
670
+ // Temporal server gives it (the summary of its last state, src/temporal/circuit/deroule.ts); null
671
+ // while it runs on its own (no question awaited), or when the server does not give it within 5 s.
672
+ async function finSurLeServeur(racine, ticket) {
673
+ const { lireLeDeroule, ouvrirLeClient } = await import('../dist/temporal/client.js');
674
+ const { idDuCircuit } = await import('../dist/temporal/circuit/contrat.js');
675
+ const c = ouvrirLeClient();
676
+ try {
677
+ const d = await c.client.connection.withDeadline(Date.now() + 5_000, () =>
678
+ lireLeDeroule(c.client, idDuCircuit(racine, ticket))
679
+ );
680
+ const e = d.memo?.etat;
681
+ return !e || (d.statut === 'RUNNING' && !d.memo?.question)
682
+ ? null
683
+ : { etape: e.etape ?? null, raison: e.raison ?? null, code: e.code ?? null };
684
+ } catch {
685
+ return null;
686
+ } finally {
687
+ await c.fermer();
688
+ }
689
+ }
690
+
675
691
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
676
692
  const [ticket, ...options] = process.argv.slice(2);
677
693
  if (!ticket || ticket.startsWith('-')) {
@@ -682,8 +698,10 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
682
698
  encoding: 'utf8',
683
699
  });
684
700
  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);
701
+ void finSurLeServeur(racine, ticket).then(fin => {
702
+ const b = calculer(racine, ticket, fin);
703
+ process.stdout.write(`${texteDuBilan(b, precedent(racine, ticket))}\n`);
704
+ if (options.includes('--garder')) garder(racine, b);
705
+ });
688
706
  }
689
707
  }
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'];