@roomi-fields/grillhouse 0.31.0 → 0.33.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 (149) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +40 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +136 -16
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
  6. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +8 -5
  9. package/dist/temporal/circuit/contrat.d.ts +15 -0
  10. package/dist/temporal/circuit/deroule.js +37 -14
  11. package/dist/temporal/circuit/deroule.js.map +1 -1
  12. package/dist/temporal/deroules.d.ts +1 -0
  13. package/dist/temporal/deroules.js +3 -1
  14. package/dist/temporal/deroules.js.map +1 -1
  15. package/dist/temporal/file/activites.d.ts +1 -0
  16. package/dist/temporal/file/activites.js +5 -2
  17. package/dist/temporal/file/activites.js.map +1 -1
  18. package/dist/temporal/file/contrat.d.ts +50 -33
  19. package/dist/temporal/file/contrat.js +2 -2
  20. package/dist/temporal/file/contrat.js.map +1 -1
  21. package/dist/temporal/file/deroule.d.ts +3 -1
  22. package/dist/temporal/file/deroule.js +128 -26
  23. package/dist/temporal/file/deroule.js.map +1 -1
  24. package/dist/temporal/installation.d.ts +3 -2
  25. package/dist/temporal/installation.js +7 -4
  26. package/dist/temporal/installation.js.map +1 -1
  27. package/dist/temporal/nuits/activites.d.ts +10 -0
  28. package/dist/temporal/nuits/activites.js +114 -0
  29. package/dist/temporal/nuits/activites.js.map +1 -0
  30. package/dist/temporal/nuits/appel.d.ts +23 -0
  31. package/dist/temporal/nuits/appel.js +40 -0
  32. package/dist/temporal/nuits/appel.js.map +1 -0
  33. package/dist/temporal/nuits/choix.d.ts +14 -0
  34. package/dist/temporal/nuits/choix.js +119 -0
  35. package/dist/temporal/nuits/choix.js.map +1 -0
  36. package/dist/temporal/nuits/client.d.ts +28 -0
  37. package/dist/temporal/nuits/client.js +83 -0
  38. package/dist/temporal/nuits/client.js.map +1 -0
  39. package/dist/temporal/nuits/commande.d.ts +2 -0
  40. package/dist/temporal/nuits/commande.js +107 -0
  41. package/dist/temporal/nuits/commande.js.map +1 -0
  42. package/dist/temporal/nuits/contrat.d.ts +98 -0
  43. package/dist/temporal/nuits/contrat.js +30 -0
  44. package/dist/temporal/nuits/contrat.js.map +1 -0
  45. package/dist/temporal/nuits/deroule.d.ts +5 -0
  46. package/dist/temporal/nuits/deroule.js +100 -0
  47. package/dist/temporal/nuits/deroule.js.map +1 -0
  48. package/dist/temporal/tickets/activites.d.ts +1 -0
  49. package/dist/temporal/tickets/activites.js +5 -0
  50. package/dist/temporal/tickets/activites.js.map +1 -1
  51. package/dist/temporal/tickets/contrat.d.ts +10 -0
  52. package/dist/temporal/tickets/deroule.js +8 -1
  53. package/dist/temporal/tickets/deroule.js.map +1 -1
  54. package/dist/temporal/travailleur.js +4 -1
  55. package/dist/temporal/travailleur.js.map +1 -1
  56. package/docs/ARCHITECTURE.md +257 -54
  57. package/docs/CADRE.md +41 -1
  58. package/docs/INTERFACE.md +54 -7
  59. package/hooks/hooks.json +4 -0
  60. package/hooks/register.tsx +11 -3
  61. package/package.json +4 -1
  62. package/scripts/abi-des-dependances.mjs +105 -0
  63. package/scripts/activites.mjs +99 -48
  64. package/scripts/aiguillage.mjs +3 -0
  65. package/scripts/attente-au-tour.mjs +99 -0
  66. package/scripts/avancement.mjs +8 -18
  67. package/scripts/base-des-workflows.mjs +57 -0
  68. package/scripts/ci-des-branches.mjs +91 -0
  69. package/scripts/circuit.mjs +99 -5
  70. package/scripts/composants-affectes.mjs +24 -7
  71. package/scripts/composition-des-langages.mjs +3 -0
  72. package/scripts/copies-finies.mjs +8 -1
  73. package/scripts/crochets.mjs +4 -0
  74. package/scripts/dernier-vert.mjs +30 -4
  75. package/scripts/effets.mjs +9 -0
  76. package/scripts/enveloppe/enveloppe.mjs +3 -1
  77. package/scripts/enveloppe/lancer.sh +1 -1
  78. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  79. package/scripts/etapes.mjs +19 -2
  80. package/scripts/faits-du-circuit.mjs +43 -20
  81. package/scripts/fichier-du-poste.mjs +87 -0
  82. package/scripts/grillhouse-maj.mjs +15 -1
  83. package/scripts/integration/file.mjs +215 -275
  84. package/scripts/integration/integrer.mjs +82 -41
  85. package/scripts/integration/rejeu.mjs +13 -64
  86. package/scripts/jointure.d.ts +30 -2
  87. package/scripts/journal-des-etats.d.mts +41 -0
  88. package/scripts/journal-des-etats.mjs +273 -0
  89. package/scripts/journal.mjs +119 -0
  90. package/scripts/langages/cargo/commandes.mjs +81 -19
  91. package/scripts/langages/cargo/exemples.mjs +2 -2
  92. package/scripts/langages/cargo/index.mjs +14 -5
  93. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  94. package/scripts/langages/python/commandes.mjs +11 -7
  95. package/scripts/langages/python/exemples.mjs +1 -1
  96. package/scripts/langages/python/index.mjs +11 -2
  97. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  98. package/scripts/langages/typescript/code-mort.mjs +41 -24
  99. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  100. package/scripts/langages/typescript/exemples.mjs +2 -0
  101. package/scripts/langages/typescript/frontieres.mjs +46 -0
  102. package/scripts/langages/typescript/index.mjs +24 -3
  103. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  104. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  105. package/scripts/langages/typescript/resumes.mjs +17 -7
  106. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  107. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  108. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  109. package/scripts/langages/typescript/tranches.mjs +273 -0
  110. package/scripts/langages/typescript/verifier.mjs +154 -23
  111. package/scripts/langages/typescript/vitest-config/base.mjs +3 -0
  112. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  113. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  114. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  115. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  116. package/scripts/langages.d.mts +20 -0
  117. package/scripts/lint-des-scripts.mjs +23 -6
  118. package/scripts/matiere-de-test.d.ts +11 -0
  119. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  120. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  121. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  122. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  123. package/scripts/migrations.mjs +8 -0
  124. package/scripts/newday.mjs +18 -0
  125. package/scripts/nuit.sh +40 -13
  126. package/scripts/places-de-la-machine.mjs +6 -0
  127. package/scripts/registre.d.mts +90 -0
  128. package/scripts/registre.mjs +28 -3
  129. package/scripts/reprise.mjs +12 -8
  130. package/scripts/services-du-noyau.mjs +4 -0
  131. package/scripts/session-start.sh +28 -32
  132. package/scripts/sous-commandes.mjs +31 -10
  133. package/scripts/superviseur.mjs +127 -75
  134. package/scripts/tableau.mjs +222 -17
  135. package/scripts/taches-du-graphe.mjs +39 -6
  136. package/scripts/ticket-du-circuit.mjs +37 -7
  137. package/scripts/transitions.mjs +60 -8
  138. package/scripts/verrou-de-machine.mjs +1 -2
  139. package/scripts/workflows-du-cadre.mjs +75 -0
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/explorateur/SKILL.md +1 -1
  142. package/skills/grill/SKILL.md +10 -62
  143. package/skills/grill/references/paquets.md +60 -0
  144. package/skills/pitmaster/SKILL.md +21 -31
  145. package/skills/questionneur/SKILL.md +1 -1
  146. package/skills/relecteur/SKILL.md +1 -1
  147. package/skills/testwriter/SKILL.md +7 -1
  148. package/skills/release/SKILL.md +0 -134
  149. package/skills/release/scripts/update-version.cjs +0 -92
