@roomi-fields/grillhouse 0.39.0 → 0.41.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 +17 -1
- package/dist/temporal/circuit/deroule.js +21 -68
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +0 -1
- package/dist/temporal/file/activites.js +0 -3
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +0 -8
- package/dist/temporal/file/deroule.d.ts +1 -7
- package/dist/temporal/file/deroule.js +7 -124
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +0 -2
- package/dist/temporal/places/contrat.js +0 -2
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +4 -12
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +0 -1
- package/dist/temporal/tickets/activites.js +0 -9
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +0 -8
- package/dist/temporal/tickets/deroule.js +11 -36
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +11 -17
- package/docs/INTERFACE.md +6 -5
- package/hooks/register.tsx +13 -4
- package/package.json +1 -1
- package/scripts/activites.mjs +20 -4
- package/scripts/faits-du-circuit.mjs +3 -11
- package/scripts/grillhouse-maj.mjs +27 -0
- package/scripts/integration/file.mjs +4 -75
- package/scripts/langages/typescript/vitest-config/cibles.mjs +10 -5
- package/scripts/nuit.sh +3 -0
- package/scripts/prefixe-des-tickets.mjs +16 -2
- package/scripts/preparation.mjs +5 -8
- package/scripts/tableau.mjs +36 -1
- package/scripts/verdict-de-la-nuit.mjs +47 -0
package/package.json
CHANGED
package/scripts/activites.mjs
CHANGED
|
@@ -937,13 +937,17 @@ export function preuveReussie(
|
|
|
937
937
|
// of its own — an aggregator harness (tests/it/main.rs, `mod …;`) or shared test matter; not a
|
|
938
938
|
// casse. With a result but no test (<res> present, 0 tests), it is a casse only when that result
|
|
939
939
|
// itself failed. Returns the kind of casse (`non-joue`, `ne-charge-pas`) or null when there is none.
|
|
940
|
-
export function casseDeChargement({ res, code, constructions }) {
|
|
940
|
+
export function casseDeChargement({ res, code, constructions, aDesResultats = false }) {
|
|
941
941
|
const tests = res?.tests ?? [];
|
|
942
942
|
if (constructions.length && (!res || tests.length === 0)) {
|
|
943
943
|
return null;
|
|
944
944
|
}
|
|
945
945
|
if (!res) {
|
|
946
|
-
|
|
946
|
+
// No result at this file's name: an aggregator harness (tests/it/main.rs, `mod …;`) with no test
|
|
947
|
+
// of its own. A casse only when the binary did not run — code ≠ 0 and the run produced no result
|
|
948
|
+
// at all. When the run produced results (its modules played, some may have failed, so the single
|
|
949
|
+
// binary exits non-zero), the harness ran: not a casse, its modules' reds carry the proof.
|
|
950
|
+
return code === 0 || aDesResultats ? null : 'non-joue';
|
|
947
951
|
}
|
|
948
952
|
if (tests.length === 0) {
|
|
949
953
|
return res.etat === 'failed' ? 'ne-charge-pas' : null;
|
|
@@ -1603,11 +1607,23 @@ export function preuve(ctx, { mesure: derniere = null, fichiers: seuls = null }
|
|
|
1603
1607
|
}
|
|
1604
1608
|
}
|
|
1605
1609
|
}
|
|
1606
|
-
|
|
1610
|
+
// The files judged: those of the lot in the group, and, for a single integration binary that
|
|
1611
|
+
// plays its modules (Rust `tests/it/main.rs`), each module file the run reports — the group names
|
|
1612
|
+
// the binary, the results name the modules, so a module's reds are credited to the lot, and the
|
|
1613
|
+
// aggregator is no false casse. A package played whole (`entier`) keeps its own branch above.
|
|
1614
|
+
const fichiersDuGroupe = entier
|
|
1615
|
+
? groupe
|
|
1616
|
+
: [...new Set([...groupe, ...resultats.map(r => path.relative(ctx.copie, r.fichier))])];
|
|
1617
|
+
for (const f of fichiersDuGroupe) {
|
|
1607
1618
|
const res = resultats.find(t => t.fichier === path.join(ctx.copie, f));
|
|
1608
1619
|
const tests = res?.tests ?? [];
|
|
1609
1620
|
const deHead = vertsDuRegistre(registre, f);
|
|
1610
|
-
const casse = casseDeChargement({
|
|
1621
|
+
const casse = casseDeChargement({
|
|
1622
|
+
res,
|
|
1623
|
+
code,
|
|
1624
|
+
constructions,
|
|
1625
|
+
aDesResultats: resultats.length > 0,
|
|
1626
|
+
});
|
|
1611
1627
|
if (casse === 'non-joue') {
|
|
1612
1628
|
casses.push(
|
|
1613
1629
|
`${f} — ne se charge pas : non joué (code ${code}) ; le journal du ticket : ${ctx.journal} (il se cite en pièce, \`${ctx.ticket}.log:<ligne>\`)`
|
|
@@ -51,8 +51,9 @@
|
|
|
51
51
|
// activity;
|
|
52
52
|
// - the acts of the queue of a project (scripts/integration/file.mjs, grillhouse-4nr.8): `situer`,
|
|
53
53
|
// where the lot of a ticket stands (`situerLeLot`); `brancher`, the branch made the candidate its
|
|
54
|
-
// CI judges and pushed (`preparerLaBranche`); `
|
|
55
|
-
// (`
|
|
54
|
+
// CI judges and pushed (`preparerLaBranche`); `passages`, one reading of the CI of a commit, its
|
|
55
|
+
// expected workflows together (`lireLesPassagesDeLaCI`); `conclure`, the CI concluded at the
|
|
56
|
+
// ticket (`conclureLaCI`); `avancer`,
|
|
56
57
|
// main moved onto the candidate (`avancerMain`); each of `brancher` and `avancer` telling the
|
|
57
58
|
// ticket of a branch out of the queue or kept (`direLIssue`); `fermer`, the ticket closed and main
|
|
58
59
|
// pushed (`fermerLEntree`); `effet-de-la-file`, one effect they gave back, under the key of its
|
|
@@ -89,7 +90,6 @@ import {
|
|
|
89
90
|
inscrireLesFluxDeMain,
|
|
90
91
|
lireLesPassagesDeLaCI,
|
|
91
92
|
relireLesLecturesDues,
|
|
92
|
-
lireUneFoisLaCI,
|
|
93
93
|
outilsDeLaFile,
|
|
94
94
|
preparerLaBranche,
|
|
95
95
|
situerLeLot,
|
|
@@ -440,14 +440,6 @@ Object.assign(ACTES, {
|
|
|
440
440
|
const o = laFile(racine);
|
|
441
441
|
return { ...fermerLEntree(o, { ticket, branche, commit }), effets: o.rendus };
|
|
442
442
|
},
|
|
443
|
-
// A reading of the CI writes the steps of its run done over planned in the working directory of
|
|
444
|
-
// the ticket, where the board reads them (scripts/avancement.mjs `avancementDeLaCI`); one that
|
|
445
|
-
// looks for its run (no run found yet) empties the records of another.
|
|
446
|
-
async ci({ racine, ticket, sha, branche, passage }) {
|
|
447
|
-
const travail = path.join(racine, '.claude', 'worktrees', `${ticket}.travail`);
|
|
448
|
-
const avancement = avancementDeLaCI(travail, { nouvelle: passage === null });
|
|
449
|
-
return lireUneFoisLaCI(laFile(racine, avancement), { sha, branche, passage });
|
|
450
|
-
},
|
|
451
443
|
// A reading of the CI of every expected workflow of the commit (`lireLesPassagesDeLaCI`), its
|
|
452
444
|
// steps written to the progress directory of the ticket.
|
|
453
445
|
async passages({ racine, ticket, sha, branche }) {
|
|
@@ -164,6 +164,7 @@ import { lireGroupe, projetsExternes } from './groupe-cles.mjs';
|
|
|
164
164
|
import { migrer, restesAuProjet } from './migrations.mjs';
|
|
165
165
|
import { langageDe, langagesDe } from './langages.mjs';
|
|
166
166
|
import * as langagesDansLArchitecture from './migrations/0.27.0-langages-dans-l-architecture.mjs';
|
|
167
|
+
import { CONFIG_BEADS, ecrireLePrefixe, prefixe, prefixeDuStore } from './prefixe-des-tickets.mjs';
|
|
167
168
|
import { poserLesWorkflows } from './workflows-du-cadre.mjs';
|
|
168
169
|
|
|
169
170
|
const SCRIPTS = {
|
|
@@ -372,6 +373,16 @@ function poserLesProjetsExternes(projet, groupe, bd) {
|
|
|
372
373
|
return poses;
|
|
373
374
|
}
|
|
374
375
|
|
|
376
|
+
// Whether the `.beads/config.yaml` of <projet> holds an active key `issue-prefix`.
|
|
377
|
+
function cleActive(projet) {
|
|
378
|
+
try {
|
|
379
|
+
prefixe(projet);
|
|
380
|
+
return true;
|
|
381
|
+
} catch {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
375
386
|
/**
|
|
376
387
|
* Brings the project at `projet` to the frame's files at `source` (CADRE, scripts/cadre.mjs; a
|
|
377
388
|
* trial's own in the tests); <inscrite> is the version it records (the package's; null records
|
|
@@ -505,6 +516,11 @@ export function mettreAJour(projet, source, { inscrite = VERSION, bd = jouerBd }
|
|
|
505
516
|
attribuer(projet);
|
|
506
517
|
bilan.workflows = poserLesWorkflows(projet, source);
|
|
507
518
|
bilan.projetsExternes = poserLesProjetsExternes(projet, groupe, bd);
|
|
519
|
+
// The key `issue-prefix`, when no active one exists: the store's value, never a guess.
|
|
520
|
+
if (existsSync(path.join(projet, CONFIG_BEADS)) && !cleActive(projet)) {
|
|
521
|
+
const valeur = prefixeDuStore(projet, bd);
|
|
522
|
+
bilan.prefixe = valeur === '' ? { manque: true } : { pose: ecrireLePrefixe(projet, valeur) };
|
|
523
|
+
}
|
|
508
524
|
return bilan;
|
|
509
525
|
}
|
|
510
526
|
|
|
@@ -564,6 +580,11 @@ export function rapport(b) {
|
|
|
564
580
|
`Projets externes de Beads : ${b.projetsExternes.join(', ')} posé(s) depuis grillhouse.groupe.`
|
|
565
581
|
);
|
|
566
582
|
}
|
|
583
|
+
if (b.prefixe?.pose) {
|
|
584
|
+
lignes.push(
|
|
585
|
+
`Préfixe des tickets : ${CONFIG_BEADS} pose \`${b.prefixe.pose}\`, la valeur du store de Beads.`
|
|
586
|
+
);
|
|
587
|
+
}
|
|
567
588
|
if (b.workflows?.length > 0) {
|
|
568
589
|
lignes.push(
|
|
569
590
|
`Workflows du cadre : ${b.workflows.join(', ')} écrit(s) depuis le gabarit ; leur machine est la variable RUNNER du dépôt sur GitHub (ubuntu-latest sans elle), que la mise à jour ne touche pas.`
|
|
@@ -703,6 +724,12 @@ function mettreAJourLeProjet(projet, premiere) {
|
|
|
703
724
|
process.stderr.write(`${l}\n`);
|
|
704
725
|
process.exitCode = 1;
|
|
705
726
|
}
|
|
727
|
+
if (b.prefixe?.manque) {
|
|
728
|
+
process.stderr.write(
|
|
729
|
+
`Préfixe des tickets : le store de Beads n'en donne aucun ; pose \`issue-prefix: "<préfixe des tickets du projet>"\` dans ${CONFIG_BEADS}, le préfixe étant celui que le projet choisit.\n`
|
|
730
|
+
);
|
|
731
|
+
process.exitCode = 1;
|
|
732
|
+
}
|
|
706
733
|
const binaires = installerBinaires(projet);
|
|
707
734
|
if (binaires.installes.length > 0) {
|
|
708
735
|
process.stdout.write(`Binaires installés : ${binaires.installes.join(', ')}.\n`);
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
// and `*.yaml`, their `on` and its filters as GitHub reads them); with none, no run is looked for,
|
|
40
40
|
// and the branch stays in the queue, the ticket told that the CI of the project must listen to
|
|
41
41
|
// `agent/**`. A workflow the queue cannot judge (a file it cannot read, a filter on the paths)
|
|
42
|
-
// counts as one that runs. With one, each reading (`
|
|
43
|
-
// (`gh run list --commit <sha> --branch <branche> --json
|
|
44
|
-
// reads
|
|
42
|
+
// counts as one that runs. With one, each reading (`lireLesPassagesDeLaCI`) looks for the runs of
|
|
43
|
+
// its expected workflows (`gh run list --commit <sha> --branch <branche> --json ...`), then
|
|
44
|
+
// reads each (`gh run view <id> --json status,conclusion,jobs`), as `gh run watch` does; the
|
|
45
45
|
// workflow of the CI of the commit spaces the readings and bounds the search and the wait
|
|
46
46
|
// (`ciDuCommit`). Green on the conclusion `success`, red on any other. Under the circuit's progress
|
|
47
47
|
// directory (scripts/avancement.mjs), each reading writes there the steps of the run done over
|
|
@@ -219,7 +219,7 @@ export function fluxDeLaBranche(fichiers, branche) {
|
|
|
219
219
|
.map(({ chemin }) => chemin);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
// The verdicts of a reading of the CI (`
|
|
222
|
+
// The verdicts of a reading of the CI (`lireLesPassagesDeLaCI`, then the workflow `ciDuCommit`).
|
|
223
223
|
const VERTE = 'verte';
|
|
224
224
|
const SANS_CI = 'sans-ci';
|
|
225
225
|
const NON_LUE = 'non-lue';
|
|
@@ -483,77 +483,6 @@ export function outilsDeLaFile(racine, dire, avancement = null) {
|
|
|
483
483
|
return { racine, principale, bd, gh: ghDans(racine), dire, avancement };
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
/**
|
|
487
|
-
* One reading of the CI of the commit <sha> pushed to <branche>, with the tools <o> (`outilsDeLaFile`),
|
|
488
|
-
* the run <passage> found by a reading before (null while it is looked for): `{ etat: 'sans-ci' }`
|
|
489
|
-
* (no workflow runs on a push to the branch), `{ etat: 'cherche' }` (no run yet), `{ etat:
|
|
490
|
-
* 'en-cours', passage }`, `{ etat: 'finie', passage, conclusion }`, or `{ etat: 'non-lue', raison
|
|
491
|
-
* }` (gh absent, refusing, or its output unreadable). The run is the one of <sha> on <branche>,
|
|
492
|
-
* read at its current attempt (`gh run view <id>` without `--attempt`). A run found is read at
|
|
493
|
-
* once. It writes nothing to the ticket: `conclureLaCI` does.
|
|
494
|
-
*/
|
|
495
|
-
export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
|
|
496
|
-
const { gh } = o;
|
|
497
|
-
let id = passage;
|
|
498
|
-
if (id === null) {
|
|
499
|
-
if (fluxDuCommit(o.racine, sha, branche).length === 0) {
|
|
500
|
-
// (the reading of before the CI of every workflow, kept for the replay of `lireLaCI`)
|
|
501
|
-
return { etat: SANS_CI };
|
|
502
|
-
}
|
|
503
|
-
const r = gh([
|
|
504
|
-
'run',
|
|
505
|
-
'list',
|
|
506
|
-
'--commit',
|
|
507
|
-
sha,
|
|
508
|
-
'--branch',
|
|
509
|
-
branche,
|
|
510
|
-
'--json',
|
|
511
|
-
'databaseId,status,conclusion',
|
|
512
|
-
]);
|
|
513
|
-
if (r.error) {
|
|
514
|
-
return { etat: NON_LUE, raison: `gh ne se lance pas (${r.error.code ?? r.error.message}).` };
|
|
515
|
-
}
|
|
516
|
-
if (r.status !== 0) {
|
|
517
|
-
return { etat: NON_LUE, raison: `gh run list refuse :\n${`${r.stderr}${r.stdout}`.trim()}` };
|
|
518
|
-
}
|
|
519
|
-
let passages = [];
|
|
520
|
-
try {
|
|
521
|
-
passages = JSON.parse(r.stdout || '[]');
|
|
522
|
-
} catch {
|
|
523
|
-
return {
|
|
524
|
-
etat: NON_LUE,
|
|
525
|
-
raison: `gh run list rend une sortie illisible :\n${r.stdout.trim()}`,
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
const trouve = passages.find(x => x?.databaseId);
|
|
529
|
-
if (!trouve) {
|
|
530
|
-
return { etat: 'cherche' };
|
|
531
|
-
}
|
|
532
|
-
id = String(trouve.databaseId);
|
|
533
|
-
}
|
|
534
|
-
const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
|
|
535
|
-
timeout: 60_000,
|
|
536
|
-
killSignal: 'SIGKILL',
|
|
537
|
-
});
|
|
538
|
-
if (v.error) {
|
|
539
|
-
return { etat: NON_LUE, raison: `gh ne se lance pas (${v.error.code ?? v.error.message}).` };
|
|
540
|
-
}
|
|
541
|
-
if (v.status !== 0) {
|
|
542
|
-
return { etat: NON_LUE, raison: `gh run view refuse :\n${`${v.stderr}${v.stdout}`.trim()}` };
|
|
543
|
-
}
|
|
544
|
-
let vue;
|
|
545
|
-
try {
|
|
546
|
-
vue = JSON.parse(v.stdout || '{}');
|
|
547
|
-
} catch {
|
|
548
|
-
return { etat: NON_LUE, raison: `gh run view rend une sortie illisible :\n${v.stdout.trim()}` };
|
|
549
|
-
}
|
|
550
|
-
ecrireLesEtapes(o.avancement, vue);
|
|
551
|
-
if (vue?.status === 'completed') {
|
|
552
|
-
return { etat: 'finie', passage: id, conclusion: vue.conclusion ?? null };
|
|
553
|
-
}
|
|
554
|
-
return { etat: 'en-cours', passage: id };
|
|
555
|
-
}
|
|
556
|
-
|
|
557
486
|
/**
|
|
558
487
|
* One reading of the CI of the commit <sha> pushed to <branche>, every expected workflow
|
|
559
488
|
* (`fluxDuCommit`) read together, with the tools <o>: `{ etat: 'sans-ci' }`; `{ etat: 'non-lue',
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
// day leaves out, through the plugin `nuit`: the night tests, the benches and the witnesses; the
|
|
41
41
|
// variable `GRILLHOUSE_TESTS_DE_NUIT` (NUIT_VARIABLE) chooses `nuit`, the night tests alone,
|
|
42
42
|
// `hors-poste`, the night tests but those that bear the tag `@poste` at their head (the night of
|
|
43
|
-
// a shared machine), or `mesures`, the benches and the witnesses alone
|
|
44
|
-
// (`fileParallelism: false
|
|
43
|
+
// a shared machine), or `mesures`, the benches and the witnesses alone; every choice plays one
|
|
44
|
+
// file at a time (`fileParallelism: false`, the night at rest: a night test mounts a trial, a
|
|
45
|
+
// measure is taken under no load), as scripts/langages/typescript/tests-de-nuit.mjs plays them; the
|
|
45
46
|
// variable `GRILLHOUSE_TRANCHE_DE_NUIT` (NUIT_TRANCHE) gives the run its tranche, as a tranche of
|
|
46
47
|
// the day (`trancher`, ../tranches.mjs).
|
|
47
48
|
// - A tranche of a pass (`tranche`, `i/n`, and `rapports` in the value, `npm run verifier --
|
|
@@ -303,8 +304,9 @@ export function testsDuPoste(dir) {
|
|
|
303
304
|
* The plugin of the night's configuration: the night tests, the benches and the time witnesses
|
|
304
305
|
* under its directory, or, as <env> chooses in NUIT_VARIABLE, the night tests alone (`nuit`), the
|
|
305
306
|
* night tests but those tagged `@poste` (`hors-poste`, the night of a shared machine: a CI), or the
|
|
306
|
-
* measures alone
|
|
307
|
-
* NUIT_TRANCHE, the tranche it carries of these
|
|
307
|
+
* measures alone (`mesures`), the benches and the witnesses; every choice plays one file at a time
|
|
308
|
+
* (`fileParallelism: false`), the night at rest; with NUIT_TRANCHE, the tranche it carries of these
|
|
309
|
+
* files.
|
|
308
310
|
* @param {NodeJS.ProcessEnv} [env] the environment that holds the choice
|
|
309
311
|
*/
|
|
310
312
|
export const nuit = (env = process.env) => ({
|
|
@@ -316,6 +318,10 @@ export const nuit = (env = process.env) => ({
|
|
|
316
318
|
delete env[NUIT_TRANCHE];
|
|
317
319
|
const test = (config.test ??= {});
|
|
318
320
|
const temoins = temoinsDe(config, { ...test, include: INCLUDE });
|
|
321
|
+
// The night plays one file at a time, at rest, without the files competing: a night test mounts
|
|
322
|
+
// a trial (a Temporal server, a copy) and a measure is taken under no load, so neither saturates
|
|
323
|
+
// the machine against the other.
|
|
324
|
+
test.fileParallelism = false;
|
|
319
325
|
if (choix === 'nuit') {
|
|
320
326
|
test.include = [NUIT];
|
|
321
327
|
} else if (choix === 'hors-poste') {
|
|
@@ -329,7 +335,6 @@ export const nuit = (env = process.env) => ({
|
|
|
329
335
|
}
|
|
330
336
|
} else if (choix === 'mesures') {
|
|
331
337
|
test.include = [BUDGET, ...temoins];
|
|
332
|
-
test.fileParallelism = false;
|
|
333
338
|
} else {
|
|
334
339
|
test.include = [...HORS_DU_JOUR, ...temoins];
|
|
335
340
|
}
|
package/scripts/nuit.sh
CHANGED
|
@@ -352,6 +352,9 @@ verdict=$?
|
|
|
352
352
|
# The copies whose content is on main go once the steps are played, the night's own kept and
|
|
353
353
|
# pruned of its tools' outputs; their removal never changes the verdict.
|
|
354
354
|
(cd "$racine" && node "$ici/retirer-les-copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
|
|
355
|
+
# The project's durable verdict, read by the board: green on 0, red on any other code but 75, which
|
|
356
|
+
# writes nothing (the previous verdict stays).
|
|
357
|
+
node "$ici/verdict-de-la-nuit.mjs" "$commun" "$verdict" >> "$journal" 2>&1 || true
|
|
355
358
|
|
|
356
359
|
if [ "$verdict" -eq 75 ]; then
|
|
357
360
|
echo "⏱ à repasser : ${tete:0:7} n'est ni vert ni rouge, la machine est restée chargée ; le dernier vert reste, aucun ticket, la nuit suivante rejoue." >> "$journal"
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// `.beads/config.yaml`, the one place a CI reads it (it has no `bd`): the guard of the titles of the
|
|
3
3
|
// tests reads it there (scripts/langages/typescript/titres-de-tests.mjs). `bd init` writes the key
|
|
4
4
|
// commented out and keeps the prefix in its database, so the frame writes the key itself, by one
|
|
5
|
-
// function: the preparation of a new project (./preparation.mjs) and the update of
|
|
6
|
-
// (the
|
|
5
|
+
// function: the preparation of a new project (./preparation.mjs) and the update of any project
|
|
6
|
+
// (`mettreAJour`, which writes the key when no active one exists, the value being the store's).
|
|
7
7
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { pathToFileURL } from 'node:url';
|
|
@@ -44,6 +44,20 @@ export function prefixe(racine) {
|
|
|
44
44
|
return valeur;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The prefix the store of Beads holds (`bd config get issue_prefix`, run in <racine> by <bd>, as
|
|
49
|
+
* `bd(args, cwd)` gives `{ status, stdout, stderr }`): '' without a value, on a failure, or when the
|
|
50
|
+
* output is a placeholder (it holds `(`).
|
|
51
|
+
* @param {string} racine
|
|
52
|
+
* @param {(args: string[], cwd: string) => { status: number | null, stdout?: string }} bd
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
export function prefixeDuStore(racine, bd) {
|
|
56
|
+
const r = bd(['config', 'get', 'issue_prefix'], racine);
|
|
57
|
+
const valeur = (r.stdout ?? '').trim();
|
|
58
|
+
return r.status === 0 && valeur !== '' && !valeur.includes('(') ? valeur : '';
|
|
59
|
+
}
|
|
60
|
+
|
|
47
61
|
/**
|
|
48
62
|
* Writes the key `issue-prefix: "<valeur>"` in the `.beads/config.yaml` of the repository at
|
|
49
63
|
* <racine>, which exists: a key written empty is replaced, an absent one added at the end; a key
|
package/scripts/preparation.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { existsSync } from 'node:fs';
|
|
|
22
22
|
import path from 'node:path';
|
|
23
23
|
import { trouverDansLePath } from './commandes-du-path.mjs';
|
|
24
24
|
import { installerGreffons } from './greffons.mjs';
|
|
25
|
-
import { ecrireLePrefixe } from './prefixe-des-tickets.mjs';
|
|
25
|
+
import { ecrireLePrefixe, prefixeDuStore } from './prefixe-des-tickets.mjs';
|
|
26
26
|
|
|
27
27
|
// The prefix of the tickets: the one given, else the store's own, else the directory's name.
|
|
28
28
|
function prefixeDe(projet, donne) {
|
|
@@ -30,13 +30,10 @@ function prefixeDe(projet, donne) {
|
|
|
30
30
|
return donne;
|
|
31
31
|
}
|
|
32
32
|
if (existsSync(path.join(projet, '.beads'))) {
|
|
33
|
-
const
|
|
34
|
-
cwd:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
const existant = (r.stdout ?? '').trim();
|
|
39
|
-
if (r.status === 0 && existant !== '' && !existant.includes('(')) {
|
|
33
|
+
const existant = prefixeDuStore(projet, (args, cwd) =>
|
|
34
|
+
spawnSync('bd', args, { cwd, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 })
|
|
35
|
+
);
|
|
36
|
+
if (existant !== '') {
|
|
40
37
|
return existant;
|
|
41
38
|
}
|
|
42
39
|
}
|
package/scripts/tableau.mjs
CHANGED
|
@@ -148,6 +148,7 @@ import {
|
|
|
148
148
|
circuitsDuServeur,
|
|
149
149
|
nuitDuServeur,
|
|
150
150
|
} from './circuits-du-serveur.mjs';
|
|
151
|
+
import { lireLeVerdict } from './verdict-de-la-nuit.mjs';
|
|
151
152
|
import {
|
|
152
153
|
aSonArchitecture,
|
|
153
154
|
attendDeLAutreProjet,
|
|
@@ -870,6 +871,7 @@ export function assembler({
|
|
|
870
871
|
outil = null,
|
|
871
872
|
places: placesDeLaMachine = null,
|
|
872
873
|
nuit: nuitEnCours = null,
|
|
874
|
+
verdictDeLaNuit = null,
|
|
873
875
|
muet = false,
|
|
874
876
|
faute = null,
|
|
875
877
|
circuitsLusA = null,
|
|
@@ -1290,7 +1292,13 @@ export function assembler({
|
|
|
1290
1292
|
// A red night says the night it turned red, short enough to stand whole on its line: the local
|
|
1291
1293
|
// day and month its ticket was opened, the night's date (scripts/nuit.sh), whatever its title names, a
|
|
1292
1294
|
// commit in older ones.
|
|
1293
|
-
|
|
1295
|
+
// The alert follows the verdict of the project's last night (`verdictDeLaNuit`), not the presence
|
|
1296
|
+
// of a night ticket: it stands while the verdict is red and falls on green or without a known night.
|
|
1297
|
+
// It names each open night ticket, or says « Nuit rouge » alone when none is open.
|
|
1298
|
+
if (verdictDeLaNuit === 'rouge' && nuit.length === 0) {
|
|
1299
|
+
alerter('nuitRouge', { signe: '🌙', texte: 'Nuit rouge' });
|
|
1300
|
+
}
|
|
1301
|
+
for (const t of verdictDeLaNuit === 'rouge' ? nuit : []) {
|
|
1294
1302
|
const { sujet: titreLu, numero: n } = titre(t);
|
|
1295
1303
|
const ouvert = Date.parse(t.created_at ?? '');
|
|
1296
1304
|
const sujet =
|
|
@@ -1795,6 +1803,18 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1795
1803
|
),
|
|
1796
1804
|
TONS.mesure
|
|
1797
1805
|
);
|
|
1806
|
+
// The day's and the cumulative work time and tokens, summed across the projects, as one
|
|
1807
|
+
// project's board shows its own: a multi-root board sums the figures of its roots.
|
|
1808
|
+
const m = t.jour ?? { travail: 0, jetons: 0 };
|
|
1809
|
+
const mc = t.cumul ?? { travail: 0, jetons: 0 };
|
|
1810
|
+
L(
|
|
1811
|
+
cadre(
|
|
1812
|
+
`jour ${duree(m.travail)} · ${k(m.jetons)} · cumul ${duree(mc.travail)} · ${k(mc.jetons)}`,
|
|
1813
|
+
'',
|
|
1814
|
+
largeur
|
|
1815
|
+
),
|
|
1816
|
+
TONS.mesure
|
|
1817
|
+
);
|
|
1798
1818
|
} else {
|
|
1799
1819
|
const g = t.global;
|
|
1800
1820
|
const c = g.compteurs;
|
|
@@ -2675,6 +2695,7 @@ function lire(
|
|
|
2675
2695
|
machine,
|
|
2676
2696
|
places,
|
|
2677
2697
|
nuit,
|
|
2698
|
+
verdictDeLaNuit: lireLeVerdict(commun),
|
|
2678
2699
|
muet,
|
|
2679
2700
|
faute,
|
|
2680
2701
|
circuitsLusA: lesCircuitsLus.lu,
|
|
@@ -2713,6 +2734,16 @@ export function ensemble(lus) {
|
|
|
2713
2734
|
const marquer = projet => x => ({ ...x, projet });
|
|
2714
2735
|
const noeud = projet => n => ({ ...n, projet, enfants: n.enfants.map(noeud(projet)) });
|
|
2715
2736
|
const tous = cle => lisibles.flatMap(l => (l.t[cle] ?? []).map(marquer(l.etiquette)));
|
|
2737
|
+
// The sum, across the projects, of a measure of `global` (`jour` or `cumul`): its work time and
|
|
2738
|
+
// its tokens added.
|
|
2739
|
+
const sommeDesMesures = cle =>
|
|
2740
|
+
lisibles.reduce(
|
|
2741
|
+
(s, l) => ({
|
|
2742
|
+
travail: s.travail + (l.t.global[cle]?.travail ?? 0),
|
|
2743
|
+
jetons: s.jetons + (l.t.global[cle]?.jetons ?? 0),
|
|
2744
|
+
}),
|
|
2745
|
+
{ travail: 0, jetons: 0 }
|
|
2746
|
+
);
|
|
2716
2747
|
return {
|
|
2717
2748
|
projets: lus.map(l =>
|
|
2718
2749
|
l.t
|
|
@@ -2748,6 +2779,10 @@ export function ensemble(lus) {
|
|
|
2748
2779
|
},
|
|
2749
2780
|
{ new: 0, check: 0, rejetes: 0, valides: 0 }
|
|
2750
2781
|
),
|
|
2782
|
+
// The day's and the cumulative work time and tokens, summed across the projects (each project's
|
|
2783
|
+
// own `global.jour`/`global.cumul`), for the board's time-and-token line of several projects.
|
|
2784
|
+
jour: sommeDesMesures('jour'),
|
|
2785
|
+
cumul: sommeDesMesures('cumul'),
|
|
2751
2786
|
etats: premier.t.etats.map(e => ({
|
|
2752
2787
|
...e,
|
|
2753
2788
|
tickets: lisibles.flatMap(l =>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// The durable verdict of a project's night: the night pass (scripts/nuit.sh) notes it at its end in
|
|
2
|
+
// `<git common dir>/nuit/verdict`, and the board reads it without a server. `vert` when the pass
|
|
3
|
+
// exits 0, `rouge` for any other code but 75 (a missing code included); 75 (« à repasser ») writes
|
|
4
|
+
// nothing and leaves the previous verdict. A read that fails gives no verdict.
|
|
5
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const CODE_A_REPASSER = 75;
|
|
10
|
+
const fichierDuVerdict = commun => path.join(commun, 'nuit', 'verdict');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} commun the git common dir of the project
|
|
14
|
+
* @param {number} code the exit code of the night pass
|
|
15
|
+
* @returns {'vert' | 'rouge' | null} the verdict written, null when the night is to be replayed
|
|
16
|
+
*/
|
|
17
|
+
export function noterLeVerdict(commun, code) {
|
|
18
|
+
if (code === CODE_A_REPASSER) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const verdict = code === 0 ? 'vert' : 'rouge';
|
|
22
|
+
mkdirSync(path.join(commun, 'nuit'), { recursive: true });
|
|
23
|
+
writeFileSync(fichierDuVerdict(commun), `${verdict}\n`);
|
|
24
|
+
return verdict;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param {string | null} commun the git common dir of the project
|
|
29
|
+
* @returns {'vert' | 'rouge' | null} the last night's verdict, null when none is known or it does not read
|
|
30
|
+
*/
|
|
31
|
+
export function lireLeVerdict(commun) {
|
|
32
|
+
if (!commun) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const v = readFileSync(fichierDuVerdict(commun), 'utf8').trim();
|
|
37
|
+
return v === 'vert' || v === 'rouge' ? v : null;
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// `node verdict-de-la-nuit.mjs <commun> <code>`: what nuit.sh calls at the end of the night.
|
|
44
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
|
|
45
|
+
const [commun, code] = process.argv.slice(2);
|
|
46
|
+
noterLeVerdict(commun, code === undefined || code === '' ? NaN : Number(code));
|
|
47
|
+
}
|