@roomi-fields/grillhouse 0.53.0 → 0.54.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 (62) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +54 -0
  3. package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
  4. package/charte.md +12 -0
  5. package/dist/temporal/circuit/deroule.js +5 -9
  6. package/dist/temporal/circuit/deroule.js.map +1 -1
  7. package/dist/temporal/installation.d.ts +15 -2
  8. package/dist/temporal/installation.js +69 -17
  9. package/dist/temporal/installation.js.map +1 -1
  10. package/docs/INTERFACE.md +21 -1
  11. package/docs/architecture/circuit.md +3 -3
  12. package/docs/architecture/entree.md +4 -4
  13. package/docs/architecture/greffon.md +28 -17
  14. package/docs/architecture/installation.md +21 -11
  15. package/docs/architecture/machine.md +1 -1
  16. package/docs/architecture/tests.md +1 -1
  17. package/hooks/register.tsx +50 -24
  18. package/package.json +1 -1
  19. package/scripts/aiguillage.mjs +4 -2
  20. package/scripts/bd-garde.mjs +69 -0
  21. package/scripts/ci-de-main.mjs +259 -56
  22. package/scripts/circuit.mjs +20 -5
  23. package/scripts/commandes-composees.mjs +1 -1
  24. package/scripts/droits.mjs +11 -4
  25. package/scripts/file-des-tickets.mjs +27 -9
  26. package/scripts/greffons.mjs +282 -17
  27. package/scripts/langages/c/commandes.mjs +1 -1
  28. package/scripts/langages/cargo/commandes.mjs +1 -1
  29. package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
  30. package/scripts/langages/python/commandes.mjs +1 -1
  31. package/scripts/langages/typescript/code-mort.mjs +36 -3
  32. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +95 -24
  33. package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
  34. package/scripts/langages/typescript/parcours.mjs +5 -1
  35. package/scripts/langages.d.mts +6 -0
  36. package/scripts/langages.mjs +6 -0
  37. package/scripts/lire.mjs +236 -0
  38. package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
  39. package/scripts/migrations/lire-un-ticket.mjs +46 -0
  40. package/scripts/migrations.mjs +4 -0
  41. package/scripts/montee.mjs +123 -47
  42. package/scripts/nuit.sh +21 -12
  43. package/scripts/registre.d.mts +7 -1
  44. package/scripts/registre.mjs +114 -102
  45. package/scripts/resultats.mjs +15 -5
  46. package/scripts/retirer-copie.sh +7 -0
  47. package/scripts/sous-commandes.mjs +1 -0
  48. package/scripts/suiveur.mjs +12 -4
  49. package/scripts/superviseur.mjs +111 -31
  50. package/scripts/tableau.mjs +527 -119
  51. package/scripts/tarifs.mjs +67 -0
  52. package/scripts/ticket-du-circuit.mjs +3 -4
  53. package/scripts/transitions.d.mts +0 -5
  54. package/scripts/transitions.mjs +3 -13
  55. package/scripts/verdict-de-la-nuit.mjs +2 -2
  56. package/skills/explorateur/SKILL.md +10 -5
  57. package/skills/mesure/SKILL.md +4 -3
  58. package/skills/pitmaster/SKILL.md +18 -4
  59. package/skills/pitmaster/references/erreurs.md +4 -2
  60. package/skills/pitmaster/references/tour.md +11 -4
  61. package/types/index.d.ts +3 -1
  62. package/scripts/base-des-workflows.mjs +0 -58
@@ -14,16 +14,22 @@
14
14
  // its role, its start and end, its working time and the turns it sums (start and end in
15
15
  // milliseconds, the waits for a message left out), its tokens, its cache reads and its cost. All
16
16
  // of it is read from the agent's transcript; the agent declares nothing.
17
- // - The cost is the total the session writes, as ccusage keeps it; without one, or with a total of
18
- // 0 for tokens spent (a sub-agent's transcript holds none), it is the usage of each model at its
19
- // tariff (`TARIFS`), as Claude Code reckons it. A model without a tariff that spent tokens leaves
20
- // such a cost unknown (null).
17
+ // - The cost is the price of the transcript's own tokens, as ccusage reckons it: each response at
18
+ // the tariff of its model (`TARIFS`, scripts/tarifs.mjs), each kind of token its own. The total a
19
+ // session writes (`cost-state`), which holds the spending of its sub-agents, is left aside. A
20
+ // model without a tariff that spent tokens leaves the cost unknown (null).
21
+ // - The tokens, the cache reads and the cost of a line are those of all the transcripts of its
22
+ // agent up to its end, without the responses another transcript of the project retains
23
+ // (`lireSansLesRetenuesAilleurs` in tableau.mjs): the board keeps one line per agent, and the
24
+ // lines it adds count each response once. Its time, turns, start and end count the whole
25
+ // transcript of its stop.
21
26
  // - The register is `~/.claude/grillhouse/registre.jsonl` (GRILLHOUSE_REGISTRE replaces it): the
