@roomi-fields/grillhouse 0.29.0 → 0.31.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 (263) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +769 -0
  3. package/agents/developpeur.md +0 -1
  4. package/agents/explorateur.md +0 -1
  5. package/agents/questionneur.md +0 -1
  6. package/agents/testwriter.md +0 -1
  7. package/bin/grillhouse.mjs +79 -18
  8. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  9. package/cadre/templates/projet/CLAUDE.md +5 -1
  10. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  11. package/cadre/templates/projet/package.json +2 -2
  12. package/charte.md +24 -0
  13. package/dist/temporal/acte.d.ts +24 -0
  14. package/dist/temporal/acte.js +139 -0
  15. package/dist/temporal/acte.js.map +1 -0
  16. package/dist/temporal/attributs.d.ts +6 -0
  17. package/dist/temporal/attributs.js +15 -0
  18. package/dist/temporal/attributs.js.map +1 -0
  19. package/dist/temporal/circuit/activites.d.ts +13 -0
  20. package/dist/temporal/circuit/activites.js +33 -0
  21. package/dist/temporal/circuit/activites.js.map +1 -0
  22. package/dist/temporal/circuit/client.d.ts +72 -0
  23. package/dist/temporal/circuit/client.js +247 -0
  24. package/dist/temporal/circuit/client.js.map +1 -0
  25. package/dist/temporal/circuit/commande.d.ts +2 -0
  26. package/dist/temporal/circuit/commande.js +238 -0
  27. package/dist/temporal/circuit/commande.js.map +1 -0
  28. package/dist/temporal/circuit/contrat.d.ts +305 -0
  29. package/dist/temporal/circuit/contrat.js +30 -0
  30. package/dist/temporal/circuit/contrat.js.map +1 -0
  31. package/dist/temporal/circuit/deroule.d.ts +3 -0
  32. package/dist/temporal/circuit/deroule.js +540 -0
  33. package/dist/temporal/circuit/deroule.js.map +1 -0
  34. package/dist/temporal/client.d.ts +47 -0
  35. package/dist/temporal/client.js +69 -0
  36. package/dist/temporal/client.js.map +1 -0
  37. package/dist/temporal/commande.d.ts +2 -0
  38. package/dist/temporal/commande.js +94 -0
  39. package/dist/temporal/commande.js.map +1 -0
  40. package/dist/temporal/deroules.d.ts +5 -0
  41. package/dist/temporal/deroules.js +10 -0
  42. package/dist/temporal/deroules.js.map +1 -0
  43. package/dist/temporal/etat.d.ts +33 -0
  44. package/dist/temporal/etat.js +59 -0
  45. package/dist/temporal/etat.js.map +1 -0
  46. package/dist/temporal/file/activites.d.ts +10 -0
  47. package/dist/temporal/file/activites.js +25 -0
  48. package/dist/temporal/file/activites.js.map +1 -0
  49. package/dist/temporal/file/client.d.ts +4 -0
  50. package/dist/temporal/file/client.js +6 -0
  51. package/dist/temporal/file/client.js.map +1 -0
  52. package/dist/temporal/file/contrat.d.ts +158 -0
  53. package/dist/temporal/file/contrat.js +14 -0
  54. package/dist/temporal/file/contrat.js.map +1 -0
  55. package/dist/temporal/file/deroule.d.ts +15 -0
  56. package/dist/temporal/file/deroule.js +235 -0
  57. package/dist/temporal/file/deroule.js.map +1 -0
  58. package/dist/temporal/installation.d.ts +120 -0
  59. package/dist/temporal/installation.js +386 -0
  60. package/dist/temporal/installation.js.map +1 -0
  61. package/dist/temporal/places/activites.d.ts +8 -0
  62. package/dist/temporal/places/activites.js +13 -0
  63. package/dist/temporal/places/activites.js.map +1 -0
  64. package/dist/temporal/places/client.d.ts +28 -0
  65. package/dist/temporal/places/client.js +64 -0
  66. package/dist/temporal/places/client.js.map +1 -0
  67. package/dist/temporal/places/contrat.d.ts +106 -0
  68. package/dist/temporal/places/contrat.js +21 -0
  69. package/dist/temporal/places/contrat.js.map +1 -0
  70. package/dist/temporal/places/deroule.d.ts +3 -0
  71. package/dist/temporal/places/deroule.js +198 -0
  72. package/dist/temporal/places/deroule.js.map +1 -0
  73. package/dist/temporal/sonde/activites.d.ts +6 -0
  74. package/dist/temporal/sonde/activites.js +52 -0
  75. package/dist/temporal/sonde/activites.js.map +1 -0
  76. package/dist/temporal/sonde/contrat.d.ts +35 -0
  77. package/dist/temporal/sonde/contrat.js +10 -0
  78. package/dist/temporal/sonde/contrat.js.map +1 -0
  79. package/dist/temporal/sonde/deroule.d.ts +3 -0
  80. package/dist/temporal/sonde/deroule.js +39 -0
  81. package/dist/temporal/sonde/deroule.js.map +1 -0
  82. package/dist/temporal/tickets/activites.d.ts +7 -0
  83. package/dist/temporal/tickets/activites.js +81 -0
  84. package/dist/temporal/tickets/activites.js.map +1 -0
  85. package/dist/temporal/tickets/client.d.ts +10 -0
  86. package/dist/temporal/tickets/client.js +31 -0
  87. package/dist/temporal/tickets/client.js.map +1 -0
  88. package/dist/temporal/tickets/contrat.d.ts +56 -0
  89. package/dist/temporal/tickets/contrat.js +13 -0
  90. package/dist/temporal/tickets/contrat.js.map +1 -0
  91. package/dist/temporal/tickets/deroule.d.ts +3 -0
  92. package/dist/temporal/tickets/deroule.js +94 -0
  93. package/dist/temporal/tickets/deroule.js.map +1 -0
  94. package/dist/temporal/travailleur.d.ts +2 -0
  95. package/dist/temporal/travailleur.js +69 -0
  96. package/dist/temporal/travailleur.js.map +1 -0
  97. package/docs/ARCHITECTURE.md +646 -87
  98. package/docs/CADRE.md +27 -0
  99. package/docs/INTERFACE.md +139 -42
  100. package/hooks/crochet.mjs +19 -2
  101. package/hooks/hooks.json +11 -0
  102. package/package.json +16 -4
  103. package/scripts/activites.mjs +2255 -0
  104. package/scripts/aiguillage.d.mts +37 -0
  105. package/scripts/aiguillage.mjs +40 -14
  106. package/scripts/avancement.mjs +155 -26
  107. package/scripts/bilan.mjs +137 -43
  108. package/scripts/cadre.mjs +16 -4
  109. package/scripts/circuit.mjs +993 -4075
  110. package/scripts/circuits-cles.d.mts +4 -0
  111. package/scripts/circuits-cles.mjs +21 -0
  112. package/scripts/circuits-du-serveur.mjs +105 -0
  113. package/scripts/codes-de-sortie.mjs +9 -0
  114. package/scripts/commandes-composees.mjs +45 -41
  115. package/scripts/commandes-du-path.d.mts +7 -0
  116. package/scripts/commandes-du-path.mjs +25 -0
  117. package/scripts/composants-affectes.mjs +64 -21
  118. package/scripts/composition-des-langages.mjs +18 -12
  119. package/scripts/conformite.mjs +56 -28
  120. package/scripts/copies-finies.mjs +52 -47
  121. package/scripts/depart-du-ticket.d.mts +53 -0
  122. package/scripts/depart-du-ticket.mjs +124 -0
  123. package/scripts/dependances-internes.mjs +121 -0
  124. package/scripts/dernier-vert.mjs +61 -34
  125. package/scripts/dette.mjs +32 -11
  126. package/scripts/donnees-cles.mjs +244 -0
  127. package/scripts/droits.mjs +51 -16
  128. package/scripts/effets.mjs +352 -0
  129. package/scripts/empreinte-d-etape.mjs +17 -0
  130. package/scripts/engendres.mjs +15 -5
  131. package/scripts/enveloppe/enveloppe.mjs +259 -55
  132. package/scripts/enveloppe/lancer.sh +14 -18
  133. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  134. package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
  135. package/scripts/etapes.mjs +5 -2
  136. package/scripts/faits-du-circuit.mjs +493 -0
  137. package/scripts/file-des-tickets.d.mts +21 -0
  138. package/scripts/file-des-tickets.mjs +58 -0
  139. package/scripts/flux-des-paquets.mjs +201 -0
  140. package/scripts/gardes-du-cadre.mjs +21 -5
  141. package/scripts/init.mjs +11 -4
  142. package/scripts/integration/file.mjs +544 -434
  143. package/scripts/integration/integrer.mjs +87 -43
  144. package/scripts/integration/rejeu.mjs +45 -13
  145. package/scripts/jointure.d.ts +151 -28
  146. package/scripts/langages/cargo/commandes.mjs +383 -124
  147. package/scripts/langages/cargo/composants.mjs +154 -42
  148. package/scripts/langages/cargo/exemples.mjs +12 -21
  149. package/scripts/langages/cargo/index.mjs +22 -8
  150. package/scripts/langages/cargo/sccache.mjs +8 -14
  151. package/scripts/langages/cargo/tests-de-head.mjs +25 -9
  152. package/scripts/langages/python/commandes.mjs +218 -100
  153. package/scripts/langages/python/composants.mjs +53 -21
  154. package/scripts/langages/python/exemples.mjs +6 -16
  155. package/scripts/langages/python/index.mjs +28 -8
  156. package/scripts/langages/python/lot.mjs +1 -36
  157. package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
  158. package/scripts/langages/typescript/composants.mjs +9 -3
  159. package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
  160. package/scripts/langages/typescript/consommateurs.mjs +39 -14
  161. package/scripts/langages/typescript/construire.mjs +6 -163
  162. package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
  163. package/scripts/langages/typescript/exemples.mjs +3 -11
  164. package/scripts/langages/typescript/frontieres.mjs +66 -22
  165. package/scripts/langages/typescript/index-interfaces.mjs +36 -13
  166. package/scripts/langages/typescript/index.mjs +50 -61
  167. package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
  168. package/scripts/langages/typescript/lecteurs.mjs +36 -11
  169. package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
  170. package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
  171. package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
  172. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  173. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
  174. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  175. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  176. package/scripts/langages/typescript/parcours.mjs +12 -4
  177. package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
  178. package/scripts/langages/typescript/resumes.mjs +9 -3
  179. package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
  180. package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
  181. package/scripts/langages/typescript/tests.mjs +40 -15
  182. package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
  183. package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
  184. package/scripts/langages/typescript/verdict.mjs +4 -2
  185. package/scripts/langages/typescript/verifier.mjs +58 -20
  186. package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
  187. package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
  188. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  189. package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
  190. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  191. package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
  192. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  193. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
  194. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
  195. package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
  196. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
  197. package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
  198. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  199. package/scripts/lint-des-scripts.mjs +58 -0
  200. package/scripts/mesure/base-de-passe.mjs +117 -25
  201. package/scripts/mesure/pression.mjs +12 -6
  202. package/scripts/mesure-de-la-machine.d.mts +21 -0
  203. package/scripts/mesure-de-la-machine.mjs +76 -0
  204. package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
  205. package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
  206. package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
  207. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
  208. package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
  209. package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
  210. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
  211. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  212. package/scripts/migrations.mjs +5 -0
  213. package/scripts/nuit.sh +25 -3
  214. package/scripts/outil.mjs +3 -1
  215. package/scripts/outils-cles.d.mts +24 -0
  216. package/scripts/outils-cles.mjs +18 -8
  217. package/scripts/paquet-npm.mjs +157 -0
  218. package/scripts/paquet.mjs +73 -4
  219. package/scripts/paquets.mjs +46 -10
  220. package/scripts/passe-de-la-machine.mjs +71 -0
  221. package/scripts/places-de-la-machine.mjs +414 -0
  222. package/scripts/places-du-serveur.mjs +170 -0
  223. package/scripts/prefixe-des-tickets.mjs +68 -0
  224. package/scripts/preparation.mjs +25 -8
  225. package/scripts/registre.mjs +9 -4
  226. package/scripts/regles-des-places.d.mts +36 -0
  227. package/scripts/regles-des-places.mjs +70 -0
  228. package/scripts/reponses-du-circuit.d.mts +6 -0
  229. package/scripts/reponses-du-circuit.mjs +28 -0
  230. package/scripts/reprise.mjs +66 -0
  231. package/scripts/resultats.mjs +112 -46
  232. package/scripts/retirer-les-copies-finies.mjs +25 -0
  233. package/scripts/sans-reponse.d.mts +4 -0
  234. package/scripts/sans-reponse.mjs +13 -0
  235. package/scripts/seances.mjs +936 -0
  236. package/scripts/services-du-noyau.mjs +27 -8
  237. package/scripts/session-start.sh +2 -2
  238. package/scripts/sortie.mjs +3 -3
  239. package/scripts/sous-commandes.mjs +41 -10
  240. package/scripts/style-a-l-ecriture.mjs +260 -0
  241. package/scripts/superviseur.mjs +122 -111
  242. package/scripts/tableau.mjs +180 -117
  243. package/scripts/taches-du-graphe.mjs +348 -0
  244. package/scripts/ticket-du-circuit.mjs +216 -0
  245. package/scripts/transitions.d.mts +148 -0
  246. package/scripts/transitions.mjs +1018 -0
  247. package/scripts/verrou-de-fichier.mjs +8 -4
  248. package/scripts/verrou-de-machine.mjs +150 -51
  249. package/scripts/verrous/commande.mjs +50 -17
  250. package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
  251. package/scripts/verrous/verrou.mjs +42 -14
  252. package/skills/explorateur/SKILL.md +9 -2
  253. package/skills/grill/SKILL.md +1 -1
  254. package/skills/mesure/SKILL.md +3 -0
  255. package/skills/pitmaster/SKILL.md +17 -18
  256. package/skills/pitmaster/references/consigne-agent.md +5 -1
  257. package/skills/release/SKILL.md +3 -3
  258. package/skills/relecteur/SKILL.md +5 -3
  259. package/skills/testwriter/SKILL.md +49 -31
  260. package/scripts/demon.mjs +0 -251
  261. package/scripts/integration/file-attente.mjs +0 -61
  262. package/scripts/langages/cargo/touches.mjs +0 -93
  263. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -10,11 +10,28 @@
