@roomi-fields/grillhouse 0.48.0 → 0.49.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 (155) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +90 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +11 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +15 -6
  6. package/cadre/templates/projet/CLAUDE.md +10 -6
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/cadre/templates/turbo/paquets.json +3 -1
  9. package/cadre/templates/turbo/sans-paquets.json +3 -1
  10. package/charte.md +51 -14
  11. package/dist/temporal/acte.d.ts +9 -0
  12. package/dist/temporal/acte.js +43 -20
  13. package/dist/temporal/acte.js.map +1 -1
  14. package/dist/temporal/circuit/appel.d.ts +4 -1
  15. package/dist/temporal/circuit/appel.js +15 -1
  16. package/dist/temporal/circuit/appel.js.map +1 -1
  17. package/dist/temporal/circuit/client.d.ts +7 -1
  18. package/dist/temporal/circuit/client.js +54 -1
  19. package/dist/temporal/circuit/client.js.map +1 -1
  20. package/dist/temporal/circuit/commande.js +30 -57
  21. package/dist/temporal/circuit/commande.js.map +1 -1
  22. package/dist/temporal/circuit/contrat.d.ts +2 -1
  23. package/dist/temporal/circuit/contrat.js +2 -1
  24. package/dist/temporal/circuit/contrat.js.map +1 -1
  25. package/dist/temporal/circuit/deroule.js +9 -2
  26. package/dist/temporal/circuit/deroule.js.map +1 -1
  27. package/dist/temporal/file/contrat.d.ts +16 -2
  28. package/dist/temporal/file/contrat.js +27 -3
  29. package/dist/temporal/file/contrat.js.map +1 -1
  30. package/dist/temporal/file/deroule.js +4 -4
  31. package/dist/temporal/file/deroule.js.map +1 -1
  32. package/dist/temporal/nuits/activites.d.ts +1 -15
  33. package/dist/temporal/nuits/activites.js +3 -62
  34. package/dist/temporal/nuits/activites.js.map +1 -1
  35. package/dist/temporal/nuits/contrat.d.ts +3 -21
  36. package/dist/temporal/nuits/deroule.js +38 -74
  37. package/dist/temporal/nuits/deroule.js.map +1 -1
  38. package/dist/temporal/places/client.d.ts +3 -16
  39. package/dist/temporal/places/client.js +3 -26
  40. package/dist/temporal/places/client.js.map +1 -1
  41. package/dist/temporal/places/contrat.d.ts +15 -51
  42. package/dist/temporal/places/contrat.js +3 -13
  43. package/dist/temporal/places/contrat.js.map +1 -1
  44. package/dist/temporal/places/deroule.js +11 -61
  45. package/dist/temporal/places/deroule.js.map +1 -1
  46. package/dist/temporal/tickets/activites.js +4 -2
  47. package/dist/temporal/tickets/activites.js.map +1 -1
  48. package/dist/temporal/tickets/contrat.d.ts +2 -1
  49. package/docs/ARCHITECTURE.md +337 -120
  50. package/docs/CADRE.md +16 -13
  51. package/docs/INTERFACE.md +90 -25
  52. package/hooks/hooks.json +9 -0
  53. package/hooks/register.tsx +59 -5
  54. package/package.json +1 -1
  55. package/scripts/activites.mjs +271 -42
  56. package/scripts/aiguillage.mjs +4 -1
  57. package/scripts/bilan.mjs +125 -2
  58. package/scripts/circuit.mjs +233 -159
  59. package/scripts/circuits-cles.d.mts +3 -3
  60. package/scripts/circuits-cles.mjs +6 -5
  61. package/scripts/coeurs-dedies.mjs +4 -4
  62. package/scripts/commandes-composees.mjs +12 -5
  63. package/scripts/dette.d.ts +2 -1
  64. package/scripts/dette.mjs +49 -6
  65. package/scripts/direct.mjs +343 -0
  66. package/scripts/droits.mjs +26 -4
  67. package/scripts/effets.mjs +4 -4
  68. package/scripts/engendres.mjs +2 -1
  69. package/scripts/enveloppe/enveloppe.mjs +119 -18
  70. package/scripts/enveloppe/lancer.sh +14 -3
  71. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  72. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  73. package/scripts/etapes.mjs +3 -3
  74. package/scripts/faits-du-circuit.mjs +12 -11
  75. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  76. package/scripts/fermeture-de-la-machine.mjs +10 -20
  77. package/scripts/fichiers-nommes.mjs +27 -1
  78. package/scripts/file-des-tickets.d.mts +18 -1
  79. package/scripts/file-des-tickets.mjs +63 -15
  80. package/scripts/flux-de-la-nuit.mjs +38 -0
  81. package/scripts/grillhouse-maj.mjs +13 -25
  82. package/scripts/groupe-cles.d.mts +6 -0
  83. package/scripts/groupe-cles.mjs +29 -1
  84. package/scripts/integration/file.mjs +148 -37
  85. package/scripts/jointure.d.ts +20 -3
  86. package/scripts/journal-des-etats.d.mts +16 -0
  87. package/scripts/journal-des-etats.mjs +44 -2
  88. package/scripts/journal.mjs +3 -0
  89. package/scripts/langages/c/commandes.mjs +5 -5
  90. package/scripts/langages/c/composants.mjs +13 -5
  91. package/scripts/langages/cargo/commandes.mjs +5 -6
  92. package/scripts/langages/python/commandes.mjs +5 -5
  93. package/scripts/langages/python/composants.mjs +10 -2
  94. package/scripts/langages/typescript/composants.mjs +10 -3
  95. package/scripts/langages/typescript/consommateurs-arbitres.mjs +15 -3
  96. package/scripts/langages/typescript/construire.mjs +2 -0
  97. package/scripts/langages/typescript/exemples.mjs +33 -1
  98. package/scripts/langages/typescript/index.mjs +19 -0
  99. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  100. package/scripts/langages/typescript/tests-de-nuit.mjs +158 -32
  101. package/scripts/langages/typescript/tests-du-poste.mjs +112 -32
  102. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  103. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  104. package/scripts/langages/typescript/verifier.mjs +3 -5
  105. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  106. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  107. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  108. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  109. package/scripts/machine.mjs +1 -1
  110. package/scripts/mesure/base-de-passe.mjs +2 -1
  111. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  112. package/scripts/migrations.mjs +2 -0
  113. package/scripts/nuit.sh +129 -3
  114. package/scripts/paquet.mjs +16 -5
  115. package/scripts/paquets.d.ts +4 -0
  116. package/scripts/paquets.mjs +57 -0
  117. package/scripts/passe-de-la-machine.mjs +4 -7
  118. package/scripts/places-de-la-machine.mjs +55 -42
  119. package/scripts/places-du-serveur.mjs +2 -2
  120. package/scripts/plafond-de-la-machine.d.mts +7 -13
  121. package/scripts/plafond-de-la-machine.mjs +19 -35
  122. package/scripts/prefixe-des-tickets.mjs +1 -1
  123. package/scripts/references-changees.mjs +159 -0
  124. package/scripts/regles-des-places.d.mts +8 -31
  125. package/scripts/regles-des-places.mjs +14 -64
  126. package/scripts/repli-de-la-nuit.mjs +183 -0
  127. package/scripts/reponses-du-circuit.d.mts +2 -2
  128. package/scripts/reponses-du-circuit.mjs +21 -12
  129. package/scripts/reprise.mjs +27 -8
  130. package/scripts/resultats.mjs +21 -9
  131. package/scripts/seances.mjs +258 -40
  132. package/scripts/services-du-noyau.mjs +4 -0
  133. package/scripts/sous-commandes.mjs +24 -7
  134. package/scripts/superviseur.mjs +185 -39
  135. package/scripts/tableau.mjs +226 -94
  136. package/scripts/taches-du-graphe.mjs +84 -4
  137. package/scripts/ticket.mjs +348 -0
  138. package/scripts/transitions.d.mts +44 -0
  139. package/scripts/transitions.mjs +188 -17
  140. package/scripts/un-commit-par-ticket.mjs +4 -3
  141. package/scripts/verdict-de-la-nuit.mjs +47 -20
  142. package/scripts/verrou-de-fichier.mjs +2 -2
  143. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  144. package/scripts/verrous/verrou.mjs +17 -1
  145. package/skills/architecte/SKILL.md +203 -0
  146. package/skills/architecte/references/exemple-d-architecture.md +159 -0
  147. package/skills/developpeur/SKILL.md +1 -1
  148. package/skills/direct/SKILL.md +57 -0
  149. package/skills/explorateur/SKILL.md +10 -6
  150. package/skills/pitmaster/SKILL.md +37 -14
  151. package/skills/pitmaster/references/consigne-agent.md +7 -1
  152. package/skills/redacteur/references/documents-d-un-composant.md +2 -1
  153. package/skills/relecteur/SKILL.md +8 -0
  154. package/skills/testwriter/SKILL.md +10 -0
  155. package/scripts/ticket.sh +0 -25
