@roomi-fields/grillhouse 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/dist/temporal/installation.d.ts +3 -2
  4. package/dist/temporal/installation.js +7 -4
  5. package/dist/temporal/installation.js.map +1 -1
  6. package/dist/temporal/tickets/activites.d.ts +1 -0
  7. package/dist/temporal/tickets/activites.js +5 -0
  8. package/dist/temporal/tickets/activites.js.map +1 -1
  9. package/dist/temporal/tickets/contrat.d.ts +10 -0
  10. package/dist/temporal/tickets/deroule.js +8 -1
  11. package/dist/temporal/tickets/deroule.js.map +1 -1
  12. package/docs/ARCHITECTURE.md +71 -9
  13. package/docs/CADRE.md +10 -0
  14. package/docs/INTERFACE.md +9 -1
  15. package/hooks/hooks.json +4 -0
  16. package/package.json +1 -1
  17. package/scripts/activites.mjs +5 -7
  18. package/scripts/aiguillage.mjs +2 -0
  19. package/scripts/attente-au-tour.mjs +99 -0
  20. package/scripts/base-des-workflows.mjs +57 -0
  21. package/scripts/circuit.mjs +20 -1
  22. package/scripts/copies-finies.mjs +8 -1
  23. package/scripts/dernier-vert.mjs +30 -4
  24. package/scripts/effets.mjs +9 -0
  25. package/scripts/etapes.mjs +1 -1
  26. package/scripts/jointure.d.ts +4 -0
  27. package/scripts/journal-des-etats.d.mts +41 -0
  28. package/scripts/journal-des-etats.mjs +273 -0
  29. package/scripts/journal.mjs +119 -0
  30. package/scripts/langages/cargo/index.mjs +3 -0
  31. package/scripts/langages/python/index.mjs +2 -0
  32. package/scripts/langages/typescript/frontieres.mjs +46 -0
  33. package/scripts/langages/typescript/index.mjs +2 -0
  34. package/scripts/langages/typescript/verifier.mjs +33 -4
  35. package/scripts/langages/typescript/vitest-config/base.mjs +3 -0
  36. package/scripts/langages.d.mts +20 -0
  37. package/scripts/matiere-de-test.d.ts +11 -0
  38. package/scripts/nuit.sh +9 -0
  39. package/scripts/places-de-la-machine.mjs +6 -0
  40. package/scripts/sous-commandes.mjs +2 -0
  41. package/scripts/superviseur.mjs +127 -75
  42. package/scripts/tableau.mjs +99 -1
  43. package/scripts/ticket-du-circuit.mjs +37 -7
  44. package/scripts/transitions.mjs +18 -5
  45. package/skills/developpeur/SKILL.md +1 -1
  46. package/skills/explorateur/SKILL.md +1 -1
  47. package/skills/grill/SKILL.md +2 -56
  48. package/skills/grill/references/paquets.md +60 -0
  49. package/skills/pitmaster/SKILL.md +16 -27
  50. package/skills/questionneur/SKILL.md +1 -1
  51. package/skills/relecteur/SKILL.md +1 -1
  52. package/skills/testwriter/SKILL.md +7 -1
  53. package/skills/release/SKILL.md +0 -134
  54. package/skills/release/scripts/update-version.cjs +0 -92
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ // The subcommand `grillhouse journal [--depuis <ISO>] [--jusqu-a <ISO>] [--ticket <id>]`: the
3
+ // chronology of the journal of states of the project (scripts/journal-des-etats.mjs), its lines in
4
+ // the order of their timestamps, and, after each launch or end of a circuit of the queue, the set
5
+ // of the tickets at work against the ceiling of the circuits (`grillhouse.circuits`): one ticket at
6
+ // work when the ceiling allows two shows at once. Bounds are ISO 8601 with the local offset,
7
+ // included; a line unreadable is left out; no journal or no line in the range is said, exit 0.
8
+ // Exit 2 for an option unknown or a date unreadable.
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import path from 'node:path';
11
+ import { pathToFileURL } from 'node:url';
12
+ import { reglageDesCircuits } from './circuits-cles.mjs';
13
+ import { dossierDuJournal, ensemblesEnTravail, lireLeJournal } from './journal-des-etats.mjs';
14
+
15
+ const USAGE = 'usage : grillhouse journal [--depuis <ISO>] [--jusqu-a <ISO>] [--ticket <id>]\n';
16
+ const ISO = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?([+-]\d{2}:\d{2}|Z)?)?$/;
17
+
18
+ // The options of <argv>, `{ depuis, jusquA, ticket }`, or `{ faute }`.
19
+ function options(argv) {
20
+ const cles = { '--depuis': 'depuis', '--jusqu-a': 'jusquA', '--ticket': 'ticket' };
21
+ const o = {};
22
+ for (let i = 0; i < argv.length; i += 2) {
23
+ const cle = cles[argv[i]];
24
+ if (!cle) {
25
+ return { faute: `option inconnue : ${argv[i]}` };
26
+ }
27
+ const v = argv[i + 1];
28
+ if (v === undefined) {
29
+ return { faute: `${argv[i]} attend une valeur` };
30
+ }
31
+ if (cle !== 'ticket' && (!ISO.test(v) || Number.isNaN(Date.parse(v)))) {
32
+ return { faute: `${argv[i]} : « ${v} » n'est pas une date ISO 8601` };
33
+ }
34
+ o[cle] = v;
35
+ }
36
+ return o;
37
+ }
38
+
39
+ // The ceiling of the circuits of the project at <racine>: its key, 1 when absent.
40
+ function plafond(racine) {
41
+ const f = path.join(racine, 'package.json');
42
+ try {
43
+ return reglageDesCircuits(existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')) : {}).max ?? 1;
44
+ } catch {
45
+ return 1;
46
+ }
47
+ }
48
+
49
+ const heure = ts => ts.slice(11);
50
+
51
+ const ligneDe = l =>
52
+ [
53
+ l.ts,
54
+ String(l.genre ?? '').padEnd(7),
55
+ l.ticket ?? '-',
56
+ l.etape ?? '-',
57
+ ...(l.boucle === null || l.boucle === undefined ? [] : [`boucle ${l.boucle}`]),
58
+ ...(l.place ? [`place ${l.place}`] : []),
59
+ ...(l.raison ? [`— ${l.raison}`] : []),
60
+ ].join(' ');
61
+
62
+ /**
63
+ * The subcommand: writes the chronology through <out>, its faults through <err>; the exit code.
64
+ * @param {string[]} argv
65
+ * @param {{ racine?: string, out?: (t: string) => void, err?: (t: string) => void }} [contexte]
66
+ * @returns {number}
67
+ */
68
+ export function journal(
69
+ argv,
70
+ {
71
+ racine = process.cwd(),
72
+ out = t => process.stdout.write(`${t}\n`),
73
+ err = t => process.stderr.write(`${t}\n`),
74
+ } = {}
75
+ ) {
76
+ const o = options(argv);
77
+ if (o.faute) {
78
+ err(`⛔ grillhouse journal : ${o.faute}\n${USAGE.trimEnd()}`);
79
+ return 2;
80
+ }
81
+ let dossier = null;
82
+ try {
83
+ dossier = dossierDuJournal(racine);
84
+ } catch {
85
+ // no git project: no journal
86
+ }
87
+ if (!dossier || !existsSync(dossier)) {
88
+ out('Aucun journal pour ce projet.');
89
+ return 0;
90
+ }
91
+ // The sets are rebuilt from the start of the journal up to the end of the range, so that a range
92
+ // that starts mid-work knows who was already at work.
93
+ const jusqua = o.jusquA === undefined ? {} : { jusquA: o.jusquA };
94
+ const toutes = lireLeJournal(racine, jusqua).lignes;
95
+ const depuis = o.depuis === undefined ? -Infinity : Date.parse(o.depuis);
96
+ const affichees = toutes.filter(
97
+ l => Date.parse(l.ts) >= depuis && (o.ticket === undefined || l.ticket === o.ticket)
98
+ );
99
+ if (affichees.length === 0) {
100
+ out('Aucune ligne dans la plage.');
101
+ return 0;
102
+ }
103
+ const max = plafond(racine);
104
+ const parInstant = new Map(ensemblesEnTravail(toutes).map(e => [e.ts, e.enTravail]));
105
+ for (const l of affichees) {
106
+ out(ligneDe(l));
107
+ const ensemble = l.genre === 'file' ? parInstant.get(l.ts) : undefined;
108
+ if (ensemble) {
109
+ out(
110
+ ` ${heure(l.ts)} en travail ${ensemble.length}/${max}${ensemble.length ? ` : ${ensemble.join(', ')}` : ''}`
111
+ );
112
+ }
113
+ }
114
+ return 0;
115
+ }
116
+
117
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
118
+ process.exitCode = journal(process.argv.slice(2));
119
+ }
@@ -77,6 +77,9 @@ export default {
77
77
  },
