@roomi-fields/grillhouse 0.29.0 → 0.31.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 +769 -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/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 +30 -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 +94 -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 +120 -0
- package/dist/temporal/installation.js +386 -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 +646 -87
- package/docs/CADRE.md +27 -0
- package/docs/INTERFACE.md +139 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2255 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +40 -14
- package/scripts/avancement.mjs +155 -26
- package/scripts/bilan.mjs +137 -43
- package/scripts/cadre.mjs +16 -4
- package/scripts/circuit.mjs +993 -4075
- 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/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +18 -12
- package/scripts/conformite.mjs +56 -28
- 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 +121 -0
- package/scripts/dernier-vert.mjs +61 -34
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +244 -0
- package/scripts/droits.mjs +51 -16
- package/scripts/effets.mjs +352 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +259 -55
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
- 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 +201 -0
- package/scripts/gardes-du-cadre.mjs +21 -5
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +544 -434
- package/scripts/integration/integrer.mjs +87 -43
- package/scripts/integration/rejeu.mjs +45 -13
- package/scripts/jointure.d.ts +151 -28
- package/scripts/langages/cargo/commandes.mjs +383 -124
- package/scripts/langages/cargo/composants.mjs +154 -42
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +22 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +218 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +28 -8
- package/scripts/langages/python/lot.mjs +1 -36
- 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/construire.mjs +6 -163
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +50 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
- 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-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -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/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 +93 -20
- package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
- package/scripts/langages/typescript/tests.mjs +40 -15
- package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
- package/scripts/langages/typescript/verdict.mjs +4 -2
- package/scripts/langages/typescript/verifier.mjs +58 -20
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +12 -6
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- 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 +56 -18
- 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 +124 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +25 -3
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +18 -8
- package/scripts/paquet-npm.mjs +157 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +46 -10
- package/scripts/passe-de-la-machine.mjs +71 -0
- package/scripts/places-de-la-machine.mjs +414 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +25 -8
- package/scripts/registre.mjs +9 -4
- 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/reprise.mjs +66 -0
- package/scripts/resultats.mjs +112 -46
- 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 +936 -0
- package/scripts/services-du-noyau.mjs +27 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +41 -10
- package/scripts/style-a-l-ecriture.mjs +260 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +180 -117
- package/scripts/taches-du-graphe.mjs +348 -0
- package/scripts/ticket-du-circuit.mjs +216 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +1018 -0
- package/scripts/verrou-de-fichier.mjs +8 -4
- package/scripts/verrou-de-machine.mjs +150 -51
- 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/explorateur/SKILL.md +9 -2
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- 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 +5 -3
- package/skills/testwriter/SKILL.md +49 -31
- 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
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 »),
|
|
@@ -323,6 +348,16 @@ function reglagesDuRole(role, { racine, copie = racine, ticket, home }) {
|
|
|
323
348
|
),
|
|
324
349
|
env: SANS_TACHE_DE_FOND,
|
|
325
350
|
};
|
|
351
|
+
// The write lock runs the frame of the main tree, never the copy's; a copy that is the root keeps
|
|
352
|
+
// the project's own command.
|
|
353
|
+
const distincte = path.resolve(copie) !== path.resolve(racine);
|
|
354
|
+
const cadre = distincte ? racine : '$CLAUDE_PROJECT_DIR';
|
|
355
|
+
const commande = `"${cadre}/node_modules/.bin/grillhouse"`;
|
|
356
|
+
// Fails closed (a firewall's rule): a missing command makes the shell exit 127, which Claude Code
|
|
357
|
+
// reads as an error that does not block, so a copy with a main tree lacking the frame refuses (2).
|
|
358
|
+
const verrou = distincte
|
|
359
|
+
? `[ -x ${commande} ] || { echo "⛔ verrou : le cadre de l'arbre principal manque ou n'est pas exécutable : ${cadre}/node_modules/.bin/grillhouse (écriture refusée)" >&2; exit 2; }; exec ${commande} verrou ${role}`
|
|
360
|
+
: `${commande} verrou ${role}`;
|
|
326
361
|
if (r.ecrit) {
|
|
327
362
|
reglages.hooks = {
|
|
328
363
|
PreToolUse: [
|
|
@@ -331,7 +366,7 @@ function reglagesDuRole(role, { racine, copie = racine, ticket, home }) {
|
|
|
331
366
|
hooks: [
|
|
332
367
|
{
|
|
333
368
|
type: 'command',
|
|
334
|
-
command:
|
|
369
|
+
command: verrou,
|
|
335
370
|
},
|
|
336
371
|
],
|
|
337
372
|
},
|
|
@@ -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
|
+
}
|
|
@@ -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)));
|