@roomi-fields/grillhouse 0.32.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 (116) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +22 -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/nuits/activites.d.ts +10 -0
  25. package/dist/temporal/nuits/activites.js +114 -0
  26. package/dist/temporal/nuits/activites.js.map +1 -0
  27. package/dist/temporal/nuits/appel.d.ts +23 -0
  28. package/dist/temporal/nuits/appel.js +40 -0
  29. package/dist/temporal/nuits/appel.js.map +1 -0
  30. package/dist/temporal/nuits/choix.d.ts +14 -0
  31. package/dist/temporal/nuits/choix.js +119 -0
  32. package/dist/temporal/nuits/choix.js.map +1 -0
  33. package/dist/temporal/nuits/client.d.ts +28 -0
  34. package/dist/temporal/nuits/client.js +83 -0
  35. package/dist/temporal/nuits/client.js.map +1 -0
  36. package/dist/temporal/nuits/commande.d.ts +2 -0
  37. package/dist/temporal/nuits/commande.js +107 -0
  38. package/dist/temporal/nuits/commande.js.map +1 -0
  39. package/dist/temporal/nuits/contrat.d.ts +98 -0
  40. package/dist/temporal/nuits/contrat.js +30 -0
  41. package/dist/temporal/nuits/contrat.js.map +1 -0
  42. package/dist/temporal/nuits/deroule.d.ts +5 -0
  43. package/dist/temporal/nuits/deroule.js +100 -0
  44. package/dist/temporal/nuits/deroule.js.map +1 -0
  45. package/dist/temporal/travailleur.js +4 -1
  46. package/dist/temporal/travailleur.js.map +1 -1
  47. package/docs/ARCHITECTURE.md +186 -45
  48. package/docs/CADRE.md +31 -1
  49. package/docs/INTERFACE.md +45 -6
  50. package/hooks/register.tsx +11 -3
  51. package/package.json +4 -1
  52. package/scripts/abi-des-dependances.mjs +105 -0
  53. package/scripts/activites.mjs +94 -41
  54. package/scripts/aiguillage.mjs +1 -0
  55. package/scripts/avancement.mjs +8 -18
  56. package/scripts/ci-des-branches.mjs +91 -0
  57. package/scripts/circuit.mjs +79 -4
  58. package/scripts/composants-affectes.mjs +24 -7
  59. package/scripts/composition-des-langages.mjs +3 -0
  60. package/scripts/crochets.mjs +4 -0
  61. package/scripts/enveloppe/enveloppe.mjs +3 -1
  62. package/scripts/enveloppe/lancer.sh +1 -1
  63. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  64. package/scripts/etapes.mjs +18 -1
  65. package/scripts/faits-du-circuit.mjs +43 -20
  66. package/scripts/fichier-du-poste.mjs +87 -0
  67. package/scripts/grillhouse-maj.mjs +15 -1
  68. package/scripts/integration/file.mjs +215 -275
  69. package/scripts/integration/integrer.mjs +82 -41
  70. package/scripts/integration/rejeu.mjs +13 -64
  71. package/scripts/jointure.d.ts +26 -2
  72. package/scripts/langages/cargo/commandes.mjs +81 -19
  73. package/scripts/langages/cargo/exemples.mjs +2 -2
  74. package/scripts/langages/cargo/index.mjs +11 -5
  75. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  76. package/scripts/langages/python/commandes.mjs +11 -7
  77. package/scripts/langages/python/exemples.mjs +1 -1
  78. package/scripts/langages/python/index.mjs +9 -2
  79. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  80. package/scripts/langages/typescript/code-mort.mjs +41 -24
  81. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  82. package/scripts/langages/typescript/exemples.mjs +2 -0
  83. package/scripts/langages/typescript/index.mjs +22 -3
  84. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  85. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  86. package/scripts/langages/typescript/resumes.mjs +17 -7
  87. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  88. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  89. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  90. package/scripts/langages/typescript/tranches.mjs +273 -0
  91. package/scripts/langages/typescript/verifier.mjs +131 -29
  92. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  93. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  94. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  95. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  96. package/scripts/lint-des-scripts.mjs +23 -6
  97. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  98. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  99. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  100. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  101. package/scripts/migrations.mjs +8 -0
  102. package/scripts/newday.mjs +18 -0
  103. package/scripts/nuit.sh +35 -17
  104. package/scripts/registre.d.mts +90 -0
  105. package/scripts/registre.mjs +28 -3
  106. package/scripts/reprise.mjs +12 -8
  107. package/scripts/services-du-noyau.mjs +4 -0
  108. package/scripts/session-start.sh +28 -32
  109. package/scripts/sous-commandes.mjs +29 -10
  110. package/scripts/tableau.mjs +124 -17
  111. package/scripts/taches-du-graphe.mjs +39 -6
  112. package/scripts/transitions.mjs +42 -3
  113. package/scripts/verrou-de-machine.mjs +1 -2
  114. package/scripts/workflows-du-cadre.mjs +75 -0
  115. package/skills/grill/SKILL.md +8 -6
  116. package/skills/pitmaster/SKILL.md +5 -4
