@roomi-fields/grillhouse 0.46.0 → 0.47.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 +14 -0
- package/cadre/templates/c/package.json +19 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +34 -49
- package/cadre/templates/projet/CLAUDE.md +6 -0
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/charte.md +17 -9
- package/dist/temporal/circuit/client.d.ts +14 -5
- package/dist/temporal/circuit/client.js +39 -9
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +2 -0
- package/dist/temporal/file/activites.js +7 -0
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +26 -18
- package/dist/temporal/file/contrat.js +8 -5
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +1 -1
- package/dist/temporal/file/deroule.js +91 -42
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.js +4 -13
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/docs/ARCHITECTURE.md +117 -82
- package/docs/INTERFACE.md +36 -19
- package/hooks/register.tsx +1 -1
- package/package.json +1 -1
- package/scripts/activites.mjs +5 -11
- package/scripts/arbres-juges.mjs +59 -0
- package/scripts/avancement.mjs +2 -38
- package/scripts/branche-de-nuit.mjs +14 -45
- package/scripts/ci-de-main.mjs +273 -0
- package/scripts/dernier-vert.mjs +12 -8
- package/scripts/etapes.mjs +1 -1
- package/scripts/faits-du-circuit.mjs +41 -25
- package/scripts/integration/file.mjs +126 -587
- package/scripts/integration/integrer.mjs +6 -5
- package/scripts/langages/c/binaires.json +4 -0
- package/scripts/langages/c/binaires.mjs +83 -0
- package/scripts/langages/c/clang-format.mjs +62 -0
- package/scripts/langages/c/clang-tidy.mjs +93 -0
- package/scripts/langages/c/clang.mjs +42 -0
- package/scripts/langages/c/commandes.mjs +530 -0
- package/scripts/langages/c/composants.mjs +209 -0
- package/scripts/langages/c/exemples.mjs +250 -0
- package/scripts/langages/c/index-interfaces.mjs +77 -0
- package/scripts/langages/c/index.mjs +120 -0
- package/scripts/langages/c/lot.mjs +41 -0
- package/scripts/langages/c/mise-a-jour.mjs +70 -0
- package/scripts/langages/c/squelette.mjs +61 -0
- package/scripts/langages/c/verdict.mjs +99 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +16 -5
- package/scripts/langages-des-paquets.mjs +30 -2
- package/scripts/langages.mjs +1 -0
- package/scripts/mesure/avancement.mjs +1 -1
- package/scripts/migrations/0.47.0-ci-de-main.mjs +48 -0
- package/scripts/migrations.mjs +2 -2
- package/scripts/session-start.sh +0 -9
- package/scripts/sortie.mjs +1 -1
- package/scripts/superviseur.mjs +146 -88
- package/scripts/tableau.mjs +23 -8
- package/skills/grill/SKILL.md +6 -5
- package/skills/pitmaster/SKILL.md +9 -7
- package/skills/redacteur/references/documents-d-un-composant.md +1 -1
- package/scripts/ci-des-branches.mjs +0 -93
- package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +0 -31
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// The components of a project of C, as CMake finds a project: the packages the module c answers the
|
|
2
|
+
// join with (scripts/jointure.d.ts, `composants`, `composantDe`, `matieres`, `joueDesTests`,
|
|
3
|
+
// `lecteurs`, `estUnTest`, `manifestes`, `entreesDeLIndex`).
|
|
4
|
+
//
|
|
5
|
+
// - A component is a folder whose CMakeLists.txt calls `project(<nom>`, found under the root, the
|
|
6
|
+
// folders whose name begins with a dot (`.build-cmake` included) and those of LAISSES left out:
|
|
7
|
+
// its folder, its name and its package the name `project()` gives. The CMakeLists.txt of
|
|
8
|
+
// `tests/`, which calls no `project(`, is the package's matter, never a component. `project(` is
|
|
9
|
+
// read in any case, after the comments (`#`) are cut, a space before the parenthesis allowed,
|
|
10
|
+
// its name on the same line or the next. The language of a package is declared in the
|
|
11
|
+
// architecture; its CMakeLists.txt is there because CMake asks it.
|
|
12
|
+
// - The component of a file is the one of the longest folder that holds it.
|
|
13
|
+
// - No shared test material: a package of C shares its helpers with its tests under `tests/`.
|
|
14
|
+
// - A test file is a `tests/test_*.c` of the package: one executable and one CTest test, played. A
|
|
15
|
+
// component plays tests when it holds one.
|
|
16
|
+
// - What the testwriter writes: a `tests/test_*.c`, played (`joue`), and any other file under
|
|
17
|
+
// `tests/`, his helpers and his data (`matiere`, not played). The CMakeLists.txt of the package's
|
|
18
|
+
// root is the code's, which a change of his is refused, named (`manifestes`); no lock file.
|
|
19
|
+
// - The readers of a package: none read by the module; a name no component bears is without
|
|
20
|
+
// provider.
|
|
21
|
+
// - The entries of the index of the interfaces: one per component that holds a
|
|
22
|
+
// `docs/INTERFACE.md`, and the root's, as the module python's.
|
|
23
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
24
|
+
import path from 'node:path';
|
|
25
|
+
import { luUneFois } from '../../services-du-noyau.mjs';
|
|
26
|
+
|
|
27
|
+
export const MANIFESTE = 'CMakeLists.txt';
|
|
28
|
+
// The folders the search of the components leaves out, beside those that begin with a dot.
|
|
29
|
+
const LAISSES = new Set(['node_modules', 'target', 'dist']);
|
|
30
|
+
/** The folder of the tests of a package. */
|
|
31
|
+
export const TESTS = 'tests';
|
|
32
|
+
|
|
33
|
+
/** Whether <nom>, a file's name, is a test file CTest plays: `test_*.c`. */
|
|
34
|
+
export const estUnFichierDeTest = nom => /^test_.+\.c$/.test(nom);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The name the text of a CMakeLists.txt gives its project: the first argument of its `project(`,
|
|
38
|
+
* its comments cut; null for none.
|
|
39
|
+
* @param {string} texte
|
|
40
|
+
*/
|
|
41
|
+
export function nomDuManifeste(texte) {
|
|
42
|
+
const sans = texte
|
|
43
|
+
.split('\n')
|
|
44
|
+
.map(l => l.replace(/#.*$/, ''))
|
|
45
|
+
.join('\n');
|
|
46
|
+
const m = /(?:^|[^\w])project\s*\(\s*([^\s)]+)/i.exec(sans);
|
|
47
|
+
return m ? m[1].replace(/^"|"$/g, '') : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// The folders under <dossier> that hold a CMakeLists.txt with a project(, <dossier> included.
|
|
51
|
+
function dossiersAvecProjet(dossier) {
|
|
52
|
+
const f = path.join(dossier, MANIFESTE);
|
|
53
|
+
const nom = existsSync(f) ? nomDuManifeste(readFileSync(f, 'utf8')) : null;
|
|
54
|
+
const out = nom === null ? [] : [{ dossier, nom }];
|
|
55
|
+
for (const e of readdirSync(dossier, { withFileTypes: true })) {
|
|
56
|
+
if (e.isDirectory() && !e.name.startsWith('.') && !LAISSES.has(e.name)) {
|
|
57
|
+
out.push(...dossiersAvecProjet(path.join(dossier, e.name)));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The components of the project at <racine>, sorted by folder; read once in a scope of the core
|
|
64
|
+
* (`luUneFois`): a sweep asks it of every file of a folder. */
|
|
65
|
+
export function composants(racine) {
|
|
66
|
+
return luUneFois(`c composants ${path.resolve(racine)}`, () =>
|
|
67
|
+
dossiersAvecProjet(racine)
|
|
68
|
+
.sort((a, b) => (a.dossier < b.dossier ? -1 : a.dossier > b.dossier ? 1 : 0))
|
|
69
|
+
.map(({ dossier, nom }) => ({ dossier, nom, paquet: nom }))
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The component of <liste> that holds <fichier> (absolute, or from <racine>), the longest folder. */
|
|
74
|
+
export function composantDans(liste, racine, fichier) {
|
|
75
|
+
const abs = path.resolve(racine, fichier);
|
|
76
|
+
const tenants = liste.filter(c => abs === c.dossier || abs.startsWith(`${c.dossier}${path.sep}`));
|
|
77
|
+
return tenants.sort((a, b) => b.dossier.length - a.dossier.length)[0] ?? null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The test files of the package at <dossier> (absolute): its `tests/test_*.c`, sorted. */
|
|
81
|
+
export function fichiersDeTest(dossier) {
|
|
82
|
+
const tests = path.join(dossier, TESTS);
|
|
83
|
+
return existsSync(tests)
|
|
84
|
+
? readdirSync(tests, { withFileTypes: true })
|
|
85
|
+
.filter(e => e.isFile() && estUnFichierDeTest(e.name))
|
|
86
|
+
.map(e => path.join(tests, e.name))
|
|
87
|
+
.sort()
|
|
88
|
+
: [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Whether the component <composant> plays tests: it holds a `tests/test_*.c`. */
|
|
92
|
+
export const joueDesTests = (_racine, composant) => fichiersDeTest(composant.dossier).length > 0;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* What the testwriter writes in <chemin>, absolute or from <racine>: `{ joue, test, matiere }`, or
|
|
96
|
+
* null for a file he does not write.
|
|
97
|
+
*/
|
|
98
|
+
export function estUnTest(chemin, racine) {
|
|
99
|
+
const abs = path.resolve(racine, chemin);
|
|
100
|
+
const c = composantDans(composants(racine), racine, abs);
|
|
101
|
+
if (!c) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const parts = path.relative(c.dossier, abs).split(path.sep);
|
|
105
|
+
if (parts[0] !== TESTS || parts.length < 2) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
if (parts.length === 2 && estUnFichierDeTest(parts[1])) {
|
|
109
|
+
return { joue: true, test: true, matiere: false };
|
|
110
|
+
}
|
|
111
|
+
return { joue: false, test: true, matiere: false };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The parts of the CMakeLists.txt of a package's root that change from <avant> to <apres>: the
|
|
116
|
+
* file whole, which is the code's, never the testwriter's. Null for any other file.
|
|
117
|
+
*/
|
|
118
|
+
function horsDesTests(chemin, racine, avant, apres) {
|
|
119
|
+
const abs = path.resolve(racine, chemin);
|
|
120
|
+
const c = composants(racine).find(x => x.dossier === path.dirname(abs));
|
|
121
|
+
if (!c || path.basename(abs) !== MANIFESTE) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return (avant ?? '') === (apres ?? '') ? [] : [`${MANIFESTE} de ${c.nom}, le fichier entier`];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** What the testwriter writes of the manifests (scripts/jointure.d.ts, `manifestes`): no lock
|
|
128
|
+
* file, and a root CMakeLists.txt refused. */
|
|
129
|
+
export const manifestes = { verrous: [], horsDesTests };
|
|
130
|
+
|
|
131
|
+
/** The internal dependencies of a CMakeLists.txt: none read by the module. */
|
|
132
|
+
export const liensDuManifeste = () => ({ noms: [], table: MANIFESTE, outil: 'cmake' });
|
|
133
|
+
|
|
134
|
+
/** The readers of the packages <noms>: none; a name no component bears, without provider. */
|
|
135
|
+
export function lecteurs(_racine, { composants: liste, noms }) {
|
|
136
|
+
const elements = [];
|
|
137
|
+
const sansFournisseur = [];
|
|
138
|
+
for (const nom of noms) {
|
|
139
|
+
const fournisseur = liste.find(c => c.paquet === nom || c.nom === nom);
|
|
140
|
+
if (fournisseur) {
|
|
141
|
+
elements.push({ nom, fournisseur, lecteurs: [] });
|
|
142
|
+
} else {
|
|
143
|
+
sansFournisseur.push(nom);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
elements,
|
|
148
|
+
sansFournisseur,
|
|
149
|
+
types: { etat: 'fait', raison: null, elements: [] },
|
|
150
|
+
lit: new Map(liste.map(c => [c, new Set()])),
|
|
151
|
+
parLesTests: new Map(liste.map(c => [c, new Set()])),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const premierePhrase = lignes => {
|
|
156
|
+
const texte = lignes.join(' ').replace(/\s+/g, ' ').trim();
|
|
157
|
+
return /^(.+?[.!?])(\s|$)/.exec(texte)?.[1] ?? texte;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// The interface of the root.
|
|
161
|
+
const RACINE = 'docs/INTERFACE.md';
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The entries of the index of the interfaces of <racine> (`entreesDeLIndex`): `{ rel, lignes }`
|
|
165
|
+
* for each `<composant>/docs/INTERFACE.md`, and for the root's `docs/INTERFACE.md`, by path; the
|
|
166
|
+
* heading the title alone when it begins with the component's name, else `<composant> — <titre>`,
|
|
167
|
+
* the root's `(racine)` when no package lies at the root, as the module python's.
|
|
168
|
+
*/
|
|
169
|
+
export function entreesDeLIndex(racine) {
|
|
170
|
+
const parRel = new Map();
|
|
171
|
+
for (const c of composants(racine)) {
|
|
172
|
+
const rel = path.relative(racine, path.join(c.dossier, 'docs', 'INTERFACE.md'));
|
|
173
|
+
if (existsSync(path.join(racine, rel))) {
|
|
174
|
+
parRel.set(rel.split(path.sep).join('/'), c.nom);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (existsSync(path.join(racine, RACINE)) && !parRel.has(RACINE)) {
|
|
178
|
+
parRel.set(RACINE, '(racine)');
|
|
179
|
+
}
|
|
180
|
+
return [...parRel]
|
|
181
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
182
|
+
.map(([rel, nom]) => {
|
|
183
|
+
const lignes = readFileSync(path.join(racine, rel), 'utf8').split('\n');
|
|
184
|
+
const t = lignes.findIndex(l => l.startsWith('# '));
|
|
185
|
+
const titre = t >= 0 ? lignes[t].slice(2).trim() : nom;
|
|
186
|
+
const paragraphe = [];
|
|
187
|
+
for (const l of lignes.slice(t + 1)) {
|
|
188
|
+
if (/^#{1,6} /.test(l) || (!l.trim() && paragraphe.length)) {
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (l.trim()) {
|
|
192
|
+
paragraphe.push(l.trim());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const parSonNom =
|
|
196
|
+
nom !== '(racine)' &&
|
|
197
|
+
titre.startsWith(nom) &&
|
|
198
|
+
(titre.length === nom.length || /\s/.test(titre[nom.length]));
|
|
199
|
+
return {
|
|
200
|
+
rel,
|
|
201
|
+
lignes: [
|
|
202
|
+
`## ${parSonNom ? titre : `${nom} — ${titre}`}`,
|
|
203
|
+
'',
|
|
204
|
+
`${premierePhrase(paragraphe)} (\`${rel}\`)`,
|
|
205
|
+
'',
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// The entries of the suite of conformity (scripts/conformite.mjs) for the module c, as the valid
|
|
2
|
+
// and invalid cases a rule of ESLint gives its RuleTester: each a trial, built under the directory
|
|
3
|
+
// the suite gives, with what a sound module answers on it.
|
|
4
|
+
//
|
|
5
|
+
// - A project of two packages, declared c in its architecture: `capteur` (its project `capteur`,
|
|
6
|
+
// a test of the day `tests/test_capteur.c`, a helper, the CMakeLists.txt of tests/, its
|
|
7
|
+
// interface) and `outil` (its project `outil`, no test); the root's interface, and the index of
|
|
8
|
+
// the interfaces they give, up to date. Committed: `projet`; the same with a second commit that
|
|
9
|
+
// changes `capteur`, adds the package `neuf` and removes `outil`: `lot`; the same, the interface
|
|
10
|
+
// of `capteur` then changed, its index late: `enRetard`.
|
|
11
|
+
// - A directory without CMakeLists.txt: `vide`.
|
|
12
|
+
// - Two results directories of a run: every task and test green (`vert`); `capteur` red with a
|
|
13
|
+
// test failed, `outil` at 75, a task not played (`defaut`).
|
|
14
|
+
// - `depots`: the repositories, for the tests of the module beside the suite.
|
|
15
|
+
import { execFileSync } from 'node:child_process';
|
|
16
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
|
|
19
|
+
const ecrireDans = racine => (rel, texte) => {
|
|
20
|
+
mkdirSync(path.dirname(path.join(racine, rel)), { recursive: true });
|
|
21
|
+
writeFileSync(path.join(racine, rel), texte);
|
|
22
|
+
};
|
|
23
|
+
const git = (racine, ...args) => execFileSync('git', ['-C', racine, ...args], { stdio: 'pipe' });
|
|
24
|
+
const tete = racine =>
|
|
25
|
+
execFileSync('git', ['-C', racine, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim();
|
|
26
|
+
|
|
27
|
+
// Commits every file of <racine>, a new repository.
|
|
28
|
+
function engager(racine) {
|
|
29
|
+
git(racine, 'init', '-q', '-b', 'main');
|
|
30
|
+
git(racine, 'config', 'user.email', 'essai@example.com');
|
|
31
|
+
git(racine, 'config', 'user.name', 'essai');
|
|
32
|
+
git(racine, 'config', 'commit.gpgsign', 'false');
|
|
33
|
+
git(racine, 'add', '-A');
|
|
34
|
+
git(racine, 'commit', '-q', '-m', 'essai');
|
|
35
|
+
return racine;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The CMakeLists.txt of the project <nom>.
|
|
39
|
+
const manifeste = nom => `cmake_minimum_required(VERSION 3.16)\nproject(${nom} C)\n`;
|
|
40
|
+
|
|
41
|
+
const ARCHITECTURE =
|
|
42
|
+
'# Architecture\n\n| Composant | Langage |\n| --- | --- |\n| `capteur` | c |\n| `outil` | c |\n| `neuf` | c |\n';
|
|
43
|
+
const INTERFACES = {
|
|
44
|
+
'capteur/docs/INTERFACE.md':
|
|
45
|
+
'# capteur — interface\n\n`capteur` lit les mesures. Une seconde phrase.\n',
|
|
46
|
+
'docs/INTERFACE.md': "# Le projet d'essai\n\nDeux paquets C.\n",
|
|
47
|
+
};
|
|
48
|
+
/** The index of the interfaces the trial gives (./index-interfaces.mjs). */
|
|
49
|
+
export const INDEX = [
|
|
50
|
+
'# Index des interfaces',
|
|
51
|
+
'',
|
|
52
|
+
'Généré depuis les `INTERFACE.md` des paquets C ; ne pas éditer.',
|
|
53
|
+
"Une ligne par composant ; l'interface donne le détail.",
|
|
54
|
+
'',
|
|
55
|
+
'## capteur — interface',
|
|
56
|
+
'',
|
|
57
|
+
'`capteur` lit les mesures. (`capteur/docs/INTERFACE.md`)',
|
|
58
|
+
'',
|
|
59
|
+
"## (racine) — Le projet d'essai",
|
|
60
|
+
'',
|
|
61
|
+
'Deux paquets C. (`docs/INTERFACE.md`)',
|
|
62
|
+
'',
|
|
63
|
+
].join('\n');
|
|
64
|
+
|
|
65
|
+
// The project of the two packages in a new directory under <dans>, committed.
|
|
66
|
+
function projet(dans) {
|
|
67
|
+
const racine = mkdtempSync(path.join(dans, 'projet-'));
|
|
68
|
+
const ecrire = ecrireDans(racine);
|
|
69
|
+
ecrire('package.json', JSON.stringify({ name: 'essai', private: true }));
|
|
70
|
+
ecrire('docs/ARCHITECTURE.md', ARCHITECTURE);
|
|
71
|
+
ecrire('README.md', "# Le projet d'essai\n");
|
|
72
|
+
ecrire('.gitignore', '.build-cmake\n');
|
|
73
|
+
ecrire('capteur/CMakeLists.txt', manifeste('capteur'));
|
|
74
|
+
ecrire('capteur/src/capteur.c', 'int capteur(void) { return 1; }\n');
|
|
75
|
+
ecrire('capteur/tests/CMakeLists.txt', 'file(GLOB TESTS CONFIGURE_DEPENDS test_*.c)\n');
|
|
76
|
+
ecrire('capteur/tests/test_capteur.c', 'int main(void) { return 0; }\n');
|
|
77
|
+
ecrire('capteur/tests/aide.h', '#define AIDE 1\n');
|
|
78
|
+
ecrire('outil/CMakeLists.txt', manifeste('outil'));
|
|
79
|
+
ecrire('outil/src/outil.c', 'int outil(void) { return 1; }\n');
|
|
80
|
+
for (const [f, t] of Object.entries(INTERFACES)) {
|
|
81
|
+
ecrire(f, t);
|
|
82
|
+
}
|
|
83
|
+
ecrire('docs/agents/index-des-interfaces.md', INDEX);
|
|
84
|
+
return engager(racine);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// A results directory under <dans>: the tasks <taches> (`[paquet, script, code]`), and the JUnit
|
|
88
|
+
// report of `capteur` (`[[test, echoue]…]`), its folder <dossier>.
|
|
89
|
+
function resultats(dans, taches, cas, dossier) {
|
|
90
|
+
const d = mkdtempSync(path.join(dans, 'resultats-'));
|
|
91
|
+
const ecrire = ecrireDans(d);
|
|
92
|
+
ecrire(
|
|
93
|
+
'c/1-1.json',
|
|
94
|
+
`${JSON.stringify({
|
|
95
|
+
taches: taches.map(([paquet, script, code]) => ({
|
|
96
|
+
tache: `${paquet}#${script}`,
|
|
97
|
+
paquet,
|
|
98
|
+
dossier: paquet,
|
|
99
|
+
script,
|
|
100
|
+
tests: script === 'ctest',
|
|
101
|
+
code,
|
|
102
|
+
cache: null,
|
|
103
|
+
journal: null,
|
|
104
|
+
})),
|
|
105
|
+
rapports: { '1-1-capteur.xml': dossier },
|
|
106
|
+
})}\n`
|
|
107
|
+
);
|
|
108
|
+
const corps = cas
|
|
109
|
+
.map(
|
|
110
|
+
([test, echoue]) =>
|
|
111
|
+
`<testcase name="${test}" classname="${test}" time="0.001" status="${echoue ? 'fail' : 'run'}">${
|
|
112
|
+
echoue ? '<failure message="Failed"/><system-out>attendu 1, obtenu 2</system-out>' : ''
|
|
113
|
+
}</testcase>`
|
|
114
|
+
)
|
|
115
|
+
.join('');
|
|
116
|
+
ecrire(
|
|
117
|
+
'ctest/1-1-capteur.xml',
|
|
118
|
+
`<?xml version="1.0" encoding="UTF-8"?><testsuite name="(empty)">${corps}</testsuite>`
|
|
119
|
+
);
|
|
120
|
+
return d;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export default {
|
|
124
|
+
// The trials under <dans>.
|
|
125
|
+
preparer(dans) {
|
|
126
|
+
const aJour = projet(dans);
|
|
127
|
+
const vide = mkdtempSync(path.join(dans, 'vide-'));
|
|
128
|
+
writeFileSync(path.join(vide, 'README.md'), 'aucun paquet\n');
|
|
129
|
+
const lot = projet(dans);
|
|
130
|
+
const avantLeLot = tete(lot);
|
|
131
|
+
const ecrireLot = ecrireDans(lot);
|
|
132
|
+
ecrireLot('capteur/src/capteur.c', 'int capteur(void) { return 3; }\n');
|
|
133
|
+
ecrireLot('neuf/CMakeLists.txt', manifeste('neuf'));
|
|
134
|
+
ecrireLot('neuf/src/neuf.c', 'int neuf(void) { return 1; }\n');
|
|
135
|
+
rmSync(path.join(lot, 'outil'), { recursive: true, force: true });
|
|
136
|
+
git(lot, 'add', '-A');
|
|
137
|
+
git(lot, 'commit', '-q', '-m', 'lot');
|
|
138
|
+
const enRetard = projet(dans);
|
|
139
|
+
writeFileSync(
|
|
140
|
+
path.join(enRetard, 'capteur/docs/INTERFACE.md'),
|
|
141
|
+
'# capteur — interface\n\n`capteur` lit d’autres mesures.\n'
|
|
142
|
+
);
|
|
143
|
+
const capteur = path.join(aJour, 'capteur');
|
|
144
|
+
return {
|
|
145
|
+
racine: aJour,
|
|
146
|
+
depots: { projet: aJour, lot, avantLeLot, enRetard, vide },
|
|
147
|
+
composants: {
|
|
148
|
+
valide: vide,
|
|
149
|
+
invalide: aJour,
|
|
150
|
+
attendu: ['capteur (capteur)', 'outil (outil)'],
|
|
151
|
+
},
|
|
152
|
+
composantDe: {
|
|
153
|
+
valide: [
|
|
154
|
+
{ fichier: 'capteur/src/capteur.c', composant: 'capteur' },
|
|
155
|
+
{ fichier: 'outil/src/outil.c', composant: 'outil' },
|
|
156
|
+
{ fichier: path.join(aJour, 'capteur/CMakeLists.txt'), composant: 'capteur' },
|
|
157
|
+
],
|
|
158
|
+
invalide: [{ fichier: 'README.md' }, { fichier: 'docs/INTERFACE.md' }],
|
|
159
|
+
attendu: [
|
|
160
|
+
'README.md : hors de tout composant',
|
|
161
|
+
'docs/INTERFACE.md : hors de tout composant',
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
lecteurs: {
|
|
165
|
+
valide: { racine: vide, noms: [] },
|
|
166
|
+
invalide: { racine: aJour, noms: ['capteur', 'absent'] },
|
|
167
|
+
attendu: ['absent : sans fournisseur'],
|
|
168
|
+
},
|
|
169
|
+
commandes: {
|
|
170
|
+
valide: ['tester', 'verifier', 'typer', 'construire', 'index-interfaces'],
|
|
171
|
+
invalide: ['tester', 'deployer'],
|
|
172
|
+
attendu: ['deployer : absente'],
|
|
173
|
+
},
|
|
174
|
+
verdict: {
|
|
175
|
+
valide: resultats(
|
|
176
|
+
dans,
|
|
177
|
+
[
|
|
178
|
+
['capteur', 'compile', 0],
|
|
179
|
+
['capteur', 'ctest', 0],
|
|
180
|
+
],
|
|
181
|
+
[['test_capteur', false]],
|
|
182
|
+
capteur
|
|
183
|
+
),
|
|
184
|
+
invalide: resultats(
|
|
185
|
+
dans,
|
|
186
|
+
[
|
|
187
|
+
['outil', 'compile', 75],
|
|
188
|
+
['capteur', 'ctest', 1],
|
|
189
|
+
['neuf', 'ctest', null],
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
['test_capteur', false],
|
|
193
|
+
['test_rendu', true],
|
|
194
|
+
],
|
|
195
|
+
capteur
|
|
196
|
+
),
|
|
197
|
+
attendu: [
|
|
198
|
+
'outil#compile à repasser',
|
|
199
|
+
'capteur#ctest rouge (1), tests',
|
|
200
|
+
'test test_rendu.c › test_rendu',
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
estUnTest: {
|
|
204
|
+
valide: [
|
|
205
|
+
'capteur/src/capteur.c',
|
|
206
|
+
'capteur/CMakeLists.txt',
|
|
207
|
+
'outil/src/outil.c',
|
|
208
|
+
'README.md',
|
|
209
|
+
],
|
|
210
|
+
invalide: [
|
|
211
|
+
'capteur/tests/test_capteur.c',
|
|
212
|
+
'capteur/tests/aide.h',
|
|
213
|
+
'capteur/tests/CMakeLists.txt',
|
|
214
|
+
],
|
|
215
|
+
attendu: [
|
|
216
|
+
'capteur/tests/test_capteur.c : joue, test',
|
|
217
|
+
'capteur/tests/aide.h : test',
|
|
218
|
+
'capteur/tests/CMakeLists.txt : test',
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
fichiersEngendres: {
|
|
222
|
+
valide: aJour,
|
|
223
|
+
invalide: enRetard,
|
|
224
|
+
attendu: ["l'index des interfaces : en retard"],
|
|
225
|
+
},
|
|
226
|
+
gardes: { valide: ['index-interfaces'] },
|
|
227
|
+
elementsDuLot: {
|
|
228
|
+
valide: { racine: aJour, avant: 'HEAD', apres: 'HEAD' },
|
|
229
|
+
invalide: { racine: lot, avant: avantLeLot, apres: 'HEAD' },
|
|
230
|
+
attendu: [
|
|
231
|
+
'fichier capteur/src/capteur.c',
|
|
232
|
+
'fichier neuf/CMakeLists.txt',
|
|
233
|
+
'fichier neuf/src/neuf.c',
|
|
234
|
+
'fichier outil/CMakeLists.txt',
|
|
235
|
+
'fichier outil/src/outil.c',
|
|
236
|
+
'hors du service capteur/src/capteur.c',
|
|
237
|
+
'hors du service neuf/src/neuf.c',
|
|
238
|
+
'hors du service outil/src/outil.c',
|
|
239
|
+
],
|
|
240
|
+
},
|
|
241
|
+
// No shared test material in C (./composants.mjs): the case has no defective entry.
|
|
242
|
+
matieres: { valide: aJour, invalide: aJour, attendu: [] },
|
|
243
|
+
joueDesTests: {
|
|
244
|
+
valide: vide,
|
|
245
|
+
invalide: aJour,
|
|
246
|
+
attendu: ['capteur (capteur) : joue des tests'],
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
},
|
|
250
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The index of the interfaces of a project of C: one line per package, from its
|
|
3
|
+
// `docs/INTERFACE.md`, and one for the root's, which an agent loads at start before opening an
|
|
4
|
+
// interface; a generated file of the module (`fichiersEngendres` of ./index.mjs), as the module
|
|
5
|
+
// python's (../python/index-interfaces.mjs), whose file and form it keeps. In a project of several
|
|
6
|
+
// languages the core's index takes its place, assembled from each module's entries.
|
|
7
|
+
//
|
|
8
|
+
// node index-interfaces.mjs writes docs/agents/index-des-interfaces.md
|
|
9
|
+
// node index-interfaces.mjs --verifier refuses (exit 1) when that file is out of date, its
|
|
10
|
+
// finding in SARIF too (../../resultats.mjs)
|
|
11
|
+
// node index-interfaces.mjs --publie <composant>
|
|
12
|
+
// prints nothing: a package's interface names no
|
|
13
|
+
// consumer, which the launcher reads (lancer.sh)
|
|
14
|
+
//
|
|
15
|
+
// - The entries are those of ./composants.mjs (`entreesDeLIndex`), in their paths' order.
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
19
|
+
import { ecrireSarif } from '../../resultats.mjs';
|
|
20
|
+
import { entreesDeLIndex } from './composants.mjs';
|
|
21
|
+
|
|
22
|
+
export const SORTIE = 'docs/agents/index-des-interfaces.md';
|
|
23
|
+
export const GARDE = 'index-interfaces';
|
|
24
|
+
const ICI = fileURLToPath(import.meta.url);
|
|
25
|
+
|
|
26
|
+
/** The index of the interfaces of the project at <racine>, as its file holds it. */
|
|
27
|
+
export function index(racine) {
|
|
28
|
+
return [
|
|
29
|
+
'# Index des interfaces',
|
|
30
|
+
'',
|
|
31
|
+
'Généré depuis les `INTERFACE.md` des paquets C ; ne pas éditer.',
|
|
32
|
+
"Une ligne par composant ; l'interface donne le détail.",
|
|
33
|
+
'',
|
|
34
|
+
...entreesDeLIndex(racine).flatMap(e => e.lignes),
|
|
35
|
+
].join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The findings of the check of the index at <racine>: none when its file is up to date. */
|
|
39
|
+
export function enRetard(racine) {
|
|
40
|
+
const cible = path.join(racine, SORTIE);
|
|
41
|
+
const present = existsSync(cible) ? readFileSync(cible, 'utf8') : '';
|
|
42
|
+
return present === index(racine)
|
|
43
|
+
? []
|
|
44
|
+
: [
|
|
45
|
+
{
|
|
46
|
+
fichier: SORTIE,
|
|
47
|
+
message: `${SORTIE} n'est pas à jour avec les interfaces : sa commande le régénère (node ${JSON.stringify(ICI)}).`,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Runs the command in the project at <racine> with <args>: its exit code.
|
|
54
|
+
* @param {string} racine
|
|
55
|
+
* @param {string[]} args `--verifier` to check, `--publie` to print nothing, nothing to write
|
|
56
|
+
* @param {{ env?: NodeJS.ProcessEnv }} [o]
|
|
57
|
+
*/
|
|
58
|
+
export function commande(racine, args, { env = process.env } = {}) {
|
|
59
|
+
if (args.includes('--publie')) {
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
if (!args.includes('--verifier')) {
|
|
63
|
+
mkdirSync(path.dirname(path.join(racine, SORTIE)), { recursive: true });
|
|
64
|
+
writeFileSync(path.join(racine, SORTIE), index(racine));
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
const refus = enRetard(racine);
|
|
68
|
+
for (const r of refus) {
|
|
69
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
70
|
+
}
|
|
71
|
+
ecrireSarif({ garde: GARDE, racine, constats: refus, env });
|
|
72
|
+
return refus.length ? 1 : 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
76
|
+
process.exitCode = commande(process.cwd(), process.argv.slice(2));
|
|
77
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// The module of language c: what the core asks of a language (scripts/jointure.d.ts,
|
|
2
|
+
// docs/INTERFACE.md), answered for the packages of C by CMake and CTest, as Bazel's rules_cc
|
|
3
|
+
// builds them. The core loads it by scripts/langages.mjs, and this module imports of the core its
|
|
4
|
+
// published entries alone.
|
|
5
|
+
//
|
|
6
|
+
// - The manifest of its package, which the guard of the languages asks of a package the
|
|
7
|
+
// architecture declares c (`manifeste`): a CMakeLists.txt whose `project(<nom>` names the
|
|
8
|
+
// component (./composants.mjs). Its one tool of npm is Turborepo, which plays the tasks of the
|
|
9
|
+
// projects (`outils`); cmake and ctest live on the machine, required of the poste (`executables`).
|
|
10
|
+
// What CMake writes in a project: `.build-cmake`, one directory per package (`ignorer`).
|
|
11
|
+
// - Where it writes, which the envelope opens to a session (`sorties`): `.build-cmake/` at the
|
|
12
|
+
// root. The rule that refuses a role that writes ctest run directly (`droits`).
|
|
13
|
+
// - The packages, a file's, the test files, what the testwriter writes, of the manifests too, the
|
|
14
|
+
// readers, the entries of the index of the interfaces (./composants.mjs); the elements of a lot
|
|
15
|
+
// (./lot.mjs).
|
|
16
|
+
// - The commands `tester`, `tests-du-paquet`, `verifier`, `typer` and `construire`
|
|
17
|
+
// (./commandes.mjs), each described, never run, and the verdict of a run (./verdict.mjs); the
|
|
18
|
+
// index of the interfaces up to date, a command and a guard by its name (./index-interfaces.mjs).
|
|
19
|
+
// No guard of the sizes of the tests, no night test, no migration yet.
|
|
20
|
+
// - Its share of the update (./mise-a-jour.mjs): the template `templates/c/`, its test scripts and
|
|
21
|
+
// the generator of the index.
|
|
22
|
+
// - The skeleton of a new package (./squelette.mjs, `squelette`), which `grillhouse paquet` writes.
|
|
23
|
+
import { readFileSync } from 'node:fs';
|
|
24
|
+
import path from 'node:path';
|
|
25
|
+
import { fileURLToPath } from 'node:url';
|
|
26
|
+
import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
|
|
27
|
+
import { CONSTRUCTION, commandes, echecDeCompilation, GARDES } from './commandes.mjs';
|
|
28
|
+
import {
|
|
29
|
+
composantDans,
|
|
30
|
+
composants,
|
|
31
|
+
entreesDeLIndex,
|
|
32
|
+
estUnTest,
|
|
33
|
+
joueDesTests,
|
|
34
|
+
lecteurs,
|
|
35
|
+
liensDuManifeste,
|
|
36
|
+
manifestes,
|
|
37
|
+
MANIFESTE,
|
|
38
|
+
nomDuManifeste,
|
|
39
|
+
} from './composants.mjs';
|
|
40
|
+
import { enRetard, SORTIE } from './index-interfaces.mjs';
|
|
41
|
+
import { elementsDuLot } from './lot.mjs';
|
|
42
|
+
import { miseAJour } from './mise-a-jour.mjs';
|
|
43
|
+
import { squelette } from './squelette.mjs';
|
|
44
|
+
import { verdict } from './verdict.mjs';
|
|
45
|
+
|
|
46
|
+
const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
nom: 'c',
|
|
50
|
+
// The expected size of a copy before any is measured: its construction, a few MB (2026-11-20).
|
|
51
|
+
tailleDUneCopie: 1024 ** 3,
|
|
52
|
+
manifeste: MANIFESTE,
|
|
53
|
+
nomDuManifeste,
|
|
54
|
+
liensDuManifeste,
|
|
55
|
+
construireLesPaquets: () => {
|
|
56
|
+
throw new Error('construction non prise en charge pour c');
|
|
57
|
+
},
|
|
58
|
+
// No output of a package of C is a datum of another package's tests.
|
|
59
|
+
sortieDuPaquet: () => {
|
|
60
|
+
throw new Error('sortie non prise en charge pour c');
|
|
61
|
+
},
|
|
62
|
+
// Turborepo, which plays the tasks of the projects (./commandes.mjs).
|
|
63
|
+
outils: ['turbo'],
|
|
64
|
+
// The programs the installer of Temporal requires in the PATH of the workers, and the poste.
|
|
65
|
+
executables: ['cmake', 'ctest'],
|
|
66
|
+
// uv at the version of the module python's file (one source), first, then the clang tools.
|
|
67
|
+
binaires: {
|
|
68
|
+
uv: JSON.parse(readFileSync(ici('../python/binaires.json'), 'utf8')).uv,
|
|
69
|
+
...JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
|
|
70
|
+
},
|
|
71
|
+
ignorer: [CONSTRUCTION],
|
|
72
|
+
sorties: {
|
|
73
|
+
ecrites: [`${CONSTRUCTION}/`],
|
|
74
|
+
propres: [],
|
|
75
|
+
lues: [
|
|
76
|
+
'~/.local/bin/uv',
|
|
77
|
+
'~/.local/bin/clang-format',
|
|
78
|
+
'~/.local/bin/clang-tidy',
|
|
79
|
+
'~/.local/share/uv/tools/',
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
// ctest run directly: `npm test` and `npm run verifier` play it.
|
|
83
|
+
droits: ['Bash(ctest*)'],
|
|
84
|
+
composants,
|
|
85
|
+
composantDe: (racine, fichier) => composantDans(composants(racine), racine, fichier),
|
|
86
|
+
matieres: () => [],
|
|
87
|
+
joueDesTests,
|
|
88
|
+
lecteurs,
|
|
89
|
+
elementsDuLot,
|
|
90
|
+
// The remote cache of Turborepo on the poste, as the other modules play by Turborepo.
|
|
91
|
+
environnementDuPoste: env =>
|
|
92
|
+
avecLeFichierDuPoste(env, {
|
|
93
|
+
fichier: 'turbo-cache.env',
|
|
94
|
+
ajouts: { TURBO_CACHE: 'local:rw,remote:r' },
|
|
95
|
+
}),
|
|
96
|
+
empreintes: (racine, noms) => empreintesDesTaches('turbo', racine, noms),
|
|
97
|
+
commandes,
|
|
98
|
+
verdict,
|
|
99
|
+
echecDeCompilation,
|
|
100
|
+
estUnTest,
|
|
101
|
+
// No night test in C yet.
|
|
102
|
+
horsDuJour: () => false,
|
|
103
|
+
manifestes,
|
|
104
|
+
fichiersEngendres: () => [
|
|
105
|
+
{
|
|
106
|
+
nom: "l'index des interfaces",
|
|
107
|
+
commande: `node ${JSON.stringify(ici('index-interfaces.mjs'))}`,
|
|
108
|
+
fichiers: [SORTIE],
|
|
109
|
+
lit: ['docs/INTERFACE.md', '**/docs/INTERFACE.md'],
|
|
110
|
+
gardes: ['index-interfaces'],
|
|
111
|
+
entiers: [SORTIE],
|
|
112
|
+
verifier: enRetard,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
entreesDeLIndex,
|
|
116
|
+
gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
|
|
117
|
+
migrations: [],
|
|
118
|
+
miseAJour,
|
|
119
|
+
squelette,
|
|
120
|
+
};
|