@roomi-fields/grillhouse 0.28.3 → 0.30.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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +128 -26
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/README.md +11 -11
  7. package/cadre/templates/projet/_gitignore +2 -5
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/projet/package.json +2 -2
  10. package/charte.md +37 -4
  11. package/dist/temporal/acte.d.ts +24 -0
  12. package/dist/temporal/acte.js +139 -0
  13. package/dist/temporal/acte.js.map +1 -0
  14. package/dist/temporal/attributs.d.ts +6 -0
  15. package/dist/temporal/attributs.js +15 -0
  16. package/dist/temporal/attributs.js.map +1 -0
  17. package/dist/temporal/circuit/activites.d.ts +13 -0
  18. package/dist/temporal/circuit/activites.js +33 -0
  19. package/dist/temporal/circuit/activites.js.map +1 -0
  20. package/dist/temporal/circuit/client.d.ts +72 -0
  21. package/dist/temporal/circuit/client.js +247 -0
  22. package/dist/temporal/circuit/client.js.map +1 -0
  23. package/dist/temporal/circuit/commande.d.ts +2 -0
  24. package/dist/temporal/circuit/commande.js +238 -0
  25. package/dist/temporal/circuit/commande.js.map +1 -0
  26. package/dist/temporal/circuit/contrat.d.ts +305 -0
  27. package/dist/temporal/circuit/contrat.js +24 -0
  28. package/dist/temporal/circuit/contrat.js.map +1 -0
  29. package/dist/temporal/circuit/deroule.d.ts +3 -0
  30. package/dist/temporal/circuit/deroule.js +540 -0
  31. package/dist/temporal/circuit/deroule.js.map +1 -0
  32. package/dist/temporal/client.d.ts +47 -0
  33. package/dist/temporal/client.js +69 -0
  34. package/dist/temporal/client.js.map +1 -0
  35. package/dist/temporal/commande.d.ts +2 -0
  36. package/dist/temporal/commande.js +95 -0
  37. package/dist/temporal/commande.js.map +1 -0
  38. package/dist/temporal/deroules.d.ts +5 -0
  39. package/dist/temporal/deroules.js +10 -0
  40. package/dist/temporal/deroules.js.map +1 -0
  41. package/dist/temporal/etat.d.ts +33 -0
  42. package/dist/temporal/etat.js +59 -0
  43. package/dist/temporal/etat.js.map +1 -0
  44. package/dist/temporal/file/activites.d.ts +10 -0
  45. package/dist/temporal/file/activites.js +25 -0
  46. package/dist/temporal/file/activites.js.map +1 -0
  47. package/dist/temporal/file/client.d.ts +4 -0
  48. package/dist/temporal/file/client.js +6 -0
  49. package/dist/temporal/file/client.js.map +1 -0
  50. package/dist/temporal/file/contrat.d.ts +158 -0
  51. package/dist/temporal/file/contrat.js +14 -0
  52. package/dist/temporal/file/contrat.js.map +1 -0
  53. package/dist/temporal/file/deroule.d.ts +15 -0
  54. package/dist/temporal/file/deroule.js +235 -0
  55. package/dist/temporal/file/deroule.js.map +1 -0
  56. package/dist/temporal/installation.d.ts +124 -0
  57. package/dist/temporal/installation.js +408 -0
  58. package/dist/temporal/installation.js.map +1 -0
  59. package/dist/temporal/places/activites.d.ts +8 -0
  60. package/dist/temporal/places/activites.js +13 -0
  61. package/dist/temporal/places/activites.js.map +1 -0
  62. package/dist/temporal/places/client.d.ts +28 -0
  63. package/dist/temporal/places/client.js +64 -0
  64. package/dist/temporal/places/client.js.map +1 -0
  65. package/dist/temporal/places/contrat.d.ts +106 -0
  66. package/dist/temporal/places/contrat.js +21 -0
  67. package/dist/temporal/places/contrat.js.map +1 -0
  68. package/dist/temporal/places/deroule.d.ts +3 -0
  69. package/dist/temporal/places/deroule.js +198 -0
  70. package/dist/temporal/places/deroule.js.map +1 -0
  71. package/dist/temporal/sonde/activites.d.ts +6 -0
  72. package/dist/temporal/sonde/activites.js +52 -0
  73. package/dist/temporal/sonde/activites.js.map +1 -0
  74. package/dist/temporal/sonde/contrat.d.ts +35 -0
  75. package/dist/temporal/sonde/contrat.js +10 -0
  76. package/dist/temporal/sonde/contrat.js.map +1 -0
  77. package/dist/temporal/sonde/deroule.d.ts +3 -0
  78. package/dist/temporal/sonde/deroule.js +39 -0
  79. package/dist/temporal/sonde/deroule.js.map +1 -0
  80. package/dist/temporal/tickets/activites.d.ts +7 -0
  81. package/dist/temporal/tickets/activites.js +81 -0
  82. package/dist/temporal/tickets/activites.js.map +1 -0
  83. package/dist/temporal/tickets/client.d.ts +10 -0
  84. package/dist/temporal/tickets/client.js +31 -0
  85. package/dist/temporal/tickets/client.js.map +1 -0
  86. package/dist/temporal/tickets/contrat.d.ts +56 -0
  87. package/dist/temporal/tickets/contrat.js +13 -0
  88. package/dist/temporal/tickets/contrat.js.map +1 -0
  89. package/dist/temporal/tickets/deroule.d.ts +3 -0
  90. package/dist/temporal/tickets/deroule.js +94 -0
  91. package/dist/temporal/tickets/deroule.js.map +1 -0
  92. package/dist/temporal/travailleur.d.ts +2 -0
  93. package/dist/temporal/travailleur.js +69 -0
  94. package/dist/temporal/travailleur.js.map +1 -0
  95. package/docs/ARCHITECTURE.md +813 -53
  96. package/docs/CADRE.md +17 -0
  97. package/docs/INTERFACE.md +161 -30
  98. package/hooks/crochet.mjs +19 -2
  99. package/hooks/hooks.json +11 -0
  100. package/package.json +16 -4
  101. package/scripts/activites.mjs +2182 -0
  102. package/scripts/aiguillage.d.mts +37 -0
  103. package/scripts/aiguillage.mjs +328 -0
  104. package/scripts/avancement.mjs +159 -64
  105. package/scripts/bilan.mjs +37 -19
  106. package/scripts/cadre.mjs +11 -2
  107. package/scripts/circuit.mjs +888 -3654
  108. package/scripts/circuits-cles.d.mts +4 -0
  109. package/scripts/circuits-cles.mjs +21 -0
  110. package/scripts/circuits-du-serveur.mjs +105 -0
  111. package/scripts/codes-de-sortie.mjs +9 -0
  112. package/scripts/commandes-composees.mjs +45 -41
  113. package/scripts/commandes-du-path.d.mts +7 -0
  114. package/scripts/commandes-du-path.mjs +25 -0
  115. package/scripts/composition-des-langages.mjs +30 -11
  116. package/scripts/conformite.mjs +19 -10
  117. package/scripts/copies-finies.mjs +188 -42
  118. package/scripts/depart-du-ticket.d.mts +53 -0
  119. package/scripts/depart-du-ticket.mjs +124 -0
  120. package/scripts/dependances-internes.mjs +115 -0
  121. package/scripts/dernier-vert.mjs +7 -15
  122. package/scripts/donnees-cles.mjs +228 -0
  123. package/scripts/droits.mjs +11 -1
  124. package/scripts/effets.mjs +352 -0
  125. package/scripts/enveloppe/enveloppe.mjs +119 -8
  126. package/scripts/enveloppe/lancer.sh +27 -32
  127. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  128. package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
  129. package/scripts/etapes.mjs +6 -3
  130. package/scripts/faits-du-circuit.mjs +493 -0
  131. package/scripts/file-des-tickets.d.mts +21 -0
  132. package/scripts/file-des-tickets.mjs +58 -0
  133. package/scripts/flux-des-paquets.mjs +187 -0
  134. package/scripts/fusion-du-changelog.mjs +0 -1
  135. package/scripts/gardes-du-cadre.mjs +12 -2
  136. package/scripts/grillhouse-maj.mjs +16 -7
  137. package/scripts/integration/file.mjs +477 -422
  138. package/scripts/integration/integrer.mjs +20 -22
  139. package/scripts/integration/rejeu.mjs +19 -4
  140. package/scripts/jointure.d.ts +168 -28
  141. package/scripts/langages/cargo/commandes.mjs +426 -119
  142. package/scripts/langages/cargo/composants.mjs +187 -3
  143. package/scripts/langages/cargo/exemples.mjs +75 -17
  144. package/scripts/langages/cargo/index.mjs +32 -13
  145. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  146. package/scripts/langages/cargo/sccache.mjs +62 -16
  147. package/scripts/langages/cargo/squelette.mjs +72 -3
  148. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  149. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  150. package/scripts/langages/python/commandes.mjs +232 -79
  151. package/scripts/langages/python/composants.mjs +65 -3
  152. package/scripts/langages/python/exemples.mjs +21 -12
  153. package/scripts/langages/python/index.mjs +25 -5
  154. package/scripts/langages/python/lot.mjs +1 -36
  155. package/scripts/langages/python/squelette.mjs +119 -17
  156. package/scripts/langages/typescript/construire.mjs +6 -163
  157. package/scripts/langages/typescript/exemples.mjs +19 -11
  158. package/scripts/langages/typescript/frontieres.mjs +1 -1
  159. package/scripts/langages/typescript/index.mjs +48 -63
  160. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  161. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  162. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  163. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  164. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  165. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  166. package/scripts/langages/typescript/squelette.mjs +18 -2
  167. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  168. package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
  169. package/scripts/langages/typescript/tests.mjs +17 -8
  170. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  171. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  172. package/scripts/langages/typescript/verdict.mjs +1 -1
  173. package/scripts/langages/typescript/verifier.mjs +110 -296
  174. package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
  175. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  176. package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
  177. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  178. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  179. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  180. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
  181. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
  182. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  183. package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
  184. package/scripts/lecture-unique.mjs +51 -0
  185. package/scripts/mesure/pression.mjs +11 -9
  186. package/scripts/mesure-de-la-machine.d.mts +21 -0
  187. package/scripts/mesure-de-la-machine.mjs +76 -0
  188. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  189. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  190. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  191. package/scripts/migrations.mjs +5 -0
  192. package/scripts/nuit.sh +29 -15
  193. package/scripts/outil.mjs +72 -0
  194. package/scripts/outils-cles.d.mts +24 -0
  195. package/scripts/outils-cles.mjs +0 -1
  196. package/scripts/paquet-npm.mjs +147 -0
  197. package/scripts/paquet.mjs +112 -14
  198. package/scripts/paquets.mjs +34 -6
  199. package/scripts/passe-de-la-machine.mjs +66 -0
  200. package/scripts/places-de-la-machine.mjs +360 -0
  201. package/scripts/places-du-serveur.mjs +170 -0
  202. package/scripts/prefixe-des-tickets.mjs +68 -0
  203. package/scripts/preparation.mjs +10 -3
  204. package/scripts/registre.mjs +3 -2
  205. package/scripts/regles-des-places.d.mts +36 -0
  206. package/scripts/regles-des-places.mjs +70 -0
  207. package/scripts/reponses-du-circuit.d.mts +6 -0
  208. package/scripts/reponses-du-circuit.mjs +28 -0
  209. package/scripts/resultats.mjs +29 -14
  210. package/scripts/retirer-les-copies-finies.mjs +25 -0
  211. package/scripts/sans-reponse.d.mts +4 -0
  212. package/scripts/sans-reponse.mjs +13 -0
  213. package/scripts/seances.mjs +918 -0
  214. package/scripts/services-du-noyau.mjs +28 -11
  215. package/scripts/session-start.sh +10 -1
  216. package/scripts/sortie.mjs +23 -4
  217. package/scripts/sources.mjs +3 -3
  218. package/scripts/sous-commandes.mjs +39 -9
  219. package/scripts/style-a-l-ecriture.mjs +229 -0
  220. package/scripts/superviseur.mjs +382 -16
  221. package/scripts/tableau.mjs +329 -130
  222. package/scripts/taches-du-graphe.mjs +328 -0
  223. package/scripts/ticket-du-circuit.mjs +206 -0
  224. package/scripts/transitions.d.mts +148 -0
  225. package/scripts/transitions.mjs +901 -0
  226. package/scripts/verrou-de-fichier.mjs +2 -2
  227. package/scripts/verrou-de-machine.mjs +322 -62
  228. package/skills/developpeur/SKILL.md +11 -3
  229. package/skills/explorateur/SKILL.md +2 -1
  230. package/skills/pitmaster/SKILL.md +62 -28
  231. package/skills/pitmaster/references/consigne-agent.md +5 -1
  232. package/skills/release/SKILL.md +3 -3
  233. package/skills/relecteur/SKILL.md +22 -8
  234. package/skills/testwriter/SKILL.md +47 -39
  235. package/scripts/demon.mjs +0 -138
  236. package/scripts/integration/file-attente.mjs +0 -61
  237. package/scripts/langages/cargo/touches.mjs +0 -93
  238. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -18,9 +18,10 @@
