@roomi-fields/grillhouse 0.31.0 → 0.32.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 +18 -0
- package/dist/temporal/installation.d.ts +3 -2
- package/dist/temporal/installation.js +7 -4
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +1 -0
- package/dist/temporal/tickets/activites.js +5 -0
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +10 -0
- package/dist/temporal/tickets/deroule.js +8 -1
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +71 -9
- package/docs/CADRE.md +10 -0
- package/docs/INTERFACE.md +9 -1
- package/hooks/hooks.json +4 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +5 -7
- package/scripts/aiguillage.mjs +2 -0
- package/scripts/attente-au-tour.mjs +99 -0
- package/scripts/base-des-workflows.mjs +57 -0
- package/scripts/circuit.mjs +20 -1
- package/scripts/copies-finies.mjs +8 -1
- package/scripts/dernier-vert.mjs +30 -4
- package/scripts/effets.mjs +9 -0
- package/scripts/etapes.mjs +1 -1
- package/scripts/jointure.d.ts +4 -0
- package/scripts/journal-des-etats.d.mts +41 -0
- package/scripts/journal-des-etats.mjs +273 -0
- package/scripts/journal.mjs +119 -0
- package/scripts/langages/cargo/index.mjs +3 -0
- package/scripts/langages/python/index.mjs +2 -0
- package/scripts/langages/typescript/frontieres.mjs +46 -0
- package/scripts/langages/typescript/index.mjs +2 -0
- package/scripts/langages/typescript/verifier.mjs +33 -4
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -0
- package/scripts/langages.d.mts +20 -0
- package/scripts/matiere-de-test.d.ts +11 -0
- package/scripts/nuit.sh +9 -0
- package/scripts/places-de-la-machine.mjs +6 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +127 -75
- package/scripts/tableau.mjs +99 -1
- package/scripts/ticket-du-circuit.mjs +37 -7
- package/scripts/transitions.mjs +18 -5
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/explorateur/SKILL.md +1 -1
- package/skills/grill/SKILL.md +2 -56
- package/skills/grill/references/paquets.md +60 -0
- package/skills/pitmaster/SKILL.md +16 -27
- package/skills/questionneur/SKILL.md +1 -1
- package/skills/relecteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +7 -1
- package/skills/release/SKILL.md +0 -134
- package/skills/release/scripts/update-version.cjs +0 -92
package/scripts/superviseur.mjs
CHANGED
|
@@ -57,7 +57,14 @@ import { pathToFileURL } from 'node:url';
|
|
|
57
57
|
import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
58
58
|
import { vivant } from './mesure/base-de-passe.mjs';
|
|
59
59
|
import { circuitsDuServeur, ServeurMuet } from './circuits-du-serveur.mjs';
|
|
60
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
attendLeSuperviseur,
|
|
62
|
+
cleDe,
|
|
63
|
+
lireLesRemontees,
|
|
64
|
+
RAPPEL_PAR_DEFAUT,
|
|
65
|
+
remonteesDe,
|
|
66
|
+
verrouDeLAttente,
|
|
67
|
+
} from './tableau.mjs';
|
|
61
68
|
import { etapeDuCircuit, libelle, SUPERVISEUR } from './etapes.mjs';
|
|
62
69
|
|
|
63
70
|
const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
|
|
@@ -94,7 +101,7 @@ function seance(depart = process.ppid) {
|
|
|
94
101
|
|
|
95
102
|
// Of the tickets <ids> of the repository at <racine>, those that bd gives closed; none when bd does
|
|
96
103
|
// not read them.
|
|
97
|
-
function ticketsFermes(racine, ids) {
|
|
104
|
+
export function ticketsFermes(racine, ids) {
|
|
98
105
|
const r = spawnSync('bd', ['show', ...ids, '--json'], {
|
|
99
106
|
cwd: racine,
|
|
100
107
|
encoding: 'utf8',
|
|
@@ -112,52 +119,77 @@ function ticketsFermes(racine, ids) {
|
|
|
112
119
|
}
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
// One stop of the circuit <c>: its ticket, the run of its workflow (`run`), the rank of its
|
|
116
|
-
// question in that run (`numero`) and its stop, so that the next stop of a circuit resumed is
|
|
117
|
-
// another one.
|
|
118
|
-
const cleDe = c => [c.ticket, c.run, c.numero, c.arret ?? 'interrompu'].join(':');
|
|
119
|
-
|
|
120
122
|
// The step where the circuit <c> stands, in words (« 3.1 Contrôles »), else its state's.
|
|
121
123
|
const ou = c => {
|
|
122
124
|
const e = etapeDuCircuit({ ...c, raison: c.arret });
|
|
123
125
|
return e ? libelle(e) : c.etape;
|
|
124
126
|
};
|
|
125
127
|
|
|
126
|
-
// The file of the stops gone up to the session of supervision
|
|
127
|
-
//
|
|
128
|
+
// The file of the stops gone up to the session of supervision (`remonteesDe`) and the lock of its
|
|
129
|
+
// one wait (`verrouDeLAttente`) are beside the states of the circuits (scripts/tableau.mjs reads
|
|
130
|
+
// both: its alerts).
|
|
128
131
|
const etatsDe = racine => path.join(racine, '.claude', 'worktrees');
|
|
129
|
-
|
|
130
|
-
const verrouDeLAttente = racine => path.join(etatsDe(racine), 'attente-des-questions.lock');
|
|
132
|
+
export { verrouDeLAttente };
|
|
131
133
|
|
|
132
|
-
// The stops gone up
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// The stops gone up of the repository at <racine>, its circuits <circuits> read, under the lock
|
|
143
|
-
// of their file: <faire>(<avant>, those gone up before) returns the keys it makes go up (`cles`)
|
|
144
|
-
// and what it gives (`rendu`); the file is written whole with them and those of <avant> whose stop
|
|
145
|
-
// still stands, its circuit waiting for the supervisor. A question answered so leaves them. Its
|
|
146
|
-
// `rendu`.
|
|
147
|
-
function remonter(racine, circuits, faire) {
|
|
134
|
+
// The stops gone up of the repository at <racine>, its circuits <circuits> read, under the lock of
|
|
135
|
+
// their file, at <maintenant> ms. Each stop that waits for the supervisor and never went up, or
|
|
136
|
+
// whose last presentation is <rappelMs> ms old or more (<toutes>: every one), is given, its ticket
|
|
137
|
+
// <fermes> gives closed left out (bd is asked of those alone); a stop given is presented now, and
|
|
138
|
+
// one that goes up has its `depuis` set now. The file is written whole with the stops that still
|
|
139
|
+
// stand, their circuit waiting for the supervisor: a question answered so leaves it. The `rendu`
|
|
140
|
+
// is the questions given, each marked `representee` when it comes back.
|
|
141
|
+
function relever(racine, circuits, { fermes, maintenant, rappelMs, toutes = false }) {
|
|
148
142
|
const f = remonteesDe(racine);
|
|
149
143
|
mkdirSync(path.dirname(f), { recursive: true });
|
|
150
144
|
const verrou = `${f}.verrou`;
|
|
151
145
|
// Held for one reading of the circuits: older than that, abandoned.
|
|
152
146
|
prendreVerrou(verrou, { attendre: true, perime: 30_000 });
|
|
153
147
|
try {
|
|
154
|
-
const avant =
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
const avant = new Map(lireLesRemontees(racine, maintenant).map(r => [r.cle, r]));
|
|
149
|
+
const debout = questionsEnAttente(racine, circuits, { fermes: aucunFerme });
|
|
150
|
+
const aRendre = debout.filter(q => {
|
|
151
|
+
const r = avant.get(q.cle);
|
|
152
|
+
return toutes || !r || maintenant - r.presentee >= rappelMs;
|
|
153
|
+
});
|
|
154
|
+
const fermesDe = aRendre.length
|
|
155
|
+
? fermes(
|
|
156
|
+
racine,
|
|
157
|
+
aRendre.map(q => q.ticket)
|
|
158
|
+
)
|
|
159
|
+
: new Set();
|
|
160
|
+
const rendu = aRendre
|
|
161
|
+
.filter(q => !fermesDe.has(q.ticket))
|
|
162
|
+
.map(q => (avant.has(q.cle) && !toutes ? { ...q, representee: true } : q));
|
|
163
|
+
const presentes = new Set(aRendre.map(q => q.cle));
|
|
164
|
+
const enTexte = liste =>
|
|
165
|
+
`${JSON.stringify(
|
|
166
|
+
{
|
|
167
|
+
remontees: liste
|
|
168
|
+
.map(r => ({ cle: r.cle, depuis: r.depuis, presentee: r.presentee }))
|
|
169
|
+
.sort((a, b) => a.cle.localeCompare(b.cle, 'en')),
|
|
170
|
+
},
|
|
171
|
+
null,
|
|
172
|
+
2
|
|
173
|
+
)}\n`;
|
|
174
|
+
const ecrit = enTexte(
|
|
175
|
+
debout.map(q => {
|
|
176
|
+
const r = avant.get(q.cle);
|
|
177
|
+
return {
|
|
178
|
+
cle: q.cle,
|
|
179
|
+
depuis: r?.depuis ?? maintenant,
|
|
180
|
+
presentee: presentes.has(q.cle) ? maintenant : r.presentee,
|
|
181
|
+
};
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
let enFichier = '';
|
|
185
|
+
try {
|
|
186
|
+
enFichier = readFileSync(f, 'utf8');
|
|
187
|
+
} catch {
|
|
188
|
+
// no file yet
|
|
189
|
+
}
|
|
190
|
+
if (ecrit !== enFichier && !(debout.length === 0 && avant.size === 0)) {
|
|
159
191
|
const provisoire = `${f}.${process.pid}`;
|
|
160
|
-
writeFileSync(provisoire,
|
|
192
|
+
writeFileSync(provisoire, ecrit);
|
|
161
193
|
renameSync(provisoire, f);
|
|
162
194
|
}
|
|
163
195
|
return rendu;
|
|
@@ -225,39 +257,33 @@ export function questionsEnAttente(
|
|
|
225
257
|
// No ticket closed: the questions read without asking bd.
|
|
226
258
|
const aucunFerme = () => new Set();
|
|
227
259
|
|
|
228
|
-
// The questions of the repository at <racine>, its circuits <circuits> read, that never went up
|
|
229
|
-
// (`questionsEnAttente`): returned, and now gone up; a question answered (its circuit runs again,
|
|
230
|
-
// or ended) leaves those gone up, and one whose ticket <fermes> gives closed goes up without a
|
|
231
|
-
// word. bd is asked of the new ones alone.
|
|
232
|
-
function releverLesNeuves(racine, circuits, fermes) {
|
|
233
|
-
return remonter(racine, circuits, avant => ({
|
|
234
|
-
cles: questionsEnAttente(racine, circuits, { fermes: aucunFerme }).map(q => q.cle),
|
|
235
|
-
rendu: questionsEnAttente(racine, circuits, { fermes, sauf: avant }),
|
|
236
|
-
}));
|
|
237
|
-
}
|
|
238
|
-
|
|
239
260
|
/**
|
|
240
261
|
* The wait of the session of supervision of the repository at <racine> (`npx grillhouse
|
|
241
|
-
* superviseur --attendre`, which the supervisor
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
262
|
+
* superviseur --attendre`, which the supervisor reads as a stream, as a worker of Temporal keeps its
|
|
263
|
+
* task queue): an asynchronous iterator that gives one batch of questions at a time and goes on
|
|
264
|
+
* listening by itself, with no relaunch. It gives a question that waits for the supervisor
|
|
265
|
+
* (`questionsEnAttente`), whatever launched its circuit, once it never went up, and again, marked
|
|
266
|
+
* `representee`, every <rappel> minutes (5 by default) while its circuit stands on the same stop,
|
|
267
|
+
* as SQS gives a message not acknowledged again after its visibility timeout; a question
|
|
268
|
+
* answered (its circuit left the stop) leaves those gone up and is not given again, and the normal
|
|
269
|
+
* end of a circuit is never one. A stop whose key changes is a new question, given at once. The
|
|
270
|
+
* times are those of <maintenant> (`Date.now` by default). It reads the circuits every <pas> ms by
|
|
271
|
+
* <circuitsDe> (one call to the Temporal server, scripts/circuits-du-serveur.mjs, by default), as
|
|
272
|
+
* the UI of Temporal refreshes its list; a reading that fails (the server down) is tried again at
|
|
273
|
+
* the next step, the questions gone up kept. One wait at a time per repository: a second one is
|
|
274
|
+
* refused while the first runs. Its <signal> ends it.
|
|
275
|
+
* @param {{ racine: string, fermes?: (racine: string, ids: string[]) => Set<string>, pas?: number, signal?: AbortSignal, circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>, maintenant?: () => number, rappel?: number }} options
|
|
276
|
+
* @returns {AsyncGenerator<{ ticket: string, etape: string, question: string, qui: string, commande: string, cle: string, representee?: boolean }[], void, void>}
|
|
253
277
|
* @throws {Error} another wait runs
|
|
254
278
|
*/
|
|
255
|
-
export async function attendreUneQuestion({
|
|
279
|
+
export async function* attendreUneQuestion({
|
|
256
280
|
racine,
|
|
257
281
|
fermes = ticketsFermes,
|
|
258
282
|
pas = 5_000,
|
|
259
283
|
signal,
|
|
260
284
|
circuitsDe = circuitsDuServeur,
|
|
285
|
+
maintenant = Date.now,
|
|
286
|
+
rappel = RAPPEL_PAR_DEFAUT,
|
|
261
287
|
}) {
|
|
262
288
|
mkdirSync(etatsDe(racine), { recursive: true });
|
|
263
289
|
const verrou = verrouDeLAttente(racine);
|
|
@@ -281,14 +307,17 @@ export async function attendreUneQuestion({
|
|
|
281
307
|
circuits = null;
|
|
282
308
|
}
|
|
283
309
|
if (circuits && !signal?.aborted) {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
310
|
+
const lot = relever(racine, circuits, {
|
|
311
|
+
fermes,
|
|
312
|
+
maintenant: maintenant(),
|
|
313
|
+
rappelMs: rappel * 60_000,
|
|
314
|
+
});
|
|
315
|
+
if (lot.length) {
|
|
316
|
+
yield lot;
|
|
287
317
|
}
|
|
288
318
|
}
|
|
289
319
|
await attendre(pas, signal);
|
|
290
320
|
}
|
|
291
|
-
return [];
|
|
292
321
|
} finally {
|
|
293
322
|
lacherVerrou(verrou);
|
|
294
323
|
}
|
|
@@ -307,21 +336,29 @@ const attendre = (ms, signal) =>
|
|
|
307
336
|
|
|
308
337
|
/**
|
|
309
338
|
* The text that wakes the session of supervision on the questions <questions>: for each one, its
|
|
310
|
-
* ticket, step, who must answer it, its question and the command that answers it
|
|
311
|
-
*
|
|
312
|
-
*
|
|
339
|
+
* ticket, step, who must answer it, its question and the command that answers it. The wait goes
|
|
340
|
+
* on by itself: the text asks for no relaunch. A question presented again (`representee`) says that
|
|
341
|
+
* it still waits for an answer.
|
|
342
|
+
* @param {{ ticket: string, etape: string, question: string, qui: string, commande: string, representee?: boolean }[]} questions
|
|
313
343
|
* @returns {string}
|
|
314
344
|
*/
|
|
315
345
|
export function texteDesQuestions(questions) {
|
|
346
|
+
const neuves = questions.filter(q => !q.representee);
|
|
347
|
+
const titre = neuves.length
|
|
348
|
+
? questions.length > 1
|
|
349
|
+
? '## Questions neuves des circuits'
|
|
350
|
+
: "## Question neuve d'un circuit"
|
|
351
|
+
: questions.length > 1
|
|
352
|
+
? '## Questions toujours sans réponse'
|
|
353
|
+
: '## Question toujours sans réponse';
|
|
316
354
|
return [
|
|
317
|
-
|
|
355
|
+
titre,
|
|
318
356
|
...questions.map(q =>
|
|
319
357
|
[
|
|
320
|
-
`- ${q.ticket}, à ${q.etape}, au ${q.qui} : ${q.question.replace(/\n/g, '\n ')}`,
|
|
358
|
+
`- ${q.ticket}, à ${q.etape}, au ${q.qui}${q.representee ? ' (toujours sans réponse)' : ''} : ${q.question.replace(/\n/g, '\n ')}`,
|
|
321
359
|
` La réponse : \`${q.commande}\`.`,
|
|
322
360
|
].join('\n')
|
|
323
361
|
),
|
|
324
|
-
"Une fois répondu, relance l'attente en arrière-plan (`run_in_background`) : `npx grillhouse superviseur --attendre`.",
|
|
325
362
|
].join('\n');
|
|
326
363
|
}
|
|
327
364
|
|
|
@@ -357,9 +394,11 @@ export async function circuitsALOuverture(
|
|
|
357
394
|
: `Les circuits ne se lisent pas : ${message}.`;
|
|
358
395
|
}
|
|
359
396
|
const questions = circuits
|
|
360
|
-
?
|
|
361
|
-
|
|
362
|
-
|
|
397
|
+
? relever(racine, circuits, {
|
|
398
|
+
fermes,
|
|
399
|
+
maintenant: Date.now(),
|
|
400
|
+
rappelMs: RAPPEL_PAR_DEFAUT * 60_000,
|
|
401
|
+
toutes: true,
|
|
363
402
|
})
|
|
364
403
|
: [];
|
|
365
404
|
const tournent = enAttente(
|
|
@@ -381,7 +420,7 @@ export async function circuitsALOuverture(
|
|
|
381
420
|
);
|
|
382
421
|
return [
|
|
383
422
|
"## L'attente des questions",
|
|
384
|
-
"Dès ta première réponse, sans attendre le mot du responsable, lance en arrière-plan (`run_in_background`) l'
|
|
423
|
+
"Dès ta première réponse, sans attendre le mot du responsable, lance l'attente des questions en arrière-plan (`run_in_background`) et surveille sa sortie en continu (l'outil `Monitor`) : `npx grillhouse superviseur --attendre`. Elle ne se termine pas : elle imprime un lot à chaque question neuve d'un circuit, quel que soit son lanceur, et te réveille ainsi ; elle reprend l'écoute seule, sans relance. Une question sans réponse revient toutes les 5 min (`--rappel <minutes>` règle l'intervalle) jusqu'à sa réponse. Un lancement de circuit rend la main tout de suite, et la fin normale d'un circuit ne te réveille pas : le panneau la montre.",
|
|
385
424
|
...(panne ? ['', '## Les circuits du dépôt', panne] : []),
|
|
386
425
|
...(nommes.length ? ['', '## Les circuits du dépôt', ...nommes.map(n => n.ligne)] : []),
|
|
387
426
|
].join('\n');
|
|
@@ -451,10 +490,23 @@ function racineDe(dossier) {
|
|
|
451
490
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
452
491
|
if (process.argv[2] === '--attendre') {
|
|
453
492
|
try {
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
493
|
+
const args = process.argv.slice(3);
|
|
494
|
+
const i = args.indexOf('--rappel');
|
|
495
|
+
let rappel = RAPPEL_PAR_DEFAUT;
|
|
496
|
+
if (i !== -1) {
|
|
497
|
+
rappel = Number(args[i + 1]);
|
|
498
|
+
if (!(rappel > 0)) {
|
|
499
|
+
throw new Error('--rappel attend un nombre de minutes supérieur à 0.');
|
|
500
|
+
}
|
|
501
|
+
args.splice(i, 2);
|
|
502
|
+
}
|
|
503
|
+
for await (const questions of attendreUneQuestion({
|
|
504
|
+
racine: racineDe(args[0] ?? process.cwd()),
|
|
505
|
+
rappel,
|
|
506
|
+
})) {
|
|
507
|
+
// One batch, one block ended by a blank line: a stream read line by line.
|
|
508
|
+
process.stdout.write(`${texteDesQuestions(questions)}\n\n`);
|
|
509
|
+
}
|
|
458
510
|
} catch (e) {
|
|
459
511
|
process.stderr.write(`${e.message}\n`);
|
|
460
512
|
process.exitCode = 1;
|
package/scripts/tableau.mjs
CHANGED
|
@@ -117,6 +117,7 @@ import { verdictDe } from './integration/verdict.mjs';
|
|
|
117
117
|
import { lireLaMesure } from './avancement.mjs';
|
|
118
118
|
import { SANS_REPONSE_EN, ServeurMuet, circuitsDuServeur } from './circuits-du-serveur.mjs';
|
|
119
119
|
import { etatDesPlaces } from './places-de-la-machine.mjs';
|
|
120
|
+
import { vivant } from './mesure/base-de-passe.mjs';
|
|
120
121
|
|
|
121
122
|
const MINUTE = 60_000;
|
|
122
123
|
export const SILENCE = 10 * MINUTE;
|
|
@@ -612,6 +613,70 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
|
|
|
612
613
|
export const attendLeSuperviseur = c =>
|
|
613
614
|
!c.vivant && Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
|
|
614
615
|
|
|
616
|
+
/**
|
|
617
|
+
* The key of one stop of the circuit <c>: its ticket, the run of its workflow, the rank of its
|
|
618
|
+
* question in that run and its stop, so that the next stop of a circuit resumed is another one. The
|
|
619
|
+
* one key of the file of the stops gone up (scripts/superviseur.mjs) and of the board's alerts.
|
|
620
|
+
* @param {{ ticket: string, run?: string, numero?: number, arret?: string | null }} c
|
|
621
|
+
* @returns {string}
|
|
622
|
+
*/
|
|
623
|
+
export const cleDe = c => [c.ticket, c.run, c.numero, c.arret ?? 'interrompu'].join(':');
|
|
624
|
+
|
|
625
|
+
/** The file of the stops gone up to the supervisor of the repository at <racine>. */
|
|
626
|
+
export const remonteesDe = racine =>
|
|
627
|
+
path.join(racine, '.claude', 'worktrees', 'questions-remontees.json');
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* The stops gone up of the repository at <racine>, each with its key, `depuis` (the time of its
|
|
631
|
+
* first going up) and `presentee` (the time of its last presentation), in ms. An older file, a
|
|
632
|
+
* list of keys, reads without error: its stops take the time <maintenant> of the reading. A file
|
|
633
|
+
* that does not read holds none.
|
|
634
|
+
* @param {string} racine
|
|
635
|
+
* @param {number} maintenant
|
|
636
|
+
* @returns {{ cle: string, depuis: number, presentee: number }[]}
|
|
637
|
+
*/
|
|
638
|
+
export function lireLesRemontees(racine, maintenant) {
|
|
639
|
+
try {
|
|
640
|
+
const lu = JSON.parse(readFileSync(remonteesDe(racine), 'utf8'));
|
|
641
|
+
if (!Array.isArray(lu?.remontees)) {
|
|
642
|
+
return [];
|
|
643
|
+
}
|
|
644
|
+
return lu.remontees.map(r =>
|
|
645
|
+
typeof r === 'string'
|
|
646
|
+
? { cle: r, depuis: maintenant, presentee: maintenant }
|
|
647
|
+
: {
|
|
648
|
+
cle: String(r.cle),
|
|
649
|
+
depuis: Number.isFinite(r.depuis) ? r.depuis : maintenant,
|
|
650
|
+
presentee: Number.isFinite(r.presentee) ? r.presentee : maintenant,
|
|
651
|
+
}
|
|
652
|
+
);
|
|
653
|
+
} catch {
|
|
654
|
+
return [];
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/** The lock of the one wait of the questions of the repository at <racine>. */
|
|
659
|
+
export const verrouDeLAttente = racine =>
|
|
660
|
+
path.join(racine, '.claude', 'worktrees', 'attente-des-questions.lock');
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Whether a wait of the questions lives for the repository at <racine>: its lock names a process
|
|
664
|
+
* that lives (the pid is read again; a lock left by a dead process does not count).
|
|
665
|
+
* @param {string} racine
|
|
666
|
+
* @returns {boolean}
|
|
667
|
+
*/
|
|
668
|
+
export function attenteVivante(racine) {
|
|
669
|
+
try {
|
|
670
|
+
const pid = Number(/^(\d+)/.exec(readFileSync(verrouDeLAttente(racine), 'utf8'))?.[1]);
|
|
671
|
+
return Number.isInteger(pid) && pid > 0 && vivant(pid);
|
|
672
|
+
} catch {
|
|
673
|
+
return false;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// The minutes between two presentations of a question not answered, by default.
|
|
678
|
+
export const RAPPEL_PAR_DEFAUT = 5;
|
|
679
|
+
|
|
615
680
|
// The reviewer's last verdict among a ticket's comments (verdictDe: a comment of the reviewer's
|
|
616
681
|
// author), or null.
|
|
617
682
|
export function verdict(commentaires) {
|
|
@@ -709,6 +774,9 @@ export function assembler({
|
|
|
709
774
|
muet = false,
|
|
710
775
|
faute = null,
|
|
711
776
|
echecPrefixe = null,
|
|
777
|
+
remontees = [],
|
|
778
|
+
rappel = RAPPEL_PAR_DEFAUT,
|
|
779
|
+
attenteVivante: attenteQuiVit = true,
|
|
712
780
|
}) {
|
|
713
781
|
// A circuit's lines are its steps, no agent's passage.
|
|
714
782
|
const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
|
|
@@ -1050,6 +1118,33 @@ export function assembler({
|
|
|
1050
1118
|
texte: `Outil ${outil.version} non installable : code du dépôt`,
|
|
1051
1119
|
});
|
|
1052
1120
|
}
|
|
1121
|
+
// A circuit stopped on a question to the supervisor: orange, how long it has waited (from the
|
|
1122
|
+
// `depuis` of its stop in the file of the stops gone up), red past two intervals of
|
|
1123
|
+
// re-presentation (two presentations with no answer); it falls when the circuit leaves the stop.
|
|
1124
|
+
// One red alert « à corriger » when some wait and no wait lives.
|
|
1125
|
+
const depuisDe = new Map(remontees.map(r => [r.cle, r.depuis]));
|
|
1126
|
+
const enAttenteDuSuperviseur = [...parCircuit.values()]
|
|
1127
|
+
.filter(attendLeSuperviseur)
|
|
1128
|
+
.sort((a, b) => ordre({ id: a.ticket }, { id: b.ticket }));
|
|
1129
|
+
for (const c of enAttenteDuSuperviseur) {
|
|
1130
|
+
const depuis = depuisDe.get(cleDe(c));
|
|
1131
|
+
if (depuis === undefined) {
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
const attendu = Math.max(0, maintenant - depuis);
|
|
1135
|
+
alertes.push({
|
|
1136
|
+
niveau: attendu > 2 * rappel * MINUTE ? 'rouge' : 'orange',
|
|
1137
|
+
signe: '⏳',
|
|
1138
|
+
texte: `${numero(c.ticket)} attend le superviseur depuis ${Math.floor(attendu / MINUTE)} min`,
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
if (enAttenteDuSuperviseur.length && !attenteQuiVit) {
|
|
1142
|
+
alertes.push({
|
|
1143
|
+
niveau: 'rouge',
|
|
1144
|
+
signe: '🔕',
|
|
1145
|
+
texte: 'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1053
1148
|
for (const b of blocs) {
|
|
1054
1149
|
for (const x of b.enCours) {
|
|
1055
1150
|
if (x.ligne && x.silence !== null && x.silence > SILENCE) {
|
|
@@ -1427,7 +1522,8 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1427
1522
|
const reste = avec =>
|
|
1428
1523
|
largeur - (droite ? colonnes(droite) + 1 : 0) - colonnes(tete) - colonnes(avec);
|
|
1429
1524
|
const place = attendUnePlace.has(c.id) ? ' · attend une place' : '';
|
|
1430
|
-
const
|
|
1525
|
+
const tag = enQuestion(c) === SUPERVISEUR ? ' · en attente du superviseur' : '';
|
|
1526
|
+
const suite = `${tag}${
|
|
1431
1527
|
!temoin
|
|
1432
1528
|
? boucles
|
|
1433
1529
|
: reste(`${boucles}${temoin.texte}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
|
|
@@ -1946,6 +2042,8 @@ function lire(
|
|
|
1946
2042
|
faute,
|
|
1947
2043
|
echecPrefixe,
|
|
1948
2044
|
outil: echecDeLOutil(racine),
|
|
2045
|
+
remontees: lireLesRemontees(racine, maintenant),
|
|
2046
|
+
attenteVivante: attenteVivante(racine),
|
|
1949
2047
|
});
|
|
1950
2048
|
return { t, prefix, tous, vivants, commun };
|
|
1951
2049
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// `racine`) and holds no state of its own. Its writings at the ticket and among the sheets are
|
|
7
7
|
// effects (scripts/effets.mjs `emettre`), and its readings see those an act of the workflow
|
|
8
8
|
// emitted and has not yet played (`rendusDe`).
|
|
9
|
+
import { spawnSync } from 'node:child_process';
|
|
9
10
|
import { appendFileSync, existsSync, readFileSync } from 'node:fs';
|
|
10
11
|
import { gesteDe } from './etapes.mjs';
|
|
11
12
|
import { paquetsDuLangage } from './enveloppe/paquets-du-plan.mjs';
|
|
@@ -153,14 +154,43 @@ export const fichesDe = (ctx, role) =>
|
|
|
153
154
|
.filter(e => e.role === role)
|
|
154
155
|
.map(e => e.fiche);
|
|
155
156
|
|
|
156
|
-
// Whether the code of the behaviour is already in the copy: a developpeur session
|
|
157
|
-
//
|
|
158
|
-
//
|
|
157
|
+
// Whether the code of the behaviour is already in the copy: a developpeur session has run (the
|
|
158
|
+
// sheets hold one) and the copy still carries a change of production the testwriter does not write
|
|
159
|
+
// (`estUnTest` null: neither a test file nor the shared test material). This is the ground truth,
|
|
160
|
+
// not the order of the sessions: a testwriter session after the developpeur's (a RENDU to fix a
|
|
161
|
+
// test) does not remove the code, so the sign stays raised; a new lot whose code is not in the copy
|
|
162
|
+
// never raises it. With it, no test can turn red, and the proof abstains.
|
|
159
163
|
export const codeDejaPresent = ctx => {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
if (!lesFiches(ctx).some(e => e.role === 'developpeur')) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
const r = spawnSync(
|
|
168
|
+
'git',
|
|
169
|
+
['-C', ctx.copie, 'status', '--porcelain', '-z', '--untracked-files=all'],
|
|
170
|
+
{ encoding: 'utf8' }
|
|
171
|
+
);
|
|
172
|
+
if (r.status !== 0) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
const langage = langageDe(ctx.copie);
|
|
176
|
+
const entrees = r.stdout.split('\0');
|
|
177
|
+
for (let i = 0; i < entrees.length; i++) {
|
|
178
|
+
const e = entrees[i];
|
|
179
|
+
if (e.length < 4) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const xy = e.slice(0, 2);
|
|
183
|
+
const fichier = e.slice(3);
|
|
184
|
+
// A rename or a copy names its source in the next entry, which is not a change of its own.
|
|
185
|
+
if (xy.includes('R') || xy.includes('C')) {
|
|
186
|
+
i++;
|
|
187
|
+
}
|
|
188
|
+
// A production file the testwriter does not write, present (not deleted): the developer's code.
|
|
189
|
+
if (!xy.includes('D') && langage.estUnTest(fichier, ctx.copie) === null) {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return false;
|
|
164
194
|
};
|
|
165
195
|
|
|
166
196
|
// One line of the circuit's history at the ticket: `Circuit · <étape> : <texte>`, the effect
|
package/scripts/transitions.mjs
CHANGED
|
@@ -703,18 +703,31 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
|
|
|
703
703
|
// that reads the reference; alone, the final pass that is due (BPScript 320.6.5: a test
|
|
704
704
|
// that reads the turbo.json, red beside their guard, sent to the developpeur, who could not
|
|
705
705
|
// write them).
|
|
706
|
+
// The debt the lot lowers, seen at the checks of the plan by its notes (`a-elaguer`), is the
|
|
707
|
+
// red of a reference too: regenerated before the checks judge the lot again, whether the
|
|
708
|
+
// developpeur delivered or not (the regeneration only lowers the keys noted, it hides no
|
|
709
|
+
// defect).
|
|
710
|
+
const dette =
|
|
711
|
+
!passeFinale && k.notes.length > 0
|
|
712
|
+
? lire('referencesDesRouges', { lieux: [], aElaguer: true })
|
|
713
|
+
: [];
|
|
706
714
|
const regenereesAuxControles =
|
|
707
|
-
!passeFinale &&
|
|
715
|
+
!passeFinale &&
|
|
716
|
+
(k.references.length || k.notes.length) &&
|
|
717
|
+
regenereSur?.arbre === lire('arbreApres')
|
|
708
718
|
? regenereSur.noms
|
|
709
719
|
: [];
|
|
710
720
|
const avantLesControles = passeFinale
|
|
711
721
|
? []
|
|
712
|
-
: k.references.filter(
|
|
722
|
+
: [...k.references, ...dette.filter(d => !k.references.some(r => r.nom === d.nom))].filter(
|
|
723
|
+
r => !regenereesAuxControles.includes(r.nom)
|
|
724
|
+
);
|
|
713
725
|
if (avantLesControles.length) {
|
|
714
726
|
const noms = avantLesControles.map(r => r.nom);
|
|
715
|
-
const
|
|
727
|
+
const deLaDette = dette.some(d => noms.includes(d.nom));
|
|
728
|
+
const meles = k.rouge || k.aRepasser || deLaDette;
|
|
716
729
|
geste('regeneration');
|
|
717
|
-
const phrase = `${k.resume} ; des rouges sont ceux de références (${noms.join(', ')}) : à leur régénération, puis ${meles ? 'les contrôles du plan' : 'la passe finale'}.`;
|
|
730
|
+
const phrase = `${k.resume} ; ${deLaDette ? 'la dette des gardes baisse, ou des rouges sont ceux de références' : 'des rouges sont ceux de références'} (${noms.join(', ')}) : à leur régénération, puis ${meles ? 'les contrôles du plan' : 'la passe finale'}.`;
|
|
718
731
|
ecrireRapport(
|
|
719
732
|
'controles',
|
|
720
733
|
phrase,
|
|
@@ -734,7 +747,7 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
|
|
|
734
747
|
// project refuses the lot, as at the final pass (BPScript 320.10).
|
|
735
748
|
maj.aRegenerer = {
|
|
736
749
|
noms,
|
|
737
|
-
notes:
|
|
750
|
+
notes: k.notes,
|
|
738
751
|
suite: meles ? 'controles' : 'passe',
|
|
739
752
|
rouges: meles ? k.tous : [],
|
|
740
753
|
auDeveloppeur: meles && k.auDeveloppeur && !k.arbitrer ? k.texte : null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: developpeur
|
|
3
|
-
description: "
|
|
3
|
+
description: "Travailler le code d'un ticket du dépôt courant, dont les tests existent déjà. À charger au démarrage d'une séance de développement, avant de lire le ticket."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Développeur — travailler un ticket
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: explorateur
|
|
3
|
-
description: "
|
|
3
|
+
description: "Écrire le plan d'un ticket à l'étape 1 de son circuit — ses critères, les paquets à toucher, ses questions ouvertes — et répondre une fois au questionneur ; jouer le geste d'un ticket mécanique à l'étape 1.1 ; trier ses découvertes à l'étape 5.3, une fois son lot sur main ; ou mener un ticket d'exploration — relever l'état réel du code, lister les décisions à prendre, proposer les tickets de réalisation. Chargé par l'agent explorateur, que lance le circuit ou le superviseur ; n'écrit aucun code."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Explorateur — relever avant de réaliser
|
package/skills/grill/SKILL.md
CHANGED
|
@@ -138,62 +138,8 @@ remplace jamais le grill. Les branches de l'arbre :
|
|
|
138
138
|
son rôle, sa frontière, ses refus, son interface et son langage (1) ; le superviseur écrit sa
|
|
139
139
|
ligne et ses documents, relus par le responsable (2) ; `npx grillhouse paquet <chemin>` bâtit
|
|
140
140
|
son squelette et, pour le premier paquet d'un langage, les outils de ce langage (3), dans le
|
|
141
|
-
même commit que 2 ; son code part en ticket ordinaire (4).
|
|
142
|
-
|
|
143
|
-
`package.json`, construite dans `dist/` ; ses tests et leurs données restent dans le paquet.
|
|
144
|
-
**Les outils du projet, un paquet** : les scripts propres au projet (son typage, ses gardes, ses
|
|
145
|
-
traces) et leurs tests forment un paquet de l'espace de travail, comme `src/tools/` de rustc,
|
|
146
|
-
nommé selon la convention du projet ; il déclare ses commandes dans le champ `bin` de son
|
|
147
|
-
`package.json`, comme npm le prévoit pour un exécutable, et n'exporte aucun module. La racine
|
|
148
|
-
ne porte aucun test, et chaque test passe par `npm test`. Ainsi un outil se teste, se relit et
|
|
149
|
-
s'intègre comme un paquet.
|
|
150
|
-
**Le corpus du produit, un seul paquet** : les cas qui traversent toute la chaîne, et dont toute
|
|
151
|
-
modification d'un paquet peut changer le résultat, vivent dans un seul paquet qui exporte
|
|
152
|
-
`./test-fixtures`, comme `tests/cases` de TypeScript ou `tests/ui` de rustc ; tous les rôles le
|
|
153
|
-
lisent, le testwriter seul l'écrit. Sa configuration de Vitest s'écrit en CommonJS
|
|
154
|
-
(`vitest.config.cjs`, la base du cadre par `await import()`) : Vite écrit un fichier à côté
|
|
155
|
-
d'une configuration ESM pour la charger, et le corpus est en lecture seule chez les autres
|
|
156
|
-
rôles. Ses données (scènes, paires) ne bougent que les tests qui
|
|
157
|
-
les lisent, comme le `data` de Bazel : chaque paquet déclare dans son `package.json`, depuis la
|
|
158
|
-
racine, les chemins (dossiers ou fichiers) que ses tests lisent (`"grillhouse": { "lit": [...] }`),
|
|
159
|
-
données ou code d'un voisin (ses scripts de capture, un fichier de ses sources), comme le `data`
|
|
160
|
-
de Bazel prend tout fichier ; son test les prend en entrée, et la construction du paquet qui
|
|
161
|
-
porte un chemin de données seules le laisse hors des siennes, tandis qu'un chemin qui contient
|
|
162
|
-
du code, ou un fichier que cette construction lit (son `package.json`, ses `tsconfig*.json`),
|
|
163
|
-
reste dans la construction de son paquet. Une
|
|
164
|
-
trace qu'un étage produit (des grammaires encodées du corpus), comme une genrule de Bazel, vit
|
|
165
|
-
dans le paquet producteur, dans un dossier que git ignore, et se déclare avec ce qu'elle lit
|
|
166
|
-
(`"traces": { "trace:<nom>": { "lit": [...], "ecrit": "<dossier>" } }`, sa commande le script du
|
|
167
|
-
même nom, qui vide son dossier d'abord) ; un lecteur la déclare dans son `lit`. Ainsi un test
|
|
168
|
-
ne dépend que de son code, de ce qu'il importe et des chemins qu'il déclare. Chaque
|
|
169
|
-
paquet construit porte un script `build` qui écrit son `dist/` ; Turborepo les lance
|
|
170
|
-
(`turbo.json`, tâche `build`) : une construction attend celle de ses seules dépendances
|
|
171
|
-
d'exécution (`dependencies`, `peerDependencies`, `optionalDependencies`), et un test celle de
|
|
172
|
-
son propre paquet, dont il importe l'entrée construite, et de tout ce qu'il importe, la matière de test partagée d'un voisin comprise ; une construction
|
|
173
|
-
inchangée se restaure de son cache. Une construction ne compte que ce qu'elle lit : le
|
|
174
|
-
`package.json`, le `tsconfig.build.json` du paquet, ce qu'il étend et les dossiers qu'il inclut
|
|
175
|
-
(un fichier listé, son dossier) ; un fichier de test changé ne rejoue ni elle ni ses dépendants.
|
|
176
|
-
Le `turbo.json` de la racine est au projet : la mise à jour
|
|
177
|
-
du cadre l'écrit une fois, depuis le gabarit de sa forme (`templates/turbo/paquets.json` quand
|
|
178
|
-
le `package.json` déclare `workspaces`), puis n'y écrit que ce que le cadre en tient (les
|
|
179
|
-
dépendances des gardes, la variable des passes ciblées, l'exclusion `!$TURBO_ROOT$/<chemin>/.git`
|
|
180
|
-
à côté d'une entrée qui couvre un sous-module, dont le `.git` nomme la copie). Celui de chaque paquet est
|
|
181
|
-
généré depuis son `package.json` (`npx grillhouse turbo-des-paquets --ecrire`, que la mise à
|
|
182
|
-
jour lance) et `grillhouse:gardes` refuse un fichier absent ou périmé : une dépendance s'écrit
|
|
183
|
-
au `package.json` seul. Chaque paquet testé porte son script
|
|
184
|
-
`test:unit` et sa configuration Vitest, qui étend la configuration de base du cadre, le
|
|
185
|
-
`@roomi-fields/grillhouse/vitest-config`, que le paquet du cadre exporte (par `mergeConfig`) : les
|
|
186
|
-
exclusions du jour (tests de nuit, bancs de budget) et l'environnement commun y sont, sans
|
|
187
|
-
copie. Le paquet l'importe par son nom (`import base from '@roomi-fields/grillhouse/vitest-config'`) et le
|
|
188
|
-
déclare (`@roomi-fields/grillhouse`) dans ses `devDependencies`, comme les exemples de
|
|
189
|
-
Turborepo atteignent leurs paquets de configuration ; la mise à jour du cadre écrit la
|
|
190
|
-
déclaration. La racine d'un dépôt sans paquets l'importe par le même nom. Un paquet hors cadre (`docs/agents/hors-cadre.txt`) reste un
|
|
191
|
-
espace de travail, qu'un voisin importe par son nom, et Turborepo ne joue aucune de ses tâches :
|
|
192
|
-
son `turbo.json` généré les exclut, et aucune tâche d'un paquet du cadre ne l'attend. Aucune configuration ne lit
|
|
193
|
-
celle d'un voisin. Un test atteint son paquet
|
|
194
|
-
par une seule route : les sources relatives pour un test unitaire, le nom du paquet pour un test
|
|
195
|
-
de porte. Ainsi un agent enveloppé construit et teste son paquet avec ce que ses voisins
|
|
196
|
-
publient.
|
|
141
|
+
même commit que 2 ; son code part en ticket ordinaire (4).
|
|
142
|
+
Les mécanismes d'un paquet — sa forme publiée, les outils du projet, le corpus et ses données, les traces, Turborepo et la configuration Vitest — sont dans `references/paquets.md`, à lire au moment de créer un paquet.
|
|
197
143
|
9. **Les interfaces** — pour chaque frontière : ce qui la traverse, qui offre, qui consomme, qui
|
|
198
144
|
juge quelle faute, et le garde qui la tiendra.
|
|
199
145
|
**Une fois les composants décidés**, la nuit entre dans la table des tâches du poste
|