@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
@@ -122,8 +122,12 @@ function proprietaire(base) {
122
122
  function orpheline(base) {
123
123
  const p = proprietaire(base);
124
124
  const ici = espace();
125
- if (p === null || ici === null || p.espace !== ici) return false;
126
- if (typeof p.racine === 'string') return !existsSync(p.racine);
125
+ if (p === null || ici === null || p.espace !== ici) {
126
+ return false;
127
+ }
128
+ if (typeof p.racine === 'string') {
129
+ return !existsSync(p.racine);
130
+ }
127
131
  return Number.isInteger(p.pid) && !vivant(p.pid);
128
132
  }
129
133
 
@@ -139,8 +143,9 @@ function balayer(dans, { vieilles = false } = {}) {
139
143
  }
140
144
  for (const nom of noms) {
141
145
  const base = path.join(dans, nom);
142
- if (nom.startsWith(PREFIXE) && (orpheline(base) || (vieilles && vieille(base))))
146
+ if (nom.startsWith(PREFIXE) && (orpheline(base) || (vieilles && vieille(base)))) {
143
147
  rmSync(base, { recursive: true, force: true });
148
+ }
144
149
  }
145
150
  }
146
151
 
@@ -150,7 +155,9 @@ export const AGE_DU_CACHE_MS = 7 * 24 * 3600 * 1000;
150
155
  // Whether <base> is a base of a cache of a root untouched (its directory's mtime) for
151
156
  // AGE_DU_CACHE_MS.