@@ -0,0 +1,114 @@
1
+ // The activities of the nights of the machine (./deroule.ts): the choice of the projects of the
2
+ // register (./choix.ts), the note of a skip in the journal of the night of its project and in the
3
+ // register of the machine, the pass of the night of a project, and the request of the scheduled
4
+ // nights, which the workflow the schedule starts plays.
5
+ //
6
+ // - The pass is `node_modules/.bin/grillhouse nuit` in the main tree of the project, the command
7
+ // of the version of the frame the project installs (scripts/nuit.sh, unchanged), in a process
8
+ // group of its own, as the table of tasks launched it. While it plays, the activity sends a
9
+ // heartbeat with its process; an attempt played again after its worker died ends the group of
10
+ // the dead attempt first (`finirLaTentativeMorte` of ../acte.ts), so that two nights never run
11
+ // at once. A cancellation sends SIGTERM to the group, then SIGKILL 10 s later.
12
+ import { spawn } from 'node:child_process';
13
+ import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
14
+ import path from 'node:path';
15
+ import { Context } from '@temporalio/activity';
16
+ import { departDe, signalerGroupe } from '../../../scripts/mesure-de-la-machine.mjs';
17
+ import { ecrire, ligneDeNuit, REGISTRE } from '../../../scripts/registre.mjs';
18
+ import { finirLaTentativeMorte } from '../acte.js';
19
+ import { ouvrirLeClient } from '../client.js';
20
+ import { choisir, marqueurDeLaNuit, projetsDuRegistre } from './choix.js';
21
+ import { demanderDesNuits } from './client.js';
22
+ // How often a night in progress sends its heartbeat.
23
+ const BATTEMENT_MS = 30_000;
24
+ // How long a cancelled night's group has after SIGTERM, before SIGKILL.
25
+ const GRACE_MS = 10_000;
26
+ // The date and the time of <d>, in local time, as the night writes them (`date +%Y-%m-%d %H:%M`).
27
+ function local(d) {
28
+ const p = (n) => String(n).padStart(2, '0');
29
+ const jour = `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
30
+ return { jour, heure: `${jour} ${p(d.getHours())}:${p(d.getMinutes())}` };
31
+ }
32
+ export function choisirLesNuits() {
33
+ const texte = existsSync(REGISTRE) ? readFileSync(REGISTRE, 'utf8') : '';
34
+ return Promise.resolve(choisir(projetsDuRegistre(texte)));
35
+ }
36
+ /** Writes the skip <saut> at <maintenant> in the journal of its night and in the register. */
37
+ export function noterLeSautA(saut, maintenant) {
38
+ const { jour, heure } = local(maintenant);
39
+ const marqueur = marqueurDeLaNuit(saut.racine);
40
+ if (marqueur) {
41
+ const dossier = path.dirname(marqueur);
42
+ mkdirSync(dossier, { recursive: true });
43
+ appendFileSync(path.join(dossier, `${jour}.log`), `— la nuit du ${heure} sur ${saut.sommet.slice(0, 7)} : sautée, ${saut.raison} ` +
44
+ `(sommet ${saut.sommet}, référence ${saut.reference}).\n`);
45
+ }
46
+ ecrire(ligneDeNuit({
47
+ projet: saut.racine,
48
+ quand: maintenant.toISOString(),
49
+ raison: saut.raison,
50
+ sommet: saut.sommet,
51
+ reference: saut.reference,
52
+ }));
53
+ }
54
+ export function noterLeSaut(saut) {
55
+ noterLeSautA(saut, new Date());
56
+ return Promise.resolve();
57
+ }
58
+ export async function jouerLaNuit({ racine }) {
59
+ const contexte = Context.current();
60
+ const avant = contexte.info.heartbeatDetails;
61
+ finirLaTentativeMorte(avant?.processus);
62
+ const enfant = spawn(path.join(racine, 'node_modules/.bin/grillhouse'), ['nuit'], {
63
+ cwd: racine,
64
+ stdio: 'ignore',
65
+ env: process.env,
66
+ detached: true,
67
+ });
68
+ const fin = new Promise((ok, ko) => {
69
+ enfant.on('error', ko);
70
+ enfant.on('close', (code, signal) => ok(code ?? (signal ? 128 : 1)));
71
+ });
72
+ const moi = { pid: enfant.pid, depart: enfant.pid ? departDe(enfant.pid) : null };
73
+ const battre = () => contexte.heartbeat({ processus: moi });
74
+ battre();
75
+ const minuteur = setInterval(battre, BATTEMENT_MS);
76
+ let tuer = null;
77
+ const annuler = () => {
78
+ signalerGroupe(moi.pid, 'SIGTERM');
79
+ tuer = setTimeout(() => signalerGroupe(moi.pid, 'SIGKILL'), GRACE_MS);
80
+ };
81
+ contexte.cancellationSignal.addEventListener('abort', annuler);
82
+ try {
83
+ const code = await fin;
84
+ // What remains of the group ends before the activity does.
85
+ while (contexte.cancellationSignal.aborted && signalerGroupe(moi.pid, 0)) {
86
+ await new Promise(ok => setTimeout(ok, 200));
87
+ }
88
+ return code;
89
+ }
90
+ finally {
91
+ if (tuer) {
92
+ clearTimeout(tuer);
93
+ }
94
+ clearInterval(minuteur);
95
+ contexte.cancellationSignal.removeEventListener('abort', annuler);
96
+ }
97
+ }
98
+ export async function demanderLesNuitsPlanifiees() {
99
+ const c = ouvrirLeClient();
100
+ try {
101
+ await demanderDesNuits(c.client, { planifiee: true });
102
+ }
103
+ finally {
104
+ await c.fermer();
105
+ }
106
+ }
107
+ // The activities match their contract.
108
+ export const activitesDesNuits = {
109
+ choisirLesNuits,
110
+ noterLeSaut,
111
+ jouerLaNuit,
112
+ demanderLesNuitsPlanifiees,
113
+ };
114
+ //# sourceMappingURL=activites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activites.js","sourceRoot":"","sources":["../../../src/temporal/nuits/activites.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,kGAAkG;AAClG,gGAAgG;AAChG,wDAAwD;AACxD,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,8FAA8F;AAC9F,gGAAgG;AAChG,iGAAiG;AACjG,iFAAiF;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/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
+ } | {
5
+ quoi: 'aide';
6
+ } | {
7
+ quoi: 'planifier';
8
+ heure: number | null;
9
+ } | {
10
+ quoi: 'demander';
11
+ projet: string;
12
+ } | {
13
+ quoi: 'faute';
14
+ raison: string;
15
+ };
16
+ /** The call <argv> read. */
17
+ export declare function lireLAppel(argv: string[]): Appel;
18
+ /** The main tree of the repository that holds <dossier>, or the reason it is none. */
19
+ export declare function arbrePrincipalDe(dossier: string): {
20
+ racine: string;
21
+ } | {
22
+ raison: string;
23
+ };
@@ -0,0 +1,40 @@
1
+ // The call of the subcommand `grillhouse nuit` (./commande.ts): what its command line asks, and the
2
+ // main tree of the project it names.
3
+ import { spawnSync } from 'node:child_process';
4
+ import path from 'node:path';
5
+ /** The call <argv> read. */
6
+ export function lireLAppel(argv) {
7
+ if (argv.length === 0) {
8
+ return { quoi: 'passe' };
9
+ }
10
+ if (argv.some(a => a === '-h' || a === '--help')) {
11
+ return argv.length === 1 ? { quoi: 'aide' } : { quoi: 'faute', raison: 'l’aide va seule.' };
12
+ }
13
+ if (argv[0] === '--planifier') {
14
+ if (argv.length === 1) {
15
+ return { quoi: 'planifier', heure: null };
16
+ }
17
+ const [, option, valeur, ...reste] = argv;
18
+ const heure = Number(valeur);
19
+ if (option !== '--heure' || reste.length || !/^\d{1,2}$/.test(valeur ?? '') || heure > 23) {
20
+ return { quoi: 'faute', raison: '--planifier prend au plus --heure <0-23>.' };
21
+ }
22
+ return { quoi: 'planifier', heure };
23
+ }
24
+ if (argv.length > 1) {
25
+ return { quoi: 'faute', raison: `un seul argument : ${argv.join(' ')}.` };
26
+ }
27
+ const [a] = argv;
28
+ if (a.startsWith('-')) {
29
+ return { quoi: 'faute', raison: `argument inconnu : ${a}` };
30
+ }
31
+ return { quoi: 'demander', projet: a };
32
+ }
33
+ /** The main tree of the repository that holds <dossier>, or the reason it is none. */
34
+ export function arbrePrincipalDe(dossier) {
35
+ const r = spawnSync('git', ['-C', dossier, 'rev-parse', '--path-format=absolute', '--git-common-dir'], { encoding: 'utf8' });
36
+ return r.status === 0
37
+ ? { racine: path.dirname(r.stdout.trim()) }
38
+ : { raison: `${dossier} n’est pas dans un dépôt git` };
39
+ }
40
+ //# sourceMappingURL=appel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appel.js","sourceRoot":"","sources":["../../../src/temporal/nuits/appel.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,4BAA4B;AAC5B,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC9F,CAAC;IACD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,aAAa,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC5C,CAAC;QACD,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC;QAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,WAAW,C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ects the register text <texte> names, each once, in the order of their paths. */
3
+ export declare function projetsDuRegistre(texte: string): string[];
4
+ /** Why the project at <racine> plays no night (its root gone, no night wired), or null. */
5
+ export declare function ecartDuProjet(racine: string): string | null;
6
+ /** The marker of the last green night of the repository at <racine>, or null out of git. */
7
+ export declare function marqueurDeLaNuit(racine: string): string | null;
8
+ /**
9
+ * The skip of the project at <racine> when its top is the commit of its last green night; else
10
+ * null: it plays (its top moved, or no marker that reads as a commit of the repository).
11
+ */
12
+ export declare function sautDuProjet(racine: string): Saut | null;
13
+ /** The choice of a scheduled night among <projets>: left out, skipped, or played, in their order. */
14
+ export declare function choisir(projets: string[]): ChoixDesNuits;
@@ -0,0 +1,119 @@
1
+ // The choice of the nights of the machine (grillhouse-4nr.13): which projects of the register play
2
+ // their night, as Jenkins builds nothing without a change and Turborepo replays from its cache a
3
+ // task whose inputs did not move. The activities of the nights (./activites.ts) call it.
4
+ //
5
+ // - The projects are those the register of the machine names (`projet` of each line,
6
+ // scripts/registre.mjs), in the order of their paths: a project enters at its first session
7
+ // noted, no line written by hand.
8
+ // - A project is left out, its reason written, when its root no longer exists, or when no night is
9
+ // wired there: no command of the frame (`node_modules/.bin/grillhouse`), no script `verifier` in
10
+ // its package.json (which the night plays), or no commit.
11
+ // - A project is skipped when its top (HEAD of its main tree, which the night plays) is the commit
12
+ // of its last green night, the marker that the green night alone writes
13
+ // (`<git common dir>/nuit/dernier-vert`, scripts/nuit.sh), apart from the last green that the
14
+ // day's passes write too (scripts/dernier-vert.mjs): a project integrated green in the day plays
15
+ // its night tests and its benches. A project without a marker, or whose marker no longer reads as
16
+ // a commit of the repository, plays.
17
+ import { spawnSync } from 'node:child_process';
18
+ import { existsSync, readFileSync } from 'node:fs';
19
+ import path from 'node:path';
20
+ const SHA = /^[0-9a-f]{40,64}$/;
21
+ // git in <racine>: its output trimmed, or null when it fails.
22
+ function git(racine, ...args) {
23
+ const r = spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
24
+ return r.status === 0 ? r.stdout.trim() : null;
25
+ }
26
+ /** The projects the register text <texte> names, each once, in the order of their paths. */
27
+ export function projetsDuRegistre(texte) {
28
+ const projets = new Set();
29
+ for (const l of texte.split('\n')) {
30
+ try {
31
+ const p = JSON.parse(l)?.projet;
32
+ if (typeof p === 'string' && path.isAbsolute(p)) {
33
+ projets.add(p);
34
+ }
35
+ }
36
+ catch {
37
+ // A torn line names nothing.
38
+ }
39
+ }
40
+ return [...projets].sort();
41
+ }
42
+ /** Why the project at <racine> plays no night (its root gone, no night wired), or null. */
43
+ export function ecartDuProjet(racine) {
44
+ if (!existsSync(racine)) {
45
+ return 'sa racine n’existe plus';
46
+ }
47
+ if (!existsSync(path.join(racine, 'node_modules/.bin/grillhouse'))) {
48
+ return 'aucune nuit branchée : node_modules/.bin/grillhouse manque';
49
+ }
50
+ let scripts = {};
51
+ try {
52
+ scripts =
53
+ JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts ?? {};
54
+ }
55
+ catch {
56
+ return 'aucune nuit branchée : son package.json ne se lit pas';
57
+ }
58
+ if (typeof scripts.verifier !== 'string') {
59
+ return 'aucune nuit branchée : son package.json n’a pas de script verifier';
60
+ }
61
+ if (!git(racine, 'rev-parse', '--verify', '-q', 'HEAD^{commit}')) {
62
+ return 'aucune nuit branchée : pas de dépôt git, ou aucun commit';
63
+ }
64
+ return null;
65
+ }
66
+ /** The marker of the last green night of the repository at <racine>, or null out of git. */
67
+ export function marqueurDeLaNuit(racine) {
68
+ const commun = git(racine, 'rev-parse', '--path-format=absolute', '--git-common-dir');
69
+ return commun ? path.join(commun, 'nuit', 'dernier-vert') : null;
70
+ }
71
+ /**
72
+ * The skip of the project at <racine> when its top is the commit of its last green night; else
73
+ * null: it plays (its top moved, or no marker that reads as a commit of the repository).
74
+ */
75
+ export function sautDuProjet(racine) {
76
+ const sommet = git(racine, 'rev-parse', '--verify', '-q', 'HEAD^{commit}');
77
+ const marqueur = marqueurDeLaNuit(racine);
78
+ if (!sommet || !marqueur) {
79
+ return null;
80
+ }
81
+ let reference;
82
+ try {
83
+ reference = readFileSync(marqueur, 'utf8').trim();
84
+ }
85
+ catch {
86
+ return null;
87
+ }
88
+ if (!SHA.test(reference) || git(racine, 'cat-file', '-e', `${reference}^{commit}`) === null) {
89
+ return null;
90
+ }
91
+ return reference === sommet
92
+ ? {
93
+ racine,
94
+ raison: `son sommet ${sommet.slice(0, 7)} est celui de sa dernière nuit verte : rien n’a bougé`,
95
+ sommet,
96
+ reference,
97
+ }
98
+ : null;
99
+ }
100
+ /** The choice of a scheduled night among <projets>: left out, skipped, or played, in their order. */
101
+ export function choisir(projets) {
102
+ const choix = { jouer: [], sautes: [], ecartes: [] };
103
+ for (const racine of projets) {
104
+ const raison = ecartDuProjet(racine);
105
+ if (raison) {
106
+ choix.ecartes.push({ racine, raison });
107
+ continue;
108
+ }
109
+ const saut = sautDuProjet(racine);
110
+ if (saut) {
111
+ choix.sautes.push(saut);
112
+ }
113
+ else {
114
+ choix.jouer.push(racine);
115
+ }
116
+ }
117
+ return choix;
118
+ }
119
+ //# sourceMappingURL=choix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choix.js","sourceRoot":"","sources":["../../../src/temporal/nuits/choix.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,iGAAiG;AACjG,yFAAyF;AACzF,EAAE;AACF,qFAAqF;AACrF,8FAA8F;AAC9F,oCAAoC;AACpC,mGAAmG;AACnG,mGAAmG;AACnG,4DAA4D;AAC5D,mGAAmG;AACnG,0EAA0E;AAC1E,gGAAgG;AAChG,mGAAmG;AACnG,oGAAoG;AACpG,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,GAAG,GAAG,mBAAmB,CAAC;AAEhC,8DAA8D;AAC9D,SAAS,G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P,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,SAAS,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5F,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,SAAS,KAAK,MAAM;QACzB,CAAC,CAAC;YACE,MAAM;YACN,MAAM,EAAE,cAAc,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,uDAAuD;YAC/F,MAAM;YACN,SAAS;SACV;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,OAAO,CAAC,OAAiB;IACvC,MAAM,KAAK,GAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACpE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACvC,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,IAAI,EAAE,CAAC;YACT,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type Client, type ScheduleOptions, type ScheduleOptionsStartWorkflowAction } from '@temporalio/client';
2
+ import { type DemandeDeNuit, type VueDesNuits } from './contrat.js';
3
+ /** Asks the workflow of the nights for <demande>, started on <file> when none runs. */
4
+ export declare function demanderDesNuits(client: Client, demande: DemandeDeNuit, { file, id }?: {
5
+ file?: string;
6
+ id?: string;
7
+ }): Promise<void>;
8
+ /** The nights as the workflow gives them. */
9
+ export declare function lireLesNuits(client: Client, id?: string): Promise<VueDesNuits>;
10
+ /** The hour of the schedule when none is given and none exists: 1 h, the earliest of the former nights. */
11
+ export declare const HEURE_PAR_DEFAUT = 1;
12
+ /**
13
+ * The schedule of the machine at <heure> (0 to 23) in the time zone <fuseau>: every day at that
14
+ * hour, the workflow NUIT_PLANIFIEE on <file>; overlap SKIP, a firing missed taken within 24 h,
15
+ * once. The hour belongs to the schedule, one for the machine, apart from the night of each
16
+ * project that the bilan counts (`grillhouse.plageDeNuit`).
17
+ */
18
+ export declare function optionsDeLaPlanification(heure: number, fuseau: string, { file, id }?: {
19
+ file?: string;
20
+ id?: string;
21
+ }): ScheduleOptions<ScheduleOptionsStartWorkflowAction<() => Promise<void>>>;
22
+ /** The hour of the schedule <id> as the server keeps it, or null when it does not exist. */
23
+ export declare function heureDeLaPlanification(client: Client, id?: string): Promise<number | null>;
24
+ /**
25
+ * Creates the schedule <options>, or updates the one that exists to them: played again, it leaves
26
+ * one schedule. Whether it was created.
27
+ */
28
+ export declare function planifierLesNuits(client: Client, options: ReturnType<typeof optionsDeLaPlanification>): Promise<boolean>;
@@ -0,0 +1,83 @@
1
+ // The client of the nights of the machine (./deroule.ts): it asks for nights (the signal DEMANDER,
2
+ // the workflow of the nights started when none runs), reads them (the query L_ETAT_DES_NUITS), and
3
+ // creates or updates the one schedule of the machine, which starts the workflow NUIT_PLANIFIEE
4
+ // every day at its hour, and reads that hour back.
5
+ import { ScheduleAlreadyRunning, ScheduleNotFoundError, } from '@temporalio/client';
6
+ import { FILE_DE_LA_MACHINE } from '../installation.js';
7
+ import { DEMANDER, ID_DE_LA_NUIT_PLANIFIEE, ID_DE_LA_PLANIFICATION, ID_DES_NUITS, L_ETAT_DES_NUITS, NUIT_PLANIFIEE, NUITS, RATTRAPAGE, } from './contrat.js';
8
+ /** Asks the workflow of the nights for <demande>, started on <file> when none runs. */
9
+ export async function demanderDesNuits(client, demande, { file = FILE_DE_LA_MACHINE, id = ID_DES_NUITS } = {}) {
10
+ await client.workflow.signalWithStart(NUITS, {
11
+ workflowId: id,
12
+ taskQueue: file,
13
+ args: [{}],
14
+ signal: DEMANDER,
15
+ signalArgs: [demande],
16
+ });
17
+ }
18
+ /** The nights as the workflow gives them. */
19
+ export async function lireLesNuits(client, id = ID_DES_NUITS) {
20
+ return client.workflow.getHandle(id).query(L_ETAT_DES_NUITS);
21
+ }
22
+ /** The hour of the schedule when none is given and none exists: 1 h, the earliest of the former nights. */
23
+ export const HEURE_PAR_DEFAUT = 1;
24
+ /**
25
+ * The schedule of the machine at <heure> (0 to 23) in the time zone <fuseau>: every day at that
26
+ * hour, the workflow NUIT_PLANIFIEE on <file>; overlap SKIP, a firing missed taken within 24 h,
27
+ * once. The hour belongs to the schedule, one for the machine, apart from the night of each
28
+ * project that the bilan counts (`grillhouse.plageDeNuit`).
29
+ */
30
+ export function optionsDeLaPlanification(heure, fuseau, { file = FILE_DE_LA_MACHINE, id = ID_DE_LA_PLANIFICATION } = {}) {
31
+ return {
32
+ scheduleId: id,
33
+ spec: {
34
+ calendars: [{ hour: heure, minute: 0, comment: 'les nuits de la machine' }],
35
+ timezone: fuseau,
36
+ },
37
+ action: {
38
+ type: 'startWorkflow',
39
+ workflowType: NUIT_PLANIFIEE,
40
+ workflowId: ID_DE_LA_NUIT_PLANIFIEE,
41
+ taskQueue: file,
42
+ args: [],
43
+ },
44
+ policies: { overlap: 'SKIP', catchupWindow: RATTRAPAGE },
45
+ };
46
+ }
47
+ /** The hour of the schedule <id> as the server keeps it, or null when it does not exist. */
48
+ export async function heureDeLaPlanification(client, id = ID_DE_LA_PLANIFICATION) {
49
+ try {
50
+ const d = await client.schedule.getHandle(id).describe();
51
+ const h = d.spec.calendars?.[0]?.hour?.[0]?.start;
52
+ return typeof h === 'number' ? h : null;
53
+ }
54
+ catch (e) {
55
+ if (e instanceof ScheduleNotFoundError) {
56
+ return null;
57
+ }
58
+ throw e;
59
+ }
60
+ }
61
+ /**
62
+ * Creates the schedule <options>, or updates the one that exists to them: played again, it leaves
63
+ * one schedule. Whether it was created.
64
+ */
65
+ export async function planifierLesNuits(client, options) {
66
+ try {
67
+ await client.schedule.create(options);
68
+ return true;
69
+ }
70
+ catch (e) {
71
+ if (!(e instanceof ScheduleAlreadyRunning)) {
72
+ throw e;
73
+ }
74
+ }
75
+ await client.schedule.getHandle(options.scheduleId).update(avant => ({
76
+ ...avant,
77
+ spec: options.spec,
78
+ action: options.action,
79
+ policies: { ...avant.policies, ...options.policies },
80
+ }));
81
+ return false;
82
+ }
83
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/temporal/nuits/client.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,mGAAmG;AACnG,+FAA+F;AAC/F,mDAAmD;AACnD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GAItB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,QAAQ,EACR,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,UAAU,GAIX,MAAM,cAAc,CAAC;AAEtB,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,OAAsB,EACtB,EAAE,IAAI,GAAG,kBAAkB,EAAE,EAAE,GAAG,YAAY,KAAqC,EAAE;IAErF,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE;QAC3C,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,CAAC,EAA2B,CAAC;QACnC,MAA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,CAAC,CAAC,EAAE,KAAK,CAAC;QAClD,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,qBAAqB,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,OAAoD;IAEpD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,CAAC,CAAC,YAAY,sBAAsB,CAAC,EAAE,CAAC;YAC3C,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IACD,MAAM,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnE,GAAG,KAAK;QACR,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE;KACrD,CAAC,CAAC,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ // The subcommand `grillhouse nuit`, the night of a project and the client of the nights of the
3
+ // machine (./client.ts):
4
+ //
5
+ // grillhouse nuit the pass of the night of the project of the working directory
6
+ // (scripts/nuit.sh), which the workflow of the nights launches
7
+ // grillhouse nuit <projet> asks for the night of <projet> (a folder of its repository)
8
+ // grillhouse nuit --planifier [--heure <0-23>]
9
+ // creates or updates the one schedule of the machine
10
+ // grillhouse nuit --help the usage on the output (also -h), exit 0
11
+ //
12
+ // - Alone, it plays the pass (scripts/nuit.sh, with this process's streams; its exit code is the
13
+ // command's): the workflow of the nights runs it in each project, as the table of tasks did.
14
+ // - With a project, the night of its main tree goes to the workflow of the nights, which plays
15
+ // it in its turn, its marker unread; a project already in its queue or under way is not put in
16
+ // twice. A project left out of the nights (its root gone, no night wired: ./choix.ts) is
17
+ // refused, by its reason, exit 2.
18
+ // - `--planifier` creates the schedule of the machine, or updates the one that exists (one, id
19
+ // fixed, overlap SKIP, a missed firing taken within 24 h): every day at <heure>, in the time zone
20
+ // of the machine; without `--heure`, the hour the schedule already has, 1 h for a new one. Played
21
+ // again, it leaves one schedule.
22
+ // - A server that does not answer is said on the error stream, exit 1; a malformed call writes the
23
+ // usage on the error stream, exit 2.
24
+ import { spawn } from 'node:child_process';
25
+ import path from 'node:path';
26
+ import { fileURLToPath } from 'node:url';
27
+ import { sansReponseEn } from '../../../scripts/sans-reponse.mjs';
28
+ import { DELAI_JOIGNABLE_MS, adresseDuServeur, ouvrirLeClient, serveurJoignable, } from '../client.js';
29
+ import { arbrePrincipalDe, lireLAppel } from './appel.js';
30
+ import { ecartDuProjet } from './choix.js';
31
+ import { demanderDesNuits, HEURE_PAR_DEFAUT, heureDeLaPlanification, optionsDeLaPlanification, planifierLesNuits, } from './client.js';
32
+ const PASSE = fileURLToPath(new URL('../../../scripts/nuit.sh', import.meta.url));
33
+ const USAGE = 'Usage : grillhouse nuit [<projet> | --planifier [--heure <0-23>]]\n' +
34
+ 'Seule, la passe de nuit du projet du dossier courant (la passe complète jouée pour de vrai,\n' +
35
+ 'puis les tests de nuit et les bancs de temps), que le déroulé des nuits lance.\n' +
36
+ ' <projet> demande la nuit de ce projet au déroulé des nuits, qui la joue à son tour\n' +
37
+ ' --planifier crée ou met à jour la planification des nuits de la machine, chaque jour\n' +
38
+ ' à --heure (0-23) ; sans elle, l’heure qu’elle a déjà, 1 h pour une neuve\n' +
39
+ ' -h, --help affiche cette aide\n';
40
+ // The pass of the night, with this process's streams: its exit code.
41
+ function jouerLaPasse() {
42
+ const enfant = spawn('bash', [PASSE], { stdio: 'inherit' });
43
+ const relais = (s) => enfant.kill(s);
44
+ for (const s of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
45
+ process.on(s, relais);
46
+ }
47
+ return new Promise(ok => enfant.on('close', (code, signal) => ok(code ?? (signal ? 128 : 1))));
48
+ }
49
+ async function principal(argv) {
50
+ const appel = lireLAppel(argv);
51
+ if (appel.quoi === 'passe') {
52
+ return jouerLaPasse();
53
+ }
54
+ if (appel.quoi === 'aide') {
55
+ process.stdout.write(USAGE);
56
+ return 0;
57
+ }
58
+ if (appel.quoi === 'faute') {
59
+ process.stderr.write(`⛔ grillhouse nuit : ${appel.raison}\n${USAGE}`);
60
+ return 2;
61
+ }
62
+ let racine = null;
63
+ if (appel.quoi === 'demander') {
64
+ const arbre = arbrePrincipalDe(path.resolve(appel.projet));
65
+ const raison = 'raison' in arbre ? arbre.raison : ecartDuProjet(arbre.racine);
66
+ if (raison !== null) {
67
+ process.stderr.write(`⛔ grillhouse nuit : pas de nuit pour ${appel.projet} : ${raison}.\n`);
68
+ return 2;
69
+ }
70
+ racine = arbre.racine;
71
+ }
72
+ const adresse = adresseDuServeur();
73
+ if (!(await serveurJoignable(adresse))) {
74
+ process.stderr.write(`⛔ ${sansReponseEn(DELAI_JOIGNABLE_MS)} sur ${adresse} : \`npx grillhouse temporal etat\` dit l'état du service.\n`);
75
+ return 1;
76
+ }
77
+ const c = ouvrirLeClient();
78
+ try {
79
+ if (racine !== null) {
80
+ await demanderDesNuits(c.client, { projet: racine });
81
+ process.stdout.write(`▶ la nuit de ${racine} est demandée : le déroulé des nuits la joue à son tour, après celle en cours.\n`);
82
+ return 0;
83
+ }
84
+ const heure = (appel.quoi === 'planifier' ? appel.heure : null) ??
85
+ (await heureDeLaPlanification(c.client)) ??
86
+ HEURE_PAR_DEFAUT;
87
+ const fuseau = Intl.DateTimeFormat().resolvedOptions().timeZone;
88
+ const cree = await planifierLesNuits(c.client, optionsDeLaPlanification(heure, fuseau));
89
+ process.stdout.write(`▶ la planification des nuits est ${cree ? 'créée' : 'à jour'} : chaque jour à ${heure} h (${fuseau}), ` +
90
+ 'les projets du registre qui ont bougé depuis leur dernière nuit verte, l’un après l’autre.\n');
91
+ return 0;
92
+ }
93
+ finally {
94
+ await c.fermer();
95
+ }
96
+ }
97
+ // The message of <e> and of each of its causes, as Temporal wraps a failure in its own.
98
+ const raisons = (e) => e instanceof Error
99
+ ? [e.message, ...(e.cause === undefined ? [] : [raisons(e.cause)])].join(' : ')
100
+ : String(e);
101
+ principal(process.argv.slice(2)).then(code => {
102
+ process.exitCode = code;
103
+ }, (e) => {
104
+ process.stderr.write(`⛔ grillhouse nuit : ${raisons(e)}\n`);
105
+ process.exitCode = 1;
106
+ });
107
+ //# sourceMappingURL=commande.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commande.js","sourceRoot":"","sources":["../../../src/temporal/nuits/commande.ts"],"names":[],"mappings":";AACA,+FAA+F;AAC/F,yBAAyB;AACzB,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,+FAA+F;AAC/F,iDAAiD;AACjD,sFAAsF;AACtF,6EAA6E;AAC7E,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,+FAA+F;AAC/F,iGAAiG;AACjG,2FAA2F;AAC3F,oCAAoC;AACpC,+FAA+F;AAC/F,oGAAoG;AACpG,oGAAoG;AACpG,mCAAmC;AACnC,mGAAmG;AACnG,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,C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