@roomi-fields/grillhouse 0.47.1 → 0.49.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 +116 -0
- package/agents/direct.md +9 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +24 -38
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +14 -2
- package/cadre/templates/projet/CLAUDE.md +31 -10
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/turbo/paquets.json +3 -1
- package/cadre/templates/turbo/sans-paquets.json +3 -1
- package/charte.md +46 -13
- package/dist/temporal/circuit/appel.d.ts +4 -1
- package/dist/temporal/circuit/appel.js +15 -1
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +7 -1
- package/dist/temporal/circuit/client.js +54 -1
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +35 -60
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +2 -1
- package/dist/temporal/circuit/contrat.js +2 -1
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +9 -2
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +2 -13
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -1
- package/dist/temporal/deroules.js +2 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -4
- package/dist/temporal/file/activites.js +13 -14
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +34 -91
- package/dist/temporal/file/contrat.js +33 -5
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +1 -9
- package/dist/temporal/file/deroule.js +57 -166
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +26 -1
- package/dist/temporal/installation.js +111 -2
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +5 -10
- package/dist/temporal/nuits/activites.js +9 -57
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/choix.d.ts +15 -0
- package/dist/temporal/nuits/choix.js +20 -0
- package/dist/temporal/nuits/choix.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +11 -16
- package/dist/temporal/nuits/deroule.js +38 -67
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +9 -11
- package/dist/temporal/places/client.js +11 -19
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +25 -24
- package/dist/temporal/places/contrat.js +5 -7
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +26 -36
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.js +4 -2
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +2 -1
- package/docs/ARCHITECTURE.md +453 -133
- package/docs/CADRE.md +16 -13
- package/docs/INTERFACE.md +100 -25
- package/hooks/hooks.json +9 -0
- package/hooks/register.tsx +59 -5
- package/package.json +1 -1
- package/scripts/activites.mjs +319 -52
- package/scripts/aiguillage.mjs +5 -1
- package/scripts/attente-a-l-arret.mjs +2 -5
- package/scripts/attente-au-tour.mjs +2 -5
- package/scripts/bilan.mjs +125 -2
- package/scripts/branche-de-nuit.mjs +32 -44
- package/scripts/ci-de-main.mjs +215 -16
- package/scripts/circuit.mjs +275 -189
- package/scripts/circuits-cles.d.mts +3 -3
- package/scripts/circuits-cles.mjs +6 -5
- package/scripts/coeurs-dedies.mjs +4 -4
- package/scripts/commandes-composees.mjs +12 -5
- package/scripts/composition-des-langages.mjs +2 -0
- package/scripts/crochets.mjs +2 -2
- package/scripts/dette.d.ts +2 -1
- package/scripts/dette.mjs +49 -6
- package/scripts/direct.mjs +343 -0
- package/scripts/droits.mjs +19 -0
- package/scripts/effets.mjs +6 -5
- package/scripts/engendres.mjs +2 -1
- package/scripts/enveloppe/enveloppe.mjs +127 -18
- package/scripts/enveloppe/lancer.sh +14 -3
- package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
- package/scripts/enveloppe/travail-de-la-copie.mjs +121 -21
- package/scripts/etapes.mjs +14 -4
- package/scripts/etat-du-depot.mjs +23 -0
- package/scripts/faits-du-circuit.mjs +24 -34
- package/scripts/fermeture-de-la-machine.d.mts +27 -0
- package/scripts/fermeture-de-la-machine.mjs +98 -0
- package/scripts/fichiers-nommes.mjs +27 -1
- package/scripts/file-des-tickets.d.mts +18 -1
- package/scripts/file-des-tickets.mjs +63 -15
- package/scripts/greffons.mjs +1 -1
- package/scripts/grillhouse-maj.mjs +13 -25
- package/scripts/groupe-cles.d.mts +6 -0
- package/scripts/groupe-cles.mjs +29 -1
- package/scripts/integration/file.mjs +162 -48
- package/scripts/integration/integrer.mjs +2 -0
- package/scripts/jointure.d.ts +22 -3
- package/scripts/journal-des-etats.d.mts +16 -0
- package/scripts/journal-des-etats.mjs +44 -2
- package/scripts/journal.mjs +3 -0
- package/scripts/langages/c/commandes.mjs +5 -5
- package/scripts/langages/c/composants.mjs +13 -5
- package/scripts/langages/c/index.mjs +2 -0
- package/scripts/langages/c/squelette.mjs +1 -1
- package/scripts/langages/cargo/commandes.mjs +5 -6
- package/scripts/langages/cargo/index.mjs +2 -0
- package/scripts/langages/python/commandes.mjs +5 -5
- package/scripts/langages/python/composants.mjs +10 -2
- package/scripts/langages/python/index.mjs +2 -0
- package/scripts/langages/typescript/composants.mjs +10 -3
- package/scripts/langages/typescript/construire.mjs +2 -0
- package/scripts/langages/typescript/exemples.mjs +33 -1
- package/scripts/langages/typescript/index.mjs +22 -0
- package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
- package/scripts/langages/typescript/module-absent.mjs +24 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
- package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
- package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
- package/scripts/langages/typescript/turbo-des-paquets.mjs +40 -5
- package/scripts/langages/typescript/verifier.mjs +3 -5
- package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +3 -1
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
- package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
- package/scripts/langages.mjs +25 -3
- package/scripts/machine.mjs +103 -0
- package/scripts/matieres-cles.mjs +17 -0
- package/scripts/matieres-lues.mjs +104 -0
- package/scripts/mesure/base-de-passe.mjs +2 -1
- package/scripts/migrations/0.48.0-ci-declenchee-par-la-file.mjs +32 -0
- package/scripts/migrations/0.48.0-poussee-retiree.mjs +31 -0
- package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
- package/scripts/migrations.mjs +6 -0
- package/scripts/nuit.sh +113 -46
- package/scripts/paquet.mjs +16 -5
- package/scripts/paquets.d.ts +4 -0
- package/scripts/paquets.mjs +57 -0
- package/scripts/passe-de-la-machine.mjs +13 -14
- package/scripts/places-de-la-machine.mjs +120 -44
- package/scripts/places-du-serveur.mjs +29 -8
- package/scripts/plafond-de-la-machine.d.mts +7 -13
- package/scripts/plafond-de-la-machine.mjs +19 -35
- package/scripts/poussee-retiree.mjs +18 -0
- package/scripts/prefixe-des-tickets.mjs +1 -1
- package/scripts/references-changees.mjs +159 -0
- package/scripts/registre.d.mts +2 -2
- package/scripts/regles-des-places.d.mts +20 -12
- package/scripts/regles-des-places.mjs +27 -30
- package/scripts/repli-de-la-nuit.mjs +112 -0
- package/scripts/reponses-du-circuit.d.mts +4 -2
- package/scripts/reponses-du-circuit.mjs +44 -9
- package/scripts/reprise.mjs +27 -8
- package/scripts/resultats.mjs +61 -9
- package/scripts/seances.mjs +258 -40
- package/scripts/services-du-noyau.mjs +3 -0
- package/scripts/sous-commandes.mjs +37 -7
- package/scripts/superviseur.mjs +241 -88
- package/scripts/tableau.mjs +327 -131
- package/scripts/taches-du-graphe.mjs +84 -4
- package/scripts/ticket.mjs +345 -0
- package/scripts/transitions.d.mts +52 -0
- package/scripts/transitions.mjs +194 -16
- package/scripts/un-commit-par-ticket.mjs +4 -3
- package/scripts/verdict-de-la-nuit.mjs +47 -20
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
- package/scripts/verrous/verrou.mjs +17 -1
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/direct/SKILL.md +57 -0
- package/skills/explorateur/SKILL.md +10 -6
- package/skills/pitmaster/SKILL.md +37 -14
- package/skills/pitmaster/references/consigne-agent.md +7 -1
- package/skills/relecteur/SKILL.md +11 -1
- package/skills/testwriter/SKILL.md +10 -0
- package/scripts/poussee-cles.mjs +0 -46
- package/scripts/ticket.sh +0 -25
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
// (scripts/langages.mjs); each other command it describes is a subcommand by its name
|
|
14
14
|
// (`frontieres`, `index-interfaces`, `typer`, `construire`), as a backend of Pants brings its
|
|
15
15
|
// goals.
|
|
16
|
+
// - `fusion-des-tranches` is a subcommand of every project (DE_TOUT_PROJET), which the frame's
|
|
17
|
+
// workflows call after the tranches of a pass, whatever the languages: the command of the
|
|
18
|
+
// modules that describe it (typescript, which merges Vitest's reports), else the composed
|
|
19
|
+
// command by its name, which finds no module to play and is green (cargo alone, python alone, c
|
|
20
|
+
// alone: no report of a tranche to merge, a red of theirs is the red of its tranche's job).
|
|
16
21
|
// - `nuit` runs the build of src/temporal/nuits/commande.ts, which plays the night's pass
|
|
17
22
|
// (`nuit.sh`) when called alone: the script it replaces is that pass (`PASSES`).
|
|
18
23
|
// - `temporal` runs the build of src/temporal/commande.ts (dist/temporal/commande.js), the
|
|
@@ -20,8 +25,9 @@
|
|
|
20
25
|
import { existsSync } from 'node:fs';
|
|
21
26
|
import path from 'node:path';
|
|
22
27
|
import { fileURLToPath } from 'node:url';
|
|
23
|
-
import { langageDe } from './langages.mjs';
|
|
28
|
+
import { langageDe, langagesDe } from './langages.mjs';
|
|
24
29
|
import { avecLesDonnees, donneesDe } from './donnees-cles.mjs';
|
|
30
|
+
import { matieresDeclareesDe } from './matieres-cles.mjs';
|
|
25
31
|
import { avecLesOutils, empreintesDe, outilsDe } from './outils-cles.mjs';
|
|
26
32
|
|
|
27
33
|
const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -38,6 +44,7 @@ export const SOUS_COMMANDES = {
|
|
|
38
44
|
'composants-affectes': 'composants-affectes.mjs',
|
|
39
45
|
consommation: 'consommation.mjs',
|
|
40
46
|
'dependances-internes': 'dependances-internes.mjs',
|
|
47
|
+
direct: 'direct.mjs',
|
|
41
48
|
droits: 'droits.mjs',
|
|
42
49
|
enveloppe: 'enveloppe/enveloppe.mjs',
|
|
43
50
|
'flux-des-paquets': 'flux-des-paquets.mjs',
|
|
@@ -52,6 +59,7 @@ export const SOUS_COMMANDES = {
|
|
|
52
59
|
lancer: 'enveloppe/lancer.sh',
|
|
53
60
|
journal: 'journal.mjs',
|
|
54
61
|
'ligne-etat': 'ligne-etat/ligne-etat.mjs',
|
|
62
|
+
machine: 'machine.mjs',
|
|
55
63
|
maj: 'grillhouse-maj.mjs',
|
|
56
64
|
'messages-non-lus': 'messages-non-lus.mjs',
|
|
57
65
|
newday: 'newday.mjs',
|
|
@@ -72,10 +80,11 @@ export const SOUS_COMMANDES = {
|
|
|
72
80
|
temporaire: 'mesure/base-de-passe.mjs',
|
|
73
81
|
temporal: '../dist/temporal/commande.js',
|
|
74
82
|
tests: { langage: 'tester' },
|
|
75
|
-
ticket: 'ticket.
|
|
83
|
+
ticket: 'ticket.mjs',
|
|
76
84
|
'ticket-du-sous-agent': 'verrous/ticket-du-sous-agent.mjs',
|
|
77
85
|
verifier: { langage: 'verifier' },
|
|
78
86
|
verrou: 'verrous/verrou.mjs',
|
|
87
|
+
'verrou-hors-enveloppe': 'verrous/ecriture-hors-enveloppe.mjs',
|
|
79
88
|
};
|
|
80
89
|
|
|
81
90
|
// The script a subcommand plays when called alone, where its command is a client of Temporal that
|
|
@@ -86,14 +95,23 @@ const PASSES = { nuit: 'nuit.sh' };
|
|
|
86
95
|
// subcommand by their name: the ones `tests` and `verifier` run.
|
|
87
96
|
const DU_NOYAU = new Set(['tester', 'verifier']);
|
|
88
97
|
|
|
98
|
+
// The commands of the modules that every project has as a subcommand, the frame's workflows
|
|
99
|
+
// calling them in each project: in a project no module of which describes one, the composed
|
|
100
|
+
// command plays it (scripts/commandes-composees.mjs), in no module, green.
|
|
101
|
+
const DE_TOUT_PROJET = ['fusion-des-tranches'];
|
|
102
|
+
const COMMANDES_COMPOSEES = path.join(SCRIPTS, 'commandes-composees.mjs');
|
|
103
|
+
|
|
89
104
|
/**
|
|
90
|
-
* The subcommands in the project at <racine>, sorted: the core's (SOUS_COMMANDES),
|
|
91
|
-
*
|
|
105
|
+
* The subcommands in the project at <racine>, sorted: the core's (SOUS_COMMANDES), the commands
|
|
106
|
+
* of the module of its language and those every project has (DE_TOUT_PROJET), each
|
|
107
|
+
* `{ langage }`, its name in `commandes`.
|
|
92
108
|
* @param {string} [racine] the root of the project, the working directory by default
|
|
93
109
|
* @returns {Record<string, string | { langage: string }>}
|
|
94
110
|
*/
|
|
95
111
|
export function sousCommandes(racine = process.cwd()) {
|
|
96
|
-
const du =
|
|
112
|
+
const du = [
|
|
113
|
+
...new Set([...Object.keys(langageDe(racine).commandes(racine)), ...DE_TOUT_PROJET]),
|
|
114
|
+
].filter(n => !DU_NOYAU.has(n));
|
|
97
115
|
return Object.fromEntries(
|
|
98
116
|
[...Object.entries(SOUS_COMMANDES), ...du.map(n => [n, { langage: n }])].sort(([a], [b]) =>
|
|
99
117
|
a.localeCompare(b, 'en')
|
|
@@ -103,7 +121,8 @@ export function sousCommandes(racine = process.cwd()) {
|
|
|
103
121
|
|
|
104
122
|
/**
|
|
105
123
|
* The command of the subcommand <nom> in the project at <racine>, the script absolute; null for a
|
|
106
|
-
* name neither the core nor the module of its language has
|
|
124
|
+
* name neither the core nor the module of its language has, unless every project has it
|
|
125
|
+
* (DE_TOUT_PROJET): the composed command by its name then.
|
|
107
126
|
* @param {string} nom the subcommand
|
|
108
127
|
* @param {string} [racine] the root of the project, the working directory by default
|
|
109
128
|
* @returns {import('./jointure.js').Commande | null}
|
|
@@ -115,7 +134,17 @@ export function commandeDe(nom, racine = process.cwd()) {
|
|
|
115
134
|
}
|
|
116
135
|
const commandes = langageDe(racine).commandes(racine);
|
|
117
136
|
const n = s?.langage ?? (DU_NOYAU.has(nom) ? null : nom);
|
|
118
|
-
|
|
137
|
+
if (n === null || !Object.hasOwn(commandes, n)) {
|
|
138
|
+
return DE_TOUT_PROJET.includes(nom) ? { script: COMMANDES_COMPOSEES, args: [nom] } : null;
|
|
139
|
+
}
|
|
140
|
+
// The verification of a project whose one module is not the one of package.json (cargo alone,
|
|
141
|
+
// python alone) goes by the composed command, which keeps its last green and its judged tree: no
|
|
142
|
+
// pass of the graph does it there (scripts/commandes-composees.mjs, `garderSansLeGraphe`).
|
|
143
|
+
const modules = langagesDe(racine);
|
|
144
|
+
if (n === 'verifier' && modules.length === 1 && modules[0].manifeste !== 'package.json') {
|
|
145
|
+
return { script: COMMANDES_COMPOSEES, args: [n] };
|
|
146
|
+
}
|
|
147
|
+
return commandes[n];
|
|
119
148
|
}
|
|
120
149
|
|
|
121
150
|
/**
|
|
@@ -154,6 +183,7 @@ export function environnementDe(nom, racine = process.cwd(), env = process.env)
|
|
|
154
183
|
if (typeof SOUS_COMMANDES[nom] === 'string') {
|
|
155
184
|
return env;
|
|
156
185
|
}
|
|
186
|
+
matieresDeclareesDe(racine);
|
|
157
187
|
const poste = langageDe(racine).environnementDuPoste(env);
|
|
158
188
|
return avecLesDonnees(
|
|
159
189
|
donneesDe(racine),
|
package/scripts/superviseur.mjs
CHANGED
|
@@ -47,11 +47,17 @@
|
|
|
47
47
|
// writes the message of the reading (`texteDesQuestions`) when `relever` gives something,
|
|
48
48
|
// nothing otherwise; exit 1 and the fault on the error stream when `grillhouse.rappel` is at
|
|
49
49
|
// fault. A reading is one reading: no process waits.
|
|
50
|
+
// - A question has three states the greffon keeps in the file of the stops gone up: sent (put in the
|
|
51
|
+
// message of the session by `relever`), read (a turn of the session started with that message,
|
|
52
|
+
// `superviseur --lue <dossier> <lueA> <envoyeesAvant>`, or the opening listed it), answered (it
|
|
53
|
+
// leaves the file). It comes back only once read, <rappelMs> after its reading, as SQS counts the
|
|
54
|
+
// visibility timeout of a message from its reception: one still in the queue is never sent again.
|
|
55
|
+
// `superviseur --chez-le-responsable <dossier> <ticket>` (the answer `--chez-le-responsable` of
|
|
56
|
+
// the circuit) marks a question carried to the owner: silent until the circuit answers.
|
|
50
57
|
// - `relever` is the one function of the reading, of the re-presentation and of the file of the
|
|
51
|
-
// stops gone up: each question of a circuit that never went up or
|
|
52
|
-
//
|
|
53
|
-
// once per due time,
|
|
54
|
-
// as SQS gives a message not acknowledged again after its visibility timeout; one answered (its
|
|
58
|
+
// stops gone up: each question of a circuit that never went up or that was read <rappelMs> ago
|
|
59
|
+
// (`grillhouse.rappel` minutes, 10 by default, scripts/circuits-cles.mjs) is given,
|
|
60
|
+
// once per due time, while its circuit stands on the same stop; one answered (its
|
|
55
61
|
// circuit left the stop) leaves the file `.claude/worktrees/questions-remontees.json` and is not
|
|
56
62
|
// given again. The stops are kept there each by its ticket, the run of its workflow, the rank of
|
|
57
63
|
// its question in that run and its stop, with the time of the first going up and of the last
|
|
@@ -65,20 +71,28 @@ import { spawnSync } from 'node:child_process';
|
|
|
65
71
|
import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
66
72
|
import path from 'node:path';
|
|
67
73
|
import { pathToFileURL } from 'node:url';
|
|
68
|
-
import {
|
|
74
|
+
import { lireEtOuvrirLeDefautDeMain } from './ci-de-main.mjs';
|
|
69
75
|
import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
70
76
|
import { vivant } from './mesure/base-de-passe.mjs';
|
|
71
77
|
import { circuitsDuServeur, ServeurMuet } from './circuits-du-serveur.mjs';
|
|
72
78
|
import {
|
|
73
79
|
attendLeSuperviseur,
|
|
74
80
|
cleDe,
|
|
81
|
+
estLue,
|
|
75
82
|
lireLesRemontees,
|
|
76
83
|
remonteesDe,
|
|
77
84
|
} from './tableau.mjs';
|
|
78
85
|
import { rappelDuProjet, reglageDuRappel } from './circuits-cles.mjs';
|
|
79
86
|
import { lireGroupe } from './groupe-cles.mjs';
|
|
80
|
-
import { etapeDuCircuit, libelle, SUPERVISEUR } from './etapes.mjs';
|
|
81
|
-
import {
|
|
87
|
+
import { etapeDuCircuit, libelle, REPONSES, sansLesReponses, SUPERVISEUR } from './etapes.mjs';
|
|
88
|
+
import { sigleDuProjet } from './sigle-du-projet.mjs';
|
|
89
|
+
import {
|
|
90
|
+
enFileSansArchitecture,
|
|
91
|
+
enFileSurMain,
|
|
92
|
+
lireLesExternes,
|
|
93
|
+
lireLesTickets,
|
|
94
|
+
lotEstSurMain,
|
|
95
|
+
} from './file-des-tickets.mjs';
|
|
82
96
|
|
|
83
97
|
const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
|
|
84
98
|
const COQUILLES = new Set(['sh', 'bash', 'dash', 'zsh']);
|
|
@@ -211,13 +225,9 @@ function lireLesIntegrations(racine, maintenant) {
|
|
|
211
225
|
// supervisor: `{ cle, texte }` for a red or a CI not read, null for a green (the alert clears),
|
|
212
226
|
// undefined for a project with no CI to read. The lots entered since the last green are named by
|
|
213
227
|
// git; nothing is kept but the reading, for five minutes.
|
|
214
|
-
export function ciDeMainDe(racine) {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
return undefined;
|
|
218
|
-
}
|
|
219
|
-
const a = alerteDuProjet(racine, lecture);
|
|
220
|
-
return a ? { cle: a.cle, texte: a.texte } : null;
|
|
228
|
+
export function ciDeMainDe(racine, o = {}) {
|
|
229
|
+
const a = lireEtOuvrirLeDefautDeMain(racine, o);
|
|
230
|
+
return a ? { cle: a.cle, texte: a.texte } : a;
|
|
221
231
|
}
|
|
222
232
|
|
|
223
233
|
// The alert of the CI of main given by the waits of the repository at <racine>, its key: kept while
|
|
@@ -279,6 +289,85 @@ function ecrireLesIntegrations(racine, depuis, rendues) {
|
|
|
279
289
|
}
|
|
280
290
|
}
|
|
281
291
|
|
|
292
|
+
// The file of the stops gone up as text: each stop with its key, its times, and its reading and its
|
|
293
|
+
// mark when it has them, sorted by key.
|
|
294
|
+
const enTexteDesRemontees = liste =>
|
|
295
|
+
`${JSON.stringify(
|
|
296
|
+
{
|
|
297
|
+
remontees: liste
|
|
298
|
+
.map(r => ({
|
|
299
|
+
cle: r.cle,
|
|
300
|
+
depuis: r.depuis,
|
|
301
|
+
presentee: r.presentee,
|
|
302
|
+
...(Number.isFinite(r.lue) ? { lue: r.lue } : {}),
|
|
303
|
+
...(Number.isFinite(r.chez) ? { chez: r.chez } : {}),
|
|
304
|
+
}))
|
|
305
|
+
.sort((a, b) => a.cle.localeCompare(b.cle, 'en')),
|
|
306
|
+
},
|
|
307
|
+
null,
|
|
308
|
+
2
|
|
309
|
+
)}\n`;
|
|
310
|
+
|
|
311
|
+
// Writes the file of the stops gone up of <racine> as <ecrit> when it differs from what it holds
|
|
312
|
+
// (<rien>: nothing to write when no file yet), by a rename. Under the lock of the file.
|
|
313
|
+
function ecrireLesRemontees(racine, ecrit, rien = false) {
|
|
314
|
+
const f = remonteesDe(racine);
|
|
315
|
+
let enFichier = '';
|
|
316
|
+
try {
|
|
317
|
+
enFichier = readFileSync(f, 'utf8');
|
|
318
|
+
} catch {
|
|
319
|
+
// no file yet
|
|
320
|
+
}
|
|
321
|
+
if (ecrit !== enFichier && !rien) {
|
|
322
|
+
const provisoire = `${f}.${process.pid}`;
|
|
323
|
+
writeFileSync(provisoire, ecrit);
|
|
324
|
+
renameSync(provisoire, f);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Changes the entries of the file of the stops gone up of <racine> by <change> (entry → entry), under
|
|
329
|
+
// its lock; nothing is written when no file holds a stop.
|
|
330
|
+
function changerLesRemontees(racine, change) {
|
|
331
|
+
const f = remonteesDe(racine);
|
|
332
|
+
if (!lireLesRemontees(racine, Date.now()).length) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
336
|
+
const verrou = `${f}.verrou`;
|
|
337
|
+
prendreVerrou(verrou, { attendre: true, perime: 30_000 });
|
|
338
|
+
try {
|
|
339
|
+
ecrireLesRemontees(racine, enTexteDesRemontees(lireLesRemontees(racine, Date.now()).map(change)));
|
|
340
|
+
} finally {
|
|
341
|
+
lacherVerrou(verrou);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* A turn of the session read, at <lueA> ms, the messages sent up to <envoyeesAvant> ms: each stop of
|
|
347
|
+
* the file of the stops gone up of <racine> sent by then and not read since its last sending is
|
|
348
|
+
* read at <lueA>. A stop read keeps the time of its reading. The opening and the greffon's turn
|
|
349
|
+
* (`superviseur --lue`) call it.
|
|
350
|
+
* @param {string} racine
|
|
351
|
+
* @param {{ lueA: number, envoyeesAvant: number }} options
|
|
352
|
+
*/
|
|
353
|
+
export function marquerLues(racine, { lueA, envoyeesAvant }) {
|
|
354
|
+
changerLesRemontees(racine, r =>
|
|
355
|
+
r.presentee <= envoyeesAvant && !estLue(r) ? { ...r, lue: lueA } : r
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* The supervisor carried the question of the stop <cle> to the owner, at <depuisA> ms: it is
|
|
361
|
+
* silent until the circuit answers (its stop leaves the file, and the mark with it).
|
|
362
|
+
* @param {string} racine
|
|
363
|
+
* @param {{ cle: string, depuisA: number }} options
|
|
364
|
+
* @returns {boolean} whether the file holds that stop (the question was sent)
|
|
365
|
+
*/
|
|
366
|
+
export function marquerChezLeResponsable(racine, { cle, depuisA }) {
|
|
367
|
+
changerLesRemontees(racine, r => (r.cle === cle ? { ...r, chez: depuisA } : r));
|
|
368
|
+
return lireLesRemontees(racine, depuisA).some(r => r.cle === cle);
|
|
369
|
+
}
|
|
370
|
+
|
|
282
371
|
/**
|
|
283
372
|
* One reading of the circuits <circuits> (those integrated included) of the repository at <racine>,
|
|
284
373
|
* at <maintenant> ms, under the lock of the file of the stops gone up; what the greffon of the
|
|
@@ -311,22 +400,33 @@ export function relever(
|
|
|
311
400
|
try {
|
|
312
401
|
const { depuis: depuisIntegrations, rendues } = lireLesIntegrations(racine, maintenant);
|
|
313
402
|
const integres = circuits
|
|
314
|
-
.filter(
|
|
403
|
+
.filter(
|
|
404
|
+
c => c.integre && c.fin !== null && c.fin >= depuisIntegrations && !rendues.has(cleDe(c))
|
|
405
|
+
)
|
|
315
406
|
.map(enFin)
|
|
316
407
|
.sort((a, b) => a.ticket.localeCompare(b.ticket, 'en'));
|
|
317
408
|
const fins = new Map(circuits.map(c => [cleDe(c), c.fin]));
|
|
318
409
|
ecrireLesIntegrations(
|
|
319
410
|
racine,
|
|
320
411
|
maintenant,
|
|
321
|
-
[...rendues, ...integres.map(i => i.cle)].filter(
|
|
412
|
+
[...rendues, ...integres.map(i => i.cle)].filter(
|
|
413
|
+
k => (fins.get(k) ?? -Infinity) >= maintenant
|
|
414
|
+
)
|
|
322
415
|
);
|
|
323
416
|
const rouges = ciDeMain === undefined ? [] : releverLaCiDeMain(racine, ciDeMain, toutes);
|
|
324
417
|
circuits = circuits.filter(c => !c.integre);
|
|
325
418
|
const avant = new Map(lireLesRemontees(racine, maintenant).map(r => [r.cle, r]));
|
|
326
419
|
const debout = questionsEnAttente(racine, circuits, { fermes: aucunFerme });
|
|
420
|
+
// A question comes back from its reading, never from its sending: one read, not carried to the
|
|
421
|
+
// owner, whose delay has passed since its reading. One still in the queue (sent, unread) or
|
|
422
|
+
// carried to the owner is never given again.
|
|
327
423
|
const aRendre = debout.filter(q => {
|
|
328
424
|
const r = avant.get(q.cle);
|
|
329
|
-
return
|
|
425
|
+
return (
|
|
426
|
+
toutes ||
|
|
427
|
+
!r ||
|
|
428
|
+
(estLue(r) && r.chez === undefined && maintenant - r.lue >= rappelMs)
|
|
429
|
+
);
|
|
330
430
|
});
|
|
331
431
|
const fermesDe = aRendre.length
|
|
332
432
|
? fermes(
|
|
@@ -345,40 +445,22 @@ export function relever(
|
|
|
345
445
|
// A question whose ticket is closed is not given, so not counted presented: it is given once
|
|
346
446
|
// its ticket waits again.
|
|
347
447
|
const presentes = new Set(rendu.map(q => q.cle));
|
|
348
|
-
const enTexte = liste =>
|
|
349
|
-
`${JSON.stringify(
|
|
350
|
-
{
|
|
351
|
-
remontees: liste
|
|
352
|
-
.map(r => ({ cle: r.cle, depuis: r.depuis, presentee: r.presentee }))
|
|
353
|
-
.sort((a, b) => a.cle.localeCompare(b.cle, 'en')),
|
|
354
|
-
},
|
|
355
|
-
null,
|
|
356
|
-
2
|
|
357
|
-
)}\n`;
|
|
358
448
|
// A question never presented, its ticket unread, is not written: the next reading gives it.
|
|
359
|
-
|
|
449
|
+
// Sent now, it is sent: its reading (`lue`) is the turn's, and its mark (`chez`) the supervisor's.
|
|
450
|
+
const ecrit = enTexteDesRemontees(
|
|
360
451
|
debout
|
|
361
452
|
.filter(q => presentes.has(q.cle) || avant.has(q.cle))
|
|
362
453
|
.map(q => {
|
|
363
454
|
const r = avant.get(q.cle);
|
|
364
455
|
return {
|
|
456
|
+
...(r ?? {}),
|
|
365
457
|
cle: q.cle,
|
|
366
458
|
depuis: r?.depuis ?? maintenant,
|
|
367
459
|
presentee: presentes.has(q.cle) ? maintenant : r.presentee,
|
|
368
460
|
};
|
|
369
461
|
})
|
|
370
462
|
);
|
|
371
|
-
|
|
372
|
-
try {
|
|
373
|
-
enFichier = readFileSync(f, 'utf8');
|
|
374
|
-
} catch {
|
|
375
|
-
// no file yet
|
|
376
|
-
}
|
|
377
|
-
if (ecrit !== enFichier && !(debout.length === 0 && avant.size === 0)) {
|
|
378
|
-
const provisoire = `${f}.${process.pid}`;
|
|
379
|
-
writeFileSync(provisoire, ecrit);
|
|
380
|
-
renameSync(provisoire, f);
|
|
381
|
-
}
|
|
463
|
+
ecrireLesRemontees(racine, ecrit, debout.length === 0 && avant.size === 0);
|
|
382
464
|
return [...rendu, ...integres, ...rouges];
|
|
383
465
|
} finally {
|
|
384
466
|
lacherVerrou(verrou);
|
|
@@ -459,13 +541,51 @@ export function questionsEnAttente(
|
|
|
459
541
|
// No ticket closed: the questions read without asking bd.
|
|
460
542
|
const aucunFerme = () => new Set();
|
|
461
543
|
|
|
462
|
-
// The
|
|
463
|
-
//
|
|
464
|
-
|
|
544
|
+
// The command that answers the question <q>, played from <dossier> when it is another project's:
|
|
545
|
+
// the command of the circuit of its ticket, its answer left to the supervisor (the answers are
|
|
546
|
+
// listed once, at the opening of the session), or the command of a question of no circuit (the CI
|
|
547
|
+
// of main), as it is.
|
|
548
|
+
const commandeDe = (q, dossier) => {
|
|
549
|
+
const duCircuit = `npx grillhouse circuit ${q.ticket}`;
|
|
550
|
+
const commande = String(q.commande ?? '').startsWith(`${duCircuit} `)
|
|
551
|
+
? `${duCircuit} <réponse>`
|
|
552
|
+
: String(q.commande ?? '');
|
|
553
|
+
return commande && dossier ? `env -C ${dossier} ${commande}` : commande;
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// The head of the line of <q>: what it is, its ticket, its step, its stop, and who answers it when
|
|
557
|
+
// it is not the supervisor; under the sigle of its project (<o.sigle>) when it is another one's.
|
|
558
|
+
const teteDe = (q, genre, { sigle } = {}) =>
|
|
465
559
|
[
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
560
|
+
`${sigle ? `[${sigle}] ` : ''}${genre}`,
|
|
561
|
+
q.ticket,
|
|
562
|
+
q.etape,
|
|
563
|
+
...(q.arret ? [q.arret] : []),
|
|
564
|
+
...(q.qui && q.qui !== SUPERVISEUR ? [`au ${q.qui}`] : []),
|
|
565
|
+
].join(' · ');
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* The lines of one question in the one rendering of the questions, shared by the message of the
|
|
569
|
+
* greffon, the opening and the hooks of the session: its head, its question without the list of
|
|
570
|
+
* the answers, and the command that answers it. A question presented again (`representee`) is its
|
|
571
|
+
* head alone, and one that waits at a hook of the session too (<o.courte>). <o.sigle> and
|
|
572
|
+
* <o.dossier> name the project of the question when it is not the session's.
|
|
573
|
+
*/
|
|
574
|
+
export const ligneDeQuestion = (q, o = {}) => {
|
|
575
|
+
if (q.representee) {
|
|
576
|
+
const tete = teteDe(q, 'Toujours sans réponse', o);
|
|
577
|
+
const commande = o.courte ? '' : commandeDe(q, o.dossier);
|
|
578
|
+
// The reminder names the answer of a question carried to the owner beside the command of the circuit.
|
|
579
|
+
return commande.endsWith('<réponse>')
|
|
580
|
+
? `${tete}\n→ ${commande} ou --chez-le-responsable`
|
|
581
|
+
: tete;
|
|
582
|
+
}
|
|
583
|
+
const tete = teteDe(q, 'Question', o);
|
|
584
|
+
const commande = commandeDe(q, o.dossier);
|
|
585
|
+
return o.courte
|
|
586
|
+
? tete
|
|
587
|
+
: [tete, sansLesReponses(q.question), ...(commande ? [`→ ${commande}`] : [])].join('\n');
|
|
588
|
+
};
|
|
469
589
|
|
|
470
590
|
/**
|
|
471
591
|
* The message the greffon submits to the session of supervision for the questions <questions> of
|
|
@@ -476,33 +596,12 @@ export const ligneDeQuestion = q =>
|
|
|
476
596
|
* @param {{ ticket: string, etape: string, question: string, qui: string, commande: string, representee?: boolean, integre?: boolean }[]} questions
|
|
477
597
|
* @returns {string}
|
|
478
598
|
*/
|
|
479
|
-
export function texteDesQuestions(questions) {
|
|
599
|
+
export function texteDesQuestions(questions, o = {}) {
|
|
480
600
|
const fins = questions.filter(q => q.integre);
|
|
481
601
|
const attente = questions.filter(q => !q.integre);
|
|
482
|
-
const neuves = attente.filter(q => !q.representee);
|
|
483
|
-
const titre = neuves.length
|
|
484
|
-
? attente.length > 1
|
|
485
|
-
? '## Questions neuves des circuits'
|
|
486
|
-
: "## Question neuve d'un circuit"
|
|
487
|
-
: attente.length > 1
|
|
488
|
-
? '## Questions toujours sans réponse'
|
|
489
|
-
: '## Question toujours sans réponse';
|
|
490
|
-
const enQuestions = attente.length
|
|
491
|
-
? [
|
|
492
|
-
titre,
|
|
493
|
-
...attente.map(ligneDeQuestion),
|
|
494
|
-
]
|
|
495
|
-
: [];
|
|
496
|
-
const enFins = fins.length
|
|
497
|
-
? [
|
|
498
|
-
fins.length > 1 ? '## Circuits intégrés' : '## Circuit intégré',
|
|
499
|
-
...fins.map(q => `- ${q.ticket} est intégré, à ${q.etape} : son lot est sur main.`),
|
|
500
|
-
]
|
|
501
|
-
: [];
|
|
502
602
|
return [
|
|
503
|
-
...
|
|
504
|
-
...(
|
|
505
|
-
...enFins,
|
|
603
|
+
...attente.map(q => ligneDeQuestion(q, o)),
|
|
604
|
+
...fins.map(q => `${o.sigle ? `[${o.sigle}] ` : ''}Intégré · ${q.ticket}`),
|
|
506
605
|
].join('\n');
|
|
507
606
|
}
|
|
508
607
|
|
|
@@ -518,19 +617,27 @@ export function texteDesQuestions(questions) {
|
|
|
518
617
|
* their re-presentation. Last, « ## La
|
|
519
618
|
* file des tickets » names the tickets of the queue without their section « ## Architecture »
|
|
520
619
|
* (`enFileSansArchitecture` of scripts/file-des-tickets.mjs, the tickets read by <ticketsDe>,
|
|
521
|
-
* `lireLesTickets` by default; a Beads that fails says nothing), which the queue never starts
|
|
620
|
+
* `lireLesTickets` by default; a Beads that fails says nothing), which the queue never starts,
|
|
621
|
+
* then those whose lot is already on main (`enFileSurMain`, main read by <surMainDe>,
|
|
622
|
+
* `lotEstSurMain` by default), which it never starts again.
|
|
522
623
|
* @param {string} racine the root of the repository
|
|
523
624
|
* The circuits are read once, by <circuitsDe> (one call to the Temporal server,
|
|
524
625
|
* scripts/circuits-du-serveur.mjs, by default); a server that does not answer is said, and no
|
|
525
626
|
* question goes up.
|
|
526
627
|
* @param {{ fermes?: (racine: string, ids: string[]) => Set<string> | null,
|
|
527
628
|
* circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>,
|
|
528
|
-
* ticketsDe?: (racine: string) => import('./file-des-tickets.mjs').TicketDeBeads[]
|
|
629
|
+
* ticketsDe?: (racine: string) => import('./file-des-tickets.mjs').TicketDeBeads[],
|
|
630
|
+
* surMainDe?: (racine: string) => (id: string) => boolean }} options
|
|
529
631
|
* @returns {Promise<string>}
|
|
530
632
|
*/
|
|
531
633
|
export async function circuitsALOuverture(
|
|
532
634
|
racine,
|
|
533
|
-
{
|
|
635
|
+
{
|
|
636
|
+
fermes = ticketsHorsAttente,
|
|
637
|
+
circuitsDe = circuitsDuServeur,
|
|
638
|
+
ticketsDe = lireLesTickets,
|
|
639
|
+
surMainDe = lotEstSurMain,
|
|
640
|
+
} = {}
|
|
534
641
|
) {
|
|
535
642
|
let circuits = null;
|
|
536
643
|
let panne = null;
|
|
@@ -544,15 +651,19 @@ export async function circuitsALOuverture(
|
|
|
544
651
|
: `Les circuits ne se lisent pas : ${message}.`;
|
|
545
652
|
}
|
|
546
653
|
ecrireLesIntegrations(racine, Date.now(), []);
|
|
654
|
+
const ouverteA = Date.now();
|
|
547
655
|
const questions = circuits
|
|
548
656
|
? relever(racine, circuits, {
|
|
549
657
|
fermes,
|
|
550
|
-
maintenant:
|
|
658
|
+
maintenant: ouverteA,
|
|
551
659
|
rappelMs: rappelDuProjet(racine) * 60_000,
|
|
552
660
|
toutes: true,
|
|
553
661
|
ciDeMain: ciDeMainDe(racine),
|
|
554
662
|
}).filter(q => !q.integre)
|
|
555
663
|
: [];
|
|
664
|
+
// The opening lists every question that waits: the session reads them, and their reminder runs
|
|
665
|
+
// from now (a question sent to a closed session, or whose message was never recognised, included).
|
|
666
|
+
marquerLues(racine, { lueA: ouverteA, envoyeesAvant: ouverteA });
|
|
556
667
|
const tournent = enAttente(
|
|
557
668
|
(circuits ?? []).filter(c => c.vivant),
|
|
558
669
|
racine,
|
|
@@ -565,9 +676,15 @@ export async function circuitsALOuverture(
|
|
|
565
676
|
: ligneDeQuestion(q),
|
|
566
677
|
});
|
|
567
678
|
let sansArchitecture = [];
|
|
679
|
+
let dejaSurMain = [];
|
|
568
680
|
try {
|
|
569
|
-
|
|
570
|
-
|
|
681
|
+
const tickets = ticketsDe(racine);
|
|
682
|
+
const enCours = new Set((circuits ?? []).map(c => c.ticket));
|
|
683
|
+
sansArchitecture = enFileSansArchitecture(tickets, { enCours }).map(t => t.id);
|
|
684
|
+
dejaSurMain = enFileSurMain(tickets, {
|
|
685
|
+
enCours,
|
|
686
|
+
externes: lireLesExternes(racine, tickets),
|
|
687
|
+
surMain: surMainDe(racine),
|
|
571
688
|
}).map(t => t.id);
|
|
572
689
|
} catch {
|
|
573
690
|
// Beads fails: the board says it, the opening names no ticket.
|
|
@@ -577,16 +694,21 @@ export async function circuitsALOuverture(
|
|
|
577
694
|
);
|
|
578
695
|
return [
|
|
579
696
|
'## Les questions des circuits',
|
|
580
|
-
"Le greffon de ta séance pousse dans la file de tes messages chaque question neuve d'un circuit du dépôt, quel que soit son lanceur, et chaque fin de circuit, une fois ; il n'y a aucune attente à lancer. Une question sans réponse revient à intervalle réglable (`grillhouse.rappel`,
|
|
697
|
+
"Le greffon de ta séance pousse dans la file de tes messages chaque question neuve d'un circuit du dépôt, quel que soit son lanceur, et chaque fin de circuit, une fois ; il n'y a aucune attente à lancer. Une question sans réponse revient une fois lue, à intervalle réglable depuis sa lecture (`grillhouse.rappel`, 10 min par défaut) : ta réponse au circuit l'acquitte, et répondue elle ne revient plus ; une question que tu as portée au responsable se tait par `npx grillhouse circuit <ticket> --chez-le-responsable`, jusqu'à la réponse du circuit. Tu ne te mets pas en attente du responsable tant qu'une question d'un circuit attend ta réponse : le crochet de fin de tour te le rappelle. Les questions en attente sont listées ci-dessous.",
|
|
581
698
|
...(panne ? ['', '## Les circuits du dépôt', panne] : []),
|
|
582
699
|
...(nommes.length ? ['', '## Les circuits du dépôt', ...nommes.map(n => n.ligne)] : []),
|
|
700
|
+
...(questions.length ? ['', `Les réponses à une question : ${REPONSES}`] : []),
|
|
701
|
+
...(sansArchitecture.length || dejaSurMain.length ? ['', '## La file des tickets'] : []),
|
|
583
702
|
...(sansArchitecture.length
|
|
584
703
|
? [
|
|
585
|
-
'',
|
|
586
|
-
'## La file des tickets',
|
|
587
704
|
`En file sans architecture : ${sansArchitecture.join(', ')}. La file ne démarre pas un ticket sans la section « ## Architecture » de sa description : écris-la (le modèle mûr, l'adresse, le mécanisme commun), puis la file le démarre.`,
|
|
588
705
|
]
|
|
589
706
|
: []),
|
|
707
|
+
...(dejaSurMain.length
|
|
708
|
+
? [
|
|
709
|
+
`En file, lot déjà sur main : ${dejaSurMain.join(', ')}. La file ne relance pas un ticket dont le lot est sur main, resté ouvert ou rouvert : ferme-le (\`bd close <ticket> --reason "intégré : <commit>"\`, une dépendance ouverte levée d'abord), et ouvre un ticket neuf pour ce qui reste à faire.`,
|
|
710
|
+
]
|
|
711
|
+
: []),
|
|
590
712
|
].join('\n');
|
|
591
713
|
}
|
|
592
714
|
|
|
@@ -693,15 +815,9 @@ export async function releverPourLeGreffon(
|
|
|
693
815
|
}
|
|
694
816
|
const parts = [await leReleveDe(racine, circuitsDe)];
|
|
695
817
|
for (const p of voisinsSansSuperviseur(racine)) {
|
|
696
|
-
const texte = await leReleveDe(p.chemin, circuitsDe);
|
|
818
|
+
const texte = await leReleveDe(p.chemin, circuitsDe, true);
|
|
697
819
|
if (texte) {
|
|
698
|
-
parts.push(
|
|
699
|
-
[
|
|
700
|
-
`# Projet ${p.nom} (${p.chemin})`,
|
|
701
|
-
`Ses réponses se jouent dans son dossier : \`env -C ${p.chemin} <la réponse>\`.`,
|
|
702
|
-
texte,
|
|
703
|
-
].join('\n')
|
|
704
|
-
);
|
|
820
|
+
parts.push(texte);
|
|
705
821
|
}
|
|
706
822
|
}
|
|
707
823
|
return parts.filter(Boolean).join('\n\n');
|
|
@@ -719,7 +835,7 @@ function paquetDe(racine) {
|
|
|
719
835
|
// The message of one reading of the project at <racine>, under its own interval
|
|
720
836
|
// (`grillhouse.rappel`) and its own state of the questions presented; empty when it gives nothing
|
|
721
837
|
// or when its circuits do not read. A faulty interval throws, the project named.
|
|
722
|
-
async function leReleveDe(racine, circuitsDe) {
|
|
838
|
+
async function leReleveDe(racine, circuitsDe, voisin = false) {
|
|
723
839
|
const { minutes, faute } = reglageDuRappel(paquetDe(racine));
|
|
724
840
|
if (faute) {
|
|
725
841
|
throw new Error(`${path.basename(racine)} : ${faute}`);
|
|
@@ -736,7 +852,11 @@ async function leReleveDe(racine, circuitsDe) {
|
|
|
736
852
|
rappelMs: minutes * 60_000,
|
|
737
853
|
ciDeMain: ciDeMainDe(racine),
|
|
738
854
|
});
|
|
739
|
-
|
|
855
|
+
// Another project's part bears its sigle, and its commands the folder they are played in.
|
|
856
|
+
const projet = voisin
|
|
857
|
+
? { sigle: sigleDuProjet(racine).sigle ?? path.basename(racine), dossier: racine }
|
|
858
|
+
: {};
|
|
859
|
+
return lot.length ? texteDesQuestions(lot, projet) : '';
|
|
740
860
|
}
|
|
741
861
|
|
|
742
862
|
// The other projects of the group of the project at <racine> (`grillhouse.groupe`) that no other
|
|
@@ -781,6 +901,39 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
781
901
|
process.stderr.write(`${e.message}\n`);
|
|
782
902
|
process.exitCode = 1;
|
|
783
903
|
}
|
|
904
|
+
} else if (process.argv[2] === '--chez-le-responsable') {
|
|
905
|
+
// superviseur --chez-le-responsable <dossier> <ticket> : the question of the circuit of <ticket>
|
|
906
|
+
// is carried to the owner, now (`grillhouse circuit <ticket> --chez-le-responsable`); exit 2 and
|
|
907
|
+
// its reason on the error stream when the circuit waits for no question, or when the question
|
|
908
|
+
// is not in the file of the stops gone up.
|
|
909
|
+
const [, , , dossier, ticket] = process.argv;
|
|
910
|
+
const racine = racineDe(dossier ?? process.cwd());
|
|
911
|
+
const circuits = await circuitsDuServeur(racine);
|
|
912
|
+
const c = circuits.find(x => x.ticket === ticket);
|
|
913
|
+
if (!c || !attendLeSuperviseur(c)) {
|
|
914
|
+
process.stderr.write(`--chez-le-responsable : le circuit de ${ticket} n'attend aucune question.\n`);
|
|
915
|
+
process.exitCode = 2;
|
|
916
|
+
} else if (!marquerChezLeResponsable(racine, { cle: cleDe(c), depuisA: Date.now() })) {
|
|
917
|
+
process.stderr.write(
|
|
918
|
+
`--chez-le-responsable : la question de ${ticket} n'est pas encore remontée au superviseur.\n`
|
|
919
|
+
);
|
|
920
|
+
process.exitCode = 2;
|
|
921
|
+
}
|
|
922
|
+
} else if (process.argv[2] === '--lue') {
|
|
923
|
+
// superviseur --lue <dossier> <lueA> <envoyeesAvant> : the turn of the session that read, at
|
|
924
|
+
// <lueA> ms, the messages sent up to <envoyeesAvant> ms (the greffon's turn.start).
|
|
925
|
+
const [, , , dossier, lueA, envoyeesAvant] = process.argv;
|
|
926
|
+
if (!dossier || !Number.isFinite(Number(lueA)) || !Number.isFinite(Number(envoyeesAvant))) {
|
|
927
|
+
process.stderr.write('usage : superviseur --lue <dossier> <lueA> <envoyeesAvant>\n');
|
|
928
|
+
process.exitCode = 1;
|
|
929
|
+
} else {
|
|
930
|
+
const racine = racineDe(dossier);
|
|
931
|
+
const lues = { lueA: Number(lueA), envoyeesAvant: Number(envoyeesAvant) };
|
|
932
|
+
marquerLues(racine, lues);
|
|
933
|
+
for (const p of voisinsSansSuperviseur(racine)) {
|
|
934
|
+
marquerLues(p.chemin, lues);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
784
937
|
} else {
|
|
785
938
|
const texte = await superviseur(process.argv[2] ?? process.cwd());
|
|
786
939
|
if (texte) {
|