78
78
  // The reader of TOML by which the lock judges a Cargo.toml (./composants.mjs, `manifestes`).
79
79
  outils: ['smol-toml'],
80
+ // The programs the installer of Temporal requires in the PATH of the workers: cargo's folder is
81
+ // also rustc's, nextest's and sccache's (rustup, `cargo install`).
82
+ executables: ['cargo'],
80
83
  // The binaries the module runs, each at an exact version: nextest and cargo-deny at the ones the
81
84
  // probe of grillhouse-pkl.1 measured; sccache, the cache of compilation common to the copies
82
85
  // (./sccache.mjs), at the last release of mozilla/sccache, v0.19.0 (2026-10-24).
@@ -69,6 +69,8 @@ export default {
69
69
  throw new Error('sortie non prise en charge pour python');
70
70
  },
71
71
  outils: ['smol-toml'],
72
+ // The programs the installer of Temporal requires in the PATH of the workers.
73
+ executables: ['python3'],
72
74
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
73
75
  ignorer: ['.venv', '.pytest_cache', PYCACHE],
74
76
  sorties: {
@@ -59,6 +59,7 @@ export const RACINES = ['src', 'packages'];
59
59
  /** The test files, as a pattern of a path from the repository's root. */
60
60
  export const TESTS = '(^|/)(test|tests|__tests__)/|[.](test|spec)[.][a-z]+$';
61
61
  const REGLE_OUTILS = 'pas-d-outil-de-developpement-dans-le-code';
62
+ const REGLE_DECLARATION = 'pas-d-import-non-declare';
62
63
  // The environment variable naming the file that holds the pattern of the published files.
63
64
  const JUGES = 'GRILLHOUSE_JUGES';
64
65
 
@@ -160,6 +161,18 @@ export function configuration(racine) {
160
161
  from: { path: CODE, pathNot: TESTS },
161
162
  to: { dependencyTypes: ['npm-dev'] },
162
163
  },
164
+ {
165
+ name: REGLE_DECLARATION,
166
+ comment:
167
+ "un import vise un paquet que le package.json du paquet importateur déclare (la règle no-non-package-json de dependency-cruiser) : l'usage se déclare s'il est valide pour l'architecture, sinon une question d'architecture s'ouvre",
168
+ severity: 'error',
169
+ // The development imports (the test files and the tools' configuration files) are out of
170
+ // the published code: the tools they import (vitest, typescript) are the workspace's.
171
+ from: { pathNot: `${TESTS}|(^|/)[^/]*[.]config[.][cm]?[jt]s$` },
172
+ // A peer dependency is declared by the package, yet dependency-cruiser types it `npm-no-pkg`
173
+ // too: the types it carries as peer are not refused.
174
+ to: { dependencyTypes: ['npm-no-pkg', 'npm-unknown'], dependencyTypesNot: ['npm-peer'] },
175
+ },
163
176
  {
164
177
  name: 'tout-import-se-resout',
165
178
  comment: "un import se résout : un chemin qu'un paquet n'exporte pas est refusé",
@@ -425,6 +438,36 @@ export function constats(resultat) {
425
438
  }));
