@roomi-fields/grillhouse 0.46.0 → 0.47.1

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.
Files changed (66) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +20 -0
  3. package/cadre/templates/c/package.json +19 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +34 -49
  5. package/cadre/templates/projet/CLAUDE.md +6 -0
  6. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  7. package/charte.md +17 -9
  8. package/dist/temporal/circuit/client.d.ts +14 -5
  9. package/dist/temporal/circuit/client.js +39 -9
  10. package/dist/temporal/circuit/client.js.map +1 -1
  11. package/dist/temporal/file/activites.d.ts +2 -0
  12. package/dist/temporal/file/activites.js +7 -0
  13. package/dist/temporal/file/activites.js.map +1 -1
  14. package/dist/temporal/file/contrat.d.ts +26 -18
  15. package/dist/temporal/file/contrat.js +8 -5
  16. package/dist/temporal/file/contrat.js.map +1 -1
  17. package/dist/temporal/file/deroule.d.ts +1 -1
  18. package/dist/temporal/file/deroule.js +91 -42
  19. package/dist/temporal/file/deroule.js.map +1 -1
  20. package/dist/temporal/tickets/activites.js +4 -13
  21. package/dist/temporal/tickets/activites.js.map +1 -1
  22. package/docs/ARCHITECTURE.md +117 -82
  23. package/docs/INTERFACE.md +36 -19
  24. package/hooks/register.tsx +1 -1
  25. package/package.json +1 -1
  26. package/scripts/activites.mjs +5 -11
  27. package/scripts/arbres-juges.mjs +59 -0
  28. package/scripts/avancement.mjs +2 -38
  29. package/scripts/branche-de-nuit.mjs +14 -45
  30. package/scripts/ci-de-main.mjs +276 -0
  31. package/scripts/circuit.mjs +2 -1
  32. package/scripts/commandes-composees.mjs +36 -6
  33. package/scripts/dernier-vert.mjs +12 -8
  34. package/scripts/etapes.mjs +1 -1
  35. package/scripts/faits-du-circuit.mjs +41 -25
  36. package/scripts/integration/file.mjs +126 -587
  37. package/scripts/integration/integrer.mjs +6 -5
  38. package/scripts/langages/c/binaires.json +4 -0
  39. package/scripts/langages/c/binaires.mjs +83 -0
  40. package/scripts/langages/c/clang-format.mjs +62 -0
  41. package/scripts/langages/c/clang-tidy.mjs +93 -0
  42. package/scripts/langages/c/clang.mjs +42 -0
  43. package/scripts/langages/c/commandes.mjs +530 -0
  44. package/scripts/langages/c/composants.mjs +209 -0
  45. package/scripts/langages/c/exemples.mjs +250 -0
  46. package/scripts/langages/c/index-interfaces.mjs +77 -0
  47. package/scripts/langages/c/index.mjs +120 -0
  48. package/scripts/langages/c/lot.mjs +41 -0
  49. package/scripts/langages/c/mise-a-jour.mjs +70 -0
  50. package/scripts/langages/c/squelette.mjs +61 -0
  51. package/scripts/langages/c/verdict.mjs +99 -0
  52. package/scripts/langages/typescript/turbo-des-paquets.mjs +16 -5
  53. package/scripts/langages-des-paquets.mjs +30 -2
  54. package/scripts/langages.mjs +1 -0
  55. package/scripts/mesure/avancement.mjs +1 -1
  56. package/scripts/migrations/0.47.0-ci-de-main.mjs +48 -0
  57. package/scripts/migrations.mjs +2 -2
  58. package/scripts/session-start.sh +0 -9
  59. package/scripts/sortie.mjs +1 -1
  60. package/scripts/superviseur.mjs +146 -88
  61. package/scripts/tableau.mjs +23 -8
  62. package/skills/grill/SKILL.md +6 -5
  63. package/skills/pitmaster/SKILL.md +9 -7
  64. package/skills/redacteur/references/documents-d-un-composant.md +1 -1
  65. package/scripts/ci-des-branches.mjs +0 -93
  66. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +0 -31
