@roomi-fields/grillhouse 0.28.3 → 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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +128 -26
  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/README.md +11 -11
  7. package/cadre/templates/projet/_gitignore +2 -5
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/projet/package.json +2 -2
  10. package/charte.md +37 -4
  11. package/dist/temporal/acte.d.ts +24 -0
  12. package/dist/temporal/acte.js +139 -0
  13. package/dist/temporal/acte.js.map +1 -0
  14. package/dist/temporal/attributs.d.ts +6 -0
  15. package/dist/temporal/attributs.js +15 -0
  16. package/dist/temporal/attributs.js.map +1 -0
  17. package/dist/temporal/circuit/activites.d.ts +13 -0
  18. package/dist/temporal/circuit/activites.js +33 -0
  19. package/dist/temporal/circuit/activites.js.map +1 -0
  20. package/dist/temporal/circuit/client.d.ts +72 -0
  21. package/dist/temporal/circuit/client.js +247 -0
  22. package/dist/temporal/circuit/client.js.map +1 -0
  23. package/dist/temporal/circuit/commande.d.ts +2 -0
  24. package/dist/temporal/circuit/commande.js +238 -0
  25. package/dist/temporal/circuit/commande.js.map +1 -0
  26. package/dist/temporal/circuit/contrat.d.ts +305 -0
  27. package/dist/temporal/circuit/contrat.js +24 -0
  28. package/dist/temporal/circuit/contrat.js.map +1 -0
  29. package/dist/temporal/circuit/deroule.d.ts +3 -0
  30. package/dist/temporal/circuit/deroule.js +540 -0
  31. package/dist/temporal/circuit/deroule.js.map +1 -0
  32. package/dist/temporal/client.d.ts +47 -0
  33. package/dist/temporal/client.js +69 -0
  34. package/dist/temporal/client.js.map +1 -0
  35. package/dist/temporal/commande.d.ts +2 -0
  36. package/dist/temporal/commande.js +95 -0
  37. package/dist/temporal/commande.js.map +1 -0
  38. package/dist/temporal/deroules.d.ts +5 -0
  39. package/dist/temporal/deroules.js +10 -0
  40. package/dist/temporal/deroules.js.map +1 -0
  41. package/dist/temporal/etat.d.ts +33 -0
  42. package/dist/temporal/etat.js +59 -0
  43. package/dist/temporal/etat.js.map +1 -0
  44. package/dist/temporal/file/activites.d.ts +10 -0
  45. package/dist/temporal/file/activites.js +25 -0
  46. package/dist/temporal/file/activites.js.map +1 -0
  47. package/dist/temporal/file/client.d.ts +4 -0
  48. package/dist/temporal/file/client.js +6 -0
  49. package/dist/temporal/file/client.js.map +1 -0
  50. package/dist/temporal/file/contrat.d.ts +158 -0
  51. package/dist/temporal/file/contrat.js +14 -0
  52. package/dist/temporal/file/contrat.js.map +1 -0
  53. package/dist/temporal/file/deroule.d.ts +15 -0
  54. package/dist/temporal/file/deroule.js +235 -0
  55. package/dist/temporal/file/deroule.js.map +1 -0
  56. package/dist/temporal/installation.d.ts +124 -0
  57. package/dist/temporal/installation.js +408 -0
  58. package/dist/temporal/installation.js.map +1 -0
  59. package/dist/temporal/places/activites.d.ts +8 -0
  60. package/dist/temporal/places/activites.js +13 -0
  61. package/dist/temporal/places/activites.js.map +1 -0
  62. package/dist/temporal/places/client.d.ts +28 -0
  63. package/dist/temporal/places/client.js +64 -0
  64. package/dist/temporal/places/client.js.map +1 -0
  65. package/dist/temporal/places/contrat.d.ts +106 -0
  66. package/dist/temporal/places/contrat.js +21 -0
  67. package/dist/temporal/places/contrat.js.map +1 -0
  68. package/dist/temporal/places/deroule.d.ts +3 -0
  69. package/dist/temporal/places/deroule.js +198 -0
  70. package/dist/temporal/places/deroule.js.map +1 -0
  71. package/dist/temporal/sonde/activites.d.ts +6 -0
  72. package/dist/temporal/sonde/activites.js +52 -0
  73. package/dist/temporal/sonde/activites.js.map +1 -0
  74. package/dist/temporal/sonde/contrat.d.ts +35 -0
  75. package/dist/temporal/sonde/contrat.js +10 -0
  76. package/dist/temporal/sonde/contrat.js.map +1 -0
  77. package/dist/temporal/sonde/deroule.d.ts +3 -0
  78. package/dist/temporal/sonde/deroule.js +39 -0
  79. package/dist/temporal/sonde/deroule.js.map +1 -0
  80. package/dist/temporal/tickets/activites.d.ts +7 -0
  81. package/dist/temporal/tickets/activites.js +81 -0
  82. package/dist/temporal/tickets/activites.js.map +1 -0
  83. package/dist/temporal/tickets/client.d.ts +10 -0
  84. package/dist/temporal/tickets/client.js +31 -0
  85. package/dist/temporal/tickets/client.js.map +1 -0
  86. package/dist/temporal/tickets/contrat.d.ts +56 -0
  87. package/dist/temporal/tickets/contrat.js +13 -0
  88. package/dist/temporal/tickets/contrat.js.map +1 -0
  89. package/dist/temporal/tickets/deroule.d.ts +3 -0
  90. package/dist/temporal/tickets/deroule.js +94 -0
  91. package/dist/temporal/tickets/deroule.js.map +1 -0
  92. package/dist/temporal/travailleur.d.ts +2 -0
  93. package/dist/temporal/travailleur.js +69 -0
  94. package/dist/temporal/travailleur.js.map +1 -0
  95. package/docs/ARCHITECTURE.md +813 -53
  96. package/docs/CADRE.md +17 -0
  97. package/docs/INTERFACE.md +161 -30
  98. package/hooks/crochet.mjs +19 -2
  99. package/hooks/hooks.json +11 -0
  100. package/package.json +16 -4
  101. package/scripts/activites.mjs +2182 -0
  102. package/scripts/aiguillage.d.mts +37 -0
  103. package/scripts/aiguillage.mjs +328 -0
  104. package/scripts/avancement.mjs +159 -64
  105. package/scripts/bilan.mjs +37 -19
  106. package/scripts/cadre.mjs +11 -2
  107. package/scripts/circuit.mjs +888 -3654
  108. package/scripts/circuits-cles.d.mts +4 -0
  109. package/scripts/circuits-cles.mjs +21 -0
  110. package/scripts/circuits-du-serveur.mjs +105 -0
  111. package/scripts/codes-de-sortie.mjs +9 -0
  112. package/scripts/commandes-composees.mjs +45 -41
  113. package/scripts/commandes-du-path.d.mts +7 -0
  114. package/scripts/commandes-du-path.mjs +25 -0
  115. package/scripts/composition-des-langages.mjs +30 -11
  116. package/scripts/conformite.mjs +19 -10
  117. package/scripts/copies-finies.mjs +188 -42
  118. package/scripts/depart-du-ticket.d.mts +53 -0
  119. package/scripts/depart-du-ticket.mjs +124 -0
  120. package/scripts/dependances-internes.mjs +115 -0
  121. package/scripts/dernier-vert.mjs +7 -15
  122. package/scripts/donnees-cles.mjs +228 -0
  123. package/scripts/droits.mjs +11 -1
  124. package/scripts/effets.mjs +352 -0
  125. package/scripts/enveloppe/enveloppe.mjs +119 -8
  126. package/scripts/enveloppe/lancer.sh +27 -32
  127. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  128. package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
  129. package/scripts/etapes.mjs +6 -3
  130. package/scripts/faits-du-circuit.mjs +493 -0
  131. package/scripts/file-des-tickets.d.mts +21 -0
  132. package/scripts/file-des-tickets.mjs +58 -0
  133. package/scripts/flux-des-paquets.mjs +187 -0
  134. package/scripts/fusion-du-changelog.mjs +0 -1
  135. package/scripts/gardes-du-cadre.mjs +12 -2
  136. package/scripts/grillhouse-maj.mjs +16 -7
  137. package/scripts/integration/file.mjs +477 -422
  138. package/scripts/integration/integrer.mjs +20 -22
  139. package/scripts/integration/rejeu.mjs +19 -4
  140. package/scripts/jointure.d.ts +168 -28
  141. package/scripts/langages/cargo/commandes.mjs +426 -119
  142. package/scripts/langages/cargo/composants.mjs +187 -3
  143. package/scripts/langages/cargo/exemples.mjs +75 -17
  144. package/scripts/langages/cargo/index.mjs +32 -13
  145. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  146. package/scripts/langages/cargo/sccache.mjs +62 -16
  147. package/scripts/langages/cargo/squelette.mjs +72 -3
  148. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  149. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  150. package/scripts/langages/python/commandes.mjs +232 -79
  151. package/scripts/langages/python/composants.mjs +65 -3
  152. package/scripts/langages/python/exemples.mjs +21 -12
  153. package/scripts/langages/python/index.mjs +25 -5
  154. package/scripts/langages/python/lot.mjs +1 -36
  155. package/scripts/langages/python/squelette.mjs +119 -17
  156. package/scripts/langages/typescript/construire.mjs +6 -163
  157. package/scripts/langages/typescript/exemples.mjs +19 -11
  158. package/scripts/langages/typescript/frontieres.mjs +1 -1
  159. package/scripts/langages/typescript/index.mjs +48 -63
  160. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  161. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  162. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  163. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  164. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  165. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  166. package/scripts/langages/typescript/squelette.mjs +18 -2
  167. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  168. package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
  169. package/scripts/langages/typescript/tests.mjs +17 -8
  170. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  171. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  172. package/scripts/langages/typescript/verdict.mjs +1 -1
  173. package/scripts/langages/typescript/verifier.mjs +110 -296
  174. package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
  175. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  176. package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
  177. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  178. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  179. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  180. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
  181. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
  182. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  183. package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
  184. package/scripts/lecture-unique.mjs +51 -0
  185. package/scripts/mesure/pression.mjs +11 -9
  186. package/scripts/mesure-de-la-machine.d.mts +21 -0
  187. package/scripts/mesure-de-la-machine.mjs +76 -0
  188. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  189. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  190. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  191. package/scripts/migrations.mjs +5 -0
  192. package/scripts/nuit.sh +29 -15
  193. package/scripts/outil.mjs +72 -0
  194. package/scripts/outils-cles.d.mts +24 -0
  195. package/scripts/outils-cles.mjs +0 -1
  196. package/scripts/paquet-npm.mjs +147 -0
  197. package/scripts/paquet.mjs +112 -14
  198. package/scripts/paquets.mjs +34 -6
  199. package/scripts/passe-de-la-machine.mjs +66 -0
  200. package/scripts/places-de-la-machine.mjs +360 -0
  201. package/scripts/places-du-serveur.mjs +170 -0
  202. package/scripts/prefixe-des-tickets.mjs +68 -0
  203. package/scripts/preparation.mjs +10 -3
  204. package/scripts/registre.mjs +3 -2
  205. package/scripts/regles-des-places.d.mts +36 -0
  206. package/scripts/regles-des-places.mjs +70 -0
  207. package/scripts/reponses-du-circuit.d.mts +6 -0
  208. package/scripts/reponses-du-circuit.mjs +28 -0
  209. package/scripts/resultats.mjs +29 -14
  210. package/scripts/retirer-les-copies-finies.mjs +25 -0
  211. package/scripts/sans-reponse.d.mts +4 -0
  212. package/scripts/sans-reponse.mjs +13 -0
  213. package/scripts/seances.mjs +918 -0
  214. package/scripts/services-du-noyau.mjs +28 -11
  215. package/scripts/session-start.sh +10 -1
  216. package/scripts/sortie.mjs +23 -4
  217. package/scripts/sources.mjs +3 -3
  218. package/scripts/sous-commandes.mjs +39 -9
  219. package/scripts/style-a-l-ecriture.mjs +229 -0
  220. package/scripts/superviseur.mjs +382 -16
  221. package/scripts/tableau.mjs +329 -130
  222. package/scripts/taches-du-graphe.mjs +328 -0
  223. package/scripts/ticket-du-circuit.mjs +206 -0
  224. package/scripts/transitions.d.mts +148 -0
  225. package/scripts/transitions.mjs +901 -0
  226. package/scripts/verrou-de-fichier.mjs +2 -2
  227. package/scripts/verrou-de-machine.mjs +322 -62
  228. package/skills/developpeur/SKILL.md +11 -3
  229. package/skills/explorateur/SKILL.md +2 -1
  230. package/skills/pitmaster/SKILL.md +62 -28
  231. package/skills/pitmaster/references/consigne-agent.md +5 -1
  232. package/skills/release/SKILL.md +3 -3
  233. package/skills/relecteur/SKILL.md +22 -8
  234. package/skills/testwriter/SKILL.md +47 -39
  235. package/scripts/demon.mjs +0 -138
  236. package/scripts/integration/file-attente.mjs +0 -61
  237. package/scripts/langages/cargo/touches.mjs +0 -93
  238. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -0,0 +1,4 @@