@@ -36,22 +36,11 @@
36
36
  // file and the manifests the lot leaves (`npm ci`, as the continuous integration runs it); an
37
37
  // install that fails refuses the lot, « Les dépendances de la copie ne s'installent pas. »;
38
38
  // then the references regenerate (below);
39
- // 6. the tests: the preparation the module of the language describes, when it describes one
40
- // (`preparer`, cargo's `cargo fetch --locked`), then `npm run verifier` in the copy, one
41
- // command (TypeScript's, by Turborepo: the build, then the
42
- // guards, the frame's and the project's own (its root script `gardes`), and every test of the
43
- // day beside each other, each task replayed from the cache of the
44
- // main tree when its inputs are unchanged). Green is required: main stays green, and nothing is compared with a base. A test
45
- // known red is put in quarantine in the test itself (`it.skip` or `it.fails`, with its
46
- // ticket), as a mature continuous integration does; the integration admits none. A
47
- // `npm run verifier` « à repasser » (75: the wait for the lock of the machine reached its
48
- // bound, scripts/verrou-de-machine.mjs) is neither green nor red: the run stops there, exit 75,
49
- // nothing committed and nothing refused, the lot where it was, for the same command again;
50
- // any other code than 0 refuses;
51
- // 7. the commit in the copy, its hooks included, under GRILLHOUSE_INTEGRATION=1: a pre-commit
52
- // hook that plays the guards skips them, as step 6 just played them; the commit validated is
53
- // the commit that enters;
54
- // 8. the branch `agent/<ticket>` is set on that commit, the ticket's copy follows it and is
39
+ // 6. the commit in the copy, its hooks included, under GRILLHOUSE_INTEGRATION=1: a pre-commit
40
+ // hook that plays the guards skips them, as the CI of the ticket's branch plays them; nothing
41
+ // is verified here: the queue pushes the branch, and its CI judges the lot before main moves
42
+ // (scripts/integration/file.mjs); the commit committed is the commit the CI judges;
43
+ // 7. the branch `agent/<ticket>` is set on that commit, the ticket's copy follows it and is
55
44
  // removed by `scripts/retirer-copie.sh` (no `--jetable`; `--garder-travail`: the working
