@roomi-fields/grillhouse 0.29.0 → 0.30.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 +739 -0
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +609 -80
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +134 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +7 -3
- package/scripts/avancement.mjs +128 -16
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +881 -4059
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +16 -12
- package/scripts/conformite.mjs +6 -13
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -1
- package/scripts/etapes.mjs +5 -2
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/integration/file.mjs +475 -420
- package/scripts/integration/integrer.mjs +17 -19
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +145 -27
- package/scripts/langages/cargo/commandes.mjs +289 -109
- package/scripts/langages/cargo/composants.mjs +130 -34
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +18 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/python/commandes.mjs +216 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +24 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +43 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +12 -9
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +31 -11
- package/scripts/langages/typescript/vitest-config/base.mjs +22 -1
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +49 -63
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +3 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/mesure/pression.mjs +3 -3
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +10 -3
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +7 -9
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +26 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +38 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +148 -110
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +28 -13
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +4 -2
- package/skills/testwriter/SKILL.md +36 -24
- package/scripts/demon.mjs +0 -251
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
// The external effects of the circuit, as data, and their one writer (docs/ARCHITECTURE.md, the
|
|
2
|
+
// workflow of a ticket: « une activité, un effet, une clé »), as a functional core hands its
|
|
3
|
+
// imperative shell what to write. The code of the circuit that the workflow of a ticket runs
|
|
4
|
+
// (scripts/circuit.mjs, scripts/seances.mjs, scripts/activites.mjs, scripts/ticket-du-circuit.mjs),
|
|
5
|
+
// and the queue of a project its comments (scripts/integration/file.mjs), write nothing outside
|
|
6
|
+
// themselves: it emits each effect (`emettre`). An effect emitted outside an act is played
|
|
7
|
+
// at once (`jouerLEffet`, without a key); an act of the workflow gathers
|
|
8
|
+
// them in `ctx.rendus` and gives them back with its outcome (scripts/faits-du-circuit.mjs), its
|
|
9
|
+
// own readings seeing those it already emitted (`rendusDe`), and the workflow plays each one in an
|
|
10
|
+
// activity of its own, under the key of that activity (src/temporal/acte.ts `cleDeLActivite`).
|
|
11
|
+
//
|
|
12
|
+
// The effects, `{ genre, ... }`:
|
|
13
|
+
//
|
|
14
|
+
// - `commentaire` `{ ticket, texte, auteur }`: a comment at a ticket, by its author;
|
|
15
|
+
// - `fiche` `{ entree }`: a line of the ticket's sheets (`<ticket>.fiches.jsonl`), dated;
|
|
16
|
+
// - `decouverte` `{ role, sujet, corps, composants }`: a discovery filed closed under the ticket
|
|
17
|
+
// (scripts/ticket.sh, label `decouverte`), then its line among the sheets (`{ id, sujet }`);
|
|
18
|
+
// - `registre` `{ ligne }`: a line of the register of the steps (scripts/registre.mjs);
|
|
19
|
+
// - `etat` `{ etat }`: the circuit's state, which the workflow of a ticket holds and no player writes
|
|
20
|
+
// (src/temporal/circuit/deroule.ts);
|
|
21
|
+
// - `plan` `{ titre, description }`: the plan written at the ticket (its title, its description);
|
|
22
|
+
// - `bilan` `{ ticket }`: the bilan of the ticket computed when it is written, once the effects
|
|
23
|
+
// before it are, kept in the main tree, and its text at the ticket (scripts/bilan.mjs
|
|
24
|
+
// `ecrireLeBilan`), its key in the comment;
|
|
25
|
+
// - `resume-du-tri` `{ ticket, debut, ecritures }`: the line of the tri at the ticket, which reads
|
|
26
|
+
// each discovery's writings when it is written (`{ decouverte, verdict, etiquettes, rouvre }`:
|
|
27
|
+
// its comment, its labels, its reopening), its key in the comment;
|
|
28
|
+
// - `etiquettes` `{ ticket, etiquettes }`: labels added to a ticket;
|
|
29
|
+
// - `reouverture` `{ ticket }`: a ticket reopened.
|
|
30
|
+
//
|
|
31
|
+
// An effect that does not replay without harm carries the key it is played under (`AVEC_CLE`),
|
|
32
|
+
// and is read before it is written: a comment holds it in a line of HTML comment, a line of the
|
|
33
|
+
// sheets or of the register in a field `cle`, a discovery in its body. Every other effect writes
|
|
34
|
+
// the same thing however often it is played: it takes no key. Each player returns `{ status,
|
|
35
|
+
// stderr }`, as bd does; an effect not written has one outcome
|
|
36
|
+
// (`ecrireLEffet`): said on the error output, or a stop.
|
|
37
|
+
import { spawnSync } from 'node:child_process';
|
|
38
|
+
import { appendFileSync, existsSync, readFileSync } from 'node:fs';
|
|
39
|
+
import path from 'node:path';
|
|
40
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
41
|
+
import { ecrireLeBilan } from './bilan.mjs';
|
|
42
|
+
import { ecrire as ecrireAuRegistre } from './registre.mjs';
|
|
43
|
+
|
|
44
|
+
/** The line of HTML comment that carries the key <cle> in a text at a ticket. */
|
|
45
|
+
export const marqueDeCle = cle => `<!-- grillhouse : ${cle} -->`;
|
|
46
|
+
|
|
47
|
+
/** The effects that do not replay without harm: each carries its key. */
|
|
48
|
+
export const AVEC_CLE = new Set([
|
|
49
|
+
'commentaire',
|
|
50
|
+
'fiche',
|
|
51
|
+
'decouverte',
|
|
52
|
+
'registre',
|
|
53
|
+
'bilan',
|
|
54
|
+
'resume-du-tri',
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
// The variable in which bd reads the author of a comment (`bd --help`: « default: $BEADS_ACTOR,
|
|
58
|
+
// git user.name, $USER »), each session's its role; the author of the circuit's own lines, and
|
|
59
|
+
// the start of each of them at a ticket.
|
|
60
|
+
export const ACTEUR = 'BEADS_ACTOR';
|
|
61
|
+
export const AUTEUR_DU_CIRCUIT = 'circuit';
|
|
62
|
+
export const PREFIXE = 'Circuit · ';
|
|
63
|
+
const TICKET_SH = path.join(import.meta.dirname, 'ticket.sh');
|
|
64
|
+
|
|
65
|
+
const ok = { status: 0, stdout: '', stderr: '' };
|
|
66
|
+
// A failure of a player, as bd answers one.
|
|
67
|
+
const echec = stderr => ({ status: 1, stdout: '', stderr });
|
|
68
|
+
|
|
69
|
+
/** <t> without its colours. */
|
|
70
|
+
export const sansCouleurs = t => stripVTControlCharacters(String(t ?? ''));
|
|
71
|
+
/** The first line of <t>, without its colours, 300 characters at most. */
|
|
72
|
+
export const premiereLigne = t => sansCouleurs(t).trim().split('\n')[0].slice(0, 300);
|
|
73
|
+
|
|
74
|
+
/** An effect not written that Temporal tries again: its activity's failure is retryable. */
|
|
75
|
+
export class EffetNonEcrit extends Error {
|
|
76
|
+
constructor(message) {
|
|
77
|
+
super(message);
|
|
78
|
+
this.reessayable = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// The JSON answer of bd <r>, or the failure of its reading: bd that fails, or answers what does
|
|
83
|
+
// not parse.
|
|
84
|
+
function lu(r, quoi) {
|
|
85
|
+
if (r.status !== 0) {
|
|
86
|
+
return { echec: echec(`${quoi} illisibles : ${r.stderr ?? ''}`.trim()) };
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
return { valeur: JSON.parse(r.stdout || '[]') };
|
|
90
|
+
} catch (e) {
|
|
91
|
+
return { echec: echec(`${quoi} illisibles : ${e.message}`) };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The effect <effet> of <ctx> emitted: gathered in `ctx.rendus` under an act of the workflow,
|
|
97
|
+
* else played at once (`jouerLEffet`, without a key). What its player returns (`{ status }`), and
|
|
98
|
+
* success when it is gathered.
|
|
99
|
+
*/
|
|
100
|
+
export function emettre(ctx, effet) {
|
|
101
|
+
if (ctx.rendus) {
|
|
102
|
+
ctx.rendus.push(effet);
|
|
103
|
+
return ok;
|
|
104
|
+
}
|
|
105
|
+
return ecrireLEffet(ctx, effet, null);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The effects of the sort <genre> <ctx> emitted and not yet played, in their order. */
|
|
109
|
+
export const rendusDe = (ctx, genre) => (ctx.rendus ?? []).filter(e => e.genre === genre);
|
|
110
|
+
|
|
111
|
+
// bd under the author <auteur>, in the main tree of <ctx>.
|
|
112
|
+
const bdSous = (ctx, auteur, ...a) => (ctx.bdSous ? ctx.bdSous(auteur, ...a) : ctx.bd(...a));
|
|
113
|
+
|
|
114
|
+
// The lines of the file <f> parsed, a torn one left out.
|
|
115
|
+
const lignes = f =>
|
|
116
|
+
(existsSync(f) ? readFileSync(f, 'utf8') : '').split('\n').flatMap(l => {
|
|
117
|
+
try {
|
|
118
|
+
return l ? [JSON.parse(l)] : [];
|
|
119
|
+
} catch {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Whether a comment at <ticket> of <ctx> already holds the mark of <cle>, or the failure of its
|
|
125
|
+
// reading.
|
|
126
|
+
function dejaCommente(ctx, ticket, cle) {
|
|
127
|
+
const r = lu(ctx.bd('comments', ticket, '--json'), `commentaires de ${ticket}`);
|
|
128
|
+
if (r.echec) {
|
|
129
|
+
return r.echec;
|
|
130
|
+
}
|
|
131
|
+
const marque = marqueDeCle(cle);
|
|
132
|
+
return (r.valeur ?? []).some(c => String(c?.text ?? '').includes(marque));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// The id of the discovery filed under the ticket of <ctx> whose body holds the mark of <cle>, '',
|
|
136
|
+
// or the failure of its reading.
|
|
137
|
+
function decouverteDeLaCle(ctx, cle) {
|
|
138
|
+
const r = lu(
|
|
139
|
+
ctx.bd('list', '--parent', ctx.ticket, '--all', '--desc-contains', marqueDeCle(cle), '--json'),
|
|
140
|
+
`découvertes de ${ctx.ticket}`
|
|
141
|
+
);
|
|
142
|
+
if (r.echec) {
|
|
143
|
+
return r.echec;
|
|
144
|
+
}
|
|
145
|
+
return r.valeur?.[0]?.id ?? '';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// The line <entree> among the sheets of <ctx>, under the key <cle> (null without one), once.
|
|
149
|
+
function ficheUneFois(ctx, entree, cle) {
|
|
150
|
+
if (cle && lignes(ctx.fiches).some(e => e.cle === cle)) {
|
|
151
|
+
return ok;
|
|
152
|
+
}
|
|
153
|
+
appendFileSync(ctx.fiches, `${JSON.stringify({ ...entree, ...(cle ? { cle } : {}) })}\n`);
|
|
154
|
+
return ok;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// The comment <texte> at <ticket> of <ctx> by <auteur>, under the key <cle> (null without one),
|
|
158
|
+
// once.
|
|
159
|
+
function commenterUneFois(ctx, { ticket, texte, auteur }, cle) {
|
|
160
|
+
const deja = cle ? dejaCommente(ctx, ticket, cle) : false;
|
|
161
|
+
if (deja) {
|
|
162
|
+
return deja === true ? ok : deja;
|
|
163
|
+
}
|
|
164
|
+
return bdSous(
|
|
165
|
+
ctx,
|
|
166
|
+
auteur ?? AUTEUR_DU_CIRCUIT,
|
|
167
|
+
'comments',
|
|
168
|
+
'add',
|
|
169
|
+
ticket,
|
|
170
|
+
cle ? `${texte}\n\n${marqueDeCle(cle)}` : texte
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// The players, by sort, each on <ctx>, the effect and its key (null without one).
|
|
175
|
+
const JOUEURS = {
|
|
176
|
+
commentaire: commenterUneFois,
|
|
177
|
+
fiche(ctx, { entree }, cle) {
|
|
178
|
+
return ficheUneFois(ctx, entree, cle);
|
|
179
|
+
},
|
|
180
|
+
decouverte(ctx, { role, sujet, corps, composants }, cle) {
|
|
181
|
+
let id = cle ? decouverteDeLaCle(ctx, cle) : '';
|
|
182
|
+
if (typeof id !== 'string') {
|
|
183
|
+
return id;
|
|
184
|
+
}
|
|
185
|
+
if (!id) {
|
|
186
|
+
const r = spawnSync(
|
|
187
|
+
'bash',
|
|
188
|
+
[
|
|
189
|
+
TICKET_SH,
|
|
190
|
+
ctx.ticket,
|
|
191
|
+
sujet,
|
|
192
|
+
composants,
|
|
193
|
+
cle ? `${corps}\n\n${marqueDeCle(cle)}` : corps,
|
|
194
|
+
'decouverte',
|
|
195
|
+
],
|
|
196
|
+
{ cwd: ctx.racine, encoding: 'utf8', env: { ...process.env, [ACTEUR]: AUTEUR_DU_CIRCUIT } }
|
|
197
|
+
);
|
|
198
|
+
id = r.status === 0 ? r.stdout.trim().split('\n').at(-1) : '';
|
|
199
|
+
if (!id) {
|
|
200
|
+
return { status: r.status || 1, stdout: '', stderr: r.stderr ?? '' };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// Filed, its line among the sheets not written stops (a writing of the sheets).
|
|
204
|
+
return ficheUneFois(
|
|
205
|
+
ctx,
|
|
206
|
+
{ date: new Date().toISOString(), role, decouverte: { id, sujet } },
|
|
207
|
+
cle
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
registre(_ctx, { ligne }, cle) {
|
|
211
|
+
try {
|
|
212
|
+
ecrireAuRegistre({ ...ligne, ...(cle ? { cle } : {}) });
|
|
213
|
+
return ok;
|
|
214
|
+
} catch (e) {
|
|
215
|
+
return echec(e.message);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
plan(ctx, { titre, description }) {
|
|
219
|
+
const options = [
|
|
220
|
+
...(titre === null ? [] : ['--title', titre]),
|
|
221
|
+
...(description === null ? [] : ['-d', description]),
|
|
222
|
+
];
|
|
223
|
+
return options.length ? ctx.bd('update', ctx.ticket, ...options) : ok;
|
|
224
|
+
},
|
|
225
|
+
bilan(ctx, { ticket, fin }, cle) {
|
|
226
|
+
let texte;
|
|
227
|
+
try {
|
|
228
|
+
texte = ecrireLeBilan(ctx.racine, ticket, fin ?? null);
|
|
229
|
+
} catch (e) {
|
|
230
|
+
return echec(e.message);
|
|
231
|
+
}
|
|
232
|
+
return commenterUneFois(
|
|
233
|
+
ctx,
|
|
234
|
+
{ ticket, texte: `${PREFIXE}bilan : ${texte}`, auteur: AUTEUR_DU_CIRCUIT },
|
|
235
|
+
cle
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
// The line of the tri, written once its writings are: each discovery read now (its comments,
|
|
239
|
+
// its labels, its status), a writing absent named among those that failed, a ticket to reopen
|
|
240
|
+
// not open not counted, so that the line says what the tickets are.
|
|
241
|
+
'resume-du-tri'(ctx, { ticket, debut, ecritures }, cle) {
|
|
242
|
+
const rouvertes = [];
|
|
243
|
+
const rates = [];
|
|
244
|
+
// The cause bd gave for a writing of <genre> at <decouverte> that failed (`ecrireLEffet`).
|
|
245
|
+
const echecs = lignes(ctx.fiches).filter(e => e.echec);
|
|
246
|
+
const cause = (genre, decouverte) =>
|
|
247
|
+
echecs.findLast(e => e.echec.genre === genre && e.echec.ticket === decouverte)?.echec.raison;
|
|
248
|
+
for (const { decouverte, verdict, etiquettes, rouvre } of ecritures) {
|
|
249
|
+
const ici = [];
|
|
250
|
+
const montre = lu(ctx.bd('show', decouverte, '--json'), `ticket ${decouverte}`);
|
|
251
|
+
const t = montre.valeur?.[0] ?? null;
|
|
252
|
+
const dits = lu(ctx.bd('comments', decouverte, '--json'), `commentaires de ${decouverte}`);
|
|
253
|
+
if (dits.echec) {
|
|
254
|
+
ici.push(`verdict (${premiereLigne(dits.echec.stderr)})`);
|
|
255
|
+
} else if (!(dits.valeur ?? []).some(c => String(c?.text ?? '').startsWith(verdict))) {
|
|
256
|
+
ici.push(`verdict (${cause('commentaire', decouverte) ?? 'absent'})`);
|
|
257
|
+
}
|
|
258
|
+
if (montre.echec) {
|
|
259
|
+
ici.push(`étiquette (${premiereLigne(montre.echec.stderr)})`);
|
|
260
|
+
} else if (!etiquettes.every(e => (t?.labels ?? []).includes(e))) {
|
|
261
|
+
ici.push(`étiquette (${cause('etiquettes', decouverte) ?? 'absente'})`);
|
|
262
|
+
}
|
|
263
|
+
if (rouvre) {
|
|
264
|
+
if (t?.status && t.status !== 'closed') {
|
|
265
|
+
rouvertes.push(decouverte);
|
|
266
|
+
} else {
|
|
267
|
+
const pourquoi = montre.echec
|
|
268
|
+
? premiereLigne(montre.echec.stderr)
|
|
269
|
+
: (cause('reouverture', decouverte) ?? 'toujours fermée');
|
|
270
|
+
ici.push(`réouverture (${pourquoi})`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (ici.length) {
|
|
274
|
+
rates.push(`${decouverte} : ${ici.join(', ')}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const texte = `${debut} ; ${rouvertes.length ? `rouvertes sous a-valider : ${rouvertes.join(', ')}` : 'aucune rouverte'}${rates.length ? ` ; écritures en échec : ${rates.join(' ; ')}` : ''}.`;
|
|
278
|
+
return commenterUneFois(ctx, { ticket, texte, auteur: AUTEUR_DU_CIRCUIT }, cle);
|
|
279
|
+
},
|
|
280
|
+
etiquettes(ctx, { ticket, etiquettes }) {
|
|
281
|
+
return ctx.bd('update', ticket, ...etiquettes.flatMap(e => ['--add-label', e]));
|
|
282
|
+
},
|
|
283
|
+
reouverture(ctx, { ticket }) {
|
|
284
|
+
const r = ctx.bd('show', ticket, '--json');
|
|
285
|
+
const statut = lu(r, `ticket ${ticket}`).valeur?.[0]?.status ?? null;
|
|
286
|
+
return statut && statut !== 'closed' ? ok : ctx.bd('reopen', ticket);
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The effect <effet> written for <ctx>, under the key <cle> when its sort takes one (`AVEC_CLE`;
|
|
292
|
+
* null plays it without, as an effect emitted outside an act): what its player returns,
|
|
293
|
+
* `{ status, stderr }`.
|
|
294
|
+
*/
|
|
295
|
+
export function jouerLEffet(ctx, effet, cle) {
|
|
296
|
+
const joueur = JOUEURS[effet?.genre];
|
|
297
|
+
if (!joueur) {
|
|
298
|
+
throw new Error(`effet inconnu du circuit : ${effet?.genre}`);
|
|
299
|
+
}
|
|
300
|
+
return joueur(ctx, effet, AVEC_CLE.has(effet.genre) ? (cle ?? null) : null);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// The effects whose failure the circuit goes on past: what the line on the error output says is
|
|
304
|
+
// not written. Every other effect not written stops (the state, a line of the sheets, the plan, a
|
|
305
|
+
// question read).
|
|
306
|
+
const DIT_SANS_ARRETER = {
|
|
307
|
+
commentaire: e => `commentaire non écrit au ticket ${e.ticket}`,
|
|
308
|
+
decouverte: e => `découverte « ${e.sujet} » non consignée`,
|
|
309
|
+
registre: () => 'registre non écrit',
|
|
310
|
+
bilan: e => `bilan non écrit au ticket ${e.ticket}`,
|
|
311
|
+
etiquettes: e => `étiquettes non posées sur ${e.ticket}`,
|
|
312
|
+
'resume-du-tri': e => `ligne du tri non écrite au ticket ${e.ticket}`,
|
|
313
|
+
reouverture: e => `${e.ticket} non rouvert`,
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* The effect <effet> written for <ctx> under the key <cle> (`jouerLEffet`), with one outcome,
|
|
318
|
+
* emitted outside an act (`emettre`) or played by an activity of the workflow: an effect the
|
|
319
|
+
* circuit goes on past (`DIT_SANS_ARRETER`) not written is said on the error output, its cause kept among
|
|
320
|
+
* the sheets of the ticket (`echec`, which the line of the tri reads), and its `{ status, stderr }`
|
|
321
|
+
* returned; any other not written throws. Under an activity Temporal tries again
|
|
322
|
+
* (<reessayer>, before its last attempt), an effect not written throws, so that a passing
|
|
323
|
+
* failure is tried again, and it is said at the last attempt only.
|
|
324
|
+
*/
|
|
325
|
+
export function ecrireLEffet(ctx, effet, cle, { reessayer = false } = {}) {
|
|
326
|
+
const r = jouerLEffet(ctx, effet, cle);
|
|
327
|
+
if (r.status === 0) {
|
|
328
|
+
return r;
|
|
329
|
+
}
|
|
330
|
+
const raison = String(r.stderr ?? '').trim() || `code ${r.status}`;
|
|
331
|
+
const dit = DIT_SANS_ARRETER[effet.genre];
|
|
332
|
+
if (!dit) {
|
|
333
|
+
throw new Error(`effet ${effet.genre} non écrit : ${raison}`);
|
|
334
|
+
}
|
|
335
|
+
if (reessayer) {
|
|
336
|
+
throw new EffetNonEcrit(`effet ${effet.genre} non écrit : ${raison}`);
|
|
337
|
+
}
|
|
338
|
+
process.stderr.write(`⚠️ ${dit(effet)} : ${raison}\n`);
|
|
339
|
+
// Its cause kept among the sheets of the ticket, which the line of the tri names.
|
|
340
|
+
if (ctx.fiches) {
|
|
341
|
+
ficheUneFois(
|
|
342
|
+
ctx,
|
|
343
|
+
{
|
|
344
|
+
date: new Date().toISOString(),
|
|
345
|
+
role: AUTEUR_DU_CIRCUIT,
|
|
346
|
+
echec: { genre: effet.genre, ticket: effet.ticket ?? null, raison: premiereLigne(raison) },
|
|
347
|
+
},
|
|
348
|
+
null
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
return r;
|
|
352
|
+
}
|
|
@@ -33,6 +33,9 @@
|
|
|
33
33
|
// `~/.claude`, `~/.claude.json`, the npm cache, the paths of `MAISON_EN_LECTURE` (claude, node,
|
|
34
34
|
// git and the session's tools) and the repository. No socket of the session comes back. Of
|
|
35
35
|
// the machine's credentials, only claude's own are in sight.
|
|
36
|
+
// - A project that names its published version (`grillhouse.outil`) gets `~/.cache/grillhouse/outil`
|
|
37
|
+
// read-only, the version installed by the envelope before the session starts: the write lock
|
|
38
|
+
// runs on that version, never on the code of the copy it guards.
|
|
36
39
|
// - The tools of the project (`grillhouse.outils` of the package.json of the main tree, never of
|
|
37
40
|
// the copy, so that an agent never opens a path for its next session; `{ "<VARIABLE>":
|
|
38
41
|
// "<chemin>" }`, read by scripts/outils-cles.mjs), as Bazel declares what an action sees out of
|
|
@@ -122,7 +125,10 @@ import {
|
|
|
122
125
|
} from './paquets-du-plan.mjs';
|
|
123
126
|
|
|
124
127
|
export { paquetsDuLangage };
|
|
128
|
+
import { cacheDesOutils, installer, versionDeLOutil } from '../aiguillage.mjs';
|
|
125
129
|
import { ouvrirBase } from '../mesure/base-de-passe.mjs';
|
|
130
|
+
import { travailleursDe, VARIABLE_TENUE } from '../places-de-la-machine.mjs';
|
|
131
|
+
import { donneesDe } from '../donnees-cles.mjs';
|
|
126
132
|
import { outilsDe } from '../outils-cles.mjs';
|
|
127
133
|
|
|
128
134
|
// The role that writes the package of the shared test material and the lock files of the versions.
|
|
@@ -176,7 +182,9 @@ const MAISON_EN_LECTURE = [
|
|
|
176
182
|
|
|
177
183
|
// The variables of a login session that the envelope passes on, as sudo's env_reset keeps them,
|
|
178
184
|
// claude's OAuth credential, the author of the session's comments at the ticket (`BEADS_ACTOR`,
|
|
179
|
-
// which the circuit sets to the session's role),
|
|
185
|
+
// which the circuit sets to the session's role), the mark of the place the session holds
|
|
186
|
+
// (`GRILLHOUSE_PLACE_TENUE`, scripts/places-de-la-machine.mjs), which covers its commands, and
|
|
187
|
+
// the prefixes of the families it passes on:
|
|
180
188
|
// the locale, and the configuration and credentials of claude's API. The state of a launching claude session
|
|
181
189
|
// (`CLAUDE_CODE_SESSION_ID`, its messaging socket and token…) stays out.
|
|
182
190
|
const ENVIRONNEMENT_DECLARE = [
|
|
@@ -192,6 +200,7 @@ const ENVIRONNEMENT_DECLARE = [
|
|
|
192
200
|
'COLORTERM',
|
|
193
201
|
'CLAUDE_CODE_OAUTH_TOKEN',
|
|
194
202
|
'BEADS_ACTOR',
|
|
203
|
+
VARIABLE_TENUE,
|
|
195
204
|
];
|
|
196
205
|
const FAMILLES_DECLAREES = ['LC_', 'ANTHROPIC_'];
|
|
197
206
|
// The declared variables that name a path: each enters only when its path is in sight inside the
|
|
@@ -233,9 +242,14 @@ export function dossierDeTravail(copie, env = process.env) {
|
|
|
233
242
|
// script: a `prepare` that writes under the read-only `.git` would fail `npm install`; the
|
|
234
243
|
// launcher installs outside the session), `TMPDIR`, `TMP` and `TEMP` set to the session's working
|
|
235
244
|
// directory <travail>, and `GRILLHOUSE_ENVELOPPE` set to the plan <paquets>; with them, each tool of the
|
|
236
|
-
// project <outils> (`grillhouse.outils`), its variable set to its path
|
|
237
|
-
//
|
|
238
|
-
|
|
245
|
+
// project <outils> (`grillhouse.outils`), its variable set to its path; and, when <travailleurs>
|
|
246
|
+
// is given, GRILLHOUSE_TRAVAILLEURS set to it: the workers the session's tests play on, which the
|
|
247
|
+
// module of each language passes to its tool (scripts/places-de-la-machine.mjs `travailleursDe`).
|
|
248
|
+
// Nothing else of <env> enters.
|
|
249
|
+
export function environnementDeLaSeance(
|
|
250
|
+
env,
|
|
251
|
+
{ cacheNpm, paquets, travail, outils = {}, donnees = {}, travailleurs }
|
|
252
|
+
) {
|
|
239
253
|
const declare = nom =>
|
|
240
254
|
ENVIRONNEMENT_DECLARE.includes(nom) ||
|
|
241
255
|
VARIABLES_DE_CHEMIN.includes(nom) ||
|
|
@@ -244,12 +258,57 @@ export function environnementDeLaSeance(env, { cacheNpm, paquets, travail, outil
|
|
|
244
258
|
return {
|
|
245
259
|
...Object.fromEntries(garde),
|
|
246
260
|
...outils,
|
|
261
|
+
...donnees,
|
|
247
262
|
npm_config_cache: cacheNpm,
|
|
248
263
|
npm_config_ignore_scripts: 'true',
|
|
249
264
|
TMPDIR: travail,
|
|
250
265
|
TMP: travail,
|
|
251
266
|
TEMP: travail,
|
|
252
267
|
[VARIABLE]: ecrireLaListe(paquets),
|
|
268
|
+
...(travailleurs === undefined ? {} : { GRILLHOUSE_TRAVAILLEURS: String(travailleurs) }),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The command <commande> placed under `nice` then `ionice`, so a session of an agent yields the
|
|
274
|
+
* CPU and the disk to the rest of the machine (its command kept whole at the end).
|
|
275
|
+
* @param {string[]} commande
|
|
276
|
+
* @returns {string[]}
|
|
277
|
+
*/
|
|
278
|
+
export function sousNiceEtIonice(commande) {
|
|
279
|
+
return ['nice', '-n', '10', 'ionice', '-c', '2', '-n', '7', ...commande];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* What `envelopper` launches for a session: `bwrap` with the arguments <argsBwrap> of the plan, then
|
|
284
|
+
* <commande> under `nice` and `ionice`, behind the test of the variables that name a path; and the
|
|
285
|
+
* environment of the session, GRILLHOUSE_TRAVAILLEURS set to max(1, cores ÷ places) of <env>.
|
|
286
|
+
* @param {{ argsBwrap: string[], commande: string[], env: Record<string, string | undefined>,
|
|
287
|
+
* cacheNpm: string, paquets: string[], travail: string, outils?: Record<string, string>,
|
|
288
|
+
* donnees?: Record<string, string> }} o
|
|
289
|
+
* @returns {{ cmd: string, args: string[], env: Record<string, string> }}
|
|
290
|
+
*/
|
|
291
|
+
export function lancementDeLaSeance({
|
|
292
|
+
argsBwrap,
|
|
293
|
+
commande,
|
|
294
|
+
env,
|
|
295
|
+
cacheNpm,
|
|
296
|
+
paquets,
|
|
297
|
+
travail,
|
|
298
|
+
outils,
|
|
299
|
+
donnees,
|
|
300
|
+
}) {
|
|
301
|
+
return {
|
|
302
|
+
cmd: 'bwrap',
|
|
303
|
+
args: [...argsBwrap, ...commandeEprouvee(sousNiceEtIonice(commande))],
|
|
304
|
+
env: environnementDeLaSeance(env, {
|
|
305
|
+
cacheNpm,
|
|
306
|
+
paquets,
|
|
307
|
+
travail,
|
|
308
|
+
outils,
|
|
309
|
+
donnees,
|
|
310
|
+
travailleurs: travailleursDe({ env }),
|
|
311
|
+
}),
|
|
253
312
|
};
|
|
254
313
|
}
|
|
255
314
|
|
|
@@ -273,6 +332,7 @@ export function montagesDeLaSeance({
|
|
|
273
332
|
scratchpads,
|
|
274
333
|
sessions = [],
|
|
275
334
|
outils = {},
|
|
335
|
+
publie = null,
|
|
276
336
|
}) {
|
|
277
337
|
const maison = path.dirname(claude);
|
|
278
338
|
return [
|
|
@@ -284,6 +344,7 @@ export function montagesDeLaSeance({
|
|
|
284
344
|
{ chemin: projet, ecriture: true },
|
|
285
345
|
...MAISON_EN_LECTURE.map(rel => ({ chemin: path.join(maison, rel), ecriture: false })),
|
|
286
346
|
...Object.values(outils).map(chemin => ({ chemin, ecriture: false })),
|
|
347
|
+
...(publie === null ? [] : [{ chemin: publie, ecriture: false }]),
|
|
287
348
|
];
|
|
288
349
|
}
|
|
289
350
|
|
|
@@ -559,6 +620,34 @@ export function plan(
|
|
|
559
620
|
|
|
560
621
|
const disque = { existe: existsSync, lien: lienSurDisque };
|
|
561
622
|
|
|
623
|
+
// The cache of the published versions to mount when the project of <copie> names its version
|
|
624
|
+
// (`grillhouse.outil`, read in the main tree), after installing the version here, outside the
|
|
625
|
+
// session; null without the key, or when the version cannot be installed (said on the error stream:
|
|
626
|
+
// the lock then falls back on the code of the copy, and refuses when that does not load either).
|
|
627
|
+
function cacheDeLaVersionPubliee(copie) {
|
|
628
|
+
const commun = execFileSync(
|
|
629
|
+
'git',
|
|
630
|
+
['-C', copie, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
|
|
631
|
+
{ encoding: 'utf8' }
|
|
632
|
+
).trim();
|
|
633
|
+
let version;
|
|
634
|
+
try {
|
|
635
|
+
version = versionDeLOutil(path.dirname(commun));
|
|
636
|
+
} catch {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
if (version === null) return null;
|
|
640
|
+
try {
|
|
641
|
+
installer(version);
|
|
642
|
+
} catch (e) {
|
|
643
|
+
process.stderr.write(
|
|
644
|
+
`⚠️ enveloppe : version publiée ${version} non installable : ${e.message}\n`
|
|
645
|
+
);
|
|
646
|
+
return null;
|
|
647
|
+
}
|
|
648
|
+
return cacheDesOutils();
|
|
649
|
+
}
|
|
650
|
+
|
|
562
651
|
// The command: the session of <commande> in the envelope of the plan <paquets> in <copie>; its
|
|
563
652
|
// exit code.
|
|
564
653
|
function envelopper(argv) {
|
|
@@ -593,14 +682,20 @@ function envelopper(argv) {
|
|
|
593
682
|
];
|
|
594
683
|
// The tools of the project, judged before anything is prepared: none holds a mount.
|
|
595
684
|
let outils;
|
|
685
|
+
let donnees;
|
|
596
686
|
try {
|
|
597
687
|
outils = outilsDe(copie, {
|
|
598
688
|
montages: [copie, claude, scratchpads, cacheNpm, TEMPORAIRE, ...sessions],
|
|
599
689
|
});
|
|
690
|
+
donnees = donneesDe(copie);
|
|
600
691
|
} catch (e) {
|
|
601
692
|
process.stderr.write(`⛔ ENVELOPPE REFUSÉE — ${e.message}\n`);
|
|
602
693
|
return CODE_REFUS;
|
|
603
694
|
}
|
|
695
|
+
// The cache of the published versions (`grillhouse.outil` of the main tree's package.json) comes
|
|
696
|
+
// in read-only, the version installed here, outside the session: the write lock runs on it, and
|
|
697
|
+
// a session cannot install it. A version that cannot be installed is said, nothing mounted.
|
|
698
|
+
const publie = cacheDeLaVersionPubliee(copie);
|
|
604
699
|
mkdirSync(projet, { recursive: true });
|
|
605
700
|
// The session's working directory, created here inside the scratchpads that bwrap mounts.
|
|
606
701
|
mkdirSync(travail, { recursive: true });
|
|
@@ -611,7 +706,16 @@ function envelopper(argv) {
|
|
|
611
706
|
const etatJetable = path.join(temporaire.dossier, 'claude.json');
|
|
612
707
|
if (existsSync(`${claude}.json`)) copyFileSync(`${claude}.json`, etatJetable);
|
|
613
708
|
const montages = avecLiens(
|
|
614
|
-
montagesDeLaSeance({
|
|
709
|
+
montagesDeLaSeance({
|
|
710
|
+
cacheNpm,
|
|
711
|
+
claude,
|
|
712
|
+
projet,
|
|
713
|
+
etatJetable,
|
|
714
|
+
scratchpads,
|
|
715
|
+
sessions,
|
|
716
|
+
outils,
|
|
717
|
+
publie,
|
|
718
|
+
}),
|
|
615
719
|
lienSurDisque
|
|
616
720
|
);
|
|
617
721
|
const langage = langageDe(copie);
|
|
@@ -672,10 +776,17 @@ function envelopper(argv) {
|
|
|
672
776
|
process.stderr.write(`⛔ ENVELOPPE REFUSÉE — ${refus}\n`);
|
|
673
777
|
code = CODE_REFUS;
|
|
674
778
|
} else {
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
779
|
+
const lancement = lancementDeLaSeance({
|
|
780
|
+
argsBwrap: args,
|
|
781
|
+
commande,
|
|
782
|
+
env: process.env,
|
|
783
|
+
cacheNpm,
|
|
784
|
+
paquets,
|
|
785
|
+
travail,
|
|
786
|
+
outils,
|
|
787
|
+
donnees,
|
|
678
788
|
});
|
|
789
|
+
const r = spawnSync(lancement.cmd, lancement.args, { stdio: 'inherit', env: lancement.env });
|
|
679
790
|
if (r.error) process.stderr.write(`⛔ ENVELOPPE IMPOSSIBLE — ${r.error.message}\n`);
|
|
680
791
|
code = r.error ? CODE_REFUS : (r.status ?? 1);
|
|
681
792
|
}
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
# without a copy, it is brought back to the main tree's HEAD and the copy is made on it: the lot
|
|
38
38
|
# the branch carried ahead of main (a branch the queue sent back) comes back as local work in
|
|
39
39
|
# the copy, a conflict with main marked in its file; a branch with nothing ahead simply starts
|
|
40
|
-
# again from main.
|
|
41
|
-
# the refusal goes to the log, which names the queue, CODE_COPIE, before any copy is made.
|
|
40
|
+
# again from main.
|
|
42
41
|
# The copy, new or existing, then goes through the one preparation of a copy, which the circuit
|
|
43
42
|
# also plays before each pass that judges the lot (scripts/enveloppe/travail-de-la-copie.mjs
|
|
44
43
|
# `preparer`, its output in the log). Moving forward keeps
|
|
@@ -98,19 +97,20 @@
|
|
|
98
97
|
# `--output-format json --json-schema <its schema>` (`npx grillhouse resultats --schema
|
|
99
98
|
# <rôle>`); --fiche <sorte> names the schema of a sheet that is not its role's (`geste`, the
|
|
100
99
|
# explorateur's gesture of a mechanical ticket, grillhouse-sos), taking a value as --modele does:
|
|
101
|
-
# claude's JSON result, its sheet in `structured_output`, goes to
|
|
102
|
-
# .claude/worktrees/<ticket>.
|
|
103
|
-
#
|
|
100
|
+
# claude's JSON result, its sheet in `structured_output`, goes to `resultat.json` in the folder
|
|
101
|
+
# of the session (.claude/worktrees/<ticket>.travail/seances/<id>/, <id> the session's
|
|
102
|
+
# --seance or --reprise, `courante` without one), which a launch removes first and the circuit
|
|
103
|
+
# reads, then to the log; its errors go to the log.
|
|
104
104
|
# - Its output, and an envelope refusal (CODE_REFUS), are added to .claude/worktrees/<ticket>.log,
|
|
105
105
|
# the log of the ticket, which keeps every session of the ticket: each launch past the checks of
|
|
106
106
|
# its call adds a header line, `=== <time> · <rôle> · <composant> ===`, then its preparation and
|
|
107
107
|
# its session. The agent writes its handover in the ticket. Once the envelope has ended, the
|
|
108
|
-
# launcher writes the session's exit code to
|
|
108
|
+
# launcher writes the session's exit code to `fin` in the folder of the session, which a launch
|
|
109
109
|
# removes first: a launch that stops before its session leaves none, so the circuit
|
|
110
110
|
# (scripts/circuit.mjs) tells a code of the session from CODE_USAGE, CODE_REFUS and CODE_COPIE.
|
|
111
111
|
# A session its lock stopped on a write out of the plan (scripts/verrous/verrou.mjs) left the
|
|
112
112
|
# reason in its working directory (`hors-plan`, removed before the session): the launcher moves
|
|
113
|
-
# it to
|
|
113
|
+
# it to `hors-plan` in the folder of the session, which a launch removes first and the circuit reads,
|
|
114
114
|
# and adds it to the log. It then writes the session's line to the register
|
|
115
115
|
# (scripts/registre.mjs --copie), and exits with the envelope's code.
|
|
116
116
|
# - The exit codes are named in scripts/enveloppe/codes.mjs; a malformed call exits CODE_USAGE.
|
|
@@ -176,19 +176,15 @@ grep -qE "TON TICKET : ${motif}([^A-Za-z0-9_.-]|$)" "$consigne" || { echo "⛔ L
|
|
|
176
176
|
|
|
177
177
|
copie="$racine/.claude/worktrees/$ticket"
|
|
178
178
|
journal="$copie.log"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
# The folder of the session, its id the one it opens or resumes: each session's result apart, so
|
|
180
|
+
# that an attempt played again reads the one its dead attempt left.
|
|
181
|
+
rang="$copie.travail/seances/${seance:-${reprise:-courante}}"
|
|
182
|
+
fin="$rang/fin"
|
|
183
|
+
resultat="$rang/resultat.json"
|
|
184
|
+
hors_plan="$rang/hors-plan"
|
|
185
|
+
mkdir -p "$(dirname "$copie")" "$rang"
|
|
183
186
|
rm -f "$fin" "$resultat" "$hors_plan"
|
|
184
187
|
printf '=== %s · %s · %s ===\n' "$(date -Iseconds)" "$role" "$composant" >> "$journal"
|
|
185
|
-
# A branch still in the queue is not relaunched: the queue brings it onto main, or sends it back.
|
|
186
|
-
if node --input-type=module -e "import { lireEntrees } from '$ici/../integration/file-attente.mjs'; const [r, b, t] = process.argv.slice(1); process.exit(lireEntrees(r).some(e => e.branche === b || e.ticket === t) ? 0 : 1);" "$racine" "agent/$ticket" "$ticket"; then
|
|
187
|
-
refus="⛔ La branche agent/$ticket est encore en file d'intégration : la file l'amène sur main ou la renvoie ; le ticket ne se relance pas avant."
|
|
188
|
-
echo "$refus" >> "$journal"
|
|
189
|
-
echo "$refus" >&2
|
|
190
|
-
exit "$CODE_COPIE"
|
|
191
|
-
fi
|
|
192
188
|
# The temporary directory of the ticket (`ouvrirBaseDuTicket`, scripts/mesure/base-de-passe.mjs):
|
|
193
189
|
# TMPDIR, TMP and TEMP of the rest of the launch and of the session, whose scratchpads and working
|
|
194
190
|
# directory lie in it. It stays from one session and one resumption of the ticket to the next, and
|
|
@@ -12,8 +12,8 @@ import { paquets } from '../paquets.mjs';
|
|
|
12
12
|
|
|
13
13
|
export const VARIABLE = 'GRILLHOUSE_ENVELOPPE';
|
|
14
14
|
// The file the lock of a session leaves in its working directory when it stops the session on a
|
|
15
|
-
// write out of the plan (scripts/verrous/verrou.mjs); the launcher hands it to the circuit
|
|
16
|
-
// `<copie>.hors-plan` (scripts/enveloppe/lancer.sh).
|
|
15
|
+
// write out of the plan (scripts/verrous/verrou.mjs); the launcher hands it to the circuit in the
|
|
16
|
+
// session's result folder, `<copie>.travail/seances/<id>/hors-plan` (scripts/enveloppe/lancer.sh).
|
|
17
17
|
export const MARQUE_HORS_PLAN = 'hors-plan';
|
|
18
18
|
|
|
19
19
|
// The list <paquets> as the variable carries it.
|
|
@@ -57,6 +57,7 @@ import { existsSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs'
|
|
|
57
57
|
import path from 'node:path';
|
|
58
58
|
import { pathToFileURL } from 'node:url';
|
|
59
59
|
import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
|
|
60
|
+
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
60
61
|
import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
|
|
61
62
|
|
|
62
63
|
const LOT = 'grillhouse-travail.patch';
|
|
@@ -89,7 +90,10 @@ const fichiersDuLot = (copie, lot) =>
|
|
|
89
90
|
*/
|
|
90
91
|
function lesCles(copie) {
|
|
91
92
|
try {
|
|
92
|
-
return {
|
|
93
|
+
return {
|
|
94
|
+
engendres: engendresDe(copie),
|
|
95
|
+
env: avecLesDonnees(donneesDe(copie), avecLesOutils(outilsDe(copie), process.env)),
|
|
96
|
+
};
|
|
93
97
|
} catch (e) {
|
|
94
98
|
return {
|
|
95
99
|
refus: `⛔ Une clé grillhouse du package.json est refusée :\n${/** @type {Error} */ (e).message}`,
|