@roomi-fields/grillhouse 0.32.0 → 0.33.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 (116) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +136 -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/contrat.d.ts +15 -0
  10. package/dist/temporal/circuit/deroule.js +37 -14
  11. package/dist/temporal/circuit/deroule.js.map +1 -1
  12. package/dist/temporal/deroules.d.ts +1 -0
  13. package/dist/temporal/deroules.js +3 -1
  14. package/dist/temporal/deroules.js.map +1 -1
  15. package/dist/temporal/file/activites.d.ts +1 -0
  16. package/dist/temporal/file/activites.js +5 -2
  17. package/dist/temporal/file/activites.js.map +1 -1
  18. package/dist/temporal/file/contrat.d.ts +50 -33
  19. package/dist/temporal/file/contrat.js +2 -2
  20. package/dist/temporal/file/contrat.js.map +1 -1
  21. package/dist/temporal/file/deroule.d.ts +3 -1
  22. package/dist/temporal/file/deroule.js +128 -26
  23. package/dist/temporal/file/deroule.js.map +1 -1
  24. package/dist/temporal/nuits/activites.d.ts +10 -0
  25. package/dist/temporal/nuits/activites.js +114 -0
  26. package/dist/temporal/nuits/activites.js.map +1 -0
  27. package/dist/temporal/nuits/appel.d.ts +23 -0
  28. package/dist/temporal/nuits/appel.js +40 -0
  29. package/dist/temporal/nuits/appel.js.map +1 -0
  30. package/dist/temporal/nuits/choix.d.ts +14 -0
  31. package/dist/temporal/nuits/choix.js +119 -0
  32. package/dist/temporal/nuits/choix.js.map +1 -0
  33. package/dist/temporal/nuits/client.d.ts +28 -0
  34. package/dist/temporal/nuits/client.js +83 -0
  35. package/dist/temporal/nuits/client.js.map +1 -0
  36. package/dist/temporal/nuits/commande.d.ts +2 -0
  37. package/dist/temporal/nuits/commande.js +107 -0
  38. package/dist/temporal/nuits/commande.js.map +1 -0
  39. package/dist/temporal/nuits/contrat.d.ts +98 -0
  40. package/dist/temporal/nuits/contrat.js +30 -0
  41. package/dist/temporal/nuits/contrat.js.map +1 -0
  42. package/dist/temporal/nuits/deroule.d.ts +5 -0
  43. package/dist/temporal/nuits/deroule.js +100 -0
  44. package/dist/temporal/nuits/deroule.js.map +1 -0
  45. package/dist/temporal/travailleur.js +4 -1
  46. package/dist/temporal/travailleur.js.map +1 -1
  47. package/docs/ARCHITECTURE.md +186 -45
  48. package/docs/CADRE.md +31 -1
  49. package/docs/INTERFACE.md +45 -6
  50. package/hooks/register.tsx +11 -3
  51. package/package.json +4 -1
  52. package/scripts/abi-des-dependances.mjs +105 -0
  53. package/scripts/activites.mjs +94 -41
  54. package/scripts/aiguillage.mjs +1 -0
  55. package/scripts/avancement.mjs +8 -18
  56. package/scripts/ci-des-branches.mjs +91 -0
  57. package/scripts/circuit.mjs +79 -4
  58. package/scripts/composants-affectes.mjs +24 -7
  59. package/scripts/composition-des-langages.mjs +3 -0
  60. package/scripts/crochets.mjs +4 -0
  61. package/scripts/enveloppe/enveloppe.mjs +3 -1
  62. package/scripts/enveloppe/lancer.sh +1 -1
  63. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  64. package/scripts/etapes.mjs +18 -1
  65. package/scripts/faits-du-circuit.mjs +43 -20
  66. package/scripts/fichier-du-poste.mjs +87 -0
  67. package/scripts/grillhouse-maj.mjs +15 -1
  68. package/scripts/integration/file.mjs +215 -275
  69. package/scripts/integration/integrer.mjs +82 -41
  70. package/scripts/integration/rejeu.mjs +13 -64
  71. package/scripts/jointure.d.ts +26 -2
  72. package/scripts/langages/cargo/commandes.mjs +81 -19
  73. package/scripts/langages/cargo/exemples.mjs +2 -2
  74. package/scripts/langages/cargo/index.mjs +11 -5
  75. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  76. package/scripts/langages/python/commandes.mjs +11 -7
  77. package/scripts/langages/python/exemples.mjs +1 -1
  78. package/scripts/langages/python/index.mjs +9 -2
  79. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  80. package/scripts/langages/typescript/code-mort.mjs +41 -24
  81. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  82. package/scripts/langages/typescript/exemples.mjs +2 -0
  83. package/scripts/langages/typescript/index.mjs +22 -3
  84. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  85. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  86. package/scripts/langages/typescript/resumes.mjs +17 -7
  87. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  88. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  89. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  90. package/scripts/langages/typescript/tranches.mjs +273 -0
  91. package/scripts/langages/typescript/verifier.mjs +131 -29
  92. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  93. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  94. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  95. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  96. package/scripts/lint-des-scripts.mjs +23 -6
  97. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  98. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  99. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  100. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  101. package/scripts/migrations.mjs +8 -0
  102. package/scripts/newday.mjs +18 -0
  103. package/scripts/nuit.sh +35 -17
  104. package/scripts/registre.d.mts +90 -0
  105. package/scripts/registre.mjs +28 -3
  106. package/scripts/reprise.mjs +12 -8
  107. package/scripts/services-du-noyau.mjs +4 -0
  108. package/scripts/session-start.sh +28 -32
  109. package/scripts/sous-commandes.mjs +29 -10
  110. package/scripts/tableau.mjs +124 -17
  111. package/scripts/taches-du-graphe.mjs +39 -6
  112. package/scripts/transitions.mjs +42 -3
  113. package/scripts/verrou-de-machine.mjs +1 -2
  114. package/scripts/workflows-du-cadre.mjs +75 -0
  115. package/skills/grill/SKILL.md +8 -6
  116. package/skills/pitmaster/SKILL.md +5 -4
