@roomi-fields/grillhouse 0.32.0 → 0.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +32 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +169 -16
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
  6. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +8 -5
  9. package/dist/temporal/circuit/client.d.ts +10 -3
  10. package/dist/temporal/circuit/client.js +8 -4
  11. package/dist/temporal/circuit/client.js.map +1 -1
  12. package/dist/temporal/circuit/contrat.d.ts +25 -0
  13. package/dist/temporal/circuit/contrat.js +31 -0
  14. package/dist/temporal/circuit/contrat.js.map +1 -1
  15. package/dist/temporal/circuit/deroule.js +67 -38
  16. package/dist/temporal/circuit/deroule.js.map +1 -1
  17. package/dist/temporal/commande.js +13 -3
  18. package/dist/temporal/commande.js.map +1 -1
  19. package/dist/temporal/deroules.d.ts +1 -0
  20. package/dist/temporal/deroules.js +3 -1
  21. package/dist/temporal/deroules.js.map +1 -1
  22. package/dist/temporal/file/activites.d.ts +1 -0
  23. package/dist/temporal/file/activites.js +5 -2
  24. package/dist/temporal/file/activites.js.map +1 -1
  25. package/dist/temporal/file/contrat.d.ts +50 -33
  26. package/dist/temporal/file/contrat.js +2 -2
  27. package/dist/temporal/file/contrat.js.map +1 -1
  28. package/dist/temporal/file/deroule.d.ts +3 -1
  29. package/dist/temporal/file/deroule.js +128 -26
  30. package/dist/temporal/file/deroule.js.map +1 -1
  31. package/dist/temporal/installation.d.ts +15 -1
  32. package/dist/temporal/installation.js +57 -15
  33. package/dist/temporal/installation.js.map +1 -1
  34. package/dist/temporal/nuits/activites.d.ts +10 -0
  35. package/dist/temporal/nuits/activites.js +114 -0
  36. package/dist/temporal/nuits/activites.js.map +1 -0
  37. package/dist/temporal/nuits/appel.d.ts +23 -0
  38. package/dist/temporal/nuits/appel.js +40 -0
  39. package/dist/temporal/nuits/appel.js.map +1 -0
  40. package/dist/temporal/nuits/choix.d.ts +14 -0
  41. package/dist/temporal/nuits/choix.js +119 -0
  42. package/dist/temporal/nuits/choix.js.map +1 -0
  43. package/dist/temporal/nuits/client.d.ts +28 -0
  44. package/dist/temporal/nuits/client.js +83 -0
  45. package/dist/temporal/nuits/client.js.map +1 -0
  46. package/dist/temporal/nuits/commande.d.ts +2 -0
  47. package/dist/temporal/nuits/commande.js +107 -0
  48. package/dist/temporal/nuits/commande.js.map +1 -0
  49. package/dist/temporal/nuits/contrat.d.ts +98 -0
  50. package/dist/temporal/nuits/contrat.js +30 -0
  51. package/dist/temporal/nuits/contrat.js.map +1 -0
  52. package/dist/temporal/nuits/deroule.d.ts +5 -0
  53. package/dist/temporal/nuits/deroule.js +100 -0
  54. package/dist/temporal/nuits/deroule.js.map +1 -0
  55. package/dist/temporal/travailleur.js +4 -1
  56. package/dist/temporal/travailleur.js.map +1 -1
  57. package/docs/ARCHITECTURE.md +214 -49
  58. package/docs/CADRE.md +31 -1
  59. package/docs/INTERFACE.md +47 -7
  60. package/hooks/register.tsx +11 -3
  61. package/package.json +4 -1
  62. package/scripts/abi-des-dependances.mjs +105 -0
  63. package/scripts/activites.mjs +113 -42
  64. package/scripts/aiguillage.mjs +1 -0
  65. package/scripts/avancement.mjs +8 -18
  66. package/scripts/ci-des-branches.mjs +91 -0
  67. package/scripts/circuit.mjs +79 -4
  68. package/scripts/circuits-du-serveur.mjs +4 -3
  69. package/scripts/composants-affectes.mjs +24 -7
  70. package/scripts/composition-des-langages.mjs +3 -0
  71. package/scripts/crochets.mjs +4 -0
  72. package/scripts/dernier-vert.mjs +31 -10
  73. package/scripts/enveloppe/enveloppe.mjs +3 -1
  74. package/scripts/enveloppe/lancer.sh +1 -1
  75. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  76. package/scripts/etapes.mjs +18 -1
  77. package/scripts/faits-du-circuit.mjs +43 -20
  78. package/scripts/fichier-du-poste.mjs +87 -0
  79. package/scripts/grillhouse-maj.mjs +15 -1
  80. package/scripts/integration/file.mjs +215 -275
  81. package/scripts/integration/integrer.mjs +82 -41
  82. package/scripts/integration/rejeu.mjs +13 -64
  83. package/scripts/jointure.d.ts +26 -2
  84. package/scripts/langages/cargo/commandes.mjs +81 -19
  85. package/scripts/langages/cargo/exemples.mjs +2 -2
  86. package/scripts/langages/cargo/index.mjs +11 -5
  87. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  88. package/scripts/langages/python/commandes.mjs +11 -7
  89. package/scripts/langages/python/exemples.mjs +1 -1
  90. package/scripts/langages/python/index.mjs +9 -2
  91. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  92. package/scripts/langages/typescript/code-mort.mjs +41 -24
  93. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  94. package/scripts/langages/typescript/exemples.mjs +2 -0
  95. package/scripts/langages/typescript/index.mjs +22 -3
  96. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  97. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  98. package/scripts/langages/typescript/resumes.mjs +17 -7
  99. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  100. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  101. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  102. package/scripts/langages/typescript/tests.mjs +8 -2
  103. package/scripts/langages/typescript/tranches.mjs +273 -0
  104. package/scripts/langages/typescript/verifier.mjs +140 -31
  105. package/scripts/langages/typescript/vitest-config/changements.mjs +23 -11
  106. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  107. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  108. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  109. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  110. package/scripts/lint-des-scripts.mjs +23 -6
  111. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  112. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  113. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  114. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  115. package/scripts/migrations.mjs +8 -0
  116. package/scripts/newday.mjs +18 -0
  117. package/scripts/nuit.sh +35 -17
  118. package/scripts/registre.d.mts +90 -0
  119. package/scripts/registre.mjs +28 -3
  120. package/scripts/reprise.mjs +12 -8
  121. package/scripts/services-du-noyau.mjs +5 -1
  122. package/scripts/session-start.sh +40 -32
  123. package/scripts/sous-commandes.mjs +29 -10
  124. package/scripts/superviseur.mjs +72 -27
  125. package/scripts/tableau.mjs +129 -20
  126. package/scripts/taches-du-graphe.mjs +39 -6
  127. package/scripts/transitions.mjs +42 -3
  128. package/scripts/verrou-de-machine.mjs +1 -2
  129. package/scripts/workflows-du-cadre.mjs +75 -0
  130. package/skills/grill/SKILL.md +8 -6
  131. package/skills/pitmaster/SKILL.md +15 -9
