@roomi-fields/grillhouse 0.26.0 → 0.27.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/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 +22 -0
- package/docs/ARCHITECTURE.md +58 -17
- package/docs/CADRE.md +7 -6
- package/docs/INTERFACE.md +96 -32
- package/package.json +1 -1
- package/scripts/circuit.mjs +44 -8
- 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/travail-de-la-copie.mjs +82 -8
- package/scripts/gardes-du-cadre.mjs +7 -4
- package/scripts/grillhouse-maj.mjs +152 -99
- 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 +26 -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 +9 -10
- package/scripts/langages/cargo/mise-a-jour.mjs +2 -1
- package/scripts/langages/cargo/sccache.mjs +29 -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 +94 -0
- package/scripts/langages/python/lot.mjs +76 -0
- package/scripts/langages/python/mise-a-jour.mjs +54 -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/index-interfaces.mjs +10 -3
- package/scripts/langages/typescript/index.mjs +11 -15
- 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/session-start.sh +34 -9
- package/scripts/sources.mjs +2 -1
- package/scripts/sous-commandes.mjs +5 -3
- package/scripts/tableau-des-composants.mjs +138 -0
- package/scripts/verrous/verrou.mjs +3 -2
- package/skills/grill/SKILL.md +9 -1
- package/skills/pitmaster/SKILL.md +6 -1
- package/skills/redacteur/references/documents-d-un-composant.md +12 -0
- package/skills/testwriter/SKILL.md +6 -0
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
// One delivery is one ticket: the ticket gives its branch `agent/<ticket>` and its copy
|
|
13
13
|
// (`.claude/worktrees/<ticket>`, the one the lot was written in, when it exists); a second
|
|
14
14
|
// --ticket is a usage error, named. In order, each step refusing stops the run:
|
|
15
|
+
// 0. the keys of the project, read from the package.json of the main tree: its generated files
|
|
16
|
+
// (`grillhouse.engendres`, scripts/engendres.mjs) and its tools (`grillhouse.outils`,
|
|
17
|
+
// scripts/outils-cles.mjs), a faulty key refused by its name before any work;
|
|
15
18
|
// 1. the verdict: the ticket has `ACCEPTÉ` as its last reviewer verdict (`ACCEPTÉ` or
|
|
16
19
|
// `RENDU` at the start of a comment of the author `relecteur`; another author's is none) and, when labelled `arbitrage`, each arbitrage
|
|
17
20
|
// (`estArbitrage`: a « ## Arbitrage » comment, the supervisor's) is settled
|
|
@@ -56,17 +59,21 @@
|
|
|
56
59
|
// `en-file` and the branch takes its place at the end of the queue
|
|
57
60
|
// (scripts/integration/file-attente.mjs). main does not move here.
|
|
58
61
|
//
|
|
59
|
-
// The references
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
62
|
+
// The references written in full are the generated files the project declares
|
|
63
|
+
// (`grillhouse.engendres`), then the frame's the circuit hands over (`--references`, a JSON file the
|
|
64
|
+
// circuit writes from its one list, `lesReferences` of scripts/circuit.mjs): each `{ nom, commande,
|
|
65
|
+
// fichiers, lit, entiers, cadre }`, `entiers` the files of `fichiers` its command writes in full,
|
|
66
|
+
// `lit` the files it reads (paths, directories or glob patterns, as `couvertPar` of
|
|
67
|
+
// scripts/engendres.mjs reads them). As a genrule of Bazel writes its output again on the merged
|
|
68
|
+
// tree, and npm install writes package-lock.json again after a merge, a file of the lot a reference
|
|
69
|
+
// writes in full is not applied: main's version stays, and each reference whose files or reads the
|
|
70
|
+
// lot touches plays in the copy, on main of the moment, after the install and before the tests,
|
|
71
|
+
// through the mounts, with the tools of the project, and what it writes enters the commit
|
|
72
|
+
// (`regenerer` of scripts/engendres.mjs; BPScript 320.30: refused twice for the one conflict on the
|
|
73
|
+
// index of the interfaces; OSC Bridge, 2026-10-31: four conflicts in one day on the generated files
|
|
74
|
+
// of synthhub and open-synth-descriptors). A command of the project at another code than 0, one of
|
|
75
|
+
// the frame on a real failure (126, 127, a signal), or a file it changes that its `fichiers` do not
|
|
76
|
+
// cover, refuses the lot, the command, its code and its output named. A conflict on any other file
|
|
70
77
|
// refuses it, as the three-way application says.
|
|
71
78
|
//
|
|
72
79
|
// What steps 2, 3 and 5 read of a lot is its files: each file added, modified or deleted, a
|
|
@@ -84,7 +91,9 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
84
91
|
import path from 'node:path';
|
|
85
92
|
import { pathToFileURL } from 'node:url';
|
|
86
93
|
import { arbitrageTranche, estArbitrage } from '../arbitrages.mjs';
|
|
94
|
+
import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
|
|
87
95
|
import { langageDe } from '../langages.mjs';
|
|
96
|
+
import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
|
|
88
97
|
import { lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
|
|
89
98
|
import { dossierCommun, inscrireEntree } from './file-attente.mjs';
|
|
90
99
|
import { ouvrirCopie, RETIRER_COPIE } from './rejeu.mjs';
|
|
@@ -118,16 +127,6 @@ function nomDeGit(ecrit) {
|
|
|
118
127
|
return Buffer.from(octets).toString('utf8');
|
|
119
128
|
}
|
|
120
129
|
|
|
121
|
-
// Whether one of <motifs> covers the file <fichier>, both from the root of the copy, as the
|
|
122
|
-
// inputs of Turborepo read them: a path names that file, a directory every file under it, a glob
|
|
123
|
-
// pattern (`*`, `**`) the files it matches (`path.matchesGlob` of Node).
|
|
124
|
-
export function couvertPar(motifs, fichier) {
|
|
125
|
-
return motifs.some(m => {
|
|
126
|
-
const dossier = m.replace(/\/+$/, '');
|
|
127
|
-
return fichier === dossier || fichier.startsWith(`${dossier}/`) || path.matchesGlob(fichier, m);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
130
|
// The refusal for the verdicts of one ticket, or null. `ticket` and `comments` are Beads' JSON.
|
|
132
131
|
export function refusVerdicts(ticket, comments) {
|
|
133
132
|
const id = ticket.id;
|
|
@@ -241,42 +240,6 @@ function differents(copieTicket, lots, fichiers, tmp) {
|
|
|
241
240
|
return r.stdout.split('\0').filter(Boolean);
|
|
242
241
|
}
|
|
243
242
|
|
|
244
|
-
// The regeneration of the references <refs> in the integration copy <copie>, each command run by
|
|
245
|
-
// the shell at its root through the mounts (`monter`), its output written; then every file they
|
|
246
|
-
// changed staged. Null, or the refusal: a command of the project at another code than 0, one of
|
|
247
|
-
// the frame on a real failure (126, 127, a signal, 128 + its number), a file changed that their
|
|
248
|
-
// `fichiers` do not cover.
|
|
249
|
-
function regenerer(copie, refs, monter, dansCopie) {
|
|
250
|
-
for (const r of refs) {
|
|
251
|
-
const x = spawnSync('bash', monter('sh', '-c', r.commande), {
|
|
252
|
-
cwd: copie,
|
|
253
|
-
encoding: 'utf8',
|
|
254
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
255
|
-
});
|
|
256
|
-
process.stdout.write(`${x.stdout ?? ''}${x.stderr ?? ''}`);
|
|
257
|
-
const code = x.status ?? 1;
|
|
258
|
-
const panne =
|
|
259
|
-
x.signal !== null || x.error !== undefined || code === 126 || code === 127 || code > 128;
|
|
260
|
-
if (panne || (!r.cadre && code !== 0)) {
|
|
261
|
-
return `La référence « ${r.nom} » (\`${r.commande}\`) rend le code ${code} dans la copie d'intégration.`;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
const etat = dansCopie('status', '--porcelain=v1', '-z', '-uall', '--no-renames');
|
|
265
|
-
if (etat.status !== 0) return "L'état de la copie d'intégration ne se lit pas.";
|
|
266
|
-
const ecrits = etat.stdout
|
|
267
|
-
.split('\0')
|
|
268
|
-
.filter(l => l && (l[1] !== ' ' || l.startsWith('??')))
|
|
269
|
-
.map(l => l.slice(3));
|
|
270
|
-
const horsDeclaration = ecrits.filter(f => !refs.some(r => couvertPar(r.fichiers, f)));
|
|
271
|
-
if (horsDeclaration.length) {
|
|
272
|
-
return `La régénération des références change des fichiers qu'aucune n'écrit :\n${horsDeclaration.map(f => ` ${f}`).join('\n')}`;
|
|
273
|
-
}
|
|
274
|
-
if (ecrits.length && dansCopie('add', '-A', '--', ...ecrits).status !== 0) {
|
|
275
|
-
return "Les fichiers des références ne s'ajoutent pas au commit.";
|
|
276
|
-
}
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
243
|
function main(argv) {
|
|
281
244
|
const o = lire(argv);
|
|
282
245
|
if ('faute' in o) {
|
|
@@ -312,6 +275,16 @@ function main(argv) {
|
|
|
312
275
|
const base = ouvrirBase('integration');
|
|
313
276
|
const tmp = base.dossier;
|
|
314
277
|
try {
|
|
278
|
+
// 0. The keys of the project, before any work.
|
|
279
|
+
let engendres;
|
|
280
|
+
let outils;
|
|
281
|
+
try {
|
|
282
|
+
engendres = engendresDe(racine);
|
|
283
|
+
outils = outilsDe(racine);
|
|
284
|
+
} catch (e) {
|
|
285
|
+
return refuser(`Une clé grillhouse du package.json est refusée :\n${e.message}`);
|
|
286
|
+
}
|
|
287
|
+
|
|
315
288
|
// 1. The verdict.
|
|
316
289
|
const show = bd('show', o.ticket, '--json');
|
|
317
290
|
const comments = bd('comments', o.ticket, '--json');
|
|
@@ -344,17 +317,21 @@ function main(argv) {
|
|
|
344
317
|
if (r2) return refuser(r2);
|
|
345
318
|
const fichiers = [...new Set([...tests, ...code])];
|
|
346
319
|
dire(`✓ lots : ${fichiers.length} fichiers`);
|
|
347
|
-
let
|
|
320
|
+
let duCircuit = [];
|
|
348
321
|
if (o.references) {
|
|
349
322
|
try {
|
|
350
|
-
|
|
323
|
+
duCircuit = JSON.parse(readFileSync(absolu(o.references), 'utf8'));
|
|
351
324
|
} catch (e) {
|
|
352
325
|
return refuser(`Les références ${o.references} ne se lisent pas : ${e.message}`);
|
|
353
326
|
}
|
|
354
327
|
}
|
|
355
|
-
|
|
328
|
+
const references = [
|
|
329
|
+
...engendres.map(e => ({ ...e, cadre: false })),
|
|
330
|
+
...duCircuit.map(r => ({ ...r, lit: r.lit ?? [] })),
|
|
331
|
+
];
|
|
332
|
+
// The files of the lot a reference writes in full, and the references the lot touches.
|
|
356
333
|
const entiers = fichiers.filter(f => references.some(r => couvertPar(r.entiers, f)));
|
|
357
|
-
const aRegenerer = references
|
|
334
|
+
const aRegenerer = touchesPar(references, fichiers);
|
|
358
335
|
|
|
359
336
|
// 3. The main tree: the lots' files are free there, so the queue can bring them. The ticket's
|
|
360
337
|
// copy holds the lot and nothing else.
|
|
@@ -408,7 +385,18 @@ function main(argv) {
|
|
|
408
385
|
const installation = installer();
|
|
409
386
|
if (installation) return refuser(installation);
|
|
410
387
|
if (aRegenerer.length) {
|
|
411
|
-
const
|
|
388
|
+
const env = avecLesOutils(outils, process.env);
|
|
389
|
+
const refus = regenerer({
|
|
390
|
+
refs: aRegenerer,
|
|
391
|
+
dansCopie,
|
|
392
|
+
lancer: commande =>
|
|
393
|
+
spawnSync('bash', monter('sh', '-c', commande), {
|
|
394
|
+
cwd: copie,
|
|
395
|
+
encoding: 'utf8',
|
|
396
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
397
|
+
env,
|
|
398
|
+
}),
|
|
399
|
+
});
|
|
412
400
|
if (refus) return refuser(refus);
|
|
413
401
|
dire(`✓ références régénérées sur main à jour : ${aRegenerer.map(r => r.nom).join(', ')}`);
|
|
414
402
|
}
|
package/scripts/jointure.d.ts
CHANGED
|
@@ -191,13 +191,11 @@ export interface MiseAJour {
|
|
|
191
191
|
} | null;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
/**
|
|
195
|
-
|
|
194
|
+
/** What the core asks of the languages of a project: a module of language, or the composition of
|
|
195
|
+
* the modules a project declares (scripts/composition-des-langages.mjs), whose name joins theirs
|
|
196
|
+
* with `+`. */
|
|
197
|
+
export interface Composition {
|
|
196
198
|
nom: string;
|
|
197
|
-
/** Whether the repository at `racine` holds code of this language, which the update declares. */
|
|
198
|
-
trouve(racine: string): boolean;
|
|
199
|
-
/** What `trouve` looks for, in words: the refusal of the update names it. */
|
|
200
|
-
signe: string;
|
|
201
199
|
/** The tools a project of this language installs, optional peers of the package. */
|
|
202
200
|
outils: string[];
|
|
203
201
|
/** The binaries a project of this language installs on the machine, each at its exact version:
|
|
@@ -246,17 +244,31 @@ export interface Langage {
|
|
|
246
244
|
fichiersEngendres(racine: string): FichierEngendre[];
|
|
247
245
|
gardes(racine: string): string[][];
|
|
248
246
|
migrations: Migration[];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** A module of language, the default export of `scripts/langages/<nom>/index.mjs`. */
|
|
250
|
+
export interface Langage extends Composition {
|
|
251
|
+
/** The manifest of a package of this language, in its folder (`package.json`, `Cargo.toml`):
|
|
252
|
+
* the guard of the languages asks it of a package the architecture declares of this language. */
|
|
253
|
+
manifeste: string;
|
|
254
|
+
/** The entries of the index of the interfaces, one per interface of the module's components and
|
|
255
|
+
* the root's, `lignes` as the index writes them, which the core assembles for a project of
|
|
256
|
+
* several languages (scripts/index-interfaces.mjs). */
|
|
257
|
+
entreesDeLIndex(racine: string): { rel: string; lignes: string[] }[];
|
|
249
258
|
miseAJour: MiseAJour;
|
|
250
259
|
}
|
|
251
260
|
|
|
252
261
|
/** The frame's languages, each its module. */
|
|
253
262
|
export const LANGAGES: Record<string, string>;
|
|
254
|
-
/** The languages the project at `racine` declares
|
|
263
|
+
/** The languages the project at `racine` declares: the column « Langage » of the table of the
|
|
264
|
+
* components of its docs/ARCHITECTURE.md, each once, empty for none. */
|
|
255
265
|
export function langagesDeclares(racine: string): string[];
|
|
256
|
-
/** The
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
266
|
+
/** The modules of the languages the project at `racine` declares, in the order of the table;
|
|
267
|
+
* throws when it declares none, or one out of the list. */
|
|
268
|
+
export function langagesDe(racine: string): Langage[];
|
|
269
|
+
/** The join of the modules that serve the project at `racine`: the module itself for one, their
|
|
270
|
+
* composition for several; throws as `langagesDe`. */
|
|
271
|
+
export function langageDe(racine: string): Composition;
|
|
260
272
|
|
|
261
273
|
// The services of the core to a module of language, which imports of the core its published
|
|
262
274
|
// entries alone (.dependency-cruiser.projet.cjs of the frame's repository).
|
|
@@ -315,8 +327,9 @@ export function attendreLeRepos(o?: Record<string, unknown>): unknown;
|
|
|
315
327
|
export const CHANGEMENTS: string;
|
|
316
328
|
/** The variable naming the commit of the last green a run measures itself from. */
|
|
317
329
|
export const DEPUIS_LE_VERT: string;
|
|
318
|
-
/** Keeps the green of a pass, which the next one measures itself from
|
|
319
|
-
|
|
330
|
+
/** Keeps the green of a pass, which the next one measures itself from; deferred to the file
|
|
331
|
+
* `GRILLHOUSE_VERT_DIFFERE` of `env` names, in a project of several languages. */
|
|
332
|
+
export function garderLeVert(etat: unknown, env?: NodeJS.ProcessEnv): void;
|
|
320
333
|
/** The measure of the repository at `racine` against its last green. */
|
|
321
334
|
export function mesure(racine: string, o?: { tout?: boolean; dans?: string }): unknown;
|
|
322
335
|
/** The wait for the lock of the machine, ended without it (scripts/verrou-de-machine.mjs). */
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
// which cargo-binstall's installations also write). Cargo absent or failing: a line on the error
|
|
10
10
|
// stream, named, and the code 1.
|
|
11
11
|
// - `installer`: `cargo binstall --no-confirm --locked <nom>@<version>`, its output this process's
|
|
12
|
-
// error stream, its code this process's; a failure names on the error stream the command to type
|
|
13
|
-
//
|
|
12
|
+
// error stream, its code this process's; a failure names on the error stream the command to type.
|
|
13
|
+
// A machine whose cargo lacks binstall (`cargo --list`) first receives cargo-binstall from cargo,
|
|
14
|
+
// at its exact version (`cargo install --locked cargo-binstall@<BINSTALL>`, the installation the
|
|
15
|
+
// README of cargo-binstall gives): the update installs the binaries without a step by hand
|
|
16
|
+
// (grillhouse-qmk, OSC Bridge). Its failure names that command, and no binstall runs.
|
|
14
17
|
import { spawnSync } from 'node:child_process';
|
|
15
18
|
import { pathToFileURL } from 'node:url';
|
|
16
19
|
|
|
@@ -28,16 +31,36 @@ export function installes() {
|
|
|
28
31
|
);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
/**
|
|
34
|
+
/** The version of cargo-binstall that cargo installs when the machine lacks it. */
|
|
35
|
+
export const BINSTALL = '1.26.2';
|
|
36
|
+
|
|
37
|
+
// Whether cargo has the subcommand binstall, as `cargo --list` lists it.
|
|
38
|
+
const avecBinstall = () => {
|
|
39
|
+
const r = spawnSync('cargo', ['--list'], { encoding: 'utf8' });
|
|
40
|
+
return r.status === 0 && /^\s+binstall\s*$/m.test(r.stdout ?? '');
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Installs <cible> (`<nom>@<version>`): the exit code of cargo binstall, or of the installation of
|
|
45
|
+
* cargo-binstall when it lacks and fails.
|
|
46
|
+
*/
|
|
32
47
|
export function installer(cible) {
|
|
48
|
+
if (!avecBinstall()) {
|
|
49
|
+
const args = ['install', '--locked', `cargo-binstall@${BINSTALL}`];
|
|
50
|
+
const r = spawnSync('cargo', args, { stdio: ['ignore', 2, 2] });
|
|
51
|
+
const code = r.error ? 127 : (r.status ?? 1);
|
|
52
|
+
if (code !== 0) {
|
|
53
|
+
const cause = r.error ? r.error.message : `code ${code}`;
|
|
54
|
+
process.stderr.write(`⛔ \`cargo ${args.join(' ')}\` échoue (${cause}) ; lance-la.\n`);
|
|
55
|
+
return code;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
33
58
|
const args = ['binstall', '--no-confirm', '--locked', cible];
|
|
34
59
|
const r = spawnSync('cargo', args, { stdio: ['ignore', 2, 2] });
|
|
35
60
|
const code = r.error ? 127 : (r.status ?? 1);
|
|
36
61
|
if (code !== 0) {
|
|
37
62
|
const cause = r.error ? r.error.message : `code ${code}`;
|
|
38
|
-
process.stderr.write(
|
|
39
|
-
`⛔ \`cargo ${args.join(' ')}\` échoue (${cause}) ; lance-la (cargo-binstall s'installe par \`cargo install cargo-binstall\`).\n`
|
|
40
|
-
);
|
|
63
|
+
process.stderr.write(`⛔ \`cargo ${args.join(' ')}\` échoue (${cause}) ; lance-la.\n`);
|
|
41
64
|
}
|
|
42
65
|
return code;
|
|
43
66
|
}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
//
|
|
7
7
|
// - It runs `cargo clippy --all-targets --message-format=json -- -D warnings`: every target, the
|
|
8
8
|
// tests of `tests/` included, which clippy reads only with `--all-targets`; every warning denied;
|
|
9
|
-
// rustc wrapped by sccache, as every command of the module that compiles (./sccache.mjs)
|
|
9
|
+
// rustc wrapped by sccache, as every command of the module that compiles (./sccache.mjs), its
|
|
10
|
+
// server started first under the machine's /tmp (`demarrerLeServeur`); a
|
|
10
11
|
// PATH without sccache refuses before cargo runs, the line naming `npx grillhouse maj`.
|
|
11
12
|
// - Each diagnostic of the compiler that carries a code is a finding: its file, the primary span's
|
|
12
13
|
// from the root, its line, its message the compiler's. A lint (`clippy::needless_return`, a lint
|
|
@@ -22,7 +23,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
22
23
|
import path from 'node:path';
|
|
23
24
|
import { pathToFileURL } from 'node:url';
|
|
24
25
|
import { MODE, trancher } from '../../dette.mjs';
|
|
25
|
-
import { avecSccache, sccacheAbsent } from './sccache.mjs';
|
|
26
|
+
import { avecSccache, demarrerLeServeur, sccacheAbsent } from './sccache.mjs';
|
|
26
27
|
|
|
27
28
|
export const GARDE = 'clippy';
|
|
28
29
|
export const ARGS = ['clippy', '--all-targets', '--message-format=json', '--', '-D', 'warnings'];
|
|
@@ -84,6 +85,7 @@ export function commande(racine, { env = process.env } = {}) {
|
|
|
84
85
|
process.stderr.write(`${absent}\n`);
|
|
85
86
|
return 1;
|
|
86
87
|
}
|
|
88
|
+
demarrerLeServeur(racine, env);
|
|
87
89
|
const r = spawnSync('cargo', ARGS, {
|
|
88
90
|
cwd: racine,
|
|
89
91
|
env: avecSccache(racine, env),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// `commandes`; run by `grillhouse <commande>` in the root of the workspace, its arguments after.
|
|
5
5
|
//
|
|
6
6
|
// npx grillhouse tests [--force] [<chemin>…] [--<option>…] tester
|
|
7
|
-
// npx grillhouse verifier [--tout]
|
|
7
|
+
// npx grillhouse verifier [--tout | --gardes] verifier
|
|
8
8
|
// node commandes.mjs typer typer
|
|
9
9
|
// npx grillhouse preparer preparer
|
|
10
10
|
// npx grillhouse clippy | frontieres | index-interfaces each guard, its own script
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
// time (`avecLaMachine` of ./jointure, as the module typescript's verifier): a measure that
|
|
36
36
|
// holds it makes it wait, and the bound of the wait reached, it stops at 75 without running
|
|
37
37
|
// cargo.
|
|
38
|
+
// - `verifier --gardes` plays the guards alone, the same verdict as the module typescript's: the
|
|
39
|
+
// project's root scripts `grillhouse:gardes` (the frame's guards) then `gardes` (its own), each
|
|
40
|
+
// one the package.json holds a task of the root, by npm, without its tests nor cargo deny, and
|
|
41
|
+
// keeps no last green.
|
|
38
42
|
// - `tester` and `verifier` play under a temporary directory of their pass, the module's guard of
|
|
39
43
|
// the temporary directory, as the CI of osc-bridge (OB-ud1.3): a base (`ouvrirBase` of
|
|
40
44
|
// ./jointure, genre `tests` or `verification`) in the temporary directory of the environment,
|
|
@@ -45,7 +49,8 @@
|
|
|
45
49
|
// a failed test included, never a path built by hand under `std::env::temp_dir()`.
|
|
46
50
|
// - `typer`: `cargo check --all-targets`. `preparer`: `cargo fetch --locked`.
|
|
47
51
|
// - Cargo runs with rustc wrapped by sccache, its cache common to the copies of the machine
|
|
48
|
-
// (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr)
|
|
52
|
+
// (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr), its server started
|
|
53
|
+
// under the machine's /tmp before each run of cargo that compiles (grillhouse-qmk). `tester`, `verifier`
|
|
49
54
|
// and `typer` refuse, before any run of cargo, a PATH without sccache, in one line that names it
|
|
50
55
|
// and `npx grillhouse maj`, which installs it (code 2).
|
|
51
56
|
// - Nextest reads the frame's profile `grillhouse` (./nextest.toml, a tool's configuration under
|
|
@@ -91,7 +96,7 @@ import {
|
|
|
91
96
|
retirerALInterruption,
|
|
92
97
|
} from '../../services-du-noyau.mjs';
|
|
93
98
|
import { composantDans, crates, joueDesTests, metadonnees } from './composants.mjs';
|
|
94
|
-
import { avecSccache, sccacheAbsent } from './sccache.mjs';
|
|
99
|
+
import { avecSccache, demarrerLeServeur, sccacheAbsent } from './sccache.mjs';
|
|
95
100
|
import { touchesDesFichiers } from './touches.mjs';
|
|
96
101
|
import { JUNIT, TACHES } from './verdict.mjs';
|
|
97
102
|
|
|
@@ -106,6 +111,8 @@ const VERROU = 'Cargo.lock';
|
|
|
106
111
|
const VERROUILLEES = ['tester', 'verifier', 'preparer'];
|
|
107
112
|
// The commands that compile, refused without sccache on the PATH (./sccache.mjs).
|
|
108
113
|
const COMPILENT = ['tester', 'verifier', 'typer'];
|
|
114
|
+
// The subcommands of cargo that compile, before which the server of sccache starts.
|
|
115
|
+
const COMPILATIONS = ['test', 'nextest', 'check'];
|
|
109
116
|
|
|
110
117
|
/** The guards of structure of the module, in the order they play: each its name, its script beside
|
|
111
118
|
* this one, and its arguments as a guard. */
|
|
@@ -176,11 +183,15 @@ function passe(racine, env) {
|
|
|
176
183
|
ecrire();
|
|
177
184
|
return { t, args };
|
|
178
185
|
},
|
|
179
|
-
jouer({ t, args }, { junit = null, journal = null } = {}) {
|
|
186
|
+
jouer({ t, args }, { junit = null, journal = null, programme = 'cargo' } = {}) {
|
|
180
187
|
// A report of an earlier run is no report of this one, which may write none.
|
|
181
188
|
if (junit) {
|
|
182
189
|
rmSync(junit, { force: true });
|
|
183
190
|
}
|
|
191
|
+
// The server of sccache, started under a short temporary directory (./sccache.mjs).
|
|
192
|
+
if (COMPILATIONS.includes(args[0])) {
|
|
193
|
+
demarrerLeServeur(racine, env);
|
|
194
|
+
}
|
|
184
195
|
let r;
|
|
185
196
|
if (journal) {
|
|
186
197
|
// The output of cargo, both streams in their order, goes to the task's log, then to the
|
|
@@ -188,7 +199,7 @@ function passe(racine, env) {
|
|
|
188
199
|
mkdirSync(path.dirname(journal), { recursive: true });
|
|
189
200
|
const fd = openSync(journal, 'w');
|
|
190
201
|
try {
|
|
191
|
-
r = spawnSync(
|
|
202
|
+
r = spawnSync(programme, args, {
|
|
192
203
|
cwd: racine,
|
|
193
204
|
env: compilation,
|
|
194
205
|
stdio: ['inherit', fd, fd],
|
|
@@ -199,7 +210,7 @@ function passe(racine, env) {
|
|
|
199
210
|
process.stderr.write(readFileSync(journal, 'utf8'));
|
|
200
211
|
t.journal = path.relative(racine, journal);
|
|
201
212
|
} else {
|
|
202
|
-
r = spawnSync(
|
|
213
|
+
r = spawnSync(programme, args, { cwd: racine, env: compilation, stdio: 'inherit' });
|
|
203
214
|
}
|
|
204
215
|
t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
|
|
205
216
|
if (junit && dossier && existsSync(junit)) {
|
|
@@ -318,6 +329,9 @@ function choisir(racine, tous, chemins) {
|
|
|
318
329
|
// last green.
|
|
319
330
|
function verifier(racine, args, env) {
|
|
320
331
|
const p = passe(racine, env);
|
|
332
|
+
if (args.includes('--gardes')) {
|
|
333
|
+
return gardes(racine, p);
|
|
334
|
+
}
|
|
321
335
|
const tous = crates(racine);
|
|
322
336
|
const { choix, m } = depuisLeVert(racine, tous, args.includes('--tout'), env);
|
|
323
337
|
try {
|
|
@@ -338,6 +352,30 @@ function verifier(racine, args, env) {
|
|
|
338
352
|
}
|
|
339
353
|
}
|
|
340
354
|
|
|
355
|
+
// The scripts of guards of the project, in the order they play, as the module typescript's
|
|
356
|
+
// `--gardes` plays its tasks: the frame's, then the project's own.
|
|
357
|
+
const SCRIPTS_DE_GARDES = ['grillhouse:gardes', 'gardes'];
|
|
358
|
+
|
|
359
|
+
// The pass of `verifier --gardes` in <racine>, the run <p>: each script of SCRIPTS_DE_GARDES the
|
|
360
|
+
// root package.json holds, a task of the root, whatever the verdict of the one before; no test.
|
|
361
|
+
function gardes(racine, p) {
|
|
362
|
+
let scripts = {};
|
|
363
|
+
try {
|
|
364
|
+
scripts = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts ?? {};
|
|
365
|
+
} catch {
|
|
366
|
+
scripts = {};
|
|
367
|
+
}
|
|
368
|
+
for (const nom of SCRIPTS_DE_GARDES.filter(n => typeof scripts[n] === 'string')) {
|
|
369
|
+
p.jouer(p.prevoir(RACINE, racine, nom, false, ['run', '--silent', nom]), { programme: 'npm' });
|
|
370
|
+
}
|
|
371
|
+
return p.code();
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Node's compile cache, which npm enables under the temporary directory (`module.enableCompileCache()`)
|
|
375
|
+
// when `verifier --gardes` runs the project's scripts: the guard of the base tolerates it at its
|
|
376
|
+
// root, as the module typescript's base of Vitest, and the base removes it with the rest.
|
|
377
|
+
const CACHE_DE_NODE = 'node-compile-cache';
|
|
378
|
+
|
|
341
379
|
// Plays <jouer>(env) under the base of a pass of <genre> in the temporary directory of <env>,
|
|
342
380
|
// named to cargo in TMPDIR, TMP and TEMP: its code, 1 when the tests left something there, named.
|
|
343
381
|
// The base goes at the end, or at an interruption.
|
|
@@ -346,7 +384,7 @@ function sousLaBase(genre, env, jouer) {
|
|
|
346
384
|
const lacher = retirerALInterruption(base.fermer);
|
|
347
385
|
try {
|
|
348
386
|
const code = jouer({ ...env, ...base.env });
|
|
349
|
-
const ligne = ligneDesRestes(base.restes());
|
|
387
|
+
const ligne = ligneDesRestes(base.restes().filter(n => n !== CACHE_DE_NODE));
|
|
350
388
|
if (!ligne) {
|
|
351
389
|
return code;
|
|
352
390
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// tester, verifier and preparer refuse a workspace whose Cargo.lock git does not track.
|
|
17
17
|
// - A crate at the root, its workspace `members = ["."]`, with its tests, as OSC Bridge: `seul`;
|
|
18
18
|
// a crate at the root holding a second crate, `crates/aide`, none with tests: `imbrique`.
|
|
19
|
-
// - A directory without Cargo.toml: `vide
|
|
19
|
+
// - A directory without Cargo.toml: `vide`.
|
|
20
20
|
// - Two results directories of a run: every task and test green (`vert`); `ws-core` at 75,
|
|
21
21
|
// `ws-app` red with a test of `integ` failed, `ws-outil` not played (`defaut`).
|
|
22
22
|
// - `depots`: the repositories, for the tests of the module beside the suite.
|
|
@@ -202,8 +202,6 @@ export default {
|
|
|
202
202
|
const aJour = espace(dans);
|
|
203
203
|
const vide = mkdtempSync(path.join(dans, 'vide-'));
|
|
204
204
|
writeFileSync(path.join(vide, 'README.md'), 'aucun crate\n');
|
|
205
|
-
const typescript = mkdtempSync(path.join(dans, 'typescript-'));
|
|
206
|
-
writeFileSync(path.join(typescript, 'tsconfig.json'), '{}\n');
|
|
207
205
|
const seul = aLaRacine(dans, 'seul', [], {
|
|
208
206
|
'src/main.rs': 'fn main() {}\n',
|
|
209
207
|
'src/lib.rs': 'pub fn un() -> i32 {\n 1\n}\n',
|
|
@@ -260,7 +258,6 @@ export default {
|
|
|
260
258
|
avantLeLot,
|
|
261
259
|
enRetard,
|
|
262
260
|
vide,
|
|
263
|
-
typescript,
|
|
264
261
|
},
|
|
265
262
|
composants: {
|
|
266
263
|
valide: vide,
|
|
@@ -379,17 +376,6 @@ export default {
|
|
|
379
376
|
invalide: aJour,
|
|
380
377
|
attendu: ['ws-app (ws-app) : joue des tests', 'ws-core (ws-core) : joue des tests'],
|
|
381
378
|
},
|
|
382
|
-
trouve: {
|
|
383
|
-
valide: [
|
|
384
|
-
{ nom: 'vide', racine: vide },
|
|
385
|
-
{ nom: 'typescript', racine: typescript },
|
|
386
|
-
],
|
|
387
|
-
invalide: [
|
|
388
|
-
{ nom: 'espace', racine: aJour },
|
|
389
|
-
{ nom: 'crate à la racine', racine: seul },
|
|
390
|
-
],
|
|
391
|
-
attendu: ['espace : trouvé', 'crate à la racine : trouvé'],
|
|
392
|
-
},
|
|
393
379
|
};
|
|
394
380
|
},
|
|
395
381
|
};
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
// node index-interfaces.mjs writes docs/agents/index-des-interfaces.md
|
|
8
8
|
// node index-interfaces.mjs --verifier refuses (exit 1) when that file is out of date, its
|
|
9
9
|
// finding in SARIF too (../../resultats.mjs)
|
|
10
|
+
// node index-interfaces.mjs --publie <composant>
|
|
11
|
+
// prints nothing: a crate's interface names no consumer,
|
|
12
|
+
// which the module typescript's prints from
|
|
10
13
|
//
|
|
11
14
|
// - An interface is found at `<crate>/docs/INTERFACE.md` for each member of the workspace
|
|
12
15
|
// (./composants.mjs), and at `docs/INTERFACE.md`; in their paths' order.
|
|
@@ -78,14 +81,24 @@ function entrees({ rel, composant }, contenu) {
|
|
|
78
81
|
return [`## ${tetiere}`, '', `${premierePhrase(paragraphe)} (\`${rel}\`)`, ''];
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
/**
|
|
85
|
+
* The entries of the index of each interface of the workspace at <racine>, `{ rel, lignes }`, in
|
|
86
|
+
* the order of `interfaces`: what the module gives the core's index of a project of several
|
|
87
|
+
* languages (`entreesDeLIndex` of the join).
|
|
88
|
+
* @param {string} racine the root of the workspace
|
|
89
|
+
*/
|
|
90
|
+
export const entreesDeLIndex = racine =>
|
|
91
|
+
interfaces(racine).map(i => ({
|
|
92
|
+
rel: i.rel,
|
|
93
|
+
lignes: entrees(i, readFileSync(path.join(racine, i.rel), 'utf8')),
|
|
94
|
+
}));
|
|
95
|
+
|
|
81
96
|
/**
|
|
82
97
|
* The index of the interfaces of the workspace at <racine>, as its file holds it.
|
|
83
98
|
* @param {string} racine the root of the workspace
|
|
84
99
|
*/
|
|
85
100
|
export function index(racine) {
|
|
86
|
-
const corps =
|
|
87
|
-
entrees(i, readFileSync(path.join(racine, i.rel), 'utf8'))
|
|
88
|
-
);
|
|
101
|
+
const corps = entreesDeLIndex(racine).flatMap(e => e.lignes);
|
|
89
102
|
return [
|
|
90
103
|
'# Index des interfaces',
|
|
91
104
|
'',
|
|
@@ -120,6 +133,10 @@ export function enRetard(racine) {
|
|
|
120
133
|
* @param {{ env?: NodeJS.ProcessEnv }} [o] the environment (the results directory)
|
|
121
134
|
*/
|
|
122
135
|
export function commande(racine, args, { env = process.env } = {}) {
|
|
136
|
+
// A crate's interface declares no consumers: what its providers publish is nothing to print.
|
|
137
|
+
if (args.includes('--publie')) {
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
123
140
|
if (!args.includes('--verifier')) {
|
|
124
141
|
mkdirSync(path.dirname(path.join(racine, SORTIE)), { recursive: true });
|
|
125
142
|
writeFileSync(path.join(racine, SORTIE), index(racine));
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// The core loads it by scripts/langages.mjs, and this module imports of the core its published
|
|
5
5
|
// entries alone.
|
|
6
6
|
//
|
|
7
|
-
// -
|
|
8
|
-
//
|
|
7
|
+
// - The manifest of its package, which the guard of the languages asks of a package the
|
|
8
|
+
// architecture declares cargo (`manifeste`): a Cargo.toml. Its one tool of npm is what its scripts import, smol-toml, the
|
|
9
9
|
// reader of a Cargo.toml (`outils`, an optional peer of the package, which the update adds to a
|
|
10
10
|
// project of cargo alone): cargo and its subcommands live on the machine, and the update
|
|
11
11
|
// installs the binaries the module runs, nextest, cargo-deny and sccache, at their versions
|
|
@@ -25,10 +25,12 @@
|
|
|
25
25
|
// - The generated file, the index of the interfaces (./index-interfaces.mjs), its command and its
|
|
26
26
|
// check; the guards of structure, in the order they play: clippy (./clippy.mjs), the boundaries
|
|
27
27
|
// between crates (./frontieres.mjs), the index of the interfaces up to date, each a command by
|
|
28
|
-
// its name too (./commandes.mjs), which the line of a red guard names
|
|
28
|
+
// its name too (./commandes.mjs), which the line of a red guard names; the entries of the index
|
|
29
|
+
// of each interface (`entreesDeLIndex`), which the core assembles in a project of several
|
|
30
|
+
// languages. No migration yet.
|
|
29
31
|
// - Its share of the update (./mise-a-jour.mjs, `miseAJour`): the template of a project of cargo
|
|
30
32
|
// (`templates/cargo/`) and its test scripts.
|
|
31
|
-
import {
|
|
33
|
+
import { readFileSync } from 'node:fs';
|
|
32
34
|
import path from 'node:path';
|
|
33
35
|
import { fileURLToPath } from 'node:url';
|
|
34
36
|
import { commandes, GARDES } from './commandes.mjs';
|
|
@@ -42,7 +44,7 @@ import {
|
|
|
42
44
|
matieres,
|
|
43
45
|
} from './composants.mjs';
|
|
44
46
|
import { elementsDuLot } from './elements-du-lot.mjs';
|
|
45
|
-
import { enRetard, SORTIE } from './index-interfaces.mjs';
|
|
47
|
+
import { enRetard, entreesDeLIndex, SORTIE } from './index-interfaces.mjs';
|
|
46
48
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
47
49
|
import { CACHE } from './sccache.mjs';
|
|
48
50
|
import { touches } from './touches.mjs';
|
|
@@ -51,13 +53,9 @@ import { verdict } from './verdict.mjs';
|
|
|
51
53
|
// The scripts of this module, beside this file.
|
|
52
54
|
const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
|
|
53
55
|
|
|
54
|
-
// Whether the repository at <racine> holds a Cargo.toml at its root.
|
|
55
|
-
const trouve = racine => existsSync(path.join(racine, 'Cargo.toml'));
|
|
56
|
-
|
|
57
56
|
export default {
|
|
58
57
|
nom: 'cargo',
|
|
59
|
-
|
|
60
|
-
signe: 'un Cargo.toml à la racine',
|
|
58
|
+
manifeste: 'Cargo.toml',
|
|
61
59
|
// The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`).
|
|
62
60
|
outils: ['smol-toml'],
|
|
63
61
|
// The binaries the module runs, each at an exact version: nextest and cargo-deny at the ones the
|
|
@@ -118,6 +116,7 @@ export default {
|
|
|
118
116
|
verifier: enRetard,
|
|
119
117
|
},
|
|
120
118
|
],
|
|
119
|
+
entreesDeLIndex,
|
|
121
120
|
gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
|
|
122
121
|
migrations: [],
|
|
123
122
|
miseAJour,
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
// - The generator: the index of the interfaces (./index-interfaces.mjs), run where the project
|
|
22
22
|
// holds it, as the module typescript's.
|
|
23
23
|
// - The installation of its binaries (./binaires.json): the commands of ./binaires.mjs, which list
|
|
24
|
-
// what cargo installed and install one binary by cargo-binstall
|
|
24
|
+
// what cargo installed and install one binary by cargo-binstall, installed first when it lacks;
|
|
25
|
+
// the core runs them.
|
|
25
26
|
import { copyFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
|
|
26
27
|
import path from 'node:path';
|
|
27
28
|
import { fileURLToPath } from 'node:url';
|