1
+ // The types of the reading of the key `grillhouse.circuits` (./circuits-cles.mjs).
2
+
3
+ /** The number of circuits at once (1 when absent), or the fault by its name. */
4
+ export function reglageDesCircuits(pkg: unknown): { max: number | null; faute: string | null };
@@ -0,0 +1,21 @@
1
+ // The reading of the key `grillhouse.circuits` of a package.json (grillhouse-4nr.9, decision D9,
2
+ // the owner's word of 2026-11-04), read as written: an integer of 1 or more, the number of
3
+ // circuits of the project that run at once, which the queue of its tickets
4
+ // (src/temporal/tickets/) holds; absent or null, 1. Any other value is a fault, which the queue
5
+ // names before any work.
6
+
7
+ // Returns { max, faute }: `max` the number of circuits at once, null on a fault; `faute` the
8
+ // fault by its name, null when the key reads.
9
+ export function reglageDesCircuits(pkg) {
10
+ const c = pkg?.grillhouse?.circuits;
11
+ if (c === undefined || c === null) {
12
+ return { max: 1, faute: null };
13
+ }
14
+ if (!Number.isInteger(c) || c < 1) {
15
+ return {
16
+ max: null,
17
+ faute: `grillhouse.circuits vaut ${JSON.stringify(c)}, pas un entier ≥ 1.`,
18
+ };
19
+ }
20
+ return { max: c, faute: null };
21
+ }
@@ -0,0 +1,105 @@
1
+ // The circuits of a repository as the board (scripts/tableau.mjs) and the supervisor
2
+ // (scripts/superviseur.mjs) read them: one call to the Temporal server (src/temporal/circuit/
3
+ // client.ts `lireLesCircuits`, the memo and the status of each workflow, no worker living), as the
4
+ // UI of Temporal lists its workflows, and the progress of the pass under way of each one that runs,
5
+ // read in its working directory (scripts/avancement.mjs `avancementDuTravail`).
6
+ import { existsSync } from 'node:fs';
7
+ import path from 'node:path';
8
+ import { avancementDuTravail } from './avancement.mjs';
9
+ import { sansReponseEn } from './sans-reponse.mjs';
10
+
11
+ /**
12
+ * A circuit as the server gives it (`CircuitLu` of src/temporal/circuit/client.ts) with its
13
+ * progress and the page of its workflow on the web UI of the server (`lien`).
14
+ * @typedef {import('../dist/temporal/circuit/client.js').CircuitLu & { avancement: ReturnType<typeof avancementDuTravail>, lien?: string }} CircuitDuServeur
15
+ */
16
+
17
+ /**
18
+ * The circuits <circuits> of the repository at <racine>, each with the progress of its pass under
19
+ * way while it runs (`avancement`, in `.claude/worktrees/<ticket>.travail`, null without one).
20
+ * @template {{ ticket: string, vivant: boolean }} C
21
+ * @param {string} racine
22
+ * @param {C[]} circuits
23
+ * @returns {(C & { avancement: ReturnType<typeof avancementDuTravail> })[]}
24
+ */
25
+ export const avecLeurAvancement = (racine, circuits) =>
26
+ circuits.map(c => ({
27
+ ...c,
28
+ avancement: c.vivant
29
+ ? avancementDuTravail(path.join(racine, '.claude', 'worktrees', `${c.ticket}.travail`))
30
+ : null,
31
+ }));
32
+
33
+ // The built client of the package (`dist/`), which a fresh clone has unbuilt.
34
+ const CONSTRUIT = path.join(import.meta.dirname, '..', 'dist', 'temporal', 'circuit', 'client.js');
35
+
36
+ /** The client of the circuits is not built: the reading names the command that builds it. */
37
+ export class ClientNonConstruit extends Error {
38
+ constructor() {
39
+ super(
40
+ `le client Temporal n'est pas construit (${CONSTRUIT} n'existe pas) : la construction du paquet le pose, \`npm run build --workspace @roomi-fields/grillhouse\``
41
+ );
42
+ this.name = 'ClientNonConstruit';
43
+ }
44
+ }
45
+
46
+ // How long the reading waits for the server: a guard, far above a reading's few milliseconds, so
47
+ // that a server down keeps neither the board nor the opening of a session waiting (the client's
48
+ // own retries last some twenty seconds).
49
+ export const DELAI_MS = 5_000;
50
+
51
+ /** What a reading that waited DELAI_MS in vain says: « Temporal ne répond pas en 5 s ». */
52
+ export const SANS_REPONSE_EN = sansReponseEn(DELAI_MS);
53
+
54
+ // The gRPC statuses of a server that does not answer in time: none listens (UNAVAILABLE, 14), or
55
+ // none answers within the delay (DEADLINE_EXCEEDED, 4), a server slow under load as a port closed.
56
+ const SANS_REPONSE = new Set([4, 14]);
57
+
58
+ /** The server at <adresse> did not answer the reading of the circuits within DELAI_MS. */
59
+ export class ServeurMuet extends Error {
60
+ /**
61
+ * @param {string} adresse
62
+ * @param {unknown} cause
63
+ */
64
+ constructor(adresse, cause) {
65
+ super(`${SANS_REPONSE_EN} sur ${adresse}`, { cause });
66
+ this.name = 'ServeurMuet';
67
+ this.adresse = adresse;
68
+ }
69
+ }
70
+
71
+ // Whether <e>, an error of the client, says that the server did not answer: its gRPC status, on
72
+ // itself or its cause (a `ServiceError` of the client carries the gRPC error as its cause).
73
+ const sansReponse = e =>
74
+ [e, e?.cause].some(x => typeof x?.code === 'number' && SANS_REPONSE.has(x.code));
75
+
76
+ /**
77
+ * The circuits of the repository at <racine>, read from the Temporal server of the environment in
78
+ * one call, with their progress (`avecLeurAvancement`) and the page of each one's workflow on the
79
+ * web UI of the server (`lienDuTableauWeb`). A server that does not answer within
80
+ * DELAI_MS throws `ServeurMuet`, which its caller tells from a repository without circuits and
81
+ * from any other fault, thrown as it is; a client not built throws `ClientNonConstruit`.
82
+ * @param {string} racine
83
+ */
84
+ export async function circuitsDuServeur(racine) {
85
+ if (!existsSync(CONSTRUIT)) {
86
+ throw new ClientNonConstruit();
87
+ }
88
+ const { lienDuTableauWeb, ouvrirLeClient } = await import('../dist/temporal/client.js');
89
+ const { lireLesCircuits } = await import('../dist/temporal/circuit/client.js');
90
+ const { idDuCircuit } = await import('../dist/temporal/circuit/contrat.js');
91
+ const c = ouvrirLeClient();
92
+ try {
93
+ const lus = await c.client.connection.withDeadline(Date.now() + DELAI_MS, () =>
94
+ lireLesCircuits(c.client, racine)
95
+ );
96
+ return avecLeurAvancement(racine, lus).map(x => ({
97
+ ...x,
98
+ lien: lienDuTableauWeb(c.adresse, c.client.options.namespace, idDuCircuit(racine, x.ticket)),
99
+ }));
100
+ } catch (e) {
101
+ throw sansReponse(e) ? new ServeurMuet(c.adresse, e) : e;
102
+ } finally {
103
+ await c.fermer();
104
+ }
105
+ }
@@ -0,0 +1,9 @@
1
+ // The exit codes the frame's processes share, with no input nor output, as sysexits.h names them:
2
+ // a module a pure module (scripts/etapes.mjs, scripts/transitions.mjs) imports with no reading of
3
+ // the machine.
4
+ //
5
+ // - A_REPASSER, 75, is the exit code of « à repasser » (EX_TEMPFAIL of sysexits.h: try again
6
+ // later), neither green nor red: a measure of time under load (scripts/mesure/pression.mjs), the
7
+ // wait of the lock of the machine at its bound (scripts/verrou-de-machine.mjs), a stop of the
8
+ // circuit that a gesture settles (scripts/etapes.mjs, ARRETS).
9
+ export const A_REPASSER = 75;
@@ -13,25 +13,29 @@
13
13
  // results directory included (`GRILLHOUSE_RESULTATS`), where each module writes under names of