56
45
  // directory of the ticket's circuit, `<copie>.travail`, stays for the circuit that still runs,
57
46
  // and the queue removes it at the ticket's closure): a refusal, a locked copy for
@@ -66,7 +55,7 @@
66
55
  // scripts/engendres.mjs reads them). As a genrule of Bazel writes its output again on the merged
67
56
  // tree, and npm install writes package-lock.json again after a merge, a file of the lot a reference
68
57
  // writes in full is not applied: main's version stays, and each reference whose files or reads the
69
- // lot touches plays in the copy, on main of the moment, after the install and before the tests,
58
+ // lot touches plays in the copy, on main of the moment, after the install and before the commit,
70
59
  // through the mounts, with the tools of the project, and what it writes enters the commit
71
60
  // (`regenerer` of scripts/engendres.mjs; BPScript 320.30: refused twice for the one conflict on the
72
61
  // index of the interfaces; OSC Bridge, 2026-10-31: four conflicts in one day on the generated files
@@ -84,7 +73,10 @@
84
73
  // The main tree is not touched. The duration is written at the end.
85
74
  // One integration runs at a time (`.git/integration.lock`): another waits for the end of the
86
75
  // running one; a lock whose process is gone is taken over. Exit code: 0 committed, 1 refused,
87
- // 2 usage, 75 à repasser.
76
+ // 2 usage.
77
+ // Called without a lot to apply (neither `--tests` nor `--code`), it does not commit: the lot is
78
+ // already on main (`lotSurMain`, exit 0, nothing done) or it is refused by the name `lot-absent`
79
+ // (exit 1), the same rule the circuit's resumption reads (scripts/activites.mjs, grillhouse-bf5.2).
88
80
  import { spawnSync } from 'node:child_process';
89
81
  import { existsSync, readFileSync } from 'node:fs';
90
82
  import path from 'node:path';
@@ -92,12 +84,12 @@ import { pathToFileURL } from 'node:url';
92
84
  import { arbitrageTranche, estArbitrage } from '../arbitrages.mjs';
93
85
  import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
94
86
  import { langageDe } from '../langages.mjs';
87
+ import { commitsDelivering, gitLog } from '../un-commit-par-ticket.mjs';
95
88
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
96
89
  import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
