@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,247 @@
1
+ // The client of the workflow of a ticket (./deroule.ts), as `npx grillhouse circuit` speaks to it
2
+ // (./commande.ts): it starts the circuit of a ticket (or leaves the one that runs), answers its
3
+ // stop (the updates REPRENDRE, DEPUIS and ETENDRE, which a validator refuses out of a wait or on a
4
+ // question already answered, and the signal ARRETER, taken anywhere), and reads it (the query
5
+ // L_ETAT). A circuit stopped on the supervisor's word has ended its workflow, which gave back the
6
+ // state it wrote last (`FinDuCircuit`): his answer starts a new one on the same id, which reopens
7
+ // from that state (`reprise`, `etatDArret`), not as a first launch, the bounds of the entry it
8
+ // follows kept. The server holds a workflow for the retention of its namespace (30 days, the
9
+ // installation's); past it, the state is gone with it, and only `--depuis` reopens the circuit,
10
+ // from the step of its agent, on the task queue of the project's worker (decision Q2 of
11
+ // grillhouse-4nr.12).
12
+ import { lesReponses, SANS_ISSUE } from '../../../scripts/reponses-du-circuit.mjs';
13
+ import { WorkflowNotFoundError, WorkflowUpdateFailedError } from '@temporalio/client';
14
+ import { ApplicationFailure, defaultPayloadConverter, WorkflowExecutionAlreadyStartedError, } from '@temporalio/common';
15
+ import { fileDuProjet } from '../installation.js';
16
+ import { ARRETER, CIRCUIT, DEPUIS, ETENDRE, idDuCircuit, L_ETAT, REFUS_DU_VALIDATEUR, REPRENDRE, } from './contrat.js';
17
+ /** Starts the circuit of <entree> on the task queue <file>, or leaves the one that runs: its id. */
18
+ export async function demarrerLeCircuit(client, entree, file) {
19
+ const id = idDuCircuit(entree.racine, entree.ticket);
20
+ await client.workflow.start(CIRCUIT, {
21
+ workflowId: id,
22
+ taskQueue: file,
23
+ args: [entree],
24
+ workflowIdConflictPolicy: 'USE_EXISTING',
25
+ });
26
+ return id;
27
+ }
28
+ const handle = (client, racine, ticket) => client.workflow.getHandle(idDuCircuit(racine, ticket));
29
+ // The bounds of the entry of the workflow <h> started with (`repasserMs`, `repassesMax`, `ci`),
30
+ // read in the first event of its history.
31
+ async function bornesDe(h) {
32
+ const historique = await h.fetchHistory();
33
+ const debut = historique.events?.[0]?.workflowExecutionStartedEventAttributes?.input?.payloads?.[0];
34
+ const e = debut ? defaultPayloadConverter.fromPayload(debut) : null;
35
+ return {
36
+ ...(e?.repasserMs === undefined ? {} : { repasserMs: e.repasserMs }),
37
+ ...(e?.repassesMax === undefined ? {} : { repassesMax: e.repassesMax }),
38
+ ...(e?.ci === undefined ? {} : { ci: e.ci }),
39
+ };
40
+ }
41
+ /**
42
+ * The refusal of an answer by its name, as `npx grillhouse circuit` refuses it (its `Usage`, exit
43
+ * code 2): nothing is written, no workflow starts.
44
+ */
45
+ export class ReponseRefusee extends Error {
46
+ constructor(message) {
47
+ super(message);
48
+ this.name = 'ReponseRefusee';
49
+ }
50
+ }
51
+ // Refuses the answer <genre> to the circuit of <ticket> whose workflow ended <raison>: --reprendre
52
+ // and --etendre an integrated lot; --depuis never.
53
+ function refuserApresLaFin(genre, raison, ticket) {
54
+ if (genre === 'reprendre' && raison === 'integre') {
55
+ throw new ReponseRefusee(`rien à reprendre : le lot de ${ticket} est intégré.`);
56
+ }
57
+ if (genre === 'etendre' && raison === 'integre') {
58
+ throw new ReponseRefusee(`--etendre : le lot de ${ticket} est intégré.`);
59
+ }
60
+ }
61
+ // The update <envoyer> to a workflow that runs: a refusal of its validator (out of a wait, a
62
+ // question already answered, an answer out of its values: REFUS_DU_VALIDATEUR) is a refusal by
63
+ // its name; any other failure of the update (no handler, the workflow ended before it) stays as
64
+ // Temporal gives it.
65
+ async function envoyerA(envoyer) {
66
+ try {
67
+ return await envoyer();
68
+ }
69
+ catch (x) {
70
+ if (x instanceof WorkflowUpdateFailedError &&
71
+ x.cause instanceof ApplicationFailure &&
72
+ x.cause.type === REFUS_DU_VALIDATEUR) {
73
+ throw new ReponseRefusee(x.cause.message);
74
+ }
75
+ throw x;
76
+ }
77
+ }
78
+ // The supervisor's answer <reponse> to the circuit of <ticket>, said <dit>: the update <envoyer>
79
+ // when its workflow runs; when it ended stopped on his word, a new workflow on the same id, which
80
+ // opens on the answer from the state the ended one gave back, on its task queue. A workflow the
81
+ // server no longer holds reopens on --depuis alone, with no state, on the project's task queue
82
+ // (<ou>). A workflow ended without its issue (terminated by force, failed) reopens on --reprendre
83
+ // from the state its last memo holds whole (`ecrit`), or on --depuis. An integrated lot (`refuserApresLaFin`),
84
+ // --reprendre or --etendre past the retention, --etendre on a workflow ended without its issue, a
85
+ // refusal of the validators of a workflow that runs, and an answer another one beat are refused by
86
+ // their name (`ReponseRefusee`).
87
+ async function repondre(client, racine, ticket, reponse, dit, envoyer, ou) {
88
+ const h = handle(client, racine, ticket);
89
+ let file;
90
+ let bornes = {};
91
+ let etatDArret = null;
92
+ try {
93
+ const d = await h.describe();
94
+ if (d.status.name === 'RUNNING') {
95
+ return await envoyerA(envoyer);
96
+ }
97
+ file = d.taskQueue;
98
+ bornes = await bornesDe(h);
99
+ if (d.status.name === 'COMPLETED') {
100
+ const fin = (await h.result());
101
+ refuserApresLaFin(reponse.genre, fin.raison, ticket);
102
+ etatDArret = fin.raison === 'arrete' ? (fin.etat ?? null) : null;
103
+ }
104
+ else {
105
+ // Ended without its issue: the state its last memo holds whole, which --reprendre reopens from.
106
+ etatDArret = d.memo?.ecrit ?? null;
107
+ if (reponse.genre === 'etendre' || (reponse.genre === 'reprendre' && !etatDArret)) {
108
+ throw new ReponseRefusee(`le déroulé de ${ticket} a fini sans son issue (${d.status.name})${etatDArret ? '' : ', aucun état écrit'} : \`${lesReponses(ticket, d.status.name, Boolean(etatDArret))}\` le rouvre.`);
109
+ }
110
+ }
111
+ }
112
+ catch (x) {
113
+ if (!(x instanceof WorkflowNotFoundError)) {
114
+ throw x;
115
+ }
116
+ // Its retention passed: its state is gone with it, and only the step of an agent reopens it.
117
+ if (reponse.genre !== 'depuis') {
118
+ throw new ReponseRefusee(`le serveur ne tient plus le circuit de ${ticket} (sa conservation est passée) : seul \`npx grillhouse circuit ${ticket} --depuis <testwriter|developpeur> --contexte <texte>\` le rouvre.`);
119
+ }
120
+ file = ou.file ?? fileDuProjet(racine);
121
+ }
122
+ try {
123
+ await client.workflow.start(CIRCUIT, {
124
+ workflowId: h.workflowId,
125
+ taskQueue: file,
126
+ args: [
127
+ {
128
+ racine,
129
+ ticket,
130
+ ...bornes,
131
+ reprise: reponse,
132
+ etatDArret,
133
+ ...(ou.superviseur === undefined ? {} : { superviseur: ou.superviseur }),
134
+ },
135
+ ],
136
+ });
137
+ }
138
+ catch (x) {
139
+ if (x instanceof WorkflowExecutionAlreadyStartedError) {
140
+ throw new ReponseRefusee(`une autre réponse a déjà repris le circuit de ${ticket} : il tourne.`);
141
+ }
142
+ throw x;
143
+ }
144
+ return dit;
145
+ }
146
+ // The supervisor's session of <ou> as an answer carries it, nothing when it names none.
147
+ const seanceDe = (ou) => ou.superviseur === undefined ? {} : { superviseur: ou.superviseur };
148
+ /** Resumes the stopped circuit at its step (`--reprendre`), with the supervisor's <contexte>; refused out of a wait. */
149
+ export async function reprendreLeCircuit(client, racine, ticket, contexte = null, ou = {}) {
150
+ return repondre(client, racine, ticket, { genre: 'reprendre', contexte }, 'repris', () => handle(client, racine, ticket).executeUpdate(REPRENDRE, { args: ou.superviseur === undefined ? [contexte] : [contexte, ou.superviseur] }), ou);
151
+ }
152
+ /**
153
+ * Stops the circuit, its session with it (`--arreter`), its motive <contexte>. A circuit that does
154
+ * not run is refused by its name (`ReponseRefusee`): its lot integrated, or no circuit running.
155
+ */
156
+ export async function arreterLeCircuit(client, racine, ticket, contexte = null) {
157
+ const h = handle(client, racine, ticket);
158
+ const d = await h.describe().catch((x) => {
159
+ if (x instanceof WorkflowNotFoundError) {
160
+ return null;
161
+ }
162
+ throw x;
163
+ });
164
+ if (d?.status.name !== 'RUNNING') {
165
+ const fin = d?.status.name === 'COMPLETED' ? (await h.result()) : null;
166
+ throw new ReponseRefusee(fin?.raison === 'integre'
167
+ ? `--arreter : le lot de ${ticket} est intégré.`
168
+ : `--arreter : aucun circuit ne tourne sur ${ticket}.`);
169
+ }
170
+ await h.signal(ARRETER, contexte);
171
+ }
172
+ /** Resumes the stopped circuit from the step of <role> (`--depuis`); refused out of a wait. */
173
+ export async function reprendreDepuis(client, racine, ticket, role, contexte = null, ou = {}) {
174
+ return repondre(client, racine, ticket, { genre: 'depuis', role, contexte }, `depuis ${role}`, () => handle(client, racine, ticket).executeUpdate(DEPUIS, { args: [{ role, contexte, ...seanceDe(ou) }] }), ou);
175
+ }
176
+ /** Extends the plan of the stopped circuit to <paquets>, then resumes it (`--etendre`). */
177
+ export async function etendreLeCircuit(client, racine, ticket, paquets, contexte = null, ou = {}) {
178
+ return repondre(client, racine, ticket, { genre: 'etendre', paquets, contexte }, `étendu à ${paquets.join(', ')}`, () => handle(client, racine, ticket).executeUpdate(ETENDRE, { args: [{ paquets, contexte, ...seanceDe(ou) }] }), ou);
179
+ }
180
+ /** The circuit as it stands: its step, whether it waits, its question. */
181
+ export async function lireLeCircuit(client, racine, ticket) {
182
+ return handle(client, racine, ticket).query(L_ETAT);
183
+ }
184
+ /** The end of the circuit: integrated, or stopped on the supervisor's word. */
185
+ export async function finDuCircuit(client, racine, ticket) {
186
+ return (await handle(client, racine, ticket).result());
187
+ }
188
+ /**
189
+ * The circuits of the repository at <racine>, read in one call to the server (a `workflow.list`,
190
+ * its memo and its status, no worker living): the last run of each ticket, a circuit integrated
191
+ * left out, in the form the board reads (`CircuitLu`).
192
+ */
193
+ export async function lireLesCircuits(client, racine) {
194
+ const prefixe = idDuCircuit(racine, '');
195
+ const lus = [];
196
+ for await (const w of client.workflow.list({ query: `WorkflowType = '${CIRCUIT}'` })) {
197
+ if (w.workflowId.startsWith(prefixe)) {
198
+ lus.push(w);
199
+ }
200
+ }
201
+ const parTicket = new Map();
202
+ for (const w of lus) {
203
+ const avant = parTicket.get(w.workflowId);
204
+ if (!avant || w.startTime.getTime() > avant.startTime.getTime()) {
205
+ parTicket.set(w.workflowId, w);
206
+ }
207
+ }
208
+ const out = [];
209
+ for (const w of parTicket.values()) {
210
+ const memo = (w.memo ?? {});
211
+ const etat = memo.etat ?? null;
212
+ if (memo.etape === 'integre' || etat?.etape === 'integre') {
213
+ continue;
214
+ }
215
+ const q = memo.question ?? null;
216
+ const statut = w.status.name;
217
+ const interrompu = SANS_ISSUE.has(statut) && !q;
218
+ const ticket = w.workflowId.slice(prefixe.length);
219
+ const reponse = lesReponses(ticket, statut, Boolean(memo.ecrit));
220
+ out.push({
221
+ ticket,
222
+ etape: etat?.etape ?? null,
223
+ tentative: etat?.tentative ?? null,
224
+ finale: etat?.finale === true,
225
+ code: etat?.code ?? null,
226
+ arret: q?.arret ?? etat?.raison ?? (statut === 'COMPLETED' ? 'arrete' : null),
227
+ raison: etat?.rapport ?? null,
228
+ // Ended without its issue, its question names no command: the answers the client accepts
229
+ // (`reponse`, `lesReponses`) are named once, beside it, by the board, the opening and the wait.
230
+ question: SANS_ISSUE.has(statut)
231
+ ? `Le déroulé du circuit a fini sans son issue (${statut}), ${q ? `pendant sa question (${q.arret})` : 'aucun arrêt écrit'}.`
232
+ : String(q?.question ?? '').trim() || null,
233
+ qui: interrompu ? 'superviseur' : q ? String(q.qui ?? 'superviseur') : null,
234
+ questionnement: etat?.questionnement ?? null,
235
+ boucles: etat?.boucles ?? {},
236
+ mene: etat?.mene && !Number.isNaN(Date.parse(etat.mene)) ? Date.parse(etat.mene) : null,
237
+ vivant: statut === 'RUNNING' && !q,
238
+ interrompu,
239
+ sansIssue: SANS_ISSUE.has(statut),
240
+ reponse,
241
+ run: w.runId,
242
+ numero: memo.numero ?? 0,
243
+ });
244
+ }
245
+ return out.sort((a, b) => a.ticket.localeCompare(b.ticket, 'en'));
246
+ }
247
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/temporal/circuit/client.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,gGAAgG;AAChG,mGAAmG;AACnG,8FAA8F;AAC9F,kGAAkG;AAClG,kGAAkG;AAClG,+FAA+F;AAC/F,6FAA6F;AAC7F,gGAAgG;AAChG,wFAAwF;AACxF,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,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AI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;YACvF,MAAM,EAAE,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC;YAClC,UAAU;YACV,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC;YACjC,OAAO;YACP,GAAG,EAAE,CAAC,CAAC,KAAK;YACZ,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC;SACzB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,238 @@
1
+ #!/usr/bin/env node
2
+ // The subcommand `grillhouse circuit`, the client of the workflow of a ticket (./client.ts), as
3
+ // `gh run` speaks to a CI it does not run:
4
+ //
5
+ // grillhouse circuit <ticket> puts it in the queue
6
+ // grillhouse circuit <ticket> --reprendre [--contexte <texte>]
7
+ // grillhouse circuit <ticket> --depuis <testwriter|developpeur> --contexte <texte>
8
+ // grillhouse circuit <ticket> --etendre <paquet>[,<paquet>…] [--contexte <texte>]
9
+ // grillhouse circuit <ticket> --arreter [--contexte <motif>]
10
+ //
11
+ // - The repository is the main tree of the working directory (git's common directory), as the
12
+ // worker of the project runs there; the server, TEMPORAL_ADDRESS or the account's.
13
+ // - Alone, the ticket goes in the queue of the tickets of the project (../tickets/), which starts
14
+ // its circuit once its dependencies are closed and a place of the setting is free: the label
15
+ // `circuit` is added (`bd update --add-label circuit`), and the queue is started when none runs.
16
+ // A ticket the circuit could not run is refused before, by its name (scripts/depart-du-ticket.mjs:
17
+ // unreadable, without its section « ## Architecture », a title that names no component, or a
18
+ // component the repository does not hold); so is a ticket whose circuit runs (`--arreter` stops
19
+ // it), and one stopped on the supervisor's word (`--reprendre` or `--depuis` reopens it).
20
+ // - `--reprendre`, `--depuis` and `--etendre` answer the stop of the circuit (the updates of its
21
+ // workflow, or a new workflow on the state a stopped one gave back), `--arreter` stops it (its
22
+ // signal); a package of `--etendre` the repository does not hold is refused before, by its name; `--contexte` gives the supervisor's text to each, and `--depuis` requires it.
23
+ // - Each writes one line on the standard output, exit 0. A malformed call writes the usage, a
24
+ // refusal (`ReponseRefusee`, the ticket refused) its reason, on the error stream, exit 2. A
25
+ // server that does not answer, or Beads that fails, is said on the error stream, exit 1.
26
+ import { spawnSync } from 'node:child_process';
27
+ import path from 'node:path';
28
+ import { WorkflowNotFoundError } from '@temporalio/client';
29
+ import { DepartRefuse, ticketAuLancement } from '../../../scripts/depart-du-ticket.mjs';
30
+ import { sansReponseEn } from '../../../scripts/sans-reponse.mjs';
31
+ import { DELAI_JOIGNABLE_MS, adresseDuServeur, ouvrirLeClient, serveurJoignable, } from '../client.js';
32
+ import { fileDuProjet } from '../installation.js';
33
+ import { demarrerLesTickets } from '../tickets/client.js';
34
+ import { arreterLeCircuit, etendreLeCircuit, reprendreDepuis, reprendreLeCircuit, ReponseRefusee, } from './client.js';
35
+ import { AGENTS_DU_LOT, idDuCircuit } from './contrat.js';
36
+ const USAGE = 'usage: npx grillhouse circuit <ticket> [--reprendre [--contexte <texte>] | ' +
37
+ '--depuis <testwriter|developpeur> --contexte <texte> | ' +
38
+ '--etendre <paquet>[,<paquet>…] [--contexte <texte>] | --arreter [--contexte <motif>]]\n';
39
+ /** A malformed call, by its reason. */
40
+ class Usage extends Error {
41
+ }
42
+ /** The call <argv> read, or a Usage, by the rules of the circuit's options. */
43
+ function lireLAppel(argv) {
44
+ let ticket = null;
45
+ const o = {
46
+ reprendre: false,
47
+ depuis: null,
48
+ etendre: null,
49
+ arreter: false,
50
+ contexte: null,
51
+ };
52
+ for (let i = 0; i < argv.length; i++) {
53
+ const a = argv[i];
54
+ const suivant = argv[i + 1];
55
+ if (a === '--reprendre') {
56
+ o.reprendre = true;
57
+ }
58
+ else if (a === '--arreter') {
59
+ o.arreter = true;
60
+ }
61
+ else if (a === '--etendre') {
62
+ const liste = String(suivant ?? '')
63
+ .split(',')
64
+ .map(c => c.trim())
65
+ .filter(Boolean);
66
+ if (!liste.length || suivant.startsWith('-')) {
67
+ throw new Usage('--etendre attend les paquets que le plan gagne.');
68
+ }
69
+ o.etendre = liste;
70
+ i++;
71
+ }
72
+ else if (a === '--depuis') {
73
+ if (!AGENTS_DU_LOT.includes(suivant)) {
74
+ throw new Usage(`--depuis attend une étape du ticket : ${AGENTS_DU_LOT.join(' ou ')}.`);
75
+ }
76
+ o.depuis = suivant;
77
+ i++;
78
+ }
79
+ else if (a === '--contexte') {
80
+ if (suivant === undefined) {
81
+ throw new Usage('--contexte attend son texte.');
82
+ }
83
+ o.contexte = suivant;
84
+ i++;
85
+ }
86
+ else if (a.startsWith('-')) {
87
+ throw new Usage(`option inconnue : ${a}`);
88
+ }
89
+ else if (ticket) {
90
+ throw new Usage(`un seul ticket : ${ticket}, puis ${a}.`);
91
+ }
92
+ else {
93
+ ticket = a;
94
+ }
95
+ }
96
+ if (!ticket) {
97
+ throw new Usage('le ticket manque.');
98
+ }
99
+ if (o.depuis && o.reprendre) {
100
+ throw new Usage('--depuis et --reprendre ne vont pas ensemble.');
101
+ }
102
+ if (o.depuis && o.contexte === null) {
103
+ throw new Usage('--depuis attend son --contexte : la tâche de chaque agent du lot.');
104
+ }
105
+ if (o.etendre && (o.reprendre || o.depuis || o.arreter)) {
106
+ throw new Usage('--etendre va seule, avec son --contexte : le circuit reprend sur le plan étendu.');
107
+ }
108
+ if (o.arreter && (o.reprendre || o.depuis)) {
109
+ throw new Usage('--arreter va seule, son motif en --contexte.');
110
+ }
111
+ return { ticket, ...o };
112
+ }
113
+ // The main tree of the repository of the working directory, from git's common directory.
114
+ function arbrePrincipal() {
115
+ const r = spawnSync('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], {
116
+ encoding: 'utf8',
117
+ });
118
+ if (r.status !== 0) {
119
+ throw new Error(`le dépôt ne se lit pas (git rev-parse) : ${r.stderr.trim()}`);
120
+ }
121
+ return path.dirname(r.stdout.trim());
122
+ }
123
+ // bd in the repository at <racine>: its output, or the failure of Beads by its reason.
124
+ function bd(racine, ...args) {
125
+ const r = spawnSync('bd', args, { cwd: racine, encoding: 'utf8' });
126
+ if (r.status !== 0) {
127
+ throw new Error(`bd ${args[0]} échoue : ${(r.stderr || r.error?.message || '').trim()}`);
128
+ }
129
+ return r.stdout;
130
+ }
131
+ // <f>, a reading of the ticket at the door (scripts/depart-du-ticket.mjs), its refusal a refused
132
+ // answer, by its reason.
133
+ function aLaPorte(f) {
134
+ try {
135
+ return f();
136
+ }
137
+ catch (x) {
138
+ if (x instanceof DepartRefuse) {
139
+ throw new ReponseRefusee(x.message);
140
+ }
141
+ throw x;
142
+ }
143
+ }
144
+ // The supervisor's session that runs the command (Claude Code's `CLAUDE_CODE_SESSION_ID`), which the
145
+ // circuit's stop gone up keeps (`EntreeDuCircuit.superviseur`); null out of a session.
146
+ const seanceDuSuperviseur = () => process.env.CLAUDE_CODE_SESSION_ID || null;
147
+ // The ticket <ticket> of <racine> put in the queue of the tickets of the project: its line.
148
+ async function mettreEnFile(client, racine, ticket) {
149
+ aLaPorte(() => ticketAuLancement(racine, ticket));
150
+ try {
151
+ const d = await client.workflow.getHandle(idDuCircuit(racine, ticket)).describe();
152
+ if (d.status.name === 'RUNNING') {
153
+ throw new ReponseRefusee(`un circuit tourne déjà sur ${ticket} : il mène le ticket à sa fin, \`--arreter\` l'arrête.`);
154
+ }
155
+ const fin = (await client.workflow.getHandle(idDuCircuit(racine, ticket)).result());
156
+ if (fin?.raison === 'arrete') {
157
+ throw new ReponseRefusee(`le circuit de ${ticket} est arrêté sur le mot du superviseur : \`--reprendre\` ou \`--depuis <testwriter|developpeur> --contexte <texte>\` le rouvre.`);
158
+ }
159
+ }
160
+ catch (x) {
161
+ if (!(x instanceof WorkflowNotFoundError)) {
162
+ throw x;
163
+ }
164
+ }
165
+ bd(racine, 'update', ticket, '--add-label', 'circuit');
166
+ await demarrerLesTickets(client, { racine }, fileDuProjet(racine), seanceDuSuperviseur());
167
+ return `▶ ${ticket} est dans la file des tickets du projet : son circuit part dès que ses dépendances sont fermées et qu'une place du réglage est libre ; sa question réveille l'attente des questions (\`npx grillhouse superviseur --attendre\`), sa fin se lit au panneau.`;
168
+ }
169
+ // The answer <appel> to the circuit of its ticket in <racine>: its line.
170
+ async function repondre(client, racine, appel) {
171
+ const { ticket, contexte } = appel;
172
+ if (appel.arreter) {
173
+ await arreterLeCircuit(client, racine, ticket, contexte);
174
+ return `▶ Circuit de ${ticket} : l'arrêt est demandé ; il s'arrête, sa séance avec lui.`;
175
+ }
176
+ if (appel.etendre) {
177
+ // A package the repository does not hold is refused at the door, by its name, as a component of
178
+ // the title is at the launch.
179
+ const { resoudre } = aLaPorte(() => ticketAuLancement(racine, ticket, { arreter: true }));
180
+ aLaPorte(() => appel.etendre.forEach(resoudre));
181
+ }
182
+ const ou = { superviseur: seanceDuSuperviseur() };
183
+ const dit = appel.depuis
184
+ ? await reprendreDepuis(client, racine, ticket, appel.depuis, contexte, ou)
185
+ : appel.etendre
186
+ ? await etendreLeCircuit(client, racine, ticket, appel.etendre, contexte, ou)
187
+ : await reprendreLeCircuit(client, racine, ticket, contexte, ou);
188
+ return `▶ Circuit de ${ticket} : ${dit}.`;
189
+ }
190
+ async function principal(argv) {
191
+ let appel;
192
+ try {
193
+ appel = lireLAppel(argv);
194
+ }
195
+ catch (x) {
196
+ if (x instanceof Usage) {
197
+ process.stderr.write(`${USAGE}⛔ ${x.message}\n`);
198
+ return 2;
199
+ }
200
+ throw x;
201
+ }
202
+ const adresse = adresseDuServeur();
203
+ if (!(await serveurJoignable(adresse))) {
204
+ process.stderr.write(`⛔ ${sansReponseEn(DELAI_JOIGNABLE_MS)} sur ${adresse} : \`npx grillhouse temporal etat\` dit l'état du service.\n`);
205
+ return 1;
206
+ }
207
+ const racine = arbrePrincipal();
208
+ const c = ouvrirLeClient();
209
+ try {
210
+ const repond = appel.reprendre || appel.depuis || appel.etendre || appel.arreter;
211
+ const ligne = repond
212
+ ? await repondre(c.client, racine, appel)
213
+ : await mettreEnFile(c.client, racine, appel.ticket);
214
+ process.stdout.write(`${ligne}\n`);
215
+ return 0;
216
+ }
217
+ catch (x) {
218
+ if (x instanceof ReponseRefusee) {
219
+ process.stderr.write(`⛔ ${x.message}\n`);
220
+ return 2;
221
+ }
222
+ throw x;
223
+ }
224
+ finally {
225
+ await c.fermer();
226
+ }
227
+ }
228
+ // The message of <e> and of each of its causes, as Temporal wraps a failure in its own.
229
+ const raisons = (e) => e instanceof Error
230
+ ? [e.message, ...(e.cause === undefined ? [] : [raisons(e.cause)])].join(' : ')
231
+ : String(e);
232
+ principal(process.argv.slice(2)).then(code => {
233
+ process.exitCode = code;
234
+ }, (e) => {
235
+ process.stderr.write(`⛔ grillhouse circuit : ${raisons(e)}\n`);
236
+ process.exitCode = 1;
237
+ });
238
+ //# sourceMappingURL=commande.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commande.js","sourceRoot":"","sources":["../../../src/temporal/circuit/commande.ts"],"names":[],"mappings":";AACA,gGAAgG;AAChG,2CAA2C;AAC3C,EAAE;AACF,8FAA8F;AAC9F,iEAAiE;AACjE,qFAAqF;AACrF,oFAAoF;AACpF,+DAA+D;AAC/D,EAAE;AACF,8FAA8F;AAC9F,qFAAqF;AACrF,kGAAkG;AAClG,+FAA+F;AAC/F,mGAAmG;AACnG,qGAAqG;AACrG,+FAA+F;AAC/F,kGAAkG;AAClG,4FAA4F;AAC5F,iGAAiG;AACjG,iGAAiG;AACjG,iLAAiL;AACjL,8FAA8F;AAC9F,8FAA8F;AAC9F,2FAA2F;AA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