@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.
Files changed (60) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/cadre/templates/projet/CLAUDE.md +7 -0
  3. package/cadre/templates/projet/docs/ARCHITECTURE.md +15 -0
  4. package/cadre/templates/python/package.json +18 -0
  5. package/charte.md +22 -0
  6. package/docs/ARCHITECTURE.md +58 -17
  7. package/docs/CADRE.md +7 -6
  8. package/docs/INTERFACE.md +96 -32
  9. package/package.json +1 -1
  10. package/scripts/circuit.mjs +44 -8
  11. package/scripts/commande-du-langage.mjs +2 -2
  12. package/scripts/commandes-composees.mjs +156 -0
  13. package/scripts/composition-des-langages.mjs +306 -0
  14. package/scripts/conformite.mjs +1 -3
  15. package/scripts/dernier-vert.mjs +15 -2
  16. package/scripts/engendres.mjs +170 -0
  17. package/scripts/enveloppe/travail-de-la-copie.mjs +82 -8
  18. package/scripts/gardes-du-cadre.mjs +7 -4
  19. package/scripts/grillhouse-maj.mjs +152 -99
  20. package/scripts/index-interfaces.mjs +78 -0
  21. package/scripts/init.mjs +5 -5
  22. package/scripts/integration/file.mjs +74 -13
  23. package/scripts/integration/integrer.mjs +50 -62
  24. package/scripts/jointure.d.ts +26 -13
  25. package/scripts/langages/cargo/binaires.mjs +29 -6
  26. package/scripts/langages/cargo/clippy.mjs +4 -2
  27. package/scripts/langages/cargo/commandes.mjs +45 -7
  28. package/scripts/langages/cargo/exemples.mjs +1 -15
  29. package/scripts/langages/cargo/index-interfaces.mjs +20 -3
  30. package/scripts/langages/cargo/index.mjs +9 -10
  31. package/scripts/langages/cargo/mise-a-jour.mjs +2 -1
  32. package/scripts/langages/cargo/sccache.mjs +29 -0
  33. package/scripts/langages/python/binaires.json +3 -0
  34. package/scripts/langages/python/binaires.mjs +59 -0
  35. package/scripts/langages/python/commandes.mjs +411 -0
  36. package/scripts/langages/python/composants.mjs +272 -0
  37. package/scripts/langages/python/exemples.mjs +260 -0
  38. package/scripts/langages/python/index-interfaces.mjs +77 -0
  39. package/scripts/langages/python/index.mjs +94 -0
  40. package/scripts/langages/python/lot.mjs +76 -0
  41. package/scripts/langages/python/mise-a-jour.mjs +54 -0
  42. package/scripts/langages/python/tailles-des-tests.mjs +102 -0
  43. package/scripts/langages/python/verdict.mjs +85 -0
  44. package/scripts/langages/typescript/exemples.mjs +1 -20
  45. package/scripts/langages/typescript/index-interfaces.mjs +10 -3
  46. package/scripts/langages/typescript/index.mjs +11 -15
  47. package/scripts/langages-des-paquets.mjs +171 -0
  48. package/scripts/langages.mjs +60 -41
  49. package/scripts/migrations/0.27.0-langages-dans-l-architecture.mjs +182 -0
  50. package/scripts/migrations.mjs +2 -0
  51. package/scripts/outils-cles.mjs +1 -1
  52. package/scripts/session-start.sh +34 -9
  53. package/scripts/sources.mjs +2 -1
  54. package/scripts/sous-commandes.mjs +5 -3
  55. package/scripts/tableau-des-composants.mjs +138 -0
  56. package/scripts/verrous/verrou.mjs +3 -2
  57. package/skills/grill/SKILL.md +9 -1
  58. package/skills/pitmaster/SKILL.md +6 -1
  59. package/skills/redacteur/references/documents-d-un-composant.md +12 -0
  60. package/skills/testwriter/SKILL.md +6 -0
