@roomi-fields/grillhouse 0.52.0 → 0.53.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 +48 -0
- package/agents/direct.md +1 -1
- package/cadre/templates/projet/vitest.config.cjs +45 -0
- package/charte/superviseur.md +36 -37
- package/charte.md +1 -1
- package/dist/temporal/circuit/appel.d.ts +2 -0
- package/dist/temporal/circuit/appel.js +24 -2
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +14 -5
- package/dist/temporal/circuit/client.js +41 -9
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +17 -6
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +9 -0
- package/dist/temporal/circuit/contrat.js +6 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +25 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/client.d.ts +35 -1
- package/dist/temporal/client.js +144 -1
- package/dist/temporal/client.js.map +1 -1
- package/dist/temporal/commande.js +31 -13
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/etat.d.ts +3 -1
- package/dist/temporal/etat.js +31 -17
- package/dist/temporal/etat.js.map +1 -1
- package/dist/temporal/file/activites.js +1 -1
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +4 -5
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.js +7 -5
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +103 -53
- package/dist/temporal/installation.js +842 -237
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/deroule.js +3 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/deroule.js +2 -1
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/sonde/deroule.js +2 -1
- package/dist/temporal/sonde/deroule.js.map +1 -1
- package/dist/temporal/tickets/deroule.js +4 -3
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.d.ts +7 -1
- package/dist/temporal/travailleur.js +49 -25
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/INTERFACE.md +17 -12
- package/docs/architecture/circuit.md +18 -15
- package/docs/architecture/entree.md +7 -8
- package/docs/architecture/greffon.md +30 -21
- package/docs/architecture/installation.md +87 -58
- package/docs/architecture/machine.md +1 -1
- package/docs/architecture/tests.md +14 -5
- package/docs/lexique.md +2 -2
- package/hooks/hooks.json +10 -0
- package/hooks/register.tsx +19 -25
- package/package.json +3 -2
- package/scripts/activites.mjs +5 -4
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/circuit.mjs +254 -42
- package/scripts/circuits-du-serveur.mjs +3 -2
- package/scripts/circuits-tenus.d.mts +7 -0
- package/scripts/circuits-tenus.mjs +17 -0
- package/scripts/copie-de-montee.mjs +354 -0
- package/scripts/copies-du-depot.d.mts +13 -0
- package/scripts/copies-du-depot.mjs +66 -0
- package/scripts/copies-finies.mjs +6 -40
- package/scripts/crochets.mjs +16 -2
- package/scripts/direct.mjs +2 -2
- package/scripts/droits.mjs +2 -2
- package/scripts/engendres.mjs +5 -3
- package/scripts/enveloppe/travail-de-la-copie.mjs +77 -0
- package/scripts/etapes.mjs +11 -3
- package/scripts/faits-du-circuit.mjs +12 -5
- package/scripts/file-des-tickets.d.mts +13 -2
- package/scripts/file-des-tickets.mjs +44 -12
- package/scripts/greffons.mjs +42 -27
- package/scripts/grillhouse-maj.mjs +105 -85
- package/scripts/init.mjs +1 -1
- package/scripts/integration/file.mjs +5 -2
- package/scripts/integration/integrer.mjs +14 -4
- package/scripts/jointure.d.ts +16 -0
- package/scripts/langages/c/commandes.mjs +17 -7
- package/scripts/langages/cargo/commandes.mjs +87 -34
- package/scripts/langages/cargo/index.mjs +6 -3
- package/scripts/langages/cargo/sccache.mjs +15 -12
- package/scripts/langages/python/commandes.mjs +18 -8
- package/scripts/langages/python/squelette.mjs +2 -2
- package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
- package/scripts/langages/typescript/index.mjs +2 -0
- package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +299 -0
- package/scripts/langages/typescript/squelette.mjs +20 -17
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
- package/scripts/langages/typescript/turbo-des-paquets.mjs +24 -37
- package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
- package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
- package/scripts/mesure/pression.mjs +5 -3
- package/scripts/montee.mjs +524 -0
- package/scripts/outil.mjs +5 -3
- package/scripts/paquet-npm.mjs +22 -0
- package/scripts/paquet.mjs +5 -5
- package/scripts/pre-compact.mjs +25 -0
- package/scripts/reponses-du-circuit.d.mts +17 -2
- package/scripts/reponses-du-circuit.mjs +78 -20
- package/scripts/resultats.mjs +40 -12
- package/scripts/retirer-les-copies-finies.mjs +4 -7
- package/scripts/seances.mjs +28 -3
- package/scripts/services-du-noyau.mjs +7 -2
- package/scripts/session-start.sh +18 -11
- package/scripts/sortie.mjs +4 -7
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/superviseur.mjs +110 -70
- package/scripts/tableau.mjs +127 -108
- package/scripts/ticket-du-circuit.mjs +22 -0
- package/scripts/transitions.d.mts +6 -9
- package/scripts/transitions.mjs +123 -36
- package/scripts/verrou-de-fichier.d.mts +11 -0
- package/skills/direct/SKILL.md +21 -11
- package/skills/explorateur/SKILL.md +6 -1
- package/skills/grill/SKILL.md +9 -7
- package/skills/grill/references/paquets.md +4 -4
- package/skills/pitmaster/SKILL.md +45 -33
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +8 -1
- package/skills/testwriter/SKILL.md +1 -1
- package/cadre/templates/projet/vitest.config.ts +0 -44
package/scripts/superviseur.mjs
CHANGED
|
@@ -14,13 +14,16 @@
|
|
|
14
14
|
// that is not a shell (sh, bash, dash, zsh). It holds as long as that process lives.
|
|
15
15
|
// - <source> is the one of the SessionStart hook (`startup` without one). Free, or held by a
|
|
16
16
|
// process that is gone: taken. Held by the session itself: kept, and nothing is said after a
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
17
|
+
// resume. After a /clear, the session that holds the lock receives « ## Reprise de la
|
|
18
|
+
// supervision après un /clear » (load `grillhouse:pitmaster`, take up the note of resumption, no
|
|
19
|
+
// whole round, put the owner's pending question again at the first turn), and after a compaction
|
|
20
|
+
// « ## Reprise de la supervision après un compactage » (the same, with: finish the work in hand,
|
|
21
|
+
// hold the summary as more recent than the note on what came after it, put the pending question
|
|
22
|
+
// again if it still waits); then what a session that takes the lock receives. Held by another
|
|
23
|
+
// live session: the section « ## Un autre superviseur tient ce dépôt » names its process and
|
|
24
|
+
// since when, and asks to say so to the owner and to launch no circuit. A declared milestone ends
|
|
25
|
+
// with the context that declared it: it is removed at every opening of the holder. The hook
|
|
26
|
+
// plays no opening for the compaction of a subagent (scripts/session-start.sh).
|
|
24
27
|
// - The session whose opening takes the lock (`ouvertureDuSuperviseur`) receives « ## Les questions
|
|
25
28
|
// des circuits », then, when the repository has circuits (read from the Temporal server in one
|
|
26
29
|
// call, scripts/circuits-du-serveur.mjs), « ## Les circuits du dépôt »: each circuit that runs;
|
|
@@ -44,10 +47,16 @@
|
|
|
44
47
|
//
|
|
45
48
|
// npx grillhouse superviseur --renouveler <dossier> <arretA> <messageA>
|
|
46
49
|
//
|
|
47
|
-
// - Played by the greffon at each period: writes the
|
|
48
|
-
// (`renouvellement
|
|
50
|
+
// - Played by the greffon at each period: writes the line `{"reprise": <message>}` when the session
|
|
51
|
+
// is to be compacted (`renouvellement`: the message of resumption at a milestone that is due,
|
|
52
|
+
// empty after 55 minutes of idleness), nothing otherwise.
|
|
49
53
|
//
|
|
50
|
-
// npx grillhouse
|
|
54
|
+
// npx grillhouse pre-compact
|
|
55
|
+
//
|
|
56
|
+
// - Played by the PreCompact hook (scripts/pre-compact.mjs): the instructions of the summary of a
|
|
57
|
+
// compaction (`consignesDuResume`).
|
|
58
|
+
//
|
|
59
|
+
// npx grillhouse superviseur --relever [<dossier>]
|
|
51
60
|
//
|
|
52
61
|
// - One reading of the circuits for the greffon (mods/grillhouse/hooks/register.tsx), which runs
|
|
53
62
|
// it at each period and submits what it writes. It reads and writes nothing unless the session
|
|
@@ -55,10 +64,9 @@
|
|
|
55
64
|
// reads. It writes the message (`texteDesQuestions`) when `relever` gives something, nothing
|
|
56
65
|
// otherwise; exit 1 and the fault on the error stream when `grillhouse.rappel` of the project is
|
|
57
66
|
// at fault, or when the reading of another project of the group fails, the message of the others
|
|
58
|
-
// then written all the same. The message ends
|
|
59
|
-
// milestone
|
|
60
|
-
//
|
|
61
|
-
// supervisor.
|
|
67
|
+
// then written all the same. The message ends, once for each night (`grillhouse.plageDeNuit`),
|
|
68
|
+
// with the request to write the note and declare a milestone, at a reading where no question of a
|
|
69
|
+
// circuit waits for the supervisor.
|
|
62
70
|
// - `superviseur --lue <dossier> <lueA> <envoyeesAvant>` marks read the questions sent up to
|
|
63
71
|
// `envoyeesAvant`; `superviseur --chez-le-responsable <dossier> <ticket>` marks a question
|
|
64
72
|
// carried to the owner: silent until the circuit answers.
|
|
@@ -107,6 +115,7 @@ import {
|
|
|
107
115
|
lireLesExternes,
|
|
108
116
|
lireLesTickets,
|
|
109
117
|
lotEstSurMain,
|
|
118
|
+
reporteJusqua,
|
|
110
119
|
} from './file-des-tickets.mjs';
|
|
111
120
|
|
|
112
121
|
const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
|
|
@@ -115,10 +124,14 @@ const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
|
|
|
115
124
|
const NOTE_DE_REPRISE = 'grillhouse-reprise.md';
|
|
116
125
|
const JALON = 'grillhouse-jalon.json';
|
|
117
126
|
const DEMANDE_DE_NUIT = 'grillhouse-demande-de-nuit.json';
|
|
118
|
-
// The message the greffon submits once the
|
|
119
|
-
// the circuits come with the opening.
|
|
127
|
+
// The message the greffon submits once the compaction of a milestone is installed; the note, the
|
|
128
|
+
// questions and the circuits come with the opening.
|
|
120
129
|
const MESSAGE_DE_REPRISE =
|
|
121
|
-
"Reprends la supervision : ta séance vient
|
|
130
|
+
"Reprends la supervision : ta séance vient d'être compactée au jalon que tu as déclaré. L'ouverture te donne la note de reprise, les questions et les circuits : suis-la.";
|
|
131
|
+
// How long a session without a turn stays before it is compacted: its prompt cache lasts one hour.
|
|
132
|
+
const INACTIVITE_MS = 55 * 60_000;
|
|
133
|
+
// The output of a hook of Claude Code stays under this many characters.
|
|
134
|
+
const PLAFOND_DU_CROCHET = 10_000;
|
|
122
135
|
const COQUILLES = new Set(['sh', 'bash', 'dash', 'zsh']);
|
|
123
136
|
// The name of the process of a session of the engine.
|
|
124
137
|
const MOTEUR = 'claude';
|
|
@@ -181,15 +194,10 @@ function estAuDessus(pid) {
|
|
|
181
194
|
return false;
|
|
182
195
|
}
|
|
183
196
|
|
|
184
|
-
// The time in ms of <texte>, a `defer_until` as Beads writes it: the local wall time of the
|
|
185
|
-
// machine, followed by a « Z » it does not mean (`bd update --defer 17:30` gives `…T17:30:00Z`);
|
|
186
|
-
// NaN without one.
|
|
187
|
-
const heureMurale = texte => Date.parse(String(texte ?? '').replace(/Z$/, ''));
|
|
188
|
-
|
|
189
197
|
/**
|
|
190
198
|
* Of the tickets <tickets> (as `bd show --json` gives them), the ids of those whose question does
|
|
191
199
|
* not wait for the supervisor at <maintenant> (ms): closed, or deferred to a later time
|
|
192
|
-
* (`
|
|
200
|
+
* (`reporteJusqua` of ./file-des-tickets.mjs), as a review's snooze hides a request until its
|
|
193
201
|
* hour, then shows it again.
|
|
194
202
|
* @param {{ id: string, status?: string, defer_until?: string }[]} tickets
|
|
195
203
|
* @param {number} maintenant
|
|
@@ -198,7 +206,7 @@ const heureMurale = texte => Date.parse(String(texte ?? '').replace(/Z$/, ''));
|
|
|
198
206
|
export function horsAttente(tickets, maintenant) {
|
|
199
207
|
return new Set(
|
|
200
208
|
tickets
|
|
201
|
-
.filter(t => t.status === 'closed' ||
|
|
209
|
+
.filter(t => t.status === 'closed' || reporteJusqua(t, maintenant) !== null)
|
|
202
210
|
.map(t => t.id)
|
|
203
211
|
);
|
|
204
212
|
}
|
|
@@ -805,30 +813,65 @@ export async function ajouterLaQuestion(dossier, fichier, { env = process.env }
|
|
|
805
813
|
}
|
|
806
814
|
|
|
807
815
|
/**
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
*
|
|
812
|
-
*
|
|
816
|
+
* Whether the session of supervision of <dossier> is to be compacted (`superviseur --renouveler`),
|
|
817
|
+
* the session holding the lock: at a milestone it declared, once a quiet Stop (<arretA>, ms, 0
|
|
818
|
+
* without one) is later than it, with the message of resumption; else once that Stop is 55 minutes
|
|
819
|
+
* old, with an empty message, a note or a milestone or not. A message of the owner (<messageA>, ms,
|
|
820
|
+
* 0 without one) later than the declaration cancels the milestone. The reading keeps a milestone
|
|
821
|
+
* that is due: the opening that follows the compaction removes it.
|
|
813
822
|
* @param {string} dossier
|
|
814
823
|
* @param {{ arretA: number, messageA: number, env?: Record<string, string | undefined> }} options
|
|
815
|
-
* @returns {Promise<string>}
|
|
824
|
+
* @returns {Promise<{ reprise: string } | null>} null when nothing is to be done
|
|
816
825
|
*/
|
|
817
826
|
export async function renouvellement(dossier, { arretA, messageA, env = process.env }) {
|
|
818
827
|
const session = laSeanceQuiTient(dossier, env);
|
|
819
828
|
if (session.refus) {
|
|
820
|
-
return
|
|
829
|
+
return null;
|
|
821
830
|
}
|
|
822
831
|
const f = path.join(session.commun, JALON);
|
|
823
832
|
const jalon = lireJson(f);
|
|
824
|
-
if (
|
|
833
|
+
if (jalon && jalon.tenant === session.tenant) {
|
|
834
|
+
if (messageA > jalon.declareA) {
|
|
835
|
+
rmSync(f, { force: true });
|
|
836
|
+
} else if (arretA > jalon.declareA) {
|
|
837
|
+
return { reprise: MESSAGE_DE_REPRISE };
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return arretA > 0 && Date.now() - arretA >= INACTIVITE_MS ? { reprise: '' } : null;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* The instructions of the summary of a compaction of the session of supervision of <dossier>
|
|
845
|
+
* (`grillhouse pre-compact`): the file of the note of resumption, the request to keep what it says
|
|
846
|
+
* and what the conversation holds of more recent, then its text, cut so that the whole stays under
|
|
847
|
+
* the cap of a hook's output. Empty without a note, for a session that does not hold the lock, a
|
|
848
|
+
* session of a role or a copy.
|
|
849
|
+
* @param {string} dossier
|
|
850
|
+
* @param {{ env?: Record<string, string | undefined> }} [options]
|
|
851
|
+
* @returns {string}
|
|
852
|
+
*/
|
|
853
|
+
export function consignesDuResume(dossier, { env = process.env } = {}) {
|
|
854
|
+
const session = laSeanceQuiTient(dossier, env);
|
|
855
|
+
if (session.refus) {
|
|
825
856
|
return '';
|
|
826
857
|
}
|
|
827
|
-
|
|
828
|
-
|
|
858
|
+
const note = path.join(session.commun, NOTE_DE_REPRISE);
|
|
859
|
+
const texte = lireTexte(note).trimEnd();
|
|
860
|
+
if (!texte) {
|
|
829
861
|
return '';
|
|
830
862
|
}
|
|
831
|
-
|
|
863
|
+
const tete = [
|
|
864
|
+
`La note de reprise de la supervision est au fichier \`${note}\`.`,
|
|
865
|
+
"Garde dans le résumé ce qu'elle dit et ce que la conversation porte de plus récent qu'elle. Son texte :",
|
|
866
|
+
'',
|
|
867
|
+
'',
|
|
868
|
+
].join('\n');
|
|
869
|
+
const coupe = '\n[Note coupée : lis son fichier en entier.]';
|
|
870
|
+
// One character is left to the newline the command ends with.
|
|
871
|
+
const place = PLAFOND_DU_CROCHET - 2 - tete.length;
|
|
872
|
+
return texte.length <= place
|
|
873
|
+
? `${tete}${texte}`
|
|
874
|
+
: `${tete}${texte.slice(0, Math.max(0, place - coupe.length))}${coupe}`;
|
|
832
875
|
}
|
|
833
876
|
|
|
834
877
|
// The section the opening gives of the note of resumption <note>; empty when none is written.
|
|
@@ -844,18 +887,27 @@ function laNote(note) {
|
|
|
844
887
|
: '';
|
|
845
888
|
}
|
|
846
889
|
|
|
847
|
-
// What the opening that follows a /clear asks, before the circuits and the note
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
890
|
+
// What the opening that follows a /clear or a compaction asks, before the circuits and the note, by
|
|
891
|
+
// the source of the SessionStart hook.
|
|
892
|
+
const REPRISES = {
|
|
893
|
+
clear: [
|
|
894
|
+
'## Reprise de la supervision après un /clear',
|
|
895
|
+
'Charge la compétence `grillhouse:pitmaster`, puis reprends la note de reprise donnée plus bas ; ne fais aucun tour complet.',
|
|
896
|
+
'À ton premier tour, quel que soit le message qui l’ouvre, repose au responsable la question que la note tient en attente.',
|
|
897
|
+
].join('\n'),
|
|
898
|
+
compact: [
|
|
899
|
+
'## Reprise de la supervision après un compactage',
|
|
900
|
+
'Charge la compétence `grillhouse:pitmaster`, puis reprends la note de reprise donnée plus bas ; ne fais aucun tour complet, et finis le travail en cours.',
|
|
901
|
+
'Tiens le résumé du compactage pour plus récent que la note sur ce qui lui est postérieur.',
|
|
902
|
+
'Repose au responsable la question que la note tient en attente, si elle attend encore.',
|
|
903
|
+
].join('\n'),
|
|
904
|
+
};
|
|
853
905
|
|
|
854
906
|
/**
|
|
855
907
|
* The check of the supervisor at the opening of a session in <dossier> (greffon.md, §5.2): what it
|
|
856
908
|
* says (empty when nothing), the lock taken when it is free. <source> is the one of the
|
|
857
|
-
* SessionStart hook. The session that takes the lock, and the holder after a /clear
|
|
858
|
-
* circuits and the note of resumption; every opening of the holder
|
|
909
|
+
* SessionStart hook. The session that takes the lock, and the holder after a /clear or a
|
|
910
|
+
* compaction, receive the circuits and the note of resumption; every opening of the holder removes
|
|
859
911
|
* the declared milestone.
|
|
860
912
|
* @param {string} dossier the directory the session opens in
|
|
861
913
|
* @param {{ source?: string, env?: Record<string, string | undefined>, circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]> }} [options]
|
|
@@ -875,14 +927,13 @@ export async function ouvertureDuSuperviseur(
|
|
|
875
927
|
if (!tenait && !prendreVerrou(verrou, { attendre: false, pid: moi })) {
|
|
876
928
|
return unAutreSuperviseur(verrou, moi);
|
|
877
929
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
if (tenait && source !== 'clear') {
|
|
930
|
+
rmSync(path.join(commun, JALON), { force: true });
|
|
931
|
+
const reprise = Object.hasOwn(REPRISES, source) ? REPRISES[source] : '';
|
|
932
|
+
if (tenait && !reprise) {
|
|
882
933
|
return '';
|
|
883
934
|
}
|
|
884
935
|
return [
|
|
885
|
-
|
|
936
|
+
reprise,
|
|
886
937
|
await circuitsALOuverture(path.dirname(commun), { circuitsDe }),
|
|
887
938
|
laNote(path.join(commun, NOTE_DE_REPRISE)),
|
|
888
939
|
]
|
|
@@ -947,18 +998,17 @@ const demandeDuJalon = raison =>
|
|
|
947
998
|
* interval and state. A fault in the reading of one of these projects costs the others nothing: it
|
|
948
999
|
* is thrown once all are read, each project at fault named with its reason, the message of the
|
|
949
1000
|
* others in the `texte` of the error. Last comes the request to write the note of resumption and
|
|
950
|
-
* declare a milestone
|
|
951
|
-
*
|
|
952
|
-
* the supervisor.
|
|
1001
|
+
* declare a milestone, once for each night of the project (`grillhouse.plageDeNuit`), at a reading
|
|
1002
|
+
* where every project read says that no question waits for the supervisor.
|
|
953
1003
|
* @param {string} racine
|
|
954
|
-
* @param {{ env?: Record<string, string | undefined>,
|
|
1004
|
+
* @param {{ env?: Record<string, string | undefined>, circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]> }} [options]
|
|
955
1005
|
* @returns {Promise<string>}
|
|
956
1006
|
* @throws {Error} `grillhouse.rappel` of the project of the session is at fault, named with its
|
|
957
1007
|
* value; or the reading of another project of the group failed (its `texte`: the others' message)
|
|
958
1008
|
*/
|
|
959
1009
|
export async function releverPourLeGreffon(
|
|
960
1010
|
racine,
|
|
961
|
-
{ env = process.env, circuitsDe = circuitsDuServeur
|
|
1011
|
+
{ env = process.env, circuitsDe = circuitsDuServeur } = {}
|
|
962
1012
|
) {
|
|
963
1013
|
const depot = depotDuSuperviseur(racine, env);
|
|
964
1014
|
if (depot.refus) {
|
|
@@ -980,13 +1030,7 @@ export async function releverPourLeGreffon(
|
|
|
980
1030
|
const demandeNocturne = path.join(commun, DEMANDE_DE_NUIT);
|
|
981
1031
|
const nuit = nuitEnCours(Date.now(), plageDeNuit(racine));
|
|
982
1032
|
const aDemander = nuit !== null && lireJson(demandeNocturne)?.nuit !== nuit;
|
|
983
|
-
const
|
|
984
|
-
const parts = [];
|
|
985
|
-
try {
|
|
986
|
-
parts.push(await leReleveDe(racine, circuitsDe, { nocturne: aDemander }));
|
|
987
|
-
} catch (e) {
|
|
988
|
-
throw Object.assign(e, { texte: apresCompaction });
|
|
989
|
-
}
|
|
1033
|
+
const parts = [await leReleveDe(racine, circuitsDe, { nocturne: aDemander })];
|
|
990
1034
|
const fautes = [];
|
|
991
1035
|
for (const p of voisinsSansSuperviseur(racine)) {
|
|
992
1036
|
try {
|
|
@@ -995,10 +1039,10 @@ export async function releverPourLeGreffon(
|
|
|
995
1039
|
fautes.push(`${path.basename(p.chemin)} : ${e.message}`);
|
|
996
1040
|
}
|
|
997
1041
|
}
|
|
998
|
-
let demande =
|
|
1042
|
+
let demande = '';
|
|
999
1043
|
if (aDemander && !fautes.length && parts.every(p => p.attend === false)) {
|
|
1000
1044
|
ecrireEntier(demandeNocturne, `${JSON.stringify({ nuit })}\n`);
|
|
1001
|
-
demande
|
|
1045
|
+
demande = demandeDuJalon('la nuit a commencé');
|
|
1002
1046
|
}
|
|
1003
1047
|
const texte = [...parts.map(p => p.texte), demande].filter(Boolean).join('\n\n');
|
|
1004
1048
|
if (fautes.length) {
|
|
@@ -1094,20 +1138,16 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
1094
1138
|
} else if (process.argv[2] === '--renouveler') {
|
|
1095
1139
|
// superviseur --renouveler <dossier> <arretA> <messageA> (the greffon, at each period).
|
|
1096
1140
|
const [, , , dossier, arretA, messageA] = process.argv;
|
|
1097
|
-
const
|
|
1141
|
+
const rendu = await renouvellement(dossier ?? process.cwd(), {
|
|
1098
1142
|
arretA: Number(arretA),
|
|
1099
1143
|
messageA: Number(messageA),
|
|
1100
1144
|
});
|
|
1101
|
-
if (
|
|
1102
|
-
process.stdout.write(`${
|
|
1145
|
+
if (rendu) {
|
|
1146
|
+
process.stdout.write(`${JSON.stringify(rendu)}\n`);
|
|
1103
1147
|
}
|
|
1104
1148
|
} else if (process.argv[2] === '--relever') {
|
|
1105
|
-
const args = process.argv.slice(3);
|
|
1106
|
-
const dossier = args.find(a => a !== '--compaction') ?? process.cwd();
|
|
1107
1149
|
try {
|
|
1108
|
-
const texte = await releverPourLeGreffon(racineDe(
|
|
1109
|
-
compaction: args.includes('--compaction'),
|
|
1110
|
-
});
|
|
1150
|
+
const texte = await releverPourLeGreffon(racineDe(process.argv[3] ?? process.cwd()));
|
|
1111
1151
|
if (texte) {
|
|
1112
1152
|
process.stdout.write(`${texte}\n`);
|
|
1113
1153
|
}
|