@roomi-fields/grillhouse 0.28.1 → 0.28.3
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/charte.md +13 -1
- package/docs/ARCHITECTURE.md +19 -2
- package/docs/INTERFACE.md +11 -2
- package/hooks/register.tsx +132 -161
- package/package.json +1 -1
- package/scripts/copies-finies.mjs +15 -4
- package/scripts/enveloppe/enveloppe.mjs +8 -5
- package/scripts/enveloppe/lancer.sh +12 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +13 -6
- package/scripts/jointure.d.ts +14 -0
- package/scripts/langages/cargo/composants.mjs +4 -0
- package/scripts/langages/cargo/index.mjs +4 -2
- package/scripts/langages/cargo/sccache.mjs +37 -6
- package/scripts/langages/python/commandes.mjs +9 -2
- package/scripts/langages/python/index.mjs +3 -2
- package/scripts/langages/typescript/consommateurs.mjs +3 -41
- package/scripts/langages/typescript/interfaces-contre-code.mjs +2 -1
- package/scripts/langages/typescript/lecteurs.mjs +2 -8
- package/scripts/langages/typescript/parcours.mjs +49 -0
- package/scripts/langages/typescript/references-par-les-types.mjs +2 -1
- package/scripts/langages/typescript/tests-de-nuit.mjs +10 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +2 -1
- package/scripts/langages/typescript/vitest-config/lances.mjs +6 -15
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +4 -1
- package/scripts/mesure/base-de-passe.mjs +202 -9
- package/scripts/services-du-noyau.mjs +9 -2
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/tableau.mjs +203 -77
- package/scripts/verrou-de-machine.mjs +147 -4
- package/skills/pitmaster/SKILL.md +6 -0
- package/skills/pitmaster/references/consigne-agent.md +4 -0
- package/types/index.d.ts +6 -14
package/scripts/tableau.mjs
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
//
|
|
6
6
|
// npx grillhouse tableau the board, as JSON (with its lines, 52 columns wide)
|
|
7
7
|
// npx grillhouse tableau --texte the board, as text
|
|
8
|
+
// npx grillhouse tableau <dossier>… the board of this project and of the projects in <dossier>…,
|
|
9
|
+
// one board, each ticket prefixed by its project (`ensemble`)
|
|
8
10
|
//
|
|
9
11
|
// Each measure writes the status line (the chantier in progress) to `grillhouse-etat.txt` in the
|
|
10
12
|
// common git directory, where the status line (`scripts/ligne-etat/`) reads it.
|
|
@@ -1007,7 +1009,7 @@ export function assembler({
|
|
|
1007
1009
|
/^La nuit est rouge\b/.test(titreLu) && !Number.isNaN(ouvert)
|
|
1008
1010
|
? `Nuit rouge depuis le ${jourEtMois(ouvert)}`
|
|
1009
1011
|
: titreLu;
|
|
1010
|
-
alertes.push({ niveau: 'rouge', texte: `${sujet} ${n}`, sujet, numero: n });
|
|
1012
|
+
alertes.push({ niveau: 'rouge', texte: `${sujet} ${n}`, sujet, numero: n, id: t.id });
|
|
1011
1013
|
}
|
|
1012
1014
|
for (const b of blocs) {
|
|
1013
1015
|
for (const x of b.enCours) {
|
|
@@ -1145,9 +1147,7 @@ const couperAvant = (gauche, suite, droite, largeur) => {
|
|
|
1145
1147
|
// The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
|
|
1146
1148
|
// discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
|
|
1147
1149
|
// ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
|
|
1148
|
-
// `chantier`.
|
|
1149
|
-
// null after the steps, and `titre`) and, stopped on a question, who must answer it (`question`):
|
|
1150
|
-
// the pane that fuses several projects' boards sorts their tickets by it. The head belongs to agents, the first section; a blank line belongs to the section
|
|
1150
|
+
// `chantier`. The head belongs to agents, the first section; a blank line belongs to the section
|
|
1151
1151
|
// of the title after it. A chantier's « sans go » and « reporté » groups, its « à valider » group
|
|
1152
1152
|
// past SEUIL_REPLI tickets, and the other chantiers beside one in progress fold to their title and
|
|
1153
1153
|
// count: the folded title carries its group's key (`groupe`), and `groupes` receives, under that
|
|
@@ -1162,32 +1162,61 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1162
1162
|
const poser = (...l) => out.push(...l.map(marquer));
|
|
1163
1163
|
const cadre = couper;
|
|
1164
1164
|
const L = (texte, ton, ticket) => poser(ticket ? { texte, ton, ticket } : { texte, ton });
|
|
1165
|
-
|
|
1166
|
-
|
|
1165
|
+
// A board of several projects (`projets`, scripts/tableau.mjs `ensemble`): each line of a ticket,
|
|
1166
|
+
// a chantier or an alert carries its project's label, « [SH] »; one project's board, none.
|
|
1167
|
+
const plusieurs = Array.isArray(t.projets);
|
|
1168
|
+
const duProjet = x => (plusieurs ? `[${x.projet}] ` : '');
|
|
1169
|
+
// The labels' column of the head and of AGENTS, « [OB] », « [OSD] ».
|
|
1170
|
+
const large = Math.max(0, ...(t.projets ?? []).map(p => p.etiquette.length + 3));
|
|
1171
|
+
const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
|
|
1167
1172
|
L(nom.toUpperCase(), 'titre');
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1173
|
+
if (plusieurs) {
|
|
1174
|
+
// One line per project: its counters, or the fault that keeps its board out.
|
|
1175
|
+
for (const p of t.projets) {
|
|
1176
|
+
if (p.erreur) {
|
|
1177
|
+
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur), 'alerte');
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
const c = p.compteurs;
|
|
1181
|
+
L(
|
|
1182
|
+
cadre(
|
|
1183
|
+
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours · ${c.enAttente} en attente · ${c.fermes} faits`,
|
|
1184
|
+
'',
|
|
1185
|
+
largeur
|
|
1186
|
+
)
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
} else {
|
|
1190
|
+
const g = t.global;
|
|
1191
|
+
const c = g.compteurs;
|
|
1192
|
+
// Two lines of states: those of the circuit, then those that wait for the owner.
|
|
1193
|
+
L(
|
|
1194
|
+
cadre(
|
|
1195
|
+
`▶ ${c.enCours} en cours · ${c.enAttente} en attente · ${c.bloques} bloqués · ${c.fermes} faits`,
|
|
1196
|
+
'',
|
|
1197
|
+
largeur
|
|
1198
|
+
)
|
|
1199
|
+
);
|
|
1200
|
+
L(
|
|
1201
|
+
cadre(`${c.sansGo} sans go · ${c.aValider} à valider · ${c.reportes} reportés`, '', largeur),
|
|
1202
|
+
c.sansGo || c.aValider ? 'attention' : undefined
|
|
1203
|
+
);
|
|
1204
|
+
L(
|
|
1205
|
+
cadre(
|
|
1206
|
+
`jour ${duree(g.jour.travail)} · ${k(g.jour.jetons)} · cumul ${duree(g.cumul.travail)} · ${k(g.cumul.jetons)}`,
|
|
1207
|
+
'',
|
|
1208
|
+
largeur
|
|
1209
|
+
),
|
|
1210
|
+
'discret'
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
// An alert of several projects' board names its ticket by its whole id.
|
|
1188
1214
|
for (const a of t.alertes) {
|
|
1215
|
+
const droite = plusieurs ? (a.id ?? a.numero) : a.numero;
|
|
1189
1216
|
L(
|
|
1190
|
-
|
|
1217
|
+
droite
|
|
1218
|
+
? cadre(`⚠ ${duProjet(a)}${a.sujet}`, droite, largeur)
|
|
1219
|
+
: cadre(`⚠ ${duProjet(a)}${a.texte}`, '', largeur),
|
|
1191
1220
|
a.niveau === 'rouge' ? 'alerte' : 'attention'
|
|
1192
1221
|
);
|
|
1193
1222
|
}
|
|
@@ -1264,21 +1293,29 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1264
1293
|
const montres = t.agents.flatMap(b =>
|
|
1265
1294
|
[...b.enCours, ...b.attend].filter(x => !enCircuit.has(x.id))
|
|
1266
1295
|
);
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1296
|
+
// A ticket's number, or on several projects' board its whole id, in one column.
|
|
1297
|
+
const nomme = x => String(plusieurs ? x.id : x.numero);
|
|
1298
|
+
const colonne = Math.max(0, ...[...(t.circuits ?? []), ...montres].map(x => nomme(x).length));
|
|
1299
|
+
// A ticket's line in AGENTS: « <signe> <numéro> <sujet> … <droite> »; on several projects'
|
|
1300
|
+
// board « <[projet]> <id> <sujet> … <signe> <droite> », the owner's maquette (grillhouse-erp.1).
|
|
1301
|
+
const teteDe = (signe, x) =>
|
|
1302
|
+
plusieurs
|
|
1303
|
+
? `${colonneDe(x.projet)}${nomme(x).padEnd(colonne)} `
|
|
1304
|
+
: `${signe} ${nomme(x).padEnd(colonne)} `;
|
|
1305
|
+
const droiteDe = (signe, droite) =>
|
|
1306
|
+
plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
|
|
1307
|
+
const ligneDuCircuit = c => {
|
|
1308
|
+
const signe = c.vivant ? '▶' : '■';
|
|
1309
|
+
const droite = droiteDe(
|
|
1310
|
+
signe,
|
|
1311
|
+
conso(t.parTicket?.[c.id]?.travail ?? 0, t.parTicket?.[c.id]?.jetons ?? 0)
|
|
1312
|
+
);
|
|
1276
1313
|
const etape = etapeDe(c);
|
|
1277
1314
|
const boucles = (etape ? bouclesDe(etape) : [])
|
|
1278
1315
|
.filter(b => b.max && c.boucles?.[b.cle] >= 2)
|
|
1279
1316
|
.map(b => ` · ${b.libelle} ${c.boucles[b.cle]}/${b.max}`)
|
|
1280
1317
|
.join('');
|
|
1281
|
-
const tete =
|
|
1318
|
+
const tete = teteDe(signe, c);
|
|
1282
1319
|
const temoin = c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null;
|
|
1283
1320
|
// The progress after the counters of the loops while the subject keeps its room beside them,
|
|
1284
1321
|
// in their place otherwise.
|
|
@@ -1292,8 +1329,6 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1292
1329
|
texte: couperAvant(`${tete}${c.sujet}`, suite, droite, largeur),
|
|
1293
1330
|
ton: temoin?.fige ? 'alerte' : c.vivant ? 'actif' : 'attention',
|
|
1294
1331
|
ticket: c.id,
|
|
1295
|
-
etape: etapeDuBloc(b),
|
|
1296
|
-
...(qui ? { question: qui } : {}),
|
|
1297
1332
|
...(temoin ? { avancement: true } : {}),
|
|
1298
1333
|
});
|
|
1299
1334
|
};
|
|
@@ -1322,31 +1357,32 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1322
1357
|
const tickets = (b, retrait) => {
|
|
1323
1358
|
const { circuits, enQuestions, enCours, attend } = contenus.get(b);
|
|
1324
1359
|
for (const c of circuits) {
|
|
1325
|
-
ligneDuCircuit(c
|
|
1360
|
+
ligneDuCircuit(c);
|
|
1326
1361
|
}
|
|
1327
1362
|
for (const x of enCours) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
});
|
|
1363
|
+
L(
|
|
1364
|
+
cadre(`${teteDe('▶', x)}${x.sujet}`, droiteDe('▶', conso(x.travail, x.jetons)), largeur),
|
|
1365
|
+
'actif',
|
|
1366
|
+
x.id
|
|
1367
|
+
);
|
|
1334
1368
|
}
|
|
1335
1369
|
const attente = x => ({
|
|
1336
1370
|
texte: cadre(
|
|
1337
|
-
|
|
1338
|
-
|
|
1371
|
+
`${teteDe('·', x)}${x.sujet}`,
|
|
1372
|
+
droiteDe(
|
|
1373
|
+
'·',
|
|
1374
|
+
x.bloquePar?.length ? `attend ${x.bloquePar.join(', ')}` : conso(x.travail, x.jetons)
|
|
1375
|
+
),
|
|
1339
1376
|
largeur
|
|
1340
1377
|
),
|
|
1341
1378
|
ton: 'discret',
|
|
1342
1379
|
ticket: x.id,
|
|
1343
|
-
etape: etapeDuBloc(b),
|
|
1344
1380
|
});
|
|
1345
1381
|
poser(...attend.map(attente));
|
|
1346
1382
|
for (const [qui, l] of enQuestions) {
|
|
1347
1383
|
L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur), 'titre');
|
|
1348
1384
|
for (const c of l) {
|
|
1349
|
-
ligneDuCircuit(c
|
|
1385
|
+
ligneDuCircuit(c);
|
|
1350
1386
|
}
|
|
1351
1387
|
}
|
|
1352
1388
|
};
|
|
@@ -1390,7 +1426,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1390
1426
|
for (const ch of t.chantiers) {
|
|
1391
1427
|
L('', undefined);
|
|
1392
1428
|
poser({
|
|
1393
|
-
texte: cadre(`CHANTIER ${ch.numero} — ${ch.sujet}`, '', largeur),
|
|
1429
|
+
texte: cadre(`CHANTIER ${duProjet(ch)}${ch.numero} — ${ch.sujet}`, '', largeur),
|
|
1394
1430
|
ton: 'titre',
|
|
1395
1431
|
ticket: ch.id,
|
|
1396
1432
|
chantier: true,
|
|
@@ -1433,7 +1469,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1433
1469
|
? marque(n)
|
|
1434
1470
|
: '';
|
|
1435
1471
|
return {
|
|
1436
|
-
texte: cadre(` ${n.numero} ${n.sujet}`, droite, largeur),
|
|
1472
|
+
texte: cadre(` ${duProjet(n)}${n.numero} ${n.sujet}`, droite, largeur),
|
|
1437
1473
|
ton: n.etat === 'enCours' ? 'actif' : undefined,
|
|
1438
1474
|
ticket: n.id,
|
|
1439
1475
|
};
|
|
@@ -1482,7 +1518,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1482
1518
|
if (t.autres.length) {
|
|
1483
1519
|
L('', undefined);
|
|
1484
1520
|
const autres = t.autres.map(a => ({
|
|
1485
|
-
texte: cadre(`${a.numero} ${a.sujet}`, `${a.faits}/${a.total}`, largeur),
|
|
1521
|
+
texte: cadre(`${duProjet(a)}${a.numero} ${a.sujet}`, `${a.faits}/${a.total}`, largeur),
|
|
1486
1522
|
ticket: a.id,
|
|
1487
1523
|
chantier: true,
|
|
1488
1524
|
}));
|
|
@@ -1518,7 +1554,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1518
1554
|
'titre'
|
|
1519
1555
|
);
|
|
1520
1556
|
const fait = x => ({
|
|
1521
|
-
texte: cadre(`✓ ${x.numero} ${x.sujet}`, conso(x.travail, x.jetons), largeur),
|
|
1557
|
+
texte: cadre(`✓ ${duProjet(x)}${x.numero} ${x.sujet}`, conso(x.travail, x.jetons), largeur),
|
|
1522
1558
|
ton: 'discret',
|
|
1523
1559
|
ticket: x.id,
|
|
1524
1560
|
});
|
|
@@ -1547,7 +1583,7 @@ export function lignesEtats(t, largeur = LARGEUR) {
|
|
|
1547
1583
|
for (const x of e.tickets) {
|
|
1548
1584
|
out.push({
|
|
1549
1585
|
texte: couper(
|
|
1550
|
-
` ${x.numero} ${x.sujet}`,
|
|
1586
|
+
` ${x.projet ? `[${x.projet}] ` : ''}${x.numero} ${x.sujet}`,
|
|
1551
1587
|
e.cle === 'bloques' && x.bloquePar.length
|
|
1552
1588
|
? `attend ${x.bloquePar.join(', ')}`
|
|
1553
1589
|
: conso(t.parTicket[x.id]?.travail ?? 0, t.parTicket[x.id]?.jetons ?? 0),
|
|
@@ -1676,9 +1712,9 @@ const bdJson = (racine, ...args) => {
|
|
|
1676
1712
|
}
|
|
1677
1713
|
};
|
|
1678
1714
|
|
|
1679
|
-
//
|
|
1680
|
-
//
|
|
1681
|
-
|
|
1715
|
+
// What the board reads of the repository at <racine>: its tickets, its prefix, its running agents
|
|
1716
|
+
// and its assembled board (`t`), with the folder git keeps its shared files in (`commun`).
|
|
1717
|
+
function lire(racine, { home, maintenant, horsTicket = null }) {
|
|
1682
1718
|
let prefix = '';
|
|
1683
1719
|
try {
|
|
1684
1720
|
prefix = execFileSync('bd', ['config', 'get', 'issue_prefix'], {
|
|
@@ -1765,42 +1801,132 @@ export function tableau(racine, { home = os.homedir(), maintenant = Date.now() }
|
|
|
1765
1801
|
verdicts,
|
|
1766
1802
|
maintenant,
|
|
1767
1803
|
jour: minuit.getTime(),
|
|
1768
|
-
horsTicket
|
|
1804
|
+
horsTicket,
|
|
1769
1805
|
});
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1806
|
+
return { t, prefix, tous, vivants, commun };
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
// The boards of several projects as one (grillhouse-erp.1), as the multi-root explorer of VS Code
|
|
1810
|
+
// keeps one view and files each root under its name: <lus> holds each project's label
|
|
1811
|
+
// (`etiquette`, its ticket prefix) and its board (`t`) or the fault that keeps it out (`erreur`),
|
|
1812
|
+
// the session's project first. Each ticket, alert and chantier is marked with its project's label
|
|
1813
|
+
// (`projet`), the agents' blocks hold every project's tickets at their step, and `projets` gives
|
|
1814
|
+
// each project's counters or fault, which the head shows one line each.
|
|
1815
|
+
export function ensemble(lus) {
|
|
1816
|
+
const lisibles = lus.filter(l => l.t);
|
|
1817
|
+
const [premier] = lisibles;
|
|
1818
|
+
const marquer = projet => x => ({ ...x, projet });
|
|
1819
|
+
const noeud = projet => n => ({ ...n, projet, enfants: n.enfants.map(noeud(projet)) });
|
|
1820
|
+
const tous = cle => lisibles.flatMap(l => (l.t[cle] ?? []).map(marquer(l.etiquette)));
|
|
1821
|
+
return {
|
|
1822
|
+
projets: lus.map(l =>
|
|
1823
|
+
l.t
|
|
1824
|
+
? { etiquette: l.etiquette, compteurs: l.t.global.compteurs }
|
|
1825
|
+
: { etiquette: l.etiquette, erreur: l.erreur }
|
|
1826
|
+
),
|
|
1827
|
+
alertes: tous('alertes'),
|
|
1828
|
+
circuits: tous('circuits'),
|
|
1829
|
+
chantiers: lisibles.flatMap(l => l.t.chantiers.map(noeud(l.etiquette))),
|
|
1830
|
+
autres: tous('autres'),
|
|
1831
|
+
agents: premier.t.agents.map(b => {
|
|
1832
|
+
const de = cle =>
|
|
1833
|
+
lisibles.flatMap(l =>
|
|
1834
|
+
(l.t.agents.find(x => x.numero === b.numero)?.[cle] ?? []).map(marquer(l.etiquette))
|
|
1835
|
+
);
|
|
1836
|
+
return { ...b, enCours: de('enCours'), attend: de('attend') };
|
|
1837
|
+
}),
|
|
1838
|
+
maintenant: premier.t.maintenant,
|
|
1839
|
+
horsTicket: premier.t.horsTicket,
|
|
1840
|
+
faitsDuJour: tous('faitsDuJour'),
|
|
1841
|
+
etats: premier.t.etats.map(e => ({
|
|
1842
|
+
...e,
|
|
1843
|
+
tickets: lisibles.flatMap(l =>
|
|
1844
|
+
(l.t.etats.find(x => x.cle === e.cle)?.tickets ?? []).map(marquer(l.etiquette))
|
|
1845
|
+
),
|
|
1846
|
+
})),
|
|
1847
|
+
parTicket: Object.assign({}, ...lisibles.map(l => l.t.parTicket)),
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
// A project beside the session's, read in its folder <dossier>: its board, or the fault that keeps
|
|
1852
|
+
// it out, on one line.
|
|
1853
|
+
function lireUnAutre(dossier, o) {
|
|
1776
1854
|
try {
|
|
1777
|
-
if (
|
|
1778
|
-
|
|
1855
|
+
if (!existsSync(dossier)) {
|
|
1856
|
+
throw new Error('dossier introuvable');
|
|
1857
|
+
}
|
|
1858
|
+
return { dossier, ...lire(dossier, o) };
|
|
1859
|
+
} catch (e) {
|
|
1860
|
+
return { dossier, erreur: String(e.message ?? e).split('\n')[0] };
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
// The board of the repository at <racine>; with <projets>, the folders of other projects, the
|
|
1865
|
+
// board of them all (`ensemble`), named « <dépôt> + <projet> + … », with the folder of each
|
|
1866
|
+
// ticket's project (`dossiers`), where the pane runs Beads for it. The status line is the
|
|
1867
|
+
// session's project's alone.
|
|
1868
|
+
export function tableau(
|
|
1869
|
+
racine,
|
|
1870
|
+
{ home = os.homedir(), maintenant = Date.now(), projets = [] } = {}
|
|
1871
|
+
) {
|
|
1872
|
+
const ici = {
|
|
1873
|
+
dossier: racine,
|
|
1874
|
+
...lire(racine, { home, maintenant, horsTicket: lireLaMesure(process.env) }),
|
|
1875
|
+
};
|
|
1876
|
+
const etat = ligneEtat(ici.t);
|
|
1877
|
+
try {
|
|
1878
|
+
if (ici.commun) {
|
|
1879
|
+
writeFileSync(path.join(ici.commun, 'grillhouse-etat.txt'), `${etat}\n`);
|
|
1779
1880
|
}
|
|
1780
1881
|
} catch {
|
|
1781
1882
|
// A read-only place keeps the board working, without its status line.
|
|
1782
1883
|
}
|
|
1884
|
+
const lus = [ici, ...projets.map(d => lireUnAutre(d, { home, maintenant }))];
|
|
1885
|
+
const etiquette = l => l.prefix || path.basename(l.dossier);
|
|
1886
|
+
const t = projets.length
|
|
1887
|
+
? ensemble(lus.map(l => ({ etiquette: etiquette(l), t: l.t, erreur: l.erreur })))
|
|
1888
|
+
: ici.t;
|
|
1889
|
+
// The project is named by its repository's folder, as a shell prompt names it.
|
|
1890
|
+
const nom = [path.basename(racine), ...lus.slice(1).map(etiquette)].join(' + ');
|
|
1891
|
+
const groupes = {};
|
|
1892
|
+
const l = lignes(t, nom, LARGEUR, groupes);
|
|
1893
|
+
const vue = lignesEtats(t);
|
|
1894
|
+
const toutes = [...l, ...vue, ...Object.values(groupes).flat()];
|
|
1895
|
+
const lisibles = lus.filter(x => x.t);
|
|
1896
|
+
const parProjet = lisibles.map(x => ({
|
|
1897
|
+
dossier: x.dossier,
|
|
1898
|
+
fiches: fiches(x.tous, toutes, x.prefix, x.t.parTicket, x.t.circuits, bilansGardes(x.dossier)),
|
|
1899
|
+
}));
|
|
1783
1900
|
return {
|
|
1784
1901
|
...t,
|
|
1785
|
-
prefixe: prefix,
|
|
1786
1902
|
lignes: l,
|
|
1787
1903
|
vueEtats: vue,
|
|
1788
1904
|
groupes,
|
|
1789
|
-
fiches: fiches
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
bilansGardes(racine)
|
|
1905
|
+
fiches: Object.assign({}, ...parProjet.map(x => x.fiches)),
|
|
1906
|
+
dernier: dernierBouge(
|
|
1907
|
+
lisibles.flatMap(x => x.tous),
|
|
1908
|
+
l,
|
|
1909
|
+
lisibles.flatMap(x => x.vivants),
|
|
1910
|
+
maintenant
|
|
1796
1911
|
),
|
|
1797
|
-
dernier: dernierBouge(tous, l, vivants, maintenant),
|
|
1798
1912
|
etat,
|
|
1913
|
+
...(projets.length
|
|
1914
|
+
? {
|
|
1915
|
+
dossiers: Object.fromEntries(
|
|
1916
|
+
parProjet.flatMap(x => Object.keys(x.fiches).map(id => [id, x.dossier]))
|
|
1917
|
+
),
|
|
1918
|
+
}
|
|
1919
|
+
: {}),
|
|
1799
1920
|
};
|
|
1800
1921
|
}
|
|
1801
1922
|
|
|
1802
1923
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
1803
|
-
|
|
1924
|
+
// The arguments other than --texte are the folders of the other projects.
|
|
1925
|
+
const projets = process.argv
|
|
1926
|
+
.slice(2)
|
|
1927
|
+
.filter(a => a !== '--texte')
|
|
1928
|
+
.map(d => path.resolve(d));
|
|
1929
|
+
const t = tableau(process.cwd(), { projets });
|
|
1804
1930
|
process.stdout.write(
|
|
1805
1931
|
process.argv.includes('--texte')
|
|
1806
1932
|
? `${t.lignes.map(l => l.texte).join('\n')}\n`
|
|
@@ -48,27 +48,43 @@
|
|
|
48
48
|
// names no one and goes. Between measures of one rank, the first to find the lock free takes
|
|
49
49
|
// it. The bound of the wait is the same for both ranks, and the wait says its rank.
|
|
50
50
|
// - The lock is let go at the end of the measure, whether it succeeds or throws.
|
|
51
|
+
// - A measure first wants room in the temporary directory (`os.tmpdir()` under its environment),
|
|
52
|
+
// a disk in memory that the sessions of the machine share: under LIBRE_MIN, 4 GB free
|
|
53
|
+
// (GRILLHOUSE_TEMPORAIRE_LIBRE names another floor, in bytes; the base configuration of the
|
|
54
|
+
// tests sets 0, scripts/langages/typescript/vitest-config/machine.setup.mjs), it waits for room
|
|
55
|
+
// instead of failing for lack of it (ENOSPC: 25 reds of the night of 2026-11-01, the
|
|
56
|
+
// scratchpads holding 8 GB of 16), as Kubernetes schedules no new pod on a node under
|
|
57
|
+
// DiskPressure. It says so, with what holds the directory (its largest
|
|
58
|
+
// entries, by the blocks their files hold, the temporary directory of a ticket naming its
|
|
59
|
+
// ticket), when it begins and every 30 s, under the same bound as the
|
|
60
|
+
// lock's, then « à repasser » (75).
|
|
51
61
|
import { randomUUID } from 'node:crypto';
|
|
52
62
|
import {
|
|
63
|
+
lstatSync,
|
|
53
64
|
mkdirSync,
|
|
54
65
|
readdirSync,
|
|
55
66
|
readFileSync,
|
|
56
67
|
readlinkSync,
|
|
57
68
|
rmSync,
|
|
69
|
+
statfsSync,
|
|
58
70
|
statSync,
|
|
59
71
|
writeFileSync,
|
|
60
72
|
} from 'node:fs';
|
|
61
|
-
import { homedir } from 'node:os';
|
|
73
|
+
import { homedir, tmpdir } from 'node:os';
|
|
62
74
|
import path from 'node:path';
|
|
63
75
|
import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
64
76
|
import { paquets } from './paquets.mjs';
|
|
65
77
|
import { attendreUnPeu, lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
66
|
-
import { vivant } from './mesure/base-de-passe.mjs';
|
|
78
|
+
import { ticketDeLaBase, vivant } from './mesure/base-de-passe.mjs';
|
|
67
79
|
import { A_REPASSER } from './mesure/pression.mjs';
|
|
68
80
|
|
|
69
81
|
const VARIABLE_VERROU = 'GRILLHOUSE_VERROU_MACHINE';
|
|
70
82
|
const VARIABLE_TENUE = 'GRILLHOUSE_MESURE_TENUE';
|
|
71
83
|
const VARIABLE_ATTENTE = 'GRILLHOUSE_ATTENTE_MACHINE_MS';
|
|
84
|
+
const VARIABLE_LIBRE = 'GRILLHOUSE_TEMPORAIRE_LIBRE';
|
|
85
|
+
|
|
86
|
+
/** The room a heavy measure wants free in the temporary directory, in bytes: 4 GB. */
|
|
87
|
+
export const LIBRE_MIN = 4 * 1024 ** 3;
|
|
72
88
|
|
|
73
89
|
// The name of the frame's package, which a repository of the first rank develops.
|
|
74
90
|
const CADRE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).name;
|
|
@@ -227,6 +243,128 @@ function ancetre(pid) {
|
|
|
227
243
|
return false;
|
|
228
244
|
}
|
|
229
245
|
|
|
246
|
+
// The floor of room under <env>, in bytes.
|
|
247
|
+
function plancherDe(env) {
|
|
248
|
+
const n = Number(env[VARIABLE_LIBRE]);
|
|
249
|
+
return env[VARIABLE_LIBRE] && Number.isFinite(n) && n >= 0 ? n : LIBRE_MIN;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// The room free in <dossier>, in bytes; Infinity when it does not read.
|
|
253
|
+
function libreDans(dossier) {
|
|
254
|
+
try {
|
|
255
|
+
const s = statfsSync(dossier);
|
|
256
|
+
return s.bavail * s.bsize;
|
|
257
|
+
} catch {
|
|
258
|
+
return Infinity;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const go = octets => `${(octets / 1024 ** 3).toFixed(1).replace('.', ',')} Go`;
|
|
263
|
+
|
|
264
|
+
// The entries a count of what holds the temporary directory reads at most, so that it stays
|
|
265
|
+
// short on a directory of millions of files: past it, a size is a floor.
|
|
266
|
+
const ENTREES_LUES = 500_000;
|
|
267
|
+
|
|
268
|
+
// The largest entries of <dossier>, the five first, each by the blocks its files hold, as `du`
|
|
269
|
+
// counts them: « claude-1000 (8,0 Go), grillhouse-vitest-x (1,2 Go) ».
|
|
270
|
+
function occupants(dossier) {
|
|
271
|
+
let noms;
|
|
272
|
+
try {
|
|
273
|
+
noms = readdirSync(dossier);
|
|
274
|
+
} catch {
|
|
275
|
+
return 'illisible';
|
|
276
|
+
}
|
|
277
|
+
if (noms.length === 0) return 'rien';
|
|
278
|
+
let budget = ENTREES_LUES;
|
|
279
|
+
const taille = racine => {
|
|
280
|
+
let octets = 0;
|
|
281
|
+
const pile = [racine];
|
|
282
|
+
while (pile.length > 0 && budget-- > 0) {
|
|
283
|
+
const p = pile.pop();
|
|
284
|
+
let e;
|
|
285
|
+
try {
|
|
286
|
+
e = lstatSync(p);
|
|
287
|
+
} catch {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
octets += e.blocks * 512;
|
|
291
|
+
if (e.isDirectory()) {
|
|
292
|
+
try {
|
|
293
|
+
for (const n of readdirSync(p)) pile.push(path.join(p, n));
|
|
294
|
+
} catch {
|
|
295
|
+
// an unreadable directory counts for itself alone
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return octets;
|
|
300
|
+
};
|
|
301
|
+
return noms
|
|
302
|
+
.map(nom => ({ nom, octets: taille(path.join(dossier, nom)) }))
|
|
303
|
+
.sort((a, b) => b.octets - a.octets)
|
|
304
|
+
.slice(0, 5)
|
|
305
|
+
.map(o => {
|
|
306
|
+
const ticket = ticketDeLaBase(o.nom);
|
|
307
|
+
return `${o.nom} (${ticket ? `le ticket ${ticket}, ` : ''}${go(o.octets)})`;
|
|
308
|
+
})
|
|
309
|
+
.join(', ');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Waits until <dossier> holds <plancher> bytes free (`libre`, a statfs at each turn), saying so
|
|
313
|
+
// (`dire`) with what holds it (`occupe`, counted only when a line is written) when it begins and
|
|
314
|
+
// every <rappelMs>. Throws an AttenteDeLaMachine (75) at <borneMs>.
|
|
315
|
+
function attendreLaPlace(dossier, { plancher, libre, occupe, dire, borneMs, rappelMs }) {
|
|
316
|
+
const debut = Date.now();
|
|
317
|
+
let dit = null;
|
|
318
|
+
for (;;) {
|
|
319
|
+
const l = libre(dossier);
|
|
320
|
+
if (l >= plancher) {
|
|
321
|
+
if (dit !== null)
|
|
322
|
+
dire(`✓ place dans le dossier temporaire après ${duree(Date.now() - debut)}.`);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const t = Date.now();
|
|
326
|
+
const etat = () =>
|
|
327
|
+
`le dossier temporaire (${dossier}) n'a que ${go(l)} libres, moins des ${go(plancher)} qu'une passe lourde demande (${VARIABLE_LIBRE}) ; l'occupent : ${occupe(dossier)}`;
|
|
328
|
+
if (t - debut >= borneMs)
|
|
329
|
+
throw new AttenteDeLaMachine(
|
|
330
|
+
`⏱ attente de place bornée à ${duree(borneMs)} (${VARIABLE_ATTENTE}) : ${etat()} ; à repasser (code ${A_REPASSER}).`,
|
|
331
|
+
A_REPASSER
|
|
332
|
+
);
|
|
333
|
+
if (dit === null) dire(`⏳ ${etat()} ; attente de place, ${duree(borneMs)} au plus.`);
|
|
334
|
+
else if (t - dit >= rappelMs)
|
|
335
|
+
dire(`⏳ attente de place depuis ${duree(t - debut)} : ${etat()}.`);
|
|
336
|
+
if (dit === null || t - dit >= rappelMs) dit = t;
|
|
337
|
+
attendreUnPeu(Math.max(1, Math.min(200, borneMs - (Date.now() - debut))));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Waits for room in the temporary directory under <env> (`os.tmpdir()` as it reads it): what a
|
|
343
|
+
* heavy pass does before it plays (`avecLaMachine`, the night tests).
|
|
344
|
+
* @param {{ env?: Record<string, string | undefined>, dire?: (ligne: string) => void,
|
|
345
|
+
* borneMs?: number, rappelMs?: number, libre?: (dossier: string) => number,
|
|
346
|
+
* occupe?: (dossier: string) => string }} [options] as `avecLaMachine`'s
|
|
347
|
+
* @throws {AttenteDeLaMachine} at the bound of the wait (code 75)
|
|
348
|
+
*/
|
|
349
|
+
export function attendreDeLaPlace({
|
|
350
|
+
env = process.env,
|
|
351
|
+
dire = l => process.stdout.write(`${l}\n`),
|
|
352
|
+
borneMs = borneDe(env),
|
|
353
|
+
rappelMs = RAPPEL_MS,
|
|
354
|
+
libre = libreDans,
|
|
355
|
+
occupe = occupants,
|
|
356
|
+
} = {}) {
|
|
357
|
+
const temporaire = env.TMPDIR || env.TMP || env.TEMP || tmpdir();
|
|
358
|
+
attendreLaPlace(temporaire, {
|
|
359
|
+
plancher: plancherDe(env),
|
|
360
|
+
libre,
|
|
361
|
+
occupe,
|
|
362
|
+
dire,
|
|
363
|
+
borneMs,
|
|
364
|
+
rappelMs,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
230
368
|
// The bound of the wait under <env>, in ms.
|
|
231
369
|
function borneDe(env) {
|
|
232
370
|
const n = Number(env[VARIABLE_ATTENTE]);
|
|
@@ -282,11 +420,13 @@ function attendreAuRang(verrou, { rang, dire, borneMs, rappelMs }) {
|
|
|
282
420
|
* environment of its children, which carries the lock to them.
|
|
283
421
|
* @param {(envEnfant: Record<string, string | undefined>) => T} mesure a synchronous measure
|
|
284
422
|
* @param {{ env?: Record<string, string | undefined>, racine?: string,
|
|
285
|
-
* dire?: (ligne: string) => void, borneMs?: number, rappelMs?: number
|
|
423
|
+
* dire?: (ligne: string) => void, borneMs?: number, rappelMs?: number,
|
|
424
|
+
* libre?: (dossier: string) => number, occupe?: (dossier: string) => string }} options `racine`, the
|
|
286
425
|
* root of the repository the measure plays in, which gives its rank (`rangDeLaMesure`; the
|
|
287
426
|
* working directory by default); `borneMs`, the bound of the wait
|
|
288
427
|
* (GRILLHOUSE_ATTENTE_MACHINE_MS, else ATTENTE_MACHINE_MS); `rappelMs`, the gap between two
|
|
289
|
-
* lines that say the wait goes on (30 s)
|
|
428
|
+
* lines that say the wait goes on (30 s); `libre`, the room free in a directory, in bytes
|
|
429
|
+
* (`statfs`, at each turn); `occupe`, what holds it, counted when a line of the wait is written
|
|
290
430
|
* @returns {T}
|
|
291
431
|
* @throws {AttenteDeLaMachine} at the bound of the wait (code 75), or at once when an ancestor
|
|
292
432
|
* holds the lock (code 1)
|
|
@@ -300,11 +440,14 @@ export function avecLaMachine(
|
|
|
300
440
|
dire = l => process.stdout.write(`${l}\n`),
|
|
301
441
|
borneMs = borneDe(env),
|
|
302
442
|
rappelMs = RAPPEL_MS,
|
|
443
|
+
libre = libreDans,
|
|
444
|
+
occupe = occupants,
|
|
303
445
|
} = {}
|
|
304
446
|
) {
|
|
305
447
|
if (paquetsDeLEnveloppe(env)) return mesure(env);
|
|
306
448
|
const verrou = verrouDeMachine(env);
|
|
307
449
|
if (env[VARIABLE_TENUE] && lire(verrou) === env[VARIABLE_TENUE]) return mesure(env);
|
|
450
|
+
attendreDeLaPlace({ env, libre, occupe, dire, borneMs, rappelMs });
|
|
308
451
|
mkdirSync(path.dirname(verrou), { recursive: true });
|
|
309
452
|
const rang = rangDeLaMesure(racine);
|
|
310
453
|
if (!(peutPrendre(verrou, rang) && prendreVerrou(verrou, { attendre: false }))) {
|
|
@@ -66,6 +66,12 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
|
|
|
66
66
|
`npx grillhouse retirer-copie <copie>`, qui retire avec elle le dossier de travail de son
|
|
67
67
|
circuit (`<copie>.travail`). Ainsi le dépôt garde seulement le travail commité, et rien ne se
|
|
68
68
|
supprime sans avoir été lu.
|
|
69
|
+
- **Le dossier temporaire d'un ticket** : la consigne d'un sous-agent que je lance sur un ticket
|
|
70
|
+
nomme le dossier que donne `npx grillhouse temporaire <ticket>`, où vont ses fichiers
|
|
71
|
+
temporaires, légers, jamais une copie du dépôt, un `node_modules` ni un cache ; c'est celui que
|
|
72
|
+
le lanceur donne aux séances du ticket ; il vit tant que le ticket est ouvert, gel compris, et
|
|
73
|
+
part avec les copies finies quand le ticket se ferme. Ainsi mon scratchpad ne grossit pas des
|
|
74
|
+
agents du ticket.
|
|
69
75
|
|
|
70
76
|
## Un agent, un ticket
|
|
71
77
|
|
|
@@ -83,6 +83,8 @@ Le lanceur a avancé ta copie sur main avant d'ouvrir ta séance : tu pars du de
|
|
|
83
83
|
Hors de ta copie, la machine est en lecture seule, `.git` compris : tu ne commites pas et tu n'écris pas l'index. Ton lot est ton travail dans la copie : le circuit le construit, le fait relire, puis le commite par le script d'intégration. Ainsi seul le circuit écrit l'histoire du dépôt.
|
|
84
84
|
|
|
85
85
|
Les outils se prennent dans le `node_modules` de ta copie.
|
|
86
|
+
|
|
87
|
+
Ton dossier temporaire est celui de ton ticket : `$TMPDIR` le nomme, il reste d'une séance et d'une reprise à l'autre, gel compris, et part quand le ticket se ferme ; il ne porte que ce qui se refait : ce qu'il te faut pour reprendre vit dans ta copie ou ta passation, jamais dans le seul dossier temporaire. Tu n'y mets ni copie du dépôt, ni `node_modules`, ni cache de compilation ; un cache va sous `~/.cache/grillhouse/`. Ainsi le disque en mémoire du poste, que partagent ses séances, ne sature jamais.
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
## Relecteur (rempli par le circuit)
|
|
@@ -121,6 +123,8 @@ Tu relis le lot dans la copie du ticket (`.claude/worktrees/{{ticket}}`) et tu y
|
|
|
121
123
|
Ton verdict est ta fiche, qui finit ta séance : le circuit l'écrit au ticket et la lit. Sur ACCEPTÉ, il intègre le lot ; sur RENDU, il relance l'agent que nomme chaque constat bloquant et chaque élément non conforme (`role`), et chaque constat reste ouvert jusqu'à la relecture qui le juge levé (`suivi`) ; il écrit ta conformité et tes remarques au ticket.
|
|
122
124
|
|
|
123
125
|
Hors de ta copie, la machine est en lecture seule, `.git` compris : tu ne commites pas et tu n'écris pas l'index. Ainsi seul le circuit écrit l'histoire du dépôt.
|
|
126
|
+
|
|
127
|
+
Le dossier temporaire ne reçoit de toi rien de lourd : ni copie du dépôt, ni `node_modules`, ni cache de compilation ; un cache va sous `~/.cache/grillhouse/`. Ainsi le disque en mémoire du poste, que partagent ses séances, ne sature jamais.
|
|
124
128
|
```
|
|
125
129
|
|
|
126
130
|
## Toute séance, sur une fiche absente ou non conforme (rempli par le circuit)
|