10
10
  export * from './langages.mjs';
11
11
 
12
12
  // The services of the core to a module of language: the plan of an envelope, the progress of a
13
- // pass and its measure, the base of a pass, the pressure of the machine and its lock, the last
14
- // green, the arbitrages of a ticket, the source files of a project.
13
+ // pass and its measure, the tasks of the graph of the packages, the base of a pass, the pressure of the machine, its place and its lock, the last
14
+ // green, the arbitrages of a ticket, the source files of a project, the search of a command in the
15
+ // PATH.
15
16
  export { arbitrageTranche, estArbitrage } from './arbitrages.mjs';
16
17
  export { garderLeTotal, inscrireLePlan, ouvrirAvancement } from './avancement.mjs';
17
18
  export { sources } from './sources.mjs';
19
+ export { trouverDansLePath } from './commandes-du-path.mjs';
20
+ export { paquetsSansPackageJson } from './paquet-npm.mjs';
21
+ export {
22
+ cheminsDeLaTache,
23
+ construireDepuisLesArguments,
24
+ empreintesDesTaches,
25
+ GRAPHE_JOUE,
26
+ lancerLesTaches,
27
+ nomDuPaquet,
28
+ PASSE_ROUGE,
29
+ SCRIPT_DES_TESTS,
30
+ TESTS_CIBLES,
31
+ testsCibles,
32
+ TRACE,
33
+ tracesDuPlan,
34
+ } from './taches-du-graphe.mjs';
18
35
  export { luUneFois } from './lecture-unique.mjs';
