@roomi-fields/grillhouse 0.32.0 → 0.33.1
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 +32 -0
- package/bin/grillhouse.mjs +6 -4
- package/cadre/templates/projet/.github/workflows/ci.yml +169 -16
- package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +8 -5
- package/dist/temporal/circuit/client.d.ts +10 -3
- package/dist/temporal/circuit/client.js +8 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +25 -0
- package/dist/temporal/circuit/contrat.js +31 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +67 -38
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +13 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -0
- package/dist/temporal/deroules.js +3 -1
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -0
- package/dist/temporal/file/activites.js +5 -2
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +50 -33
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +3 -1
- package/dist/temporal/file/deroule.js +128 -26
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -1
- package/dist/temporal/installation.js +57 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +10 -0
- package/dist/temporal/nuits/activites.js +114 -0
- package/dist/temporal/nuits/activites.js.map +1 -0
- package/dist/temporal/nuits/appel.d.ts +23 -0
- package/dist/temporal/nuits/appel.js +40 -0
- package/dist/temporal/nuits/appel.js.map +1 -0
- package/dist/temporal/nuits/choix.d.ts +14 -0
- package/dist/temporal/nuits/choix.js +119 -0
- package/dist/temporal/nuits/choix.js.map +1 -0
- package/dist/temporal/nuits/client.d.ts +28 -0
- package/dist/temporal/nuits/client.js +83 -0
- package/dist/temporal/nuits/client.js.map +1 -0
- package/dist/temporal/nuits/commande.d.ts +2 -0
- package/dist/temporal/nuits/commande.js +107 -0
- package/dist/temporal/nuits/commande.js.map +1 -0
- package/dist/temporal/nuits/contrat.d.ts +98 -0
- package/dist/temporal/nuits/contrat.js +30 -0
- package/dist/temporal/nuits/contrat.js.map +1 -0
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +100 -0
- package/dist/temporal/nuits/deroule.js.map +1 -0
- package/dist/temporal/travailleur.js +4 -1
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +214 -49
- package/docs/CADRE.md +31 -1
- package/docs/INTERFACE.md +47 -7
- package/hooks/register.tsx +11 -3
- package/package.json +4 -1
- package/scripts/abi-des-dependances.mjs +105 -0
- package/scripts/activites.mjs +113 -42
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/avancement.mjs +8 -18
- package/scripts/ci-des-branches.mjs +91 -0
- package/scripts/circuit.mjs +79 -4
- package/scripts/circuits-du-serveur.mjs +4 -3
- package/scripts/composants-affectes.mjs +24 -7
- package/scripts/composition-des-langages.mjs +3 -0
- package/scripts/crochets.mjs +4 -0
- package/scripts/dernier-vert.mjs +31 -10
- package/scripts/enveloppe/enveloppe.mjs +3 -1
- package/scripts/enveloppe/lancer.sh +1 -1
- package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
- package/scripts/etapes.mjs +18 -1
- package/scripts/faits-du-circuit.mjs +43 -20
- package/scripts/fichier-du-poste.mjs +87 -0
- package/scripts/grillhouse-maj.mjs +15 -1
- package/scripts/integration/file.mjs +215 -275
- package/scripts/integration/integrer.mjs +82 -41
- package/scripts/integration/rejeu.mjs +13 -64
- package/scripts/jointure.d.ts +26 -2
- package/scripts/langages/cargo/commandes.mjs +81 -19
- package/scripts/langages/cargo/exemples.mjs +2 -2
- package/scripts/langages/cargo/index.mjs +11 -5
- package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
- package/scripts/langages/python/commandes.mjs +11 -7
- package/scripts/langages/python/exemples.mjs +1 -1
- package/scripts/langages/python/index.mjs +9 -2
- package/scripts/langages/python/tailles-des-tests.mjs +19 -11
- package/scripts/langages/typescript/code-mort.mjs +41 -24
- package/scripts/langages/typescript/consommateurs.mjs +28 -17
- package/scripts/langages/typescript/exemples.mjs +2 -0
- package/scripts/langages/typescript/index.mjs +22 -3
- package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
- package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
- package/scripts/langages/typescript/resumes.mjs +17 -7
- package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
- package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
- package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
- package/scripts/langages/typescript/tests.mjs +8 -2
- package/scripts/langages/typescript/tranches.mjs +273 -0
- package/scripts/langages/typescript/verifier.mjs +140 -31
- package/scripts/langages/typescript/vitest-config/changements.mjs +23 -11
- package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
- package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
- package/scripts/lint-des-scripts.mjs +23 -6
- package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
- package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
- package/scripts/migrations/0.33.0-node-26.mjs +58 -0
- package/scripts/migrations.mjs +8 -0
- package/scripts/newday.mjs +18 -0
- package/scripts/nuit.sh +35 -17
- package/scripts/registre.d.mts +90 -0
- package/scripts/registre.mjs +28 -3
- package/scripts/reprise.mjs +12 -8
- package/scripts/services-du-noyau.mjs +5 -1
- package/scripts/session-start.sh +40 -32
- package/scripts/sous-commandes.mjs +29 -10
- package/scripts/superviseur.mjs +72 -27
- package/scripts/tableau.mjs +129 -20
- package/scripts/taches-du-graphe.mjs +39 -6
- package/scripts/transitions.mjs +42 -3
- package/scripts/verrou-de-machine.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +75 -0
- package/skills/grill/SKILL.md +8 -6
- package/skills/pitmaster/SKILL.md +15 -9
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The CI of a project's ticket branches: the queue enters a lot on main only once the CI of its
|
|
3
|
+
// branch `agent/<ticket>` judged it green (scripts/integration/file.mjs), so the project's CI must
|
|
4
|
+
// run on a push to `agent/**`, as bors needs a status on its staging branch.
|
|
5
|
+
//
|
|
6
|
+
// node ci-des-branches.mjs --absente <project> prints one line when no workflow of the project
|
|
7
|
+
// runs on a push to a ticket's branch
|
|
8
|
+
//
|
|
9
|
+
// - Whether a workflow runs on a push to a ticket's branch is the queue's own reading of the
|
|
10
|
+
// workflows (`fluxDeLaBranche` of scripts/integration/file.mjs), here on the working tree's
|
|
11
|
+
// `.github/workflows/*.yml` and `*.yaml`, for the branch `agent/ticket`.
|
|
12
|
+
// - `ajouterLesBranchesDeTicket` adds `agent/**` to the `on.push.branches` list of each workflow
|
|
13
|
+
// that runs on a push to the branch main is pushed to (`grillhouse.poussee.commit`, `main` by
|
|
14
|
+
// default), the CI of the lots, its comments and its layout kept (the library yaml's document);
|
|
15
|
+
// a project already listening, or none to judge, is left as it is, `GESTE` the line left to it.
|
|
16
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { pathToFileURL } from 'node:url';
|
|
19
|
+
import { parseDocument } from 'yaml';
|
|
20
|
+
import { fluxDeLaBranche } from './integration/file.mjs';
|
|
21
|
+
import { lireCommit } from './poussee-cles.mjs';
|
|
22
|
+
|
|
23
|
+
/** The pattern of the ticket branches the queue pushes. */
|
|
24
|
+
export const BRANCHES_DE_TICKET = 'agent/**';
|
|
25
|
+
// A branch of a ticket, which the pattern matches.
|
|
26
|
+
const TEMOIN = 'agent/ticket';
|
|
27
|
+
const DOSSIER = '.github/workflows';
|
|
28
|
+
/** The gesture left to a project none of whose workflows runs on a push to `agent/**`. */
|
|
29
|
+
export const GESTE = `aucun flux de ${DOSSIER} ne se lance sur un push vers les branches de ticket : la file n'entre un lot sur main qu'une fois la CI de sa branche verte ; ajoute '${BRANCHES_DE_TICKET}' aux branches du push du flux de la CI du projet.`;
|
|
30
|
+
|
|
31
|
+
// The workflows of the working tree of <racine>: `{ chemin, texte }`.
|
|
32
|
+
function lesFlux(racine) {
|
|
33
|
+
const dossier = path.join(racine, DOSSIER);
|
|
34
|
+
if (!existsSync(dossier)) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return readdirSync(dossier)
|
|
38
|
+
.filter(n => /\.ya?ml$/.test(n))
|
|
39
|
+
.sort()
|
|
40
|
+
.map(n => ({ chemin: `${DOSSIER}/${n}`, texte: readFileSync(path.join(dossier, n), 'utf8') }));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Whether a workflow of the project at <racine> runs on a push to a ticket's branch. */
|
|
44
|
+
export function ecouteLesBranchesDeTicket(racine) {
|
|
45
|
+
return fluxDeLaBranche(lesFlux(racine), TEMOIN).length > 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// The branch main is pushed to, from the package.json of <racine>; `main` without it.
|
|
49
|
+
function principale(racine) {
|
|
50
|
+
const f = path.join(racine, 'package.json');
|
|
51
|
+
try {
|
|
52
|
+
return lireCommit(JSON.parse(readFileSync(f, 'utf8'))).commit ?? 'main';
|
|
53
|
+
} catch {
|
|
54
|
+
return 'main';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* `agent/**` added to the push of the CI of the lots of the project at <racine>: the workflows
|
|
60
|
+
* written, none when the project already listens or has no workflow that runs on a push to main
|
|
61
|
+
* with a list of branches to add it to.
|
|
62
|
+
*/
|
|
63
|
+
export function ajouterLesBranchesDeTicket(racine) {
|
|
64
|
+
const flux = lesFlux(racine);
|
|
65
|
+
if (fluxDeLaBranche(flux, TEMOIN).length > 0) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
const surMain = new Set(fluxDeLaBranche(flux, principale(racine)));
|
|
69
|
+
const ajoutes = [];
|
|
70
|
+
for (const { chemin, texte } of flux.filter(f => surMain.has(f.chemin))) {
|
|
71
|
+
const doc = parseDocument(texte);
|
|
72
|
+
const branches = doc.getIn(['on', 'push', 'branches'], true);
|
|
73
|
+
if (!branches || typeof branches.add !== 'function') {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
branches.add(doc.createNode(BRANCHES_DE_TICKET));
|
|
77
|
+
writeFileSync(path.join(racine, chemin), doc.toString());
|
|
78
|
+
ajoutes.push(chemin);
|
|
79
|
+
}
|
|
80
|
+
return ajoutes;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
84
|
+
const [option, racine] = process.argv.slice(2);
|
|
85
|
+
if (option !== '--absente' || !racine) {
|
|
86
|
+
process.stderr.write('usage: ci-des-branches.mjs --absente <projet>\n');
|
|
87
|
+
process.exitCode = 2;
|
|
88
|
+
} else if (!ecouteLesBranchesDeTicket(racine)) {
|
|
89
|
+
process.stdout.write(`${BRANCHES_DE_TICKET}\n`);
|
|
90
|
+
}
|
|
91
|
+
}
|
package/scripts/circuit.mjs
CHANGED
|
@@ -595,7 +595,9 @@
|
|
|
595
595
|
// the developpeur's same sending to the testwriter twice in a row, on the same red output of the
|
|
596
596
|
// checks, no green checks between them), 16 relecture-arret (a finding without a valid agent, one to the testwriter the plan skips,
|
|
597
597
|
// one on a criterion, the third RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
|
|
598
|
-
// ticket
|
|
598
|
+
// ticket; at the same code, two stops of the resumption of the integration under their own
|
|
599
|
+
// names: lot-absent, a lot neither on main nor in the copy, and copie-gardee, a lot on main
|
|
600
|
+
// whose copy does not get removed), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
|
|
599
601
|
// sending to the testwriter, or a developpeur's FAIT with criteria out of the plan), 20 besoin (a testwriter or developpeur whose sheet says BESOIN, a
|
|
600
602
|
// reviewer whose sheet carries a `question`, or a ticket labelled `arbitrage` whose arbitrage
|
|
601
603
|
// `refusArbitrage` of scripts/integration/integrer.mjs refuses, at the launch or a resumption,
|
|
@@ -704,7 +706,7 @@ import {
|
|
|
704
706
|
reponsesAuxQuestions,
|
|
705
707
|
sorteDuPlan,
|
|
706
708
|
} from './resultats.mjs';
|
|
707
|
-
import { preparer } from './enveloppe/travail-de-la-copie.mjs';
|
|
709
|
+
import { preparer, rolesDuConflit } from './enveloppe/travail-de-la-copie.mjs';
|
|
708
710
|
import { refusArbitrage } from './integration/integrer.mjs';
|
|
709
711
|
import { prendreUnRang } from './places-de-la-machine.mjs';
|
|
710
712
|
import { langageDe } from './langages.mjs';
|
|
@@ -912,6 +914,18 @@ function inscrireEtape(ctx, { etape, debut }) {
|
|
|
912
914
|
});
|
|
913
915
|
}
|
|
914
916
|
|
|
917
|
+
// The rule of a test file of the module of the language of the copy of <ctx> (`estUnTest`); a copy
|
|
918
|
+
// the module does not read judges every file the developpeur's.
|
|
919
|
+
function rouleDeTest(ctx) {
|
|
920
|
+
return fichier => {
|
|
921
|
+
try {
|
|
922
|
+
return langageDe(ctx.copie).estUnTest(fichier, ctx.copie);
|
|
923
|
+
} catch {
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
|
|
915
929
|
// The steps whose pass judges the lot, 3.1 and 4.1 (one state, `finale` apart): the copy is
|
|
916
930
|
// prepared on the tip of main before each of them.
|
|
917
931
|
export const SUR_LA_POINTE = new Set([CONTROLES]);
|
|
@@ -930,7 +944,8 @@ export function avantLaPasse(
|
|
|
930
944
|
ctx,
|
|
931
945
|
etape,
|
|
932
946
|
regeneration,
|
|
933
|
-
env = environnementDeLaPasse(ctx, process.env)
|
|
947
|
+
env = environnementDeLaPasse(ctx, process.env),
|
|
948
|
+
{ estUnTest = rouleDeTest(ctx) } = {}
|
|
934
949
|
) {
|
|
935
950
|
if (!SUR_LA_POINTE.has(etape)) {
|
|
936
951
|
return { avancee: false, regeneration };
|
|
@@ -948,7 +963,11 @@ export function avantLaPasse(
|
|
|
948
963
|
);
|
|
949
964
|
const fd = openSync(ctx.journal, 'a');
|
|
950
965
|
try {
|
|
951
|
-
r = preparer(ctx.copie, cible.stdout.trim(), {
|
|
966
|
+
r = preparer(ctx.copie, cible.stdout.trim(), {
|
|
967
|
+
env,
|
|
968
|
+
sortie: fd,
|
|
969
|
+
suspects: ctx.fichiersDuConflit ?? [],
|
|
970
|
+
});
|
|
952
971
|
} finally {
|
|
953
972
|
closeSync(fd);
|
|
954
973
|
}
|
|
@@ -959,6 +978,30 @@ export function avantLaPasse(
|
|
|
959
978
|
const avancee = tete(ctx.copie).stdout.trim() !== avant.stdout.trim();
|
|
960
979
|
return { avancee, regeneration: avancee ? null : regeneration };
|
|
961
980
|
}
|
|
981
|
+
const fichiers = [...(r.conflits ?? []), ...(r.enAttente ?? [])];
|
|
982
|
+
if (fichiers.length) {
|
|
983
|
+
// The files in conflict, or kept in the lot, go to the role that writes them, the testwriter
|
|
984
|
+
// first; a role already relaunched for them that left one of its files is not relaunched: the
|
|
985
|
+
// stop goes up.
|
|
986
|
+
const { testwriter, developpeur, roles } = rolesDuConflit(fichiers, estUnTest);
|
|
987
|
+
const relances = ctx.conflitsRelances ?? [];
|
|
988
|
+
const restants = roles.filter(role => !relances.includes(role));
|
|
989
|
+
if (restants.length && restants.length === roles.length) {
|
|
990
|
+
const deRestants = restants.flatMap(role =>
|
|
991
|
+
role === 'testwriter' ? testwriter : developpeur
|
|
992
|
+
);
|
|
993
|
+
const siens = restants[0] === 'testwriter' ? testwriter : developpeur;
|
|
994
|
+
return {
|
|
995
|
+
avancee: false,
|
|
996
|
+
regeneration,
|
|
997
|
+
conflit: {
|
|
998
|
+
fichiers: deRestants,
|
|
999
|
+
roles: restants,
|
|
1000
|
+
rapport: `${r.message}\n\nL'avance de la copie sur la pointe de main a laissé ces fichiers à ton rôle : ${siens.join(', ')}.\nLes marques de conflit sont dans la copie (\`<<<<<<<\`, \`=======\`, \`>>>>>>>\`) : tu résous chaque fichier, marques retirées ; un fichier du lot gardé (\`grillhouse-travail.patch\`, dans le dossier git de la copie) se reprend à la main dans la copie, un fichier supprimé par le lot se supprime. Les fichiers de l'autre rôle restent à sa séance.`,
|
|
1001
|
+
},
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
962
1005
|
return {
|
|
963
1006
|
arret: {
|
|
964
1007
|
nom: 'lancement',
|
|
@@ -969,6 +1012,35 @@ export function avantLaPasse(
|
|
|
969
1012
|
};
|
|
970
1013
|
}
|
|
971
1014
|
|
|
1015
|
+
/**
|
|
1016
|
+
* What the circuit keeps of the conflict <conflit> (`avantLaPasse`) its pass at the state <etat>
|
|
1017
|
+
* met: the role relaunched, the first of `conflit.roles`, and the memory: the roles relaunched,
|
|
1018
|
+
* the files of the conflict, whose marks the next advance looks for again (`fichiersDuConflit`),
|
|
1019
|
+
* and the state of the pass the role's session comes back to (`retourDuConflit`), not the step
|
|
1020
|
+
* that follows the role, so no build plays while a file carries marks.
|
|
1021
|
+
* @param {{ conflitsRelances?: string[] | null, fichiersDuConflit?: string[] | null }} ctx
|
|
1022
|
+
* @param {object} etat
|
|
1023
|
+
* @param {{ fichiers: string[], roles: string[] }} conflit
|
|
1024
|
+
*/
|
|
1025
|
+
export function suiteDuConflit(ctx, etat, conflit) {
|
|
1026
|
+
const [role] = conflit.roles;
|
|
1027
|
+
return {
|
|
1028
|
+
role,
|
|
1029
|
+
memoire: {
|
|
1030
|
+
conflitsRelances: [...(ctx.conflitsRelances ?? []), role],
|
|
1031
|
+
fichiersDuConflit: [...new Set([...(ctx.fichiersDuConflit ?? []), ...conflit.fichiers])],
|
|
1032
|
+
retourDuConflit: etat,
|
|
1033
|
+
},
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// The memory of a conflict once its pass prepares the copy without one: dropped.
|
|
1038
|
+
export const SANS_CONFLIT = Object.freeze({
|
|
1039
|
+
conflitsRelances: null,
|
|
1040
|
+
fichiersDuConflit: null,
|
|
1041
|
+
retourDuConflit: null,
|
|
1042
|
+
});
|
|
1043
|
+
|
|
972
1044
|
// The tools of the project whose main tree is <racine>, read at the launch of a run:
|
|
973
1045
|
// `{ outils }`, or `{ arret }`, the stop « lancement » that goes up to the supervisor before any
|
|
974
1046
|
// session (its code, name, report, piece and question), the faults of the key named.
|
|
@@ -1282,6 +1354,9 @@ export const MEMOIRE = [
|
|
|
1282
1354
|
'verts',
|
|
1283
1355
|
'reprise',
|
|
1284
1356
|
'relancesTestwriter',
|
|
1357
|
+
'conflitsRelances',
|
|
1358
|
+
'fichiersDuConflit',
|
|
1359
|
+
'retourDuConflit',
|
|
1285
1360
|
];
|
|
1286
1361
|
|
|
1287
1362
|
// The fact <fait> of the circuit of <ctx>, with its <parametres>, the facts <faits> of the step
|
|
@@ -75,13 +75,14 @@ const sansReponse = e =>
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* The circuits of the repository at <racine>, read from the Temporal server of the environment in
|
|
78
|
-
* one call, with their progress (`avecLeurAvancement`) and the page of each one's workflow on the
|
|
78
|
+
* one call (the integrated ones too when <integres> asks for them, `lireLesCircuits`), with their progress (`avecLeurAvancement`) and the page of each one's workflow on the
|
|
79
79
|
* web UI of the server (`lienDuTableauWeb`). A server that does not answer within
|
|
80
80
|
* DELAI_MS throws `ServeurMuet`, which its caller tells from a repository without circuits and
|
|
81
81
|
* from any other fault, thrown as it is; a client not built throws `ClientNonConstruit`.
|
|
82
82
|
* @param {string} racine
|
|
83
|
+
* @param {{ integres?: boolean }} [options]
|
|
83
84
|
*/
|
|
84
|
-
export async function circuitsDuServeur(racine) {
|
|
85
|
+
export async function circuitsDuServeur(racine, options = {}) {
|
|
85
86
|
if (!existsSync(CONSTRUIT)) {
|
|
86
87
|
throw new ClientNonConstruit();
|
|
87
88
|
}
|
|
@@ -91,7 +92,7 @@ export async function circuitsDuServeur(racine) {
|
|
|
91
92
|
const c = ouvrirLeClient();
|
|
92
93
|
try {
|
|
93
94
|
const lus = await c.client.connection.withDeadline(Date.now() + DELAI_MS, () =>
|
|
94
|
-
lireLesCircuits(c.client, racine)
|
|
95
|
+
lireLesCircuits(c.client, racine, options)
|
|
95
96
|
);
|
|
96
97
|
return avecLeurAvancement(racine, lus).map(x => ({
|
|
97
98
|
...x,
|
|
@@ -385,23 +385,40 @@ export function texteDuReleve(r) {
|
|
|
385
385
|
return out.join('\n');
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
// The
|
|
389
|
-
|
|
388
|
+
// The survey of the draft description in the file <fichier> (from <racine>), as text; the command
|
|
389
|
+
// `--description` writes it on its standard output.
|
|
390
|
+
export function rapportDescription(racine, fichier) {
|
|
391
|
+
return texteDuReleve(releve(racine, readFileSync(path.resolve(racine, fichier), 'utf8')));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const USAGE = 'usage: npx grillhouse composants-affectes <ticket> | --description <fichier>\n';
|
|
395
|
+
|
|
396
|
+
// The command: its exit code. `-h`/`--help` writes the usage, exit 0; any other option than
|
|
397
|
+
// `--description`, the usage on the error stream, exit 2.
|
|
398
|
+
export function commande(racine, args) {
|
|
399
|
+
if (args.includes('-h') || args.includes('--help')) {
|
|
400
|
+
process.stdout.write(USAGE);
|
|
401
|
+
return 0;
|
|
402
|
+
}
|
|
403
|
+
const inconnue = args.find(
|
|
404
|
+
(a, k) => a.startsWith('-') && a !== '--description' && args[k - 1] !== '--description'
|
|
405
|
+
);
|
|
406
|
+
if (inconnue) {
|
|
407
|
+
process.stderr.write(`⛔ option inconnue : ${inconnue}\n${USAGE}`);
|
|
408
|
+
return 2;
|
|
409
|
+
}
|
|
390
410
|
const i = args.indexOf('--description');
|
|
391
411
|
if (i >= 0) {
|
|
392
412
|
if (!args[i + 1]) {
|
|
393
413
|
process.stderr.write('usage: npx grillhouse composants-affectes --description <fichier>\n');
|
|
394
414
|
return 2;
|
|
395
415
|
}
|
|
396
|
-
|
|
397
|
-
process.stdout.write(`${texteDuReleve(r)}\n`);
|
|
416
|
+
process.stdout.write(`${rapportDescription(racine, args[i + 1])}\n`);
|
|
398
417
|
return 0;
|
|
399
418
|
}
|
|
400
419
|
const [ticket] = args;
|
|
401
420
|
if (!ticket) {
|
|
402
|
-
process.stderr.write(
|
|
403
|
-
'usage: npx grillhouse composants-affectes <ticket> | --description <fichier>\n'
|
|
404
|
-
);
|
|
421
|
+
process.stderr.write(USAGE);
|
|
405
422
|
return 2;
|
|
406
423
|
}
|
|
407
424
|
const show = spawnSync('bd', ['show', ticket, '--json'], {
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
// when one module cannot read it, its reason named with its language.
|
|
19
19
|
// - The verdict of a run is every module's, read in the same results directory, where each module
|
|
20
20
|
// writes under names of its own (scripts/resultats.mjs).
|
|
21
|
+
// - The environment of the poste is each module's, applied one after the other: a module that
|
|
22
|
+
// finds its file's variables already set (by the one before) leaves the environment as it is.
|
|
21
23
|
// - Each command a module describes is the composed command by its name
|
|
22
24
|
// (./commandes-composees.mjs), which plays it in each module that describes it and joins their
|
|
23
25
|
// codes.
|
|
@@ -196,6 +198,7 @@ export function composer(modules) {
|
|
|
196
198
|
matieres: racine => modules.flatMap(m => m.matieres(racine)),
|
|
197
199
|
joueDesTests: (racine, composant) =>
|
|
198
200
|
moduleDuComposant(racine, composant)?.joueDesTests(racine, composant) ?? false,
|
|
201
|
+
environnementDuPoste: env => modules.reduce((e, m) => m.environnementDuPoste(e), env),
|
|
199
202
|
empreintes(racine, noms) {
|
|
200
203
|
const parts = modules.map(m => m.empreintes(racine, noms));
|
|
201
204
|
return parts.some(p => p === null) ? null : Object.assign({}, ...parts);
|
package/scripts/crochets.mjs
CHANGED
|
@@ -23,10 +23,13 @@
|
|
|
23
23
|
// - The merge driver of the CHANGELOG (scripts/fusion-du-changelog.mjs) is written in the
|
|
24
24
|
// repository's configuration by the same function, `poserCrochets`, which each `npm install`
|
|
25
25
|
// runs, as git asks a driver's command of the configuration, never of a versioned file.
|
|
26
|
+
// - Under `npm ci`, the same `prepare` writes the mark of the Node the dependencies were installed
|
|
27
|
+
// under (scripts/abi-des-dependances.mjs), which the session start compares with the current one.
|
|
26
28
|
import { execFileSync } from 'node:child_process';
|
|
27
29
|
import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
28
30
|
import path from 'node:path';
|
|
29
31
|
import { pathToFileURL } from 'node:url';
|
|
32
|
+
import { marquerApresInstallation } from './abi-des-dependances.mjs';
|
|
30
33
|
import { poserLePilote } from './fusion-du-changelog.mjs';
|
|
31
34
|
|
|
32
35
|
// The project's command, which the frame's lines run.
|
|
@@ -137,5 +140,6 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
137
140
|
}
|
|
138
141
|
} else {
|
|
139
142
|
poserCrochets(projet);
|
|
143
|
+
marquerApresInstallation(projet);
|
|
140
144
|
}
|
|
141
145
|
}
|
package/scripts/dernier-vert.mjs
CHANGED
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
// removes at its end.
|
|
35
35
|
// - `npm test` measures itself against the last green under the circuit's mark,
|
|
36
36
|
// `GRILLHOUSE_DEPUIS_LE_VERT` (scripts/langages/typescript/tests.mjs, scripts/circuit.mjs); it never keeps one.
|
|
37
|
+
// - The circuit's passes, in a project whose CI runs on a ticket's branch, measure themselves
|
|
38
|
+
// against the base of their lot (`lot`, the variable `GRILLHOUSE_BASE_DU_LOT` that the circuit
|
|
39
|
+
// gives to `npm test` and `npm run verifier`): the copy's HEAD, which main reached green by that
|
|
40
|
+
// CI, as Google's presubmit plays the tests a change affects. Their changes carry the mark
|
|
41
|
+
// `cible`: each package plays the tests Vitest relates to them, a file out of its graph playing
|
|
42
|
+
// neither the whole package nor the tests that read it by its path
|
|
43
|
+
// (scripts/langages/typescript/vitest-config/changements.mjs); the complete pass is the CI's and
|
|
44
|
+
// the night's. Such a pass keeps no green.
|
|
37
45
|
// - Only the measure of the changed files and the keeping of the green live here: the files go to
|
|
38
46
|
// `vitest --changed`, and no module of language chooses the packages it plays by the last green
|
|
39
47
|
// (the tests of a crate or a Python project are tasks of Turborepo, which its cache selects).
|
|
@@ -56,6 +64,9 @@ import path from 'node:path';
|
|
|
56
64
|
// tests of the module of the language reads in each package.
|
|
57
65
|
export const CHANGEMENTS = 'GRILLHOUSE_CHANGEMENTS';
|
|
58
66
|
export const DEPUIS_LE_VERT = 'GRILLHOUSE_DEPUIS_LE_VERT';
|
|
67
|
+
// The variable that gives a pass of the circuit the base of its lot, against which it measures
|
|
68
|
+
// itself, targeted.
|
|
69
|
+
export const BASE_DU_LOT = 'GRILLHOUSE_BASE_DU_LOT';
|
|
59
70
|
const SHA = /^[0-9a-f]{40,64}$/;
|
|
60
71
|
|
|
61
72
|
const git = (racine, args, env = process.env) =>
|
|
@@ -244,10 +255,11 @@ function supprimesDuCommit(racine, commit, arbre) {
|
|
|
244
255
|
// What a pass in <racine> measures itself against: `{ etat, env, ligne, retirer }`, the state to
|
|
245
256
|
// keep once green (null when none can count), the variables to add to the pass's environment (the
|
|
246
257
|
// changes since the last green, none for a complete pass), the line that says which, and the
|
|
247
|
-
// function that removes the file of the changes. <tout> asks for the complete pass;
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
|
|
258
|
+
// function that removes the file of the changes. <tout> asks for the complete pass; <base>, a base
|
|
259
|
+
// given (`verifier --base`); <lot>, the base of a lot of the circuit, measured targeted (`cible`),
|
|
260
|
+
// <base> taking precedence; the file lies in <dans>, the base of the pass
|
|
261
|
+
// (scripts/mesure/base-de-passe.mjs), which a killed pass leaves to the next one to sweep.
|
|
262
|
+
export function mesure(racine, { tout = false, base, lot, dans = os.tmpdir() } = {}) {
|
|
251
263
|
const etat = etatDuDepot(racine);
|
|
252
264
|
const complete = raison => ({
|
|
253
265
|
etat: etat.raison ? null : etat,
|
|
@@ -261,8 +273,10 @@ export function mesure(racine, { tout = false, base, dans = os.tmpdir() } = {})
|
|
|
261
273
|
if (tout) {
|
|
262
274
|
return complete('demandée');
|
|
263
275
|
}
|
|
264
|
-
// A base given takes precedence over the last green: the pass keeps no
|
|
265
|
-
|
|
276
|
+
// A base given, or the base of a lot, takes precedence over the last green: the pass keeps no
|
|
277
|
+
// green of its own.
|
|
278
|
+
const cible = base === undefined && Boolean(lot);
|
|
279
|
+
const donnee = base !== undefined ? lireLaBase(etat, base) : cible ? lireLaBase(etat, lot) : null;
|
|
266
280
|
if (donnee?.raison) {
|
|
267
281
|
return complete(donnee.raison);
|
|
268
282
|
}
|
|
@@ -288,15 +302,22 @@ export function mesure(racine, { tout = false, base, dans = os.tmpdir() } = {})
|
|
|
288
302
|
const fichier = path.join(dir, 'changements.json');
|
|
289
303
|
writeFileSync(
|
|
290
304
|
fichier,
|
|
291
|
-
JSON.stringify({
|
|
305
|
+
JSON.stringify({
|
|
306
|
+
racine: etat.racine,
|
|
307
|
+
fichiers: ch.fichiers,
|
|
308
|
+
supprimes: ch.supprimes,
|
|
309
|
+
...(cible ? { cible: true } : {}),
|
|
310
|
+
})
|
|
292
311
|
);
|
|
293
312
|
const n = ch.fichiers.length + ch.supprimes.length;
|
|
294
313
|
return {
|
|
295
314
|
etat: donnee ? null : etat,
|
|
296
315
|
env: { [CHANGEMENTS]: fichier },
|
|
297
|
-
ligne:
|
|
298
|
-
? `↳ depuis la base ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`
|
|
299
|
-
:
|
|
316
|
+
ligne: cible
|
|
317
|
+
? `↳ depuis la base du lot ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent, la passe complète à la CI de la branche et à la nuit.`
|
|
318
|
+
: donnee
|
|
319
|
+
? `↳ depuis la base ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`
|
|
320
|
+
: `↳ depuis le dernier vert de ${vert.branche} (${vert.commit.slice(0, 12)}, arbre ${vert.arbre.slice(0, 12)}) : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`,
|
|
300
321
|
retirer: () => rmSync(dir, { recursive: true, force: true }),
|
|
301
322
|
};
|
|
302
323
|
}
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
// the envelope declares: each starts empty and sealed read-only, and the home gets back
|
|
33
33
|
// `~/.claude`, `~/.claude.json`, the npm cache, the paths of `MAISON_EN_LECTURE` (claude, node,
|
|
34
34
|
// git and the session's tools) and the repository. No socket of the session comes back. Of
|
|
35
|
-
// the machine's credentials, only claude's own are in sight
|
|
35
|
+
// the machine's credentials, only claude's own are in sight: the file of the remote cache of
|
|
36
|
+
// the poste (`~/.config/grillhouse/`, scripts/fichier-du-poste.mjs) stays out, and the
|
|
37
|
+
// session's runs keep to the local cache of the main tree that every copy shares.
|
|
36
38
|
// - A project that names its published version (`grillhouse.outil`) gets `~/.cache/grillhouse/outil`
|
|
37
39
|
// read-only, the version installed by the envelope before the session starts: the write lock
|
|
38
40
|
// runs on that version, never on the code of the copy it guards.
|
|
@@ -227,7 +227,7 @@ echec=$(mktemp)
|
|
|
227
227
|
# its advance to main, its work kept in the copy, a conflict stopping the launch, marked in the
|
|
228
228
|
# files, the log naming each one; then the pose of the submodules, their mount, the installation.
|
|
229
229
|
# The list the pose fixes is the one every mount gets, whatever the installation rewrites.
|
|
230
|
-
partages=$(node "$ici/travail-de-la-copie.mjs" preparer "$copie" ${cible:+"$cible"}) || exit 1
|
|
230
|
+
partages=$(node "$ici/travail-de-la-copie.mjs" preparer "$copie" ${cible:+"$cible"} --role "$role") || exit 1
|
|
231
231
|
monter() { bash "$ici/../sous-modules.sh" monter "$copie" --partages "$partages" "$@"; }
|
|
232
232
|
if [ -f "$copie/package.json" ]; then
|
|
233
233
|
# The build of the copy for the session's plan, by the module of its language (`construire`),
|