@roomi-fields/grillhouse 0.50.3 → 0.52.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 +68 -0
- package/agents/developpeur.md +1 -1
- package/agents/direct.md +1 -1
- package/agents/explorateur.md +1 -1
- package/agents/questionneur.md +1 -1
- package/agents/relecteur.md +1 -1
- package/agents/testwriter.md +1 -1
- package/cadre/templates/c/package.json +1 -0
- package/cadre/templates/cargo/package.json +1 -0
- package/cadre/templates/python/package.json +1 -0
- package/charte/plan.md +47 -0
- package/charte/preuve.md +39 -0
- package/charte/superviseur.md +61 -0
- package/charte/tests.md +38 -0
- package/charte.md +39 -189
- package/dist/machine/part-par-sorte.d.ts +16 -0
- package/dist/machine/part-par-sorte.js +36 -0
- package/dist/machine/part-par-sorte.js.map +1 -0
- package/dist/temporal/circuit/appel.js +1 -1
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +4 -4
- package/dist/temporal/circuit/client.js +38 -16
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +11 -7
- package/dist/temporal/circuit/contrat.js +5 -9
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +18 -6
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +12 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +54 -3
- package/dist/temporal/installation.js +187 -17
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/places/client.d.ts +5 -1
- package/dist/temporal/places/client.js +23 -11
- package/dist/temporal/places/client.js.map +1 -1
- package/docs/ARCHITECTURE.md +23 -2700
- package/docs/INTERFACE.md +26 -10
- package/docs/architecture/circuit.md +61 -14
- package/docs/architecture/entree.md +21 -8
- package/docs/architecture/greffon.md +49 -20
- package/docs/architecture/installation.md +46 -17
- package/docs/architecture/machine.md +79 -39
- package/docs/architecture/tests.md +59 -16
- package/docs/lexique.md +163 -0
- package/hooks/hooks.json +0 -10
- package/hooks/register.tsx +92 -4
- package/package.json +2 -1
- package/scripts/activites.mjs +105 -65
- package/scripts/aiguillage.mjs +15 -8
- package/scripts/attente-au-tour.mjs +2 -3
- package/scripts/attente-de-la-machine.mjs +4 -8
- package/scripts/avancement.mjs +12 -8
- package/scripts/bilan.mjs +126 -63
- package/scripts/bilans-gardes.mjs +37 -0
- package/scripts/branche-de-nuit.mjs +2 -2
- package/scripts/ci-de-main.mjs +18 -21
- package/scripts/circuit.mjs +89 -44
- package/scripts/circuits-du-serveur.mjs +5 -5
- package/scripts/composants-affectes.mjs +30 -12
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +1 -1
- package/scripts/consommation-des-passes.mjs +8 -6
- package/scripts/copies-finies.mjs +3 -14
- package/scripts/depart-du-ticket.d.mts +8 -2
- package/scripts/depart-du-ticket.mjs +26 -8
- package/scripts/direct.mjs +158 -72
- package/scripts/droits.mjs +165 -208
- package/scripts/engendres.mjs +3 -14
- package/scripts/entree-de-seance.mjs +35 -0
- package/scripts/enveloppe/enveloppe.mjs +98 -46
- package/scripts/enveloppe/lancer.sh +90 -66
- package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
- package/scripts/enveloppe/travail-de-la-copie.mjs +192 -3
- package/scripts/etapes.mjs +84 -22
- package/scripts/faits-du-circuit.mjs +8 -2
- package/scripts/grillhouse-maj.mjs +43 -18
- package/scripts/groupe-cles.d.mts +15 -0
- package/scripts/groupe-cles.mjs +77 -2
- package/scripts/init.mjs +9 -2
- package/scripts/integration/rejeu.mjs +8 -1
- package/scripts/jointure.d.ts +24 -4
- package/scripts/langages/c/index.mjs +5 -2
- package/scripts/langages/cargo/commandes.mjs +35 -15
- package/scripts/langages/cargo/composants.mjs +45 -3
- package/scripts/langages/cargo/index.mjs +6 -3
- package/scripts/langages/python/commandes.mjs +50 -7
- package/scripts/langages/python/index.mjs +5 -2
- package/scripts/langages/python/squelette.mjs +2 -1
- package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +16 -14
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
- package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +151 -38
- package/scripts/langages/typescript/verdict.mjs +29 -3
- package/scripts/langages/typescript/verifier.mjs +28 -3
- package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
- package/scripts/langages.mjs +54 -4
- package/scripts/matieres-lues.mjs +1 -1
- package/scripts/mesure/base-de-passe.mjs +32 -90
- package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
- package/scripts/migrations/suivi-du-superviseur-retire.mjs +56 -0
- package/scripts/migrations.mjs +23 -7
- package/scripts/nuit.sh +3 -2
- package/scripts/paquet.mjs +1 -1
- package/scripts/paquets.d.ts +3 -0
- package/scripts/paquets.mjs +88 -1
- package/scripts/passe-de-la-machine.mjs +109 -36
- package/scripts/places-de-la-machine.mjs +81 -29
- package/scripts/plafond-de-la-machine.d.mts +2 -5
- package/scripts/plafond-de-la-machine.mjs +9 -9
- package/scripts/reprise.mjs +42 -13
- package/scripts/resultats.mjs +78 -56
- package/scripts/retirer-les-copies-finies.mjs +1 -1
- package/scripts/seances.mjs +471 -133
- package/scripts/services-du-noyau.mjs +9 -1
- package/scripts/session-start.sh +22 -7
- package/scripts/sortie-de-seance.mjs +70 -0
- package/scripts/sortie.mjs +37 -6
- package/scripts/sous-commandes.mjs +0 -3
- package/scripts/superviseur.mjs +400 -162
- package/scripts/tableau.mjs +188 -65
- package/scripts/transitions.d.mts +25 -2
- package/scripts/transitions.mjs +137 -29
- package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
- package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
- package/skills/developpeur/SKILL.md +38 -15
- package/skills/direct/SKILL.md +29 -9
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
- package/skills/domain-modeling/SKILL.md +14 -12
- package/skills/explorateur/SKILL.md +32 -8
- package/skills/grill/SKILL.md +3 -2
- package/skills/pitmaster/SKILL.md +80 -50
- package/skills/pitmaster/references/cadre.md +1 -1
- package/skills/pitmaster/references/consigne-agent.md +12 -11
- package/skills/pitmaster/references/tour.md +6 -5
- package/skills/relecteur/SKILL.md +13 -6
- package/skills/systematic-debugging/SKILL.md +281 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/testwriter/SKILL.md +37 -31
- package/cadre/templates/projet/pitmaster/SUIVI.md +0 -22
- package/scripts/attente-a-l-arret.mjs +0 -114
- package/scripts/verrous/commande.mjs +0 -214
- package/scripts/verrous/verrou.mjs +0 -311
package/scripts/seances.mjs
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
// for it, under the same watch, before it takes its place (`lancer`): the second attempt of
|
|
8
8
|
// `jusquALaFiche`, and the fresh session that follows a failed resumption in `seance`; the id of
|
|
9
9
|
// each session comes from its caller, which gives a new one to each session it launches. `lancer` launches one session, `jusquALaFiche` until its
|
|
10
|
-
// sheet, `seance` the testwriter
|
|
10
|
+
// sheet, `seance` that of the testwriter, the developpeur or the agent direct on the whole ticket, with the instruction of
|
|
11
11
|
// the templates (`consigne`) and the findings of the reviewer open for its role
|
|
12
|
-
// (`constatsDeLaSeance`).
|
|
12
|
+
// (`constatsDeLaSeance`). Each session of a role ends on the judgment of its lot (`jugerLeLot`,
|
|
13
|
+
// machine.md §5.5). The circuit (scripts/circuit.mjs) calls them.
|
|
13
14
|
import { spawn, spawnSync } from 'node:child_process';
|
|
14
15
|
import { createHash, randomUUID } from 'node:crypto';
|
|
15
16
|
import {
|
|
@@ -26,15 +27,34 @@ import {
|
|
|
26
27
|
} from 'node:fs';
|
|
27
28
|
import os from 'node:os';
|
|
28
29
|
import path from 'node:path';
|
|
30
|
+
import { pathToFileURL } from 'node:url';
|
|
29
31
|
import { GREFFON } from './cadre.mjs';
|
|
32
|
+
import { competencesDuRole } from './droits.mjs';
|
|
33
|
+
import { entreeDeSeance } from './entree-de-seance.mjs';
|
|
30
34
|
import { avecLeFichierDuPoste, configurationDuPoste } from './fichier-du-poste.mjs';
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
import {
|
|
36
|
+
changements,
|
|
37
|
+
ecritPar,
|
|
38
|
+
etatDuFichier,
|
|
39
|
+
marquesRestantes,
|
|
40
|
+
photographier,
|
|
41
|
+
texteDeLEtat,
|
|
42
|
+
} from './enveloppe/travail-de-la-copie.mjs';
|
|
43
|
+
import {
|
|
44
|
+
ecrireLaListe,
|
|
45
|
+
paquetQuiTient,
|
|
46
|
+
paquetsDuLangage,
|
|
47
|
+
VARIABLE_TESTS_ETENDUS,
|
|
48
|
+
} from './enveloppe/paquets-du-plan.mjs';
|
|
49
|
+
import { langageDe, langageDeLaCopie } from './langages.mjs';
|
|
50
|
+
import { leRole, nomDuRole } from './etapes.mjs';
|
|
51
|
+
import { departDe, VARIABLE_SEANCE } from './mesure/base-de-passe.mjs';
|
|
36
52
|
import { groupeVivant, signalerGroupe } from './mesure-de-la-machine.mjs';
|
|
37
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
commandeDuGroupe,
|
|
55
|
+
lancementDeLaPasse,
|
|
56
|
+
mesureDeLaSeance,
|
|
57
|
+
} from './passe-de-la-machine.mjs';
|
|
38
58
|
import { prendreUnePlace } from './places-de-la-machine.mjs';
|
|
39
59
|
import { transcriptionsDeLaCopie } from './registre.mjs';
|
|
40
60
|
import { cleDuConstat, lireFiche, reponsesAuxConstats, schemaDeFiche } from './resultats.mjs';
|
|
@@ -99,6 +119,35 @@ const LANCEUR = path.join(import.meta.dirname, 'enveloppe', 'lancer.sh');
|
|
|
99
119
|
|
|
100
120
|
const REGISTRE = path.join(import.meta.dirname, 'registre.mjs');
|
|
101
121
|
|
|
122
|
+
// The script that opens the temporary directory of a session out of the envelope, the base of a
|
|
123
|
+
// pass whose owner is the process its argument names, and writes it without its end of line.
|
|
124
|
+
const OUVRIR_LE_TEMPORAIRE = `import { ouvrirBase } from ${JSON.stringify(
|
|
125
|
+
pathToFileURL(path.join(import.meta.dirname, 'mesure', 'base-de-passe.mjs')).href
|
|
126
|
+
)}; process.stdout.write(ouvrirBase('seance', { pid: Number(process.argv[1]) }).dossier);`;
|
|
127
|
+
|
|
128
|
+
// The shell that carries a session out of the envelope (`$0` the file of its exit code, `$1` node,
|
|
129
|
+
// `$2` the script above, `$3` the sorter of its stream (scripts/sortie-de-seance.mjs), `$4` the
|
|
130
|
+
// file of its result, `$5` that of the lines the log takes of it, then the session's command): it
|
|
131
|
+
// opens the session's temporary directory, which it owns, so that it outlives a dead circuit,
|
|
132
|
+
// names it in TMPDIR, TMP and TEMP, whatever CLAUDE_CODE_TMPDIR the poste holds, and removes it at
|
|
133
|
+
// its end, even interrupted. The stream of the session is written beside that directory, then
|
|
134
|
+
// sorted: its result to `$4`, the lines of the log to `$5`, which the circuit adds to the log
|
|
135
|
+
// after the last attempt of the launch.
|
|
136
|
+
const PORTER_LA_SEANCE = [
|
|
137
|
+
"trap 'exit 129' HUP; trap 'exit 130' INT; trap 'exit 143' TERM",
|
|
138
|
+
't=$("$1" --input-type=module -e "$2" "$$" </dev/null) || exit',
|
|
139
|
+
'trap \'rm -rf -- "${t%/t}"\' EXIT',
|
|
140
|
+
'node=$1 tri=$3 resultat=$4 journal=$5 flux="${t%/t}/flux"',
|
|
141
|
+
'shift 5',
|
|
142
|
+
'export TMPDIR="$t" TMP="$t" TEMP="$t"',
|
|
143
|
+
'unset CLAUDE_CODE_TMPDIR',
|
|
144
|
+
'"$@" > "$flux"; c=$?',
|
|
145
|
+
'"$node" "$tri" "$flux" "$resultat" > "$journal"',
|
|
146
|
+
'echo "$c" > "$0"; exit "$c"',
|
|
147
|
+
].join('\n');
|
|
148
|
+
|
|
149
|
+
const TRIER_LE_FLUX = path.join(import.meta.dirname, 'sortie-de-seance.mjs');
|
|
150
|
+
|
|
102
151
|
// The templates of the instructions, in the skill of the supervisor, which the frame's plugin
|
|
103
152
|
// carries, read at the plugin's root (scripts/cadre.mjs).
|
|
104
153
|
const GABARIT = path.join(GREFFON, 'skills', 'pitmaster', 'references', 'consigne-agent.md');
|
|
@@ -132,9 +181,10 @@ const mtime = f => {
|
|
|
132
181
|
|
|
133
182
|
/**
|
|
134
183
|
* Where the session <id> of <ctx> keeps its result, in the working directory of the ticket
|
|
135
|
-
* (`<copie>.travail/seances/<id>/`, as lancer.sh writes it): its exit code (`fin`),
|
|
136
|
-
* result (`resultat.json`), the
|
|
137
|
-
*
|
|
184
|
+
* (`<copie>.travail/seances/<id>/`, as lancer.sh writes it): its exit code (`fin`), the line
|
|
185
|
+
* `type: result` of claude's stream (`resultat.json`), the lines the log takes of the stream of
|
|
186
|
+
* a session out of the envelope (`au-journal`), the tree the prepared copy held before it
|
|
187
|
+
* (`avant`) and the witness that the envelope started its command (`demarree`).
|
|
138
188
|
*/
|
|
139
189
|
export function rangDeLaSeance(ctx, id) {
|
|
140
190
|
const dossier = path.join(ctx.tmp, 'seances', id);
|
|
@@ -142,8 +192,8 @@ export function rangDeLaSeance(ctx, id) {
|
|
|
142
192
|
dossier,
|
|
143
193
|
fin: path.join(dossier, 'fin'),
|
|
144
194
|
resultat: path.join(dossier, 'resultat.json'),
|
|
145
|
-
|
|
146
|
-
|
|
195
|
+
auJournal: path.join(dossier, 'au-journal'),
|
|
196
|
+
avant: path.join(dossier, 'avant'),
|
|
147
197
|
demarree: path.join(dossier, 'demarree'),
|
|
148
198
|
};
|
|
149
199
|
}
|
|
@@ -158,8 +208,6 @@ function resultatRange(rang, id, { horsEnveloppe = false } = {}) {
|
|
|
158
208
|
code: 0,
|
|
159
209
|
seance: Number(readFileSync(rang.fin, 'utf8').trim()),
|
|
160
210
|
bloque: false,
|
|
161
|
-
horsPlan: existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null,
|
|
162
|
-
ecriture: ecritureRangee(rang),
|
|
163
211
|
erreur: null,
|
|
164
212
|
sortie: lire(rang.resultat).trim(),
|
|
165
213
|
id,
|
|
@@ -180,9 +228,12 @@ function resultatRange(rang, id, { horsEnveloppe = false } = {}) {
|
|
|
180
228
|
// itself, in the ticket's
|
|
181
229
|
// copy (the main tree once the copy is gone), under <droits> (`horsDeLEnveloppe`), the
|
|
182
230
|
// schema of its role's sheet and the options <session> names (its id, or the session it
|
|
183
|
-
// resumes),
|
|
184
|
-
//
|
|
185
|
-
//
|
|
231
|
+
// resumes), in stream-json both ways: the skills of its role and its instruction on its standard
|
|
232
|
+
// input (scripts/entree-de-seance.mjs), its stream on its standard output, in a temporary
|
|
233
|
+
// directory of its own (PORTER_LA_SEANCE); of that stream, its result is ranged under its id with
|
|
234
|
+
// its exit code as lancer.sh ranges them, and the log takes under its header line what is not the
|
|
235
|
+
// conversation (scripts/sortie-de-seance.mjs); then its line is written to the register, as
|
|
236
|
+
// lancer.sh does.
|
|
186
237
|
// Its launch is kept with the circuit's results (`lancement`: its role, its session id, and the
|
|
187
238
|
// <objet> of a session that is not its role's own work, `tri`), which the bilan reads to count the
|
|
188
239
|
// sessions the circuit launched (scripts/bilan.mjs). Its sign of life names the session
|
|
@@ -256,12 +307,17 @@ export async function lancer(
|
|
|
256
307
|
return mort;
|
|
257
308
|
}
|
|
258
309
|
}
|
|
310
|
+
// The lot a dead attempt left unjudged is judged before anything of this launch moves the copy.
|
|
311
|
+
const juge = estJuge(role, horsEnveloppe);
|
|
312
|
+
if (juge) {
|
|
313
|
+
jugerLeLot(ctx, role);
|
|
314
|
+
}
|
|
259
315
|
const rang = rangDeLaSeance(ctx, id);
|
|
260
316
|
mkdirSync(rang.dossier, { recursive: true });
|
|
261
317
|
rmSync(rang.fin, { force: true });
|
|
262
318
|
rmSync(rang.resultat, { force: true });
|
|
263
|
-
rmSync(rang.
|
|
264
|
-
rmSync(rang.
|
|
319
|
+
rmSync(rang.auJournal, { force: true });
|
|
320
|
+
rmSync(rang.avant, { force: true });
|
|
265
321
|
rmSync(rang.demarree, { force: true });
|
|
266
322
|
inscrire(ctx, {
|
|
267
323
|
role: AUTEUR_DU_CIRCUIT,
|
|
@@ -272,30 +328,40 @@ export async function lancer(
|
|
|
272
328
|
writeFileSync(fichier, consigne);
|
|
273
329
|
// A file, not a pipe: a session whose circuit is dead writes its errors without breaking.
|
|
274
330
|
const erreurs = path.join(ctx.tmp, `erreurs-${numero}.txt`);
|
|
331
|
+
// The input of a session out of the envelope; lancer.sh composes that of an enveloped one.
|
|
332
|
+
const entree = path.join(ctx.tmp, `entree-${numero}.jsonl`);
|
|
333
|
+
if (horsEnveloppe) {
|
|
334
|
+
writeFileSync(entree, entreeDeSeance({ competences: competencesDuRole(role), consigne }));
|
|
335
|
+
}
|
|
275
336
|
let commande;
|
|
276
|
-
// Its result ranged under its id, as lancer.sh ranges a session's: claude's
|
|
277
|
-
// exit code once it ends, written by the shell that runs it, which outlives a
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
337
|
+
// Its result ranged under its id, as lancer.sh ranges a session's: the result of claude's
|
|
338
|
+
// stream, then its exit code once it ends, written by the shell that runs it, which outlives a
|
|
339
|
+
// dead circuit.
|
|
340
|
+
const ouvrirLesFds = () => {
|
|
341
|
+
if (!horsEnveloppe) {
|
|
342
|
+
return ['ignore', 'ignore', openSync(erreurs, 'w')];
|
|
343
|
+
}
|
|
344
|
+
const journal = openSync(ctx.journal, 'a');
|
|
345
|
+
return [openSync(entree, 'r'), journal, journal];
|
|
346
|
+
};
|
|
282
347
|
let fds = ouvrirLesFds();
|
|
283
348
|
if (horsEnveloppe) {
|
|
284
349
|
entete(ctx, role);
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
'json',
|
|
288
|
-
'--json-schema',
|
|
289
|
-
JSON.stringify(schemaDeFiche(sorte ?? role)),
|
|
290
|
-
];
|
|
350
|
+
const flux = ['--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose'];
|
|
351
|
+
const fiche = ['--json-schema', JSON.stringify(schemaDeFiche(sorte ?? role))];
|
|
291
352
|
commande = {
|
|
292
353
|
cmd: 'sh',
|
|
293
354
|
args: [
|
|
294
355
|
'-c',
|
|
295
|
-
|
|
356
|
+
PORTER_LA_SEANCE,
|
|
296
357
|
rang.fin,
|
|
358
|
+
process.execPath,
|
|
359
|
+
OUVRIR_LE_TEMPORAIRE,
|
|
360
|
+
TRIER_LE_FLUX,
|
|
361
|
+
rang.resultat,
|
|
362
|
+
rang.auJournal,
|
|
297
363
|
process.env.CLAUDE_BIN || 'claude',
|
|
298
|
-
...['-p', '--agent', role, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
|
|
364
|
+
...['-p', '--agent', role, ...flux, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
|
|
299
365
|
],
|
|
300
366
|
cwd: existsSync(ctx.copie) ? ctx.copie : ctx.racine,
|
|
301
367
|
};
|
|
@@ -360,13 +426,28 @@ export async function lancer(
|
|
|
360
426
|
role === 'testwriter' && ctx.testsEtendus?.length
|
|
361
427
|
? { [VARIABLE_TESTS_ETENDUS]: ecrireLaListe(ctx.testsEtendus) }
|
|
362
428
|
: {};
|
|
363
|
-
const
|
|
429
|
+
const marque = horsEnveloppe ? { [VARIABLE_SEANCE]: '1' } : {};
|
|
430
|
+
const env = { ...base, ...place.env, ...testsEtendus, ...marque, [ACTEUR]: role };
|
|
364
431
|
const lancement = horsEnveloppe
|
|
365
432
|
? lancementDeLaPasse({ lourde: false, cmd: commande.cmd, args: commande.args, env })
|
|
366
433
|
: { cmd: commande.cmd, args: commande.args, env };
|
|
434
|
+
// A session out of the envelope runs in a group of its own, which measures its peak into the
|
|
435
|
+
// register (an enveloped one is measured by its envelope): the default weight, no bound.
|
|
436
|
+
const mesure = horsEnveloppe
|
|
437
|
+
? mesureDeLaSeance({ racine: ctx.racine, role, ticket: ctx.ticket, env: lancement.env })
|
|
438
|
+
: null;
|
|
439
|
+
const lancee = mesure
|
|
440
|
+
? commandeDuGroupe({
|
|
441
|
+
part: { coeurs: 1, memoire: 0 },
|
|
442
|
+
cmd: lancement.cmd,
|
|
443
|
+
args: lancement.args,
|
|
444
|
+
unite: mesure.unite,
|
|
445
|
+
memoire: false,
|
|
446
|
+
})
|
|
447
|
+
: lancement;
|
|
367
448
|
const r = await jouerLeGroupe({
|
|
368
|
-
cmd:
|
|
369
|
-
args:
|
|
449
|
+
cmd: lancee.cmd,
|
|
450
|
+
args: lancee.args,
|
|
370
451
|
cwd: commande.cwd,
|
|
371
452
|
env: lancement.env,
|
|
372
453
|
stdio: fds,
|
|
@@ -385,6 +466,11 @@ export async function lancer(
|
|
|
385
466
|
}
|
|
386
467
|
},
|
|
387
468
|
});
|
|
469
|
+
mesure?.garder({
|
|
470
|
+
status: r.code,
|
|
471
|
+
error: r.erreur ?? undefined,
|
|
472
|
+
signal: r.bloque || r.annulee ? 'SIGTERM' : null,
|
|
473
|
+
});
|
|
388
474
|
if (r.pid === null && r.annulee) {
|
|
389
475
|
fermer();
|
|
390
476
|
}
|
|
@@ -394,6 +480,9 @@ export async function lancer(
|
|
|
394
480
|
}
|
|
395
481
|
return r;
|
|
396
482
|
};
|
|
483
|
+
if (juge) {
|
|
484
|
+
ouvrirLeLot(ctx, role, { id, horsEnveloppe, depot: horsEnveloppe ? commande.cwd : ctx.copie });
|
|
485
|
+
}
|
|
397
486
|
let r = await jouer(cle?.env ?? process.env);
|
|
398
487
|
let sortie = lireLaSortie(rang);
|
|
399
488
|
const motif = cle ? motifDeRefus(sortie) : null;
|
|
@@ -408,6 +497,7 @@ export async function lancer(
|
|
|
408
497
|
);
|
|
409
498
|
rmSync(rang.fin, { force: true });
|
|
410
499
|
rmSync(rang.resultat, { force: true });
|
|
500
|
+
rmSync(rang.auJournal, { force: true });
|
|
411
501
|
fds = ouvrirLesFds();
|
|
412
502
|
const { ANTHROPIC_API_KEY: _cle, ...sansCle } = process.env;
|
|
413
503
|
r = await jouer(sansCle);
|
|
@@ -415,30 +505,26 @@ export async function lancer(
|
|
|
415
505
|
}
|
|
416
506
|
place.rendre();
|
|
417
507
|
let seance;
|
|
418
|
-
let horsPlan = null;
|
|
419
|
-
let ecriture = null;
|
|
420
508
|
if (horsEnveloppe) {
|
|
421
509
|
seance = existsSync(rang.fin)
|
|
422
510
|
? Number(readFileSync(rang.fin, 'utf8').trim())
|
|
423
511
|
: r.erreur === null
|
|
424
512
|
? r.code
|
|
425
513
|
: null;
|
|
426
|
-
|
|
514
|
+
if (existsSync(rang.auJournal)) {
|
|
515
|
+
appendFileSync(ctx.journal, readFileSync(rang.auJournal));
|
|
516
|
+
}
|
|
427
517
|
spawnSync(process.execPath, [REGISTRE, '--copie', ctx.copie], {
|
|
428
518
|
cwd: ctx.racine,
|
|
429
519
|
stdio: ['ignore', 'ignore', 'ignore'],
|
|
430
520
|
});
|
|
431
521
|
} else {
|
|
432
522
|
seance = existsSync(rang.fin) ? Number(readFileSync(rang.fin, 'utf8').trim()) : null;
|
|
433
|
-
horsPlan = existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null;
|
|
434
|
-
ecriture = ecritureRangee(rang);
|
|
435
523
|
}
|
|
436
524
|
return {
|
|
437
525
|
code: r.code,
|
|
438
526
|
seance,
|
|
439
527
|
bloque: r.bloque,
|
|
440
|
-
horsPlan,
|
|
441
|
-
ecriture,
|
|
442
528
|
erreur: r.erreur ?? lire(erreurs),
|
|
443
529
|
sortie,
|
|
444
530
|
id,
|
|
@@ -653,6 +739,25 @@ export function consigne(valeurs, rang = 0) {
|
|
|
653
739
|
return `${bloc[1].replace(/\{\{(\w+)\}\}/g, (m, k) => (k in valeurs ? valeurs[k] : m))}\n`;
|
|
654
740
|
}
|
|
655
741
|
|
|
742
|
+
// What a direct asks of the reviewer of its lot, written once: the instruction of the circuit's
|
|
743
|
+
// reviewer on a direct circuit and that of the rescue command carry it.
|
|
744
|
+
const EXIGENCE_DU_DIRECT = [
|
|
745
|
+
'CE LOT EST UN DIRECT : un seul agent, le rôle `direct`, a écrit les tests et le code ensemble. Tout constat bloquant lui est adressé : son destinataire est `direct`.',
|
|
746
|
+
"La preuve du rouge n'est pas jouée : tu la tiens. Un défaut corrigé porte un test qui le reproduit, et ce test échoue sans le code du lot ; sans lui, le constat est bloquant. Un ticket de données ou le squelette d'un paquet, qui ne change aucun comportement, n'a pas de test à exiger.",
|
|
747
|
+
].join('\n\n');
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* The instruction of the reviewer of a direct lot: that of the circuit's reviewer (the second
|
|
751
|
+
* template of the supervisor's skill) filled with <valeurs>, then `propre`, what the caller alone
|
|
752
|
+
* says of the lot, then what a direct asks of it.
|
|
753
|
+
* @param {Record<string, string>} valeurs
|
|
754
|
+
* @param {string | null} [propre]
|
|
755
|
+
* @returns {string}
|
|
756
|
+
*/
|
|
757
|
+
export function consigneDuRelecteurDUnLotDirect(valeurs, propre = null) {
|
|
758
|
+
return `${[consigne(valeurs, 1).trim(), propre, EXIGENCE_DU_DIRECT].filter(Boolean).join('\n\n')}\n`;
|
|
759
|
+
}
|
|
760
|
+
|
|
656
761
|
// One session of <role> on the whole ticket: its sheet. A relaunch on its step (<tentative> past
|
|
657
762
|
// 1) that is not the last (<derniere>) resumes the agent's session the circuit keeps
|
|
658
763
|
// (<reprise>, its author and id) with the short instruction (the fourth template); its sheet
|
|
@@ -737,7 +842,12 @@ async function uneSeance(
|
|
|
737
842
|
},
|
|
738
843
|
};
|
|
739
844
|
const plan = ctx.paquets.join(', ');
|
|
740
|
-
|
|
845
|
+
// The sheet of an author of the circuit carries what its lot holds out of the rule of its role.
|
|
846
|
+
const repondu = fiche => {
|
|
847
|
+
const constats = fiche ? repondre(gardes, fiche) : gardes;
|
|
848
|
+
const horsRole = fiche && AUTEURS_JUGES.has(role) ? jugerLeLot(ctx, role) : null;
|
|
849
|
+
return { fiche: horsRole ? { ...fiche, horsRole } : fiche, constats };
|
|
850
|
+
};
|
|
741
851
|
if (reprise) {
|
|
742
852
|
const courte = {
|
|
743
853
|
role: nom,
|
|
@@ -747,9 +857,13 @@ async function uneSeance(
|
|
|
747
857
|
tentative,
|
|
748
858
|
change:
|
|
749
859
|
change ??
|
|
750
|
-
(
|
|
860
|
+
(rapport?.startsWith(TITRE_DU_LOT)
|
|
861
|
+
? 'le jugement du lot, joué après ta séance, trouve ton lot hors de la règle de ton rôle'
|
|
862
|
+
: role === 'testwriter'
|
|
751
863
|
? 'la preuve du rouge, jouée après ta séance, refuse ton lot'
|
|
752
|
-
:
|
|
864
|
+
: role === 'direct'
|
|
865
|
+
? 'la passe finale, jouée après ta séance, est rouge'
|
|
866
|
+
: 'les contrôles, joués après ta séance, sont rouges'),
|
|
753
867
|
rapport: rapport ?? 'aucun',
|
|
754
868
|
tache,
|
|
755
869
|
ouverts,
|
|
@@ -905,6 +1019,9 @@ export async function seance(ctx, role, options) {
|
|
|
905
1019
|
`Sa séance devait lever un conflit de la copie (${autres.join(', ')}) avant celle du ${nomDuRole(role)}.`
|
|
906
1020
|
);
|
|
907
1021
|
}
|
|
1022
|
+
if (fiche.horsRole) {
|
|
1023
|
+
throw new Arret('controles', fiche.horsRole.rapport);
|
|
1024
|
+
}
|
|
908
1025
|
return uneSeance(ctx, role, { ...options, constats });
|
|
909
1026
|
}
|
|
910
1027
|
}
|
|
@@ -912,7 +1029,9 @@ export async function seance(ctx, role, options) {
|
|
|
912
1029
|
/**
|
|
913
1030
|
* The stop for the sheet <fiche> of the session <tentative> of <role>, BLOQUÉ (« hors-portee »)
|
|
914
1031
|
* or BESOIN (« besoin »): its reason or question first, then its handover; the sheet's piece as
|
|
915
|
-
* its own, and the agent's question as its own
|
|
1032
|
+
* its own, and the agent's question as its own, with the package of the file out of the plan a
|
|
1033
|
+
* BESOIN sheet names (`manque`) and the command that extends the plan to it. <suite> says what
|
|
1034
|
+
* follows a BLOQUÉ.
|
|
916
1035
|
*/
|
|
917
1036
|
export function arretDuStatut(
|
|
918
1037
|
ctx,
|
|
@@ -922,13 +1041,18 @@ export function arretDuStatut(
|
|
|
922
1041
|
suite = 'Le circuit ne le relance pas sur ce rouge.'
|
|
923
1042
|
) {
|
|
924
1043
|
const passation = derniereDe(ctx, role)?.text ?? 'aucune';
|
|
925
|
-
const qui =
|
|
1044
|
+
const qui = leRole(role);
|
|
926
1045
|
const { piece } = fiche;
|
|
927
1046
|
return fiche.statut === 'BESOIN'
|
|
928
1047
|
? new Arret(
|
|
929
1048
|
'besoin',
|
|
930
1049
|
`${qui} attend une réponse (séance ${tentative}) : ${fiche.question}\n\nSa passation :\n\n${passation}`,
|
|
931
|
-
{
|
|
1050
|
+
{
|
|
1051
|
+
piece,
|
|
1052
|
+
question: [`${qui} demande : ${fiche.question}`, questionDuManque(ctx, fiche.manque)]
|
|
1053
|
+
.filter(Boolean)
|
|
1054
|
+
.join('\n\n'),
|
|
1055
|
+
}
|
|
932
1056
|
)
|
|
933
1057
|
: new Arret(
|
|
934
1058
|
'hors-portee',
|
|
@@ -937,6 +1061,66 @@ export function arretDuStatut(
|
|
|
937
1061
|
);
|
|
938
1062
|
}
|
|
939
1063
|
|
|
1064
|
+
// The file <manque> of a BESOIN sheet, from the root of the copy, and the package that holds it
|
|
1065
|
+
// (`.` the root), read on the components of the copy; null when it names no path of the copy.
|
|
1066
|
+
function fichierManquant(ctx, manque) {
|
|
1067
|
+
const chemin = manque ? path.posix.normalize(manque.trim()) : '.';
|
|
1068
|
+
if (chemin === '.' || chemin.startsWith('..') || path.isAbsolute(chemin)) {
|
|
1069
|
+
return null;
|
|
1070
|
+
}
|
|
1071
|
+
try {
|
|
1072
|
+
const racine = existsSync(ctx.copie) ? ctx.copie : ctx.racine;
|
|
1073
|
+
const liste = paquetsDuLangage(langageDeLaCopie(racine), racine);
|
|
1074
|
+
return { chemin, paquet: paquetQuiTient(chemin, liste) };
|
|
1075
|
+
} catch {
|
|
1076
|
+
return null;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
const dansLePlan = (ctx, paquet) => ctx.paquets.some(p => p === '.' || p === paquet);
|
|
1081
|
+
|
|
1082
|
+
// What the question of a BESOIN stop adds on the file <manque> out of the plan, or null.
|
|
1083
|
+
function questionDuManque(ctx, manque) {
|
|
1084
|
+
const f = fichierManquant(ctx, manque);
|
|
1085
|
+
if (!f || dansLePlan(ctx, f.paquet)) {
|
|
1086
|
+
return null;
|
|
1087
|
+
}
|
|
1088
|
+
return f.paquet === '.'
|
|
1089
|
+
? `${f.chemin} est à la racine du dépôt, hors du plan du ticket : aucun paquet ne le porte, l’écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`
|
|
1090
|
+
: `${f.chemin} est dans ${f.paquet}, hors du plan du ticket : le plan s’étend-il à ce paquet (\`--etendre ${f.paquet}\`), ou l’écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// The extension of the plan the file <manque> of a BESOIN sheet of <role> calls for without a
|
|
1094
|
+
// question: `{ etendre: { paquet, chemin, piece } }` for a file the ticket's description names,
|
|
1095
|
+
// `{ etendreTests: … }` for a test file of a reader package the testwriter asks for (the plan
|
|
1096
|
+
// extends to its tests alone), null for any other (the root and the documents the responsable
|
|
1097
|
+
// owns among them), which goes up.
|
|
1098
|
+
function extensionDemandee(ctx, role, manque) {
|
|
1099
|
+
const f = fichierManquant(ctx, manque);
|
|
1100
|
+
if (!f || f.paquet === '.' || dansLePlan(ctx, f.paquet)) {
|
|
1101
|
+
return null;
|
|
1102
|
+
}
|
|
1103
|
+
const nomme = fichierNommeAuTicket(leTicket(ctx).description, f.chemin);
|
|
1104
|
+
if (nomme) {
|
|
1105
|
+
return { etendre: { ...f, piece: nomme.piece } };
|
|
1106
|
+
}
|
|
1107
|
+
if (role !== 'testwriter' || (ctx.testsEtendus ?? []).includes(f.paquet)) {
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
const classe = rouleDeTest(ctx)(f.chemin);
|
|
1111
|
+
return classe?.test && !classe.matiere
|
|
1112
|
+
? {
|
|
1113
|
+
etendreTests: {
|
|
1114
|
+
...f,
|
|
1115
|
+
piece: `${f.chemin} est un fichier de test de ${f.paquet}, un paquet lecteur que le lot fait rougir`,
|
|
1116
|
+
},
|
|
1117
|
+
}
|
|
1118
|
+
: null;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// The authors of the code, whose sheet answers each finding open for them.
|
|
1122
|
+
const REPONDENT = ['developpeur', 'direct'];
|
|
1123
|
+
|
|
940
1124
|
// The findings of the reviewer open for <role> among <constats>, as a session of the run whose
|
|
941
1125
|
// supervisor's context is <contexte> (`--contexte`, with `--depuis`, `--reprendre` or
|
|
942
1126
|
// `--etendre`) receives them, as a review its author relaunches on a change he frames keeps its
|
|
@@ -958,7 +1142,8 @@ export function constatsDeLaSeance(contexte, constats, role, destinataire = null
|
|
|
958
1142
|
const siens = (constats ?? []).filter(c => c.role === role);
|
|
959
1143
|
const anciens = siens.filter(c => c.enContexte);
|
|
960
1144
|
const neufs = siens.filter(c => !c.enContexte);
|
|
961
|
-
const
|
|
1145
|
+
const repondAuxConstats = REPONDENT.includes(role);
|
|
1146
|
+
const titres = repondAuxConstats ? neufs.map(c => c.titre) : [];
|
|
962
1147
|
const enContexte = `les constats ouverts au lancement de la passe du superviseur, donnés en contexte : ta tâche est celle du superviseur, ci-dessus ; chacun reste ouvert jusqu'à la relecture qui le juge levé, et ta fiche n'a pas à répondre à chacun`;
|
|
963
1148
|
const titre =
|
|
964
1149
|
'LES CONSTATS DU RELECTEUR QUI RESTENT OUVERTS pour ton rôle, ' +
|
|
@@ -979,7 +1164,7 @@ export function constatsDeLaSeance(contexte, constats, role, destinataire = null
|
|
|
979
1164
|
constats: texte,
|
|
980
1165
|
valider: f => reponsesAuxConstats(f, titres),
|
|
981
1166
|
repondre: (tous, fiche) =>
|
|
982
|
-
|
|
1167
|
+
repondAuxConstats && siens.length ? avecLesReponses(tous, fiche) : tous,
|
|
983
1168
|
};
|
|
984
1169
|
}
|
|
985
1170
|
|
|
@@ -993,13 +1178,13 @@ export const auLancement = (contexte, constats) =>
|
|
|
993
1178
|
return contexte ? { ...reste, enContexte: true } : reste;
|
|
994
1179
|
});
|
|
995
1180
|
|
|
996
|
-
// The findings <constats>, each finding of the
|
|
1181
|
+
// The findings <constats>, each finding of the author of the code that his sheet <fiche> answers (by its
|
|
997
1182
|
// title, numbered or not: `cleDuConstat`) with its answer `{ etat, raison, piece }`, as a thread
|
|
998
1183
|
// of a review keeps the author's reply under its comment.
|
|
999
1184
|
function avecLesReponses(constats, fiche) {
|
|
1000
1185
|
const parTitre = new Map((fiche.reponses ?? []).map(r => [cleDuConstat(r.titre), r]));
|
|
1001
1186
|
return (constats ?? []).map(c => {
|
|
1002
|
-
const r = c.role
|
|
1187
|
+
const r = REPONDENT.includes(c.role) ? parTitre.get(c.titre) : undefined;
|
|
1003
1188
|
if (!r) {
|
|
1004
1189
|
return c;
|
|
1005
1190
|
}
|
|
@@ -1010,65 +1195,9 @@ function avecLesReponses(constats, fiche) {
|
|
|
1010
1195
|
});
|
|
1011
1196
|
}
|
|
1012
1197
|
|
|
1013
|
-
// The
|
|
1014
|
-
// (
|
|
1015
|
-
function ecritureRangee(rang) {
|
|
1016
|
-
return existsSync(rang.horsPlanFait) ? JSON.parse(lire(rang.horsPlanFait)) : null;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// The launch <r> of a session of <role>: `{ etendre: { paquet, chemin, piece } }` for a write out
|
|
1020
|
-
// of the plan in a file the ticket names (the plan extends, the session resumes), nothing for a
|
|
1021
|
-
// session that went its way, or the Arret it is: a session its lock stopped on a
|
|
1022
|
-
// write out of the plan (« hors-plan », the write as its piece), a motionless session
|
|
1023
|
-
// (« bloqué »), a launch that stops before its session (« lancement »).
|
|
1198
|
+
// The launch <r> of a session of <role>: nothing for a session that went its way, or the Arret it
|
|
1199
|
+
// is: a motionless session (« bloqué »), a launch that stops before its session (« lancement »).
|
|
1024
1200
|
export function seanceLancee(ctx, role, r) {
|
|
1025
|
-
if (r.horsPlan) {
|
|
1026
|
-
// The lock's structured write: the first line of the report names the path and its package;
|
|
1027
|
-
// the question carries the command (none for the root, which no package holds).
|
|
1028
|
-
const ecriture = r.ecriture;
|
|
1029
|
-
// A file the ticket's description names (its « Architecture » or a criterion) extends the plan
|
|
1030
|
-
// to its package without a stop; the root, and the documents the responsable owns, still go up.
|
|
1031
|
-
// A ticket that does not read names nothing: the stop goes up as it did.
|
|
1032
|
-
let nomme = null;
|
|
1033
|
-
if (ecriture && !ecriture.racine && typeof ctx.bd === 'function') {
|
|
1034
|
-
try {
|
|
1035
|
-
nomme = fichierNommeAuTicket(leTicket(ctx).description, ecriture.chemin);
|
|
1036
|
-
} catch {
|
|
1037
|
-
nomme = null;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
if (nomme) {
|
|
1041
|
-
return {
|
|
1042
|
-
etendre: { paquet: ecriture.paquet, chemin: ecriture.chemin, piece: nomme.piece },
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
// A test file of a reader package, written by the testwriter, extends the plan to the tests of
|
|
1046
|
-
// that package alone, without a stop: its code stays out of the plan, and no other role writes it.
|
|
1047
|
-
if (role === 'testwriter' && ecriture && !ecriture.racine) {
|
|
1048
|
-
const classe = rouleDeTest(ctx)(ecriture.chemin);
|
|
1049
|
-
if (classe?.test && !classe.matiere) {
|
|
1050
|
-
return {
|
|
1051
|
-
etendreTests: {
|
|
1052
|
-
paquet: ecriture.paquet,
|
|
1053
|
-
chemin: ecriture.chemin,
|
|
1054
|
-
piece: `${ecriture.chemin} est un fichier de test de ${ecriture.paquet}, un paquet lecteur que le lot fait rougir`,
|
|
1055
|
-
},
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
const nom = ecriture ? (ecriture.racine ? 'la racine du dépôt' : ecriture.paquet) : null;
|
|
1060
|
-
const dit = ecriture ? `${ecriture.chemin} est dans ${nom}` : null;
|
|
1061
|
-
const question = !ecriture
|
|
1062
|
-
? null
|
|
1063
|
-
: ecriture.racine
|
|
1064
|
-
? `La séance écrit ${ecriture.chemin}, que tient la racine du dépôt, hors du plan du ticket : aucun paquet ne le porte, l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`
|
|
1065
|
-
: `La séance écrit ${ecriture.chemin}, que tient ${ecriture.paquet}, hors du plan du ticket : le plan s'étend-il à ce paquet (\`--etendre ${ecriture.paquet}\`), ou l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`;
|
|
1066
|
-
throw new Arret(
|
|
1067
|
-
'hors-plan',
|
|
1068
|
-
`${dit ? `${dit}, hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}).\n\n` : ''}Le crochet de la séance du ${nomDuRole(role)} l'arrête sur une écriture hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}) :\n\n${r.horsPlan}`,
|
|
1069
|
-
{ piece: r.horsPlan, ...(question ? { question } : {}) }
|
|
1070
|
-
);
|
|
1071
|
-
}
|
|
1072
1201
|
if (r.bloque) {
|
|
1073
1202
|
const minutes = Math.round(ctx.immobileMs / 60_000);
|
|
1074
1203
|
throw new Arret(
|
|
@@ -1196,9 +1325,10 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1196
1325
|
}
|
|
1197
1326
|
reste.signeDeVie?.(vie);
|
|
1198
1327
|
};
|
|
1199
|
-
// The instruction of a resumption after the plan extended to a
|
|
1200
|
-
// session goes on
|
|
1328
|
+
// The instruction of a resumption after the plan extended to the file a BESOIN sheet names: the
|
|
1329
|
+
// session goes on, and the launch is neither a first nor a second. Each package extends once.
|
|
1201
1330
|
let etendu = null;
|
|
1331
|
+
const etendus = new Set();
|
|
1202
1332
|
// Whether the session already launched afresh for want of a conversation to resume, and
|
|
1203
1333
|
// whether this call launched it: the launch of a dead attempt is taken up as it is (`lancer`).
|
|
1204
1334
|
let repartie = false;
|
|
@@ -1237,10 +1367,12 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1237
1367
|
});
|
|
1238
1368
|
lancee = true;
|
|
1239
1369
|
etendu = null;
|
|
1370
|
+
// The lot of the session, judged as soon as it ends, whatever it ends on.
|
|
1371
|
+
const hors = estJuge(role, reste.horsEnveloppe) ? jugerLeLot(ctx, role) : null;
|
|
1240
1372
|
// The usage limit stops a session that does not end on its own: neither a sheet missing nor a
|
|
1241
1373
|
// sheet to resume, the circuit waits for the hour the usage returns (« limite-d-usage »).
|
|
1242
1374
|
const limite =
|
|
1243
|
-
|
|
1375
|
+
r.seance !== 0
|
|
1244
1376
|
? limiteDUsage({ resultat: r.sortie, journal: finDuJournal(ctx, avantLeJournal) })
|
|
1245
1377
|
: null;
|
|
1246
1378
|
if (limite) {
|
|
@@ -1250,23 +1382,7 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1250
1382
|
{ resultat: limite }
|
|
1251
1383
|
);
|
|
1252
1384
|
}
|
|
1253
|
-
|
|
1254
|
-
const extensionDesTests = suite?.etendreTests;
|
|
1255
|
-
if (extensionDesTests) {
|
|
1256
|
-
ctx.etendreTestsEnVol(extensionDesTests);
|
|
1257
|
-
courante = r.id ?? courante;
|
|
1258
|
-
etendu = `Le plan du ticket s'étend aux tests de ${extensionDesTests.paquet} (${extensionDesTests.piece}) : le crochet qui t'a arrêté sur ${extensionDesTests.chemin} le laisse maintenant passer, les fichiers de test de ce paquet seuls ; son code reste hors du plan. Reprends ta tâche là où il t'a arrêté.`;
|
|
1259
|
-
essai--;
|
|
1260
|
-
continue;
|
|
1261
|
-
}
|
|
1262
|
-
const extension = suite?.etendre;
|
|
1263
|
-
if (extension) {
|
|
1264
|
-
ctx.etendreEnVol(extension);
|
|
1265
|
-
courante = r.id ?? courante;
|
|
1266
|
-
etendu = `Le plan du ticket s'étend à ${extension.paquet} (${extension.piece}) : le crochet qui t'a arrêté sur ${extension.chemin} le laisse maintenant passer. Reprends ta tâche là où il t'a arrêté.`;
|
|
1267
|
-
essai--;
|
|
1268
|
-
continue;
|
|
1269
|
-
}
|
|
1385
|
+
seanceLancee(ctx, role, r);
|
|
1270
1386
|
courante = r.id ?? courante;
|
|
1271
1387
|
if (repli && r.seance !== 0) {
|
|
1272
1388
|
return null;
|
|
@@ -1282,6 +1398,25 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1282
1398
|
if (faute) {
|
|
1283
1399
|
lu = { erreur: lu.erreur ? `${lu.erreur} ; ${faute}` : `fiche non conforme : ${faute}` };
|
|
1284
1400
|
}
|
|
1401
|
+
// A role that writes nothing leaves an empty lot: its files go to the one resumption too.
|
|
1402
|
+
if (hors && reste.horsEnveloppe) {
|
|
1403
|
+
lu = { erreur: [lu.erreur, hors.rapport].filter(Boolean).join(' ; ') };
|
|
1404
|
+
}
|
|
1405
|
+
if (lu.fiche?.statut === 'BESOIN' && lu.fiche.manque && !reste.horsEnveloppe) {
|
|
1406
|
+
const demande = extensionDemandee(ctx, role, lu.fiche.manque);
|
|
1407
|
+
const extension = demande?.etendre ?? demande?.etendreTests;
|
|
1408
|
+
const etendre = demande?.etendre ? ctx.etendreEnVol : ctx.etendreTestsEnVol;
|
|
1409
|
+
if (extension && etendre && !etendus.has(extension.paquet)) {
|
|
1410
|
+
etendus.add(extension.paquet);
|
|
1411
|
+
garder(ctx, role, lu.fiche, avec);
|
|
1412
|
+
etendre(extension);
|
|
1413
|
+
etendu = demande.etendre
|
|
1414
|
+
? `Le plan du ticket s'étend à ${extension.paquet} (${extension.piece}) : ${extension.chemin} s'écrit maintenant. Reprends ta tâche là où tu l'as laissée.`
|
|
1415
|
+
: `Le plan du ticket s'étend aux tests de ${extension.paquet} (${extension.piece}) : ${extension.chemin} s'écrit maintenant, les fichiers de test de ce paquet seuls ; son code reste hors du plan. Reprends ta tâche là où tu l'as laissée.`;
|
|
1416
|
+
essai--;
|
|
1417
|
+
continue;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1285
1420
|
if (lu.fiche) {
|
|
1286
1421
|
// The session that gave it, which a resumption of it names (the plan's answer).
|
|
1287
1422
|
surLaSeance(courante);
|
|
@@ -1291,12 +1426,16 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1291
1426
|
commenter(ctx, role, `séance finie sans fiche conforme : ${lu.erreur} ; reprise une fois.`);
|
|
1292
1427
|
}
|
|
1293
1428
|
}
|
|
1294
|
-
throw
|
|
1429
|
+
throw arretQuiSeDit(
|
|
1295
1430
|
'sans-fiche',
|
|
1296
1431
|
`Deux fois, la séance du ${nomDuRole(role)} finit sans fiche conforme : ${lu.erreur}. Le journal du ticket : ${ctx.journal} (il se cite en pièce, \`${ctx.ticket}.log:<ligne>\`)`
|
|
1297
1432
|
);
|
|
1298
1433
|
}
|
|
1299
1434
|
|
|
1435
|
+
// The stop <nom> whose error message says its report too, for a caller that reads the error alone.
|
|
1436
|
+
const arretQuiSeDit = (nom, rapport) =>
|
|
1437
|
+
Object.assign(new Arret(nom, rapport), { message: `${nom} : ${rapport}` });
|
|
1438
|
+
|
|
1300
1439
|
// The sheet of schema <sorte> (a role's, or the tri's) in the output <sortie> of its session
|
|
1301
1440
|
// (`lireFiche`), each file piece of it checked in the ticket's copy, or in the main tree before the
|
|
1302
1441
|
// copy exists and once the integration removed it, and each piece of the ticket in its description.
|
|
@@ -1330,6 +1469,205 @@ export function garder(ctx, role, fiche, avec) {
|
|
|
1330
1469
|
return fiche;
|
|
1331
1470
|
}
|
|
1332
1471
|
|
|
1472
|
+
// The judgment of the lot (machine.md §5.5), as CODEOWNERS judges a change by the files it
|
|
1473
|
+
// touches, whatever tool wrote them. The lot of a session is what it creates, changes or removes
|
|
1474
|
+
// in the folder it works in, read on content between the tree the folder held before it (`avant`,
|
|
1475
|
+
// which lancer.sh takes once the copy is prepared; else the circuit's, before the launch) and the
|
|
1476
|
+
// tree it holds after it, `.beads/`, the files git ignores and the circuit's copies aside. In the
|
|
1477
|
+
// main tree, which others write, each session is judged on what changes during it, a commit
|
|
1478
|
+
// entered meanwhile aside. In a ticket's copy, a commit of the session takes nothing out of the
|
|
1479
|
+
// lot, and a faulty file stays named until it is back to its state before the session that
|
|
1480
|
+
// changed it (or to main's, once main changed it): the circuit keeps them by role in the working
|
|
1481
|
+
// directory of the ticket (`lot-<rôle>.json`: the session under way `enCours`, the faulty files
|
|
1482
|
+
// `fautifs`), so that neither a session that leaves them nor an act played again lets them pass.
|
|
1483
|
+
// The judgment runs on the installed frame; it reads the languages of the copy, else, when they do
|
|
1484
|
+
// not load there, those of the main tree, and it fails closed when neither loads.
|
|
1485
|
+
|
|
1486
|
+
// The authors of a circuit whose lot is judged on their rule; the agent direct writes tests and
|
|
1487
|
+
// code, and its lot is not judged. Every other judged session writes nothing: an empty lot.
|
|
1488
|
+
const AUTEURS_JUGES = new Set(['testwriter', 'developpeur']);
|
|
1489
|
+
|
|
1490
|
+
const estJuge = (role, horsEnveloppe) => Boolean(horsEnveloppe) || AUTEURS_JUGES.has(role);
|
|
1491
|
+
|
|
1492
|
+
// The head of the report of a lot out of the rule.
|
|
1493
|
+
const TITRE_DU_LOT = 'Le lot de la séance sort de la règle de son rôle';
|
|
1494
|
+
|
|
1495
|
+
const REGLES_DU_LOT = {
|
|
1496
|
+
testwriter:
|
|
1497
|
+
'le testwriter n’écrit que ses fichiers de test, la matière de test partagée, la part de ses tests d’un manifeste et les fichiers de verrou des versions',
|
|
1498
|
+
developpeur: 'le développeur n’écrit ni un fichier de test ni la matière de test partagée',
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
const fichierDuLot = (ctx, role) => path.join(ctx.tmp, `lot-${role}.json`);
|
|
1502
|
+
|
|
1503
|
+
const lotGarde = (ctx, role) =>
|
|
1504
|
+
existsSync(fichierDuLot(ctx, role))
|
|
1505
|
+
? JSON.parse(lire(fichierDuLot(ctx, role)))
|
|
1506
|
+
: { depot: null, enCours: null, fautifs: {} };
|
|
1507
|
+
|
|
1508
|
+
const garderLeLot = (ctx, role, lot) => {
|
|
1509
|
+
mkdirSync(ctx.tmp, { recursive: true });
|
|
1510
|
+
writeFileSync(fichierDuLot(ctx, role), `${JSON.stringify(lot)}\n`);
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
const estLArbrePrincipal = (ctx, depot) => path.resolve(depot) === path.resolve(ctx.racine);
|
|
1514
|
+
|
|
1515
|
+
const teteDe = depot =>
|
|
1516
|
+
spawnSync('git', ['-C', depot, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).stdout.trim();
|
|
1517
|
+
|
|
1518
|
+
// Notes the session <id> of <role> about to work in <depot>, the tree it holds now.
|
|
1519
|
+
function ouvrirLeLot(ctx, role, { id, horsEnveloppe, depot }) {
|
|
1520
|
+
const lot = lotGarde(ctx, role);
|
|
1521
|
+
garderLeLot(ctx, role, {
|
|
1522
|
+
depot,
|
|
1523
|
+
enCours: {
|
|
1524
|
+
id,
|
|
1525
|
+
horsEnveloppe: Boolean(horsEnveloppe),
|
|
1526
|
+
avant: existsSync(depot) ? photographier(depot) : null,
|
|
1527
|
+
principal: teteDe(ctx.racine),
|
|
1528
|
+
},
|
|
1529
|
+
fautifs: estLArbrePrincipal(ctx, depot) ? {} : lot.fautifs,
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
// The tree the session `enCours` started from: the launcher's, taken after its preparation; else
|
|
1534
|
+
// the circuit's, for a session out of the envelope, or one that ran to its end. Null for a launch
|
|
1535
|
+
// that stopped before its session.
|
|
1536
|
+
function avantLaSeance(ctx, enCours) {
|
|
1537
|
+
const rang = rangDeLaSeance(ctx, enCours.id);
|
|
1538
|
+
if (existsSync(rang.avant)) {
|
|
1539
|
+
return JSON.parse(lire(rang.avant));
|
|
1540
|
+
}
|
|
1541
|
+
return enCours.horsEnveloppe || existsSync(rang.fin) ? enCours.avant : null;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Judges the lot of <role> (the section's header): the session under way, once, then each faulty
|
|
1546
|
+
* file kept, on the tree the folder holds now. Returns `{ fichiers, rapport }`, or null for a lot
|
|
1547
|
+
* in the rule of its role. Throws an Arret when no tree says which languages judge the lot.
|
|
1548
|
+
* @returns {{ fichiers: string[], rapport: string } | null}
|
|
1549
|
+
*/
|
|
1550
|
+
function jugerLeLot(ctx, role) {
|
|
1551
|
+
const lot = lotGarde(ctx, role);
|
|
1552
|
+
const { depot, enCours } = lot;
|
|
1553
|
+
if (!depot || !existsSync(depot)) {
|
|
1554
|
+
return null;
|
|
1555
|
+
}
|
|
1556
|
+
const principal = estLArbrePrincipal(ctx, depot);
|
|
1557
|
+
const avant = enCours ? avantLaSeance(ctx, enCours) : null;
|
|
1558
|
+
const apres = avant || !principal ? photographier(depot) : null;
|
|
1559
|
+
if (avant && apres) {
|
|
1560
|
+
const entres = new Set(
|
|
1561
|
+
principal && avant.tete !== apres.tete
|
|
1562
|
+
? changements(depot, avant.tete, apres.tete).map(c => c.chemin)
|
|
1563
|
+
: []
|
|
1564
|
+
);
|
|
1565
|
+
for (const c of changements(depot, avant.arbre, apres.arbre)) {
|
|
1566
|
+
if (entres.has(c.chemin) && c.apres === etatDuFichier(depot, apres.tete, c.chemin)) {
|
|
1567
|
+
continue;
|
|
1568
|
+
}
|
|
1569
|
+
lot.fautifs[c.chemin] ??= { avant: c.avant, principal: enCours.principal };
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
if (apres) {
|
|
1573
|
+
for (const [chemin, f] of Object.entries(lot.fautifs)) {
|
|
1574
|
+
const etat = etatDuFichier(depot, apres.arbre, chemin);
|
|
1575
|
+
const faute =
|
|
1576
|
+
!principal && revenuAMain(ctx, chemin, f.principal, etat)
|
|
1577
|
+
? null
|
|
1578
|
+
: fauteDuFichier(ctx, role, depot, { chemin, avant: f.avant, apres: etat });
|
|
1579
|
+
if (faute) {
|
|
1580
|
+
f.parties = faute.parties;
|
|
1581
|
+
} else {
|
|
1582
|
+
delete lot.fautifs[chemin];
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
garderLeLot(ctx, role, { ...lot, enCours: null });
|
|
1587
|
+
const fautifs = Object.entries(lot.fautifs).sort(([a], [b]) => a.localeCompare(b));
|
|
1588
|
+
if (!fautifs.length) {
|
|
1589
|
+
return null;
|
|
1590
|
+
}
|
|
1591
|
+
const regle = REGLES_DU_LOT[role] ?? 'ce rôle n’écrit rien, son lot reste vide';
|
|
1592
|
+
const lignes = fautifs.map(
|
|
1593
|
+
([chemin, f]) =>
|
|
1594
|
+
`- ${chemin}${f.parties ? ` (hors de la part de ses tests : ${f.parties.join(', ')})` : ''}`
|
|
1595
|
+
);
|
|
1596
|
+
const geste = principal
|
|
1597
|
+
? 'D’autres écrivent l’arbre principal : défais seulement ce que tu as toi-même écrit.'
|
|
1598
|
+
: 'Remets chacun à son état d’avant la séance qui l’a changé.';
|
|
1599
|
+
return {
|
|
1600
|
+
fichiers: fautifs.map(([chemin]) => chemin),
|
|
1601
|
+
rapport: `${TITRE_DU_LOT} : ${regle}.\n${lignes.join('\n')}\n${geste}`,
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
// Whether the file <chemin> of a copy, in the state <etat>, is back to main's after main changed it
|
|
1606
|
+
// since <depuis>: what the advance of the copy brings is no work of a session.
|
|
1607
|
+
function revenuAMain(ctx, chemin, depuis, etat) {
|
|
1608
|
+
const tete = teteDe(ctx.racine);
|
|
1609
|
+
return (
|
|
1610
|
+
tete !== depuis &&
|
|
1611
|
+
etatDuFichier(ctx.racine, tete, chemin) === etat &&
|
|
1612
|
+
etatDuFichier(ctx.racine, depuis, chemin) !== etat
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// What puts the change <c> of a file of <depot> out of the rule of <role>: `{ parties }`, the parts
|
|
1617
|
+
// of a manifest out of its tests' (null for a whole file), or null for a change in the rule.
|
|
1618
|
+
function fauteDuFichier(ctx, role, depot, c) {
|
|
1619
|
+
if (c.avant === c.apres) {
|
|
1620
|
+
return null;
|
|
1621
|
+
}
|
|
1622
|
+
const entier = { parties: null };
|
|
1623
|
+
if (!AUTEURS_JUGES.has(role)) {
|
|
1624
|
+
return entier;
|
|
1625
|
+
}
|
|
1626
|
+
return selonLesLangages(ctx, depot, (langage, racine) => {
|
|
1627
|
+
const abs = path.join(racine, c.chemin);
|
|
1628
|
+
const classe = langage.estUnTest(abs, racine);
|
|
1629
|
+
if (role === 'developpeur') {
|
|
1630
|
+
return classe ? entier : null;
|
|
1631
|
+
}
|
|
1632
|
+
// A reader package the plan extended to its tests: its test files alone.
|
|
1633
|
+
const lecteur = (ctx.testsEtendus ?? []).find(d => c.chemin.startsWith(`${d}/`));
|
|
1634
|
+
if (lecteur && !dansLePlan(ctx, lecteur)) {
|
|
1635
|
+
return classe?.test ? null : entier;
|
|
1636
|
+
}
|
|
1637
|
+
if (classe || langage.manifestes.verrous.includes(c.chemin)) {
|
|
1638
|
+
return null;
|
|
1639
|
+
}
|
|
1640
|
+
const parties =
|
|
1641
|
+
c.apres === null
|
|
1642
|
+
? null
|
|
1643
|
+
: langage.manifestes.horsDesTests(
|
|
1644
|
+
abs,
|
|
1645
|
+
racine,
|
|
1646
|
+
texteDeLEtat(depot, c.avant),
|
|
1647
|
+
texteDeLEtat(depot, c.apres)
|
|
1648
|
+
);
|
|
1649
|
+
return parties?.length === 0 ? null : { parties };
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
// `juger(langage, racine)` on the languages of <depot>, else on those of the main tree; an Arret
|
|
1654
|
+
// that names the version of the frame, the two causes and the main tree when neither loads.
|
|
1655
|
+
function selonLesLangages(ctx, depot, juger) {
|
|
1656
|
+
try {
|
|
1657
|
+
return juger(langageDe(depot), depot);
|
|
1658
|
+
} catch (ici) {
|
|
1659
|
+
try {
|
|
1660
|
+
return juger(langageDe(ctx.racine), ctx.racine);
|
|
1661
|
+
} catch (la) {
|
|
1662
|
+
const { version } = JSON.parse(lire(path.join(import.meta.dirname, '..', 'package.json')));
|
|
1663
|
+
throw arretQuiSeDit(
|
|
1664
|
+
'inattendu',
|
|
1665
|
+
`Le lot n'est pas jugé, et l'étape ne passe pas : la version ${version} du cadre ne charge les langages ni de la copie (${depot} : ${ici.message}) ni de l'arbre principal (${ctx.racine} : ${la.message}). L'arbre principal se répare par le superviseur, hors séance d'agent.`
|
|
1666
|
+
);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1333
1671
|
// The findings <constats> as an agent's instruction carries them, each under its heading, with
|
|
1334
1672
|
// what it holds, its body and its piece, numbered after <avant>; « aucun » without one.
|
|
1335
1673
|
export const texteDesOuverts = (constats, avant = 0) =>
|