@roomi-fields/grillhouse 0.35.0 → 0.36.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.
Files changed (38) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +12 -0
  3. package/cadre/templates/cargo/package.json +4 -2
  4. package/cadre/templates/projet/CLAUDE.md +5 -0
  5. package/cadre/templates/python/package.json +4 -2
  6. package/dist/temporal/file/contrat.d.ts +3 -1
  7. package/dist/temporal/file/deroule.js +2 -2
  8. package/dist/temporal/file/deroule.js.map +1 -1
  9. package/dist/temporal/places/contrat.d.ts +12 -0
  10. package/dist/temporal/places/deroule.js +2 -0
  11. package/dist/temporal/places/deroule.js.map +1 -1
  12. package/dist/temporal/tickets/activites.js +30 -3
  13. package/dist/temporal/tickets/activites.js.map +1 -1
  14. package/docs/ARCHITECTURE.md +27 -6
  15. package/docs/INTERFACE.md +2 -2
  16. package/package.json +1 -1
  17. package/scripts/attente-a-l-arret.mjs +1 -1
  18. package/scripts/attente-au-tour.mjs +1 -1
  19. package/scripts/file-des-tickets.d.mts +23 -1
  20. package/scripts/file-des-tickets.mjs +94 -3
  21. package/scripts/gabarit-absent.mjs +30 -0
  22. package/scripts/grillhouse-maj.mjs +58 -1
  23. package/scripts/groupe-cles.d.mts +25 -0
  24. package/scripts/groupe-cles.mjs +73 -0
  25. package/scripts/integration/file.mjs +30 -5
  26. package/scripts/jointure.d.ts +11 -0
  27. package/scripts/langages/cargo/index.mjs +3 -2
  28. package/scripts/langages/cargo/mise-a-jour.mjs +17 -0
  29. package/scripts/langages/python/index.mjs +3 -1
  30. package/scripts/langages/python/mise-a-jour.mjs +22 -5
  31. package/scripts/langages/typescript/mise-a-jour.mjs +8 -20
  32. package/scripts/places-de-la-machine.mjs +15 -5
  33. package/scripts/regles-des-places.d.mts +7 -0
  34. package/scripts/regles-des-places.mjs +46 -4
  35. package/scripts/services-du-noyau.mjs +2 -1
  36. package/scripts/sigle-du-projet.mjs +49 -0
  37. package/scripts/superviseur.mjs +31 -18
  38. package/scripts/tableau.mjs +96 -13
@@ -16,6 +16,12 @@
16
16
  // - A circuit alive whose ticket was closed outside it (delivered directly) holds no place: the
17
17
  // queue stops it (`fermesHorsCircuit`).
18
18
  // - A ticket whose dependency is open stays: the board says « attend <ticket> » (scripts/tableau.mjs).
19
+ // - A dependency on another project (`external:<project>:<capability>`, Beads' cross-project
20
+ // dependency) holds the ticket until the provider delivered the capability: a closed ticket of
21
+ // that project labelled `provides:<capability>` (which `bd ship` sets; `export:` alone does
22
+ // not deliver). <externes> gives the tickets of each provider by its name in Beads'
23
+ // `external_projects`; a project it lacks holds the ticket, and `attentesExternes` names the
24
+ // fault (never a silent start).
19
25
  import { spawnSync } from 'node:child_process';
20
26
  import { ETAPES } from './etapes.mjs';
21
27
 
@@ -33,22 +39,76 @@ const enFile = (tous, enCours) =>
33
39
  !enCours.has(t.id)
34
40
  );
35
41
 