@@ -39,9 +39,10 @@
39
39
  // install that fails refuses the lot, « Les dépendances de la copie ne s'installent pas. »;
40
40
  // then the references regenerate (below);
41
41
  // 6. the commit in the copy, its hooks included, under GRILLHOUSE_INTEGRATION=1: a pre-commit
42
- // hook that plays the guards skips them, as the CI of the ticket's branch plays them; nothing
43
- // is verified here: the queue pushes the branch, and its CI judges the lot before main moves
44
- // (scripts/integration/file.mjs); the commit committed is the commit the CI judges;
42
+ // hook that plays the guards skips them, as the final pass plays them; nothing is verified
43
+ // here: the queue lays the branch on the tip of main, and its final pass judges the lot before
44
+ // main moves (scripts/integration/file.mjs); the commit committed is the commit that pass
45
+ // judges;
45
46
  // 7. the branch `agent/<ticket>` is set on that commit, the ticket's copy follows it and is
46
47
  // removed by `scripts/retirer-copie.sh` (no `--jetable`; `--garder-travail`: the working
47
48
  // directory of the ticket's circuit, `<copie>.travail`, stays for the circuit that still runs,
@@ -534,8 +535,8 @@ function main(argv) {
534
535
  dire(`✓ références régénérées sur main à jour : ${aRejouer.map(r => r.nom).join(', ')}`);
535
536
  }
536
537
 
537
- // 6. The commit, in the copy: the commit committed is the commit the CI of the branch judges.
538
- // The guards run in that CI: a pre-commit hook that plays them skips them under
538
+ // 6. The commit, in the copy: the commit committed is the commit the final pass judges.
539
+ // The guards run in that pass: a pre-commit hook that plays them skips them under
539
540
  // GRILLHOUSE_INTEGRATION=1; commit-msg (a closed ticket refuses a second commit, a reopened one
540
541
  // takes its corrections) runs as always.
