@roomi-fields/grillhouse 0.45.0 → 0.46.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 +46 -0
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +101 -0
- package/cadre/templates/projet/CLAUDE.md +22 -5
- package/charte.md +45 -15
- package/dist/temporal/circuit/appel.d.ts +7 -0
- package/dist/temporal/circuit/appel.js +17 -0
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +14 -0
- package/dist/temporal/circuit/client.js +17 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +16 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +22 -2
- package/dist/temporal/circuit/contrat.js +76 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +68 -11
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +3 -0
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/installation.d.ts +5 -0
- package/dist/temporal/installation.js +23 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +1 -0
- package/dist/temporal/tickets/activites.js +37 -2
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +14 -0
- package/dist/temporal/tickets/deroule.js +16 -3
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +204 -55
- package/docs/INTERFACE.md +8 -5
- package/hooks/register.tsx +30 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +64 -15
- package/scripts/attente-a-l-arret.mjs +29 -52
- package/scripts/attente-au-tour.mjs +8 -26
- package/scripts/circuit.mjs +204 -64
- package/scripts/circuits-cles.d.mts +9 -0
- package/scripts/circuits-cles.mjs +38 -0
- package/scripts/coeurs-dedies.mjs +4 -3
- package/scripts/dernier-vert.mjs +66 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -2
- package/scripts/etapes.mjs +6 -1
- package/scripts/faits-du-circuit.mjs +22 -3
- package/scripts/fichiers-nommes.mjs +55 -0
- package/scripts/file-des-tickets.d.mts +17 -0
- package/scripts/file-des-tickets.mjs +39 -0
- package/scripts/grillhouse-maj.mjs +20 -1
- package/scripts/integration/file.mjs +11 -5
- package/scripts/integration/integrer.mjs +4 -2
- package/scripts/langages/cargo/clippy.mjs +16 -9
- package/scripts/langages/cargo/commandes.mjs +7 -2
- package/scripts/langages/cargo/sccache.mjs +19 -6
- package/scripts/langages/typescript/tests.mjs +31 -5
- package/scripts/langages/typescript/turbo-des-paquets.mjs +51 -3
- package/scripts/langages/typescript/vitest-config/changements.mjs +32 -3
- package/scripts/langages/typescript/vitest-config/lances.mjs +16 -0
- package/scripts/limite-d-usage.mjs +88 -0
- package/scripts/outils-cles.d.mts +13 -5
- package/scripts/outils-cles.mjs +157 -17
- package/scripts/passe-de-la-machine.mjs +26 -2
- package/scripts/places-de-la-machine.mjs +52 -6
- package/scripts/plafond-de-la-machine.d.mts +10 -2
- package/scripts/plafond-de-la-machine.mjs +39 -13
- package/scripts/reponses-du-circuit.d.mts +16 -0
- package/scripts/reponses-du-circuit.mjs +39 -3
- package/scripts/resultats.mjs +32 -11
- package/scripts/seances.mjs +211 -59
- package/scripts/session-start.sh +2 -2
- package/scripts/sous-commandes.mjs +5 -2
- package/scripts/superviseur.mjs +178 -226
- package/scripts/tableau.mjs +50 -37
- package/scripts/transitions.d.mts +22 -1
- package/scripts/transitions.mjs +111 -13
- package/scripts/workflows-du-cadre.mjs +21 -1
- package/skills/explorateur/SKILL.md +34 -13
- package/skills/pitmaster/SKILL.md +24 -20
- package/skills/relecteur/SKILL.md +6 -0
- package/skills/testwriter/SKILL.md +4 -0
package/hooks/register.tsx
CHANGED
|
@@ -471,6 +471,35 @@ async function changerLaListe($: EngineInterface, geste: 'ajouter' | 'retirer',
|
|
|
471
471
|
return geste === 'ajouter' ? `Projet ajouté au tableau : ${dossier}.` : `Projet retiré du tableau : ${dossier}.`
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
// The questions of the circuits reach the session of supervision by a push, as a queue gives its
|
|
475
|
+
// messages (grillhouse-3uv.110): at each period the greffon asks one reading of the circuits of the
|
|
476
|
+
// project (`grillhouse superviseur --relever`, which reads the circuits as the board does and
|
|
477
|
+
// answers nothing unless this session holds the lock of the supervisor) and submits what it prints,
|
|
478
|
+
// one message per reading, to the session: `$.prompt.submit` queues it while the session works, so
|
|
479
|
+
// it arrives at the end of the turn, without interrupting it. A question not answered comes back at
|
|
480
|
+
// the interval `grillhouse.rappel` of the project; its answer to the circuit acknowledges it. The
|
|
481
|
+
// state « presented at such a time » lives in the file of the stops gone up that the reading keeps.
|
|
482
|
+
export const PERIODE_DES_QUESTIONS_MS = 15_000
|
|
483
|
+
let relevee = false
|
|
484
|
+
export async function pousserLesQuestions($: EngineInterface): Promise<void> {
|
|
485
|
+
if (!eligible || relevee) return
|
|
486
|
+
relevee = true
|
|
487
|
+
try {
|
|
488
|
+
const r = await $.process.run([GRILLHOUSE, 'superviseur', '--relever', cwd], { cwd, timeoutMs: 60_000 })
|
|
489
|
+
if (r.exitCode !== 0) {
|
|
490
|
+
const faute = (r.stderr || '').trim().slice(0, 300)
|
|
491
|
+
if (faute) await update($, etat, s => ({ ...s, erreur: faute }))
|
|
492
|
+
return
|
|
493
|
+
}
|
|
494
|
+
const texte = (r.stdout || '').trim()
|
|
495
|
+
if (texte) void $.prompt.submit({ text: texte })
|
|
496
|
+
} catch {
|
|
497
|
+
// a reading that fails is taken again at the next period
|
|
498
|
+
} finally {
|
|
499
|
+
relevee = false
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
474
503
|
// The board applies to a Grillhouse project outside an agent's copy (`eligible`), once someone can
|
|
475
504
|
// see it: a person at the terminal's prompt from the start (`isInteractive`), or a surface that
|
|
476
505
|
// attaches later — the desktop app's Code tab, whose session starts headless, as the SDK's does,
|
|
@@ -486,6 +515,7 @@ async function activer($: EngineInterface) {
|
|
|
486
515
|
argumentHint: '[newday|ajouter|retirer <chemin>]',
|
|
487
516
|
})
|
|
488
517
|
void demarrer($)
|
|
518
|
+
$.clock.every(PERIODE_DES_QUESTIONS_MS, () => void pousserLesQuestions($))
|
|
489
519
|
}
|
|
490
520
|
|
|
491
521
|
export const register: Register = on => {
|
package/package.json
CHANGED
package/scripts/activites.mjs
CHANGED
|
@@ -839,7 +839,7 @@ export function restaurerLaCopie(ctx, commit) {
|
|
|
839
839
|
// of the project (`ctx.outils`, `grillhouse.outils`) and its data (`ctx.donnees`,
|
|
840
840
|
// `grillhouse.donnees`), read at the launch, whatever <base> holds, then <env>.
|
|
841
841
|
export const environnementDeLaPasse = (ctx, base, env = {}) => ({
|
|
842
|
-
...avecLesDonnees(ctx.donnees ?? {}, avecLesOutils(ctx.outils ?? {}, base)),
|
|
842
|
+
...avecLesDonnees(ctx.donnees ?? {}, avecLesOutils(ctx.outils ?? {}, base, ctx.empreintes ?? {})),
|
|
843
843
|
...env,
|
|
844
844
|
});
|
|
845
845
|
|
|
@@ -916,7 +916,7 @@ function restaurer(ctx, commit, fichiers) {
|
|
|
916
916
|
// Whether a proof of the counts <compte> passes: no file of the lot that does not load, no green
|
|
917
917
|
// the sheet names in `portent_le_travail` (`nommes`), and at least one red (of the lot, existing
|
|
918
918
|
// or of a build); the greens the sheet does not name and the ones HEAD holds are accepted but prove
|
|
919
|
-
// nothing. Under a plan « comportement
|
|
919
|
+
// nothing. Under a plan « comportement tests-adaptés » (<inchange>), nothing has to turn red and every
|
|
920
920
|
// green passes: a proof passes with no file of the lot that does not load, its reds going to the
|
|
921
921
|
// developpeur.
|
|
922
922
|
// The files of the lot that only the night plays (<misDeCote>, `separerLesFichiersDuJour`) are no
|
|
@@ -1374,13 +1374,17 @@ const duTestwriter = (ctx, fichier) => langageDe(ctx.copie).estUnTest(fichier, c
|
|
|
1374
1374
|
// the plan and in the shared test material. <langage> reads the class of a file: the strict join
|
|
1375
1375
|
// by default, the join of the copy (`langageDeLaCopie`) for the launch of a session, which must
|
|
1376
1376
|
// go on in a copy its tool no longer loads.
|
|
1377
|
+
// A copy not made yet (the launch of the first session of the testwriter) has no change, and
|
|
1378
|
+
// the language is read only when a file is to class.
|
|
1377
1379
|
export function testsDuLot(ctx, langage = langageDe) {
|
|
1378
|
-
const
|
|
1379
|
-
return changements(ctx)
|
|
1380
|
+
const fichiers = changements(ctx)
|
|
1380
1381
|
.filter(c => !c.supprime)
|
|
1381
|
-
.map(c => c.fichier)
|
|
1382
|
-
|
|
1383
|
-
|
|
1382
|
+
.map(c => c.fichier);
|
|
1383
|
+
if (fichiers.length === 0) {
|
|
1384
|
+
return [];
|
|
1385
|
+
}
|
|
1386
|
+
const l = langage(ctx.copie);
|
|
1387
|
+
return fichiers.filter(f => l.estUnTest(f, ctx.copie)?.joue).sort();
|
|
1384
1388
|
}
|
|
1385
1389
|
|
|
1386
1390
|
// The package directory of the copy that holds <fichier>, or « . ».
|
|
@@ -1606,8 +1610,8 @@ export function preuve(ctx, { mesure: derniere = null, fichiers: seuls = null }
|
|
|
1606
1610
|
// main's (scripts/registre-des-resultats.mjs): a test of the lot the registry holds existed, its
|
|
1607
1611
|
// green accepted; one absent is new.
|
|
1608
1612
|
const registre = lireLeRegistre(ctx.copie);
|
|
1609
|
-
// A plan « comportement
|
|
1610
|
-
const inchange =
|
|
1613
|
+
// A plan « comportement tests-adaptés »: every green of the lot is expected.
|
|
1614
|
+
const inchange = ctx.sorte?.comportement === 'tests-adaptés';
|
|
1611
1615
|
// The developpeur already ran after the last testwriter: the code is there, no test can turn red.
|
|
1612
1616
|
const codePresent = codeDejaPresent(ctx);
|
|
1613
1617
|
for (const { groupe, entier, code, resultats, constructions } of mesure) {
|
|
@@ -1699,7 +1703,7 @@ export function preuve(ctx, { mesure: derniere = null, fichiers: seuls = null }
|
|
|
1699
1703
|
? []
|
|
1700
1704
|
: inchange
|
|
1701
1705
|
? [
|
|
1702
|
-
'Aucun fichier de test du lot : le plan dit «
|
|
1706
|
+
'Aucun fichier de test du lot : le plan dit « tests-adaptés », rien à prouver.',
|
|
1703
1707
|
'',
|
|
1704
1708
|
]
|
|
1705
1709
|
: ['Aucun fichier de test du lot dans le plan : rien ne prouve le rouge.', '']),
|
|
@@ -1796,11 +1800,24 @@ const STYLE = new Set(['lint', 'format:check']);
|
|
|
1796
1800
|
// a path of the plan holds it, the name of the package of <liste> that holds it, and that name
|
|
1797
1801
|
// again when the plan does not hold it. A red with no path (null) is in the plan when the plan
|
|
1798
1802
|
// names « . », which holds the whole copy.
|
|
1803
|
+
// A path of a component the plan set apart from the survey (`ctx.ecartes`) counts as the plan's:
|
|
1804
|
+
// `ecarte`, its directory, says so, and the circuit extends the plan to it.
|
|
1799
1805
|
function situer(ctx, liste, chemin) {
|
|
1800
1806
|
const dedans = chemin ? dansLePlan(ctx, chemin) : nommeLaRacine(ctx);
|
|
1801
1807
|
const p = chemin ? liste.find(x => chemin.startsWith(`${x.dossier}/`)) : null;
|
|
1802
1808
|
const paquet = p ? p.pkg.name : null;
|
|
1803
|
-
|
|
1809
|
+
const ecarte = !dedans && p && dansLesEcartes(ctx, chemin) ? p.dossier : null;
|
|
1810
|
+
return {
|
|
1811
|
+
dansLePlan: dedans || ecarte !== null,
|
|
1812
|
+
paquet,
|
|
1813
|
+
horsTitre: dedans || ecarte !== null ? null : paquet,
|
|
1814
|
+
ecarte,
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
// Whether a directory of the components the plan set apart (`ctx.ecartes`) holds <chemin>.
|
|
1819
|
+
function dansLesEcartes(ctx, chemin) {
|
|
1820
|
+
return (ctx.ecartes ?? []).some(c => chemin === c || chemin.startsWith(`${c}/`));
|
|
1804
1821
|
}
|
|
1805
1822
|
|
|
1806
1823
|
// The reds of the check <c> (`{ args, env, code, dossier }`), read in its results: each failed
|
|
@@ -1985,8 +2002,16 @@ export function controles(ctx, finale, restreinte = null, reportes = null, fichi
|
|
|
1985
2002
|
.taches.map(t => t.paquet)
|
|
1986
2003
|
)
|
|
1987
2004
|
);
|
|
2005
|
+
// A red two commands both play (a package of the plan and a component set apart that share a
|
|
2006
|
+
// task) is one red.
|
|
2007
|
+
const vusDesCommandes = new Set();
|
|
1988
2008
|
const tous = [
|
|
1989
|
-
...resultats
|
|
2009
|
+
...resultats
|
|
2010
|
+
.flatMap(r => r.rouges)
|
|
2011
|
+
.filter(r => {
|
|
2012
|
+
const cle = `${r.joue}\0${r.texte}`;
|
|
2013
|
+
return vusDesCommandes.has(cle) ? false : (vusDesCommandes.add(cle), true);
|
|
2014
|
+
}),
|
|
1990
2015
|
...(reportes?.rouges ?? []).filter(
|
|
1991
2016
|
r => !reportes.rejouee || (Boolean(r.joue) && !joues.has(r.joue))
|
|
1992
2017
|
),
|
|
@@ -2087,6 +2112,8 @@ export function controles(ctx, finale, restreinte = null, reportes = null, fichi
|
|
|
2087
2112
|
rouges: rouges.map(r => ({ paquet: nomDuPaquet(r), texte: r.texte, detail: r.detail })),
|
|
2088
2113
|
resume,
|
|
2089
2114
|
horsTitre: [...new Set(rouges.map(r => r.horsTitre).filter(Boolean))].sort(),
|
|
2115
|
+
// The directories of the components the plan set apart that hold a red: the plan extends to them.
|
|
2116
|
+
ecartesRouges: [...new Set(rouges.map(r => r.ecarte).filter(Boolean))].sort(),
|
|
2090
2117
|
lieux: rouges.map(lieu),
|
|
2091
2118
|
references,
|
|
2092
2119
|
tous,
|
|
@@ -2104,11 +2131,19 @@ export function controles(ctx, finale, restreinte = null, reportes = null, fichi
|
|
|
2104
2131
|
};
|
|
2105
2132
|
}
|
|
2106
2133
|
|
|
2134
|
+
// The test files <fichiers> of the lot that the checks name to `npm test`: all but the ones out of
|
|
2135
|
+
// every package of the language (`horsDesPaquets` of `separerLesFichiersDuJour`: the tests of the
|
|
2136
|
+
// frame's plugin), which `npm test` refuses and the guards play (`claude plugin test`).
|
|
2137
|
+
export function testsNommesAuxControles(ctx, fichiers) {
|
|
2138
|
+
const hors = new Set(separerLesFichiersDuJour(ctx, fichiers).horsDesPaquets);
|
|
2139
|
+
return fichiers.filter(f => !hors.has(f));
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2107
2142
|
// The checks of the plan, out of the final pass: `npm test -- <package>` for each package of the
|
|
2108
2143
|
// plan and each the lot touches in it, `npm test -- <test files of the lot>` that none of them
|
|
2109
2144
|
// holds (the shared test material's out of the plan), each test played once, then the guards in
|
|
2110
2145
|
// the envelope of the plan, whose findings on its files alone count.
|
|
2111
|
-
function commandesDuPlan(ctx, liste, seuls = null) {
|
|
2146
|
+
export function commandesDuPlan(ctx, liste, seuls = null) {
|
|
2112
2147
|
const lot = changements(ctx);
|
|
2113
2148
|
const touches = liste.length
|
|
2114
2149
|
? [...new Set(lot.map(c => paquetDe(liste, c.fichier)).filter(d => d !== '.'))].sort()
|
|
@@ -2119,14 +2154,28 @@ function commandesDuPlan(ctx, liste, seuls = null) {
|
|
|
2119
2154
|
: [
|
|
2120
2155
|
...new Set([...touches.filter(d => dansLePlan(ctx, d)), ...paquetsDuPlan(ctx, liste)]),
|
|
2121
2156
|
].sort();
|
|
2122
|
-
const tests = (seuls ?? testsDuLot(ctx)).filter(
|
|
2157
|
+
const tests = testsNommesAuxControles(ctx, seuls ?? testsDuLot(ctx)).filter(
|
|
2123
2158
|
f => !entiers.some(d => d === '.' || f.startsWith(`${d}/`))
|
|
2124
2159
|
);
|
|
2160
|
+
// The components the plan set apart that play tests, after the plan's packages: a one the plan or
|
|
2161
|
+
// the named tests already cover is not played twice (a resumption at named tests plays them alone).
|
|
2162
|
+
const jouesDesEcartes = seuls
|
|
2163
|
+
? []
|
|
2164
|
+
: liste
|
|
2165
|
+
.filter(
|
|
2166
|
+
p =>
|
|
2167
|
+
(ctx.ecartes ?? []).includes(p.dossier) &&
|
|
2168
|
+
!entiers.some(d => d === '.' || p.dossier === d || p.dossier.startsWith(`${d}/`)) &&
|
|
2169
|
+
joueDesTests(ctx.copie, p)
|
|
2170
|
+
)
|
|
2171
|
+
.map(p => p.dossier)
|
|
2172
|
+
.sort();
|
|
2125
2173
|
const scripts = lireJson(path.join(ctx.copie, 'package.json'))?.scripts ?? {};
|
|
2126
2174
|
const enveloppe = { [VARIABLE_ENVELOPPE]: ecrireLaListe(ctx.paquets) };
|
|
2127
2175
|
return [
|
|
2128
2176
|
...(tests.length ? [{ args: ['test', '--', ...tests] }] : []),
|
|
2129
2177
|
...entiers.map(d => ({ args: d === '.' ? ['test'] : ['test', '--', d] })),
|
|
2178
|
+
...jouesDesEcartes.map(d => ({ args: ['test', '--', d] })),
|
|
2130
2179
|
...['grillhouse:gardes', 'gardes']
|
|
2131
2180
|
.filter(s => s in scripts)
|
|
2132
2181
|
.map(s => ({ args: ['run', s], env: enveloppe })),
|
|
@@ -2255,7 +2304,7 @@ export function portesDuRouge(ctx, lieux) {
|
|
|
2255
2304
|
const nommes = [...new Set((lieux ?? []).map(l => l.fichier).filter(Boolean))];
|
|
2256
2305
|
return {
|
|
2257
2306
|
tests: nommes.filter(f => dulot.has(f)),
|
|
2258
|
-
code: nommes.filter(f => !dulot.has(f) && dansLePlan(ctx, f)),
|
|
2307
|
+
code: nommes.filter(f => !dulot.has(f) && (dansLePlan(ctx, f) || dansLesEcartes(ctx, f))),
|
|
2259
2308
|
};
|
|
2260
2309
|
}
|
|
2261
2310
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// The stop of the session of supervision: the hook Stop of the frame's plugin runs it
|
|
3
3
|
// (`grillhouse attente-a-l-arret`) when the session ends its turn, to wait for the owner. As an
|
|
4
4
|
// alert not acknowledged pages again (PagerDuty), the supervisor does not go to sleep while a
|
|
5
|
-
// circuit waits for it
|
|
6
|
-
//
|
|
5
|
+
// circuit waits for it (grillhouse-d4n.9: bf5 stopped on a question at 17:06, read 40 min later,
|
|
6
|
+
// on the owner's word). It asks for no wait: the greffon pushes the questions of the circuits.
|
|
7
7
|
//
|
|
8
8
|
// - Stop runs for the session itself, never for a sub-agent (SubagentStop). The session is the
|
|
9
9
|
// supervisor's as for the signal of the turn (`racineDeLaSupervision` of
|
|
@@ -12,12 +12,9 @@
|
|
|
12
12
|
// - A question of a circuit waits for the supervisor (`questionsEnAttente` of
|
|
13
13
|
// scripts/superviseur.mjs, a circuit ended without its issue included): the stop is blocked
|
|
14
14
|
// with each question, its ticket, its step and the command that answers it.
|
|
15
|
-
// -
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// - Each question blocks once, by its key, and each state of the circuits running without a wait
|
|
19
|
-
// once, by their tickets: both are noted in `.claude/worktrees/signale-a-l-arret.json`, which
|
|
20
|
-
// keeps the questions that still wait alone, so that a stop the supervisor decides (a question
|
|
15
|
+
// - Each question blocks once, by its key: it is noted in `.claude/worktrees/signale-a-l-arret.json`,
|
|
16
|
+
// which keeps the questions that still wait alone (an older note that holds a `etat` reads
|
|
17
|
+
// without error, the state dropped), so that a stop the supervisor decides (a question
|
|
21
18
|
// carried to the owner) is never held in a loop (`stop_hook_active` is not read; Claude Code
|
|
22
19
|
// caps the blocks in a row at eight in any case, hooks.md « Stop »).
|
|
23
20
|
// - The block: the reason on the error stream, exit code 2, which Claude Code gives the session as
|
|
@@ -30,42 +27,37 @@ import { pathToFileURL } from 'node:url';
|
|
|
30
27
|
import { racineDeLaSupervision } from './attente-au-tour.mjs';
|
|
31
28
|
import { circuitsDuServeur } from './circuits-du-serveur.mjs';
|
|
32
29
|
import { questionsEnAttente, ticketsHorsAttente } from './superviseur.mjs';
|
|
33
|
-
import { attenteVivante } from './tableau.mjs';
|
|
34
30
|
|
|
35
31
|
// The note of what blocked the stop in the repository at <racine>.
|
|
36
32
|
const noteDe = racine => path.join(racine, '.claude', 'worktrees', 'signale-a-l-arret.json');
|
|
37
33
|
|
|
34
|
+
// The keys of the questions the note holds; an older note's other keys are ignored.
|
|
38
35
|
function lireLaNote(racine) {
|
|
39
36
|
try {
|
|
40
37
|
const lu = JSON.parse(readFileSync(noteDe(racine), 'utf8'));
|
|
41
38
|
return {
|
|
42
39
|
questions: new Set(Array.isArray(lu?.questions) ? lu.questions.map(String) : []),
|
|
43
|
-
|
|
40
|
+
// Only `questions`: a note that holds another key (an older `etat`) is written again.
|
|
41
|
+
nette: Object.keys(lu ?? {}).join() === 'questions',
|
|
44
42
|
};
|
|
45
43
|
} catch {
|
|
46
|
-
return { questions: new Set(),
|
|
44
|
+
return { questions: new Set(), nette: true };
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/**
|
|
51
49
|
* What the stop of the session of supervision in <dossier> gets: the reason that blocks it, or
|
|
52
|
-
* null when the stop passes (see the header). The questions
|
|
53
|
-
*
|
|
50
|
+
* null when the stop passes (see the header). The questions it gives are noted, so that each
|
|
51
|
+
* blocks once.
|
|
54
52
|
* @param {string} dossier the directory the session works in
|
|
55
53
|
* @param {{ env?: Record<string, string | undefined>,
|
|
56
54
|
* fermes?: (racine: string, ids: string[]) => Set<string> | null,
|
|
57
|
-
* circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]
|
|
58
|
-
* attenteVit?: (racine: string) => boolean }} [options]
|
|
55
|
+
* circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]> }} [options]
|
|
59
56
|
* @returns {Promise<string | null>}
|
|
60
57
|
*/
|
|
61
58
|
export async function attenteALArret(
|
|
62
59
|
dossier,
|
|
63
|
-
{
|
|
64
|
-
env = process.env,
|
|
65
|
-
fermes = ticketsHorsAttente,
|
|
66
|
-
circuitsDe = circuitsDuServeur,
|
|
67
|
-
attenteVit = attenteVivante,
|
|
68
|
-
} = {}
|
|
60
|
+
{ env = process.env, fermes = ticketsHorsAttente, circuitsDe = circuitsDuServeur } = {}
|
|
69
61
|
) {
|
|
70
62
|
const racine = racineDeLaSupervision(dossier, env);
|
|
71
63
|
if (!racine) {
|
|
@@ -78,21 +70,15 @@ export async function attenteALArret(
|
|
|
78
70
|
return null;
|
|
79
71
|
}
|
|
80
72
|
const questions = questionsEnAttente(racine, circuits, { fermes });
|
|
81
|
-
const tournent = circuits
|
|
82
|
-
.filter(c => c.vivant)
|
|
83
|
-
.map(c => c.ticket)
|
|
84
|
-
.sort((a, b) => a.localeCompare(b, 'en'));
|
|
85
73
|
const note = lireLaNote(racine);
|
|
86
74
|
const neuves = questions.filter(q => !note.questions.has(q.cle));
|
|
87
|
-
|
|
88
|
-
const etatNeuf = etat !== null && etat !== note.etat;
|
|
89
|
-
if (etat !== note.etat || questions.length !== note.questions.size || neuves.length) {
|
|
75
|
+
if (!note.nette || questions.length !== note.questions.size || neuves.length) {
|
|
90
76
|
const f = noteDe(racine);
|
|
91
77
|
try {
|
|
92
78
|
mkdirSync(path.dirname(f), { recursive: true });
|
|
93
79
|
writeFileSync(
|
|
94
80
|
`${f}.${process.pid}`,
|
|
95
|
-
`${JSON.stringify({ questions: questions.map(q => q.cle).sort()
|
|
81
|
+
`${JSON.stringify({ questions: questions.map(q => q.cle).sort() })}\n`
|
|
96
82
|
);
|
|
97
83
|
renameSync(`${f}.${process.pid}`, f);
|
|
98
84
|
} catch {
|
|
@@ -100,31 +86,22 @@ export async function attenteALArret(
|
|
|
100
86
|
return null;
|
|
101
87
|
}
|
|
102
88
|
}
|
|
103
|
-
if (!neuves.length
|
|
89
|
+
if (!neuves.length) {
|
|
104
90
|
return null;
|
|
105
91
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
)
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
if (etatNeuf) {
|
|
123
|
-
blocs.push(
|
|
124
|
-
`${blocs.length ? '\n' : ''}Ne te mets pas en attente : ${tournent.length > 1 ? `les circuits ${tournent.join(', ')} tournent` : `le circuit ${tournent[0]} tourne`} et aucune attente des questions ne vit pour ce dépôt, rien ne te réveillera à sa question ni à sa fin. Lance l'attente des questions en arrière-plan (\`run_in_background\`), sans tube ni veille à durée : \`npx grillhouse superviseur --attendre\`, et relance-la après chaque lot traité.`
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
return blocs.join('\n');
|
|
92
|
+
return [
|
|
93
|
+
neuves.length > 1
|
|
94
|
+
? `Ne te mets pas en attente : ${neuves.length} circuits attendent ta réponse. Réponds à chacun, ou porte sa question au responsable en le lui disant, puis termine ton tour.`
|
|
95
|
+
: 'Ne te mets pas en attente : un circuit attend ta réponse. Réponds-lui, ou porte sa question au responsable en le lui disant, puis termine ton tour.',
|
|
96
|
+
...neuves.map(q =>
|
|
97
|
+
q.interrompu
|
|
98
|
+
? `- ${q.ticket} a fini sans son issue, à ${q.etape} : \`${q.commande}\`.`
|
|
99
|
+
: [
|
|
100
|
+
`- ${q.ticket}, à ${q.etape}, au ${q.qui} : ${q.question.replace(/\n/g, '\n ')}`,
|
|
101
|
+
` La réponse : \`${q.commande}\`.`,
|
|
102
|
+
].join('\n')
|
|
103
|
+
),
|
|
104
|
+
].join('\n');
|
|
128
105
|
}
|
|
129
106
|
|
|
130
107
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
@@ -1,35 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// The signal of the supervisor's turn: the hook UserPromptSubmit of the mod runs it at each turn
|
|
3
3
|
// of a session of supervision (`npx grillhouse attente-au-tour`), and what it writes reaches the
|
|
4
|
-
// session. A question of a circuit must never stay mute
|
|
5
|
-
//
|
|
4
|
+
// session. A question of a circuit must never stay mute, as a review requested on GitHub is named
|
|
5
|
+
// again until it is answered.
|
|
6
6
|
//
|
|
7
7
|
// - It names each circuit that waits for the supervisor (`questionsEnAttente`, the one source of
|
|
8
|
-
// the opening and of the
|
|
9
|
-
// question, the command that answers it
|
|
10
|
-
// - A question already
|
|
8
|
+
// the opening and of the greffon's reading), a circuit ended without its issue included: its
|
|
9
|
+
// ticket, its question, the command that answers it. It asks for no wait and reads no lock.
|
|
10
|
+
// - A question already pushed by the greffon is named again: the file of the stops gone up is not
|
|
11
11
|
// read.
|
|
12
|
-
// - A wait that lives says it all: its lock (`attente-des-questions.lock`) names a live process,
|
|
13
|
-
// and nothing is said. A lock whose process is dead counts as no wait.
|
|
14
12
|
// - Out of a git repository, in an agent's copy (a worktree) and in the session of a role that
|
|
15
13
|
// the circuit launches (BEADS_ACTOR set), nothing is said.
|
|
16
14
|
// Exit 0, whatever it finds.
|
|
17
15
|
import { spawnSync } from 'node:child_process';
|
|
18
|
-
import { readFileSync } from 'node:fs';
|
|
19
16
|
import path from 'node:path';
|
|
20
17
|
import { pathToFileURL } from 'node:url';
|
|
21
18
|
import { circuitsDuServeur } from './circuits-du-serveur.mjs';
|
|
22
|
-
import {
|
|
23
|
-
import { questionsEnAttente, ticketsHorsAttente, verrouDeLAttente } from './superviseur.mjs';
|
|
24
|
-
|
|
25
|
-
// The process that the lock of the wait of the repository at <racine> names; null without a lock.
|
|
26
|
-
function tenant(racine) {
|
|
27
|
-
try {
|
|
28
|
-
return Number(/^(\d+)/.exec(readFileSync(verrouDeLAttente(racine), 'utf8'))?.[1]) || null;
|
|
29
|
-
} catch {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
19
|
+
import { questionsEnAttente, ticketsHorsAttente } from './superviseur.mjs';
|
|
33
20
|
|
|
34
21
|
/**
|
|
35
22
|
* The root of the repository whose session of supervision works in <dossier>: null out of a git
|
|
@@ -61,8 +48,8 @@ export function racineDeLaSupervision(dossier, env = process.env) {
|
|
|
61
48
|
|
|
62
49
|
/**
|
|
63
50
|
* What the session of supervision in <dossier> reads at its turn: the circuits that wait for the
|
|
64
|
-
* supervisor, each with its ticket, its question and the command that answers it
|
|
65
|
-
*
|
|
51
|
+
* supervisor, each with its ticket, its question and the command that answers it; empty when no
|
|
52
|
+
* circuit waits, or out of a session of supervision.
|
|
66
53
|
* @param {string} dossier the directory the session works in
|
|
67
54
|
* @param {{ env?: Record<string, string | undefined>,
|
|
68
55
|
* fermes?: (racine: string, ids: string[]) => Set<string> | null,
|
|
@@ -77,10 +64,6 @@ export async function attenteAuTour(
|
|
|
77
64
|
if (!racine) {
|
|
78
65
|
return '';
|
|
79
66
|
}
|
|
80
|
-
const vit = tenant(racine);
|
|
81
|
-
if (vit && vivant(vit)) {
|
|
82
|
-
return '';
|
|
83
|
-
}
|
|
84
67
|
let circuits;
|
|
85
68
|
try {
|
|
86
69
|
circuits = await circuitsDe(racine);
|
|
@@ -103,7 +86,6 @@ export async function attenteAuTour(
|
|
|
103
86
|
` La réponse : \`${q.commande}\`.`,
|
|
104
87
|
].join('\n')
|
|
105
88
|
),
|
|
106
|
-
'Aucune attente de fond ne vit : lance-la en arrière-plan (`run_in_background`), sans tube ni veille à durée, et relance-la après chaque lot traité : `npx grillhouse superviseur --attendre`.',
|
|
107
89
|
].join('\n');
|
|
108
90
|
}
|
|
109
91
|
|