@roomi-fields/grillhouse 0.35.0 → 0.37.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 +28 -0
- package/cadre/templates/cargo/package.json +4 -2
- package/cadre/templates/projet/.github/workflows/ci.yml +10 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +5 -0
- package/cadre/templates/projet/CLAUDE.md +5 -0
- package/cadre/templates/python/package.json +4 -2
- package/charte.md +5 -0
- package/dist/temporal/file/contrat.d.ts +3 -1
- package/dist/temporal/file/deroule.js +2 -2
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +10 -1
- package/dist/temporal/nuits/activites.js +59 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +15 -0
- package/dist/temporal/nuits/deroule.js +67 -35
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +12 -0
- package/dist/temporal/places/client.js +23 -1
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +47 -0
- package/dist/temporal/places/contrat.js +11 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +49 -2
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.js +30 -3
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/docs/ARCHITECTURE.md +41 -9
- package/docs/CADRE.md +11 -0
- package/docs/INTERFACE.md +7 -4
- package/package.json +1 -1
- package/scripts/activites.mjs +10 -4
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-a-l-arret.mjs +1 -1
- package/scripts/attente-au-tour.mjs +1 -1
- package/scripts/binaires.mjs +119 -0
- package/scripts/file-des-tickets.d.mts +23 -1
- package/scripts/file-des-tickets.mjs +94 -3
- package/scripts/gabarit-absent.mjs +30 -0
- package/scripts/grillhouse-maj.mjs +61 -61
- package/scripts/groupe-cles.d.mts +25 -0
- package/scripts/groupe-cles.mjs +73 -0
- package/scripts/integration/file.mjs +30 -5
- package/scripts/jointure.d.ts +11 -0
- package/scripts/langages/cargo/binaires.mjs +1 -1
- package/scripts/langages/cargo/clippy.mjs +1 -1
- package/scripts/langages/cargo/commandes.mjs +1 -1
- package/scripts/langages/cargo/index.mjs +3 -2
- package/scripts/langages/cargo/mise-a-jour.mjs +17 -0
- package/scripts/langages/cargo/sccache.mjs +1 -1
- package/scripts/langages/python/commandes.mjs +1 -1
- package/scripts/langages/python/index.mjs +3 -1
- package/scripts/langages/python/mise-a-jour.mjs +22 -5
- package/scripts/langages/typescript/mise-a-jour.mjs +8 -20
- package/scripts/paquet.mjs +2 -7
- package/scripts/places-de-la-machine.mjs +53 -31
- package/scripts/regles-des-places.d.mts +34 -2
- package/scripts/regles-des-places.mjs +112 -9
- package/scripts/services-du-noyau.mjs +2 -1
- package/scripts/sigle-du-projet.mjs +49 -0
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/superviseur.mjs +31 -18
- package/scripts/tableau.mjs +483 -193
|
@@ -104,7 +104,8 @@
|
|
|
104
104
|
// brings what is installed to what is declared; the report
|
|
105
105
|
// names each one installed. One that cannot be installed has its line, the error stream of its
|
|
106
106
|
// command naming the command to type, and the exit code is non-zero. A language without
|
|
107
|
-
// binaries runs nothing.
|
|
107
|
+
// binaries runs nothing. The same installation runs alone by `npx grillhouse binaires`
|
|
108
|
+
// (scripts/binaires.mjs), which a CI plays after `npm ci`.
|
|
108
109
|
// - The git hooks: both of the frame (commit-msg « a closed ticket refuses a second commit, a reopened ticket takes its corrections », pre-push night branch
|
|
109
110
|
// guard) are placed by scripts/crochets.mjs, the mechanism `grillhouse hooks` (the project's
|
|
110
111
|
// `prepare`) also runs, in the hooks folder git reads for the project (`core.hooksPath`, else the
|
|
@@ -120,6 +121,10 @@
|
|
|
120
121
|
// as `npm install` brings what is installed to what is declared. A plugin that cannot be
|
|
121
122
|
// installed, or a mod left at another version, has its line naming the command to type; the
|
|
122
123
|
// update has finished its files, and the exit code is non-zero.
|
|
124
|
+
// - The group: when the package.json declares `grillhouse.groupe` (scripts/groupe-cles.mjs), the
|
|
125
|
+
// update sets in the Beads of the project each other project of the group as an
|
|
126
|
+
// `external_projects.<name>` (its absolute path), the ones already set left alone; a group
|
|
127
|
+
// badly declared is refused by its key before any work.
|
|
123
128
|
// - The generated files: after the package.json, each generator of the declared language
|
|
124
129
|
// (`miseAJour.generateurs` of its module) is run in the project by the project's command
|
|
125
130
|
// (`node_modules/.bin/grillhouse`, its installed package) for the file it writes when the project
|
|
@@ -149,10 +154,12 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
149
154
|
import path from 'node:path';
|
|
150
155
|
import { pathToFileURL } from 'node:url';
|
|
151
156
|
import { CADRE, VERSION } from './cadre.mjs';
|
|
157
|
+
import { installerBinaires } from './binaires.mjs';
|
|
152
158
|
import { poserCrochets } from './crochets.mjs';
|
|
153
159
|
import { ATTRIBUT } from './fusion-du-changelog.mjs';
|
|
154
160
|
import { fluxSansEntree } from './flux-des-paquets.mjs';
|
|
155
161
|
import { installerGreffons } from './greffons.mjs';
|
|
162
|
+
import { lireGroupe, projetsExternes } from './groupe-cles.mjs';
|
|
156
163
|
import { migrer, restesAuProjet } from './migrations.mjs';
|
|
157
164
|
import { langageDe, langagesDe } from './langages.mjs';
|
|
158
165
|
import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
|
|
@@ -318,13 +325,59 @@ export function versionDuProjet(projet) {
|
|
|
318
325
|
return typeof v === 'string' ? v : null;
|
|
319
326
|
}
|
|
320
327
|
|
|
328
|
+
// Beads run in <cwd>, as `bd(args, cwd)` gives it: { status, stdout, stderr }.
|
|
329
|
+
const jouerBd = (args, cwd) => spawnSync('bd', args, { cwd, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
|
|
330
|
+
|
|
331
|
+
// The group the package.json of <projet> declares (null without it); a fault throws, naming its
|
|
332
|
+
// key (`grillhouse.groupe`) and its value.
|
|
333
|
+
function lireDuGroupe(projet) {
|
|
334
|
+
const pkg = path.join(projet, 'package.json');
|
|
335
|
+
if (!existsSync(pkg)) {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
const { groupe, fautes } = lireGroupe(lireJson(pkg, {}), projet);
|
|
339
|
+
if (fautes.length > 0) {
|
|
340
|
+
throw new Error(
|
|
341
|
+
`⛔ ${fautes.map(f => `${f.cle} vaut ${f.valeur}, pas un chemin de projet existant, une fois`).join(' ; ')}.`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
return groupe;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// The `external_projects` of the Beads of <projet>: the other projects of its <groupe>, each by its
|
|
348
|
+
// name and absolute path; those it sets, by name (none when already set).
|
|
349
|
+
function poserLesProjetsExternes(projet, groupe, bd) {
|
|
350
|
+
if (groupe === null) {
|
|
351
|
+
return [];
|
|
352
|
+
}
|
|
353
|
+
const poses = [];
|
|
354
|
+
for (const [nom, chemin] of Object.entries(projetsExternes(groupe, projet))) {
|
|
355
|
+
const cle = `external_projects.${nom}`;
|
|
356
|
+
const lu = bd(['config', 'get', cle], projet);
|
|
357
|
+
if (lu.status === 0 && `${lu.stdout ?? ''}`.trim() === chemin) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const r = bd(['config', 'set', cle, chemin], projet);
|
|
361
|
+
if (r.status !== 0) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
`⛔ bd config set ${cle} a échoué : ${`${r.stderr ?? ''}`.trim() || `code ${r.status}`}`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
poses.push(nom);
|
|
367
|
+
}
|
|
368
|
+
return poses;
|
|
369
|
+
}
|
|
370
|
+
|
|
321
371
|
/**
|
|
322
372
|
* Brings the project at `projet` to the frame's files at `source` (CADRE, scripts/cadre.mjs; a
|
|
323
373
|
* trial's own in the tests); <inscrite> is the version it records (the package's; null records
|
|
324
374
|
* none, the project keeping its own). Returns what changed.
|
|
325
375
|
*/
|
|
326
|
-
export function mettreAJour(projet, source, { inscrite = VERSION } = {}) {
|
|
376
|
+
export function mettreAJour(projet, source, { inscrite = VERSION, bd = jouerBd } = {}) {
|
|
377
|
+
// The group declared, refused by its key before any work.
|
|
378
|
+
const groupe = lireDuGroupe(projet);
|
|
327
379
|
const bilan = {
|
|
380
|
+
projetsExternes: [],
|
|
328
381
|
dependances: [],
|
|
329
382
|
gardes: null,
|
|
330
383
|
ligneEtat: false,
|
|
@@ -447,68 +500,10 @@ export function mettreAJour(projet, source, { inscrite = VERSION } = {}) {
|
|
|
447
500
|
poserCrochets(projet);
|
|
448
501
|
attribuer(projet);
|
|
449
502
|
bilan.workflows = poserLesWorkflows(projet, source);
|
|
503
|
+
bilan.projetsExternes = poserLesProjetsExternes(projet, groupe, bd);
|
|
450
504
|
return bilan;
|
|
451
505
|
}
|
|
452
506
|
|
|
453
|
-
/**
|
|
454
|
-
* Installs on the machine each binary of the languages of the project at <projet> (`binaires` of
|
|
455
|
-
* its module) that its installation does not list at its version, by the commands its module
|
|
456
|
-
* describes (`miseAJour.installation`: `liste`, then `installer` for each one missing), each run by
|
|
457
|
-
* Node, as `npm install` brings what is installed to what is declared; a language without
|
|
458
|
-
* binaries runs nothing. Returns `{ installes, lignes }`: each binary installed
|
|
459
|
-
* (`<nom>@<version>`), and the line of each failure, the error stream of its command, which names
|
|
460
|
-
* the command to type.
|
|
461
|
-
*/
|
|
462
|
-
export function installerBinaires(projet) {
|
|
463
|
-
const installes = [];
|
|
464
|
-
const lignes = [];
|
|
465
|
-
for (const m of langagesDe(projet)) {
|
|
466
|
-
const r = installerLesBinairesDe(projet, m);
|
|
467
|
-
installes.push(...r.installes);
|
|
468
|
-
lignes.push(...r.lignes);
|
|
469
|
-
}
|
|
470
|
-
return { installes, lignes };
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// The binaries of the module <langage> installed in the project at <projet> (`installerBinaires`).
|
|
474
|
-
function installerLesBinairesDe(projet, langage) {
|
|
475
|
-
const voulus = Object.entries(langage.binaires);
|
|
476
|
-
const installation = langage.miseAJour.installation;
|
|
477
|
-
if (voulus.length === 0 || installation === null) {
|
|
478
|
-
return { installes: [], lignes: [] };
|
|
479
|
-
}
|
|
480
|
-
const lancer = c =>
|
|
481
|
-
spawnSync(process.execPath, [c.script, ...c.args], { cwd: projet, encoding: 'utf8' });
|
|
482
|
-
const cause = r => (r.error ? r.error.message : (r.stderr ?? '').trim() || `code ${r.status}`);
|
|
483
|
-
const liste = lancer(installation.liste);
|
|
484
|
-
let presents;
|
|
485
|
-
try {
|
|
486
|
-
if (liste.error || liste.status !== 0) {
|
|
487
|
-
throw new Error(cause(liste));
|
|
488
|
-
}
|
|
489
|
-
presents = JSON.parse(liste.stdout);
|
|
490
|
-
} catch (e) {
|
|
491
|
-
return {
|
|
492
|
-
installes: [],
|
|
493
|
-
lignes: [`Binaires : la liste des binaires installés échoue. ${e.message}`],
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
const installes = [];
|
|
497
|
-
const lignes = [];
|
|
498
|
-
for (const [nom, version] of voulus) {
|
|
499
|
-
if (presents[nom] === version) {
|
|
500
|
-
continue;
|
|
501
|
-
}
|
|
502
|
-
const r = lancer(installation.installer(nom, version));
|
|
503
|
-
if (!r.error && r.status === 0) {
|
|
504
|
-
installes.push(`${nom}@${version}`);
|
|
505
|
-
} else {
|
|
506
|
-
lignes.push(`Binaire ${nom}@${version} : ${cause(r)}`);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return { installes, lignes };
|
|
510
|
-
}
|
|
511
|
-
|
|
512
507
|
/**
|
|
513
508
|
* Runs each generator of the languages of the project (`miseAJour.generateurs` of each module,
|
|
514
509
|
* each once) whose output the project holds (every one with `tous`, for a project `grillhouse init` creates;
|
|
@@ -560,6 +555,11 @@ export function rapport(b) {
|
|
|
560
555
|
`Greffon du cadre : .claude/settings.json déclare la place de marché ${MARCHE_DU_CADRE} (${SOURCE_DU_MARCHE.repo}) et active ${GREFFON_DU_CADRE}.`
|
|
561
556
|
);
|
|
562
557
|
}
|
|
558
|
+
if (b.projetsExternes?.length > 0) {
|
|
559
|
+
lignes.push(
|
|
560
|
+
`Projets externes de Beads : ${b.projetsExternes.join(', ')} posé(s) depuis grillhouse.groupe.`
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
563
|
if (b.workflows?.length > 0) {
|
|
564
564
|
lignes.push(
|
|
565
565
|
`Workflows du cadre : ${b.workflows.join(', ')} écrit(s) depuis le gabarit ; leur machine est la variable RUNNER du dépôt sur GitHub (ubuntu-latest sans elle), que la mise à jour ne touche pas.`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// The types of the reading of the key `grillhouse.groupe` (./groupe-cles.mjs).
|
|
2
|
+
|
|
3
|
+
/** A project of a group: its folder's name (the key of Beads' `external_projects`), its absolute path. */
|
|
4
|
+
export interface ProjetDuGroupe {
|
|
5
|
+
nom: string;
|
|
6
|
+
chemin: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** The group a package.json declares: the same `id` for every project that declares the same paths. */
|
|
10
|
+
export interface GroupeDeclare {
|
|
11
|
+
id: string;
|
|
12
|
+
projets: ProjetDuGroupe[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The group declared (null without the key or on a fault), and each fault by its key and value. */
|
|
16
|
+
export function lireGroupe(
|
|
17
|
+
pkg: unknown,
|
|
18
|
+
racine: string
|
|
19
|
+
): { groupe: GroupeDeclare | null; fautes: Array<{ cle: string; valeur: string }> };
|
|
20
|
+
|
|
21
|
+
/** The `external_projects` of the Beads of the project at <racine>: the other projects of its group. */
|
|
22
|
+
export function projetsExternes(
|
|
23
|
+
groupe: { projets: ProjetDuGroupe[] },
|
|
24
|
+
racine: string
|
|
25
|
+
): Record<string, string>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// The reading of the key `grillhouse.groupe` of a package.json (grillhouse-pie), read as written:
|
|
2
|
+
// a list of projects, each by its path (absolute, or relative to the project's root), every
|
|
3
|
+
// project of the group, the project itself included. The projects of a group are ordered together:
|
|
4
|
+
// their tickets that wait for a place leave by priority (scripts/regles-des-places.mjs), and
|
|
5
|
+
// `grillhouse maj` writes the other projects of the group as the `external_projects` of the Beads
|
|
6
|
+
// of each (`bd ship` and `external:<project>:<capability>` dependencies resolve through them).
|
|
7
|
+
// Any other value is a fault, named by its key before any work.
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The group a package.json <pkg> declares, read from the project at <racine>.
|
|
14
|
+
* Returns { groupe, fautes }: `groupe` null without the key or on a fault, else `{ id, projets }`
|
|
15
|
+
* (`projets`: each `{ nom, chemin }`, `nom` the folder of the project, the key of Beads'
|
|
16
|
+
* `external_projects`, `chemin` absolute; `id` the same for every project that declares the same
|
|
17
|
+
* paths, in any order); `fautes` each `{ cle, valeur }`, the key it names and the value read.
|
|
18
|
+
* @param {unknown} pkg
|
|
19
|
+
* @param {string} racine
|
|
20
|
+
* @returns {{ groupe: { id: string, projets: { nom: string, chemin: string }[] } | null,
|
|
21
|
+
* fautes: { cle: string, valeur: string }[] }}
|
|
22
|
+
*/
|
|
23
|
+
export function lireGroupe(pkg, racine) {
|
|
24
|
+
const liste = pkg?.grillhouse?.groupe;
|
|
25
|
+
if (liste === undefined) {
|
|
26
|
+
return { groupe: null, fautes: [] };
|
|
27
|
+
}
|
|
28
|
+
if (!Array.isArray(liste) || liste.length === 0) {
|
|
29
|
+
return {
|
|
30
|
+
groupe: null,
|
|
31
|
+
fautes: [{ cle: 'grillhouse.groupe', valeur: JSON.stringify(liste) }],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const fautes = [];
|
|
35
|
+
const projets = [];
|
|
36
|
+
const vus = new Set();
|
|
37
|
+
liste.forEach((v, i) => {
|
|
38
|
+
const cle = `grillhouse.groupe[${i}]`;
|
|
39
|
+
if (typeof v !== 'string' || v.trim() === '') {
|
|
40
|
+
fautes.push({ cle, valeur: JSON.stringify(v) ?? String(v) });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const chemin = path.resolve(racine, v);
|
|
44
|
+
if (!existsSync(chemin) || vus.has(chemin)) {
|
|
45
|
+
fautes.push({ cle, valeur: JSON.stringify(v) });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
vus.add(chemin);
|
|
49
|
+
projets.push({ nom: path.basename(chemin), chemin });
|
|
50
|
+
});
|
|
51
|
+
if (fautes.length > 0) {
|
|
52
|
+
return { groupe: null, fautes };
|
|
53
|
+
}
|
|
54
|
+
const id = createHash('sha256')
|
|
55
|
+
.update([...vus].sort().join('\n'))
|
|
56
|
+
.digest('hex')
|
|
57
|
+
.slice(0, 12);
|
|
58
|
+
return { groupe: { id, projets }, fautes: [] };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The `external_projects` of the Beads of the project at <racine>: the other projects of its
|
|
63
|
+
* <groupe>, `{ <nom>: <chemin> }`.
|
|
64
|
+
* @param {{ projets: { nom: string, chemin: string }[] }} groupe
|
|
65
|
+
* @param {string} racine
|
|
66
|
+
* @returns {Record<string, string>}
|
|
67
|
+
*/
|
|
68
|
+
export function projetsExternes(groupe, racine) {
|
|
69
|
+
const soi = path.resolve(racine);
|
|
70
|
+
return Object.fromEntries(
|
|
71
|
+
groupe.projets.filter(p => p.chemin !== soi).map(p => [p.nom, p.chemin])
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -902,6 +902,29 @@ export function avancerMain(o, entree) {
|
|
|
902
902
|
return { entre: { commit: entree.commit } };
|
|
903
903
|
}
|
|
904
904
|
|
|
905
|
+
// The capabilities of the ticket <ticket> (its `labels`, `export:<capability>` each) delivered by
|
|
906
|
+
// `bd ship <capability>`, which sets `provides:<capability>`, the signal that the queue of another
|
|
907
|
+
// project reads. A `bd ship` that fails is a fault named, never ignored: its comment at the
|
|
908
|
+
// ticket says it whole, `livraison` in one line (the capability and Beads' reason), the other
|
|
909
|
+
// capabilities still delivered; null without a fault.
|
|
910
|
+
function livrerLesCapacites(o, ticket, labels) {
|
|
911
|
+
const fautes = [];
|
|
912
|
+
for (const cap of labels.filter(l => l.startsWith('export:')).map(l => l.slice(7))) {
|
|
913
|
+
const r = o.bd('ship', cap);
|
|
914
|
+
if (r.status !== 0) {
|
|
915
|
+
const raison = `${r.stderr ?? ''}`.trim() || `${r.stdout ?? ''}`.trim() || `code ${r.status}`;
|
|
916
|
+
commenterAu(
|
|
917
|
+
o,
|
|
918
|
+
ticket,
|
|
919
|
+
`La livraison de la capacité ${cap} n'est pas faite : \`bd ship ${cap}\` échoue :\n${raison}\n\nLe ticket est fermé ; la capacité reste à livrer.`
|
|
920
|
+
);
|
|
921
|
+
o.dire(`⚠ bd ship ${cap} échoue`);
|
|
922
|
+
fautes.push(`bd ship ${cap} échoue : ${enUneLigne(raison)}`);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
return { livraison: fautes.length > 0 ? fautes.join(' ; ') : null };
|
|
926
|
+
}
|
|
927
|
+
|
|
905
928
|
/**
|
|
906
929
|
* The ticket of <entree> (`{ ticket, branche, commit }`) entered on main at <commit>, with the
|
|
907
930
|
* tools <o>: it closes « intégré : <commit> » and loses `en-file` (a ticket already closed is left
|
|
@@ -920,11 +943,13 @@ export function fermerLEntree(o, entree) {
|
|
|
920
943
|
const court = entree.commit.slice(0, 7);
|
|
921
944
|
const commenter = texte => commenterAu(o, entree.ticket, texte);
|
|
922
945
|
const show = o.bd('show', entree.ticket, '--json');
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
946
|
+
const lu = show.status === 0 ? (JSON.parse(show.stdout)[0] ?? null) : null;
|
|
947
|
+
if ((lu?.status ?? null) !== 'closed') {
|
|
925
948
|
o.bd('update', entree.ticket, '--remove-label', 'en-file');
|
|
926
949
|
o.bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
|
|
927
950
|
}
|
|
951
|
+
// The capabilities the ticket exports (`export:<capability>`) are delivered once it is closed.
|
|
952
|
+
const ferme = livrerLesCapacites(o, entree.ticket, lu?.labels ?? []);
|
|
928
953
|
o.dire(`✓ ${entree.branche} entre sur ${o.principale} : ${court}`);
|
|
929
954
|
if (git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).status === 0) {
|
|
930
955
|
const efface = git('branch', '-D', entree.branche);
|
|
@@ -941,7 +966,7 @@ export function fermerLEntree(o, entree) {
|
|
|
941
966
|
if (faute) {
|
|
942
967
|
const raison = `Poussée non faite : grillhouse.poussee.commit vaut ${faute}, pas un nom de branche.`;
|
|
943
968
|
commenter(raison);
|
|
944
|
-
return { poussee: null, raison: enUneLigne(raison) };
|
|
969
|
+
return { poussee: null, raison: enUneLigne(raison), ...ferme };
|
|
945
970
|
}
|
|
946
971
|
const sansInvite = { encoding: 'utf8', env: { ...process.env, GIT_TERMINAL_PROMPT: '0' } };
|
|
947
972
|
const pousse = spawnSync(
|
|
@@ -953,7 +978,7 @@ export function fermerLEntree(o, entree) {
|
|
|
953
978
|
const raison = `La poussée de ${court} vers origin/${commit} (grillhouse.poussee.commit) est refusée :\n${pousse.stderr.trim()}`;
|
|
954
979
|
commenter(raison);
|
|
955
980
|
o.dire(`⚠ poussée de ${court} refusée`);
|
|
956
|
-
return { poussee: null, raison: enUneLigne(raison) };
|
|
981
|
+
return { poussee: null, raison: enUneLigne(raison), ...ferme };
|
|
957
982
|
}
|
|
958
983
|
o.dire(`✓ poussée : ${court} est sur origin/${commit}`);
|
|
959
984
|
// The branch the CI judged leaves origin with its entry; one already gone is no fault.
|
|
@@ -965,7 +990,7 @@ export function fermerLEntree(o, entree) {
|
|
|
965
990
|
if (distante.status !== 0) {
|
|
966
991
|
o.dire(`⚠ origin/${entree.branche} n'est pas effacée : ${distante.stderr.trim()}`);
|
|
967
992
|
}
|
|
968
|
-
return { poussee: commit, raison: null };
|
|
993
|
+
return { poussee: commit, raison: null, ...ferme };
|
|
969
994
|
}
|
|
970
995
|
|
|
971
996
|
/**
|
package/scripts/jointure.d.ts
CHANGED
|
@@ -429,6 +429,17 @@ export function avecLeFichierDuPoste<T extends Record<string, string | undefined
|
|
|
429
429
|
): T;
|
|
430
430
|
/** The path of the command <nom> in the PATH of <env>, or null (scripts/commandes-du-path.mjs). */
|
|
431
431
|
export function trouverDansLePath(nom: string, env?: NodeJS.ProcessEnv): string | null;
|
|
432
|
+
/**
|
|
433
|
+
* Writes <fichier> at the root of the project <projet> when it has none, from the template of
|
|
434
|
+
* <source> that fits its form (<avecEspaces> when its package.json <p> declares workspaces, else
|
|
435
|
+
* <sansEspaces>); the template written, or null.
|
|
436
|
+
*/
|
|
437
|
+
export function poserLeGabaritAbsent(
|
|
438
|
+
projet: string,
|
|
439
|
+
source: string,
|
|
440
|
+
p: Record<string, unknown>,
|
|
441
|
+
gabarits: { fichier: string; avecEspaces: string; sansEspaces: string }
|
|
442
|
+
): string | null;
|
|
432
443
|
/** The cache of `outil` for the build rooted at `racine`, swept once `racine` is gone. */
|
|
433
444
|
export function cacheDeLaRacine(
|
|
434
445
|
outil: string,
|
|
@@ -23,7 +23,7 @@ export function installes() {
|
|
|
23
23
|
if (r.error || r.status !== 0) {
|
|
24
24
|
const cause = r.error ? r.error.message : (r.stderr ?? '').trim() || `code ${r.status}`;
|
|
25
25
|
throw new Error(
|
|
26
|
-
`⛔ \`cargo install --list\` échoue (${cause}) ; installe Rust (rustup), puis relance \`npx grillhouse
|
|
26
|
+
`⛔ \`cargo install --list\` échoue (${cause}) ; installe Rust (rustup), puis relance \`npx grillhouse binaires\`.`
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
return Object.fromEntries(
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// tests of `tests/` included, which clippy reads only with `--all-targets`; every warning denied;
|
|
9
9
|
// rustc wrapped by sccache, as every command of the module that compiles (./sccache.mjs), its
|
|
10
10
|
// server started first under the machine's /tmp (`demarrerLeServeur`); a
|
|
11
|
-
// PATH without sccache refuses before cargo runs, the line naming `npx grillhouse
|
|
11
|
+
// PATH without sccache refuses before cargo runs, the line naming `npx grillhouse binaires`.
|
|
12
12
|
// - Each diagnostic of the compiler that carries a code is a finding: its file, the primary span's
|
|
13
13
|
// from the root, its line, its message the compiler's. A lint (`clippy::needless_return`, a lint
|
|
14
14
|
// of rustc such as `unused_variables`) is its rule, which the debt keys; an error of compilation
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
// (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr), its server started
|
|
99
99
|
// under the machine's /tmp before each run of cargo that compiles (grillhouse-qmk).
|
|
100
100
|
// `tests-du-paquet`, `verifier` and `typer` refuse, before any run of cargo, a PATH without sccache, in one line that names it
|
|
101
|
-
// and `npx grillhouse
|
|
101
|
+
// and `npx grillhouse binaires`, which installs it (code 2).
|
|
102
102
|
// - Nextest reads the frame's profile `grillhouse` (./nextest.toml, a tool's configuration under
|
|
103
103
|
// the project's own, `--tool-config-file`), whose JUnit report lands in nextest's store, at
|
|
104
104
|
// `<workspace root>/target/nextest/grillhouse/junit.xml` (nextest's default `store.dir`, under
|
|
@@ -79,8 +79,9 @@ export default {
|
|
|
79
79
|
construireLesPaquets: () => {
|
|
80
80
|
throw new Error('construction non prise en charge pour cargo');
|
|
81
81
|
},
|
|
82
|
-
// The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`)
|
|
83
|
-
|
|
82
|
+
// The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`), and
|
|
83
|
+
// Turborepo, which plays the tasks of the crates (./commandes.mjs).
|
|
84
|
+
outils: ['smol-toml', 'turbo'],
|
|
84
85
|
// The programs the installer of Temporal requires in the PATH of the workers: cargo's folder is
|
|
85
86
|
// also rustc's, nextest's and sccache's (rustup, `cargo install`).
|
|
86
87
|
executables: ['cargo'],
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
// leaves the frame's profile `grillhouse` to the frame (./nextest.toml); `rust-toolchain.toml`,
|
|
13
13
|
// the toolchain and its components clippy and rustfmt, which the guards run. A file the project
|
|
14
14
|
// holds is its own: never written again.
|
|
15
|
+
// - `turbo.json`, which a project lacks, from the frame's template of its form (`TURBO`): the
|
|
16
|
+
// module plays the tasks of the crates by Turborepo.
|
|
15
17
|
// - The root scripts `test`, `test:forcer` and `verifier` a project lacks become the template's:
|
|
16
18
|
// the agents run `npm test`, the integration and the night `npm run verifier`. A project's own
|
|
17
19
|
// script stays.
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
import { copyFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
|
|
27
29
|
import path from 'node:path';
|
|
28
30
|
import { fileURLToPath } from 'node:url';
|
|
31
|
+
import { poserLeGabaritAbsent } from '../../services-du-noyau.mjs';
|
|
29
32
|
import { verrouNonVersionne } from './commandes.mjs';
|
|
30
33
|
import { SORTIE } from './index-interfaces.mjs';
|
|
31
34
|
|
|
@@ -33,6 +36,13 @@ const BINAIRES = path.join(path.dirname(fileURLToPath(import.meta.url)), 'binair
|
|
|
33
36
|
|
|
34
37
|
const GABARIT = 'templates/cargo';
|
|
35
38
|
const SCRIPTS_DES_TESTS = ['test', 'test:forcer', 'verifier'];
|
|
39
|
+
// The frame's templates of `turbo.json`, one per form of repository: the module plays its tasks
|
|
40
|
+
// by Turborepo (./commandes.mjs).
|
|
41
|
+
const TURBO = {
|
|
42
|
+
fichier: 'turbo.json',
|
|
43
|
+
avecEspaces: 'templates/turbo/paquets.json',
|
|
44
|
+
sansEspaces: 'templates/turbo/sans-paquets.json',
|
|
45
|
+
};
|
|
36
46
|
|
|
37
47
|
// The files under <dossier>, as paths from it.
|
|
38
48
|
const fichiers = (dossier, rel = '') =>
|
|
@@ -54,6 +64,7 @@ function appliquer(projet, { p, modele, source }) {
|
|
|
54
64
|
copies.push(f);
|
|
55
65
|
}
|
|
56
66
|
}
|
|
67
|
+
const turbo = poserLeGabaritAbsent(projet, source, p, TURBO);
|
|
57
68
|
p.scripts ??= {};
|
|
58
69
|
const scripts = [];
|
|
59
70
|
for (const nom of SCRIPTS_DES_TESTS) {
|
|
@@ -70,6 +81,11 @@ function appliquer(projet, { p, modele, source }) {
|
|
|
70
81
|
`Gabarit cargo : ${copies.join(', ')} écrits ; ils sont au projet, la mise à jour n'y touche plus.`
|
|
71
82
|
);
|
|
72
83
|
}
|
|
84
|
+
if (turbo) {
|
|
85
|
+
lignes.push(
|
|
86
|
+
`turbo.json écrit depuis le gabarit du cadre ${turbo} ; il est au projet, la mise à jour n'y touche plus.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
73
89
|
if (scripts.length > 0) {
|
|
74
90
|
lignes.push(
|
|
75
91
|
`Scripts des tests : ${scripts.map(n => `${n} (\`${p.scripts[n]}\`)`).join(', ')} écrits ; les agents lancent \`npm test\`, l'intégration et la nuit \`npm run verifier\`.`
|
|
@@ -80,6 +96,7 @@ function appliquer(projet, { p, modele, source }) {
|
|
|
80
96
|
bilan: {
|
|
81
97
|
gabarit: copies.length > 0 ? copies : null,
|
|
82
98
|
scripts: scripts.length > 0 ? scripts : null,
|
|
99
|
+
turbo,
|
|
83
100
|
},
|
|
84
101
|
lignes,
|
|
85
102
|
aFaire: verrou ? [verrou] : [],
|
|
@@ -153,7 +153,7 @@ export function sccacheAbsent(racine, env) {
|
|
|
153
153
|
}
|
|
154
154
|
return trouverDansLePath('sccache', env)
|
|
155
155
|
? null
|
|
156
|
-
: "⛔ sccache absent du PATH : cargo compile à travers lui (RUSTC_WRAPPER=sccache) ; `npx grillhouse
|
|
156
|
+
: "⛔ sccache absent du PATH : cargo compile à travers lui (RUSTC_WRAPPER=sccache) ; `npx grillhouse binaires` l'installe avec les autres binaires du module cargo.";
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
@@ -220,7 +220,7 @@ function passe(racine, env) {
|
|
|
220
220
|
stdio: 'inherit',
|
|
221
221
|
});
|
|
222
222
|
if (r.error?.code === 'ENOENT' && programme === 'uv') {
|
|
223
|
-
process.stderr.write("⛔ uv absent du PATH : `npx grillhouse
|
|
223
|
+
process.stderr.write("⛔ uv absent du PATH : `npx grillhouse binaires` l'installe.\n");
|
|
224
224
|
}
|
|
225
225
|
t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
|
|
226
226
|
if (vert.includes(t.code)) {
|
|
@@ -71,7 +71,9 @@ export default {
|
|
|
71
71
|
sortieDuPaquet: () => {
|
|
72
72
|
throw new Error('sortie non prise en charge pour python');
|
|
73
73
|
},
|
|
74
|
-
|
|
74
|
+
// The reader of TOML of a pyproject.toml, and Turborepo, which plays the tasks of the projects
|
|
75
|
+
// (./commandes.mjs).
|
|
76
|
+
outils: ['smol-toml', 'turbo'],
|
|
75
77
|
// The programs the installer of Temporal requires in the PATH of the workers.
|
|
76
78
|
executables: ['python3'],
|
|
77
79
|
binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
// - The template: `templates/python/` of the frame's files. Its package.json gives the frame's
|
|
5
5
|
// scripts, which run the frame's commands, and smol-toml, the reader of a pyproject.toml.
|
|
6
|
+
// - `turbo.json`, which a project lacks, from the frame's template of its form (`TURBO`): the
|
|
7
|
+
// module plays the tasks of the projects by Turborepo.
|
|
6
8
|
// - The root scripts `test`, `test:forcer` and `verifier` a project lacks become the template's;
|
|
7
9
|
// a project's own script stays.
|
|
8
10
|
// - The generator: the index of the interfaces (./index-interfaces.mjs), run where the project
|
|
@@ -10,14 +12,23 @@
|
|
|
10
12
|
// - The installation of uv (./binaires.json) by the commands of ./binaires.mjs, which the core runs.
|
|
11
13
|
import path from 'node:path';
|
|
12
14
|
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { poserLeGabaritAbsent } from '../../services-du-noyau.mjs';
|
|
13
16
|
import { SORTIE } from './index-interfaces.mjs';
|
|
14
17
|
|
|
15
18
|
const BINAIRES = path.join(path.dirname(fileURLToPath(import.meta.url)), 'binaires.mjs');
|
|
16
19
|
const GABARIT = 'templates/python';
|
|
17
20
|
const SCRIPTS_DES_TESTS = ['test', 'test:forcer', 'verifier'];
|
|
21
|
+
// The frame's templates of `turbo.json`, one per form of repository: the module plays its tasks
|
|
22
|
+
// by Turborepo (./commandes.mjs).
|
|
23
|
+
const TURBO = {
|
|
24
|
+
fichier: 'turbo.json',
|
|
25
|
+
avecEspaces: 'templates/turbo/paquets.json',
|
|
26
|
+
sansEspaces: 'templates/turbo/sans-paquets.json',
|
|
27
|
+
};
|
|
18
28
|
|
|
19
29
|
/** @type {import('../../jointure.js').MiseAJour['appliquer']} */
|
|
20
|
-
function appliquer(
|
|
30
|
+
function appliquer(projet, { p, modele, source }) {
|
|
31
|
+
const turbo = poserLeGabaritAbsent(projet, source, p, TURBO);
|
|
21
32
|
p.scripts ??= {};
|
|
22
33
|
const scripts = [];
|
|
23
34
|
for (const nom of SCRIPTS_DES_TESTS) {
|
|
@@ -29,13 +40,19 @@ function appliquer(_projet, { p, modele }) {
|
|
|
29
40
|
scripts.push(nom);
|
|
30
41
|
}
|
|
31
42
|
return {
|
|
32
|
-
bilan: { scripts: scripts.length > 0 ? scripts : null },
|
|
33
|
-
lignes:
|
|
34
|
-
|
|
43
|
+
bilan: { scripts: scripts.length > 0 ? scripts : null, turbo },
|
|
44
|
+
lignes: [
|
|
45
|
+
...(turbo
|
|
46
|
+
? [
|
|
47
|
+
`turbo.json écrit depuis le gabarit du cadre ${turbo} ; il est au projet, la mise à jour n'y touche plus.`,
|
|
48
|
+
]
|
|
49
|
+
: []),
|
|
50
|
+
...(scripts.length > 0
|
|
35
51
|
? [
|
|
36
52
|
`Scripts des tests : ${scripts.map(n => `${n} (\`${p.scripts[n]}\`)`).join(', ')} écrits ; les agents lancent \`npm test\`, l'intégration et la nuit \`npm run verifier\`.`,
|
|
37
53
|
]
|
|
38
|
-
: [],
|
|
54
|
+
: []),
|
|
55
|
+
],
|
|
39
56
|
aFaire: [],
|
|
40
57
|
installer: false,
|
|
41
58
|
sansVerifier: null,
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
// - The generators: the boundaries' configuration (`.dependency-cruiser.cjs`), the index of the
|
|
47
47
|
// interfaces, and the turbo.json of each package in a repository with `workspaces`.
|
|
48
48
|
import { spawnSync } from 'node:child_process';
|
|
49
|
-
import {
|
|
49
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
50
50
|
import { createRequire } from 'node:module';
|
|
51
51
|
import path from 'node:path';
|
|
52
52
|
import { CODE, paquets, TYPAGE } from '../../paquets.mjs';
|
|
53
|
-
import { SCRIPT_DES_TESTS, sources } from '../../services-du-noyau.mjs';
|
|
53
|
+
import { poserLeGabaritAbsent, SCRIPT_DES_TESTS, sources } from '../../services-du-noyau.mjs';
|
|
54
54
|
import { estUnTest } from './regle-des-tests.mjs';
|
|
55
55
|
|
|
56
56
|
// The frame's package, as a project declares it, and its base configuration of Vitest.
|
|
@@ -60,8 +60,11 @@ const CONFIG_VITEST = `${PAQUET_DU_CADRE}/vitest-config`;
|
|
|
60
60
|
const SCRIPTS_DES_TESTS = ['test', SCRIPT_DES_TESTS, 'test:forcer', 'verifier'];
|
|
61
61
|
const CHAMPS_INSTALLES = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
62
62
|
// The frame's templates of `turbo.json`, one per form of repository, read in the source.
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const TURBO = {
|
|
64
|
+
fichier: 'turbo.json',
|
|
65
|
+
avecEspaces: 'templates/turbo/paquets.json',
|
|
66
|
+
sansEspaces: 'templates/turbo/sans-paquets.json',
|
|
67
|
+
};
|
|
65
68
|
|
|
66
69
|
const ecrireJson = (f, v) => writeFileSync(f, `${JSON.stringify(v, null, 2)}\n`);
|
|
67
70
|
// <deps> written sorted by name, as npm writes them.
|
|
@@ -271,21 +274,6 @@ function poserTypage(projet, p, script) {
|
|
|
271
274
|
return declarants.length > 0 ? { script, paquets: declarants } : null;
|
|
272
275
|
}
|
|
273
276
|
|
|
274
|
-
// Writes the `turbo.json` of the project at <projet>, when it has none, from the source's template
|
|
275
|
-
// of its form (`workspaces` declared in <p>); the template written, or null.
|
|
276
|
-
function poserTurbo(projet, p, source) {
|
|
277
|
-
const f = path.join(projet, 'turbo.json');
|
|
278
|
-
if (existsSync(f)) {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
const gabarit = p.workspaces !== undefined ? TURBO_PAQUETS : TURBO_SANS_PAQUETS;
|
|
282
|
-
if (!existsSync(path.join(source, gabarit))) {
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
|
-
copyFileSync(path.join(source, gabarit), f);
|
|
286
|
-
return gabarit;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
277
|
// The lines of the report of the share <b>.
|
|
290
278
|
export function rapport(b) {
|
|
291
279
|
const lignes = [];
|
|
@@ -343,7 +331,7 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
|
|
|
343
331
|
dependanceDuCadre: declarerDependanceDuCadre(projet, p, version),
|
|
344
332
|
configVitest: poserConfigVitest(projet, p, version, joueDesTests),
|
|
345
333
|
typage: poserTypage(projet, p, modele.scripts?.[TYPAGE]),
|
|
346
|
-
turbo:
|
|
334
|
+
turbo: poserLeGabaritAbsent(projet, source, p, TURBO),
|
|
347
335
|
};
|
|
348
336
|
return {
|
|
349
337
|
bilan,
|
package/scripts/paquet.mjs
CHANGED
|
@@ -45,13 +45,8 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
|
|
|
45
45
|
import path from 'node:path';
|
|
46
46
|
import { pathToFileURL } from 'node:url';
|
|
47
47
|
import { CADRE } from './cadre.mjs';
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
installerBinaires,
|
|
51
|
-
mettreAJour,
|
|
52
|
-
rapport,
|
|
53
|
-
regenerer,
|
|
54
|
-
} from './grillhouse-maj.mjs';
|
|
48
|
+
import { installerBinaires } from './binaires.mjs';
|
|
49
|
+
import { aInstaller, mettreAJour, rapport, regenerer } from './grillhouse-maj.mjs';
|
|
55
50
|
import { LANGAGES, langage } from './langages.mjs';
|
|
56
51
|
import {
|
|
57
52
|
inscrireAuxEspaces,
|