426
439
  }
427
440
 
441
+ // The package an import of a violation targets: the name in the `node_modules` path it resolves
442
+ // to (`@scope/name` or `name`), else the module's own name.
443
+ function paquetVise(violation) {
444
+ const m = /(?:^|\/)node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(violation.to);
445
+ return m ? m[1] : violation.to;
446
+ }
447
+
448
+ // The refusal of an import the package does not declare, with its two ways on: the file, the
449
+ // package imported, then declaring the usage (and, for a component of the repository, in the
450
+ // provider's "Consommateurs" section), else an architecture question.
451
+ export function suitesDeLUsage(racine, violation) {
452
+ const importe = paquetVise(violation);
453
+ const propre = /^(packages\/[^/]+)\//.exec(violation.from);
454
+ const manifeste = `${propre ? `${propre[1]}/` : ''}package.json`;
455
+ const fournisseur = composants(racine).find(c => c.paquet === importe);
456
+ const tete = `⛔ ${violation.from} importe ${importe}, que ${manifeste} ne déclare pas.`;
457
+ if (fournisseur) {
458
+ const interfaceDuFournisseur = `${posix(path.relative(racine, fournisseur.dir))}/docs/INTERFACE.md`;
459
+ return (
460
+ `${tete}\n Si l'usage est valide pour l'architecture : le déclarer dans ${manifeste}, et dans ` +
461
+ `la section « Consommateurs » de ${interfaceDuFournisseur}.\n Sinon : ouvrir une question ` +
462
+ "d'architecture (au superviseur)."
463
+ );
464
+ }
465
+ return (
466
+ `${tete}\n Si l'usage est valide pour l'architecture : le déclarer dans ${manifeste}.\n` +
467
+ " Sinon : ouvrir une question d'architecture (au superviseur)."
468
+ );
469
+ }
470
+
428
471
  // The pattern of the files to judge, as dependency-cruiser's `path` filter reads it.
