@roomi-fields/grillhouse 0.34.1 → 0.35.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 +35 -13
- package/cadre/templates/projet/.claude/settings.json +0 -1
- package/cadre/templates/projet/_gitignore +1 -0
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +4 -4
- package/dist/temporal/circuit/appel.d.ts +2 -0
- package/dist/temporal/circuit/appel.js +12 -0
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/commande.js +10 -1
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/docs/ARCHITECTURE.md +10 -4
- package/docs/INTERFACE.md +4 -3
- package/hooks/crochet.mjs +0 -6
- package/package.json +1 -1
- package/scripts/activites.mjs +41 -7
- package/scripts/adresse-du-registre.mjs +10 -0
- package/scripts/attente-a-l-arret.mjs +2 -2
- package/scripts/attente-au-tour.mjs +2 -2
- package/scripts/bilan.mjs +5 -4
- package/scripts/branche-de-nuit.mjs +15 -6
- package/scripts/circuit.mjs +10 -2
- package/scripts/enveloppe/enveloppe.mjs +44 -14
- package/scripts/enveloppe/lancer.sh +5 -1
- package/scripts/enveloppe/paquets-du-plan.mjs +3 -0
- package/scripts/etapes.mjs +1 -1
- package/scripts/flux-des-paquets.mjs +22 -8
- package/scripts/grillhouse-maj.mjs +19 -0
- package/scripts/langages/cargo/sccache.mjs +22 -16
- package/scripts/langages/typescript/index.mjs +8 -4
- package/scripts/langages/typescript/migrations/0.34.1-cache-des-outils.mjs +53 -0
- package/scripts/langages/typescript/vitest-config/base.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/registre.setup.mjs +35 -0
- package/scripts/mesure/base-de-passe.mjs +7 -0
- package/scripts/migrations/0.35.0-greffon-mattpocock-retire.mjs +41 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/places-du-serveur.mjs +12 -2
- package/scripts/registre.mjs +3 -3
- package/scripts/reponses-du-circuit.mjs +1 -1
- package/scripts/seances.mjs +24 -2
- package/scripts/superviseur.mjs +29 -11
- package/scripts/tableau.mjs +90 -11
- package/scripts/verrous/verrou.mjs +7 -0
- package/skills/codebase-design/DEEPENING.md +37 -0
- package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/skills/codebase-design/SKILL.md +114 -0
- package/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/grill/SKILL.md +4 -5
- package/skills/grilling/SKILL.md +30 -0
- package/skills/pitmaster/SKILL.md +4 -3
- package/skills/pitmaster/references/cadre.md +1 -1
- package/skills/redacteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +7 -4
- package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/skills/writing-for-agents/SKILL.md +81 -0
package/scripts/seances.mjs
CHANGED
|
@@ -134,6 +134,7 @@ export function rangDeLaSeance(ctx, id) {
|
|
|
134
134
|
fin: path.join(dossier, 'fin'),
|
|
135
135
|
resultat: path.join(dossier, 'resultat.json'),
|
|
136
136
|
horsPlan: path.join(dossier, 'hors-plan'),
|
|
137
|
+
horsPlanFait: path.join(dossier, 'hors-plan.json'),
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
|
|
@@ -147,6 +148,7 @@ function resultatRange(rang, id) {
|
|
|
147
148
|
seance: Number(readFileSync(rang.fin, 'utf8').trim()),
|
|
148
149
|
bloque: false,
|
|
149
150
|
horsPlan: existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null,
|
|
151
|
+
ecriture: ecritureRangee(rang),
|
|
150
152
|
erreur: null,
|
|
151
153
|
sortie: lire(rang.resultat).trim(),
|
|
152
154
|
id,
|
|
@@ -244,6 +246,7 @@ export async function lancer(
|
|
|
244
246
|
rmSync(rang.fin, { force: true });
|
|
245
247
|
rmSync(rang.resultat, { force: true });
|
|
246
248
|
rmSync(rang.horsPlan, { force: true });
|
|
249
|
+
rmSync(rang.horsPlanFait, { force: true });
|
|
247
250
|
inscrire(ctx, {
|
|
248
251
|
role: AUTEUR_DU_CIRCUIT,
|
|
249
252
|
lancement: { role, seance: id, ...(objet ? { objet } : {}) },
|
|
@@ -373,6 +376,7 @@ export async function lancer(
|
|
|
373
376
|
let seance;
|
|
374
377
|
let sortie;
|
|
375
378
|
let horsPlan = null;
|
|
379
|
+
let ecriture = null;
|
|
376
380
|
if (horsEnveloppe) {
|
|
377
381
|
seance = existsSync(rang.fin)
|
|
378
382
|
? Number(readFileSync(rang.fin, 'utf8').trim())
|
|
@@ -389,12 +393,14 @@ export async function lancer(
|
|
|
389
393
|
seance = existsSync(rang.fin) ? Number(readFileSync(rang.fin, 'utf8').trim()) : null;
|
|
390
394
|
sortie = lire(rang.resultat).trim();
|
|
391
395
|
horsPlan = existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null;
|
|
396
|
+
ecriture = ecritureRangee(rang);
|
|
392
397
|
}
|
|
393
398
|
return {
|
|
394
399
|
code: r.code,
|
|
395
400
|
seance,
|
|
396
401
|
bloque: r.bloque,
|
|
397
402
|
horsPlan,
|
|
403
|
+
ecriture,
|
|
398
404
|
erreur: r.erreur ?? lire(erreurs),
|
|
399
405
|
sortie,
|
|
400
406
|
id,
|
|
@@ -747,15 +753,31 @@ function avecLesReponses(constats, fiche) {
|
|
|
747
753
|
});
|
|
748
754
|
}
|
|
749
755
|
|
|
756
|
+
// The write the lock stopped, `{ chemin, paquet, racine }`, as it ranged it at <rang>
|
|
757
|
+
// (`hors-plan.json`), or null without it.
|
|
758
|
+
function ecritureRangee(rang) {
|
|
759
|
+
return existsSync(rang.horsPlanFait) ? JSON.parse(lire(rang.horsPlanFait)) : null;
|
|
760
|
+
}
|
|
761
|
+
|
|
750
762
|
// The launch <r> of a session of <role>, or the Arret it is: a session its lock stopped on a
|
|
751
763
|
// write out of the plan (« hors-plan », the write as its piece), a motionless session
|
|
752
764
|
// (« bloqué »), a launch that stops before its session (« lancement »).
|
|
753
765
|
export function seanceLancee(ctx, role, r) {
|
|
754
766
|
if (r.horsPlan) {
|
|
767
|
+
// The lock's structured write: the first line of the report names the path and its package;
|
|
768
|
+
// the question carries the command (none for the root, which no package holds).
|
|
769
|
+
const ecriture = r.ecriture;
|
|
770
|
+
const nom = ecriture ? (ecriture.racine ? 'la racine du dépôt' : ecriture.paquet) : null;
|
|
771
|
+
const dit = ecriture ? `${ecriture.chemin} est dans ${nom}` : null;
|
|
772
|
+
const question = !ecriture
|
|
773
|
+
? null
|
|
774
|
+
: ecriture.racine
|
|
775
|
+
? `La séance écrit ${ecriture.chemin}, que tient la racine du dépôt, hors du plan du ticket : aucun paquet ne le porte, l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`
|
|
776
|
+
: `La séance écrit ${ecriture.chemin}, que tient ${ecriture.paquet}, hors du plan du ticket : le plan s'étend-il à ce paquet (\`--etendre ${ecriture.paquet}\`), ou l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`;
|
|
755
777
|
throw new Arret(
|
|
756
778
|
'hors-plan',
|
|
757
|
-
`Le crochet de la séance du ${nomDuRole(role)} l'arrête sur une écriture hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}) :\n\n${r.horsPlan}`,
|
|
758
|
-
{ piece: r.horsPlan }
|
|
779
|
+
`${dit ? `${dit}, hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}).\n\n` : ''}Le crochet de la séance du ${nomDuRole(role)} l'arrête sur une écriture hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}) :\n\n${r.horsPlan}`,
|
|
780
|
+
{ piece: r.horsPlan, ...(question ? { question } : {}) }
|
|
759
781
|
);
|
|
760
782
|
}
|
|
761
783
|
if (r.bloque) {
|
package/scripts/superviseur.mjs
CHANGED
|
@@ -111,9 +111,31 @@ function seance(depart = process.ppid) {
|
|
|
111
111
|
return depart;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
//
|
|
115
|
-
// not
|
|
116
|
-
|
|
114
|
+
// The time in ms of <texte>, a `defer_until` as Beads writes it: the local wall time of the
|
|
115
|
+
// machine, followed by a « Z » it does not mean (`bd update --defer 17:30` gives `…T17:30:00Z`);
|
|
116
|
+
// NaN without one.
|
|
117
|
+
const heureMurale = texte => Date.parse(String(texte ?? '').replace(/Z$/, ''));
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Of the tickets <tickets> (as `bd show --json` gives them), the ids of those whose question does
|
|
121
|
+
* not wait for the supervisor at <maintenant> (ms): closed, or deferred to a later time
|
|
122
|
+
* (`defer_until`, the answer `--reporter <heure>`), as a review's snooze hides a request until its
|
|
123
|
+
* hour, then shows it again.
|
|
124
|
+
* @param {{ id: string, status?: string, defer_until?: string }[]} tickets
|
|
125
|
+
* @param {number} maintenant
|
|
126
|
+
* @returns {Set<string>}
|
|
127
|
+
*/
|
|
128
|
+
export function horsAttente(tickets, maintenant) {
|
|
129
|
+
return new Set(
|
|
130
|
+
tickets
|
|
131
|
+
.filter(t => t.status === 'closed' || heureMurale(t.defer_until) > maintenant)
|
|
132
|
+
.map(t => t.id)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Of the tickets <ids> of the repository at <racine>, those whose question does not wait now
|
|
137
|
+
// (`horsAttente`); none when bd does not read them.
|
|
138
|
+
export function ticketsHorsAttente(racine, ids) {
|
|
117
139
|
const r = spawnSync('bd', ['show', ...ids, '--json'], {
|
|
118
140
|
cwd: racine,
|
|
119
141
|
encoding: 'utf8',
|
|
@@ -121,11 +143,7 @@ export function ticketsFermes(racine, ids) {
|
|
|
121
143
|
maxBuffer: 256 * 1024 * 1024,
|
|
122
144
|
});
|
|
123
145
|
try {
|
|
124
|
-
return
|
|
125
|
-
JSON.parse(r.stdout)
|
|
126
|
-
.filter(t => t.status === 'closed')
|
|
127
|
-
.map(t => t.id)
|
|
128
|
-
);
|
|
146
|
+
return horsAttente(JSON.parse(r.stdout), Date.now());
|
|
129
147
|
} catch {
|
|
130
148
|
return new Set();
|
|
131
149
|
}
|
|
@@ -374,7 +392,7 @@ function enAttente(lus, racine, fermes) {
|
|
|
374
392
|
export function questionsEnAttente(
|
|
375
393
|
racine,
|
|
376
394
|
circuits,
|
|
377
|
-
{ fermes =
|
|
395
|
+
{ fermes = ticketsHorsAttente, sauf = new Set() } = {}
|
|
378
396
|
) {
|
|
379
397
|
return enAttente(
|
|
380
398
|
circuits.filter(c => attendLeSuperviseur(c) && !sauf.has(cleDe(c))),
|
|
@@ -413,7 +431,7 @@ const aucunFerme = () => new Set();
|
|
|
413
431
|
*/
|
|
414
432
|
export async function attendreUneQuestion({
|
|
415
433
|
racine,
|
|
416
|
-
fermes =
|
|
434
|
+
fermes = ticketsHorsAttente,
|
|
417
435
|
pas = 5_000,
|
|
418
436
|
signal,
|
|
419
437
|
circuitsDe = circuitsDuServeur,
|
|
@@ -590,7 +608,7 @@ export function texteDesQuestions(questions) {
|
|
|
590
608
|
*/
|
|
591
609
|
export async function circuitsALOuverture(
|
|
592
610
|
racine,
|
|
593
|
-
{ fermes =
|
|
611
|
+
{ fermes = ticketsHorsAttente, circuitsDe = circuitsDuServeur, ticketsDe = lireLesTickets } = {}
|
|
594
612
|
) {
|
|
595
613
|
let circuits = null;
|
|
596
614
|
let panne = null;
|
package/scripts/tableau.mjs
CHANGED
|
@@ -121,6 +121,7 @@ import {
|
|
|
121
121
|
} from './etapes.mjs';
|
|
122
122
|
import { echecDeLOutil } from './aiguillage.mjs';
|
|
123
123
|
import { bilansGardes, enBref } from './bilan.mjs';
|
|
124
|
+
import { REGISTRE } from './adresse-du-registre.mjs';
|
|
124
125
|
import { lireLaMesure } from './avancement.mjs';
|
|
125
126
|
import {
|
|
126
127
|
SANS_REPONSE_EN,
|
|
@@ -261,6 +262,7 @@ const etatNeuf = () => ({
|
|
|
261
262
|
tours: [],
|
|
262
263
|
recu: false,
|
|
263
264
|
vus: [],
|
|
265
|
+
minutes: {},
|
|
264
266
|
});
|
|
265
267
|
|
|
266
268
|
// The union of intervals, ordered by date: no instant is in two of them.
|
|
@@ -350,8 +352,15 @@ function avancer(etat, texte) {
|
|
|
350
352
|
if (id) {
|
|
351
353
|
vus.add(id);
|
|
352
354
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
const n = (u.input_tokens ?? 0) + (u.output_tokens ?? 0) + (u.cache_creation_input_tokens ?? 0);
|
|
356
|
+
etat.jetons += n;
|
|
357
|
+
// The tokens by minute of their message, which share the supervisor's among the tickets he
|
|
358
|
+
// leads directly (`jetonsDuSuperviseur`); a state kept before them starts its own.
|
|
359
|
+
if (!Number.isNaN(t)) {
|
|
360
|
+
etat.minutes ??= {};
|
|
361
|
+
const minute = Math.floor(t / 60_000);
|
|
362
|
+
etat.minutes[minute] = (etat.minutes[minute] ?? 0) + n;
|
|
363
|
+
}
|
|
355
364
|
etat.cache += u.cache_read_input_tokens ?? 0;
|
|
356
365
|
// The usage of the message's model: a write of the cache by its duration, one without them
|
|
357
366
|
// of five minutes, the default of the API.
|
|
@@ -394,6 +403,7 @@ const mesurer = etat => ({
|
|
|
394
403
|
role: etat.role,
|
|
395
404
|
cout: etat.cout,
|
|
396
405
|
modeles: structuredClone(etat.modeles),
|
|
406
|
+
minutes: { ...(etat.minutes ?? {}) },
|
|
397
407
|
});
|
|
398
408
|
|
|
399
409
|
// The measures of the transcript text `texte` held in memory.
|
|
@@ -572,6 +582,25 @@ const metaDe = f => {
|
|
|
572
582
|
}
|
|
573
583
|
};
|
|
574
584
|
|
|
585
|
+
/**
|
|
586
|
+
* The tokens of the supervisor's sessions of the repository at <racine> by minute (`{ <minute>:
|
|
587
|
+
* <tokens> }`, the minute since the epoch): its main transcripts touched since the day's marker
|
|
588
|
+
* <jour>, read through <cache>; the sub-agents' are counted by their tickets.
|
|
589
|
+
*/
|
|
590
|
+
export function jetonsDuSuperviseur({ racine, home, jour, cache = {} }) {
|
|
591
|
+
const lire = lecteur(cache);
|
|
592
|
+
const out = {};
|
|
593
|
+
for (const f of fichiers(path.join(home, '.claude', 'projects', enTirets(racine)), '.jsonl')) {
|
|
594
|
+
if (statSync(f).mtimeMs < jour) {
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
for (const [minute, n] of Object.entries(lire(f)?.minutes ?? {})) {
|
|
598
|
+
out[minute] = (out[minute] ?? 0) + n;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return out;
|
|
602
|
+
}
|
|
603
|
+
|
|
575
604
|
// The agents running now, each with its measures so far. `ps` is the process list
|
|
576
605
|
// (`pid etimes args` per line); `cache` keeps the readings of unchanged transcripts. A role agent
|
|
577
606
|
// launched in a shell shows by the envelope lancer.sh starts for it,
|
|
@@ -805,6 +834,7 @@ export function assembler({
|
|
|
805
834
|
remontees = [],
|
|
806
835
|
attenteVivante: attenteQuiVit = true,
|
|
807
836
|
voies = {},
|
|
837
|
+
superviseur = {},
|
|
808
838
|
}) {
|
|
809
839
|
// A circuit's lines are its steps, no agent's passage.
|
|
810
840
|
const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
|
|
@@ -1102,12 +1132,35 @@ export function assembler({
|
|
|
1102
1132
|
(t.labels ?? []).includes('direct')
|
|
1103
1133
|
? 'direct'
|
|
1104
1134
|
: (voies[t.id] ?? (parUnCircuit.has(t.id) ? 'complet' : 'direct'));
|
|
1135
|
+
// A ticket closed with no delivery: a duplicate, superseded (`bd duplicate`, `bd supersede`), or
|
|
1136
|
+
// labelled `sans-suite`.
|
|
1137
|
+
const sansLivraison = t =>
|
|
1138
|
+
(t.dependencies ?? []).some(d => d.type === 'duplicates' || d.type === 'supersedes') ||
|
|
1139
|
+
aLabel(t, 'sans-suite');
|
|
1140
|
+
// The supervisor leads a direct ticket from its claim to its close (now while it runs): each
|
|
1141
|
+
// minute of his tokens is shared among the direct tickets he holds at that minute.
|
|
1142
|
+
const tenusEnDirect = tous
|
|
1143
|
+
.filter(t => voieDe(t) === 'direct' && Number.isFinite(Date.parse(t.started_at ?? '')))
|
|
1144
|
+
.map(t => ({
|
|
1145
|
+
id: t.id,
|
|
1146
|
+
debut: Math.floor(Date.parse(t.started_at) / 60_000),
|
|
1147
|
+
fin: Math.floor((t.closed_at ? Date.parse(t.closed_at) : maintenant) / 60_000),
|
|
1148
|
+
}));
|
|
1149
|
+
const partDuSuperviseur = new Map();
|
|
1150
|
+
for (const [cle, n] of Object.entries(superviseur)) {
|
|
1151
|
+
const minute = Number(cle);
|
|
1152
|
+
const tenus = tenusEnDirect.filter(x => x.debut <= minute && minute <= x.fin);
|
|
1153
|
+
for (const x of tenus) {
|
|
1154
|
+
partDuSuperviseur.set(x.id, (partDuSuperviseur.get(x.id) ?? 0) + n / tenus.length);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1105
1157
|
const faitsDuJour = tous
|
|
1106
1158
|
.filter(
|
|
1107
1159
|
t =>
|
|
1108
1160
|
travail(t) &&
|
|
1109
1161
|
!actifs.has(t.id) &&
|
|
1110
1162
|
!estDecouverte(t) &&
|
|
1163
|
+
!sansLivraison(t) &&
|
|
1111
1164
|
t.closed_at &&
|
|
1112
1165
|
Date.parse(t.closed_at) >= debutJour
|
|
1113
1166
|
)
|
|
@@ -1124,7 +1177,17 @@ export function assembler({
|
|
|
1124
1177
|
: Number.isFinite(pris)
|
|
1125
1178
|
? Date.parse(t.closed_at) - pris
|
|
1126
1179
|
: null;
|
|
1127
|
-
|
|
1180
|
+
const jetons =
|
|
1181
|
+
m.jetons + Math.round(voie === 'direct' ? (partDuSuperviseur.get(t.id) ?? 0) : 0);
|
|
1182
|
+
return {
|
|
1183
|
+
id: t.id,
|
|
1184
|
+
numero: numero(t.id),
|
|
1185
|
+
sujet: titre(t).sujet,
|
|
1186
|
+
voie,
|
|
1187
|
+
duree: dure,
|
|
1188
|
+
...m,
|
|
1189
|
+
jetons,
|
|
1190
|
+
};
|
|
1128
1191
|
});
|
|
1129
1192
|
|
|
1130
1193
|
// Alerts, each with its state (`etat`) and the tone of that state (TONS).
|
|
@@ -1462,7 +1525,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1462
1525
|
const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
|
|
1463
1526
|
L(nom.toUpperCase(), TONS.titre);
|
|
1464
1527
|
if (plusieurs) {
|
|
1465
|
-
//
|
|
1528
|
+
// The three lines of states of each project, as one project's board says them: the first
|
|
1529
|
+
// under its label, the two others aligned below it; or the fault that keeps its board out.
|
|
1530
|
+
const retrait = ' '.repeat(large);
|
|
1466
1531
|
for (const p of t.projets) {
|
|
1467
1532
|
if (p.erreur) {
|
|
1468
1533
|
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur), TONS.panne);
|
|
@@ -1471,11 +1536,26 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1471
1536
|
const c = p.compteurs;
|
|
1472
1537
|
L(
|
|
1473
1538
|
cadre(
|
|
1474
|
-
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours ·
|
|
1539
|
+
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours · ${c.bloques ?? 0} bloqués · ${c.fermes} faits`,
|
|
1540
|
+
'',
|
|
1541
|
+
largeur
|
|
1542
|
+
)
|
|
1543
|
+
);
|
|
1544
|
+
L(
|
|
1545
|
+
cadre(
|
|
1546
|
+
`${retrait}⏭ file : ${c.enAttente} en circuit · ${c.fileDirecte ?? 0} en direct`,
|
|
1475
1547
|
'',
|
|
1476
1548
|
largeur
|
|
1477
1549
|
)
|
|
1478
1550
|
);
|
|
1551
|
+
L(
|
|
1552
|
+
cadre(
|
|
1553
|
+
`${retrait}${c.sansGo ?? 0} sans go · ${c.aValider ?? 0} à valider · ${c.reportes ?? 0} reportés`,
|
|
1554
|
+
'',
|
|
1555
|
+
largeur
|
|
1556
|
+
),
|
|
1557
|
+
c.sansGo ? TONS.sansGo : c.aValider ? TONS.aValider : TONS.reportes
|
|
1558
|
+
);
|
|
1479
1559
|
}
|
|
1480
1560
|
// The discoveries of the day, summed across the projects (grillhouse-3uv.96, criterion 14).
|
|
1481
1561
|
const d96 = t.decouvertes ?? { new: 0, check: 0, rejetes: 0, valides: 0 };
|
|
@@ -2270,11 +2350,7 @@ function lire(
|
|
|
2270
2350
|
} catch {
|
|
2271
2351
|
ps = '';
|
|
2272
2352
|
}
|
|
2273
|
-
const
|
|
2274
|
-
process.env.GRILLHOUSE_REGISTRE ?? path.join(home, '.claude', 'grillhouse', 'registre.jsonl');
|
|
2275
|
-
const registre = existsSync(fichierRegistre)
|
|
2276
|
-
? lireRegistre(readFileSync(fichierRegistre, 'utf8'), racine)
|
|
2277
|
-
: [];
|
|
2353
|
+
const registre = existsSync(REGISTRE) ? lireRegistre(readFileSync(REGISTRE, 'utf8'), racine) : [];
|
|
2278
2354
|
const tous = bdJson(racine, 'list', '--all', '--limit', '0');
|
|
2279
2355
|
const commun = dossierCommun(racine);
|
|
2280
2356
|
const fichierCache = commun && path.join(commun, 'tableau-cache.json');
|
|
@@ -2292,6 +2368,8 @@ function lire(
|
|
|
2292
2368
|
ps,
|
|
2293
2369
|
cache,
|
|
2294
2370
|
});
|
|
2371
|
+
const jourLu = lireLeRepere(commun, maintenant);
|
|
2372
|
+
const superviseur = jetonsDuSuperviseur({ racine, home, jour: jourLu, cache });
|
|
2295
2373
|
try {
|
|
2296
2374
|
if (fichierCache) {
|
|
2297
2375
|
writeFileSync(
|
|
@@ -2302,7 +2380,7 @@ function lire(
|
|
|
2302
2380
|
} catch {
|
|
2303
2381
|
// A read-only place keeps the board working, without its cache.
|
|
2304
2382
|
}
|
|
2305
|
-
const jour =
|
|
2383
|
+
const jour = jourLu;
|
|
2306
2384
|
// The kept results of the circuits of the tickets done since the day's marker, in the main tree.
|
|
2307
2385
|
const voies = voiesDesCircuits(
|
|
2308
2386
|
commun ? path.dirname(commun) : racine,
|
|
@@ -2326,6 +2404,7 @@ function lire(
|
|
|
2326
2404
|
outil: echecDeLOutil(racine),
|
|
2327
2405
|
remontees: lireLesRemontees(racine, maintenant),
|
|
2328
2406
|
attenteVivante: attenteVivante(racine),
|
|
2407
|
+
superviseur,
|
|
2329
2408
|
});
|
|
2330
2409
|
return { t, prefix, tous, vivants, commun };
|
|
2331
2410
|
}
|
|
@@ -40,6 +40,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
40
40
|
import {
|
|
41
41
|
ecritsDuPlan,
|
|
42
42
|
MARQUE_HORS_PLAN,
|
|
43
|
+
MARQUE_HORS_PLAN_FAIT,
|
|
43
44
|
paquetQuiTient,
|
|
44
45
|
paquetsDeLEnveloppe,
|
|
45
46
|
paquetsDuLangage,
|
|
@@ -125,6 +126,8 @@ export function horsDuPlan(input, { tmp = tmpdir(), env = process.env, role = nu
|
|
|
125
126
|
const paquet = tenant === '.' ? 'la racine du dépôt' : tenant;
|
|
126
127
|
return {
|
|
127
128
|
paquet,
|
|
129
|
+
chemin: rel,
|
|
130
|
+
racine: tenant === '.',
|
|
128
131
|
raison: `⛔ hors-plan — ${rel} est dans ${paquet}, hors des paquets du plan (${plan.join(', ')}) : ta séance s'arrête là, et le superviseur étend le plan ou refuse l'écriture.`,
|
|
129
132
|
};
|
|
130
133
|
}
|
|
@@ -267,6 +270,10 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
267
270
|
// The mark for the circuit; the stop below is the hook's answer, mark or not.
|
|
268
271
|
try {
|
|
269
272
|
writeFileSync(path.join(tmpdir(), MARQUE_HORS_PLAN), stop.raison);
|
|
273
|
+
writeFileSync(
|
|
274
|
+
path.join(tmpdir(), MARQUE_HORS_PLAN_FAIT),
|
|
275
|
+
JSON.stringify({ chemin: stop.chemin, paquet: stop.paquet, racine: stop.racine })
|
|
276
|
+
);
|
|
270
277
|
} catch {
|
|
271
278
|
// A working directory gone leaves no mark; the session still stops.
|
|
272
279
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: _"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."_
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Design It Twice
|
|
2
|
+
|
|
3
|
+
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout): your first idea is unlikely to be the best.
|
|
4
|
+
|
|
5
|
+
Uses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.
|
|
6
|
+
|
|
7
|
+
## Process
|
|
8
|
+
|
|
9
|
+
### 1. Frame the problem space
|
|
10
|
+
|
|
11
|
+
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
|
12
|
+
|
|
13
|
+
- The constraints any new interface would need to satisfy
|
|
14
|
+
- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
|
|
15
|
+
- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete
|
|
16
|
+
|
|
17
|
+
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
|
18
|
+
|
|
19
|
+
### 2. Spawn sub-agents
|
|
20
|
+
|
|
21
|
+
Spawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.
|
|
22
|
+
|
|
23
|
+
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
|
24
|
+
|
|
25
|
+
- Agent 1: "Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point."
|
|
26
|
+
- Agent 2: "Maximise flexibility: support many use cases and extension."
|
|
27
|
+
- Agent 3: "Optimise for the most common caller: make the default case trivial."
|
|
28
|
+
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
|
29
|
+
|
|
30
|
+
Include both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
|
|
31
|
+
|
|
32
|
+
Each sub-agent outputs:
|
|
33
|
+
|
|
34
|
+
1. Interface (types, methods, params, plus invariants, ordering, error modes)
|
|
35
|
+
2. Usage example showing how callers use it
|
|
36
|
+
3. What the implementation hides behind the seam
|
|
37
|
+
4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
|
|
38
|
+
5. Trade-offs: where leverage is high, where it's thin
|
|
39
|
+
|
|
40
|
+
### 3. Present and compare
|
|
41
|
+
|
|
42
|
+
Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
|
|
43
|
+
|
|
44
|
+
After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-design
|
|
3
|
+
description: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Design
|
|
7
|
+
|
|
8
|
+
Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
|
|
9
|
+
|
|
10
|
+
## Glossary
|
|
11
|
+
|
|
12
|
+
Use these terms exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
|
13
|
+
|
|
14
|
+
**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
|
|
15
|
+
|
|
16
|
+
**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).
|
|
17
|
+
|
|
18
|
+
**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
|
|
19
|
+
|
|
20
|
+
**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.
|
|
21
|
+
|
|
22
|
+
**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the _location_ at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).
|
|
23
|
+
|
|
24
|
+
**Adapter**: a concrete thing that satisfies an interface at a seam. Describes _role_ (what slot it fills), not substance (what's inside).
|
|
25
|
+
|
|
26
|
+
**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.
|
|
27
|
+
|
|
28
|
+
**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
|
|
29
|
+
|
|
30
|
+
## Deep vs shallow
|
|
31
|
+
|
|
32
|
+
**Deep module** = small interface + lots of implementation:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
┌─────────────────────┐
|
|
36
|
+
│ Small Interface │ ← Few methods, simple params
|
|
37
|
+
├─────────────────────┤
|
|
38
|
+
│ │
|
|
39
|
+
│ Deep Implementation│ ← Complex logic hidden
|
|
40
|
+
│ │
|
|
41
|
+
└─────────────────────┘
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Shallow module** = large interface + little implementation (avoid):
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────┐
|
|
48
|
+
│ Large Interface │ ← Many methods, complex params
|
|
49
|
+
├─────────────────────────────────┤
|
|
50
|
+
│ Thin Implementation │ ← Just passes through
|
|
51
|
+
└─────────────────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
When designing an interface, ask:
|
|
55
|
+
|
|
56
|
+
- Can I reduce the number of methods?
|
|
57
|
+
- Can I simplify the parameters?
|
|
58
|
+
- Can I hide more complexity inside?
|
|
59
|
+
|
|
60
|
+
## Principles
|
|
61
|
+
|
|
62
|
+
- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
|
|
63
|
+
- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
|
|
64
|
+
- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test _past_ the interface, the module is probably the wrong shape.
|
|
65
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
|
66
|
+
|
|
67
|
+
## Designing for testability
|
|
68
|
+
|
|
69
|
+
Good interfaces make testing natural:
|
|
70
|
+
|
|
71
|
+
1. **Accept dependencies, don't create them.**
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Testable
|
|
75
|
+
function processOrder(order, paymentGateway) {}
|
|
76
|
+
|
|
77
|
+
// Hard to test
|
|
78
|
+
function processOrder(order) {
|
|
79
|
+
const gateway = new StripeGateway();
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. **Return results, don't produce side effects.**
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Testable
|
|
87
|
+
function calculateDiscount(cart): Discount {}
|
|
88
|
+
|
|
89
|
+
// Hard to test
|
|
90
|
+
function applyDiscount(cart): void {
|
|
91
|
+
cart.total -= discount;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
|
|
96
|
+
|
|
97
|
+
## Relationships
|
|
98
|
+
|
|
99
|
+
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
|
100
|
+
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
|
101
|
+
- A **Seam** is where a **Module**'s **Interface** lives.
|
|
102
|
+
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
|
103
|
+
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
|
104
|
+
|
|
105
|
+
## Rejected framings
|
|
106
|
+
|
|
107
|
+
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
|
108
|
+
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.
|
|
109
|
+
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
|
110
|
+
|
|
111
|
+
## Going deeper
|
|
112
|
+
|
|
113
|
+
- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
|
|
114
|
+
- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ADR Format
|
|
2
|
+
|
|
3
|
+
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
|
4
|
+
|
|
5
|
+
Create the `docs/adr/` directory lazily: only when the first ADR is needed.
|
|
6
|
+
|
|
7
|
+
## Template
|
|
8
|
+
|
|
9
|
+
```md
|
|
10
|
+
# {Short title of the decision}
|
|
11
|
+
|
|
12
|
+
{1-3 sentences: what's the context, what did we decide, and why.}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
That's it. An ADR can be a single paragraph. The value is in recording _that_ a decision was made and _why_, not in filling out sections.
|
|
16
|
+
|
|
17
|
+
## Optional sections
|
|
18
|
+
|
|
19
|
+
Only include these when they add genuine value. Most ADRs won't need them.
|
|
20
|
+
|
|
21
|
+
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited
|
|
22
|
+
- **Considered Options**: only when the rejected alternatives are worth remembering
|
|
23
|
+
- **Consequences**: only when non-obvious downstream effects need to be called out
|
|
24
|
+
|
|
25
|
+
## Numbering
|
|
26
|
+
|
|
27
|
+
Scan `docs/adr/` for the highest existing number and increment by one.
|
|
28
|
+
|
|
29
|
+
## When to offer an ADR
|
|
30
|
+
|
|
31
|
+
All three of these must be true:
|
|
32
|
+
|
|
33
|
+
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
|
34
|
+
2. **Surprising without context**: a future reader will look at the code and wonder "why on earth did they do it this way?"
|
|
35
|
+
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
|
36
|
+
|
|
37
|
+
If a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
|
38
|
+
|
|
39
|
+
### What qualifies
|
|
40
|
+
|
|
41
|
+
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
|
42
|
+
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
|
43
|
+
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.
|
|
44
|
+
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
|
45
|
+
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
|
46
|
+
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
|
47
|
+
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.
|