@roomi-fields/grillhouse 0.28.3 → 0.30.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 +739 -0
- package/bin/grillhouse.mjs +128 -26
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +37 -4
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +813 -53
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +161 -30
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +328 -0
- package/scripts/avancement.mjs +159 -64
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +888 -3654
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +30 -11
- package/scripts/conformite.mjs +19 -10
- package/scripts/copies-finies.mjs +188 -42
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +27 -32
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
- package/scripts/etapes.mjs +6 -3
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/fusion-du-changelog.mjs +0 -1
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +477 -422
- package/scripts/integration/integrer.mjs +20 -22
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +168 -28
- package/scripts/langages/cargo/commandes.mjs +426 -119
- package/scripts/langages/cargo/composants.mjs +187 -3
- package/scripts/langages/cargo/exemples.mjs +75 -17
- package/scripts/langages/cargo/index.mjs +32 -13
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +62 -16
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +232 -79
- package/scripts/langages/python/composants.mjs +65 -3
- package/scripts/langages/python/exemples.mjs +21 -12
- package/scripts/langages/python/index.mjs +25 -5
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +19 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +48 -63
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +110 -296
- package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +11 -9
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +29 -15
- package/scripts/outil.mjs +72 -0
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +112 -14
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +29 -14
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +28 -11
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +23 -4
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +39 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +382 -16
- package/scripts/tableau.mjs +329 -130
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +322 -62
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +62 -28
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +22 -8
- package/skills/testwriter/SKILL.md +47 -39
- package/scripts/demon.mjs +0 -138
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The guard of the flows of the CI: each flow declares the packages it exercises, and the reviewer
|
|
3
|
+
// reads it when a lot touches one of them, as a CODEOWNERS file names who reads a path.
|
|
4
|
+
//
|
|
5
|
+
// npx grillhouse flux-des-paquets (one of the frame's guards, scripts/gardes-du-cadre.mjs)
|
|
6
|
+
//
|
|
7
|
+
// - The key `grillhouse.flux` of the root package.json declares them, read from the main tree of
|
|
8
|
+
// the repository (`fluxDe`), as `grillhouse.engendres` and `grillhouse.outils` are:
|
|
9
|
+
// `{ ".github/workflows/<flux>.yml": ["<paquet>", …] }`, each package named by its name in the
|
|
10
|
+
// graph (the `name` of its package.json, whatever its language: a crate and a project of Python
|
|
11
|
+
// have one, scripts/paquets.mjs).
|
|
12
|
+
// - The key is absent, null or an object; each key is a path under .github/workflows, each value a
|
|
13
|
+
// list of strings. Every fault is named with its key; a faulty key gives no flow.
|
|
14
|
+
// - Refused, each finding named: a file of .github/workflows (.yml, .yaml) the key does not
|
|
15
|
+
// declare, a declared flow whose file does not exist, a package name the graph does not carry.
|
|
16
|
+
// A project without .github/workflows and without the key has nothing to say.
|
|
17
|
+
// - A lot touches a package when one of its files changes under the folder of the package; neither
|
|
18
|
+
// its dependents nor its dependencies count, the flow declares each package it exercises.
|
|
19
|
+
// `consigneDesFlux` gives the reviewer's line per flow the lot touches (the flow itself, or a
|
|
20
|
+
// package it declares), « aucun » for none.
|
|
21
|
+
// - Each finding is written in SARIF under the guard's name, and on the error stream after ⛔; the
|
|
22
|
+
// exit code is 1 when there is one, 0 otherwise.
|
|
23
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
24
|
+
import path from 'node:path';
|
|
25
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
26
|
+
import { arbrePrincipal } from './outils-cles.mjs';
|
|
27
|
+
import { paquets } from './paquets.mjs';
|
|
28
|
+
import { ecrireSarif } from './resultats.mjs';
|
|
29
|
+
|
|
30
|
+
/** This script. */
|
|
31
|
+
export const SCRIPT = fileURLToPath(import.meta.url);
|
|
32
|
+
/** The name its findings carry. */
|
|
33
|
+
export const GARDE = 'flux-des-paquets';
|
|
34
|
+
|
|
35
|
+
const DOSSIER = '.github/workflows';
|
|
36
|
+
const CLE = 'grillhouse.flux';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The flows that the package.json <pkg> declares (`grillhouse.flux`): `flux`, each `{ fichier,
|
|
40
|
+
* paquets }`, and `fautes`, each fault named with its key (no flow with a fault).
|
|
41
|
+
* @param {Record<string, any> | null | undefined} pkg
|
|
42
|
+
* @returns {{ flux: { fichier: string, paquets: string[] }[], fautes: string[] }}
|
|
43
|
+
*/
|
|
44
|
+
export function lireFlux(pkg) {
|
|
45
|
+
const f = pkg?.grillhouse?.flux;
|
|
46
|
+
if (f === undefined || f === null) return { flux: [], fautes: [] };
|
|
47
|
+
if (typeof f !== 'object' || Array.isArray(f)) {
|
|
48
|
+
return {
|
|
49
|
+
flux: [],
|
|
50
|
+
fautes: [
|
|
51
|
+
`la clé ${CLE} vaut ${JSON.stringify(f)}, pas un objet { "${DOSSIER}/<flux>.yml": ["<paquet>", …] }.`,
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const fautes = [];
|
|
56
|
+
const flux = [];
|
|
57
|
+
for (const [fichier, liste] of Object.entries(f)) {
|
|
58
|
+
const cle = `${CLE}.${fichier}`;
|
|
59
|
+
const sain = fichier.startsWith(`${DOSSIER}/`) && !fichier.split('/').includes('..');
|
|
60
|
+
if (!sain) {
|
|
61
|
+
fautes.push(`${cle} : la clé n'est pas un fichier sous ${DOSSIER}/.`);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (!Array.isArray(liste) || liste.some(p => typeof p !== 'string')) {
|
|
65
|
+
fautes.push(`${cle} vaut ${JSON.stringify(liste)}, pas une liste de noms de paquets.`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
flux.push({ fichier, paquets: liste });
|
|
69
|
+
}
|
|
70
|
+
return { flux: fautes.length ? [] : flux, fautes };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const lireJson = f => {
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(readFileSync(f, 'utf8'));
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The flows of the project that holds <dir>, from the package.json of its main tree, never of a
|
|
83
|
+
* copy; none without one.
|
|
84
|
+
* @param {string} dir a directory of the project: its main tree or a copy
|
|
85
|
+
* @throws {Error} the faults of the key, one per line
|
|
86
|
+
*/
|
|
87
|
+
export function fluxDe(dir) {
|
|
88
|
+
const f = path.join(arbrePrincipal(dir), 'package.json');
|
|
89
|
+
if (!existsSync(f)) return [];
|
|
90
|
+
const { flux, fautes } = lireFlux(lireJson(f));
|
|
91
|
+
if (fautes.length) throw new Error(fautes.join('\n'));
|
|
92
|
+
return flux;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// The workflow files of <racine>: the .yml and .yaml under .github/workflows, from the root.
|
|
96
|
+
function fichiersDeFlux(racine) {
|
|
97
|
+
const d = path.join(racine, DOSSIER);
|
|
98
|
+
if (!existsSync(d)) return [];
|
|
99
|
+
return readdirSync(d, { withFileTypes: true })
|
|
100
|
+
.filter(e => e.isFile() && /\.ya?ml$/.test(e.name))
|
|
101
|
+
.map(e => `${DOSSIER}/${e.name}`)
|
|
102
|
+
.sort();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The findings of the guard on the project at <racine>: `{ fichier, message }`, none when each
|
|
107
|
+
* workflow is declared with packages the graph carries.
|
|
108
|
+
* @param {string} racine the root of the project
|
|
109
|
+
*/
|
|
110
|
+
export function constats(racine) {
|
|
111
|
+
const pkg = lireJson(path.join(racine, 'package.json'));
|
|
112
|
+
const { flux, fautes } = lireFlux(pkg);
|
|
113
|
+
const out = fautes.map(message => ({ fichier: 'package.json', message }));
|
|
114
|
+
if (fautes.length) return out;
|
|
115
|
+
const connus = new Set(paquets(racine).map(p => p.pkg.name));
|
|
116
|
+
const declares = new Set(flux.map(f => f.fichier));
|
|
117
|
+
for (const f of fichiersDeFlux(racine)) {
|
|
118
|
+
if (!declares.has(f)) {
|
|
119
|
+
out.push({
|
|
120
|
+
fichier: f,
|
|
121
|
+
message: `${f} : flux de la CI sans entrée dans ${CLE} du package.json ; chaque flux déclare les paquets qu'il exerce, le relecteur le lit.`,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (const { fichier, paquets: noms } of flux) {
|
|
126
|
+
if (!existsSync(path.join(racine, fichier))) {
|
|
127
|
+
out.push({
|
|
128
|
+
fichier: 'package.json',
|
|
129
|
+
message: `${fichier} : déclaré dans ${CLE}, mais le fichier n'existe pas.`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
for (const n of noms.filter(x => !connus.has(x))) {
|
|
133
|
+
out.push({
|
|
134
|
+
fichier: 'package.json',
|
|
135
|
+
message: `${fichier} : le paquet ${n} que ${CLE} déclare est inconnu du graphe ; un paquet s'écrit par son nom (le « name » de son package.json), non par son dossier.`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The reviewer's lines for the lot of <fichiers> (from the root): one `- lis <flux> : <raison>` per
|
|
144
|
+
* flow it touches, « aucun … » for none.
|
|
145
|
+
* @param {string} racine the root of the project
|
|
146
|
+
* @param {string[]} fichiers
|
|
147
|
+
*/
|
|
148
|
+
export function consigneDesFlux(racine, fichiers) {
|
|
149
|
+
let flux;
|
|
150
|
+
try {
|
|
151
|
+
flux = fluxDe(racine);
|
|
152
|
+
} catch (e) {
|
|
153
|
+
return `aucun : la clé ${CLE} est refusée (${e.message.split('\n')[0]}).`;
|
|
154
|
+
}
|
|
155
|
+
const dossiers = new Map(
|
|
156
|
+
paquets(racine).map(p => [p.pkg.name, p.dossier.split(path.sep).join('/')])
|
|
157
|
+
);
|
|
158
|
+
const sous = (f, d) => d === '.' || f.startsWith(`${d}/`);
|
|
159
|
+
const lignes = [];
|
|
160
|
+
for (const { fichier, paquets: noms } of flux) {
|
|
161
|
+
const raisons = [];
|
|
162
|
+
if (fichiers.includes(fichier)) raisons.push('le lot change le flux');
|
|
163
|
+
for (const n of noms) {
|
|
164
|
+
const d = dossiers.get(n);
|
|
165
|
+
if (d !== undefined && fichiers.some(f => sous(f, d))) {
|
|
166
|
+
raisons.push(`le lot touche le paquet ${n}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (raisons.length) lignes.push(`- lis ${fichier} : ${raisons.join(' ; ')}`);
|
|
170
|
+
}
|
|
171
|
+
return lignes.length ? lignes.join('\n') : 'aucun : le lot ne touche aucun flux de la CI.';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
175
|
+
const racine = process.cwd();
|
|
176
|
+
let refus;
|
|
177
|
+
try {
|
|
178
|
+
refus = constats(racine);
|
|
179
|
+
} catch (e) {
|
|
180
|
+
refus = [{ message: e.message.replace(/^⛔ /, '') }];
|
|
181
|
+
}
|
|
182
|
+
for (const r of refus) {
|
|
183
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
184
|
+
}
|
|
185
|
+
ecrireSarif({ garde: GARDE, racine, constats: refus });
|
|
186
|
+
process.exitCode = refus.length ? 1 : 0;
|
|
187
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
// The frame's merge driver of the CHANGELOG, on the model of gnulib's git-merge-changelog: two
|
|
3
2
|
// lots that each add an entry under the same heading both keep their entry, wherever git merges
|
|
4
3
|
// three ways (the integration's `git apply --3way --index`, the relaunch's `git apply --3way`, the
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
// npx grillhouse gardes-du-cadre (npm run grillhouse:gardes, a task of Turborepo)
|
|
5
5
|
//
|
|
6
6
|
// - The guards are the core's, the languages of the packages first (./langages-des-paquets.mjs:
|
|
7
|
-
// each package follows the language the architecture declares for it
|
|
7
|
+
// each package follows the language the architecture declares for it; ./dependances-internes.mjs:
|
|
8
|
+
// the package.json of a crate or of a project of Python names the internal packages its
|
|
9
|
+
// manifest links; ./flux-des-paquets.mjs: each flow of the CI declares the packages it exercises),
|
|
10
|
+
// then those of the
|
|
8
11
|
// modules of the project's languages (`gardes`, scripts/jointure.d.ts, scripts/langages.mjs),
|
|
9
12
|
// each module's in their order, the modules in the order of the declaration.
|
|
10
13
|
// - Each guard is a script of the package, and plays in the working directory, under the environment of the run
|
|
@@ -20,14 +23,21 @@
|
|
|
20
23
|
import { spawnSync } from 'node:child_process';
|
|
21
24
|
import path from 'node:path';
|
|
22
25
|
import { pathToFileURL } from 'node:url';
|
|
26
|
+
import { SCRIPT as DEPENDANCES_INTERNES } from './dependances-internes.mjs';
|
|
23
27
|
import { SCRIPT as LANGAGES_DES_PAQUETS } from './langages-des-paquets.mjs';
|
|
28
|
+
import { SCRIPT as FLUX_DES_PAQUETS } from './flux-des-paquets.mjs';
|
|
24
29
|
import { langageDe } from './langages.mjs';
|
|
25
30
|
import { A_ELAGUER, ecrireSarif, lireSarif, RESULTATS } from './resultats.mjs';
|
|
26
31
|
|
|
27
32
|
// The guards of the frame in the repository at <racine>, each its script and its arguments, in
|
|
28
33
|
// the order they play: the core's, then the languages'.
|
|
29
34
|
export function gardesDuCadre(racine) {
|
|
30
|
-
return [
|
|
35
|
+
return [
|
|
36
|
+
[LANGAGES_DES_PAQUETS],
|
|
37
|
+
[DEPENDANCES_INTERNES],
|
|
38
|
+
[FLUX_DES_PAQUETS],
|
|
39
|
+
...langageDe(racine).gardes(racine),
|
|
40
|
+
];
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
// The name of each guard of the frame, as its findings carry it: its script's, without extension.
|
|
@@ -85,9 +85,11 @@
|
|
|
85
85
|
// previous version added stays, and `devDependencies` are written sorted by name. The report
|
|
86
86
|
// names each tool added and `npm install`, which installs them. A project without
|
|
87
87
|
// `packageManager` receives the template's.
|
|
88
|
-
// - What the
|
|
89
|
-
//
|
|
90
|
-
//
|
|
88
|
+
// - What the frame writes in a project (IGNORES_DU_CADRE: the copies of the tickets,
|
|
89
|
+
// `.claude/worktrees`) and what the tools of the declared language write there (`ignorer` of its
|
|
90
|
+
// module: typescript's `.turbo`, cargo's `target`): a `.gitignore` that does not ignore one
|
|
91
|
+
// receives its line, `<nom>/`. The template's `.gitignore` lists none of them: the update is
|
|
92
|
+
// their one source, for a project `init` creates as for an existing one.
|
|
91
93
|
// - The binaries of the declared language (`binaires` of its module: cargo's nextest and
|
|
92
94
|
// cargo-deny), after the files: the command line runs the commands of its module
|
|
93
95
|
// (`miseAJour.installation`), which list what is installed and install each one missing or at
|
|
@@ -181,14 +183,21 @@ const lireJson = (f, defaut) => {
|
|
|
181
183
|
}
|
|
182
184
|
};
|
|
183
185
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
/**
|
|
187
|
+
* The directories the frame itself writes in a project, which its `.gitignore` ignores: the
|
|
188
|
+
* copies of the tickets. The template's `.gitignore` lists none of them, nor what the tools of its
|
|
189
|
+
* language write: the update lays both, in a new project as in an existing one.
|
|
190
|
+
*/
|
|
191
|
+
export const IGNORES_DU_CADRE = ['.claude/worktrees'];
|
|
192
|
+
|
|
193
|
+
// Adds to the `.gitignore` of the project at <projet> each directory the frame writes
|
|
194
|
+
// (IGNORES_DU_CADRE) and each its language's tools write (`ignorer` of its module), as `<nom>/`,
|
|
195
|
+
// when no line ignores it (`<nom>`, `<nom>/`, `/<nom>`, `/<nom>/`); its own lines stay.
|
|
187
196
|
function ignorer(projet) {
|
|
188
197
|
const f = path.join(projet, '.gitignore');
|
|
189
198
|
let texte = existsSync(f) ? readFileSync(f, 'utf8') : '';
|
|
190
199
|
const avant = texte;
|
|
191
|
-
for (const nom of langageDe(projet).ignorer) {
|
|
200
|
+
for (const nom of [...IGNORES_DU_CADRE, ...langageDe(projet).ignorer]) {
|
|
192
201
|
const lignes = texte.split('\n').map(l => l.trim());
|
|
193
202
|
if ([nom, `${nom}/`, `/${nom}`, `/${nom}/`].some(l => lignes.includes(l))) {
|
|
194
203
|
continue;
|