541
542
  const c = spawnSync(
@@ -0,0 +1,4 @@
1
+ {
2
+ "clang-format": "21.1.8",
3
+ "clang-tidy": "21.1.6"
4
+ }
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ // The installation of the binaries of the module c, the commands its share of the update describes
3
+ // (`miseAJour.installation`, scripts/jointure.d.ts), which the core runs.
4
+ //
5
+ // node binaires.mjs liste the binaries installed, JSON on the standard output
6
+ // node binaires.mjs installer <nom>@<version> installs one binary at its version
7
+ //
8
+ // - The binaries: uv, at the version of the module python's binaires.json (one source), then
9
+ // clang-format and clang-tidy at the versions of ./binaires.json, the wheels of PyPI that uv
10
+ // installs.
11
+ // - `liste`: `{ "uv": <version> }` from `uv --version`, with the tools `uv tool list` prints
12
+ // (`<nom> v<version>`); `{}` without uv, so that the update installs uv first.
13
+ // - `installer`: uv by the installer of the module python (../python/binaires.mjs); a clang tool by
14
+ // `uv tool install <nom>==<version>`, its output this process's error stream, its code this
15
+ // process's; a failure names on the error stream the command to type.
16
+ import { spawnSync } from 'node:child_process';
17
+ import { fileURLToPath, pathToFileURL } from 'node:url';
18
+
19
+ const OUTILS = ['clang-format', 'clang-tidy'];
20
+ // The script of the module python, which installs and lists uv: played, never imported (a module
21
+ // of language imports nothing from another).
22
+ const SCRIPT_UV = fileURLToPath(new URL('../python/binaires.mjs', import.meta.url));
23
+
24
+ const uvInstalle = () => {
25
+ const r = spawnSync(process.execPath, [SCRIPT_UV, 'liste'], { encoding: 'utf8' });
26
+ try {
27
+ return r.status === 0 ? JSON.parse(r.stdout) : {};
28
+ } catch {
29
+ return {};
30
+ }
31
+ };
32
+ const installerUv = cible =>
33
+ spawnSync(process.execPath, [SCRIPT_UV, 'installer', cible], { stdio: ['ignore', 2, 2] })
34
+ .status ?? 1;
35
+
36
+ /** The binaries installed: uv, and the clang tools uv lists. */
37
+ export function installes() {
38
+ const out = uvInstalle();
39
+ if (!out.uv) {
40
+ return out;
41
+ }
42
+ const r = spawnSync('uv', ['tool', 'list'], { encoding: 'utf8' });
43
+ if (r.status === 0) {
44
+ for (const [, nom, version] of (r.stdout ?? '').matchAll(/^(\S+) v(\S+)\s*$/gm)) {
45
+ if (OUTILS.includes(nom)) {
46
+ out[nom] = version;
47
+ }
48
+ }
49
+ }
50
+ return out;
51
+ }
52
+
53
+ /** Installs <cible> (`<nom>@<version>`): its exit code. */
54
+ export function installer(cible) {
55
+ const [nom, version] = cible.split('@');
56
+ if (nom === 'uv') {
57
+ return installerUv(cible);
58
+ }
59
+ if (!OUTILS.includes(nom) || !version) {
60
+ process.stderr.write(`⛔ binaire inconnu du module c : ${cible} (<nom>@<version>)\n`);
61
+ return 2;
62
+ }
63
+ const args = ['tool', 'install', `${nom}==${version}`];
64
+ const r = spawnSync('uv', args, { stdio: ['ignore', 2, 2] });
65
+ const code = r.error ? 127 : (r.status ?? 1);
66
+ if (code !== 0) {
67
+ const cause = r.error ? r.error.message : `code ${code}`;
68
+ process.stderr.write(`⛔ \`uv ${args.join(' ')}\` échoue (${cause}) ; lance-la.\n`);
69
+ }
70
+ return code;
71
+ }
72
+
73
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
74
+ const [nom, cible] = process.argv.slice(2);
75
+ if (nom === 'liste') {
76
+ process.stdout.write(`${JSON.stringify(installes())}\n`);
77
+ } else if (nom === 'installer' && cible) {
78
+ process.exitCode = installer(cible);
79
+ } else {
80
+ process.stderr.write('usage: binaires.mjs liste | installer <nom>@<version>\n');
81
+ process.exitCode = 2;
82
+ }
83
+ }
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ // The guard clang-format of the module c: every .c and .h of each package conforms to the
3
+ // .clang-format of the package, without debt (a finding refuses, never inscribed).
4
+ //
5
+ // node clang-format.mjs in the root of the project; 0 green, 1 a finding refused
6
+ //
7
+ // - It runs `clang-format --dry-run --Werror <fichiers>` per package, from the root, the style
8
+ // being the package's `.clang-format` (clang-format finds it from the file); each file it names
9
+ // as `<fichier>:<ligne>:<colonne>: error:` is a finding, named by its path from the root.
10
+ // - A clang-format absent from the PATH, or a package without .clang-format, refuses in one line,
11
+ // the tool never run; clang-format red without a finding refuses, its last line named.
12
+ import { spawnSync } from 'node:child_process';
13
+ import path from 'node:path';
14
+ import { pathToFileURL } from 'node:url';
15
+ import { composants } from './composants.mjs';
16
+ import { fichiersC, manque } from './clang.mjs';
17
+
18
+ export const GARDE = 'clang-format';
19
+ const CONFIGURATION = '.clang-format';
20
+
21
+ /** Runs the guard in the project at <racine>: its exit code, its refusals printed. */
22
+ export function commande(racine, { env = process.env } = {}) {
23
+ const lignes = [];
24
+ for (const c of composants(racine)) {
25
+ const ligne = manque(['clang-format'], c.dossier, CONFIGURATION, env);
26
+ if (ligne) {
27
+ lignes.push(ligne);
28
+ break;
29
+ }
30
+ const fichiers = fichiersC(racine, c.dossier, true);
31
+ if (fichiers.length === 0) {
32
+ continue;
33
+ }
34
+ const r = spawnSync(GARDE, ['--dry-run', '--Werror', ...fichiers], {
35
+ cwd: racine,
36
+ env,
37
+ encoding: 'utf8',
38
+ maxBuffer: 64 * 1024 * 1024,
39
+ });
40
+ const trouves = [
41
+ ...new Set(
42
+ [...(r.stderr ?? '').matchAll(/^(.+?):(\d+):\d+: error: (.*)$/gm)].map(
43
+ ([, f, l, m]) => `⛔ clang-format : ${path.relative(racine, path.resolve(racine, f))}:${l} — ${m}`
44
+ )
45
+ ),
46
+ ];
47
+ if (trouves.length > 0) {
48
+ lignes.push(...trouves);
49
+ } else if (r.error || r.status !== 0) {
50
+ const fin = r.error?.message ?? (r.stderr ?? '').trim().split('\n').at(-1) ?? '';
51
+ lignes.push(`⛔ clang-format rouge (code ${r.status ?? r.signal}) : ${fin}`);
52
+ }
53
+ }
54
+ for (const l of lignes) {
55
+ process.stderr.write(`${l}\n`);
56
+ }
57
+ return lignes.length ? 1 : 0;
58
+ }
59
+
60
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
61
+ process.exitCode = commande(process.cwd());
62
+ }
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env node
2
+ // The guard clang-tidy of the module c: the lint of clang-tidy on each package, without debt (a
3
+ // finding refuses, never inscribed).
4
+ //
5
+ // node clang-tidy.mjs in the root of the project; 0 green, 1 a finding refused
6
+ //
7
+ // - Each package is configured by `cmake -S <paquet> -B .build-cmake/<paquet>
8
+ // -DCMAKE_EXPORT_COMPILE_COMMANDS=ON`, the directory `construire` and `tests-du-paquet` use
9
+ // (./commandes.mjs: one configuration), then clang-tidy plays on its compile_commands.json
10
+ // (`-p`), on the `.c` files of the package, its `.clang-tidy` read from there.
11
+ // - Each warning and each error `<fichier>:<ligne>:<colonne>: <gravité>: <message> [<règle>]` of
12
+ // its standard output is a finding: its file from the root, its line, its rule; a note is none.
13
+ // - A cmake or a clang-tidy absent from the PATH, or a package without .clang-tidy, refuses in one
14
+ // line, the tool never run; a configuration that fails is refused with the code of cmake, never
15
+ // as a finding; clang-tidy red without a finding refuses, its error stream named.
16
+ import { spawnSync } from 'node:child_process';
17
+ import path from 'node:path';
18
+ import { pathToFileURL } from 'node:url';
19
+ import { CONSTRUCTION, pourLOutil } from './commandes.mjs';
20
+ import { composants } from './composants.mjs';
21
+ import { fichiersC, manque } from './clang.mjs';
22
+
23
+ export const GARDE = 'clang-tidy';
24
+ const CONFIGURATION = '.clang-tidy';
25
+ const CMAKE = 'cmake';
26
+ const CONSTAT = /^(.+?):(\d+):\d+: (?:warning|error): (.*) \[([\w.,-]+)\]$/gm;
27
+
28
+ /**
29
+ * The findings of the output <sortie> of clang-tidy: each `{ fichier, ligne, regle, message }`,
30
+ * the file from <racine>.
31
+ */
32
+ export function constatsDeClangTidy(sortie, racine) {
33
+ const vus = new Set();
34
+ const out = [];
35
+ for (const [, f, ligne, message, regle] of sortie.matchAll(CONSTAT)) {
36
+ const fichier = path.relative(racine, path.resolve(racine, f)).split(path.sep).join('/');
37
+ const cle = `${fichier}:${ligne}:${regle}:${message}`;
38
+ if (!vus.has(cle)) {
39
+ vus.add(cle);
40
+ out.push({ fichier, ligne: Number(ligne), regle, message });
41
+ }
42
+ }
43
+ return out;
44
+ }
45
+
46
+ /** Runs the guard in the project at <racine>: its exit code, its refusals printed. */
47
+ export function commande(racine, { env = process.env } = {}) {
48
+ const lignes = [];
49
+ for (const c of composants(racine)) {
50
+ const ligne = manque([CMAKE, GARDE], c.dossier, CONFIGURATION, env);
51
+ if (ligne) {
52
+ lignes.push(ligne);
53
+ break;
54
+ }
55
+ const construction = path.join(racine, CONSTRUCTION, c.nom);
56
+ const configure = spawnSync(
57
+ CMAKE,
58
+ ['-S', c.dossier, '-B', construction, '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON'],
59
+ { cwd: racine, env: pourLOutil(env), encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 }
60
+ );
61
+ if (configure.error || configure.status !== 0) {
62
+ const fin = configure.error?.message ?? (configure.stderr ?? '').trim().split('\n').at(-1);
63
+ lignes.push(`⛔ cmake de ${c.nom} échoue (code ${configure.status ?? 127}) : ${fin ?? ''}`);
64
+ continue;
65
+ }
66
+ const fichiers = fichiersC(racine, c.dossier, false);
67
+ if (fichiers.length === 0) {
68
+ continue;
69
+ }
70
+ const r = spawnSync(GARDE, ['-p', construction, '--quiet', ...fichiers], {
71
+ cwd: racine,
72
+ env: pourLOutil(env),
73
+ encoding: 'utf8',
74
+ maxBuffer: 256 * 1024 * 1024,
75
+ });
76
+ const constats = constatsDeClangTidy(r.stdout ?? '', racine);
77
+ for (const k of constats) {
78
+ lignes.push(`⛔ clang-tidy : ${k.fichier}:${k.ligne} — ${k.message} [${k.regle}]`);
79
+ }
80
+ if (constats.length === 0 && (r.error || r.status !== 0)) {
81
+ const fin = r.error?.message ?? (r.stderr ?? '').trim().split('\n').at(-1) ?? '';
82
+ lignes.push(`⛔ clang-tidy rouge (code ${r.status ?? r.signal}) : ${fin}`);
83
+ }
84
+ }
85
+ for (const l of lignes) {
86
+ process.stderr.write(`${l}\n`);
87
+ }
88
+ return lignes.length ? 1 : 0;
89
+ }
90
+
91
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
92
+ process.exitCode = commande(process.cwd());
93
+ }
@@ -0,0 +1,42 @@
1
+ // What the guards of clang share (./clang-format.mjs, ./clang-tidy.mjs): the C files of a package,
2
+ // and the refusal of a tool or a file that lacks, in one line.
3
+ import { existsSync, readdirSync } from 'node:fs';
4
+ import path from 'node:path';
5
+ import { trouverDansLePath } from '../../services-du-noyau.mjs';
6
+
7
+ /** The `.c` (and `.h` when <avecEntetes>) of <dossier>, as paths from <racine>, sorted. */
8
+ export function fichiersC(racine, dossier, avecEntetes) {
9
+ const motif = avecEntetes ? /\.[ch]$/ : /\.c$/;
10
+ const out = [];
11
+ const lire = d => {
12
+ for (const e of readdirSync(d, { withFileTypes: true })) {
13
+ if (e.isDirectory()) {
14
+ if (!e.name.startsWith('.')) {
15
+ lire(path.join(d, e.name));
16
+ }
17
+ } else if (motif.test(e.name)) {
18
+ out.push(path.relative(racine, path.join(d, e.name)).split(path.sep).join('/'));
19
+ }
20
+ }
21
+ };
22
+ lire(dossier);
23
+ return out.sort();
24
+ }
25
+
26
+ /**
27
+ * The line that refuses a tool of <outils> the PATH of <env> lacks, or a configuration file of
28
+ * <dossier> that lacks; null when all are there.
29
+ */
30
+ export function manque(outils, dossier, fichier, env) {
31
+ const absent = outils.find(o => trouverDansLePath(o, env) === null);
32
+ if (absent) {
33
+ const aide = absent.startsWith('clang-')
34
+ ? ' : installe-le par `npx grillhouse binaires`'
35
+ : ' : le poste exige CMake';
36
+ return `⛔ ${absent} absent du PATH${aide}.`;
37
+ }
38
+ if (!existsSync(path.join(dossier, fichier))) {
39
+ return `⛔ ${path.basename(dossier)}/${fichier} absent : le paquet écrit sa configuration (le squelette de \`grillhouse paquet\` la pose).`;
40
+ }
41
+ return null;
42
+ }