@roomi-fields/grillhouse 0.34.0 → 0.34.2
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 +34 -2
- package/cadre/templates/projet/_gitignore +1 -0
- package/cadre/templates/projet/package.json +2 -2
- 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/appel.d.ts +2 -0
- package/dist/temporal/circuit/appel.js +12 -0
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/commande.js +10 -1
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/docs/ARCHITECTURE.md +12 -0
- package/package.json +1 -1
- package/scripts/adresse-du-registre.mjs +10 -0
- package/scripts/attente-a-l-arret.mjs +2 -2
- package/scripts/attente-au-tour.mjs +2 -2
- package/scripts/bilan.mjs +5 -4
- package/scripts/branche-de-nuit.mjs +15 -6
- package/scripts/ci-des-branches.mjs +4 -2
- package/scripts/etapes.mjs +7 -5
- package/scripts/integration/file.mjs +7 -6
- package/scripts/jointure.d.ts +10 -3
- package/scripts/langages/cargo/commandes.mjs +10 -2
- package/scripts/langages/cargo/sccache.mjs +22 -16
- package/scripts/langages/python/commandes.mjs +3 -0
- package/scripts/langages/typescript/index.mjs +8 -4
- package/scripts/langages/typescript/migrations/0.34.1-cache-des-outils.mjs +53 -0
- package/scripts/langages/typescript/resume-du-lanceur.mjs +8 -2
- package/scripts/langages/typescript/vitest-config/base.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/registre.setup.mjs +35 -0
- package/scripts/migrations-des-gardes.mjs +15 -4
- package/scripts/registre.mjs +3 -3
- package/scripts/reponses-du-circuit.mjs +1 -1
- package/scripts/superviseur.mjs +24 -11
- package/scripts/tableau.mjs +164 -39
- package/scripts/taches-du-graphe.mjs +22 -8
|
@@ -722,8 +722,16 @@ function verifier(racine, args, env) {
|
|
|
722
722
|
env,
|
|
723
723
|
})
|
|
724
724
|
: 0;
|
|
725
|
-
p.jouer(p.prevoir(RACINE, racine, 'deny', false, ['deny', 'check']));
|
|
726
|
-
|
|
725
|
+
const deny = p.jouer(p.prevoir(RACINE, racine, 'deny', false, ['deny', 'check']));
|
|
726
|
+
const verdict = code === 0 ? p.code() : 1;
|
|
727
|
+
// A red pass names its task out of the graph, as `lancerLesTaches` names those of the graph.
|
|
728
|
+
if (verdict !== 0) {
|
|
729
|
+
if (deny !== 0) {
|
|
730
|
+
process.stderr.write(`⛔ ${RACINE}#deny (code ${deny})\n`);
|
|
731
|
+
}
|
|
732
|
+
process.stderr.write('⛔ rouge.\n');
|
|
733
|
+
}
|
|
734
|
+
return verdict;
|
|
727
735
|
}
|
|
728
736
|
|
|
729
737
|
// The scripts of guards of the project, in the order they play, as the module typescript's
|
|
@@ -23,16 +23,20 @@
|
|
|
23
23
|
// Every command of the module that compiles (tests, verification, typing, clippy) runs cargo
|
|
24
24
|
// under this environment, in a copy as in an agent's envelope.
|
|
25
25
|
//
|
|
26
|
-
// - One server per copy and per namespace of processes: by default the
|
|
27
|
-
// on 127.0.0.1:4226 (README of v0.19.0), one for the whole machine, and
|
|
28
|
-
// network, so that a server born in one agent's envelope would serve
|
|
29
|
-
// outside would compile for an agent out of his envelope. Each run
|
|
30
|
-
// (`SCCACHE_SERVER_UDS`), an abstract unix socket (the README's
|
|
31
|
-
// the copy
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
26
|
+
// - One server per copy, per temporary directory and per namespace of processes: by default the
|
|
27
|
+
// server of sccache listens on 127.0.0.1:4226 (README of v0.19.0), one for the whole machine, and
|
|
28
|
+
// the envelope shares the network, so that a server born in one agent's envelope would serve
|
|
29
|
+
// another copy, and one born outside would compile for an agent out of his envelope. Each run
|
|
30
|
+
// names its server's socket (`SCCACHE_SERVER_UDS`), an abstract unix socket (the README's
|
|
31
|
+
// `\x00<name>` form), named after the copy, the temporary directory of the run (TMPDIR) and the
|
|
32
|
+
// namespace of processes it runs in (`/proc/self/ns/pid`), which each envelope creates
|
|
33
|
+
// (`--unshare-pid`): the two sides of an envelope, and two envelopes of one copy, never share a
|
|
34
|
+
// server, whatever the environment says. An abstract socket writes no file, so that neither the
|
|
35
|
+
// read-only copy nor the 108 bytes of a socket's path bind it, and it goes with its server,
|
|
36
|
+
// leaving no stale file. A server cargo starts keeps the temporary directory of its run, where it
|
|
37
|
+
// writes as it compiles, and outlives it (its idle time): a pass, whose temporary directory goes
|
|
38
|
+
// at its end, never joins the server of another (SyntHub, grillhouse-67dz). The disk cache stays
|
|
39
|
+
// common.
|
|
36
40
|
// - The server starts before each run of cargo that compiles, under the machine's `/tmp`
|
|
37
41
|
// (`demarrerLeServeur`): sccache 0.19.0 starts its server by binding a socket of a path under
|
|
38
42
|
// TMPDIR (`<TMPDIR>/sccacheXXXXXX/sock`, src/commands.rs, `run_server_process`), which fails
|
|
@@ -51,7 +55,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
51
55
|
import { createHash } from 'node:crypto';
|
|
52
56
|
import { readFileSync, readlinkSync, realpathSync } from 'node:fs';
|
|
53
57
|
import { createRequire } from 'node:module';
|
|
54
|
-
import { homedir } from 'node:os';
|
|
58
|
+
import { homedir, tmpdir } from 'node:os';
|
|
55
59
|
import path from 'node:path';
|
|
56
60
|
import {
|
|
57
61
|
cacheDeCompilation,
|
|
@@ -122,14 +126,16 @@ const reel = p => {
|
|
|
122
126
|
};
|
|
123
127
|
|
|
124
128
|
/**
|
|
125
|
-
* The socket of the server of sccache for the copy at <racine
|
|
126
|
-
* <espace>: an abstract unix socket, named after
|
|
129
|
+
* The socket of the server of sccache for the copy at <racine>, the temporary directory
|
|
130
|
+
* <temporaire> and the namespace of processes <espace>: an abstract unix socket, named after the
|
|
131
|
+
* three.
|
|
127
132
|
* @param {string} racine
|
|
133
|
+
* @param {string} temporaire the temporary directory of the run (its TMPDIR)
|
|
128
134
|
* @param {string} [espace] this process's namespace by default
|
|
129
135
|
*/
|
|
130
|
-
export function socketDuServeur(racine, espace = espaceDesProcessus()) {
|
|
136
|
+
export function socketDuServeur(racine, temporaire, espace = espaceDesProcessus()) {
|
|
131
137
|
const empreinte = createHash('sha256')
|
|
132
|
-
.update(`${reel(racine)}\0${espace}`)
|
|
138
|
+
.update(`${reel(racine)}\0${reel(temporaire)}\0${espace}`)
|
|
133
139
|
.digest('hex');
|
|
134
140
|
return `\\x00grillhouse-sccache-${empreinte.slice(0, 16)}`;
|
|
135
141
|
}
|
|
@@ -244,6 +250,6 @@ export function avecSccache(racine, env) {
|
|
|
244
250
|
...cible,
|
|
245
251
|
RUSTC_WRAPPER: 'sccache',
|
|
246
252
|
SCCACHE_DIR: cacheDeCompilation('sccache', env),
|
|
247
|
-
SCCACHE_SERVER_UDS: socketDuServeur(racine),
|
|
253
|
+
SCCACHE_SERVER_UDS: socketDuServeur(racine, env.TMPDIR || tmpdir()),
|
|
248
254
|
};
|
|
249
255
|
}
|
|
@@ -72,6 +72,7 @@ import * as prefixeDesTickets from './migrations/0.30.0-prefixe-des-tickets.mjs'
|
|
|
72
72
|
import * as titresNommantUnTicket from './migrations/0.30.0-titres-nommant-un-ticket.mjs';
|
|
73
73
|
import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
|
|
74
74
|
import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
|
|
75
|
+
import * as cacheDesOutils from './migrations/0.34.1-cache-des-outils.mjs';
|
|
75
76
|
|
|
76
77
|
// The scripts of this module, beside this file.
|
|
77
78
|
const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -208,16 +209,18 @@ export default {
|
|
|
208
209
|
// No program the installer of Temporal looks for: Node is a tool of the account.
|
|
209
210
|
executables: [],
|
|
210
211
|
// What its tools write in a project: Turborepo's runs and cache, and Vitest's reports of the
|
|
211
|
-
// tranches of a pass (./tranches.mjs)
|
|
212
|
-
|
|
212
|
+
// tranches of a pass (./tranches.mjs), and the cache of the lint and of the format check of the
|
|
213
|
+
// project (`.cache-outils/`).
|
|
214
|
+
ignorer: ['.turbo', '.vitest-reports', '.cache-outils'],
|
|
213
215
|
// Where its tools write: the cache of Turborepo in the main tree, shared by every copy, written;
|
|
214
216
|
// the logs of Turborepo's tasks (`.turbo/turbo-<task>.log`, written on every run, a task replayed
|
|
215
217
|
// from its cache included, and which no option of Turborepo sends elsewhere) and the cache of
|
|
216
218
|
// Vite, where Vitest writes the results of a run (`node_modules/.vite/vitest/`) and whose failure
|
|
217
|
-
// fails it, proper to the session
|
|
219
|
+
// fails it, proper to the session; and the cache of ESLint and Prettier (`.cache-outils/`),
|
|
220
|
+
// proper to the session too, an empty one costing a whole reading, as without a cache.
|
|
218
221
|
sorties: {
|
|
219
222
|
ecrites: ['//.turbo/cache/'],
|
|
220
|
-
propres: ['.turbo', 'node_modules/.vite'],
|
|
223
|
+
propres: ['.turbo', 'node_modules/.vite', '.cache-outils'],
|
|
221
224
|
lues: [],
|
|
222
225
|
},
|
|
223
226
|
// The test tool run directly, Vitest or Turborepo that plays it: `npm test` and `npm run
|
|
@@ -350,6 +353,7 @@ export default {
|
|
|
350
353
|
titresNommantUnTicket,
|
|
351
354
|
binaireDeJour,
|
|
352
355
|
testsDuPoste,
|
|
356
|
+
cacheDesOutils,
|
|
353
357
|
],
|
|
354
358
|
miseAJour: miseAJour(joueDesTests),
|
|
355
359
|
squelette,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// From 0.34.1 the cache of the lint and of the format check lives under `.cache-outils/`, a clean
|
|
2
|
+
// output of the module typescript, no longer under `node_modules/.cache/`: a session's envelope
|
|
3
|
+
// mounts `/` read-only and the `node_modules` of a copy is a link out of it, so ESLint and
|
|
4
|
+
// Prettier failed to write their cache there (EROFS). The migration moves it in a project.
|
|
5
|
+
//
|
|
6
|
+
// - In the `lint` and `format:check` scripts of `package.json`, the former path
|
|
7
|
+
// (`node_modules/.cache/`) is replaced by the new one (`.cache-outils/`), wherever it falls;
|
|
8
|
+
// every other byte of the file stays, and every other script is left.
|
|
9
|
+
// - One line per script rewritten; a project without `package.json`, or whose scripts lack the
|
|
10
|
+
// former path, is left, nothing said.
|
|
11
|
+
// - Replayable without effect: once moved, nothing.
|
|
12
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
|
|
15
|
+
export const version = '0.34.1';
|
|
16
|
+
export const nom = 'cache des outils';
|
|
17
|
+
|
|
18
|
+
const ANCIEN = 'node_modules/.cache/';
|
|
19
|
+
const NOUVEAU = '.cache-outils/';
|
|
20
|
+
const SCRIPTS = ['lint', 'format:check'];
|
|
21
|
+
|
|
22
|
+
/** Moves the cache path of the `lint` and `format:check` scripts of <projet>; returns its lines. */
|
|
23
|
+
export function migrer(projet) {
|
|
24
|
+
const fichier = path.join(projet, 'package.json');
|
|
25
|
+
if (!existsSync(fichier)) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
let texte = readFileSync(fichier, 'utf8');
|
|
29
|
+
const debut = texte.indexOf('"scripts"');
|
|
30
|
+
if (debut === -1) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const lignes = [];
|
|
34
|
+
for (const script of SCRIPTS) {
|
|
35
|
+
const motif = new RegExp(`("${script}"\\s*:\\s*")((?:[^"\\\\]|\\\\.)*)(")`);
|
|
36
|
+
const trouve = motif.exec(texte.slice(debut));
|
|
37
|
+
if (!trouve || !trouve[2].includes(ANCIEN)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const place = debut + trouve.index + trouve[1].length;
|
|
41
|
+
texte =
|
|
42
|
+
texte.slice(0, place) +
|
|
43
|
+
trouve[2].replaceAll(ANCIEN, NOUVEAU) +
|
|
44
|
+
texte.slice(place + trouve[2].length);
|
|
45
|
+
lignes.push(
|
|
46
|
+
`package.json : le cache du script ${script} passe de ${ANCIEN} à ${NOUVEAU}, une sortie propre de la séance`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (lignes.length > 0) {
|
|
50
|
+
writeFileSync(fichier, texte);
|
|
51
|
+
}
|
|
52
|
+
return lignes;
|
|
53
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// - `resumesDuLancement` names the summaries present in a project before a run.
|
|
7
7
|
// - `garderLesResumes` moves the summaries a run wrote into `<dossier>/turbo/`, the results
|
|
8
8
|
// directory (`GRILLHOUSE_RESULTATS`, scripts/resultats.mjs) its environment names, or removes
|
|
9
|
-
// them without one.
|
|
9
|
+
// them without one, and gives each of their tasks with its exit code.
|
|
10
10
|
// - `lireLesResumes` gives each task of those summaries, its package and directory, its script,
|
|
11
11
|
// its exit code, its cache status and its log file (from the root), and whether it plays the
|
|
12
12
|
// tests of its package (`test:unit`).
|
|
@@ -41,14 +41,19 @@ export function resumesDuLancement(racine) {
|
|
|
41
41
|
|
|
42
42
|
// Moves the summaries that a run in <racine> wrote (`.turbo/runs/*.json` absent from <avant>, the
|
|
43
43
|
// names there before it) into the results directory <env> names; removes them without it.
|
|
44
|
-
// `.turbo/runs` goes too when the run created it (<avant> empty) and it is left empty.
|
|
44
|
+
// `.turbo/runs` goes too when the run created it (<avant> empty) and it is left empty. Gives each
|
|
45
|
+
// task of those summaries, `{ tache, code }`, `code` null for a task that did not run.
|
|
45
46
|
export function garderLesResumes(racine, avant, env = process.env) {
|
|
46
47
|
const runs = path.join(racine, '.turbo', 'runs');
|
|
47
48
|
const neufs = (existsSync(runs) ? readdirSync(runs) : []).filter(
|
|
48
49
|
f => !avant.has(f) && f.endsWith('.json')
|
|
49
50
|
);
|
|
50
51
|
const dossier = env[RESULTATS];
|
|
52
|
+
const taches = [];
|
|
51
53
|
for (const f of neufs) {
|
|
54
|
+
for (const t of lireJson(path.join(runs, f))?.tasks ?? []) {
|
|
55
|
+
taches.push({ tache: t.taskId, code: t.execution?.exitCode ?? null });
|
|
56
|
+
}
|
|
52
57
|
if (dossier) {
|
|
53
58
|
mkdirSync(path.join(dossier, TURBO), { recursive: true });
|
|
54
59
|
// The results directory may lie on another file system: a copy, then the removal.
|
|
@@ -59,6 +64,7 @@ export function garderLesResumes(racine, avant, env = process.env) {
|
|
|
59
64
|
if (neufs.length && !avant.size && existsSync(runs) && readdirSync(runs).length === 0) {
|
|
60
65
|
rmdirSync(runs);
|
|
61
66
|
}
|
|
67
|
+
return taches;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
// The tasks of the summaries under the results directory <dossier>, in their order:
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
// scripts/mesure/avancement.mjs), the reporter of progress writes there the files done and planned of its
|
|
66
66
|
// task at each test file done, which the board reads (scripts/avancement.mjs,
|
|
67
67
|
// scripts/tableau.mjs).
|
|
68
|
+
import { readdirSync, rmSync } from 'node:fs';
|
|
69
|
+
import path from 'node:path';
|
|
68
70
|
import { fileURLToPath } from 'node:url';
|
|
69
71
|
import {
|
|
70
72
|
ligneDesRestes,
|
|
@@ -120,6 +122,13 @@ function baseDeVitest() {
|
|
|
120
122
|
Object.assign(process.env, b.env);
|
|
121
123
|
retirerALInterruption(b.fermer);
|
|
122
124
|
process.on('exit', () => {
|
|
125
|
+
// The registers of the test files (registre.setup.mjs): a file whose tests are all skipped
|
|
126
|
+
// runs no `afterAll`, so its register directory goes with the base, not as a rest.
|
|
127
|
+
for (const n of readdirSync(b.dossier)) {
|
|
128
|
+
if (n.startsWith('grillhouse-registre-')) {
|
|
129
|
+
rmSync(path.join(b.dossier, n),{ recursive: true, force: true });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
123
132
|
const ligne = ligneDesRestes([
|
|
124
133
|
...b.restes().filter(n => !CACHES_DES_OUTILS.has(n)),
|
|
125
134
|
...b.essais(),
|
|
@@ -154,6 +163,7 @@ export default {
|
|
|
154
163
|
ici('./mesure.setup.mjs'),
|
|
155
164
|
ici('./machine.setup.mjs'),
|
|
156
165
|
ici('./resultats.setup.mjs'),
|
|
166
|
+
ici('./registre.setup.mjs'),
|
|
157
167
|
],
|
|
158
168
|
watch: false,
|
|
159
169
|
...travailleurs(),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// A setup file of the base configuration: a test file's register is its own, as git's tests give
|
|
2
|
+
// each test a HOME of its own. When the launch names no register (`GRILLHOUSE_REGISTRE`), the file
|
|
3
|
+
// names one under a directory of its own in the temporary directory, which every process the test
|
|
4
|
+
// starts inherits (scripts/registre.mjs reads the variable first); the directory is removed at the
|
|
5
|
+
// end of the test file, and at the exit of the process for one made inside a running test. A
|
|
6
|
+
// register the launch names stays.
|
|
7
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
8
|
+
import { tmpdir } from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { afterAll, onTestFinished } from 'vitest';
|
|
11
|
+
|
|
12
|
+
const DOSSIERS = (globalThis.__grillhouseRegistresDEssai ??= new Set());
|
|
13
|
+
if (DOSSIERS.size === 0) {
|
|
14
|
+
process.on('exit', () => {
|
|
15
|
+
for (const d of DOSSIERS) {
|
|
16
|
+
rmSync(d, { recursive: true, force: true });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!process.env.GRILLHOUSE_REGISTRE) {
|
|
22
|
+
const dossier = mkdtempSync(path.join(tmpdir(), 'grillhouse-registre-'));
|
|
23
|
+
DOSSIERS.add(dossier);
|
|
24
|
+
process.env.GRILLHOUSE_REGISTRE = path.join(dossier, 'essai.jsonl');
|
|
25
|
+
const retirer = () => {
|
|
26
|
+
rmSync(dossier, { recursive: true, force: true });
|
|
27
|
+
DOSSIERS.delete(dossier);
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
// Imported inside a running test (a test of this file's behavior): the end of that test.
|
|
31
|
+
onTestFinished(retirer);
|
|
32
|
+
} catch {
|
|
33
|
+
afterAll(retirer);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -76,7 +76,9 @@ const constanteGarde = t => /\bconst\s+GARDE\s*=\s*['"]([^'"]+)['"]/.exec(t)?.[1
|
|
|
76
76
|
|
|
77
77
|
// The names of the guard <fichier> (text <t>), or [] when it is not a guard with a debt.
|
|
78
78
|
function nomsDeGarde(fichier, t) {
|
|
79
|
-
if (
|
|
79
|
+
if (
|
|
80
|
+
!imports(t, fichier).some(i => /\btrancher\b/.test(i.noms) && /\/dette(\.mjs)?$/.test(i.chemin))
|
|
81
|
+
) {
|
|
80
82
|
return [];
|
|
81
83
|
}
|
|
82
84
|
const noms = new Set();
|
|
@@ -93,7 +95,9 @@ function nomsDeGarde(fichier, t) {
|
|
|
93
95
|
// installed under node_modules. A project that installs the frame judges none of its scripts.
|
|
94
96
|
function chezLeCadre(racine, scripts) {
|
|
95
97
|
const rel = path.relative(racine, scripts);
|
|
96
|
-
return
|
|
98
|
+
return (
|
|
99
|
+
!rel.startsWith('..') && !path.isAbsolute(rel) && !rel.split(path.sep).includes('node_modules')
|
|
100
|
+
);
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
// The refusals of the repository at <racine>, its frame's scripts at <scripts>.
|
|
@@ -125,7 +129,9 @@ export function verifier(racine, scripts = DOSSIER) {
|
|
|
125
129
|
const noms = nomsDeGarde(g, t);
|
|
126
130
|
for (const nom of noms) {
|
|
127
131
|
const couverte = jouees.some(({ m, t: tm }) => {
|
|
128
|
-
const lien = imports(tm, m).find(
|
|
132
|
+
const lien = imports(tm, m).find(
|
|
133
|
+
i => i.chemin === g || i.chemin === g.replace(/\.mjs$/, '')
|
|
134
|
+
);
|
|
129
135
|
if (!lien) {
|
|
130
136
|
return false;
|
|
131
137
|
}
|
|
@@ -147,8 +153,13 @@ export function verifier(racine, scripts = DOSSIER) {
|
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
// The report of the guard at <racine>: its lines and its exit code, the findings counted against
|
|
150
|
-
// the debt.
|
|
156
|
+
// the debt. A repository whose frame's scripts are not its own (a project, or a copy that runs the
|
|
157
|
+
// scripts of another tree) is not measured: its debt is neither judged nor pruned, since no
|
|
158
|
+
// finding there says what is corrected.
|
|
151
159
|
export function rapport(racine, env = process.env, scripts = DOSSIER) {
|
|
160
|
+
if (!chezLeCadre(racine, scripts)) {
|
|
161
|
+
return { lignes: [], code: 0 };
|
|
162
|
+
}
|
|
152
163
|
const { refus, lignes } = trancher(
|
|
153
164
|
racine,
|
|
154
165
|
GARDE,
|
package/scripts/registre.mjs
CHANGED
|
@@ -47,9 +47,9 @@ import { roleDeLAgent } from './etapes.mjs';
|
|
|
47
47
|
import { lireFichier, ROLE_DE_LA_NUIT, ROLE_DU_CIRCUIT, roleDuMeta, tourne } from './tableau.mjs';
|
|
48
48
|
import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
import { REGISTRE } from './adresse-du-registre.mjs';
|
|
51
|
+
|
|
52
|
+
export { REGISTRE };
|
|
53
53
|
|
|
54
54
|
// The transcript and the role the hook's input names: a sub-agent's sits next to the session's.
|
|
55
55
|
export function source(input) {
|
|
@@ -23,6 +23,6 @@ export function lesReponses(ticket, statut, ecrit) {
|
|
|
23
23
|
}
|
|
24
24
|
const etendre = '--etendre <paquet>';
|
|
25
25
|
return statut === 'RUNNING'
|
|
26
|
-
? `${circuit} --reprendre\`, \`${depuis}\`, \`${etendre}
|
|
26
|
+
? `${circuit} --reprendre\`, \`${depuis}\`, \`${etendre}\`, \`--reporter <heure>\` ou \`--arreter`
|
|
27
27
|
: `${circuit} --reprendre\`, \`${depuis}\` ou \`${etendre}`;
|
|
28
28
|
}
|
package/scripts/superviseur.mjs
CHANGED
|
@@ -111,9 +111,26 @@ function seance(depart = process.ppid) {
|
|
|
111
111
|
return depart;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Of the tickets <tickets> (as `bd show --json` gives them), the ids of those whose question does
|
|
116
|
+
* not wait for the supervisor at <maintenant> (ms): closed, or deferred to a later time
|
|
117
|
+
* (`defer_until`, the answer `--reporter <heure>`), as a review's snooze hides a request until its
|
|
118
|
+
* hour, then shows it again.
|
|
119
|
+
* @param {{ id: string, status?: string, defer_until?: string }[]} tickets
|
|
120
|
+
* @param {number} maintenant
|
|
121
|
+
* @returns {Set<string>}
|
|
122
|
+
*/
|
|
123
|
+
export function horsAttente(tickets, maintenant) {
|
|
124
|
+
return new Set(
|
|
125
|
+
tickets
|
|
126
|
+
.filter(t => t.status === 'closed' || Date.parse(t.defer_until ?? '') > maintenant)
|
|
127
|
+
.map(t => t.id)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Of the tickets <ids> of the repository at <racine>, those whose question does not wait now
|
|
132
|
+
// (`horsAttente`); none when bd does not read them.
|
|
133
|
+
export function ticketsHorsAttente(racine, ids) {
|
|
117
134
|
const r = spawnSync('bd', ['show', ...ids, '--json'], {
|
|
118
135
|
cwd: racine,
|
|
119
136
|
encoding: 'utf8',
|
|
@@ -121,11 +138,7 @@ export function ticketsFermes(racine, ids) {
|
|
|
121
138
|
maxBuffer: 256 * 1024 * 1024,
|
|
122
139
|
});
|
|
123
140
|
try {
|
|
124
|
-
return
|
|
125
|
-
JSON.parse(r.stdout)
|
|
126
|
-
.filter(t => t.status === 'closed')
|
|
127
|
-
.map(t => t.id)
|
|
128
|
-
);
|
|
141
|
+
return horsAttente(JSON.parse(r.stdout), Date.now());
|
|
129
142
|
} catch {
|
|
130
143
|
return new Set();
|
|
131
144
|
}
|
|
@@ -374,7 +387,7 @@ function enAttente(lus, racine, fermes) {
|
|
|
374
387
|
export function questionsEnAttente(
|
|
375
388
|
racine,
|
|
376
389
|
circuits,
|
|
377
|
-
{ fermes =
|
|
390
|
+
{ fermes = ticketsHorsAttente, sauf = new Set() } = {}
|
|
378
391
|
) {
|
|
379
392
|
return enAttente(
|
|
380
393
|
circuits.filter(c => attendLeSuperviseur(c) && !sauf.has(cleDe(c))),
|
|
@@ -413,7 +426,7 @@ const aucunFerme = () => new Set();
|
|
|
413
426
|
*/
|
|
414
427
|
export async function attendreUneQuestion({
|
|
415
428
|
racine,
|
|
416
|
-
fermes =
|
|
429
|
+
fermes = ticketsHorsAttente,
|
|
417
430
|
pas = 5_000,
|
|
418
431
|
signal,
|
|
419
432
|
circuitsDe = circuitsDuServeur,
|
|
@@ -590,7 +603,7 @@ export function texteDesQuestions(questions) {
|
|
|
590
603
|
*/
|
|
591
604
|
export async function circuitsALOuverture(
|
|
592
605
|
racine,
|
|
593
|
-
{ fermes =
|
|
606
|
+
{ fermes = ticketsHorsAttente, circuitsDe = circuitsDuServeur, ticketsDe = lireLesTickets } = {}
|
|
594
607
|
) {
|
|
595
608
|
let circuits = null;
|
|
596
609
|
let panne = null;
|