@roomi-fields/grillhouse 0.47.1 → 0.49.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 +116 -0
- package/agents/direct.md +9 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +24 -38
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +14 -2
- package/cadre/templates/projet/CLAUDE.md +31 -10
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/turbo/paquets.json +3 -1
- package/cadre/templates/turbo/sans-paquets.json +3 -1
- package/charte.md +46 -13
- package/dist/temporal/circuit/appel.d.ts +4 -1
- package/dist/temporal/circuit/appel.js +15 -1
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +7 -1
- package/dist/temporal/circuit/client.js +54 -1
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +35 -60
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +2 -1
- package/dist/temporal/circuit/contrat.js +2 -1
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +9 -2
- package/dist/temporal/circuit/deroule.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 +34 -91
- package/dist/temporal/file/contrat.js +33 -5
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +1 -9
- package/dist/temporal/file/deroule.js +57 -166
- 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 +5 -10
- package/dist/temporal/nuits/activites.js +9 -57
- 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 +11 -16
- package/dist/temporal/nuits/deroule.js +38 -67
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +9 -11
- package/dist/temporal/places/client.js +11 -19
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +25 -24
- package/dist/temporal/places/contrat.js +5 -7
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +26 -36
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.js +4 -2
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +2 -1
- package/docs/ARCHITECTURE.md +453 -133
- package/docs/CADRE.md +16 -13
- package/docs/INTERFACE.md +100 -25
- package/hooks/hooks.json +9 -0
- package/hooks/register.tsx +59 -5
- package/package.json +1 -1
- package/scripts/activites.mjs +319 -52
- package/scripts/aiguillage.mjs +5 -1
- package/scripts/attente-a-l-arret.mjs +2 -5
- package/scripts/attente-au-tour.mjs +2 -5
- package/scripts/bilan.mjs +125 -2
- package/scripts/branche-de-nuit.mjs +32 -44
- package/scripts/ci-de-main.mjs +215 -16
- package/scripts/circuit.mjs +275 -189
- package/scripts/circuits-cles.d.mts +3 -3
- package/scripts/circuits-cles.mjs +6 -5
- package/scripts/coeurs-dedies.mjs +4 -4
- package/scripts/commandes-composees.mjs +12 -5
- package/scripts/composition-des-langages.mjs +2 -0
- package/scripts/crochets.mjs +2 -2
- package/scripts/dette.d.ts +2 -1
- package/scripts/dette.mjs +49 -6
- package/scripts/direct.mjs +343 -0
- package/scripts/droits.mjs +19 -0
- package/scripts/effets.mjs +6 -5
- package/scripts/engendres.mjs +2 -1
- package/scripts/enveloppe/enveloppe.mjs +127 -18
- package/scripts/enveloppe/lancer.sh +14 -3
- package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
- package/scripts/enveloppe/travail-de-la-copie.mjs +121 -21
- package/scripts/etapes.mjs +14 -4
- package/scripts/etat-du-depot.mjs +23 -0
- package/scripts/faits-du-circuit.mjs +24 -34
- package/scripts/fermeture-de-la-machine.d.mts +27 -0
- package/scripts/fermeture-de-la-machine.mjs +98 -0
- package/scripts/fichiers-nommes.mjs +27 -1
- package/scripts/file-des-tickets.d.mts +18 -1
- package/scripts/file-des-tickets.mjs +63 -15
- package/scripts/greffons.mjs +1 -1
- package/scripts/grillhouse-maj.mjs +13 -25
- package/scripts/groupe-cles.d.mts +6 -0
- package/scripts/groupe-cles.mjs +29 -1
- package/scripts/integration/file.mjs +162 -48
- package/scripts/integration/integrer.mjs +2 -0
- package/scripts/jointure.d.ts +22 -3
- package/scripts/journal-des-etats.d.mts +16 -0
- package/scripts/journal-des-etats.mjs +44 -2
- package/scripts/journal.mjs +3 -0
- package/scripts/langages/c/commandes.mjs +5 -5
- package/scripts/langages/c/composants.mjs +13 -5
- package/scripts/langages/c/index.mjs +2 -0
- package/scripts/langages/c/squelette.mjs +1 -1
- package/scripts/langages/cargo/commandes.mjs +5 -6
- package/scripts/langages/cargo/index.mjs +2 -0
- package/scripts/langages/python/commandes.mjs +5 -5
- package/scripts/langages/python/composants.mjs +10 -2
- package/scripts/langages/python/index.mjs +2 -0
- package/scripts/langages/typescript/composants.mjs +10 -3
- package/scripts/langages/typescript/construire.mjs +2 -0
- package/scripts/langages/typescript/exemples.mjs +33 -1
- package/scripts/langages/typescript/index.mjs +22 -0
- package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
- package/scripts/langages/typescript/module-absent.mjs +24 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
- package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
- package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
- package/scripts/langages/typescript/turbo-des-paquets.mjs +40 -5
- package/scripts/langages/typescript/verifier.mjs +3 -5
- package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +3 -1
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
- package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
- 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/mesure/base-de-passe.mjs +2 -1
- 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/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
- package/scripts/migrations.mjs +6 -0
- package/scripts/nuit.sh +113 -46
- package/scripts/paquet.mjs +16 -5
- package/scripts/paquets.d.ts +4 -0
- package/scripts/paquets.mjs +57 -0
- package/scripts/passe-de-la-machine.mjs +13 -14
- package/scripts/places-de-la-machine.mjs +120 -44
- package/scripts/places-du-serveur.mjs +29 -8
- package/scripts/plafond-de-la-machine.d.mts +7 -13
- package/scripts/plafond-de-la-machine.mjs +19 -35
- package/scripts/poussee-retiree.mjs +18 -0
- package/scripts/prefixe-des-tickets.mjs +1 -1
- package/scripts/references-changees.mjs +159 -0
- package/scripts/registre.d.mts +2 -2
- package/scripts/regles-des-places.d.mts +20 -12
- package/scripts/regles-des-places.mjs +27 -30
- package/scripts/repli-de-la-nuit.mjs +112 -0
- package/scripts/reponses-du-circuit.d.mts +4 -2
- package/scripts/reponses-du-circuit.mjs +44 -9
- package/scripts/reprise.mjs +27 -8
- package/scripts/resultats.mjs +61 -9
- package/scripts/seances.mjs +258 -40
- package/scripts/services-du-noyau.mjs +3 -0
- package/scripts/sous-commandes.mjs +37 -7
- package/scripts/superviseur.mjs +241 -88
- package/scripts/tableau.mjs +327 -131
- package/scripts/taches-du-graphe.mjs +84 -4
- package/scripts/ticket.mjs +345 -0
- package/scripts/transitions.d.mts +52 -0
- package/scripts/transitions.mjs +194 -16
- package/scripts/un-commit-par-ticket.mjs +4 -3
- package/scripts/verdict-de-la-nuit.mjs +47 -20
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
- package/scripts/verrous/verrou.mjs +17 -1
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/direct/SKILL.md +57 -0
- package/skills/explorateur/SKILL.md +10 -6
- package/skills/pitmaster/SKILL.md +37 -14
- package/skills/pitmaster/references/consigne-agent.md +7 -1
- package/skills/relecteur/SKILL.md +11 -1
- package/skills/testwriter/SKILL.md +10 -0
- package/scripts/poussee-cles.mjs +0 -46
- package/scripts/ticket.sh +0 -25
|
@@ -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
|
+
}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
// (`globalPassThroughEnv`, scripts/langages/typescript/turbo-des-paquets.mjs); `circuit`, the results and progress
|
|
16
16
|
// of the passes of a circuit's run (scripts/circuit.mjs; its working directory is the ticket's,
|
|
17
17
|
// beside its copy, which no sweep touches); `integration`, the working directory of an
|
|
18
|
-
// integration (scripts/integration/integrer.mjs); `
|
|
18
|
+
// integration (scripts/integration/integrer.mjs); `file`, the results of the final pass of the queue
|
|
19
|
+
// (scripts/integration/file.mjs); `enveloppe`, the throwaway state of a session's envelope
|
|
19
20
|
// (scripts/enveloppe/enveloppe.mjs).
|
|
20
21
|
// - The owner of a base is the process that opens it, for a pass and a session out of a ticket
|
|
21
22
|
// (the night, a verification); a ticket (`ouvrirBaseDuTicket`: `<dans>/grillhouse-ticket-<id>/`,
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// From 0.49.0 a circuit reserves 3 cores (it reserved 4). A package.json of the project whose
|
|
2
|
+
// `grillhouse.part.coeurs` is 4 gets 3, its other keys, its layout and its end of line kept; a
|
|
3
|
+
// project without that value, without `grillhouse` or without package.json is left, and a second
|
|
4
|
+
// pass changes nothing and says nothing.
|
|
5
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
|
|
8
|
+
export const version = '0.49.0';
|
|
9
|
+
export const nom = 'reservation de trois coeurs';
|
|
10
|
+
|
|
11
|
+
/** `grillhouse.part.coeurs` 4 turned into 3 in the package.json of <projet>; returns what it did. */
|
|
12
|
+
export function migrer(projet) {
|
|
13
|
+
const fichier = path.join(projet, 'package.json');
|
|
14
|
+
if (!existsSync(fichier)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const texte = readFileSync(fichier, 'utf8');
|
|
18
|
+
const pkg = JSON.parse(texte);
|
|
19
|
+
const part = pkg?.grillhouse?.part;
|
|
20
|
+
if (!part || typeof part !== 'object' || part.coeurs !== 4) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
part.coeurs = 3;
|
|
24
|
+
const indent = /^\n?(\s+)"/m.exec(texte)?.[1] ?? 2;
|
|
25
|
+
const fin = texte.endsWith('\n') ? '\n' : '';
|
|
26
|
+
writeFileSync(fichier, `${JSON.stringify(pkg, null, indent)}${fin}`);
|
|
27
|
+
return [
|
|
28
|
+
'package.json : grillhouse.part.coeurs passe de 4 à 3, la réservation de cœurs d’un circuit ordinaire',
|
|
29
|
+
];
|
|
30
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -42,6 +42,9 @@ 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';
|
|
47
|
+
import * as reservationDeTroisCoeurs from './migrations/0.49.0-reservation-de-trois-coeurs.mjs';
|
|
45
48
|
|
|
46
49
|
/** The migrations of the core. */
|
|
47
50
|
export const MIGRATIONS = [
|
|
@@ -63,6 +66,9 @@ export const MIGRATIONS = [
|
|
|
63
66
|
node26Seul,
|
|
64
67
|
seuilDesCodesDeTickets,
|
|
65
68
|
ciDeMain,
|
|
69
|
+
pousseeRetiree,
|
|
70
|
+
ciDeclencheeParLaFile,
|
|
71
|
+
reservationDeTroisCoeurs,
|
|
66
72
|
];
|
|
67
73
|
|
|
68
74
|
/**
|
package/scripts/nuit.sh
CHANGED
|
@@ -66,26 +66,29 @@
|
|
|
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
|
-
# -
|
|
70
|
-
#
|
|
69
|
+
# - The two parts of the night: a project whose `.github/workflows/nuit.yml` plays on the label
|
|
70
|
+
# `pc2` leaves PC2 its night tests but those tagged @poste and the measures of time (the flow's
|
|
71
|
+
# tranches, `tests-de-nuit --hors-du-poste`, then `--mesures`). The night of PC3 plays the tests
|
|
72
|
+
# tagged @poste alone (`tests-de-nuit --du-poste`, on its part), then reads the day's flow by `gh`
|
|
73
|
+
# (scripts/repli-de-la-nuit.mjs): a tranche whose job has not started 60 minutes after the flow's
|
|
74
|
+
# hour is cancelled and played on PC3, a tranche started then interrupted plays whole again, a
|
|
75
|
+
# tranche finished on PC2, green or red, is never replayed; the log says which tranches played
|
|
76
|
+
# where. Each part keeps its verdict (scripts/verdict-de-la-nuit.mjs: `nuit/verdict` for PC3,
|
|
77
|
+
# `nuit/verdict-pc2`), the night is red when either is, and a red tranche opens or comments its
|
|
78
|
+
# night ticket.
|
|
79
|
+
# - « À repasser » (exit 75): neither green nor red. The last green stays, no ticket opens,
|
|
80
|
+
# the log says so; the next night plays again.
|
|
71
81
|
# - The project's night script: `grillhouse.nuit` in the package.json of the commit it plays names
|
|
72
82
|
# an npm script (`npm pkg set grillhouse.nuit=<script>`). After the night tests, the night plays
|
|
73
83
|
# `npm run <script>` in its copy; a red script turns the night red, with a log line that names it.
|
|
74
84
|
# The key is read as written, before any work: without it (or with null) the night plays
|
|
75
85
|
# no script of the project; a value that is not a non-blank string, or a name absent from the scripts of
|
|
76
86
|
# 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.
|
|
87
|
+
# - The night pushes nothing: main receives every lot by the queue, on a tree judged; the night keeps
|
|
88
|
+
# its last green (`<git common dir>/nuit/dernier-vert`), a mark and not a branch. A project whose
|
|
89
|
+
# package.json carries the retired key `grillhouse.poussee`, whatever its value, turns the night
|
|
90
|
+
# red before any work, with a log line that names the key and the gesture (remove it,
|
|
91
|
+
# scripts/poussee-retiree.mjs).
|
|
89
92
|
# - The copies whose content is on main: once its steps are played, whatever their verdict, the
|
|
90
93
|
# night passes each copy `git worktree list` names, the main tree and its own left out, through
|
|
91
94
|
# scripts/retirer-copie.sh without `--jetable` (scripts/retirer-les-copies-finies.mjs), as a CI cleans its
|
|
@@ -158,13 +161,18 @@ mkdir -p "$resultats"
|
|
|
158
161
|
|
|
159
162
|
tete="$(git -C "$racine" rev-parse HEAD)"
|
|
160
163
|
copie="$racine/.claude/worktrees/nuit"
|
|
161
|
-
branche=
|
|
162
164
|
# The red steps of the night, and its red tasks: those of the full pass, each with the command
|
|
163
165
|
# that replays it alone when the language has one (in `rejeux`, which a bisect runs), then a step
|
|
164
166
|
# red without a task of its own, named by its command (no command).
|
|
165
167
|
etapes=()
|
|
166
168
|
taches=()
|
|
167
169
|
rejeux=()
|
|
170
|
+
# The part of PC2 of the night (the tranches of the Nuit flow), when the project's flow plays on PC2:
|
|
171
|
+
# its red steps and tasks, kept apart from PC3's so that each part has its own verdict, and its exit
|
|
172
|
+
# code (empty when the project has no part on PC2; 75 when a tranche is still to play there).
|
|
173
|
+
etapes_pc2=()
|
|
174
|
+
taches_pc2=()
|
|
175
|
+
code_pc2=
|
|
168
176
|
# Gets the copy ready on HEAD: detached, cleaned, its submodules set; `partages` holds the list the
|
|
169
177
|
# pose fixes, which every mount gets. Prints the reason on failure.
|
|
170
178
|
partages=
|
|
@@ -177,6 +185,57 @@ preparer() {
|
|
|
177
185
|
fi
|
|
178
186
|
partages=$(bash "$ici/sous-modules.sh" pose "$copie")
|
|
179
187
|
}
|
|
188
|
+
# The part of PC2: reads the day's Nuit flow by `gh` (scripts/repli-de-la-nuit.mjs), which cancels the
|
|
189
|
+
# run when a tranche has not started 60 minutes after the flow's hour, then plays on PC3, whole, each
|
|
190
|
+
# tranche not played on PC2 (never one finished there, green or red). A tranche still running or
|
|
191
|
+
# waiting leaves the part of PC2 « à repasser » (75). The statement says which tranches played where.
|
|
192
|
+
repli() {
|
|
193
|
+
local depot decision ligne
|
|
194
|
+
code_pc2=0
|
|
195
|
+
if ! depot="$(cd "$racine" && gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null)" || [ -z "$depot" ]; then
|
|
196
|
+
echo "⏱ le repli de la nuit ne lit pas le dépôt GitHub (gh) : la part de PC2 reste à repasser."
|
|
197
|
+
code_pc2=75
|
|
198
|
+
return
|
|
199
|
+
fi
|
|
200
|
+
if ! decision="$(node "$ici/repli-de-la-nuit.mjs" "$depot" "$tranches")"; then
|
|
201
|
+
echo "⏱ le repli de la nuit ne lit pas le flux Nuit : la part de PC2 reste à repasser."
|
|
202
|
+
code_pc2=75
|
|
203
|
+
return
|
|
204
|
+
fi
|
|
205
|
+
local lignes rejouer= rouges_pc2= attend=
|
|
206
|
+
lignes="$(printf '%s' "$decision" | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const d=JSON.parse(s);const l=k=>(d[k]??[]).join(" ");process.stdout.write(["pc2","pc3","rouges","enAttente","enCours"].map(k=>k+"\t"+l(k)).join("\n")+"\n")})')"
|
|
207
|
+
while IFS= read -r ligne; do
|
|
208
|
+
case "$ligne" in
|
|
209
|
+
pc2$'\t'*) echo "relevé de la nuit : tranches jouées sur PC2 : ${ligne#pc2$'\t'}" ;;
|
|
210
|
+
pc3$'\t'*) rejouer="${ligne#pc3$'\t'}"; echo "relevé de la nuit : tranches jouées sur PC3 : ${rejouer:-aucune}" ;;
|
|
211
|
+
rouges$'\t'*) rouges_pc2="${ligne#rouges$'\t'}" ;;
|
|
212
|
+
enAttente$'\t'*|enCours$'\t'*) attend="$attend ${ligne#*$'\t'}" ;;
|
|
213
|
+
esac
|
|
214
|
+
done <<< "$lignes"
|
|
215
|
+
local t code
|
|
216
|
+
for t in $rouges_pc2; do
|
|
217
|
+
echo "✗ la tranche $t de la nuit est rouge sur PC2."
|
|
218
|
+
etapes_pc2+=("la tranche $t de la nuit sur PC2")
|
|
219
|
+
taches_pc2+=("la tranche $t de la nuit sur PC2")
|
|
220
|
+
done
|
|
221
|
+
for t in $rejouer; do
|
|
222
|
+
(cd "$copie" && monter node "$ici/commande-du-langage.mjs" tests-de-nuit --hors-du-poste --tranche "$t/$tranches")
|
|
223
|
+
code=$?
|
|
224
|
+
if [ "$code" -ne 0 ] && [ "$code" -ne 75 ]; then
|
|
225
|
+
echo "✗ la tranche $t, rejouée sur PC3, est rouge."
|
|
226
|
+
etapes_pc2+=("la tranche $t de la nuit, rejouée sur PC3")
|
|
227
|
+
taches_pc2+=("la tranche $t de la nuit sur PC3 (repli)")
|
|
228
|
+
elif [ "$code" -eq 75 ]; then
|
|
229
|
+
attend="$attend $t"
|
|
230
|
+
fi
|
|
231
|
+
done
|
|
232
|
+
if [ "${#etapes_pc2[@]}" -gt 0 ]; then
|
|
233
|
+
code_pc2=1
|
|
234
|
+
elif [ -n "${attend// /}" ]; then
|
|
235
|
+
echo "⏱ la part de PC2 reste à repasser : tranche(s) en cours, en attente ou à repasser :$attend."
|
|
236
|
+
code_pc2=75
|
|
237
|
+
fi
|
|
238
|
+
}
|
|
180
239
|
# Plays the copy; its status is the night's verdict. An existing copy that does not get ready is
|
|
181
240
|
# removed (scripts/retirer-copie.sh --jetable) and created again, once.
|
|
182
241
|
jouer() {
|
|
@@ -198,15 +257,15 @@ jouer() {
|
|
|
198
257
|
echo "$raison"
|
|
199
258
|
return 1
|
|
200
259
|
fi
|
|
201
|
-
# The reading gives one line per finding: « script<TAB>name », «
|
|
202
|
-
#
|
|
203
|
-
#
|
|
260
|
+
# The reading gives one line per finding: « script<TAB>name », or a fault « nuit-invalide<TAB>value
|
|
261
|
+
# as JSON », « nuit-absent<TAB>name », « poussee-retiree<TAB>line ». Every faulty key is reported
|
|
262
|
+
# before any work.
|
|
204
263
|
local lecture ligne nuit=
|
|
205
264
|
lecture="$(node --input-type=module -e '
|
|
206
265
|
import { readFileSync } from "node:fs";
|
|
207
266
|
import { pathToFileURL } from "node:url";
|
|
208
267
|
const pkg = JSON.parse(readFileSync(process.argv[1], "utf8"));
|
|
209
|
-
const {
|
|
268
|
+
const { pousseeRetiree } = await import(pathToFileURL(process.argv[2]).href);
|
|
210
269
|
const out = (...l) => process.stdout.write(l.join("\t") + "\n");
|
|
211
270
|
const vide = v => typeof v !== "string" || !v.trim();
|
|
212
271
|
const v = pkg.grillhouse?.nuit;
|
|
@@ -215,26 +274,21 @@ jouer() {
|
|
|
215
274
|
else if (!Object.hasOwn(pkg.scripts ?? {}, v)) out("nuit-absent", v);
|
|
216
275
|
else out("script", v);
|
|
217
276
|
}
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
' "$copie/package.json" "$ici/poussee-cles.mjs" 2>/dev/null)"
|
|
277
|
+
const retiree = pousseeRetiree(pkg);
|
|
278
|
+
if (retiree) out("poussee-retiree", retiree);
|
|
279
|
+
' "$copie/package.json" "$ici/poussee-retiree.mjs" 2>/dev/null)"
|
|
222
280
|
local faute=0
|
|
223
281
|
while IFS= read -r ligne; do
|
|
224
282
|
case "$ligne" in
|
|
225
283
|
script$'\t'*) nuit="${ligne#script$'\t'}" ;;
|
|
226
|
-
pousse$'\t'*) branche="${ligne#pousse$'\t'}" ;;
|
|
227
284
|
nuit-invalide$'\t'*)
|
|
228
285
|
echo "✗ la clé grillhouse.nuit vaut ${ligne#nuit-invalide$'\t'}, pas un nom de script npm : rien n'est joué."
|
|
229
286
|
faute=1 ;;
|
|
230
287
|
nuit-absent$'\t'*)
|
|
231
288
|
echo "✗ la clé grillhouse.nuit nomme « ${ligne#nuit-absent$'\t'} », absent des scripts du package.json : rien n'est joué."
|
|
232
289
|
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é."
|
|
290
|
+
poussee-retiree$'\t'*)
|
|
291
|
+
echo "✗ ${ligne#poussee-retiree$'\t'} Rien n'est joué."
|
|
238
292
|
faute=1 ;;
|
|
239
293
|
esac
|
|
240
294
|
done <<< "$lecture"
|
|
@@ -310,7 +364,19 @@ process.exit(paquets(process.argv[2]).some(p => p.pkg.name === "@roomi-fields/gr
|
|
|
310
364
|
rejeux+=("")
|
|
311
365
|
fi
|
|
312
366
|
fi
|
|
313
|
-
|
|
367
|
+
# A project whose Nuit flow plays on PC2 (its runner label `pc2`) leaves PC2 the night tests that
|
|
368
|
+
# do not need the poste: PC3 plays the tests tagged @poste alone, then the tranches PC2 did not
|
|
369
|
+
# play (the fallback, scripts/repli-de-la-nuit.mjs); the measures of time play on PC2.
|
|
370
|
+
local sur_pc2=0 tranches=
|
|
371
|
+
if grep -q "\bpc2\b" "$copie/.github/workflows/nuit.yml" 2>/dev/null; then
|
|
372
|
+
sur_pc2=1
|
|
373
|
+
tranches="$(sed -n 's/^ TRANCHES: *\([0-9]*\).*/\1/p' "$copie/.github/workflows/nuit.yml")"
|
|
374
|
+
fi
|
|
375
|
+
bancs() {
|
|
376
|
+
local args=()
|
|
377
|
+
[ "$sur_pc2" -eq 0 ] || args=(--du-poste)
|
|
378
|
+
(cd "$copie" && monter node "$ici/commande-du-langage.mjs" tests-de-nuit "${args[@]}")
|
|
379
|
+
}
|
|
314
380
|
bancs
|
|
315
381
|
code=$?
|
|
316
382
|
if [ "$code" -eq 75 ]; then
|
|
@@ -334,6 +400,9 @@ process.exit(paquets(process.argv[2]).some(p => p.pkg.name === "@roomi-fields/gr
|
|
|
334
400
|
taches+=("les bancs de temps et les tests de nuit")
|
|
335
401
|
rejeux+=("")
|
|
336
402
|
fi
|
|
403
|
+
if [ "$sur_pc2" -eq 1 ]; then
|
|
404
|
+
repli
|
|
405
|
+
fi
|
|
337
406
|
if [ -n "$nuit" ] && ! monter npm --prefix "$copie" run "$nuit"; then
|
|
338
407
|
echo "✗ le script de nuit du projet \`npm run $nuit\` (grillhouse.nuit) a échoué."
|
|
339
408
|
etapes+=("le script de nuit du projet (npm run $nuit, grillhouse.nuit)")
|
|
@@ -354,7 +423,20 @@ verdict=$?
|
|
|
354
423
|
(cd "$racine" && node "$ici/retirer-les-copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
|
|
355
424
|
# The project's durable verdict, read by the board: green on 0, red on any other code but 75, which
|
|
356
425
|
# writes nothing (the previous verdict stays).
|
|
357
|
-
node "$ici/verdict-de-la-nuit.mjs" "$commun" "$verdict" >> "$journal" 2>&1 || true
|
|
426
|
+
node "$ici/verdict-de-la-nuit.mjs" "$commun" "$verdict" pc3 >> "$journal" 2>&1 || true
|
|
427
|
+
# The part of PC2, when the project has one: its own durable verdict, and the night's, which is red
|
|
428
|
+
# when either part is red and « à repasser » while a tranche of PC2 is still to play.
|
|
429
|
+
if [ -n "$code_pc2" ]; then
|
|
430
|
+
node "$ici/verdict-de-la-nuit.mjs" "$commun" "$code_pc2" pc2 >> "$journal" 2>&1 || true
|
|
431
|
+
if [ "$code_pc2" -eq 1 ]; then
|
|
432
|
+
etapes+=("${etapes_pc2[@]}")
|
|
433
|
+
taches+=("${taches_pc2[@]}")
|
|
434
|
+
for _ in "${taches_pc2[@]}"; do rejeux+=(""); done
|
|
435
|
+
verdict=1
|
|
436
|
+
elif [ "$code_pc2" -eq 75 ] && [ "$verdict" -eq 0 ]; then
|
|
437
|
+
verdict=75
|
|
438
|
+
fi
|
|
439
|
+
fi
|
|
358
440
|
|
|
359
441
|
if [ "$verdict" -eq 75 ]; then
|
|
360
442
|
echo "⏱ à repasser : ${tete:0:7} n'est ni vert ni rouge, la machine est restée chargée ; le dernier vert reste, aucun ticket, la nuit suivante rejoue." >> "$journal"
|
|
@@ -393,21 +475,6 @@ signaler() {
|
|
|
393
475
|
if [ "$verdict" -eq 0 ]; then
|
|
394
476
|
echo "$tete" > "$dossier/dernier-vert"
|
|
395
477
|
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
478
|
exit 0
|
|
412
479
|
fi
|
|
413
480
|
|
package/scripts/paquet.mjs
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
// path, or else the folder's name, as the guard of the languages reads a component; a row that
|
|
14
14
|
// names the path itself comes first. Refused, by its name, and nothing written: a path no row
|
|
15
15
|
// names; a row whose cell of the column « Langage » is empty; a language out of the frame's
|
|
16
|
-
// list; a folder that already holds the manifest of its language (`manifeste` of its module)
|
|
16
|
+
// list; a folder that already holds the manifest of its language (`manifeste` of its module); a
|
|
17
|
+
// key `grillhouse.groupe` the update would refuse (`groupeDe` of ./groupe-cles.mjs, read in the
|
|
18
|
+
// main tree of the repository: the command plays in a copy of work as in the main tree). A
|
|
17
19
|
// folder that holds docs/ alone, the documents of the second time, is accepted, as `cargo init`
|
|
18
20
|
// takes a folder without its Cargo.toml; a folder that already holds code is given to the
|
|
19
21
|
// module with its files (`existants`), which takes them as they are, or refuses, by its name,
|
|
@@ -47,6 +49,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
47
49
|
import { CADRE } from './cadre.mjs';
|
|
48
50
|
import { installerBinaires } from './binaires.mjs';
|
|
49
51
|
import { aInstaller, mettreAJour, rapport, regenerer } from './grillhouse-maj.mjs';
|
|
52
|
+
import { groupeDe } from './groupe-cles.mjs';
|
|
50
53
|
import { LANGAGES, langage } from './langages.mjs';
|
|
51
54
|
import {
|
|
52
55
|
inscrireAuxEspaces,
|
|
@@ -284,15 +287,23 @@ const lancer = (commande, args, dossier) =>
|
|
|
284
287
|
/**
|
|
285
288
|
* Creates the package at <chemin> of the project at <racine>: its plan written, then the tools of
|
|
286
289
|
* its language (see the header). Returns `{ ecrits, lignes, echecs }`: the files written, the
|
|
287
|
-
* lines of the report, the lines of each command that fails. Throws a Refus as `planDuPaquet
|
|
290
|
+
* lines of the report, the lines of each command that fails. Throws a Refus as `planDuPaquet`,
|
|
291
|
+
* and on a faulty key `grillhouse.groupe`, before any file is written.
|
|
288
292
|
* @param {string} racine
|
|
289
293
|
* @param {string} chemin
|
|
290
|
-
* @param {{ source?: string, executer?: (commande: string, args: string[], dossier: string) => number }} [o]
|
|
294
|
+
* @param {{ source?: string, executer?: (commande: string, args: string[], dossier: string) => number, bd?: (args: string[], cwd: string) => { status: number | null, stdout?: string, stderr?: string } }} [o]
|
|
295
|
+
* `bd`: the Beads the update plays (`mettreAJour`), the real one without it
|
|
291
296
|
*/
|
|
292
|
-
export function creerPaquet(racine, chemin, { source = CADRE, executer = lancer } = {}) {
|
|
297
|
+
export function creerPaquet(racine, chemin, { source = CADRE, executer = lancer, bd } = {}) {
|
|
293
298
|
const plan = planDuPaquet(racine, chemin, { source });
|
|
299
|
+
// What the update refuses by its key is refused here, before the first file is written.
|
|
300
|
+
try {
|
|
301
|
+
groupeDe(racine);
|
|
302
|
+
} catch (e) {
|
|
303
|
+
throw new Refus(e.message.replace(/^⛔ /, ''));
|
|
304
|
+
}
|
|
294
305
|
const ecrits = ecrireLePaquet(racine, plan);
|
|
295
|
-
const b = mettreAJour(racine, source);
|
|
306
|
+
const b = mettreAJour(racine, source, bd ? { bd } : {});
|
|
296
307
|
const echecs = [];
|
|
297
308
|
const vus = new Set();
|
|
298
309
|
const jouer = (commande, args, dossier) => {
|
package/scripts/paquets.d.ts
CHANGED
|
@@ -8,3 +8,7 @@ export const CODE: string;
|
|
|
8
8
|
export const TYPAGE: string;
|
|
9
9
|
/** The names listed in `racine`'s `docs/agents/hors-cadre.txt`: empty without the file. */
|
|
10
10
|
export function horsCadre(racine: string): Set<string>;
|
|
11
|
+
/** Those of `chemins` (absolute, under `racine`), each as given, that git ignores in the repository
|
|
12
|
+
* at `racine`; a path under a submodule is never one. Empty when `racine` is not the root of a git
|
|
13
|
+
* repository (it holds no `.git`), or when git does not answer. */
|
|
14
|
+
export function ignoresParGit(racine: string, chemins: string[]): Set<string>;
|
package/scripts/paquets.mjs
CHANGED
|
@@ -10,11 +10,16 @@
|
|
|
10
10
|
// `docs/agents/hors-cadre.txt` (read by `horsCadre`, below) lists it: a directory under
|
|
11
11
|
// `packages/` or `src/`.
|
|
12
12
|
//
|
|
13
|
+
// What git ignores holds no component (`ignoresParGit`, below): the modules of language that find
|
|
14
|
+
// their components on the disk (c, python, typescript) leave it out, as ripgrep and ESLint judge
|
|
15
|
+
// the tree git follows.
|
|
16
|
+
//
|
|
13
17
|
// This module and the ones it imports use Node alone: the update runs them from a source checkout
|
|
14
18
|
// of the frame that installs no dependency.
|
|
15
19
|
//
|
|
16
20
|
// A project's guard imports `horsCadre` by the package's entry `@roomi-fields/grillhouse/paquets`,
|
|
17
21
|
// its types in ./paquets.d.ts (docs/ARCHITECTURE.md, the package's named entries).
|
|
22
|
+
import { spawnSync } from 'node:child_process';
|
|
18
23
|
import { existsSync, globSync, readdirSync, readFileSync } from 'node:fs';
|
|
19
24
|
import path from 'node:path';
|
|
20
25
|
|
|
@@ -45,6 +50,58 @@ export function horsCadre(racine) {
|
|
|
45
50
|
return noms;
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Those of <chemins> (absolute, under <racine>), each as given, that git ignores in the repository
|
|
55
|
+
* at <racine>, as `git check-ignore` reads its exclusion rules: a path under an ignored folder is
|
|
56
|
+
* ignored, a file git tracks never is. A path under a submodule is never ignored: the submodule
|
|
57
|
+
* is tracked, and git refuses to judge a path inside it. Empty when <racine> is not the root of a
|
|
58
|
+
* git repository (it holds no `.git`), or when git does not answer: the disk alone is then read.
|
|
59
|
+
* @param {string} racine the root of the project
|
|
60
|
+
* @param {string[]} chemins
|
|
61
|
+
* @returns {Set<string>}
|
|
62
|
+
*/
|
|
63
|
+
export function ignoresParGit(racine, chemins) {
|
|
64
|
+
if (chemins.length === 0 || !existsSync(path.join(racine, '.git'))) {
|
|
65
|
+
return new Set();
|
|
66
|
+
}
|
|
67
|
+
const git = (args, input) =>
|
|
68
|
+
spawnSync('git', ['-C', racine, ...args], {
|
|
69
|
+
input,
|
|
70
|
+
encoding: 'utf8',
|
|
71
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
72
|
+
});
|
|
73
|
+
// The submodules of the index (its entries of mode 160000), each a path from the root.
|
|
74
|
+
const index = git(['ls-files', '--stage', '-z']);
|
|
75
|
+
if (index.status !== 0) {
|
|
76
|
+
return new Set();
|
|
77
|
+
}
|
|
78
|
+
const sousModules = index.stdout
|
|
79
|
+
.split('\0')
|
|
80
|
+
.filter(l => l.startsWith('160000 '))
|
|
81
|
+
.map(l => l.slice(l.indexOf('\t') + 1));
|
|
82
|
+
const parRel = new Map();
|
|
83
|
+
for (const c of chemins) {
|
|
84
|
+
const rel = path.relative(racine, c).split(path.sep).join('/');
|
|
85
|
+
if (!sousModules.some(s => rel === s || rel.startsWith(`${s}/`))) {
|
|
86
|
+
parRel.set(rel, c);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (parRel.size === 0) {
|
|
90
|
+
return new Set();
|
|
91
|
+
}
|
|
92
|
+
const r = git(['check-ignore', '-z', '--stdin'], [...parRel.keys()].join('\0'));
|
|
93
|
+
// 0: at least one path is ignored; 1: none; any other code, git did not answer.
|
|
94
|
+
if (r.status !== 0) {
|
|
95
|
+
return new Set();
|
|
96
|
+
}
|
|
97
|
+
return new Set(
|
|
98
|
+
r.stdout
|
|
99
|
+
.split('\0')
|
|
100
|
+
.filter(rel => parRel.has(rel))
|
|
101
|
+
.map(rel => parRel.get(rel))
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
48
105
|
// The names of <racine>'s `docs/agents/hors-cadre.txt` that no directory under `packages/` or
|
|
49
106
|
// `src/` bears, in the order of the list: a line the session start names (a typo names nothing).
|
|
50
107
|
export function horsCadreInconnus(racine) {
|