152
157
  function vieille(base) {
153
- if (typeof proprietaire(base)?.racine !== 'string') return false;
158
+ if (typeof proprietaire(base)?.racine !== 'string') {
159
+ return false;
160
+ }
154
161
  try {
155
162
  return Date.now() - statSync(base).mtimeMs > AGE_DU_CACHE_MS;
156
163
  } catch {
@@ -164,9 +171,13 @@ const enEnveloppe = env => Boolean(env.GRILLHOUSE_ENVELOPPE);
164
171
  // The sweep of the caches of the roots under <env> (`cacheDeLaRacine`, in each tool's directory of
165
172
  // the frame's caches), from the host only: the orphans and the old ones.
166
173
  function balayerLesCaches(env) {
167
- if (enEnveloppe(env)) return;
174
+ if (enEnveloppe(env)) {
175
+ return;
176
+ }
168
177
  const racine = path.dirname(cacheDeCompilation('-', env));
169
- for (const outil of contenu(racine)) balayer(path.join(racine, outil), { vieilles: true });
178
+ for (const outil of contenu(racine)) {
179
+ balayer(path.join(racine, outil), { vieilles: true });
180
+ }
170
181
  }
171
182
 
172
183
  // The variables that name the temporary directory: TMPDIR (POSIX, Node, Rust), TMP and TEMP
@@ -186,11 +197,16 @@ function contenu(dossier) {
186
197
  * The line of the guard of a pass of tests: what its tests left in their temporary directory,
187
198
  * named; null when they left nothing.
188
199
  * @param {string[]} restes the names left (`restes` of a base)
200
+ * @param {string} [paquet] the package whose tests played under that directory, when the pass
201
+ * gives each package its own; the line names it
189
202
  * @returns {string | null}
190
203
  */
191
- export function ligneDesRestes(restes) {
192
- if (restes.length === 0) return null;
193
- return `⛔ Les tests ont laissé dans leur dossier temporaire : ${restes.join(', ')}. Un test retire ce qu'il y crée, rouge compris.`;
204
+ export function ligneDesRestes(restes, paquet) {
205
+ if (restes.length === 0) {
206
+ return null;
207
+ }
208
+ const de = paquet ? `Les tests de ${paquet} ont` : 'Les tests ont';
209
+ return `⛔ ${de} laissé dans leur dossier temporaire : ${restes.join(', ')}. Un test retire ce qu'il y crée, rouge compris.`;
194
210
  }
195
211
 
196
212
  // The signals that interrupt a pass: Ctrl-C, a kill, the end of its terminal.
@@ -205,34 +221,89 @@ const INTERRUPTIONS = ['SIGINT', 'SIGTERM', 'SIGHUP'];
205
221
  */
206
222
  export function retirerALInterruption(retirer) {
207
223
  const lacher = () => {
208
- for (const s of INTERRUPTIONS) process.removeListener(s, surSignal);
224
+ for (const s of INTERRUPTIONS) {
225
+ process.removeListener(s, surSignal);
226
+ }
209
227
  };
210
228
  function surSignal(signal) {
211
229
  lacher();
212
230
  retirer();
213
231
  process.kill(process.pid, signal);
214
232
  }
215
- for (const s of INTERRUPTIONS) process.on(s, surSignal);
233
+ for (const s of INTERRUPTIONS) {
234
+ process.on(s, surSignal);
235
+ }
216
236
  return lacher;
217
237
  }
218
238
 
239
+ // The trial directories under the home (`racineSousLaMaison`, grillhouse-matiere): their prefix, and
240
+ // how long one without a readable owner file waits before it goes (the ones the passes before the
241
+ // owner file left, and one being created).
242
+ const ESSAIS = `${PREFIXE}essais-`;
243
+ const AGE_DES_ESSAIS_MS = 24 * 3600 * 1000;
244
+
245
+ // The cache directory of the home, where the trial directories lie.
246
+ const cacheDeLaMaison = () => path.join(process.env.HOME || homedir(), '.cache');
247
+
248
+ // Whether the owner <p> of a trial directory is a pass of this namespace that is gone: its number
249
+ // is free, or reused by a process that started at another time.
250
+ function passeMorte(p) {
251
+ const ici = espace();
252
+ if (p === null || ici === null || p.espace !== ici || !Number.isInteger(p.pid)) {
253
+ return false;
254
+ }
255
+ return typeof p.depart === 'string' ? !leMemeVivant(p.pid, p.depart) : !vivant(p.pid);
256
+ }
257
+
258
+ // Removes from the home's cache every trial directory whose pass is gone, and, from the host
259
+ // only (the home is read-only in an envelope, whose namespace is its own), the ones without a
260
+ // readable owner file older than a day.
261
+ function balayerLesEssais(env) {
262
+ if (enEnveloppe(env)) {
263
+ return;
264
+ }
265
+ const cache = cacheDeLaMaison();
266
+ for (const nom of contenu(cache)) {
267
+ if (!nom.startsWith(ESSAIS)) {
268
+ continue;
269
+ }
270
+ const dossier = path.join(cache, nom);
271
+ const p = proprietaire(dossier);
272
+ let retirer = false;
273
+ if (p === null) {
274
+ try {
275
+ retirer = Date.now() - statSync(dossier).mtimeMs > AGE_DES_ESSAIS_MS;
276
+ } catch {
277
+ retirer = false;
278
+ }
279
+ } else {
280
+ retirer = passeMorte(p);
281
+ }
282
+ if (retirer) {
283
+ rmSync(dossier, { recursive: true, force: true });
284
+ }
285
+ }
286
+ }
287
+
219
288
  /**
220
- * Opens the base of a pass of <genre> in <dans>, after sweeping the orphan bases there.
289
+ * Opens the base of a pass of <genre> in <dans>, after sweeping the orphan bases there, and the
290
+ * orphan trial directories under the home.
221
291
  * @param {string} genre what the pass is (`vitest`, `circuit`…), in the base's name
222
292
  * @param {{ dans?: string }} options `dans`, the directory of the base (`os.tmpdir()`)
223
293
  * @returns {{ base: string, dossier: string, env: Record<string, string>, restes: () => string[],
224
- * fermer: () => void }} the base; the directory its pass writes in; the variables that name it
225
- * to the pass's children (TMPDIR, TMP, TEMP); what is in it, sorted; and the removal of the base
294
+ * essais: () => string[], fermer: () => void }} the base; the directory its pass writes in; the
295
+ * variables that name it to the pass's children (TMPDIR, TMP, TEMP); what is in it, sorted; the
296
+ * names of the `grillhouse-essais-*` directories of the home's cache whose owner file names this
297
+ * pass, read at the call; and the removal of the base
226
298
  */
227
299
  export function ouvrirBase(genre, { dans = tmpdir() } = {}) {
228
300
  balayer(dans);
229
301
  balayerLesCaches(process.env);
302
+ balayerLesEssais(process.env);
230
303
  mkdirSync(dans, { recursive: true });
231
304
  const base = mkdtempSync(path.join(dans, `${PREFIXE}${genre}-`));
232
- writeFileSync(
233
- path.join(base, PROPRIETAIRE),
234
- `${JSON.stringify({ pid: process.pid, espace: espace() })}\n`
235
- );
305
+ const moi = { pid: process.pid, depart: departDe(process.pid), espace: espace() };
306
+ writeFileSync(path.join(base, PROPRIETAIRE), `${JSON.stringify(moi)}\n`);
236
307
  const dossier = path.join(base, 't');
237
308
  mkdirSync(dossier);
238
309
  return {
@@ -240,6 +311,14 @@ export function ouvrirBase(genre, { dans = tmpdir() } = {}) {
240
311
  dossier,
241
312
  env: Object.fromEntries(TEMPORAIRES.map(v => [v, dossier])),
242
313
  restes: () => contenu(dossier),
314
+ essais: () =>
315
+ contenu(cacheDeLaMaison()).filter(nom => {
316
+ if (!nom.startsWith(ESSAIS)) {
317
+ return false;
318
+ }
319
+ const p = proprietaire(path.join(cacheDeLaMaison(), nom));
320
+ return p?.pid === moi.pid && p.depart === moi.depart && p.espace === moi.espace;
321
+ }),
243
322
  fermer: () => rmSync(base, { recursive: true, force: true }),
244
323
  };
245
324
  }
@@ -257,7 +336,9 @@ const ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
257
336
  * @returns {{ base: string, dossier: string }} the base, and the directory its agents write in
258
337
  */
259
338
  export function ouvrirBaseDuTicket(ticket, { dans = tmpdir() } = {}) {
260
- if (!ID.test(ticket)) throw new Error(`⛔ « ${ticket} » n'est pas l'identifiant d'un ticket.`);
339
+ if (!ID.test(ticket)) {
340
+ throw new Error(`⛔ « ${ticket} » n'est pas l'identifiant d'un ticket.`);
341
+ }
261
342
  const base = path.join(dans, `${DU_TICKET}${ticket}`);
262
343
  const dossier = path.join(base, 't');
263
344
  mkdirSync(dossier, { recursive: true });
@@ -281,11 +362,17 @@ export function balayerLesTickets(fermes, { dans = tmpdir() } = {}) {
281
362
  .filter(n => n.startsWith(DU_TICKET))
282
363
  .map(n => ({ base: path.join(dans, n), ticket: proprietaire(path.join(dans, n))?.ticket }))
283
364
  .filter(b => typeof b.ticket === 'string');
284
- if (tickets.length === 0) return [];
365
+ if (tickets.length === 0) {
366
+ return [];
367
+ }
285
368
  const clos = fermes();
286
- if (clos === null) return [];
369
+ if (clos === null) {
370
+ return [];
371
+ }
287
372
  const retires = tickets.filter(b => clos.has(b.ticket));
288
- for (const b of retires) rmSync(b.base, { recursive: true, force: true });
373
+ for (const b of retires) {
374
+ rmSync(b.base, { recursive: true, force: true });
375
+ }
289
376
  return retires.map(b => b.ticket);
290
377
  }
291
378
 
@@ -342,9 +429,14 @@ export function cacheDeLaRacine(outil, racine, env = process.env, { creer = true
342
429
  const reelle = path.resolve(racine);
343
430
  const empreinte = createHash('sha256').update(reelle).digest('hex').slice(0, 16);
344
431
  const cache = path.join(dans, `${PREFIXE}${empreinte}`);
345
- if (!creer) return cache;
346
- if (enEnveloppe(env)) balayer(dans);
347
- else balayerLesCaches(env);
432
+ if (!creer) {
433
+ return cache;
434
+ }
435
+ if (enEnveloppe(env)) {
436
+ balayer(dans);
437
+ } else {
438
+ balayerLesCaches(env);
439
+ }
348
440
  mkdirSync(cache, { recursive: true });
349
441
  // A use renews it: its age counts from the last.
350
442
  const maintenant = new Date();
@@ -10,8 +10,8 @@
10
10
  // - The machine is at rest under SEUIL_PRESSION (25 %); at or above it, it is under load.
11
11
  // - A file that does not read (no pressure stall information on the machine) gives null: whoever
12
12
  // reads it says « pression illisible » and leaves the verdict to the runner of the tests.
13
- // - A_REPASSER, 75, is the exit code of « à repasser » (EX_TEMPFAIL of sysexits.h: try again
14
- // later), neither green nor red: the measure of time of each module of language gives it
13
+ // - A_REPASSER (scripts/codes-de-sortie.mjs), 75, is the exit code of « à repasser » (EX_TEMPFAIL
14
+ // of sysexits.h: try again later), neither green nor red: the measure of time of each module of language gives it
15
15
  // (scripts/langages/typescript/vitest-config/duree.reporter.mjs, the benches of the module cargo),
16
16
  // and the night reads it (scripts/nuit.sh). The day waits for no rest: `npm run verifier` takes a
17
17
  // task at 75 for a red (scripts/langages/typescript/verifier.mjs).
@@ -22,9 +22,9 @@
22
22
  // waits so before it plays its time budget benches again (scripts/nuit.sh).
23
23
  import { readFileSync } from 'node:fs';
24
24
  import { pathToFileURL } from 'node:url';
25
+ import { A_REPASSER } from '../codes-de-sortie.mjs';
25
26
 
26
27
  export const SEUIL_PRESSION = 25;
27
- export const A_REPASSER = 75;
28
28
  export const FICHIER_PRESSION = '/proc/pressure/cpu';
29
29
  // The longest wait for rest, and the shortest gap between two lines that say it waits.
30
30
  export const BORNE_ATTENTE_MS = 15 * 60_000;
@@ -64,9 +64,13 @@ export function attendreLeRepos({
64
64
  dire('⏳ pression CPU illisible : la relance part sans attendre, verdict des tests.');
65
65
  return true;
66
66
  }
67
- if (p < SEUIL_PRESSION) return true;
67
+ if (p < SEUIL_PRESSION) {
68
+ return true;
69
+ }
68
70
  const t = maintenant();
69
- if (t >= limite) return false;
71
+ if (t >= limite) {
72
+ return false;
73
+ }
70
74
  if (t - derniere >= ECART_LIGNES_MS) {
71
75
  const reste = Math.ceil((limite - t) / 60_000);
72
76
  dire(
@@ -85,7 +89,9 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
85
89
  } else {
86
90
  const dire = l => process.stdout.write(`${l}\n`);
87
91
  const repos = attendreLeRepos({ limite: Date.now() + BORNE_ATTENTE_MS, dire });
88
- if (!repos) dire(`⏳ pas de repos en ${BORNE_ATTENTE_MS / 60_000} min.`);
92
+ if (!repos) {
93
+ dire(`⏳ pas de repos en ${BORNE_ATTENTE_MS / 60_000} min.`);
94
+ }
89
95
  process.exitCode = repos ? 0 : A_REPASSER;
90
96
  }
91
97
  }
@@ -0,0 +1,21 @@
1
+ // The types of the measure of the machine (./mesure-de-la-machine.mjs), which the activity of the workflow of
2
+ // the machine under Temporal (src/temporal/places/activites.ts) imports.
3
+ import type { MesureDeLaMachine } from './regles-des-places.mjs';
4
+
5
+ /** The memory available now, in bytes. */
6
+ export function memoireDisponible(): number;
7
+
8
+ /** The machine now: its cores, its load over one minute, its free memory in bytes. */
9
+ export function mesureDeLaMachine(): MesureDeLaMachine;
10
+
11
+ /** The start of the process <pid> as the system gives it, null when it is gone. */
12
+ export function departDe(pid: number): string | null;
13
+
14
+ /** Whether the process <pid> lives and is the one of its start <depart>. */
15
+ export function processusVivant(p: { pid: number; depart: string | null }): boolean;
16
+
17
+ /** <signal> to the process group <groupe>; false when the group is gone. */
18
+ export function signalerGroupe(groupe: number | null | undefined, signal: NodeJS.Signals | 0): boolean;
19
+
20
+ /** Whether the group a sign of life <vie> names still runs, its leader dead or alive. */
21
+ export function groupeVivant(vie: { pid: number; depart?: string | null } | null | undefined): boolean;
@@ -0,0 +1,76 @@
1
+ // What the machine gives at a moment, which the admission of a start reads
2
+ // (scripts/regles-des-places.mjs): its cores, its load over one minute, its free memory. The
3
+ // activity of the workflow of the machine (src/temporal/places/activites.ts) measures it here, and
4
+ // whether the process of a place still lives; a signal to a process group, and whether the group
5
+ // a sign of life names still runs, which the sessions (scripts/seances.mjs), the circuit and the
6
+ // acts under Temporal (src/temporal/acte.ts) share.
7
+ import { readFileSync } from 'node:fs';
8
+ import { availableParallelism, freemem, loadavg } from 'node:os';
9
+ import { departDe, leMemeVivant, vivant } from './mesure/base-de-passe.mjs';
10
+
11
+ export { departDe };
12
+
13
+ /**
14
+ * The memory available now, in bytes (MemAvailable of the kernel, else the free memory of node).
15
+ * @returns {number}
16
+ */
17
+ export function memoireDisponible() {
18
+ try {
19
+ const kio = /^MemAvailable:\s+(\d+) kB/m.exec(readFileSync('/proc/meminfo', 'utf8'))?.[1];
20
+ if (kio) {
21
+ return Number(kio) * 1024;
22
+ }
23
+ } catch {
24
+ // no /proc/meminfo: the free memory of node
25
+ }
26
+ return freemem();
27
+ }
28
+
29
+ /**
30
+ * The machine now: `{ coeurs, charge, memoireLibre }`, the load over one minute, the memory in bytes.
31
+ * @returns {{ coeurs: number, charge: number, memoireLibre: number }}
32
+ */
33
+ export const mesureDeLaMachine = () => ({
34
+ coeurs: availableParallelism(),
35
+ charge: loadavg()[0],
36
+ memoireLibre: memoireDisponible(),
37
+ });
38
+
39
+ /**
40
+ * Whether the process <pid> lives and is the one of its start <depart> (`departDe`; any process
41
+ * of that number without a start): a place whose process is gone is free.
42
+ * @param {{ pid: number, depart: string | null }} p
43
+ * @returns {boolean}
44
+ */
45
+ export const processusVivant = ({ pid, depart }) =>
46
+ depart ? leMemeVivant(pid, depart) : vivant(pid);
47
+
48
+ /**
49
+ * <signal> to the process group <groupe>; false when the group is gone (or not the caller's).
50
+ * @param {number | null | undefined} groupe
51
+ * @param {NodeJS.Signals | 0} signal
52
+ * @returns {boolean}
53
+ */
54
+ export function signalerGroupe(groupe, signal) {
55
+ if (!groupe) {
56
+ return false;
57
+ }
58
+ try {
59
+ process.kill(-groupe, signal);
60
+ return true;
61
+ } catch {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Whether the group a sign of life <vie> names still runs: its group answers, and its leader, when
68
+ * it lives, is the process of its start (a number reused names another); a group whose leader died
69
+ * runs as long as one of its processes does.
70
+ * @param {{ pid: number, depart?: string | null } | null | undefined} vie
71
+ * @returns {boolean}
72
+ */
73
+ export const groupeVivant = vie =>
74
+ Boolean(vie?.pid) &&
75
+ signalerGroupe(vie.pid, 0) &&
76
+ (!vie.depart || !vivant(vie.pid) || leMemeVivant(vie.pid, vie.depart));
@@ -30,10 +30,14 @@ const PARAGRAPHE_DU_GREFFON =
30
30
  /** Brings the import of the common charter to the project's CLAUDE.md; returns what it did. */
31
31
  export function migrer(projet) {
32
32
  const fichier = path.join(projet, 'CLAUDE.md');
33
- if (!existsSync(fichier)) return [];
33
+ if (!existsSync(fichier)) {
34
+ return [];
35
+ }
34
36
  const texte = readFileSync(fichier, 'utf8');
35
37
  const imports = [...texte.matchAll(IMPORT_D_UNE_CHARTE)].map(m => `@${m[1]}`);
36
- if (imports.some(i => i !== ANCIENNE_COPIE)) return [];
38
+ if (imports.some(i => i !== ANCIENNE_COPIE)) {
39
+ return [];
40
+ }
37
41
  let neuf;
38
42
  if (imports.length > 0) {
39
43
  neuf = texte.replaceAll(ANCIENNE_COPIE, IMPORT);
@@ -27,9 +27,13 @@ const duCadre = crochet =>
27
27
  /** Removes the frame's former session hooks from the project's settings; returns what it did. */
28
28
  export function migrer(projet) {
29
29
  const f = path.join(projet, '.claude', 'settings.json');
30
- if (!existsSync(f)) return [];
30
+ if (!existsSync(f)) {
31
+ return [];
32
+ }
31
33
  const reglages = JSON.parse(readFileSync(f, 'utf8'));
32
- if (reglages.hooks === null || typeof reglages.hooks !== 'object') return [];
34
+ if (reglages.hooks === null || typeof reglages.hooks !== 'object') {
35
+ return [];
36
+ }
33
37
  const retires = [];
34
38
  const hooks = {};
35
39
  for (const [evenement, groupes] of Object.entries(reglages.hooks)) {
@@ -39,17 +43,30 @@ export function migrer(projet) {
39
43
  }
40
44
  const restants = groupes
41
45
  .map(g => {
42
- if (!Array.isArray(g?.hooks)) return g;
46
+ if (!Array.isArray(g?.hooks)) {
47
+ return g;
48
+ }
43
49
  const gardes = g.hooks.filter(c => !duCadre(c));
44
- for (const c of g.hooks) if (duCadre(c)) retires.push(`${evenement} : ${c.command}`);
50
+ for (const c of g.hooks) {
51
+ if (duCadre(c)) {
52
+ retires.push(`${evenement} : ${c.command}`);
53
+ }
54
+ }
45
55
  return gardes.length > 0 ? { ...g, hooks: gardes } : null;
46
56
  })
47
57
  .filter(g => g !== null);
48
- if (restants.length > 0) hooks[evenement] = restants;
58
+ if (restants.length > 0) {
59
+ hooks[evenement] = restants;
60
+ }
61
+ }
62
+ if (retires.length === 0) {
63
+ return [];
64
+ }
65
+ if (Object.keys(hooks).length > 0) {
66
+ reglages.hooks = hooks;
67
+ } else {
68
+ delete reglages.hooks;
49
69
  }
50
- if (retires.length === 0) return [];
51
- if (Object.keys(hooks).length > 0) reglages.hooks = hooks;
52
- else delete reglages.hooks;
53
70
  writeFileSync(f, `${JSON.stringify(reglages, null, 2)}\n`);
54
71
  return retires.map(r => `.claude/settings.json : crochet retiré, que le greffon porte (${r})`);
55
72
  }
@@ -49,17 +49,25 @@ const declareDuCadre = (n, e) =>
49
49
  // Takes the project's marketplace off the settings file <rel> of the project at <projet>.
50
50
  function retirerDesReglages(projet, rel) {
51
51
  const f = path.join(projet, rel);
52
- if (!existsSync(f)) return [];
52
+ if (!existsSync(f)) {
53
+ return [];
54
+ }
53
55
  const reglages = JSON.parse(readFileSync(f, 'utf8'));
54
56
  const marches = reglages.extraKnownMarketplaces;
55
- if (!marches || typeof marches !== 'object') return [];
57
+ if (!marches || typeof marches !== 'object') {
58
+ return [];
59
+ }
56
60
  const noms = Object.keys(marches).filter(n => declareDuCadre(n, marches[n]));
57
- if (noms.length === 0) return [];
61
+ if (noms.length === 0) {
62
+ return [];
63
+ }
58
64
  for (const n of noms) {
59
65
  delete marches[n];
60
66
  delete reglages.enabledPlugins?.[`grillhouse@${n}`];
61
67
  }
62
- if (Object.keys(marches).length === 0) delete reglages.extraKnownMarketplaces;
68
+ if (Object.keys(marches).length === 0) {
69
+ delete reglages.extraKnownMarketplaces;
70
+ }
63
71
  if (reglages.enabledPlugins && Object.keys(reglages.enabledPlugins).length === 0) {
64
72
  delete reglages.enabledPlugins;
65
73
  }
@@ -74,9 +82,13 @@ export function migrer(projet) {
74
82
  const manifeste = path.join(dossier, 'marketplace.json');
75
83
  if (existsSync(manifeste) && duCadre(lireJson(manifeste))) {
76
84
  rmSync(manifeste);
77
- if (readdirSync(dossier).length === 0) rmSync(dossier, { recursive: true });
85
+ if (readdirSync(dossier).length === 0) {
86
+ rmSync(dossier, { recursive: true });
87
+ }
78
88
  lignes.push('.claude-plugin/marketplace.json : place de marché du projet retirée');
79
89
  }
80
- for (const rel of REGLAGES) lignes.push(...retirerDesReglages(projet, rel));
90
+ for (const rel of REGLAGES) {
91
+ lignes.push(...retirerDesReglages(projet, rel));
92
+ }
81
93
  return lignes;
82
94
  }
@@ -68,7 +68,9 @@ const ANCIENS_CHEMINS = [
68
68
  // back to the former package's, or each name of the base back to one former path; none when it
69
69
  // wrote nothing.
70
70
  function formesAnterieures(texte) {
71
- if (texte.search(ECRIT) < 0) return [];
71
+ if (texte.search(ECRIT) < 0) {
72
+ return [];
73
+ }
72
74
  return [
73
75
  texte.replace(ECRIT, (_, q, mesure) => `${q}${ANCIEN}${mesure ?? ''}${q}`),
74
76
  ...ANCIENS_CHEMINS.map(c =>
@@ -80,9 +82,15 @@ function formesAnterieures(texte) {
80
82
  const hacher = octets => createHash('sha256').update(octets).digest('hex');
81
83
  const lireJson = f => JSON.parse(readFileSync(f, 'utf8'));
82
84
 
83
- // The subcommand that runs each script of the package, by the path of its former copy.
85
+ // The subcommand that runs each script of the package, by the path of its former copy; a former
86
+ // copy whose subcommand runs another script since (`circuit`, the client of the workflow of a
87
+ // ticket since 0.30.0, src/temporal/circuit/commande.ts) keeps its subcommand.
88
+ const DEPLACEES = [['scripts/circuit.mjs', 'circuit']];
84
89
  const parCopie = projet =>
85
- new Map(Object.entries(scriptsDesSousCommandes(projet)).map(([n, s]) => [`scripts/${s}`, n]));
90
+ new Map([
91
+ ...Object.entries(scriptsDesSousCommandes(projet)).map(([n, s]) => [`scripts/${s}`, n]),
92
+ ...DEPLACEES,
93
+ ]);
86
94
 
87
95
  // The lines of the list that keep a path: a file, or a directory « …/ ».
88
96
  const gardees = texte =>
@@ -95,17 +103,23 @@ const couvert = (lignes, f) => lignes.some(l => (l.endsWith('/') ? f.startsWith(
95
103
  // Whether the file at <absolu> has the fingerprint <attendue>, as copied or as 0.23.0 rewrote it.
96
104
  function intacte(absolu, attendue) {
97
105
  const octets = readFileSync(absolu);
98
- if (hacher(octets) === attendue) return true;
106
+ if (hacher(octets) === attendue) {
107
+ return true;
108
+ }
99
109
  return formesAnterieures(octets.toString('utf8')).some(t => hacher(t) === attendue);
100
110
  }
101
111
 
102
112
  // The files under the directory <rel> of <projet>, as paths from it.
103
113
  function fichiersSous(projet, rel) {
104
114
  const absolu = path.join(projet, rel);
105
- if (!existsSync(absolu)) return [];
115
+ if (!existsSync(absolu)) {
116
+ return [];
117
+ }
106
118
  return readdirSync(absolu, { withFileTypes: true }).flatMap(e => {
107
119
  const r = `${rel}/${e.name}`;
108
- if (e.isDirectory()) return fichiersSous(projet, r);
120
+ if (e.isDirectory()) {
121
+ return fichiersSous(projet, r);
122
+ }
109
123
  return e.isFile() ? [r] : [];
110
124
  });
111
125
  }
@@ -114,7 +128,9 @@ function fichiersSous(projet, rel) {
114
128
  function viderDossiers(projet, f) {
115
129
  for (let d = path.dirname(f); d !== '.'; d = path.dirname(d)) {
116
130
  const absolu = path.join(projet, d);
117
- if (!existsSync(absolu) || readdirSync(absolu).length > 0) return;
131
+ if (!existsSync(absolu) || readdirSync(absolu).length > 0) {
132
+ return;
133
+ }
118
134
  rmSync(absolu, { recursive: true });
119
135
  }
120
136
  }
@@ -123,7 +139,9 @@ function viderDossiers(projet, f) {
123
139
  export function migrer(projet) {
124
140
  const liste = path.join(projet, LISTE);
125
141
  const fEmpreintes = path.join(projet, EMPREINTES);
126
- if (!existsSync(liste) || !existsSync(fEmpreintes)) return [];
142
+ if (!existsSync(liste) || !existsSync(fEmpreintes)) {
143
+ return [];
144
+ }
127
145
  const lignes = gardees(readFileSync(liste, 'utf8'));
128
146
  const enregistres = Object.entries(lireJson(fEmpreintes).fichiers ?? {}).filter(
129
147
  ([f]) =>
@@ -142,7 +160,9 @@ export function migrer(projet) {
142
160
  sortie.push(ligne);
143
161
  };
144
162
  for (const [f, attendue] of enregistres) {
145
- if (!existsSync(path.join(projet, f))) continue;
163
+ if (!existsSync(path.join(projet, f))) {
164
+ continue;
165
+ }
146
166
  if (intacte(path.join(projet, f), attendue)) {
147
167
  retirer(f, `${f} : copie du cadre retirée, que le paquet porte`);
148
168
  } else if (!deRoleSupprime(f)) {
@@ -155,9 +175,13 @@ export function migrer(projet) {
155
175
  const espaces = new Set(paquets(projet).map(p => p.dossier));
156
176
  for (const d of lignes.filter(l => l.endsWith('/') && !l.startsWith(`${DOSSIER}/`))) {
157
177
  const dossier = d.replace(/\/$/, '');
158
- if (espaces.has(dossier)) continue;
178
+ if (espaces.has(dossier)) {
179
+ continue;
180
+ }
159
181
  for (const f of fichiersSous(projet, dossier)) {
160
- if (!GENERE.test(readFileSync(path.join(projet, f), 'utf8'))) continue;
182
+ if (!GENERE.test(readFileSync(path.join(projet, f), 'utf8'))) {
183
+ continue;
184
+ }
161
185
  retirer(f, `${f} : fichier engendré pour l'ancien espace de travail ${dossier}, retiré`);
162
186
  }
163
187
  }
@@ -174,12 +198,16 @@ export function migrer(projet) {
174
198
  }
175
199
 
176
200
  const fPkg = path.join(projet, 'package.json');
177
- if (!existsSync(fPkg)) return sortie;
201
+ if (!existsSync(fPkg)) {
202
+ return sortie;
203
+ }
178
204
  const pkg = lireJson(fPkg);
179
205
  const par = parCopie(projet);
180
206
  let reecrit = false;
181
207
  for (const [n, script] of Object.entries(pkg.scripts ?? {})) {
182
- if (typeof script !== 'string') continue;
208
+ if (typeof script !== 'string') {
209
+ continue;
210
+ }
183
211
  const neuf = script.replace(APPEL, (tout, avant, f) =>
184
212
  retires.has(f) && par.has(f) ? `${avant}grillhouse ${par.get(f)}` : tout
185
213
  );
@@ -202,16 +230,26 @@ export function migrer(projet) {
202
230
  });
203
231
  }
204
232
  }
205
- if (reecrit) writeFileSync(fPkg, `${JSON.stringify(pkg, null, 2)}\n`);
233
+ if (reecrit) {
234
+ writeFileSync(fPkg, `${JSON.stringify(pkg, null, 2)}\n`);
235
+ }
206
236
 
207
237
  const duPaquet = Object.keys(lireJson(path.join(PAQUET, 'package.json')).dependencies ?? {});
208
238
  const gabarit = lireJson(path.join(CADRE, GABARIT, 'package.json'));
209
239
  const textes = sources(projet).map(f => readFileSync(path.join(projet, f), 'utf8'));
210
240
  for (const dep of duPaquet.filter(d => d !== DU_PAQUET)) {
211
- if (!CHAMPS.some(c => pkg[c]?.[dep] !== undefined)) continue;
212
- if (CHAMPS.some(c => gabarit[c]?.[dep] !== undefined)) continue;
213
- if (![...retires.values()].some(t => importe(t, dep))) continue;
214
- if (textes.some(t => importe(t, dep))) continue;
241
+ if (!CHAMPS.some(c => pkg[c]?.[dep] !== undefined)) {
242
+ continue;
243
+ }
244
+ if (CHAMPS.some(c => gabarit[c]?.[dep] !== undefined)) {
245
+ continue;
246
+ }
247
+ if (![...retires.values()].some(t => importe(t, dep))) {
248
+ continue;
249
+ }
250
+ if (textes.some(t => importe(t, dep))) {
251
+ continue;
252
+ }
215
253
  sortie.push(dependanceDuPaquet(dep));
216
254
  }
217
255
  return sortie;
@@ -30,10 +30,14 @@ const REMPLACEMENTS = [
30
30
  /** Brings the rule of the tri to the project's issue-tracker.md; returns what it did. */
31
31
  export function migrer(projet) {
32
32
  const fichier = path.join(projet, FICHIER);
33
- if (!existsSync(fichier)) return [];
33
+ if (!existsSync(fichier)) {
34
+ return [];
35
+ }
34
36
  const texte = readFileSync(fichier, 'utf8');
35
37
  const neuf = REMPLACEMENTS.reduce((t, [ancien, nouveau]) => t.replace(ancien, nouveau), texte);
36
- if (neuf === texte) return [];
38
+ if (neuf === texte) {
39
+ return [];
40
+ }
37
41
  writeFileSync(fichier, neuf);
38
42
  return [
39
43
  `${FICHIER} : une découverte reçoit son verdict au tri des découvertes, en fin de ticket, au lieu de se rouvrir sur le mot du responsable`,