@roomi-fields/grillhouse 0.36.0 → 0.37.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 +16 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +10 -0
- package/cadre/templates/projet/.github/workflows/nuit.yml +5 -0
- package/charte.md +5 -0
- package/dist/temporal/nuits/activites.d.ts +10 -1
- package/dist/temporal/nuits/activites.js +59 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +15 -0
- package/dist/temporal/nuits/deroule.js +67 -35
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/client.d.ts +12 -0
- package/dist/temporal/places/client.js +23 -1
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +35 -0
- package/dist/temporal/places/contrat.js +11 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +47 -2
- package/dist/temporal/places/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +14 -3
- package/docs/CADRE.md +11 -0
- package/docs/INTERFACE.md +6 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +10 -4
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/binaires.mjs +119 -0
- package/scripts/grillhouse-maj.mjs +3 -60
- package/scripts/langages/cargo/binaires.mjs +1 -1
- package/scripts/langages/cargo/clippy.mjs +1 -1
- package/scripts/langages/cargo/commandes.mjs +1 -1
- package/scripts/langages/cargo/sccache.mjs +1 -1
- package/scripts/langages/python/commandes.mjs +1 -1
- package/scripts/paquet.mjs +2 -7
- package/scripts/places-de-la-machine.mjs +40 -28
- package/scripts/regles-des-places.d.mts +27 -2
- package/scripts/regles-des-places.mjs +66 -5
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/tableau.mjs +389 -182
package/scripts/tableau.mjs
CHANGED
|
@@ -12,22 +12,32 @@
|
|
|
12
12
|
// common git directory, where the status line (`scripts/ligne-etat/`) reads it.
|
|
13
13
|
//
|
|
14
14
|
// - Global: the work tickets of the project (a ticket without children; a mother is a grouping)
|
|
15
|
-
// by state, the agents' working time and tokens of the day and in all, the alerts.
|
|
15
|
+
// by state, the agents' working time and tokens of the day and in all, the alerts. The head's
|
|
16
|
+
// first line counts the signs AGENTS shows (`etatsDAgents`, the one source: « ▶ N · ⏸ N · ⛔ N
|
|
17
|
+
// · N faits », a ticket closed and not integrated counted under its sign, not as done), one line
|
|
18
|
+
// per project on a board of several; the line of the queues counts the tickets blocked
|
|
19
|
+
// by an open ticket; the status line says the same signs in the same words.
|
|
16
20
|
// - Agents: the tree of the steps of the process (scripts/etapes.mjs), one block per step and
|
|
17
21
|
// sub-step, with who works there, for the whole project. A ticket stands at a step only by its
|
|
18
22
|
// circuit (below) or by an agent that runs on it, at that agent's step; a ticket in the queue,
|
|
19
|
-
//
|
|
20
|
-
// - Circuits: one entry per
|
|
21
|
-
// from the Temporal server in one call
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
23
|
+
// its circuit not launched, stands at no step.
|
|
24
|
+
// - Circuits: one entry per known ticket, open or closed, whose circuit (scripts/circuit.mjs) is
|
|
25
|
+
// launched and not integrated, read from the Temporal server in one call
|
|
26
|
+
// (scripts/circuits-du-serveur.mjs, the memo of its workflow), so that the ticket stands in
|
|
27
|
+
// AGENTS at every instant from the launch of its circuit to its end: it runs while its workflow
|
|
28
|
+
// runs with no question awaited, and stands at the step of its last state, with its attempt,
|
|
29
|
+
// every step one for the whole ticket, a running one with no known state at the step of its
|
|
30
|
+
// stop, else at the plan (1); while the explorateur or the questionneur works on its plan
|
|
31
|
+
// (`questionnement`, of the plan), it stands at the plan (1); waiting for the supervisor
|
|
32
|
+
// (`attendLeSuperviseur`, the one rule the opening and the wait of the questions read too:
|
|
33
|
+
// stopped, « à repasser » included, but by the supervisor's « arrete », or ended without its
|
|
34
|
+
// issue), it stands under the stopped step after a line « ⤷ Question · <qui> », who must answer
|
|
35
|
+
// it, the supervisor or the owner, the supervisor when it names no question; its card opens on
|
|
36
|
+
// that question, or on the stop (its name and code) and the first line of its reason.
|
|
37
|
+
// - Readings: a reading of the circuits or of the tickets that fails (the Temporal server silent
|
|
38
|
+
// or at fault, Beads at fault) gives way to the last one that succeeded, kept in the common git
|
|
39
|
+
// directory (`lectureGardee`, `tableau-lu-<quoi>.json`), its age in the alert that names the
|
|
40
|
+
// fault; a project beside the session's says the faults of its own reading.
|
|
31
41
|
// - Bilans: the card of a ticket whose circuit kept its bilan (scripts/bilan.mjs,
|
|
32
42
|
// `.claude/worktrees/<ticket>.bilan.json`) opens on its key figures: wall time, share lost,
|
|
33
43
|
// sessions, cost.
|
|
@@ -62,37 +72,43 @@
|
|
|
62
72
|
// its pass, read in the progress directory its state names (scripts/avancement.mjs), in
|
|
63
73
|
// figures, as Bazel's counter of actions: « faits/prévus · <durée> » since the start of the
|
|
64
74
|
// pass, after the counters of its loops, or in their place when room lacks (the subject is cut,
|
|
65
|
-
// never the figures); the queue (5.2), the steps of its CI. Past FIGEE
|
|
66
|
-
// without a sign, «
|
|
67
|
-
// tone of an alert.
|
|
75
|
+
// never the figures nor the ticket's number); the queue (5.2), the steps of its CI. Past FIGEE
|
|
76
|
+
// without a sign, « figée <durée> · faits/prévus », the time since its last sign, signed ⛔ in
|
|
77
|
+
// the tone of an alert.
|
|
68
78
|
// - The lock of the machine (scripts/verrou-de-machine.mjs, read by `lireLaMesure`), as lslocks
|
|
69
79
|
// names who holds a lock and cargo says what its wait waits for. A holder or a wait of a circuit
|
|
70
80
|
// AGENTS shows stands on that circuit's line, one line per ticket, in place of the progress of
|
|
71
|
-
// its pass: « ·
|
|
72
|
-
// <durée> · faits/prévus » past FIGEE without a sign, « ·
|
|
73
|
-
// kind in lower case. Any other stands at the head of AGENTS
|
|
74
|
-
// out of a ticket, the circuit of a ticket of any project of the
|
|
75
|
-
// <projet> · <qui> · faits/prévus · <durée> », « ⚠ <sorte> figée
|
|
76
|
-
// faits/prévus »; then each pass that waits for the lock or for
|
|
77
|
-
// first, « ⏳ <sorte> · <projet> · <qui> · attend · <durée> ». <qui>
|
|
78
|
-
// prefix (`courtDuTicket`), else the folder of its copy (`copie`,
|
|
79
|
-
// the main tree when the project is not named); <projet> is left
|
|
80
|
-
// board (`ici`). The width cuts the project first, then leaves out
|
|
81
|
-
// never the kind, the figures nor the time. Such a line
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
81
|
+
// its pass: « · <sorte> faits/prévus · <durée> » since it took the lock, « · <sorte> figée
|
|
82
|
+
// <durée> · faits/prévus » past FIGEE without a sign, « · verrou <sorte> · <durée> » for a
|
|
83
|
+
// wait, the kind in lower case. Any other stands at the head of AGENTS, with the machine: its
|
|
84
|
+
// holder, whoever it is (a pass out of a ticket, the circuit of a ticket of any project of the
|
|
85
|
+
// machine), « 🔒 <sorte> · <projet> · <qui> · faits/prévus · <durée> », « ⚠ <sorte> figée
|
|
86
|
+
// <durée> · <projet> · <qui> · faits/prévus »; then each pass that waits for the lock or for
|
|
87
|
+
// room under /tmp, the oldest first, « ⏳ <sorte> · <projet> · <qui> · attend · <durée> ». <qui>
|
|
88
|
+
// is its ticket without its prefix (`courtDuTicket`), else the folder of its copy (`copie`,
|
|
89
|
+
// under .claude/worktrees/, or the main tree when the project is not named); <projet> is left
|
|
90
|
+
// out for the project of the board (`ici`). The width cuts the project first, then leaves out
|
|
91
|
+
// « attend », then cuts <qui>, never the kind, the figures nor the time. Such a line is marked
|
|
92
|
+
// `avancement`, which the pane measures again more often.
|
|
93
|
+
// - Signs: each sign keeps one sense (the owner's decisions of 2026-11-01 and 2026-11-12). A
|
|
94
|
+
// ticket's line in AGENTS takes one of three, by the tone of its state: ▶ its step works (cyan),
|
|
95
|
+
// a ticket led in direct included; ⏸ it waits, under the step about to be launched, the reason
|
|
96
|
+
// on its right (« attend une place », « verrou », « CI », « disque », « démarre » in grey, the
|
|
97
|
+
// circuit waiting for the machine; « question au superviseur », « question au responsable »,
|
|
98
|
+
// « arrêté » in yellow, the circuit waiting for someone); ⛔ it stopped on a fault or its pass is
|
|
99
|
+
// frozen, to correct (red). The head of AGENTS, the machine's lines: 🔒 the holder of the lock,
|
|
100
|
+
// ⏳ a pass that waits for it or for room, 🌙 the night under way. The alerts: 💤 a ticket
|
|
101
|
+
// claimed with nothing running, 🌙 a red night, ⚠ the alerts without a kind of their own. A
|
|
102
|
+
// sign two columns wide stands as the others, a sign then a space; the width of a line counts
|
|
103
|
+
// its columns (`colonnes`), ⏳ and ⛔ two.
|
|
89
104
|
// - Alerts: one alert per open night ticket (🌙, its subject, then its number), per circuit that
|
|
90
105
|
// waits for the supervisor (⏳, how long), a shell agent silent for 10 minutes, a ticket in
|
|
91
106
|
// progress without anything running for 30 minutes (💤), each with its state (`etat`).
|
|
92
107
|
// - Tones: each state the board shows has one tone, defined once (`TONS`), which every line and
|
|
93
108
|
// every alert takes, whatever its duration or the line that shows it: red for what asks for a
|
|
94
109
|
// correction (frozen, a fault, a question with no live wait, a ceiling refused), yellow for what
|
|
95
|
-
// waits for
|
|
110
|
+
// waits for someone (the supervisor, the owner), grey for what waits for the machine (a place,
|
|
111
|
+
// the lock, the disk, the CI), cyan for what runs.
|
|
96
112
|
import { execFileSync } from 'node:child_process';
|
|
97
113
|
import {
|
|
98
114
|
closeSync,
|
|
@@ -101,6 +117,7 @@ import {
|
|
|
101
117
|
readdirSync,
|
|
102
118
|
readFileSync,
|
|
103
119
|
readSync,
|
|
120
|
+
renameSync,
|
|
104
121
|
statSync,
|
|
105
122
|
writeFileSync,
|
|
106
123
|
} from 'node:fs';
|
|
@@ -174,10 +191,10 @@ export const ETATS = [
|
|
|
174
191
|
// The tone of each state the board shows, defined once: as a dashboard of states (GitHub Checks,
|
|
175
192
|
// Alertmanager), the severity belongs to the state, never to its duration nor to the line that
|
|
176
193
|
// shows it; the duration stays in the text. Every line and every alert takes its tone here:
|
|
177
|
-
// `alerte` (red), what asks for a correction; `attention` (yellow), what waits for an
|
|
178
|
-
// look; `actif` (cyan), what runs; `discret
|
|
179
|
-
//
|
|
180
|
-
// `couleur`).
|
|
194
|
+
// `alerte` (red), what asks for a correction; `attention` (yellow), what waits for someone, an
|
|
195
|
+
// answer or a look; `actif` (cyan), what runs; `discret` (grey), what waits for the machine (a
|
|
196
|
+
// place, the lock, the disk, the CI), what is done, empty or a measure; `titre`, a heading; none,
|
|
197
|
+
// a ticket at rest. The pane turns each tone into its colour (mods/grillhouse `couleur`).
|
|
181
198
|
export const TONS = Object.freeze({
|
|
182
199
|
// A ticket's state (ETATS).
|
|
183
200
|
enCours: 'actif',
|
|
@@ -189,11 +206,13 @@ export const TONS = Object.freeze({
|
|
|
189
206
|
reportes: undefined,
|
|
190
207
|
fermes: 'discret',
|
|
191
208
|
// A circuit, a pass, a wait.
|
|
192
|
-
attendUnePlace: '
|
|
193
|
-
attendLeVerrou: '
|
|
209
|
+
attendUnePlace: 'discret',
|
|
210
|
+
attendLeVerrou: 'discret',
|
|
211
|
+
attendLeDisque: 'discret',
|
|
212
|
+
attendLaCI: 'discret',
|
|
213
|
+
sansEtape: 'discret',
|
|
194
214
|
enDirect: 'actif',
|
|
195
215
|
nuitEnCours: 'actif',
|
|
196
|
-
attendLeDisque: 'attention',
|
|
197
216
|
attendLeSuperviseur: 'attention',
|
|
198
217
|
attendLeResponsable: 'attention',
|
|
199
218
|
arrete: 'attention',
|
|
@@ -203,6 +222,7 @@ export const TONS = Object.freeze({
|
|
|
203
222
|
outilNonInstallable: 'attention',
|
|
204
223
|
machineChargee: 'attention',
|
|
205
224
|
fige: 'alerte',
|
|
225
|
+
sansIssue: 'alerte',
|
|
206
226
|
panne: 'alerte',
|
|
207
227
|
nuitRouge: 'alerte',
|
|
208
228
|
sansAttente: 'alerte',
|
|
@@ -810,16 +830,21 @@ export function lecture(t, prefix) {
|
|
|
810
830
|
* under way on the machine (scripts/circuits-du-serveur.mjs `nuitDuServeur`), its line under the
|
|
811
831
|
* places'; `muet`, the Temporal
|
|
812
832
|
* server did not answer the reading of the circuits, which the first alert says; `faute`, any
|
|
813
|
-
* other fault of that reading, said in the first alert as it is; `
|
|
814
|
-
*
|
|
815
|
-
*
|
|
833
|
+
* other fault of that reading, said in the first alert as it is; `circuitsLusA`, when the reading
|
|
834
|
+
* failed, the time of the last one that succeeded, whose circuits `circuits` holds and whose age
|
|
835
|
+
* the alert says; `fauteTickets`, the fault of the reading of the tickets, said in an alert, and
|
|
836
|
+
* `ticketsLusA`, the time of the last one that succeeded, whose tickets `tous` holds;
|
|
837
|
+
* `echecPrefixe`, the cause of a ticket prefix that did not read, named in an alert; `voies`, the
|
|
838
|
+
* way of each circuit done (`voiesDesCircuits`), whose sign FAITS AUJOURD'HUI shows.
|
|
816
839
|
* @param {{ tous: any[], prefix?: string, racine?: string | null, registre: any[], vivants: any[],
|
|
817
|
-
* circuits?: any[],
|
|
840
|
+
* circuits?: any[],
|
|
841
|
+
* circuitsLusA?: number | null, fauteTickets?: string | null, ticketsLusA?: number | null,
|
|
842
|
+
* maintenant: number, jour: number,
|
|
818
843
|
* machine?: Machine | null, outil?: { version: string, raison: string } | null,
|
|
819
844
|
* places?: { prises: number, plafond: number, faute?: string | null, charge: number,
|
|
820
845
|
* coeurs: number, memoireGo: number, memoireTotaleGo: number,
|
|
821
846
|
* tenues?: { ticket: string | null, racine?: string | null }[], attentes: { ticket: string,
|
|
822
|
-
* depuis: number, disque?: string | null }[] } | null,
|
|
847
|
+
* depuis: number, disque?: string | null }[], nuit?: 'attend' | 'en cours' | null } | null,
|
|
823
848
|
* nuit?: { racine: string, depuis: number | null } | null, muet?: boolean, faute?: string | null,
|
|
824
849
|
* echecPrefixe?: string | null, voies?: Record<string, 'complet' | 'court'> }} lu
|
|
825
850
|
*/
|
|
@@ -838,6 +863,9 @@ export function assembler({
|
|
|
838
863
|
nuit: nuitEnCours = null,
|
|
839
864
|
muet = false,
|
|
840
865
|
faute = null,
|
|
866
|
+
circuitsLusA = null,
|
|
867
|
+
fauteTickets = null,
|
|
868
|
+
ticketsLusA = null,
|
|
841
869
|
echecPrefixe = null,
|
|
842
870
|
remontees = [],
|
|
843
871
|
attenteVivante: attenteQuiVit = true,
|
|
@@ -888,12 +916,11 @@ export function assembler({
|
|
|
888
916
|
for (const l of enfants.values()) {
|
|
889
917
|
l.sort(ordre);
|
|
890
918
|
}
|
|
891
|
-
// The circuits of the
|
|
892
|
-
//
|
|
919
|
+
// The circuits not integrated of the known tickets, open or closed (the queue closes a ticket
|
|
920
|
+
// before it reads the CI, and its circuit may then wait); a ticket whose circuit runs is in
|
|
921
|
+
// progress.
|
|
893
922
|
const parCircuit = new Map(
|
|
894
|
-
circuits
|
|
895
|
-
.filter(c => ouvert(c.ticket) || (c.vivant && parId.has(c.ticket)))
|
|
896
|
-
.map(c => [c.ticket, c])
|
|
923
|
+
circuits.filter(c => parId.has(c.ticket) && !c.integre).map(c => [c.ticket, c])
|
|
897
924
|
);
|
|
898
925
|
const actifs = new Set([
|
|
899
926
|
...enCoursMesures.map(v => v.ticket).filter(Boolean),
|
|
@@ -910,10 +937,13 @@ export function assembler({
|
|
|
910
937
|
const bloquePar = t => [...blocages(t).map(d => numero(d.depends_on_id)), ...attentesExternes(t)];
|
|
911
938
|
// The owner's go: the label `circuit`, set on his word.
|
|
912
939
|
const circuit = t => (t.labels ?? []).includes('circuit');
|
|
913
|
-
// A ticket's state:
|
|
914
|
-
//
|
|
940
|
+
// A ticket's state: in progress (claimed, or its circuit launched and not integrated, its
|
|
941
|
+
// question deferred or its ticket closed before its integration included: AGENTS shows it, and it
|
|
942
|
+
// is done only once integrated), done, deferred,
|
|
943
|
+
// awaiting validation; else, with the owner's go, waiting (ready) or blocked (an open ticket it
|
|
944
|
+
// depends on); without it, awaiting his go.
|
|
915
945
|
const etat = t => {
|
|
916
|
-
if (t.status === 'in_progress' || actifs.has(t.id)) {
|
|
946
|
+
if (t.status === 'in_progress' || actifs.has(t.id) || parCircuit.has(t.id)) {
|
|
917
947
|
return 'enCours';
|
|
918
948
|
}
|
|
919
949
|
if (t.status === 'closed') {
|
|
@@ -1174,6 +1204,7 @@ export function assembler({
|
|
|
1174
1204
|
t =>
|
|
1175
1205
|
travail(t) &&
|
|
1176
1206
|
!actifs.has(t.id) &&
|
|
1207
|
+
!parCircuit.has(t.id) &&
|
|
1177
1208
|
!estDecouverte(t) &&
|
|
1178
1209
|
!sansLivraison(t) &&
|
|
1179
1210
|
t.closed_at &&
|
|
@@ -1208,12 +1239,21 @@ export function assembler({
|
|
|
1208
1239
|
// Alerts, each with its state (`etat`) and the tone of that state (TONS).
|
|
1209
1240
|
const alertes = [];
|
|
1210
1241
|
const alerter = (etat, champs) => alertes.push({ etat, ton: TONS[etat], ...champs });
|
|
1211
|
-
// The Temporal server does not answer: the board shows the
|
|
1212
|
-
//
|
|
1242
|
+
// The Temporal server does not answer: the board shows the circuits of the last reading that
|
|
1243
|
+
// succeeded, whose age the first alert says, or none without one; that alert names the command
|
|
1244
|
+
// that tells the state of the service.
|
|
1245
|
+
const ageDesCircuits =
|
|
1246
|
+
circuitsLusA === null ? '' : ` · circuits lus il y a ${ilYa(maintenant - circuitsLusA)}`;
|
|
1213
1247
|
if (muet) {
|
|
1214
|
-
alerter('panne', { texte: `${SANS_REPONSE_EN} · temporal etat` });
|
|
1248
|
+
alerter('panne', { texte: `${SANS_REPONSE_EN} · temporal etat${ageDesCircuits}` });
|
|
1215
1249
|
} else if (faute) {
|
|
1216
|
-
alerter('panne', { texte: `Circuits illisibles : ${faute}` });
|
|
1250
|
+
alerter('panne', { texte: `Circuits illisibles : ${faute}${ageDesCircuits}` });
|
|
1251
|
+
}
|
|
1252
|
+
// Beads did not read: the board shows the tickets of the last reading that succeeded.
|
|
1253
|
+
if (fauteTickets) {
|
|
1254
|
+
alerter('panne', {
|
|
1255
|
+
texte: `Tickets illisibles : ${fauteTickets}${ticketsLusA === null ? '' : ` · tickets lus il y a ${ilYa(maintenant - ticketsLusA)}`}`,
|
|
1256
|
+
});
|
|
1217
1257
|
}
|
|
1218
1258
|
// The ticket prefix did not read: the project keeps its folder's name, and the alert says why.
|
|
1219
1259
|
if (echecPrefixe) {
|
|
@@ -1322,8 +1362,8 @@ export function assembler({
|
|
|
1322
1362
|
// holds them, a mother of theirs or a ticket under them (a circuit holds its ticket's mothers and
|
|
1323
1363
|
// children): one that runs or waits for an answer (`attendLeSuperviseur`), never one the
|
|
1324
1364
|
// supervisor stopped; or labelled `direct` and claimed (led out of the circuit); and no role
|
|
1325
|
-
// agent shown at a step. None while the circuits do not read (a
|
|
1326
|
-
//
|
|
1365
|
+
// agent shown at a step. None while the circuits do not read (a silent server, a fault) and no
|
|
1366
|
+
// earlier reading is kept, when no ticket can be told out of a circuit.
|
|
1327
1367
|
const aUneEtape = new Set(blocs.flatMap(b => b.enCours.map(x => x.id)));
|
|
1328
1368
|
const tenus = new Set(
|
|
1329
1369
|
[...parCircuit.values()].filter(c => c.vivant || attendLeSuperviseur(c)).map(c => c.ticket)
|
|
@@ -1338,7 +1378,7 @@ export function assembler({
|
|
|
1338
1378
|
return sousUnCircuit(t);
|
|
1339
1379
|
};
|
|
1340
1380
|
const horsCircuit =
|
|
1341
|
-
muet || faute
|
|
1381
|
+
(muet || faute) && circuitsLusA === null
|
|
1342
1382
|
? []
|
|
1343
1383
|
: tous
|
|
1344
1384
|
.filter(
|
|
@@ -1409,8 +1449,9 @@ const ilYa = ms => (ms < MINUTE ? `${Math.max(0, Math.round(ms / 1000))} s` : du
|
|
|
1409
1449
|
|
|
1410
1450
|
// The witness of the automatic step of the running circuit <c> at <maintenant>: the progress of
|
|
1411
1451
|
// its pass (` · faits/prévus · <durée>`, the figures once a task wrote, the time since the start
|
|
1412
|
-
// of the pass, as Bazel's counter); past FIGEE without a sign, ` ·
|
|
1413
|
-
// faits/prévus`, the time since the last sign, `fige
|
|
1452
|
+
// of the pass, as Bazel's counter); past FIGEE without a sign, ` · figée <durée> ·
|
|
1453
|
+
// faits/prévus`, the time since the last sign, `fige`, which the line's ⛔ signs. Null without a
|
|
1454
|
+
// progress.
|
|
1414
1455
|
function temoinDe(c, maintenant) {
|
|
1415
1456
|
let age;
|
|
1416
1457
|
let ecoule;
|
|
@@ -1429,7 +1470,7 @@ function temoinDe(c, maintenant) {
|
|
|
1429
1470
|
return {
|
|
1430
1471
|
fige,
|
|
1431
1472
|
texte: fige
|
|
1432
|
-
? ` ·
|
|
1473
|
+
? ` · figée ${ilYa(age)}${compte ? ` · ${compte}` : ''}`
|
|
1433
1474
|
: ` · ${compte ? `${compte} · ` : ''}${ilYa(ecoule)}`,
|
|
1434
1475
|
};
|
|
1435
1476
|
}
|
|
@@ -1473,9 +1514,9 @@ export function voiesDesCircuits(racine, tickets) {
|
|
|
1473
1514
|
const conso = (ms, jetons) =>
|
|
1474
1515
|
Math.round(ms / MINUTE) === 0 && !jetons ? '' : `${duree(ms)} · ${k(jetons)}`;
|
|
1475
1516
|
|
|
1476
|
-
// The columns <s> takes in a terminal: a character one, ⏳ two, as the signs out of the
|
|
1477
|
-
// plane (🔒 💤 🌙), which count two code units, take two.
|
|
1478
|
-
const colonnes = s => s.length + (s.match(
|
|
1517
|
+
// The columns <s> takes in a terminal: a character one, ⏳ and ⛔ two, as the signs out of the
|
|
1518
|
+
// basic plane (🔒 💤 🌙), which count two code units, take two.
|
|
1519
|
+
const colonnes = s => s.length + (s.match(/[⏳⛔]/g)?.length ?? 0);
|
|
1479
1520
|
// The start of <s> that holds in <n> columns, a sign out of the basic plane never split.
|
|
1480
1521
|
const debutDe = (s, n) => {
|
|
1481
1522
|
let out = '';
|
|
@@ -1540,6 +1581,118 @@ function nommerLesPrises(tenues, { racine, prefix }) {
|
|
|
1540
1581
|
return ici ? numero : `${sigleDuProjet(deLaPrise).sigle ?? path.basename(deLaPrise)} ${numero}`;
|
|
1541
1582
|
});
|
|
1542
1583
|
}
|
|
1584
|
+
// The sign of a ticket's line in AGENTS, by the tone of its state: ▶ what runs, ⛔ what asks for a
|
|
1585
|
+
// correction, ⏸ a wait, for the machine (grey) or for someone (yellow).
|
|
1586
|
+
const signeDuTon = ton => (ton === TONS.enCours ? '▶' : ton === 'alerte' ? '⛔' : '⏸');
|
|
1587
|
+
// The step of the circuit <c>, by its state or its stop.
|
|
1588
|
+
const etapeDuCircuitLu = c => etapeDuCircuit({ ...c, raison: c.arret });
|
|
1589
|
+
// A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
|
|
1590
|
+
// its question, the supervisor when its stop names no one.
|
|
1591
|
+
const enQuestion = c => (attendLeSuperviseur(c) ? (c.qui ?? SUPERVISEUR) : null);
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* The state of each ticket's line of AGENTS on the board <t>, the one source of its signs, which
|
|
1595
|
+
* AGENTS draws and the head and the status line count. Each circuit (`circuits`, by its ticket):
|
|
1596
|
+
* its state (`etat`, whose tone TONS gives), the reason of its wait (`raison`), its tone, its sign
|
|
1597
|
+
* and its witness (`temoin`: the lock it holds or waits for, « · <sorte> faits/prévus · <durée> »,
|
|
1598
|
+
* « · verrou <sorte> · <durée> », else the progress of its automatic pass, `temoinDe`), in this
|
|
1599
|
+
* order: frozen; ended without its issue; its question (to the supervisor or to another); stopped;
|
|
1600
|
+
* its wait for the disk, a place (« nuit » while the night holds the machine), the lock, the CI of
|
|
1601
|
+
* its queue (5.2, the lock not held) or its first state; else it runs. `lignes`: one entry per
|
|
1602
|
+
* ticket's line of AGENTS, its id, its project on a board of several and its sign: each circuit,
|
|
1603
|
+
* each ticket led in direct (▶) and each agent shown out of a circuit (▶).
|
|
1604
|
+
*/
|
|
1605
|
+
export function etatsDAgents(t) {
|
|
1606
|
+
const maintenant = t.maintenant ?? Date.now();
|
|
1607
|
+
const p = t.places;
|
|
1608
|
+
const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
|
|
1609
|
+
const duCircuit = x => Boolean(x.ticket && enCircuit.has(x.ticket));
|
|
1610
|
+
const verrouDe = new Map();
|
|
1611
|
+
const tenu = t.machine?.detenteur;
|
|
1612
|
+
if (tenu && duCircuit(tenu)) {
|
|
1613
|
+
const a = tenu.avancement;
|
|
1614
|
+
const age = a ? maintenant - a.dernier : 0;
|
|
1615
|
+
const compte = a && (a.faits || a.prevus) ? `${a.faits}/${a.prevus}` : '';
|
|
1616
|
+
const fige = age > FIGEE;
|
|
1617
|
+
const sorte = tenu.sorte.toLocaleLowerCase('fr');
|
|
1618
|
+
verrouDe.set(tenu.ticket, {
|
|
1619
|
+
fige,
|
|
1620
|
+
texte: fige
|
|
1621
|
+
? ` · ${sorte} figée ${ilYa(age)}${compte ? ` · ${compte}` : ''}`
|
|
1622
|
+
: ` · ${sorte}${compte ? ` ${compte}` : ''} · ${ilYa(maintenant - (tenu.depuis ?? maintenant))}`,
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
for (const w of [...(t.machine?.attentes ?? [])].sort((x, y) => x.depuis - y.depuis)) {
|
|
1626
|
+
if (duCircuit(w) && !verrouDe.has(w.ticket)) {
|
|
1627
|
+
verrouDe.set(w.ticket, {
|
|
1628
|
+
fige: false,
|
|
1629
|
+
texte: ` · verrou ${w.sorte.toLocaleLowerCase('fr')} · ${ilYa(maintenant - w.depuis)}`,
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
const attendLeVerrou = new Set((t.machine?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1634
|
+
const attendUnePlace = new Set((p?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1635
|
+
const attendLeDisque = new Set((p?.attentes ?? []).filter(w => w.disque).map(w => w.ticket));
|
|
1636
|
+
const tientLeVerrou = tenu && duCircuit(tenu) ? tenu.ticket : null;
|
|
1637
|
+
const etatDuCircuit = (c, temoin) => {
|
|
1638
|
+
if (temoin?.fige) {
|
|
1639
|
+
return ['fige', ''];
|
|
1640
|
+
}
|
|
1641
|
+
if (!c.vivant) {
|
|
1642
|
+
const qui = enQuestion(c);
|
|
1643
|
+
return c.sansIssue
|
|
1644
|
+
? ['sansIssue', 'fini sans son issue']
|
|
1645
|
+
: qui === SUPERVISEUR
|
|
1646
|
+
? ['attendLeSuperviseur', `question au ${SUPERVISEUR}`]
|
|
1647
|
+
: qui
|
|
1648
|
+
? ['attendLeResponsable', `question au ${qui}`]
|
|
1649
|
+
: ['arrete', 'arrêté'];
|
|
1650
|
+
}
|
|
1651
|
+
const etape = etapeDuCircuitLu(c);
|
|
1652
|
+
return attendLeDisque.has(c.id)
|
|
1653
|
+
? ['attendLeDisque', 'disque']
|
|
1654
|
+
: attendUnePlace.has(c.id)
|
|
1655
|
+
? ['attendUnePlace', p?.nuit ? 'nuit' : 'attend une place']
|
|
1656
|
+
: attendLeVerrou.has(c.id)
|
|
1657
|
+
? ['attendLeVerrou', '']
|
|
1658
|
+
: !etape
|
|
1659
|
+
? ['sansEtape', 'démarre']
|
|
1660
|
+
: etape.etat === 'file' && tientLeVerrou !== c.id
|
|
1661
|
+
? ['attendLaCI', 'CI']
|
|
1662
|
+
: ['enCours', ''];
|
|
1663
|
+
};
|
|
1664
|
+
const circuits = new Map();
|
|
1665
|
+
for (const c of t.circuits ?? []) {
|
|
1666
|
+
const etape = etapeDuCircuitLu(c);
|
|
1667
|
+
const temoin =
|
|
1668
|
+
verrouDe.get(c.id) ??
|
|
1669
|
+
(c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
|
|
1670
|
+
const [etat, raison] = etatDuCircuit(c, temoin);
|
|
1671
|
+
circuits.set(c.id, { etat, raison, ton: TONS[etat], signe: signeDuTon(TONS[etat]), temoin });
|
|
1672
|
+
}
|
|
1673
|
+
const ligne = (x, signe) => ({ id: x.id, projet: x.projet, signe });
|
|
1674
|
+
return {
|
|
1675
|
+
circuits,
|
|
1676
|
+
lignes: [
|
|
1677
|
+
...(t.circuits ?? []).map(c => ligne(c, circuits.get(c.id).signe)),
|
|
1678
|
+
...(t.horsCircuit ?? []).map(x => ligne(x, '▶')),
|
|
1679
|
+
...t.agents.flatMap(b => b.enCours.filter(x => !enCircuit.has(x.id)).map(x => ligne(x, '▶'))),
|
|
1680
|
+
],
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* The counts of the signs of AGENTS on the board <t> (`etatsDAgents`), of the project <projet> on a
|
|
1686
|
+
* board of several, of all its lines otherwise: `enCours` ▶, `enAttente` ⏸, `arretes` ⛔.
|
|
1687
|
+
* @param {any} t
|
|
1688
|
+
* @param {string} [projet]
|
|
1689
|
+
*/
|
|
1690
|
+
export function comptesDAgents(t, projet) {
|
|
1691
|
+
const l = etatsDAgents(t).lignes.filter(x => projet === undefined || x.projet === projet);
|
|
1692
|
+
const n = s => l.filter(x => x.signe === s).length;
|
|
1693
|
+
return { enCours: n('▶'), enAttente: n('⏸'), arretes: n('⛔') };
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1543
1696
|
// The board's lines, `largeur` columns wide, each with its tone (titre, alerte, attention, actif,
|
|
1544
1697
|
// discret, or none), its section (`section`: agents, chantier or faits, in that order) and, for a
|
|
1545
1698
|
// ticket's line, its id (`ticket`), which the pane makes selectable; an epic's line is marked
|
|
@@ -1566,6 +1719,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1566
1719
|
const large = Math.max(0, ...(t.projets ?? []).map(p => p.etiquette.length + 3));
|
|
1567
1720
|
const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
|
|
1568
1721
|
L(nom.toUpperCase(), TONS.titre);
|
|
1722
|
+
// The state of each ticket's line of AGENTS, which AGENTS draws and the head counts.
|
|
1723
|
+
const etats = etatsDAgents(t);
|
|
1724
|
+
// The first line of the head, the signs of AGENTS counted (`comptesDAgents`) as AGENTS signs its
|
|
1725
|
+
// lines, then the tickets done: « ▶ N · ⏸ N · ⛔ N · ✓ N ».
|
|
1726
|
+
const ligneDesSignes = (a, fermes) =>
|
|
1727
|
+
`▶ ${a.enCours} · ⏸ ${a.enAttente} · ⛔ ${a.arretes} · ✓ ${fermes}`;
|
|
1728
|
+
// The line of the queues, under their signs: ● the tickets ready for the circuit, ✎ the direct
|
|
1729
|
+
// queue, ⊘ the tickets blocked by an open ticket.
|
|
1730
|
+
const ligneDeLaFile = c =>
|
|
1731
|
+
`⏭ file : ● ${c.enAttente} · ✎ ${c.fileDirecte ?? 0} · ⊘ ${c.bloques ?? 0}`;
|
|
1569
1732
|
if (plusieurs) {
|
|
1570
1733
|
// The three lines of states of each project, as one project's board says them: the first
|
|
1571
1734
|
// under its label, the two others aligned below it; or the fault that keeps its board out.
|
|
@@ -1578,18 +1741,12 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1578
1741
|
const c = p.compteurs;
|
|
1579
1742
|
L(
|
|
1580
1743
|
cadre(
|
|
1581
|
-
`${colonneDe(p.etiquette)}
|
|
1582
|
-
'',
|
|
1583
|
-
largeur
|
|
1584
|
-
)
|
|
1585
|
-
);
|
|
1586
|
-
L(
|
|
1587
|
-
cadre(
|
|
1588
|
-
`${retrait}⏭ file : ${c.enAttente} en circuit · ${c.fileDirecte ?? 0} en direct`,
|
|
1744
|
+
`${colonneDe(p.etiquette)}${ligneDesSignes(comptesDAgents(t, p.etiquette), c.fermes)}`,
|
|
1589
1745
|
'',
|
|
1590
1746
|
largeur
|
|
1591
1747
|
)
|
|
1592
1748
|
);
|
|
1749
|
+
L(cadre(`${retrait}${ligneDeLaFile(c)}`, '', largeur));
|
|
1593
1750
|
L(
|
|
1594
1751
|
cadre(
|
|
1595
1752
|
`${retrait}${c.sansGo ?? 0} sans go · ${c.aValider ?? 0} à valider · ${c.reportes ?? 0} reportés`,
|
|
@@ -1612,10 +1769,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1612
1769
|
} else {
|
|
1613
1770
|
const g = t.global;
|
|
1614
1771
|
const c = g.compteurs;
|
|
1615
|
-
// Three lines of states: the
|
|
1616
|
-
// wait for the owner.
|
|
1617
|
-
L(cadre(
|
|
1618
|
-
L(cadre(
|
|
1772
|
+
// Three lines of states: the signs of AGENTS and the tickets done, the queues (the circuit's,
|
|
1773
|
+
// the direct one, the blocked), then those that wait for the owner.
|
|
1774
|
+
L(cadre(ligneDesSignes(comptesDAgents(t), c.fermes), '', largeur));
|
|
1775
|
+
L(cadre(ligneDeLaFile(c), '', largeur));
|
|
1619
1776
|
L(
|
|
1620
1777
|
cadre(`${c.sansGo} sans go · ${c.aValider} à valider · ${c.reportes} reportés`, '', largeur),
|
|
1621
1778
|
c.sansGo ? TONS.sansGo : c.aValider ? TONS.aValider : TONS.reportes
|
|
@@ -1697,6 +1854,18 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1697
1854
|
ticket: w.ticket,
|
|
1698
1855
|
});
|
|
1699
1856
|
}
|
|
1857
|
+
// The night reserving the machine (`nuit` of the places: `attend`, `en cours`, none outside
|
|
1858
|
+
// the night): the stages under way finish, then the nights play.
|
|
1859
|
+
if (p.nuit) {
|
|
1860
|
+
poser({
|
|
1861
|
+
texte: cadre(
|
|
1862
|
+
p.nuit === 'attend' ? 'nuit : attend la fin des étapes en cours' : 'nuit en cours',
|
|
1863
|
+
'',
|
|
1864
|
+
largeur
|
|
1865
|
+
),
|
|
1866
|
+
ton: p.nuit === 'attend' ? TONS.attendLeDisque : TONS.nuitEnCours,
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1700
1869
|
}
|
|
1701
1870
|
// The night under way on the machine, under the places: « 🌙 nuit · <projet> · depuis <durée> »,
|
|
1702
1871
|
// its project by its folder's name, the time since it started when the server gives it.
|
|
@@ -1735,41 +1904,24 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1735
1904
|
}
|
|
1736
1905
|
return couperAvant(avecQui, fin, '', largeur);
|
|
1737
1906
|
};
|
|
1738
|
-
// The lock
|
|
1739
|
-
const verrouDe = new Map();
|
|
1907
|
+
// The lock of each circuit shown stands on its line (`etatsDAgents`); any other, here.
|
|
1740
1908
|
const tenu = t.machine?.detenteur;
|
|
1741
|
-
if (tenu) {
|
|
1909
|
+
if (tenu && !duCircuit(tenu)) {
|
|
1742
1910
|
const a = tenu.avancement;
|
|
1743
1911
|
const age = a ? maintenant - a.dernier : 0;
|
|
1744
1912
|
const compte = a && (a.faits || a.prevus) ? `${a.faits}/${a.prevus}` : '';
|
|
1745
1913
|
const fige = age > FIGEE;
|
|
1746
1914
|
const depuis = ilYa(maintenant - (tenu.depuis ?? maintenant));
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
});
|
|
1755
|
-
} else {
|
|
1756
|
-
poser({
|
|
1757
|
-
texte: fige
|
|
1758
|
-
? ligneDuVerrou(`⚠ ${tenu.sorte} figée ${ilYa(age)}`, tenu, compte ? ` · ${compte}` : '')
|
|
1759
|
-
: ligneDuVerrou(`🔒 ${tenu.sorte}`, tenu, ` · ${compte ? `${compte} · ` : ''}${depuis}`),
|
|
1760
|
-
ton: fige ? TONS.fige : TONS.enCours,
|
|
1761
|
-
avancement: true,
|
|
1762
|
-
});
|
|
1763
|
-
}
|
|
1915
|
+
poser({
|
|
1916
|
+
texte: fige
|
|
1917
|
+
? ligneDuVerrou(`⚠ ${tenu.sorte} figée ${ilYa(age)}`, tenu, compte ? ` · ${compte}` : '')
|
|
1918
|
+
: ligneDuVerrou(`🔒 ${tenu.sorte}`, tenu, ` · ${compte ? `${compte} · ` : ''}${depuis}`),
|
|
1919
|
+
ton: fige ? TONS.fige : TONS.enCours,
|
|
1920
|
+
avancement: true,
|
|
1921
|
+
});
|
|
1764
1922
|
}
|
|
1765
1923
|
for (const w of [...(t.machine?.attentes ?? [])].sort((x, y) => x.depuis - y.depuis)) {
|
|
1766
1924
|
if (duCircuit(w)) {
|
|
1767
|
-
if (!verrouDe.has(w.ticket)) {
|
|
1768
|
-
verrouDe.set(w.ticket, {
|
|
1769
|
-
fige: false,
|
|
1770
|
-
texte: ` · ⏳ ${w.sorte.toLocaleLowerCase('fr')} · ${ilYa(maintenant - w.depuis)}`,
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
1925
|
continue;
|
|
1774
1926
|
}
|
|
1775
1927
|
poser({
|
|
@@ -1783,31 +1935,28 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1783
1935
|
avancement: true,
|
|
1784
1936
|
});
|
|
1785
1937
|
}
|
|
1786
|
-
// The tickets
|
|
1787
|
-
|
|
1788
|
-
const enAttente = new Set(attendLeVerrou);
|
|
1789
|
-
// The tickets whose circuit waits for a place of the machine, and those that wait for a place of
|
|
1790
|
-
// a circuit, not started, whose line in their chantier says « attend une place ».
|
|
1938
|
+
// The tickets that wait for a place of a circuit, not started, whose line in their chantier says
|
|
1939
|
+
// « attend une place ».
|
|
1791
1940
|
const attendUnePlace = new Set((p?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1792
1941
|
// The tickets that wait for the disk of their project's copies.
|
|
1793
1942
|
const attendLeDisque = new Set((p?.attentes ?? []).filter(w => w.disque).map(w => w.ticket));
|
|
1794
|
-
for (const id of attendUnePlace) {
|
|
1795
|
-
enAttente.add(id);
|
|
1796
|
-
}
|
|
1797
1943
|
// The tree of the steps (scripts/etapes.mjs), in its order, as a pipeline of GitLab CI shows its
|
|
1798
1944
|
// stages and folds the jobs of a stage that has nothing: a step with sub-steps is folded
|
|
1799
1945
|
// (« ▸ 2 · Composants ») while none of them holds a ticket, unfolded (« ▾ ») once one does, all
|
|
1800
1946
|
// its sub-steps then shown, indented, the empty ones in the discreet tone; a step without
|
|
1801
1947
|
// sub-steps stands on one line « number · title · who », discreet when empty, a title with its
|
|
1802
|
-
// tickets under it. A circuit
|
|
1803
|
-
// else in AGENTS: the
|
|
1804
|
-
//
|
|
1948
|
+
// tickets under it. A circuit launched and not integrated stands on one line from its launch to
|
|
1949
|
+
// its end, and nowhere else in AGENTS: at the step that works, or, while it waits, at the step
|
|
1950
|
+
// about to be launched: the step of its state; the work on the plan at its step; a running
|
|
1951
|
+
// circuit with no known step at the step of its stop, else at the plan (1); waiting for the
|
|
1952
|
+
// supervisor (`attendLeSuperviseur`), under its step after a line « ⤷ Question · <qui> », who
|
|
1805
1953
|
// must answer it, the supervisor or the owner, which unfolds the step, its counters those of its
|
|
1806
1954
|
// step; a stopped circuit at no step of the list stands under that line after the steps. A
|
|
1807
1955
|
// circuit's line gives its subject (`texte`), then the counters of the bounded loops of its step
|
|
1808
1956
|
// from their second pass (`boucles` of the step, scripts/etapes.mjs, their counts in the state's
|
|
1809
|
-
// `boucles`), whole; then its ticket's working time and tokens. Its card
|
|
1810
|
-
// its question, or says where it stopped and why. The tickets' numbers line up in one
|
|
1957
|
+
// `boucles`), whole, the reason of its wait; then its ticket's working time and tokens. Its card
|
|
1958
|
+
// opens on its question, or says where it stopped and why. The tickets' numbers line up in one
|
|
1959
|
+
// column.
|
|
1811
1960
|
// The block of the step <e>, an empty one when the board holds none.
|
|
1812
1961
|
const vides = new Map();
|
|
1813
1962
|
const blocDe = e =>
|
|
@@ -1823,13 +1972,12 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1823
1972
|
.get(e.numero);
|
|
1824
1973
|
// The block of the circuits at no step of the list, after the steps.
|
|
1825
1974
|
const ailleurs = { numero: null, titre: '', qui: '', enCours: [] };
|
|
1826
|
-
const etapeDe =
|
|
1827
|
-
//
|
|
1828
|
-
//
|
|
1829
|
-
const enQuestion = c => (attendLeSuperviseur(c) ? (c.qui ?? SUPERVISEUR) : null);
|
|
1975
|
+
const etapeDe = etapeDuCircuitLu;
|
|
1976
|
+
// The block of the circuit <c>: the step of its state, else, while it stopped, the block after
|
|
1977
|
+
// the steps, else, running with no known step (it starts or resumes), the plan (1).
|
|
1830
1978
|
const blocDuCircuit = c => {
|
|
1831
1979
|
const e = etapeDe(c);
|
|
1832
|
-
return e ? blocDe(e) : !c.vivant ? ailleurs :
|
|
1980
|
+
return e ? blocDe(e) : !c.vivant ? ailleurs : blocDe(ETAPES[0]);
|
|
1833
1981
|
};
|
|
1834
1982
|
const montres = t.agents.flatMap(b => b.enCours.filter(x => !enCircuit.has(x.id)));
|
|
1835
1983
|
// A ticket's number, or on several projects' board its whole id, in one column.
|
|
@@ -1846,56 +1994,45 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1846
1994
|
: `${signe} ${nomme(x).padEnd(colonne)} `;
|
|
1847
1995
|
const droiteDe = (signe, droite) =>
|
|
1848
1996
|
plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
|
|
1849
|
-
//
|
|
1850
|
-
//
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
: attendLeDisque.has(c.id)
|
|
1861
|
-
? 'attendLeDisque'
|
|
1862
|
-
: attendUnePlace.has(c.id)
|
|
1863
|
-
? 'attendUnePlace'
|
|
1864
|
-
: attendLeVerrou.has(c.id)
|
|
1865
|
-
? 'attendLeVerrou'
|
|
1866
|
-
: 'enCours';
|
|
1997
|
+
// A ticket's line of `largeur` columns: its head <tete> (its sign and number, or its project and
|
|
1998
|
+
// id) whole, then its subject, cut to leave <suite> and the right part <droite> whole; without
|
|
1999
|
+
// room for the subject, <suite> is cut, never the head.
|
|
2000
|
+
const ligneDuTicket = (tete, sujet, suite, droite) => {
|
|
2001
|
+
const place = largeur - colonnes(tete) - colonnes(suite) - (droite ? colonnes(droite) + 1 : 0);
|
|
2002
|
+
if (place < 2) {
|
|
2003
|
+
return couper(`${tete}${suite}`, droite, largeur);
|
|
2004
|
+
}
|
|
2005
|
+
const s = colonnes(sujet) > place ? `${debutDe(sujet, place - 1)}…` : sujet;
|
|
2006
|
+
return couper(`${tete}${s}${suite}`, droite, largeur);
|
|
2007
|
+
};
|
|
1867
2008
|
const ligneDuCircuit = c => {
|
|
1868
|
-
const
|
|
2009
|
+
const etape = etapeDe(c);
|
|
2010
|
+
// Its state, its sign, its reason and its witness, as the head counts them.
|
|
2011
|
+
const { ton, signe, raison, temoin } = etats.circuits.get(c.id);
|
|
1869
2012
|
const droite = droiteDe(
|
|
1870
2013
|
signe,
|
|
1871
2014
|
conso(t.parTicket?.[c.id]?.travail ?? 0, t.parTicket?.[c.id]?.jetons ?? 0)
|
|
1872
2015
|
);
|
|
1873
|
-
const etape = etapeDe(c);
|
|
1874
2016
|
const boucles = (etape ? bouclesDe(etape) : [])
|
|
1875
2017
|
.filter(b => b.max && c.boucles?.[b.cle] >= 2)
|
|
1876
2018
|
.map(b => ` · ${b.libelle} ${c.boucles[b.cle]}/${b.max}`)
|
|
1877
2019
|
.join('');
|
|
1878
2020
|
const tete = teteDe(signe, c);
|
|
1879
|
-
|
|
1880
|
-
const temoin =
|
|
1881
|
-
verrouDe.get(c.id) ??
|
|
1882
|
-
(c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
|
|
2021
|
+
const pourquoi = raison ? ` · ${raison}` : '';
|
|
1883
2022
|
// The progress after the counters of the loops while the subject keeps its room beside them,
|
|
1884
|
-
// in their place otherwise.
|
|
2023
|
+
// in their place otherwise; the reason of its wait last.
|
|
1885
2024
|
const reste = avec =>
|
|
1886
2025
|
largeur - (droite ? colonnes(droite) + 1 : 0) - colonnes(tete) - colonnes(avec);
|
|
1887
|
-
const
|
|
1888
|
-
const tag = enQuestion(c) === SUPERVISEUR ? ' · en attente du superviseur' : '';
|
|
1889
|
-
const suite = `${tag}${
|
|
2026
|
+
const suite = `${
|
|
1890
2027
|
!temoin
|
|
1891
2028
|
? boucles
|
|
1892
|
-
: reste(`${boucles}${temoin.texte}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
|
|
2029
|
+
: reste(`${boucles}${temoin.texte}${pourquoi}`) >= Math.min(PLACE_DU_SUJET, c.sujet.length)
|
|
1893
2030
|
? `${boucles}${temoin.texte}`
|
|
1894
2031
|
: temoin.texte
|
|
1895
|
-
}${
|
|
2032
|
+
}${pourquoi}`;
|
|
1896
2033
|
poser({
|
|
1897
|
-
texte:
|
|
1898
|
-
ton
|
|
2034
|
+
texte: ligneDuTicket(tete, c.sujet, suite, droite),
|
|
2035
|
+
ton,
|
|
1899
2036
|
ticket: c.id,
|
|
1900
2037
|
...(temoin ? { avancement: true } : {}),
|
|
1901
2038
|
});
|
|
@@ -1927,7 +2064,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1927
2064
|
}
|
|
1928
2065
|
for (const x of enCours) {
|
|
1929
2066
|
L(
|
|
1930
|
-
|
|
2067
|
+
ligneDuTicket(teteDe('▶', x), x.sujet, '', droiteDe('▶', conso(x.travail, x.jetons))),
|
|
1931
2068
|
TONS.enCours,
|
|
1932
2069
|
x.id
|
|
1933
2070
|
);
|
|
@@ -1945,10 +2082,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1945
2082
|
plein ? TONS.titre : TONS.vide
|
|
1946
2083
|
);
|
|
1947
2084
|
// The tickets worked out of a circuit, once each, before the steps, from their claim to their
|
|
1948
|
-
// close: «
|
|
2085
|
+
// close: « ▶ <numéro> <sujet> · en direct ».
|
|
1949
2086
|
for (const x of t.horsCircuit ?? []) {
|
|
1950
2087
|
poser({
|
|
1951
|
-
texte:
|
|
2088
|
+
texte: ligneDuTicket(teteDe('▶', x), x.sujet, ' · en direct', droiteDe('▶', '')),
|
|
1952
2089
|
ton: TONS.enDirect,
|
|
1953
2090
|
ticket: x.id,
|
|
1954
2091
|
});
|
|
@@ -2276,9 +2413,12 @@ export function dernierBouge(tous, lignesDuTableau, vivants = [], maintenant = D
|
|
|
2276
2413
|
|
|
2277
2414
|
// The status line: the chantier in progress; first the alerts, counted by their signs as the board
|
|
2278
2415
|
// shows them (🌙, 💤, ⚠), then the holder of the lock of the machine, « 🔒 <sorte> · <projet> »,
|
|
2279
|
-
// and the count of its waits, « ⏳ <n>
|
|
2280
|
-
|
|
2281
|
-
|
|
2416
|
+
// and the count of its waits, « ⏳ <n> »; then the signs of AGENTS counted as the head counts them
|
|
2417
|
+
// (`comptesDAgents`), « ▶ N · ⏸ N · ⛔ N ». The alerts of the other projects of a board of several
|
|
2418
|
+
// (<voisins>, their boards) count beside the session's, as a multi-root status bar counts the problems
|
|
2419
|
+
// of every root; the counters and the chantier stay the session's.
|
|
2420
|
+
export function ligneEtat(t, voisins = []) {
|
|
2421
|
+
const signes = [t, ...voisins].flatMap(b => b.alertes ?? []).map(signeDe);
|
|
2282
2422
|
const tenu = t.machine?.detenteur;
|
|
2283
2423
|
const attentes = t.machine?.attentes?.length ?? 0;
|
|
2284
2424
|
const alerte = [
|
|
@@ -2290,27 +2430,76 @@ export function ligneEtat(t) {
|
|
|
2290
2430
|
.join('');
|
|
2291
2431
|
const ch = t.chantiers[0];
|
|
2292
2432
|
const c = t.global.compteurs;
|
|
2433
|
+
const a = comptesDAgents(t);
|
|
2434
|
+
const dAgents = `▶ ${a.enCours} · ⏸ ${a.enAttente} · ⛔ ${a.arretes}`;
|
|
2293
2435
|
if (!ch) {
|
|
2294
|
-
return `${alerte}Grillhouse : ${
|
|
2436
|
+
return `${alerte}Grillhouse : ${dAgents} · ⏭ ● ${c.enAttente} · ✎ ${c.fileDirecte} · ✓ ${c.fermes}`;
|
|
2295
2437
|
}
|
|
2296
|
-
return `${alerte}${ch.numero} ${ch.faits}/${ch.total} ·
|
|
2438
|
+
return `${alerte}${ch.numero} ${ch.faits}/${ch.total} · ${dAgents} · ${k(t.global.jour.jetons)} aujourd'hui`;
|
|
2297
2439
|
}
|
|
2298
2440
|
|
|
2441
|
+
// The answer of Beads to <args> in the repository at <racine>, as JSON (`liste`), or the first line
|
|
2442
|
+
// of its fault (`faute`), its error output first.
|
|
2299
2443
|
const bdJson = (racine, ...args) => {
|
|
2300
2444
|
try {
|
|
2301
|
-
return
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2445
|
+
return {
|
|
2446
|
+
liste: JSON.parse(
|
|
2447
|
+
execFileSync('bd', [...args, '--json'], {
|
|
2448
|
+
cwd: racine,
|
|
2449
|
+
encoding: 'utf8',
|
|
2450
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
2451
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
2452
|
+
})
|
|
2453
|
+
),
|
|
2454
|
+
faute: null,
|
|
2455
|
+
};
|
|
2456
|
+
} catch (e) {
|
|
2457
|
+
const message = String(e?.stderr ?? '').trim() || String(e?.message ?? e);
|
|
2458
|
+
return { liste: [], faute: message.split('\n')[0] };
|
|
2311
2459
|
}
|
|
2312
2460
|
};
|
|
2313
2461
|
|
|
2462
|
+
// The file of the last reading that succeeded of <quoi> (`circuits`, `tickets`), beside the
|
|
2463
|
+
// status line in the common dir <commun>; null without a common dir.
|
|
2464
|
+
const fichierDeLaLecture = (commun, quoi) => commun && path.join(commun, `tableau-lu-${quoi}.json`);
|
|
2465
|
+
|
|
2466
|
+
/**
|
|
2467
|
+
* The reading of <quoi> (`circuits`, `tickets`) of the project whose common dir is <commun>, kept
|
|
2468
|
+
* when it succeeded, as a dashboard keeps showing its last data with their age: a reading that
|
|
2469
|
+
* succeeded (<liste>, not null) is written with its time <maintenant> and comes back as it is,
|
|
2470
|
+
* `lu` null; a reading that failed (<liste> null) comes back as the last one kept, `lu` its time,
|
|
2471
|
+
* or empty, `lu` null, without one. A place that cannot be written or read keeps none.
|
|
2472
|
+
* @param {string | null} commun
|
|
2473
|
+
* @param {'circuits' | 'tickets'} quoi
|
|
2474
|
+
* @param {any[] | null} liste
|
|
2475
|
+
* @param {number} maintenant
|
|
2476
|
+
* @returns {{ liste: any[], lu: number | null }}
|
|
2477
|
+
*/
|
|
2478
|
+
export function lectureGardee(commun, quoi, liste, maintenant) {
|
|
2479
|
+
const fichier = fichierDeLaLecture(commun, quoi);
|
|
2480
|
+
if (liste) {
|
|
2481
|
+
try {
|
|
2482
|
+
if (fichier) {
|
|
2483
|
+
// Written beside, then renamed: a reader never sees a file half written.
|
|
2484
|
+
writeFileSync(`${fichier}.${process.pid}`, JSON.stringify({ lu: maintenant, liste }));
|
|
2485
|
+
renameSync(`${fichier}.${process.pid}`, fichier);
|
|
2486
|
+
}
|
|
2487
|
+
} catch {
|
|
2488
|
+
// A read-only place keeps the board working, without the reading kept.
|
|
2489
|
+
}
|
|
2490
|
+
return { liste, lu: null };
|
|
2491
|
+
}
|
|
2492
|
+
try {
|
|
2493
|
+
const garde = JSON.parse(readFileSync(fichier, 'utf8'));
|
|
2494
|
+
if (Array.isArray(garde.liste) && typeof garde.lu === 'number') {
|
|
2495
|
+
return { liste: garde.liste, lu: garde.lu };
|
|
2496
|
+
}
|
|
2497
|
+
} catch {
|
|
2498
|
+
// No reading kept.
|
|
2499
|
+
}
|
|
2500
|
+
return { liste: [], lu: null };
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2314
2503
|
// The folder git keeps a repository's shared files in (its common dir), absolute; null when
|
|
2315
2504
|
// <racine> is no git repository. The board's cache and the day's marker live there.
|
|
2316
2505
|
export function dossierCommun(racine) {
|
|
@@ -2407,8 +2596,22 @@ function lire(
|
|
|
2407
2596
|
ps = '';
|
|
2408
2597
|
}
|
|
2409
2598
|
const registre = existsSync(REGISTRE) ? lireRegistre(readFileSync(REGISTRE, 'utf8'), racine) : [];
|
|
2410
|
-
const tous = bdJson(racine, 'list', '--all', '--limit', '0');
|
|
2411
2599
|
const commun = dossierCommun(racine);
|
|
2600
|
+
// The tickets and the circuits, each the last reading that succeeded when this one failed.
|
|
2601
|
+
const lesTickets = bdJson(racine, 'list', '--all', '--limit', '0');
|
|
2602
|
+
const tickets = lectureGardee(
|
|
2603
|
+
commun,
|
|
2604
|
+
'tickets',
|
|
2605
|
+
lesTickets.faute ? null : lesTickets.liste,
|
|
2606
|
+
maintenant
|
|
2607
|
+
);
|
|
2608
|
+
const tous = tickets.liste;
|
|
2609
|
+
const lesCircuitsLus = lectureGardee(
|
|
2610
|
+
commun,
|
|
2611
|
+
'circuits',
|
|
2612
|
+
muet || faute ? null : circuits,
|
|
2613
|
+
maintenant
|
|
2614
|
+
);
|
|
2412
2615
|
const fichierCache = commun && path.join(commun, 'tableau-cache.json');
|
|
2413
2616
|
let cache = {};
|
|
2414
2617
|
try {
|
|
@@ -2448,7 +2651,7 @@ function lire(
|
|
|
2448
2651
|
racine: commun ? path.dirname(commun) : racine,
|
|
2449
2652
|
registre,
|
|
2450
2653
|
vivants,
|
|
2451
|
-
circuits,
|
|
2654
|
+
circuits: lesCircuitsLus.liste,
|
|
2452
2655
|
maintenant,
|
|
2453
2656
|
jour,
|
|
2454
2657
|
voies,
|
|
@@ -2457,6 +2660,9 @@ function lire(
|
|
|
2457
2660
|
nuit,
|
|
2458
2661
|
muet,
|
|
2459
2662
|
faute,
|
|
2663
|
+
circuitsLusA: lesCircuitsLus.lu,
|
|
2664
|
+
fauteTickets: lesTickets.faute,
|
|
2665
|
+
ticketsLusA: tickets.lu,
|
|
2460
2666
|
echecPrefixe,
|
|
2461
2667
|
outil: echecDeLOutil(racine),
|
|
2462
2668
|
remontees: lireLesRemontees(racine, maintenant),
|
|
@@ -2535,8 +2741,8 @@ export function ensemble(lus) {
|
|
|
2535
2741
|
};
|
|
2536
2742
|
}
|
|
2537
2743
|
|
|
2538
|
-
// A project beside the session's, read in its folder <dossier>: its board,
|
|
2539
|
-
// it out, on one line.
|
|
2744
|
+
// A project beside the session's, read in its folder <dossier>: its board, the faults of its
|
|
2745
|
+
// reading of the circuits in its alerts, or the fault that keeps it out, on one line.
|
|
2540
2746
|
async function lireUnAutre(dossier, { circuitsDe, ...o }) {
|
|
2541
2747
|
try {
|
|
2542
2748
|
if (!existsSync(dossier)) {
|
|
@@ -2544,7 +2750,7 @@ async function lireUnAutre(dossier, { circuitsDe, ...o }) {
|
|
|
2544
2750
|
}
|
|
2545
2751
|
return {
|
|
2546
2752
|
dossier,
|
|
2547
|
-
...lire(dossier, { ...o,
|
|
2753
|
+
...lire(dossier, { ...o, ...(await lesCircuits(circuitsDe, dossier)) }),
|
|
2548
2754
|
};
|
|
2549
2755
|
} catch (e) {
|
|
2550
2756
|
return { dossier, erreur: String(e.message ?? e).split('\n')[0] };
|
|
@@ -2552,8 +2758,9 @@ async function lireUnAutre(dossier, { circuitsDe, ...o }) {
|
|
|
2552
2758
|
}
|
|
2553
2759
|
|
|
2554
2760
|
// The circuits of the repository at <racine> by the reader <circuitsDe>; none when the reading
|
|
2555
|
-
// fails,
|
|
2556
|
-
// fault, a client not built among them, by the first line of its
|
|
2761
|
+
// fails, which `lire` replaces by the last reading kept: the server stayed silent (`muet`,
|
|
2762
|
+
// `ServeurMuet`), or another fault, a client not built among them, by the first line of its
|
|
2763
|
+
// message (`faute`).
|
|
2557
2764
|
async function lesCircuits(circuitsDe, racine) {
|
|
2558
2765
|
try {
|
|
2559
2766
|
return { circuits: await circuitsDe(racine), muet: false, faute: null };
|
|
@@ -2668,7 +2875,7 @@ export async function tableau(
|
|
|
2668
2875
|
),
|
|
2669
2876
|
ici.commun ? path.dirname(ici.commun) : null
|
|
2670
2877
|
);
|
|
2671
|
-
const etat = ligneEtat(ici.t);
|
|
2878
|
+
const etat = ligneEtat(ici.t, autres.map(l => l.t).filter(Boolean));
|
|
2672
2879
|
try {
|
|
2673
2880
|
if (ici.commun) {
|
|
2674
2881
|
writeFileSync(path.join(ici.commun, 'grillhouse-etat.txt'), `${etat}\n`);
|