@roomi-fields/grillhouse 0.29.0 → 0.31.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 +769 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +30 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +94 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +120 -0
- package/dist/temporal/installation.js +386 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +646 -87
- package/docs/CADRE.md +27 -0
- package/docs/INTERFACE.md +139 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2255 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +40 -14
- package/scripts/avancement.mjs +155 -26
- package/scripts/bilan.mjs +137 -43
- package/scripts/cadre.mjs +16 -4
- package/scripts/circuit.mjs +993 -4075
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +18 -12
- package/scripts/conformite.mjs +56 -28
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +121 -0
- package/scripts/dernier-vert.mjs +61 -34
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +244 -0
- package/scripts/droits.mjs +51 -16
- package/scripts/effets.mjs +352 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +259 -55
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
- package/scripts/etapes.mjs +5 -2
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +201 -0
- package/scripts/gardes-du-cadre.mjs +21 -5
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +544 -434
- package/scripts/integration/integrer.mjs +87 -43
- package/scripts/integration/rejeu.mjs +45 -13
- package/scripts/jointure.d.ts +151 -28
- package/scripts/langages/cargo/commandes.mjs +383 -124
- package/scripts/langages/cargo/composants.mjs +154 -42
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +22 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +218 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +28 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +50 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
- package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
- package/scripts/langages/typescript/tests.mjs +40 -15
- package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
- package/scripts/langages/typescript/verdict.mjs +4 -2
- package/scripts/langages/typescript/verifier.mjs +58 -20
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +12 -6
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +25 -3
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +18 -8
- package/scripts/paquet-npm.mjs +157 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +46 -10
- package/scripts/passe-de-la-machine.mjs +71 -0
- package/scripts/places-de-la-machine.mjs +414 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +25 -8
- package/scripts/registre.mjs +9 -4
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +112 -46
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +936 -0
- package/scripts/services-du-noyau.mjs +27 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +41 -10
- package/scripts/style-a-l-ecriture.mjs +260 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +180 -117
- package/scripts/taches-du-graphe.mjs +348 -0
- package/scripts/ticket-du-circuit.mjs +216 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +1018 -0
- package/scripts/verrou-de-fichier.mjs +8 -4
- package/scripts/verrou-de-machine.mjs +150 -51
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +9 -2
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +5 -3
- package/skills/testwriter/SKILL.md +49 -31
- package/scripts/demon.mjs +0 -251
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
package/scripts/bilan.mjs
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
// conformed, `conforme`, its verdicts by kind, `verdicts`; its sessions, the launches of object
|
|
27
27
|
// `tri`), each end of a run on
|
|
28
28
|
// a stop (`montee`: its code, its stop and the supervisor's session that ran it, `superviseur`);
|
|
29
|
-
// the circuit
|
|
29
|
+
// where the circuit ended (`{ etape, raison, code }`), which the end of the circuit gives its
|
|
30
|
+
// bilan (the effect `bilan`, scripts/effets.mjs) and the command reads from the Temporal server;
|
|
30
31
|
// the night the project declares in its package.json (`grillhouse.plageDeNuit`); the transcript
|
|
31
32
|
// of each supervisor's session a stop names (`~/.claude/projects/<projet>/<séance>.jsonl`), of
|
|
32
33
|
// which the origin and the time of each message, as ccusage measures from the transcripts. It
|
|
@@ -161,11 +162,15 @@ function nuits([d, f], nuit) {
|
|
|
161
162
|
const a = new Date(jour);
|
|
162
163
|
a.setHours(nuit.debut);
|
|
163
164
|
const b = new Date(jour);
|
|
164
|
-
if (nuit.fin < nuit.debut)
|
|
165
|
+
if (nuit.fin < nuit.debut) {
|
|
166
|
+
b.setDate(b.getDate() + 1);
|
|
167
|
+
}
|
|
165
168
|
b.setHours(nuit.fin);
|
|
166
169
|
const x = Math.max(a.getTime(), d);
|
|
167
170
|
const y = Math.min(b.getTime(), f);
|
|
168
|
-
if (y > x)
|
|
171
|
+
if (y > x) {
|
|
172
|
+
out.push([x, y]);
|
|
173
|
+
}
|
|
169
174
|
jour.setDate(jour.getDate() + 1);
|
|
170
175
|
}
|
|
171
176
|
return out;
|
|
@@ -200,7 +205,9 @@ function longueur(l) {
|
|
|
200
205
|
let total = 0;
|
|
201
206
|
let fin = -Infinity;
|
|
202
207
|
for (const [d, f] of [...l].sort((x, y) => x[0] - y[0])) {
|
|
203
|
-
if (f <= fin)
|
|
208
|
+
if (f <= fin) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
204
211
|
total += f - Math.max(d, fin);
|
|
205
212
|
fin = f;
|
|
206
213
|
}
|
|
@@ -231,9 +238,13 @@ export function bilan({
|
|
|
231
238
|
const derniere = new Map();
|
|
232
239
|
for (const x of lignes) {
|
|
233
240
|
const l = { ...x, role: roleDeLAgent(x.role) };
|
|
234
|
-
if (l.ticket !== ticket || (l.role !== CIRCUIT && !ROLES.has(l.role)))
|
|
241
|
+
if (l.ticket !== ticket || (l.role !== CIRCUIT && !ROLES.has(l.role))) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
235
244
|
const avant = derniere.get(l.agent);
|
|
236
|
-
if (!avant || Date.parse(l.fin) > Date.parse(avant.fin))
|
|
245
|
+
if (!avant || Date.parse(l.fin) > Date.parse(avant.fin)) {
|
|
246
|
+
derniere.set(l.agent, l);
|
|
247
|
+
}
|
|
237
248
|
}
|
|
238
249
|
const hors = [...derniere.values()].filter(l => l.role !== CIRCUIT && !lancees.has(l.agent));
|
|
239
250
|
const agents = [...derniere.values()].filter(l => !hors.includes(l));
|
|
@@ -280,13 +291,17 @@ export function bilan({
|
|
|
280
291
|
}
|
|
281
292
|
const etapes = segments.filter(s => s.role === CIRCUIT);
|
|
282
293
|
const preuves = etapes.filter(s => s.etape === 'preuve');
|
|
283
|
-
for (const p of preuves)
|
|
294
|
+
for (const p of preuves) {
|
|
295
|
+
p.preuve = p.entree?.resultat ?? null;
|
|
296
|
+
}
|
|
284
297
|
// A proof and the category it gives the testwriter before it: the lot unchanged since the proof
|
|
285
298
|
// before, or none.
|
|
286
299
|
const avantLa = p => preuves.findLast(x => x.f <= p.d);
|
|
287
300
|
const parLaPreuve = p => {
|
|
288
301
|
const avant = avantLa(p);
|
|
289
|
-
if (!p.preuve)
|
|
302
|
+
if (!p.preuve) {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
290
305
|
if (avant?.preuve && signature(avant.preuve) === signature(p.preuve)) {
|
|
291
306
|
return avant.preuve.ok ? 'rejeu' : 'sansEffet';
|
|
292
307
|
}
|
|
@@ -300,13 +315,16 @@ export function bilan({
|
|
|
300
315
|
|
|
301
316
|
// The sessions first: the checks read what they delivered.
|
|
302
317
|
for (const s of segments.filter(x => x.role !== CIRCUIT)) {
|
|
303
|
-
if (s.role === QUESTIONNEUR)
|
|
304
|
-
|
|
318
|
+
if (s.role === QUESTIONNEUR) {
|
|
319
|
+
s.categorie = 'questionnement';
|
|
320
|
+
} else if (s.role === 'developpeur') {
|
|
305
321
|
s.categorie = inchangee(s) ? 'sansEffet' : 'travail';
|
|
306
322
|
} else if (s.role === 'testwriter') {
|
|
307
323
|
const p = preuves.find(x => x.d >= s.f - JEU);
|
|
308
324
|
s.categorie = p ? (parLaPreuve(p) ?? (p.preuve?.vide ? 'sansEffet' : 'travail')) : 'travail';
|
|
309
|
-
} else
|
|
325
|
+
} else {
|
|
326
|
+
s.categorie = 'travail';
|
|
327
|
+
}
|
|
310
328
|
}
|
|
311
329
|
// A session that changed the lot: the testwriter's or the developpeur's, that delivered.
|
|
312
330
|
const livre = s => AGENTS_DU_LOT.includes(s.role) && s.categorie === 'travail';
|
|
@@ -331,7 +349,9 @@ export function bilan({
|
|
|
331
349
|
: i === 'vert'
|
|
332
350
|
? 'rejeu'
|
|
333
351
|
: 'sansEffet';
|
|
334
|
-
} else
|
|
352
|
+
} else {
|
|
353
|
+
s.categorie = 'automatique';
|
|
354
|
+
}
|
|
335
355
|
}
|
|
336
356
|
|
|
337
357
|
// The waits: from each end of a run on a stop to the answer, the run after; the owner's when he
|
|
@@ -343,7 +363,9 @@ export function bilan({
|
|
|
343
363
|
const f = Math.min(tour, suivant, fin);
|
|
344
364
|
const ecrit = duResponsable.some(t => t > e.t && t <= f);
|
|
345
365
|
const qui = ecrit ? RESPONSABLE : SUPERVISEUR;
|
|
346
|
-
if (f > e.t)
|
|
366
|
+
if (f > e.t) {
|
|
367
|
+
lesAttentes.push({ i: [e.t, f], qui, nuit: nuits([e.t, f], nuit) });
|
|
368
|
+
}
|
|
347
369
|
}
|
|
348
370
|
const attentes = lesAttentes.map(a => a.i);
|
|
349
371
|
|
|
@@ -359,7 +381,9 @@ export function bilan({
|
|
|
359
381
|
const fenetre = s => [Math.max(s.d, debut), Math.min(s.f, fin)];
|
|
360
382
|
for (const s of segments) {
|
|
361
383
|
const [d, f] = fenetre(s);
|
|
362
|
-
if (f <= d)
|
|
384
|
+
if (f <= d) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
363
387
|
const ms = f - d - commun([d, f], attentes);
|
|
364
388
|
const c = categories[s.categorie];
|
|
365
389
|
c.ms += ms;
|
|
@@ -388,7 +412,9 @@ export function bilan({
|
|
|
388
412
|
const out = {};
|
|
389
413
|
for (const role of new Set(SUITE.flatMap(e => e.qui))) {
|
|
390
414
|
const n = l.filter(x => x.role === role).length;
|
|
391
|
-
if (n)
|
|
415
|
+
if (n) {
|
|
416
|
+
out[role] = n;
|
|
417
|
+
}
|
|
392
418
|
}
|
|
393
419
|
return out;
|
|
394
420
|
};
|
|
@@ -399,7 +425,9 @@ export function bilan({
|
|
|
399
425
|
parEtape[titre] = (parEtape[titre] ?? 0) + 1;
|
|
400
426
|
}
|
|
401
427
|
const arrets = {};
|
|
402
|
-
for (const e of duCircuit.filter(x => x.arret))
|
|
428
|
+
for (const e of duCircuit.filter(x => x.arret)) {
|
|
429
|
+
arrets[e.arret] = (arrets[e.arret] ?? 0) + 1;
|
|
430
|
+
}
|
|
403
431
|
// The ends of the questionings of the plan: the questions asked, the plans an answer changed, the
|
|
404
432
|
// questions left open.
|
|
405
433
|
const fins = duCircuit.map(e => e.questionnement).filter(Boolean);
|
|
@@ -421,6 +449,31 @@ export function bilan({
|
|
|
421
449
|
verdicts: finDuTri.verdicts ?? {},
|
|
422
450
|
}
|
|
423
451
|
: null;
|
|
452
|
+
// The time replayed after a red and the time read back without replaying, apart, by step
|
|
453
|
+
// (« passe-finale » for the checks once final): a step that plays again after a pass of its own
|
|
454
|
+
// that ended red adds its duration to the first; a step the circuit read back (the result
|
|
455
|
+
// `relue`) adds the duration of its last green, which the reading spared, to the second. A
|
|
456
|
+
// ticket without a red replays nothing.
|
|
457
|
+
const nomDeLEtape = (etape, finale) => (etape === 'controles' && finale ? 'passe-finale' : etape);
|
|
458
|
+
const reprise = { rejoue: { ms: 0, parEtape: {} }, relu: { ms: 0, parEtape: {} } };
|
|
459
|
+
const ajouter = (c, nom, ms) => {
|
|
460
|
+
c.ms += ms;
|
|
461
|
+
c.parEtape[nom] = (c.parEtape[nom] ?? 0) + ms;
|
|
462
|
+
};
|
|
463
|
+
for (const s of etapes) {
|
|
464
|
+
const memes = x => x.etape === s.etape && Boolean(x.finale) === Boolean(s.finale);
|
|
465
|
+
const avant = etapes.findLast(x => memes(x) && x.f <= s.d);
|
|
466
|
+
if (!avant?.entree || issue(avant.entree) === 'vert') {
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
const [d, f] = fenetre(s);
|
|
470
|
+
if (f > d) {
|
|
471
|
+
ajouter(reprise.rejoue, nomDeLEtape(s.etape, s.finale), f - d - commun([d, f], attentes));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
for (const e of duCircuit.filter(x => x.relue)) {
|
|
475
|
+
ajouter(reprise.relu, nomDeLEtape(e.etape, e.finale), e.relue.ms ?? 0);
|
|
476
|
+
}
|
|
424
477
|
const somme = k => sessions.reduce((m, l) => m + (l[k] ?? 0), 0);
|
|
425
478
|
const perdu = CATEGORIES.filter(([k]) => !GARDE.has(k)).reduce(
|
|
426
479
|
(m, [k]) => m + categories[k].ms,
|
|
@@ -437,6 +490,7 @@ export function bilan({
|
|
|
437
490
|
perdu,
|
|
438
491
|
perduHorsAttentes: perdu - ATTENTES.reduce((m, k) => m + categories[k].ms, 0),
|
|
439
492
|
categories,
|
|
493
|
+
reprise,
|
|
440
494
|
seances: {
|
|
441
495
|
total: sessions.length,
|
|
442
496
|
parRole: parRoleDe(sessions),
|
|
@@ -458,8 +512,12 @@ export function bilan({
|
|
|
458
512
|
|
|
459
513
|
// Where the circuit of the state <etat> ended, in words.
|
|
460
514
|
function statutDe(etat) {
|
|
461
|
-
if (etat?.etape === 'integre')
|
|
462
|
-
|
|
515
|
+
if (etat?.etape === 'integre') {
|
|
516
|
+
return 'intégré';
|
|
517
|
+
}
|
|
518
|
+
if (etat?.raison) {
|
|
519
|
+
return `arrêt ${etat.raison}${etat.code !== null && etat.code !== undefined ? ` (${etat.code})` : ''}`;
|
|
520
|
+
}
|
|
463
521
|
return 'en cours';
|
|
464
522
|
}
|
|
465
523
|
|
|
@@ -518,7 +576,12 @@ export function texteDuBilan(b, avant) {
|
|
|
518
576
|
const base = avant
|
|
519
577
|
? `Face au bilan de ${avant.ticket}, recalculé : mur ${minutes(avant.mur)} → ${minutes(b.mur)} min, perte ${pourcent(avant.perdu, avant.mur)} → ${pourcent(b.perdu, b.mur)} %, séances ${avant.seances.total} → ${b.seances.total}, coût ${dollars(avant.cout)} → ${dollars(b.cout)} $.`
|
|
520
578
|
: "Aucun bilan d'avant dans ce projet : pas de base.";
|
|
521
|
-
|
|
579
|
+
const parEtape = c =>
|
|
580
|
+
Object.entries(c.parEtape)
|
|
581
|
+
.map(([nom, ms]) => `${nom} ${minutes(ms)} min`)
|
|
582
|
+
.join(', ');
|
|
583
|
+
const reprise = `Reprise après un rouge : ${minutes(b.reprise.rejoue.ms)} min rejouées${b.reprise.rejoue.ms ? ` (${parEtape(b.reprise.rejoue)})` : ''}, ${minutes(b.reprise.relu.ms)} min relues sans rejouer${b.reprise.relu.ms ? ` (${parEtape(b.reprise.relu)})` : ''}.`;
|
|
584
|
+
return [tete, ...lignes, ...tri, reprise, `Arrêts : ${arrets || 'aucun'}.`, base].join('\n');
|
|
522
585
|
}
|
|
523
586
|
|
|
524
587
|
const dossier = racine => path.join(racine, '.claude', 'worktrees');
|
|
@@ -536,11 +599,15 @@ export function garder(racine, b) {
|
|
|
536
599
|
export function bilansGardes(racine) {
|
|
537
600
|
const d = dossier(racine);
|
|
538
601
|
const out = {};
|
|
539
|
-
if (!existsSync(d))
|
|
602
|
+
if (!existsSync(d)) {
|
|
603
|
+
return out;
|
|
604
|
+
}
|
|
540
605
|
for (const n of readdirSync(d).filter(x => x.endsWith(SUFFIXE))) {
|
|
541
606
|
try {
|
|
542
607
|
const b = JSON.parse(readFileSync(path.join(d, n), 'utf8'));
|
|
543
|
-
if (b?.ticket)
|
|
608
|
+
if (b?.ticket) {
|
|
609
|
+
out[b.ticket] = b;
|
|
610
|
+
}
|
|
544
611
|
} catch {
|
|
545
612
|
// A torn bilan counts nothing.
|
|
546
613
|
}
|
|
@@ -557,7 +624,9 @@ export function precedent(racine, ticket) {
|
|
|
557
624
|
const avant = Object.values(bilansGardes(racine))
|
|
558
625
|
.filter(b => b.ticket !== ticket)
|
|
559
626
|
.sort((x, y) => Date.parse(y.calcule ?? 0) - Date.parse(x.calcule ?? 0))[0];
|
|
560
|
-
if (!avant)
|
|
627
|
+
if (!avant) {
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
561
630
|
const b = calculer(racine, avant.ticket, { responsable: false });
|
|
562
631
|
return b.mur > 0 ? b : null;
|
|
563
632
|
}
|
|
@@ -582,11 +651,15 @@ export function messagesDuResponsable(texte) {
|
|
|
582
651
|
const out = [];
|
|
583
652
|
for (const l of texte.split('\n')) {
|
|
584
653
|
// Only a line that names the person can be his message: the others are not parsed.
|
|
585
|
-
if (!l.includes('"human"'))
|
|
654
|
+
if (!l.includes('"human"')) {
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
586
657
|
try {
|
|
587
658
|
const e = JSON.parse(l);
|
|
588
659
|
const t = Date.parse(e.timestamp ?? '');
|
|
589
|
-
if (e.type === 'user' && e.origin?.kind === 'human' && !Number.isNaN(t))
|
|
660
|
+
if (e.type === 'user' && e.origin?.kind === 'human' && !Number.isNaN(t)) {
|
|
661
|
+
out.push(t);
|
|
662
|
+
}
|
|
590
663
|
} catch {
|
|
591
664
|
// A torn line holds no message.
|
|
592
665
|
}
|
|
@@ -607,7 +680,9 @@ function messagesDeLaSeance(seance) {
|
|
|
607
680
|
.map(d => path.join(projets, d, `${seance}.jsonl`))
|
|
608
681
|
.find(g => existsSync(g))
|
|
609
682
|
: null;
|
|
610
|
-
if (!f)
|
|
683
|
+
if (!f) {
|
|
684
|
+
return [];
|
|
685
|
+
}
|
|
611
686
|
const out = [];
|
|
612
687
|
const decodeur = new StringDecoder('utf8');
|
|
613
688
|
const tampon = Buffer.alloc(MORCEAU);
|
|
@@ -628,9 +703,9 @@ function messagesDeLaSeance(seance) {
|
|
|
628
703
|
}
|
|
629
704
|
|
|
630
705
|
// The bilan of <ticket> computed from the main tree <racine>: its register, the results its
|
|
631
|
-
// circuit kept, its circuit
|
|
632
|
-
// stops name unless <responsable> is false.
|
|
633
|
-
function calculer(racine, ticket, { responsable = true } = {}) {
|
|
706
|
+
// circuit kept, where its circuit ended (<fin>, `{ etape, raison, code }`, null while it runs), and
|
|
707
|
+
// the owner's messages in the supervisor's sessions its stops name unless <responsable> is false.
|
|
708
|
+
function calculer(racine, ticket, fin, { responsable = true } = {}) {
|
|
634
709
|
const registre =
|
|
635
710
|
process.env.GRILLHOUSE_REGISTRE ??
|
|
636
711
|
path.join(os.homedir(), '.claude', 'grillhouse', 'registre.jsonl');
|
|
@@ -645,33 +720,48 @@ function calculer(racine, ticket, { responsable = true } = {}) {
|
|
|
645
720
|
return [];
|
|
646
721
|
}
|
|
647
722
|
});
|
|
648
|
-
const f = path.join(dossier(racine), `${ticket}.circuit.json`);
|
|
649
|
-
let etat = null;
|
|
650
|
-
try {
|
|
651
|
-
etat = existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')) : null;
|
|
652
|
-
} catch {
|
|
653
|
-
etat = null;
|
|
654
|
-
}
|
|
655
723
|
const seances = new Set(entrees.map(e => e.montee?.superviseur).filter(Boolean));
|
|
656
724
|
return bilan({
|
|
657
725
|
ticket,
|
|
658
726
|
lignes,
|
|
659
727
|
entrees,
|
|
660
|
-
etat,
|
|
728
|
+
etat: fin,
|
|
661
729
|
nuit: plageDeNuit(racine),
|
|
662
730
|
duResponsable: responsable ? [...seances].flatMap(s => messagesDeLaSeance(String(s))) : [],
|
|
663
731
|
});
|
|
664
732
|
}
|
|
665
733
|
|
|
666
|
-
// The bilan of <ticket> computed,
|
|
667
|
-
// bilan before it: what the circuit writes at the ticket.
|
|
668
|
-
export function ecrireLeBilan(racine, ticket) {
|
|
669
|
-
const b = calculer(racine, ticket);
|
|
734
|
+
// The bilan of <ticket> computed, where its circuit ended <fin> (`calculer`), kept in the main tree
|
|
735
|
+
// <racine>, and its text, compared with the bilan before it: what the circuit writes at the ticket.
|
|
736
|
+
export function ecrireLeBilan(racine, ticket, fin) {
|
|
737
|
+
const b = calculer(racine, ticket, fin);
|
|
670
738
|
const avant = precedent(racine, ticket);
|
|
671
739
|
garder(racine, b);
|
|
672
740
|
return texteDuBilan(b, avant);
|
|
673
741
|
}
|
|
674
742
|
|
|
743
|
+
// Where the circuit of <ticket> in the repository at <racine> ended, as its workflow's memo on the
|
|
744
|
+
// Temporal server gives it (the summary of its last state, src/temporal/circuit/deroule.ts); null
|
|
745
|
+
// while it runs on its own (no question awaited), or when the server does not give it within 5 s.
|
|
746
|
+
async function finSurLeServeur(racine, ticket) {
|
|
747
|
+
const { lireLeDeroule, ouvrirLeClient } = await import('../dist/temporal/client.js');
|
|
748
|
+
const { idDuCircuit } = await import('../dist/temporal/circuit/contrat.js');
|
|
749
|
+
const c = ouvrirLeClient();
|
|
750
|
+
try {
|
|
751
|
+
const d = await c.client.connection.withDeadline(Date.now() + 5_000, () =>
|
|
752
|
+
lireLeDeroule(c.client, idDuCircuit(racine, ticket))
|
|
753
|
+
);
|
|
754
|
+
const e = d.memo?.etat;
|
|
755
|
+
return !e || (d.statut === 'RUNNING' && !d.memo?.question)
|
|
756
|
+
? null
|
|
757
|
+
: { etape: e.etape ?? null, raison: e.raison ?? null, code: e.code ?? null };
|
|
758
|
+
} catch {
|
|
759
|
+
return null;
|
|
760
|
+
} finally {
|
|
761
|
+
await c.fermer();
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
675
765
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
676
766
|
const [ticket, ...options] = process.argv.slice(2);
|
|
677
767
|
if (!ticket || ticket.startsWith('-')) {
|
|
@@ -682,8 +772,12 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
682
772
|
encoding: 'utf8',
|
|
683
773
|
});
|
|
684
774
|
const racine = commun.status === 0 ? path.dirname(commun.stdout.trim()) : process.cwd();
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
775
|
+
void finSurLeServeur(racine, ticket).then(fin => {
|
|
776
|
+
const b = calculer(racine, ticket, fin);
|
|
777
|
+
process.stdout.write(`${texteDuBilan(b, precedent(racine, ticket))}\n`);
|
|
778
|
+
if (options.includes('--garder')) {
|
|
779
|
+
garder(racine, b);
|
|
780
|
+
}
|
|
781
|
+
});
|
|
688
782
|
}
|
|
689
783
|
}
|
package/scripts/cadre.mjs
CHANGED
|
@@ -41,9 +41,18 @@ export const FICHIERS_DU_CADRE = ['templates'];
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* The entries the package publishes of its own; `docs/` holds the architecture the charter names,
|
|
44
|
-
* `
|
|
44
|
+
* `dist/` the build of src/ (the account's Temporal, src/temporal/), `tsdoc-base.json` the TSDoc
|
|
45
|
+
* base a project's tsdoc.json extends.
|
|
45
46
|
*/
|
|
46
|
-
export const PROPRES_DU_PAQUET = [
|
|
47
|
+
export const PROPRES_DU_PAQUET = [
|
|
48
|
+
'CHANGELOG.md',
|
|
49
|
+
'bin',
|
|
50
|
+
'cadre',
|
|
51
|
+
'dist',
|
|
52
|
+
'docs',
|
|
53
|
+
'scripts',
|
|
54
|
+
'tsdoc-base.json',
|
|
55
|
+
];
|
|
47
56
|
|
|
48
57
|
/** The entries of the plugin's source the package leaves out. */
|
|
49
58
|
export const HORS_DU_GREFFON = ['tests', 'tsconfig.json'];
|
|
@@ -87,15 +96,18 @@ function empaqueter() {
|
|
|
87
96
|
);
|
|
88
97
|
for (const f of FICHIERS_DU_CADRE) {
|
|
89
98
|
const source = path.join(DEPOT, f);
|
|
90
|
-
if (!existsSync(source))
|
|
99
|
+
if (!existsSync(source)) {
|
|
100
|
+
throw new Error(`${f} manque au dépôt du cadre (${DEPOT})`);
|
|
101
|
+
}
|
|
91
102
|
cpSync(source, path.join(COPIE, f), { recursive: true });
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
105
|
|
|
95
106
|
// Removes the copies of the plugin and cadre/.
|
|
96
107
|
function nettoyer() {
|
|
97
|
-
for (const e of ELEMENTS_DU_GREFFON)
|
|
108
|
+
for (const e of ELEMENTS_DU_GREFFON) {
|
|
98
109
|
rmSync(path.join(PAQUET, e), { recursive: true, force: true });
|
|
110
|
+
}
|
|
99
111
|
rmSync(COPIE, { recursive: true, force: true });
|
|
100
112
|
}
|
|
101
113
|
|