@@ -0,0 +1,138 @@
1
+ // The tables of the components of a project, in its docs/ARCHITECTURE.md: where the project
2
+ // declares the language of each package, as the BUILD file of Bazel names the rule of each target.
3
+ // The core reads them (./langages.mjs), the guard of the languages judges the packages against
4
+ // them (./langages-des-paquets.mjs), and the migration of 0.27.0 writes their column
5
+ // (./migrations/0.27.0-langages-dans-l-architecture.mjs).
6
+ //
7
+ // - A table of the components is a table of Markdown of docs/ARCHITECTURE.md whose header holds a
8
+ // column « Langage » (COLONNE): BPScript's table of the stages, and its section « Les paquets »
9
+ // for the packages that table does not name; each counts, in the order of the document. A row
10
+ // declares a package when its cell of that column is not empty: the language is that cell, its backquotes and its case left out. A row
11
+ // with an empty cell names a part that is no package of the project (a crate of another
12
+ // repository, a folder of data).
13
+ // - The names of a cell are its spans in backquotes, the whole cell when it has none: « `osd`
14
+ // (`osd/`, the workspace) » names `osd` and `osd/`, « service » names service.
15
+ // - A row names a component when one name of its cell of the names is the component's folder name,
16
+ // its package name or its path from the root (`.` for the root; a trailing `/` and a leading
17
+ // `./` left out). The column of the names of a table is its first column, left to right, where a
18
+ // cell names a component: the phase of BPScript's table comes before its package, the crates a row calls
19
+ // come after the component of SyntHub's.
20
+ // - A cell holds no `|` but in backquotes, as GitHub's tables read it.
21
+ import { existsSync, readFileSync } from 'node:fs';
22
+ import path from 'node:path';
23
+
24
+ /** The document that holds the table, from the root of the project. */
25
+ export const ARCHITECTURE = 'docs/ARCHITECTURE.md';
26
+ /** The header of the column of the languages. */
27
+ export const COLONNE = 'Langage';
28
+
29
+ // The cells of the row <ligne> of a table, its outer pipes left out.
30
+ export function cellules(ligne) {
31
+ const out = [];
32
+ let courante = '';
33
+ let code = false;
34
+ for (const c of ligne.trim().replace(/^\|/, '')) {
35
+ if (c === '`') {
36
+ code = !code;
37
+ }
38
+ if (c === '|' && !code) {
39
+ out.push(courante.trim());
40
+ courante = '';
41
+ } else {
42
+ courante += c;
43
+ }
44
+ }
45
+ if (courante.trim() !== '') {
46
+ out.push(courante.trim());
47
+ }
48
+ return out;
49
+ }
50
+
51
+ const SEPARATEUR = /^\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/;
52
+
53
+ /**
54
+ * The tables of Markdown of <texte>: `{ entete, ligneEntete, lignes }`, `ligneEntete` the index of
55
+ * its header in the lines of the text, each row `{ index, cellules }`.
56
+ * @param {string} texte
57
+ */
58
+ export function tableaux(texte) {
59
+ const lignes = texte.split('\n');
60
+ const out = [];
61
+ for (let i = 0; i + 1 < lignes.length; i++) {
62
+ if (!lignes[i].trim().startsWith('|') || !SEPARATEUR.test(lignes[i + 1].trim())) {
63
+ continue;
64
+ }
65
+ const t = { entete: cellules(lignes[i]), ligneEntete: i, lignes: [] };
66
+ let j = i + 2;
67
+ while (j < lignes.length && lignes[j].trim().startsWith('|')) {
68
+ t.lignes.push({ index: j, cellules: cellules(lignes[j]) });
69
+ j++;
70
+ }
71
+ out.push(t);
72
+ i = j - 1;
73
+ }
74
+ return out;
75
+ }
76
+
77
+ /** The index of the column of the languages in the header <entete>, -1 without one. */
78
+ export const colonneDesLangages = entete =>
79
+ entete.findIndex(c => c.replace(/[`*]/g, '').trim().toLowerCase() === COLONNE.toLowerCase());
80
+
81
+ /**
82
+ * The tables of the components of the project at <racine> (each table whose header holds the
83
+ * column « Langage »), in the order of the document, each with `colonne`, the index of that
84
+ * column; none without document or without such a table.
85
+ * @param {string} racine
86
+ */
87
+ export function tableauxDesComposants(racine) {
88
+ const f = path.join(racine, ARCHITECTURE);
89
+ if (!existsSync(f)) {
90
+ return [];
91
+ }
92
+ return tableaux(readFileSync(f, 'utf8'))
93
+ .filter(x => colonneDesLangages(x.entete) >= 0)
94
+ .map(t => ({ ...t, colonne: colonneDesLangages(t.entete) }));
95
+ }
96
+
97
+ /** The language a cell declares: its text without backquotes nor emphasis, lower case. */
98
+ export const langageDeLaCellule = cellule =>
99
+ (cellule ?? '').replace(/[`*]/g, '').trim().toLowerCase();
100
+
101
+ /** The names of the cell <cellule>: its spans in backquotes, the whole cell without one. */
102
+ export function nomsDe(cellule) {
103
+ const spans = [...(cellule ?? '').matchAll(/`([^`]+)`/g)].map(m => m[1].trim());
104
+ const noms = spans.length ? spans : [(cellule ?? '').trim()];
105
+ return noms.filter(Boolean).map(n => n.replace(/^\.\//, '').replace(/(.)\/$/, '$1'));
106
+ }
107
+
108
+ /**
109
+ * Whether one of <noms> names the component <c> of the project at <racine>.
110
+ * @param {string[]} noms
111
+ * @param {import('./jointure.js').Composant} c
112
+ * @param {string} racine
113
+ */
114
+ export function nomme(noms, c, racine) {
115
+ const rel = path.relative(racine, c.dossier).split(path.sep).join('/') || '.';
116
+ return noms.some(n => n === c.nom || n === c.paquet || n === rel);
117
+ }
118
+
119
+ /**
120
+ * The column of the names of the rows <lignes>: the first, left to right, out of <hors>, where a
121
+ * cell names one of the components <composants>; -1 when none does.
122
+ * @param {{ cellules: string[] }[]} lignes
123
+ * @param {import('./jointure.js').Composant[]} composants
124
+ * @param {string} racine
125
+ * @param {number} [hors] a column left out (the languages')
126
+ */
127
+ export function colonneDesNoms(lignes, composants, racine, hors = -1) {
128
+ const largeur = Math.max(0, ...lignes.map(l => l.cellules.length));
129
+ for (let i = 0; i < largeur; i++) {
130
+ if (i === hors) {
131
+ continue;
132
+ }
133
+ if (lignes.some(l => composants.some(c => nomme(nomsDe(l.cellules[i]), c, racine)))) {
134
+ return i;
135
+ }
136
+ }
137
+ return -1;
138
+ }
@@ -15,8 +15,9 @@
15
15
  // a part of it the tests' (cargo: the test module of a file of `src/`).
16
16
  // - The repository root is that of the git repository holding the written file, whatever the
17
17
  // agent's working directory; a file outside any repository is read against the working directory.
18
- // A project that declares no language (`grillhouse.langages`) is refused, exit code 2, the
19
- // update named: the lock cannot judge its writes, and a hook that throws would let them pass.
18
+ // A project that declares no language (the column « Langage » of its docs/ARCHITECTURE.md) is
19
+ // refused, exit code 2, the column named: the lock cannot judge its writes, and a hook that
20
+ // throws would let them pass.
20
21
  // - developpeur writes none of the testwriter's files, and no other file until its ticket's
21
22
  // description holds a "## Architecture" section (`sansArchitecture`, which the start of the
22
23
  // circuit reads too). The ticket is the "TON TICKET : <id>" line of the agent's
@@ -125,7 +125,15 @@ remplace jamais le grill. Les branches de l'arbre :
125
125
  8. **Les composants** — le découpage qui découle des branches 5 à 7, chaque frontière avec ses
126
126
  pièces ; pour chacun, les huit rubriques du cadre : rôle, reçoit, rend, connaît, ne connaît pas,
127
127
  refuse, invariants, coût. Puis la forme : un paquet ou plusieurs, bibliothèque ou service (un
128
- service garde `deployment/`, le démon et `.env`), TypeScript ou JavaScript. **Plusieurs paquets,
128
+ service garde `deployment/`, le démon et `.env`), TypeScript ou JavaScript.
129
+ **Le langage de chaque paquet** : le tableau des composants de `docs/ARCHITECTURE.md` porte une
130
+ colonne « Langage » (`typescript`, `cargo`, `python`), une ligne par paquet, comme le fichier BUILD de
131
+ Bazel nomme la règle de chaque cible ; le cadre lit là les langages du projet, rien ne se devine
132
+ aux fichiers, et un projet qui n'en déclare aucun est refusé. L'`INTERFACE.md` de chaque paquet
133
+ le reprend (`**Langage** : <nom>`). La garde `grillhouse langages-des-paquets` refuse un paquet
134
+ que le tableau ne déclare pas, un paquet dont le manifeste suit un autre langage (un
135
+ `package.json` pour `typescript`, un `Cargo.toml` pour `cargo`, un `pyproject.toml` pour
136
+ `python`), un dossier déclaré sans ce manifeste, et une interface qui en nomme un autre. **Plusieurs paquets,
129
137
  une forme publiée** : chaque paquet publie son entrée dans le champ `exports` de son
130
138
  `package.json`, construite dans `dist/` ; ses tests et leurs données restent dans le paquet.
131
139
  **Les outils du projet, un paquet** : les scripts propres au projet (son typage, ses gardes, ses
@@ -82,7 +82,8 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
82
82
  de son `package.json`, chacune `{ nom, commande, fichiers, tests, lit, gardes }`, ses fichiers en
83
83
  chemins, dossiers ou motifs `*` et `**`, ses tests les fichiers de test qui la jugent, `lit` les
84
84
  fichiers qu'elle lit d'une autre référence, ses gardes les gardes du projet qui la jugent, par le
85
- nom que porte leur constat SARIF ; celles du cadre, l'index des interfaces, les `turbo.json`, les
85
+ nom que porte leur constat SARIF ; ses fichiers engendrés, `grillhouse.engendres`, que
86
+ l'intégration régénère au lieu de les fusionner ; celles du cadre, l'index des interfaces, les `turbo.json`, les
86
87
  rapports d'API et la dette des gardes ; sur la copie entière, dès qu'un rouge est le leur, mêlé
87
88
  ou non à d'autres, ou que la dette baisse, chacune suivie de celles qui lisent ce qu'elle écrit
88
89
  (l'index après les rapports d'API), sans que le plan les nomme, puis la passe finale restreinte
@@ -100,6 +101,10 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
100
101
  étape joue une fois pour tout le ticket, dans l'enveloppe de tous les paquets du plan ; je dis
101
102
  où en est un ticket par son étape, « 3 Code » ; son en-tête dit ses arrêts et leurs codes. Ainsi
102
103
  les gestes mécaniques passent à une commande, et je garde la vue d'ensemble.
104
+ - **Je ne lance pas de circuit pour un ticket de données** : un ticket qui n'ajoute que des
105
+ données (des fichiers qu'un schéma valide) passe par le chemin de données du projet, sa
106
+ validation et sa CI (charte commune). Ainsi les tests, la preuve du rouge et le développeur ne
107
+ tournent que sur du code.
103
108
  - **Le code de fin du circuit dit la suite** : 0, le lot est sur main et le ticket fermé ; je lis
104
109
  sa fermeture. 75 (`a-repasser` : un contrôle ou l'intégration encore « à repasser », ou la
105
110
  branche gardée en file) : je relance `--reprendre` en arrière-plan, la
@@ -46,6 +46,9 @@ ses commandes dans `bin`), n'a pas d'API publique : son `INTERFACE.md` est tout
46
46
  marques ni rapport, et le contrôle ne lui demande aucune construction. L'index des interfaces (`docs/agents/index-des-interfaces.md`, généré par
47
47
  `npm run interfaces`) se construit depuis la part générée. Ainsi l'interface que lit un agent
48
48
  voisin dit vrai.
49
+ **Le langage du paquet** : une ligne `**Langage** : <nom>` reprend la colonne « Langage » de
50
+ l'architecture ; la garde `grillhouse langages-des-paquets` refuse une interface qui en nomme un
51
+ autre. Ainsi l'interface dit dans quel langage le voisin la lit.
49
52
  **Les fautes se listent** sous « ## Les fautes » : leurs codes sont exactement ceux que le code du
50
53
  composant produit.
51
54
  **Les consommateurs sont déclarés** : une section `## Consommateurs` liste chaque composant qui
@@ -97,6 +100,15 @@ Ainsi le document reste exact quand le code bouge.
97
100
  Dans un dépôt à plusieurs paquets, `docs/ARCHITECTURE.md` à la racine décrit l'ensemble sur le même
98
101
  modèle et renvoie à l'architecture de chaque paquet.
99
102
 
103
+ **Le tableau des composants porte la colonne « Langage »** : à la racine, la section des
104
+ composants liste chaque paquet dans un tableau dont la colonne « Langage » nomme son langage
105
+ (`typescript`, `cargo`, `python`), comme le fichier BUILD de Bazel nomme la règle de chaque cible ; une ligne
106
+ sans langage nomme une partie qui n'est pas un paquet du projet (un crate d'un autre dépôt). Un
107
+ paquet qu'un tableau propre à une vue ne nomme pas (le tableau des étages d'une chaîne, où chaque
108
+ ligne fait une étape) va dans une section « Les paquets », un tableau `Paquet | Langage`. Le cadre
109
+ lit les langages du projet dans chaque tableau qui porte la colonne. Ainsi le langage se décide à
110
+ la conception.
111
+
100
112
  ## Le ton