19
36
  export { CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
20
37
  export { lireLaListe, paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
@@ -27,10 +44,12 @@ export {
27
44
  ouvrirBase,
28
45
  retirerALInterruption,
29
46
  } from './mesure/base-de-passe.mjs';
30
- export { A_REPASSER, ecrirePression, lirePression, SEUIL_PRESSION } from './mesure/pression.mjs';
47
+ export { A_REPASSER } from './codes-de-sortie.mjs';
48
+ export { ecrirePression, lirePression, SEUIL_PRESSION } from './mesure/pression.mjs';
31
49
  export {
32
- attendreDeLaPlace,
33
- AttenteDeLaMachine,
34
- avecLaMachine,
35
- nommerLAvancement,
36
- } from './verrou-de-machine.mjs';
50
+ avecLaMachineEtUnePlace,
51
+ surUnePlace,
52
+ travailleursDeLaSeance,
53
+ } from './places-de-la-machine.mjs';
54
+ export { attendreDeLaPlace, AttenteDeLaMachine, nommerLAvancement } from './verrou-de-machine.mjs';
55
+ export { CONFIG_BEADS, ecrireLePrefixe, prefixe } from './prefixe-des-tickets.mjs';
@@ -31,8 +31,8 @@
31
31
  # repository, and, when its opening takes the lock (not when it keeps it, after a compaction or a
32
32
  # /clear), receives the section « L'attente des questions », the wait to launch in the background,
33
33
  # then « Les circuits du dépôt » when there are some: each circuit that runs, each one stopped on a
34
- # question with its question and the command that answers it, each one dead without a final state
35
- # with the command that resumes it; a second session, while the first one lives, receives first the section « Un autre
34
+ # question with its question and the command that answers it, each one whose workflow ended
35
+ # without its issue with the command that resumes it; a second session, while the first one lives, receives first the section « Un autre
36
36
  # superviseur tient ce dépôt », which asks it to say so to the owner and to launch no circuit. An
37
37
  # agent's copy and a session of a role the circuit launches take nothing and receive nothing.
38
38
  #
@@ -2,8 +2,8 @@
2
2
  // A release of Grillhouse, its package npm, which carries the frame's plugin: Grillhouse's own
3
3
  // script, which no project runs (`grillhouse init` installs the template of a project alone).
4
4
  //
5
- // npx grillhouse sortie <x.y.z> the release's files: the package's package.json, CHANGELOG.md
6
- // npx grillhouse sortie --etiqueter the annotated tag v<version> on HEAD, the release commit
5
+ // npx grillhouse sortie <x.y.z> the release's files: the package's package.json, packages/grillhouse/CHANGELOG.md
6
+ // npx grillhouse sortie --etiqueter the annotated tag v<version> on HEAD, the release commit
7
7
  // and the gesture that leads Grillhouse with it once published
8
8
  // npx grillhouse sortie --verifier-etiquette <v> exits 0 when the tag <v> names the version of the package
9
9
  // npx grillhouse sortie --entree-du-marche the entry of the plugin in the marketplace roomi-fields
@@ -39,7 +39,7 @@ export const ENTREE_DU_MARCHE = {
39
39
  name: 'grillhouse',
40
40
  source: { source: 'npm', package: '@roomi-fields/grillhouse' },
41
41
  };
42
- const CHANGELOG = 'CHANGELOG.md';
42
+ const CHANGELOG = 'packages/grillhouse/CHANGELOG.md';
43
43
  const OUVERTE = '## [Unreleased]\n';
44
44
  const SEMVER = /^(\d+)\.(\d+)\.(\d+)$/;
45
45
 
@@ -10,11 +10,16 @@
10
10
  // - `tests` and `verifier` run the commands the modules of the project's languages describe
11
11
  // (`commandes`, scripts/jointure.d.ts: `tester` and `verifier`; for several languages, the
12
12
  // composed command, scripts/commandes-composees.mjs), the project being the working directory
13
- // (scripts/langages.mjs); each other command it describes but `typer` is a subcommand
14
- // by its name (`frontieres`, `index-interfaces`), as a backend of Pants brings its goals.
13
+ // (scripts/langages.mjs); each other command it describes is a subcommand by its name
14
+ // (`frontieres`, `index-interfaces`, `typer`, `construire`), as a backend of Pants brings its
15
+ // goals.
16
+ // - `temporal` runs the build of src/temporal/commande.ts (dist/temporal/commande.js), the
17
+ // package's TypeScript, which Turborepo builds before the tests and the package publishes.
18
+ import { existsSync } from 'node:fs';
15
19
  import path from 'node:path';
16
20
  import { fileURLToPath } from 'node:url';
17
21
  import { langageDe } from './langages.mjs';
22
+ import { avecLesDonnees, donneesDe } from './donnees-cles.mjs';
18
23
  import { avecLesOutils, outilsDe } from './outils-cles.mjs';
19
24
 
20
25
  const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
@@ -23,12 +28,13 @@ const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
23
28
  // that runs it (`{ langage }`, its name in `commandes`).
24
29
  export const SOUS_COMMANDES = {
25
30
  bilan: 'bilan.mjs',
26
- circuit: 'circuit.mjs',
31
+ circuit: '../dist/temporal/circuit/commande.js',
27
32
  commande: 'verrous/commande.mjs',
28
33
  'composants-affectes': 'composants-affectes.mjs',
34
+ 'dependances-internes': 'dependances-internes.mjs',
29
35
  droits: 'droits.mjs',
30
36
  enveloppe: 'enveloppe/enveloppe.mjs',
31
- file: 'integration/file.mjs',
37
+ 'flux-des-paquets': 'flux-des-paquets.mjs',
32
38
  'fusion-du-changelog': 'fusion-du-changelog.mjs',
33
39
  'gardes-du-cadre': 'gardes-du-cadre.mjs',
34
40
  greffons: 'greffons.mjs',
@@ -49,11 +55,13 @@ export const SOUS_COMMANDES = {
49
55
  'retirer-copie': 'retirer-copie.sh',
50
56
  'session-start': 'session-start.sh',
51
57
  sortie: 'sortie.mjs',
58
+ 'style-a-l-ecriture': 'style-a-l-ecriture.mjs',
52
59
  'sous-modules': 'sous-modules.sh',
53
60
  'structure-guard': 'structure-guard.sh',
54
61
  superviseur: 'superviseur.mjs',
55
62
  tableau: 'tableau.mjs',
56
63
  temporaire: 'mesure/base-de-passe.mjs',
64
+ temporal: '../dist/temporal/commande.js',
57
65
  tests: { langage: 'tester' },
58
66
  ticket: 'ticket.sh',
59
67
  'ticket-du-sous-agent': 'verrous/ticket-du-sous-agent.mjs',
@@ -62,8 +70,8 @@ export const SOUS_COMMANDES = {
62
70
  };
63
71
 
64
72
  // The commands of the module of the language that serve the project at <racine> and are no
65
- // subcommand by their name: the ones `tests` and `verifier` run, and the typing.
66
- const DU_NOYAU = new Set(['tester', 'verifier', 'typer']);
73
+ // subcommand by their name: the ones `tests` and `verifier` run.
74
+ const DU_NOYAU = new Set(['tester', 'verifier']);
67
75
 
68
76
  /**
69
77
  * The subcommands in the project at <racine>, sorted: the core's (SOUS_COMMANDES), and the
@@ -89,16 +97,37 @@ export function sousCommandes(racine = process.cwd()) {
89
97
  */
90
98
  export function commandeDe(nom, racine = process.cwd()) {
91
99
  const s = Object.hasOwn(SOUS_COMMANDES, nom) ? SOUS_COMMANDES[nom] : null;
92
- if (typeof s === 'string') return { script: path.join(SCRIPTS, s), args: [] };
100
+ if (typeof s === 'string') {
101
+ return { script: path.join(SCRIPTS, s), args: [] };
102
+ }
93
103
  const commandes = langageDe(racine).commandes(racine);
94
104
  const n = s?.langage ?? (DU_NOYAU.has(nom) ? null : nom);
95
105
  return n !== null && Object.hasOwn(commandes, n) ? commandes[n] : null;
96
106
  }
97
107
 
108
+ /**
109
+ * The refusal of the subcommand <nom> whose script <script> is missing, or null when it exists: a
110
+ * script of the package's TypeScript (under `dist/`) is named with the command that builds it,
111
+ * as a fresh clone has it unbuilt.
112
+ * @param {string} nom the subcommand
113
+ * @param {string} script its script, absolute
114
+ * @returns {string | null}
115
+ */
116
+ export function scriptAbsent(nom, script) {
117
+ if (existsSync(script)) {
118
+ return null;
119
+ }
120
+ const construit = script.split(path.sep).includes('dist')
121
+ ? ' : la construction du paquet le pose, `npm run build --workspace @roomi-fields/grillhouse`'
122
+ : '';
123
+ return `⛔ grillhouse ${nom} : ${script} n'existe pas${construit}.`;
124
+ }
125
+
98
126
  /**
99
127
  * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>:
100
- * `verifier` gets the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs), each
101
- * variable set to its path, whatever <env> holds; every other subcommand gets <env>.
128
+ * `verifier` gets the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs) and its
129
+ * data (`grillhouse.donnees`, scripts/donnees-cles.mjs), each variable set to its path, whatever
130
+ * <env> holds; every other subcommand gets <env>.
102
131
  * @param {string} nom the subcommand
103
132
  * @param {string} [racine] the root of the project, the working directory by default
104
133
  * @param {Record<string, string | undefined>} [env]
@@ -106,7 +135,9 @@ export function commandeDe(nom, racine = process.cwd()) {
106
135
  * @throws {Error} the faults of the key, for `verifier`
107
136
  */
108
137
  export function environnementDe(nom, racine = process.cwd(), env = process.env) {
109
- return nom === 'verifier' ? avecLesOutils(outilsDe(racine), env) : env;
138
+ return nom === 'verifier'
139
+ ? avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), env))
140
+ : env;
110
141
  }