18
18
  // `requires-python` and `.python-version`. The rules that refuse a role that writes pytest run
19
19
  // directly (`droits`).
20
20
  // - The packages, a file's, the test files, what the testwriter writes, of the manifests too, the
21
- // readers, the entries of the index of the interfaces (./composants.mjs); the packages touched
22
- // since a commit and the elements of a lot (./lot.mjs).
23
- // - The commands `tester`, `verifier`, `typer`, `preparer` and `tests-de-nuit` (./commandes.mjs),
21
+ // readers, the entries of the index of the interfaces (./composants.mjs); the elements of a lot
22
+ // (./lot.mjs).
23
+ // - The commands `tester` (the projects' tasks of Turborepo), `tests-du-paquet` (the body of a
24
+ // project's task), `verifier`, `typer`, `preparer` and `tests-de-nuit` (./commandes.mjs),
24
25
  // each described, never run, and the verdict of a run (./verdict.mjs); the guard of the sizes of
25
26
  // the tests (./tailles-des-tests.mjs) and the index of the interfaces up to date, each a command
26
27
  // by its name too. The generated file, the index of the interfaces (./index-interfaces.mjs), its
@@ -37,13 +38,17 @@ import {
37
38
  composantDans,
38
39
  composants,
39
40
  entreesDeLIndex,
41
+ estDeNuit,
40
42
  estUnTest,
43
+ arbreDAvant,
41
44
  joueDesTests,
42
45
  lecteurs,
46
+ liensDuManifeste,
43
47
  manifestes,
48
+ nomDuManifeste,
44
49
  } from './composants.mjs';