@@ -0,0 +1,31 @@
1
+ // From 0.33.0 the queue enters a lot on main only once the CI of its branch `agent/<ticket>`
2
+ // judged it green (grillhouse-44b.12.5): the CI of the project runs on a push to `agent/**`.
3
+ //
4
+ // - The workflows of `.github/workflows/` that run on a push to the branch main is pushed to, and
5
+ // list the branches of their push, gain `agent/**` (scripts/ci-des-branches.mjs).
6
+ // - A project whose CI already runs on a push to `agent/**` is left, nothing said: a second pass
7
+ // changes nothing.
8
+ // - A project without such a workflow is left; `restes` says the gesture, which the update
9
+ // reports without failing, as the opening of a session names it under « Manque ».
10
+ import {
11
+ ajouterLesBranchesDeTicket,
12
+ BRANCHES_DE_TICKET,
13
+ ecouteLesBranchesDeTicket,
14
+ GESTE,
15
+ } from '../ci-des-branches.mjs';
16
+
17
+ export const version = '0.33.0';
18
+ export const nom = 'ci des branches de ticket';
19
+
20
+ /** Adds `agent/**` to the push of the CI of the lots; returns what it did. */
21
+ export function migrer(projet) {
22
+ return ajouterLesBranchesDeTicket(projet).map(
23
+ f =>
24
+ `${f} : '${BRANCHES_DE_TICKET}' ajoutée aux branches de son push, que la file pousse et dont la CI juge chaque lot`
25
+ );
26
+ }
27
+
28
+ /** What stays to the project: the gesture, while no workflow runs on a push to `agent/**`. */
29
+ export function restes(projet) {
30
+ return ecouteLesBranchesDeTicket(projet) ? [] : [GESTE];
31
+ }
@@ -0,0 +1,31 @@
1
+ // From 0.33.0 the frame carries the CI of a project (grillhouse-44b.12.7): the template's
2
+ // `.github/workflows/ci.yml` (the verification in tranches, for a lot) and `nuit.yml` (the night
3
+ // tests out of the poste), each bearing the frame's mark on its first line, which the update keeps
4
+ // (scripts/workflows-du-cadre.mjs).
5
+ //
6
+ // - The migration changes no file: a project's CI is its own until it adopts the frame's, and the
7
+ // update starts no CI on a repository.
8
+ // - What stays to the project (`restes`), once: a project that holds no workflow of the frame is
9
+ // told how to adopt them. One that holds one has nothing to do.
10
+ import path from 'node:path';
11
+ import { CADRE } from '../cadre.mjs';
12
+ import { aLaCiDuCadre, GABARIT_DES_WORKFLOWS, WORKFLOWS } from '../workflows-du-cadre.mjs';
13
+
14
+ export const version = '0.33.0';
15
+ export const nom = 'ci du cadre';
16
+
17
+ /** Changes nothing: the adoption of the frame's CI is the project's gesture (`restes`). */
18
+ export function migrer() {
19
+ return [];
20
+ }
21
+
22
+ /** The adoption of the frame's CI, for a project that holds none of its workflows. */
23
+ export function restes(projet) {
24
+ if (aLaCiDuCadre(projet)) {
25
+ return [];
26
+ }
27
+ const modele = path.relative(projet, path.join(CADRE, GABARIT_DES_WORKFLOWS, 'ci.yml'));
28
+ return [
29
+ `${WORKFLOWS} : le cadre porte la CI d'un projet (ci.yml, le lot en tranches ; nuit.yml, les tests de nuit hors du poste). Pour l'adopter, copier \`${modele}\` dans \`${WORKFLOWS}/\` (un ci.yml du projet cède sa place, ses étapes propres versées ailleurs), puis \`npx grillhouse maj\`, qui écrit nuit.yml et tient les deux à jour. Leur machine : la variable RUNNER du dépôt sur GitHub, facultative (ubuntu-latest sans elle).`,
30
+ ];
31
+ }
@@ -0,0 +1,58 @@
1
+ // From 0.33.0 the frame runs on Node 24 and 26, the supported long-term releases, Node 26 at the
2
+ // poste (grillhouse-3uv.99): the template's package.json declares `engines.node` `>=24.0.0` and
3
+ // the npm Node 26 ships as its `packageManager`.
4
+ //
5
+ // - A project's package.json that still holds the value of the template before (`engines.node`
6
+ // `>=22.0.0`, `packageManager` `npm@10.9.8`) receives the template's; a value the project chose
7
+ // stays, unsaid.
8
+ // - Only those values change in the text: the rest of the file keeps its bytes.
9
+ // - A project already migrated, or without package.json, is not written: a second pass changes
10
+ // nothing and returns no line.
11
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
12
+ import path from 'node:path';
13
+ import { CADRE } from '../cadre.mjs';
14
+
15
+ export const version = '0.33.0';
16
+ export const nom = 'node 26';
17
+
18
+ // The values of the template before this version.
19
+ const MOTEUR_AVANT = '>=22.0.0';
20
+ const GESTIONNAIRE_AVANT = 'npm@10.9.8';
21
+
22
+ // The template's package.json.
23
+ const gabarit = () =>
24
+ JSON.parse(readFileSync(path.join(CADRE, 'templates', 'projet', 'package.json'), 'utf8'));
25
+
26
+ // A text as a pattern that matches it alone.
27
+ const litteral = t => t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
28
+
29
+ // <texte> with the first string value <avant> of the key <cle> replaced by <apres>.
30
+ const remplacer = (texte, cle, avant, apres) =>
31
+ texte.replace(
32
+ new RegExp(`("${litteral(cle)}"\\s*:\\s*)${litteral(JSON.stringify(avant))}`),
33
+ (_, debut) => `${debut}${JSON.stringify(apres)}`
34
+ );
35
+
36
+ /** Gives the project the template's engines and npm when it holds the former ones. */
37
+ export function migrer(projet) {
38
+ const f = path.join(projet, 'package.json');
39
+ if (!existsSync(f)) {
40
+ return [];
41
+ }
42
+ let texte = readFileSync(f, 'utf8');
43
+ const pkg = JSON.parse(texte);
44
+ const neuf = gabarit();
45
+ const lignes = [];
46
+ if (pkg.engines?.node === MOTEUR_AVANT && neuf.engines?.node !== MOTEUR_AVANT) {
47
+ texte = remplacer(texte, 'node', MOTEUR_AVANT, neuf.engines.node);
48
+ lignes.push(`package.json : engines.node passe à ${neuf.engines.node}`);
49
+ }
50
+ if (pkg.packageManager === GESTIONNAIRE_AVANT && neuf.packageManager !== GESTIONNAIRE_AVANT) {
51
+ texte = remplacer(texte, 'packageManager', GESTIONNAIRE_AVANT, neuf.packageManager);
52
+ lignes.push(`package.json : packageManager passe à ${neuf.packageManager}`);
53
+ }
54
+ if (lignes.length) {
55
+ writeFileSync(f, texte);
56
+ }
57
+ return lignes;
58
+ }
@@ -35,6 +35,10 @@ import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-
35
35
 