101
113
 
102
114
  Celui d'une spécification d'architecture (arc42, C4) : des noms de composants, des
@@ -21,6 +21,12 @@ le test n'est jamais compilé ; un `#[cfg(test)] mod tests { … }` en ligne, tu
21
21
  fichier de code et le déplaces dans `tests.rs`. Le verrou te refuse tout autre changement d'un
22
22
  fichier de code, la partie nommée.
23
23
  La matière partagée est le crate dont le manifeste dit `[package.metadata.grillhouse] matiere = true`.
24
+ Dans un paquet Python, tes tests sont les fichiers que pytest trouve, `test_*.py` ou `*_test.py`,
25
+ un test de nuit `*_nuit_test.py` ; leurs aides vont dans `conftest.py` et sous `tests/`. Ce dont
26
+ ils dépendent va dans le groupe `test` de `[dependency-groups]` du `pyproject.toml`, et
27
+ `uv.lock` suit ; le verrou te refuse toute autre partie du `pyproject.toml`. Un dossier ou un
28
+ fichier temporaire se crée par `tempfile` (`TemporaryDirectory`, `NamedTemporaryFile`), jamais
29
+ par `mkdtemp` à la main : la passe échoue sur ce qu'un test laisse dans son dossier temporaire.
24
30
 
25
31
  ## Au démarrage
26
32