@@ -72,7 +72,8 @@
72
72
  // at its real path, never at a link, by that same mechanism.
73
73
  // - A worktree of the repository under an emptied directory (the home, `/tmp`) comes back
74
74
  // read-only, `.git` included; the copy's packages of the plan and the tickets base are then
75
- // written as above.
75
+ // written as above. The copy of another ticket is an optional mount (`--ro-bind-try`): its
76
+ // circuit removes it at any moment, and the session leaves without it.
76
77
  // - An envelope on the main tree is refused, so is a plan that names no package, and so is a path
77
78
  // of the plan that does not exist; when it is the name of a package of the copy, the refusal
78
79
  // gives its path.
@@ -117,6 +118,7 @@ import {
117
118
  import os from 'node:os';
118
119
  import path from 'node:path';
119
120
  import { pathToFileURL } from 'node:url';
121
+ import { ROLES } from '../droits.mjs';
120
122
  import { langageDeLaCopie } from '../langages.mjs';
121
123
  import { CODE_REFUS, CODE_USAGE } from './codes.mjs';
122
124
  import {
@@ -124,7 +126,9 @@ import {
124
126
  ecrireLaListe,
125
127
  lireLaListe,
126
128
  paquetsDuLangage,
129
+ testsEtendusDeLEnveloppe,
127
130
  VARIABLE,
131
+ VARIABLE_TESTS_ETENDUS,
128
132
  } from './paquets-du-plan.mjs';
129
133
 
130
134
  export { paquetsDuLangage };
@@ -132,6 +136,7 @@ import { cacheDesOutils, installer, versionDeLOutil } from '../aiguillage.mjs';
132
136
  import { ouvrirBase } from '../mesure/base-de-passe.mjs';
133
137
  import {
134
138
  partDeLaPasse,
139
+ prendreUnePart,
135
140
  sousNiceEtIonice,
136
141
  travailleursDe,
137
142
  VARIABLE_TENUE,
@@ -141,8 +146,9 @@ import { donneesDe } from '../donnees-cles.mjs';
141
146
  import { matieresDeclareesDe } from '../matieres-cles.mjs';
142
147
  import { outilsDe } from '../outils-cles.mjs';
143
148
 
144
- // The role that writes the package of the shared test material and the lock files of the versions.
145
- const ROLE_MATIERE = 'testwriter';
149
+ // The roles that write the package of the shared test material and the lock files of the versions:
150
+ // the testwriter, and the agent of a direct, who writes tests and code together.
151
+ const ROLES_MATIERE = ['testwriter', 'direct'];
146
152
  // The directories <sorties> of <dir>, each relative to it.
147
153
  // One that a symbolic link carries out of <dir> (a `node_modules` linked to another tree's) is
148
154
  // left out: it is not the copy's, and bwrap could not mount over it. `lien(path)` gives the text
@@ -186,7 +192,7 @@ const paquetsHorsDuPlan = (paquets, paquetsDeLaCopie, matieres) => {
186
192
  // link carries out of the copy is left out. bwrap then has a directory to mount an empty one over.
187
193
  export function preparerLesSorties({ copie, paquets, paquetsDeLaCopie, matieres, role, sorties }) {
188
194
  const dossiers = paquetsHorsDuPlan(paquets, paquetsDeLaCopie, matieres);
189
- if (role !== ROLE_MATIERE) {
195
+ if (!ROLES_MATIERE.includes(role)) {
190
196
  // A declared folder of test material is no package: no run of tests writes outputs in it.
191
197
  dossiers.push(...matieres.filter(m => paquetsDeLaCopie.some(p => p.dossier === m)));
192
198
  }
@@ -201,11 +207,13 @@ export function preparerLesSorties({ copie, paquets, paquetsDeLaCopie, matieres,
201
207
  }
202
208
  // The machine's temporary directory: an empty one, proper to the session, replaces it.
203
209
  const TEMPORAIRE = '/tmp';
204
- // What stays read-only inside `~/.claude`: the configuration and what it loads.
210
+ // What stays read-only inside `~/.claude`: the configuration and what it loads. The user's own
211
+ // charter (`CLAUDE.md`) is not among it: it holds rules made for the user's session (commit and
212
+ // push on their own), and a role session never receives it; the settings of the role also exclude
213
+ // it (`claudeMdExcludes`, scripts/droits.mjs), for the sessions out of the envelope.
205
214
  const CLAUDE_EN_LECTURE = [
206
215
  'settings.json',
207
216
  'settings.local.json',
208
- 'CLAUDE.md',
209
217
  'keybindings.json',
210
218
  'agents',
211
219
  'commands',
@@ -216,9 +224,9 @@ const CLAUDE_EN_LECTURE = [
216
224
  ];
217
225
  // What the home shows read-only besides `~/.claude`, as paths relative to it: claude's launcher
218
226
  // and versions, node and its global tools (bd), the state of bd and of its dolt database, and the
219
- // git configuration. The home shows nothing else: neither codegraph nor rtfm, whose servers the
220
- // roles of the envelope do not receive (scripts/droits.mjs); the indexes of the repository are in
221
- // sight with it.
227
+ // git configuration. The home shows nothing else but the programs of the index for a role whose
228
+ // rights hold it (`cheminsDeLIndex`: codegraph); the indexes of the repository are in sight with
229
+ // it.
222
230
  const MAISON_EN_LECTURE = [
223
231
  '.local/bin/claude',
224
232
  '.local/share/claude',
@@ -232,6 +240,39 @@ const MAISON_EN_LECTURE = [
232
240
  '.config/git/attributes',
233
241
  ];
234
242
 
243
+ // The programs of the index, as paths of the home: the program that the `.mcp.json` of the project
244
+ // launches by its name (codegraph, found in `~/.local/bin`) and the home of its versions. rtfm
245
+ // needs none: its server comes with its plugin, which the envelope mounts (`plugins`).
246
+ const INDEX_DE_LA_MAISON = [{ nom: 'codegraph', programme: '.local/bin/codegraph', maison: '.codegraph' }];
247
+
248
+ /**
249
+ * The paths that the envelope of <role> mounts read-only for the index, as a sandbox mounts the
250
+ * tools its configuration gives a process: those of the programs of the index when the rights of
251
+ * the role hold it (`ROLES[role].index`), and the names of the programs the machine lacks, which
252
+ * the journal says. A role without the index gets nothing.
253
+ * @param {{ role?: string, maison: string, existe?: (p: string) => boolean }} o
254
+ * @returns {{ chemins: string[], manquants: string[] }}
255
+ */
256
+ export function cheminsDeLIndex({ role, maison, existe = existsSync }) {
257
+ const r = { chemins: [], manquants: [] };
258
+ if (!role || !ROLES[role]?.index) {
259
+ return r;
260
+ }
261
+ for (const { nom, programme, maison: dossier } of INDEX_DE_LA_MAISON) {
262
+ const prog = path.join(maison, programme);
263
+ if (!existe(prog)) {
264
+ r.manquants.push(nom);
265
+ continue;
266
+ }
267
+ r.chemins.push(prog);
268
+ const home = path.join(maison, dossier);
269
+ if (existe(home)) {
270
+ r.chemins.push(home);
271
+ }
272
+ }
273
+ return r;
274
+ }
275
+
235
276
  // The variables of a login session that the envelope passes on, as sudo's env_reset keeps them,
236
277
  // claude's OAuth credential, the author of the session's comments at the ticket (`BEADS_ACTOR`,
237
278
  // which the circuit sets to the session's role), the mark of the place the session holds
@@ -264,9 +305,16 @@ const VARIABLES_DE_CHEMIN = [
264
305
  'NVM_DIR',
265
306
  'XDG_RUNTIME_DIR',
266
307
  ];
267
- // Run inside the envelope before the command: unsets each named variable whose path does not
268
- // exist there, then runs the command. `sh -c EPREUVE sh <variables…> -- <commande…>`.
308
+ // The witness that the envelope started its command: an empty file the command writes as its first
309
+ // gesture inside the envelope, in the session's working directory (`TMPDIR` there). The launcher
310
+ // (lancer.sh) removes it before the envelope and ranges it with the session's result after: a
311
+ // launch bwrap refuses, on a mount or anything else, leaves none.
312
+ export const TEMOIN_DE_DEMARRAGE = '.demarree';
313
+ // Run inside the envelope before the command: leaves the witness of its start, unsets each named
314
+ // variable whose path does not exist there, then runs the command.
315
+ // `sh -c EPREUVE sh <variables…> -- <commande…>`.
269
316
  const EPREUVE =
317
+ `[ -z "\${TMPDIR-}" ] || touch "$TMPDIR/${TEMOIN_DE_DEMARRAGE}" || :; ` +
270
318
  'while [ "$1" != -- ]; do eval "p=\\${$1-}"; ' +
271
319
  'if [ -n "$p" ] && [ ! -e "$p" ]; then unset "$1"; fi; shift; done; shift; exec "$@"';
272
320
 
@@ -300,7 +348,7 @@ export function dossierDeTravail(copie, env = process.env) {
300
348
  // Nothing else of <env> enters.
301
349
  export function environnementDeLaSeance(
302
350
  env,
303
- { cacheNpm, paquets, travail, outils = {}, donnees = {}, travailleurs }
351
+ { cacheNpm, paquets, travail, outils = {}, donnees = {}, travailleurs, testsEtendus = [] }
304
352
  ) {
305
353
  const declare = nom =>
306
354
  ENVIRONNEMENT_DECLARE.includes(nom) ||
@@ -317,6 +365,7 @@ export function environnementDeLaSeance(
317
365
  TMP: travail,
318
366
  TEMP: travail,
319
367
  [VARIABLE]: ecrireLaListe(paquets),
368
+ ...(testsEtendus.length ? { [VARIABLE_TESTS_ETENDUS]: ecrireLaListe(testsEtendus) } : {}),
320
369
  ...(travailleurs === undefined ? {} : { GRILLHOUSE_TRAVAILLEURS: String(travailleurs) }),
321
370
  };
322
371
  }
@@ -348,6 +397,7 @@ export function lancementDeLaSeance({
348
397
  donnees,
349
398
  part,
350
399
  sonde,
400
+ testsEtendus,
351
401
  }) {
352
402
  const seance = {
353
403
  cmd: 'bwrap',
@@ -369,6 +419,7 @@ export function lancementDeLaSeance({
369
419
  travail,
370
420
  outils,
371
421
  donnees,
422
+ testsEtendus,
372
423
  travailleurs: travailleursDe({ env }),
373
424
  }),
374
425
  };
@@ -394,6 +445,7 @@ export function montagesDeLaSeance({
394
445
  scratchpads,
395
446
  sessions = [],
396
447
  outils = {},
448
+ index = [],
397
449
  publie = null,
398
450
  }) {
399
451
  const maison = path.dirname(claude);
@@ -405,6 +457,7 @@ export function montagesDeLaSeance({
405
457
  ...CLAUDE_EN_LECTURE.map(nom => ({ chemin: path.join(claude, nom), ecriture: false })),
406
458
  { chemin: projet, ecriture: true },
407
459
  ...MAISON_EN_LECTURE.map(rel => ({ chemin: path.join(maison, rel), ecriture: false })),
460
+ ...index.map(chemin => ({ chemin, ecriture: false })),
408
461
  ...Object.values(outils).map(chemin => ({ chemin, ecriture: false })),
409
462
  ...(publie === null ? [] : [{ chemin: publie, ecriture: false }]),
410
463
  ];
@@ -596,6 +649,7 @@ export function jugerComposant({ depot, composant, paquets = [] }, fs) {
596
649
  * paquets?: string[],
597
650
  * role?: string,
598
651
  * matieres?: string[],
652
+ * testsEtendus?: string[],
599
653
  * verrous?: string[],
600
654
  * montages?: { chemin: string, source?: string, ecriture?: boolean, vide?: boolean, scelle?: boolean, lien?: string }[],
601
655
  * magasins?: string[],
@@ -613,6 +667,7 @@ export function plan(
613
667
  paquets = [],
614
668
  role,
615
669
  matieres = [],
670
+ testsEtendus = [],
616
671
  verrous = [],
617
672
  montages = [],
618
673
  magasins = [],
@@ -692,8 +747,17 @@ export function plan(
692
747
  args.push('--symlink', lien, chemin);
693
748
  }
694
749
  // A worktree that an emptied directory covers comes back read-only, before the copy is written.
750
+ // The main tree and the copy of the session are mounted as they are found; the copy of another
751
+ // ticket, which its circuit removes at any moment, is an optional mount: bwrap skips it when its
752
+ // source is gone by then, as a container skips an optional mount.
695
753
  for (const t of trees) {
696
- if (videes.some(v => inside(t, v)) && fs.existe(t)) {
754
+ if (!videes.some(v => inside(t, v))) {
755
+ continue;
756
+ }
757
+ const tenu = [trees[0], copie].some(a => path.resolve(a) === path.resolve(t));
758
+ if (!tenu) {
759
+ args.push('--ro-bind-try', t, t);
760
+ } else if (fs.existe(t)) {
697
761
  args.push('--ro-bind', t, t);
698
762
  }
699
763
  }
@@ -748,19 +812,27 @@ export function plan(
748
812
  const d = path.join(copie, e);
749
813
  args.push('--bind', d, d);
750
814
  }
815
+ // The reader packages the plan extended to their tests: the testwriter writes them (his lock
816
+ // lets only their test files through), every other role reads them.
817
+ for (const e of testsEtendus.filter(t => !ecrits.includes(t))) {
818
+ const d = path.join(copie, e);
819
+ if (fs.existe(d)) {
820
+ args.push(role === 'testwriter' ? '--bind' : '--ro-bind', d, d);
821
+ }
822
+ }
751
823
  // The lock files of the versions, which a run of the testwriter's tests brings in line with
752
824
  // the dependencies of his tests, are written by him alone.
753
825
  for (const v of verrous.map(v => path.join(copie, v))) {
754
- if (role === ROLE_MATIERE && fs.existe(v)) {
826
+ if (ROLES_MATIERE.includes(role) && fs.existe(v)) {
755
827
  args.push('--bind', v, v);
756
828
  }
757
829
  }
758
830
  }
759
831
  for (const m of matieres.map(m => path.join(copie, m))) {
760
- args.push(role === ROLE_MATIERE ? '--bind' : '--ro-bind', m, m);
832
+ args.push(ROLES_MATIERE.includes(role) ? '--bind' : '--ro-bind', m, m);
761
833
  // What a run of its tests writes goes, for a role that does not write it, to an empty
762
834
  // directory proper to the session, as Bazel writes a test's logs out of its source.
763
- if (role === ROLE_MATIERE) {
835
+ if (ROLES_MATIERE.includes(role)) {
764
836
  continue;
765
837
  }
766
838
  for (const s of sortiesDe(m, sorties.propres, fs.lien)) {
@@ -821,6 +893,8 @@ function envelopper(argv) {
821
893
  }
822
894
  const copie = path.resolve(copieArg);
823
895
  const paquets = lireLaListe(liste);
896
+ // The reader packages extended to their tests, for the testwriter alone.
897
+ const testsEtendus = role === 'testwriter' ? testsEtendusDeLEnveloppe(process.env) : [];
824
898
  // A launch from a package of a repository of workspaces sets npm's `workspace`, which
825
899
  // `npm config` refuses: the cache is the user's, whatever the workspace.
826
900
  const cacheNpm = execFileSync('npm', ['config', 'get', 'cache', '--workspaces=false'], {
@@ -869,6 +943,14 @@ function envelopper(argv) {
869
943
  if (existsSync(`${claude}.json`)) {
870
944
  copyFileSync(`${claude}.json`, etatJetable);
871
945
  }
946
+ // The program of the index for a role whose rights hold it; one the machine lacks is named in
947
+ // the journal, the session starting without it.
948
+ const indexDeLaSeance = cheminsDeLIndex({ role, maison: os.homedir() });
949
+ for (const nom of indexDeLaSeance.manquants) {
950
+ process.stderr.write(
951
+ `⚠ la séance part sans ${nom} : les droits du rôle ${role} lui donnent l'index, le programme est introuvable sur le poste\n`
952
+ );
953
+ }
872
954
  const montages = avecLiens(
873
955
  montagesDeLaSeance({
874
956
  cacheNpm,
@@ -878,6 +960,7 @@ function envelopper(argv) {
878
960
  scratchpads,
879
961
  sessions,
880
962
  outils,
963
+ index: indexDeLaSeance.chemins,
881
964
  publie,
882
965
  }),
883
966
  lienSurDisque
@@ -918,6 +1001,7 @@ function envelopper(argv) {
918
1001
  paquets,
919
1002
  role,
920
1003
  matieres,
1004
+ testsEtendus,
921
1005
  verrous: langage.manifestes.verrous,
922
1006
  montages,
923
1007
  magasins,
@@ -932,9 +1016,20 @@ function envelopper(argv) {
932
1016
  process.stderr.write(`⛔ ENVELOPPE REFUSÉE — ${refus}\n`);
933
1017
  code = CODE_REFUS;
934
1018
  } else {
1019
+ // The session reserves its cores for its phase alone (3, a direct's 2) against the budget of
1020
+ // the machine, and gives them back at its end; under a part already held, its cap is that part.
935
1021
  let part;
1022
+ let prise = null;
936
1023
  try {
937
- part = partDeLaPasse({ racine: copie });
1024
+ const direct = role === 'direct';
1025
+ prise = prendreUnePart({
1026
+ racine: copie,
1027
+ ticket: path.basename(copie),
1028
+ sorte: `séance ${role ?? ''}`.trim(),
1029
+ direct,
1030
+ dire: l => process.stderr.write(`${l}\n`),
1031
+ });
1032
+ part = prise.part ?? partDeLaPasse({ racine: copie, direct });
938
1033
  } catch (e) {
939
1034
  process.stderr.write(`⛔ ENVELOPPE REFUSÉE — ${e.message}\n`);
940
1035
  temporaire.fermer();
@@ -950,11 +1045,17 @@ function envelopper(argv) {
950
1045
  outils,
951
1046
  donnees,
952
1047
  part,
1048
+ testsEtendus,
953
1049
  });
954
1050
  if (lancement.sansBorne !== null) {
955
1051
  process.stderr.write(`⚠ la séance part sans borne de processeur : ${lancement.sansBorne}\n`);
956
1052
  }
957
- const r = spawnSync(lancement.cmd, lancement.args, { stdio: 'inherit', env: lancement.env });
1053
+ let r;
1054
+ try {
1055
+ r = spawnSync(lancement.cmd, lancement.args, { stdio: 'inherit', env: lancement.env });
1056
+ } finally {
1057
+ prise.rendre();
1058
+ }
958
1059
  if (r.error) {
959
1060
  process.stderr.write(`⛔ ENVELOPPE IMPOSSIBLE — ${r.error.message}\n`);
960
1061
  }
@@ -108,6 +108,9 @@
108
108
  # launcher writes the session's exit code to `fin` in the folder of the session, which a launch
109
109
  # removes first: a launch that stops before its session leaves none, so the circuit
110
110
  # (scripts/circuit.mjs) tells a code of the session from CODE_USAGE, CODE_REFUS and CODE_COPIE.
111
+ # The command the envelope runs leaves a witness of its start in the working directory, which the
112
+ # launcher ranges beside it (`demarree`, removed first): an envelope that ends without it refused
113
+ # the launch before the session, whatever its code (scripts/seances.mjs `seanceLancee`).
111
114
  # A session its lock stopped on a write out of the plan (scripts/verrous/verrou.mjs) left the
112
115
  # reason in its working directory (`hors-plan`, removed before the session): the launcher moves
113
116
  # it to `hors-plan` in the folder of the session, which a launch removes first and the circuit reads,
@@ -183,8 +186,9 @@ fin="$rang/fin"
183
186
  resultat="$rang/resultat.json"
184
187
  hors_plan="$rang/hors-plan"
185
188
  hors_plan_fait="$rang/hors-plan.json"
189
+ demarree="$rang/demarree"
186
190
  mkdir -p "$(dirname "$copie")" "$rang"
187
- rm -f "$fin" "$resultat" "$hors_plan" "$hors_plan_fait"
191
+ rm -f "$fin" "$resultat" "$hors_plan" "$hors_plan_fait" "$demarree"
188
192
  printf '=== %s · %s · %s ===\n' "$(date -Iseconds)" "$role" "$composant" >> "$journal"
189
193
  # The temporary directory of the ticket (`ouvrirBaseDuTicket`, scripts/mesure/base-de-passe.mjs):
190
194
  # TMPDIR, TMP and TEMP of the rest of the launch and of the session, whose scratchpads and working
@@ -244,8 +248,10 @@ publie=$(cd "$copie" && node "$ici/../../bin/grillhouse.mjs" index-interfaces --
244
248
  # The session's working directory, the one the envelope gives as TMPDIR, follows them.
245
249
  travail=$(node --input-type=module -e "import { dossierDeTravail } from '$ici/enveloppe.mjs'; process.stdout.write(dossierDeTravail(process.argv[1]));" "$copie" 2>> "$journal") \
246
250
  || { rm -f "$echec"; echo "⛔ Le dossier de travail de la séance n'a pas pu se lire : voir $journal." >&2; exit "$CODE_COPIE"; }
247
- # The mark a lock leaves there when it stops the session out of the plan: none before the session.
248
- rm -f "$travail/hors-plan"
251
+ # The mark a lock leaves there when it stops the session out of the plan, and the witness the
252
+ # envelope's command leaves there at its start (`TEMOIN_DE_DEMARRAGE` of enveloppe.mjs): none before
253
+ # the session.
254
+ rm -f "$travail/hors-plan" "$travail/.demarree"
249
255
  dossier=$'\n\n'"## Ton dossier de travail"$'\n\n'"Tout fichier temporaire s'écrit dans \`$travail\`, que \`\$TMPDIR\` nomme aussi."
250
256
  construction=
251
257
  if [ -s "$echec" ]; then
@@ -288,6 +294,11 @@ else
288
294
  lancer_claude >> "$journal" 2>&1 || code=$?
289
295
  fi
290
296
  rm -f "$prompt"
297
+ # The witness that the envelope started its command goes to the circuit: a launch the envelope
298
+ # refuses before the session (a mount bwrap cannot make) leaves none.
299
+ if [ -f "$travail/.demarree" ]; then
300
+ mv "$travail/.demarree" "$demarree"
301
+ fi
291
302
  # A session its lock stopped out of the plan (scripts/verrous/verrou.mjs): its reason goes to the
292
303
  # circuit, and to the log.
293
304
  if [ -f "$travail/hors-plan" ]; then
@@ -28,6 +28,15 @@ export const lireLaListe = texte =>
28
28
  .split(path.delimiter)
29
29
  .filter(Boolean);
30
30
 
31
+ // The variable that lists, in the same form, the reader packages the circuit extended the plan to
32
+ // for their tests alone: given to the session of the testwriter only, which writes their test
33
+ // files and no other file of those packages.
34
+ export const VARIABLE_TESTS_ETENDUS = 'GRILLHOUSE_TESTS_ETENDUS';
35
+
36
+ // The directories of the reader packages extended to their tests named in <env>.
37
+ export const testsEtendusDeLEnveloppe = (env = process.env) =>
38
+ env[VARIABLE_TESTS_ETENDUS] ? lireLaListe(env[VARIABLE_TESTS_ETENDUS]) : [];
39
+
31
40
  // The packages of the plan of the envelope named in <env>, or null outside an envelope.
32
41
  export const paquetsDeLEnveloppe = (env = process.env) =>
33
42
  env[VARIABLE] ? lireLaListe(env[VARIABLE]) : null;