14
14
  // its own. A line on the error stream names each module before it plays, so that what a
15
15
  // command prints on its standard output stays its own.
16
- // - `tester`: an argument that begins with « - » is an option, given to every module; any other is
16
+ // - `tester`, `tests-du-paquet`, `construire` and `typer` (the last three: one package, as the
17
+ // scripts of its package.json call them): an argument that begins with « - » is an option, given to every module; any other is
17
18
  // a path from the root, given to the module of the component that holds it
18
19
  // (`moduleDuFichier`), or out of every component to the first module whose rule of a test file
19
20
  // judges it (`estUnTest`). With paths, the modules that receive none do not play. A path no
20
21
  // module takes is refused, named, and nothing plays (code 2).
21
- // - The last green (scripts/dernier-vert.mjs) is kept once, after the last module: while the
22
- // modules play, a module green defers its own (`VERT_DIFFERE`); when every module played green
23
- // and each deferred one, the first deferred is kept, the state of the repository when the pass
24
- // began. A pass with one module red keeps none, so that the next pass plays its changes again.
22
+ // - The launcher's `construire --echec <fichier> <plan>` is one implementation for every language
23
+ // (scripts/taches-du-graphe.mjs): the first module plays it, once.
24
+ // - No green is kept here, and no module is given one to defer: the last green
25
+ // (scripts/dernier-vert.mjs) is kept by the one pass of the verification, once, when every task
26
+ // of every language of the graph is green (scripts/langages/typescript/verifier.mjs). A module
27
+ // that plays after a red one gets `PASSE_ROUGE` in its environment: that pass keeps none.
28
+ // - `verifier`: the module of package.json passes over the whole graph (every task of every
29
+ // language, once); the others get `GRAPHE_JOUE` and play no task of it again (cargo: its
30
+ // `deny check` alone), so that nextest and pytest play once.
25
31
  // - The exit code: 0 when every module is green, 75 when the only reds are « à repasser », else the
