@roomi-fields/grillhouse 0.26.0 → 0.28.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/agents/explorateur.md +1 -1
- package/cadre/templates/paquet/docs/CADRE.md +36 -0
- package/cadre/templates/paquet/docs/INTERFACE.md +10 -0
- package/cadre/templates/projet/CLAUDE.md +7 -0
- package/cadre/templates/projet/docs/ARCHITECTURE.md +15 -0
- package/cadre/templates/python/package.json +18 -0
- package/charte.md +48 -1
- package/docs/ARCHITECTURE.md +113 -20
- package/docs/CADRE.md +7 -6
- package/docs/INTERFACE.md +111 -32
- package/package.json +1 -1
- package/scripts/circuit.mjs +304 -40
- package/scripts/commande-du-langage.mjs +2 -2
- package/scripts/commandes-composees.mjs +156 -0
- package/scripts/composition-des-langages.mjs +306 -0
- package/scripts/conformite.mjs +1 -3
- package/scripts/dernier-vert.mjs +15 -2
- package/scripts/engendres.mjs +170 -0
- package/scripts/enveloppe/lancer.sh +10 -6
- package/scripts/enveloppe/travail-de-la-copie.mjs +82 -8
- package/scripts/etapes.mjs +18 -5
- package/scripts/gardes-du-cadre.mjs +7 -4
- package/scripts/grillhouse-maj.mjs +157 -103
- package/scripts/index-interfaces.mjs +78 -0
- package/scripts/init.mjs +5 -5
- package/scripts/integration/file.mjs +74 -13
- package/scripts/integration/integrer.mjs +50 -62
- package/scripts/jointure.d.ts +44 -13
- package/scripts/langages/cargo/binaires.mjs +29 -6
- package/scripts/langages/cargo/clippy.mjs +4 -2
- package/scripts/langages/cargo/commandes.mjs +45 -7
- package/scripts/langages/cargo/exemples.mjs +1 -15
- package/scripts/langages/cargo/index-interfaces.mjs +20 -3
- package/scripts/langages/cargo/index.mjs +12 -10
- package/scripts/langages/cargo/mise-a-jour.mjs +2 -1
- package/scripts/langages/cargo/sccache.mjs +29 -0
- package/scripts/langages/cargo/squelette.mjs +111 -0
- package/scripts/langages/python/binaires.json +3 -0
- package/scripts/langages/python/binaires.mjs +59 -0
- package/scripts/langages/python/commandes.mjs +411 -0
- package/scripts/langages/python/composants.mjs +272 -0
- package/scripts/langages/python/exemples.mjs +260 -0
- package/scripts/langages/python/index-interfaces.mjs +77 -0
- package/scripts/langages/python/index.mjs +97 -0
- package/scripts/langages/python/lot.mjs +76 -0
- package/scripts/langages/python/mise-a-jour.mjs +54 -0
- package/scripts/langages/python/squelette.mjs +66 -0
- package/scripts/langages/python/tailles-des-tests.mjs +102 -0
- package/scripts/langages/python/verdict.mjs +85 -0
- package/scripts/langages/typescript/exemples.mjs +1 -20
- package/scripts/langages/typescript/frontieres.mjs +14 -1
- package/scripts/langages/typescript/index-interfaces.mjs +10 -3
- package/scripts/langages/typescript/index.mjs +14 -15
- package/scripts/langages/typescript/squelette.mjs +120 -0
- package/scripts/langages-des-paquets.mjs +171 -0
- package/scripts/langages.mjs +60 -41
- package/scripts/migrations/0.27.0-langages-dans-l-architecture.mjs +182 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/outils-cles.mjs +1 -1
- package/scripts/paquet.mjs +261 -0
- package/scripts/resultats.mjs +54 -1
- package/scripts/session-start.sh +34 -9
- package/scripts/sources.mjs +2 -1
- package/scripts/sous-commandes.mjs +6 -3
- package/scripts/tableau-des-composants.mjs +140 -0
- package/scripts/verrous/verrou.mjs +3 -2
- package/skills/explorateur/SKILL.md +33 -4
- package/skills/grill/SKILL.md +14 -1
- package/skills/pitmaster/SKILL.md +34 -4
- package/skills/pitmaster/references/consigne-agent.md +33 -4
- package/skills/redacteur/references/documents-d-un-composant.md +12 -0
- package/skills/relecteur/SKILL.md +12 -0
- package/skills/testwriter/SKILL.md +6 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// The generated files a project keeps committed, and their regeneration on a tree where a lot is
|
|
2
|
+
// applied. As npm writes package-lock.json again after a merge instead of merging it, and as a
|
|
3
|
+
// genrule of Bazel writes its output again on the merged tree, a derived file is never merged: its
|
|
4
|
+
// command writes it again from its merged sources.
|
|
5
|
+
//
|
|
6
|
+
// - The key `grillhouse.engendres` of the root package.json declares them, read from the main tree
|
|
7
|
+
// of the repository (`engendresDe`), never from a copy, as `grillhouse.outils`
|
|
8
|
+
// (scripts/outils-cles.mjs): `{ "<nom>": { "commande": "<ligne du shell>", "fichiers":
|
|
9
|
+
// ["<motif>"], "lit": ["<motif>"] } }`, each pattern from the root (a path, a directory or a glob
|
|
10
|
+
// pattern, as `couvertPar` reads it), `lit` the files it reads, empty when not given. Each one
|
|
11
|
+
// is read in the form of a file a module of language generates (`FichierEngendre` of
|
|
12
|
+
// scripts/jointure.d.ts): its command writes its `fichiers` in full (`entiers`), and no guard
|
|
13
|
+
// judges it (`gardes` empty). A key without a command, without files, or with a pattern out of
|
|
14
|
+
// the repository (absolute, or climbing above the root) is refused by its name, and gives no
|
|
15
|
+
// generated file: the circuit stops at its launch, the integration, the queue and the move of a
|
|
16
|
+
// copy onto main refuse before any work.
|
|
17
|
+
// - `touchesPar` gives the generated files a lot touches: one of their files, or one they read.
|
|
18
|
+
// - `regenerer` plays the command of each, in order, then stages every file they changed; a command
|
|
19
|
+
// of the project at another code than 0, one of the frame on a real failure (126, 127, a signal,
|
|
20
|
+
// 128 + its number), or a file changed that their `fichiers` do not cover refuses, the command,
|
|
21
|
+
// its code and its output named. The integration (scripts/integration/integrer.mjs), the queue
|
|
22
|
+
// (scripts/integration/file.mjs) and the move of a copy onto main
|
|
23
|
+
// (scripts/enveloppe/travail-de-la-copie.mjs) call it on the tree where they applied the lot,
|
|
24
|
+
// main's version of each file taken.
|
|
25
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
26
|
+
import path from 'node:path';
|
|
27
|
+
import { arbrePrincipal } from './outils-cles.mjs';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether one of <motifs> covers the file <fichier>, both from the root of the copy, as the inputs
|
|
31
|
+
* of Turborepo read them: a path names that file, a directory every file under it, a glob pattern
|
|
32
|
+
* (`*`, `**`) the files it matches (`path.matchesGlob` of Node).
|
|
33
|
+
* @param {string[]} motifs
|
|
34
|
+
* @param {string} fichier
|
|
35
|
+
*/
|
|
36
|
+
export function couvertPar(motifs, fichier) {
|
|
37
|
+
return motifs.some(m => {
|
|
38
|
+
const dossier = m.replace(/\/+$/, '');
|
|
39
|
+
return fichier === dossier || fichier.startsWith(`${dossier}/`) || path.matchesGlob(fichier, m);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Whether the pattern <m> leaves the repository: absolute, or climbing above the root.
|
|
44
|
+
const horsDuDepot = m => path.isAbsolute(m) || path.posix.normalize(m).split('/')[0] === '..';
|
|
45
|
+
|
|
46
|
+
// Whether <v> is a list of strings, non-empty ones.
|
|
47
|
+
const motifs = v => Array.isArray(v) && v.every(m => typeof m === 'string' && m !== '');
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The generated files that the package.json <pkg> declares (`grillhouse.engendres`): `engendres`,
|
|
51
|
+
* none when a fault is found; `fautes`, one sentence per fault, naming its key.
|
|
52
|
+
* @param {any} pkg the parsed package.json
|
|
53
|
+
* @returns {{ engendres: { nom: string, commande: string, fichiers: string[], lit: string[], gardes: string[], entiers: string[] }[], fautes: string[] }}
|
|
54
|
+
*/
|
|
55
|
+
export function lireEngendres(pkg) {
|
|
56
|
+
const e = pkg?.grillhouse?.engendres;
|
|
57
|
+
if (e === undefined || e === null) return { engendres: [], fautes: [] };
|
|
58
|
+
if (typeof e !== 'object' || Array.isArray(e)) {
|
|
59
|
+
return {
|
|
60
|
+
engendres: [],
|
|
61
|
+
fautes: [
|
|
62
|
+
`la clé grillhouse.engendres vaut ${JSON.stringify(e)}, pas un objet { nom: { commande, fichiers, lit } }.`,
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** @type {string[]} */
|
|
67
|
+
const fautes = [];
|
|
68
|
+
const engendres = [];
|
|
69
|
+
for (const [nom, v] of Object.entries(e)) {
|
|
70
|
+
const cle = `grillhouse.engendres.${nom}`;
|
|
71
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v)) {
|
|
72
|
+
fautes.push(
|
|
73
|
+
`la clé ${cle} vaut ${JSON.stringify(v)}, pas un objet { commande, fichiers, lit }.`
|
|
74
|
+
);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const avant = fautes.length;
|
|
78
|
+
if (typeof v.commande !== 'string' || v.commande.trim() === '') {
|
|
79
|
+
fautes.push(`la clé ${cle} n'a pas de commande, la ligne du shell qui écrit ses fichiers.`);
|
|
80
|
+
}
|
|
81
|
+
if (!motifs(v.fichiers) || v.fichiers.length === 0) {
|
|
82
|
+
fautes.push(`la clé ${cle} n'a pas de fichiers, les motifs depuis la racine qu'elle écrit.`);
|
|
83
|
+
}
|
|
84
|
+
if (v.lit !== undefined && !motifs(v.lit)) {
|
|
85
|
+
fautes.push(`la clé ${cle}.lit vaut ${JSON.stringify(v.lit)}, pas une liste de motifs.`);
|
|
86
|
+
}
|
|
87
|
+
for (const m of [...(motifs(v.fichiers) ? v.fichiers : []), ...(motifs(v.lit) ? v.lit : [])]) {
|
|
88
|
+
if (horsDuDepot(m)) {
|
|
89
|
+
fautes.push(`la clé ${cle} nomme « ${m} », hors du dépôt : un motif part de la racine.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (fautes.length === avant) {
|
|
93
|
+
engendres.push({
|
|
94
|
+
nom,
|
|
95
|
+
commande: v.commande,
|
|
96
|
+
fichiers: v.fichiers,
|
|
97
|
+
lit: v.lit ?? [],
|
|
98
|
+
gardes: [],
|
|
99
|
+
entiers: v.fichiers,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { engendres: fautes.length ? [] : engendres, fautes };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The generated files of the project that holds <dir>, from the package.json of its main tree,
|
|
108
|
+
* never of a copy, so that no lot writes the command line the integration then runs; the script
|
|
109
|
+
* that line launches is the one of the tree it runs in, which the lot may change. None without one.
|
|
110
|
+
* @param {string} dir a directory of the project: its main tree or a copy
|
|
111
|
+
* @throws {Error} the faults of the key, one per line
|
|
112
|
+
*/
|
|
113
|
+
export function engendresDe(dir) {
|
|
114
|
+
const f = path.join(arbrePrincipal(dir), 'package.json');
|
|
115
|
+
if (!existsSync(f)) return [];
|
|
116
|
+
const { engendres, fautes } = lireEngendres(JSON.parse(readFileSync(f, 'utf8')));
|
|
117
|
+
if (fautes.length) throw new Error(fautes.join('\n'));
|
|
118
|
+
return engendres;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The generated files of <engendres> the lot of <fichiers> touches: one of the files it writes in
|
|
123
|
+
* full, or one it reads.
|
|
124
|
+
* @template {{ entiers: string[], lit: string[] }} E
|
|
125
|
+
* @param {E[]} engendres
|
|
126
|
+
* @param {string[]} fichiers
|
|
127
|
+
* @returns {E[]}
|
|
128
|
+
*/
|
|
129
|
+
export const touchesPar = (engendres, fichiers) =>
|
|
130
|
+
engendres.filter(e => fichiers.some(f => couvertPar(e.entiers, f) || couvertPar(e.lit, f)));
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Plays the command of each of <refs>, in order (`lancer`, which runs a line of the shell at the
|
|
134
|
+
* root of the tree and gives the result of spawnSync), then stages every file they changed (`dansCopie`, git in the
|
|
135
|
+
* tree, its strings in UTF-8). Null, or the refusal (see the header). The output of a command that
|
|
136
|
+
* passes goes to <ecrire>.
|
|
137
|
+
* @param {{ refs: { nom: string, commande: string, fichiers: string[], cadre?: boolean }[], lancer: (commande: string) => import('node:child_process').SpawnSyncReturns<string>, dansCopie: (...args: string[]) => import('node:child_process').SpawnSyncReturns<string>, ecrire?: (s: string) => void }} o
|
|
138
|
+
* @returns {string | null}
|
|
139
|
+
*/
|
|
140
|
+
export function regenerer({ refs, lancer, dansCopie, ecrire = s => process.stdout.write(s) }) {
|
|
141
|
+
const etat = () => {
|
|
142
|
+
const r = dansCopie('status', '--porcelain=v1', '-z', '-uall', '--no-renames');
|
|
143
|
+
return r.status === 0 ? r.stdout.split('\0').filter(Boolean) : null;
|
|
144
|
+
};
|
|
145
|
+
const avant = etat();
|
|
146
|
+
if (avant === null) return "L'état de l'arbre ne se lit pas.";
|
|
147
|
+
for (const r of refs) {
|
|
148
|
+
const x = lancer(r.commande);
|
|
149
|
+
const sortie = `${x.stdout ?? ''}${x.stderr ?? ''}`;
|
|
150
|
+
const code = x.status ?? 1;
|
|
151
|
+
const panne =
|
|
152
|
+
x.signal !== null || x.error !== undefined || code === 126 || code === 127 || code > 128;
|
|
153
|
+
if (panne || (!r.cadre && code !== 0)) {
|
|
154
|
+
return `La commande de « ${r.nom} » (\`${r.commande}\`) rend le code ${code}. Sa sortie :\n${sortie.trim()}`;
|
|
155
|
+
}
|
|
156
|
+
ecrire(sortie);
|
|
157
|
+
}
|
|
158
|
+
const apres = etat();
|
|
159
|
+
if (apres === null) return "L'état de l'arbre ne se lit pas.";
|
|
160
|
+
const deja = new Set(avant);
|
|
161
|
+
const ecrits = apres.filter(l => !deja.has(l)).map(l => l.slice(3));
|
|
162
|
+
const horsDeclaration = ecrits.filter(f => !refs.some(r => couvertPar(r.fichiers, f)));
|
|
163
|
+
if (horsDeclaration.length) {
|
|
164
|
+
return `La régénération change des fichiers qu'aucune commande rejouée n'écrit :\n${horsDeclaration.map(f => ` ${f}`).join('\n')}`;
|
|
165
|
+
}
|
|
166
|
+
if (ecrits.length && dansCopie('add', '-A', '--', ...ecrits).status !== 0) {
|
|
167
|
+
return "Les fichiers régénérés ne s'ajoutent pas à l'index.";
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# plan, the packages it writes (one session of the testwriter or the developpeur for the whole
|
|
4
4
|
# ticket, `.` as its component and the plan as `--paquets`, grillhouse-3uv.95.6). The supervisor runs it in the background and is told when the session ends.
|
|
5
5
|
#
|
|
6
|
-
# npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] <ticket> <rôle> <composant> <fichier de consigne>
|
|
6
|
+
# npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] [--fiche <sorte>] <ticket> <rôle> <composant> <fichier de consigne>
|
|
7
7
|
#
|
|
8
8
|
# - <composant> is the component's path from the root (`packages/<nom>`, or `.` for the whole
|
|
9
9
|
# repository). It is judged before the copy is prepared, by the envelope's rule
|
|
@@ -91,7 +91,9 @@
|
|
|
91
91
|
# locks), its tools and the servers of the index, for the reading of the whole copy.
|
|
92
92
|
# - A role that ends on a sheet (scripts/resultats.mjs: the testwriter, the developpeur) runs with
|
|
93
93
|
# `--output-format json --json-schema <its schema>` (`npx grillhouse resultats --schema
|
|
94
|
-
# <rôle>`)
|
|
94
|
+
# <rôle>`); --fiche <sorte> names the schema of a sheet that is not its role's (`geste`, the
|
|
95
|
+
# explorateur's gesture of a mechanical ticket, grillhouse-sos), taking a value as --modele does:
|
|
96
|
+
# claude's JSON result, its sheet in `structured_output`, goes to
|
|
95
97
|
# .claude/worktrees/<ticket>.resultat.json, which a launch removes first and the circuit reads,
|
|
96
98
|
# then to the log; its errors go to the log.
|
|
97
99
|
# - Its output, and an envelope refusal (CODE_REFUS), are added to .claude/worktrees/<ticket>.log,
|
|
@@ -111,12 +113,12 @@
|
|
|
111
113
|
set -euo pipefail
|
|
112
114
|
ici="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
113
115
|
eval "$(node "$ici/codes.mjs")"
|
|
114
|
-
usage="usage: npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] <ticket> <rôle> <composant> <fichier de consigne>"
|
|
116
|
+
usage="usage: npx grillhouse lancer [--modele <m>] [--effort <e>] [--seance <id> | --reprise <id>] [--paquets <liste>] [--fiche <sorte>] <ticket> <rôle> <composant> <fichier de consigne>"
|
|
115
117
|
refus_usage() { echo "$usage" >&2; exit "$CODE_USAGE"; }
|
|
116
|
-
modele="" effort="" seance="" reprise="" liste="" surcharge=()
|
|
118
|
+
modele="" effort="" seance="" reprise="" liste="" sorte="" surcharge=()
|
|
117
119
|
while [ $# -gt 0 ]; do
|
|
118
120
|
case "$1" in
|
|
119
|
-
--modele|--effort|--seance|--reprise|--paquets)
|
|
121
|
+
--modele|--effort|--seance|--reprise|--paquets|--fiche)
|
|
120
122
|
[ $# -ge 2 ] && [ -n "$2" ] && [[ "$2" != --* ]] || refus_usage
|
|
121
123
|
if [ "$1" = --modele ]; then
|
|
122
124
|
modele=$2
|
|
@@ -126,6 +128,8 @@ while [ $# -gt 0 ]; do
|
|
|
126
128
|
reprise=$2
|
|
127
129
|
elif [ "$1" = --paquets ]; then
|
|
128
130
|
liste=$2
|
|
131
|
+
elif [ "$1" = --fiche ]; then
|
|
132
|
+
sorte=$2
|
|
129
133
|
else
|
|
130
134
|
case "$2" in low|medium|high|xhigh|max) effort=$2 ;; *) refus_usage ;; esac
|
|
131
135
|
fi
|
|
@@ -260,7 +264,7 @@ mapfile -t droits_du_role <<<"$droits"
|
|
|
260
264
|
# The schema of the role's end-of-session sheet (scripts/resultats.mjs), for a role that has one:
|
|
261
265
|
# the session ends on it, which claude writes in its JSON result, on the standard output.
|
|
262
266
|
fiche=()
|
|
263
|
-
schema=$(node "$ici/../resultats.mjs" --schema "$role" 2> /dev/null) || schema=
|
|
267
|
+
schema=$(node "$ici/../resultats.mjs" --schema "${sorte:-$role}" 2> /dev/null) || schema=
|
|
264
268
|
[ -z "$schema" ] || fiche=(--output-format json --json-schema "$schema")
|
|
265
269
|
|
|
266
270
|
# An envelope in error does not stop the launcher (set -e): its code is kept for the exit.
|
|
@@ -28,10 +28,22 @@
|
|
|
28
28
|
// that fails after the work is set aside (an untracked file in the way) gives the work back
|
|
29
29
|
// on HEAD; exit 1.
|
|
30
30
|
// - A copy at <cible> already, or without local work, simply fast-forwards; exit 0.
|
|
31
|
+
// - Both: a generated file the project declares (`grillhouse.engendres`, scripts/engendres.mjs,
|
|
32
|
+
// read from the main tree) is not merged, as npm writes package-lock.json again after a merge:
|
|
33
|
+
// when the lot touches one of its files, or one it reads (the copy's untracked files counting),
|
|
34
|
+
// the application leaves its files out (main's version stays), then its command writes them
|
|
35
|
+
// again in the copy, the lot applied, with the tools of the project (`grillhouse.outils`), out
|
|
36
|
+
// of the envelope. A command that fails stops, exit 1, the command, its code and its output
|
|
37
|
+
// named, the rest of the lot in the copy; a faulty key refuses, named, before the copy is
|
|
38
|
+
// touched (OSC Bridge, 2026-10-31: four conflicts in one day on the generated files of synthhub
|
|
39
|
+
// and open-synth-descriptors, each copy moved by hand). A lot in conflict on another file is not
|
|
40
|
+
// regenerated: its conflicts come first.
|
|
31
41
|
import { spawnSync } from 'node:child_process';
|
|
32
42
|
import { existsSync, rmSync, writeFileSync } from 'node:fs';
|
|
33
43
|
import path from 'node:path';
|
|
34
44
|
import { pathToFileURL } from 'node:url';
|
|
45
|
+
import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
|
|
46
|
+
import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
|
|
35
47
|
|
|
36
48
|
const LOT = 'grillhouse-travail.patch';
|
|
37
49
|
|
|
@@ -47,16 +59,65 @@ const lignes = r =>
|
|
|
47
59
|
// The files of <copie> unmerged in its index.
|
|
48
60
|
const enConflit = copie => lignes(git(copie, ['diff', '--name-only', '--diff-filter=U']));
|
|
49
61
|
|
|
62
|
+
// The files the lot <lot> touches in <copie>: each added, modified or deleted, a rename its source
|
|
63
|
+
// and its destination.
|
|
64
|
+
const fichiersDuLot = (copie, lot) =>
|
|
65
|
+
String(git(copie, ['apply', '--numstat', '-z', '-'], lot).stdout)
|
|
66
|
+
.split('\0')
|
|
67
|
+
.map(l => (l.includes('\t') ? l.split('\t')[2] : l))
|
|
68
|
+
.filter(Boolean);
|
|
69
|
+
|
|
50
70
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
71
|
+
* The keys of the project that holds <copie>, read before any work: `{ engendres, env }`, its
|
|
72
|
+
* generated files and the environment of their commands with its tools, or `{ refus }`.
|
|
73
|
+
* @param {string} copie
|
|
74
|
+
* @returns {{ engendres: any[], env: NodeJS.ProcessEnv, refus?: undefined } | { refus: string }}
|
|
75
|
+
*/
|
|
76
|
+
function lesCles(copie) {
|
|
77
|
+
try {
|
|
78
|
+
return { engendres: engendresDe(copie), env: avecLesOutils(outilsDe(copie), process.env) };
|
|
79
|
+
} catch (e) {
|
|
80
|
+
return {
|
|
81
|
+
refus: `⛔ Une clé grillhouse du package.json est refusée :\n${/** @type {Error} */ (e).message}`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Applies the lot <lot> (a Buffer of `git diff --binary`) three ways to <copie>: `conflits`, the
|
|
88
|
+
* files in conflict, null when git refuses the lot outright. With <cles> (`lesCles`), the generated
|
|
89
|
+
* files the lot (or one of <autres>, the copy's untracked files) touches are left out, then written
|
|
90
|
+
* again by their command once the lot applies without conflict; `refus`, a command that fails.
|
|
53
91
|
* @param {string} copie
|
|
54
92
|
* @param {Buffer} lot
|
|
93
|
+
* @param {{ engendres: any[], env: NodeJS.ProcessEnv } | null} [cles]
|
|
94
|
+
* @param {string[]} [autres]
|
|
95
|
+
* @returns {{ conflits: string[] | null, refus?: string | null }}
|
|
55
96
|
*/
|
|
56
|
-
function appliquer(copie, lot) {
|
|
57
|
-
const
|
|
97
|
+
function appliquer(copie, lot, cles = null, autres = []) {
|
|
98
|
+
const fichiers = cles ? [...fichiersDuLot(copie, lot), ...autres] : [];
|
|
99
|
+
const touches = cles ? touchesPar(cles.engendres, fichiers) : [];
|
|
100
|
+
const exclus = fichiers.filter(f => touches.some(e => couvertPar(e.entiers, f)));
|
|
101
|
+
const r = git(
|
|
102
|
+
copie,
|
|
103
|
+
['apply', '--3way', '--allow-empty', ...exclus.map(f => `--exclude=${f}`), '-'],
|
|
104
|
+
lot
|
|
105
|
+
);
|
|
58
106
|
const conflits = enConflit(copie);
|
|
59
|
-
|
|
107
|
+
if (r.status !== 0 && !conflits.length) return { conflits: null };
|
|
108
|
+
if (conflits.length || !touches.length || !cles) return { conflits };
|
|
109
|
+
const refus = regenerer({
|
|
110
|
+
refs: touches.map(e => ({ ...e, cadre: false })),
|
|
111
|
+
lancer: commande =>
|
|
112
|
+
spawnSync('bash', ['-c', commande], {
|
|
113
|
+
cwd: copie,
|
|
114
|
+
encoding: 'utf8',
|
|
115
|
+
env: cles.env,
|
|
116
|
+
maxBuffer: 1024 * 1024 * 1024,
|
|
117
|
+
}),
|
|
118
|
+
dansCopie: (...args) => spawnSync('git', ['-C', copie, ...args], { encoding: 'utf8' }),
|
|
119
|
+
});
|
|
120
|
+
return { conflits, refus };
|
|
60
121
|
}
|
|
61
122
|
|
|
62
123
|
/**
|
|
@@ -69,10 +130,14 @@ export function reporter(copie, { base, pointe }) {
|
|
|
69
130
|
if (d.status !== 0) {
|
|
70
131
|
return { ok: false, message: `⛔ Le lot de ${base} à ${pointe} ne se lit pas : ${texte(d)}` };
|
|
71
132
|
}
|
|
72
|
-
|
|
133
|
+
const cles = lesCles(copie);
|
|
134
|
+
if (cles.refus !== undefined) return { ok: false, message: cles.refus };
|
|
135
|
+
const a = appliquer(copie, d.stdout, cles);
|
|
136
|
+
if (a.conflits === null) {
|
|
73
137
|
return { ok: false, message: `⛔ Le lot ne s'applique pas à la copie ${copie}.` };
|
|
74
138
|
}
|
|
75
139
|
const r = git(copie, ['reset', '-q']);
|
|
140
|
+
if (a.refus) return { ok: false, message: `⛔ ${a.refus}` };
|
|
76
141
|
return r.status === 0 ? { ok: true, message: '' } : { ok: false, message: texte(r) };
|
|
77
142
|
}
|
|
78
143
|
|
|
@@ -106,6 +171,8 @@ export function avancer(copie, cible) {
|
|
|
106
171
|
message: `⛔ Le travail de la copie ${copie} attend dans ${garde}, que git n'a pas pu remettre en place ; il se reprend à la main (git apply --3way ${garde}, ou il se jette), puis le fichier se retire, avant une relance.`,
|
|
107
172
|
};
|
|
108
173
|
}
|
|
174
|
+
const cles = lesCles(copie);
|
|
175
|
+
if (cles.refus !== undefined) return { ok: false, message: cles.refus };
|
|
109
176
|
const tete = String(git(copie, ['rev-parse', 'HEAD']).stdout).trim();
|
|
110
177
|
const vise = git(copie, ['rev-parse', '--verify', `${cible}^{commit}`]);
|
|
111
178
|
if (vise.status !== 0) {
|
|
@@ -134,7 +201,7 @@ export function avancer(copie, cible) {
|
|
|
134
201
|
const remis = git(copie, ['reset', '-q', '--hard']);
|
|
135
202
|
const ff = remis.status === 0 ? git(copie, ['merge', '-q', '--ff-only', cible]) : remis;
|
|
136
203
|
if (ff.status !== 0) {
|
|
137
|
-
const rendu = appliquer(copie, d.stdout);
|
|
204
|
+
const rendu = appliquer(copie, d.stdout).conflits;
|
|
138
205
|
if (rendu !== null && rendu.length === 0 && git(copie, ['reset', '-q']).status === 0) {
|
|
139
206
|
rmSync(garde, { force: true });
|
|
140
207
|
return {
|
|
@@ -147,7 +214,8 @@ export function avancer(copie, cible) {
|
|
|
147
214
|
message: `⛔ La copie ${copie} ne peut pas avancer sur main : ${texte(ff)}\nSon travail ne se remet pas en place ; il reste dans ${garde}.`,
|
|
148
215
|
};
|
|
149
216
|
}
|
|
150
|
-
const
|
|
217
|
+
const libres = lignes(git(copie, ['ls-files', '--others', '--exclude-standard']));
|
|
218
|
+
const { conflits, refus } = appliquer(copie, d.stdout, cles, libres);
|
|
151
219
|
if (conflits === null) {
|
|
152
220
|
return {
|
|
153
221
|
ok: false,
|
|
@@ -166,6 +234,12 @@ export function avancer(copie, cible) {
|
|
|
166
234
|
};
|
|
167
235
|
}
|
|
168
236
|
const r = git(copie, ['reset', '-q']);
|
|
237
|
+
if (refus) {
|
|
238
|
+
return {
|
|
239
|
+
ok: false,
|
|
240
|
+
message: `⛔ ${refus}\nLe travail de la copie ${copie} est sur main, ses fichiers engendrés à la version de main.`,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
169
243
|
return r.status === 0 ? { ok: true, message: '' } : { ok: false, message: texte(r) };
|
|
170
244
|
}
|
|
171
245
|
|
package/scripts/etapes.mjs
CHANGED
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
// The plan (1) is read elsewhere in the state: by the work on the plan under way
|
|
14
14
|
// (`questionnement`, the explorateur's or the questionneur's session) and by its stop (`arrets`).
|
|
15
15
|
// The tri of the discoveries (5.3) is the explorateur's too, once the queue has brought the lot
|
|
16
|
-
// onto main, as Chromium and Mozilla give each new report a verdict before it is filed; the
|
|
17
|
-
//
|
|
16
|
+
// onto main, as Chromium and Mozilla give each new report a verdict before it is filed; so is the
|
|
17
|
+
// gesture of a mechanical ticket (1.1), the command its plan names played in the copy, as Rosie
|
|
18
|
+
// and ClangMR let a tool make a large-scale change at Google (grillhouse-sos); the role's own step
|
|
19
|
+
// stays the plan (`etapeDuRole`).
|
|
18
20
|
// SUITE is the tree in its order, each step before its sub-steps.
|
|
19
21
|
// - A step carries as many bounded loops as it needs (`boucles`), each spanning the step and its
|
|
20
22
|
// sub-steps: each its key (`cle`, which keys its count in the state's `boucles`), its label and
|
|
@@ -46,6 +48,9 @@ export const ETAPES = [
|
|
|
46
48
|
etat: null,
|
|
47
49
|
questionnement: 'plan',
|
|
48
50
|
arrets: ['questionnement'],
|
|
51
|
+
// The gesture of a mechanical ticket, in the copy, in place of the testwriter and the
|
|
52
|
+
// developpeur (grillhouse-sos).
|
|
53
|
+
sous: [{ numero: '1.1', titre: 'Geste mécanique', qui: [EXPLORATEUR], etat: 'geste' }],
|
|
49
54
|
},
|
|
50
55
|
{
|
|
51
56
|
numero: '2',
|
|
@@ -215,6 +220,14 @@ export const GESTES = [
|
|
|
215
220
|
'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison) ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
|
|
216
221
|
cas: 'BP 320.9 : 995-tools n’a rien à livrer, 4 montées et 49 min (B5)',
|
|
217
222
|
},
|
|
223
|
+
{
|
|
224
|
+
genre: 'mecanique',
|
|
225
|
+
geste:
|
|
226
|
+
'ni testwriter, ni preuve du rouge, ni développeur : l’explorateur joue dans la copie la commande que le plan nomme (1.1), puis les contrôles, la passe finale, la relecture et l’intégration',
|
|
227
|
+
regle:
|
|
228
|
+
'le plan dit le ticket mécanique, avec sa raison et sa commande (`sorte` de la fiche de l’explorateur) : un geste sans comportement neuf ; tant qu’aucun testwriter ni développeur n’a travaillé le lot, un rouge des contrôles ou un RENDU monte, sans relancer personne',
|
|
229
|
+
cas: 'BP 320.16 : 38 outils déplacés par mv, 117 commentaires ; BP 320.40.1 : une variable inutilisée, 4 séances ; BP 322.11.1 : l’outil de test monté sur 31 paquets',
|
|
230
|
+
},
|
|
218
231
|
];
|
|
219
232
|
|
|
220
233
|
// The gesture of name <genre>, or null.
|
|
@@ -247,11 +260,11 @@ export const MONTEES = Object.fromEntries(
|
|
|
247
260
|
preuve:
|
|
248
261
|
'La troisième preuve du rouge refuse le lot de tests : quel contexte donner au testwriter, ou le plan doit-il changer ?',
|
|
249
262
|
controles:
|
|
250
|
-
'Un rouge reste, que le circuit ne rend pas au développeur (hors du plan, sans fichier, à arbitrer), ou que trois séances n’ont pas levé : avec quel contexte le lever, ou le plan doit-il s’étendre ?',
|
|
263
|
+
'Un rouge reste, que le circuit ne rend pas au développeur (hors du plan, sans fichier, à arbitrer, le lot d’un geste mécanique), ou que trois séances n’ont pas levé : avec quel contexte le lever, ou le plan doit-il s’étendre ?',
|
|
251
264
|
'sans-livraison':
|
|
252
|
-
'Le développeur ne change rien et le rouge reste : avec quel contexte le lever, ou le plan doit-il changer ?',
|
|
265
|
+
'Le développeur ne change rien et le rouge reste, ou le geste mécanique ne change aucun fichier du plan : avec quel contexte le lever, ou le plan doit-il changer ?',
|
|
253
266
|
'relecture-arret':
|
|
254
|
-
'La relecture ne rend pas le lot à un agent (un constat sans destinataire valide, un constat au testwriter que le plan saute, un critère en cause, ou la troisième relecture rendue) : que devient le plan, et qui reprend ?',
|
|
267
|
+
'La relecture ne rend pas le lot à un agent (un constat sans destinataire valide, un constat au testwriter que le plan saute, un lot mécanique rendu, un critère en cause, ou la troisième relecture rendue) : que devient le plan, et qui reprend ?',
|
|
255
268
|
integration:
|
|
256
269
|
'L’intégration refuse le lot, ou la file rouvre le ticket : que corrige le lot, et qui le reprend ?',
|
|
257
270
|
'hors-portee':
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
// npx grillhouse gardes-du-cadre (npm run grillhouse:gardes, a task of Turborepo)
|
|
5
5
|
//
|
|
6
|
-
// - The guards are
|
|
7
|
-
//
|
|
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), then those of the
|
|
8
|
+
// modules of the project's languages (`gardes`, scripts/jointure.d.ts, scripts/langages.mjs),
|
|
9
|
+
// each module's in their order, the modules in the order of the declaration.
|
|
8
10
|
// - Each guard is a script of the package, and plays in the working directory, under the environment of the run
|
|
9
11
|
// (`GRILLHOUSE_DETTE` among it, scripts/dette.mjs), whatever the verdict of the ones before: a
|
|
10
12
|
// red does not stop the pass, as `--continue` does for Turborepo's tasks.
|
|
@@ -18,13 +20,14 @@
|
|
|
18
20
|
import { spawnSync } from 'node:child_process';
|
|
19
21
|
import path from 'node:path';
|
|
20
22
|
import { pathToFileURL } from 'node:url';
|
|
23
|
+
import { SCRIPT as LANGAGES_DES_PAQUETS } from './langages-des-paquets.mjs';
|
|
21
24
|
import { langageDe } from './langages.mjs';
|
|
22
25
|
import { A_ELAGUER, ecrireSarif, lireSarif, RESULTATS } from './resultats.mjs';
|
|
23
26
|
|
|
24
27
|
// The guards of the frame in the repository at <racine>, each its script and its arguments, in
|
|
25
|
-
// the order they play: the
|
|
28
|
+
// the order they play: the core's, then the languages'.
|
|
26
29
|
export function gardesDuCadre(racine) {
|
|
27
|
-
return langageDe(racine).gardes(racine);
|
|
30
|
+
return [[LANGAGES_DES_PAQUETS], ...langageDe(racine).gardes(racine)];
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
// The name of each guard of the frame, as its findings carry it: its script's, without extension.
|