@roomi-fields/grillhouse 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +12 -0
- package/cadre/templates/cargo/package.json +4 -2
- package/cadre/templates/projet/CLAUDE.md +5 -0
- package/cadre/templates/python/package.json +4 -2
- package/dist/temporal/file/contrat.d.ts +3 -1
- package/dist/temporal/file/deroule.js +2 -2
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +12 -0
- package/dist/temporal/places/deroule.js +2 -0
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.js +30 -3
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/docs/ARCHITECTURE.md +27 -6
- package/docs/INTERFACE.md +2 -2
- package/package.json +1 -1
- package/scripts/attente-a-l-arret.mjs +1 -1
- package/scripts/attente-au-tour.mjs +1 -1
- package/scripts/file-des-tickets.d.mts +23 -1
- package/scripts/file-des-tickets.mjs +94 -3
- package/scripts/gabarit-absent.mjs +30 -0
- package/scripts/grillhouse-maj.mjs +58 -1
- package/scripts/groupe-cles.d.mts +25 -0
- package/scripts/groupe-cles.mjs +73 -0
- package/scripts/integration/file.mjs +30 -5
- package/scripts/jointure.d.ts +11 -0
- package/scripts/langages/cargo/index.mjs +3 -2
- package/scripts/langages/cargo/mise-a-jour.mjs +17 -0
- package/scripts/langages/python/index.mjs +3 -1
- package/scripts/langages/python/mise-a-jour.mjs +22 -5
- package/scripts/langages/typescript/mise-a-jour.mjs +8 -20
- package/scripts/places-de-la-machine.mjs +15 -5
- package/scripts/regles-des-places.d.mts +7 -0
- package/scripts/regles-des-places.mjs +46 -4
- package/scripts/services-du-noyau.mjs +2 -1
- package/scripts/sigle-du-projet.mjs +49 -0
- package/scripts/superviseur.mjs +31 -18
- package/scripts/tableau.mjs +96 -13
|
@@ -42,7 +42,7 @@ import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
|
42
42
|
import { ecrireLaTrace, traceDesPlaces } from './journal-des-etats.mjs';
|
|
43
43
|
import { mesureDeLaMachine } from './mesure-de-la-machine.mjs';
|
|
44
44
|
import { plafondDe } from './plafond-de-la-machine.mjs';
|
|
45
|
-
import { AttenteDeLaMachine, avecLaMachine, borneDe } from './verrou-de-machine.mjs';
|
|
45
|
+
import { AttenteDeLaMachine, avecLaMachine, borneDe, racineDuDepot } from './verrou-de-machine.mjs';
|
|
46
46
|
|
|
47
47
|
export const VARIABLE_ESPACEMENT = 'GRILLHOUSE_ESPACEMENT_MS';
|
|
48
48
|
export const VARIABLE_TRAVAILLEURS = 'GRILLHOUSE_TRAVAILLEURS';
|
|
@@ -205,6 +205,7 @@ export function prendreUnePlace({
|
|
|
205
205
|
pid,
|
|
206
206
|
depart: depart === undefined ? departDe(pid) : depart,
|
|
207
207
|
ticket,
|
|
208
|
+
racine: racineDuDepot(racine),
|
|
208
209
|
...(rang === undefined || rang === null ? {} : { rang }),
|
|
209
210
|
borneMs,
|
|
210
211
|
rappelMs,
|
|
@@ -344,7 +345,7 @@ export function avecLaMachineEtUnePlace(mesure, options = {}) {
|
|
|
344
345
|
* The places taken and the waits of the machine under <env>, as the server holds them: `{ plafond,
|
|
345
346
|
* faute, prises, attentes, circuits }` (`faute`, a value of the ceiling the poste names and the
|
|
346
347
|
* server refused, the ceiling read before kept; `circuits`, the places of the circuits, held or
|
|
347
|
-
* waited for, `{ racine, ticket, rang, accordee, depuis, vu }`), `prises` `{ id, pid, depart, ticket, rang, depuis }`, `attentes` in the
|
|
348
|
+
* waited for, `{ racine, ticket, rang, accordee, depuis, vu }`), `prises` `{ id, pid, depart, ticket, racine, rang, depuis }`, `attentes` in the
|
|
348
349
|
* order of arrival `{ id, pid, ticket, rang, raison, depuis }`; none where no place is taken.
|
|
349
350
|
* @param {{ env?: Record<string, string | undefined> }} [o]
|
|
350
351
|
*/
|
|
@@ -399,15 +400,24 @@ function mesureDEssai(env) {
|
|
|
399
400
|
* started (`circuits` of the server, which the queue of each project reserves). The
|
|
400
401
|
* machine is the one GRILLHOUSE_MESURE_D_ESSAI fixes, else the real one (`mesurer`).
|
|
401
402
|
* @param {{ env?: Record<string, string | undefined>, mesurer?: () => { coeurs: number,
|
|
402
|
-
* charge: number, memoireLibre: number, memoireTotale: number }
|
|
403
|
+
* charge: number, memoireLibre: number, memoireTotale: number },
|
|
404
|
+
* lues?: { plafond: number, faute?: string | null, prises: { ticket: string | null,
|
|
405
|
+
* racine?: string | null }[], attentes: { ticket: string, depuis: number }[],
|
|
406
|
+
* circuits?: { ticket: string, depuis: number, accordee?: boolean, raison?: string | null }[] }
|
|
407
|
+
* }} [o] `lues`, the places as the server holds them (`lirePlaces` by default); `tenues` of the
|
|
408
|
+
* result gives each place taken, its ticket and the root of its project (null without one)
|
|
409
|
+
* @returns {{ prises: number, tenues: { ticket: string | null, racine: string | null }[],
|
|
410
|
+
* plafond: number, faute: string | null, charge: number, coeurs: number, memoireGo: number,
|
|
411
|
+
* memoireTotaleGo: number, attentes: { ticket: string, depuis: number, disque?: string | null }[] }}
|
|
403
412
|
* @throws {Error} naming GRILLHOUSE_MESURE_D_ESSAI when its value is faulty
|
|
404
413
|
*/
|
|
405
|
-
export function etatDesPlaces({ env = process.env, mesurer = mesureDeLaMachine } = {}) {
|
|
414
|
+
export function etatDesPlaces({ env = process.env, mesurer = mesureDeLaMachine, lues } = {}) {
|
|
406
415
|
const fixee = mesureDEssai(env);
|
|
407
|
-
const { plafond, faute = null, prises, attentes, circuits = [] } = lirePlaces({ env });
|
|
416
|
+
const { plafond, faute = null, prises, attentes, circuits = [] } = lues ?? lirePlaces({ env });
|
|
408
417
|
const m = fixee ?? mesurer();
|
|
409
418
|
return {
|
|
410
419
|
prises: prises.length,
|
|
420
|
+
tenues: prises.map(p => ({ ticket: p.ticket ?? null, racine: p.racine ?? null })),
|
|
411
421
|
plafond,
|
|
412
422
|
faute,
|
|
413
423
|
charge: Math.round(m.charge * 10) / 10,
|
|
@@ -50,6 +50,11 @@ export interface PlaceDeCircuit {
|
|
|
50
50
|
reprise?: boolean;
|
|
51
51
|
/** Why it waits apart from the order of arrival (its disk of copies), null without. */
|
|
52
52
|
raison?: string | null;
|
|
53
|
+
/** Its Beads priority (0 to 4) and creation, which order the circuits that wait of one group. */
|
|
54
|
+
priorite?: number;
|
|
55
|
+
creation?: string;
|
|
56
|
+
/** The identity of its project's group, absent out of a group. */
|
|
57
|
+
groupe?: string;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
/**
|
|
@@ -66,6 +71,8 @@ export function reserverDesCircuits(
|
|
|
66
71
|
candidats?: string[];
|
|
67
72
|
disque?: string | null;
|
|
68
73
|
reprise?: { ticket: string; rang: number | null };
|
|
74
|
+
groupe?: string;
|
|
75
|
+
priorites?: Record<string, { priorite: number; creation: string }>;
|
|
69
76
|
},
|
|
70
77
|
o: { rang: number; plafond: number; maintenant: number }
|
|
71
78
|
): { circuits: PlaceDeCircuit[]; rang: number; accordes: string[] };
|
|
@@ -86,14 +86,31 @@ export const PERIME_MS = 10 * 60_000;
|
|
|
86
86
|
* the circuits that hold one are fewer than <plafond>: the first that waits keeps the next ones
|
|
87
87
|
* waiting, but a candidate short of disk, which waits with its reason and keeps no one. Gives the
|
|
88
88
|
* places, the last rank drawn, and the tickets of the demand that hold a place.
|
|
89
|
+
*
|
|
90
|
+
* Between the projects of one group (`grillhouse.groupe`, `groupe` its identity, absent out of a
|
|
91
|
+
* group), the priority orders the circuits that wait: each candidate carries its Beads priority and
|
|
92
|
+
* its creation (`priorites`), and the circuits not granted of one group share out their own ranks
|
|
93
|
+
* of arrival again by priority (P0 to P4), age, then rank. A circuit already granted keeps its
|
|
94
|
+
* place (a higher priority arriving later passes only the ones that wait), a project out of a
|
|
95
|
+
* group and the order of the groups between them keep the order of arrival.
|
|
89
96
|
* @param {Array<{ racine: string, ticket: string, rang: number, accordee: boolean, depuis: number,
|
|
90
|
-
* vu: number, reprise?: boolean, raison?: string | null
|
|
97
|
+
* vu: number, reprise?: boolean, raison?: string | null, priorite?: number, creation?: string,
|
|
98
|
+
* groupe?: string }>} places
|
|
91
99
|
* @param {{ racine: string, vivants?: string[], candidats?: string[], disque?: string | null,
|
|
92
|
-
* reprise?: { ticket: string, rang: number | null }
|
|
100
|
+
* reprise?: { ticket: string, rang: number | null }, groupe?: string,
|
|
101
|
+
* priorites?: Record<string, { priorite: number, creation: string }> }} demande
|
|
93
102
|
* @param {{ rang: number, plafond: number, maintenant: number }} o
|
|
94
103
|
*/
|
|
95
104
|
export function reserverDesCircuits(places, demande, o) {
|
|
96
|
-
const {
|
|
105
|
+
const {
|
|
106
|
+
racine,
|
|
107
|
+
vivants = [],
|
|
108
|
+
candidats = [],
|
|
109
|
+
disque = null,
|
|
110
|
+
reprise,
|
|
111
|
+
groupe,
|
|
112
|
+
priorites = {},
|
|
113
|
+
} = demande;
|
|
97
114
|
const { plafond, maintenant } = o;
|
|
98
115
|
let { rang } = o;
|
|
99
116
|
const siens = new Set([...vivants, ...candidats]);
|
|
@@ -101,6 +118,13 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
101
118
|
maintenant - c.vu < PERIME_MS &&
|
|
102
119
|
(c.racine !== racine || siens.has(c.ticket) || Boolean(reprise) || (c.reprise && !c.accordee));
|
|
103
120
|
const circuits = places.filter(garde).map(c => ({ ...c }));
|
|
121
|
+
// What the demand says of a ticket's place: its group, its priority and its creation.
|
|
122
|
+
const dit = ticket => ({
|
|
123
|
+
...(groupe === undefined ? {} : { groupe }),
|
|
124
|
+
...(priorites[ticket] === undefined
|
|
125
|
+
? {}
|
|
126
|
+
: { priorite: priorites[ticket].priorite, creation: priorites[ticket].creation }),
|
|
127
|
+
});
|
|
104
128
|
const placer = (ticket, accordee, o2 = {}) => {
|
|
105
129
|
const c = circuits.find(x => x.racine === racine && x.ticket === ticket);
|
|
106
130
|
if (c) {
|
|
@@ -109,7 +133,7 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
109
133
|
if (accordee) {
|
|
110
134
|
c.reprise = false;
|
|
111
135
|
}
|
|
112
|
-
Object.assign(c, o2.maj ?? {});
|
|
136
|
+
Object.assign(c, dit(ticket), o2.maj ?? {});
|
|
113
137
|
return;
|
|
114
138
|
}
|
|
115
139
|
const r = o2.rang ?? (rang += 1);
|
|
@@ -121,6 +145,7 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
121
145
|
accordee,
|
|
122
146
|
depuis: maintenant,
|
|
123
147
|
vu: maintenant,
|
|
148
|
+
...dit(ticket),
|
|
124
149
|
...(o2.maj ?? {}),
|
|
125
150
|
});
|
|
126
151
|
};
|
|
@@ -132,6 +157,23 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
132
157
|
maj: { reprise: true, raison: null },
|
|
133
158
|
});
|
|
134
159
|
}
|
|
160
|
+
// The circuits not granted of each group share out their own ranks again, by priority, age, rank.
|
|
161
|
+
const sorte = c => [c.priorite ?? 2, Date.parse(c.creation ?? '') || 0, c.rang];
|
|
162
|
+
const parGroupe = Map.groupBy(
|
|
163
|
+
circuits.filter(c => !c.accordee && c.groupe !== undefined),
|
|
164
|
+
c => c.groupe
|
|
165
|
+
);
|
|
166
|
+
for (const attente of parGroupe.values()) {
|
|
167
|
+
const rangs = attente.map(c => c.rang).sort((a, b) => a - b);
|
|
168
|
+
attente
|
|
169
|
+
.toSorted((a, b) => {
|
|
170
|
+
const [x, y] = [sorte(a), sorte(b)];
|
|
171
|
+
return x[0] - y[0] || x[1] - y[1] || x[2] - y[2];
|
|
172
|
+
})
|
|
173
|
+
.forEach((c, i) => {
|
|
174
|
+
c.rang = rangs[i];
|
|
175
|
+
});
|
|
176
|
+
}
|
|
135
177
|
let tenues = circuits.filter(c => c.accordee).length;
|
|
136
178
|
for (const c of circuits.filter(x => !x.accordee).sort((a, b) => a.rang - b.rang)) {
|
|
137
179
|
if (tenues >= plafond) {
|
|
@@ -12,12 +12,13 @@ export * from './langages.mjs';
|
|
|
12
12
|
// The services of the core to a module of language: the plan of an envelope, the progress of a
|
|
13
13
|
// pass and its measure, the tasks of the graph of the packages, the base of a pass, the pressure of the machine, its place and its lock, the last
|
|
14
14
|
// green, the arbitrages of a ticket, the source files of a project, the search of a command in the
|
|
15
|
-
// PATH.
|
|
15
|
+
// PATH, the copy of a template a project lacks.
|
|
16
16
|
export { arbitrageTranche, estArbitrage } from './arbitrages.mjs';
|
|
17
17
|
export { garderLeTotal, inscrireLePlan, ouvrirAvancement } from './avancement.mjs';
|
|
18
18
|
export { sources } from './sources.mjs';
|
|
19
19
|
export { trouverDansLePath } from './commandes-du-path.mjs';
|
|
20
20
|
export { paquetsSansPackageJson } from './paquet-npm.mjs';
|
|
21
|
+
export { poserLeGabaritAbsent } from './gabarit-absent.mjs';
|
|
21
22
|
export {
|
|
22
23
|
cheminsDeLaTache,
|
|
23
24
|
construireDepuisLesArguments,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The short name of a project on the displays shared between projects (the line of the places, the
|
|
2
|
+
// board of several projects): the key `grillhouse.sigle` of its package.json (grillhouse-1lf, the
|
|
3
|
+
// owner's word of 2026-11-12), else its ticket prefix (`issue-prefix` of .beads/config.yaml,
|
|
4
|
+
// ./prefixe-des-tickets.mjs). Read like the other keys `grillhouse.*` (./circuits-cles.mjs): as
|
|
5
|
+
// written, a faulty value is named by its key.
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { prefixe } from './prefixe-des-tickets.mjs';
|
|
9
|
+
|
|
10
|
+
// Returns { sigle, faute }: `sigle` the short name declared, null when the key is absent, null or
|
|
11
|
+
// faulty; `faute` the fault by its key, null when the key reads.
|
|
12
|
+
export function lireSigle(pkg) {
|
|
13
|
+
const s = pkg?.grillhouse?.sigle;
|
|
14
|
+
if (s === undefined || s === null) {
|
|
15
|
+
return { sigle: null, faute: null };
|
|
16
|
+
}
|
|
17
|
+
if (typeof s !== 'string' || s === '' || /\s/.test(s)) {
|
|
18
|
+
return {
|
|
19
|
+
sigle: null,
|
|
20
|
+
faute: `grillhouse.sigle vaut ${JSON.stringify(s)}, pas une chaîne non vide sans espace.`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return { sigle: s, faute: null };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The sigle of the project whose root is <racine>: `{ sigle, faute }`; the declared key, else its
|
|
28
|
+
* ticket prefix (the prefix also when the key is faulty, `faute` saying it); no sigle, and no
|
|
29
|
+
* throw, when neither reads.
|
|
30
|
+
* @param {string} racine
|
|
31
|
+
* @returns {{ sigle: string | null, faute: string | null }}
|
|
32
|
+
*/
|
|
33
|
+
export function sigleDuProjet(racine) {
|
|
34
|
+
let pkg = null;
|
|
35
|
+
try {
|
|
36
|
+
pkg = JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8'));
|
|
37
|
+
} catch {
|
|
38
|
+
pkg = null;
|
|
39
|
+
}
|
|
40
|
+
const { sigle, faute } = lireSigle(pkg);
|
|
41
|
+
if (sigle) {
|
|
42
|
+
return { sigle, faute: null };
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return { sigle: prefixe(racine), faute };
|
|
46
|
+
} catch {
|
|
47
|
+
return { sigle: null, faute };
|
|
48
|
+
}
|
|
49
|
+
}
|
package/scripts/superviseur.mjs
CHANGED
|
@@ -134,18 +134,19 @@ export function horsAttente(tickets, maintenant) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// Of the tickets <ids> of the repository at <racine>, those whose question does not wait now
|
|
137
|
-
// (`horsAttente`);
|
|
137
|
+
// (`horsAttente`); null when bd does not read them (unknown, never « none »): a machine under
|
|
138
|
+
// load can take seconds to answer.
|
|
138
139
|
export function ticketsHorsAttente(racine, ids) {
|
|
139
140
|
const r = spawnSync('bd', ['show', ...ids, '--json'], {
|
|
140
141
|
cwd: racine,
|
|
141
142
|
encoding: 'utf8',
|
|
142
|
-
timeout:
|
|
143
|
+
timeout: 30_000,
|
|
143
144
|
maxBuffer: 256 * 1024 * 1024,
|
|
144
145
|
});
|
|
145
146
|
try {
|
|
146
147
|
return horsAttente(JSON.parse(r.stdout), Date.now());
|
|
147
148
|
} catch {
|
|
148
|
-
return
|
|
149
|
+
return null;
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -293,10 +294,15 @@ function relever(racine, circuits, { fermes, maintenant, rappelMs, toutes = fals
|
|
|
293
294
|
aRendre.map(q => q.ticket)
|
|
294
295
|
)
|
|
295
296
|
: new Set();
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const
|
|
297
|
+
// Tickets that do not read: nothing is given at this reading, nor counted presented, so that
|
|
298
|
+
// the next reading that reads them gives what still waits.
|
|
299
|
+
const lisible = fermesDe !== null;
|
|
300
|
+
const rendu = lisible
|
|
301
|
+
? aRendre
|
|
302
|
+
.filter(q => !fermesDe.has(q.ticket))
|
|
303
|
+
.map(q => (avant.has(q.cle) && !toutes ? { ...q, representee: true } : q))
|
|
304
|
+
: [];
|
|
305
|
+
const presentes = new Set(lisible ? aRendre.map(q => q.cle) : []);
|
|
300
306
|
const enTexte = liste =>
|
|
301
307
|
`${JSON.stringify(
|
|
302
308
|
{
|
|
@@ -307,15 +313,18 @@ function relever(racine, circuits, { fermes, maintenant, rappelMs, toutes = fals
|
|
|
307
313
|
null,
|
|
308
314
|
2
|
|
309
315
|
)}\n`;
|
|
316
|
+
// A question never presented, its ticket unread, is not written: the next reading gives it.
|
|
310
317
|
const ecrit = enTexte(
|
|
311
|
-
debout
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
debout
|
|
319
|
+
.filter(q => presentes.has(q.cle) || avant.has(q.cle))
|
|
320
|
+
.map(q => {
|
|
321
|
+
const r = avant.get(q.cle);
|
|
322
|
+
return {
|
|
323
|
+
cle: q.cle,
|
|
324
|
+
depuis: r?.depuis ?? maintenant,
|
|
325
|
+
presentee: presentes.has(q.cle) ? maintenant : r.presentee,
|
|
326
|
+
};
|
|
327
|
+
})
|
|
319
328
|
);
|
|
320
329
|
let enFichier = '';
|
|
321
330
|
try {
|
|
@@ -370,6 +379,10 @@ function enAttente(lus, racine, fermes) {
|
|
|
370
379
|
lus.map(c => c.ticket)
|
|
371
380
|
)
|
|
372
381
|
: new Set();
|
|
382
|
+
// Tickets that do not read: no question can be told waiting, none is.
|
|
383
|
+
if (ferme === null) {
|
|
384
|
+
return [];
|
|
385
|
+
}
|
|
373
386
|
return lus
|
|
374
387
|
.filter(c => !ferme.has(c.ticket))
|
|
375
388
|
.sort((a, b) => a.ticket.localeCompare(b.ticket, 'en'));
|
|
@@ -386,7 +399,7 @@ function enAttente(lus, racine, fermes) {
|
|
|
386
399
|
* its circuit ended without its issue (`interrompu`) and its stop (`arret`).
|
|
387
400
|
* @param {string} racine the root of the repository
|
|
388
401
|
* @param {import('./circuits-du-serveur.mjs').CircuitDuServeur[]} circuits
|
|
389
|
-
* @param {{ fermes?: (racine: string, ids: string[]) => Set<string
|
|
402
|
+
* @param {{ fermes?: (racine: string, ids: string[]) => Set<string> | null, sauf?: Set<string> }} options
|
|
390
403
|
* @returns {{ ticket: string, etape: string, question: string, qui: string, commande: string, cle: string, interrompu: boolean, arret: string | null }[]}
|
|
391
404
|
*/
|
|
392
405
|
export function questionsEnAttente(
|
|
@@ -425,7 +438,7 @@ const aucunFerme = () => new Set();
|
|
|
425
438
|
* <fluxRouges>: bd by default) is given as a batch of its own, once per run (`adresse`: the
|
|
426
439
|
* workflow, the URL of the run, the commit), and again at another run; taken up or closed, it is
|
|
427
440
|
* no longer given.
|
|
428
|
-
* @param {{ racine: string, fermes?: (racine: string, ids: string[]) => Set<string
|
|
441
|
+
* @param {{ racine: string, fermes?: (racine: string, ids: string[]) => Set<string> | null, pas?: number, signal?: AbortSignal, circuitsDe?: (racine: string, options?: { integres?: boolean }) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>, fluxRouges?: (racine: string) => { ticket: string, adresse: string }[] | Promise<{ ticket: string, adresse: string }[]>, maintenant?: () => number, rappel?: number }} options
|
|
429
442
|
* @returns {Promise<{ ticket: string, etape: string, question: string, qui: string, commande: string, cle: string, representee?: boolean, integre?: boolean }[]>}
|
|
430
443
|
* @throws {Error} another wait runs
|
|
431
444
|
*/
|
|
@@ -601,7 +614,7 @@ export function texteDesQuestions(questions) {
|
|
|
601
614
|
* The circuits are read once, by <circuitsDe> (one call to the Temporal server,
|
|
602
615
|
* scripts/circuits-du-serveur.mjs, by default); a server that does not answer is said, and no
|
|
603
616
|
* question goes up.
|
|
604
|
-
* @param {{ fermes?: (racine: string, ids: string[]) => Set<string
|
|
617
|
+
* @param {{ fermes?: (racine: string, ids: string[]) => Set<string> | null,
|
|
605
618
|
* circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>,
|
|
606
619
|
* ticketsDe?: (racine: string) => import('./file-des-tickets.mjs').TicketDeBeads[] }} options
|
|
607
620
|
* @returns {Promise<string>}
|
package/scripts/tableau.mjs
CHANGED
|
@@ -129,8 +129,14 @@ import {
|
|
|
129
129
|
circuitsDuServeur,
|
|
130
130
|
nuitDuServeur,
|
|
131
131
|
} from './circuits-du-serveur.mjs';
|
|
132
|
-
import {
|
|
132
|
+
import {
|
|
133
|
+
attendDeLAutreProjet,
|
|
134
|
+
enFileSansArchitecture,
|
|
135
|
+
lireLesExternes,
|
|
136
|
+
} from './file-des-tickets.mjs';
|
|
133
137
|
import { etatDesPlaces } from './places-de-la-machine.mjs';
|
|
138
|
+
import { prefixe as prefixeDeLaRacine } from './prefixe-des-tickets.mjs';
|
|
139
|
+
import { sigleDuProjet } from './sigle-du-projet.mjs';
|
|
134
140
|
import { vivant } from './mesure/base-de-passe.mjs';
|
|
135
141
|
|
|
136
142
|
const MINUTE = 60_000;
|
|
@@ -807,11 +813,12 @@ export function lecture(t, prefix) {
|
|
|
807
813
|
* other fault of that reading, said in the first alert as it is; `echecPrefixe`, the cause of a
|
|
808
814
|
* ticket prefix that did not read, named in an alert; `voies`, the way of each circuit done
|
|
809
815
|
* (`voiesDesCircuits`), whose sign FAITS AUJOURD'HUI shows.
|
|
810
|
-
* @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[],
|
|
811
|
-
* maintenant: number, jour: number,
|
|
816
|
+
* @param {{ tous: any[], prefix?: string, racine?: string | null, registre: any[], vivants: any[],
|
|
817
|
+
* circuits?: any[], maintenant: number, jour: number,
|
|
812
818
|
* machine?: Machine | null, outil?: { version: string, raison: string } | null,
|
|
813
819
|
* places?: { prises: number, plafond: number, faute?: string | null, charge: number,
|
|
814
|
-
* coeurs: number, memoireGo: number, memoireTotaleGo: number,
|
|
820
|
+
* coeurs: number, memoireGo: number, memoireTotaleGo: number,
|
|
821
|
+
* tenues?: { ticket: string | null, racine?: string | null }[], attentes: { ticket: string,
|
|
815
822
|
* depuis: number, disque?: string | null }[] } | null,
|
|
816
823
|
* nuit?: { racine: string, depuis: number | null } | null, muet?: boolean, faute?: string | null,
|
|
817
824
|
* echecPrefixe?: string | null, voies?: Record<string, 'complet' | 'court'> }} lu
|
|
@@ -819,6 +826,7 @@ export function lecture(t, prefix) {
|
|
|
819
826
|
export function assembler({
|
|
820
827
|
tous,
|
|
821
828
|
prefix = '',
|
|
829
|
+
racine = null,
|
|
822
830
|
registre: lignesDuRegistre,
|
|
823
831
|
vivants,
|
|
824
832
|
circuits = [],
|
|
@@ -835,6 +843,7 @@ export function assembler({
|
|
|
835
843
|
attenteVivante: attenteQuiVit = true,
|
|
836
844
|
voies = {},
|
|
837
845
|
superviseur = {},
|
|
846
|
+
externes,
|
|
838
847
|
}) {
|
|
839
848
|
// A circuit's lines are its steps, no agent's passage.
|
|
840
849
|
const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
|
|
@@ -858,7 +867,13 @@ export function assembler({
|
|
|
858
867
|
// Ready: open, every ticket that blocks it closed (Beads' own rule, without a second call).
|
|
859
868
|
const blocages = t =>
|
|
860
869
|
(t.dependencies ?? []).filter(d => d.type === 'blocks' && ouvert(d.depends_on_id));
|
|
861
|
-
|
|
870
|
+
// What a ticket waits for from another project, « <project>:<capability> » (the capability not
|
|
871
|
+
// delivered by the provider, or its project not resolved: `externes`, the tickets of each other
|
|
872
|
+
// project by its name in Beads' `external_projects`).
|
|
873
|
+
const attentesExternes = t => attendDeLAutreProjet(t, externes).map(a => a.attend);
|
|
874
|
+
const prets = tous.filter(
|
|
875
|
+
t => t.status === 'open' && blocages(t).length === 0 && attentesExternes(t).length === 0
|
|
876
|
+
);
|
|
862
877
|
const aValider = tous.filter(
|
|
863
878
|
t => t.status !== 'closed' && (t.labels ?? []).includes('a-valider')
|
|
864
879
|
);
|
|
@@ -892,7 +907,7 @@ export function assembler({
|
|
|
892
907
|
(!enfants.has(t.id) || t.status === 'in_progress' || actifs.has(t.id) || travailles.has(t.id));
|
|
893
908
|
const pret = new Set(prets.map(t => t.id));
|
|
894
909
|
const avalider = new Set(aValider.map(t => t.id));
|
|
895
|
-
const bloquePar = t => blocages(t).map(d => numero(d.depends_on_id));
|
|
910
|
+
const bloquePar = t => [...blocages(t).map(d => numero(d.depends_on_id)), ...attentesExternes(t)];
|
|
896
911
|
// The owner's go: the label `circuit`, set on his word.
|
|
897
912
|
const circuit = t => (t.labels ?? []).includes('circuit');
|
|
898
913
|
// A ticket's state: done, in progress, deferred, awaiting validation; else, with the owner's go,
|
|
@@ -1360,7 +1375,10 @@ export function assembler({
|
|
|
1360
1375
|
agents: blocs,
|
|
1361
1376
|
maintenant,
|
|
1362
1377
|
machine,
|
|
1363
|
-
places: placesDeLaMachine
|
|
1378
|
+
places: placesDeLaMachine && {
|
|
1379
|
+
...placesDeLaMachine,
|
|
1380
|
+
noms: nommerLesPrises(placesDeLaMachine.tenues ?? [], { racine, prefix }),
|
|
1381
|
+
},
|
|
1364
1382
|
nuit: nuitEnCours,
|
|
1365
1383
|
faitsDuJour,
|
|
1366
1384
|
etats,
|
|
@@ -1498,6 +1516,30 @@ const signeDe = a => a.signe ?? '⚠';
|
|
|
1498
1516
|
// project's prefix, which the line already names, « bp-mono-vbwf.320.11 » → « vbwf.320.11 »,
|
|
1499
1517
|
// « SH-ae6.5 » → « ae6.5 ».
|
|
1500
1518
|
const courtDuTicket = id => id.slice(id.lastIndexOf('-') + 1);
|
|
1519
|
+
|
|
1520
|
+
// Who holds each place of the machine, in the order of the places: the project of the board (the
|
|
1521
|
+
// root <racine> of its main tree, its ticket prefix <prefix>) by the short number of its ticket,
|
|
1522
|
+
// another project by « <sigle> <short number> » (its sigle and its prefix read from its own root),
|
|
1523
|
+
// a place with no ticket « passe »; a place with no root (a state of before) is the board's.
|
|
1524
|
+
function nommerLesPrises(tenues, { racine, prefix }) {
|
|
1525
|
+
return tenues.map(({ ticket, racine: deLaPrise }) => {
|
|
1526
|
+
const ici = !deLaPrise || (racine && path.resolve(deLaPrise) === path.resolve(racine));
|
|
1527
|
+
let prefixeDuProjet = prefix;
|
|
1528
|
+
if (!ici) {
|
|
1529
|
+
try {
|
|
1530
|
+
prefixeDuProjet = prefixeDeLaRacine(deLaPrise);
|
|
1531
|
+
} catch {
|
|
1532
|
+
prefixeDuProjet = '';
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
const numero = !ticket
|
|
1536
|
+
? 'passe'
|
|
1537
|
+
: prefixeDuProjet && ticket.startsWith(`${prefixeDuProjet}-`)
|
|
1538
|
+
? ticket.slice(prefixeDuProjet.length + 1)
|
|
1539
|
+
: courtDuTicket(ticket);
|
|
1540
|
+
return ici ? numero : `${sigleDuProjet(deLaPrise).sigle ?? path.basename(deLaPrise)} ${numero}`;
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1501
1543
|
// The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
|
|
1502
1544
|
// discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
|
|
1503
1545
|
// ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
|
|
@@ -1625,12 +1667,26 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1625
1667
|
const p = t.places;
|
|
1626
1668
|
if (p) {
|
|
1627
1669
|
const nb = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.', ','));
|
|
1670
|
+
// Who holds each place stands between the count and the load: the most names that keep the
|
|
1671
|
+
// line within the width, the others counted « +n ».
|
|
1672
|
+
const noms = p.noms ?? [];
|
|
1673
|
+
const suite = p.faute
|
|
1674
|
+
? `plafond refusé : ${p.faute}`
|
|
1675
|
+
: `charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo}/${p.memoireTotaleGo} Go`;
|
|
1676
|
+
const ligne = k =>
|
|
1677
|
+
`Places ${p.prises}/${p.plafond} · ${
|
|
1678
|
+
noms.length
|
|
1679
|
+
? `${[noms.slice(0, k).join(', '), ...(k < noms.length ? [`+${noms.length - k}`] : [])]
|
|
1680
|
+
.filter(Boolean)
|
|
1681
|
+
.join(' ')} · `
|
|
1682
|
+
: ''
|
|
1683
|
+
}${suite}`;
|
|
1684
|
+
let k = noms.length;
|
|
1685
|
+
while (k > 0 && colonnes(ligne(k)) > largeur) {
|
|
1686
|
+
k--;
|
|
1687
|
+
}
|
|
1628
1688
|
poser({
|
|
1629
|
-
texte: cadre(
|
|
1630
|
-
`Places ${p.prises}/${p.plafond} · ${p.faute ? `plafond refusé : ${p.faute}` : `charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo}/${p.memoireTotaleGo} Go`}`,
|
|
1631
|
-
'',
|
|
1632
|
-
largeur
|
|
1633
|
-
),
|
|
1689
|
+
texte: cadre(ligne(k), '', largeur),
|
|
1634
1690
|
ton: p.faute ? TONS.plafondRefuse : p.charge >= p.coeurs ? TONS.machineChargee : TONS.mesure,
|
|
1635
1691
|
});
|
|
1636
1692
|
// A ticket that waits for the disk of its project's copies: what holds it, the ticket named.
|
|
@@ -2389,6 +2445,7 @@ function lire(
|
|
|
2389
2445
|
const t = assembler({
|
|
2390
2446
|
tous,
|
|
2391
2447
|
prefix,
|
|
2448
|
+
racine: commun ? path.dirname(commun) : racine,
|
|
2392
2449
|
registre,
|
|
2393
2450
|
vivants,
|
|
2394
2451
|
circuits,
|
|
@@ -2405,6 +2462,7 @@ function lire(
|
|
|
2405
2462
|
remontees: lireLesRemontees(racine, maintenant),
|
|
2406
2463
|
attenteVivante: attenteVivante(racine),
|
|
2407
2464
|
superviseur,
|
|
2465
|
+
externes: lireLesExternes(racine, tous),
|
|
2408
2466
|
});
|
|
2409
2467
|
return { t, prefix, tous, vivants, commun };
|
|
2410
2468
|
}
|
|
@@ -2573,7 +2631,32 @@ export async function tableau(
|
|
|
2573
2631
|
}),
|
|
2574
2632
|
};
|
|
2575
2633
|
const lus = [ici, ...autres];
|
|
2576
|
-
|
|
2634
|
+
// A project is labelled by its sigle (scripts/sigle-du-projet.mjs: the key `grillhouse.sigle`, else
|
|
2635
|
+
// its ticket prefix), as the line of the places names it; a project with neither keeps its
|
|
2636
|
+
// folder's name. A faulty key is said in an alert, the prefix staying the sigle; two projects of
|
|
2637
|
+
// the board with one sigle are said, both named.
|
|
2638
|
+
const sigles = new Map(lus.map(l => [l, sigleDuProjet(l.dossier)]));
|
|
2639
|
+
const etiquette = l => sigles.get(l).sigle || l.prefix || path.basename(l.dossier);
|
|
2640
|
+
const alerteDeSigle = (l, texte) =>
|
|
2641
|
+
(l.t ?? ici.t).alertes.push({ etat: 'panne', ton: TONS.panne, texte });
|
|
2642
|
+
for (const l of lus) {
|
|
2643
|
+
const { faute } = sigles.get(l);
|
|
2644
|
+
if (faute) {
|
|
2645
|
+
alerteDeSigle(l, `Sigle illisible : ${faute}`);
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
const memeSigle = new Map();
|
|
2649
|
+
for (const l of lus) {
|
|
2650
|
+
memeSigle.set(etiquette(l), [...(memeSigle.get(etiquette(l)) ?? []), l]);
|
|
2651
|
+
}
|
|
2652
|
+
for (const [sigle, deux] of memeSigle) {
|
|
2653
|
+
if (deux.length > 1) {
|
|
2654
|
+
alerteDeSigle(
|
|
2655
|
+
ici,
|
|
2656
|
+
`Sigle « ${sigle} » porté par ${deux.map(l => path.basename(l.dossier)).join(' et ')}`
|
|
2657
|
+
);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2577
2660
|
// The lock of the machine names each project of the board as the board does: the session's by
|
|
2578
2661
|
// its folder, another by its label; the root of its main tree, its common git directory's parent.
|
|
2579
2662
|
ici.t.machine = nommerLesProjets(
|