22
27
  // envelope of a role agent leaves it writable.
23
28
  // - A hook never stops the session, and never waits for a transcript: it hands the fields of its
24
29
  // input that the line reads to a detached process (`--ecrire`) and ends at once, within Claude
25
- // Code's hook time limit. The detached process reads the transcript in chunks (`lireFichier` in
26
- // tableau.mjs), never whole; a transcript it cannot read writes nothing.
30
+ // Code's hook time limit. The detached process reads the transcripts in chunks
31
+ // (`lireSansLesRetenuesAilleurs` in tableau.mjs), never whole; a transcript it cannot read writes
32
+ // nothing. `--rattraper` and `--copie` read the project's transcripts once for all their lines.
27
33
  // - One stop has one line: the write holds the register's lock (`prendreVerrou`, judged by the
28
34
  // lock's age, since a role agent's envelope and the outside do not share process numbers),
29
35
  // and skips a line whose agent and end the register already holds. The hook and
@@ -42,12 +48,20 @@ import os from 'node:os';
42
48
  import path from 'node:path';
43
49
  import { pathToFileURL } from 'node:url';
44
50
  import { roleDeLAgent } from './etapes.mjs';
45
- import { lireFichier, ROLE_DE_LA_NUIT, ROLE_DU_CIRCUIT, roleDuMeta, tourne } from './tableau.mjs';
51
+ import {
52
+ lireSansLesRetenuesAilleurs,
53
+ ROLE_DE_LA_NUIT,
54
+ ROLE_DU_CIRCUIT,
55
+ roleDuMeta,
56
+ tourne,
57
+ transcriptionsDuProjet,
58
+ } from './tableau.mjs';
59
+ import { coutDe, TARIFS } from './tarifs.mjs';
46
60
  import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
47
61
 
48
62
  import { REGISTRE } from './adresse-du-registre.mjs';
49
63
 
50
- export { REGISTRE };
64
+ export { coutDe, REGISTRE, TARIFS };
51
65
 
52
66
  // The transcript and the role the hook's input names: a sub-agent's sits next to the session's.
53
67
  export function source(input) {
@@ -83,36 +97,9 @@ export function source(input) {
83
97
  };
84
98
  }
85
99
 