@@ -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,6 +36,7 @@ export {
33
36
  tracesDuPlan,
34
37
  } from './taches-du-graphe.mjs';
35
38
  export { luUneFois } from './lecture-unique.mjs';
39
+ export { avecLeFichierDuPoste } from './fichier-du-poste.mjs';
36
40
  export { 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';
@@ -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,9 @@
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 CI of the ticket branches: a project none of whose workflows runs on a push to `agent/**`
35
+ # (scripts/ci-des-branches.mjs) joins « Manque », with `npx grillhouse maj`, which adds it.
36
+ #
30
37
  # One supervisor per project (scripts/superviseur.mjs): the session takes the lock of its
31
38
  # repository, and, when its opening takes the lock (not when it keeps it, after a compaction or a
32
39
  # /clear), receives the section « L'attente des questions », the wait to launch in the background,
@@ -83,6 +90,10 @@ if [ -z "$copie_agent" ]; then
83
90
  [ -d "$root/.codegraph" ] || missing+=("l'index CodeGraph du code (\`codegraph init .\`)")
84
91
  fi
85
92
  [ ! -f "$root/package.json" ] || [ -d "$root/node_modules" ] || missing+=("les dépendances npm (\`npm install\`)")
93
+ # Dependencies installed under another Node (scripts/abi-des-dependances.mjs): a native module
94
+ # refuses the binary interface of the current one.
95
+ abi="$(node "$ici/abi-des-dependances.mjs" --manque "$root" 2>/dev/null)"
96
+ [ -z "$abi" ] || missing+=("$abi")
86
97
  # The project's languages (scripts/langages.mjs): a project whose docs/ARCHITECTURE.md declares
87
98
  # none (the column « Langage » of its table of the components) is refused by the frame's scripts
88
99
  # and locks until the grill writes it, or, for a project that holds the declaration of a former
@@ -120,6 +131,12 @@ fi
120
131
  while IFS= read -r crochet; do
121
132
  [ -n "$crochet" ] && missing+=("le crochet git $crochet du cadre")
122
133
  done < <(node "$ici/crochets.mjs" --absents "$root" 2>/dev/null)
134
+ # The CI of the ticket branches (scripts/ci-des-branches.mjs): the queue enters a lot on main only
135
+ # once the CI of `agent/<ticket>` judged it green, so a project none of whose workflows runs on a
136
+ # push to `agent/**` lacks it. An agent's copy does not read it.
137
+ if [ -z "$copie_agent" ] && [ -n "$(node "$ici/ci-des-branches.mjs" --absente "$root" 2>/dev/null)" ]; then
138
+ 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/**']\`)")
139
+ fi
123
140
  command -v bwrap >/dev/null || missing+=("bubblewrap (bwrap), l'enveloppe des agents : sudo apt install bubblewrap")
124
141
 
125
142
  # The key elements the skills read; each one still empty is proposed for a grill.
@@ -208,39 +225,20 @@ if [ -f "$root/package.json" ]; then
208
225
  done
209
226
  fi
210
227
 
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
228
+ # The nights run under the schedule of the machine (src/temporal/nuits/, `npx grillhouse nuit
229
+ # --planifier`), no longer by the table of tasks: a line of the crontab that still launches a night
230
+ # (`grillhouse nuit`, or a nuit.sh) is named, with the proposal to remove it, so that the table and
231
+ # the schedule never play two nights at once. The lines are joined by « ; », each one as the table
232
+ # writes it, its own semicolons kept.
233
+ nuit_en_table=
234
+ if command -v crontab >/dev/null 2>&1; then
235
+ 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
236
  fi
239
237
 
240
238
  # An epic is a chantier, at the root: one with a mother is a mother ticket typed by mistake.
241
239
  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
240
 
243
- [ ${#missing[@]} -eq 0 ] && [ ${#pending[@]} -eq 0 ] && [ ${#wiring[@]} -eq 0 ] && [ -z "${nuit:-}" ] && [ -z "$epopees" ] && [ -z "${inconnus:-}" ] && [ -z "${ecart_versions:-}" ] && exit 0
241
+ [ ${#missing[@]} -eq 0 ] && [ ${#pending[@]} -eq 0 ] && [ ${#wiring[@]} -eq 0 ] && [ -z "$nuit_en_table" ] && [ -z "$epopees" ] && [ -z "${inconnus:-}" ] && [ -z "${ecart_versions:-}" ] && exit 0
244
242
 
245
243
  echo "## Éléments du projet à définir (Roomi's Grillhouse)"
246
244
  if [ ${#missing[@]} -gt 0 ]; then
@@ -254,10 +252,8 @@ fi
254
252
  if [ ${#wiring[@]} -gt 0 ]; then
255
253
  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
254
  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\`."
255
+ if [ -n "$nuit_en_table" ]; then
256
+ 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
257
  fi
262
258
  if [ -n "$epopees" ]; then
263
259
  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 »)."
@@ -13,6 +13,8 @@
13
13
  // (scripts/langages.mjs); each other command it describes is a subcommand by its name
14
14
  // (`frontieres`, `index-interfaces`, `typer`, `construire`), as a backend of Pants brings its
15
15
  // goals.
16
+ // - `nuit` runs the build of src/temporal/nuits/commande.ts, which plays the night's pass
17
+ // (`nuit.sh`) when called alone: the script it replaces is that pass (`PASSES`).
16
18
  // - `temporal` runs the build of src/temporal/commande.ts (dist/temporal/commande.js), the
17
19
  // package's TypeScript, which Turborepo builds before the tests and the package publishes.
18
20
  import { existsSync } from 'node:fs';
@@ -48,7 +50,8 @@ export const SOUS_COMMANDES = {
48
50
  journal: 'journal.mjs',
49
51
  'ligne-etat': 'ligne-etat/ligne-etat.mjs',
50
52
  maj: 'grillhouse-maj.mjs',
51
- nuit: 'nuit.sh',
53
+ newday: 'newday.mjs',
54
+ nuit: '../dist/temporal/nuits/commande.js',
52
55
  outil: 'outil.mjs',
53
56
  paquet: 'paquet.mjs',
54
57
  pression: 'mesure/pression.mjs',
@@ -71,6 +74,10 @@ export const SOUS_COMMANDES = {
71
74
  verrou: 'verrous/verrou.mjs',
72
75
  };
73
76
 
77
+ // The script a subcommand plays when called alone, where its command is a client of Temporal that
78
+ // runs it: `nuit`, the night's pass.
79
+ const PASSES = { nuit: 'nuit.sh' };
80
+
74
81
  // The commands of the module of the language that serve the project at <racine> and are no
75
82
  // subcommand by their name: the ones `tests` and `verifier` run.
76
83
  const DU_NOYAU = new Set(['tester', 'verifier']);
@@ -126,10 +133,13 @@ export function scriptAbsent(nom, script) {
126
133
  }
127
134
 
128
135
  /**
129
- * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>:
130
- * `verifier` gets the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs) and its
131
- * data (`grillhouse.donnees`, scripts/donnees-cles.mjs), each variable set to its path, whatever
132
- * <env> holds; every other subcommand gets <env>.
136
+ * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>: a
137
+ * command of the module of the project's language (`tests`, `verifier`, `construire`…), the
138
+ * ones that run its task runner, gets the module's environment of the poste
139
+ * (`environnementDuPoste`, scripts/jointure.d.ts: the remote cache read-only, when the poste holds
140
+ * its file); `verifier` also gets the tools of the project (`grillhouse.outils`,
141
+ * scripts/outils-cles.mjs) and its data (`grillhouse.donnees`, scripts/donnees-cles.mjs), each
142
+ * variable set to its path, whatever <env> holds; a subcommand of the core gets <env>.
133
143
  * @param {string} nom the subcommand
134
144
  * @param {string} [racine] the root of the project, the working directory by default
135
145
  * @param {Record<string, string | undefined>} [env]
@@ -137,20 +147,29 @@ export function scriptAbsent(nom, script) {
137
147
  * @throws {Error} the faults of the key, for `verifier`
138
148
  */
139
149
  export function environnementDe(nom, racine = process.cwd(), env = process.env) {
150
+ if (typeof SOUS_COMMANDES[nom] === 'string') {
151
+ return env;
152
+ }
153
+ const poste = langageDe(racine).environnementDuPoste(env);
140
154
  return nom === 'verifier'
141
- ? avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), env))
142
- : env;
155
+ ? avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), poste))
156
+ : poste;
143
157
  }
144
158
 
145
159
  // The script of each subcommand in the project at <racine>, where a former copy of the frame lay
146
160
  // (`scripts/<script>`): what the migrations name, a former copy becoming its subcommand. A script
147
- // of the core is named from `scripts/`, one of a module of language by its file's name, where the
148
- // frame kept it before its module.
161
+ // of the core is named from `scripts/` (the pass it plays alone, `PASSES`, for a client of
162
+ // Temporal), one of a module of language by its file's name, where the frame kept it before its
163
+ // module.
149
164
  export function scriptsDesSousCommandes(racine) {
150
165
  return Object.fromEntries(
151
166
  Object.entries(sousCommandes(racine)).map(([n, s]) => [
152
167
  n,
153
- typeof s === 'string' ? s : path.basename(commandeDe(n, racine).script),
168
+ Object.hasOwn(PASSES, n)
169
+ ? PASSES[n]
170
+ : typeof s === 'string'
171
+ ? s
172
+ : path.basename(commandeDe(n, racine).script),
154
173
  ])
155
174
  );
156
175
  }