@roomi-fields/grillhouse 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +48 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/dist/temporal/circuit/client.d.ts +2 -2
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +4 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +3 -3
- package/dist/temporal/circuit/contrat.js +8 -2
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +3 -3
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +5 -6
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +3 -6
- package/dist/temporal/installation.js +19 -38
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +1 -0
- package/dist/temporal/tickets/activites.js +5 -0
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +10 -0
- package/dist/temporal/tickets/deroule.js +8 -1
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +119 -27
- package/docs/CADRE.md +20 -0
- package/docs/INTERFACE.md +17 -4
- package/hooks/hooks.json +4 -0
- package/package.json +2 -2
- package/scripts/activites.mjs +155 -84
- package/scripts/aiguillage.mjs +35 -11
- package/scripts/attente-au-tour.mjs +99 -0
- package/scripts/avancement.mjs +27 -10
- package/scripts/base-des-workflows.mjs +57 -0
- package/scripts/bilan.mjs +101 -25
- package/scripts/cadre.mjs +5 -2
- package/scripts/circuit.mjs +173 -58
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +54 -19
- package/scripts/copies-finies.mjs +8 -1
- package/scripts/dependances-internes.mjs +9 -3
- package/scripts/dernier-vert.mjs +84 -23
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +24 -8
- package/scripts/droits.mjs +40 -15
- package/scripts/effets.mjs +9 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +141 -48
- package/scripts/enveloppe/travail-de-la-copie.mjs +36 -12
- package/scripts/etapes.mjs +1 -1
- package/scripts/faits-du-circuit.mjs +1 -1
- package/scripts/flux-des-paquets.mjs +21 -7
- package/scripts/gardes-du-cadre.mjs +9 -3
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +84 -29
- package/scripts/integration/integrer.mjs +70 -24
- package/scripts/integration/rejeu.mjs +26 -9
- package/scripts/jointure.d.ts +10 -1
- package/scripts/journal-des-etats.d.mts +41 -0
- package/scripts/journal-des-etats.mjs +273 -0
- package/scripts/journal.mjs +119 -0
- package/scripts/langages/cargo/commandes.mjs +97 -18
- package/scripts/langages/cargo/composants.mjs +24 -8
- package/scripts/langages/cargo/index.mjs +7 -0
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +3 -1
- package/scripts/langages/python/index.mjs +6 -0
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/frontieres.mjs +112 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +12 -3
- package/scripts/langages/typescript/interfaces-contre-code.mjs +109 -41
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +3 -1
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +58 -16
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -1
- package/scripts/langages/typescript/tests.mjs +24 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +35 -12
- package/scripts/langages/typescript/turbo-des-paquets.mjs +152 -51
- package/scripts/langages/typescript/verdict.mjs +3 -1
- package/scripts/langages/typescript/verifier.mjs +61 -14
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +10 -2
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/delais.mjs +9 -3
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +12 -4
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +17 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages.d.mts +20 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/matiere-de-test.d.ts +11 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +9 -3
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +48 -16
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +6 -2
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +7 -7
- package/scripts/nuit.sh +24 -0
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.mjs +18 -7
- package/scripts/paquet-npm.mjs +15 -5
- package/scripts/paquets.mjs +12 -4
- package/scripts/passe-de-la-machine.mjs +7 -2
- package/scripts/places-de-la-machine.mjs +72 -12
- package/scripts/preparation.mjs +15 -5
- package/scripts/registre.mjs +6 -2
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +105 -37
- package/scripts/seances.mjs +22 -4
- package/scripts/services-du-noyau.mjs +1 -0
- package/scripts/sous-commandes.mjs +5 -1
- package/scripts/style-a-l-ecriture.mjs +48 -17
- package/scripts/superviseur.mjs +127 -75
- package/scripts/tableau.mjs +133 -10
- package/scripts/taches-du-graphe.mjs +33 -13
- package/scripts/ticket-du-circuit.mjs +40 -0
- package/scripts/transitions.mjs +159 -29
- package/scripts/verrou-de-fichier.mjs +6 -2
- package/scripts/verrou-de-machine.mjs +123 -39
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/explorateur/SKILL.md +8 -2
- package/skills/grill/SKILL.md +3 -57
- package/skills/grill/references/paquets.md +60 -0
- package/skills/mesure/SKILL.md +3 -0
- package/skills/pitmaster/SKILL.md +16 -27
- package/skills/questionneur/SKILL.md +1 -1
- package/skills/relecteur/SKILL.md +2 -2
- package/skills/testwriter/SKILL.md +19 -7
- package/skills/release/SKILL.md +0 -134
- package/skills/release/scripts/update-version.cjs +0 -92
package/scripts/donnees-cles.mjs
CHANGED
|
@@ -40,7 +40,9 @@ const RELEASE = /(^|\s)--release(\s|$)/;
|
|
|
40
40
|
// package.json when the tables declare it so, else the language of the package.json.
|
|
41
41
|
function langageDuPaquet(racine, chemin) {
|
|
42
42
|
const hors = paquetsSansPackageJson(racine).find(p => p.chemin === chemin);
|
|
43
|
-
if (hors)
|
|
43
|
+
if (hors) {
|
|
44
|
+
return hors.langage;
|
|
45
|
+
}
|
|
44
46
|
return Object.keys(LANGAGES).find(n => langage(n).manifeste === 'package.json') ?? 'typescript';
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -64,12 +66,16 @@ function lire(dir) {
|
|
|
64
66
|
/** @type {Map<string, string[]>} */
|
|
65
67
|
const fournisseurs = new Map();
|
|
66
68
|
const racinePkg = lireJson(path.join(racine, 'package.json'));
|
|
67
|
-
if (racinePkg === null)
|
|
69
|
+
if (racinePkg === null) {
|
|
70
|
+
return { donnees, parPaquet, fournisseurs, fautes };
|
|
71
|
+
}
|
|
68
72
|
const liste = paquets(racine);
|
|
69
73
|
const consommateurs = [{ dossier: '.', pkg: racinePkg }, ...liste];
|
|
70
74
|
for (const { dossier, pkg } of consommateurs) {
|
|
71
75
|
const d = pkg?.grillhouse?.donnees;
|
|
72
|
-
if (d === undefined || d === null)
|
|
76
|
+
if (d === undefined || d === null) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
73
79
|
const ou = dossier === '.' ? 'package.json' : `${dossier}/package.json`;
|
|
74
80
|
if (typeof d !== 'object' || Array.isArray(d)) {
|
|
75
81
|
fautes.push(
|
|
@@ -132,7 +138,9 @@ function lire(dir) {
|
|
|
132
138
|
*/
|
|
133
139
|
export function donneesDe(dir) {
|
|
134
140
|
const { donnees, fautes } = lire(dir);
|
|
135
|
-
if (fautes.length)
|
|
141
|
+
if (fautes.length) {
|
|
142
|
+
throw new Error(fautes.join('\n'));
|
|
143
|
+
}
|
|
136
144
|
return donnees;
|
|
137
145
|
}
|
|
138
146
|
|
|
@@ -146,7 +154,9 @@ export function donneesDe(dir) {
|
|
|
146
154
|
*/
|
|
147
155
|
export function donneesDuPaquet(dir, chemin) {
|
|
148
156
|
const { donnees, parPaquet, fautes } = lire(dir);
|
|
149
|
-
if (fautes.length)
|
|
157
|
+
if (fautes.length) {
|
|
158
|
+
throw new Error(fautes.join('\n'));
|
|
159
|
+
}
|
|
150
160
|
return Object.fromEntries(
|
|
151
161
|
[...parPaquet]
|
|
152
162
|
.filter(([d]) => contient(d, chemin))
|
|
@@ -168,7 +178,9 @@ const contient = (dossier, chemin) =>
|
|
|
168
178
|
*/
|
|
169
179
|
export function fournisseursDuPaquet(dir, chemin) {
|
|
170
180
|
const { fautes, fournisseurs } = lire(dir);
|
|
171
|
-
if (fautes.length)
|
|
181
|
+
if (fautes.length) {
|
|
182
|
+
throw new Error(fautes.join('\n'));
|
|
183
|
+
}
|
|
172
184
|
return [
|
|
173
185
|
...new Set([...fournisseurs].filter(([d]) => contient(d, chemin)).flatMap(([, ns]) => ns)),
|
|
174
186
|
];
|
|
@@ -180,7 +192,9 @@ export function fournisseursDuPaquet(dir, chemin) {
|
|
|
180
192
|
* @throws {Error} a build that fails
|
|
181
193
|
*/
|
|
182
194
|
export function construireLesFournisseurs(noms) {
|
|
183
|
-
if (!noms.length)
|
|
195
|
+
if (!noms.length) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
184
198
|
const nom = Object.keys(LANGAGES).find(n => langage(n).manifeste === 'package.json');
|
|
185
199
|
const module = nom ? langage(nom) : null;
|
|
186
200
|
if (!module?.construireLesPaquets) {
|
|
@@ -200,7 +214,9 @@ export function controlerLesDonnees(donnees) {
|
|
|
200
214
|
.map(
|
|
201
215
|
([n, c]) => `la variable ${n} nomme ${c}, que la construction du fournisseur n'a pas produit.`
|
|
202
216
|
);
|
|
203
|
-
if (absents.length)
|
|
217
|
+
if (absents.length) {
|
|
218
|
+
throw new Error(absents.join('\n'));
|
|
219
|
+
}
|
|
204
220
|
}
|
|
205
221
|
|
|
206
222
|
/**
|
package/scripts/droits.mjs
CHANGED
|
@@ -114,6 +114,17 @@ const LIRE_L_INDEX = [
|
|
|
114
114
|
const LIRE = ['Bash', 'Read', 'Skill'];
|
|
115
115
|
const ECRIRE = ['Edit', 'Write'];
|
|
116
116
|
|
|
117
|
+
// The charter prescribes `env -C <dossier>` in place of `cd`: a command run in the copy carries
|
|
118
|
+
// that prefix, which a bare rule does not match. Each rule of command, out of bd, git and env -C,
|
|
119
|
+
// gets its twin `Bash(env -C * <commande>)`, as git has `git show` and `git -C * show`.
|
|
120
|
+
/** @param {string[]} regles @returns {string[]} */
|
|
121
|
+
function avecJumelles(regles) {
|
|
122
|
+
return regles.flatMap(r => {
|
|
123
|
+
const bash = /^Bash\((.*)\)$/.exec(r);
|
|
124
|
+
return bash && !/^(bd|git|env -C) /.test(bash[1]) ? [r, `Bash(env -C * ${bash[1]})`] : [r];
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
117
128
|
// Each role the circuit launches: whether it writes (files, `ecrit`; the ticket, unless
|
|
118
129
|
// `ecritAuTicket` is false), whether it uses the index, whether its skill names the frame's
|
|
119
130
|
// METACADRE.md (`metacadre`, read at the root of the plugin installed), and the commands its skill
|
|
@@ -129,7 +140,7 @@ export const ROLES = {
|
|
|
129
140
|
metacadre: true,
|
|
130
141
|
index: true,
|
|
131
142
|
ecritAuTicket: false,
|
|
132
|
-
commandes: [
|
|
143
|
+
commandes: avecJumelles([
|
|
133
144
|
'Bash(bd show *)',
|
|
134
145
|
'Bash(bd comments *)',
|
|
135
146
|
'Bash(git show *)',
|
|
@@ -141,7 +152,7 @@ export const ROLES = {
|
|
|
141
152
|
'Bash(codegraph explore *)',
|
|
142
153
|
'mcp__codegraph__codegraph_explore',
|
|
143
154
|
'mcp__rtfm__rtfm_search',
|
|
144
|
-
],
|
|
155
|
+
]),
|
|
145
156
|
},
|
|
146
157
|
// It writes the tests of the whole ticket, in the envelope of its plan, and reads the whole copy
|
|
147
158
|
// by the index (charter, « L'index d'abord »).
|
|
@@ -149,14 +160,14 @@ export const ROLES = {
|
|
|
149
160
|
metacadre: true,
|
|
150
161
|
ecrit: true,
|
|
151
162
|
index: true,
|
|
152
|
-
commandes: [
|
|
163
|
+
commandes: avecJumelles([
|
|
153
164
|
'Bash(bd update * --claim)',
|
|
154
165
|
'Bash(bd comments add *)',
|
|
155
166
|
'Bash(npm test *)',
|
|
156
167
|
// The removal of a file of its tests, by a script of its temporary directory.
|
|
157
168
|
'Bash(node $TMPDIR/*)',
|
|
158
169
|
...LIRE_L_INDEX,
|
|
159
|
-
],
|
|
170
|
+
]),
|
|
160
171
|
},
|
|
161
172
|
// It writes the code of the whole ticket, in the envelope of its plan, and reads the whole copy
|
|
162
173
|
// by the index.
|
|
@@ -164,7 +175,7 @@ export const ROLES = {
|
|
|
164
175
|
metacadre: true,
|
|
165
176
|
ecrit: true,
|
|
166
177
|
index: true,
|
|
167
|
-
commandes: [
|
|
178
|
+
commandes: avecJumelles([
|
|
168
179
|
'Bash(bd update * --claim)',
|
|
169
180
|
'Bash(bd update * --notes*)',
|
|
170
181
|
'Bash(bd comments add *)',
|
|
@@ -173,12 +184,12 @@ export const ROLES = {
|
|
|
173
184
|
'Bash(npm test *)',
|
|
174
185
|
'Bash(npm run api*)',
|
|
175
186
|
...LIRE_L_INDEX,
|
|
176
|
-
],
|
|
187
|
+
]),
|
|
177
188
|
},
|
|
178
189
|
relecteur: {
|
|
179
190
|
metacadre: true,
|
|
180
191
|
index: true,
|
|
181
|
-
commandes: [
|
|
192
|
+
commandes: avecJumelles([
|
|
182
193
|
...LIRE_GIT,
|
|
183
194
|
'Bash(npx grillhouse index-interfaces --publie *)',
|
|
184
195
|
'Bash(npm test *)',
|
|
@@ -186,18 +197,18 @@ export const ROLES = {
|
|
|
186
197
|
'Bash(codegraph explore *)',
|
|
187
198
|
'mcp__codegraph__codegraph_explore',
|
|
188
199
|
'mcp__rtfm__rtfm_search',
|
|
189
|
-
],
|
|
200
|
+
]),
|
|
190
201
|
},
|
|
191
202
|
// It asks, and decides nothing: it reads the proposal its instruction carries and the code by
|
|
192
203
|
// the index; the circuit writes its questions at the ticket.
|
|
193
204
|
questionneur: {
|
|
194
205
|
index: true,
|
|
195
206
|
ecritAuTicket: false,
|
|
196
|
-
commandes: [
|
|
207
|
+
commandes: avecJumelles([
|
|
197
208
|
'Bash(codegraph explore *)',
|
|
198
209
|
'mcp__codegraph__codegraph_explore',
|
|
199
210
|
'mcp__rtfm__rtfm_search',
|
|
200
|
-
],
|
|
211
|
+
]),
|
|
201
212
|
},
|
|
202
213
|
};
|
|
203
214
|
|
|
@@ -229,7 +240,11 @@ function greffonsDuProjet(racine) {
|
|
|
229
240
|
const actifs = new Set();
|
|
230
241
|
for (const f of ['settings.json', 'settings.local.json']) {
|
|
231
242
|
const p = lireJson(path.join(racine, '.claude', f))?.enabledPlugins ?? {};
|
|
232
|
-
for (const [nom, actif] of Object.entries(p))
|
|
243
|
+
for (const [nom, actif] of Object.entries(p)) {
|
|
244
|
+
if (actif) {
|
|
245
|
+
actifs.add(nom);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
233
248
|
}
|
|
234
249
|
return [...actifs].sort();
|
|
235
250
|
}
|
|
@@ -268,16 +283,24 @@ function lireSaCompetence(role, { racine, copie, home }) {
|
|
|
268
283
|
function serveursDeLIndex(racine, home) {
|
|
269
284
|
const out = {};
|
|
270
285
|
const projet = lireJson(path.join(racine, '.mcp.json'))?.mcpServers ?? {};
|
|
271
|
-
for (const n of INDEX)
|
|
286
|
+
for (const n of INDEX) {
|
|
287
|
+
if (projet[n]) {
|
|
288
|
+
out[n] = projet[n];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
272
291
|
for (const greffon of greffonsDuProjet(racine)) {
|
|
273
292
|
const dossier = cheminDuGreffon(greffon, [racine], home);
|
|
274
|
-
if (!dossier)
|
|
293
|
+
if (!dossier) {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
275
296
|
const serveurs =
|
|
276
297
|
lireJson(path.join(dossier, '.claude-plugin', 'plugin.json'))?.mcpServers ??
|
|
277
298
|
lireJson(path.join(dossier, '.mcp.json'))?.mcpServers ??
|
|
278
299
|
{};
|
|
279
300
|
for (const n of INDEX) {
|
|
280
|
-
if (out[n] || !serveurs[n])
|
|
301
|
+
if (out[n] || !serveurs[n]) {
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
281
304
|
out[n] = JSON.parse(JSON.stringify(serveurs[n]).replaceAll('${CLAUDE_PLUGIN_ROOT}', dossier));
|
|
282
305
|
}
|
|
283
306
|
}
|
|
@@ -288,7 +311,9 @@ function serveursDeLIndex(racine, home) {
|
|
|
288
311
|
// project's own skills are read) and the main tree <racine>; <home> holds the plugins installed.
|
|
289
312
|
function reglagesDuRole(role, { racine, copie = racine, ticket, home }) {
|
|
290
313
|
const r = ROLES[role];
|
|
291
|
-
if (!r)
|
|
314
|
+
if (!r) {
|
|
315
|
+
throw new Error(`rôle sans droits : ${role}`);
|
|
316
|
+
}
|
|
292
317
|
const deny = [...AUTEUR_FIXE, ...(r.ecritAuTicket === false ? ECRIRE_AU_TICKET : [])];
|
|
293
318
|
if (r.ecrit) {
|
|
294
319
|
// The test tool run directly (charter, « Aucun agent ne lance l'outil de test directement »),
|
package/scripts/effets.mjs
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
// - `decouverte` `{ role, sujet, corps, composants }`: a discovery filed closed under the ticket
|
|
17
17
|
// (scripts/ticket.sh, label `decouverte`), then its line among the sheets (`{ id, sujet }`);
|
|
18
18
|
// - `registre` `{ ligne }`: a line of the register of the steps (scripts/registre.mjs);
|
|
19
|
+
// - `trace` `{ ligne }`: a line of the journal of states (scripts/journal-des-etats.mjs), whose
|
|
20
|
+
// failure is said once and never stops the circuit;
|
|
19
21
|
// - `etat` `{ etat }`: the circuit's state, which the workflow of a ticket holds and no player writes
|
|
20
22
|
// (src/temporal/circuit/deroule.ts);
|
|
21
23
|
// - `plan` `{ titre, description }`: the plan written at the ticket (its title, its description);
|
|
@@ -39,6 +41,7 @@ import { appendFileSync, existsSync, readFileSync } from 'node:fs';
|
|
|
39
41
|
import path from 'node:path';
|
|
40
42
|
import { stripVTControlCharacters } from 'node:util';
|
|
41
43
|
import { ecrireLeBilan } from './bilan.mjs';
|
|
44
|
+
import { ecrireLaTrace } from './journal-des-etats.mjs';
|
|
42
45
|
import { ecrire as ecrireAuRegistre } from './registre.mjs';
|
|
43
46
|
|
|
44
47
|
/** The line of HTML comment that carries the key <cle> in a text at a ticket. */
|
|
@@ -215,6 +218,12 @@ const JOUEURS = {
|
|
|
215
218
|
return echec(e.message);
|
|
216
219
|
}
|
|
217
220
|
},
|
|
221
|
+
// A line of the journal of states: never an arrest, never a wait (ecrireLaTrace says a failure
|
|
222
|
+
// once and goes on).
|
|
223
|
+
trace(ctx, { ligne }) {
|
|
224
|
+
ecrireLaTrace(ctx.racine, ligne);
|
|
225
|
+
return ok;
|
|
226
|
+
},
|
|
218
227
|
plan(ctx, { titre, description }) {
|
|
219
228
|
const options = [
|
|
220
229
|
...(titre === null ? [] : ['--title', titre]),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The fingerprint of a step, on the side of the activities (it hashes with `node:crypto`, which a
|
|
2
|
+
// decision of the circuit imports none of). Mature model: the cache key of a task of Turborepo.
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The fingerprint of a step: the hash of its <commande> and of the content hashes <hashes> of the
|
|
7
|
+
* files it reads (by package, the root configuration under `//`); the same inputs give the same
|
|
8
|
+
* fingerprint, whatever the order of the packages.
|
|
9
|
+
*/
|
|
10
|
+
export function empreinteDEtape({ commande, hashes }) {
|
|
11
|
+
const entrees = Object.keys(hashes)
|
|
12
|
+
.sort()
|
|
13
|
+
.map(k => [k, hashes[k]]);
|
|
14
|
+
return createHash('sha256')
|
|
15
|
+
.update(JSON.stringify([commande, entrees]))
|
|
16
|
+
.digest('hex');
|
|
17
|
+
}
|
package/scripts/engendres.mjs
CHANGED
|
@@ -54,7 +54,9 @@ const motifs = v => Array.isArray(v) && v.every(m => typeof m === 'string' && m
|
|
|
54
54
|
*/
|
|
55
55
|
export function lireEngendres(pkg) {
|
|
56
56
|
const e = pkg?.grillhouse?.engendres;
|
|
57
|
-
if (e === undefined || e === null)
|
|
57
|
+
if (e === undefined || e === null) {
|
|
58
|
+
return { engendres: [], fautes: [] };
|
|
59
|
+
}
|
|
58
60
|
if (typeof e !== 'object' || Array.isArray(e)) {
|
|
59
61
|
return {
|
|
60
62
|
engendres: [],
|
|
@@ -112,9 +114,13 @@ export function lireEngendres(pkg) {
|
|
|
112
114
|
*/
|
|
113
115
|
export function engendresDe(dir) {
|
|
114
116
|
const f = path.join(arbrePrincipal(dir), 'package.json');
|
|
115
|
-
if (!existsSync(f))
|
|
117
|
+
if (!existsSync(f)) {
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
116
120
|
const { engendres, fautes } = lireEngendres(JSON.parse(readFileSync(f, 'utf8')));
|
|
117
|
-
if (fautes.length)
|
|
121
|
+
if (fautes.length) {
|
|
122
|
+
throw new Error(fautes.join('\n'));
|
|
123
|
+
}
|
|
118
124
|
return engendres;
|
|
119
125
|
}
|
|
120
126
|
|
|
@@ -143,7 +149,9 @@ export function regenerer({ refs, lancer, dansCopie, ecrire = s => process.stdou
|
|
|
143
149
|
return r.status === 0 ? r.stdout.split('\0').filter(Boolean) : null;
|
|
144
150
|
};
|
|
145
151
|
const avant = etat();
|
|
146
|
-
if (avant === null)
|
|
152
|
+
if (avant === null) {
|
|
153
|
+
return "L'état de l'arbre ne se lit pas.";
|
|
154
|
+
}
|
|
147
155
|
for (const r of refs) {
|
|
148
156
|
const x = lancer(r.commande);
|
|
149
157
|
const sortie = `${x.stdout ?? ''}${x.stderr ?? ''}`;
|
|
@@ -156,7 +164,9 @@ export function regenerer({ refs, lancer, dansCopie, ecrire = s => process.stdou
|
|
|
156
164
|
ecrire(sortie);
|
|
157
165
|
}
|
|
158
166
|
const apres = etat();
|
|
159
|
-
if (apres === null)
|
|
167
|
+
if (apres === null) {
|
|
168
|
+
return "L'état de l'arbre ne se lit pas.";
|
|
169
|
+
}
|
|
160
170
|
const deja = new Set(avant);
|
|
161
171
|
const ecrits = apres.filter(l => !deja.has(l)).map(l => l.slice(3));
|
|
162
172
|
const horsDeclaration = ecrits.filter(f => !refs.some(r => couvertPar(r.fichiers, f)));
|
|
@@ -65,8 +65,9 @@
|
|
|
65
65
|
// (`VARIABLES_DE_CHEMIN`) enters only when its path is in sight inside the envelope, tested there
|
|
66
66
|
// before the command runs. The session has its own process space: it reads the environment of
|
|
67
67
|
// no process of the machine.
|
|
68
|
-
// - A declared path that is a symbolic link
|
|
69
|
-
// (`avecLiens`)
|
|
68
|
+
// - A declared path that is a symbolic link, or that holds one among its components, comes back as
|
|
69
|
+
// that link, and its target with it (`avecLiens`); a store, a read or a written output is mounted
|
|
70
|
+
// at its real path, never at a link, by that same mechanism.
|
|
70
71
|
// - A worktree of the repository under an emptied directory (the home, `/tmp`) comes back
|
|
71
72
|
// read-only, `.git` included; the copy's packages of the plan and the tickets base are then
|
|
72
73
|
// written as above.
|
|
@@ -353,26 +354,56 @@ export function montagesDeLaSeance({
|
|
|
353
354
|
// an emptied directory and under no other declared path comes back with the link's rights, so a
|
|
354
355
|
// launcher finds its package beside its real path. A target the root shows needs no mount.
|
|
355
356
|
// `lien(path)` gives the text of the link at <path>, or null when <path> is not a link.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
// A declared path whose chain breaks (a target that does not exist, a link broken along the way, a
|
|
358
|
+
// loop of links) is not mounted, and nothing is raised. A component of the path that is a link is
|
|
359
|
+
// followed as well as the path itself, and the real path is mounted where the path was, never at a
|
|
360
|
+
// link: bwrap cannot mount over one. Each link of the chain that an emptied directory hides, and
|
|
361
|
+
// no other declared path holds, is made again; the real path is mounted when it lies in an emptied
|
|
362
|
+
// directory, is written, or is marked `monter` (a store, a read, a written output). `contexte`
|
|
363
|
+
// lists mounts beyond <montages> that also hold a link; `existe(path)` tells a real path that is
|
|
364
|
+
// there. The steps keep every other property of the mount they come from.
|
|
365
|
+
function avecLiens(montages, lien, existe = () => true, contexte = []) {
|
|
366
|
+
const videes = [...montages, ...contexte].filter(m => m.vide).map(m => m.chemin);
|
|
367
|
+
const declares = [...montages, ...contexte].filter(m => !m.vide && !m.lien).map(m => m.chemin);
|
|
368
|
+
const decouper = p => p.split('/').filter(Boolean);
|
|
359
369
|
return montages.flatMap(m => {
|
|
360
|
-
if (m.vide || m.lien || (m.source ?? m.chemin) !== m.chemin)
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
let
|
|
365
|
-
|
|
366
|
-
while (
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
if (m.vide || m.lien || (m.source ?? m.chemin) !== m.chemin) {
|
|
371
|
+
return [m];
|
|
372
|
+
}
|
|
373
|
+
const chaine = [];
|
|
374
|
+
let courant = '/';
|
|
375
|
+
let restants = decouper(m.chemin);
|
|
376
|
+
while (restants.length > 0) {
|
|
377
|
+
const [nom, ...reste] = restants;
|
|
378
|
+
const suivant = path.join(courant, nom);
|
|
379
|
+
const texte = lien(suivant);
|
|
380
|
+
if (texte === null) {
|
|
381
|
+
courant = suivant;
|
|
382
|
+
restants = reste;
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (chaine.length >= 40) {
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
chaine.push({ chemin: suivant, lien: texte });
|
|
389
|
+
restants = [...decouper(path.resolve(courant, texte)), ...reste];
|
|
390
|
+
courant = '/';
|
|
391
|
+
}
|
|
392
|
+
if (chaine.length === 0) {
|
|
393
|
+
return [m];
|
|
374
394
|
}
|
|
375
|
-
|
|
395
|
+
if (!existe(courant)) {
|
|
396
|
+
return [];
|
|
397
|
+
}
|
|
398
|
+
const liens = chaine
|
|
399
|
+
.filter(
|
|
400
|
+
({ chemin }) =>
|
|
401
|
+
videes.some(v => inside(chemin, v)) &&
|
|
402
|
+
!declares.some(d => d !== m.chemin && d !== chemin && inside(chemin, d))
|
|
403
|
+
)
|
|
404
|
+
.map(({ chemin, lien: texte }) => ({ chemin, lien: texte }));
|
|
405
|
+
const cachee = videes.some(v => inside(courant, v));
|
|
406
|
+
return cachee || m.ecriture || m.monter ? [...liens, { ...m, chemin: courant }] : liens;
|
|
376
407
|
});
|
|
377
408
|
}
|
|
378
409
|
|
|
@@ -465,7 +496,9 @@ const inside = (child, parent) => {
|
|
|
465
496
|
// in the copy.
|
|
466
497
|
export function jugerComposant({ depot, composant, paquets = [] }, fs) {
|
|
467
498
|
const propre = path.join(depot, composant);
|
|
468
|
-
if (fs.existe(propre))
|
|
499
|
+
if (fs.existe(propre)) {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
469
502
|
const nomme =
|
|
470
503
|
paquets.find(p => p.pkg?.name === composant) ??
|
|
471
504
|
paquets.find(p => path.basename(p.dossier) === composant);
|
|
@@ -492,8 +525,8 @@ export function jugerComposant({ depot, composant, paquets = [] }, fs) {
|
|
|
492
525
|
// exist is not mounted. `sorties` lists, from the root of the copy,
|
|
493
526
|
// where a run of the language's tools writes (`sortiesDuLangage`): `ecrites` in writing, `propres`
|
|
494
527
|
// an empty directory proper to the session, there and in each package of the material the role
|
|
495
|
-
// does not write; one that does not exist,
|
|
496
|
-
// mounted. `fs` gives `existe(path)`, and `lien(path)`, the text of a link or null, so the plan is
|
|
528
|
+
// does not write; one that does not exist is not mounted, and one that a symbolic link carries out
|
|
529
|
+
// of the copy is mounted at its real path as a store, whatever the plan writes. `fs` gives `existe(path)`, and `lien(path)`, the text of a link or null, so the plan is
|
|
497
530
|
// testable without disk.
|
|
498
531
|
/**
|
|
499
532
|
* @param {{
|
|
@@ -539,7 +572,9 @@ export function plan(
|
|
|
539
572
|
}
|
|
540
573
|
for (const p of paquets) {
|
|
541
574
|
const refus = jugerComposant({ depot: copie, composant: p, paquets: paquetsDeLaCopie }, fs);
|
|
542
|
-
if (refus)
|
|
575
|
+
if (refus) {
|
|
576
|
+
return { refus };
|
|
577
|
+
}
|
|
543
578
|
}
|
|
544
579
|
const ecrits = ecritsDuPlan(paquets, paquetsDeLaCopie);
|
|
545
580
|
const toute = ecrits.includes('.');
|
|
@@ -559,14 +594,47 @@ export function plan(
|
|
|
559
594
|
'/proc',
|
|
560
595
|
];
|
|
561
596
|
for (const { chemin, source = chemin, ecriture, vide, lien } of montages) {
|
|
562
|
-
if (vide)
|
|
563
|
-
|
|
564
|
-
else if (
|
|
597
|
+
if (vide) {
|
|
598
|
+
args.push('--tmpfs', chemin);
|
|
599
|
+
} else if (lien !== undefined) {
|
|
600
|
+
args.push('--symlink', lien, chemin);
|
|
601
|
+
} else if (fs.existe(source)) {
|
|
602
|
+
args.push(ecriture ? '--bind' : '--ro-bind', source, chemin);
|
|
603
|
+
}
|
|
565
604
|
}
|
|
566
|
-
// A
|
|
605
|
+
// A declared path (read, store, written output) is mounted at its real path, never at a link,
|
|
606
|
+
// by the one mechanism the session's mounts use (`avecLiens`): the links of its chain that an
|
|
607
|
+
// emptied directory hides, and no declared path holds, are made again before the emptied
|
|
608
|
+
// directories are sealed. A written output of the copy is mounted as a store when a link carries
|
|
609
|
+
// it out of the copy, whether the plan writes one package or the whole copy.
|
|
610
|
+
const lienDe = fs.lien ?? (() => null);
|
|
567
611
|
const videes = montages.filter(m => m.vide).map(m => m.chemin);
|
|
612
|
+
const declarees = [
|
|
613
|
+
...lectures.map(chemin => ({ chemin, ecriture: false, monter: true, genre: 'lu' })),
|
|
614
|
+
...magasins.map(chemin => ({ chemin, ecriture: true, monter: true, genre: 'ecrit' })),
|
|
615
|
+
...sorties.ecrites.map(s => ({
|
|
616
|
+
chemin: path.join(copie, s),
|
|
617
|
+
ecriture: true,
|
|
618
|
+
monter: true,
|
|
619
|
+
genre: 'sortie',
|
|
620
|
+
})),
|
|
621
|
+
];
|
|
622
|
+
const suivis = avecLiens(declarees, lienDe, fs.existe, montages);
|
|
623
|
+
const refaits = suivis.filter(m => m.lien !== undefined);
|
|
624
|
+
const reels = genre =>
|
|
625
|
+
suivis.flatMap(m =>
|
|
626
|
+
m.lien === undefined && m.genre === genre && fs.existe(m.chemin) ? [m.chemin] : []
|
|
627
|
+
);
|
|
628
|
+
const reelsLus = reels('lu');
|
|
629
|
+
const reelsEcrits = [...reels('ecrit'), ...reels('sortie').filter(c => !inside(c, copie))];
|
|
630
|
+
for (const { chemin, lien } of refaits) {
|
|
631
|
+
args.push('--symlink', lien, chemin);
|
|
632
|
+
}
|
|
633
|
+
// A worktree that an emptied directory covers comes back read-only, before the copy is written.
|
|
568
634
|
for (const t of trees) {
|
|
569
|
-
if (videes.some(v => inside(t, v)) && fs.existe(t))
|
|
635
|
+
if (videes.some(v => inside(t, v)) && fs.existe(t)) {
|
|
636
|
+
args.push('--ro-bind', t, t);
|
|
637
|
+
}
|
|
570
638
|
}
|
|
571
639
|
// The copy is mounted after them: an emptied /tmp does not hide it. It is read-only, and the
|
|
572
640
|
// packages of the plan come back in writing below, as a sandbox of Bazel opens only what the
|
|
@@ -575,24 +643,34 @@ export function plan(
|
|
|
575
643
|
// root writes the whole copy. Its .git stays read-only.
|
|
576
644
|
args.push(toute ? '--bind' : '--ro-bind', copie, copie);
|
|
577
645
|
if (!toute) {
|
|
578
|
-
for (const s of sortiesDe(copie, sorties.propres, fs.lien))
|
|
579
|
-
if (fs.existe(s))
|
|
580
|
-
|
|
581
|
-
|
|
646
|
+
for (const s of sortiesDe(copie, sorties.propres, fs.lien)) {
|
|
647
|
+
if (fs.existe(s)) {
|
|
648
|
+
args.push('--tmpfs', s);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
for (const s of sortiesDe(copie, sorties.ecrites, fs.lien)) {
|
|
652
|
+
if (fs.existe(s)) {
|
|
653
|
+
args.push('--bind', s, s);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
582
656
|
}
|
|
583
657
|
const gitDeLaCopie = path.join(copie, '.git');
|
|
584
|
-
if (fs.existe(gitDeLaCopie))
|
|
658
|
+
if (fs.existe(gitDeLaCopie)) {
|
|
659
|
+
args.push('--ro-bind', gitDeLaCopie, gitDeLaCopie);
|
|
660
|
+
}
|
|
585
661
|
// What the language's tools read (cargo's home) comes back read-only; then the stores inside it
|
|
586
662
|
// or beside it (Turborepo's cache, cargo's registry and locks) are written by the agent's runs,
|
|
587
663
|
// as by every copy's.
|
|
588
|
-
for (const l of
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
664
|
+
for (const l of reelsLus) {
|
|
665
|
+
args.push('--ro-bind', l, l);
|
|
666
|
+
}
|
|
667
|
+
for (const m of reelsEcrits) {
|
|
668
|
+
args.push('--bind', m, m);
|
|
592
669
|
}
|
|
593
|
-
for (const m of magasins) if (fs.existe(m)) args.push('--bind', m, m);
|
|
594
670
|
const tickets = trees.length > 0 ? path.join(trees[0], '.beads') : null;
|
|
595
|
-
if (tickets && fs.existe(tickets))
|
|
671
|
+
if (tickets && fs.existe(tickets)) {
|
|
672
|
+
args.push('--bind', tickets, tickets);
|
|
673
|
+
}
|
|
596
674
|
if (!toute) {
|
|
597
675
|
for (const e of ecrits) {
|
|
598
676
|
const d = path.join(copie, e);
|
|
@@ -601,19 +679,28 @@ export function plan(
|
|
|
601
679
|
// The lock files of the versions, which a run of the testwriter's tests brings in line with
|
|
602
680
|
// the dependencies of his tests, are written by him alone.
|
|
603
681
|
for (const v of verrous.map(v => path.join(copie, v))) {
|
|
604
|
-
if (role === ROLE_MATIERE && fs.existe(v))
|
|
682
|
+
if (role === ROLE_MATIERE && fs.existe(v)) {
|
|
683
|
+
args.push('--bind', v, v);
|
|
684
|
+
}
|
|
605
685
|
}
|
|
606
686
|
}
|
|
607
687
|
for (const m of matieres.map(m => path.join(copie, m))) {
|
|
608
688
|
args.push(role === ROLE_MATIERE ? '--bind' : '--ro-bind', m, m);
|
|
609
689
|
// What a run of its tests writes goes, for a role that does not write it, to an empty
|
|
610
690
|
// directory proper to the session, as Bazel writes a test's logs out of its source.
|
|
611
|
-
if (role === ROLE_MATIERE)
|
|
612
|
-
|
|
613
|
-
|
|
691
|
+
if (role === ROLE_MATIERE) {
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
for (const s of sortiesDe(m, sorties.propres, fs.lien)) {
|
|
695
|
+
if (fs.existe(s)) {
|
|
696
|
+
args.push('--tmpfs', s);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
614
699
|
}
|
|
615
700
|
// The emptied directories close behind the mounts: nothing new is written there.
|
|
616
|
-
for (const { chemin } of montages.filter(m => m.scelle))
|
|
701
|
+
for (const { chemin } of montages.filter(m => m.scelle)) {
|
|
702
|
+
args.push('--remount-ro', chemin);
|
|
703
|
+
}
|
|
617
704
|
args.push('--chdir', copie);
|
|
618
705
|
return { args };
|
|
619
706
|
}
|
|
@@ -636,7 +723,9 @@ function cacheDeLaVersionPubliee(copie) {
|
|
|
636
723
|
} catch {
|
|
637
724
|
return null;
|
|
638
725
|
}
|
|
639
|
-
if (version === null)
|
|
726
|
+
if (version === null) {
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
640
729
|
try {
|
|
641
730
|
installer(version);
|
|
642
731
|
} catch (e) {
|
|
@@ -704,7 +793,9 @@ function envelopper(argv) {
|
|
|
704
793
|
// killed (../mesure/base-de-passe.mjs).
|
|
705
794
|
const temporaire = ouvrirBase('enveloppe');
|
|
706
795
|
const etatJetable = path.join(temporaire.dossier, 'claude.json');
|
|
707
|
-
if (existsSync(`${claude}.json`))
|
|
796
|
+
if (existsSync(`${claude}.json`)) {
|
|
797
|
+
copyFileSync(`${claude}.json`, etatJetable);
|
|
798
|
+
}
|
|
708
799
|
const montages = avecLiens(
|
|
709
800
|
montagesDeLaSeance({
|
|
710
801
|
cacheNpm,
|
|
@@ -787,7 +878,9 @@ function envelopper(argv) {
|
|
|
787
878
|
donnees,
|
|
788
879
|
});
|
|
789
880
|
const r = spawnSync(lancement.cmd, lancement.args, { stdio: 'inherit', env: lancement.env });
|
|
790
|
-
if (r.error)
|
|
881
|
+
if (r.error) {
|
|
882
|
+
process.stderr.write(`⛔ ENVELOPPE IMPOSSIBLE — ${r.error.message}\n`);
|
|
883
|
+
}
|
|
791
884
|
code = r.error ? CODE_REFUS : (r.status ?? 1);
|
|
792
885
|
}
|
|
793
886
|
temporaire.fermer();
|