429
472
  const motifDes = fichiers => `^(${[...fichiers].sort().map(echappe).join('|')})$`;
430
473
 
@@ -500,6 +543,9 @@ function frontieres(racine, args) {
500
543
  for (const l of lignes) {
501
544
  process.stderr.write(`${l}\n`);
502
545
  }
546
+ for (const c of refus.filter(c => c.regle === REGLE_DECLARATION)) {
547
+ process.stderr.write(`${suitesDeLUsage(racine, c.violation)}\n`);
548
+ }
503
549
  return refus.length ? 1 : 0;
504
550
  } finally {
505
551
  if (dossier) {
@@ -195,6 +195,8 @@ export default {
195
195
  ],
196
196
  // No binary of the machine: its tools are packages of npm.
197
197
  binaires: {},
198
+ // No program the installer of Temporal looks for: Node is a tool of the account.
199
+ executables: [],
198
200
  // What its tools write in a project: Turborepo's runs and cache.
199
201
  ignorer: ['.turbo'],
200
202
  // Where its tools write: the cache of Turborepo in the main tree, shared by every copy, written;
@@ -207,12 +207,41 @@ export function poserLeVert({ code, etat, args, env, garder }) {
207
207
  }
208
208
  }
209
209
 
210
- function passe({ racine, demandes, env, dire, coeurs }) {
210
+ // The options of the pass in <demandes>: `{ gardesSeules, tout, base, args }`. `--base <commit>`
211
+ // (or `--base=<commit>`) belongs to the verification alone: it never reaches the tasks, `base` is
212
+ // '' when it has no value (alone, or followed by another option), and undefined when it is not
213
+ // given or when the guards alone ask for no measure.
214
+ export function lireLesDemandes(demandes) {
211
215
  const gardesSeules = demandes.includes('--gardes');
212
216
  const tout = demandes.includes('--tout') || demandes.includes('--force');
213
- const args = demandes.filter(a => a !== '--gardes' && a !== '--tout');
214
- // The measure against the last green: the guards alone need none.
215
- const m = gardesSeules ? null : mesure(racine, { tout, dans: env.TMPDIR });
217
+ let base;
218
+ const args = [];
219
+ for (let i = 0; i < demandes.length; i++) {
220
+ const a = demandes[i];
221
+ if (a === '--gardes' || a === '--tout') {
222
+ continue;
223
+ }
224
+ if (a === '--base') {
225
+ const suite = demandes[i + 1];
226
+ if (suite !== undefined && !suite.startsWith('-')) {
227
+ base = suite;
228
+ i++;
229
+ } else {
230
+ base = '';
231
+ }
232
+ } else if (a.startsWith('--base=')) {
233
+ base = a.slice('--base='.length);
234
+ } else {
235
+ args.push(a);
236
+ }
237
+ }
238
+ return { gardesSeules, tout, base: gardesSeules ? undefined : base, args };
239
+ }
240
+
241
+ function passe({ racine, demandes, env, dire, coeurs }) {
242
+ const { gardesSeules, tout, base, args } = lireLesDemandes(demandes);
243
+ // The measure against the last green, or the base given: the guards alone need none.
244
+ const m = gardesSeules ? null : mesure(racine, { tout, base, dans: env.TMPDIR });
216
245
  if (m) {
217
246
  dire(m.ligne);
218
247
  }
@@ -75,6 +75,9 @@ import {
75
75
  import { ciblage, HORS_DU_JOUR } from './cibles.mjs';
76
76
  import { rapportAvancement } from './avancement.reporter.mjs';
77
77
  import { rapportJson } from './resultats.mjs';
78
+ // The mark of a measure of time, published as `./vitest-config/mesure` and imported by the tests of
79
+ // other packages: the import attaches it to the configuration that decides what such a mark does.
80
+ import './mesure.mjs';
78
81
 
79
82
  const ici = f => fileURLToPath(new URL(f, import.meta.url));
80
83
 
@@ -0,0 +1,20 @@
1
+ // The types of ./langages.mjs the frame reads (src/temporal/installation.ts, its tests).
2
+ import type { Composition, Langage } from './jointure.js';
3
+
4
+ /** The frame's languages, each its module, from this directory. */
5
+ export const LANGAGES: Record<string, string>;
6
+
7
+ /** The module of the language <nom> of the frame's list, loaded once per process. */
8
+ export function langage(nom: string): Langage;
9
+
10
+ /** The languages the project at <racine> declares, each once, in the order of its table; empty
11
+ * without document, table or language. */
12
+ export function langagesDeclares(racine: string): string[];
13
+
14
+ /** The modules of the languages the project at <racine> declares, in the order of its table;
15
+ * throws when it declares none, or a language out of the frame's list. */
16
+ export function langagesDe(racine: string): Langage[];
17
+
18
+ /** The join of the modules that serve the project at <racine>: the module itself when the project
19
+ * declares one, else their composition. */
20
+ export function langageDe(racine: string): Composition;
@@ -0,0 +1,11 @@
1
+ // The types of the shared test material the package's typed tests read
2
+ // (`@roomi-fields/grillhouse-matiere/test-fixtures`, which publishes its source, not a built
3
+ // declaration): tsconfig.json maps the entry here, so the typing of this package stays on its own
4
+ // files. Only the names these tests import are declared.
5
+
6
+ /** Writes at <repo> the docs/ARCHITECTURE.md of <paquets>: a list of languages (a package each,
7
+ * `paquet-<n>`), or a record of package name to language. */
8
+ export function declarerLesLangages(
9
+ repo: string,
10
+ paquets?: string[] | Record<string, string>
11
+ ): void;
package/scripts/nuit.sh CHANGED
@@ -252,6 +252,15 @@ jouer() {
252
252
  monter npm --prefix "$copie" ci --no-audit --no-fund --silent || return 1
253
253
  cp "$copie/package-lock.json" "$copie/node_modules/.nuit-lock"
254
254
  fi
255
+ # The frame's package, built once when the copy carries it as a package of the repository: the
256
+ # copy is cleaned of dist/ and the pass (the taking of its place) and the night tests of Temporal
257
+ # read dist/temporal. A project that installs the frame builds nothing more.
258
+ if grep -q '"name": *"@roomi-fields/grillhouse"' "$copie/packages/grillhouse/package.json" 2>/dev/null; then
259
+ if ! monter npm --prefix "$copie" run build --workspace=@roomi-fields/grillhouse; then
260
+ echo "✗ la construction du paquet @roomi-fields/grillhouse échoue : rien n'est joué."
261
+ return 1
262
+ fi
263
+ fi
255
264
  # The full pass, played for real: the night replays no log of the cache. Each step plays even
256
265
  # when one before it is red; a step à repasser ends the night there, red if a step before it is.
257
266
  local code tache avant
@@ -39,6 +39,7 @@ import path from 'node:path';
39
39
  import { departDe } from './mesure/base-de-passe.mjs';
40
40
  import { A_REPASSER } from './codes-de-sortie.mjs';
41
41
  import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
42
+ import { ecrireLaTrace, traceDesPlaces } from './journal-des-etats.mjs';
42
43
  import { mesureDeLaMachine } from './mesure-de-la-machine.mjs';
43
44
  import { AttenteDeLaMachine, avecLaMachine, borneDe } from './verrou-de-machine.mjs';
44
45
 
@@ -206,6 +207,7 @@ export function prendreUnePlace({
206
207
  borneMs = borneDe(env),
207
208
  rappelMs = RAPPEL_MS,
208
209
  dire = l => process.stdout.write(`${l}\n`),
210
+ racine = process.cwd(),
209
211
  } = {}) {
210
212
  const e = env[VARIABLE_TENUE] ? null : surLeServeur(env);
211
213
  if (!e) {
@@ -222,6 +224,8 @@ export function prendreUnePlace({
222
224
  const { code, lignes } = auServeur(e, ['prendre', JSON.stringify(demande)], borneMs + 60_000);
223
225
  for (const l of lignes) {
224
226
  if (l.dire) {
227
+ // The wait, said and dated in the journal of states, its reason the message said.
228
+ ecrireLaTrace(racine, traceDesPlaces({ evenement: 'attente', ticket, raison: l.dire }));
225
229
  dire(l.dire);
226
230
  }
227
231
  }
@@ -229,6 +233,7 @@ export function prendreUnePlace({
229
233
  throw new AttenteDeLaMachine(lignes.at(-1)?.dire ?? 'attente de place bornée', A_REPASSER);
230
234
  }
231
235
  const place = lignes.find(l => l.id);
236
+ ecrireLaTrace(racine, traceDesPlaces({ evenement: 'prise', ticket, place: place.id }));
232
237
  return {
233
238
  id: place.id,
234
239
  rang: place.rang,
@@ -238,6 +243,7 @@ export function prendreUnePlace({
238
243
  rendre: () => {
239
244
  try {
240
245
  auServeur(e, ['rendre', place.id]);
246
+ ecrireLaTrace(racine, traceDesPlaces({ evenement: 'rendue', ticket, place: place.id }));
241
247
  } catch (x) {
242
248
  if (!(x instanceof AttenteDeLaMachine)) {
243
249
  throw x;
@@ -27,6 +27,7 @@ const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
27
27
  // Each subcommand and its script, under `scripts/`, or the command of the module of the language
28
28
  // that runs it (`{ langage }`, its name in `commandes`).
29
29
  export const SOUS_COMMANDES = {
30
+ 'attente-au-tour': 'attente-au-tour.mjs',
30
31
  bilan: 'bilan.mjs',
31
32
  circuit: '../dist/temporal/circuit/commande.js',
32
33
  commande: 'verrous/commande.mjs',
@@ -44,6 +45,7 @@ export const SOUS_COMMANDES = {
44
45
  'langages-des-paquets': 'langages-des-paquets.mjs',
45
46
  integrer: 'integration/integrer.mjs',
46
47
  lancer: 'enveloppe/lancer.sh',
48
+ journal: 'journal.mjs',
47
49
  'ligne-etat': 'ligne-etat/ligne-etat.mjs',
48
50
  maj: 'grillhouse-maj.mjs',
49
51
  nuit: 'nuit.sh',