36
36
  import * as ciAppelleLaVerification from './migrations/0.30.0-ci-appelle-la-verification.mjs';
37
37
  import * as paquetsDansLeGraphe from './migrations/0.31.0-paquets-dans-le-graphe.mjs';
38
+ import * as ciDesBranchesDeTicket from './migrations/0.33.0-ci-des-branches-de-ticket.mjs';
39
+ import * as node26 from './migrations/0.33.0-node-26.mjs';
40
+ import * as ciDuCadre from './migrations/0.33.0-ci-du-cadre.mjs';
41
+ import * as cacheDistant from './migrations/0.33.0-cache-distant.mjs';
38
42
 
39
43
  /** The migrations of the core. */
40
44
  export const MIGRATIONS = [
@@ -49,6 +53,10 @@ export const MIGRATIONS = [
49
53
  langagesDansLArchitecture,
50
54
  ciAppelleLaVerification,
51
55
  paquetsDansLeGraphe,
56
+ ciDesBranchesDeTicket,
57
+ node26,
58
+ ciDuCadre,
59
+ cacheDistant,
52
60
  ];
53
61
 
54
62
  /**
@@ -0,0 +1,18 @@
1
+ // `grillhouse newday`: sets the day's marker of the project to now (scripts/tableau.mjs,
2
+ // `poserLeRepere`). FAITS AUJOURD'HUI and the board's « rejetés » and « validés » cases then count
3
+ // only since it, while « new » and « →check » stay (grillhouse-3uv.96). The mod's command
4
+ // /grillhouse:newday runs it.
5
+ import { pathToFileURL } from 'node:url';
6
+ import { poserLeRepere } from './tableau.mjs';
7
+
8
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
9
+ try {
10
+ poserLeRepere(process.cwd());
11
+ process.stdout.write(
12
+ 'Repère de journée posé à maintenant : FAITS AUJOURD’HUI et les cases « rejetés » et « validés » repartent de zéro.\n'
13
+ );
14
+ } catch (e) {
15
+ process.stderr.write(`⛔ ${/** @type {Error} */ (e).message}\n`);
16
+ process.exitCode = 1;
17
+ }
18
+ }
package/scripts/nuit.sh CHANGED
@@ -5,18 +5,20 @@
5
5
  # scripts/dernier-vert.mjs); the module of the project's language plays each step
6
6
  # (scripts/jointure.d.ts).
7
7
  #
8
- # npx grillhouse nuit from the root of the project, by the crontab of the machine, as the
9
- # session start proposes it, with the directory of its Node, e.g.
10
- # « 0 3 * * * export PATH=<node dir>:$PATH; cd <root> &&
11
- # node_modules/.bin/grillhouse nuit »
12
- # npx grillhouse nuit --help the usage on the output (also -h), exit 0; any other argument is
8
+ # npx grillhouse nuit from the root of the project, which runs it alone
9
+ # (src/temporal/nuits/commande.ts): the workflow of the nights of the
10
+ # machine (src/temporal/nuits/) launches it for each project that moved,
11
+ # one after the other
12
+ # nuit.sh --help the usage on the output (also -h), exit 0; any other argument is
13
13
  # refused, the usage on the error stream, exit 2: nothing runs.
14
14
  #
15
15
  # - It plays main's HEAD in its own clean copy (.claude/worktrees/nuit): detached, every untracked
16
16
  # file removed, its submodules set at the commit of HEAD (scripts/sous-modules.sh, a local
17
17
  # modification overwritten; one that cannot be set turns the night red; a submodule the project
18
18
  # shares, `grillhouse.partage`, is linked to the main repository's instead, not set),
19
- # dependencies reinstalled (npm ci) when package-lock.json changes, then
19
+ # dependencies reinstalled (npm ci) when package-lock.json changes or when the Node that plays
20
+ # the night is not the one they were installed under (its binary interface, the mark of
21
+ # scripts/abi-des-dependances.mjs, which the night writes after its `npm ci`), then
20
22
  # `npm run verifier -- --force`: the build, the guards (the frame's and the project's own, its
21
23
  # root script `gardes`) and every test of the day, each task played for real (`--force`, no log
22
24
  # replayed from a cache, no measure against the last green: the complete pass); green, its tree
@@ -43,8 +45,15 @@
43
45
  # Temporal down (`grillhouse temporal installer --programme-seul`, by the built command of the
44
46
  # version playing the night, not the copy's: the copy has no build yet; idempotent: a program
45
47
  # already laid down is not downloaded again) and exports its path as TEMPORAL, over any key left
46
- # in a package.json; a laying that fails turns the night red, the log naming its cause, and
47
- # nothing runs.
48
+ # in a package.json. A laying that fails does not stop the night: the log names it, TEMPORAL
49
+ # stays unset, and a test that starts a server resolves the program from the shared cache
50
+ # (~/.cache/grillhouse/temporal/<version>/temporal), or fails on itself naming the command that
51
+ # lays it down. A night of trial, whose copy holds no build, thus plays on.
52
+ # - The frame's package: after the installation, before the full pass, the night builds
53
+ # @roomi-fields/grillhouse (`npm run build --workspace=@roomi-fields/grillhouse`) when it is a
54
+ # package of the copy's repository, one the `workspaces` of its root select (scripts/paquets.mjs);
55
+ # a project that installs the frame, even with a copy of the frame's package.json under
56
+ # packages/grillhouse/, builds nothing. A failed build turns the night red, and nothing runs.
48
57
  # - The night tests: after the full pass, the night tests, then the measures of time alone (the
49
58
  # time budget benches and the time witnesses), which `npm test` and the integration leave out
50
59
  # (grillhouse-bd7), played by the command `tests-de-nuit` of the module of the copy's language
@@ -236,11 +245,11 @@ jouer() {
236
245
  # of the version playing the night (already built), not the copy's: the copy is cleaned of its
237
246
  # build and has no node_modules before the `npm ci` below.
238
247
  local temporal
239
- if ! temporal=$(env -C "$copie" node "$ici/../bin/grillhouse.mjs" temporal installer --programme-seul); then
240
- echo "✗ la pose du programme temporal échoue : rien n'est joué."
241
- return 1
248
+ if temporal=$(env -C "$copie" node "$ici/../bin/grillhouse.mjs" temporal installer --programme-seul); then
249
+ export TEMPORAL="$temporal"
250
+ else
251
+ echo "⚠ la pose du programme temporal n'a pas abouti : un test qui monte un serveur le résout depuis le cache partagé, ou échoue en le nommant."
242
252
  fi
243
- export TEMPORAL="$temporal"
244
253
  # The data of the project (donnees-cles.mjs), exported the same way.
245
254
  local donnees
246
255
  if ! donnees=$(node "$ici/donnees-cles.mjs" "$copie"); then
@@ -248,14 +257,23 @@ jouer() {
248
257
  return 1
249
258
  fi
250
259
  eval "$donnees"
251
- if [ -f "$copie/package-lock.json" ] && ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"; then
260
+ # The dependencies, installed again when the lock moved or when they were installed under
261
+ # another Node (scripts/abi-des-dependances.mjs: a native module refuses another interface).
262
+ if [ -f "$copie/package-lock.json" ] && { ! cmp -s "$copie/package-lock.json" "$copie/node_modules/.nuit-lock" || ! node "$ici/abi-des-dependances.mjs" --a-jour "$copie"; }; then
252
263
  monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
253
264
  cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
265
+ node "$ici/abi-des-dependances.mjs" --marquer "$copie"
254
266
  fi
255
- # The frame's package, built once when the copy carries it as a package of the repository: the
256
- # copy is cleaned of dist/ and the pass (the taking of its place) and the night tests of Temporal
257
- # read dist/temporal. A project that installs the frame builds nothing more.
258
- if grep -q '"name": *"@roomi-fields/grillhouse"' "$copie/packages/grillhouse/package.json" 2>/dev/null; then
267
+ # The frame's package, built once when the copy carries it as a package of the repository (one
268
+ # the `workspaces` of its root select, as scripts/paquets.mjs maps them, named
269
+ # @roomi-fields/grillhouse): the copy is cleaned of dist/ and the pass (the taking of its place)
270
+ # and the night tests of Temporal read dist/temporal. A project that installs the frame builds
271
+ # nothing more, even with a copy of the frame's package.json no `workspaces` select.
272
+ if node --input-type=module -e '
273
+ const { pathToFileURL } = await import("node:url");
274
+ const { paquets } = await import(pathToFileURL(process.argv[1]).href);
275
+ process.exit(paquets(process.argv[2]).some(p => p.pkg.name === "@roomi-fields/grillhouse") ? 0 : 1);
276
+ ' "$ici/paquets.mjs" "$copie" 2>/dev/null; then
259
277
  if ! monter npm --prefix "$copie" run build --workspace=@roomi-fields/grillhouse; then
260
278
  echo "✗ la construction du paquet @roomi-fields/grillhouse échoue : rien n'est joué."
261
279
  return 1
@@ -0,0 +1,90 @@
1
+ // The types of the register of finished agents (./registre.mjs), which the activities of the
2
+ // nights under Temporal (src/temporal/nuits/activites.ts) import.
3
+
4
+ /** The fields of a hook's input that the register reads. */
5
+ export interface EntreeDuCrochet {
6
+ hook_event_name?: string;
7
+ transcript_path?: string;
8
+ session_id?: string;
9
+ agent_id?: string;
10
+ agent_type?: string;
11
+ agent_transcript_path?: string;
12
+ cwd?: string;
13
+ projet_dir?: string;
14
+ }
15
+
16
+ /** A tariff in dollars per million tokens. */
17
+ export interface Tarif {
18
+ entree: number;
19
+ sortie: number;
20
+ lecture: number;
21
+ ecriture5m: number;
22
+ ecriture1h: number;
23
+ }
24
+
25
+ /** A line of the register. */
26
+ export interface LigneDuRegistre {
27
+ projet: string;
28
+ agent: string | null;
29
+ ticket: string | null;
30
+ role: string | null;
31
+ etape?: string;
32
+ debut: string;
33
+ fin: string;
34
+ travail: number;
35
+ tours: [number, number][];
36
+ jetons: number;
37
+ cache: number;
38
+ cout: number | null;
39
+ cle?: string;
40
+ nuit?: { verdict: 'sautee'; raison: string; sommet: string; reference: string };
41
+ }
42
+
43
+ /** The register's file: GRILLHOUSE_REGISTRE, else ~/.claude/grillhouse/registre.jsonl. */
44
+ export const REGISTRE: string;
45
+ export const TARIFS: Record<string, Tarif>;
46
+ export function source(input: EntreeDuCrochet): {
47
+ transcription: string | null;
48
+ role: string | null;
49
+ agent: string | null;
50
+ };
51
+ export function coutDe(modeles: Record<string, Partial<Tarif>> | null | undefined): number | null;
52
+ export function ligne(
53
+ input: EntreeDuCrochet,
54
+ t: {
55
+ premier: number | null;
56
+ dernier: number;
57
+ ticket?: string | null;
58
+ role?: string | null;
59
+ travail: number;
60
+ tours: [number, number][];
61
+ jetons: number;
62
+ cache: number;
63
+ cout?: number | null;
64
+ modeles?: Record<string, Partial<Tarif>>;
65
+ },
66
+ projet: string
67
+ ): LigneDuRegistre | null;
68
+ export function ligneDEtape(e: {
69
+ projet: string;
70
+ ticket: string;
71
+ etape: string;
72
+ debut: string;
73
+ fin: string;
74
+ }): LigneDuRegistre;
75
+ export function ligneDeNuit(e: {
76
+ projet: string;
77
+ quand: string;
78
+ raison: string;
79
+ sommet: string;
80
+ reference: string;
81
+ }): LigneDuRegistre;
82
+ export function aRattraper(
83
+ racine: string,
84
+ home: string,
85
+ connus: Set<string>,
86
+ maintenant?: number
87
+ ): EntreeDuCrochet[];
88
+ export function ecrire(l: LigneDuRegistre): boolean;
89
+ export function transcriptionsDeLaCopie(copie: string, home: string): string;
90
+ export function deLaCopie(copie: string, home: string, connus: Set<string>): EntreeDuCrochet[];
@@ -4,7 +4,10 @@
4
4
  // role agent launched in a shell included). An agent resumed by a message has one line per stop; the board
5
5
  // reads an agent's latest line, and the transcripts of running ones. The circuit of a ticket
6
6
  // (scripts/circuit.mjs) writes a line at the end of each step it leads itself, with no agent
7
- // (`ligneDEtape`: its role `circuit`, its step, one turn, no tokens).
7
+ // (`ligneDEtape`: its role `circuit`, its step, one turn, no tokens). The workflow of the nights
8
+ // (src/temporal/nuits/) writes a line for each night it skips (`ligneDeNuit`: its role `nuit`, no
9
+ // ticket, no turn, the reason, the top and the reference compared), which the board counts nowhere;
10
+ // the projects the register names are those whose night it plays.
8
11
  //
9
12
  // - The line: the project (the main tree of the directory the session opened in, which the hook
10
13
  // reads in CLAUDE_PROJECT_DIR, else in its input's `cwd`), the agent, its ticket (« TON TICKET : »),
@@ -41,10 +44,10 @@ import os from 'node:os';
41
44
  import path from 'node:path';
42
45
  import { pathToFileURL } from 'node:url';
43
46
  import { roleDeLAgent } from './etapes.mjs';
44
- import { lireFichier, ROLE_DU_CIRCUIT, roleDuMeta, tourne } from './tableau.mjs';
47
+ import { lireFichier, ROLE_DE_LA_NUIT, ROLE_DU_CIRCUIT, roleDuMeta, tourne } from './tableau.mjs';
45
48
  import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
46
49
 
47
- const REGISTRE =
50
+ export const REGISTRE =
48
51
  process.env.GRILLHOUSE_REGISTRE ??
49
52
  path.join(os.homedir(), '.claude', 'grillhouse', 'registre.jsonl');
50
53
 
@@ -153,6 +156,28 @@ export function ligneDEtape({ projet, ticket, etape, debut, fin }) {
153
156
  };
154
157
  }
155
158
 
159
+ // The register's line of a night that the workflow of the nights skips (src/temporal/nuits/), at
160
+ // <quand> (an ISO date): its role `nuit`, no ticket, no turn, no tokens, the reason, the top and
161
+ // the reference compared; its key one per project, top and day, so that a skip noted again that
162
+ // day writes nothing.
163
+ export function ligneDeNuit({ projet, quand, raison, sommet, reference }) {
164
+ return {
165
+ projet,
166
+ agent: `${ROLE_DE_LA_NUIT}:${projet}:${quand}`,
167
+ ticket: null,
168
+ role: ROLE_DE_LA_NUIT,
169
+ debut: quand,
170
+ fin: quand,
171
+ travail: 0,
172
+ tours: [],
173
+ jetons: 0,
174
+ cache: 0,
175
+ cout: null,
176
+ cle: `${ROLE_DE_LA_NUIT}:${projet}:${sommet}:${quand.slice(0, 10)}`,
177
+ nuit: { verdict: 'sautee', raison, sommet, reference },
178
+ };
179
+ }
180
+
156
181
  // The main tree of a directory: an agent's copy belongs to the repository it was made from.
157
182
  function arbrePrincipal(dir) {
158
183
  try {
@@ -8,19 +8,23 @@ import { SUITE } from './etapes.mjs';
8
8
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
9
9
 
10
10
  /**
11
- * The step that carries the red whose places are <lieux> (`{ paquet, fichier, gardes }`), by the
12
- * files the red names against what the testwriter (`portes.tests`) and the developpeur
13
- * (`portes.code`) wrote: `{ etape, fichiers, motif? }`. A test file that a guard or the style
14
- * refuses (`gardes` not empty) is the testwriter's, the earliest step (the developpeur replays
15
- * after him); a test that fails (no guard) and a file of code are the developpeur's. A red that
16
- * names no file, or a file nobody wrote, is never attributed (`etape` null, its `motif` said): it
17
- * goes up.
11
+ * The step that carries the red whose places are <lieux> (`{ paquet, fichier, gardes,
12
+ * dansLePlan }`), by the files the red names against what the testwriter (`portes.tests`) and the
13
+ * developpeur (`portes.code`) wrote: `{ etape, fichiers, motif? }`. A test file that a guard or
14
+ * the style refuses (`gardes` not empty) is the testwriter's, the earliest step (the developpeur
15
+ * replays after him); a test that fails (no guard) and a file of code are the developpeur's. A red
16
+ * that names no file but lies in a package of the plan (a red task: lint, format check, typing,
17
+ * build) is the developpeur's, no file named, as a red job of a CI goes back to its author (the
18
+ * owner's decision on grillhouse-4nr.14.1); one out of the plan, or a file nobody wrote, is never
19
+ * attributed (`etape` null, its `motif` said): it goes up.
18
20
  */
19
21
  export function attribuerLeRouge({ lieux, portes }) {
20
22
  const avecFichier = (lieux ?? []).filter(l => typeof l.fichier === 'string' && l.fichier);
21
23
  const nommes = [...new Set(avecFichier.map(l => l.fichier))];
22
24
  if (!nommes.length) {
23
- return { etape: null, fichiers: [], motif: 'le rouge ne nomme aucun fichier' };
25
+ return (lieux ?? []).some(l => l.dansLePlan)
26
+ ? { etape: 'developpeur', fichiers: [] }
27
+ : { etape: null, fichiers: [], motif: 'le rouge ne nomme aucun fichier du plan' };
24
28
  }
25
29
  const tests = new Set(portes.tests);
26
30
  const code = new Set(portes.code);
@@ -23,7 +23,10 @@ export {
23
23
  construireDepuisLesArguments,
24
24
  empreintesDesTaches,
25
25
  GRAPHE_JOUE,
26
+ joueCeQuiNeSeDivisePas,
27
+ LA_FORME,
26
28
  lancerLesTaches,
29
+ lireLaTranche,
27
30
  nomDuPaquet,
28
31
  PASSE_ROUGE,
29
32
  SCRIPT_DES_TESTS,
@@ -33,7 +36,8 @@ export {
33
36
  tracesDuPlan,
34
37
  } from './taches-du-graphe.mjs';
35
38
  export { luUneFois } from './lecture-unique.mjs';
36
- export { CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
39
+ export { avecLeFichierDuPoste } from './fichier-du-poste.mjs';
40
+ export { BASE_DU_LOT, CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
37
41
  export { lireLaListe, paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
38
42
  export { AVANCEMENT, ecrireTache } from './mesure/avancement.mjs';
39
43
  export {
@@ -11,6 +11,10 @@
11
11
  # written; the session start goes on. Without the key (or with null), nothing runs; a value that is
12
12
  # not a non-blank string runs nothing and adds a line that says so. An agent's copy does not play it.
13
13
  #
14
+ # The Node of the dependencies: a project whose dependencies were installed (`npm ci`) under
15
+ # another binary interface of Node than the current one joins « Manque », with `npm ci`
16
+ # (scripts/abi-des-dependances.mjs).
17
+ #
14
18
  # The project's languages: a project whose docs/ARCHITECTURE.md declares none (the column
15
19
  # « Langage » of its table of the components, scripts/langages.mjs) joins « Manque » as « le
16
20
  # langage de chaque paquet », with the grill, which writes it, or with `npx grillhouse maj` for a
@@ -27,6 +31,13 @@
27
31
  # for the project at another version than the package @roomi-fields/grillhouse, both released under
28
32
  # one version, with the command that aligns the one behind. An agent's copy does not read them.
29
33
  #
34
+ # The worker of Temporal on a former version after a rise of `grillhouse.outil` (see below, the
35
+ # detection `grillhouse temporal perime`): joins « Manque » with `npx grillhouse temporal installer`.
36
+ # An agent's copy does not read it.
37
+ #
38
+ # The CI of the ticket branches: a project none of whose workflows runs on a push to `agent/**`
39
+ # (scripts/ci-des-branches.mjs) joins « Manque », with `npx grillhouse maj`, which adds it.
40
+ #
30
41
  # One supervisor per project (scripts/superviseur.mjs): the session takes the lock of its
31
42
  # repository, and, when its opening takes the lock (not when it keeps it, after a compaction or a
32
43
  # /clear), receives the section « L'attente des questions », the wait to launch in the background,
@@ -83,6 +94,10 @@ if [ -z "$copie_agent" ]; then
83
94
  [ -d "$root/.codegraph" ] || missing+=("l'index CodeGraph du code (\`codegraph init .\`)")
84
95
  fi
85
96
  [ ! -f "$root/package.json" ] || [ -d "$root/node_modules" ] || missing+=("les dépendances npm (\`npm install\`)")
97
+ # Dependencies installed under another Node (scripts/abi-des-dependances.mjs): a native module
98
+ # refuses the binary interface of the current one.
99
+ abi="$(node "$ici/abi-des-dependances.mjs" --manque "$root" 2>/dev/null)"
100
+ [ -z "$abi" ] || missing+=("$abi")
86
101
  # The project's languages (scripts/langages.mjs): a project whose docs/ARCHITECTURE.md declares
87
102
  # none (the column « Langage » of its table of the components) is refused by the frame's scripts
88
103
  # and locks until the grill writes it, or, for a project that holds the declaration of a former
@@ -116,10 +131,24 @@ if [ -z "$copie_agent" ]; then
116
131
  esac
117
132
  done < <(timeout -k 1 8 node "$ici/greffons.mjs" --absents "$root" 2>/dev/null)
118
133
  fi
134
+ # The worker of Temporal left on a former version after a rise of `grillhouse.outil`
135
+ # (src/temporal/installation.ts, travailleurPerime, read from dist/): the one command that
136
+ # re-points it joins « Manque ». Nothing without an installation of Temporal on the account; an
137
+ # agent's copy does not read it.
138
+ if [ -z "$copie_agent" ] && [ -f "$ici/../dist/temporal/commande.js" ] && [ -f "$root/package.json" ] \
139
+ && [ -n "$(timeout -k 1 8 node "$ici/../dist/temporal/commande.js" perime --racine "$root" 2>/dev/null)" ]; then
140
+ missing+=("le travailleur de Temporal périmé après une montée de version (\`npx grillhouse temporal installer\`)")
141
+ fi
119
142
  # The frame's git hooks absent from the folder git reads (scripts/crochets.mjs), each named.
120
143
  while IFS= read -r crochet; do
121
144
  [ -n "$crochet" ] && missing+=("le crochet git $crochet du cadre")
122
145
  done < <(node "$ici/crochets.mjs" --absents "$root" 2>/dev/null)
146
+ # The CI of the ticket branches (scripts/ci-des-branches.mjs): the queue enters a lot on main only
147
+ # once the CI of `agent/<ticket>` judged it green, so a project none of whose workflows runs on a
148
+ # push to `agent/**` lacks it. An agent's copy does not read it.
149
+ if [ -z "$copie_agent" ] && [ -n "$(node "$ici/ci-des-branches.mjs" --absente "$root" 2>/dev/null)" ]; then
150
+ missing+=("une CI qui se lance sur les branches de ticket agent/** (la file n'entre un lot sur main qu'une fois la CI de sa branche verte : \`npx grillhouse maj\` ajoute agent/** aux branches du push du flux de la CI, sinon ajoute-le à la main, \`branches: [main, 'agent/**']\`)")
151
+ fi
123
152
  command -v bwrap >/dev/null || missing+=("bubblewrap (bwrap), l'enveloppe des agents : sudo apt install bubblewrap")
124
153
 
125
154
  # The key elements the skills read; each one still empty is proposed for a grill.
@@ -208,39 +237,20 @@ if [ -f "$root/package.json" ]; then
208
237
  done
209
238
  fi
210
239
 
211
- # Once the architecture is written, the night (the full pass played for real, the night tests and
212
- # the time budget benches) needs its line in the crontab. Under the crontab, `#!/usr/bin/env node`
213
- # does not find a Node that nvm installed: the line sets the directory of the Node this script
214
- # runs. A line of the crontab is the night's when it runs `cd <root> && node_modules/.bin/grillhouse
215
- # nuit` and sets `PATH=<that directory>:`. A line that launches a nuit.sh under the root, absent
216
- # (the frame's script before the package, 0.24.0; a relative path after `cd <root>`), is named
217
- # with the line that replaces it, as brew doctor names a configuration that aims at a missing path.
218
- nuit_absente=
219
- if ecrit "$root/docs/ARCHITECTURE.md"; then
220
- noeud="$(dirname "$(command -v node)")"
221
- table="$(crontab -l 2>/dev/null | grep -v '^[[:space:]]*#')"
222
- if ! printf '%s\n' "$table" | grep -F "cd $root && node_modules/.bin/grillhouse nuit" | grep -qF "PATH=$noeud:"; then
223
- nuit="0 3 * * * export PATH=$noeud:\$PATH; cd $root && node_modules/.bin/grillhouse nuit"
224
- while IFS= read -r ligne; do
225
- read -ra mots <<< "$ligne"
226
- for mot in "${mots[@]}"; do
227
- mot="${mot%%[;&|]*}"
228
- case "$mot" in
229
- "$root"/*nuit.sh) chemin="$mot" ;;
230
- /*) continue ;;
231
- *nuit.sh) [[ "$ligne" == *"cd $root "* ]] || continue; chemin="$root/$mot" ;;
232
- *) continue ;;
233
- esac
234
- [ -f "$chemin" ] || nuit_absente+="${nuit_absente:+ ; }lance $chemin, absent, par \`$ligne\`"
235
- done
236
- done <<< "$table"
237
- fi
240
+ # The nights run under the schedule of the machine (src/temporal/nuits/, `npx grillhouse nuit
241
+ # --planifier`), no longer by the table of tasks: a line of the crontab that still launches a night
242
+ # (`grillhouse nuit`, or a nuit.sh) is named, with the proposal to remove it, so that the table and
243
+ # the schedule never play two nights at once. The lines are joined by « ; », each one as the table
244
+ # writes it, its own semicolons kept.
245
+ nuit_en_table=
246
+ if command -v crontab >/dev/null 2>&1; then
247
+ nuit_en_table="$(crontab -l 2>/dev/null | grep -v '^[[:space:]]*#' | grep -E 'grillhouse nuit|nuit\.sh' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ ; /g')"
238
248
  fi
239
249
 
240
250
  # An epic is a chantier, at the root: one with a mother is a mother ticket typed by mistake.
241
251
  epopees="$(cd "$root" && bd list --type epic --all --json --limit 0 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{process.stdout.write(JSON.parse(s).filter(t=>t.parent).map(t=>t.id).join(" "))}catch{}})')"
242
252
 
243
- [ ${#missing[@]} -eq 0 ] && [ ${#pending[@]} -eq 0 ] && [ ${#wiring[@]} -eq 0 ] && [ -z "${nuit:-}" ] && [ -z "$epopees" ] && [ -z "${inconnus:-}" ] && [ -z "${ecart_versions:-}" ] && exit 0
253
+ [ ${#missing[@]} -eq 0 ] && [ ${#pending[@]} -eq 0 ] && [ ${#wiring[@]} -eq 0 ] && [ -z "$nuit_en_table" ] && [ -z "$epopees" ] && [ -z "${inconnus:-}" ] && [ -z "${ecart_versions:-}" ] && exit 0
244
254
 
245
255
  echo "## Éléments du projet à définir (Roomi's Grillhouse)"
246
256
  if [ ${#missing[@]} -gt 0 ]; then
@@ -254,10 +264,8 @@ fi
254
264
  if [ ${#wiring[@]} -gt 0 ]; then
255
265
  echo "À brancher : $(IFS=' '; echo "${wiring[*]}") dans le package.json de la racine. L'intégration (\`npx grillhouse integrer\`, contrat en tête de son script) et la nuit lancent \`npm run verifier\` (les gardes et les tests, par l'outil du langage du projet), les agents \`npm test\` ; sans eux, l'intégration refuse chaque lot. \`npm run grillhouse:maj\` les écrit quand le langage du projet sait jouer ses tests, et finit par \`npm run verifier\`, une passe longue : lance-la en tâche de fond et relis son code à la fin ; sinon, écris-les pour ses tests."
256
266
  fi
257
- if [ -n "$nuit_absente" ]; then
258
- echo "La nuit ne tourne plus : la table des tâches du poste $nuit_absente. Propose au responsable de remplacer cette ligne (\`crontab -e\`) par : \`$nuit\`."
259
- elif [ -n "${nuit:-}" ]; then
260
- echo "La nuit n'est pas programmée : elle rejoue pour de vrai la passe complète, puis les tests de nuit et les bancs de budget, que le jour ne joue pas (\`npx grillhouse nuit\`). Propose au responsable d'ajouter à la table des tâches du poste (\`crontab -e\`) : \`$nuit\`."
267
+ if [ -n "$nuit_en_table" ]; then
268
+ echo "La table des tâches du poste lance encore la nuit : \`$nuit_en_table\`. La planification des nuits de la machine la remplace (\`npx grillhouse nuit --planifier\`, une fois par poste) : propose au responsable de retirer ces lignes (\`crontab -e\`)."
261
269
  fi
262
270
  if [ -n "$epopees" ]; then
263
271
  echo "Épopées qui ont une mère : $epopees. Une épopée est un chantier, à la racine ; une mère sous un chantier est une tâche (\`bd update <id> -t task\`, docs/agents/issue-tracker.md, « Numéros et titres »)."