42
+ // The external dependencies of <t>, each { projet, capacite }.
43
+ const dependancesExternes = t =>
44
+ (t.dependencies ?? [])
45
+ .filter(d => d.type === 'blocks' && d.depends_on_id.startsWith('external:'))
46
+ .map(d => {
47
+ const [, projet = '', ...reste] = d.depends_on_id.split(':');
48
+ return { projet, capacite: reste.join(':') };
49
+ });
50
+
51
+ // Whether the provider <projet> delivered <capacite> in <externes>.
52
+ const livree = (externes, projet, capacite) =>
53
+ (externes?.[projet] ?? []).some(
54
+ t => t.status === 'closed' && (t.labels ?? []).includes(`provides:${capacite}`)
55
+ );
56
+
57
+ /**
58
+ * What each ticket of the queue waits for from another project: one { ticket, attend:
59
+ * '<project>:<capability>', faute } per capability not delivered, `faute` naming the project that
60
+ * `external_projects` does not resolve (a project absent of <externes>), null otherwise.
61
+ * @param {Parameters<typeof ticketsAPartir>[0]} tous every ticket of the project
62
+ * @param {{ enCours?: Set<string>, externes?: Record<string, typeof tous> }} [o]
63
+ * @returns {Array<{ ticket: string, attend: string, faute: string | null }>}
64
+ */
65
+ export function attentesExternes(tous, { enCours = new Set(), externes } = {}) {
66
+ return enFile(tous, enCours).flatMap(t =>
67
+ attendDeLAutreProjet(t, externes).map(a => ({ ticket: t.id, ...a }))
68
+ );
69
+ }
70
+
71
+ /**
72
+ * What the ticket <t> waits for from another project in <externes>: one { attend:
73
+ * '<project>:<capability>', faute } per capability not delivered (see `attentesExternes`).
74
+ * @param {{ dependencies?: Array<{ type: string, depends_on_id: string }> }} t
75
+ * @param {Record<string, Array<{ status: string, labels?: string[] }>>} [externes]
76
+ * @returns {Array<{ attend: string, faute: string | null }>}
77
+ */
78
+ export function attendDeLAutreProjet(t, externes) {
79
+ return dependancesExternes(t)
80
+ .filter(d => !livree(externes, d.projet, d.capacite))
81
+ .map(d => ({
82
+ attend: `${d.projet}:${d.capacite}`,
83
+ faute:
84
+ externes?.[d.projet] === undefined
85
+ ? `le projet ${d.projet} n'est pas dans external_projects de Beads`
86
+ : null,
87
+ }));
88
+ }
89
+
36
90
  /**
37
91
  * The tickets of <tous> that start now, in the order they start.
38
92
  * @param {Array<{ id: string, status: string, priority?: number, labels?: string[],
39
93
  * created_at?: string, description?: string,
40
94
  * dependencies?: Array<{ type: string, depends_on_id: string }> }>} tous
41
95
  * every ticket of the project, the closed ones too
42
- * @param {{ enCours?: Set<string> }} [o] `enCours`, the tickets whose circuit already runs
96
+ * @param {{ enCours?: Set<string>, externes?: Record<string, typeof tous> }} [o] `enCours`, the
97
+ * tickets whose circuit already runs; `externes`, the tickets of each other project by its name
43
98
  * @returns {typeof tous}
44
99
  */