86
- // The tariffs of the models the frame's agents run on, in dollars per million tokens: the input,
87
- // the output, a read of the cache, a write of the cache kept five minutes, and one kept an hour.
88
- // Those of Sonnet 5.5 and Opus 5.5 give the total Claude Code wrote for each of the 25 sessions of
89
- // BPScript 320.8, to the thousandth.
90
- export const TARIFS = {
91
- 'claude-sonnet-5-5': { entree: 2, sortie: 10, lecture: 0.1, ecriture5m: 2.5, ecriture1h: 4 },
92
- 'claude-opus-5-5': { entree: 4, sortie: 20, lecture: 0.2, ecriture5m: 5, ecriture1h: 8 },
93
- 'claude-haiku-4-5': { entree: 1, sortie: 5, lecture: 0.1, ecriture5m: 1.25, ecriture1h: 2 },
94
- };
95
-
96
- // The cost of the usage by model <modeles> (`{ <modèle>: { entree, sortie, lecture, ecriture5m,
97
- // ecriture1h } }`, tokens), or null when a model without a tariff spent tokens.
98
- export function coutDe(modeles) {
99
- let cout = 0;
100
- for (const [modele, u] of Object.entries(modeles ?? {})) {
101
- const parts = Object.entries(u);
102
- if (parts.every(([, n]) => !n)) {
103
- continue;
104
- }
105
- const tarif = TARIFS[modele];
106
- if (!tarif) {
107
- return null;
108
- }
109
- cout += parts.reduce((m, [k, n]) => m + n * (tarif[k] ?? 0), 0) / 1e6;
110
- }
111
- return cout;
112
- }
113
-
114
- // The register's line for this hook input and the reading `t` of its transcript (`lireFichier` or
115
- // `lireTranscription`), or null. `projet` is the main tree of the session.
100
+ // The register's line for this hook input and the reading `t` of its transcript (`lireFichier`,
101
+ // `lireTranscription` or `lireSansLesRetenuesAilleurs`), or null. `projet` is the main tree of the
102
+ // session.
116
103
  export function ligne(input, t, projet) {
117
104
  const { role, agent } = source(input);
118
105
  if (t.premier === null) {
@@ -129,8 +116,8 @@ export function ligne(input, t, projet) {
129
116
  tours: t.tours,
130
117
  jetons: t.jetons,
131
118
  cache: t.cache,
132
- // The total the session wrote; none, or 0, reckoned on its tokens (0 without any).
133
- cout: t.cout || coutDe(t.modeles),
119
+ // The price of the transcript's own tokens (0 without any).
120
+ cout: coutDe(t.modeles),
134
121
  };
135
122
  }
136
123
 
@@ -177,7 +164,7 @@ export function ligneDeNuit({ projet, quand, raison, sommet, reference }) {
177
164
  }
178
165
 
179
166
  // The main tree of a directory: an agent's copy belongs to the repository it was made from.
180
- function arbrePrincipal(dir) {
167
+ export function arbrePrincipal(dir) {
181
168
  try {
182
169
  const commun = execFileSync(
183
170
  'git',
@@ -197,49 +184,23 @@ const enTirets = p => p.replace(/[^A-Za-z0-9]/g, '-');
197
184
 
198
185
  // The hook inputs of the project's finished agents that `connus` (agent ids) does not hold.
199
186
  export function aRattraper(racine, home, connus, maintenant = Date.now()) {
200
- const projets = path.join(home, '.claude', 'projects');
201
- if (!existsSync(projets)) {
202
- return [];
203
- }
204
187
  const out = [];
205
- const fini = (f, sousAgent) => !tourne(f, maintenant, sousAgent);
206
- const jsonl = d => (existsSync(d) ? readdirSync(d).filter(n => n.endsWith('.jsonl')) : []);
207
- const propre = path.join(projets, enTirets(racine));
208
- const copies = `${enTirets(path.join(racine, '.claude', 'worktrees'))}-`;
209
- for (const d of readdirSync(projets)) {
210
- const dir = path.join(projets, d);
211
- if (d !== enTirets(racine) && !d.startsWith(copies)) {
188
+ for (const { f, agent, session, propre } of transcriptionsDuProjet(racine, home)) {
189
+ // The sub-agents caught up are those of the project's own sessions.
190
+ if ((session && !propre) || connus.has(agent) || tourne(f, maintenant, Boolean(session))) {
212
191
  continue;
213
192
  }
214
- for (const n of jsonl(dir)) {
215
- const f = path.join(dir, n);
216
- const session = n.replace(/\.jsonl$/, '');
217
- if (!connus.has(session) && fini(f, false)) {
218
- out.push({
219
- hook_event_name: 'SessionEnd',
220
- transcript_path: f,
221
- session_id: session,
222
- cwd: racine,
223
- });
224
- }
225
- if (dir !== propre) {
226
- continue;
227
- }
228
- const sous = path.join(dir, session, 'subagents');
229
- for (const m of jsonl(sous)) {
230
- const agent = m.replace(/^agent-/, '').replace(/\.jsonl$/, '');
231
- const g = path.join(sous, m);
232
- if (!connus.has(agent) && fini(g, true)) {
233
- out.push({
193
+ out.push(
194
+ session
195
+ ? {
234
196
  hook_event_name: 'SubagentStop',
235
- transcript_path: f,
197
+ transcript_path: session,
236
198
  agent_id: agent,
237
- agent_transcript_path: g,
199
+ agent_transcript_path: f,
238
200
  cwd: racine,
239
- });
240
- }
241
- }
242
- }
201
+ }
202
+ : { hook_event_name: 'SessionEnd', transcript_path: f, session_id: agent, cwd: racine }
203
+ );
243
204
  }
244
205
  return out;
245
206
  }
@@ -274,16 +235,80 @@ export function ecrire(l) {
274
235
  }
275
236
  }
276
237
 
277
- // Reads the transcript of `input` in chunks and writes its line; false when nothing was written.
278
- function ecrireLaLigne(input, projet) {
279
- const { transcription } = source(input);
280
- if (!transcription || !existsSync(transcription)) {
281
- return false;
238
+ // What an agent spent up to `fin` in the readings `lectures` of its transcripts
239
+ // (`lireSansLesRetenuesAilleurs`), without the responses another transcript retains, so that each
240
+ // counts once: its tokens, its cache reads, its usage by key of tariff, and `ecartee` when one of
241
+ // those responses is retained elsewhere. A transcript without a reading counts nothing.
242
+ export function depenseJusqua(lectures, fin) {
243
+ const depense = { jetons: 0, cache: 0, modeles: {}, ecartee: false };
244
+ // One file named by two paths has one reading.
245
+ for (const { reponses } of new Set(lectures.filter(Boolean))) {
246
+ for (const r of reponses) {
247
+ if (r.quand > fin) {
248
+ continue;
249
+ }
250
+ if (r.ailleurs) {
251
+ depense.ecartee = true;
252
+ continue;
253
+ }
254
+ depense.jetons += r.jetons;
255
+ depense.cache += r.cache;
256
+ const m = (depense.modeles[r.cle] ??= {});
257
+ for (const [part, n] of Object.entries(r.usage)) {
258
+ m[part] = (m[part] ?? 0) + n;
259
+ }
260
+ }
282
261
  }
283
- const l = ligne(input, lireFichier(transcription), projet);
284
- return l ? ecrire(l) : false;
262
+ return depense;
285
263
  }
286
264
 
265
+ // Reads the transcripts of the agents of `inputs` and writes their lines: the time, the turns, the
266
+ // start and the end of the input's transcript, the spending of all the agent's transcripts in the
267
+ // project `projet` of the home `home` up to that end (`depenseJusqua`). Returns how many were
268
+ // written. A line that cannot be read or written leaves the others.
269
+ function ecrireLesLignes(inputs, projet, home) {
270
+ const presentes = inputs
271
+ .map(input => ({ input, ...source(input) }))
272
+ .filter(({ transcription }) => transcription && existsSync(transcription));
273
+ if (presentes.length === 0) {
274
+ return 0;
275
+ }
276
+ const duProjet = transcriptionsDuProjet(projet, home);
277
+ const attendues = presentes.map(({ input, transcription, agent }) => ({
278
+ input,
279
+ f: transcription,
280
+ siennes: [transcription, ...duProjet.filter(x => x.agent === agent).map(x => x.f)],
281
+ }));
282
+ const lues = lireSansLesRetenuesAilleurs(
283
+ attendues.flatMap(({ siennes }) => siennes),
284
+ duProjet.map(({ f }) => f)
285
+ );
286
+ let n = 0;
287
+ for (const { input, f, siennes } of attendues) {
288
+ try {
289
+ const lu = lues.get(f);
290
+ const l = lu && ligne(input, lu.mesures, projet);
291
+ if (!l) {
292
+ continue;
293
+ }
294
+ const { jetons, cache, modeles } = depenseJusqua(
295
+ siennes.map(x => lues.get(x)),
296
+ Date.parse(l.fin)
297
+ );
298
+ if (ecrire({ ...l, jetons, cache, cout: coutDe(modeles) })) {
299
+ n++;
300
+ }
301
+ } catch {
302
+ // A line it cannot write waits for the next catch-up.
303
+ }
304
+ }
305
+ return n;
306
+ }
307
+
308
+ // Writes the line of the agent of `input`; false when nothing was written.
309
+ export const ecrireLaLigne = (input, projet, home = os.homedir()) =>
310
+ ecrireLesLignes([input], projet, home) === 1;
311
+
287
312
  // The directory where Claude Code keeps the transcripts of the sessions of an agent's copy
288
313
  // (`copie`), in the home <home>: its path in dashes under `~/.claude/projects`. The circuit
289
314
  // (scripts/circuit.mjs) watches it.
@@ -342,26 +367,13 @@ const CHAMPS = [
342
367
  const direct = import.meta.url === pathToFileURL(process.argv[1] ?? '').href;
343
368
  if (direct && process.argv.includes('--rattraper')) {
344
369
  const racine = arbrePrincipal(process.cwd());
345
- let n = 0;
346
- for (const input of aRattraper(racine, os.homedir(), connusDuRegistre())) {
347
- try {
348
- if (ecrireLaLigne(input, racine)) {
349
- n++;
350
- }
351
- } catch {
352
- // A transcript it cannot read waits for the next catch-up.
353
- }
354
- }
370
+ const inputs = aRattraper(racine, os.homedir(), connusDuRegistre());
371
+ const n = ecrireLesLignes(inputs, racine, os.homedir());
355
372
  process.stdout.write(`${n} agent(s) fini(s) ajouté(s) au registre.\n`);
356
373
  } else if (direct && process.argv[2] === '--copie') {
357
374
  const copie = path.resolve(process.argv[3] ?? '.');
358
- for (const input of deLaCopie(copie, os.homedir(), connusDuRegistre())) {
359
- try {
360
- ecrireLaLigne(input, arbrePrincipal(copie));
361
- } catch {
362
- // A transcript it cannot read writes nothing.
363
- }
364
- }
375
+ const inputs = deLaCopie(copie, os.homedir(), connusDuRegistre());
376
+ ecrireLesLignes(inputs, arbrePrincipal(copie), os.homedir());
365
377
  } else if (direct && process.argv[2] === '--ecrire') {
366
378
  try {
367
379
  const input = JSON.parse(process.argv[3]);
@@ -895,16 +895,20 @@ const titreLu = titre => titre.replace(/\s+/g, ' ').trim().toLocaleLowerCase('fr
895
895
 
896
896
  // What makes a piece of the ticket of the sheet <f> absent from the description <description>: a
897
897
  // criterion no numbered line of its section of criteria (a heading that begins with « Critères »)
898
- // carries, a section no heading names (its title, or its beginning); each fault, naming its piece.
898
+ // carries, a section no heading names (its title, or its beginning); each fault, naming its piece
899
+ // and what the description holds instead, as a compiler suggests the names it knows: its headings
900
+ // for a section, the expected heading for a criterion when it has no section of criteria.
899
901
  function horsDuTicket(f, description) {
900
902
  const titres = [];
901
903
  const criteres = new Set();
902
904
  let dedans = false;
905
+ let section = false;
903
906
  for (const ligne of String(description).split('\n')) {
904
907
  const tete = /^#{1,6}\s+(.*)$/.exec(ligne);
905
908
  if (tete) {
906
- titres.push(titreLu(tete[1]));
909
+ titres.push(tete[1].replace(/\s+/g, ' ').trim());
907
910
  dedans = /^Critères\b/i.test(tete[1].trim());
911
+ section ||= dedans;
908
912
  continue;
909
913
  }
910
914
  const numero = /^\s*(\d+)[.)]\s/.exec(ligne);
@@ -912,17 +916,23 @@ function horsDuTicket(f, description) {
912
916
  criteres.add(Number(numero[1]));
913
917
  }
914
918
  }
919
+ const attendu = section
920
+ ? ''
921
+ : " ; les critères se lisent sous un titre qui commence par « Critères » (« ## Critères d'acceptation »), que la description n'a pas";
922
+ const portes = titres.length
923
+ ? `ses sections : ${titres.map(t => `« ${t} »`).join(', ')}`
924
+ : "elle n'a aucune section";
915
925
  const out = [];
916
926
  for (const [ou, p] of piecesDe(f)) {
917
927
  const lu = lirePiece(p);
918
928
  if (lu?.critere && !criteres.has(lu.critere)) {
919
929
  out.push(
920
- `${ou} : ticket, critère ${lu.critere} : la description du ticket n'a pas de critère ${lu.critere}`
930
+ `${ou} : ticket, critère ${lu.critere} : la description du ticket n'a pas de critère ${lu.critere}${attendu}`
921
931
  );
922
932
  }
923
- if (lu?.section && !titres.some(x => x.startsWith(titreLu(lu.section)))) {
933
+ if (lu?.section && !titres.some(x => titreLu(x).startsWith(titreLu(lu.section)))) {
924
934
  out.push(
925
- `${ou} : ticket, § ${lu.section} : la description du ticket n'a pas de section « ${lu.section} »`
935
+ `${ou} : ticket, § ${lu.section} : la description du ticket n'a pas de section « ${lu.section} » ; ${portes}`
926
936
  );
927
937
  }
928
938
  }
@@ -33,6 +33,9 @@
33
33
  # `--garder-travail`, passed only by the integration, it stays: the circuit still runs, and the
34
34
  # queue removes it at the ticket's closure (scripts/integration/file.mjs). A copy refused keeps
35
35
  # it.
36
+ # - The copy removed, the entries of scope local that Claude Code's registry of plugins holds for it
37
+ # go too (scripts/greffons.mjs --oublier), as `git worktree remove` removes the copy's metadata; a
38
+ # registry that cannot lose them is said on stderr, the copy removed (exit 0).
36
39
  # - Exit 0 removed, 1 refused (the first line on stderr names the copy and what holds it), 2 a
37
40
  # malformed call (the usage on stderr).
38
41
  set -uo pipefail
@@ -51,6 +54,7 @@ done
51
54
  exit 2
52
55
  }
53
56
  copie=$1
57
+ ici=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
54
58
 
55
59
  refuser() {
56
60
  echo "$1" >&2
@@ -127,3 +131,6 @@ fi
127
131
  sortie=$(git worktree remove --force "$chemin" 2>&1) ||
128
132
  refuser "la copie $copie ne se retire pas :" "$sortie"
129
133
  [ "$garder" -eq 1 ] || rm -rf -- "$chemin.travail"
134
+ node "$ici/greffons.mjs" --oublier "$chemin" >/dev/null ||
135
+ echo "la copie $copie est retirée ; ses inscriptions de greffons restent : npx grillhouse greffons --purger les retire." >&2
136
+ exit 0
@@ -58,6 +58,7 @@ export const SOUS_COMMANDES = {
58
58
  lancer: 'enveloppe/lancer.sh',
59
59
  journal: 'journal.mjs',
60
60
  'ligne-etat': 'ligne-etat/ligne-etat.mjs',
61
+ lire: 'lire.mjs',
61
62
  machine: 'machine.mjs',
62
63
  maj: 'grillhouse-maj.mjs',
63
64
  'messages-non-lus': 'messages-non-lus.mjs',
@@ -4,8 +4,9 @@
4
4
  // and the pane are readers. Mechanism: greffon.md, §5.3.
5
5
  //
6
6
  // - A measure follows an event: a change under `.beads/`, a change of the git state (HEAD, the
7
- // references), a change of the set of circuits (a light poll of Temporal), the end of a bd or git
8
- // command (through the first two). Events close together fold into one measure (`rebondir`).
7
+ // references), of the day's marker or of the kept path of `bd` (scripts/bd-garde.mjs), a change
8
+ // of the set of circuits (a light poll of Temporal), the end of a bd or git command (through the
9
+ // first two). Events close together fold into one measure (`rebondir`).
9
10
  // - Without an event, a measure every SECOURS; every AVANCEMENT while a line of progress shows.
10
11
  // - One follower writes per repository: it holds the lock `grillhouse-suiveur.verrou` of the common
11
12
  // directory; another follower relays the lines the writer writes, and takes the lock over when
@@ -14,6 +15,7 @@
14
15
  import { mkdirSync, readFileSync, renameSync, rmSync, watch, writeFileSync } from 'node:fs';
15
16
  import path from 'node:path';
16
17
 
18
+ import { FICHIER_BD, garderBd } from './bd-garde.mjs';
17
19
  import { vivant as processVivant } from './mesure/base-de-passe.mjs';
18
20
 
19
21
  // The measure (the board) and the common git folder come from the command that starts the
@@ -151,8 +153,9 @@ export function veiller({ racine, commun, rebond = REBOND, quand }) {
151
153
  }
152
154
  };
153
155
  sur(path.join(racine, '.beads'), { recursive: true }, () => true);
154
- // The day's marker (`grillhouse newday`) moves the board too.
155
- sur(commun, {}, nom => nom === 'HEAD' || nom === 'packed-refs' || nom === 'tableau-repere.json');
156
+ // The day's marker (`grillhouse newday`) and a path of `bd` newly kept move the board too.
157
+ const duCommun = ['HEAD', 'packed-refs', 'tableau-repere.json', FICHIER_BD];
158
+ sur(commun, {}, nom => duCommun.includes(nom));
156
159
  sur(path.join(commun, 'refs'), { recursive: true }, () => true);
157
160
  return {
158
161
  fermer() {
@@ -268,6 +271,11 @@ export async function suivre(racine, { projets = [], surLigne, mesure, dossierCo
268
271
  throw new Error('suivre : le dossier git commun du projet est introuvable.');
269
272
  }
270
273
  mkdirSync(commun, { recursive: true });
274
+ // Every follower, relaying ones included, keeps the path of its `bd` for a writer that lacks it.
275
+ garderBd(commun);
276
+ for (const projet of projets) {
277
+ garderBd(dossierCommun(projet));
278
+ }
271
279
  let ferme = false;
272
280
  let ecrivain = null;
273
281
  let relais = null;