@roomi-fields/grillhouse 0.47.0 → 0.48.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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +54 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +18 -38
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +5 -0
- package/cadre/templates/projet/CLAUDE.md +23 -6
- package/charte.md +9 -2
- package/dist/temporal/circuit/commande.js +5 -3
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/commande.js +2 -13
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -1
- package/dist/temporal/deroules.js +2 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -4
- package/dist/temporal/file/activites.js +13 -14
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +20 -91
- package/dist/temporal/file/contrat.js +7 -3
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +1 -9
- package/dist/temporal/file/deroule.js +54 -163
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +26 -1
- package/dist/temporal/installation.js +111 -2
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +11 -2
- package/dist/temporal/nuits/activites.js +16 -5
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/choix.d.ts +15 -0
- package/dist/temporal/nuits/choix.js +20 -0
- package/dist/temporal/nuits/choix.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +16 -3
- package/dist/temporal/nuits/deroule.js +9 -2
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +13 -2
- package/dist/temporal/places/client.js +17 -2
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +41 -4
- package/dist/temporal/places/contrat.js +8 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +46 -6
- package/dist/temporal/places/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +166 -41
- package/docs/INTERFACE.md +13 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +48 -10
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-a-l-arret.mjs +2 -5
- package/scripts/attente-au-tour.mjs +2 -5
- package/scripts/branche-de-nuit.mjs +32 -44
- package/scripts/ci-de-main.mjs +221 -19
- package/scripts/circuit.mjs +47 -34
- package/scripts/commandes-composees.mjs +36 -6
- package/scripts/composition-des-langages.mjs +2 -0
- package/scripts/crochets.mjs +2 -2
- package/scripts/effets.mjs +2 -1
- package/scripts/enveloppe/enveloppe.mjs +61 -6
- package/scripts/enveloppe/travail-de-la-copie.mjs +2 -0
- package/scripts/etapes.mjs +11 -1
- package/scripts/etat-du-depot.mjs +23 -0
- package/scripts/faits-du-circuit.mjs +12 -23
- package/scripts/fermeture-de-la-machine.d.mts +27 -0
- package/scripts/fermeture-de-la-machine.mjs +108 -0
- package/scripts/greffons.mjs +1 -1
- package/scripts/integration/file.mjs +16 -13
- package/scripts/integration/integrer.mjs +2 -0
- package/scripts/jointure.d.ts +5 -0
- package/scripts/langages/c/index.mjs +2 -0
- package/scripts/langages/c/squelette.mjs +1 -1
- package/scripts/langages/cargo/index.mjs +2 -0
- package/scripts/langages/python/index.mjs +2 -0
- package/scripts/langages/typescript/index.mjs +3 -0
- package/scripts/langages/typescript/module-absent.mjs +24 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +19 -1
- package/scripts/langages/typescript/vitest-config/lances.mjs +3 -1
- package/scripts/langages.mjs +25 -3
- package/scripts/machine.mjs +103 -0
- package/scripts/matieres-cles.mjs +17 -0
- package/scripts/matieres-lues.mjs +104 -0
- package/scripts/migrations/0.48.0-ci-declenchee-par-la-file.mjs +32 -0
- package/scripts/migrations/0.48.0-poussee-retiree.mjs +31 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/nuit.sh +16 -44
- package/scripts/passe-de-la-machine.mjs +9 -7
- package/scripts/places-de-la-machine.mjs +74 -11
- package/scripts/places-du-serveur.mjs +29 -8
- package/scripts/poussee-retiree.mjs +18 -0
- package/scripts/registre.d.mts +2 -2
- package/scripts/regles-des-places.d.mts +36 -5
- package/scripts/regles-des-places.mjs +56 -9
- package/scripts/reponses-du-circuit.d.mts +2 -0
- package/scripts/reponses-du-circuit.mjs +26 -0
- package/scripts/resultats.mjs +40 -0
- package/scripts/sous-commandes.mjs +15 -2
- package/scripts/superviseur.mjs +64 -57
- package/scripts/tableau.mjs +132 -67
- package/scripts/transitions.d.mts +8 -0
- package/scripts/transitions.mjs +21 -3
- package/skills/pitmaster/SKILL.md +6 -3
- package/skills/relecteur/SKILL.md +3 -1
- package/scripts/poussee-cles.mjs +0 -46
|
@@ -67,6 +67,10 @@
|
|
|
67
67
|
// root's task sets none, since `$TURBO_EXTENDS$` then extends an empty list; then
|
|
68
68
|
// `$TURBO_ROOT$/<dir>/**` each) and waits, beside the root's `dependsOn`, for each trace whose
|
|
69
69
|
// output one of them overlaps (`<producer>#trace:<name>`); the producer declares nothing for it.
|
|
70
|
+
// The patterns its test files declare they read (`// @lit <motif>` at their head,
|
|
71
|
+
// ./vitest-config/lances.mjs) are hashed with them (`$TURBO_ROOT$/<motif>` each, those `lit`
|
|
72
|
+
// already covers left out), a package without `lit` included: one declaration, read by the
|
|
73
|
+
// choice of the tests of a pass and by Turborepo's cache.
|
|
70
74
|
// - `traces`: each trace the package produces, its command the package's script of the same name,
|
|
71
75
|
// `trace:<name>`. Its task waits for `build` and `^build`, and for the traces its `lit` overlaps;
|
|
72
76
|
// it hashes the package's files and its `lit`, its output left out, and Turborepo caches its
|
|
@@ -174,6 +178,7 @@ import {
|
|
|
174
178
|
VARIABLE_TRAVAILLEURS as TRAVAILLEURS,
|
|
175
179
|
} from '../../services-du-noyau.mjs';
|
|
176
180
|
import { matieres } from './consommateurs.mjs';
|
|
181
|
+
import { lecturesDeclarees, testsDuPaquet } from './vitest-config/lances.mjs';
|
|
177
182
|
import { parcourir } from './parcours.mjs';
|
|
178
183
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
179
184
|
import { ecrireSarif, RESULTATS } from '../../resultats.mjs';
|
|
@@ -717,6 +722,17 @@ function declarations(liste) {
|
|
|
717
722
|
});
|
|
718
723
|
}
|
|
719
724
|
|
|
725
|
+
// The patterns the test files of the package at <dossier> (absolute) declare they read (`// @lit`
|
|
726
|
+
// at their head, ./vitest-config/lances.mjs), each a glob from the root, those the paths <lit> of
|
|
727
|
+
// the package already cover left out; sorted.
|
|
728
|
+
function lecturesDesTests(dossier, lit) {
|
|
729
|
+
return [
|
|
730
|
+
...new Set(testsDuPaquet(dossier).flatMap(t => lecturesDeclarees(readFileSync(t, 'utf8')))),
|
|
731
|
+
]
|
|
732
|
+
.filter(m => !lit.some(l => m === l || m.startsWith(`${l}/`)))
|
|
733
|
+
.sort();
|
|
734
|
+
}
|
|
735
|
+
|
|
720
736
|
// The text of a package's turbo.json, whose tasks are <taches>.
|
|
721
737
|
const texte = taches =>
|
|
722
738
|
`// Généré par \`${COMMANDE}\` depuis les package.json, le turbo.json racine et docs/agents/hors-cadre.txt ; ne pas éditer.\n${JSON.stringify(
|
|
@@ -821,12 +837,14 @@ export function attendus(racine) {
|
|
|
821
837
|
}
|
|
822
838
|
}
|
|
823
839
|
const decl = decls.get(dossier);
|
|
824
|
-
|
|
840
|
+
const declares = lecturesDesTests(path.join(racine, dossier), decl.lit);
|
|
841
|
+
if (decl.lit.length || declares.length) {
|
|
825
842
|
taches[TESTS] = {
|
|
826
843
|
dependsOn: [...deplier(deRacine.get(TESTS)?.dependsOn ?? []), ...jointes(decl.lit)],
|
|
827
844
|
inputs: [
|
|
828
845
|
base(TESTS),
|
|
829
846
|
...decl.lit.map(l => `$TURBO_ROOT$/${l}/**`),
|
|
847
|
+
...declares.map(m => `$TURBO_ROOT$/${m}`),
|
|
830
848
|
...gitsExclus(decl.lit, sm),
|
|
831
849
|
],
|
|
832
850
|
};
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
// target of Bazel declares its `data`: a line `// @lit <motif> …` of the comment at its head,
|
|
40
40
|
// each pattern a glob from the top of the repository (`// @lit packages/grillhouse/scripts/**`).
|
|
41
41
|
// ./changements.mjs adds it to the tests of every pass, targeted or not, whose changes, files
|
|
42
|
-
// changed, added or removed, one of its patterns covers
|
|
42
|
+
// changed, added or removed, one of its patterns covers; the generator of the packages'
|
|
43
|
+
// turbo.json (../turbo-des-paquets.mjs) writes each pattern in the inputs of the package's test
|
|
44
|
+
// task, so that Turborepo's cache follows the same declaration.
|
|
43
45
|
// - What a test names without the frame reading it (`nonDeclares`): a string of the test's code or
|
|
44
46
|
// of its material that ends the path of a module of its package (`'verrou.mjs'`,
|
|
45
47
|
// `'verrous/verrou.mjs'`), out of a directory of tests, the module out of what the test reads and
|
package/scripts/langages.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
30
30
|
import { createRequire } from 'node:module';
|
|
31
31
|
import path from 'node:path';
|
|
32
32
|
import { composer } from './composition-des-langages.mjs';
|
|
33
|
+
import { matieresDeclarees, sousUneMatiere } from './matieres-lues.mjs';
|
|
33
34
|
import {
|
|
34
35
|
ARCHITECTURE,
|
|
35
36
|
COLONNE,
|
|
@@ -98,10 +99,31 @@ export function langagesDe(racine) {
|
|
|
98
99
|
return noms.map(charger);
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
// The class of a file under a folder of test material the project declares
|
|
103
|
+
// (`grillhouse.matieres`, ./matieres-cles.mjs): shared test material, never played.
|
|
104
|
+
const MATIERE_DECLAREE = Object.freeze({ joue: false, test: false, matiere: true });
|
|
105
|
+
|
|
106
|
+
// <langage> with the answer of `estUnTest` completed after its modules: the first answer not null
|
|
107
|
+
// of a module stays the file's; a file under a declared folder, in any language, is test material;
|
|
108
|
+
// any other file keeps the answer of its module.
|
|
109
|
+
const avecLesMatieres = langage =>
|
|
110
|
+
Object.assign(Object.create(langage), {
|
|
111
|
+
estUnTest: (chemin, racine) =>
|
|
112
|
+
langage.estUnTest(chemin, racine) ??
|
|
113
|
+
(sousUneMatiere(
|
|
114
|
+
matieresDeclarees(racine, d => langage.composants(d)),
|
|
115
|
+
racine,
|
|
116
|
+
chemin
|
|
117
|
+
)
|
|
118
|
+
? MATIERE_DECLAREE
|
|
119
|
+
: null),
|
|
120
|
+
});
|
|
121
|
+
|
|
101
122
|
const composes = new Map();
|
|
102
123
|
/**
|
|
103
|
-
* The join of the modules that serve the project at <racine> (`langagesDe`):
|
|
104
|
-
* when the project declares one,
|
|
124
|
+
* The join of the modules that serve the project at <racine> (`langagesDe`): their composition
|
|
125
|
+
* (the module itself when the project declares one), the folders of test material the project
|
|
126
|
+
* declares (`grillhouse.matieres`) added to `estUnTest`, built once per list of languages.
|
|
105
127
|
* @param {string} racine the root of the project
|
|
106
128
|
* @returns {import('./jointure.js').Composition}
|
|
107
129
|
*/
|
|
@@ -109,7 +131,7 @@ export function langageDe(racine) {
|
|
|
109
131
|
const modules = langagesDe(racine);
|
|
110
132
|
const cle = modules.map(m => m.nom).join('+');
|
|
111
133
|
if (!composes.has(cle)) {
|
|
112
|
-
composes.set(cle, composer(modules));
|
|
134
|
+
composes.set(cle, avecLesMatieres(composer(modules)));
|
|
113
135
|
}
|
|
114
136
|
return composes.get(cle);
|
|
115
137
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// `grillhouse machine fermer [--attendre]` and `grillhouse machine rouvrir`: closes the machine to
|
|
2
|
+
// new work and reopens it, as `kubectl cordon` / `drain` / `uncordon` do for a node, so that the
|
|
3
|
+
// poste restarts without cutting a circuit in the middle of its work.
|
|
4
|
+
//
|
|
5
|
+
// - `fermer`: no place is given any more, to any project of the poste, and no ticket starts; each
|
|
6
|
+
// circuit alive finishes its step, then waits without starting the next. The command returns at
|
|
7
|
+
// once (as `cordon`), saying what still runs by project and by ticket, and « la machine est
|
|
8
|
+
// vide » when nothing plays; played again, it reads that state. With `--attendre` it returns
|
|
9
|
+
// only once the machine is empty (as `drain`): exit 0.
|
|
10
|
+
// - `rouvrir`: the circuits go on by themselves at the next step.
|
|
11
|
+
// - A night that holds the machine is never doubled nor lifted: the command says so (exit 0).
|
|
12
|
+
// - The closure lives in the state of the places on the Temporal server: it survives a restart of
|
|
13
|
+
// the poste, and no circuit starts again before the reopening.
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { setTimeout as dormirVraiment } from 'node:timers/promises';
|
|
16
|
+
import { direLaFermeture } from './fermeture-de-la-machine.mjs';
|
|
17
|
+
import {
|
|
18
|
+
dossierDesParts,
|
|
19
|
+
fermerLaMachine,
|
|
20
|
+
lireLesParts,
|
|
21
|
+
lirePlaces,
|
|
22
|
+
rouvrirLaMachine,
|
|
23
|
+
} from './places-de-la-machine.mjs';
|
|
24
|
+
|
|
25
|
+
const SONDE_MS = 2_000;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* What the machine holds now: the sessions (places) and the passes (parts that hold their part),
|
|
29
|
+
* and the reservation in place.
|
|
30
|
+
* @param {Record<string, string | undefined>} env
|
|
31
|
+
*/
|
|
32
|
+
export function lireLaMachine(env = process.env) {
|
|
33
|
+
const lues = lirePlaces({ env });
|
|
34
|
+
return {
|
|
35
|
+
prises: lues.prises ?? [],
|
|
36
|
+
parts: lireLesParts(dossierDesParts(env)).prises,
|
|
37
|
+
fermeture: lues.fermeture ?? null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Plays the command <mode> (`fermer` or `rouvrir`) with its arguments <args>: its lines, one per
|
|
43
|
+
* call of <dire>; the exit code.
|
|
44
|
+
* @param {string | undefined} mode
|
|
45
|
+
* @param {string[]} args
|
|
46
|
+
* @param {{ env?: Record<string, string | undefined>, dire?: (l: string) => void,
|
|
47
|
+
* maintenant?: () => number,
|
|
48
|
+
* agir?: (mode: 'fermer' | 'rouvrir', o: { env: Record<string, string | undefined> }) => string,
|
|
49
|
+
* lire?: (env: Record<string, string | undefined>) => ReturnType<typeof lireLaMachine>,
|
|
50
|
+
* dormir?: (ms: number) => Promise<unknown> }} [o]
|
|
51
|
+
* @returns {Promise<number>}
|
|
52
|
+
*/
|
|
53
|
+
export async function jouer(
|
|
54
|
+
mode,
|
|
55
|
+
args,
|
|
56
|
+
{
|
|
57
|
+
env = process.env,
|
|
58
|
+
dire = l => console.log(l),
|
|
59
|
+
maintenant = Date.now,
|
|
60
|
+
agir = (m, o) => (m === 'fermer' ? fermerLaMachine(o) : rouvrirLaMachine(o)),
|
|
61
|
+
lire = lireLaMachine,
|
|
62
|
+
dormir = dormirVraiment,
|
|
63
|
+
} = {},
|
|
64
|
+
) {
|
|
65
|
+
const attendre = args.includes('--attendre');
|
|
66
|
+
if ((mode !== 'fermer' && mode !== 'rouvrir') || args.some(a => a !== '--attendre') || (attendre && mode !== 'fermer')) {
|
|
67
|
+
process.stderr.write('usage : grillhouse machine fermer [--attendre] | rouvrir\n');
|
|
68
|
+
return 2;
|
|
69
|
+
}
|
|
70
|
+
const issue = agir(mode, { env });
|
|
71
|
+
const dit = () => {
|
|
72
|
+
const { prises, parts, fermeture } = lire(env);
|
|
73
|
+
for (const l of direLaFermeture({ issue, reservation: fermeture, prises, parts, maintenant: maintenant() })) {
|
|
74
|
+
dire(l);
|
|
75
|
+
}
|
|
76
|
+
return prises.length + parts.length;
|
|
77
|
+
};
|
|
78
|
+
const restent = dit();
|
|
79
|
+
if (!attendre || issue === 'nuit-tient') {
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
let encore = restent;
|
|
83
|
+
while (encore > 0) {
|
|
84
|
+
await dormir(SONDE_MS);
|
|
85
|
+
const { prises, parts } = lire(env);
|
|
86
|
+
if (prises.length + parts.length === 0) {
|
|
87
|
+
dire('la machine est vide');
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
encore = prises.length + parts.length;
|
|
91
|
+
}
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (process.argv[1] && path.basename(process.argv[1]) === 'machine.mjs') {
|
|
96
|
+
const [mode, ...args] = process.argv.slice(2);
|
|
97
|
+
try {
|
|
98
|
+
process.exitCode = await jouer(mode, args);
|
|
99
|
+
} catch (x) {
|
|
100
|
+
process.stderr.write(`⛔ grillhouse machine : ${x?.message ?? x}\n`);
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The folders of test material a project declares (`grillhouse.matieres` of its root package.json,
|
|
2
|
+
// read by ./matieres-lues.mjs, which holds the rules of the key), asked by a directory of the
|
|
3
|
+
// project: the callers of the circuit, the envelope, the integration, the queue and the move of a
|
|
4
|
+
// copy, which refuse a faulty key by its name before any work.
|
|
5
|
+
import { langageDe } from './langages.mjs';
|
|
6
|
+
import { matieresDeclarees } from './matieres-lues.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The folders of test material that the project that holds <dir> declares, from the root, in the
|
|
10
|
+
* order of the key; none without the key.
|
|
11
|
+
* @param {string} dir a directory of the project: its main tree or a copy
|
|
12
|
+
* @returns {string[]}
|
|
13
|
+
* @throws {Error} the faults of the key, one per line
|
|
14
|
+
*/
|
|
15
|
+
export function matieresDeclareesDe(dir) {
|
|
16
|
+
return matieresDeclarees(dir, d => langageDe(d).composants(d));
|
|
17
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// The reading of the `grillhouse.matieres` key of a package.json, the folders of test material out
|
|
2
|
+
// of every package, as Bazel declares a `filegroup(testonly = True)` named in the `data` of a test
|
|
3
|
+
// and as the compiler of Rust keeps `tests/ui` at its root, out of every crate, its cases added
|
|
4
|
+
// with the code (Web Platform Tests keep their cases the same way): a list of folders of the
|
|
5
|
+
// repository, each from the root. The testwriter writes any file under one, as a file of shared
|
|
6
|
+
// test material; the developpeur does not (`estUnTest` of the join of the languages,
|
|
7
|
+
// scripts/langages.mjs, which the lock, the envelope and the conflicts of a copy read).
|
|
8
|
+
//
|
|
9
|
+
// This module holds the reading itself, given the components of the project; it imports no
|
|
10
|
+
// language, so that the join of the languages can use it. The reading a caller asks by a
|
|
11
|
+
// directory alone is `matieresDeclareesDe` (./matieres-cles.mjs).
|
|
12
|
+
//
|
|
13
|
+
// - The key is read from the package.json of the main tree of the repository, never of a copy, as
|
|
14
|
+
// `grillhouse.engendres` (scripts/engendres.mjs): a lot never declares the folder it then
|
|
15
|
+
// writes; each folder is resolved from the root of the tree given, the copy. Read once per pass
|
|
16
|
+
// (`luUneFois`).
|
|
17
|
+
// - A fault is refused by its key `grillhouse.matieres`, named: not a list of strings, an empty
|
|
18
|
+
// path, an absolute one, one that leaves the root, a folder absent of the main tree, a folder
|
|
19
|
+
// that is a package, holds one or lies inside one (the declaration gives the testwriter no
|
|
20
|
+
// manifest, and no package is opened to him by it). The nature of the files of a folder is not
|
|
21
|
+
// bounded, as the `data` of a `filegroup(testonly)` and `tests/ui`.
|
|
22
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
23
|
+
import path from 'node:path';
|
|
24
|
+
import { luUneFois } from './lecture-unique.mjs';
|
|
25
|
+
import { arbrePrincipal } from './outils-cles.mjs';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The folders of test material that the project that holds <dir> declares, from the root, in the
|
|
29
|
+
* order of the key; none without the key.
|
|
30
|
+
* @param {string} dir a directory of the project: its main tree or a copy
|
|
31
|
+
* @param {(dir: string) => { dossier: string }[]} composants the components of the project
|
|
32
|
+
* @returns {string[]}
|
|
33
|
+
* @throws {Error} the faults of the key, one per line
|
|
34
|
+
*/
|
|
35
|
+
export function matieresDeclarees(dir, composants) {
|
|
36
|
+
return luUneFois(`matieres ${path.resolve(dir)}`, () => lire(dir, composants));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function lire(dir, composants) {
|
|
40
|
+
const principal = arbrePrincipal(dir);
|
|
41
|
+
const f = path.join(principal, 'package.json');
|
|
42
|
+
const brut = existsSync(f) ? JSON.parse(readFileSync(f, 'utf8'))?.grillhouse?.matieres : undefined;
|
|
43
|
+
if (brut === undefined || brut === null) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(brut) || !brut.every(m => typeof m === 'string')) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`la clé grillhouse.matieres vaut ${JSON.stringify(brut)}, pas une liste de chemins de dossiers depuis la racine.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
if (brut.length === 0) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const paquets = composants(dir)
|
|
55
|
+
.map(c => path.relative(dir, c.dossier).split(path.sep).join('/'))
|
|
56
|
+
.filter(p => p !== '' && p !== '.');
|
|
57
|
+
const fautes = [];
|
|
58
|
+
const dossiers = [];
|
|
59
|
+
for (const m of brut) {
|
|
60
|
+
const n = path.posix.normalize(m === '' ? '.' : m).replace(/\/+$/, '');
|
|
61
|
+
const nom = `la clé grillhouse.matieres nomme « ${m} »`;
|
|
62
|
+
if (n === '.' || n === '') {
|
|
63
|
+
fautes.push(
|
|
64
|
+
'la clé grillhouse.matieres nomme un chemin vide ou la racine : un dossier est sous la racine.'
|
|
65
|
+
);
|
|
66
|
+
} else if (path.isAbsolute(m)) {
|
|
67
|
+
fautes.push(`${nom}, un chemin absolu : un dossier part de la racine du dépôt.`);
|
|
68
|
+
} else if (n.split('/')[0] === '..') {
|
|
69
|
+
fautes.push(`${nom}, hors du dépôt : un dossier part de la racine.`);
|
|
70
|
+
} else if (
|
|
71
|
+
!existsSync(path.join(principal, n)) ||
|
|
72
|
+
!statSync(path.join(principal, n)).isDirectory()
|
|
73
|
+
) {
|
|
74
|
+
fautes.push(`${nom}, qui n'est pas un dossier de l'arbre principal.`);
|
|
75
|
+
} else {
|
|
76
|
+
const paquet = paquets.find(p => n === p || n.startsWith(`${p}/`) || p.startsWith(`${n}/`));
|
|
77
|
+
if (paquet) {
|
|
78
|
+
fautes.push(
|
|
79
|
+
`${nom}, qui recouvre le paquet ${paquet} : un dossier de matière est hors de tout paquet.`
|
|
80
|
+
);
|
|
81
|
+
} else {
|
|
82
|
+
dossiers.push(n);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (fautes.length) {
|
|
87
|
+
throw new Error(fautes.join('\n'));
|
|
88
|
+
}
|
|
89
|
+
return dossiers;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether <fichier> (absolute, or from <racine>) lies under one of the folders <dossiers>.
|
|
94
|
+
* @param {string[]} dossiers
|
|
95
|
+
* @param {string} racine
|
|
96
|
+
* @param {string} fichier
|
|
97
|
+
*/
|
|
98
|
+
export function sousUneMatiere(dossiers, racine, fichier) {
|
|
99
|
+
if (dossiers.length === 0) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
const rel = path.relative(racine, path.resolve(racine, fichier)).split(path.sep).join('/');
|
|
103
|
+
return dossiers.some(d => rel.startsWith(`${d}/`));
|
|
104
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// From 0.48.0 the queue of the project starts the CI of main itself after a lot entered, one pass
|
|
2
|
+
// an hour at most (scripts/ci-de-main.mjs `declencherLaCiDeMain`): the frame's ci.yml loses its
|
|
3
|
+
// hourly schedule and its job `moved`, and keeps `workflow_dispatch` and `workflow_call`.
|
|
4
|
+
//
|
|
5
|
+
// - A ci.yml of the frame (its mark on the first line, scripts/workflows-du-cadre.mjs) is rewritten
|
|
6
|
+
// on the template's new one; a ci.yml without the mark, and every other workflow, stay as they
|
|
7
|
+
// are. A second pass changes nothing and says nothing.
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { CADRE } from '../cadre.mjs';
|
|
11
|
+
import { estDuCadre, GABARIT_DES_WORKFLOWS, WORKFLOWS } from '../workflows-du-cadre.mjs';
|
|
12
|
+
|
|
13
|
+
export const version = '0.48.0';
|
|
14
|
+
export const nom = 'ci declenchee par la file';
|
|
15
|
+
|
|
16
|
+
/** The ci.yml of the frame of <projet> written on the template's; returns what it did. */
|
|
17
|
+
export function migrer(projet) {
|
|
18
|
+
const fichier = path.join(projet, WORKFLOWS, 'ci.yml');
|
|
19
|
+
const modele = path.join(CADRE, GABARIT_DES_WORKFLOWS, 'ci.yml');
|
|
20
|
+
if (!existsSync(fichier) || !existsSync(modele)) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const actuel = readFileSync(fichier, 'utf8');
|
|
24
|
+
const voulu = readFileSync(modele, 'utf8');
|
|
25
|
+
if (!estDuCadre(actuel) || actuel === voulu) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
writeFileSync(fichier, voulu);
|
|
29
|
+
return [
|
|
30
|
+
`${WORKFLOWS}/ci.yml : la planification horaire et le travail moved sont retirés, la file déclenche elle-même la CI de main après l'entrée d'un lot, au plus une fois par heure`,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// From 0.48.0 the key `grillhouse.poussee` (the commit branch and the night branch) is retired from
|
|
2
|
+
// the frame: main receives every lot, and the night pushes nothing. A package.json of the project
|
|
3
|
+
// that carries the key, with any value, loses it, its other keys, its layout and its end of line
|
|
4
|
+
// kept; a project without the key, without `grillhouse` or without package.json is left, and a
|
|
5
|
+
// second pass changes nothing and says nothing. The remote branches of the project are not touched.
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
|
|
9
|
+
export const version = '0.48.0';
|
|
10
|
+
export const nom = 'poussee retiree';
|
|
11
|
+
|
|
12
|
+
/** `grillhouse.poussee` taken out of the package.json of <projet>; returns what it did. */
|
|
13
|
+
export function migrer(projet) {
|
|
14
|
+
const fichier = path.join(projet, 'package.json');
|
|
15
|
+
if (!existsSync(fichier)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const texte = readFileSync(fichier, 'utf8');
|
|
19
|
+
const pkg = JSON.parse(texte);
|
|
20
|
+
const grillhouse = pkg?.grillhouse;
|
|
21
|
+
if (!grillhouse || typeof grillhouse !== 'object' || !Object.hasOwn(grillhouse, 'poussee')) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
delete grillhouse.poussee;
|
|
25
|
+
const indent = /^\n?(\s+)"/m.exec(texte)?.[1] ?? 2;
|
|
26
|
+
const fin = texte.endsWith('\n') ? '\n' : '';
|
|
27
|
+
writeFileSync(fichier, `${JSON.stringify(pkg, null, indent)}${fin}`);
|
|
28
|
+
return [
|
|
29
|
+
"package.json : la clé grillhouse.poussee est retirée, main reçoit seule chaque lot et la nuit ne pousse plus ; les branches distantes du projet (l'ancienne branche de commit, la branche de nuit) ne sont pas touchées",
|
|
30
|
+
];
|
|
31
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -42,6 +42,8 @@ import * as greffonMattpocockRetire from './migrations/0.35.0-greffon-mattpocock
|
|
|
42
42
|
import * as node26Seul from './migrations/0.44.0-node-26-seul.mjs';
|
|
43
43
|
import * as seuilDesCodesDeTickets from './migrations/0.44.0-seuil-des-codes-de-tickets.mjs';
|
|
44
44
|
import * as ciDeMain from './migrations/0.47.0-ci-de-main.mjs';
|
|
45
|
+
import * as pousseeRetiree from './migrations/0.48.0-poussee-retiree.mjs';
|
|
46
|
+
import * as ciDeclencheeParLaFile from './migrations/0.48.0-ci-declenchee-par-la-file.mjs';
|
|
45
47
|
|
|
46
48
|
/** The migrations of the core. */
|
|
47
49
|
export const MIGRATIONS = [
|
|
@@ -63,6 +65,8 @@ export const MIGRATIONS = [
|
|
|
63
65
|
node26Seul,
|
|
64
66
|
seuilDesCodesDeTickets,
|
|
65
67
|
ciDeMain,
|
|
68
|
+
pousseeRetiree,
|
|
69
|
+
ciDeclencheeParLaFile,
|
|
66
70
|
];
|
|
67
71
|
|
|
68
72
|
/**
|
package/scripts/nuit.sh
CHANGED
|
@@ -66,26 +66,19 @@
|
|
|
66
66
|
# depended on a duration, one under load) waits for rest (`npx grillhouse pression attendre`,
|
|
67
67
|
# bound 15 min) and plays once more; green then, the night goes on; à repasser again, or no rest in the bound, the night
|
|
68
68
|
# ends there, « à repasser », red if the full pass is.
|
|
69
|
-
# - « À repasser » (exit 75): neither green nor red. The last green stays, no ticket opens,
|
|
70
|
-
#
|
|
69
|
+
# - « À repasser » (exit 75): neither green nor red. The last green stays, no ticket opens,
|
|
70
|
+
# the log says so; the next night plays again.
|
|
71
71
|
# - The project's night script: `grillhouse.nuit` in the package.json of the commit it plays names
|
|
72
72
|
# an npm script (`npm pkg set grillhouse.nuit=<script>`). After the night tests, the night plays
|
|
73
73
|
# `npm run <script>` in its copy; a red script turns the night red, with a log line that names it.
|
|
74
74
|
# The key is read as written, before any work: without it (or with null) the night plays
|
|
75
75
|
# no script of the project; a value that is not a non-blank string, or a name absent from the scripts of
|
|
76
76
|
# that package.json, turns the night red, with a log line that cites it, and nothing runs.
|
|
77
|
-
# - The night
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
# (or with null, as for grillhouse.poussee itself) or after a red night it pushes nothing. The
|
|
83
|
-
# keys are read as written, before any work: a grillhouse.poussee that is neither null nor an
|
|
84
|
-
# object, or a grillhouse.poussee.nuit that is not a non-blank string, turns the night red with
|
|
85
|
-
# a log line that cites it, one line per faulty key. A refused push keeps the last green, opens
|
|
86
|
-
# the night ticket « La poussée de la nuit est refusée sur <commit> vers « origin/<branch> » »
|
|
87
|
-
# (or comments the open one that names « origin/<branch> »), and exits 1; a remote already at
|
|
88
|
-
# the commit accepts the push.
|
|
77
|
+
# - The night pushes nothing: main receives every lot by the queue, on a tree judged; the night keeps
|
|
78
|
+
# its last green (`<git common dir>/nuit/dernier-vert`), a mark and not a branch. A project whose
|
|
79
|
+
# package.json carries the retired key `grillhouse.poussee`, whatever its value, turns the night
|
|
80
|
+
# red before any work, with a log line that names the key and the gesture (remove it,
|
|
81
|
+
# scripts/poussee-retiree.mjs).
|
|
89
82
|
# - The copies whose content is on main: once its steps are played, whatever their verdict, the
|
|
90
83
|
# night passes each copy `git worktree list` names, the main tree and its own left out, through
|
|
91
84
|
# scripts/retirer-copie.sh without `--jetable` (scripts/retirer-les-copies-finies.mjs), as a CI cleans its
|
|
@@ -158,7 +151,6 @@ mkdir -p "$resultats"
|
|
|
158
151
|
|
|
159
152
|
tete="$(git -C "$racine" rev-parse HEAD)"
|
|
160
153
|
copie="$racine/.claude/worktrees/nuit"
|
|
161
|
-
branche=
|
|
162
154
|
# The red steps of the night, and its red tasks: those of the full pass, each with the command
|
|
163
155
|
# that replays it alone when the language has one (in `rejeux`, which a bisect runs), then a step
|
|
164
156
|
# red without a task of its own, named by its command (no command).
|
|
@@ -198,15 +190,15 @@ jouer() {
|
|
|
198
190
|
echo "$raison"
|
|
199
191
|
return 1
|
|
200
192
|
fi
|
|
201
|
-
# The reading gives one line per finding: « script<TAB>name », «
|
|
202
|
-
#
|
|
203
|
-
#
|
|
193
|
+
# The reading gives one line per finding: « script<TAB>name », or a fault « nuit-invalide<TAB>value
|
|
194
|
+
# as JSON », « nuit-absent<TAB>name », « poussee-retiree<TAB>line ». Every faulty key is reported
|
|
195
|
+
# before any work.
|
|
204
196
|
local lecture ligne nuit=
|
|
205
197
|
lecture="$(node --input-type=module -e '
|
|
206
198
|
import { readFileSync } from "node:fs";
|
|
207
199
|
import { pathToFileURL } from "node:url";
|
|
208
200
|
const pkg = JSON.parse(readFileSync(process.argv[1], "utf8"));
|
|
209
|
-
const {
|
|
201
|
+
const { pousseeRetiree } = await import(pathToFileURL(process.argv[2]).href);
|
|
210
202
|
const out = (...l) => process.stdout.write(l.join("\t") + "\n");
|
|
211
203
|
const vide = v => typeof v !== "string" || !v.trim();
|
|
212
204
|
const v = pkg.grillhouse?.nuit;
|
|
@@ -215,26 +207,21 @@ jouer() {
|
|
|
215
207
|
else if (!Object.hasOwn(pkg.scripts ?? {}, v)) out("nuit-absent", v);
|
|
216
208
|
else out("script", v);
|
|
217
209
|
}
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
' "$copie/package.json" "$ici/poussee-cles.mjs" 2>/dev/null)"
|
|
210
|
+
const retiree = pousseeRetiree(pkg);
|
|
211
|
+
if (retiree) out("poussee-retiree", retiree);
|
|
212
|
+
' "$copie/package.json" "$ici/poussee-retiree.mjs" 2>/dev/null)"
|
|
222
213
|
local faute=0
|
|
223
214
|
while IFS= read -r ligne; do
|
|
224
215
|
case "$ligne" in
|
|
225
216
|
script$'\t'*) nuit="${ligne#script$'\t'}" ;;
|
|
226
|
-
pousse$'\t'*) branche="${ligne#pousse$'\t'}" ;;
|
|
227
217
|
nuit-invalide$'\t'*)
|
|
228
218
|
echo "✗ la clé grillhouse.nuit vaut ${ligne#nuit-invalide$'\t'}, pas un nom de script npm : rien n'est joué."
|
|
229
219
|
faute=1 ;;
|
|
230
220
|
nuit-absent$'\t'*)
|
|
231
221
|
echo "✗ la clé grillhouse.nuit nomme « ${ligne#nuit-absent$'\t'} », absent des scripts du package.json : rien n'est joué."
|
|
232
222
|
faute=1 ;;
|
|
233
|
-
poussee-
|
|
234
|
-
echo "✗
|
|
235
|
-
faute=1 ;;
|
|
236
|
-
poussee-nuit-invalide$'\t'*)
|
|
237
|
-
echo "✗ la clé grillhouse.poussee.nuit vaut ${ligne#poussee-nuit-invalide$'\t'}, pas un nom de branche : rien n'est joué."
|
|
223
|
+
poussee-retiree$'\t'*)
|
|
224
|
+
echo "✗ ${ligne#poussee-retiree$'\t'} Rien n'est joué."
|
|
238
225
|
faute=1 ;;
|
|
239
226
|
esac
|
|
240
227
|
done <<< "$lecture"
|
|
@@ -393,21 +380,6 @@ signaler() {
|
|
|
393
380
|
if [ "$verdict" -eq 0 ]; then
|
|
394
381
|
echo "$tete" > "$dossier/dernier-vert"
|
|
395
382
|
echo "✓ vert : ${tete:0:7} est le dernier vert." >> "$journal"
|
|
396
|
-
if [ -n "$branche" ]; then
|
|
397
|
-
if GRILLHOUSE_NUIT=1 GIT_TERMINAL_PROMPT=0 git -C "$racine" push origin "$tete:$branche" >> "$journal" 2>&1; then
|
|
398
|
-
echo "✓ poussée : ${tete:0:7} est sur origin/$branche." >> "$journal"
|
|
399
|
-
else
|
|
400
|
-
echo "✗ la poussée de ${tete:0:7} vers origin/$branche (grillhouse.poussee.nuit) est refusée." >> "$journal"
|
|
401
|
-
texte="La poussée de la nuit du $(date +%Y-%m-%d) est refusée : ${tete:0:7} vers origin/$branche (grillhouse.poussee.nuit).
|
|
402
|
-
Le dernier vert reste ${tete:0:7}.
|
|
403
|
-
Journal : $journal
|
|
404
|
-
Fin du journal :
|
|
405
|
-
$(tail -40 "$journal")"
|
|
406
|
-
signaler "origin/$branche" "La poussée de la nuit est refusée sur ${tete:0:7} vers « origin/$branche »" "$texte"
|
|
407
|
-
echo "✗ vert, poussée refusée : ticket ${numero:-neuf} (étiquette nuit)." >> "$journal"
|
|
408
|
-
exit 1
|
|
409
|
-
fi
|
|
410
|
-
fi
|
|
411
383
|
exit 0
|
|
412
384
|
fi
|
|
413
385
|
|
|
@@ -90,31 +90,33 @@ export function lancementDeLaPasse({ lourde, cmd, args, env }) {
|
|
|
90
90
|
* The command line that runs <cmd> in a control group of its own under the part <part>: `systemd-run
|
|
91
91
|
* --user --scope` (the manager of the user, no privilege), its CPU weight and its memory bound
|
|
92
92
|
* drawn from the part, no hard ceiling of CPU, the command of the pass whole at the end after
|
|
93
|
-
*
|
|
93
|
+
* `--`, given as written (`--expand-environment=no`: systemd-run would otherwise expand each
|
|
94
|
+
* `${…}` of its arguments, a shell script's included). <plafond> adds the hard CPU ceiling (`CPUQuota`, the cores of the part: the group of an
|
|
95
|
+
* agent's session); <memoire> false leaves the memory unbound. <unite> names the scope, which a
|
|
96
|
+
* sampler reads. With <fils> (the precise threads of the
|
|
94
97
|
* part, the system delegating the cpuset controller to the account) the group allows those
|
|
95
98
|
* threads only (`AllowedCPUs`), under the slice of the frame, which the programs out of the frame
|
|
96
99
|
* are kept out of.
|
|
97
100
|
* @param {{ part: { coeurs: number, memoire: number }, cmd: string, args: string[],
|
|
98
|
-
* unite?: string | null, fils?: number[] | null }} o
|
|
101
|
+
* unite?: string | null, fils?: number[] | null, plafond?: boolean, memoire?: boolean }} o
|
|
99
102
|
* @returns {{ cmd: string, args: string[] }}
|
|
100
103
|
*/
|
|
101
|
-
export function commandeDuGroupe({ part, cmd, args, unite = null, fils = null }) {
|
|
104
|
+
export function commandeDuGroupe({ part, cmd, args, unite = null, fils = null, plafond = false, memoire = true }) {
|
|
102
105
|
return {
|
|
103
106
|
cmd: LANCEUR_DE_GROUPE,
|
|
104
107
|
args: [
|
|
105
108
|
'--user',
|
|
106
109
|
'--scope',
|
|
107
110
|
'--quiet',
|
|
111
|
+
'--expand-environment=no',
|
|
108
112
|
...(unite ? [`--unit=${unite}`] : []),
|
|
109
113
|
...(fils ? [`--slice=${TRANCHE_DU_CADRE}`] : []),
|
|
110
114
|
'-p',
|
|
111
|
-
'CPUAccounting=yes',
|
|
112
|
-
'-p',
|
|
113
115
|
'MemoryAccounting=yes',
|
|
114
116
|
'-p',
|
|
115
117
|
`CPUWeight=${poidsDeLaPart(part)}`,
|
|
116
|
-
'-p',
|
|
117
|
-
`
|
|
118
|
+
...(memoire ? ['-p', `MemoryMax=${Math.floor(part.memoire)}`] : []),
|
|
119
|
+
...(plafond ? ['-p', `CPUQuota=${part.coeurs * 100}%`] : []),
|
|
118
120
|
...(fils ? ['-p', `AllowedCPUs=${listeDeCoeurs(fils)}`] : []),
|
|
119
121
|
'--',
|
|
120
122
|
cmd,
|