26
32
  // first other code; 128 plus the number of a signal that ended a module.
27
33
  import { spawnSync } from 'node:child_process';
28
- import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
29
- import { constants, tmpdir } from 'node:os';
30
- import path from 'node:path';
34
+ import { constants } from 'node:os';
31
35
  import { fileURLToPath, pathToFileURL } from 'node:url';
32
36
  import { moduleDuFichier } from './composition-des-langages.mjs';
33
- import { garderLeVert, VERT_DIFFERE } from './dernier-vert.mjs';
34
37
  import { langagesDe } from './langages.mjs';
38
+ import { GRAPHE_JOUE, PASSE_ROUGE } from './taches-du-graphe.mjs';
35
39
 
36
40
  /** This script, the one every composed command runs. */
37
41
  export const SCRIPT = fileURLToPath(import.meta.url);
@@ -46,10 +50,19 @@ export const unir = codes =>
46
50
  codes.find(c => c !== 0 && c !== A_REPASSER) ??
47
51
  (codes.some(c => c === A_REPASSER) ? A_REPASSER : 0);
48
52
 
53
+ // The commands whose path arguments go to the module of the component that holds each.
54
+ const PAR_CHEMIN = ['tester', 'tests-du-paquet', 'construire', 'typer'];
55
+
49
56
  // The arguments of each module of <modules> for the command <nom>: `{ parts: [{ module, args }] }`,