45
- export function ticketsAPartir(tous, { enCours = new Set() } = {}) {
100
+ export function ticketsAPartir(tous, { enCours = new Set(), externes } = {}) {
46
101
  const fermes = new Set(tous.filter(t => t.status === 'closed').map(t => t.id));
47
102
  return enFile(tous, enCours)
48
103
  .filter(
49
104
  t =>
50
105
  aSonArchitecture(t) &&
51
- (t.dependencies ?? []).every(d => d.type !== 'blocks' || fermes.has(d.depends_on_id))
106
+ (t.dependencies ?? []).every(
107
+ d =>
108
+ d.type !== 'blocks' ||
109
+ (d.depends_on_id.startsWith('external:') ? true : fermes.has(d.depends_on_id))
110
+ ) &&
111
+ dependancesExternes(t).every(d => livree(externes, d.projet, d.capacite))
52
112
  )
53
113
  .sort(
54
114
  (a, b) =>
@@ -94,6 +154,37 @@ export function enFileSansArchitecture(tous, { enCours = new Set() } = {}) {
94
154
  .sort((a, b) => a.id.localeCompare(b.id, 'en', { numeric: true }));
95
155
  }
96
156
 
157
+ /**
158
+ * The tickets of each provider project the tickets <tous> depend on (`external:<project>:…`), by
159
+ * the project's name, read through Beads' `external_projects` of the project at <racine>; a
160
+ * project that the configuration does not set, or whose tickets do not read, is left out (the
161
+ * ticket that waits for it stays held, `attentesExternes` naming the fault).
162
+ * @param {string} racine
163
+ * @param {Parameters<typeof ticketsAPartir>[0]} tous
164
+ * @returns {Record<string, typeof tous>}
165
+ */
166
+ export function lireLesExternes(racine, tous) {
167
+ const noms = new Set(tous.flatMap(t => dependancesExternes(t).map(d => d.projet)));
168
+ const externes = {};
169
+ for (const nom of noms) {
170
+ const r = spawnSync('bd', ['config', 'get', `external_projects.${nom}`], {
171
+ cwd: racine,
172
+ encoding: 'utf8',
173
+ maxBuffer: 256 * 1024 * 1024,
174
+ });
175
+ const chemin =`${r.stdout ?? ''}`.trim();
176
+ if (r.status !== 0 || chemin === '' || chemin.includes('not set')) {
177
+ continue;
178
+ }
179
+ try {
180
+ externes[nom] = lireLesTickets(chemin);
181
+ } catch {
182
+ // Left out: the project does not resolve.
183
+ }
184
+ }
185
+ return externes;
186
+ }
187
+
97
188
  /**
98
189
  * Every ticket of the project at <racine>, the closed ones too, as Beads gives them; a Beads that
99
190
  * fails or a list that does not parse throws, its reason named (`bd list`), never an empty list.
@@ -0,0 +1,30 @@
1
+ // The copy of a template of the frame into a project that lacks the file: the update of a module
2
+ // of language (`miseAJour.appliquer`, scripts/jointure.d.ts) poses so the configuration of its
3
+ // tool at the root of a project, one template per form of repository, as `nx init` writes the
4
+ // configuration of a workspace once and leaves it to the project.
5
+ import { copyFileSync, existsSync } from 'node:fs';
6
+ import path from 'node:path';
7
+
8
+ /**
9
+ * Writes <fichier> at the root of the project at <projet> when it has none, from the template of
10
+ * the source <source> that fits its form: <avecEspaces> when its package.json <p> declares
11
+ * `workspaces`, else <sansEspaces>. A file present is the project's own, never written again.
12
+ * Returns the template written, or null.
13
+ * @param {string} projet
14
+ * @param {string} source
15
+ * @param {Record<string, unknown>} p
16
+ * @param {{ fichier: string, avecEspaces: string, sansEspaces: string }} gabarits
17
+ * @returns {string | null}
18
+ */
19
+ export function poserLeGabaritAbsent(projet, source, p, { fichier, avecEspaces, sansEspaces }) {
20
+ const f = path.join(projet, fichier);
21
+ if (existsSync(f)) {
22
+ return null;
23
+ }
24
+ const gabarit = p.workspaces !== undefined ? avecEspaces : sansEspaces;
25
+ if (!existsSync(path.join(source, gabarit))) {
26
+ return null;
27
+ }
28
+ copyFileSync(path.join(source, gabarit), f);
29
+ return gabarit;
30
+ }
@@ -120,6 +120,10 @@
120
120
  // as `npm install` brings what is installed to what is declared. A plugin that cannot be
121
121
  // installed, or a mod left at another version, has its line naming the command to type; the
122
122
  // update has finished its files, and the exit code is non-zero.
123
+ // - The group: when the package.json declares `grillhouse.groupe` (scripts/groupe-cles.mjs), the
124
+ // update sets in the Beads of the project each other project of the group as an
125
+ // `external_projects.<name>` (its absolute path), the ones already set left alone; a group
126
+ // badly declared is refused by its key before any work.
123
127
  // - The generated files: after the package.json, each generator of the declared language
124
128
  // (`miseAJour.generateurs` of its module) is run in the project by the project's command
125
129
  // (`node_modules/.bin/grillhouse`, its installed package) for the file it writes when the project
@@ -153,6 +157,7 @@ import { poserCrochets } from './crochets.mjs';
153
157
  import { ATTRIBUT } from './fusion-du-changelog.mjs';
154
158
  import { fluxSansEntree } from './flux-des-paquets.mjs';
155
159
  import { installerGreffons } from './greffons.mjs';
160
+ import { lireGroupe, projetsExternes } from './groupe-cles.mjs';
156
161
  import { migrer, restesAuProjet } from './migrations.mjs';
157
162
  import { langageDe, langagesDe } from './langages.mjs';
158
163
  import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
@@ -318,13 +323,59 @@ export function versionDuProjet(projet) {
318
323
  return typeof v === 'string' ? v : null;
319
324
  }
320
325
 
326
+ // Beads run in <cwd>, as `bd(args, cwd)` gives it: { status, stdout, stderr }.
327
+ const jouerBd = (args, cwd) => spawnSync('bd', args, { cwd, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
328
+
329
+ // The group the package.json of <projet> declares (null without it); a fault throws, naming its
330
+ // key (`grillhouse.groupe`) and its value.
331
+ function lireDuGroupe(projet) {
332
+ const pkg = path.join(projet, 'package.json');
333
+ if (!existsSync(pkg)) {
334
+ return null;
335
+ }
336
+ const { groupe, fautes } = lireGroupe(lireJson(pkg, {}), projet);
337
+ if (fautes.length > 0) {
338
+ throw new Error(
339
+ `⛔ ${fautes.map(f => `${f.cle} vaut ${f.valeur}, pas un chemin de projet existant, une fois`).join(' ; ')}.`
340
+ );
341
+ }
342
+ return groupe;
343
+ }
344
+
345
+ // The `external_projects` of the Beads of <projet>: the other projects of its <groupe>, each by its
346
+ // name and absolute path; those it sets, by name (none when already set).
347
+ function poserLesProjetsExternes(projet, groupe, bd) {
348
+ if (groupe === null) {
349
+ return [];
350
+ }
351
+ const poses = [];
352
+ for (const [nom, chemin] of Object.entries(projetsExternes(groupe, projet))) {
353
+ const cle = `external_projects.${nom}`;
354
+ const lu = bd(['config', 'get', cle], projet);
355
+ if (lu.status === 0 && `${lu.stdout ?? ''}`.trim() === chemin) {
356
+ continue;
357
+ }
358
+ const r = bd(['config', 'set', cle, chemin], projet);
359
+ if (r.status !== 0) {
360
+ throw new Error(
361
+ `⛔ bd config set ${cle} a échoué : ${`${r.stderr ?? ''}`.trim() || `code ${r.status}`}`
362
+ );
363
+ }
364
+ poses.push(nom);
365
+ }
366
+ return poses;
367
+ }
368
+
321
369
  /**
322
370
  * Brings the project at `projet` to the frame's files at `source` (CADRE, scripts/cadre.mjs; a
323
371
  * trial's own in the tests); <inscrite> is the version it records (the package's; null records
324
372
  * none, the project keeping its own). Returns what changed.
325
373
  */
326
- export function mettreAJour(projet, source, { inscrite = VERSION } = {}) {
374
+ export function mettreAJour(projet, source, { inscrite = VERSION, bd = jouerBd } = {}) {
375
+ // The group declared, refused by its key before any work.
376
+ const groupe = lireDuGroupe(projet);
327
377
  const bilan = {
378
+ projetsExternes: [],
328
379
  dependances: [],
329
380
  gardes: null,
330
381
  ligneEtat: false,
@@ -447,6 +498,7 @@ export function mettreAJour(projet, source, { inscrite = VERSION } = {}) {
447
498
  poserCrochets(projet);
448
499
  attribuer(projet);
449
500
  bilan.workflows = poserLesWorkflows(projet, source);
501
+ bilan.projetsExternes = poserLesProjetsExternes(projet, groupe, bd);
450
502
  return bilan;
451
503
  }
452
504
 
@@ -560,6 +612,11 @@ export function rapport(b) {
560
612
  `Greffon du cadre : .claude/settings.json déclare la place de marché ${MARCHE_DU_CADRE} (${SOURCE_DU_MARCHE.repo}) et active ${GREFFON_DU_CADRE}.`
561
613
  );
562
614
  }
615
+ if (b.projetsExternes?.length > 0) {
616
+ lignes.push(
617
+ `Projets externes de Beads : ${b.projetsExternes.join(', ')} posé(s) depuis grillhouse.groupe.`
618
+ );
619
+ }
563
620
  if (b.workflows?.length > 0) {
564
621
  lignes.push(
565
622
  `Workflows du cadre : ${b.workflows.join(', ')} écrit(s) depuis le gabarit ; leur machine est la variable RUNNER du dépôt sur GitHub (ubuntu-latest sans elle), que la mise à jour ne touche pas.`
@@ -0,0 +1,25 @@
1
+ // The types of the reading of the key `grillhouse.groupe` (./groupe-cles.mjs).
2
+
3
+ /** A project of a group: its folder's name (the key of Beads' `external_projects`), its absolute path. */
4
+ export interface ProjetDuGroupe {
5
+ nom: string;
6
+ chemin: string;
7
+ }
8
+
9
+ /** The group a package.json declares: the same `id` for every project that declares the same paths. */
10
+ export interface GroupeDeclare {
11
+ id: string;
12
+ projets: ProjetDuGroupe[];
13
+ }
14
+
15
+ /** The group declared (null without the key or on a fault), and each fault by its key and value. */
16
+ export function lireGroupe(
17
+ pkg: unknown,
18
+ racine: string
19
+ ): { groupe: GroupeDeclare | null; fautes: Array<{ cle: string; valeur: string }> };
20
+
21
+ /** The `external_projects` of the Beads of the project at <racine>: the other projects of its group. */
22
+ export function projetsExternes(
23
+ groupe: { projets: ProjetDuGroupe[] },
24
+ racine: string
25
+ ): Record<string, string>;
@@ -0,0 +1,73 @@
1
+ // The reading of the key `grillhouse.groupe` of a package.json (grillhouse-pie), read as written:
2
+ // a list of projects, each by its path (absolute, or relative to the project's root), every
3
+ // project of the group, the project itself included. The projects of a group are ordered together:
4
+ // their tickets that wait for a place leave by priority (scripts/regles-des-places.mjs), and
5
+ // `grillhouse maj` writes the other projects of the group as the `external_projects` of the Beads
6
+ // of each (`bd ship` and `external:<project>:<capability>` dependencies resolve through them).
7
+ // Any other value is a fault, named by its key before any work.
8
+ import { createHash } from 'node:crypto';
9
+ import { existsSync } from 'node:fs';
10
+ import path from 'node:path';
11
+
12
+ /**
13
+ * The group a package.json <pkg> declares, read from the project at <racine>.
14
+ * Returns { groupe, fautes }: `groupe` null without the key or on a fault, else `{ id, projets }`
15
+ * (`projets`: each `{ nom, chemin }`, `nom` the folder of the project, the key of Beads'
16
+ * `external_projects`, `chemin` absolute; `id` the same for every project that declares the same
17
+ * paths, in any order); `fautes` each `{ cle, valeur }`, the key it names and the value read.
18
+ * @param {unknown} pkg
19
+ * @param {string} racine
20
+ * @returns {{ groupe: { id: string, projets: { nom: string, chemin: string }[] } | null,
21
+ * fautes: { cle: string, valeur: string }[] }}
22
+ */
23
+ export function lireGroupe(pkg, racine) {
24
+ const liste = pkg?.grillhouse?.groupe;
25
+ if (liste === undefined) {
26
+ return { groupe: null, fautes: [] };
27
+ }
28
+ if (!Array.isArray(liste) || liste.length === 0) {
29
+ return {
30
+ groupe: null,
31
+ fautes: [{ cle: 'grillhouse.groupe', valeur: JSON.stringify(liste) }],
32
+ };
33
+ }
34
+ const fautes = [];
35
+ const projets = [];
36
+ const vus = new Set();
37
+ liste.forEach((v, i) => {
38
+ const cle = `grillhouse.groupe[${i}]`;
39
+ if (typeof v !== 'string' || v.trim() === '') {
40
+ fautes.push({ cle, valeur: JSON.stringify(v) ?? String(v) });
41
+ return;
42
+ }
43
+ const chemin = path.resolve(racine, v);
44
+ if (!existsSync(chemin) || vus.has(chemin)) {
45
+ fautes.push({ cle, valeur: JSON.stringify(v) });
46
+ return;
47
+ }
48
+ vus.add(chemin);
49
+ projets.push({ nom: path.basename(chemin), chemin });
50
+ });
51
+ if (fautes.length > 0) {
52
+ return { groupe: null, fautes };
53
+ }
54
+ const id = createHash('sha256')
55
+ .update([...vus].sort().join('\n'))
56
+ .digest('hex')
57
+ .slice(0, 12);
58
+ return { groupe: { id, projets }, fautes: [] };
59
+ }
60
+
61
+ /**
62
+ * The `external_projects` of the Beads of the project at <racine>: the other projects of its
63
+ * <groupe>, `{ <nom>: <chemin> }`.
64
+ * @param {{ projets: { nom: string, chemin: string }[] }} groupe
65
+ * @param {string} racine
66
+ * @returns {Record<string, string>}
67
+ */
68
+ export function projetsExternes(groupe, racine) {
69
+ const soi = path.resolve(racine);
70
+ return Object.fromEntries(
71
+ groupe.projets.filter(p => p.chemin !== soi).map(p => [p.nom, p.chemin])
72
+ );
73
+ }
@@ -902,6 +902,29 @@ export function avancerMain(o, entree) {
902
902
  return { entre: { commit: entree.commit } };
903
903
  }
904
904
 
905
+ // The capabilities of the ticket <ticket> (its `labels`, `export:<capability>` each) delivered by
906
+ // `bd ship <capability>`, which sets `provides:<capability>`, the signal that the queue of another
907
+ // project reads. A `bd ship` that fails is a fault named, never ignored: its comment at the
908
+ // ticket says it whole, `livraison` in one line (the capability and Beads' reason), the other
909
+ // capabilities still delivered; null without a fault.
910
+ function livrerLesCapacites(o, ticket, labels) {
911
+ const fautes = [];
912
+ for (const cap of labels.filter(l => l.startsWith('export:')).map(l => l.slice(7))) {
913
+ const r = o.bd('ship', cap);
914
+ if (r.status !== 0) {
915
+ const raison = `${r.stderr ?? ''}`.trim() || `${r.stdout ?? ''}`.trim() || `code ${r.status}`;
916
+ commenterAu(
917
+ o,
918
+ ticket,
919
+ `La livraison de la capacité ${cap} n'est pas faite : \`bd ship ${cap}\` échoue :\n${raison}\n\nLe ticket est fermé ; la capacité reste à livrer.`
920
+ );
921
+ o.dire(`⚠ bd ship ${cap} échoue`);
922
+ fautes.push(`bd ship ${cap} échoue : ${enUneLigne(raison)}`);
923
+ }
924
+ }
925
+ return { livraison: fautes.length > 0 ? fautes.join(' ; ') : null };
926
+ }
927
+
905
928
  /**
906
929
  * The ticket of <entree> (`{ ticket, branche, commit }`) entered on main at <commit>, with the
907
930
  * tools <o>: it closes « intégré : <commit> » and loses `en-file` (a ticket already closed is left
@@ -920,11 +943,13 @@ export function fermerLEntree(o, entree) {
920
943
  const court = entree.commit.slice(0, 7);
921
944
  const commenter = texte => commenterAu(o, entree.ticket, texte);
922
945
  const show = o.bd('show', entree.ticket, '--json');
923
- const statut = show.status === 0 ? (JSON.parse(show.stdout)[0]?.status ?? null) : null;
924
- if (statut !== 'closed') {
946
+ const lu = show.status === 0 ? (JSON.parse(show.stdout)[0] ?? null) : null;
947
+ if ((lu?.status ?? null) !== 'closed') {
925
948
  o.bd('update', entree.ticket, '--remove-label', 'en-file');
926
949
  o.bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
927
950
  }
951
+ // The capabilities the ticket exports (`export:<capability>`) are delivered once it is closed.
952
+ const ferme = livrerLesCapacites(o, entree.ticket, lu?.labels ?? []);
928
953
  o.dire(`✓ ${entree.branche} entre sur ${o.principale} : ${court}`);
929
954
  if (git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).status === 0) {
930
955
  const efface = git('branch', '-D', entree.branche);
@@ -941,7 +966,7 @@ export function fermerLEntree(o, entree) {
941
966
  if (faute) {
942
967
  const raison = `Poussée non faite : grillhouse.poussee.commit vaut ${faute}, pas un nom de branche.`;
943
968
  commenter(raison);
944
- return { poussee: null, raison: enUneLigne(raison) };
969
+ return { poussee: null, raison: enUneLigne(raison), ...ferme };
945
970
  }
946
971
  const sansInvite = { encoding: 'utf8', env: { ...process.env, GIT_TERMINAL_PROMPT: '0' } };
947
972
  const pousse = spawnSync(
@@ -953,7 +978,7 @@ export function fermerLEntree(o, entree) {
953
978
  const raison = `La poussée de ${court} vers origin/${commit} (grillhouse.poussee.commit) est refusée :\n${pousse.stderr.trim()}`;
954
979
  commenter(raison);
955
980
  o.dire(`⚠ poussée de ${court} refusée`);
956
- return { poussee: null, raison: enUneLigne(raison) };
981
+ return { poussee: null, raison: enUneLigne(raison), ...ferme };
957
982
  }
958
983
  o.dire(`✓ poussée : ${court} est sur origin/${commit}`);
959
984
  // The branch the CI judged leaves origin with its entry; one already gone is no fault.
@@ -965,7 +990,7 @@ export function fermerLEntree(o, entree) {
965
990
  if (distante.status !== 0) {
966
991
  o.dire(`⚠ origin/${entree.branche} n'est pas effacée : ${distante.stderr.trim()}`);
967
992
  }
968
- return { poussee: commit, raison: null };
993
+ return { poussee: commit, raison: null, ...ferme };
969
994
  }
970
995
 
971
996
  /**
@@ -429,6 +429,17 @@ export function avecLeFichierDuPoste<T extends Record<string, string | undefined
429
429
  ): T;
430
430
  /** The path of the command <nom> in the PATH of <env>, or null (scripts/commandes-du-path.mjs). */
431
431
  export function trouverDansLePath(nom: string, env?: NodeJS.ProcessEnv): string | null;
432
+ /**
433
+ * Writes <fichier> at the root of the project <projet> when it has none, from the template of
434
+ * <source> that fits its form (<avecEspaces> when its package.json <p> declares workspaces, else
435
+ * <sansEspaces>); the template written, or null.
436
+ */
437
+ export function poserLeGabaritAbsent(
438
+ projet: string,
439
+ source: string,
440
+ p: Record<string, unknown>,
441
+ gabarits: { fichier: string; avecEspaces: string; sansEspaces: string }
442
+ ): string | null;
432
443
  /** The cache of `outil` for the build rooted at `racine`, swept once `racine` is gone. */
433
444
  export function cacheDeLaRacine(
434
445
  outil: string,
@@ -79,8 +79,9 @@ export default {
79
79
  construireLesPaquets: () => {
80
80
  throw new Error('construction non prise en charge pour cargo');
81
81
  },
82
- // The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`).
83
- outils: ['smol-toml'],
82
+ // The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`), and
83
+ // Turborepo, which plays the tasks of the crates (./commandes.mjs).
84
+ outils: ['smol-toml', 'turbo'],
84
85
  // The programs the installer of Temporal requires in the PATH of the workers: cargo's folder is
85
86
  // also rustc's, nextest's and sccache's (rustup, `cargo install`).
86
87
  executables: ['cargo'],
@@ -12,6 +12,8 @@
12
12
  // leaves the frame's profile `grillhouse` to the frame (./nextest.toml); `rust-toolchain.toml`,
13
13
  // the toolchain and its components clippy and rustfmt, which the guards run. A file the project
14
14
  // holds is its own: never written again.
15
+ // - `turbo.json`, which a project lacks, from the frame's template of its form (`TURBO`): the
16
+ // module plays the tasks of the crates by Turborepo.
15
17
  // - The root scripts `test`, `test:forcer` and `verifier` a project lacks become the template's:
16
18
  // the agents run `npm test`, the integration and the night `npm run verifier`. A project's own
17
19
  // script stays.
@@ -26,6 +28,7 @@
26
28
  import { copyFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
27
29
  import path from 'node:path';
28
30
  import { fileURLToPath } from 'node:url';
31
+ import { poserLeGabaritAbsent } from '../../services-du-noyau.mjs';
29
32
  import { verrouNonVersionne } from './commandes.mjs';
30
33
  import { SORTIE } from './index-interfaces.mjs';
31
34
 
@@ -33,6 +36,13 @@ const BINAIRES = path.join(path.dirname(fileURLToPath(import.meta.url)), 'binair
33
36
 
34
37
  const GABARIT = 'templates/cargo';
35
38
  const SCRIPTS_DES_TESTS = ['test', 'test:forcer', 'verifier'];
39
+ // The frame's templates of `turbo.json`, one per form of repository: the module plays its tasks
40
+ // by Turborepo (./commandes.mjs).
41
+ const TURBO = {
42
+ fichier: 'turbo.json',
43
+ avecEspaces: 'templates/turbo/paquets.json',
44
+ sansEspaces: 'templates/turbo/sans-paquets.json',
45
+ };
36
46
 
37
47
  // The files under <dossier>, as paths from it.
38
48
  const fichiers = (dossier, rel = '') =>
@@ -54,6 +64,7 @@ function appliquer(projet, { p, modele, source }) {
54
64
  copies.push(f);
55
65
  }
56
66
  }
67
+ const turbo = poserLeGabaritAbsent(projet, source, p, TURBO);
57
68
  p.scripts ??= {};
58
69
  const scripts = [];
59
70
  for (const nom of SCRIPTS_DES_TESTS) {
@@ -70,6 +81,11 @@ function appliquer(projet, { p, modele, source }) {
70
81
  `Gabarit cargo : ${copies.join(', ')} écrits ; ils sont au projet, la mise à jour n'y touche plus.`
71
82
  );
72
83
  }
84
+ if (turbo) {
85
+ lignes.push(
86
+ `turbo.json écrit depuis le gabarit du cadre ${turbo} ; il est au projet, la mise à jour n'y touche plus.`
87
+ );
88
+ }
73
89
  if (scripts.length > 0) {
74
90
  lignes.push(
75
91
  `Scripts des tests : ${scripts.map(n => `${n} (\`${p.scripts[n]}\`)`).join(', ')} écrits ; les agents lancent \`npm test\`, l'intégration et la nuit \`npm run verifier\`.`
@@ -80,6 +96,7 @@ function appliquer(projet, { p, modele, source }) {
80
96
  bilan: {
81
97
  gabarit: copies.length > 0 ? copies : null,
82
98
  scripts: scripts.length > 0 ? scripts : null,
99
+ turbo,
83
100
  },
84
101
  lignes,
85
102
  aFaire: verrou ? [verrou] : [],
@@ -71,7 +71,9 @@ export default {
71
71
  sortieDuPaquet: () => {
72
72
  throw new Error('sortie non prise en charge pour python');
73
73
  },
74
- outils: ['smol-toml'],
74
+ // The reader of TOML of a pyproject.toml, and Turborepo, which plays the tasks of the projects
75
+ // (./commandes.mjs).
76
+ outils: ['smol-toml', 'turbo'],
75
77
  // The programs the installer of Temporal requires in the PATH of the workers.
76
78
  executables: ['python3'],
77
79
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
@@ -3,6 +3,8 @@
3
3
  //
4
4
  // - The template: `templates/python/` of the frame's files. Its package.json gives the frame's
5
5
  // scripts, which run the frame's commands, and smol-toml, the reader of a pyproject.toml.
6
+ // - `turbo.json`, which a project lacks, from the frame's template of its form (`TURBO`): the
7
+ // module plays the tasks of the projects by Turborepo.
6
8
  // - The root scripts `test`, `test:forcer` and `verifier` a project lacks become the template's;
7
9
  // a project's own script stays.
8
10
  // - The generator: the index of the interfaces (./index-interfaces.mjs), run where the project
@@ -10,14 +12,23 @@
10
12
  // - The installation of uv (./binaires.json) by the commands of ./binaires.mjs, which the core runs.
11
13
  import path from 'node:path';
12
14
  import { fileURLToPath } from 'node:url';
15
+ import { poserLeGabaritAbsent } from '../../services-du-noyau.mjs';
13
16
  import { SORTIE } from './index-interfaces.mjs';
14
17
 
15
18
  const BINAIRES = path.join(path.dirname(fileURLToPath(import.meta.url)), 'binaires.mjs');
16
19
  const GABARIT = 'templates/python';
17
20
  const SCRIPTS_DES_TESTS = ['test', 'test:forcer', 'verifier'];
21
+ // The frame's templates of `turbo.json`, one per form of repository: the module plays its tasks
22
+ // by Turborepo (./commandes.mjs).
23
+ const TURBO = {
24
+ fichier: 'turbo.json',
25
+ avecEspaces: 'templates/turbo/paquets.json',
26
+ sansEspaces: 'templates/turbo/sans-paquets.json',
27
+ };
18
28
 
19
29
  /** @type {import('../../jointure.js').MiseAJour['appliquer']} */
20
- function appliquer(_projet, { p, modele }) {
30
+ function appliquer(projet, { p, modele, source }) {
31
+ const turbo = poserLeGabaritAbsent(projet, source, p, TURBO);
21
32
  p.scripts ??= {};
22
33
  const scripts = [];
23
34
  for (const nom of SCRIPTS_DES_TESTS) {
@@ -29,13 +40,19 @@ function appliquer(_projet, { p, modele }) {
29
40
  scripts.push(nom);
30
41
  }
31
42
  return {
32
- bilan: { scripts: scripts.length > 0 ? scripts : null },
33
- lignes:
34
- scripts.length > 0
43
+ bilan: { scripts: scripts.length > 0 ? scripts : null, turbo },
44
+ lignes: [
45
+ ...(turbo
46
+ ? [
47
+ `turbo.json écrit depuis le gabarit du cadre ${turbo} ; il est au projet, la mise à jour n'y touche plus.`,
48
+ ]
49
+ : []),
50
+ ...(scripts.length > 0
35
51
  ? [
36
52
  `Scripts des tests : ${scripts.map(n => `${n} (\`${p.scripts[n]}\`)`).join(', ')} écrits ; les agents lancent \`npm test\`, l'intégration et la nuit \`npm run verifier\`.`,
37
53
  ]
38
- : [],
54
+ : []),
55
+ ],
39
56
  aFaire: [],
40
57
  installer: false,
41
58
  sansVerifier: null,
@@ -46,11 +46,11 @@
46
46
  // - The generators: the boundaries' configuration (`.dependency-cruiser.cjs`), the index of the
47
47
  // interfaces, and the turbo.json of each package in a repository with `workspaces`.
48
48
  import { spawnSync } from 'node:child_process';
49
- import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
49
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
50
50
  import { createRequire } from 'node:module';
51
51
  import path from 'node:path';
52
52
  import { CODE, paquets, TYPAGE } from '../../paquets.mjs';
53
- import { SCRIPT_DES_TESTS, sources } from '../../services-du-noyau.mjs';
53
+ import { poserLeGabaritAbsent, SCRIPT_DES_TESTS, sources } from '../../services-du-noyau.mjs';
54
54
  import { estUnTest } from './regle-des-tests.mjs';
55
55
 
56
56
  // The frame's package, as a project declares it, and its base configuration of Vitest.
@@ -60,8 +60,11 @@ const CONFIG_VITEST = `${PAQUET_DU_CADRE}/vitest-config`;
60
60
  const SCRIPTS_DES_TESTS = ['test', SCRIPT_DES_TESTS, 'test:forcer', 'verifier'];
61
61
  const CHAMPS_INSTALLES = ['dependencies', 'devDependencies', 'optionalDependencies'];
62
62
  // The frame's templates of `turbo.json`, one per form of repository, read in the source.
63
- const TURBO_PAQUETS = 'templates/turbo/paquets.json';
64
- const TURBO_SANS_PAQUETS = 'templates/turbo/sans-paquets.json';
63
+ const TURBO = {
64
+ fichier: 'turbo.json',
65
+ avecEspaces: 'templates/turbo/paquets.json',
66
+ sansEspaces: 'templates/turbo/sans-paquets.json',
67
+ };
65
68
 
66
69
  const ecrireJson = (f, v) => writeFileSync(f, `${JSON.stringify(v, null, 2)}\n`);
67
70
  // <deps> written sorted by name, as npm writes them.
@@ -271,21 +274,6 @@ function poserTypage(projet, p, script) {
271
274
  return declarants.length > 0 ? { script, paquets: declarants } : null;
272
275
  }
273
276
 
274
- // Writes the `turbo.json` of the project at <projet>, when it has none, from the source's template
275
- // of its form (`workspaces` declared in <p>); the template written, or null.
276
- function poserTurbo(projet, p, source) {
277
- const f = path.join(projet, 'turbo.json');
278
- if (existsSync(f)) {
279
- return null;
280
- }
281
- const gabarit = p.workspaces !== undefined ? TURBO_PAQUETS : TURBO_SANS_PAQUETS;
282
- if (!existsSync(path.join(source, gabarit))) {
283
- return null;
284
- }
285
- copyFileSync(path.join(source, gabarit), f);
286
- return gabarit;
287
- }
288
-
289
277
  // The lines of the report of the share <b>.
290
278
  export function rapport(b) {
291
279
  const lignes = [];
@@ -343,7 +331,7 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
343
331
  dependanceDuCadre: declarerDependanceDuCadre(projet, p, version),
344
332
  configVitest: poserConfigVitest(projet, p, version, joueDesTests),
345
333
  typage: poserTypage(projet, p, modele.scripts?.[TYPAGE]),
346
- turbo: poserTurbo(projet, p, source),
334
+ turbo: poserLeGabaritAbsent(projet, source, p, TURBO),
347
335
  };
348
336
  return {
349
337
  bilan,