111
142
 
112
143
  // The script of each subcommand in the project at <racine>, where a former copy of the frame lay
@@ -0,0 +1,260 @@
1
+ #!/usr/bin/env node
2
+ // The hook of the agents' writes (PostToolUse of Write, Edit and MultiEdit, hooks.json): it applies
3
+ // the format and the lint's automatic fixes to the file just written, as an editor's
4
+ // format-on-save and lint-staged do, and gives the agent the findings nothing fixes.
5
+ //
6
+ // npx grillhouse style-a-l-ecriture reads the hook's input (JSON) on its standard input
7
+ //
8
+ // - The file written alone is touched. The package that holds it is the nearest `package.json`
9
+ // above it (the project's root when none lies between); the package's `format:check` and `lint`
10
+ // scripts say what the format and the lint cover (their patterns, from the package's folder),
11
+ // and the configurations of Prettier and ESLint are found upward from the file, up to the root.
12
+ // A file the patterns of its package do not name stays as it is; a package without a script has
13
+ // no such control for its files.
14
+ // - The order is the one of lint-staged: ESLint's fixes, then Prettier, then the findings of
15
+ // ESLint on the result. A finding (an ESLint error that no fix lifts, a file Prettier or ESLint
16
+ // cannot read) is written as `<file>:<line>:<column> <rule> — <message>`, from the project's
17
+ // root, in the `additionalContext` of the hook's output; it comes back at each write while it
18
+ // stands, and nothing blocks.
19
+ // - It never fails on the tool: without Prettier or ESLint installed in the project, an input that
20
+ // is no JSON, a file absent or out of the project, it exits 0 and writes nothing.
21
+ import { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
22
+ import { createRequire } from 'node:module';
23
+ import path from 'node:path';
24
+
25
+ // Node's glob matching is experimental and says so on the error stream; the hook writes none.
26
+ process.emitWarning = () => {};
27
+
28
+ // The flags of the two tools whose next argument is a value, not a pattern.
29
+ const AVEC_VALEUR = new Set([
30
+ '--cache-location',
31
+ '--config',
32
+ '-c',
33
+ '--ignore-path',
34
+ '--log-level',
35
+ '--ext',
36
+ '--parser',
37
+ '--resolve-plugins-relative-to',
38
+ '--rulesdir',
39
+ '--format',
40
+ '-f',
41
+ '--max-warnings',
42
+ '--plugin',
43
+ '--env',
44
+ '--global',
45
+ '--report-unused-disable-directives-severity',
46
+ ]);
47
+
48
+ // The patterns and the extensions the script <script> names for the tool <outil> (`prettier` or
49
+ // `eslint`), or null when the script does not run it.
50
+ function motifsDuScript(script, outil) {
51
+ if (typeof script !== 'string') {
52
+ return null;
53
+ }
54
+ const mots = (script.match(/"[^"]*"|'[^']*'|\S+/g) ?? []).map(m =>
55
+ m.replace(/^(["'])(.*)\1$/, '$2')
56
+ );
57
+ const i = mots.findIndex(m => m === outil || m.endsWith(`/${outil}`));
58
+ if (i < 0) {
59
+ return null;
60
+ }
61
+ const motifs = [];
62
+ const ext = [];
63
+ for (let j = i + 1; j < mots.length; j++) {
64
+ const m = mots[j];
65
+ if (['&&', '||', ';', '|'].includes(m)) {
66
+ break;
67
+ }
68
+ if (m === '--ext') {
69
+ ext.push(...String(mots[++j] ?? '').split(','));
70
+ } else if (m.startsWith('--ext=')) {
71
+ ext.push(...m.slice(6).split(','));
72
+ } else if (AVEC_VALEUR.has(m)) {
73
+ j++;
74
+ } else if (!m.startsWith('-')) {
75
+ motifs.push(m.replace(/^\.\//, ''));
76
+ }
77
+ }
78
+ return { motifs, ext: ext.filter(Boolean).map(e => (e.startsWith('.') ? e : `.${e}`)) };
79
+ }
80
+
81
+ // Whether the file <rel> (from the package's folder) is named by <motifs>: a pattern with a glob
82
+ // matches it as such, one without names the file or a folder that holds it (then <extension>
83
+ // decides, when given, which files of a folder count).
84
+ function couvre(rel, motifs, extension) {
85
+ return motifs.some(m => {
86
+ if (/[*?[\]{}]/.test(m)) {
87
+ return path.matchesGlob(rel, m);
88
+ }
89
+ const net = m.replace(/\/+$/, '');
90
+ if (net === '.' || net === '') {
91
+ return extension(rel);
92
+ }
93
+ return rel === net || (rel.startsWith(`${net}/`) && extension(rel));
94
+ });
95
+ }
96
+
97
+ // The package.json nearest above <fichier> in <projet>: its folder and its scripts, or null.
98
+ function paquetDe(projet, fichier) {
99
+ let dossier = path.dirname(fichier);
100
+ for (;;) {
101
+ const pj = path.join(dossier, 'package.json');
102
+ if (existsSync(pj)) {
103
+ try {
104
+ return { dossier, scripts: JSON.parse(readFileSync(pj, 'utf8')).scripts ?? {} };
105
+ } catch {
106
+ return null;
107
+ }
108
+ }
109
+ if (dossier === projet || path.dirname(dossier) === dossier) {
110
+ return null;
111
+ }
112
+ dossier = path.dirname(dossier);
113
+ }
114
+ }
115
+
116
+ const ligneDe = (e, defaut = 1) => e?.loc?.start?.line ?? e?.loc?.line ?? e?.line ?? defaut;
117
+ const premiereLigne = t => String(t ?? '').split('\n')[0];
118
+
119
+ async function main() {
120
+ let entree;
121
+ try {
122
+ entree = JSON.parse(readFileSync(0, 'utf8'));
123
+ } catch {
124
+ return [];
125
+ }
126
+ if (!['Write', 'Edit', 'MultiEdit'].includes(entree?.tool_name)) {
127
+ return [];
128
+ }
129
+ const brut = entree.tool_input?.file_path;
130
+ if (typeof brut !== 'string') {
131
+ return [];
132
+ }
133
+ const projet = realpathSync(process.env.CLAUDE_PROJECT_DIR || process.cwd());
134
+ let fichier;
135
+ try {
136
+ fichier = realpathSync(path.resolve(projet, brut));
137
+ } catch {
138
+ return [];
139
+ }
140
+ if (!fichier.startsWith(`${projet}${path.sep}`)) {
141
+ return [];
142
+ }
143
+ const paquet = paquetDe(projet, fichier);
144
+ if (!paquet) {
145
+ return [];
146
+ }
147
+ const rel = path.relative(paquet.dossier, fichier).split(path.sep).join('/');
148
+ const depuisRacine = path.relative(projet, fichier).split(path.sep).join('/');
149
+
150
+ const exigerDuProjet = createRequire(path.join(projet, 'package.json'));
151
+ const charger = nom => {
152
+ try {
153
+ return exigerDuProjet(nom);
154
+ } catch {
155
+ return null;
156
+ }
157
+ };
158
+
159
+ // What the scripts of the package cover.
160
+ const formatage = motifsDuScript(paquet.scripts['format:check'], 'prettier');
161
+ const lint = motifsDuScript(paquet.scripts.lint, 'eslint');
162
+ const prettier = formatage ? charger('prettier') : null;
163
+ const eslintModule = lint ? charger('eslint') : null;
164
+ const ESLint = eslintModule?.ESLint;
165
+ const constats = [];
166
+ const dit = (ligne, colonne, regle, message) =>
167
+ constats.push(`${depuisRacine}:${ligne}:${colonne} ${regle} — ${premiereLigne(message)}`);
168
+
169
+ // 1. ESLint's fixes.
170
+ let fatale = false;
171
+ const lintCouvert =
172
+ ESLint &&
173
+ couvre(rel, lint.motifs, f => (lint.ext.length ? lint.ext : ['.js']).some(e => f.endsWith(e)));
174
+ const eslint = fix => new ESLint({ cwd: paquet.dossier, fix });
175
+ const juger = async fix => {
176
+ const moteur = eslint(fix);
177
+ if (await moteur.isPathIgnored(fichier)) {
178
+ return null;
179
+ }
180
+ const [resultat] = await moteur.lintFiles([fichier]);
181
+ if (fix) {
182
+ await ESLint.outputFixes([resultat]);
183
+ }
184
+ return resultat;
185
+ };
186
+ let dernier = null;
187
+ if (lintCouvert) {
188
+ try {
189
+ dernier = await juger(true);
190
+ } catch (e) {
191
+ dit(ligneDe(e), 1, 'eslint', e?.message);
192
+ fatale = true;
193
+ }
194
+ }
195
+
196
+ // 2. Prettier.
197
+ let modifie = false;
198
+ let erreurFormat = null;
199
+ if (prettier) {
200
+ const info = await prettier.getFileInfo(fichier, {
201
+ ignorePath: path.join(projet, '.prettierignore'),
202
+ resolveConfig: true,
203
+ });
204
+ const couvert =
205
+ !info.ignored && info.inferredParser && couvre(rel, formatage.motifs, f => f.length > 0);
206
+ if (couvert) {
207
+ try {
208
+ const texte = readFileSync(fichier, 'utf8');
209
+ const config = (await prettier.resolveConfig(fichier, { editorconfig: true })) ?? {};
210
+ const formate = await prettier.format(texte, { ...config, filepath: fichier });
211
+ if (formate !== texte) {
212
+ writeFileSync(fichier, formate);
213
+ modifie = true;
214
+ }
215
+ } catch (e) {
216
+ erreurFormat = e;
217
+ }
218
+ }
219
+ }
220
+
221
+ // 3. ESLint's findings on the result.
222
+ if (lintCouvert && !fatale) {
223
+ try {
224
+ const resultat = modifie || !dernier ? await juger(false) : dernier;
225
+ for (const m of resultat?.messages ?? []) {
226
+ if (m.severity === 2) {
227
+ dit(m.line ?? 1, m.column ?? 1, m.ruleId ?? 'erreur', m.message);
228
+ if (m.fatal) {
229
+ fatale = true;
230
+ }
231
+ }
232
+ }
233
+ } catch (e) {
234
+ dit(ligneDe(e), 1, 'eslint', e?.message);
235
+ fatale = true;
236
+ }
237
+ }
238
+ if (erreurFormat && !fatale) {
239
+ dit(
240
+ ligneDe(erreurFormat),
241
+ erreurFormat?.loc?.start?.column ?? 1,
242
+ 'prettier',
243
+ erreurFormat.message
244
+ );
245
+ }
246
+ return constats;
247
+ }
248
+
249
+ let constats = [];
250
+ try {
251
+ constats = await main();
252
+ } catch {
253
+ constats = [];
254
+ }
255
+ if (constats.length) {
256
+ const texte = `Constats de style sur le fichier que tu viens d'écrire (rien ne les corrige seul ; corrige-les dans cette séance) :\n${constats.join('\n')}`;
257
+ process.stdout.write(
258
+ `${JSON.stringify({ hookSpecificOutput: { hookEventName: 'PostToolUse', additionalContext: texte } })}\n`
259
+ );
260
+ }