@roomi-fields/grillhouse 0.29.0 → 0.31.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 +769 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- 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 +30 -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 +94 -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 +120 -0
- package/dist/temporal/installation.js +386 -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 +646 -87
- package/docs/CADRE.md +27 -0
- package/docs/INTERFACE.md +139 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2255 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +40 -14
- package/scripts/avancement.mjs +155 -26
- package/scripts/bilan.mjs +137 -43
- package/scripts/cadre.mjs +16 -4
- package/scripts/circuit.mjs +993 -4075
- 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/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +18 -12
- package/scripts/conformite.mjs +56 -28
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +121 -0
- package/scripts/dernier-vert.mjs +61 -34
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +244 -0
- package/scripts/droits.mjs +51 -16
- package/scripts/effets.mjs +352 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +259 -55
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
- package/scripts/etapes.mjs +5 -2
- 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 +201 -0
- package/scripts/gardes-du-cadre.mjs +21 -5
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +544 -434
- package/scripts/integration/integrer.mjs +87 -43
- package/scripts/integration/rejeu.mjs +45 -13
- package/scripts/jointure.d.ts +151 -28
- package/scripts/langages/cargo/commandes.mjs +383 -124
- package/scripts/langages/cargo/composants.mjs +154 -42
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +22 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +218 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +28 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +50 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- 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 +33 -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/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
- package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
- package/scripts/langages/typescript/tests.mjs +40 -15
- package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
- package/scripts/langages/typescript/verdict.mjs +4 -2
- package/scripts/langages/typescript/verifier.mjs +58 -20
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +12 -6
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +25 -3
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +18 -8
- package/scripts/paquet-npm.mjs +157 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +46 -10
- package/scripts/passe-de-la-machine.mjs +71 -0
- package/scripts/places-de-la-machine.mjs +414 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +25 -8
- package/scripts/registre.mjs +9 -4
- 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/reprise.mjs +66 -0
- package/scripts/resultats.mjs +112 -46
- 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 +936 -0
- package/scripts/services-du-noyau.mjs +27 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +41 -10
- package/scripts/style-a-l-ecriture.mjs +260 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +180 -117
- package/scripts/taches-du-graphe.mjs +348 -0
- package/scripts/ticket-du-circuit.mjs +216 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +1018 -0
- package/scripts/verrou-de-fichier.mjs +8 -4
- package/scripts/verrou-de-machine.mjs +150 -51
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +9 -2
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +5 -3
- package/skills/testwriter/SKILL.md +49 -31
- package/scripts/demon.mjs +0 -251
- 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
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// The mechanical steps of one integration, run by the circuit of the ticket (scripts/circuit.mjs)
|
|
3
3
|
// once the reviewer has accepted the lot, which the circuit builds from the ticket's copy. It
|
|
4
4
|
// commits the lot on the branch of the ticket, or refuses it with the full output of the step that
|
|
5
|
-
// refused. The
|
|
6
|
-
//
|
|
7
|
-
// common directory.
|
|
5
|
+
// refused. The circuit of the ticket then sends the branch to the queue of the project (the
|
|
6
|
+
// workflow `file:<racine>`, src/temporal/file/deroule.ts), which brings it onto main. Run from any
|
|
7
|
+
// working tree of the repository, it works on the main tree, found from git's common directory.
|
|
8
8
|
//
|
|
9
9
|
// npx grillhouse integrer --ticket <id>
|
|
10
10
|
// [--tests <patch>] [--code <patch>] --message <file> [--references <file>]
|
|
@@ -56,8 +56,7 @@
|
|
|
56
56
|
// directory of the ticket's circuit, `<copie>.travail`, stays for the circuit that still runs,
|
|
57
57
|
// and the queue removes it at the ticket's closure): a refusal, a locked copy for
|
|
58
58
|
// example, is written to the ticket, the commit stands. The ticket is labelled
|
|
59
|
-
// `en-file
|
|
60
|
-
// (scripts/integration/file-attente.mjs). main does not move here.
|
|
59
|
+
// `en-file`, which the queue removes. main does not move here.
|
|
61
60
|
//
|
|
62
61
|
// The references written in full are the generated files the project declares
|
|
63
62
|
// (`grillhouse.engendres`), then the frame's the circuit hands over (`--references`, a JSON file the
|
|
@@ -93,19 +92,21 @@ import { pathToFileURL } from 'node:url';
|
|
|
93
92
|
import { arbitrageTranche, estArbitrage } from '../arbitrages.mjs';
|
|
94
93
|
import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
|
|
95
94
|
import { langageDe } from '../langages.mjs';
|
|
95
|
+
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
96
96
|
import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
|
|
97
97
|
import { lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
|
|
98
|
-
import { dossierCommun, inscrireEntree } from './file-attente.mjs';
|
|
99
98
|
import { ouvrirCopie, RETIRER_COPIE } from './rejeu.mjs';
|
|
100
99
|
import { verdictDe } from './verdict.mjs';
|
|
101
|
-
import { A_REPASSER } from '../
|
|
100
|
+
import { A_REPASSER } from '../codes-de-sortie.mjs';
|
|
102
101
|
import { ouvrirBase } from '../mesure/base-de-passe.mjs';
|
|
103
102
|
|
|
104
103
|
// A file name as git writes it in a patch: a name with a character outside ASCII, a quote, a
|
|
105
104
|
// backslash or a control character comes between quotes with C escapes (`\303\251` for `é`).
|
|
106
105
|
// Returns the name itself.
|
|
107
106
|
function nomDeGit(ecrit) {
|
|
108
|
-
if (!ecrit.startsWith('"'))
|
|
107
|
+
if (!ecrit.startsWith('"')) {
|
|
108
|
+
return ecrit;
|
|
109
|
+
}
|
|
109
110
|
const octets = [];
|
|
110
111
|
const echappes = { n: 10, t: 9, r: 13, a: 7, b: 8, f: 12, v: 11 };
|
|
111
112
|
const corps = Buffer.from(ecrit.slice(1, -1), 'utf8');
|
|
@@ -143,11 +144,14 @@ export function refusVerdicts(ticket, comments) {
|
|
|
143
144
|
// resumption (scripts/circuit.mjs), as a CI refuses a pull request without its required label
|
|
144
145
|
// before it runs a job. `ticket` and `comments` are Beads' JSON.
|
|
145
146
|
export function refusArbitrage(ticket, comments) {
|
|
146
|
-
if (!(ticket.labels ?? []).includes('arbitrage'))
|
|
147
|
+
if (!(ticket.labels ?? []).includes('arbitrage')) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
147
150
|
const id = ticket.id;
|
|
148
151
|
const arbitrages = comments.filter(c => estArbitrage(c.text));
|
|
149
|
-
if (arbitrages.length === 0)
|
|
152
|
+
if (arbitrages.length === 0) {
|
|
150
153
|
return `${id} est étiqueté arbitrage sans commentaire « Arbitrage ».`;
|
|
154
|
+
}
|
|
151
155
|
for (const a of arbitrages) {
|
|
152
156
|
if (!arbitrageTranche(comments, a)) {
|
|
153
157
|
const titre = a.text.trim().split('\n')[0];
|
|
@@ -163,10 +167,13 @@ export function refusLots(tests, code, racine) {
|
|
|
163
167
|
const langage = langageDe(racine);
|
|
164
168
|
const testwriter = f => langage.estUnTest(f, racine) !== null;
|
|
165
169
|
const horsTests = tests.filter(f => !testwriter(f));
|
|
166
|
-
if (horsTests.length)
|
|
170
|
+
if (horsTests.length) {
|
|
171
|
+
return `Le lot de tests touche du code : ${horsTests.join(', ')}.`;
|
|
172
|
+
}
|
|
167
173
|
const duTestwriter = code.filter(testwriter);
|
|
168
|
-
if (duTestwriter.length)
|
|
174
|
+
if (duTestwriter.length) {
|
|
169
175
|
return `Le lot de code touche des fichiers du testwriter (tests ou matière de test partagée) : ${duTestwriter.join(', ')}.`;
|
|
176
|
+
}
|
|
170
177
|
return null;
|
|
171
178
|
}
|
|
172
179
|
|
|
@@ -177,10 +184,11 @@ function lire(argv) {
|
|
|
177
184
|
const v = argv[i + 1];
|
|
178
185
|
switch (argv[i]) {
|
|
179
186
|
case '--ticket':
|
|
180
|
-
if (o.ticket !== null)
|
|
187
|
+
if (o.ticket !== null) {
|
|
181
188
|
return {
|
|
182
189
|
faute: `un seul --ticket : ${v} en est un second, et une livraison est un ticket.`,
|
|
183
190
|
};
|
|
191
|
+
}
|
|
184
192
|
o.ticket = v;
|
|
185
193
|
i++;
|
|
186
194
|
break;
|
|
@@ -204,7 +212,9 @@ function lire(argv) {
|
|
|
204
212
|
return { faute: null };
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
|
-
if (!o.ticket || !o.message || !(o.tests || o.code))
|
|
215
|
+
if (!o.ticket || !o.message || !(o.tests || o.code)) {
|
|
216
|
+
return { faute: null };
|
|
217
|
+
}
|
|
208
218
|
return o;
|
|
209
219
|
}
|
|
210
220
|
|
|
@@ -216,7 +226,9 @@ function horsLot(copieTicket, fichiers) {
|
|
|
216
226
|
['-C', copieTicket, 'status', '--porcelain=v1', '-z', '-uall', '--no-renames'],
|
|
217
227
|
{ encoding: 'utf8' }
|
|
218
228
|
);
|
|
219
|
-
if (r.status !== 0)
|
|
229
|
+
if (r.status !== 0) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
220
232
|
const dans = new Set(fichiers);
|
|
221
233
|
return r.stdout
|
|
222
234
|
.split('\0')
|
|
@@ -233,10 +245,18 @@ function differents(copieTicket, lots, fichiers, tmp) {
|
|
|
233
245
|
const env = { ...process.env, GIT_INDEX_FILE: index };
|
|
234
246
|
const dansCopie = (...args) =>
|
|
235
247
|
spawnSync('git', ['-C', copieTicket, ...args], { encoding: 'utf8', env });
|
|
236
|
-
if (dansCopie('read-tree', 'HEAD').status !== 0)
|
|
237
|
-
|
|
248
|
+
if (dansCopie('read-tree', 'HEAD').status !== 0) {
|
|
249
|
+
return fichiers;
|
|
250
|
+
}
|
|
251
|
+
for (const p of lots) {
|
|
252
|
+
if (dansCopie('apply', '--cached', p).status !== 0) {
|
|
253
|
+
return fichiers;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
238
256
|
const r = dansCopie('diff', '--name-only', '--no-renames', '-z', '--', ...fichiers);
|
|
239
|
-
if (r.status !== 0)
|
|
257
|
+
if (r.status !== 0) {
|
|
258
|
+
return fichiers;
|
|
259
|
+
}
|
|
240
260
|
return r.stdout.split('\0').filter(Boolean);
|
|
241
261
|
}
|
|
242
262
|
|
|
@@ -250,11 +270,10 @@ function main(argv) {
|
|
|
250
270
|
return 2;
|
|
251
271
|
}
|
|
252
272
|
// The main tree, from git's common directory: run from a copy, the integration still works on it.
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
);
|
|
273
|
+
const commun = spawnSync('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], {
|
|
274
|
+
encoding: 'utf8',
|
|
275
|
+
}).stdout.trim();
|
|
276
|
+
const racine = path.dirname(commun);
|
|
258
277
|
const git = (...args) => spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
|
|
259
278
|
const bd = (...a) =>
|
|
260
279
|
spawnSync('bd', a, { cwd: racine, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
|
|
@@ -267,7 +286,7 @@ function main(argv) {
|
|
|
267
286
|
|
|
268
287
|
// One integration at a time: a second waits for the end of the first; a lock whose process is
|
|
269
288
|
// gone is taken over.
|
|
270
|
-
const verrou = path.join(
|
|
289
|
+
const verrou = path.join(commun, 'integration.lock');
|
|
271
290
|
prendreVerrou(verrou, { attendre: true });
|
|
272
291
|
const debut = Date.now();
|
|
273
292
|
// The working directory of the integration: a base of its own, removed at its end, swept by the
|
|
@@ -278,9 +297,11 @@ function main(argv) {
|
|
|
278
297
|
// 0. The keys of the project, before any work.
|
|
279
298
|
let engendres;
|
|
280
299
|
let outils;
|
|
300
|
+
let donnees;
|
|
281
301
|
try {
|
|
282
302
|
engendres = engendresDe(racine);
|
|
283
303
|
outils = outilsDe(racine);
|
|
304
|
+
donnees = donneesDe(racine);
|
|
284
305
|
} catch (e) {
|
|
285
306
|
return refuser(`Une clé grillhouse du package.json est refusée :\n${e.message}`);
|
|
286
307
|
}
|
|
@@ -288,17 +309,22 @@ function main(argv) {
|
|
|
288
309
|
// 1. The verdict.
|
|
289
310
|
const show = bd('show', o.ticket, '--json');
|
|
290
311
|
const comments = bd('comments', o.ticket, '--json');
|
|
291
|
-
if (show.status !== 0 || comments.status !== 0)
|
|
312
|
+
if (show.status !== 0 || comments.status !== 0) {
|
|
292
313
|
return refuser(`Ticket ${o.ticket} illisible : ${show.stderr}${comments.stderr}`);
|
|
314
|
+
}
|
|
293
315
|
const r1 = refusVerdicts(JSON.parse(show.stdout)[0], JSON.parse(comments.stdout || '[]'));
|
|
294
|
-
if (r1)
|
|
316
|
+
if (r1) {
|
|
317
|
+
return refuser(r1);
|
|
318
|
+
}
|
|
295
319
|
dire('✓ verdicts');
|
|
296
320
|
|
|
297
321
|
// 2. The lots.
|
|
298
322
|
const lots = [o.tests, o.code].filter(Boolean).map(absolu);
|
|
299
323
|
const fichiersDe = p => {
|
|
300
324
|
const r = git('apply', '--numstat', '-z', p);
|
|
301
|
-
if (r.status !== 0)
|
|
325
|
+
if (r.status !== 0) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
302
328
|
const destinations = r.stdout
|
|
303
329
|
.split('\0')
|
|
304
330
|
.map(l => l.split('\t')[2])
|
|
@@ -312,9 +338,13 @@ function main(argv) {
|
|
|
312
338
|
};
|
|
313
339
|
const tests = o.tests ? fichiersDe(absolu(o.tests)) : [];
|
|
314
340
|
const code = o.code ? fichiersDe(absolu(o.code)) : [];
|
|
315
|
-
if (!tests || !code)
|
|
341
|
+
if (!tests || !code) {
|
|
342
|
+
return refuser('Un patch du lot est illisible.');
|
|
343
|
+
}
|
|
316
344
|
const r2 = refusLots(tests, code, racine);
|
|
317
|
-
if (r2)
|
|
345
|
+
if (r2) {
|
|
346
|
+
return refuser(r2);
|
|
347
|
+
}
|
|
318
348
|
const fichiers = [...new Set([...tests, ...code])];
|
|
319
349
|
dire(`✓ lots : ${fichiers.length} fichiers`);
|
|
320
350
|
let duCircuit = [];
|
|
@@ -336,7 +366,9 @@ function main(argv) {
|
|
|
336
366
|
// 3. The main tree: the lots' files are free there, so the queue can bring them. The ticket's
|
|
337
367
|
// copy holds the lot and nothing else.
|
|
338
368
|
const tenus = git('status', '--porcelain', '--', ...fichiers).stdout.trim();
|
|
339
|
-
if (tenus)
|
|
369
|
+
if (tenus) {
|
|
370
|
+
return refuser(`Des fichiers du lot sont modifiés dans l'arbre :\n${tenus}`);
|
|
371
|
+
}
|
|
340
372
|
dire('✓ arbre principal libre');
|
|
341
373
|
const branche = `agent/${o.ticket}`;
|
|
342
374
|
const copieTicket = path.join(racine, '.claude', 'worktrees', o.ticket);
|
|
@@ -352,7 +384,9 @@ function main(argv) {
|
|
|
352
384
|
return refuser(`La copie du ticket ${copieTicket} n'est pas sur la branche ${branche}.`);
|
|
353
385
|
}
|
|
354
386
|
const autres = horsLot(copieTicket, fichiers);
|
|
355
|
-
if (autres === null)
|
|
387
|
+
if (autres === null) {
|
|
388
|
+
return refuser(`L'état de la copie ${copieTicket} ne se lit pas.`);
|
|
389
|
+
}
|
|
356
390
|
if (autres.length) {
|
|
357
391
|
return refuser(
|
|
358
392
|
`La copie du ticket porte autre chose que le lot :\n${autres.map(f => ` ${f}`).join('\n')}`
|
|
@@ -365,7 +399,9 @@ function main(argv) {
|
|
|
365
399
|
// are kept only while the lock file and the manifests are the same (a CI cache keyed by them).
|
|
366
400
|
const copie = path.join(racine, '.claude', 'worktrees', 'integration');
|
|
367
401
|
const ouverte = ouvrirCopie({ racine, copie, ref: 'HEAD', dire });
|
|
368
|
-
if (ouverte.refus)
|
|
402
|
+
if (ouverte.refus) {
|
|
403
|
+
return refuser(ouverte.refus);
|
|
404
|
+
}
|
|
369
405
|
const { dansCopie, monter, installer, tester } = ouverte;
|
|
370
406
|
|
|
371
407
|
// 5. The lots, applied in the copy without the files a reference writes in full, then
|
|
@@ -373,7 +409,9 @@ function main(argv) {
|
|
|
373
409
|
const sansEntiers = entiers.map(f => `--exclude=${f}`);
|
|
374
410
|
for (const p of lots) {
|
|
375
411
|
const r = dansCopie('apply', '--3way', '--index', ...sansEntiers, p);
|
|
376
|
-
if (r.status !== 0)
|
|
412
|
+
if (r.status !== 0) {
|
|
413
|
+
return refuser(`Le lot ${p} ne s'applique pas :\n${r.stdout}${r.stderr}`);
|
|
414
|
+
}
|
|
377
415
|
}
|
|
378
416
|
const divergents = avecCopie ? differents(copieTicket, lots, fichiers, tmp) : [];
|
|
379
417
|
if (divergents.length) {
|
|
@@ -383,9 +421,11 @@ function main(argv) {
|
|
|
383
421
|
}
|
|
384
422
|
dire('✓ lots appliqués');
|
|
385
423
|
const installation = installer();
|
|
386
|
-
if (installation)
|
|
424
|
+
if (installation) {
|
|
425
|
+
return refuser(installation);
|
|
426
|
+
}
|
|
387
427
|
if (aRegenerer.length) {
|
|
388
|
-
const env = avecLesOutils(outils, process.env);
|
|
428
|
+
const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env));
|
|
389
429
|
const refus = regenerer({
|
|
390
430
|
refs: aRegenerer,
|
|
391
431
|
dansCopie,
|
|
@@ -397,20 +437,24 @@ function main(argv) {
|
|
|
397
437
|
env,
|
|
398
438
|
}),
|
|
399
439
|
});
|
|
400
|
-
if (refus)
|
|
440
|
+
if (refus) {
|
|
441
|
+
return refuser(refus);
|
|
442
|
+
}
|
|
401
443
|
dire(`✓ références régénérées sur main à jour : ${aRegenerer.map(r => r.nom).join(', ')}`);
|
|
402
444
|
}
|
|
403
445
|
|
|
404
446
|
// 6. The tests: the build, the guards and every test of the day, green required.
|
|
405
447
|
dire('— npm run verifier (construction, gardes, tests)');
|
|
406
|
-
const verdict = tester().status;
|
|
448
|
+
const verdict = tester({ sorte: 'Intégration', ticket: o.ticket }).status;
|
|
407
449
|
if (verdict === A_REPASSER) {
|
|
408
450
|
dire(
|
|
409
451
|
`⏱ À repasser (code ${A_REPASSER}) : l'attente de la machine a atteint sa borne. Le lot n'est ni commis ni refusé ; relance la même commande.`
|
|
410
452
|
);
|
|
411
453
|
return A_REPASSER;
|
|
412
454
|
}
|
|
413
|
-
if (verdict !== 0)
|
|
455
|
+
if (verdict !== 0) {
|
|
456
|
+
return refuser('Les tests refusent le lot (sortie ci-dessus).');
|
|
457
|
+
}
|
|
414
458
|
dire('✓ tests');
|
|
415
459
|
|
|
416
460
|
// 7. The commit, in the copy: the commit validated is the commit that enters.
|
|
@@ -424,11 +468,13 @@ function main(argv) {
|
|
|
424
468
|
env: { ...process.env, GRILLHOUSE_INTEGRATION: '1' },
|
|
425
469
|
}
|
|
426
470
|
);
|
|
427
|
-
if (c.status !== 0)
|
|
471
|
+
if (c.status !== 0) {
|
|
472
|
+
return refuser(`Le commit est refusé :\n${c.stdout}${c.stderr}`);
|
|
473
|
+
}
|
|
428
474
|
const commit = dansCopie('rev-parse', 'HEAD').stdout.trim();
|
|
429
475
|
|
|
430
476
|
// 8. The branch of the ticket takes the commit; the ticket's copy follows it (it carried the
|
|
431
|
-
// lot, which the commit now holds) and is removed; the ticket
|
|
477
|
+
// lot, which the commit now holds) and is removed; the ticket is labelled `en-file`.
|
|
432
478
|
const pose = git('update-ref', `refs/heads/${branche}`, commit);
|
|
433
479
|
if (pose.status !== 0) {
|
|
434
480
|
return refuser(`La branche ${branche} ne prend pas ${commit.slice(0, 7)} :\n${pose.stderr}`);
|
|
@@ -445,12 +491,10 @@ function main(argv) {
|
|
|
445
491
|
})
|
|
446
492
|
: { status: 0, stderr: '' };
|
|
447
493
|
if (retrait.status !== 0) {
|
|
448
|
-
const raison = `La copie ${copieTicket} n'est pas retirée après le commit de ${branche} : ${retrait.stderr.trim()}
|
|
494
|
+
const raison = `La copie ${copieTicket} n'est pas retirée après le commit de ${branche} : ${retrait.stderr.trim()}`;
|
|
449
495
|
bd('comments', 'add', o.ticket, raison);
|
|
450
496
|
dire(`⚠ ${raison}`);
|
|
451
497
|
}
|
|
452
|
-
inscrireEntree(racine, branche, o.ticket);
|
|
453
|
-
dire('✓ en file');
|
|
454
498
|
const duree = Math.round((Date.now() - debut) / 100) / 10;
|
|
455
499
|
dire(`⏱ ${duree} s`);
|
|
456
500
|
return 0;
|
|
@@ -59,7 +59,9 @@ function empreinteDesDependances(copie, verrou, dansCopie) {
|
|
|
59
59
|
.filter(Boolean)
|
|
60
60
|
.sort();
|
|
61
61
|
const h = createHash('sha256').update(readFileSync(verrou));
|
|
62
|
-
for (const f of suivis)
|
|
62
|
+
for (const f of suivis) {
|
|
63
|
+
h.update(`\0${f}\0`).update(readFileSync(path.join(copie, f)));
|
|
64
|
+
}
|
|
63
65
|
return h.digest('hex');
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -91,9 +93,13 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
|
|
|
91
93
|
? dansCopie('checkout', '-q', '--detach', '--force', tete).status === 0 &&
|
|
92
94
|
dansCopie('clean', '-q', '-f', '-d', '-x', '-e', 'node_modules').status === 0
|
|
93
95
|
: git('worktree', 'add', '-q', '--detach', copie, tete).status === 0;
|
|
94
|
-
if (!prete)
|
|
96
|
+
if (!prete) {
|
|
97
|
+
return `La copie ${copie} ne se prépare pas.`;
|
|
98
|
+
}
|
|
95
99
|
const poses = spawnSync('bash', [SOUS_MODULES, 'pose', copie], { encoding: 'utf8' });
|
|
96
|
-
if (poses.status !== 0)
|
|
100
|
+
if (poses.status !== 0) {
|
|
101
|
+
return `La copie ne pose pas ses sous-modules : ${poses.stderr.trim()}`;
|
|
102
|
+
}
|
|
97
103
|
partages = poses.stdout;
|
|
98
104
|
return null;
|
|
99
105
|
};
|
|
@@ -109,7 +115,9 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
|
|
|
109
115
|
}
|
|
110
116
|
refus = preparer();
|
|
111
117
|
}
|
|
112
|
-
if (refus)
|
|
118
|
+
if (refus) {
|
|
119
|
+
return { refus };
|
|
120
|
+
}
|
|
113
121
|
const monter = (...commande) => [
|
|
114
122
|
SOUS_MODULES,
|
|
115
123
|
'monter',
|
|
@@ -119,10 +127,13 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
|
|
|
119
127
|
...commande,
|
|
120
128
|
];
|
|
121
129
|
const montage = spawnSync('bash', monter('true'), { encoding: 'utf8' });
|
|
122
|
-
if (montage.status !== 0)
|
|
123
|
-
|
|
130
|
+
if (montage.status !== 0) {
|
|
131
|
+
return { refus: montage.stderr.trim() };
|
|
132
|
+
}
|
|
133
|
+
const lancer = (commande, args, envPlus = null) => {
|
|
124
134
|
const r = spawnSync('bash', monter(commande, ...args), {
|
|
125
135
|
cwd: copie,
|
|
136
|
+
...(envPlus ? { env: { ...process.env, ...envPlus } } : {}),
|
|
126
137
|
encoding: 'utf8',
|
|
127
138
|
maxBuffer: SORTIE_MAX,
|
|
128
139
|
});
|
|
@@ -139,25 +150,46 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
|
|
|
139
150
|
// differ, the key is written again. Null when they agree, else the refusal.
|
|
140
151
|
const accorder = () => {
|
|
141
152
|
const verrouNpm = path.join(copie, VERROU);
|
|
142
|
-
if (!existsSync(verrouNpm))
|
|
153
|
+
if (!existsSync(verrouNpm)) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
143
156
|
const cle = path.join(copie, 'node_modules', '.integration-lock');
|
|
144
157
|
const empreinte = empreinteDesDependances(copie, verrouNpm, dansCopie);
|
|
145
|
-
if (existsSync(cle) && readFileSync(cle, 'utf8') === empreinte)
|
|
146
|
-
|
|
158
|
+
if (existsSync(cle) && readFileSync(cle, 'utf8') === empreinte) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
if (npm(['ci', '--no-audit', '--no-fund', '--silent']).status !== 0) {
|
|
147
162
|
return DEPENDANCES_REFUSEES;
|
|
163
|
+
}
|
|
148
164
|
writeFileSync(cle, empreinte);
|
|
149
165
|
return null;
|
|
150
166
|
};
|
|
151
167
|
const refusOuverture = accorder();
|
|
152
|
-
if (refusOuverture)
|
|
168
|
+
if (refusOuverture) {
|
|
169
|
+
return { refus: refusOuverture };
|
|
170
|
+
}
|
|
153
171
|
dire(`✓ copie propre sur ${tete.slice(0, 7)}`);
|
|
154
172
|
|
|
155
173
|
// The checks of the copy: its preparation, then its verification; the first that is not green
|
|
156
174
|
// ends them.
|
|
157
|
-
|
|
175
|
+
// `identite` (`{ sorte, ticket }`, the ticket null when unknown) is set in the environment of
|
|
176
|
+
// `npm run verifier` alone, which names itself so at the lock of the machine; the preparation
|
|
177
|
+
// does not receive it.
|
|
178
|
+
const tester = identite => {
|
|
158
179
|
let r;
|
|
159
|
-
|
|
160
|
-
|
|
180
|
+
const commandes = commandesDeVerification(copie);
|
|
181
|
+
for (const [i, [commande, args]] of commandes.entries()) {
|
|
182
|
+
const verifier = i === commandes.length - 1 && identite;
|
|
183
|
+
r = lancer(
|
|
184
|
+
commande,
|
|
185
|
+
args,
|
|
186
|
+
verifier
|
|
187
|
+
? {
|
|
188
|
+
GRILLHOUSE_VERIFICATION_SORTE: identite.sorte,
|
|
189
|
+
GRILLHOUSE_VERIFICATION_TICKET: identite.ticket ?? '',
|
|
190
|
+
}
|
|
191
|
+
: null
|
|
192
|
+
);
|
|
161
193
|
if (r.status !== 0) {
|
|
162
194
|
break;
|
|
163
195
|
}
|