50
57
  // or `{ refus }`, the paths no module takes.
51
58
  function repartir(nom, args, modules, racine) {
52
- if (nom !== 'tester') {
59
+ // `construire` and `typer` name a package by its path, as `tester`.
60
+ // The launcher's build is one implementation for every language (scripts/taches-du-graphe.mjs): it
61
+ // plays once, by the first module, not once per module (each would build the same copy again).
62
+ if (nom === 'construire' && args.includes('--echec')) {
63
+ return { parts: modules.slice(0, 1).map(module => ({ module, args })) };
64
+ }
65
+ if (!PAR_CHEMIN.includes(nom)) {
53
66
  return { parts: modules.map(module => ({ module, args })) };
54
67
  }
55
68
  const estChemin = a => !a.startsWith('-');
@@ -109,40 +122,31 @@ export function jouer(
109
122
  }
110
123
  return 2;
111
124
  }
112
- const dossier = mkdtempSync(path.join(tmpdir(), 'grillhouse-vert-differe-'));
113
- const differe = path.join(dossier, 'verts');
114
- try {
115
- const codes = r.parts.map(({ module, args: siens }) => {
116
- const c = module.commandes(racine)[nom];
117
- dire(`▶ ${module.nom} : ${nom}`);
118
- const p = spawnSync(process.execPath, [c.script, ...c.args, ...siens], {
119
- cwd: racine,
120
- stdio: 'inherit',
121
- env: { ...env, [VERT_DIFFERE]: differe },
122
- });
123
- if (p.error) {
124
- process.stderr.write(`⛔ ${module.nom} : ${nom} : ${p.error.message}\n`);
125
- return 1;
126
- }
127
- return p.status ?? 128 + (constants.signals[p.signal ?? 'SIGTERM'] ?? 0);
125
+ // A module that plays after a red one is told so (PASSE_ROUGE): the one pass of the verification
126
+ // keeps no green then.
127
+ const codes = [];
128
+ const duGraphe = r.parts.find(x => x.module.manifeste === 'package.json')?.module;
129
+ for (const { module, args: siens } of r.parts) {
130
+ const c = module.commandes(racine)[nom];
131
+ dire(`▶ ${module.nom} : ${nom}`);
132
+ const rouge = codes.some(x => x !== 0);
133
+ const p = spawnSync(process.execPath, [c.script, ...c.args, ...siens], {
134
+ cwd: racine,
135
+ stdio: 'inherit',
136
+ env: {
137
+ ...env,
138
+ ...(rouge ? { [PASSE_ROUGE]: '1' } : {}),
139
+ ...(nom === 'verifier' && module !== duGraphe && duGraphe ? { [GRAPHE_JOUE]: '1' } : {}),
140
+ },
128
141
  });
129
- const code = unir(codes);
130
- let verts = [];
131
- try {
132
- verts = readFileSync(differe, 'utf8')
133
- .split('\n')
134
- .filter(Boolean)
135
- .map(l => JSON.parse(l));
136
- } catch {
137
- verts = [];
138
- }
139
- if (code === 0 && verts.length > 0 && verts.length === r.parts.length) {
140
- garderLeVert(verts[0], {});
142
+ if (p.error) {
143
+ process.stderr.write(`⛔ ${module.nom} : ${nom} : ${p.error.message}\n`);
144
+ codes.push(1);
145
+ } else {
146
+ codes.push(p.status ?? 128 + (constants.signals[p.signal ?? 'SIGTERM'] ?? 0));
141
147
  }
142
- return code;
143
- } finally {
144
- rmSync(dossier, { recursive: true, force: true });
145
148
  }
149
+ return unir(codes);
146
150
  }
147
151
 
148
152
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
@@ -0,0 +1,7 @@
1
+ // The types of ./commandes-du-path.mjs, for the frame's TypeScript (src/temporal/installation.ts).
2
+
3
+ /** The path of the command <nom> in the PATH of <env>, or null. */
4
+ export function trouverDansLePath(
5
+ nom: string,
6
+ env?: Record<string, string | undefined>
7
+ ): string | null;
@@ -0,0 +1,25 @@
1
+ // The search of a command in the PATH, as `command -v` finds it: the first folder of PATH that
2
+ // holds an executable file of its name. The one search of the core, which the installation of
3
+ // Temporal (src/temporal/installation.ts), the preparation of a project (./preparation.mjs) and
4
+ // the modules of language (by ./services-du-noyau.mjs) call.
5
+ import { accessSync, constants } from 'node:fs';
6
+ import path from 'node:path';
7
+
8
+ /**
9
+ * The path of the command <nom> in the PATH of <env>, or null.
10
+ * @param {string} nom
11
+ * @param {Record<string, string | undefined>} [env]
12
+ * @returns {string | null}
13
+ */
14
+ export function trouverDansLePath(nom, env = process.env) {
15
+ for (const d of (env.PATH ?? '').split(path.delimiter).filter(Boolean)) {
16
+ const f = path.join(d, nom);
17
+ try {
18
+ accessSync(f, constants.X_OK);
19
+ return f;
20
+ } catch {
21
+ // not in this folder
22
+ }
23
+ }
24
+ return null;
25
+ }
@@ -8,7 +8,8 @@
8
8
  // is refused, named with both languages: a package has one language. A file belongs to the
9
9
  // module of the component that holds it, the deepest (`moduleDuFichier`); a file out of every
10
10
  // component stays the core's, as with one language: the first module, in the order of the
11
- // declaration, whose answer is not null judges it (`estUnTest`, `manifestes.horsDesTests`).
11
+ // declaration, whose answer is not null judges it (`estUnTest`, `soeurDAvant`, `arbreDAvant`,
12
+ // `testsDeHead`, `manifestes.horsDesTests`).
12
13
  // - Whether a component plays tests, the readers of components and the components touched are
13
14
  // each module's on its own components, the results joined: a name without supplier is without
14
15
  // supplier in every module, a file out of the graph is out of every module's graph.
@@ -30,6 +31,7 @@
30
31
  import { existsSync, readFileSync } from 'node:fs';
31
32
  import path from 'node:path';
32
33
  import { fileURLToPath } from 'node:url';
34
+ import { luUneFois } from './lecture-unique.mjs';
33
35
 
34
36
  // The scripts of the commands above the composition, named by their paths, never imported: the
35
37
  // one that plays a composed command (./commandes-composees.mjs), and the index of the interfaces
@@ -102,6 +104,15 @@ const sous = (dossier, abs) => abs === dossier || abs.startsWith(`${dossier}${pa
102
104
  * @param {string} racine
103
105
  */
104
106
  export function composantsRanges(modules, racine) {
107
+ // Read once in a scope of readings done once (./lecture-unique.mjs): a sweep asks the module of
108
+ // every file of a folder.
109
+ return luUneFois(`composants ${modules.map(m => m.nom).join('+')} ${path.resolve(racine)}`, () =>
110
+ rangerLesComposants(modules, racine)
111
+ );
112
+ }
113
+
114
+ // The components of `composantsRanges`, read at each call.
115
+ function rangerLesComposants(modules, racine) {
105
116
  const ranges = modules.flatMap(module =>
106
117
  module.composants(racine).map(composant => ({ composant, module }))
107
118
  );
@@ -212,16 +223,6 @@ export function composer(modules) {
212
223
  parLesTests: new Map(parts.flatMap(p => [...p.parLesTests])),
213
224
  };
214
225
  },
215
- touches(racine, o) {
216
- const parts = modules.map(m => m.touches(racine, o));
217
- const touches = parts.flatMap(p => p.touches);
218
- const vus = new Set(touches.map(c => c.dossier));
219
- return {
220
- touches,
221
- dependants: parts.flatMap(p => p.dependants).filter(c => !vus.has(c.dossier)),
222
- horsGraphe: parts[0].horsGraphe.filter(f => parts.every(p => p.horsGraphe.includes(f))),
223
- };
224
- },
225
226
  elementsDuLot(racine, o) {
226
227
  const parts = modules.map(m => ({ m, l: m.elementsDuLot(racine, o) }));
227
228
  const impossibles = parts.filter(p => p.l.etat !== 'fait');
@@ -259,6 +260,24 @@ export function composer(modules) {
259
260
  },
260
261
  estUnTest: (chemin, racine) =>
261
262
  premiereReponse(modules, racine, chemin, m => m.estUnTest(chemin, racine)),
263
+ horsDuJour: (chemin, racine) =>
264
+ Boolean(
265
+ premiereReponse(modules, racine, chemin, m => m.horsDuJour(chemin, racine))
266
+ ),
267
+ soeurDAvant: (chemin, racine) =>
268
+ premiereReponse(modules, racine, chemin, m =>
269
+ typeof m.soeurDAvant === 'function' ? m.soeurDAvant(chemin, racine) : null
270
+ ),
271
+ arbreDAvant: (chemin, racine) =>
272
+ Boolean(
273
+ premiereReponse(modules, racine, chemin, m =>
274
+ typeof m.arbreDAvant === 'function' ? m.arbreDAvant(chemin, racine) : null
275
+ )
276
+ ),
277
+ envDArbre: (chemin, racine) =>
278
+ moduleDuFichier(modules, racine, chemin)?.envDArbre?.(chemin, racine) ?? {},
279
+ testsDeHead: (chemin, racine, lire, options) =>
280
+ premiereReponse(modules, racine, chemin, m => m.testsDeHead(chemin, racine, lire, options)),
262
281
  manifestes: {
263
282
  verrous: unique(modules.flatMap(m => m.manifestes.verrous)),
264
283
  horsDesTests: (chemin, racine, avant, apres) =>
@@ -17,13 +17,16 @@
17
17
  // - composantDe: each file of the entry lies in the component it names, among `composants`;
18
18
  // - lecteurs: what each component reads of another, by its code, and each name of the entry no
19
19
  // component provides;
20
- // - touches: what changed since the commit of the entry, each component touched, each dependent
21
- // and each file out of the graph;
22
20
  // - commandes: each command named is described (`{ script, args }`, the script a file), and asking
23
21
  // them writes nothing in the repository;
24
22
  // - verdict: each task neither green nor unplayed (« à repasser » at 75, red otherwise), the one
25
23
  // that plays the tests marked, and each test failed;
26
24
  // - estUnTest: each path the testwriter writes, with what it is (`joue`, `test`, `matiere`);
25
+ // - versionDeHead (`soeurDAvant`, `arbreDAvant`, `testsDeHead`): each path whose HEAD's version
26
+ // plays in a tree (`→ un arbre`), and each that has a sibling for it, with it, said when the sibling is the path itself or lies in another folder, and each path
27
+ // whose names of tests the module reads in HEAD's version (the entry a path, or `{ chemin,
28
+ // textes }`, HEAD's text of each file by its path), with them, said when it has both; the
29
+ // entry's expected siblings are names the module's tool plays, of their file's class;
27
30
  // - fichiersEngendres: each generated file whose check finds a gap;
28
31
  // - gardes: each guard named that the module does not play, and each script it plays that does
29
32
  // not exist;
@@ -113,14 +116,6 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
113
116
  ...l.sansFournisseur.map(n => `${n} : sans fournisseur`),
114
117
  ];
115
118
  },
116
- touches: ({ racine, depuis }) => {
117
- const t = langage.touches(racine, { depuis });
118
- return [
119
- ...t.touches.map(c => `touché ${c.nom}`),
120
- ...t.dependants.map(c => `dépendant ${c.nom}`),
121
- ...t.horsGraphe.map(f => `hors ${f}`),
122
- ];
123
- },
124
119
  commandes: noms => {
125
120
  const avant = etat(e.racine);
126
121
  const c = langage.commandes(e.racine);
@@ -154,6 +149,20 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
154
149
  if (c === null) return [];
155
150
  return [`${chemin} : ${['joue', 'test', 'matiere'].filter(k => c[k]).join(', ')}`];
156
151
  }),
152
+ versionDeHead: entrees =>
153
+ entrees.flatMap(x => {
154
+ const { chemin, textes = {} } = typeof x === 'string' ? { chemin: x } : x;
155
+ const s = typeof langage.soeurDAvant === 'function' ? langage.soeurDAvant(chemin, e.racine) : null;
156
+ const arbre = typeof langage.arbreDAvant === 'function' && langage.arbreDAvant(chemin, e.racine);
157
+ const noms = langage.testsDeHead(chemin, e.racine, f => textes[f] ?? null);
158
+ if (s !== null && arbre) return [`${chemin} : une sœur et un arbre`];
159
+ if (arbre) return [`${chemin} → un arbre`];
160
+ if (s !== null && noms !== null) return [`${chemin} : une sœur et des noms lus`];
161
+ if (noms !== null) return [`${chemin} : ${noms.join(', ') || 'aucun test'}`];
162
+ if (s === null) return [];
163
+ const aCote = s !== chemin && path.dirname(s) === path.dirname(chemin);
164
+ return [aCote ? `${chemin} → ${s}` : `${chemin} → ${s} : pas à côté du fichier`];
165
+ }),
157
166
  fichiersEngendres: racine =>
158
167
  langage
159
168
  .fichiersEngendres(racine)