97
90
  import { lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
98
91
  import { ouvrirCopie, RETIRER_COPIE } from './rejeu.mjs';
99
92
  import { verdictDe } from './verdict.mjs';
100
- import { A_REPASSER } from '../codes-de-sortie.mjs';
101
93
  import { ouvrirBase } from '../mesure/base-de-passe.mjs';
102
94
 
103
95
  // A file name as git writes it in a patch: a name with a character outside ASCII, a quote, a
@@ -177,8 +169,57 @@ export function refusLots(tests, code, racine) {
177
169
  return null;
178
170
  }
179
171
 
180
- // The options, or { faute } for a usage error.
181
- function lire(argv) {
172
+ /**
173
+ * The commit of main that holds the lot of <ticket>, or null: the one rule that says a lot is on
174
+ * main, which the queue (scripts/integration/file.mjs) and the circuit's resumption
175
+ * (scripts/activites.mjs) import as they import `refusArbitrage`, as a merge queue knows an entry
176
+ * already merged (Zuul). Two ways name the same commit on main:
177
+ * (a) the tip of the branch `agent/<ticket>` is an ancestor of main (`git merge-base --is-ancestor`,
178
+ * the tip the delivered commit) and that commit names the ticket as `messageDeCommit` writes it,
179
+ * `(<ticket>)` — a lot the queue entered by fast-forward; its tip naming the ticket keeps a fresh
180
+ * branch sitting at a commit of main (lancer.sh creates it there, no lot yet) from being taken
181
+ * for a delivered lot (grillhouse-bf5.2.1);
182
+ * (b) a commit of main whose message names the ticket (`commitsDelivering`, the prefix read from bd,
183
+ * a withdrawn one left out) — a lot the queue rebased or merged in a squash, its branch gone or
184
+ * left behind.
185
+ * <o> is `{ racine, principale, bd }` over the main tree.
186
+ */
187
+ export function lotSurMain(o, ticket) {
188
+ const { racine, bd } = o;
189
+ const git = (...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
190
+ const principale =
191
+ o.principale ?? (git('symbolic-ref', '--short', '-q', 'HEAD').stdout.trim() || 'main');
192
+ const refMain = `refs/heads/${principale}`;
193
+ const surMain = sha =>
194
+ Boolean(sha) && git('merge-base', '--is-ancestor', sha, refMain).status === 0;
195
+ // (a) the delivered tip of the branch, on main and naming the ticket.
196
+ const tip = git(
197
+ 'rev-parse',
198
+ '--verify',
199
+ '-q',
200
+ `refs/heads/agent/${ticket}^{commit}`
201
+ ).stdout.trim();
202
+ if (surMain(tip) && git('show', '-s', '--format=%s', tip).stdout.includes(`(${ticket})`)) {
203
+ return tip;
204
+ }
205
+ // (b) a commit of main that names the ticket, the queue's rebase or squash.
206
+ const prefixe = bd('config', 'get', 'issue_prefix').stdout?.trim() ?? '';
207
+ return (
208
+ commitsDelivering(ticket, prefixe, gitLog(racine))
209
+ .map(c => git('rev-parse', '--verify', '-q', `${c}^{commit}`).stdout.trim())
210
+ .find(surMain) ?? null
211
+ );
212
+ }
213
+
214
+ // The refusal « lot-absent » for <ticket>: no lot to apply (neither --tests nor --code) and no
215
+ // commit of the ticket on main. The one text, which the integrator's direct call and the circuit's
216
+ // resumption both give, the name `lot-absent` first.
217
+ export const refusLotAbsent = ticket =>
218
+ `lot-absent : ${ticket} n'a aucun lot à appliquer (ni --tests ni --code) et aucun commit de ce ticket n'est sur main.`;
219
+
220
+ // The options, or { faute } for a usage error: a ticket always, a message with a lot to apply;
221
+ // without a lot (neither --tests nor --code), the call is judged by `lotSurMain` (see `main`).
222
+ export function lire(argv) {
182
223
  const o = { ticket: null, tests: null, code: null, message: null, references: null };
183
224
  for (let i = 0; i < argv.length; i++) {
184
225
  const v = argv[i + 1];
@@ -212,7 +253,7 @@ function lire(argv) {
212
253
  return { faute: null };
213
254
  }
214
255
  }
215
- if (!o.ticket || !o.message || !(o.tests || o.code)) {
256
+ if (!o.ticket || ((o.tests || o.code) && !o.message)) {
216
257
  return { faute: null };
217
258
  }
218
259
  return o;
@@ -284,6 +325,19 @@ function main(argv) {
284
325
  };
285
326
  const absolu = p => path.resolve(p);
286
327
 
328
+ // Without a lot to apply (neither --tests nor --code): the lot is already on main, nothing to
329
+ // commit (exit 0), or it is absent and the call is refused by its name `lot-absent` — the same
330
+ // rule `lotSurMain` the circuit's resumption reads, not the usage (exit 2), so a resumption that
331
+ // finds no lot and no commit on main gets the one named refusal.
332
+ if (!(o.tests || o.code)) {
333
+ const entre = lotSurMain({ racine, bd }, o.ticket);
334
+ if (!entre) {
335
+ return refuser(refusLotAbsent(o.ticket));
336
+ }
337
+ dire(`✓ le commit ${entre.slice(0, 7)} de ${o.ticket} est déjà sur main`);
338
+ return 0;
339
+ }
340
+
287
341
  // One integration at a time: a second waits for the end of the first; a lock whose process is
288
342
  // gone is taken over.
289
343
  const verrou = path.join(commun, 'integration.lock');
@@ -402,7 +456,7 @@ function main(argv) {
402
456
  if (ouverte.refus) {
403
457
  return refuser(ouverte.refus);
404
458
  }
405
- const { dansCopie, monter, installer, tester } = ouverte;
459
+ const { dansCopie, monter, installer } = ouverte;
406
460
 
407
461
  // 5. The lots, applied in the copy without the files a reference writes in full, then
408
462
  // installed, then the references regenerated.
@@ -443,23 +497,10 @@ function main(argv) {
443
497
  dire(`✓ références régénérées sur main à jour : ${aRegenerer.map(r => r.nom).join(', ')}`);
444
498
  }
445
499
 
446
- // 6. The tests: the build, the guards and every test of the day, green required.
447
- dire('— npm run verifier (construction, gardes, tests)');
448
- const verdict = tester({ sorte: 'Intégration', ticket: o.ticket }).status;
449
- if (verdict === A_REPASSER) {
450
- dire(
451
- `⏱ À repasser (code ${A_REPASSER}) : l'attente de la machine a atteint sa borne. Le lot n'est ni commis ni refusé ; relance la même commande.`
452
- );
453
- return A_REPASSER;
454
- }
455
- if (verdict !== 0) {
456
- return refuser('Les tests refusent le lot (sortie ci-dessus).');
457
- }
458
- dire('✓ tests');
459
-
460
- // 7. The commit, in the copy: the commit validated is the commit that enters.
461
- // The guards have just run (in `npm run verifier`): a pre-commit hook that plays them skips them under
462
- // GRILLHOUSE_INTEGRATION=1; commit-msg (a closed ticket refuses a second commit, a reopened one takes its corrections) runs as always.
500
+ // 6. The commit, in the copy: the commit committed is the commit the CI of the branch judges.
501
+ // The guards run in that CI: a pre-commit hook that plays them skips them under
502
+ // GRILLHOUSE_INTEGRATION=1; commit-msg (a closed ticket refuses a second commit, a reopened one
503
+ // takes its corrections) runs as always.
463
504
  const c = spawnSync(
464
505
  'bash',
465
506
  monter('git', '-C', copie, 'commit', '-q', '-F', absolu(o.message)),
@@ -473,7 +514,7 @@ function main(argv) {
473
514
  }
474
515
  const commit = dansCopie('rev-parse', 'HEAD').stdout.trim();
475
516
 
476
- // 8. The branch of the ticket takes the commit; the ticket's copy follows it (it carried the
517
+ // 7. The branch of the ticket takes the commit; the ticket's copy follows it (it carried the
477
518
  // lot, which the commit now holds) and is removed; the ticket is labelled `en-file`.
478
519
  const pose = git('update-ref', `refs/heads/${branche}`, commit);
479
520
  if (pose.status !== 0) {
@@ -1,12 +1,12 @@
1
- // The replay of a lot in a clean copy, shared by the integration (scripts/integration/integrer.mjs,
1
+ // The clean copy a lot is replayed in, shared by the integration (scripts/integration/integrer.mjs,
2
2
  // a lot on the main of the moment) and the queue (scripts/integration/file.mjs, a branch replaced
3
- // on the main of the moment): the copy made ready, the project's commands, its tests.
3
+ // on the main of the moment): the copy made ready and the project's commands. Neither verifies
4
+ // there: the CI of the ticket's branch judges the lot (scripts/integration/file.mjs).
4
5
  //
5
6
  // - `ouvrirCopie` makes the copy <copie> ready on <ref>: detached, every untracked file removed, its
6
7
  // submodules set (`scripts/sous-modules.sh`, a local modification overwritten; a submodule the
7
8
  // project shares, `grillhouse.partage`, is linked to the main repository's instead), its
8
- // dependencies made to agree with its lock file and manifests (below). It builds nothing: the
9
- // tests build. An existing copy that does not get ready is removed by
9
+ // dependencies made to agree with its lock file and manifests (below). It builds nothing. An existing copy that does not get ready is removed by
10
10
  // `scripts/retirer-copie.sh --jetable` (local work does not hold it, a lock does) and created
11
11
  // again, once; a copy that does not get ready the second time refuses, and so does a removal the
12
12
  // script refuses, with its reason. Every command of the project plays through
@@ -18,19 +18,11 @@
18
18
  // the manifests (every `package.json` git tracks) with the key
19
19
  // `node_modules/.integration-lock`, runs `npm ci` when they differ and writes the key again; a
20
20
  // failing install gives `DEPENDANCES_REFUSEES`, the one form of that refusal. It runs at the
21
- // opening, and the consumer calls `installer` once the lot is in the copy, before the tests: a
22
- // lot that changes the lock file or a manifest is installed as the continuous integration
23
- // installs it (`npm ci` refuses a lock file in disagreement with its manifest). The tests run on
24
- // dependencies in agreement, and they neither read the key nor install.
25
- // - `tester` plays the commands of the verification in the copy (`commandesDeVerification`): the
26
- // preparation the module of its language describes (`preparer` of its `commandes`, cargo's
27
- // `cargo fetch --locked`), as a CI fetches the dependencies of a job before its tests, then
28
- // `npm run verifier`, the command of the module (TypeScript's builds the project with Turborepo,
29
- // then plays its guards and its tests beside each other, each task kept in the cache of the main
30
- // tree, shared by every copy). It gives the result of the first command that is not green, else
31
- // of the last: green (status 0), « à repasser » (75) or red (any other), its output written as it
32
- // comes.
33
- // - Every command of the project run in the copy (`lancer`: the install, the tests) leaves the
21
+ // opening, and the consumer calls `installer` once the lot is in the copy, before the commands
22
+ // that regenerate its files: a lot that changes the lock file or a manifest is installed as the
23
+ // continuous integration installs it (`npm ci` refuses a lock file in disagreement with its
24
+ // manifest).
25
+ // - Every command of the project run in the copy (`lancer`: the install) leaves the
34
26
  // index of its copy up to date, green or red: the consumers that apply a lot with `--index` (the
35
27
  // integration, the queue) read an index that matches the files the command touched, and none
36
28
  // refreshes for its own account.
@@ -39,14 +31,13 @@ import { createHash } from 'node:crypto';
39
31
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
40
32
  import path from 'node:path';
41
33
  import { fileURLToPath } from 'node:url';
42
- import { langageDe } from '../langages.mjs';
43
34
 
44
35
  const SOUS_MODULES = fileURLToPath(new URL('../sous-modules.sh', import.meta.url));
45
36
  export const RETIRER_COPIE = fileURLToPath(new URL('../retirer-copie.sh', import.meta.url));
46
37
 
47
38
  const VERROU = 'package-lock.json';
48
39
  const DEPENDANCES_REFUSEES = "Les dépendances de la copie ne s'installent pas.";
49
- // The most output a command of the project may write: a whole run of the tests, logs included.
40
+ // The most output a command of the project may write: an install, logs included.
50
41
  const SORTIE_MAX = 256 * 1024 * 1024;
51
42
 
52
43
  // The fingerprint of what `npm ci` reads in <copie>: the lock file at <verrou> and every
@@ -65,24 +56,9 @@ function empreinteDesDependances(copie, verrou, dansCopie) {
65
56
  return h.digest('hex');
66
57
  }
67
58
 
68
- /**
69
- * The commands of the verification of the copy <copie>, in order, each `[commande, args]`: the
70
- * preparation the module of its language describes, when it describes one, then `npm run
71
- * verifier`.
72
- * @param {string} copie the root of the copy
73
- * @returns {[string, string[]][]}
74
- */
75
- export function commandesDeVerification(copie) {
76
- const preparer = langageDe(copie).commandes(copie).preparer;
77
- return [
78
- ...(preparer ? [[process.execPath, [preparer.script, ...preparer.args]]] : []),
79
- ['npm', ['run', 'verifier']],
80
- ];
81
- }
82
-
83
59
  // The copy <copie> ready on <ref>, or `{ refus }`. `dire` writes a progress line. Returns the
84
60
  // copy's tools: `dansCopie` (git in the copy), `monter` (the command line of a mounted command),
85
- // `installer`, `tester`, and `tete`, the commit the copy was made ready on.
61
+ // `installer`, and `tete`, the commit the copy was made ready on.
86
62
  export function ouvrirCopie({ racine, copie, ref, dire }) {
87
63
  const git = (...args) => spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
88
64
  const dansCopie = (...args) => spawnSync('git', ['-C', copie, ...args], { encoding: 'utf8' });
@@ -130,10 +106,9 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
130
106
  if (montage.status !== 0) {
131
107
  return { refus: montage.stderr.trim() };
132
108
  }
133
- const lancer = (commande, args, envPlus = null) => {
109
+ const lancer = (commande, args) => {
134
110
  const r = spawnSync('bash', monter(commande, ...args), {
135
111
  cwd: copie,
136
- ...(envPlus ? { env: { ...process.env, ...envPlus } } : {}),
137
112
  encoding: 'utf8',
138
113
  maxBuffer: SORTIE_MAX,
139
114
  });
@@ -170,31 +145,5 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
170
145
  }
171
146
  dire(`✓ copie propre sur ${tete.slice(0, 7)}`);
172
147
 
173
- // The checks of the copy: its preparation, then its verification; the first that is not green
174
- // ends them.
175
- // `identite` (`{ sorte, ticket }`, the ticket null when unknown) is set in the environment of
176
- // `npm run verifier` alone, which names itself so at the lock of the machine; the preparation
177
- // does not receive it.
178
- const tester = identite => {
179
- let r;
180
- const commandes = commandesDeVerification(copie);
181
- for (const [i, [commande, args]] of commandes.entries()) {
182
- const verifier = i === commandes.length - 1 && identite;
183
- r = lancer(
184
- commande,
185
- args,
186
- verifier
187
- ? {
188
- GRILLHOUSE_VERIFICATION_SORTE: identite.sorte,
189
- GRILLHOUSE_VERIFICATION_TICKET: identite.ticket ?? '',
190
- }
191
- : null
192
- );
193
- if (r.status !== 0) {
194
- break;
195
- }
196
- }
197
- return r;
198
- };
199
- return { dansCopie, monter, installer: accorder, tester, tete };
148
+ return { dansCopie, monter, installer: accorder, tete };
200
149
  }
@@ -231,6 +231,11 @@ export interface Composition {
231
231
  * task covers the content of the files it reads and of what it waits for); null when the runner
232
232
  * gives no plan. The fingerprint of a step of the circuit reads them. */
233
233
  empreintes(racine: string, noms: string[]): Record<string, string> | null;
234
+ /** The environment the tools of the language run under on the poste, from `env`: the variables
235
+ * of the file of the poste the module names (`avecLeFichierDuPoste`), the server of the remote
236
+ * cache of its task runner, read-only; `env` itself without the file, or when `env` already
237
+ * names one of its variables (a CI). The commands of the module run under it. */
238
+ environnementDuPoste(env: Record<string, string | undefined>): Record<string, string | undefined>;
234
239
  lecteurs(
235
240
  racine: string,
236
241
  o: { composants: Composant[]; noms: string[]; texte: string; nommes: Composant[] }
@@ -281,6 +286,10 @@ export interface Composition {
281
286
 
282
287
  /** A module of language, the default export of `scripts/langages/<nom>/index.mjs`. */
283
288
  export interface Langage extends Composition {
289
+ /** The programs of this language's toolchain (`cargo`, `python3`) that the installer of Temporal
290
+ * requires in its PATH, each refused by its name when absent; none for TypeScript, Node being a
291
+ * tool of the account. */
292
+ executables: string[];
284
293
  /** The manifest of a package of this language, in its folder (`package.json`, `Cargo.toml`):
285
294
  * the guard of the languages asks it of a package the architecture declares of this language. */
286
295
  manifeste: string;
@@ -391,6 +400,14 @@ export function dansLeTemporaire(chemin: string, env?: NodeJS.ProcessEnv): boole
391
400
  /** The cache of compilation of `outil`, under `~/.cache/grillhouse/`, never in the temporary
392
401
  * directory. */
393
402
  export function cacheDeCompilation(outil: string, env?: NodeJS.ProcessEnv): string;
403
+ /** The environment <env> with the variables of the file `fichier` of the poste (under
404
+ * `$XDG_CONFIG_HOME/grillhouse/`, `~/.config/grillhouse/` without it), then `ajouts`; <env> itself
405
+ * when the file is absent or <env> already names one of its variables
406
+ * (scripts/fichier-du-poste.mjs). */
407
+ export function avecLeFichierDuPoste<T extends Record<string, string | undefined>>(
408
+ env: T,
409
+ o: { fichier: string; ajouts?: Record<string, string>; lire?: (f: string) => string | null }
410
+ ): T;
394
411
  /** The path of the command <nom> in the PATH of <env>, or null (scripts/commandes-du-path.mjs). */
395
412
  export function trouverDansLePath(nom: string, env?: NodeJS.ProcessEnv): string | null;
396
413
  /** The cache of `outil` for the build rooted at `racine`, swept once `racine` is gone. */
@@ -491,13 +508,24 @@ export function testsCibles(o: {
491
508
  /** The paths and the options of a task of the tests of a package, run by its script: the paths
492
509
  * `donnes` its script names, each replaced by those of the variable `TESTS_CIBLES` of `env` that
493
510
  * lie in the same component (`dossierDe`: the folder of the component of an absolute path, or
494
- * null), and the options of the variable. */
511
+ * null), the options of the variable, and the tranche of a pass it carries, or null. */
495
512
  export function cheminsDeLaTache(o: {
496
513
  racine: string;
497
514
  donnes: string[];
498
515
  env?: NodeJS.ProcessEnv;
499
516
  dossierDe: (absolu: string) => string | null;
500
- }): { chemins: string[]; options: string[] };
517
+ }): { chemins: string[]; options: string[]; tranche: Tranche | null };
518
+ /** A tranche of a pass, the i-th (`index`) of n (`count`) parts of the tests. */
519
+ export interface Tranche {
520
+ index: number;
521
+ count: number;
522
+ }
523
+ /** Whether the tests a tool cannot split play in `tranche`: without a tranche, or in the first. */
524
+ export function joueCeQuiNeSeDivisePas(tranche: Tranche | null | undefined): boolean;
525
+ /** The form of a tranche, `i/n`. */
526
+ export const LA_FORME: string;
527
+ /** The tranche `texte` reads, or null when it is not `i/n` with 1 ≤ i ≤ n. */
528
+ export function lireLaTranche(texte: unknown): Tranche | null;
501
529
  /** The trace tasks of a plan of the runner (`run … --dry=json`, parsed), those `garder` keeps: their
502
530
  * task ids, sorted. */
503
531
  export function tracesDuPlan(
@@ -0,0 +1,41 @@
1
+ // The types of the journal of states (./journal-des-etats.mjs).
2
+
3
+ /** A line of the journal of states. */
4
+ export interface LigneDuJournal {
5
+ ts: string;
6
+ genre: 'circuit' | 'file' | 'places';
7
+ ticket: string | null;
8
+ etape: string | null;
9
+ boucle: number | null;
10
+ place: string | null;
11
+ raison: string;
12
+ }
13
+
14
+ /** A trace to write: a line, `ts` set when it already has its date. */
15
+ export type Trace = Partial<LigneDuJournal> & { genre: LigneDuJournal['genre'] };
16
+
17
+ export const AGE_MAX_JOURS: number;
18
+ export const TAILLE_MAX: number;
19
+ export function heureLocale(date?: Date): string;
20
+ export function dossierDuJournal(racine: string): string;
21
+ export function ecrireLaTrace(
22
+ racine: string,
23
+ trace: Trace,
24
+ options?: { maintenant?: Date; dire?: (message: string) => void }
25
+ ): { ecrit: boolean };
26
+ export function traceDeLaFile(e: { ticket: string; evenement: 'lance' | 'termine' }): Trace;
27
+ export function traceDesPlaces(e: {
28
+ evenement: 'prise' | 'rendue' | 'attente';
29
+ ticket?: string | null;
30
+ place?: string | null;
31
+ raison?: string;
32
+ }): Trace;
33
+ export function lireLeJournal(
34
+ racine: string,
35
+ plage?: { depuis?: string; jusquA?: string; ticket?: string }
36
+ ): { lignes: LigneDuJournal[] };
37
+ export function nettoyerLeJournal(
38
+ racine: string,
39
+ options?: { maintenant?: Date; ageMaxJours?: number; tailleMax?: number }
40
+ ): { retires: string[] };
41
+ export function ensemblesEnTravail(lignes: LigneDuJournal[]): { ts: string; enTravail: string[] }[];