@roomi-fields/grillhouse 0.33.0 → 0.34.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 +73 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +35 -2
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/circuit/activites.d.ts +3 -1
- package/dist/temporal/circuit/activites.js +25 -1
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/appel.d.ts +19 -0
- package/dist/temporal/circuit/appel.js +93 -0
- package/dist/temporal/circuit/appel.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +17 -3
- package/dist/temporal/circuit/client.js +28 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +27 -87
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +29 -0
- package/dist/temporal/circuit/contrat.js +33 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +115 -34
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +13 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +3 -0
- package/dist/temporal/file/activites.js +9 -0
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +58 -0
- package/dist/temporal/file/deroule.d.ts +8 -1
- package/dist/temporal/file/deroule.js +100 -2
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -1
- package/dist/temporal/installation.js +57 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +2 -0
- package/dist/temporal/nuits/deroule.js +3 -0
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +12 -1
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +8 -1
- package/dist/temporal/places/client.js +25 -2
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +35 -3
- package/dist/temporal/places/contrat.js +5 -4
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +55 -9
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +3 -0
- package/dist/temporal/tickets/activites.js +73 -4
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +31 -0
- package/dist/temporal/tickets/deroule.js +61 -10
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +240 -60
- package/docs/CADRE.md +6 -1
- package/docs/INTERFACE.md +25 -8
- package/hooks/crochet.mjs +17 -2
- package/hooks/hooks.json +24 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +96 -15
- package/scripts/aiguillage.mjs +2 -0
- package/scripts/attente-a-l-arret.mjs +141 -0
- package/scripts/attente-au-tour.mjs +32 -16
- package/scripts/avancement.mjs +5 -3
- package/scripts/branche-de-nuit.mjs +63 -3
- package/scripts/circuit.mjs +57 -4
- package/scripts/circuits-du-serveur.mjs +38 -4
- package/scripts/commandes-composees.mjs +11 -4
- package/scripts/copies-finies.mjs +43 -29
- package/scripts/crochets.mjs +1 -1
- package/scripts/dernier-vert.mjs +31 -10
- package/scripts/dette.mjs +55 -4
- package/scripts/disque-des-copies.d.mts +28 -0
- package/scripts/disque-des-copies.mjs +155 -0
- package/scripts/droits.mjs +2 -0
- package/scripts/faits-du-circuit.mjs +24 -0
- package/scripts/file-des-tickets.d.mts +16 -0
- package/scripts/file-des-tickets.mjs +65 -7
- package/scripts/gardes-du-cadre.mjs +4 -2
- package/scripts/integration/file.mjs +302 -5
- package/scripts/jointure.d.ts +33 -1
- package/scripts/langages/cargo/commandes.mjs +71 -10
- package/scripts/langages/cargo/composants.mjs +12 -4
- package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
- package/scripts/langages/cargo/exemples.mjs +17 -3
- package/scripts/langages/cargo/index.mjs +8 -3
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
- package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
- package/scripts/langages/cargo/squelette.mjs +8 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
- package/scripts/langages/cargo/tests-de-head.mjs +12 -9
- package/scripts/langages/cargo/verdict.mjs +40 -14
- package/scripts/langages/python/commandes.mjs +11 -2
- package/scripts/langages/python/index.mjs +12 -4
- package/scripts/langages/python/verdict.mjs +8 -1
- package/scripts/langages/typescript/index.mjs +9 -2
- package/scripts/langages/typescript/resume-du-lanceur.mjs +86 -0
- package/scripts/langages/typescript/tests.mjs +9 -3
- package/scripts/langages/typescript/verdict.mjs +4 -60
- package/scripts/langages/typescript/verifier.mjs +11 -4
- package/scripts/langages/typescript/vitest-config/changements.mjs +32 -15
- package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
- package/scripts/messages-non-lus.mjs +166 -0
- package/scripts/mesure-de-la-machine.mjs +7 -4
- package/scripts/migrations-des-gardes.mjs +168 -0
- package/scripts/places-de-la-machine.mjs +44 -40
- package/scripts/places-du-serveur.mjs +82 -14
- package/scripts/plafond-de-la-machine.d.mts +18 -0
- package/scripts/plafond-de-la-machine.mjs +45 -0
- package/scripts/recommencer.d.mts +4 -0
- package/scripts/recommencer.mjs +29 -0
- package/scripts/regles-des-places.d.mts +35 -0
- package/scripts/regles-des-places.mjs +82 -1
- package/scripts/resultats.mjs +38 -4
- package/scripts/retirer-les-copies-finies.mjs +11 -7
- package/scripts/seances.mjs +1 -1
- package/scripts/services-du-noyau.mjs +2 -1
- package/scripts/session-start.sh +12 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +283 -59
- package/scripts/tableau.mjs +390 -250
- package/scripts/taches-du-graphe.mjs +32 -5
- package/scripts/ticket-du-circuit.mjs +25 -0
- package/scripts/transitions.d.mts +27 -1
- package/scripts/transitions.mjs +96 -4
- package/scripts/verrou-de-machine.mjs +41 -17
- package/skills/explorateur/SKILL.md +8 -2
- package/skills/pitmaster/SKILL.md +26 -18
- package/skills/pitmaster/references/tour.md +3 -1
- package/skills/questionneur/SKILL.md +5 -1
- package/skills/testwriter/SKILL.md +32 -6
package/scripts/tableau.mjs
CHANGED
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
// - Global: the work tickets of the project (a ticket without children; a mother is a grouping)
|
|
15
15
|
// by state, the agents' working time and tokens of the day and in all, the alerts.
|
|
16
16
|
// - Agents: the tree of the steps of the process (scripts/etapes.mjs), one block per step and
|
|
17
|
-
// sub-step, with who works there, for the whole project. A ticket stands at
|
|
18
|
-
// agent that runs on it,
|
|
19
|
-
//
|
|
20
|
-
// start of a comment).
|
|
17
|
+
// sub-step, with who works there, for the whole project. A ticket stands at a step only by its
|
|
18
|
+
// circuit (below) or by an agent that runs on it, at that agent's step; a ticket in the queue,
|
|
19
|
+
// with neither, stands at no step.
|
|
21
20
|
// - Circuits: one entry per open ticket whose circuit (scripts/circuit.mjs) runs or stopped, read
|
|
22
21
|
// from the Temporal server in one call (scripts/circuits-du-serveur.mjs, the memo of its
|
|
23
22
|
// workflow): it runs while its workflow runs with no question awaited, and stands at the step of
|
|
@@ -28,8 +27,7 @@
|
|
|
28
27
|
// « arrete », or ended without its issue), it stands under the stopped
|
|
29
28
|
// step after a line « ⤷ Question · <qui> », who must answer it, the supervisor or the owner, the
|
|
30
29
|
// supervisor when it names no question; its card opens on that question, or on the stop
|
|
31
|
-
// (its name and code) and the first line of its reason.
|
|
32
|
-
// block.
|
|
30
|
+
// (its name and code) and the first line of its reason.
|
|
33
31
|
// - Bilans: the card of a ticket whose circuit kept its bilan (scripts/bilan.mjs,
|
|
34
32
|
// `.claude/worktrees/<ticket>.bilan.json`) opens on its key figures: wall time, share lost,
|
|
35
33
|
// sessions, cost.
|
|
@@ -68,22 +66,33 @@
|
|
|
68
66
|
// without a sign, « ⚠ figée <durée> · faits/prévus », the time since its last sign, in the
|
|
69
67
|
// tone of an alert.
|
|
70
68
|
// - The lock of the machine (scripts/verrou-de-machine.mjs, read by `lireLaMesure`), as lslocks
|
|
71
|
-
// names who holds a lock and cargo says what its wait waits for
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
69
|
+
// names who holds a lock and cargo says what its wait waits for. A holder or a wait of a circuit
|
|
70
|
+
// AGENTS shows stands on that circuit's line, one line per ticket, in place of the progress of
|
|
71
|
+
// its pass: « · 🔒 <sorte> faits/prévus · <durée> » since it took the lock, « · ⚠ <sorte> figée
|
|
72
|
+
// <durée> · faits/prévus » past FIGEE without a sign, « · ⏳ <sorte> · <durée> » for a wait, the
|
|
73
|
+
// kind in lower case. Any other stands at the head of AGENTS: its holder, whoever it is (a pass
|
|
74
|
+
// out of a ticket, the circuit of a ticket of any project of the machine), « 🔒 <sorte> ·
|
|
75
|
+
// <projet> · <qui> · faits/prévus · <durée> », « ⚠ <sorte> figée <durée> · <projet> · <qui> ·
|
|
76
|
+
// faits/prévus »; then each pass that waits for the lock or for room under /tmp, the oldest
|
|
77
|
+
// first, « ⏳ <sorte> · <projet> · <qui> · attend · <durée> ». <qui> is its ticket without its
|
|
78
|
+
// prefix (`courtDuTicket`), else the folder of its copy (`copie`, under .claude/worktrees/, or
|
|
79
|
+
// the main tree when the project is not named); <projet> is left out for the project of the
|
|
80
|
+
// board (`ici`). The width cuts the project first, then leaves out « attend », then cuts <qui>,
|
|
81
|
+
// never the kind, the figures nor the time. Such a line
|
|
82
|
+
// is marked `avancement`, which the pane measures again more often. A circuit that waits shows
|
|
83
|
+
// ⏳ on its ticket's line, ▶ while it waits for nothing.
|
|
79
84
|
// - Signs: each sign keeps one sense (the owner's decision of 2026-11-01): ▶ in progress, ⏸ a
|
|
80
85
|
// stopped circuit, 🔒 the holder of the lock, ⏳ a wait for it or for room, 💤 a ticket claimed
|
|
81
86
|
// with nothing running, 🌙 a red night, ⚠ the alerts without a kind of their own. A sign two
|
|
82
87
|
// columns wide stands as the others, a sign then a space; the width of a line counts its
|
|
83
88
|
// columns (`colonnes`), ⏳ two.
|
|
84
|
-
// - Alerts: one
|
|
85
|
-
//
|
|
86
|
-
// anything running for 30 minutes (💤).
|
|
89
|
+
// - Alerts: one alert per open night ticket (🌙, its subject, then its number), per circuit that
|
|
90
|
+
// waits for the supervisor (⏳, how long), a shell agent silent for 10 minutes, a ticket in
|
|
91
|
+
// progress without anything running for 30 minutes (💤), each with its state (`etat`).
|
|
92
|
+
// - Tones: each state the board shows has one tone, defined once (`TONS`), which every line and
|
|
93
|
+
// every alert takes, whatever its duration or the line that shows it: red for what asks for a
|
|
94
|
+
// correction (frozen, a fault, a question with no live wait, a ceiling refused), yellow for what
|
|
95
|
+
// waits for an answer or a look (the supervisor, the owner, the disk), cyan for what runs.
|
|
87
96
|
import { execFileSync } from 'node:child_process';
|
|
88
97
|
import {
|
|
89
98
|
closeSync,
|
|
@@ -105,7 +114,6 @@ import {
|
|
|
105
114
|
etapeDuCircuit,
|
|
106
115
|
etapeDuRole,
|
|
107
116
|
libelle,
|
|
108
|
-
QUESTIONNEUR,
|
|
109
117
|
quiDe,
|
|
110
118
|
roleDeLAgent,
|
|
111
119
|
SUITE,
|
|
@@ -113,9 +121,14 @@ import {
|
|
|
113
121
|
} from './etapes.mjs';
|
|
114
122
|
import { echecDeLOutil } from './aiguillage.mjs';
|
|
115
123
|
import { bilansGardes, enBref } from './bilan.mjs';
|
|
116
|
-
import { verdictDe } from './integration/verdict.mjs';
|
|
117
124
|
import { lireLaMesure } from './avancement.mjs';
|
|
118
|
-
import {
|
|
125
|
+
import {
|
|
126
|
+
SANS_REPONSE_EN,
|
|
127
|
+
ServeurMuet,
|
|
128
|
+
circuitsDuServeur,
|
|
129
|
+
nuitDuServeur,
|
|
130
|
+
} from './circuits-du-serveur.mjs';
|
|
131
|
+
import { enFileSansArchitecture } from './file-des-tickets.mjs';
|
|
119
132
|
import { etatDesPlaces } from './places-de-la-machine.mjs';
|
|
120
133
|
import { vivant } from './mesure/base-de-passe.mjs';
|
|
121
134
|
|
|
@@ -150,6 +163,46 @@ export const ETATS = [
|
|
|
150
163
|
{ cle: 'reportes', nom: 'reporté', sens: 'mis de côté' },
|
|
151
164
|
{ cle: 'fermes', nom: 'fait', sens: 'fermé' },
|
|
152
165
|
];
|
|
166
|
+
// The tone of each state the board shows, defined once: as a dashboard of states (GitHub Checks,
|
|
167
|
+
// Alertmanager), the severity belongs to the state, never to its duration nor to the line that
|
|
168
|
+
// shows it; the duration stays in the text. Every line and every alert takes its tone here:
|
|
169
|
+
// `alerte` (red), what asks for a correction; `attention` (yellow), what waits for an answer or a
|
|
170
|
+
// look; `actif` (cyan), what runs; `discret`, what is done, empty or a measure; `titre`, a
|
|
171
|
+
// heading; none, a ticket at rest. The pane turns each tone into its colour (mods/grillhouse
|
|
172
|
+
// `couleur`).
|
|
173
|
+
export const TONS = Object.freeze({
|
|
174
|
+
// A ticket's state (ETATS).
|
|
175
|
+
enCours: 'actif',
|
|
176
|
+
enAttente: undefined,
|
|
177
|
+
bloques: undefined,
|
|
178
|
+
sansGo: 'attention',
|
|
179
|
+
aValider: 'attention',
|
|
180
|
+
reportes: undefined,
|
|
181
|
+
fermes: 'discret',
|
|
182
|
+
// A circuit, a pass, a wait.
|
|
183
|
+
attendUnePlace: 'attention',
|
|
184
|
+
attendLeVerrou: 'actif',
|
|
185
|
+
enDirect: 'actif',
|
|
186
|
+
nuitEnCours: 'actif',
|
|
187
|
+
attendLeDisque: 'attention',
|
|
188
|
+
attendLeSuperviseur: 'attention',
|
|
189
|
+
attendLeResponsable: 'attention',
|
|
190
|
+
arrete: 'attention',
|
|
191
|
+
sansRienQuiTourne: 'attention',
|
|
192
|
+
silencieux: 'attention',
|
|
193
|
+
sansArchitecture: 'attention',
|
|
194
|
+
outilNonInstallable: 'attention',
|
|
195
|
+
machineChargee: 'attention',
|
|
196
|
+
fige: 'alerte',
|
|
197
|
+
panne: 'alerte',
|
|
198
|
+
nuitRouge: 'alerte',
|
|
199
|
+
sansAttente: 'alerte',
|
|
200
|
+
plafondRefuse: 'alerte',
|
|
201
|
+
// The layout.
|
|
202
|
+
titre: 'titre',
|
|
203
|
+
vide: 'discret',
|
|
204
|
+
mesure: 'discret',
|
|
205
|
+
});
|
|
153
206
|
const enTirets = p => p.replace(/[^A-Za-z0-9]/g, '-');
|
|
154
207
|
|
|
155
208
|
// The origins of an incoming message: the person, another agent, a notification, the supervisor
|
|
@@ -604,17 +657,19 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
|
|
|
604
657
|
|
|
605
658
|
/**
|
|
606
659
|
* Whether the circuit <c>, as scripts/circuits-du-serveur.mjs reads it, waits for the supervisor:
|
|
607
|
-
* not running on its own, and ended without its issue, on a question, or stopped (any stop but the
|
|
660
|
+
* not running on its own, not integrated, and ended without its issue, on a question, or stopped (any stop but the
|
|
608
661
|
* supervisor's own « arrete », « à repasser » included: the supervisor resumes it once the machine
|
|
609
662
|
* is free). The
|
|
610
663
|
* one rule of the questions that wait for the supervisor (grillhouse-pq6), which the board reads,
|
|
611
664
|
* and `questionsEnAttente` of scripts/superviseur.mjs, the one source of the opening and of the
|
|
612
665
|
* wait of the questions.
|
|
613
|
-
* @param {{ vivant: boolean, interrompu: boolean, question: string | null, arret: string | null }} c
|
|
666
|
+
* @param {{ vivant: boolean, integre?: boolean, interrompu: boolean, question: string | null, arret: string | null }} c
|
|
614
667
|
* @returns {boolean}
|
|
615
668
|
*/
|
|
616
669
|
export const attendLeSuperviseur = c =>
|
|
617
|
-
!c.vivant &&
|
|
670
|
+
!c.vivant &&
|
|
671
|
+
!c.integre &&
|
|
672
|
+
Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
|
|
618
673
|
|
|
619
674
|
/**
|
|
620
675
|
* The key of one stop of the circuit <c>: its ticket, the run of its workflow, the rank of its
|
|
@@ -680,44 +735,6 @@ export function attenteVivante(racine) {
|
|
|
680
735
|
// The minutes between two presentations of a question not answered, by default.
|
|
681
736
|
export const RAPPEL_PAR_DEFAUT = 5;
|
|
682
737
|
|
|
683
|
-
// The reviewer's last verdict among a ticket's comments (verdictDe: a comment of the reviewer's
|
|
684
|
-
// author), or null.
|
|
685
|
-
export function verdict(commentaires) {
|
|
686
|
-
let v = null;
|
|
687
|
-
for (const c of [...commentaires].sort(
|
|
688
|
-
(a, b) => Date.parse(a.created_at) - Date.parse(b.created_at)
|
|
689
|
-
)) {
|
|
690
|
-
const lu = verdictDe(c);
|
|
691
|
-
if (lu) {
|
|
692
|
-
v = { verdict: lu, date: Date.parse(c.created_at) };
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
return v;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
// The role a ticket waits for, from the roles of the flow that ran on it (finished, oldest first)
|
|
699
|
-
// and the reviewer's last verdict; null when it waits for none: an accepted lot waits for no
|
|
700
|
-
// agent, the circuit integrates it (scripts/circuit.mjs).
|
|
701
|
-
export function etape(passages, v) {
|
|
702
|
-
const faits = passages.filter(p => etapeDuRole(p.role) && p.role !== QUESTIONNEUR);
|
|
703
|
-
const dernier = faits[faits.length - 1];
|
|
704
|
-
if (!dernier) {
|
|
705
|
-
return 'testwriter';
|
|
706
|
-
}
|
|
707
|
-
const fin = Date.parse(dernier.fin);
|
|
708
|
-
const jugé = v && v.date >= fin ? v.verdict : null;
|
|
709
|
-
if (dernier.role === 'testwriter') {
|
|
710
|
-
return 'developpeur';
|
|
711
|
-
}
|
|
712
|
-
if (dernier.role === 'developpeur') {
|
|
713
|
-
return jugé === 'ACCEPTÉ' ? null : jugé === 'RENDU' ? 'developpeur' : 'relecteur';
|
|
714
|
-
}
|
|
715
|
-
if (dernier.role === 'relecteur') {
|
|
716
|
-
return v?.verdict === 'ACCEPTÉ' ? null : 'developpeur';
|
|
717
|
-
}
|
|
718
|
-
return null;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
738
|
// A ticket's number, subject and component: its title « number — subject — component » when
|
|
722
739
|
// the number ends its id, else its id without the prefix and its whole title.
|
|
723
740
|
export function lecture(t, prefix) {
|
|
@@ -740,9 +757,10 @@ export function lecture(t, prefix) {
|
|
|
740
757
|
|
|
741
758
|
/**
|
|
742
759
|
* Who holds the lock of the machine, or waits for it, as the board shows it (`lireLaMesure` of
|
|
743
|
-
* scripts/avancement.mjs, its project named as the board names it, `nommerLesProjets`
|
|
744
|
-
*
|
|
745
|
-
*
|
|
760
|
+
* scripts/avancement.mjs, its project named as the board names it, `nommerLesProjets`; `copie`,
|
|
761
|
+
* its working tree; `ici`, it is of the board's project).
|
|
762
|
+
* @typedef {{ depot?: string | null, copie?: string | null, ici?: boolean, projet: string,
|
|
763
|
+
* ticket: string | null, sorte: string, depuis: number | null, quoi?: string,
|
|
746
764
|
* avancement?: { faits: number, prevus: number, debut?: number, dernier: number } | null }} DuVerrou
|
|
747
765
|
* @typedef {{ detenteur: DuVerrou | null, attentes: DuVerrou[] }} Machine
|
|
748
766
|
*/
|
|
@@ -751,15 +769,19 @@ export function lecture(t, prefix) {
|
|
|
751
769
|
* The board, from what was read. Pure: every source comes in, the time included; `machine`, the
|
|
752
770
|
* lock of the machine; `outil`, the failed installation of the published version that leads the
|
|
753
771
|
* repository (scripts/aiguillage.mjs `echecDeLOutil`); `places`, the places of the machine
|
|
754
|
-
* (scripts/places-de-la-machine.mjs `etatDesPlaces`), whose line heads AGENTS; `
|
|
772
|
+
* (scripts/places-de-la-machine.mjs `etatDesPlaces`), whose line heads AGENTS; `nuit`, the night
|
|
773
|
+
* under way on the machine (scripts/circuits-du-serveur.mjs `nuitDuServeur`), its line under the
|
|
774
|
+
* places'; `muet`, the Temporal
|
|
755
775
|
* server did not answer the reading of the circuits, which the first alert says; `faute`, any
|
|
756
776
|
* other fault of that reading, said in the first alert as it is; `echecPrefixe`, the cause of a
|
|
757
777
|
* ticket prefix that did not read, named in an alert.
|
|
758
778
|
* @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[], circuits?: any[],
|
|
759
|
-
*
|
|
779
|
+
* maintenant: number, jour: number,
|
|
760
780
|
* machine?: Machine | null, outil?: { version: string, raison: string } | null,
|
|
761
|
-
* places?: { prises: number, plafond: number,
|
|
762
|
-
*
|
|
781
|
+
* places?: { prises: number, plafond: number, faute?: string | null, charge: number,
|
|
782
|
+
* coeurs: number, memoireGo: number, memoireTotaleGo: number, attentes: { ticket: string,
|
|
783
|
+
* depuis: number, disque?: string | null }[] } | null,
|
|
784
|
+
* nuit?: { racine: string, depuis: number | null } | null, muet?: boolean, faute?: string | null,
|
|
763
785
|
* echecPrefixe?: string | null }} lu
|
|
764
786
|
*/
|
|
765
787
|
export function assembler({
|
|
@@ -768,17 +790,16 @@ export function assembler({
|
|
|
768
790
|
registre: lignesDuRegistre,
|
|
769
791
|
vivants,
|
|
770
792
|
circuits = [],
|
|
771
|
-
verdicts = {},
|
|
772
793
|
maintenant,
|
|
773
794
|
jour,
|
|
774
795
|
machine = null,
|
|
775
796
|
outil = null,
|
|
776
797
|
places: placesDeLaMachine = null,
|
|
798
|
+
nuit: nuitEnCours = null,
|
|
777
799
|
muet = false,
|
|
778
800
|
faute = null,
|
|
779
801
|
echecPrefixe = null,
|
|
780
802
|
remontees = [],
|
|
781
|
-
rappel = RAPPEL_PAR_DEFAUT,
|
|
782
803
|
attenteVivante: attenteQuiVit = true,
|
|
783
804
|
}) {
|
|
784
805
|
// A circuit's lines are its steps, no agent's passage.
|
|
@@ -1033,12 +1054,6 @@ export function assembler({
|
|
|
1033
1054
|
const etats = etatsDe(duChantier);
|
|
1034
1055
|
|
|
1035
1056
|
// Agents.
|
|
1036
|
-
const passages = new Map();
|
|
1037
|
-
for (const r of [...registre].sort((a, b) => Date.parse(a.fin) - Date.parse(b.fin))) {
|
|
1038
|
-
if (r.ticket) {
|
|
1039
|
-
(passages.get(r.ticket) ?? passages.set(r.ticket, []).get(r.ticket)).push(r);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
1057
|
// One block per step and sub-step, in the order of the steps, with who works there.
|
|
1043
1058
|
const blocs = SUITE.map(e => ({
|
|
1044
1059
|
numero: e.numero,
|
|
@@ -1046,20 +1061,17 @@ export function assembler({
|
|
|
1046
1061
|
roles: e.qui.filter(r => r !== AUTO),
|
|
1047
1062
|
qui: quiDe(e),
|
|
1048
1063
|
enCours: [],
|
|
1049
|
-
attend: [],
|
|
1050
1064
|
}));
|
|
1051
1065
|
const bloc = role => {
|
|
1052
1066
|
const e = etapeDuRole(role);
|
|
1053
1067
|
return e ? blocs.find(b => b.numero === e.numero) : undefined;
|
|
1054
1068
|
};
|
|
1055
|
-
const places = new Set();
|
|
1056
1069
|
// One line per ticket: a ticket on which a role agent runs stands at its step.
|
|
1057
1070
|
for (const v of enCoursMesures) {
|
|
1058
1071
|
const t = v.ticket && parId.get(v.ticket);
|
|
1059
1072
|
if (!t || !bloc(v.role)) {
|
|
1060
1073
|
continue;
|
|
1061
1074
|
}
|
|
1062
|
-
places.add(t.id);
|
|
1063
1075
|
bloc(v.role).enCours.push({
|
|
1064
1076
|
id: t.id,
|
|
1065
1077
|
numero: numero(t.id),
|
|
@@ -1071,36 +1083,6 @@ export function assembler({
|
|
|
1071
1083
|
...mesure(new Set([t.id])),
|
|
1072
1084
|
});
|
|
1073
1085
|
}
|
|
1074
|
-
// A ticket waits in AGENTS only with the owner's go (`circuit`): ready, blocked, or claimed with
|
|
1075
|
-
// nothing running; a ticket without it stands in CHANTIER alone; a ticket with a circuit, running
|
|
1076
|
-
// or stopped, stands in its circuit's entry, never waiting. The flow's deduction places the
|
|
1077
|
-
// others, and a ticket no agent took yet waits for the testwriter, the circuit's first agent.
|
|
1078
|
-
for (const t of [...tous].sort(ordre)) {
|
|
1079
|
-
if (
|
|
1080
|
-
!travail(t) ||
|
|
1081
|
-
places.has(t.id) ||
|
|
1082
|
-
parCircuit.has(t.id) ||
|
|
1083
|
-
['fermes', 'reportes', 'aValider', 'sansGo'].includes(etat(t)) ||
|
|
1084
|
-
!circuit(t)
|
|
1085
|
-
) {
|
|
1086
|
-
continue;
|
|
1087
|
-
}
|
|
1088
|
-
const p = passages.get(t.id) ?? [];
|
|
1089
|
-
// Claimed without any passage, the ticket keeps its line in its chantier.
|
|
1090
|
-
if (p.length === 0 && t.status === 'in_progress') {
|
|
1091
|
-
continue;
|
|
1092
|
-
}
|
|
1093
|
-
const r = etape(p, verdicts[t.id] ?? null);
|
|
1094
|
-
if (r && bloc(r)) {
|
|
1095
|
-
bloc(r).attend.push({
|
|
1096
|
-
id: t.id,
|
|
1097
|
-
numero: numero(t.id),
|
|
1098
|
-
sujet: titre(t).sujet,
|
|
1099
|
-
bloquePar: bloquePar(t),
|
|
1100
|
-
...mesure(new Set([t.id])),
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
1086
|
const debutJour = jour;
|
|
1105
1087
|
const faitsDuJour = tous
|
|
1106
1088
|
.filter(
|
|
@@ -1119,18 +1101,19 @@ export function assembler({
|
|
|
1119
1101
|
...mesure(new Set([t.id])),
|
|
1120
1102
|
}));
|
|
1121
1103
|
|
|
1122
|
-
// Alerts.
|
|
1104
|
+
// Alerts, each with its state (`etat`) and the tone of that state (TONS).
|
|
1123
1105
|
const alertes = [];
|
|
1106
|
+
const alerter = (etat, champs) => alertes.push({ etat, ton: TONS[etat], ...champs });
|
|
1124
1107
|
// The Temporal server does not answer: the board shows the tickets without their circuits, and
|
|
1125
1108
|
// its first alert names the command that tells the state of the service.
|
|
1126
1109
|
if (muet) {
|
|
1127
|
-
|
|
1110
|
+
alerter('panne', { texte: `${SANS_REPONSE_EN} · temporal etat` });
|
|
1128
1111
|
} else if (faute) {
|
|
1129
|
-
|
|
1112
|
+
alerter('panne', { texte: `Circuits illisibles : ${faute}` });
|
|
1130
1113
|
}
|
|
1131
1114
|
// The ticket prefix did not read: the project keeps its folder's name, and the alert says why.
|
|
1132
1115
|
if (echecPrefixe) {
|
|
1133
|
-
|
|
1116
|
+
alerter('panne', { texte: `Préfixe des tickets illisible : ${echecPrefixe}` });
|
|
1134
1117
|
}
|
|
1135
1118
|
// A red night says the night it turned red, short enough to stand whole on its line: the local
|
|
1136
1119
|
// day and month its ticket was opened, the night's date (scripts/nuit.sh), whatever its title names, a
|
|
@@ -1142,8 +1125,7 @@ export function assembler({
|
|
|
1142
1125
|
/^La nuit est rouge\b/.test(titreLu) && !Number.isNaN(ouvert)
|
|
1143
1126
|
? `Nuit rouge depuis le ${jourEtMois(ouvert)}`
|
|
1144
1127
|
: titreLu;
|
|
1145
|
-
|
|
1146
|
-
niveau: 'rouge',
|
|
1128
|
+
alerter('nuitRouge', {
|
|
1147
1129
|
signe: '🌙',
|
|
1148
1130
|
texte: `${sujet} ${n}`,
|
|
1149
1131
|
sujet,
|
|
@@ -1154,16 +1136,15 @@ export function assembler({
|
|
|
1154
1136
|
// The published version that leads the repository cannot be installed: the orchestration runs on
|
|
1155
1137
|
// the code of the repository (scripts/aiguillage.mjs).
|
|
1156
1138
|
if (outil) {
|
|
1157
|
-
|
|
1158
|
-
niveau: 'orange',
|
|
1139
|
+
alerter('outilNonInstallable', {
|
|
1159
1140
|
signe: '🧰',
|
|
1160
1141
|
texte: `Outil ${outil.version} non installable : code du dépôt`,
|
|
1161
1142
|
});
|
|
1162
1143
|
}
|
|
1163
|
-
// A circuit stopped on a question to the supervisor:
|
|
1164
|
-
// `depuis` of its stop in the file of the stops gone up)
|
|
1165
|
-
//
|
|
1166
|
-
//
|
|
1144
|
+
// A circuit stopped on a question to the supervisor: the tone of that wait, whatever its length,
|
|
1145
|
+
// and how long it has waited (from the `depuis` of its stop in the file of the stops gone up);
|
|
1146
|
+
// it falls when the circuit leaves the stop. One alert « à corriger » when some wait and no wait
|
|
1147
|
+
// lives.
|
|
1167
1148
|
const depuisDe = new Map(remontees.map(r => [r.cle, r.depuis]));
|
|
1168
1149
|
const enAttenteDuSuperviseur = [...parCircuit.values()]
|
|
1169
1150
|
.filter(attendLeSuperviseur)
|
|
@@ -1174,25 +1155,30 @@ export function assembler({
|
|
|
1174
1155
|
continue;
|
|
1175
1156
|
}
|
|
1176
1157
|
const attendu = Math.max(0, maintenant - depuis);
|
|
1177
|
-
|
|
1178
|
-
niveau: attendu > 2 * rappel * MINUTE ? 'rouge' : 'orange',
|
|
1158
|
+
alerter('attendLeSuperviseur', {
|
|
1179
1159
|
signe: '⏳',
|
|
1180
1160
|
texte: `${numero(c.ticket)} attend le superviseur depuis ${Math.floor(attendu / MINUTE)} min`,
|
|
1181
1161
|
});
|
|
1182
1162
|
}
|
|
1183
1163
|
if (enAttenteDuSuperviseur.length && !attenteQuiVit) {
|
|
1184
|
-
|
|
1185
|
-
niveau: 'rouge',
|
|
1164
|
+
alerter('sansAttente', {
|
|
1186
1165
|
signe: '🔕',
|
|
1187
1166
|
texte:
|
|
1188
1167
|
'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
|
|
1189
1168
|
});
|
|
1190
1169
|
}
|
|
1170
|
+
// The tickets of the queue without their section « ## Architecture », which the queue never
|
|
1171
|
+
// starts (scripts/file-des-tickets.mjs): one line names them all, for the supervisor to write it.
|
|
1172
|
+
const sansArchitecture = enFileSansArchitecture(tous, { enCours: new Set(parCircuit.keys()) });
|
|
1173
|
+
if (sansArchitecture.length) {
|
|
1174
|
+
alerter('sansArchitecture', {
|
|
1175
|
+
texte: `En file sans architecture : ${sansArchitecture.map(t => numero(t.id)).join(', ')}`,
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1191
1178
|
for (const b of blocs) {
|
|
1192
1179
|
for (const x of b.enCours) {
|
|
1193
1180
|
if (x.ligne && x.silence !== null && x.silence > SILENCE) {
|
|
1194
|
-
|
|
1195
|
-
niveau: 'orange',
|
|
1181
|
+
alerter('silencieux', {
|
|
1196
1182
|
texte: `${x.numero}, agent ${b.numero} silencieux depuis ${Math.round(x.silence / MINUTE)} min`,
|
|
1197
1183
|
});
|
|
1198
1184
|
}
|
|
@@ -1218,8 +1204,7 @@ export function assembler({
|
|
|
1218
1204
|
t.started_at &&
|
|
1219
1205
|
maintenant - Date.parse(t.started_at) > SANS_AGENT
|
|
1220
1206
|
) {
|
|
1221
|
-
|
|
1222
|
-
niveau: 'orange',
|
|
1207
|
+
alerter('sansRienQuiTourne', {
|
|
1223
1208
|
signe: '💤',
|
|
1224
1209
|
texte: `${numero(t.id)} en cours sans rien qui tourne`,
|
|
1225
1210
|
});
|
|
@@ -1229,8 +1214,48 @@ export function assembler({
|
|
|
1229
1214
|
const parTicket = Object.fromEntries(
|
|
1230
1215
|
[...new Set(mesures.map(m => m.ticket).filter(Boolean))].map(id => [id, mesure(new Set([id]))])
|
|
1231
1216
|
);
|
|
1232
|
-
// The
|
|
1217
|
+
// The tickets worked out of a circuit: claimed (`in_progress`), no circuit on the server that
|
|
1218
|
+
// holds them, a mother of theirs or a ticket under them (a circuit holds its ticket's mothers and
|
|
1219
|
+
// children): one that runs or waits for an answer (`attendLeSuperviseur`), never one the
|
|
1220
|
+
// supervisor stopped; or labelled `direct`, open or claimed (led out of the circuit); and no role
|
|
1221
|
+
// agent shown at a step. None while the circuits do not read (a
|
|
1222
|
+
// silent server, a fault), when no ticket can be told out of a circuit.
|
|
1223
|
+
const aUneEtape = new Set(blocs.flatMap(b => b.enCours.map(x => x.id)));
|
|
1224
|
+
const tenus = new Set(
|
|
1225
|
+
[...parCircuit.values()].filter(c => c.vivant || attendLeSuperviseur(c)).map(c => c.ticket)
|
|
1226
|
+
);
|
|
1227
|
+
const sousUnCircuit = t => tenus.has(t.id) || (enfants.get(t.id) ?? []).some(sousUnCircuit);
|
|
1228
|
+
const dansUnCircuit = t => {
|
|
1229
|
+
for (let m = parId.get(t.parent); m; m = parId.get(m.parent)) {
|
|
1230
|
+
if (tenus.has(m.id)) {
|
|
1231
|
+
return true;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
return sousUnCircuit(t);
|
|
1235
|
+
};
|
|
1236
|
+
const horsCircuit =
|
|
1237
|
+
muet || faute
|
|
1238
|
+
? []
|
|
1239
|
+
: tous
|
|
1240
|
+
.filter(
|
|
1241
|
+
t =>
|
|
1242
|
+
travail(t) &&
|
|
1243
|
+
!aUneEtape.has(t.id) &&
|
|
1244
|
+
((t.status === 'in_progress' && !dansUnCircuit(t)) ||
|
|
1245
|
+
((t.labels ?? []).includes('direct') &&
|
|
1246
|
+
(t.status === 'open' || t.status === 'in_progress')))
|
|
1247
|
+
)
|
|
1248
|
+
.sort(ordre)
|
|
1249
|
+
.map(t => ({
|
|
1250
|
+
id: t.id,
|
|
1251
|
+
numero: numero(t.id),
|
|
1252
|
+
sujet: titre(t).sujet,
|
|
1253
|
+
qui: t.assignee || null,
|
|
1254
|
+
}));
|
|
1255
|
+
// The circuits, in the tickets' order; a ticket worked in direct has its line alone.
|
|
1256
|
+
const enDirect = new Set(horsCircuit.map(x => x.id));
|
|
1233
1257
|
const lesCircuits = [...parCircuit.values()]
|
|
1258
|
+
.filter(c => !enDirect.has(c.ticket))
|
|
1234
1259
|
.sort((a, b) => ordre({ id: a.ticket }, { id: b.ticket }))
|
|
1235
1260
|
.map(c => ({
|
|
1236
1261
|
...c,
|
|
@@ -1242,12 +1267,14 @@ export function assembler({
|
|
|
1242
1267
|
global,
|
|
1243
1268
|
alertes,
|
|
1244
1269
|
circuits: lesCircuits,
|
|
1270
|
+
horsCircuit,
|
|
1245
1271
|
chantiers,
|
|
1246
1272
|
autres,
|
|
1247
1273
|
agents: blocs,
|
|
1248
1274
|
maintenant,
|
|
1249
1275
|
machine,
|
|
1250
1276
|
places: placesDeLaMachine,
|
|
1277
|
+
nuit: nuitEnCours,
|
|
1251
1278
|
faitsDuJour,
|
|
1252
1279
|
etats,
|
|
1253
1280
|
parTicket,
|
|
@@ -1374,12 +1401,12 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1374
1401
|
// The labels' column of the head and of AGENTS, « [OB] », « [OSD] ».
|
|
1375
1402
|
const large = Math.max(0, ...(t.projets ?? []).map(p => p.etiquette.length + 3));
|
|
1376
1403
|
const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
|
|
1377
|
-
L(nom.toUpperCase(),
|
|
1404
|
+
L(nom.toUpperCase(), TONS.titre);
|
|
1378
1405
|
if (plusieurs) {
|
|
1379
1406
|
// One line per project: its counters, or the fault that keeps its board out.
|
|
1380
1407
|
for (const p of t.projets) {
|
|
1381
1408
|
if (p.erreur) {
|
|
1382
|
-
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur),
|
|
1409
|
+
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur), TONS.panne);
|
|
1383
1410
|
continue;
|
|
1384
1411
|
}
|
|
1385
1412
|
const c = p.compteurs;
|
|
@@ -1399,7 +1426,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1399
1426
|
'',
|
|
1400
1427
|
largeur
|
|
1401
1428
|
),
|
|
1402
|
-
|
|
1429
|
+
TONS.mesure
|
|
1403
1430
|
);
|
|
1404
1431
|
} else {
|
|
1405
1432
|
const g = t.global;
|
|
@@ -1414,7 +1441,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1414
1441
|
);
|
|
1415
1442
|
L(
|
|
1416
1443
|
cadre(`${c.sansGo} sans go · ${c.aValider} à valider · ${c.reportes} reportés`, '', largeur),
|
|
1417
|
-
c.sansGo
|
|
1444
|
+
c.sansGo ? TONS.sansGo : c.aValider ? TONS.aValider : TONS.reportes
|
|
1418
1445
|
);
|
|
1419
1446
|
// The discoveries of the day, one count per case (grillhouse-3uv.96): always shown, at 0 when
|
|
1420
1447
|
// nothing counts, like the other head lines.
|
|
@@ -1425,7 +1452,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1425
1452
|
'',
|
|
1426
1453
|
largeur
|
|
1427
1454
|
),
|
|
1428
|
-
|
|
1455
|
+
TONS.mesure
|
|
1429
1456
|
);
|
|
1430
1457
|
L(
|
|
1431
1458
|
cadre(
|
|
@@ -1433,7 +1460,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1433
1460
|
'',
|
|
1434
1461
|
largeur
|
|
1435
1462
|
),
|
|
1436
|
-
|
|
1463
|
+
TONS.mesure
|
|
1437
1464
|
);
|
|
1438
1465
|
}
|
|
1439
1466
|
// An alert of several projects' board names its ticket by its whole id.
|
|
@@ -1443,75 +1470,136 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1443
1470
|
droite
|
|
1444
1471
|
? cadre(`${signeDe(a)} ${duProjet(a)}${a.sujet}`, droite, largeur)
|
|
1445
1472
|
: cadre(`${signeDe(a)} ${duProjet(a)}${a.texte}`, '', largeur),
|
|
1446
|
-
a.
|
|
1473
|
+
a.ton
|
|
1447
1474
|
);
|
|
1448
1475
|
}
|
|
1449
1476
|
|
|
1450
1477
|
L('', undefined);
|
|
1451
|
-
L('AGENTS ▶ en cours · en attente',
|
|
1452
|
-
// The lock of the machine (scripts/avancement.mjs `lireLaMesure`)
|
|
1453
|
-
//
|
|
1454
|
-
//
|
|
1455
|
-
//
|
|
1456
|
-
//
|
|
1457
|
-
//
|
|
1478
|
+
L('AGENTS ▶ en cours · en attente', TONS.titre);
|
|
1479
|
+
// The lock of the machine (scripts/avancement.mjs `lireLaMesure`): a holder or a wait of a
|
|
1480
|
+
// circuit shown stands on its line (`verrouDe`); any other at the head: its holder, whoever it
|
|
1481
|
+
// is, « 🔒 <sorte> · <projet> · <qui> · faits/prévus · <durée> », the time since it took the
|
|
1482
|
+
// lock, the figures when it has them; past FIGEE without a sign of its progress « ⚠ <sorte>
|
|
1483
|
+
// figée <durée> · <projet> · <qui> · faits/prévus », in the tone of an alert. Then each wait,
|
|
1484
|
+
// the oldest first, « ⏳ <sorte> · <projet> · <qui> · attend · <durée> ».
|
|
1458
1485
|
const maintenant = t.maintenant ?? Date.now();
|
|
1459
1486
|
// The places of the machine (scripts/places-de-la-machine.mjs), the first line of AGENTS:
|
|
1460
|
-
// « Places 3/3 · charge 11,2/12 · mémoire 9 Go », the places taken of the ceiling, the load
|
|
1461
|
-
// one minute of the cores, the free memory
|
|
1487
|
+
// « Places 3/3 · charge 11,2/12 · mémoire 9/30 Go », the places taken of the ceiling, the load
|
|
1488
|
+
// over one minute of the cores, the free memory of the total; a value of the ceiling the poste names and the
|
|
1489
|
+
// server refused, in place of the load and the memory, by its name.
|
|
1462
1490
|
const p = t.places;
|
|
1463
1491
|
if (p) {
|
|
1464
1492
|
const nb = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.', ','));
|
|
1465
1493
|
poser({
|
|
1466
1494
|
texte: cadre(
|
|
1467
|
-
`Places ${p.prises}/${p.plafond} · charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo} Go`,
|
|
1495
|
+
`Places ${p.prises}/${p.plafond} · ${p.faute ? `plafond refusé : ${p.faute}` : `charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo}/${p.memoireTotaleGo} Go`}`,
|
|
1468
1496
|
'',
|
|
1469
1497
|
largeur
|
|
1470
1498
|
),
|
|
1471
|
-
ton: p.charge >= p.coeurs ?
|
|
1499
|
+
ton: p.faute ? TONS.plafondRefuse : p.charge >= p.coeurs ? TONS.machineChargee : TONS.mesure,
|
|
1500
|
+
});
|
|
1501
|
+
// A ticket that waits for the disk of its project's copies: what holds it, the ticket named.
|
|
1502
|
+
for (const w of (p.attentes ?? []).filter(x => x.disque)) {
|
|
1503
|
+
poser({
|
|
1504
|
+
texte: cadre(`⏳ ${courtDuTicket(w.ticket)} · ${w.disque}`, '', largeur),
|
|
1505
|
+
ton: TONS.attendLeDisque,
|
|
1506
|
+
ticket: w.ticket,
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
// The night under way on the machine, under the places: « 🌙 nuit · <projet> · depuis <durée> »,
|
|
1511
|
+
// its project by its folder's name, the time since it started when the server gives it.
|
|
1512
|
+
if (t.nuit) {
|
|
1513
|
+
const depuis =
|
|
1514
|
+
typeof t.nuit.depuis === 'number' ? ` · depuis ${duree(maintenant - t.nuit.depuis)}` : '';
|
|
1515
|
+
poser({
|
|
1516
|
+
texte: couperAvant(`🌙 nuit · ${path.basename(t.nuit.racine)}`, depuis, '', largeur),
|
|
1517
|
+
ton: TONS.nuitEnCours,
|
|
1472
1518
|
});
|
|
1473
1519
|
}
|
|
1474
|
-
const
|
|
1520
|
+
const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
|
|
1521
|
+
const duCircuit = x => Boolean(x.ticket && enCircuit.has(x.ticket));
|
|
1522
|
+
// The project of a holder or a wait, none for the board's project on one project's board.
|
|
1523
|
+
const projetDe = x => (x.ici && !plusieurs ? null : x.projet);
|
|
1524
|
+
// What names a holder or a wait: its ticket, else the folder of its copy, the main tree's only
|
|
1525
|
+
// when the project is not named (it would say the project twice).
|
|
1526
|
+
const quiDuVerrou = x =>
|
|
1527
|
+
x.ticket
|
|
1528
|
+
? courtDuTicket(x.ticket)
|
|
1529
|
+
: x.copie && (x.copie !== x.depot || !projetDe(x))
|
|
1530
|
+
? path.basename(x.copie)
|
|
1531
|
+
: null;
|
|
1532
|
+
// A line of the lock « <tete> · <projet> · <qui><fin> », <fin> the first of <fins> that holds
|
|
1533
|
+
// (« · attend · <durée> », else « · <durée> »: ⏳ already says the wait); the project is cut
|
|
1534
|
+
// first, then left out, then <qui> is cut, never <tete> nor <fin>.
|
|
1535
|
+
const ligneDuVerrou = (tete, x, ...fins) => {
|
|
1536
|
+
const qui = quiDuVerrou(x);
|
|
1537
|
+
const avecQui = `${tete}${qui ? ` · ${qui}` : ''}`;
|
|
1538
|
+
const fin = fins.find(f => colonnes(`${avecQui}${f}`) <= largeur) ?? fins[fins.length - 1];
|
|
1539
|
+
const projet = projetDe(x);
|
|
1540
|
+
const place = largeur - colonnes(`${avecQui}${fin}`) - 3;
|
|
1541
|
+
if (projet && place >= 2) {
|
|
1542
|
+
const p = colonnes(projet) > place ? `${debutDe(projet, place - 1)}…` : projet;
|
|
1543
|
+
return `${tete} · ${p}${qui ? ` · ${qui}` : ''}${fin}`;
|
|
1544
|
+
}
|
|
1545
|
+
return couperAvant(avecQui, fin, '', largeur);
|
|
1546
|
+
};
|
|
1547
|
+
// The lock on the line of each circuit shown that holds it or waits for it, by its ticket.
|
|
1548
|
+
const verrouDe = new Map();
|
|
1475
1549
|
const tenu = t.machine?.detenteur;
|
|
1476
1550
|
if (tenu) {
|
|
1477
1551
|
const a = tenu.avancement;
|
|
1478
1552
|
const age = a ? maintenant - a.dernier : 0;
|
|
1479
1553
|
const compte = a && (a.faits || a.prevus) ? `${a.faits}/${a.prevus}` : '';
|
|
1480
1554
|
const fige = age > FIGEE;
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
),
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1555
|
+
const depuis = ilYa(maintenant - (tenu.depuis ?? maintenant));
|
|
1556
|
+
if (duCircuit(tenu)) {
|
|
1557
|
+
const sorte = tenu.sorte.toLocaleLowerCase('fr');
|
|
1558
|
+
verrouDe.set(tenu.ticket, {
|
|
1559
|
+
fige,
|
|
1560
|
+
texte: fige
|
|
1561
|
+
? ` · ⚠ ${sorte} figée ${ilYa(age)}${compte ? ` · ${compte}` : ''}`
|
|
1562
|
+
: ` · 🔒 ${sorte}${compte ? ` ${compte}` : ''} · ${depuis}`,
|
|
1563
|
+
});
|
|
1564
|
+
} else {
|
|
1565
|
+
poser({
|
|
1566
|
+
texte: fige
|
|
1567
|
+
? ligneDuVerrou(`⚠ ${tenu.sorte} figée ${ilYa(age)}`, tenu, compte ? ` · ${compte}` : '')
|
|
1568
|
+
: ligneDuVerrou(`🔒 ${tenu.sorte}`, tenu, ` · ${compte ? `${compte} · ` : ''}${depuis}`),
|
|
1569
|
+
ton: fige ? TONS.fige : TONS.enCours,
|
|
1570
|
+
avancement: true,
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1498
1573
|
}
|
|
1499
1574
|
for (const w of [...(t.machine?.attentes ?? [])].sort((x, y) => x.depuis - y.depuis)) {
|
|
1575
|
+
if (duCircuit(w)) {
|
|
1576
|
+
if (!verrouDe.has(w.ticket)) {
|
|
1577
|
+
verrouDe.set(w.ticket, {
|
|
1578
|
+
fige: false,
|
|
1579
|
+
texte: ` · ⏳ ${w.sorte.toLocaleLowerCase('fr')} · ${ilYa(maintenant - w.depuis)}`,
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
continue;
|
|
1583
|
+
}
|
|
1500
1584
|
poser({
|
|
1501
|
-
texte:
|
|
1502
|
-
`⏳ ${
|
|
1585
|
+
texte: ligneDuVerrou(
|
|
1586
|
+
`⏳ ${w.sorte}`,
|
|
1587
|
+
w,
|
|
1503
1588
|
` · attend · ${ilYa(maintenant - w.depuis)}`,
|
|
1504
|
-
|
|
1505
|
-
largeur
|
|
1589
|
+
` · ${ilYa(maintenant - w.depuis)}`
|
|
1506
1590
|
),
|
|
1507
|
-
ton:
|
|
1591
|
+
ton: TONS.attendLeVerrou,
|
|
1508
1592
|
avancement: true,
|
|
1509
1593
|
});
|
|
1510
1594
|
}
|
|
1511
1595
|
// The tickets whose circuit waits for the lock or for room.
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1596
|
+
const attendLeVerrou = new Set((t.machine?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1597
|
+
const enAttente = new Set(attendLeVerrou);
|
|
1598
|
+
// The tickets whose circuit waits for a place of the machine, and those that wait for a place of
|
|
1599
|
+
// a circuit, not started, whose line in their chantier says « attend une place ».
|
|
1514
1600
|
const attendUnePlace = new Set((p?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1601
|
+
// The tickets that wait for the disk of their project's copies.
|
|
1602
|
+
const attendLeDisque = new Set((p?.attentes ?? []).filter(w => w.disque).map(w => w.ticket));
|
|
1515
1603
|
for (const id of attendUnePlace) {
|
|
1516
1604
|
enAttente.add(id);
|
|
1517
1605
|
}
|
|
@@ -1529,7 +1617,6 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1529
1617
|
// from their second pass (`boucles` of the step, scripts/etapes.mjs, their counts in the state's
|
|
1530
1618
|
// `boucles`), whole; then its ticket's working time and tokens. Its card opens on
|
|
1531
1619
|
// its question, or says where it stopped and why. The tickets' numbers line up in one column.
|
|
1532
|
-
const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
|
|
1533
1620
|
// The block of the step <e>, an empty one when the board holds none.
|
|
1534
1621
|
const vides = new Map();
|
|
1535
1622
|
const blocDe = e =>
|
|
@@ -1541,11 +1628,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1541
1628
|
titre: e.titre,
|
|
1542
1629
|
qui: quiDe(e),
|
|
1543
1630
|
enCours: [],
|
|
1544
|
-
attend: [],
|
|
1545
1631
|
})
|
|
1546
1632
|
.get(e.numero);
|
|
1547
1633
|
// The block of the circuits at no step of the list, after the steps.
|
|
1548
|
-
const ailleurs = { numero: null, titre: '', qui: '', enCours: []
|
|
1634
|
+
const ailleurs = { numero: null, titre: '', qui: '', enCours: [] };
|
|
1549
1635
|
const etapeDe = c => etapeDuCircuit({ ...c, raison: c.arret });
|
|
1550
1636
|
// A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
|
|
1551
1637
|
// its question, the supervisor when its stop names no one.
|
|
@@ -1554,12 +1640,13 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1554
1640
|
const e = etapeDe(c);
|
|
1555
1641
|
return e ? blocDe(e) : !c.vivant ? ailleurs : undefined;
|
|
1556
1642
|
};
|
|
1557
|
-
const montres = t.agents.flatMap(b =>
|
|
1558
|
-
[...b.enCours, ...b.attend].filter(x => !enCircuit.has(x.id))
|
|
1559
|
-
);
|
|
1643
|
+
const montres = t.agents.flatMap(b => b.enCours.filter(x => !enCircuit.has(x.id)));
|
|
1560
1644
|
// A ticket's number, or on several projects' board its whole id, in one column.
|
|
1561
1645
|
const nomme = x => String(plusieurs ? x.id : x.numero);
|
|
1562
|
-
const colonne = Math.max(
|
|
1646
|
+
const colonne = Math.max(
|
|
1647
|
+
0,
|
|
1648
|
+
...[...(t.circuits ?? []), ...(t.horsCircuit ?? []), ...montres].map(x => nomme(x).length)
|
|
1649
|
+
);
|
|
1563
1650
|
// A ticket's line in AGENTS: « <signe> <numéro> <sujet> … <droite> »; on several projects'
|
|
1564
1651
|
// board « <[projet]> <id> <sujet> … <signe> <droite> », the owner's maquette (grillhouse-erp.1).
|
|
1565
1652
|
const teteDe = (signe, x) =>
|
|
@@ -1568,6 +1655,24 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1568
1655
|
: `${signe} ${nomme(x).padEnd(colonne)} `;
|
|
1569
1656
|
const droiteDe = (signe, droite) =>
|
|
1570
1657
|
plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
|
|
1658
|
+
// The state of a circuit's line, whose tone TONS gives: frozen, its question (to the supervisor
|
|
1659
|
+
// or to another), stopped, its wait for the disk, a place or the lock, else it runs.
|
|
1660
|
+
const etatDuCircuit = (c, temoin) =>
|
|
1661
|
+
temoin?.fige
|
|
1662
|
+
? 'fige'
|
|
1663
|
+
: !c.vivant
|
|
1664
|
+
? enQuestion(c) === SUPERVISEUR
|
|
1665
|
+
? 'attendLeSuperviseur'
|
|
1666
|
+
: enQuestion(c)
|
|
1667
|
+
? 'attendLeResponsable'
|
|
1668
|
+
: 'arrete'
|
|
1669
|
+
: attendLeDisque.has(c.id)
|
|
1670
|
+
? 'attendLeDisque'
|
|
1671
|
+
: attendUnePlace.has(c.id)
|
|
1672
|
+
? 'attendUnePlace'
|
|
1673
|
+
: attendLeVerrou.has(c.id)
|
|
1674
|
+
? 'attendLeVerrou'
|
|
1675
|
+
: 'enCours';
|
|
1571
1676
|
const ligneDuCircuit = c => {
|
|
1572
1677
|
const signe = !c.vivant ? '⏸' : enAttente.has(c.id) ? '⏳' : '▶';
|
|
1573
1678
|
const droite = droiteDe(
|
|
@@ -1580,7 +1685,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1580
1685
|
.map(b => ` · ${b.libelle} ${c.boucles[b.cle]}/${b.max}`)
|
|
1581
1686
|
.join('');
|
|
1582
1687
|
const tete = teteDe(signe, c);
|
|
1583
|
-
|
|
1688
|
+
// The lock it holds or waits for, else the progress of its pass.
|
|
1689
|
+
const temoin =
|
|
1690
|
+
verrouDe.get(c.id) ??
|
|
1691
|
+
(c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
|
|
1584
1692
|
// The progress after the counters of the loops while the subject keeps its room beside them,
|
|
1585
1693
|
// in their place otherwise.
|
|
1586
1694
|
const reste = avec =>
|
|
@@ -1596,7 +1704,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1596
1704
|
}${place}`;
|
|
1597
1705
|
poser({
|
|
1598
1706
|
texte: couperAvant(`${tete}${c.sujet}`, suite, droite, largeur),
|
|
1599
|
-
ton:
|
|
1707
|
+
ton: TONS[etatDuCircuit(c, temoin)],
|
|
1600
1708
|
ticket: c.id,
|
|
1601
1709
|
...(temoin ? { avancement: true } : {}),
|
|
1602
1710
|
});
|
|
@@ -1610,46 +1718,31 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1610
1718
|
.map(qui => [qui, tous.filter(c => enQuestion(c) === qui)])
|
|
1611
1719
|
.filter(([, l]) => l.length);
|
|
1612
1720
|
const enCours = b.enCours.filter(x => !enCircuit.has(x.id));
|
|
1613
|
-
const attend = b.attend.filter(x => !enCircuit.has(x.id));
|
|
1614
1721
|
return {
|
|
1615
1722
|
circuits,
|
|
1616
1723
|
enQuestions,
|
|
1617
1724
|
enCours,
|
|
1618
|
-
|
|
1619
|
-
vide: !tous.length && !enCours.length && !attend.length,
|
|
1725
|
+
vide: !tous.length && !enCours.length,
|
|
1620
1726
|
};
|
|
1621
1727
|
};
|
|
1622
1728
|
const contenus = new Map([...SUITE.map(blocDe), ailleurs].map(b => [b, contenu(b)]));
|
|
1623
|
-
// The tickets of the block <b>: its circuits without a question, its agents,
|
|
1729
|
+
// The tickets of the block <b>: its circuits without a question, its agents, then
|
|
1624
1730
|
// for each one who must answer, the line « ⤷ Question · <qui> », indented by <retrait>, and its
|
|
1625
1731
|
// circuits.
|
|
1626
1732
|
const tickets = (b, retrait) => {
|
|
1627
|
-
const { circuits, enQuestions, enCours
|
|
1733
|
+
const { circuits, enQuestions, enCours } = contenus.get(b);
|
|
1628
1734
|
for (const c of circuits) {
|
|
1629
1735
|
ligneDuCircuit(c);
|
|
1630
1736
|
}
|
|
1631
1737
|
for (const x of enCours) {
|
|
1632
1738
|
L(
|
|
1633
1739
|
cadre(`${teteDe('▶', x)}${x.sujet}`, droiteDe('▶', conso(x.travail, x.jetons)), largeur),
|
|
1634
|
-
|
|
1740
|
+
TONS.enCours,
|
|
1635
1741
|
x.id
|
|
1636
1742
|
);
|
|
1637
1743
|
}
|
|
1638
|
-
const attente = x => ({
|
|
1639
|
-
texte: cadre(
|
|
1640
|
-
`${teteDe('·', x)}${x.sujet}`,
|
|
1641
|
-
droiteDe(
|
|
1642
|
-
'·',
|
|
1643
|
-
x.bloquePar?.length ? `attend ${x.bloquePar.join(', ')}` : conso(x.travail, x.jetons)
|
|
1644
|
-
),
|
|
1645
|
-
largeur
|
|
1646
|
-
),
|
|
1647
|
-
ton: 'discret',
|
|
1648
|
-
ticket: x.id,
|
|
1649
|
-
});
|
|
1650
|
-
poser(...attend.map(attente));
|
|
1651
1744
|
for (const [qui, l] of enQuestions) {
|
|
1652
|
-
L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur),
|
|
1745
|
+
L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur), TONS.titre);
|
|
1653
1746
|
for (const c of l) {
|
|
1654
1747
|
ligneDuCircuit(c);
|
|
1655
1748
|
}
|
|
@@ -1658,8 +1751,22 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1658
1751
|
const ligneDEtape = (b, retrait, plein = !contenus.get(b).vide) =>
|
|
1659
1752
|
L(
|
|
1660
1753
|
cadre(`${retrait}${b.numero} · ${b.titre}${b.qui ? ` · ${b.qui}` : ''}`, '', largeur),
|
|
1661
|
-
plein ?
|
|
1754
|
+
plein ? TONS.titre : TONS.vide
|
|
1662
1755
|
);
|
|
1756
|
+
// The tickets worked out of a circuit, once each, before the steps, from their claim to their
|
|
1757
|
+
// close: « ✎ <numéro> <sujet> · en direct · <assignee> ».
|
|
1758
|
+
for (const x of t.horsCircuit ?? []) {
|
|
1759
|
+
poser({
|
|
1760
|
+
texte: couperAvant(
|
|
1761
|
+
`${teteDe('✎', x)}${x.sujet}`,
|
|
1762
|
+
` · en direct${x.qui ? ` · ${x.qui}` : ''}`,
|
|
1763
|
+
droiteDe('✎', ''),
|
|
1764
|
+
largeur
|
|
1765
|
+
),
|
|
1766
|
+
ton: TONS.enDirect,
|
|
1767
|
+
ticket: x.id,
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1663
1770
|
for (const e of ETAPES) {
|
|
1664
1771
|
const b = blocDe(e);
|
|
1665
1772
|
const lesSous = e.sous ?? [];
|
|
@@ -1690,13 +1797,14 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1690
1797
|
// The tickets the agents' blocks show: the chantier's tree does not show them a second time.
|
|
1691
1798
|
const dansAgents = new Set([
|
|
1692
1799
|
...(t.circuits ?? []).map(c => c.id),
|
|
1693
|
-
...t.
|
|
1800
|
+
...(t.horsCircuit ?? []).map(x => x.id),
|
|
1801
|
+
...t.agents.flatMap(b => b.enCours.map(x => x.id)),
|
|
1694
1802
|
]);
|
|
1695
1803
|
for (const ch of t.chantiers) {
|
|
1696
1804
|
L('', undefined);
|
|
1697
1805
|
poser({
|
|
1698
1806
|
texte: cadre(`CHANTIER ${duProjet(ch)}${ch.numero} — ${ch.sujet}`, '', largeur),
|
|
1699
|
-
ton:
|
|
1807
|
+
ton: TONS.titre,
|
|
1700
1808
|
ticket: ch.id,
|
|
1701
1809
|
chantier: true,
|
|
1702
1810
|
});
|
|
@@ -1706,7 +1814,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1706
1814
|
'',
|
|
1707
1815
|
largeur
|
|
1708
1816
|
),
|
|
1709
|
-
|
|
1817
|
+
TONS.mesure
|
|
1710
1818
|
);
|
|
1711
1819
|
const arbre = [];
|
|
1712
1820
|
const marque = n =>
|
|
@@ -1728,18 +1836,31 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1728
1836
|
// Every open ticket of the chantier has its line under the title of its state, the states in
|
|
1729
1837
|
// their order, the tickets in their numbers' order. A ticket an agent block shows stands there
|
|
1730
1838
|
// alone; its children keep their lines.
|
|
1839
|
+
// The state of a ticket's line, whose tone TONS gives: a ticket in the queue that waits for the
|
|
1840
|
+
// disk or a place, else its state.
|
|
1841
|
+
const etatDuNoeud = n =>
|
|
1842
|
+
!n.mere && n.etat === 'enAttente' && attendLeDisque.has(n.id)
|
|
1843
|
+
? 'attendLeDisque'
|
|
1844
|
+
: !n.mere && n.etat === 'enAttente' && attendUnePlace.has(n.id)
|
|
1845
|
+
? 'attendUnePlace'
|
|
1846
|
+
: n.etat;
|
|
1731
1847
|
const ligneDe = n => {
|
|
1732
1848
|
const conso = n.jetons ? ` · ${k(n.jetons)}` : '';
|
|
1849
|
+
const etat = etatDuNoeud(n);
|
|
1733
1850
|
const droite = n.mere
|
|
1734
1851
|
? `${n.faits}/${n.total}${conso}${n.etat === 'bloques' ? ` ${marque(n)}` : ''}`
|
|
1735
1852
|
: n.etat === 'enCours'
|
|
1736
1853
|
? `${duree(n.travail)}${conso}`
|
|
1737
1854
|
: n.etat === 'bloques'
|
|
1738
1855
|
? marque(n)
|
|
1739
|
-
: ''
|
|
1856
|
+
: etat === 'attendLeDisque'
|
|
1857
|
+
? 'attend le disque'
|
|
1858
|
+
: etat === 'attendUnePlace'
|
|
1859
|
+
? 'attend une place'
|
|
1860
|
+
: '';
|
|
1740
1861
|
return {
|
|
1741
1862
|
texte: cadre(` ${duProjet(n)}${n.numero} ${n.sujet}`, droite, largeur),
|
|
1742
|
-
ton:
|
|
1863
|
+
ton: TONS[etat],
|
|
1743
1864
|
ticket: n.id,
|
|
1744
1865
|
};
|
|
1745
1866
|
};
|
|
@@ -1760,7 +1881,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1760
1881
|
}
|
|
1761
1882
|
const titreDuGroupe = {
|
|
1762
1883
|
texte: cadre(` ${e.nom}`, `${liste.length}`, largeur),
|
|
1763
|
-
ton:
|
|
1884
|
+
ton: TONS.titre,
|
|
1764
1885
|
};
|
|
1765
1886
|
const replie =
|
|
1766
1887
|
e.cle === 'sansGo' ||
|
|
@@ -1771,7 +1892,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1771
1892
|
groupes[cle] = [titreDuGroupe, ...liste.map(ligneDe)].map(marquer);
|
|
1772
1893
|
arbre.push({
|
|
1773
1894
|
texte: cadre(` ${e.nom} ›`, `${liste.length}`, largeur),
|
|
1774
|
-
ton:
|
|
1895
|
+
ton: TONS.titre,
|
|
1775
1896
|
groupe: cle,
|
|
1776
1897
|
});
|
|
1777
1898
|
continue;
|
|
@@ -1793,16 +1914,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1793
1914
|
}));
|
|
1794
1915
|
if (t.chantiers.length) {
|
|
1795
1916
|
groupes.autres = [
|
|
1796
|
-
{ texte: cadre('AUTRES CHANTIERS', `${t.autres.length}`, largeur), ton:
|
|
1917
|
+
{ texte: cadre('AUTRES CHANTIERS', `${t.autres.length}`, largeur), ton: TONS.titre },
|
|
1797
1918
|
...autres,
|
|
1798
1919
|
].map(marquer);
|
|
1799
1920
|
poser({
|
|
1800
1921
|
texte: cadre('AUTRES CHANTIERS ›', `${t.autres.length}`, largeur),
|
|
1801
|
-
ton:
|
|
1922
|
+
ton: TONS.titre,
|
|
1802
1923
|
groupe: 'autres',
|
|
1803
1924
|
});
|
|
1804
1925
|
} else {
|
|
1805
|
-
L(cadre('CHANTIERS', `${t.autres.length}`, largeur),
|
|
1926
|
+
L(cadre('CHANTIERS', `${t.autres.length}`, largeur), TONS.titre);
|
|
1806
1927
|
poser(...autres);
|
|
1807
1928
|
}
|
|
1808
1929
|
}
|
|
@@ -1820,11 +1941,11 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1820
1941
|
`${n} ticket${n > 1 ? 's' : ''} · ${duree(temps)} · ${k(jetons)}`,
|
|
1821
1942
|
largeur
|
|
1822
1943
|
),
|
|
1823
|
-
|
|
1944
|
+
TONS.titre
|
|
1824
1945
|
);
|
|
1825
1946
|
const fait = x => ({
|
|
1826
1947
|
texte: cadre(`✓ ${duProjet(x)}${x.numero} ${x.sujet}`, conso(x.travail, x.jetons), largeur),
|
|
1827
|
-
ton:
|
|
1948
|
+
ton: TONS.fermes,
|
|
1828
1949
|
ticket: x.id,
|
|
1829
1950
|
});
|
|
1830
1951
|
poser(...t.faitsDuJour.map(fait));
|
|
@@ -1843,11 +1964,11 @@ export function lignesEtats(t, largeur = LARGEUR) {
|
|
|
1843
1964
|
}
|
|
1844
1965
|
out.push({
|
|
1845
1966
|
texte: couper(`${e.nom.toUpperCase()} — ${e.sens}`, `${e.tickets.length}`, largeur),
|
|
1846
|
-
ton:
|
|
1967
|
+
ton: TONS.titre,
|
|
1847
1968
|
section: 'etats',
|
|
1848
1969
|
});
|
|
1849
1970
|
if (!e.tickets.length) {
|
|
1850
|
-
out.push({ texte: ' —', ton:
|
|
1971
|
+
out.push({ texte: ' —', ton: TONS.vide, section: 'etats' });
|
|
1851
1972
|
}
|
|
1852
1973
|
for (const x of e.tickets) {
|
|
1853
1974
|
out.push({
|
|
@@ -1858,7 +1979,7 @@ export function lignesEtats(t, largeur = LARGEUR) {
|
|
|
1858
1979
|
: conso(t.parTicket[x.id]?.travail ?? 0, t.parTicket[x.id]?.jetons ?? 0),
|
|
1859
1980
|
largeur
|
|
1860
1981
|
),
|
|
1861
|
-
ton: e.cle
|
|
1982
|
+
ton: TONS[e.cle],
|
|
1862
1983
|
ticket: x.id,
|
|
1863
1984
|
section: 'etats',
|
|
1864
1985
|
});
|
|
@@ -2016,17 +2137,28 @@ export function dossierCommun(racine) {
|
|
|
2016
2137
|
// dir. Unversioned, out of the worktree: the board does not reset at midnight.
|
|
2017
2138
|
const fichierDuRepere = commun => commun && path.join(commun, 'tableau-repere.json');
|
|
2018
2139
|
|
|
2019
|
-
// The day's marker of the project whose common dir is <commun>: the number its file holds
|
|
2020
|
-
//
|
|
2140
|
+
// The day's marker of the project whose common dir is <commun>: the number its file holds. Without
|
|
2141
|
+
// one (no file, or no number), the first reading sets it to midnight of <maintenant> and keeps it,
|
|
2142
|
+
// so that only `grillhouse newday` moves it; a place that cannot be written gives midnight still.
|
|
2021
2143
|
export function lireLeRepere(commun, maintenant) {
|
|
2144
|
+
try {
|
|
2145
|
+
const { repere } = JSON.parse(readFileSync(fichierDuRepere(commun), 'utf8'));
|
|
2146
|
+
if (typeof repere === 'number') {
|
|
2147
|
+
return repere;
|
|
2148
|
+
}
|
|
2149
|
+
} catch {
|
|
2150
|
+
// No marker yet: set below.
|
|
2151
|
+
}
|
|
2022
2152
|
const minuit = new Date(maintenant);
|
|
2023
2153
|
minuit.setHours(0, 0, 0, 0);
|
|
2024
2154
|
try {
|
|
2025
|
-
|
|
2026
|
-
|
|
2155
|
+
if (commun) {
|
|
2156
|
+
writeFileSync(fichierDuRepere(commun), `${JSON.stringify({ repere: minuit.getTime() })}\n`);
|
|
2157
|
+
}
|
|
2027
2158
|
} catch {
|
|
2028
|
-
|
|
2159
|
+
// A read-only place keeps the board working: midnight, unkept.
|
|
2029
2160
|
}
|
|
2161
|
+
return minuit.getTime();
|
|
2030
2162
|
}
|
|
2031
2163
|
|
|
2032
2164
|
// Sets the day's marker of the project at <racine> to <quand> (now by default), purging FAITS
|
|
@@ -2045,7 +2177,16 @@ export function poserLeRepere(racine, quand = Date.now()) {
|
|
|
2045
2177
|
// shared files in (`commun`).
|
|
2046
2178
|
function lire(
|
|
2047
2179
|
racine,
|
|
2048
|
-
{
|
|
2180
|
+
{
|
|
2181
|
+
home,
|
|
2182
|
+
maintenant,
|
|
2183
|
+
circuits,
|
|
2184
|
+
muet = false,
|
|
2185
|
+
faute = null,
|
|
2186
|
+
machine = null,
|
|
2187
|
+
places = null,
|
|
2188
|
+
nuit = null,
|
|
2189
|
+
}
|
|
2049
2190
|
) {
|
|
2050
2191
|
// The prefix is read once, with no delay of its own; a read that fails leaves it empty (the
|
|
2051
2192
|
// project is labelled by its folder) and its cause is named in an alert (`echecPrefixe`).
|
|
@@ -2079,23 +2220,6 @@ function lire(
|
|
|
2079
2220
|
? lireRegistre(readFileSync(fichierRegistre, 'utf8'), racine)
|
|
2080
2221
|
: [];
|
|
2081
2222
|
const tous = bdJson(racine, 'list', '--all', '--limit', '0');
|
|
2082
|
-
// The reviewer's verdict matters once a developer or a reviewer ran: only those tickets are read.
|
|
2083
|
-
const dernier = {};
|
|
2084
|
-
for (const r of [...registre].sort((x, y) => Date.parse(x.fin) - Date.parse(y.fin))) {
|
|
2085
|
-
if (r.ticket && r.role !== QUESTIONNEUR && r.role !== ROLE_DU_CIRCUIT) {
|
|
2086
|
-
dernier[r.ticket] = r.role;
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
const verdicts = {};
|
|
2090
|
-
for (const t of tous) {
|
|
2091
|
-
if (t.status === 'closed' || !['developpeur', 'relecteur'].includes(dernier[t.id])) {
|
|
2092
|
-
continue;
|
|
2093
|
-
}
|
|
2094
|
-
const v = verdict(bdJson(racine, 'comments', t.id));
|
|
2095
|
-
if (v) {
|
|
2096
|
-
verdicts[t.id] = v;
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
2223
|
const commun = dossierCommun(racine);
|
|
2100
2224
|
const fichierCache = commun && path.join(commun, 'tableau-cache.json');
|
|
2101
2225
|
let cache = {};
|
|
@@ -2128,11 +2252,11 @@ function lire(
|
|
|
2128
2252
|
registre,
|
|
2129
2253
|
vivants,
|
|
2130
2254
|
circuits,
|
|
2131
|
-
verdicts,
|
|
2132
2255
|
maintenant,
|
|
2133
2256
|
jour: lireLeRepere(commun, maintenant),
|
|
2134
2257
|
machine,
|
|
2135
2258
|
places,
|
|
2259
|
+
nuit,
|
|
2136
2260
|
muet,
|
|
2137
2261
|
faute,
|
|
2138
2262
|
echecPrefixe,
|
|
@@ -2174,6 +2298,7 @@ export function ensemble(lus) {
|
|
|
2174
2298
|
),
|
|
2175
2299
|
alertes: tous('alertes'),
|
|
2176
2300
|
circuits: tous('circuits'),
|
|
2301
|
+
horsCircuit: tous('horsCircuit'),
|
|
2177
2302
|
chantiers: lisibles.flatMap(l => l.t.chantiers.map(noeud(l.etiquette))),
|
|
2178
2303
|
autres: tous('autres'),
|
|
2179
2304
|
agents: premier.t.agents.map(b => {
|
|
@@ -2181,11 +2306,12 @@ export function ensemble(lus) {
|
|
|
2181
2306
|
lisibles.flatMap(l =>
|
|
2182
2307
|
(l.t.agents.find(x => x.numero === b.numero)?.[cle] ?? []).map(marquer(l.etiquette))
|
|
2183
2308
|
);
|
|
2184
|
-
return { ...b, enCours: de('enCours')
|
|
2309
|
+
return { ...b, enCours: de('enCours') };
|
|
2185
2310
|
}),
|
|
2186
2311
|
maintenant: premier.t.maintenant,
|
|
2187
2312
|
machine: premier.t.machine,
|
|
2188
2313
|
places: premier.t.places,
|
|
2314
|
+
nuit: premier.t.nuit,
|
|
2189
2315
|
faitsDuJour: tous('faitsDuJour'),
|
|
2190
2316
|
decouvertes: lisibles.reduce(
|
|
2191
2317
|
(s, l) => {
|
|
@@ -2240,16 +2366,22 @@ async function lesCircuits(circuitsDe, racine) {
|
|
|
2240
2366
|
/**
|
|
2241
2367
|
* The lock of the machine <machine> with each project named as the board names it: <noms> gives
|
|
2242
2368
|
* the name of each project of the board by the root of its main tree (`depot`); a project out of
|
|
2243
|
-
* the board keeps its folder's name.
|
|
2369
|
+
* the board keeps its folder's name. A holder or a wait of the repository whose main tree is <ici>
|
|
2370
|
+
* is marked `ici`, the board's project.
|
|
2244
2371
|
* @param {Machine | null} machine
|
|
2245
2372
|
* @param {Map<string, string>} noms
|
|
2373
|
+
* @param {string | null} [ici]
|
|
2246
2374
|
* @returns {Machine | null}
|
|
2247
2375
|
*/
|
|
2248
|
-
export function nommerLesProjets(machine, noms) {
|
|
2376
|
+
export function nommerLesProjets(machine, noms, ici = null) {
|
|
2249
2377
|
if (!machine) {
|
|
2250
2378
|
return machine;
|
|
2251
2379
|
}
|
|
2252
|
-
const nommer = x => ({
|
|
2380
|
+
const nommer = x => ({
|
|
2381
|
+
...x,
|
|
2382
|
+
projet: (x.depot && noms.get(x.depot)) || x.projet,
|
|
2383
|
+
ici: Boolean(ici && x.depot === ici),
|
|
2384
|
+
});
|
|
2253
2385
|
return {
|
|
2254
2386
|
detenteur: machine.detenteur && nommer(machine.detenteur),
|
|
2255
2387
|
attentes: machine.attentes.map(nommer),
|
|
@@ -2260,11 +2392,13 @@ export function nommerLesProjets(machine, noms) {
|
|
|
2260
2392
|
// board of them all (`ensemble`), named « <dépôt> + <projet> + … », with the folder of each
|
|
2261
2393
|
// ticket's project (`dossiers`), where the pane runs Beads for it. The status line is the
|
|
2262
2394
|
// session's project's alone. Each project's circuits are read by <circuitsDe> (one call to the
|
|
2263
|
-
// Temporal server, scripts/circuits-du-serveur.mjs, by default)
|
|
2395
|
+
// Temporal server, scripts/circuits-du-serveur.mjs, by default), and the night under way on the
|
|
2396
|
+
// machine by <nuitDe> (`nuitDuServeur` by default); a night that does not read shows none.
|
|
2264
2397
|
/**
|
|
2265
2398
|
* @param {string} racine
|
|
2266
2399
|
* @param {{ home?: string, maintenant?: number, projets?: string[],
|
|
2267
|
-
* circuitsDe?: (racine: string) => Promise<object[]
|
|
2400
|
+
* circuitsDe?: (racine: string) => Promise<object[]>,
|
|
2401
|
+
* nuitDe?: () => Promise<{ racine: string, depuis: number | null } | null> }} [o]
|
|
2268
2402
|
*/
|
|
2269
2403
|
export async function tableau(
|
|
2270
2404
|
racine,
|
|
@@ -2273,9 +2407,13 @@ export async function tableau(
|
|
|
2273
2407
|
maintenant = Date.now(),
|
|
2274
2408
|
projets = [],
|
|
2275
2409
|
circuitsDe = circuitsDuServeur,
|
|
2410
|
+
nuitDe = () => nuitDuServeur(),
|
|
2276
2411
|
} = {}
|
|
2277
2412
|
) {
|
|
2278
|
-
const [{ circuits, muet, faute }, ...autres] = await Promise.all([
|
|
2413
|
+
const [nuit, { circuits, muet, faute }, ...autres] = await Promise.all([
|
|
2414
|
+
Promise.resolve()
|
|
2415
|
+
.then(nuitDe)
|
|
2416
|
+
.catch(() => null),
|
|
2279
2417
|
lesCircuits(circuitsDe, racine),
|
|
2280
2418
|
...projets.map(d => lireUnAutre(d, { home, maintenant, circuitsDe })),
|
|
2281
2419
|
]);
|
|
@@ -2289,6 +2427,7 @@ export async function tableau(
|
|
|
2289
2427
|
faute,
|
|
2290
2428
|
machine: lireLaMesure(process.env),
|
|
2291
2429
|
places: lireLesPlaces(),
|
|
2430
|
+
nuit,
|
|
2292
2431
|
}),
|
|
2293
2432
|
};
|
|
2294
2433
|
const lus = [ici, ...autres];
|
|
@@ -2301,7 +2440,8 @@ export async function tableau(
|
|
|
2301
2440
|
lus
|
|
2302
2441
|
.filter(l => l.commun)
|
|
2303
2442
|
.map(l => [path.dirname(l.commun), l === ici ? path.basename(racine) : etiquette(l)])
|
|
2304
|
-
)
|
|
2443
|
+
),
|
|
2444
|
+
ici.commun ? path.dirname(ici.commun) : null
|
|
2305
2445
|
);
|
|
2306
2446
|
const etat = ligneEtat(ici.t);
|
|
2307
2447
|
try {
|