@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
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
// even when the index no longer says them in conflict); a conflict the session of the role
|
|
50
50
|
// does not lift goes up to the supervisor, the stop « lancement », each file named. A file
|
|
51
51
|
// without marker left in the copy counts as resolved (put in the index by the circuit).
|
|
52
|
+
// At the launch of a session, the circuit plays the rule too (scripts/seances.mjs `seance`):
|
|
53
|
+
// the launch refused goes to the other role first while files of its own carry marks
|
|
54
|
+
// (`marquesRestantes`), and the sheet FAIT of a session is refused while a file of its role
|
|
55
|
+
// carries them, one the session put in the index with its marks included.
|
|
52
56
|
// - A copy still in conflict (unmerged entries in its index) or whose branch has left main
|
|
53
57
|
// (commits on both sides, no fast-forward) is not touched; the output says why; exit 1. A
|
|
54
58
|
// fast-forward that fails after the work is set aside (an untracked file in the way) gives
|
|
@@ -61,18 +65,34 @@
|
|
|
61
65
|
// when the lot touches one of its files, or one it reads (the copy's untracked files counting),
|
|
62
66
|
// the application leaves its files out (main's version stays), then its command writes them
|
|
63
67
|
// again in the copy, the lot applied, with the tools of the project (`grillhouse.outils`), out
|
|
64
|
-
// of the envelope.
|
|
65
|
-
//
|
|
68
|
+
// of the envelope. The output of a command that passes is a message, never the data of the
|
|
69
|
+
// preparation: it goes where the faults go (stderr, the log of the preparation for the circuit),
|
|
70
|
+
// so the standard output of `preparer` holds the list of its pose alone (BPScript, 2026-11-22:
|
|
71
|
+
// the output of « npm install --package-lock-only » read as the list of the shared submodules,
|
|
72
|
+
// the mount refused on « usage: sous-modules.sh … »). A command that fails stops, exit 1, the
|
|
73
|
+
// command, its code and its output named, the rest of the lot in the copy; a faulty key
|
|
74
|
+
// refuses, named, before the copy is
|
|
66
75
|
// touched (OSC Bridge, 2026-10-31: four conflicts in one day on the generated files of synthhub
|
|
67
76
|
// and open-synth-descriptors, each copy moved by hand). A lot in conflict on another file is not
|
|
68
|
-
// regenerated: its conflicts come first.
|
|
77
|
+
// regenerated: its conflicts come first. A reference the frame generates itself and writes in
|
|
78
|
+
// full (`fichiersEngendres` of the module of the language, its `entiers`: the index of the
|
|
79
|
+
// interfaces, the turbo.json of the packages) follows the same rule, with no key of the project:
|
|
80
|
+
// main's version, then the frame's generator, whose code is not read, a real failure aside
|
|
81
|
+
// (BPScript, 2026-11-22: « UU docs/agents/index-des-interfaces.md » at the advance of two
|
|
82
|
+
// copies). The reports of API (INTERFACE.api.md and the generated part of an INTERFACE.md) and
|
|
83
|
+
// the debt of the guards, which the frame does not give as written in full (no `entiers`), are
|
|
84
|
+
// still merged. A copy whose references the module of the language does not read (no language
|
|
85
|
+
// declared) is advanced all the same, its references merged as files written by hand, and the
|
|
86
|
+
// fault is said: on stderr, in the log of the preparation for the circuit.
|
|
69
87
|
import { spawnSync } from 'node:child_process';
|
|
70
88
|
import { existsSync, readFileSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
|
|
71
89
|
import path from 'node:path';
|
|
72
90
|
import { pathToFileURL } from 'node:url';
|
|
73
91
|
import { couvertPar, encoreDeclares, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
|
|
74
92
|
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
93
|
+
import { matieresDeclareesDe } from '../matieres-cles.mjs';
|
|
75
94
|
import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
|
|
95
|
+
import { langageDe } from '../langages.mjs';
|
|
76
96
|
|
|
77
97
|
const LOT = 'grillhouse-travail.patch';
|
|
78
98
|
|
|
@@ -88,6 +108,10 @@ const lignes = r =>
|
|
|
88
108
|
// The files of <copie> unmerged in its index.
|
|
89
109
|
const enConflit = copie => lignes(git(copie, ['diff', '--name-only', '--diff-filter=U']));
|
|
90
110
|
|
|
111
|
+
// The files of <copie> its index holds apart from HEAD, a deletion aside: those a session put
|
|
112
|
+
// there, the circuit leaving the index as HEAD has it.
|
|
113
|
+
const aLIndex = copie => lignes(git(copie, ['diff', '--cached', '--name-only', '--diff-filter=d']));
|
|
114
|
+
|
|
91
115
|
// The files the lot <lot> touches in <copie>: each added, modified or deleted, a rename its source
|
|
92
116
|
// and its destination.
|
|
93
117
|
const fichiersDuLot = (copie, lot) =>
|
|
@@ -96,16 +120,53 @@ const fichiersDuLot = (copie, lot) =>
|
|
|
96
120
|
.map(l => (l.includes('\t') ? l.split('\t')[2] : l))
|
|
97
121
|
.filter(Boolean);
|
|
98
122
|
|
|
123
|
+
/**
|
|
124
|
+
* The references the frame generates itself in <copie> and writes in full (`fichiersEngendres` of
|
|
125
|
+
* the module of its language, those with `entiers`: the index of the interfaces, the turbo.json of
|
|
126
|
+
* the packages), as the circuit regenerates them at 4.2; none for a copy the module does not read,
|
|
127
|
+
* whose fault goes to <dire>.
|
|
128
|
+
* @param {string} copie
|
|
129
|
+
* @param {(texte: string) => void} dire
|
|
130
|
+
* @returns {{ nom: string, commande: string, fichiers: string[], lit: string[], entiers: string[] }[]}
|
|
131
|
+
*/
|
|
132
|
+
function referencesEntieresDuCadre(copie, dire) {
|
|
133
|
+
try {
|
|
134
|
+
return langageDe(copie)
|
|
135
|
+
.fichiersEngendres(copie)
|
|
136
|
+
.filter(r => r.entiers.length)
|
|
137
|
+
.map(({ verifier: _verifier, ...reference }) => reference);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
dire(
|
|
140
|
+
`⚠ Les références du cadre ne se lisent pas dans la copie ${copie} : celles qu'il écrit en entier (l'index des interfaces, les turbo.json des paquets) sont fusionnées comme des fichiers écrits à la main.\n${/** @type {Error} */ (e).message}\n`
|
|
141
|
+
);
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Where a fault that does not refuse the advance is said, by default.
|
|
147
|
+
const surStderr = texte => void process.stderr.write(texte);
|
|
148
|
+
|
|
99
149
|
/**
|
|
100
150
|
* The keys of the project that holds <copie>, read before any work: `{ engendres, env }`, its
|
|
101
|
-
* generated files
|
|
151
|
+
* generated files, then the references the frame writes in full (<duCadre>, each marked `cadre`,
|
|
152
|
+
* but one whose first file a generated file of the project writes), and the environment of their
|
|
153
|
+
* commands with its tools, or `{ refus }`. A fault that refuses nothing goes to <dire>.
|
|
102
154
|
* @param {string} copie
|
|
155
|
+
* @param {(copie: string, dire: (texte: string) => void) => { nom: string, commande: string, fichiers: string[], lit: string[], entiers: string[] }[]} [duCadre]
|
|
156
|
+
* @param {(texte: string) => void} [dire]
|
|
103
157
|
* @returns {{ engendres: any[], env: NodeJS.ProcessEnv, refus?: undefined } | { refus: string }}
|
|
104
158
|
*/
|
|
105
|
-
function lesCles(copie) {
|
|
159
|
+
function lesCles(copie, duCadre = referencesEntieresDuCadre, dire = surStderr) {
|
|
106
160
|
try {
|
|
161
|
+
matieresDeclareesDe(copie);
|
|
162
|
+
const duProjet = engendresDe(copie);
|
|
107
163
|
return {
|
|
108
|
-
engendres:
|
|
164
|
+
engendres: [
|
|
165
|
+
...duProjet,
|
|
166
|
+
...duCadre(copie, dire)
|
|
167
|
+
.filter(c => !duProjet.some(e => couvertPar(e.entiers, c.fichiers[0])))
|
|
168
|
+
.map(c => ({ ...c, cadre: true })),
|
|
169
|
+
],
|
|
109
170
|
env: avecLesDonnees(
|
|
110
171
|
donneesDe(copie),
|
|
111
172
|
avecLesOutils(outilsDe(copie), process.env, empreintesDe(copie))
|
|
@@ -126,14 +187,15 @@ function lesCles(copie) {
|
|
|
126
187
|
* then written again by their command once the lot applies without conflict; `refus`, a command
|
|
127
188
|
* that fails. A generated file the lot removes from the key (`encoreDeclares`) follows the lot
|
|
128
189
|
* instead: its deletion is done, any other change applied as a file of the lot, its command not
|
|
129
|
-
* played.
|
|
190
|
+
* played. The output of a command that passes goes to <dire>.
|
|
130
191
|
* @param {string} copie
|
|
131
192
|
* @param {Buffer} lot
|
|
132
193
|
* @param {{ engendres: any[], env: NodeJS.ProcessEnv } | null} [cles]
|
|
133
194
|
* @param {string[]} [autres]
|
|
195
|
+
* @param {(texte: string) => void} [dire]
|
|
134
196
|
* @returns {{ conflits: string[], enAttente: string[], restant: Buffer, refus?: string | null }}
|
|
135
197
|
*/
|
|
136
|
-
function appliquer(copie, lot, cles = null, autres = []) {
|
|
198
|
+
function appliquer(copie, lot, cles = null, autres = [], dire = surStderr) {
|
|
137
199
|
const fichiers = cles ? [...fichiersDuLot(copie, lot), ...autres] : [];
|
|
138
200
|
const touches = cles ? touchesPar(cles.engendres, fichiers) : [];
|
|
139
201
|
const exclus = fichiers.filter(f => touches.some(e => couvertPar(e.entiers, f)));
|
|
@@ -166,7 +228,13 @@ function appliquer(copie, lot, cles = null, autres = []) {
|
|
|
166
228
|
// The generated files the lot removes from the key follow the lot: main's version is not kept.
|
|
167
229
|
// A package.json left in conflict is read at the two versions of its conflict in the index.
|
|
168
230
|
const etage = n => String(git(copie, ['show', `:${n}:package.json`]).stdout);
|
|
169
|
-
|
|
231
|
+
// A reference of the frame is always declared: no key of the project names it.
|
|
232
|
+
const declares = encoreDeclares(
|
|
233
|
+
touches.filter(e => !e.cadre),
|
|
234
|
+
copie,
|
|
235
|
+
() => ({ base: etage(1), lot: etage(3) })
|
|
236
|
+
);
|
|
237
|
+
const vivants = touches.filter(e => e.cadre || declares.includes(e));
|
|
170
238
|
for (const { morceau, noms } of laisses) {
|
|
171
239
|
if (noms.every(f => vivants.some(e => couvertPar(e.entiers, f)))) {
|
|
172
240
|
continue;
|
|
@@ -185,7 +253,7 @@ function appliquer(copie, lot, cles = null, autres = []) {
|
|
|
185
253
|
return { conflits, enAttente, restant };
|
|
186
254
|
}
|
|
187
255
|
const refus = regenerer({
|
|
188
|
-
refs: vivants.map(e => ({ ...e, cadre:
|
|
256
|
+
refs: vivants.map(e => ({ ...e, cadre: Boolean(e.cadre) })),
|
|
189
257
|
lancer: commande =>
|
|
190
258
|
spawnSync('bash', ['-c', commande], {
|
|
191
259
|
cwd: copie,
|
|
@@ -194,6 +262,8 @@ function appliquer(copie, lot, cles = null, autres = []) {
|
|
|
194
262
|
maxBuffer: 1024 * 1024 * 1024,
|
|
195
263
|
}),
|
|
196
264
|
dansCopie: (...args) => spawnSync('git', ['-C', copie, ...args], { encoding: 'utf8' }),
|
|
265
|
+
// A command that says nothing leaves no message.
|
|
266
|
+
ecrire: sortie => void (sortie && dire(sortie)),
|
|
197
267
|
});
|
|
198
268
|
return { conflits, enAttente, restant, refus };
|
|
199
269
|
}
|
|
@@ -217,6 +287,26 @@ function porteDesMarques(copie, f) {
|
|
|
217
287
|
return existsSync(chemin) && /^(<{7}|>{7}) /m.test(readFileSync(chemin, 'latin1'));
|
|
218
288
|
}
|
|
219
289
|
|
|
290
|
+
/**
|
|
291
|
+
* The files of <copie> that still carry the marks of a conflict: those unmerged in its index, those
|
|
292
|
+
* its index holds apart from HEAD (a file a session put in the index with its marks, after a
|
|
293
|
+
* conflict the launcher's advance posed, is no longer unmerged), as pre-commit's
|
|
294
|
+
* check-merge-conflict reads the staged files, and those of <suspects> (the files an earlier
|
|
295
|
+
* advance left in conflict, which the index may no longer say so). Nothing is written: a session's
|
|
296
|
+
* sheet and a refused launch are judged on it.
|
|
297
|
+
* @param {string} copie
|
|
298
|
+
* @param {string[]} [suspects]
|
|
299
|
+
* @returns {string[]}
|
|
300
|
+
*/
|
|
301
|
+
export function marquesRestantes(copie, suspects = []) {
|
|
302
|
+
if (!existsSync(copie)) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
return [...new Set([...enConflit(copie), ...aLIndex(copie), ...suspects])].filter(f =>
|
|
306
|
+
porteDesMarques(copie, f)
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
220
310
|
// The files of <copie> that carry no conflict marker any more, among those unmerged: the work of a
|
|
221
311
|
// session that resolved them. Each goes to the index as resolved; the index is then left as HEAD has
|
|
222
312
|
// it once no conflict remains.
|
|
@@ -265,20 +355,22 @@ export function ecritPar(role, estUnTest) {
|
|
|
265
355
|
}
|
|
266
356
|
|
|
267
357
|
/**
|
|
268
|
-
* The lot from <base> to <pointe> as local work of <copie>; returns `{ ok, message }`.
|
|
358
|
+
* The lot from <base> to <pointe> as local work of <copie>; returns `{ ok, message }`. <dire>
|
|
359
|
+
* receives a fault that does not refuse the lot, and the output of the command of a generated file
|
|
360
|
+
* played again (stderr by default).
|
|
269
361
|
* @param {string} copie
|
|
270
|
-
* @param {{ base: string, pointe: string }} o
|
|
362
|
+
* @param {{ base: string, pointe: string, duCadre?: (copie: string) => any[], dire?: (texte: string) => void }} o
|
|
271
363
|
*/
|
|
272
|
-
export function reporter(copie, { base, pointe }) {
|
|
364
|
+
export function reporter(copie, { base, pointe, duCadre, dire = surStderr }) {
|
|
273
365
|
const d = git(copie, ['diff', '--binary', base, pointe]);
|
|
274
366
|
if (d.status !== 0) {
|
|
275
367
|
return { ok: false, message: `⛔ Le lot de ${base} à ${pointe} ne se lit pas : ${texte(d)}` };
|
|
276
368
|
}
|
|
277
|
-
const cles = lesCles(copie);
|
|
369
|
+
const cles = lesCles(copie, duCadre, dire);
|
|
278
370
|
if (cles.refus !== undefined) {
|
|
279
371
|
return { ok: false, message: cles.refus };
|
|
280
372
|
}
|
|
281
|
-
const a = appliquer(copie, d.stdout, cles);
|
|
373
|
+
const a = appliquer(copie, d.stdout, cles, [], dire);
|
|
282
374
|
if (a.enAttente.length) {
|
|
283
375
|
return {
|
|
284
376
|
ok: false,
|
|
@@ -305,11 +397,13 @@ const conflit = (copie, conflits, entete) =>
|
|
|
305
397
|
* lot waiting is accepted (`ok`) when that role writes one of their files. <suspects>, the files
|
|
306
398
|
* an earlier advance left in conflict: one that still carries its marks counts as in conflict,
|
|
307
399
|
* even when the index no longer says so (a session wrote it, or put it in the index, unresolved).
|
|
400
|
+
* <dire> receives a fault that does not refuse the advance, and the output of the command of a
|
|
401
|
+
* generated file played again (stderr by default).
|
|
308
402
|
* @param {string} copie
|
|
309
403
|
* @param {string} cible
|
|
310
|
-
* @param {{ ecrit?: (fichier: string) => boolean, suspects?: string[] }} [o]
|
|
404
|
+
* @param {{ ecrit?: (fichier: string) => boolean, suspects?: string[], duCadre?: (copie: string) => any[], dire?: (texte: string) => void }} [o]
|
|
311
405
|
*/
|
|
312
|
-
export function avancer(copie, cible, { ecrit, suspects = [] } = {}) {
|
|
406
|
+
export function avancer(copie, cible, { ecrit, suspects = [], duCadre, dire = surStderr } = {}) {
|
|
313
407
|
releverLesResolus(copie);
|
|
314
408
|
const restants = [
|
|
315
409
|
...new Set([...enConflit(copie), ...suspects.filter(f => porteDesMarques(copie, f))]),
|
|
@@ -356,7 +450,7 @@ export function avancer(copie, cible, { ecrit, suspects = [] } = {}) {
|
|
|
356
450
|
enAttente: siens(attendus),
|
|
357
451
|
};
|
|
358
452
|
}
|
|
359
|
-
const cles = lesCles(copie);
|
|
453
|
+
const cles = lesCles(copie, duCadre, dire);
|
|
360
454
|
if (cles.refus !== undefined) {
|
|
361
455
|
return { ok: false, message: cles.refus };
|
|
362
456
|
}
|
|
@@ -411,7 +505,7 @@ export function avancer(copie, cible, { ecrit, suspects = [] } = {}) {
|
|
|
411
505
|
};
|
|
412
506
|
}
|
|
413
507
|
const libres = lignes(git(copie, ['ls-files', '--others', '--exclude-standard']));
|
|
414
|
-
const { conflits, enAttente, restant, refus } = appliquer(copie, d.stdout, cles, libres);
|
|
508
|
+
const { conflits, enAttente, restant, refus } = appliquer(copie, d.stdout, cles, libres, dire);
|
|
415
509
|
if (enAttente.length) {
|
|
416
510
|
writeFileSync(garde, restant);
|
|
417
511
|
} else {
|
|
@@ -458,7 +552,9 @@ const SOUS_MODULES = path.join(import.meta.dirname, '..', 'sous-modules.sh');
|
|
|
458
552
|
* Prepares <copie> for a pass or a session (see the header, `preparer`): with <cible>, the guard of
|
|
459
553
|
* its submodules and its advance to <cible>; then the pose of its submodules, the check of their
|
|
460
554
|
* read-only mount, and the installation when the lock file is newer than it. The output of each
|
|
461
|
-
* command
|
|
555
|
+
* command, the command of a generated file the advance plays again included, and a fault of the
|
|
556
|
+
* advance that does not refuse it, go to the file descriptor <sortie>; returns
|
|
557
|
+
* `{ ok, message, partages }`.
|
|
462
558
|
* @param {string} copie
|
|
463
559
|
* @param {string | null} cible
|
|
464
560
|
* @param {{ env?: NodeJS.ProcessEnv, sortie?: number, ecrit?: (fichier: string) => boolean,
|
|
@@ -488,7 +584,11 @@ export function preparer(copie, cible, { env = process.env, sortie = 2, ecrit, s
|
|
|
488
584
|
if (g.status !== 0) {
|
|
489
585
|
return echec(g, 'La garde des sous-modules');
|
|
490
586
|
}
|
|
491
|
-
const a = avancer(copie, cible, {
|
|
587
|
+
const a = avancer(copie, cible, {
|
|
588
|
+
ecrit,
|
|
589
|
+
suspects,
|
|
590
|
+
dire: texte => void writeSync(sortie, texte),
|
|
591
|
+
});
|
|
492
592
|
if (!a.ok) {
|
|
493
593
|
return { ...a, partages: '' };
|
|
494
594
|
}
|
package/scripts/etapes.mjs
CHANGED
|
@@ -38,6 +38,8 @@ export const AUTO = 'auto';
|
|
|
38
38
|
// The role that writes the plan and answers its questions once, and sorts the discoveries of the
|
|
39
39
|
// ticket once its lot is on main; the role that questions the plan.
|
|
40
40
|
export const EXPLORATEUR = 'explorateur';
|
|
41
|
+
// The author of the circuit's own lines, at a ticket and among its kept results.
|
|
42
|
+
export const AUTEUR_DU_CIRCUIT = 'circuit';
|
|
41
43
|
export const QUESTIONNEUR = 'questionneur';
|
|
42
44
|
|
|
43
45
|
export const ETAPES = [
|
|
@@ -225,7 +227,7 @@ export const GESTES = [
|
|
|
225
227
|
genre: 'rien-a-livrer',
|
|
226
228
|
geste: 'aux contrôles, qui jugent le lot',
|
|
227
229
|
regle:
|
|
228
|
-
'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison), sauf le rouge d’une référence que le lot fait baisser, la dette des gardes, qui se régénère au lieu d’arrêter ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
|
|
230
|
+
'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison), sauf le rouge d’une référence que le lot fait baisser, la dette des gardes, qui se régénère au lieu d’arrêter, et le rouge qui nomme un fichier de test du lot, qui va au testwriter ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
|
|
229
231
|
cas: 'BP 320.9 : 995-tools n’a rien à livrer, 4 montées et 49 min (B5)',
|
|
230
232
|
},
|
|
231
233
|
{
|
|
@@ -256,8 +258,8 @@ export const RESPONSABLE = 'responsable';
|
|
|
256
258
|
|
|
257
259
|
// The commands by which the supervisor answers a question (scripts/circuit.mjs): resume, extend
|
|
258
260
|
// the plan, stop.
|
|
259
|
-
const REPONSES =
|
|
260
|
-
'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--mecanique [<commande>]` (avec `--contexte` : à l’arrêt du testwriter qui ne trouve aucun comportement à tester, le ticket bascule en circuit court sur le même plan, vers 1.1 avec sa commande, vers le développeur sans elle), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), `--reporter <heure>` (la question se tait jusqu’à l’heure, le circuit en attente), ou `--arreter`.';
|
|
261
|
+
export const REPONSES =
|
|
262
|
+
'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--mecanique [<commande>]` (avec `--contexte` : à l’arrêt du testwriter qui ne trouve aucun comportement à tester, ou de la preuve du rouge qui refuse le lot de tests, le ticket bascule en circuit court sur le même plan, vers 1.1 avec sa commande, vers le développeur sans elle), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), `--reporter <heure>` (la question se tait jusqu’à l’heure, le circuit en attente), ou `--arreter`.';
|
|
261
263
|
|
|
262
264
|
// The question of each stop no gesture settles, as a CI calls a person only for what no rule
|
|
263
265
|
// settles (the approval of a review): every stop of ARRETS, « a-repasser » once the circuit has
|
|
@@ -277,7 +279,7 @@ export const MONTEES = Object.fromEntries(
|
|
|
277
279
|
'sans-fiche':
|
|
278
280
|
'La séance finit deux fois sans fiche conforme : reprendre l’étape, ou arrêter le circuit ?',
|
|
279
281
|
preuve:
|
|
280
|
-
'La troisième preuve du rouge refuse le lot de tests : quel contexte donner au testwriter, ou le plan doit-il changer ?',
|
|
282
|
+
'La troisième preuve du rouge refuse le lot de tests : quel contexte donner au testwriter, le lot n’a-t-il aucun comportement à prouver (`--mecanique`), ou le plan doit-il changer ?',
|
|
281
283
|
controles:
|
|
282
284
|
'Un rouge reste, que le circuit ne rend pas au développeur (hors du plan, sans fichier, à arbitrer, le lot d’un geste mécanique), ou que trois séances n’ont pas levé : avec quel contexte le lever, ou le plan doit-il s’étendre ?',
|
|
283
285
|
'sans-livraison':
|
|
@@ -306,5 +308,13 @@ export const MONTEES = Object.fromEntries(
|
|
|
306
308
|
}).map(([arret, question]) => [arret, { question: `${question} ${REPONSES}`, qui: SUPERVISEUR }])
|
|
307
309
|
);
|
|
308
310
|
|
|
311
|
+
// The question <question> of a stop without the list of the answers it ends with (`REPONSES`), which
|
|
312
|
+
// the session of supervision reads once, at its opening.
|
|
313
|
+
const AMORCE_DES_REPONSES = REPONSES.slice(0, REPONSES.indexOf(':') + 1);
|
|
314
|
+
export const sansLesReponses = question =>
|
|
315
|
+
String(question ?? '')
|
|
316
|
+
.split(AMORCE_DES_REPONSES)[0]
|
|
317
|
+
.trim();
|
|
318
|
+
|
|
309
319
|
// The question of the stop <arret>, `{ question, qui }`, or null for a stop of no circuit.
|
|
310
320
|
export const monteeDe = arret => MONTEES[arret] ?? null;
|
|
@@ -11,6 +11,9 @@ import path from 'node:path';
|
|
|
11
11
|
|
|
12
12
|
export const SHA = /^[0-9a-f]{40,64}$/;
|
|
13
13
|
|
|
14
|
+
// The journal every bd command writes: the tree judged takes its version of the commit.
|
|
15
|
+
export const JOURNAL = '.beads/interactions.jsonl';
|
|
16
|
+
|
|
14
17
|
export const git = (racine, args, env = process.env) =>
|
|
15
18
|
spawnSync('git', ['-C', racine, ...args], {
|
|
16
19
|
encoding: 'utf8',
|
|
@@ -51,6 +54,17 @@ function sousModuleModifie(racine) {
|
|
|
51
54
|
return r.stdout.split('\0').some(e => /^[12] \S+ S/.test(e));
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
// The files where the tree judged of the folder at <racine> differs from the tree of its HEAD
|
|
58
|
+
// (the journal of bd left out, it takes its version of the commit); [] when none or git fails.
|
|
59
|
+
export function ecartsDuDossier(racine) {
|
|
60
|
+
const etat = etatDuDepot(racine);
|
|
61
|
+
if (!etat.arbre) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
const r = git(etat.racine, ['diff-tree', '-r', '--name-only', '-z', etat.commit, etat.arbre]);
|
|
65
|
+
return r.status === 0 ? r.stdout.split('\0').filter(Boolean) : [];
|
|
66
|
+
}
|
|
67
|
+
|
|
54
68
|
// The state of the repository at <racine> as it stands: `{ racine, commit, arbre, branche, main }`,
|
|
55
69
|
// its top (its real path), HEAD, the tree of its working tree, the branch of HEAD (null when
|
|
56
70
|
// detached) and main (brancheDeMain); `{ raison }` when no last green can count.
|
|
@@ -80,6 +94,15 @@ export function etatDuDepot(racine) {
|
|
|
80
94
|
if (git(top, ['add', '-A'], env).status !== 0) {
|
|
81
95
|
return { raison: 'git échoue' };
|
|
82
96
|
}
|
|
97
|
+
// The journal of bd takes its version of the commit (removed when the commit lacks it).
|
|
98
|
+
const dansLeCommit = sortie(top, ['ls-tree', 'HEAD', '--', JOURNAL]);
|
|
99
|
+
const entree = dansLeCommit?.match(/^(\d+) blob ([0-9a-f]+)\t/);
|
|
100
|
+
const retablir = entree
|
|
101
|
+
? git(top, ['update-index', '--add', '--cacheinfo', `${entree[1]},${entree[2]},${JOURNAL}`], env)
|
|
102
|
+
: git(top, ['update-index', '--force-remove', JOURNAL], env);
|
|
103
|
+
if (retablir.status !== 0) {
|
|
104
|
+
return { raison: 'git échoue' };
|
|
105
|
+
}
|
|
83
106
|
const arbre = sortie(top, ['write-tree'], env);
|
|
84
107
|
if (!arbre) {
|
|
85
108
|
return { raison: 'git échoue' };
|
|
@@ -50,10 +50,8 @@
|
|
|
50
50
|
// an effect not written has its outcome, said on the error output or the failure of its
|
|
51
51
|
// activity;
|
|
52
52
|
// - the acts of the queue of a project (scripts/integration/file.mjs, grillhouse-4nr.8): `situer`,
|
|
53
|
-
// where the lot of a ticket stands (`situerLeLot`); `brancher`, the branch made the candidate
|
|
54
|
-
//
|
|
55
|
-
// expected workflows together (`lireLesPassagesDeLaCI`); `conclure`, the CI concluded at the
|
|
56
|
-
// ticket (`conclureLaCI`); `avancer`,
|
|
53
|
+
// where the lot of a ticket stands (`situerLeLot`); `brancher`, the branch made the candidate the
|
|
54
|
+
// final pass judges (`preparerLaBranche`); `avancer`,
|
|
57
55
|
// main moved onto the candidate (`avancerMain`); each of `brancher` and `avancer` telling the
|
|
58
56
|
// ticket of a branch out of the queue or kept (`direLIssue`); `fermer`, the ticket closed and main
|
|
59
57
|
// pushed (`fermerLEntree`); `effet-de-la-file`, one effect they gave back, under the key of its
|
|
@@ -91,11 +89,13 @@ import {
|
|
|
91
89
|
} from './integration/file.mjs';
|
|
92
90
|
import {
|
|
93
91
|
ghDans,
|
|
92
|
+
declencherLaCiDeMain,
|
|
94
93
|
lireLaCiDeMain,
|
|
95
94
|
lotsDepuisLeVert,
|
|
96
95
|
ouvrirLeDefautDeMain,
|
|
97
96
|
} from './ci-de-main.mjs';
|
|
98
97
|
|
|
98
|
+
import { rougesDUnePasse } from './activites.mjs';
|
|
99
99
|
import { ecrireLEffet } from './effets.mjs';
|
|
100
100
|
import { Arret, commenter, geste } from './ticket-du-circuit.mjs';
|
|
101
101
|
import { arretDeLaLimiteDUsage, MEMOIRE } from './transitions.mjs';
|
|
@@ -155,9 +155,14 @@ function leContexte(ticket, memoire = {}, options = {}) {
|
|
|
155
155
|
|
|
156
156
|
// The tools of the queue on the main tree <racine> (the act plays there), its lines on the error
|
|
157
157
|
// output, the progress directory <avancement> of a reading of the CI, the effects it emits
|
|
158
|
-
// gathered (`rendus`), which the act gives back.
|
|
158
|
+
// gathered (`rendus`), which the act gives back. Its final pass reads its reds as the checks of the
|
|
159
|
+
// circuit do (`rougesDUnePasse`), the port every tool of the queue is built with.
|
|
160
|
+
const outilsDeLActe = (racine, avancement = null) =>
|
|
161
|
+
outilsDeLaFile(racine, l => process.stderr.write(`${l}\n`), avancement, {
|
|
162
|
+
rouges: rougesDUnePasse,
|
|
163
|
+
});
|
|
159
164
|
const laFile = (racine, avancement = null) => {
|
|
160
|
-
const o =
|
|
165
|
+
const o = outilsDeLActe(racine, avancement);
|
|
161
166
|
o.rendus = [];
|
|
162
167
|
return o;
|
|
163
168
|
};
|
|
@@ -181,7 +186,7 @@ const arretDeLEtat = (ctx, code, etat) => ({
|
|
|
181
186
|
});
|
|
182
187
|
|
|
183
188
|
// The options of a run on the supervisor's answer <reponse>.
|
|
184
|
-
const optionsDe = reponse => {
|
|
189
|
+
export const optionsDe = reponse => {
|
|
185
190
|
if (!reponse) {
|
|
186
191
|
return {};
|
|
187
192
|
}
|
|
@@ -477,9 +482,16 @@ Object.assign(ACTES, {
|
|
|
477
482
|
// The CI of main read once, in the main tree: the defect ticket of a red passage opened for the
|
|
478
483
|
// owner (`ouvrirLeDefautDeMain`, one per passage), the lots entered since the last green named by
|
|
479
484
|
// git. `{ etat }`: `verte`, `rouge` or `non-lue`.
|
|
480
|
-
|
|
485
|
+
// It starts the CI first when the delay and the tip ask for it (`declencherLaCiDeMain`, <apresEntree>
|
|
486
|
+
// after an entry): a start GitHub refuses leaves its fault, the queue goes on.
|
|
487
|
+
async 'surveiller-la-ci-de-main'({ racine, apresEntree }) {
|
|
481
488
|
const o = laFile(racine);
|
|
482
|
-
const
|
|
489
|
+
const gh = ghDans(racine);
|
|
490
|
+
const lancement = declencherLaCiDeMain({ racine, gh }, { apresEntree: apresEntree === true });
|
|
491
|
+
if (lancement.faute) {
|
|
492
|
+
o.dire(`⚠ ${lancement.faute}`);
|
|
493
|
+
}
|
|
494
|
+
const lecture = lireLaCiDeMain({ racine, gh });
|
|
483
495
|
if (lecture.etat === 'rouge') {
|
|
484
496
|
const pointe = o.principale ?? 'main';
|
|
485
497
|
const lots = lotsDepuisLeVert(racine, { vert: lecture.vert, pointe });
|
|
@@ -490,34 +502,12 @@ Object.assign(ACTES, {
|
|
|
490
502
|
}
|
|
491
503
|
return { etat: lecture.etat };
|
|
492
504
|
},
|
|
493
|
-
// The acts of the former path of the queue (the CI of a ticket's branch, the readings of the
|
|
494
|
-
// workflows of main), kept for the executions in flight whose history replays them, retired
|
|
495
|
-
// by grillhouse-3uv.131 once they are drained: they read nothing and judge nothing, the lot
|
|
496
|
-
// having been prepared as the queue's former path did, and the final pass of its circuit
|
|
497
|
-
// having judged it.
|
|
498
|
-
async passages() {
|
|
499
|
-
return { etat: 'verte', passage: 'ancien-chemin' };
|
|
500
|
-
},
|
|
501
|
-
async 'inscrire-flux-de-main'() {
|
|
502
|
-
return null;
|
|
503
|
-
},
|
|
504
|
-
async 'relire-flux-de-main'() {
|
|
505
|
-
return { dues: 0, effets: [] };
|
|
506
|
-
},
|
|
507
|
-
async conclure() {
|
|
508
|
-
return { avancer: true, effets: [] };
|
|
509
|
-
},
|
|
510
505
|
// One effect an act of the queue gave back, under the key of its activity, with the outcome of
|
|
511
506
|
// the queue when it is not written (`ecrireLEffet`).
|
|
512
507
|
async 'effet-de-la-file'({ racine, effet, cle, derniere }) {
|
|
513
|
-
ecrireLEffet(
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
cle,
|
|
517
|
-
{
|
|
518
|
-
reessayer: derniere === false,
|
|
519
|
-
}
|
|
520
|
-
);
|
|
508
|
+
ecrireLEffet(outilsDeLActe(racine), effet, cle, {
|
|
509
|
+
reessayer: derniere === false,
|
|
510
|
+
});
|
|
521
511
|
return null;
|
|
522
512
|
},
|
|
523
513
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// The types of the closure of the machine (./fermeture-de-la-machine.mjs), which the workflow of
|
|
2
|
+
// the places (src/temporal/places/) imports.
|
|
3
|
+
|
|
4
|
+
/** What the command of closure does on the reservation in place. */
|
|
5
|
+
export function decisionDeFermeture(
|
|
6
|
+
reservation: object | null | undefined
|
|
7
|
+
): 'fermer' | 'deja-fermee';
|
|
8
|
+
|
|
9
|
+
/** What the command of reopening does on the reservation in place. */
|
|
10
|
+
export function decisionDeReouverture(
|
|
11
|
+
reservation: object | null | undefined
|
|
12
|
+
): 'rouvrir' | 'deja-ouverte';
|
|
13
|
+
|
|
14
|
+
/** What still runs by project and by ticket, or « la machine est vide ». */
|
|
15
|
+
export function direCeQuiTourne(o: {
|
|
16
|
+
prises: readonly { ticket?: string | null; racine?: string | null }[];
|
|
17
|
+
parts: readonly { ticket?: string | null; projet?: string | null; etat?: string }[];
|
|
18
|
+
}): string[];
|
|
19
|
+
|
|
20
|
+
/** The lines a command says once it has played. */
|
|
21
|
+
export function direLaFermeture(o: {
|
|
22
|
+
issue: string;
|
|
23
|
+
reservation: { depuis: number } | null;
|
|
24
|
+
prises: readonly { ticket?: string | null; racine?: string | null }[];
|
|
25
|
+
parts: readonly { ticket?: string | null; projet?: string | null; etat?: string }[];
|
|
26
|
+
maintenant: number;
|
|
27
|
+
}): string[];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// The closure of the machine by the supervisor, as `kubectl cordon` and `drain` close a node to new
|
|
2
|
+
// work: the decision of each command on the reservation of the machine in place, and the lines it
|
|
3
|
+
// says, what still runs by project and by ticket (sessions: the places of the workflow of the
|
|
4
|
+
// machine; passes: their parts), « la machine est vide » when nothing plays, and how long the
|
|
5
|
+
// closure has lasted. Pure: the workflow of the places (src/temporal/places/deroule.ts) bundles
|
|
6
|
+
// the decisions, so this module imports only a rule that imports nothing. The commands themselves
|
|
7
|
+
// are scripts/machine.mjs.
|
|
8
|
+
import { duree } from './regles-des-places.mjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What the command of closure does on the reservation <reservation> of the machine (null without):
|
|
12
|
+
* `'fermer'` when none stands, `'deja-fermee'` under the supervisor's closure.
|
|
13
|
+
* @param {object | null | undefined} reservation
|
|
14
|
+
* @returns {'fermer' | 'deja-fermee'}
|
|
15
|
+
*/
|
|
16
|
+
export function decisionDeFermeture(reservation) {
|
|
17
|
+
return reservation ? 'deja-fermee' : 'fermer';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* What the command of reopening does on the reservation <reservation>: `'rouvrir'` the supervisor's
|
|
22
|
+
* closure, `'deja-ouverte'` when none stands.
|
|
23
|
+
* @param {object | null | undefined} reservation
|
|
24
|
+
* @returns {'rouvrir' | 'deja-ouverte'}
|
|
25
|
+
*/
|
|
26
|
+
export function decisionDeReouverture(reservation) {
|
|
27
|
+
return reservation ? 'rouvrir' : 'deja-ouverte';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// The folder name of a root of project, « alpha » for « /depots/alpha ».
|
|
31
|
+
const nomDuProjet = racine => (racine ? (racine.split('/').filter(Boolean).at(-1) ?? racine) : '?');
|
|
32
|
+
|
|
33
|
+
const pluriel = (n, mot) => `${n} ${mot}${n > 1 ? 's' : ''}`;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* What still runs, one line by project: its sessions (`prises`, the places of the workflow of the
|
|
37
|
+
* machine) and its passes (`parts` that hold their part; a pass that waits does not run), each with
|
|
38
|
+
* its tickets. Only « la machine est vide » when nothing runs.
|
|
39
|
+
* @param {{ prises: { ticket?: string | null, racine?: string | null }[],
|
|
40
|
+
* parts: { ticket?: string | null, projet?: string | null, etat?: string }[] }} o
|
|
41
|
+
* @returns {string[]}
|
|
42
|
+
*/
|
|
43
|
+
export function direCeQuiTourne({ prises, parts }) {
|
|
44
|
+
/** @type {Map<string, { seances: string[], passes: string[] }>} */
|
|
45
|
+
const projets = new Map();
|
|
46
|
+
const de = nom => {
|
|
47
|
+
if (!projets.has(nom)) {
|
|
48
|
+
projets.set(nom, { seances: [], passes: [] });
|
|
49
|
+
}
|
|
50
|
+
return projets.get(nom);
|
|
51
|
+
};
|
|
52
|
+
for (const p of prises) {
|
|
53
|
+
de(nomDuProjet(p.racine)).seances.push(p.ticket ?? 'sans ticket');
|
|
54
|
+
}
|
|
55
|
+
for (const p of parts.filter(x => x.etat !== 'attend')) {
|
|
56
|
+
de(nomDuProjet(p.projet)).passes.push(p.ticket ?? 'sans ticket');
|
|
57
|
+
}
|
|
58
|
+
if (!projets.size) {
|
|
59
|
+
return ['la machine est vide'];
|
|
60
|
+
}
|
|
61
|
+
return [...projets.entries()]
|
|
62
|
+
.sort(([a], [b]) => a.localeCompare(b, 'en'))
|
|
63
|
+
.map(([nom, { seances, passes }]) =>
|
|
64
|
+
[
|
|
65
|
+
nom,
|
|
66
|
+
...(seances.length ? [`${pluriel(seances.length, 'séance')} (${seances.join(', ')})`] : []),
|
|
67
|
+
...(passes.length ? [`${pluriel(passes.length, 'passe')} (${passes.join(', ')})`] : []),
|
|
68
|
+
].join(' · ')
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The lines a command says once it has played: its <issue> (`fermee`, `deja-fermee` for the
|
|
74
|
+
* closure; `rouverte`, `deja-ouverte` for the reopening), then, for a closure, what still runs. <reservation> is the one in place after the
|
|
75
|
+
* command (its start gives how long the closure has lasted), <maintenant> the time in ms.
|
|
76
|
+
* @param {{ issue: string, reservation: { depuis: number } | null,
|
|
77
|
+
* prises: Parameters<typeof direCeQuiTourne>[0]['prises'],
|
|
78
|
+
* parts: Parameters<typeof direCeQuiTourne>[0]['parts'], maintenant: number }} o
|
|
79
|
+
* @returns {string[]}
|
|
80
|
+
*/
|
|
81
|
+
export function direLaFermeture({ issue, reservation, prises, parts, maintenant }) {
|
|
82
|
+
const tourne = direCeQuiTourne({ prises, parts });
|
|
83
|
+
switch (issue) {
|
|
84
|
+
case 'fermee':
|
|
85
|
+
return ['machine fermée par le superviseur : aucune place neuve, aucun circuit neuf', ...tourne];
|
|
86
|
+
case 'deja-fermee':
|
|
87
|
+
return [
|
|
88
|
+
`machine déjà fermée par le superviseur, depuis ${reservation ? duree(maintenant - reservation.depuis) : '?'}`,
|
|
89
|
+
...tourne,
|
|
90
|
+
];
|
|
91
|
+
case 'rouverte':
|
|
92
|
+
return ['machine rouverte : les circuits reprennent d’eux-mêmes à l’étape suivante'];
|
|
93
|
+
case 'deja-ouverte':
|
|
94
|
+
return ['machine déjà ouverte : rien à faire'];
|
|
95
|
+
default:
|
|
96
|
+
throw new Error(`issue inconnue : ${issue}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// in its « Architecture » section or in an acceptance criterion. A file named there is one the
|
|
3
3
|
// ticket's plan covers by its own word: a write out of the plan in it extends the plan, with the
|
|
4
4
|
// piece that names it. A parent directory, a base name alone, another section, and the documents
|
|
5
|
-
// the responsable owns (ARCHITECTURE.md, CADRE.md, INTERFACE.md) are not named.
|
|
5
|
+
// the responsable owns (ARCHITECTURE.md, CADRE.md, INTERFACE.md) are not named. The plan keeps the
|
|
6
|
+
// component of the title that holds a file named there (`fichiersNommesAuTicket`).
|
|
6
7
|
|
|
7
8
|
const DOCUMENTS_DU_RESPONSABLE = /(^|\/)(ARCHITECTURE|CADRE|INTERFACE)\.md$/;
|
|
8
9
|
|
|
@@ -53,3 +54,28 @@ export function fichierNommeAuTicket(description, chemin) {
|
|
|
53
54
|
}
|
|
54
55
|
return null;
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
// The words of a description that may be a path: what its delimiters (`figureDans`) leave.
|
|
59
|
+
const MOTS = /[^\s`'"()[\],;:]+/g;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The files the description <description> names (`{ chemin, piece }`, in their order, each once):
|
|
63
|
+
* those of its words that <estUnFichier> says a file of the repository, by its path from the root,
|
|
64
|
+
* and that `fichierNommeAuTicket` reads as named.
|
|
65
|
+
*/
|
|
66
|
+
export function fichiersNommesAuTicket(description, estUnFichier) {
|
|
67
|
+
const vus = new Set();
|
|
68
|
+
const nommes = [];
|
|
69
|
+
for (const [mot] of String(description ?? '').matchAll(MOTS)) {
|
|
70
|
+
const chemin = mot.replace(/\.$/, '');
|
|
71
|
+
if (vus.has(chemin) || chemin.startsWith('/') || chemin.startsWith('..')) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
vus.add(chemin);
|
|
75
|
+
const nomme = estUnFichier(chemin) ? fichierNommeAuTicket(description, chemin) : null;
|
|
76
|
+
if (nomme) {
|
|
77
|
+
nommes.push({ chemin, piece: nomme.piece });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return nommes;
|
|
81
|
+
}
|