@roomi-fields/grillhouse 0.33.1 → 0.34.1
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 +81 -0
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/acte.d.ts +7 -0
- package/dist/temporal/acte.js +19 -2
- package/dist/temporal/acte.js.map +1 -1
- 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 +7 -0
- package/dist/temporal/circuit/client.js +20 -0
- 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 +19 -0
- package/dist/temporal/circuit/contrat.js +2 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +86 -11
- package/dist/temporal/circuit/deroule.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/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 +225 -57
- package/docs/CADRE.md +6 -1
- package/docs/INTERFACE.md +24 -8
- package/hooks/crochet.mjs +17 -2
- package/hooks/hooks.json +24 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +77 -14
- 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/ci-des-branches.mjs +4 -2
- package/scripts/circuit.mjs +57 -4
- package/scripts/circuits-du-serveur.mjs +34 -1
- package/scripts/commandes-composees.mjs +11 -4
- package/scripts/copies-finies.mjs +43 -29
- package/scripts/crochets.mjs +1 -1
- 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/etapes.mjs +6 -4
- 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 +308 -10
- package/scripts/jointure.d.ts +41 -2
- package/scripts/langages/cargo/commandes.mjs +81 -12
- 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 +14 -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 +92 -0
- package/scripts/langages/typescript/tests.mjs +1 -1
- package/scripts/langages/typescript/verdict.mjs +4 -60
- package/scripts/langages/typescript/verifier.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/changements.mjs +12 -7
- 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 +179 -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 +1 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +235 -56
- package/scripts/tableau.mjs +468 -267
- package/scripts/taches-du-graphe.mjs +49 -8
- 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 +18 -15
- 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
|
|
|
@@ -144,12 +157,54 @@ export const roleDuMeta = m =>
|
|
|
144
157
|
export const ETATS = [
|
|
145
158
|
{ cle: 'enCours', nom: 'en cours', sens: 'un agent y travaille' },
|
|
146
159
|
{ cle: 'enAttente', nom: 'en attente', sens: 'ton go, prêt à partir' },
|
|
160
|
+
{ cle: 'fileDirecte', nom: 'en direct', sens: 'mené hors du circuit, pas encore pris' },
|
|
147
161
|
{ cle: 'bloques', nom: 'bloqué', sens: 'ton go, il attend un autre ticket' },
|
|
148
162
|
{ cle: 'sansGo', nom: 'sans go', sens: 'validé, il attend ton go' },
|
|
149
163
|
{ cle: 'aValider', nom: 'à valider', sens: 'une trouvaille attend ton accord' },
|
|
150
164
|
{ cle: 'reportes', nom: 'reporté', sens: 'mis de côté' },
|
|
151
165
|
{ cle: 'fermes', nom: 'fait', sens: 'fermé' },
|
|
152
166
|
];
|
|
167
|
+
// The tone of each state the board shows, defined once: as a dashboard of states (GitHub Checks,
|
|
168
|
+
// Alertmanager), the severity belongs to the state, never to its duration nor to the line that
|
|
169
|
+
// shows it; the duration stays in the text. Every line and every alert takes its tone here:
|
|
170
|
+
// `alerte` (red), what asks for a correction; `attention` (yellow), what waits for an answer or a
|
|
171
|
+
// look; `actif` (cyan), what runs; `discret`, what is done, empty or a measure; `titre`, a
|
|
172
|
+
// heading; none, a ticket at rest. The pane turns each tone into its colour (mods/grillhouse
|
|
173
|
+
// `couleur`).
|
|
174
|
+
export const TONS = Object.freeze({
|
|
175
|
+
// A ticket's state (ETATS).
|
|
176
|
+
enCours: 'actif',
|
|
177
|
+
enAttente: undefined,
|
|
178
|
+
fileDirecte: undefined,
|
|
179
|
+
bloques: undefined,
|
|
180
|
+
sansGo: 'attention',
|
|
181
|
+
aValider: 'attention',
|
|
182
|
+
reportes: undefined,
|
|
183
|
+
fermes: 'discret',
|
|
184
|
+
// A circuit, a pass, a wait.
|
|
185
|
+
attendUnePlace: 'attention',
|
|
186
|
+
attendLeVerrou: 'actif',
|
|
187
|
+
enDirect: 'actif',
|
|
188
|
+
nuitEnCours: 'actif',
|
|
189
|
+
attendLeDisque: 'attention',
|
|
190
|
+
attendLeSuperviseur: 'attention',
|
|
191
|
+
attendLeResponsable: 'attention',
|
|
192
|
+
arrete: 'attention',
|
|
193
|
+
sansRienQuiTourne: 'attention',
|
|
194
|
+
silencieux: 'attention',
|
|
195
|
+
sansArchitecture: 'attention',
|
|
196
|
+
outilNonInstallable: 'attention',
|
|
197
|
+
machineChargee: 'attention',
|
|
198
|
+
fige: 'alerte',
|
|
199
|
+
panne: 'alerte',
|
|
200
|
+
nuitRouge: 'alerte',
|
|
201
|
+
sansAttente: 'alerte',
|
|
202
|
+
plafondRefuse: 'alerte',
|
|
203
|
+
// The layout.
|
|
204
|
+
titre: 'titre',
|
|
205
|
+
vide: 'discret',
|
|
206
|
+
mesure: 'discret',
|
|
207
|
+
});
|
|
153
208
|
const enTirets = p => p.replace(/[^A-Za-z0-9]/g, '-');
|
|
154
209
|
|
|
155
210
|
// The origins of an incoming message: the person, another agent, a notification, the supervisor
|
|
@@ -682,44 +737,6 @@ export function attenteVivante(racine) {
|
|
|
682
737
|
// The minutes between two presentations of a question not answered, by default.
|
|
683
738
|
export const RAPPEL_PAR_DEFAUT = 5;
|
|
684
739
|
|
|
685
|
-
// The reviewer's last verdict among a ticket's comments (verdictDe: a comment of the reviewer's
|
|
686
|
-
// author), or null.
|
|
687
|
-
export function verdict(commentaires) {
|
|
688
|
-
let v = null;
|
|
689
|
-
for (const c of [...commentaires].sort(
|
|
690
|
-
(a, b) => Date.parse(a.created_at) - Date.parse(b.created_at)
|
|
691
|
-
)) {
|
|
692
|
-
const lu = verdictDe(c);
|
|
693
|
-
if (lu) {
|
|
694
|
-
v = { verdict: lu, date: Date.parse(c.created_at) };
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
return v;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// The role a ticket waits for, from the roles of the flow that ran on it (finished, oldest first)
|
|
701
|
-
// and the reviewer's last verdict; null when it waits for none: an accepted lot waits for no
|
|
702
|
-
// agent, the circuit integrates it (scripts/circuit.mjs).
|
|
703
|
-
export function etape(passages, v) {
|
|
704
|
-
const faits = passages.filter(p => etapeDuRole(p.role) && p.role !== QUESTIONNEUR);
|
|
705
|
-
const dernier = faits[faits.length - 1];
|
|
706
|
-
if (!dernier) {
|
|
707
|
-
return 'testwriter';
|
|
708
|
-
}
|
|
709
|
-
const fin = Date.parse(dernier.fin);
|
|
710
|
-
const jugé = v && v.date >= fin ? v.verdict : null;
|
|
711
|
-
if (dernier.role === 'testwriter') {
|
|
712
|
-
return 'developpeur';
|
|
713
|
-
}
|
|
714
|
-
if (dernier.role === 'developpeur') {
|
|
715
|
-
return jugé === 'ACCEPTÉ' ? null : jugé === 'RENDU' ? 'developpeur' : 'relecteur';
|
|
716
|
-
}
|
|
717
|
-
if (dernier.role === 'relecteur') {
|
|
718
|
-
return v?.verdict === 'ACCEPTÉ' ? null : 'developpeur';
|
|
719
|
-
}
|
|
720
|
-
return null;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
740
|
// A ticket's number, subject and component: its title « number — subject — component » when
|
|
724
741
|
// the number ends its id, else its id without the prefix and its whole title.
|
|
725
742
|
export function lecture(t, prefix) {
|
|
@@ -742,9 +759,10 @@ export function lecture(t, prefix) {
|
|
|
742
759
|
|
|
743
760
|
/**
|
|
744
761
|
* Who holds the lock of the machine, or waits for it, as the board shows it (`lireLaMesure` of
|
|
745
|
-
* scripts/avancement.mjs, its project named as the board names it, `nommerLesProjets`
|
|
746
|
-
*
|
|
747
|
-
*
|
|
762
|
+
* scripts/avancement.mjs, its project named as the board names it, `nommerLesProjets`; `copie`,
|
|
763
|
+
* its working tree; `ici`, it is of the board's project).
|
|
764
|
+
* @typedef {{ depot?: string | null, copie?: string | null, ici?: boolean, projet: string,
|
|
765
|
+
* ticket: string | null, sorte: string, depuis: number | null, quoi?: string,
|
|
748
766
|
* avancement?: { faits: number, prevus: number, debut?: number, dernier: number } | null }} DuVerrou
|
|
749
767
|
* @typedef {{ detenteur: DuVerrou | null, attentes: DuVerrou[] }} Machine
|
|
750
768
|
*/
|
|
@@ -753,16 +771,21 @@ export function lecture(t, prefix) {
|
|
|
753
771
|
* The board, from what was read. Pure: every source comes in, the time included; `machine`, the
|
|
754
772
|
* lock of the machine; `outil`, the failed installation of the published version that leads the
|
|
755
773
|
* repository (scripts/aiguillage.mjs `echecDeLOutil`); `places`, the places of the machine
|
|
756
|
-
* (scripts/places-de-la-machine.mjs `etatDesPlaces`), whose line heads AGENTS; `
|
|
774
|
+
* (scripts/places-de-la-machine.mjs `etatDesPlaces`), whose line heads AGENTS; `nuit`, the night
|
|
775
|
+
* under way on the machine (scripts/circuits-du-serveur.mjs `nuitDuServeur`), its line under the
|
|
776
|
+
* places'; `muet`, the Temporal
|
|
757
777
|
* server did not answer the reading of the circuits, which the first alert says; `faute`, any
|
|
758
778
|
* other fault of that reading, said in the first alert as it is; `echecPrefixe`, the cause of a
|
|
759
|
-
* ticket prefix that did not read, named in an alert
|
|
779
|
+
* ticket prefix that did not read, named in an alert; `voies`, the way of each circuit done
|
|
780
|
+
* (`voiesDesCircuits`), whose sign FAITS AUJOURD'HUI shows.
|
|
760
781
|
* @param {{ tous: any[], prefix?: string, registre: any[], vivants: any[], circuits?: any[],
|
|
761
|
-
*
|
|
782
|
+
* maintenant: number, jour: number,
|
|
762
783
|
* machine?: Machine | null, outil?: { version: string, raison: string } | null,
|
|
763
|
-
* places?: { prises: number, plafond: number,
|
|
764
|
-
*
|
|
765
|
-
*
|
|
784
|
+
* places?: { prises: number, plafond: number, faute?: string | null, charge: number,
|
|
785
|
+
* coeurs: number, memoireGo: number, memoireTotaleGo: number, attentes: { ticket: string,
|
|
786
|
+
* depuis: number, disque?: string | null }[] } | null,
|
|
787
|
+
* nuit?: { racine: string, depuis: number | null } | null, muet?: boolean, faute?: string | null,
|
|
788
|
+
* echecPrefixe?: string | null, voies?: Record<string, 'complet' | 'court'> }} lu
|
|
766
789
|
*/
|
|
767
790
|
export function assembler({
|
|
768
791
|
tous,
|
|
@@ -770,18 +793,18 @@ export function assembler({
|
|
|
770
793
|
registre: lignesDuRegistre,
|
|
771
794
|
vivants,
|
|
772
795
|
circuits = [],
|
|
773
|
-
verdicts = {},
|
|
774
796
|
maintenant,
|
|
775
797
|
jour,
|
|
776
798
|
machine = null,
|
|
777
799
|
outil = null,
|
|
778
800
|
places: placesDeLaMachine = null,
|
|
801
|
+
nuit: nuitEnCours = null,
|
|
779
802
|
muet = false,
|
|
780
803
|
faute = null,
|
|
781
804
|
echecPrefixe = null,
|
|
782
805
|
remontees = [],
|
|
783
|
-
rappel = RAPPEL_PAR_DEFAUT,
|
|
784
806
|
attenteVivante: attenteQuiVit = true,
|
|
807
|
+
voies = {},
|
|
785
808
|
}) {
|
|
786
809
|
// A circuit's lines are its steps, no agent's passage.
|
|
787
810
|
const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
|
|
@@ -857,6 +880,10 @@ export function assembler({
|
|
|
857
880
|
if (avalider.has(t.id)) {
|
|
858
881
|
return 'aValider';
|
|
859
882
|
}
|
|
883
|
+
// A ticket led out of the circuit, not yet claimed: the direct queue.
|
|
884
|
+
if ((t.labels ?? []).includes('direct')) {
|
|
885
|
+
return 'fileDirecte';
|
|
886
|
+
}
|
|
860
887
|
if (!circuit(t)) {
|
|
861
888
|
return 'sansGo';
|
|
862
889
|
}
|
|
@@ -867,6 +894,7 @@ export function assembler({
|
|
|
867
894
|
const compteurs = {
|
|
868
895
|
enCours: 0,
|
|
869
896
|
enAttente: 0,
|
|
897
|
+
fileDirecte: 0,
|
|
870
898
|
bloques: 0,
|
|
871
899
|
fermes: 0,
|
|
872
900
|
sansGo: 0,
|
|
@@ -1035,12 +1063,6 @@ export function assembler({
|
|
|
1035
1063
|
const etats = etatsDe(duChantier);
|
|
1036
1064
|
|
|
1037
1065
|
// Agents.
|
|
1038
|
-
const passages = new Map();
|
|
1039
|
-
for (const r of [...registre].sort((a, b) => Date.parse(a.fin) - Date.parse(b.fin))) {
|
|
1040
|
-
if (r.ticket) {
|
|
1041
|
-
(passages.get(r.ticket) ?? passages.set(r.ticket, []).get(r.ticket)).push(r);
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
1066
|
// One block per step and sub-step, in the order of the steps, with who works there.
|
|
1045
1067
|
const blocs = SUITE.map(e => ({
|
|
1046
1068
|
numero: e.numero,
|
|
@@ -1048,20 +1070,17 @@ export function assembler({
|
|
|
1048
1070
|
roles: e.qui.filter(r => r !== AUTO),
|
|
1049
1071
|
qui: quiDe(e),
|
|
1050
1072
|
enCours: [],
|
|
1051
|
-
attend: [],
|
|
1052
1073
|
}));
|
|
1053
1074
|
const bloc = role => {
|
|
1054
1075
|
const e = etapeDuRole(role);
|
|
1055
1076
|
return e ? blocs.find(b => b.numero === e.numero) : undefined;
|
|
1056
1077
|
};
|
|
1057
|
-
const places = new Set();
|
|
1058
1078
|
// One line per ticket: a ticket on which a role agent runs stands at its step.
|
|
1059
1079
|
for (const v of enCoursMesures) {
|
|
1060
1080
|
const t = v.ticket && parId.get(v.ticket);
|
|
1061
1081
|
if (!t || !bloc(v.role)) {
|
|
1062
1082
|
continue;
|
|
1063
1083
|
}
|
|
1064
|
-
places.add(t.id);
|
|
1065
1084
|
bloc(v.role).enCours.push({
|
|
1066
1085
|
id: t.id,
|
|
1067
1086
|
numero: numero(t.id),
|
|
@@ -1073,37 +1092,16 @@ export function assembler({
|
|
|
1073
1092
|
...mesure(new Set([t.id])),
|
|
1074
1093
|
});
|
|
1075
1094
|
}
|
|
1076
|
-
// A ticket waits in AGENTS only with the owner's go (`circuit`): ready, blocked, or claimed with
|
|
1077
|
-
// nothing running; a ticket without it stands in CHANTIER alone; a ticket with a circuit, running
|
|
1078
|
-
// or stopped, stands in its circuit's entry, never waiting. The flow's deduction places the
|
|
1079
|
-
// others, and a ticket no agent took yet waits for the testwriter, the circuit's first agent.
|
|
1080
|
-
for (const t of [...tous].sort(ordre)) {
|
|
1081
|
-
if (
|
|
1082
|
-
!travail(t) ||
|
|
1083
|
-
places.has(t.id) ||
|
|
1084
|
-
parCircuit.has(t.id) ||
|
|
1085
|
-
['fermes', 'reportes', 'aValider', 'sansGo'].includes(etat(t)) ||
|
|
1086
|
-
!circuit(t)
|
|
1087
|
-
) {
|
|
1088
|
-
continue;
|
|
1089
|
-
}
|
|
1090
|
-
const p = passages.get(t.id) ?? [];
|
|
1091
|
-
// Claimed without any passage, the ticket keeps its line in its chantier.
|
|
1092
|
-
if (p.length === 0 && t.status === 'in_progress') {
|
|
1093
|
-
continue;
|
|
1094
|
-
}
|
|
1095
|
-
const r = etape(p, verdicts[t.id] ?? null);
|
|
1096
|
-
if (r && bloc(r)) {
|
|
1097
|
-
bloc(r).attend.push({
|
|
1098
|
-
id: t.id,
|
|
1099
|
-
numero: numero(t.id),
|
|
1100
|
-
sujet: titre(t).sujet,
|
|
1101
|
-
bloquePar: bloquePar(t),
|
|
1102
|
-
...mesure(new Set([t.id])),
|
|
1103
|
-
});
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
1095
|
const debutJour = jour;
|
|
1096
|
+
// The way of a ticket done (grillhouse-592): `direct` when labelled so; else the way its kept
|
|
1097
|
+
// results give (`voies`, `voiesDesCircuits`: `court` through 1.1, else `complet`); else
|
|
1098
|
+
// `complet` when a circuit led a step of it (the register) or is read for it; else `direct`,
|
|
1099
|
+
// closed with no circuit.
|
|
1100
|
+
const parUnCircuit = new Set([...etapesFinies.map(r => r.ticket), ...parCircuit.keys()]);
|
|
1101
|
+
const voieDe = t =>
|
|
1102
|
+
(t.labels ?? []).includes('direct')
|
|
1103
|
+
? 'direct'
|
|
1104
|
+
: (voies[t.id] ?? (parUnCircuit.has(t.id) ? 'complet' : 'direct'));
|
|
1107
1105
|
const faitsDuJour = tous
|
|
1108
1106
|
.filter(
|
|
1109
1107
|
t =>
|
|
@@ -1114,25 +1112,34 @@ export function assembler({
|
|
|
1114
1112
|
Date.parse(t.closed_at) >= debutJour
|
|
1115
1113
|
)
|
|
1116
1114
|
.sort((a, b) => Date.parse(b.closed_at) - Date.parse(a.closed_at))
|
|
1117
|
-
.map(t =>
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1115
|
+
.map(t => {
|
|
1116
|
+
const m = mesure(new Set([t.id]));
|
|
1117
|
+
const voie = voieDe(t);
|
|
1118
|
+
// A circuit's time is its agents' and steps' working time; a direct ticket's runs from its
|
|
1119
|
+
// claim to its close, null without a claim.
|
|
1120
|
+
const pris = Date.parse(t.started_at ?? '');
|
|
1121
|
+
const dure =
|
|
1122
|
+
voie !== 'direct'
|
|
1123
|
+
? m.travail
|
|
1124
|
+
: Number.isFinite(pris)
|
|
1125
|
+
? Date.parse(t.closed_at) - pris
|
|
1126
|
+
: null;
|
|
1127
|
+
return { id: t.id, numero: numero(t.id), sujet: titre(t).sujet, voie, duree: dure, ...m };
|
|
1128
|
+
});
|
|
1123
1129
|
|
|
1124
|
-
// Alerts.
|
|
1130
|
+
// Alerts, each with its state (`etat`) and the tone of that state (TONS).
|
|
1125
1131
|
const alertes = [];
|
|
1132
|
+
const alerter = (etat, champs) => alertes.push({ etat, ton: TONS[etat], ...champs });
|
|
1126
1133
|
// The Temporal server does not answer: the board shows the tickets without their circuits, and
|
|
1127
1134
|
// its first alert names the command that tells the state of the service.
|
|
1128
1135
|
if (muet) {
|
|
1129
|
-
|
|
1136
|
+
alerter('panne', { texte: `${SANS_REPONSE_EN} · temporal etat` });
|
|
1130
1137
|
} else if (faute) {
|
|
1131
|
-
|
|
1138
|
+
alerter('panne', { texte: `Circuits illisibles : ${faute}` });
|
|
1132
1139
|
}
|
|
1133
1140
|
// The ticket prefix did not read: the project keeps its folder's name, and the alert says why.
|
|
1134
1141
|
if (echecPrefixe) {
|
|
1135
|
-
|
|
1142
|
+
alerter('panne', { texte: `Préfixe des tickets illisible : ${echecPrefixe}` });
|
|
1136
1143
|
}
|
|
1137
1144
|
// A red night says the night it turned red, short enough to stand whole on its line: the local
|
|
1138
1145
|
// day and month its ticket was opened, the night's date (scripts/nuit.sh), whatever its title names, a
|
|
@@ -1144,8 +1151,7 @@ export function assembler({
|
|
|
1144
1151
|
/^La nuit est rouge\b/.test(titreLu) && !Number.isNaN(ouvert)
|
|
1145
1152
|
? `Nuit rouge depuis le ${jourEtMois(ouvert)}`
|
|
1146
1153
|
: titreLu;
|
|
1147
|
-
|
|
1148
|
-
niveau: 'rouge',
|
|
1154
|
+
alerter('nuitRouge', {
|
|
1149
1155
|
signe: '🌙',
|
|
1150
1156
|
texte: `${sujet} ${n}`,
|
|
1151
1157
|
sujet,
|
|
@@ -1156,16 +1162,15 @@ export function assembler({
|
|
|
1156
1162
|
// The published version that leads the repository cannot be installed: the orchestration runs on
|
|
1157
1163
|
// the code of the repository (scripts/aiguillage.mjs).
|
|
1158
1164
|
if (outil) {
|
|
1159
|
-
|
|
1160
|
-
niveau: 'orange',
|
|
1165
|
+
alerter('outilNonInstallable', {
|
|
1161
1166
|
signe: '🧰',
|
|
1162
1167
|
texte: `Outil ${outil.version} non installable : code du dépôt`,
|
|
1163
1168
|
});
|
|
1164
1169
|
}
|
|
1165
|
-
// A circuit stopped on a question to the supervisor:
|
|
1166
|
-
// `depuis` of its stop in the file of the stops gone up)
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1170
|
+
// A circuit stopped on a question to the supervisor: the tone of that wait, whatever its length,
|
|
1171
|
+
// and how long it has waited (from the `depuis` of its stop in the file of the stops gone up);
|
|
1172
|
+
// it falls when the circuit leaves the stop. One alert « à corriger » when some wait and no wait
|
|
1173
|
+
// lives.
|
|
1169
1174
|
const depuisDe = new Map(remontees.map(r => [r.cle, r.depuis]));
|
|
1170
1175
|
const enAttenteDuSuperviseur = [...parCircuit.values()]
|
|
1171
1176
|
.filter(attendLeSuperviseur)
|
|
@@ -1176,25 +1181,30 @@ export function assembler({
|
|
|
1176
1181
|
continue;
|
|
1177
1182
|
}
|
|
1178
1183
|
const attendu = Math.max(0, maintenant - depuis);
|
|
1179
|
-
|
|
1180
|
-
niveau: attendu > 2 * rappel * MINUTE ? 'rouge' : 'orange',
|
|
1184
|
+
alerter('attendLeSuperviseur', {
|
|
1181
1185
|
signe: '⏳',
|
|
1182
1186
|
texte: `${numero(c.ticket)} attend le superviseur depuis ${Math.floor(attendu / MINUTE)} min`,
|
|
1183
1187
|
});
|
|
1184
1188
|
}
|
|
1185
1189
|
if (enAttenteDuSuperviseur.length && !attenteQuiVit) {
|
|
1186
|
-
|
|
1187
|
-
niveau: 'rouge',
|
|
1190
|
+
alerter('sansAttente', {
|
|
1188
1191
|
signe: '🔕',
|
|
1189
1192
|
texte:
|
|
1190
1193
|
'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
|
|
1191
1194
|
});
|
|
1192
1195
|
}
|
|
1196
|
+
// The tickets of the queue without their section « ## Architecture », which the queue never
|
|
1197
|
+
// starts (scripts/file-des-tickets.mjs): one line names them all, for the supervisor to write it.
|
|
1198
|
+
const sansArchitecture = enFileSansArchitecture(tous, { enCours: new Set(parCircuit.keys()) });
|
|
1199
|
+
if (sansArchitecture.length) {
|
|
1200
|
+
alerter('sansArchitecture', {
|
|
1201
|
+
texte: `En file sans architecture : ${sansArchitecture.map(t => numero(t.id)).join(', ')}`,
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1193
1204
|
for (const b of blocs) {
|
|
1194
1205
|
for (const x of b.enCours) {
|
|
1195
1206
|
if (x.ligne && x.silence !== null && x.silence > SILENCE) {
|
|
1196
|
-
|
|
1197
|
-
niveau: 'orange',
|
|
1207
|
+
alerter('silencieux', {
|
|
1198
1208
|
texte: `${x.numero}, agent ${b.numero} silencieux depuis ${Math.round(x.silence / MINUTE)} min`,
|
|
1199
1209
|
});
|
|
1200
1210
|
}
|
|
@@ -1220,8 +1230,7 @@ export function assembler({
|
|
|
1220
1230
|
t.started_at &&
|
|
1221
1231
|
maintenant - Date.parse(t.started_at) > SANS_AGENT
|
|
1222
1232
|
) {
|
|
1223
|
-
|
|
1224
|
-
niveau: 'orange',
|
|
1233
|
+
alerter('sansRienQuiTourne', {
|
|
1225
1234
|
signe: '💤',
|
|
1226
1235
|
texte: `${numero(t.id)} en cours sans rien qui tourne`,
|
|
1227
1236
|
});
|
|
@@ -1231,8 +1240,46 @@ export function assembler({
|
|
|
1231
1240
|
const parTicket = Object.fromEntries(
|
|
1232
1241
|
[...new Set(mesures.map(m => m.ticket).filter(Boolean))].map(id => [id, mesure(new Set([id]))])
|
|
1233
1242
|
);
|
|
1234
|
-
// The
|
|
1243
|
+
// The tickets worked out of a circuit: claimed (`in_progress`), no circuit on the server that
|
|
1244
|
+
// holds them, a mother of theirs or a ticket under them (a circuit holds its ticket's mothers and
|
|
1245
|
+
// children): one that runs or waits for an answer (`attendLeSuperviseur`), never one the
|
|
1246
|
+
// supervisor stopped; or labelled `direct` and claimed (led out of the circuit); and no role
|
|
1247
|
+
// agent shown at a step. None while the circuits do not read (a
|
|
1248
|
+
// silent server, a fault), when no ticket can be told out of a circuit.
|
|
1249
|
+
const aUneEtape = new Set(blocs.flatMap(b => b.enCours.map(x => x.id)));
|
|
1250
|
+
const tenus = new Set(
|
|
1251
|
+
[...parCircuit.values()].filter(c => c.vivant || attendLeSuperviseur(c)).map(c => c.ticket)
|
|
1252
|
+
);
|
|
1253
|
+
const sousUnCircuit = t => tenus.has(t.id) || (enfants.get(t.id) ?? []).some(sousUnCircuit);
|
|
1254
|
+
const dansUnCircuit = t => {
|
|
1255
|
+
for (let m = parId.get(t.parent); m; m = parId.get(m.parent)) {
|
|
1256
|
+
if (tenus.has(m.id)) {
|
|
1257
|
+
return true;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
return sousUnCircuit(t);
|
|
1261
|
+
};
|
|
1262
|
+
const horsCircuit =
|
|
1263
|
+
muet || faute
|
|
1264
|
+
? []
|
|
1265
|
+
: tous
|
|
1266
|
+
.filter(
|
|
1267
|
+
t =>
|
|
1268
|
+
travail(t) &&
|
|
1269
|
+
!aUneEtape.has(t.id) &&
|
|
1270
|
+
t.status === 'in_progress' &&
|
|
1271
|
+
(!dansUnCircuit(t) || (t.labels ?? []).includes('direct'))
|
|
1272
|
+
)
|
|
1273
|
+
.sort(ordre)
|
|
1274
|
+
.map(t => ({
|
|
1275
|
+
id: t.id,
|
|
1276
|
+
numero: numero(t.id),
|
|
1277
|
+
sujet: titre(t).sujet,
|
|
1278
|
+
}));
|
|
1279
|
+
// The circuits, in the tickets' order; a ticket worked in direct has its line alone.
|
|
1280
|
+
const enDirect = new Set(horsCircuit.map(x => x.id));
|
|
1235
1281
|
const lesCircuits = [...parCircuit.values()]
|
|
1282
|
+
.filter(c => !enDirect.has(c.ticket))
|
|
1236
1283
|
.sort((a, b) => ordre({ id: a.ticket }, { id: b.ticket }))
|
|
1237
1284
|
.map(c => ({
|
|
1238
1285
|
...c,
|
|
@@ -1244,12 +1291,14 @@ export function assembler({
|
|
|
1244
1291
|
global,
|
|
1245
1292
|
alertes,
|
|
1246
1293
|
circuits: lesCircuits,
|
|
1294
|
+
horsCircuit,
|
|
1247
1295
|
chantiers,
|
|
1248
1296
|
autres,
|
|
1249
1297
|
agents: blocs,
|
|
1250
1298
|
maintenant,
|
|
1251
1299
|
machine,
|
|
1252
1300
|
places: placesDeLaMachine,
|
|
1301
|
+
nuit: nuitEnCours,
|
|
1253
1302
|
faitsDuJour,
|
|
1254
1303
|
etats,
|
|
1255
1304
|
parTicket,
|
|
@@ -1305,6 +1354,41 @@ function temoinDe(c, maintenant) {
|
|
|
1305
1354
|
}
|
|
1306
1355
|
|
|
1307
1356
|
// A ticket's time and tokens, « 12 min · 310 k »; nothing when both are zero.
|
|
1357
|
+
// The sign of a ticket done by its way (grillhouse-592): a full circuit, a short one (1.1 Geste
|
|
1358
|
+
// mécanique), a ticket led directly.
|
|
1359
|
+
export const SIGNE_DE_LA_VOIE = Object.freeze({ complet: '●', court: '○', direct: '✎' });
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* The way of the circuit each ticket of <tickets> went, read from its kept results in the main tree
|
|
1363
|
+
* <racine> (`.claude/worktrees/<ticket>.fiches.jsonl`, which the circuit writes and keeps once the
|
|
1364
|
+
* ticket is done): `court` when the launch of a session carries the object `geste` (1.1 Geste
|
|
1365
|
+
* mécanique), else `complet`; a ticket without the file has no entry. A line that does not parse
|
|
1366
|
+
* counts nothing.
|
|
1367
|
+
* @param {string} racine
|
|
1368
|
+
* @param {string[]} tickets
|
|
1369
|
+
* @returns {Record<string, 'complet' | 'court'>}
|
|
1370
|
+
*/
|
|
1371
|
+
export function voiesDesCircuits(racine, tickets) {
|
|
1372
|
+
const out = {};
|
|
1373
|
+
for (const id of tickets) {
|
|
1374
|
+
let texte;
|
|
1375
|
+
try {
|
|
1376
|
+
texte = readFileSync(path.join(racine, '.claude', 'worktrees', `${id}.fiches.jsonl`), 'utf8');
|
|
1377
|
+
} catch {
|
|
1378
|
+
continue;
|
|
1379
|
+
}
|
|
1380
|
+
const geste = texte.split('\n').some(l => {
|
|
1381
|
+
try {
|
|
1382
|
+
return JSON.parse(l)?.lancement?.objet === 'geste';
|
|
1383
|
+
} catch {
|
|
1384
|
+
return false;
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
out[id] = geste ? 'court' : 'complet';
|
|
1388
|
+
}
|
|
1389
|
+
return out;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1308
1392
|
const conso = (ms, jetons) =>
|
|
1309
1393
|
Math.round(ms / MINUTE) === 0 && !jetons ? '' : `${duree(ms)} · ${k(jetons)}`;
|
|
1310
1394
|
|
|
@@ -1376,18 +1460,18 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1376
1460
|
// The labels' column of the head and of AGENTS, « [OB] », « [OSD] ».
|
|
1377
1461
|
const large = Math.max(0, ...(t.projets ?? []).map(p => p.etiquette.length + 3));
|
|
1378
1462
|
const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
|
|
1379
|
-
L(nom.toUpperCase(),
|
|
1463
|
+
L(nom.toUpperCase(), TONS.titre);
|
|
1380
1464
|
if (plusieurs) {
|
|
1381
1465
|
// One line per project: its counters, or the fault that keeps its board out.
|
|
1382
1466
|
for (const p of t.projets) {
|
|
1383
1467
|
if (p.erreur) {
|
|
1384
|
-
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur),
|
|
1468
|
+
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur), TONS.panne);
|
|
1385
1469
|
continue;
|
|
1386
1470
|
}
|
|
1387
1471
|
const c = p.compteurs;
|
|
1388
1472
|
L(
|
|
1389
1473
|
cadre(
|
|
1390
|
-
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours · ${c.enAttente}
|
|
1474
|
+
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours · ⏭ ${c.enAttente} · ✎ ${c.fileDirecte ?? 0} · ${c.fermes} faits`,
|
|
1391
1475
|
'',
|
|
1392
1476
|
largeur
|
|
1393
1477
|
)
|
|
@@ -1401,22 +1485,18 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1401
1485
|
'',
|
|
1402
1486
|
largeur
|
|
1403
1487
|
),
|
|
1404
|
-
|
|
1488
|
+
TONS.mesure
|
|
1405
1489
|
);
|
|
1406
1490
|
} else {
|
|
1407
1491
|
const g = t.global;
|
|
1408
1492
|
const c = g.compteurs;
|
|
1409
|
-
//
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
'',
|
|
1414
|
-
largeur
|
|
1415
|
-
)
|
|
1416
|
-
);
|
|
1493
|
+
// Three lines of states: the work, the queues (the circuit's, the direct one), then those that
|
|
1494
|
+
// wait for the owner.
|
|
1495
|
+
L(cadre(`▶ ${c.enCours} en cours · ${c.bloques} bloqués · ${c.fermes} faits`, '', largeur));
|
|
1496
|
+
L(cadre(`⏭ file : ${c.enAttente} en circuit · ${c.fileDirecte} en direct`, '', largeur));
|
|
1417
1497
|
L(
|
|
1418
1498
|
cadre(`${c.sansGo} sans go · ${c.aValider} à valider · ${c.reportes} reportés`, '', largeur),
|
|
1419
|
-
c.sansGo
|
|
1499
|
+
c.sansGo ? TONS.sansGo : c.aValider ? TONS.aValider : TONS.reportes
|
|
1420
1500
|
);
|
|
1421
1501
|
// The discoveries of the day, one count per case (grillhouse-3uv.96): always shown, at 0 when
|
|
1422
1502
|
// nothing counts, like the other head lines.
|
|
@@ -1427,7 +1507,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1427
1507
|
'',
|
|
1428
1508
|
largeur
|
|
1429
1509
|
),
|
|
1430
|
-
|
|
1510
|
+
TONS.mesure
|
|
1431
1511
|
);
|
|
1432
1512
|
L(
|
|
1433
1513
|
cadre(
|
|
@@ -1435,7 +1515,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1435
1515
|
'',
|
|
1436
1516
|
largeur
|
|
1437
1517
|
),
|
|
1438
|
-
|
|
1518
|
+
TONS.mesure
|
|
1439
1519
|
);
|
|
1440
1520
|
}
|
|
1441
1521
|
// An alert of several projects' board names its ticket by its whole id.
|
|
@@ -1445,75 +1525,136 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1445
1525
|
droite
|
|
1446
1526
|
? cadre(`${signeDe(a)} ${duProjet(a)}${a.sujet}`, droite, largeur)
|
|
1447
1527
|
: cadre(`${signeDe(a)} ${duProjet(a)}${a.texte}`, '', largeur),
|
|
1448
|
-
a.
|
|
1528
|
+
a.ton
|
|
1449
1529
|
);
|
|
1450
1530
|
}
|
|
1451
1531
|
|
|
1452
1532
|
L('', undefined);
|
|
1453
|
-
L('AGENTS ▶ en cours · en attente',
|
|
1454
|
-
// The lock of the machine (scripts/avancement.mjs `lireLaMesure`)
|
|
1455
|
-
//
|
|
1456
|
-
//
|
|
1457
|
-
//
|
|
1458
|
-
//
|
|
1459
|
-
//
|
|
1533
|
+
L('AGENTS ▶ en cours · en attente', TONS.titre);
|
|
1534
|
+
// The lock of the machine (scripts/avancement.mjs `lireLaMesure`): a holder or a wait of a
|
|
1535
|
+
// circuit shown stands on its line (`verrouDe`); any other at the head: its holder, whoever it
|
|
1536
|
+
// is, « 🔒 <sorte> · <projet> · <qui> · faits/prévus · <durée> », the time since it took the
|
|
1537
|
+
// lock, the figures when it has them; past FIGEE without a sign of its progress « ⚠ <sorte>
|
|
1538
|
+
// figée <durée> · <projet> · <qui> · faits/prévus », in the tone of an alert. Then each wait,
|
|
1539
|
+
// the oldest first, « ⏳ <sorte> · <projet> · <qui> · attend · <durée> ».
|
|
1460
1540
|
const maintenant = t.maintenant ?? Date.now();
|
|
1461
1541
|
// The places of the machine (scripts/places-de-la-machine.mjs), the first line of AGENTS:
|
|
1462
|
-
// « Places 3/3 · charge 11,2/12 · mémoire 9 Go », the places taken of the ceiling, the load
|
|
1463
|
-
// one minute of the cores, the free memory
|
|
1542
|
+
// « Places 3/3 · charge 11,2/12 · mémoire 9/30 Go », the places taken of the ceiling, the load
|
|
1543
|
+
// over one minute of the cores, the free memory of the total; a value of the ceiling the poste names and the
|
|
1544
|
+
// server refused, in place of the load and the memory, by its name.
|
|
1464
1545
|
const p = t.places;
|
|
1465
1546
|
if (p) {
|
|
1466
1547
|
const nb = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.', ','));
|
|
1467
1548
|
poser({
|
|
1468
1549
|
texte: cadre(
|
|
1469
|
-
`Places ${p.prises}/${p.plafond} · charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo} Go`,
|
|
1550
|
+
`Places ${p.prises}/${p.plafond} · ${p.faute ? `plafond refusé : ${p.faute}` : `charge ${nb(p.charge)}/${p.coeurs} · mémoire ${p.memoireGo}/${p.memoireTotaleGo} Go`}`,
|
|
1470
1551
|
'',
|
|
1471
1552
|
largeur
|
|
1472
1553
|
),
|
|
1473
|
-
ton: p.charge >= p.coeurs ?
|
|
1554
|
+
ton: p.faute ? TONS.plafondRefuse : p.charge >= p.coeurs ? TONS.machineChargee : TONS.mesure,
|
|
1555
|
+
});
|
|
1556
|
+
// A ticket that waits for the disk of its project's copies: what holds it, the ticket named.
|
|
1557
|
+
for (const w of (p.attentes ?? []).filter(x => x.disque)) {
|
|
1558
|
+
poser({
|
|
1559
|
+
texte: cadre(`⏳ ${courtDuTicket(w.ticket)} · ${w.disque}`, '', largeur),
|
|
1560
|
+
ton: TONS.attendLeDisque,
|
|
1561
|
+
ticket: w.ticket,
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
// The night under way on the machine, under the places: « 🌙 nuit · <projet> · depuis <durée> »,
|
|
1566
|
+
// its project by its folder's name, the time since it started when the server gives it.
|
|
1567
|
+
if (t.nuit) {
|
|
1568
|
+
const depuis =
|
|
1569
|
+
typeof t.nuit.depuis === 'number' ? ` · depuis ${duree(maintenant - t.nuit.depuis)}` : '';
|
|
1570
|
+
poser({
|
|
1571
|
+
texte: couperAvant(`🌙 nuit · ${path.basename(t.nuit.racine)}`, depuis, '', largeur),
|
|
1572
|
+
ton: TONS.nuitEnCours,
|
|
1474
1573
|
});
|
|
1475
1574
|
}
|
|
1476
|
-
const
|
|
1575
|
+
const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
|
|
1576
|
+
const duCircuit = x => Boolean(x.ticket && enCircuit.has(x.ticket));
|
|
1577
|
+
// The project of a holder or a wait, none for the board's project on one project's board.
|
|
1578
|
+
const projetDe = x => (x.ici && !plusieurs ? null : x.projet);
|
|
1579
|
+
// What names a holder or a wait: its ticket, else the folder of its copy, the main tree's only
|
|
1580
|
+
// when the project is not named (it would say the project twice).
|
|
1581
|
+
const quiDuVerrou = x =>
|
|
1582
|
+
x.ticket
|
|
1583
|
+
? courtDuTicket(x.ticket)
|
|
1584
|
+
: x.copie && (x.copie !== x.depot || !projetDe(x))
|
|
1585
|
+
? path.basename(x.copie)
|
|
1586
|
+
: null;
|
|
1587
|
+
// A line of the lock « <tete> · <projet> · <qui><fin> », <fin> the first of <fins> that holds
|
|
1588
|
+
// (« · attend · <durée> », else « · <durée> »: ⏳ already says the wait); the project is cut
|
|
1589
|
+
// first, then left out, then <qui> is cut, never <tete> nor <fin>.
|
|
1590
|
+
const ligneDuVerrou = (tete, x, ...fins) => {
|
|
1591
|
+
const qui = quiDuVerrou(x);
|
|
1592
|
+
const avecQui = `${tete}${qui ? ` · ${qui}` : ''}`;
|
|
1593
|
+
const fin = fins.find(f => colonnes(`${avecQui}${f}`) <= largeur) ?? fins[fins.length - 1];
|
|
1594
|
+
const projet = projetDe(x);
|
|
1595
|
+
const place = largeur - colonnes(`${avecQui}${fin}`) - 3;
|
|
1596
|
+
if (projet && place >= 2) {
|
|
1597
|
+
const p = colonnes(projet) > place ? `${debutDe(projet, place - 1)}…` : projet;
|
|
1598
|
+
return `${tete} · ${p}${qui ? ` · ${qui}` : ''}${fin}`;
|
|
1599
|
+
}
|
|
1600
|
+
return couperAvant(avecQui, fin, '', largeur);
|
|
1601
|
+
};
|
|
1602
|
+
// The lock on the line of each circuit shown that holds it or waits for it, by its ticket.
|
|
1603
|
+
const verrouDe = new Map();
|
|
1477
1604
|
const tenu = t.machine?.detenteur;
|
|
1478
1605
|
if (tenu) {
|
|
1479
1606
|
const a = tenu.avancement;
|
|
1480
1607
|
const age = a ? maintenant - a.dernier : 0;
|
|
1481
1608
|
const compte = a && (a.faits || a.prevus) ? `${a.faits}/${a.prevus}` : '';
|
|
1482
1609
|
const fige = age > FIGEE;
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
),
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1610
|
+
const depuis = ilYa(maintenant - (tenu.depuis ?? maintenant));
|
|
1611
|
+
if (duCircuit(tenu)) {
|
|
1612
|
+
const sorte = tenu.sorte.toLocaleLowerCase('fr');
|
|
1613
|
+
verrouDe.set(tenu.ticket, {
|
|
1614
|
+
fige,
|
|
1615
|
+
texte: fige
|
|
1616
|
+
? ` · ⚠ ${sorte} figée ${ilYa(age)}${compte ? ` · ${compte}` : ''}`
|
|
1617
|
+
: ` · 🔒 ${sorte}${compte ? ` ${compte}` : ''} · ${depuis}`,
|
|
1618
|
+
});
|
|
1619
|
+
} else {
|
|
1620
|
+
poser({
|
|
1621
|
+
texte: fige
|
|
1622
|
+
? ligneDuVerrou(`⚠ ${tenu.sorte} figée ${ilYa(age)}`, tenu, compte ? ` · ${compte}` : '')
|
|
1623
|
+
: ligneDuVerrou(`🔒 ${tenu.sorte}`, tenu, ` · ${compte ? `${compte} · ` : ''}${depuis}`),
|
|
1624
|
+
ton: fige ? TONS.fige : TONS.enCours,
|
|
1625
|
+
avancement: true,
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1500
1628
|
}
|
|
1501
1629
|
for (const w of [...(t.machine?.attentes ?? [])].sort((x, y) => x.depuis - y.depuis)) {
|
|
1630
|
+
if (duCircuit(w)) {
|
|
1631
|
+
if (!verrouDe.has(w.ticket)) {
|
|
1632
|
+
verrouDe.set(w.ticket, {
|
|
1633
|
+
fige: false,
|
|
1634
|
+
texte: ` · ⏳ ${w.sorte.toLocaleLowerCase('fr')} · ${ilYa(maintenant - w.depuis)}`,
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
continue;
|
|
1638
|
+
}
|
|
1502
1639
|
poser({
|
|
1503
|
-
texte:
|
|
1504
|
-
`⏳ ${
|
|
1640
|
+
texte: ligneDuVerrou(
|
|
1641
|
+
`⏳ ${w.sorte}`,
|
|
1642
|
+
w,
|
|
1505
1643
|
` · attend · ${ilYa(maintenant - w.depuis)}`,
|
|
1506
|
-
|
|
1507
|
-
largeur
|
|
1644
|
+
` · ${ilYa(maintenant - w.depuis)}`
|
|
1508
1645
|
),
|
|
1509
|
-
ton:
|
|
1646
|
+
ton: TONS.attendLeVerrou,
|
|
1510
1647
|
avancement: true,
|
|
1511
1648
|
});
|
|
1512
1649
|
}
|
|
1513
1650
|
// The tickets whose circuit waits for the lock or for room.
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1651
|
+
const attendLeVerrou = new Set((t.machine?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1652
|
+
const enAttente = new Set(attendLeVerrou);
|
|
1653
|
+
// The tickets whose circuit waits for a place of the machine, and those that wait for a place of
|
|
1654
|
+
// a circuit, not started, whose line in their chantier says « attend une place ».
|
|
1516
1655
|
const attendUnePlace = new Set((p?.attentes ?? []).map(w => w.ticket).filter(Boolean));
|
|
1656
|
+
// The tickets that wait for the disk of their project's copies.
|
|
1657
|
+
const attendLeDisque = new Set((p?.attentes ?? []).filter(w => w.disque).map(w => w.ticket));
|
|
1517
1658
|
for (const id of attendUnePlace) {
|
|
1518
1659
|
enAttente.add(id);
|
|
1519
1660
|
}
|
|
@@ -1531,7 +1672,6 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1531
1672
|
// from their second pass (`boucles` of the step, scripts/etapes.mjs, their counts in the state's
|
|
1532
1673
|
// `boucles`), whole; then its ticket's working time and tokens. Its card opens on
|
|
1533
1674
|
// its question, or says where it stopped and why. The tickets' numbers line up in one column.
|
|
1534
|
-
const enCircuit = new Set((t.circuits ?? []).map(c => c.id));
|
|
1535
1675
|
// The block of the step <e>, an empty one when the board holds none.
|
|
1536
1676
|
const vides = new Map();
|
|
1537
1677
|
const blocDe = e =>
|
|
@@ -1543,11 +1683,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1543
1683
|
titre: e.titre,
|
|
1544
1684
|
qui: quiDe(e),
|
|
1545
1685
|
enCours: [],
|
|
1546
|
-
attend: [],
|
|
1547
1686
|
})
|
|
1548
1687
|
.get(e.numero);
|
|
1549
1688
|
// The block of the circuits at no step of the list, after the steps.
|
|
1550
|
-
const ailleurs = { numero: null, titre: '', qui: '', enCours: []
|
|
1689
|
+
const ailleurs = { numero: null, titre: '', qui: '', enCours: [] };
|
|
1551
1690
|
const etapeDe = c => etapeDuCircuit({ ...c, raison: c.arret });
|
|
1552
1691
|
// A circuit that waits for the supervisor (`attendLeSuperviseur`, the one rule): who must answer
|
|
1553
1692
|
// its question, the supervisor when its stop names no one.
|
|
@@ -1556,12 +1695,13 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1556
1695
|
const e = etapeDe(c);
|
|
1557
1696
|
return e ? blocDe(e) : !c.vivant ? ailleurs : undefined;
|
|
1558
1697
|
};
|
|
1559
|
-
const montres = t.agents.flatMap(b =>
|
|
1560
|
-
[...b.enCours, ...b.attend].filter(x => !enCircuit.has(x.id))
|
|
1561
|
-
);
|
|
1698
|
+
const montres = t.agents.flatMap(b => b.enCours.filter(x => !enCircuit.has(x.id)));
|
|
1562
1699
|
// A ticket's number, or on several projects' board its whole id, in one column.
|
|
1563
1700
|
const nomme = x => String(plusieurs ? x.id : x.numero);
|
|
1564
|
-
const colonne = Math.max(
|
|
1701
|
+
const colonne = Math.max(
|
|
1702
|
+
0,
|
|
1703
|
+
...[...(t.circuits ?? []), ...(t.horsCircuit ?? []), ...montres].map(x => nomme(x).length)
|
|
1704
|
+
);
|
|
1565
1705
|
// A ticket's line in AGENTS: « <signe> <numéro> <sujet> … <droite> »; on several projects'
|
|
1566
1706
|
// board « <[projet]> <id> <sujet> … <signe> <droite> », the owner's maquette (grillhouse-erp.1).
|
|
1567
1707
|
const teteDe = (signe, x) =>
|
|
@@ -1570,6 +1710,24 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1570
1710
|
: `${signe} ${nomme(x).padEnd(colonne)} `;
|
|
1571
1711
|
const droiteDe = (signe, droite) =>
|
|
1572
1712
|
plusieurs ? `${signe}${droite ? ` ${droite}` : ''}` : droite;
|
|
1713
|
+
// The state of a circuit's line, whose tone TONS gives: frozen, its question (to the supervisor
|
|
1714
|
+
// or to another), stopped, its wait for the disk, a place or the lock, else it runs.
|
|
1715
|
+
const etatDuCircuit = (c, temoin) =>
|
|
1716
|
+
temoin?.fige
|
|
1717
|
+
? 'fige'
|
|
1718
|
+
: !c.vivant
|
|
1719
|
+
? enQuestion(c) === SUPERVISEUR
|
|
1720
|
+
? 'attendLeSuperviseur'
|
|
1721
|
+
: enQuestion(c)
|
|
1722
|
+
? 'attendLeResponsable'
|
|
1723
|
+
: 'arrete'
|
|
1724
|
+
: attendLeDisque.has(c.id)
|
|
1725
|
+
? 'attendLeDisque'
|
|
1726
|
+
: attendUnePlace.has(c.id)
|
|
1727
|
+
? 'attendUnePlace'
|
|
1728
|
+
: attendLeVerrou.has(c.id)
|
|
1729
|
+
? 'attendLeVerrou'
|
|
1730
|
+
: 'enCours';
|
|
1573
1731
|
const ligneDuCircuit = c => {
|
|
1574
1732
|
const signe = !c.vivant ? '⏸' : enAttente.has(c.id) ? '⏳' : '▶';
|
|
1575
1733
|
const droite = droiteDe(
|
|
@@ -1582,7 +1740,10 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1582
1740
|
.map(b => ` · ${b.libelle} ${c.boucles[b.cle]}/${b.max}`)
|
|
1583
1741
|
.join('');
|
|
1584
1742
|
const tete = teteDe(signe, c);
|
|
1585
|
-
|
|
1743
|
+
// The lock it holds or waits for, else the progress of its pass.
|
|
1744
|
+
const temoin =
|
|
1745
|
+
verrouDe.get(c.id) ??
|
|
1746
|
+
(c.vivant && etape?.qui.includes(AUTO) ? temoinDe(c, maintenant) : null);
|
|
1586
1747
|
// The progress after the counters of the loops while the subject keeps its room beside them,
|
|
1587
1748
|
// in their place otherwise.
|
|
1588
1749
|
const reste = avec =>
|
|
@@ -1598,7 +1759,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1598
1759
|
}${place}`;
|
|
1599
1760
|
poser({
|
|
1600
1761
|
texte: couperAvant(`${tete}${c.sujet}`, suite, droite, largeur),
|
|
1601
|
-
ton:
|
|
1762
|
+
ton: TONS[etatDuCircuit(c, temoin)],
|
|
1602
1763
|
ticket: c.id,
|
|
1603
1764
|
...(temoin ? { avancement: true } : {}),
|
|
1604
1765
|
});
|
|
@@ -1612,46 +1773,31 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1612
1773
|
.map(qui => [qui, tous.filter(c => enQuestion(c) === qui)])
|
|
1613
1774
|
.filter(([, l]) => l.length);
|
|
1614
1775
|
const enCours = b.enCours.filter(x => !enCircuit.has(x.id));
|
|
1615
|
-
const attend = b.attend.filter(x => !enCircuit.has(x.id));
|
|
1616
1776
|
return {
|
|
1617
1777
|
circuits,
|
|
1618
1778
|
enQuestions,
|
|
1619
1779
|
enCours,
|
|
1620
|
-
|
|
1621
|
-
vide: !tous.length && !enCours.length && !attend.length,
|
|
1780
|
+
vide: !tous.length && !enCours.length,
|
|
1622
1781
|
};
|
|
1623
1782
|
};
|
|
1624
1783
|
const contenus = new Map([...SUITE.map(blocDe), ailleurs].map(b => [b, contenu(b)]));
|
|
1625
|
-
// The tickets of the block <b>: its circuits without a question, its agents,
|
|
1784
|
+
// The tickets of the block <b>: its circuits without a question, its agents, then
|
|
1626
1785
|
// for each one who must answer, the line « ⤷ Question · <qui> », indented by <retrait>, and its
|
|
1627
1786
|
// circuits.
|
|
1628
1787
|
const tickets = (b, retrait) => {
|
|
1629
|
-
const { circuits, enQuestions, enCours
|
|
1788
|
+
const { circuits, enQuestions, enCours } = contenus.get(b);
|
|
1630
1789
|
for (const c of circuits) {
|
|
1631
1790
|
ligneDuCircuit(c);
|
|
1632
1791
|
}
|
|
1633
1792
|
for (const x of enCours) {
|
|
1634
1793
|
L(
|
|
1635
1794
|
cadre(`${teteDe('▶', x)}${x.sujet}`, droiteDe('▶', conso(x.travail, x.jetons)), largeur),
|
|
1636
|
-
|
|
1795
|
+
TONS.enCours,
|
|
1637
1796
|
x.id
|
|
1638
1797
|
);
|
|
1639
1798
|
}
|
|
1640
|
-
const attente = x => ({
|
|
1641
|
-
texte: cadre(
|
|
1642
|
-
`${teteDe('·', x)}${x.sujet}`,
|
|
1643
|
-
droiteDe(
|
|
1644
|
-
'·',
|
|
1645
|
-
x.bloquePar?.length ? `attend ${x.bloquePar.join(', ')}` : conso(x.travail, x.jetons)
|
|
1646
|
-
),
|
|
1647
|
-
largeur
|
|
1648
|
-
),
|
|
1649
|
-
ton: 'discret',
|
|
1650
|
-
ticket: x.id,
|
|
1651
|
-
});
|
|
1652
|
-
poser(...attend.map(attente));
|
|
1653
1799
|
for (const [qui, l] of enQuestions) {
|
|
1654
|
-
L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur),
|
|
1800
|
+
L(cadre(`${retrait}⤷ Question · ${qui}`, '', largeur), TONS.titre);
|
|
1655
1801
|
for (const c of l) {
|
|
1656
1802
|
ligneDuCircuit(c);
|
|
1657
1803
|
}
|
|
@@ -1660,8 +1806,17 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1660
1806
|
const ligneDEtape = (b, retrait, plein = !contenus.get(b).vide) =>
|
|
1661
1807
|
L(
|
|
1662
1808
|
cadre(`${retrait}${b.numero} · ${b.titre}${b.qui ? ` · ${b.qui}` : ''}`, '', largeur),
|
|
1663
|
-
plein ?
|
|
1809
|
+
plein ? TONS.titre : TONS.vide
|
|
1664
1810
|
);
|
|
1811
|
+
// The tickets worked out of a circuit, once each, before the steps, from their claim to their
|
|
1812
|
+
// close: « ✎ <numéro> <sujet> · en direct ».
|
|
1813
|
+
for (const x of t.horsCircuit ?? []) {
|
|
1814
|
+
poser({
|
|
1815
|
+
texte: couperAvant(`${teteDe('✎', x)}${x.sujet}`, ' · en direct', droiteDe('✎', ''), largeur),
|
|
1816
|
+
ton: TONS.enDirect,
|
|
1817
|
+
ticket: x.id,
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1665
1820
|
for (const e of ETAPES) {
|
|
1666
1821
|
const b = blocDe(e);
|
|
1667
1822
|
const lesSous = e.sous ?? [];
|
|
@@ -1692,13 +1847,14 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1692
1847
|
// The tickets the agents' blocks show: the chantier's tree does not show them a second time.
|
|
1693
1848
|
const dansAgents = new Set([
|
|
1694
1849
|
...(t.circuits ?? []).map(c => c.id),
|
|
1695
|
-
...t.
|
|
1850
|
+
...(t.horsCircuit ?? []).map(x => x.id),
|
|
1851
|
+
...t.agents.flatMap(b => b.enCours.map(x => x.id)),
|
|
1696
1852
|
]);
|
|
1697
1853
|
for (const ch of t.chantiers) {
|
|
1698
1854
|
L('', undefined);
|
|
1699
1855
|
poser({
|
|
1700
1856
|
texte: cadre(`CHANTIER ${duProjet(ch)}${ch.numero} — ${ch.sujet}`, '', largeur),
|
|
1701
|
-
ton:
|
|
1857
|
+
ton: TONS.titre,
|
|
1702
1858
|
ticket: ch.id,
|
|
1703
1859
|
chantier: true,
|
|
1704
1860
|
});
|
|
@@ -1708,7 +1864,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1708
1864
|
'',
|
|
1709
1865
|
largeur
|
|
1710
1866
|
),
|
|
1711
|
-
|
|
1867
|
+
TONS.mesure
|
|
1712
1868
|
);
|
|
1713
1869
|
const arbre = [];
|
|
1714
1870
|
const marque = n =>
|
|
@@ -1730,18 +1886,31 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1730
1886
|
// Every open ticket of the chantier has its line under the title of its state, the states in
|
|
1731
1887
|
// their order, the tickets in their numbers' order. A ticket an agent block shows stands there
|
|
1732
1888
|
// alone; its children keep their lines.
|
|
1889
|
+
// The state of a ticket's line, whose tone TONS gives: a ticket in the queue that waits for the
|
|
1890
|
+
// disk or a place, else its state.
|
|
1891
|
+
const etatDuNoeud = n =>
|
|
1892
|
+
!n.mere && n.etat === 'enAttente' && attendLeDisque.has(n.id)
|
|
1893
|
+
? 'attendLeDisque'
|
|
1894
|
+
: !n.mere && n.etat === 'enAttente' && attendUnePlace.has(n.id)
|
|
1895
|
+
? 'attendUnePlace'
|
|
1896
|
+
: n.etat;
|
|
1733
1897
|
const ligneDe = n => {
|
|
1734
1898
|
const conso = n.jetons ? ` · ${k(n.jetons)}` : '';
|
|
1899
|
+
const etat = etatDuNoeud(n);
|
|
1735
1900
|
const droite = n.mere
|
|
1736
1901
|
? `${n.faits}/${n.total}${conso}${n.etat === 'bloques' ? ` ${marque(n)}` : ''}`
|
|
1737
1902
|
: n.etat === 'enCours'
|
|
1738
1903
|
? `${duree(n.travail)}${conso}`
|
|
1739
1904
|
: n.etat === 'bloques'
|
|
1740
1905
|
? marque(n)
|
|
1741
|
-
: ''
|
|
1906
|
+
: etat === 'attendLeDisque'
|
|
1907
|
+
? 'attend le disque'
|
|
1908
|
+
: etat === 'attendUnePlace'
|
|
1909
|
+
? 'attend une place'
|
|
1910
|
+
: '';
|
|
1742
1911
|
return {
|
|
1743
1912
|
texte: cadre(` ${duProjet(n)}${n.numero} ${n.sujet}`, droite, largeur),
|
|
1744
|
-
ton:
|
|
1913
|
+
ton: TONS[etat],
|
|
1745
1914
|
ticket: n.id,
|
|
1746
1915
|
};
|
|
1747
1916
|
};
|
|
@@ -1762,7 +1931,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1762
1931
|
}
|
|
1763
1932
|
const titreDuGroupe = {
|
|
1764
1933
|
texte: cadre(` ${e.nom}`, `${liste.length}`, largeur),
|
|
1765
|
-
ton:
|
|
1934
|
+
ton: TONS.titre,
|
|
1766
1935
|
};
|
|
1767
1936
|
const replie =
|
|
1768
1937
|
e.cle === 'sansGo' ||
|
|
@@ -1773,7 +1942,7 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1773
1942
|
groupes[cle] = [titreDuGroupe, ...liste.map(ligneDe)].map(marquer);
|
|
1774
1943
|
arbre.push({
|
|
1775
1944
|
texte: cadre(` ${e.nom} ›`, `${liste.length}`, largeur),
|
|
1776
|
-
ton:
|
|
1945
|
+
ton: TONS.titre,
|
|
1777
1946
|
groupe: cle,
|
|
1778
1947
|
});
|
|
1779
1948
|
continue;
|
|
@@ -1795,16 +1964,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1795
1964
|
}));
|
|
1796
1965
|
if (t.chantiers.length) {
|
|
1797
1966
|
groupes.autres = [
|
|
1798
|
-
{ texte: cadre('AUTRES CHANTIERS', `${t.autres.length}`, largeur), ton:
|
|
1967
|
+
{ texte: cadre('AUTRES CHANTIERS', `${t.autres.length}`, largeur), ton: TONS.titre },
|
|
1799
1968
|
...autres,
|
|
1800
1969
|
].map(marquer);
|
|
1801
1970
|
poser({
|
|
1802
1971
|
texte: cadre('AUTRES CHANTIERS ›', `${t.autres.length}`, largeur),
|
|
1803
|
-
ton:
|
|
1972
|
+
ton: TONS.titre,
|
|
1804
1973
|
groupe: 'autres',
|
|
1805
1974
|
});
|
|
1806
1975
|
} else {
|
|
1807
|
-
L(cadre('CHANTIERS', `${t.autres.length}`, largeur),
|
|
1976
|
+
L(cadre('CHANTIERS', `${t.autres.length}`, largeur), TONS.titre);
|
|
1808
1977
|
poser(...autres);
|
|
1809
1978
|
}
|
|
1810
1979
|
}
|
|
@@ -1822,11 +1991,17 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1822
1991
|
`${n} ticket${n > 1 ? 's' : ''} · ${duree(temps)} · ${k(jetons)}`,
|
|
1823
1992
|
largeur
|
|
1824
1993
|
),
|
|
1825
|
-
|
|
1994
|
+
TONS.titre
|
|
1826
1995
|
);
|
|
1996
|
+
// Each line: the sign of its way, then « <durée> · <jetons> », « — » for a direct ticket never
|
|
1997
|
+
// claimed.
|
|
1827
1998
|
const fait = x => ({
|
|
1828
|
-
texte: cadre(
|
|
1829
|
-
|
|
1999
|
+
texte: cadre(
|
|
2000
|
+
`${SIGNE_DE_LA_VOIE[x.voie] ?? SIGNE_DE_LA_VOIE.direct} ${duProjet(x)}${x.numero} ${x.sujet}`,
|
|
2001
|
+
`${x.duree === null || x.duree === undefined ? '—' : duree(x.duree)} · ${k(x.jetons)}`,
|
|
2002
|
+
largeur
|
|
2003
|
+
),
|
|
2004
|
+
ton: TONS.fermes,
|
|
1830
2005
|
ticket: x.id,
|
|
1831
2006
|
});
|
|
1832
2007
|
poser(...t.faitsDuJour.map(fait));
|
|
@@ -1845,11 +2020,11 @@ export function lignesEtats(t, largeur = LARGEUR) {
|
|
|
1845
2020
|
}
|
|
1846
2021
|
out.push({
|
|
1847
2022
|
texte: couper(`${e.nom.toUpperCase()} — ${e.sens}`, `${e.tickets.length}`, largeur),
|
|
1848
|
-
ton:
|
|
2023
|
+
ton: TONS.titre,
|
|
1849
2024
|
section: 'etats',
|
|
1850
2025
|
});
|
|
1851
2026
|
if (!e.tickets.length) {
|
|
1852
|
-
out.push({ texte: ' —', ton:
|
|
2027
|
+
out.push({ texte: ' —', ton: TONS.vide, section: 'etats' });
|
|
1853
2028
|
}
|
|
1854
2029
|
for (const x of e.tickets) {
|
|
1855
2030
|
out.push({
|
|
@@ -1860,7 +2035,7 @@ export function lignesEtats(t, largeur = LARGEUR) {
|
|
|
1860
2035
|
: conso(t.parTicket[x.id]?.travail ?? 0, t.parTicket[x.id]?.jetons ?? 0),
|
|
1861
2036
|
largeur
|
|
1862
2037
|
),
|
|
1863
|
-
ton: e.cle
|
|
2038
|
+
ton: TONS[e.cle],
|
|
1864
2039
|
ticket: x.id,
|
|
1865
2040
|
section: 'etats',
|
|
1866
2041
|
});
|
|
@@ -1980,7 +2155,7 @@ export function ligneEtat(t) {
|
|
|
1980
2155
|
const ch = t.chantiers[0];
|
|
1981
2156
|
const c = t.global.compteurs;
|
|
1982
2157
|
if (!ch) {
|
|
1983
|
-
return `${alerte}Grillhouse : ${c.enCours} en cours · ${c.enAttente}
|
|
2158
|
+
return `${alerte}Grillhouse : ${c.enCours} en cours · ⏭ ${c.enAttente} · ✎ ${c.fileDirecte} · ${c.fermes} faits`;
|
|
1984
2159
|
}
|
|
1985
2160
|
return `${alerte}${ch.numero} ${ch.faits}/${ch.total} · ▶ ${c.enCours} en cours · ${k(t.global.jour.jetons)} aujourd'hui`;
|
|
1986
2161
|
}
|
|
@@ -2018,17 +2193,28 @@ export function dossierCommun(racine) {
|
|
|
2018
2193
|
// dir. Unversioned, out of the worktree: the board does not reset at midnight.
|
|
2019
2194
|
const fichierDuRepere = commun => commun && path.join(commun, 'tableau-repere.json');
|
|
2020
2195
|
|
|
2021
|
-
// The day's marker of the project whose common dir is <commun>: the number its file holds
|
|
2022
|
-
//
|
|
2196
|
+
// The day's marker of the project whose common dir is <commun>: the number its file holds. Without
|
|
2197
|
+
// one (no file, or no number), the first reading sets it to midnight of <maintenant> and keeps it,
|
|
2198
|
+
// so that only `grillhouse newday` moves it; a place that cannot be written gives midnight still.
|
|
2023
2199
|
export function lireLeRepere(commun, maintenant) {
|
|
2200
|
+
try {
|
|
2201
|
+
const { repere } = JSON.parse(readFileSync(fichierDuRepere(commun), 'utf8'));
|
|
2202
|
+
if (typeof repere === 'number') {
|
|
2203
|
+
return repere;
|
|
2204
|
+
}
|
|
2205
|
+
} catch {
|
|
2206
|
+
// No marker yet: set below.
|
|
2207
|
+
}
|
|
2024
2208
|
const minuit = new Date(maintenant);
|
|
2025
2209
|
minuit.setHours(0, 0, 0, 0);
|
|
2026
2210
|
try {
|
|
2027
|
-
|
|
2028
|
-
|
|
2211
|
+
if (commun) {
|
|
2212
|
+
writeFileSync(fichierDuRepere(commun), `${JSON.stringify({ repere: minuit.getTime() })}\n`);
|
|
2213
|
+
}
|
|
2029
2214
|
} catch {
|
|
2030
|
-
|
|
2215
|
+
// A read-only place keeps the board working: midnight, unkept.
|
|
2031
2216
|
}
|
|
2217
|
+
return minuit.getTime();
|
|
2032
2218
|
}
|
|
2033
2219
|
|
|
2034
2220
|
// Sets the day's marker of the project at <racine> to <quand> (now by default), purging FAITS
|
|
@@ -2047,7 +2233,16 @@ export function poserLeRepere(racine, quand = Date.now()) {
|
|
|
2047
2233
|
// shared files in (`commun`).
|
|
2048
2234
|
function lire(
|
|
2049
2235
|
racine,
|
|
2050
|
-
{
|
|
2236
|
+
{
|
|
2237
|
+
home,
|
|
2238
|
+
maintenant,
|
|
2239
|
+
circuits,
|
|
2240
|
+
muet = false,
|
|
2241
|
+
faute = null,
|
|
2242
|
+
machine = null,
|
|
2243
|
+
places = null,
|
|
2244
|
+
nuit = null,
|
|
2245
|
+
}
|
|
2051
2246
|
) {
|
|
2052
2247
|
// The prefix is read once, with no delay of its own; a read that fails leaves it empty (the
|
|
2053
2248
|
// project is labelled by its folder) and its cause is named in an alert (`echecPrefixe`).
|
|
@@ -2081,23 +2276,6 @@ function lire(
|
|
|
2081
2276
|
? lireRegistre(readFileSync(fichierRegistre, 'utf8'), racine)
|
|
2082
2277
|
: [];
|
|
2083
2278
|
const tous = bdJson(racine, 'list', '--all', '--limit', '0');
|
|
2084
|
-
// The reviewer's verdict matters once a developer or a reviewer ran: only those tickets are read.
|
|
2085
|
-
const dernier = {};
|
|
2086
|
-
for (const r of [...registre].sort((x, y) => Date.parse(x.fin) - Date.parse(y.fin))) {
|
|
2087
|
-
if (r.ticket && r.role !== QUESTIONNEUR && r.role !== ROLE_DU_CIRCUIT) {
|
|
2088
|
-
dernier[r.ticket] = r.role;
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
const verdicts = {};
|
|
2092
|
-
for (const t of tous) {
|
|
2093
|
-
if (t.status === 'closed' || !['developpeur', 'relecteur'].includes(dernier[t.id])) {
|
|
2094
|
-
continue;
|
|
2095
|
-
}
|
|
2096
|
-
const v = verdict(bdJson(racine, 'comments', t.id));
|
|
2097
|
-
if (v) {
|
|
2098
|
-
verdicts[t.id] = v;
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
2279
|
const commun = dossierCommun(racine);
|
|
2102
2280
|
const fichierCache = commun && path.join(commun, 'tableau-cache.json');
|
|
2103
2281
|
let cache = {};
|
|
@@ -2124,17 +2302,24 @@ function lire(
|
|
|
2124
2302
|
} catch {
|
|
2125
2303
|
// A read-only place keeps the board working, without its cache.
|
|
2126
2304
|
}
|
|
2305
|
+
const jour = lireLeRepere(commun, maintenant);
|
|
2306
|
+
// The kept results of the circuits of the tickets done since the day's marker, in the main tree.
|
|
2307
|
+
const voies = voiesDesCircuits(
|
|
2308
|
+
commun ? path.dirname(commun) : racine,
|
|
2309
|
+
tous.filter(x => x.closed_at && Date.parse(x.closed_at) >= jour).map(x => x.id)
|
|
2310
|
+
);
|
|
2127
2311
|
const t = assembler({
|
|
2128
2312
|
tous,
|
|
2129
2313
|
prefix,
|
|
2130
2314
|
registre,
|
|
2131
2315
|
vivants,
|
|
2132
2316
|
circuits,
|
|
2133
|
-
verdicts,
|
|
2134
2317
|
maintenant,
|
|
2135
|
-
jour
|
|
2318
|
+
jour,
|
|
2319
|
+
voies,
|
|
2136
2320
|
machine,
|
|
2137
2321
|
places,
|
|
2322
|
+
nuit,
|
|
2138
2323
|
muet,
|
|
2139
2324
|
faute,
|
|
2140
2325
|
echecPrefixe,
|
|
@@ -2176,6 +2361,7 @@ export function ensemble(lus) {
|
|
|
2176
2361
|
),
|
|
2177
2362
|
alertes: tous('alertes'),
|
|
2178
2363
|
circuits: tous('circuits'),
|
|
2364
|
+
horsCircuit: tous('horsCircuit'),
|
|
2179
2365
|
chantiers: lisibles.flatMap(l => l.t.chantiers.map(noeud(l.etiquette))),
|
|
2180
2366
|
autres: tous('autres'),
|
|
2181
2367
|
agents: premier.t.agents.map(b => {
|
|
@@ -2183,11 +2369,12 @@ export function ensemble(lus) {
|
|
|
2183
2369
|
lisibles.flatMap(l =>
|
|
2184
2370
|
(l.t.agents.find(x => x.numero === b.numero)?.[cle] ?? []).map(marquer(l.etiquette))
|
|
2185
2371
|
);
|
|
2186
|
-
return { ...b, enCours: de('enCours')
|
|
2372
|
+
return { ...b, enCours: de('enCours') };
|
|
2187
2373
|
}),
|
|
2188
2374
|
maintenant: premier.t.maintenant,
|
|
2189
2375
|
machine: premier.t.machine,
|
|
2190
2376
|
places: premier.t.places,
|
|
2377
|
+
nuit: premier.t.nuit,
|
|
2191
2378
|
faitsDuJour: tous('faitsDuJour'),
|
|
2192
2379
|
decouvertes: lisibles.reduce(
|
|
2193
2380
|
(s, l) => {
|
|
@@ -2242,16 +2429,22 @@ async function lesCircuits(circuitsDe, racine) {
|
|
|
2242
2429
|
/**
|
|
2243
2430
|
* The lock of the machine <machine> with each project named as the board names it: <noms> gives
|
|
2244
2431
|
* the name of each project of the board by the root of its main tree (`depot`); a project out of
|
|
2245
|
-
* the board keeps its folder's name.
|
|
2432
|
+
* the board keeps its folder's name. A holder or a wait of the repository whose main tree is <ici>
|
|
2433
|
+
* is marked `ici`, the board's project.
|
|
2246
2434
|
* @param {Machine | null} machine
|
|
2247
2435
|
* @param {Map<string, string>} noms
|
|
2436
|
+
* @param {string | null} [ici]
|
|
2248
2437
|
* @returns {Machine | null}
|
|
2249
2438
|
*/
|
|
2250
|
-
export function nommerLesProjets(machine, noms) {
|
|
2439
|
+
export function nommerLesProjets(machine, noms, ici = null) {
|
|
2251
2440
|
if (!machine) {
|
|
2252
2441
|
return machine;
|
|
2253
2442
|
}
|
|
2254
|
-
const nommer = x => ({
|
|
2443
|
+
const nommer = x => ({
|
|
2444
|
+
...x,
|
|
2445
|
+
projet: (x.depot && noms.get(x.depot)) || x.projet,
|
|
2446
|
+
ici: Boolean(ici && x.depot === ici),
|
|
2447
|
+
});
|
|
2255
2448
|
return {
|
|
2256
2449
|
detenteur: machine.detenteur && nommer(machine.detenteur),
|
|
2257
2450
|
attentes: machine.attentes.map(nommer),
|
|
@@ -2262,11 +2455,13 @@ export function nommerLesProjets(machine, noms) {
|
|
|
2262
2455
|
// board of them all (`ensemble`), named « <dépôt> + <projet> + … », with the folder of each
|
|
2263
2456
|
// ticket's project (`dossiers`), where the pane runs Beads for it. The status line is the
|
|
2264
2457
|
// session's project's alone. Each project's circuits are read by <circuitsDe> (one call to the
|
|
2265
|
-
// Temporal server, scripts/circuits-du-serveur.mjs, by default)
|
|
2458
|
+
// Temporal server, scripts/circuits-du-serveur.mjs, by default), and the night under way on the
|
|
2459
|
+
// machine by <nuitDe> (`nuitDuServeur` by default); a night that does not read shows none.
|
|
2266
2460
|
/**
|
|
2267
2461
|
* @param {string} racine
|
|
2268
2462
|
* @param {{ home?: string, maintenant?: number, projets?: string[],
|
|
2269
|
-
* circuitsDe?: (racine: string) => Promise<object[]
|
|
2463
|
+
* circuitsDe?: (racine: string) => Promise<object[]>,
|
|
2464
|
+
* nuitDe?: () => Promise<{ racine: string, depuis: number | null } | null> }} [o]
|
|
2270
2465
|
*/
|
|
2271
2466
|
export async function tableau(
|
|
2272
2467
|
racine,
|
|
@@ -2275,9 +2470,13 @@ export async function tableau(
|
|
|
2275
2470
|
maintenant = Date.now(),
|
|
2276
2471
|
projets = [],
|
|
2277
2472
|
circuitsDe = circuitsDuServeur,
|
|
2473
|
+
nuitDe = () => nuitDuServeur(),
|
|
2278
2474
|
} = {}
|
|
2279
2475
|
) {
|
|
2280
|
-
const [{ circuits, muet, faute }, ...autres] = await Promise.all([
|
|
2476
|
+
const [nuit, { circuits, muet, faute }, ...autres] = await Promise.all([
|
|
2477
|
+
Promise.resolve()
|
|
2478
|
+
.then(nuitDe)
|
|
2479
|
+
.catch(() => null),
|
|
2281
2480
|
lesCircuits(circuitsDe, racine),
|
|
2282
2481
|
...projets.map(d => lireUnAutre(d, { home, maintenant, circuitsDe })),
|
|
2283
2482
|
]);
|
|
@@ -2291,6 +2490,7 @@ export async function tableau(
|
|
|
2291
2490
|
faute,
|
|
2292
2491
|
machine: lireLaMesure(process.env),
|
|
2293
2492
|
places: lireLesPlaces(),
|
|
2493
|
+
nuit,
|
|
2294
2494
|
}),
|
|
2295
2495
|
};
|
|
2296
2496
|
const lus = [ici, ...autres];
|
|
@@ -2303,7 +2503,8 @@ export async function tableau(
|
|
|
2303
2503
|
lus
|
|
2304
2504
|
.filter(l => l.commun)
|
|
2305
2505
|
.map(l => [path.dirname(l.commun), l === ici ? path.basename(racine) : etiquette(l)])
|
|
2306
|
-
)
|
|
2506
|
+
),
|
|
2507
|
+
ici.commun ? path.dirname(ici.commun) : null
|
|
2307
2508
|
);
|
|
2308
2509
|
const etat = ligneEtat(ici.t);
|
|
2309
2510
|
try {
|