@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/conformite.mjs
CHANGED
|
@@ -17,15 +17,13 @@
|
|
|
17
17
|
// - composantDe: each file of the entry lies in the component it names, among `composants`;
|
|
18
18
|
// - lecteurs: what each component reads of another, by its code, and each name of the entry no
|
|
19
19
|
// component provides;
|
|
20
|
-
// - touches: what changed since the commit of the entry, each component touched, each dependent
|
|
21
|
-
// and each file out of the graph;
|
|
22
20
|
// - commandes: each command named is described (`{ script, args }`, the script a file), and asking
|
|
23
21
|
// them writes nothing in the repository;
|
|
24
22
|
// - verdict: each task neither green nor unplayed (« à repasser » at 75, red otherwise), the one
|
|
25
23
|
// that plays the tests marked, and each test failed;
|
|
26
24
|
// - estUnTest: each path the testwriter writes, with what it is (`joue`, `test`, `matiere`);
|
|
27
|
-
// - versionDeHead (`soeurDAvant`, `testsDeHead`): each path
|
|
28
|
-
// with it, said when the sibling is the path itself or lies in another folder, and each path
|
|
25
|
+
// - versionDeHead (`soeurDAvant`, `arbreDAvant`, `testsDeHead`): each path whose HEAD's version
|
|
26
|
+
// plays in a tree (`→ un arbre`), and each that has a sibling for it, with it, said when the sibling is the path itself or lies in another folder, and each path
|
|
29
27
|
// whose names of tests the module reads in HEAD's version (the entry a path, or `{ chemin,
|
|
30
28
|
// textes }`, HEAD's text of each file by its path), with them, said when it has both; the
|
|
31
29
|
// entry's expected siblings are names the module's tool plays, of their file's class;
|
|
@@ -44,9 +42,13 @@ import { isDeepStrictEqual } from 'node:util';
|
|
|
44
42
|
const preparees = new WeakMap();
|
|
45
43
|
// The entries of <exemples> under <dans>, prepared once.
|
|
46
44
|
function entrees(exemples, dans) {
|
|
47
|
-
if (!preparees.has(exemples))
|
|
45
|
+
if (!preparees.has(exemples)) {
|
|
46
|
+
preparees.set(exemples, new Map());
|
|
47
|
+
}
|
|
48
48
|
const parDossier = preparees.get(exemples);
|
|
49
|
-
if (!parDossier.has(dans))
|
|
49
|
+
if (!parDossier.has(dans)) {
|
|
50
|
+
parDossier.set(dans, exemples.preparer(dans));
|
|
51
|
+
}
|
|
50
52
|
return parDossier.get(dans);
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -55,11 +57,16 @@ function etat(racine) {
|
|
|
55
57
|
const out = new Map();
|
|
56
58
|
const parcourir = d => {
|
|
57
59
|
for (const n of readdirSync(d)) {
|
|
58
|
-
if (n === '.git')
|
|
60
|
+
if (n === '.git') {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
59
63
|
const f = path.join(d, n);
|
|
60
64
|
const s = statSync(f);
|
|
61
|
-
if (s.isDirectory())
|
|
62
|
-
|
|
65
|
+
if (s.isDirectory()) {
|
|
66
|
+
parcourir(f);
|
|
67
|
+
} else {
|
|
68
|
+
out.set(f, s.mtimeMs);
|
|
69
|
+
}
|
|
63
70
|
}
|
|
64
71
|
};
|
|
65
72
|
parcourir(racine);
|
|
@@ -101,9 +108,13 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
|
|
|
101
108
|
liste.flatMap(({ fichier, composant }) => {
|
|
102
109
|
const c = langage.composantDe(e.racine, fichier);
|
|
103
110
|
const rel = path.isAbsolute(fichier) ? path.relative(e.racine, fichier) : fichier;
|
|
104
|
-
if (!c)
|
|
111
|
+
if (!c) {
|
|
112
|
+
return [`${rel} : hors de tout composant`];
|
|
113
|
+
}
|
|
105
114
|
const connu = langage.composants(e.racine).some(k => k.dossier === c.dossier);
|
|
106
|
-
if (!connu)
|
|
115
|
+
if (!connu) {
|
|
116
|
+
return [`${rel} : dans ${c.nom}, qui n'est pas un composant`];
|
|
117
|
+
}
|
|
107
118
|
return c.nom === composant ? [] : [`${rel} : dans ${c.nom}, attendu ${composant}`];
|
|
108
119
|
}),
|
|
109
120
|
lecteurs: ({ racine, noms }) => {
|
|
@@ -118,22 +129,18 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
|
|
|
118
129
|
...l.sansFournisseur.map(n => `${n} : sans fournisseur`),
|
|
119
130
|
];
|
|
120
131
|
},
|
|
121
|
-
touches: ({ racine, depuis }) => {
|
|
122
|
-
const t = langage.touches(racine, { depuis });
|
|
123
|
-
return [
|
|
124
|
-
...t.touches.map(c => `touché ${c.nom}`),
|
|
125
|
-
...t.dependants.map(c => `dépendant ${c.nom}`),
|
|
126
|
-
...t.horsGraphe.map(f => `hors ${f}`),
|
|
127
|
-
];
|
|
128
|
-
},
|
|
129
132
|
commandes: noms => {
|
|
130
133
|
const avant = etat(e.racine);
|
|
131
134
|
const c = langage.commandes(e.racine);
|
|
132
135
|
const out = noms.flatMap(n => {
|
|
133
|
-
if (!Object.hasOwn(c, n))
|
|
136
|
+
if (!Object.hasOwn(c, n)) {
|
|
137
|
+
return [`${n} : absente`];
|
|
138
|
+
}
|
|
134
139
|
return decrite(c[n]) ? [] : [`${n} : pas une commande décrite`];
|
|
135
140
|
});
|
|
136
|
-
if (!isDeepStrictEqual(etat(e.racine), avant))
|
|
141
|
+
if (!isDeepStrictEqual(etat(e.racine), avant)) {
|
|
142
|
+
out.push('commandes écrit dans le dépôt');
|
|
143
|
+
}
|
|
137
144
|
return out;
|
|
138
145
|
},
|
|
139
146
|
verdict: dossier => {
|
|
@@ -156,17 +163,34 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
|
|
|
156
163
|
estUnTest: chemins =>
|
|
157
164
|
chemins.flatMap(chemin => {
|
|
158
165
|
const c = langage.estUnTest(chemin, e.racine);
|
|
159
|
-
if (c === null)
|
|
166
|
+
if (c === null) {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
160
169
|
return [`${chemin} : ${['joue', 'test', 'matiere'].filter(k => c[k]).join(', ')}`];
|
|
161
170
|
}),
|
|
162
171
|
versionDeHead: entrees =>
|
|
163
172
|
entrees.flatMap(x => {
|
|
164
173
|
const { chemin, textes = {} } = typeof x === 'string' ? { chemin: x } : x;
|
|
165
|
-
const s =
|
|
174
|
+
const s =
|
|
175
|
+
typeof langage.soeurDAvant === 'function' ? langage.soeurDAvant(chemin, e.racine) : null;
|
|
176
|
+
const arbre =
|
|
177
|
+
typeof langage.arbreDAvant === 'function' && langage.arbreDAvant(chemin, e.racine);
|
|
166
178
|
const noms = langage.testsDeHead(chemin, e.racine, f => textes[f] ?? null);
|
|
167
|
-
if (s !== null &&
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
if (s !== null && arbre) {
|
|
180
|
+
return [`${chemin} : une sœur et un arbre`];
|
|
181
|
+
}
|
|
182
|
+
if (arbre) {
|
|
183
|
+
return [`${chemin} → un arbre`];
|
|
184
|
+
}
|
|
185
|
+
if (s !== null && noms !== null) {
|
|
186
|
+
return [`${chemin} : une sœur et des noms lus`];
|
|
187
|
+
}
|
|
188
|
+
if (noms !== null) {
|
|
189
|
+
return [`${chemin} : ${noms.join(', ') || 'aucun test'}`];
|
|
190
|
+
}
|
|
191
|
+
if (s === null) {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
170
194
|
const aCote = s !== chemin && path.dirname(s) === path.dirname(chemin);
|
|
171
195
|
return [aCote ? `${chemin} → ${s}` : `${chemin} → ${s} : pas à côté du fichier`];
|
|
172
196
|
}),
|
|
@@ -185,7 +209,9 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
|
|
|
185
209
|
},
|
|
186
210
|
elementsDuLot: ({ racine, avant, apres }) => {
|
|
187
211
|
const l = langage.elementsDuLot(racine, { avant, apres });
|
|
188
|
-
if (l.etat !== 'fait')
|
|
212
|
+
if (l.etat !== 'fait') {
|
|
213
|
+
return [`impossible : ${l.raison}`];
|
|
214
|
+
}
|
|
189
215
|
return [
|
|
190
216
|
...l.fichiers.map(f => `fichier ${f}`),
|
|
191
217
|
...l.horsDuService.map(f => `hors du service ${f}`),
|
|
@@ -222,7 +248,9 @@ export function echecs(langage, exemples, options) {
|
|
|
222
248
|
return cas(langage, exemples, options).flatMap(c => {
|
|
223
249
|
try {
|
|
224
250
|
const v = c.valide();
|
|
225
|
-
if (v.length)
|
|
251
|
+
if (v.length) {
|
|
252
|
+
return [{ nom: c.nom, raison: `entrée valide : ${v.join(' ; ')}` }];
|
|
253
|
+
}
|
|
226
254
|
const i = c.invalide();
|
|
227
255
|
if (!isDeepStrictEqual(i, c.attendu)) {
|
|
228
256
|
return [
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
// CI pipeline (Jenkins « Workspace Cleanup »): no copy outlives the entry of its content on main,
|
|
5
5
|
// and no target directory its ticket (grillhouse-cyr: 34 GB of target/ under synthhub's copies).
|
|
6
6
|
//
|
|
7
|
-
//
|
|
7
|
+
// Its command is ./retirer-les-copies-finies.mjs, which reads the circuits that run on the Temporal
|
|
8
|
+
// server; this module imports nothing of the built `dist/`, since the lock of the machine and the
|
|
9
|
+
// base configuration of the tests import it.
|
|
8
10
|
//
|
|
9
11
|
// - The night's copy (`.claude/worktrees/nuit`) is always left out: the night prepares and
|
|
10
12
|
// removes its own.
|
|
@@ -26,18 +28,21 @@
|
|
|
26
28
|
// progress (the copy's folder bears the ticket's id, `.claude/worktrees/<ticket>`, as the
|
|
27
29
|
// circuit and the launcher name it; read by `bd list --status in_progress`), the working
|
|
28
30
|
// directory of its circuit (`<copie>.travail`, which lives as long as the ticket,
|
|
29
|
-
// scripts/circuit.mjs), or, for the integration copy
|
|
30
|
-
//
|
|
31
|
-
//
|
|
31
|
+
// scripts/circuit.mjs), or, for the integration copy (`.claude/worktrees/integration`), its
|
|
32
|
+
// lock in git's common directory (`integration.lock`, scripts/integration/integrer.mjs). The
|
|
33
|
+
// queue copy (`.claude/worktrees/file`) always stays: the workflow of the queue plays in it
|
|
34
|
+
// without a lock, one entry at a time, and prepares it again before each replay. Tickets in
|
|
32
35
|
// progress that do not read, or not within a minute, hold every copy: none is removed. They are
|
|
33
36
|
// read only when a copy is left to judge: a repository with no copy but the night's calls no bd.
|
|
34
37
|
// A locked copy (`git worktree lock`, as Claude Code locks the copy of a live agent) stays too.
|
|
35
|
-
// A copy whose circuit no longer runs (its `<copie>.travail` there, the
|
|
36
|
-
//
|
|
37
|
-
// its code and commits untouched, and its line says so with the place it holds and that
|
|
38
|
-
// of its tools' outputs (« son circuit ne tourne plus
|
|
39
|
-
//
|
|
40
|
-
//
|
|
38
|
+
// A copy whose circuit no longer runs (its `<copie>.travail` there, its ticket out of the
|
|
39
|
+
// circuits the Temporal server runs, which its caller gives, `vivants`), its ticket still open,
|
|
40
|
+
// stays, its code and commits untouched, and its line says so with the place it holds and that
|
|
41
|
+
// of each of its tools' outputs (« son circuit ne tourne plus ; target y tient 5,1 Go ; son code
|
|
42
|
+
// et ses commits restent »): 5.2 GB of SyntHub's SH-cgi.8.2 were kept so under the words of a
|
|
43
|
+
// running circuit (grillhouse-k5y). Without the circuits that run (the server unread, or the end
|
|
44
|
+
// of a circuit, whose act reads no server), its line says only that its circuit has its
|
|
45
|
+
// working directory.
|
|
41
46
|
// - The count of what holds the disk of a copy (`occupantsDesCopies`), which the wait for room of
|
|
42
47
|
// a heavy pass names (scripts/verrou-de-machine.mjs): the copies of its repository, the five
|
|
43
48
|
// largest first, each with its ticket (the copy's folder, but the frame's copies that last and
|
|
@@ -72,17 +77,18 @@
|
|
|
72
77
|
// output, which the night adds to its log. The exit is
|
|
73
78
|
// 0 whatever is removed or kept: the removal never changes the night's verdict.
|
|
74
79
|
import { spawnSync } from 'node:child_process';
|
|
75
|
-
import { existsSync, lstatSync,
|
|
80
|
+
import { existsSync, lstatSync, realpathSync, rmSync } from 'node:fs';
|
|
76
81
|
import path from 'node:path';
|
|
77
|
-
import { pathToFileURL } from 'node:url';
|
|
78
82
|
import { PILOTE } from './fusion-du-changelog.mjs';
|
|
79
83
|
import { langageDe } from './langages.mjs';
|
|
80
|
-
import { balayerLesTickets
|
|
84
|
+
import { balayerLesTickets } from './mesure/base-de-passe.mjs';
|
|
81
85
|
|
|
82
86
|
const RETIRER = path.join(import.meta.dirname, 'retirer-copie.sh');
|
|
83
87
|
const PRINCIPALE = 'main';
|
|
84
88
|
// The copies of the integration and of the queue, each held while its lock stands.
|
|
85
|
-
const VERROUS = { integration: 'integration.lock'
|
|
89
|
+
const VERROUS = { integration: 'integration.lock' };
|
|
90
|
+
// The queue copy, which the workflow of the queue holds without a lock (src/temporal/file/).
|
|
91
|
+
const DE_LA_FILE = 'file';
|
|
86
92
|
// The install of a copy: a link to the main tree's, or its own directory.
|
|
87
93
|
const INSTALLATION = 'node_modules';
|
|
88
94
|
// The folder of the copies of a repository, from its main tree.
|
|
@@ -92,7 +98,7 @@ const NUIT = path.join(COPIES, 'nuit');
|
|
|
92
98
|
// The frame's copies that last, each prepared again before its pass, every untracked file removed
|
|
93
99
|
// (`git clean -x`, scripts/nuit.sh and scripts/integration/rejeu.mjs): the night's, the
|
|
94
100
|
// integration's, the queue's. Their folder bears no ticket.
|
|
95
|
-
const DURABLES = new Set(['nuit', ...Object.keys(VERROUS)]);
|
|
101
|
+
const DURABLES = new Set(['nuit', DE_LA_FILE, ...Object.keys(VERROUS)]);
|
|
96
102
|
|
|
97
103
|
const lancer = (dossier, cmd, args) =>
|
|
98
104
|
spawnSync(cmd, args, { cwd: dossier, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
@@ -121,25 +127,16 @@ function lesCopies(racine) {
|
|
|
121
127
|
}));
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
const lireJson = f => {
|
|
125
|
-
try {
|
|
126
|
-
return JSON.parse(readFileSync(f, 'utf8'));
|
|
127
|
-
} catch {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
130
|
// What holds the copy <chemin> for a running circuit or a live process (its lock), or null. A
|
|
133
|
-
// copy whose circuit no longer runs (
|
|
134
|
-
//
|
|
135
|
-
// outputs (<ignorer>) hold there.
|
|
136
|
-
function tenue({ chemin, verrou: raison }, enCours, commun, ignorer) {
|
|
131
|
+
// copy whose circuit no longer runs (its ticket out of <vivants>, the tickets whose circuit the
|
|
132
|
+
// server runs, null when unread) stays held beside its `.travail`, and its line names the place
|
|
133
|
+
// its tools' outputs (<ignorer>) hold there.
|
|
134
|
+
function tenue({ chemin, verrou: raison }, enCours, commun, ignorer, vivants) {
|
|
137
135
|
const nom = path.basename(chemin);
|
|
138
136
|
if (existsSync(`${chemin}.travail`)) {
|
|
139
|
-
|
|
140
|
-
if (etat && !leMemeVivant(etat.processus, etat.depart)) {
|
|
137
|
+
if (vivants && !vivants.has(nom)) {
|
|
141
138
|
const sorties = placeDesSorties(chemin, ignorer).map(s => ` ; ${s}`);
|
|
142
|
-
return `son circuit ne tourne plus
|
|
139
|
+
return `son circuit ne tourne plus${sorties.join('')} ; son code et ses commits restent`;
|
|
143
140
|
}
|
|
144
141
|
return `son circuit a son dossier ${nom}.travail`;
|
|
145
142
|
}
|
|
@@ -150,8 +147,11 @@ function tenue({ chemin, verrou: raison }, enCours, commun, ignorer) {
|
|
|
150
147
|
return `elle est verrouillée${raison ? ` (${raison})` : ''}`;
|
|
151
148
|
}
|
|
152
149
|
const verrou = VERROUS[nom];
|
|
153
|
-
if (
|
|
154
|
-
if (
|
|
150
|
+
if (path.dirname(chemin).endsWith(path.join('.claude', 'worktrees'))) {
|
|
151
|
+
if (nom === DE_LA_FILE) {
|
|
152
|
+
return 'la file y rejoue ses entrées';
|
|
153
|
+
}
|
|
154
|
+
if (verrou && existsSync(path.join(commun, verrou))) {
|
|
155
155
|
return `le verrou ${verrou} est posé`;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -335,11 +335,17 @@ function elaguer(chemin, ignorer) {
|
|
|
335
335
|
* wrote there (<ignorer>, the directories the module of the language names, and `node_modules`).
|
|
336
336
|
* <elaguer> names copies left out too, whose owner has played its pass (the night's own): each
|
|
337
337
|
* loses its tools' outputs, its install kept; so does a copy of the integration or of the queue
|
|
338
|
-
* kept that no lock holds.
|
|
338
|
+
* kept that no lock holds. <vivants> names the tickets whose circuit the Temporal server runs
|
|
339
|
+
* (null when its caller does not read them): a copy beside its `.travail` whose ticket is out of
|
|
340
|
+
* them stays, its line saying its circuit no longer runs, with the place of its tools' outputs.
|
|
341
|
+
* @param {string} racine
|
|
342
|
+
* @param {{ garder?: string[], elaguer?: string[], lireEnCours: () => Set<string> | null,
|
|
343
|
+
* lireFermes: () => Set<string> | null, ignorer: string[], vivants?: Set<string> | null }} o
|
|
344
|
+
* @returns {string[]}
|
|
339
345
|
*/
|
|
340
346
|
export function retirerLesCopiesFinies(
|
|
341
347
|
racine,
|
|
342
|
-
{ garder = [], elaguer: aElaguer = [], lireEnCours, lireFermes, ignorer }
|
|
348
|
+
{ garder = [], elaguer: aElaguer = [], lireEnCours, lireFermes, ignorer, vivants = null }
|
|
343
349
|
) {
|
|
344
350
|
const [principale, ...listees] = lesCopies(racine);
|
|
345
351
|
const ici = reel(racine);
|
|
@@ -379,7 +385,10 @@ export function retirerLesCopiesFinies(
|
|
|
379
385
|
// preparation removes; then the place it holds.
|
|
380
386
|
const gardee = (chemin, raison) => {
|
|
381
387
|
const nom = path.basename(chemin);
|
|
382
|
-
if (
|
|
388
|
+
if (
|
|
389
|
+
(Object.hasOwn(VERROUS, nom) || nom === DE_LA_FILE) &&
|
|
390
|
+
path.dirname(chemin).endsWith(COPIES)
|
|
391
|
+
) {
|
|
383
392
|
const retirees = elaguer(chemin, ignorer);
|
|
384
393
|
const perte = retirees.length
|
|
385
394
|
? ` ; sa prochaine préparation l'efface : ${retirees.join(', ')}`
|
|
@@ -396,7 +405,7 @@ export function retirerLesCopiesFinies(
|
|
|
396
405
|
if (ecartees.has(reel(chemin))) {
|
|
397
406
|
continue;
|
|
398
407
|
}
|
|
399
|
-
const raison = tenue(copie, enCours, commun, ignorer);
|
|
408
|
+
const raison = tenue(copie, enCours, commun, ignorer, vivants);
|
|
400
409
|
if (raison) {
|
|
401
410
|
lignes.push(`· copie gardée : ${vu(chemin)} (${place(chemin)}) : ${raison}.`);
|
|
402
411
|
continue;
|
|
@@ -470,15 +479,18 @@ function ignoresDuLangage(racine) {
|
|
|
470
479
|
/**
|
|
471
480
|
* The removal of the copies of the repository at <racine> (`retirerLesCopiesFinies`), the copy of
|
|
472
481
|
* the night left out, the copies <finies> left out and pruned, their owner having played its pass
|
|
473
|
-
* in them (the night's own, which scripts/nuit.sh names), the tickets read by bd,
|
|
474
|
-
*
|
|
475
|
-
* of each circuit (scripts/circuit.mjs)
|
|
482
|
+
* in them (the night's own, which scripts/nuit.sh names), the tickets read by bd, the tickets
|
|
483
|
+
* whose circuit runs <vivants> (null when unread), then of the temporary directories of its closed
|
|
484
|
+
* tickets (`balayerLesTickets`): what the night and the end of each circuit (scripts/circuit.mjs)
|
|
485
|
+
* run. Its lines.
|
|
476
486
|
* @param {string} racine the main tree
|
|
477
487
|
* @param {string[]} [finies]
|
|
488
|
+
* @param {Set<string> | null} [vivants]
|
|
478
489
|
* @returns {string[]}
|
|
479
490
|
*/
|
|
480
|
-
export function retirerLesCopiesDuDepot(racine, finies = []) {
|
|
491
|
+
export function retirerLesCopiesDuDepot(racine, finies = [], vivants = null) {
|
|
481
492
|
const lignes = retirerLesCopiesFinies(racine, {
|
|
493
|
+
vivants,
|
|
482
494
|
garder: [path.join(racine, NUIT)],
|
|
483
495
|
elaguer: finies,
|
|
484
496
|
lireEnCours: () => tickets(racine, 'in_progress'),
|
|
@@ -488,10 +500,3 @@ export function retirerLesCopiesDuDepot(racine, finies = []) {
|
|
|
488
500
|
const retires = balayerLesTickets(() => tickets(racine, 'closed'));
|
|
489
501
|
return [...lignes, ...retires.map(t => `✓ dossier temporaire du ticket ${t} retiré.`)];
|
|
490
502
|
}
|
|
491
|
-
|
|
492
|
-
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
493
|
-
const lignes = retirerLesCopiesDuDepot(process.cwd(), process.argv.slice(2));
|
|
494
|
-
if (lignes.length) {
|
|
495
|
-
process.stdout.write(`${lignes.join('\n')}\n`);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// The types of ./depart-du-ticket.mjs, for the frame's TypeScript (src/temporal/circuit/commande.ts).
|
|
2
|
+
|
|
3
|
+
/** A component of the repository, as `composantsDe` lists it. */
|
|
4
|
+
export interface Composant {
|
|
5
|
+
dossier: string;
|
|
6
|
+
pkg: { name?: string };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** A ticket as Beads shows it. */
|
|
10
|
+
export interface TicketDeBeads {
|
|
11
|
+
id?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
issue_type?: string;
|
|
15
|
+
[champ: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A ticket a circuit cannot start on, by its reason. */
|
|
19
|
+
export class DepartRefuse extends Error {}
|
|
20
|
+
|
|
21
|
+
/** The directory of the component <nom> of a title among <liste>; or a refusal. */
|
|
22
|
+
export function resoudreComposant(liste: Composant[], base: string, nom: string): string;
|
|
23
|
+
|
|
24
|
+
/** The ticket <id> as `bd show --json` gives it in <sortie>, refused without its architecture. */
|
|
25
|
+
export function ticketAuDepart(
|
|
26
|
+
id: string,
|
|
27
|
+
sortie: string,
|
|
28
|
+
options?: { arreter?: boolean }
|
|
29
|
+
): TicketDeBeads;
|
|
30
|
+
|
|
31
|
+
/** The subject and the plan of the title <titre> of the ticket <id>; or a refusal. */
|
|
32
|
+
export function leTitre(
|
|
33
|
+
id: string,
|
|
34
|
+
titre: string | undefined,
|
|
35
|
+
resoudre: (nom: string) => string
|
|
36
|
+
): { sujet: string; plan: string[] };
|
|
37
|
+
|
|
38
|
+
/** The ticket <id> of the repository at <racine>, read before any work; or a refusal. */
|
|
39
|
+
export function ticketAuLancement(
|
|
40
|
+
racine: string,
|
|
41
|
+
id: string,
|
|
42
|
+
options?: {
|
|
43
|
+
arreter?: boolean;
|
|
44
|
+
bd?: ((...a: string[]) => { status: number | null; stdout: string; stderr: string }) | null;
|
|
45
|
+
}
|
|
46
|
+
): {
|
|
47
|
+
ticket: TicketDeBeads;
|
|
48
|
+
base: string;
|
|
49
|
+
liste: Composant[];
|
|
50
|
+
resoudre: (nom: string) => string;
|
|
51
|
+
sujet: string;
|
|
52
|
+
plan: string[];
|
|
53
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// The ticket a circuit starts on, read before any work, as a CI validates its configuration before
|
|
2
|
+
// it runs its jobs: `npx grillhouse circuit` refuses at the door what the circuit could not run
|
|
3
|
+
// (src/temporal/circuit/commande.ts), and the opening of each act of the circuit reads its plan
|
|
4
|
+
// the same way (scripts/circuit.mjs `contexte`).
|
|
5
|
+
//
|
|
6
|
+
// - The ticket is read by `bd show <id> --json` in the main tree; one Beads cannot show is refused.
|
|
7
|
+
// - Its description holds a « ## Architecture » section, by the rule of the developer's lock
|
|
8
|
+
// (`sansArchitecture` of ./verrous/verrou.mjs): the code waits for the architecture. The
|
|
9
|
+
// supervisor's stop (`--arreter`) reads neither it nor the title: it does not depend on the
|
|
10
|
+
// ticket's content, as GitLab cancels a pipeline whatever its configuration; its plan is empty.
|
|
11
|
+
// - Its title names its plan after its last « — », separated by commas: each one a path
|
|
12
|
+
// (`packages/<nom>`, or `.`), or the name of a package, which becomes its directory, read in the
|
|
13
|
+
// ticket's copy when it exists, else in the main tree (`composantsDe`). A title without it, and
|
|
14
|
+
// a component that names neither, are refused by their name. An act after the opening is given
|
|
15
|
+
// the plan its workflow holds (<plan>) and reads only the subject of the title: the integration
|
|
16
|
+
// removes the ticket's copy while the circuit still runs, and a component the lot creates is in
|
|
17
|
+
// neither tree then.
|
|
18
|
+
// Each refusal is a `DepartRefuse`, its reason its message.
|
|
19
|
+
import { spawnSync } from 'node:child_process';
|
|
20
|
+
import { existsSync } from 'node:fs';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { composantsDe } from './ticket-du-circuit.mjs';
|
|
23
|
+
import { sansArchitecture } from './verrous/verrou.mjs';
|
|
24
|
+
|
|
25
|
+
/** A ticket a circuit cannot start on, by its reason. */
|
|
26
|
+
export class DepartRefuse extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = 'DepartRefuse';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The directory of the component <nom> of a title among <liste> (`composantsDe` of the repository
|
|
35
|
+
* at <base>): `.` itself; a component by its path or its name; else a path of the repository; or a
|
|
36
|
+
* refusal.
|
|
37
|
+
*/
|
|
38
|
+
export function resoudreComposant(liste, base, nom) {
|
|
39
|
+
const brut = path.normalize(nom);
|
|
40
|
+
const norme = brut.endsWith('/') ? brut.slice(0, -1) : brut;
|
|
41
|
+
if (norme === '.') {
|
|
42
|
+
return '.';
|
|
43
|
+
}
|
|
44
|
+
if (liste.some(p => p.dossier === norme)) {
|
|
45
|
+
return norme;
|
|
46
|
+
}
|
|
47
|
+
const parNom = liste.find(p => p.pkg.name === nom);
|
|
48
|
+
if (parNom) {
|
|
49
|
+
return parNom.dossier;
|
|
50
|
+
}
|
|
51
|
+
if (!norme.startsWith('..') && existsSync(path.join(base, norme))) {
|
|
52
|
+
return norme;
|
|
53
|
+
}
|
|
54
|
+
throw new DepartRefuse(
|
|
55
|
+
`le composant « ${nom} » du titre ne nomme ni un paquet ni un chemin du dépôt.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The ticket <id> as `bd show --json` gives it in <sortie>, refused when its description holds no
|
|
61
|
+
* « ## Architecture » section, unless the call is the supervisor's stop (<arreter>).
|
|
62
|
+
*/
|
|
63
|
+
export function ticketAuDepart(id, sortie, { arreter = false } = {}) {
|
|
64
|
+
const t = JSON.parse(sortie)[0];
|
|
65
|
+
const refus = arreter ? null : sansArchitecture(id, t?.description);
|
|
66
|
+
if (refus) {
|
|
67
|
+
throw new DepartRefuse(refus);
|
|
68
|
+
}
|
|
69
|
+
return t;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// The subject of the title cut at its « — » into <parts>: what stands between the number and the
|
|
73
|
+
// components, or the first part of a title of two.
|
|
74
|
+
const sujetDe = parts => (parts.length > 2 ? parts.slice(1, -1).join(' — ') : parts[0]);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The subject and the plan of the title <titre> of the ticket <id>, « numéro — sujet —
|
|
78
|
+
* composants », each component resolved by <resoudre>; or a refusal.
|
|
79
|
+
*/
|
|
80
|
+
export function leTitre(id, titre, resoudre) {
|
|
81
|
+
const parts = String(titre ?? '').split(' — ');
|
|
82
|
+
if (parts.length < 2) {
|
|
83
|
+
throw new DepartRefuse(`le titre de ${id} ne nomme pas ses composants.`);
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
sujet: sujetDe(parts),
|
|
87
|
+
plan: parts
|
|
88
|
+
.at(-1)
|
|
89
|
+
.split(',')
|
|
90
|
+
.map(c => c.trim())
|
|
91
|
+
.filter(Boolean)
|
|
92
|
+
.map(resoudre),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The ticket <id> of the repository whose main tree is <racine>, read before any work: the ticket
|
|
98
|
+
* as Beads shows it, the tree its components are read in (`base`, its copy when it exists), the
|
|
99
|
+
* components of that tree, the resolver of a component, the subject and the plan of its title (the
|
|
100
|
+
* title whole and no plan for the supervisor's stop, <arreter>; the plan <plan> an act after the
|
|
101
|
+
* opening is given, its components not resolved again); or a refusal. <bd> runs bd in the main
|
|
102
|
+
* tree, `bd` by default.
|
|
103
|
+
*/
|
|
104
|
+
export function ticketAuLancement(racine, id, { arreter = false, bd = null, plan = null } = {}) {
|
|
105
|
+
const show = (
|
|
106
|
+
bd ??
|
|
107
|
+
((...a) => spawnSync('bd', a, { cwd: racine, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 }))
|
|
108
|
+
)('show', id, '--json');
|
|
109
|
+
if (show.status !== 0) {
|
|
110
|
+
throw new DepartRefuse(`ticket ${id} illisible : ${show.stderr}`);
|
|
111
|
+
}
|
|
112
|
+
const ticket = ticketAuDepart(id, show.stdout, { arreter });
|
|
113
|
+
const copie = path.join(racine, '.claude', 'worktrees', id);
|
|
114
|
+
const base = existsSync(copie) ? copie : racine;
|
|
115
|
+
const liste = composantsDe(base);
|
|
116
|
+
const resoudre = nom => resoudreComposant(liste, base, nom);
|
|
117
|
+
// The supervisor's stop reads neither the ticket's « ## Architecture » section nor its title.
|
|
118
|
+
const titre = arreter
|
|
119
|
+
? { sujet: String(ticket?.title ?? id), plan: [] }
|
|
120
|
+
: plan
|
|
121
|
+
? { sujet: sujetDe(String(ticket?.title ?? '').split(' — ')), plan }
|
|
122
|
+
: leTitre(id, ticket?.title, resoudre);
|
|
123
|
+
return { ticket, base, liste, resoudre, ...titre };
|
|
124
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The guard of the internal dependencies of the packages of a language other than TypeScript: the
|
|
3
|
+
// package.json of a crate or of a project of Python names the same internal packages as its
|
|
4
|
+
// manifest, because Turborepo orders the tasks by the graph of the package.json
|
|
5
|
+
// (node_modules/turbo/docs/guides/multi-language.mdx:191) while cargo and uv build by the graph of
|
|
6
|
+
// the manifest, as Turborepo's own example of Rust keeps the two by hand.
|
|
7
|
+
//
|
|
8
|
+
// npx grillhouse dependances-internes (one of the frame's guards, scripts/gardes-du-cadre.mjs)
|
|
9
|
+
//
|
|
10
|
+
// - The packages are those the architecture declares of a language without package.json of its own
|
|
11
|
+
// (`paquetsSansPackageJson`, ./paquet-npm.mjs) that hold a package.json; one without it is the
|
|
12
|
+
// migration's (./migrations/0.31.0-paquets-dans-le-graphe.mjs).
|
|
13
|
+
// - The internal dependencies of the manifest: of a Cargo.toml, each dependency with a `path`
|
|
14
|
+
// (`[dependencies]`, `[dev-dependencies]`, `[build-dependencies]`, and the same under
|
|
15
|
+
// `[target.*]`; a `workspace = true` one takes the `path` of `[workspace.dependencies]` of the
|
|
16
|
+
// root), named by the `name` of the manifest at that path; of a pyproject.toml, each entry of
|
|
17
|
+
// `[tool.uv.sources]` with a `path` (named by the manifest there) or `workspace = true`.
|
|
18
|
+
// - The internal dependencies of the package.json: the names of its `dependencies`,
|
|
19
|
+
// `devDependencies`, `optionalDependencies` and `peerDependencies` that are the name of a package
|
|
20
|
+
// of the project (the ones above and the workspaces'). An external dependency, on either side,
|
|
21
|
+
// is no gap.
|
|
22
|
+
// - Refused, one finding per package, named with the dependencies in gap in each sense: the
|
|
23
|
+
// package.json that lacks a dependency its manifest links, or names an internal package its
|
|
24
|
+
// manifest does not link. Written in SARIF under the guard's name, and on the error stream after
|
|
25
|
+
// ⛔; the exit code is 1 when there is one, 0 otherwise.
|
|
26
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
27
|
+
import path from 'node:path';
|
|
28
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
29
|
+
import { langage } from './langages.mjs';
|
|
30
|
+
import { nomDuManifeste, paquetsSansPackageJson, sansPackageJson } from './paquet-npm.mjs';
|
|
31
|
+
import { paquets } from './paquets.mjs';
|
|
32
|
+
import { ecrireSarif } from './resultats.mjs';
|
|
33
|
+
|
|
34
|
+
/** This script. */
|
|
35
|
+
export const SCRIPT = fileURLToPath(import.meta.url);
|
|
36
|
+
/** The name its findings carry. */
|
|
37
|
+
export const GARDE = 'dependances-internes';
|
|
38
|
+
|
|
39
|
+
// The fields of a package.json that name the packages it depends on.
|
|
40
|
+
const CHAMPS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
41
|
+
|
|
42
|
+
const lire = f => (existsSync(f) ? readFileSync(f, 'utf8') : null);
|
|
43
|
+
|
|
44
|
+
// The name of the package whose manifest lies in <dossier>, the one of <langageNom> first (a crate
|
|
45
|
+
// may link a project of Python), null for none.
|
|
46
|
+
function nomA(langageNom, dossier) {
|
|
47
|
+
for (const l of [langageNom, ...sansPackageJson()]) {
|
|
48
|
+
const texte = lire(path.join(dossier, langage(l).manifeste));
|
|
49
|
+
const nom = texte === null ? null : nomDuManifeste(l, texte);
|
|
50
|
+
if (nom !== null) {
|
|
51
|
+
return nom;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The findings of the guard on the project at <racine>: `{ fichier, message }`, none when each
|
|
59
|
+
* package.json and its manifest agree.
|
|
60
|
+
* @param {string} racine the root of the project
|
|
61
|
+
*/
|
|
62
|
+
export function constats(racine) {
|
|
63
|
+
const sans = paquetsSansPackageJson(racine);
|
|
64
|
+
const internes = new Set([...sans.map(p => p.nom), ...paquets(racine).map(p => p.pkg.name)]);
|
|
65
|
+
const out = [];
|
|
66
|
+
for (const p of sans) {
|
|
67
|
+
const f = `${p.chemin}/package.json`;
|
|
68
|
+
const texte = lire(path.join(racine, f));
|
|
69
|
+
if (texte === null) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
let pkg;
|
|
73
|
+
try {
|
|
74
|
+
pkg = JSON.parse(texte);
|
|
75
|
+
} catch {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const manifeste = langage(p.langage).manifeste;
|
|
79
|
+
const liens = langage(p.langage).liensDuManifeste(racine, p.chemin, d => nomA(p.langage, d));
|
|
80
|
+
const duManifeste = new Set(liens.noms);
|
|
81
|
+
duManifeste.delete(p.nom);
|
|
82
|
+
const duPackage = new Set(
|
|
83
|
+
CHAMPS.flatMap(c => Object.keys(pkg[c] ?? {})).filter(n => internes.has(n) && n !== p.nom)
|
|
84
|
+
);
|
|
85
|
+
const manquantes = [...duManifeste].filter(n => !duPackage.has(n)).sort();
|
|
86
|
+
const enTrop = [...duPackage].filter(n => !duManifeste.has(n)).sort();
|
|
87
|
+
if (!manquantes.length && !enTrop.length) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const dits = [
|
|
91
|
+
...(manquantes.length
|
|
92
|
+
? [
|
|
93
|
+
`${manifeste} lie ${manquantes.join(', ')} (${liens.table}), que le package.json ne nomme pas`,
|
|
94
|
+
]
|
|
95
|
+
: []),
|
|
96
|
+
...(enTrop.length
|
|
97
|
+
? [`le package.json nomme ${enTrop.join(', ')}, que ${manifeste} ne lie pas`]
|
|
98
|
+
: []),
|
|
99
|
+
];
|
|
100
|
+
out.push({
|
|
101
|
+
fichier: f,
|
|
102
|
+
message: `${f} : le paquet ${p.nom} diffère de son manifeste dans ses dépendances internes : ${dits.join(' ; ')} ; le graphe des tâches suit le package.json, ${liens.outil} par ${manifeste} : les deux nomment les mêmes paquets.`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
109
|
+
const racine = process.cwd();
|
|
110
|
+
let refus;
|
|
111
|
+
try {
|
|
112
|
+
refus = constats(racine);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
refus = [{ message: e.message.replace(/^⛔ /, '') }];
|
|
115
|
+
}
|
|
116
|
+
for (const r of refus) {
|
|
117
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
118
|
+
}
|
|
119
|
+
ecrireSarif({ garde: GARDE, racine, constats: refus });
|
|
120
|
+
process.exitCode = refus.length ? 1 : 0;
|
|
121
|
+
}
|