@roomi-fields/grillhouse 0.53.0 → 0.54.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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +48 -0
- package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
- package/charte.md +12 -0
- package/dist/temporal/circuit/deroule.js +5 -9
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -2
- package/dist/temporal/installation.js +69 -17
- package/dist/temporal/installation.js.map +1 -1
- package/docs/INTERFACE.md +21 -1
- package/docs/architecture/circuit.md +3 -3
- package/docs/architecture/entree.md +4 -4
- package/docs/architecture/greffon.md +19 -10
- package/docs/architecture/installation.md +11 -7
- package/docs/architecture/machine.md +1 -1
- package/docs/architecture/tests.md +1 -1
- package/hooks/register.tsx +50 -24
- package/package.json +1 -1
- package/scripts/aiguillage.mjs +4 -2
- package/scripts/bd-garde.mjs +69 -0
- package/scripts/ci-de-main.mjs +259 -56
- package/scripts/circuit.mjs +20 -5
- package/scripts/commandes-composees.mjs +1 -1
- package/scripts/droits.mjs +11 -4
- package/scripts/file-des-tickets.mjs +27 -9
- package/scripts/langages/c/commandes.mjs +1 -1
- package/scripts/langages/cargo/commandes.mjs +1 -1
- package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
- package/scripts/langages/python/commandes.mjs +1 -1
- package/scripts/langages/typescript/code-mort.mjs +36 -3
- package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +95 -24
- package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
- package/scripts/langages/typescript/parcours.mjs +5 -1
- package/scripts/langages.d.mts +6 -0
- package/scripts/langages.mjs +6 -0
- package/scripts/lire.mjs +236 -0
- package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
- package/scripts/migrations/lire-un-ticket.mjs +46 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +110 -46
- package/scripts/nuit.sh +21 -12
- package/scripts/registre.d.mts +7 -1
- package/scripts/registre.mjs +114 -102
- package/scripts/resultats.mjs +15 -5
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/suiveur.mjs +12 -4
- package/scripts/superviseur.mjs +28 -17
- package/scripts/tableau.mjs +527 -119
- package/scripts/tarifs.mjs +67 -0
- package/scripts/ticket-du-circuit.mjs +3 -4
- package/scripts/transitions.d.mts +0 -5
- package/scripts/transitions.mjs +3 -13
- package/scripts/verdict-de-la-nuit.mjs +2 -2
- package/skills/explorateur/SKILL.md +10 -5
- package/skills/mesure/SKILL.md +4 -3
- package/skills/pitmaster/SKILL.md +11 -2
- package/skills/pitmaster/references/erreurs.md +4 -2
- package/skills/pitmaster/references/tour.md +11 -4
- package/types/index.d.ts +3 -1
- package/scripts/base-des-workflows.mjs +0 -58
package/scripts/registre.mjs
CHANGED
|
@@ -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
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
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
|
|
26
|
-
// tableau.mjs), never whole; a transcript it cannot read writes
|
|
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 {
|
|
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
|
|
87
|
-
//
|
|
88
|
-
//
|
|
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
|
|
133
|
-
cout:
|
|
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
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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:
|
|
197
|
+
transcript_path: session,
|
|
236
198
|
agent_id: agent,
|
|
237
|
-
agent_transcript_path:
|
|
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
|
-
//
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
|
|
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
|
-
|
|
346
|
-
|
|
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
|
-
|
|
359
|
-
|
|
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]);
|
package/scripts/resultats.mjs
CHANGED
|
@@ -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(
|
|
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
|
}
|
|
@@ -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',
|
package/scripts/suiveur.mjs
CHANGED
|
@@ -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),
|
|
8
|
-
//
|
|
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`)
|
|
155
|
-
|
|
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;
|
package/scripts/superviseur.mjs
CHANGED
|
@@ -45,11 +45,12 @@
|
|
|
45
45
|
// and declares nothing. Exit 2 and the reason on the error stream, nothing written, on a file
|
|
46
46
|
// that is absent or empty, a session that does not hold the lock, a session of a role or a copy.
|
|
47
47
|
//
|
|
48
|
-
// npx grillhouse superviseur --renouveler <dossier> <arretA> <messageA>
|
|
48
|
+
// npx grillhouse superviseur --renouveler <dossier> <arretA> <messageA> [sans-reponse]
|
|
49
49
|
//
|
|
50
50
|
// - Played by the greffon at each period: writes the line `{"reprise": <message>}` when the session
|
|
51
51
|
// is to be compacted (`renouvellement`: the message of resumption at a milestone that is due,
|
|
52
|
-
// empty after 55 minutes of idleness), nothing otherwise.
|
|
52
|
+
// empty after 55 minutes of idleness), nothing otherwise. `sans-reponse` says that <arretA> is
|
|
53
|
+
// the end of a turn with no answer, which serves idleness alone.
|
|
53
54
|
//
|
|
54
55
|
// npx grillhouse pre-compact
|
|
55
56
|
//
|
|
@@ -77,9 +78,10 @@
|
|
|
77
78
|
// and the opening lists it; one answered leaves the file
|
|
78
79
|
// `.claude/worktrees/questions-remontees.json`. A stop is kept there by its ticket, the run of
|
|
79
80
|
// its workflow, the rank of its question in that run and its stop, with the times of the first
|
|
80
|
-
// going up and of the last presentation. The alert of the CI of main (a red,
|
|
81
|
-
// scripts/ci-de-main.mjs) is given once per passage
|
|
82
|
-
// cleared
|
|
81
|
+
// going up and of the last presentation. The alert of the CI of main (a red, a CI not read, or
|
|
82
|
+
// main no longer judged, scripts/ci-de-main.mjs) is given once per passage
|
|
83
|
+
// (`.claude/worktrees/ci-de-main-rendue.json`), cleared when the reading tells nothing. A circuit
|
|
84
|
+
// integrated gives nothing: it is read on the board.
|
|
83
85
|
// - The reading covers the project and each other project of its group (`grillhouse.groupe`) that
|
|
84
86
|
// no other live session of supervision holds, each under its name and its folder.
|
|
85
87
|
import { spawnSync } from 'node:child_process';
|
|
@@ -244,7 +246,8 @@ const ou = c => {
|
|
|
244
246
|
const etatsDe = racine => path.join(racine, '.claude', 'worktrees');
|
|
245
247
|
|
|
246
248
|
// The alert of the CI of main of the project at <racine> (scripts/ci-de-main.mjs), read for the
|
|
247
|
-
// supervisor: `{ cle, texte }` for a red
|
|
249
|
+
// supervisor: `{ cle, texte }` for a red, a CI not read or main no longer judged, null when there is
|
|
250
|
+
// nothing to tell (the alert clears),
|
|
248
251
|
// undefined for a project with no CI to read. The lots entered since the last green are named by
|
|
249
252
|
// git; nothing is kept but the reading, for five minutes.
|
|
250
253
|
export function ciDeMainDe(racine, o = {}) {
|
|
@@ -253,7 +256,8 @@ export function ciDeMainDe(racine, o = {}) {
|
|
|
253
256
|
}
|
|
254
257
|
|
|
255
258
|
// The alert of the CI of main given by the waits of the repository at <racine>, its key: kept while
|
|
256
|
-
// it stands, so that one is given once, cleared
|
|
259
|
+
// it stands, so that one is given once, cleared when the reading tells nothing and given again if it
|
|
260
|
+
// comes back.
|
|
257
261
|
const ciDeMainRendue = racine => path.join(etatsDe(racine), 'ci-de-main-rendue.json');
|
|
258
262
|
function lireLaCiDeMainRendue(racine) {
|
|
259
263
|
try {
|
|
@@ -275,8 +279,8 @@ function ecrireLaCiDeMainRendue(racine, cle) {
|
|
|
275
279
|
}
|
|
276
280
|
}
|
|
277
281
|
|
|
278
|
-
// The alert of the CI of main <alerte> (`{ cle, texte }`, null
|
|
279
|
-
// not the one already given; the file keeps the key that stands.
|
|
282
|
+
// The alert of the CI of main <alerte> (`{ cle, texte }`, null when the reading tells nothing) as a
|
|
283
|
+
// question, when it is not the one already given; the file keeps the key that stands.
|
|
280
284
|
function releverLaCiDeMain(racine, alerte, toutes) {
|
|
281
285
|
const avant = lireLaCiDeMainRendue(racine);
|
|
282
286
|
const cle = alerte?.cle ?? null;
|
|
@@ -387,8 +391,8 @@ export function marquerChezLeResponsable(racine, { cle, depuisA }) {
|
|
|
387
391
|
* given is presented now, and one that goes up has its `depuis` set now. The file is written whole
|
|
388
392
|
* with the stops that still stand, their circuit waiting for the supervisor: a question answered
|
|
389
393
|
* so leaves it, and the next stop of its circuit is new. The alert of the CI of main <ciDeMain>
|
|
390
|
-
* (`{ cle, texte }`; null
|
|
391
|
-
* what was given) is given once per passage. A circuit integrated gives nothing. The result is the
|
|
394
|
+
* (`{ cle, texte }`; null when the reading tells nothing, which clears it; undefined when it is not
|
|
395
|
+
* read, which keeps what was given) is given once per passage. A circuit integrated gives nothing. The result is the
|
|
392
396
|
* questions given, each marked `representee` when it comes back, then the alert of the CI of main.
|
|
393
397
|
* @param {string} racine
|
|
394
398
|
* @param {import('./circuits-du-serveur.mjs').CircuitDuServeur[]} circuits
|
|
@@ -816,14 +820,19 @@ export async function ajouterLaQuestion(dossier, fichier, { env = process.env }
|
|
|
816
820
|
* Whether the session of supervision of <dossier> is to be compacted (`superviseur --renouveler`),
|
|
817
821
|
* the session holding the lock: at a milestone it declared, once a quiet Stop (<arretA>, ms, 0
|
|
818
822
|
* without one) is later than it, with the message of resumption; else once that Stop is 55 minutes
|
|
819
|
-
* old, with an empty message, a note or a milestone or not.
|
|
823
|
+
* old, with an empty message, a note or a milestone or not. With <sansReponse>, <arretA> is the end
|
|
824
|
+
* of a turn that gave no answer, not a Stop: it serves idleness alone and plays no milestone. A message of the owner (<messageA>, ms,
|
|
820
825
|
* 0 without one) later than the declaration cancels the milestone. The reading keeps a milestone
|
|
821
826
|
* that is due: the opening that follows the compaction removes it.
|
|
822
827
|
* @param {string} dossier
|
|
823
|
-
* @param {{ arretA: number, messageA: number,
|
|
828
|
+
* @param {{ arretA: number, messageA: number, sansReponse?: boolean,
|
|
829
|
+
* env?: Record<string, string | undefined> }} options
|
|
824
830
|
* @returns {Promise<{ reprise: string } | null>} null when nothing is to be done
|
|
825
831
|
*/
|
|
826
|
-
export async function renouvellement(
|
|
832
|
+
export async function renouvellement(
|
|
833
|
+
dossier,
|
|
834
|
+
{ arretA, messageA, sansReponse = false, env = process.env },
|
|
835
|
+
) {
|
|
827
836
|
const session = laSeanceQuiTient(dossier, env);
|
|
828
837
|
if (session.refus) {
|
|
829
838
|
return null;
|
|
@@ -833,7 +842,7 @@ export async function renouvellement(dossier, { arretA, messageA, env = process.
|
|
|
833
842
|
if (jalon && jalon.tenant === session.tenant) {
|
|
834
843
|
if (messageA > jalon.declareA) {
|
|
835
844
|
rmSync(f, { force: true });
|
|
836
|
-
} else if (arretA > jalon.declareA) {
|
|
845
|
+
} else if (!sansReponse && arretA > jalon.declareA) {
|
|
837
846
|
return { reprise: MESSAGE_DE_REPRISE };
|
|
838
847
|
}
|
|
839
848
|
}
|
|
@@ -1136,11 +1145,13 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
1136
1145
|
}
|
|
1137
1146
|
process.exitCode = code;
|
|
1138
1147
|
} else if (process.argv[2] === '--renouveler') {
|
|
1139
|
-
// superviseur --renouveler <dossier> <arretA> <messageA> (the greffon, at each
|
|
1140
|
-
|
|
1148
|
+
// superviseur --renouveler <dossier> <arretA> <messageA> [sans-reponse] (the greffon, at each
|
|
1149
|
+
// period).
|
|
1150
|
+
const [, , , dossier, arretA, messageA, fin] = process.argv;
|
|
1141
1151
|
const rendu = await renouvellement(dossier ?? process.cwd(), {
|
|
1142
1152
|
arretA: Number(arretA),
|
|
1143
1153
|
messageA: Number(messageA),
|
|
1154
|
+
sansReponse: fin === 'sans-reponse',
|
|
1144
1155
|
});
|
|
1145
1156
|
if (rendu) {
|
|
1146
1157
|
process.stdout.write(`${JSON.stringify(rendu)}\n`);
|