45
50
  import { enRetard, SORTIE } from './index-interfaces.mjs';
46
- import { elementsDuLot, touches } from './lot.mjs';
51
+ import { elementsDuLot } from './lot.mjs';
47
52
  import { miseAJour } from './mise-a-jour.mjs';
48
53
  import { squelette } from './squelette.mjs';
49
54
  import { verdict } from './verdict.mjs';
@@ -53,6 +58,15 @@ const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
53
58
  export default {
54
59
  nom: 'python',
55
60
  manifeste: 'pyproject.toml',
61
+ nomDuManifeste,
62
+ liensDuManifeste,
63
+ construireLesPaquets: () => {
64
+ throw new Error('construction non prise en charge pour python');
65
+ },
66
+ // No output of a project of Python is a datum of another package's tests.
67
+ sortieDuPaquet: () => {
68
+ throw new Error('sortie non prise en charge pour python');
69
+ },
56
70
  outils: ['smol-toml'],
57
71
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
58
72
  ignorer: ['.venv', '.pytest_cache', PYCACHE],
@@ -73,11 +87,17 @@ export default {
73
87
  matieres: () => [],
74
88
  joueDesTests,
75
89
  lecteurs,
76
- touches,
77
90
  elementsDuLot,
78
91
  commandes,
79
92
  verdict,
80
93
  estUnTest,
94
+ // A night test, `*_nuit_test.py` (`estDeNuit`).
95
+ horsDuJour: chemin => estDeNuit(path.basename(chemin)),
96
+ arbreDAvant,
97
+ // Its tree needs no environment of its own: the virtual environment of a tree is uv's.
98
+ envDArbre: () => ({}),
99
+ // Its tool plays HEAD's version of each test file in a tree (`arbreDAvant`): no name to read.
100
+ testsDeHead: () => null,
81
101
  manifestes,
82
102
  fichiersEngendres: () => [
83
103
  {
@@ -1,16 +1,9 @@
1
- // The changes of a project of Python read by git: the packages touched since a commit (`touches`
2
- // of the join, scripts/jointure.d.ts) and the elements of a lot (`elementsDuLot`).
1
+ // The changes of a project of Python read by git: the elements of a lot (`elementsDuLot`).
3
2
  //
4
- // - The files changed since a commit: what git sees changed, the working tree and the untracked
5
- // files included (`git diff --name-only --no-renames <depuis>`, `git ls-files -o
6
- // --exclude-standard`). Each touches the package of the longest folder that holds it
7
- // (./composants.mjs); a file out of every package is out of the graph. No dependent: the module
8
- // reads no dependency between packages of Python.
9
3
  // - The lot between two commits (`git diff --name-only --no-renames <avant> <apres>`): every file
10
4
  // it changes in `fichiers`; the module reads no element of a source of Python, so each `.py` is
11
5
  // named in `horsDuService`, which the reviewer surveys himself.
12
6
  import { spawnSync } from 'node:child_process';
13
- import { composantDans, composants } from './composants.mjs';
14
7
 
15
8
  const lignesDeGit = (racine, args) => {
16
9
  const r = spawnSync('git', ['-C', racine, ...args, '-z'], {
@@ -23,34 +16,6 @@ const lignesDeGit = (racine, args) => {
23
16
  return r.stdout.split('\0').filter(Boolean);
24
17
  };
25
18
 
26
- /** The packages the files <fichiers> (from <racine>) touch, and the files out of the graph. */
27
- export function touchesDesFichiers(racine, fichiers) {
28
- const liste = composants(racine);
29
- const touches = new Set();
30
- const horsGraphe = [];
31
- for (const f of new Set(fichiers)) {
32
- const c = composantDans(liste, racine, f);
33
- if (c) {
34
- touches.add(c);
35
- } else {
36
- horsGraphe.push(f);
37
- }
38
- }
39
- return {
40
- touches: [...touches].sort((a, b) => a.nom.localeCompare(b.nom)),
41
- dependants: [],
42
- horsGraphe: horsGraphe.sort(),
43
- };
44
- }
45
-
46
- /** The packages touched in <racine> since the commit <depuis>, and the files out of the graph. */
47
- export function touches(racine, { depuis }) {
48
- return touchesDesFichiers(racine, [
49
- ...lignesDeGit(racine, ['diff', '--name-only', '--no-renames', depuis]),
50
- ...lignesDeGit(racine, ['ls-files', '-o', '--exclude-standard']),
51
- ]);
52
- }
53
-
54
19
  /** The elements of the lot of <racine> between <avant> and <apres>. */
55
20
  export function elementsDuLot(racine, { avant, apres }) {
56
21
  try {
@@ -2,52 +2,152 @@
2
2
  // (scripts/jointure.d.ts), which `grillhouse paquet` writes (scripts/paquet.mjs), as `uv init`
3
3
  // writes one: no behaviour, no test.
4
4
  //
5
- // - Its files: its pyproject.toml (PEP 621: its name, the folder's, its version 0.1.0, the Python
6
- // it requires, no dependency; its group `test` of `[dependency-groups]`, PEP 735, pytest, which
7
- // the module runs by `uv run --group test pytest`; the configuration of pytest,
8
- // `[tool.pytest.ini_options]`, its tests under `tests/` and its code importable from `src/`, as
9
- // uv's layout of a library has it); `src/<module>/__init__.py`, the module named after the
10
- // package (`-` read `_`), without code; `tests/.gitkeep`, its folder of tests. The typing is
5
+ // - Its name: the folder's, prefixed by the project's name when the root declares one (the
6
+ // `[project].name` of its pyproject.toml, else the `name` of its package.json, its scope when it
7
+ // has one), as the module typescript prefixes a package with the root's scope and Nx names a
8
+ // library after the workspace's scope; normalized as uv writes the name of a project (PEP 503:
9
+ // lowercase, each run of `-`, `_` or `.` read `-`), its module the name with `-` read `_`.
10
+ // - A module that would bear the name of a module of the standard library of Python is refused,
11
+ // by its name, nothing written, the name to give named (the root folder's name before the
12
+ // package's), as `cargo new` refuses a name Rust reserves: `import site` reaches the standard
13
+ // module, never the package. The list is the interpreter's own, `sys.stdlib_module_names`, of
14
+ // the Python the package requires, which uv provides; without uv, the refusal names `npx
15
+ // grillhouse maj`, which installs it.
16
+ // - Its files: its pyproject.toml (PEP 621: its name, its version 0.1.0, the Python it requires, no
17
+ // dependency; its group `test` of `[dependency-groups]`, PEP 735, pytest, which the module runs
18
+ // by `uv run --group test pytest`; the configuration of pytest, `[tool.pytest.ini_options]`, its
19
+ // tests under `tests/` and its code importable from `src/`, as uv's layout of a library has it);
20
+ // `src/<module>/__init__.py`, without code; `tests/.gitkeep`, its folder of tests. The typing is
11
21
  // `python -m compileall`, which needs no configuration. No build system: uv neither builds nor
12
22
  // installs the package to run its tests.
13
23
  // - The workspace: a root pyproject.toml whose `[tool.uv.workspace]` names its `members` receives
14
24
  // the package's path there, as `uv init` adds a project under a workspace to its members; without
15
25
  // one, the package is its own project of uv, as the module plays each package (./commandes.mjs).
16
26
  // - The lock of the versions: `uv lock`, at the workspace's root, else in the package.
27
+ // - A folder that already holds Python code is taken as it is, as `cargo init` takes the code in
28
+ // place: its tests (`test_*.py`, `*_test.py`, pytest's names) are collected where they are, its
29
+ // testpaths the folders that hold them and `tests`, each once, the package itself for a test at
30
+ // its root; no `src/<module>/` beside its code, and no `pythonpath` for code out of `src/`
31
+ // (code under `src/` keeps `pythonpath = ["src"]`); each `requirements.txt` is
32
+ // taken by `uv add -r`, in the order of its path, run in the package, which declares its
33
+ // dependencies and locks them, in place of `uv lock`. A manifest the module does not read
34
+ // (`setup.py`, `setup.cfg`, `Pipfile`) is refused by its name, nothing written, what to do named.
35
+ import { spawnSync } from 'node:child_process';
17
36
  import { existsSync, readFileSync } from 'node:fs';
18
37
  import { createRequire } from 'node:module';
19
38
  import path from 'node:path';
39
+ import { estUnFichierDeTest } from './composants.mjs';
20
40
 
21
41
  const require = createRequire(import.meta.url);
22
42
 
43
+ // The Python a package requires.
44
+ const PYTHON = '>=3.12';
45
+
46
+ // The manifests of Python the module does not read.
47
+ const ETRANGERS = new Set(['setup.py', 'setup.cfg', 'Pipfile']);
48
+
49
+ // The testpaths of a package whose files of tests lie in <fichiers> (from the package): the
50
+ // folders that hold them and `tests`, each once, a folder under another left out; the package
51
+ // itself, `.`, for a test at its root.
52
+ function cheminsDesTests(fichiers) {
53
+ const dossiers = new Set(
54
+ fichiers.filter(f => estUnFichierDeTest(path.posix.basename(f))).map(f => path.posix.dirname(f))
55
+ );
56
+ if (dossiers.has('.')) {
57
+ return ['.'];
58
+ }
59
+ const tous = [...dossiers, 'tests'].filter((d, i, l) => l.indexOf(d) === i).sort();
60
+ return tous.filter(d => !tous.some(o => d.startsWith(`${o}/`)));
61
+ }
62
+
63
+ // <n> normalized as uv writes the name of a project (PEP 503).
64
+ const normaliser = n => n.toLowerCase().replace(/[-_.]+/g, '-');
65
+
66
+ // The project's name the root at <racine> declares (see the header), null for none; <racinePy>
67
+ // its pyproject.toml read, null without one.
68
+ function nomDuProjet(racine, racinePy) {
69
+ const py = racinePy?.project?.name;
70
+ if (typeof py === 'string' && py.trim()) {
71
+ return py;
72
+ }
73
+ const f = path.join(racine, 'package.json');
74
+ const n = existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')).name : undefined;
75
+ return typeof n === 'string' && n.trim() ? (/^@([^/]+)\//.exec(n)?.[1] ?? n) : null;
76
+ }
77
+
78
+ // The modules of the standard library of Python, `sys.stdlib_module_names`, of the interpreter uv
79
+ // provides for PYTHON; throws, uv named, when uv cannot give them.
80
+ function modulesStandard(racine) {
81
+ const code = 'import sys; print("\\n".join(sorted(sys.stdlib_module_names)))';
82
+ const r = spawnSync(
83
+ 'uv',
84
+ ['run', '--no-project', '--quiet', '--python', PYTHON, 'python', '-c', code],
85
+ { cwd: racine, encoding: 'utf8' }
86
+ );
87
+ if (r.status !== 0) {
88
+ throw new Error(
89
+ `uv ne donne pas les modules de la bibliothèque standard de Python (${String(r.error?.message ?? r.stderr).trim()}) ; \`npx grillhouse maj\` installe uv, puis relance la commande.`
90
+ );
91
+ }
92
+ return new Set(r.stdout.split('\n').filter(Boolean));
93
+ }
94
+
23
95
  /** @type {import('../../jointure.js').Langage['squelette']} */
24
- export function squelette(racine, { chemin }) {
25
- const nom = path.posix.basename(chemin);
96
+ export function squelette(racine, { chemin, existants }) {
97
+ const etrangers = existants.filter(e => ETRANGERS.has(path.posix.basename(e)));
98
+ if (etrangers.length) {
99
+ throw new Error(
100
+ `${chemin} : ${etrangers.join(', ')} déclare un paquet Python que le module python ne lit pas. Reprends ses dépendances dans un requirements.txt, que le paquet reprend par \`uv add -r\`, retire-le, puis relance la commande.`
101
+ );
102
+ }
103
+ const code = existants.some(e => e.endsWith('.py'));
104
+ // Code out of src/ and tests/, which `pythonpath = ["src"]` would not reach.
105
+ const aPlat = existants.some(
106
+ e =>
107
+ e.endsWith('.py') &&
108
+ !e.startsWith('src/') &&
109
+ !e.startsWith('tests/') &&
110
+ !estUnFichierDeTest(path.posix.basename(e))
111
+ );
112
+ const exigences = existants.filter(e => path.posix.basename(e) === 'requirements.txt');
113
+ const f = path.join(racine, 'pyproject.toml');
114
+ const texte = existsSync(f) ? readFileSync(f, 'utf8') : null;
115
+ const racinePy = texte === null ? null : require('smol-toml').parse(texte);
116
+ const dossier = path.posix.basename(chemin);
117
+ const projet = nomDuProjet(racine, racinePy);
118
+ const nom = normaliser(projet ? `${projet}-${dossier}` : dossier);
26
119
  const module = nom.replace(/-/g, '_');
120
+ if (modulesStandard(racine).has(module)) {
121
+ const autre = normaliser(`${path.basename(racine)}-${nom}`);
122
+ throw new Error(
123
+ `${chemin} : son module, ${module}, est un module de la bibliothèque standard de Python ; \`import ${module}\` le trouverait, jamais le paquet. Nomme-le ${autre} (le dossier et sa ligne du tableau des composants), ou déclare le nom du projet à la racine (le \`name\` de son package.json), qui préfixe le paquet.`
124
+ );
125
+ }
27
126
  const manifeste = [
28
127
  '[project]',
29
128
  `name = ${JSON.stringify(nom)}`,
30
129
  'version = "0.1.0"',
31
- 'requires-python = ">=3.12"',
130
+ `requires-python = ${JSON.stringify(PYTHON)}`,
32
131
  'dependencies = []',
33
132
  '',
34
133
  '[dependency-groups]',
35
134
  'test = ["pytest>=8"]',
36
135
  '',
37
136
  '[tool.pytest.ini_options]',
38
- 'testpaths = ["tests"]',
39
- 'pythonpath = ["src"]',
137
+ `testpaths = ${JSON.stringify(cheminsDesTests(existants)).replaceAll(',', ', ')}`,
138
+ ...(aPlat ? [] : ['pythonpath = ["src"]']),
40
139
  '',
41
140
  ].join('\n');
42
141
  const fichiers = {
43
142
  [`${chemin}/pyproject.toml`]: manifeste,
44
- [`${chemin}/src/${module}/__init__.py`]: `"""The package ${nom}: its interface, docs/INTERFACE.md, says what it offers."""\n`,
143
+ ...(code
144
+ ? {}
145
+ : {
146
+ [`${chemin}/src/${module}/__init__.py`]: `"""The package ${nom}: its interface, docs/INTERFACE.md, says what it offers."""\n`,
147
+ }),
45
148
  [`${chemin}/tests/.gitkeep`]: '',
46
149
  };
47
- const f = path.join(racine, 'pyproject.toml');
48
- const texte = existsSync(f) ? readFileSync(f, 'utf8') : null;
49
- const espace =
50
- texte === null ? null : (require('smol-toml').parse(texte).tool?.uv?.workspace ?? null);
150
+ const espace = racinePy?.tool?.uv?.workspace ?? null;
51
151
  const membres = Array.isArray(espace?.members) ? espace.members : null;
52
152
  let entree = null;
53
153
  if (membres && !membres.some(m => typeof m === 'string' && path.matchesGlob(chemin, m))) {
@@ -61,6 +161,8 @@ export function squelette(racine, { chemin }) {
61
161
  return {
62
162
  fichiers,
63
163
  espace: entree,
64
- verrouiller: { commande: 'uv', args: ['lock'], dossier: membres ? '.' : chemin },
164
+ verrouiller: exigences.length
165
+ ? exigences.map(e => ({ commande: 'uv', args: ['add', '-r', e], dossier: chemin }))
166
+ : [{ commande: 'uv', args: ['lock'], dossier: membres ? '.' : chemin }],
65
167
  };
66
168
  }
@@ -5,172 +5,15 @@
5
5
  //
6
6
  // node construire.mjs --echec <fichier> <plan> from the root of the copy
7
7
  //
8
- // - <plan> is the session's plan, the paths of the packages it writes, in the form of the
9
- // envelope's variable (`lireLaListe` of the core's services, `packages/a:packages/b`).
10
- // - As Bazel builds the dependencies of a target before the target: for a plan whose every path
11
- // is a package of the frame, their providers are built first (the builds their builds wait for,
12
- // read in Turborepo's graph, `turbo run build --filter=<paquet>… --dry=json`), and a failure
13
- // stops the launch; then the traces of other packages their tests wait for
14
- // (`grillhouse.traces`, read in Turborepo's plan of their tests, `turbo run test:unit
15
- // --filter=<paquet>… --dry=json`), which the envelope shows read-only, and a failure stops the
16
- // launch. A task of either step that waits, directly or not, for a task of a package of the plan
17
- // (`attendentLePlan` of ./turbo-des-paquets.mjs) is not played there: as with Bazel's
18
- // --keep_going, a package of the plan stays a target of the plan even as another's provider
19
- // (BPScript's 990-corpus, the shared test material, which the trace of 060-encoder waits for),
20
- // and goes with the plan. Then the packages, the traces of the plan or that wait for it, and what
21
- // their tests read (`turbo run build <those traces> --filter=<paquet>...…
22
- // --continue=dependencies-successful`), whose failure does not stop the launch: each task whose
23
- // dependencies succeed goes to its end, so what their tests read without depending on them is
24
- // built whole. Their consumers are not built.
25
- // - Any other plan, the whole repository (`.`) included, or a path that is no package of the frame
26
- // (BPScript's libraries/), reads the graph of the whole copy dry (`turbo run build --dry=json`),
27
- // whose failure (Turborepo absent, its configuration refused) stops the launch, then builds the
28
- // copy whole as far as it builds (`turbo run build --continue=dependencies-successful`), whose
29
- // failure does not stop the launch either.
30
- // - A build that fails without stopping the launch writes in <fichier> the line that says which
31
- // build failed and what was built, then its output, which the launcher puts in the session's
32
- // instruction (« La construction échoue »): repairing it is the session's work. Its output goes
33
- // to the standard output too.
8
+ // - The launcher is the core's, one for every language (`construireDepuisLesArguments` of
9
+ // scripts/taches-du-graphe.mjs): the plan and its providers by `turbo run build
10
+ // --filter=<paquet>…`, the whole copy for a plan with a path that is no package of the graph.
11
+ // This module gives it Turborepo, the task runner of the graph.
34
12
  // - The exit code: 0 when the launch goes on, a build failure included; 1 for a step that stops it;
35
13
  // 2 for a malformed call.
36
- import { spawnSync } from 'node:child_process';
37
- import { closeSync, openSync, readFileSync, writeFileSync } from 'node:fs';
38
- import path from 'node:path';
39
14
  import { pathToFileURL } from 'node:url';
40
- import { paquets } from '../../paquets.mjs';
41
- import { lireLaListe } from '../../services-du-noyau.mjs';
42
- import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
43
- import { attendentLePlan, tracesDuPlan } from './turbo-des-paquets.mjs';
44
-
45
- const TURBO = ['--no-install', 'turbo'];
46
- const ENTIERE =
47
- "La construction de la copie entière échoue ; ce qui n'attend pas la construction en échec est construit.";
48
- const DU_PLAN =
49
- "La construction des paquets de ton plan échoue ; leurs fournisseurs et ce que leurs tests lisent sans dépendre d'eux sont construits.";
50
-
51
- class Arret extends Error {}
52
-
53
- // Turborepo with <args> in <racine>, its output on this process's; throws Arret on a failure.
54
- function turbo(racine, args) {
55
- const r = spawnSync('npx', [...TURBO, ...args], { cwd: racine, stdio: 'inherit' });
56
- if (r.status !== 0) {
57
- throw new Arret(`turbo ${args.join(' ')}`);
58
- }
59
- }
60
-
61
- // Turborepo's plan of <args> in <racine>, parsed; throws Arret on a failure.
62
- function plan(racine, args) {
63
- const r = spawnSync('npx', [...TURBO, ...args, '--dry=json'], {
64
- cwd: racine,
65
- encoding: 'utf8',
66
- maxBuffer: 256 * 1024 * 1024,
67
- stdio: ['ignore', 'pipe', 'inherit'],
68
- });
69
- if (r.status !== 0) {
70
- throw new Arret(`turbo ${args.join(' ')} --dry=json`);
71
- }
72
- return JSON.parse(r.stdout);
73
- }
74
-
75
- // The build <args> in <racine>, its output in <echec> then on this process's: when it fails,
76
- // <echec> holds <ligne> then that output, and the warning <alerte> follows it.
77
- function construireJusquOuIlConstruit(racine, args, echec, ligne, alerte) {
78
- const fd = openSync(echec, 'w');
79
- let r;
80
- try {
81
- r = spawnSync('npx', [...TURBO, ...args], { cwd: racine, stdio: ['ignore', fd, fd] });
82
- } finally {
83
- closeSync(fd);
84
- }
85
- const sortie = readFileSync(echec, 'utf8');
86
- process.stdout.write(sortie);
87
- if (r.status === 0) {
88
- writeFileSync(echec, '');
89
- return;
90
- }
91
- process.stdout.write(`${alerte}\n`);
92
- writeFileSync(echec, `${ligne}\n${sortie}`);
93
- }
94
-
95
- /**
96
- * Builds the copy at <racine> for the plan <liste>, the failure of a build that does not stop the
97
- * launch written in <echec>: the exit code (see the header).
98
- * @param {string} racine the root of the copy
99
- * @param {string} liste the plan, in the form of the envelope's variable
100
- * @param {string} echec the file of a build that fails
101
- */
102
- export function construire(racine, liste, echec) {
103
- writeFileSync(echec, '');
104
- const tous = paquets(racine).filter(p => !p.hors);
105
- const noms = lireLaListe(liste).map(
106
- d => tous.find(p => p.dossier === path.normalize(d).replace(/\/$/, ''))?.pkg.name ?? null
107
- );
108
- try {
109
- if (noms.length === 0 || !noms.every(Boolean)) {
110
- plan(racine, ['run', 'build']);
111
- construireJusquOuIlConstruit(
112
- racine,
113
- ['run', 'build', '--continue=dependencies-successful'],
114
- echec,
115
- ENTIERE,
116
- "⚠️ La construction de la copie échoue : la séance s'ouvre, la consigne porte l'erreur."
117
- );
118
- return 0;
119
- }
120
- const cibles = noms.map(n => `--filter=${n}`);
121
- // Their providers: the builds their own builds wait for, save those that wait for a package
122
- // of the plan, which go with the plan below.
123
- const graphe = plan(racine, ['run', 'build', ...cibles]);
124
- const avecLePlan = attendentLePlan(graphe, noms);
125
- const fournisseurs = graphe.tasks
126
- .map(t => t.taskId)
127
- .filter(id => !avecLePlan.has(id))
128
- .sort();
129
- if (fournisseurs.length) {
130
- turbo(racine, ['run', ...fournisseurs]);
131
- }
132
- // The traces their tests wait for: another package's trace that waits for no package of the
133
- // plan is produced here, a failure stopping the launch, as a provider's; a trace of the plan,
134
- // or one that waits for it, is produced with the plan below.
135
- const tests = plan(racine, ['run', SCRIPT_DES_TESTS, ...cibles]);
136
- const attend = attendentLePlan(tests, noms);
137
- const autres = tracesDuPlan(tests, t => !attend.has(t.taskId));
138
- if (autres.length) {
139
- turbo(racine, ['run', ...autres]);
140
- }
141
- const avec = tracesDuPlan(tests, t => attend.has(t.taskId));
142
- construireJusquOuIlConstruit(
143
- racine,
144
- [
145
- 'run',
146
- 'build',
147
- ...avec,
148
- ...noms.map(n => `--filter=${n}...`),
149
- '--continue=dependencies-successful',
150
- ],
151
- echec,
152
- DU_PLAN,
153
- `⚠️ La construction du plan (${noms.join(' ')}) échoue : la séance s'ouvre, la consigne porte l'erreur.`
154
- );
155
- return 0;
156
- } catch (e) {
157
- if (!(e instanceof Arret)) {
158
- throw e;
159
- }
160
- process.stderr.write(`⛔ ${e.message} échoue.\n`);
161
- return 1;
162
- }
163
- }
15
+ import { construireDepuisLesArguments } from '../../services-du-noyau.mjs';
164
16
 
165
17
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
166
- const args = process.argv.slice(2);
167
- const i = args.indexOf('--echec');
168
- const echec = i >= 0 ? args[i + 1] : undefined;
169
- const reste = i >= 0 ? [...args.slice(0, i), ...args.slice(i + 2)] : args;
170
- if (!echec || reste.length !== 1) {
171
- process.stderr.write('usage: construire.mjs --echec <fichier> <plan>\n');
172
- process.exitCode = 2;
173
- } else {
174
- process.exitCode = construire(process.cwd(), reste[0], echec);
175
- }
18
+ process.exitCode = construireDepuisLesArguments('turbo', process.argv.slice(2));
176
19
  }
@@ -8,8 +8,7 @@
8
8
  // interfaces, the turbo.json of the packages): `aJour`; the same with each generated file out
9
9
  // of date: the interface of `a` changed after its index, a fault listed that its code never
10
10
  // produces (the check of the interfaces against the code), the turbo.json of `b` stale:
11
- // `enRetard`; the same, committed, a file of `a` then changed and a file out of every package
12
- // added: `change`, measured from its commit; the same where the code of `b` imports `a` and the
11
+ // `enRetard`; the same where the code of `b` imports `a` and the
13
12
  // code of `c` imports `b`: `lus`; the same with a second commit that changes a file of `a`:
14
13
  // `lot`. A directory whose package.json names no package: `vide`. A
15
14
  // repository of two packages, one with the script of the tests (`test:unit`): `avecTests`.
@@ -141,10 +140,6 @@ export default {
141
140
  const avantLeLot = tete(lot);
142
141
  writeFileSync(path.join(lot, 'packages/a/src/index.ts'), 'export const a = 3;\n');
143
142
  git(lot, 'commit', '-q', '-am', 'lot');
144
- const change = depot(dans);
145
- const depuis = tete(change);
146
- writeFileSync(path.join(change, 'packages/a/src/index.ts'), 'export const a = 2;\n');
147
- writeFileSync(path.join(change, 'notes.txt'), 'hors des paquets\n');
148
143
  return {
149
144
  racine: aJour,
150
145
  composants: {
@@ -169,11 +164,6 @@ export default {
169
164
  invalide: { racine: lus, noms: ['package.json'] },
170
165
  attendu: ['b lit a', 'c lit b', 'package.json : sans fournisseur'],
171
166
  },
172
- touches: {
173
- valide: { racine: aJour, depuis: 'HEAD' },
174
- invalide: { racine: change, depuis },
175
- attendu: ['touché a', 'dépendant b', 'dépendant c', 'hors notes.txt'],
176
- },
177
167
  commandes: {
178
168
  valide: [
179
169
  'tester',
@@ -188,6 +178,7 @@ export default {
188
178
  'interfaces-contre-code',
189
179
  'resumes',
190
180
  'tailles-des-tests',
181
+ 'titres-de-tests',
191
182
  'turbo-des-paquets',
192
183
  ],
193
184
  invalide: ['tester', 'deployer'],
@@ -235,6 +226,22 @@ export default {
235
226
  'packages/m/src/index.ts : matiere',
236
227
  ],
237
228
  },
229
+ versionDeHead: {
230
+ valide: ['packages/a/src/index.ts', 'packages/a/tests/aide.ts', 'README.md'],
231
+ // A night test and a bench keep their mark, so that their sibling plays as they do.
232
+ invalide: [
233
+ 'packages/a/src/index.test.ts',
234
+ 'packages/a/src/index.spec.mjs',
235
+ 'packages/a/tests/tout.nuit.test.ts',
236
+ 'packages/a/tests/vitesse.budget.test.ts',
237
+ ],
238
+ attendu: [
239
+ 'packages/a/src/index.test.ts → packages/a/src/index.circuit-avant.test.ts',
240
+ 'packages/a/src/index.spec.mjs → packages/a/src/index.circuit-avant.spec.mjs',
241
+ 'packages/a/tests/tout.nuit.test.ts → packages/a/tests/tout.circuit-avant.nuit.test.ts',
242
+ 'packages/a/tests/vitesse.budget.test.ts → packages/a/tests/vitesse.circuit-avant.budget.test.ts',
243
+ ],
244
+ },
238
245
  fichiersEngendres: {
239
246
  valide: aJour,
240
247
  invalide: enRetard,
@@ -254,6 +261,7 @@ export default {
254
261
  'interfaces-contre-code',
255
262
  'code-mort',
256
263
  'tailles-des-tests',
264
+ 'titres-de-tests',
257
265
  'chemins-des-tests',
258
266
  'resumes',
259
267
  ],
@@ -165,7 +165,7 @@ export function configuration(racine) {
165
165
  severity: 'warn',
166
166
  from: {
167
167
  orphan: true,
168
- pathNot: [`${TESTS}|(^|/)index[.][a-z]+$|[.]d[.]ts$|[.]config[.][a-z]+$`, ...bin].join('|'),
168
+ pathNot: [`${TESTS}|(^|/)index[.][a-z]+$|[.]d[.][mc]?ts$|[.]config[.][a-z]+$`, ...bin].join('|'),
169
169
  },
170
170
  to: {},
171
171
  },