@roomi-fields/grillhouse 0.53.0 → 0.54.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 +54 -0
- package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
- package/charte.md +12 -0
- package/dist/temporal/circuit/deroule.js +5 -9
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -2
- package/dist/temporal/installation.js +69 -17
- package/dist/temporal/installation.js.map +1 -1
- package/docs/INTERFACE.md +21 -1
- package/docs/architecture/circuit.md +3 -3
- package/docs/architecture/entree.md +4 -4
- package/docs/architecture/greffon.md +28 -17
- package/docs/architecture/installation.md +21 -11
- package/docs/architecture/machine.md +1 -1
- package/docs/architecture/tests.md +1 -1
- package/hooks/register.tsx +50 -24
- package/package.json +1 -1
- package/scripts/aiguillage.mjs +4 -2
- package/scripts/bd-garde.mjs +69 -0
- package/scripts/ci-de-main.mjs +259 -56
- package/scripts/circuit.mjs +20 -5
- package/scripts/commandes-composees.mjs +1 -1
- package/scripts/droits.mjs +11 -4
- package/scripts/file-des-tickets.mjs +27 -9
- package/scripts/greffons.mjs +282 -17
- package/scripts/langages/c/commandes.mjs +1 -1
- package/scripts/langages/cargo/commandes.mjs +1 -1
- package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
- package/scripts/langages/python/commandes.mjs +1 -1
- package/scripts/langages/typescript/code-mort.mjs +36 -3
- package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +95 -24
- package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
- package/scripts/langages/typescript/parcours.mjs +5 -1
- package/scripts/langages.d.mts +6 -0
- package/scripts/langages.mjs +6 -0
- package/scripts/lire.mjs +236 -0
- package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
- package/scripts/migrations/lire-un-ticket.mjs +46 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +123 -47
- package/scripts/nuit.sh +21 -12
- package/scripts/registre.d.mts +7 -1
- package/scripts/registre.mjs +114 -102
- package/scripts/resultats.mjs +15 -5
- package/scripts/retirer-copie.sh +7 -0
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/suiveur.mjs +12 -4
- package/scripts/superviseur.mjs +111 -31
- package/scripts/tableau.mjs +527 -119
- package/scripts/tarifs.mjs +67 -0
- package/scripts/ticket-du-circuit.mjs +3 -4
- package/scripts/transitions.d.mts +0 -5
- package/scripts/transitions.mjs +3 -13
- package/scripts/verdict-de-la-nuit.mjs +2 -2
- package/skills/explorateur/SKILL.md +10 -5
- package/skills/mesure/SKILL.md +4 -3
- package/skills/pitmaster/SKILL.md +18 -4
- package/skills/pitmaster/references/erreurs.md +4 -2
- package/skills/pitmaster/references/tour.md +11 -4
- package/types/index.d.ts +3 -1
- package/scripts/base-des-workflows.mjs +0 -58
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// The lines the register of finished agents already holds take for `cout` the price of their own
|
|
2
|
+
// tokens and for `jetons` their count (scripts/registre.mjs): a line written before took the total
|
|
3
|
+
// its session wrote, which holds the spending of its sub-agents, and the output of the first line of
|
|
4
|
+
// each response. Their tokens, cache and cost leave out the responses another transcript of the
|
|
5
|
+
// project retains: a line written before counted each copy. Mechanism: installation.md §5.4
|
|
6
|
+
// (packages/grillhouse/docs/architecture/).
|
|
7
|
+
//
|
|
8
|
+
// - `version`: null until the release that brings it, which `grillhouse sortie` numbers.
|
|
9
|
+
// - `migrer` reckons, for the project (the main tree of <projet>), each line of an agent whose
|
|
10
|
+
// transcript still exists: what the responses of all the agent's transcripts dated up to the
|
|
11
|
+
// line's end and retained by no other transcript count, at their tariff (scripts/tarifs.mjs), as
|
|
12
|
+
// the register writes a line (`depenseJusqua`). A line takes its tokens from them; it takes its
|
|
13
|
+
// cache too when one of its responses is retained elsewhere or its agent has several transcripts,
|
|
14
|
+
// and keeps it otherwise. Before it writes, it keeps a copy of the register beside it. Nothing
|
|
15
|
+
// else of a line changes: the lines of other projects, those without a transcript, the steps of
|
|
16
|
+
// the circuit and a torn line stay as they are. It says the number and the amount of the lines of
|
|
17
|
+
// the project without a transcript, which may hold sub-agents' spending. Played again, it changes
|
|
18
|
+
// and says nothing.
|
|
19
|
+
import { copyFileSync, existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
20
|
+
import os from 'node:os';
|
|
21
|
+
import { REGISTRE } from '../adresse-du-registre.mjs';
|
|
22
|
+
import { arbrePrincipal, depenseJusqua } from '../registre.mjs';
|
|
23
|
+
import {
|
|
24
|
+
lireSansLesRetenuesAilleurs,
|
|
25
|
+
ROLE_DE_LA_NUIT,
|
|
26
|
+
ROLE_DU_CIRCUIT,
|
|
27
|
+
transcriptionsDuProjet,
|
|
28
|
+
} from '../tableau.mjs';
|
|
29
|
+
import { coutDe } from '../tarifs.mjs';
|
|
30
|
+
import { lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
|
|
31
|
+
|
|
32
|
+
export const version = '0.54.0';
|
|
33
|
+
export const nom = 'cout des jetons au registre';
|
|
34
|
+
|
|
35
|
+
const lue = ligne => {
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(ligne);
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// A path beside the register that holds no file yet.
|
|
44
|
+
function copieLibre() {
|
|
45
|
+
const base = `${REGISTRE}.avant-cout-des-jetons`;
|
|
46
|
+
let f = base;
|
|
47
|
+
for (let n = 2; existsSync(f); n++) {
|
|
48
|
+
f = `${base}.${n}`;
|
|
49
|
+
}
|
|
50
|
+
return f;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The tokens and costs of the register's lines of <projet> reckoned again, each response counted
|
|
55
|
+
* once; returns what it did.
|
|
56
|
+
*/
|
|
57
|
+
export function migrer(projet) {
|
|
58
|
+
if (!existsSync(REGISTRE)) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
const racine = arbrePrincipal(projet);
|
|
62
|
+
const fichiers = new Map();
|
|
63
|
+
for (const { agent, f } of transcriptionsDuProjet(racine, process.env.HOME || os.homedir())) {
|
|
64
|
+
fichiers.set(agent, [...(fichiers.get(agent) ?? []), f]);
|
|
65
|
+
}
|
|
66
|
+
const duProjet = e =>
|
|
67
|
+
e?.projet === racine && e.role !== ROLE_DU_CIRCUIT && e.role !== ROLE_DE_LA_NUIT;
|
|
68
|
+
// The transcripts of the agents that have a line, read before the lock, whose time they would
|
|
69
|
+
// outlast.
|
|
70
|
+
const inscrits = new Set(
|
|
71
|
+
readFileSync(REGISTRE, 'utf8')
|
|
72
|
+
.split('\n')
|
|
73
|
+
.map(lue)
|
|
74
|
+
.filter(duProjet)
|
|
75
|
+
.map(e => e.agent)
|
|
76
|
+
);
|
|
77
|
+
const lues = lireSansLesRetenuesAilleurs(
|
|
78
|
+
[...inscrits].flatMap(agent => fichiers.get(agent) ?? []),
|
|
79
|
+
[...fichiers.values()].flat()
|
|
80
|
+
);
|
|
81
|
+
const verrou = `${REGISTRE}.verrou`;
|
|
82
|
+
prendreVerrou(verrou, { attendre: true, perime: 30_000 });
|
|
83
|
+
try {
|
|
84
|
+
let changees = 0;
|
|
85
|
+
const sans = { lignes: 0, montant: 0 };
|
|
86
|
+
const apres = readFileSync(REGISTRE, 'utf8')
|
|
87
|
+
.split('\n')
|
|
88
|
+
.map(ligne => {
|
|
89
|
+
const e = lue(ligne);
|
|
90
|
+
if (!duProjet(e)) {
|
|
91
|
+
return ligne;
|
|
92
|
+
}
|
|
93
|
+
if (!fichiers.has(e.agent)) {
|
|
94
|
+
if (e.jetons || e.cache) {
|
|
95
|
+
sans.lignes++;
|
|
96
|
+
sans.montant += e.cout ?? 0;
|
|
97
|
+
}
|
|
98
|
+
return ligne;
|
|
99
|
+
}
|
|
100
|
+
// A line written since the reading, or whose transcript does not read, stays.
|
|
101
|
+
const siennes = fichiers.get(e.agent).map(f => lues.get(f));
|
|
102
|
+
if (!siennes.some(Boolean)) {
|
|
103
|
+
return ligne;
|
|
104
|
+
}
|
|
105
|
+
const { jetons, cache, modeles, ecartee } = depenseJusqua(siennes, Date.parse(e.fin));
|
|
106
|
+
const cout = coutDe(modeles);
|
|
107
|
+
const neuve = { jetons, cout, ...(ecartee || siennes.length > 1 ? { cache } : {}) };
|
|
108
|
+
const pareil =
|
|
109
|
+
(cout === e.cout || (cout !== null && Math.abs(cout - (e.cout ?? NaN)) < 1e-9)) &&
|
|
110
|
+
jetons === e.jetons &&
|
|
111
|
+
(neuve.cache === undefined || neuve.cache === e.cache);
|
|
112
|
+
if (pareil) {
|
|
113
|
+
return ligne;
|
|
114
|
+
}
|
|
115
|
+
changees++;
|
|
116
|
+
return JSON.stringify({ ...e, ...neuve });
|
|
117
|
+
});
|
|
118
|
+
if (changees === 0) {
|
|
119
|
+
return [];
|
|
120
|
+
}
|
|
121
|
+
copyFileSync(REGISTRE, copieLibre());
|
|
122
|
+
const neuf = `${REGISTRE}.neuf`;
|
|
123
|
+
writeFileSync(neuf, apres.join('\n'));
|
|
124
|
+
renameSync(neuf, REGISTRE);
|
|
125
|
+
return [
|
|
126
|
+
`registre des agents : jetons et coût recalculés, sans les réponses comptées dans une autre transcription, sur ${changees} ligne(s) du projet, la copie d’avant gardée à côté du registre`,
|
|
127
|
+
...(sans.lignes
|
|
128
|
+
? [
|
|
129
|
+
`registre des agents : ${sans.lignes} ligne(s) du projet sans transcription, laissées telles, pour ${Math.round(sans.montant * 100) / 100} $ ; elles peuvent inclure la dépense de sous-agents`,
|
|
130
|
+
]
|
|
131
|
+
: []),
|
|
132
|
+
];
|
|
133
|
+
} finally {
|
|
134
|
+
lacherVerrou(verrou);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// The `docs/agents/issue-tracker.md` of a project reads a ticket by `npx grillhouse lire`, its
|
|
2
|
+
// summary first, in place of `bd show` and `bd comments`, to read it and to find its handoff.
|
|
3
|
+
// Mechanism: installation.md §5.4 (packages/grillhouse/docs/architecture/).
|
|
4
|
+
//
|
|
5
|
+
// - `version`: null until the release that brings it, which `grillhouse sortie` numbers.
|
|
6
|
+
// - `migrer` replaces each of the two passages of the template it finds, the rest of the file as
|
|
7
|
+
// it is; a file absent, or without either passage, is not written.
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
|
|
11
|
+
export const version = '0.54.0';
|
|
12
|
+
export const nom = 'lire un ticket';
|
|
13
|
+
|
|
14
|
+
const FICHIER = 'docs/agents/issue-tracker.md';
|
|
15
|
+
// Each passage of the template that read a ticket, and what the template
|
|
16
|
+
// (templates/projet/docs/agents/issue-tracker.md) writes in its place.
|
|
17
|
+
const PASSAGES = [
|
|
18
|
+
// The sentence of reading.
|
|
19
|
+
[
|
|
20
|
+
'`bd show <id>`, then `bd comments <id>` (the handoff lives there).',
|
|
21
|
+
'`npx grillhouse lire <id>` gives its summary (title, state, description up to its criteria, one line per comment, the handoff among them). Before acting, play `npx grillhouse lire <id> --description` when the summary names a section left out or notes, and unfold by its number each comment the gesture needs, `npx grillhouse lire <id> <number>` (a handoff is read whole); `--tout` gives everything.',
|
|
22
|
+
],
|
|
23
|
+
// The end of the sentence of handoff.
|
|
24
|
+
[
|
|
25
|
+
'the next session finds it with `bd show` or `bd comments <id>`.',
|
|
26
|
+
'the next session finds it with `npx grillhouse lire <id>`, and unfolds it by its number (`--description` first when the summary names a section left out or notes).',
|
|
27
|
+
],
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/** The passages that read a ticket replaced in the issue tracker of <projet>; returns what it did. */
|
|
31
|
+
export function migrer(projet) {
|
|
32
|
+
const fichier = path.join(projet, FICHIER);
|
|
33
|
+
if (!existsSync(fichier)) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
const texte = readFileSync(fichier, 'utf8');
|
|
37
|
+
const neuf = PASSAGES.reduce(
|
|
38
|
+
(courant, [ancien, nouveau]) => courant.replace(ancien, () => nouveau),
|
|
39
|
+
texte
|
|
40
|
+
);
|
|
41
|
+
if (neuf === texte) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
writeFileSync(fichier, neuf);
|
|
45
|
+
return [`${FICHIER} : un ticket se lit par \`npx grillhouse lire\`, son sommaire d'abord`];
|
|
46
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -53,7 +53,9 @@ import * as ciDeclencheeParLaFile from './migrations/0.48.0-ci-declenchee-par-la
|
|
|
53
53
|
import * as reservationDeTroisCoeurs from './migrations/0.49.0-reservation-de-trois-coeurs.mjs';
|
|
54
54
|
|
|
55
55
|
import * as reglagesHorsDeLaCharte from './migrations/0.50.0-reglages-hors-de-la-charte.mjs';
|
|
56
|
+
import * as lireUnTicket from './migrations/lire-un-ticket.mjs';
|
|
56
57
|
import * as serveursDeLIndex from './migrations/serveurs-de-l-index.mjs';
|
|
58
|
+
import * as coutDesJetons from './migrations/cout-des-jetons-au-registre.mjs';
|
|
57
59
|
import * as suiviDuSuperviseurRetire from './migrations/suivi-du-superviseur-retire.mjs';
|
|
58
60
|
|
|
59
61
|
/** The migrations of the core. */
|
|
@@ -81,7 +83,9 @@ export const MIGRATIONS = [
|
|
|
81
83
|
reservationDeTroisCoeurs,
|
|
82
84
|
reglagesHorsDeLaCharte,
|
|
83
85
|
serveursDeLIndex,
|
|
86
|
+
coutDesJetons,
|
|
84
87
|
suiviDuSuperviseurRetire,
|
|
88
|
+
lireUnTicket,
|
|
85
89
|
];
|
|
86
90
|
|
|
87
91
|
/**
|
package/scripts/montee.mjs
CHANGED
|
@@ -11,16 +11,19 @@
|
|
|
11
11
|
// rest from the variable `GRILLHOUSE_MONTEE`.
|
|
12
12
|
// - The rest, up to five passes: the files the frame writes (scripts/grillhouse-maj.mjs), the
|
|
13
13
|
// machine's part once (the published tool, the plugins, the binaries, the units and workers, the
|
|
14
|
-
// schedule of the nights
|
|
14
|
+
// schedule of the nights; in the repository of the frame, the last two by the commands of the
|
|
15
|
+
// published tool), the verification of the sort « Montée » on the content of the commit
|
|
15
16
|
// alone; green, the commit, its tree kept as judged (scripts/arbres-juges.mjs), main advanced by
|
|
16
17
|
// fast-forward and pushed; main advanced meanwhile, the next pass writes everything again from
|
|
17
18
|
// its tip. Main advanced, the main tree installs its dependencies and the plugins the lot adds.
|
|
19
|
+
// - A montée in which a gesture failed ends its report, on the error output, by saying each such
|
|
20
|
+
// failure again, whole, with the command that plays the gesture again.
|
|
18
21
|
// - Exit code: 0; 1 for a failure, a refusal or a montée not entered; 75 for a verification to play
|
|
19
22
|
// again; 2 for the usage (scripts/grillhouse-maj.mjs).
|
|
20
23
|
import { spawnSync } from 'node:child_process';
|
|
21
24
|
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
22
25
|
import path from 'node:path';
|
|
23
|
-
import { installer, NOM_DU_PAQUET, versionDeLOutil } from './aiguillage.mjs';
|
|
26
|
+
import { dossierDeLOutil, installer, NOM_DU_PAQUET, versionDeLOutil } from './aiguillage.mjs';
|
|
24
27
|
import { garderLArbreJuge } from './arbres-juges.mjs';
|
|
25
28
|
import { installerBinaires } from './binaires.mjs';
|
|
26
29
|
import { poserCrochets } from './crochets.mjs';
|
|
@@ -37,7 +40,12 @@ import {
|
|
|
37
40
|
restaurer,
|
|
38
41
|
retirerLaCopie,
|
|
39
42
|
} from './copie-de-montee.mjs';
|
|
40
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
direLesRetraits,
|
|
45
|
+
greffonsDuProjet,
|
|
46
|
+
installerGreffons,
|
|
47
|
+
purgerLesInscriptions,
|
|
48
|
+
} from './greffons.mjs';
|
|
41
49
|
import { paquets } from './paquets.mjs';
|
|
42
50
|
|
|
43
51
|
/** The variable by which the command of the package installed in the copy plays the rest. */
|
|
@@ -138,16 +146,16 @@ function versionDeLaPointe(principal, pointe, sources) {
|
|
|
138
146
|
);
|
|
139
147
|
}
|
|
140
148
|
|
|
141
|
-
// npm in `dossier`, its output the command's
|
|
149
|
+
// npm in `dossier`, its output the command's: null when it succeeds, else the line of its failure,
|
|
150
|
+
// said.
|
|
142
151
|
function npm(dossier, args) {
|
|
143
152
|
const r = spawnSync('npm', args, { cwd: dossier, stdio: 'inherit' });
|
|
144
153
|
if (r.status === 0) {
|
|
145
|
-
return
|
|
154
|
+
return null;
|
|
146
155
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return false;
|
|
156
|
+
const ligne = `⛔ \`npm ${args.join(' ')}\` dans ${dossier} échoue (${r.error?.message ?? `code ${r.status}`}).`;
|
|
157
|
+
signaler(ligne);
|
|
158
|
+
return ligne;
|
|
151
159
|
}
|
|
152
160
|
|
|
153
161
|
// The installation of a montée in its copy: the package at `version` when the tip does not hold it
|
|
@@ -157,7 +165,22 @@ function installerDansLaCopie({ copie, version, duCadre }) {
|
|
|
157
165
|
duCadre ||
|
|
158
166
|
(declareLePaquet(lireJson(path.join(copie, 'package.json'))) &&
|
|
159
167
|
versionVerrouillee(lireJson(path.join(copie, 'package-lock.json'))) === version);
|
|
160
|
-
return npm(copie, aJour ? ['install'] : ['install', '-D', `${NOM_DU_PAQUET}@${version}`]);
|
|
168
|
+
return !npm(copie, aJour ? ['install'] : ['install', '-D', `${NOM_DU_PAQUET}@${version}`]);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A gesture that failed: the lines the montée said of it, and the line naming the command that
|
|
173
|
+
* plays it again.
|
|
174
|
+
* @typedef {{ lignes: string[], rejeu: string }} Echec
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
// The end of the report: each failure said again, whole, with its command; the exit code.
|
|
178
|
+
function redire(echecs) {
|
|
179
|
+
for (const { lignes, rejeu } of echecs) {
|
|
180
|
+
lignes.forEach(signaler);
|
|
181
|
+
signaler(rejeu);
|
|
182
|
+
}
|
|
183
|
+
return echecs.length > 0 ? 1 : 0;
|
|
161
184
|
}
|
|
162
185
|
|
|
163
186
|
// What the report says of a montée that did not enter main: its copy, the versions, the commands.
|
|
@@ -262,15 +285,31 @@ export function monter(voulue, deLaMaj, cwd = process.cwd()) {
|
|
|
262
285
|
nonEntree(montee, false);
|
|
263
286
|
return 1;
|
|
264
287
|
}
|
|
265
|
-
const echecs =
|
|
266
|
-
|
|
288
|
+
const echecs = [];
|
|
289
|
+
jouerLePoste(montee, echecs);
|
|
290
|
+
apresLAvance(montee, false, echecs);
|
|
267
291
|
retirerOuDire(montee);
|
|
268
|
-
return echecs
|
|
292
|
+
return redire(echecs);
|
|
269
293
|
}
|
|
270
294
|
|
|
271
|
-
//
|
|
272
|
-
|
|
273
|
-
|
|
295
|
+
// The package whose commands the machine's part runs: in the repository of the frame, the published
|
|
296
|
+
// tool of the version the copy writes, never the build of the workspace (installation.md §5.5);
|
|
297
|
+
// elsewhere the package that runs, installed in the copy.
|
|
298
|
+
function paquetDuPoste({ copie, version, duCadre }) {
|
|
299
|
+
if (!duCadre) {
|
|
300
|
+
return PAQUET;
|
|
301
|
+
}
|
|
302
|
+
const publiee = versionDeLOutil(copie) ?? version;
|
|
303
|
+
const paquet = path.join(dossierDeLOutil(publiee), 'node_modules', NOM_DU_PAQUET);
|
|
304
|
+
if (!existsSync(paquet)) {
|
|
305
|
+
throw new Error(`l'outil publié ${publiee} n'est pas installé.`);
|
|
306
|
+
}
|
|
307
|
+
return paquet;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Runs a command of <paquet> in the main tree; the line of its failure, which names `geste`.
|
|
311
|
+
function duPoste(principal, geste, paquet, script, args) {
|
|
312
|
+
const r = spawnSync(process.execPath, [path.join(paquet, script), ...args], {
|
|
274
313
|
cwd: principal,
|
|
275
314
|
encoding: 'utf8',
|
|
276
315
|
});
|
|
@@ -283,9 +322,16 @@ function duPoste(principal, geste, script, args) {
|
|
|
283
322
|
];
|
|
284
323
|
}
|
|
285
324
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
325
|
+
/**
|
|
326
|
+
* The machine's part (installation.md §5.3), at the version and by the declarations the copy
|
|
327
|
+
* holds, with the paths and names of the main tree: the lines of failure, each said, and its
|
|
328
|
+
* failure added to `echoues`.
|
|
329
|
+
* @param {{ principal: string, copie: string, version: string, duCadre: boolean }} montee
|
|
330
|
+
* @param {Echec[]} [echoues]
|
|
331
|
+
* @returns {string[]}
|
|
332
|
+
*/
|
|
333
|
+
export function jouerLePoste(montee, echoues = []) {
|
|
334
|
+
const { principal, copie, version } = montee;
|
|
289
335
|
const echecs = [];
|
|
290
336
|
const essayer = (geste, jouer) => {
|
|
291
337
|
try {
|
|
@@ -300,6 +346,13 @@ function jouerLePoste({ principal, copie, version }) {
|
|
|
300
346
|
dire(`Part du poste : outil publié ${publiee} ${r.installe ? 'installé' : 'déjà là'}.`);
|
|
301
347
|
return [];
|
|
302
348
|
});
|
|
349
|
+
essayer('npx grillhouse greffons --purger', () => {
|
|
350
|
+
const n = purgerLesInscriptions();
|
|
351
|
+
if (n > 0) {
|
|
352
|
+
dire(`Part du poste : ${direLesRetraits(n)}, leur dossier n'existe plus.`);
|
|
353
|
+
}
|
|
354
|
+
return [];
|
|
355
|
+
});
|
|
303
356
|
essayer('npx grillhouse greffons', () =>
|
|
304
357
|
installerGreffons(principal, {
|
|
305
358
|
declarations: copie,
|
|
@@ -315,24 +368,32 @@ function jouerLePoste({ principal, copie, version }) {
|
|
|
315
368
|
return r.lignes;
|
|
316
369
|
});
|
|
317
370
|
essayer('npx grillhouse temporal installer', () =>
|
|
318
|
-
duPoste(
|
|
319
|
-
'installer',
|
|
320
|
-
'--racine',
|
|
371
|
+
duPoste(
|
|
321
372
|
principal,
|
|
322
|
-
'
|
|
323
|
-
|
|
324
|
-
|
|
373
|
+
'npx grillhouse temporal installer',
|
|
374
|
+
paquetDuPoste(montee),
|
|
375
|
+
'dist/temporal/commande.js',
|
|
376
|
+
['installer', '--racine', principal, '--declarations', copie]
|
|
377
|
+
)
|
|
325
378
|
);
|
|
326
379
|
essayer('npx grillhouse nuit --planifier', () =>
|
|
327
|
-
duPoste(
|
|
328
|
-
|
|
329
|
-
|
|
380
|
+
duPoste(
|
|
381
|
+
principal,
|
|
382
|
+
'npx grillhouse nuit --planifier',
|
|
383
|
+
paquetDuPoste(montee),
|
|
384
|
+
'dist/temporal/nuits/commande.js',
|
|
385
|
+
['--planifier']
|
|
386
|
+
)
|
|
330
387
|
);
|
|
331
388
|
echecs.forEach(signaler);
|
|
332
389
|
if (echecs.length > 0) {
|
|
333
390
|
signaler(
|
|
334
391
|
`Part du poste en échec : \`npx grillhouse maj ${version}\` la rejoue, \`npx grillhouse maj\` revient à la version du projet.`
|
|
335
392
|
);
|
|
393
|
+
echoues.push({
|
|
394
|
+
lignes: echecs,
|
|
395
|
+
rejeu: `Part du poste en échec : \`npx grillhouse maj ${version}\` la rejoue.`,
|
|
396
|
+
});
|
|
336
397
|
}
|
|
337
398
|
return echecs;
|
|
338
399
|
}
|
|
@@ -352,19 +413,26 @@ function perime(principal) {
|
|
|
352
413
|
}
|
|
353
414
|
|
|
354
415
|
// What follows the advance of main (`avance`) in the main tree: its dependencies, then the plugins
|
|
355
|
-
// it declares;
|
|
356
|
-
function apresLAvance({ principal, version }, avance) {
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
416
|
+
// it declares; their failures, each line said, added to `echoues`.
|
|
417
|
+
function apresLAvance({ principal, version }, avance, echoues) {
|
|
418
|
+
const deNpm = (avance || perime(principal)) && npm(principal, ['install']);
|
|
419
|
+
if (deNpm) {
|
|
420
|
+
const reste = `Arbre principal : \`npm install\` reste à jouer ; \`npx grillhouse maj ${version}\` le rejoue.`;
|
|
421
|
+
signaler(reste);
|
|
422
|
+
echoues.push({
|
|
423
|
+
lignes: [deNpm, reste],
|
|
424
|
+
rejeu: `\`npx grillhouse maj ${version}\` rejoue \`npm install\` dans l'arbre principal.`,
|
|
425
|
+
});
|
|
363
426
|
}
|
|
364
427
|
poserCrochets(principal);
|
|
365
428
|
const greffons = installerGreffons(principal, { version });
|
|
366
429
|
greffons.forEach(signaler);
|
|
367
|
-
|
|
430
|
+
if (greffons.length > 0) {
|
|
431
|
+
echoues.push({
|
|
432
|
+
lignes: greffons,
|
|
433
|
+
rejeu: `Greffons en échec : \`npx grillhouse greffons\` les rejoue dans ${principal}.`,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
368
436
|
}
|
|
369
437
|
|
|
370
438
|
// Removes the copy, or says why it stays.
|
|
@@ -403,7 +471,8 @@ function avancer({ principal, branche }, base, commit, fichiers) {
|
|
|
403
471
|
export function suivre(montee, { ecrireLeProjet, verifier }) {
|
|
404
472
|
const { principal, branche, copie, version, duCadre } = montee;
|
|
405
473
|
let { pointe } = montee;
|
|
406
|
-
|
|
474
|
+
const echecs = [];
|
|
475
|
+
let posteJoue = false;
|
|
407
476
|
let entree = false;
|
|
408
477
|
// Lays back what was set aside, says the montée did not enter, and gives the exit code.
|
|
409
478
|
const arreter = (cause, code = 1) => {
|
|
@@ -415,8 +484,9 @@ export function suivre(montee, { ecrireLeProjet, verifier }) {
|
|
|
415
484
|
signaler(`Le changement d'un autre reste tel quel dans la copie : ${enConflit.join(', ')}.`);
|
|
416
485
|
}
|
|
417
486
|
if (!entree) {
|
|
418
|
-
nonEntree({ ...montee, pointe },
|
|
487
|
+
nonEntree({ ...montee, pointe }, posteJoue);
|
|
419
488
|
}
|
|
489
|
+
redire(echecs);
|
|
420
490
|
return code;
|
|
421
491
|
};
|
|
422
492
|
try {
|
|
@@ -439,7 +509,10 @@ export function suivre(montee, { ecrireLeProjet, verifier }) {
|
|
|
439
509
|
});
|
|
440
510
|
const fichiers = fichiersEcrits(copie);
|
|
441
511
|
garderLEtat(copie, version, fichiers);
|
|
442
|
-
|
|
512
|
+
if (!posteJoue) {
|
|
513
|
+
jouerLePoste(montee, echecs);
|
|
514
|
+
posteJoue = true;
|
|
515
|
+
}
|
|
443
516
|
const enConflit = conflits(copie, version);
|
|
444
517
|
if (aFaire || enConflit.length > 0) {
|
|
445
518
|
const v = aFaire
|
|
@@ -452,9 +525,9 @@ export function suivre(montee, { ecrireLeProjet, verifier }) {
|
|
|
452
525
|
if (fichiers.length === 0) {
|
|
453
526
|
dire(`Montée ${version} : rien à commiter, le projet est à jour ; aucun commit.`);
|
|
454
527
|
restaurer(copie, version);
|
|
455
|
-
|
|
528
|
+
apresLAvance(montee, false, echecs);
|
|
456
529
|
retirerOuDire(montee);
|
|
457
|
-
return echecs
|
|
530
|
+
return redire(echecs);
|
|
458
531
|
}
|
|
459
532
|
const arbre = arbreDe(copie, pointe, fichiers);
|
|
460
533
|
const v = verifier(copie, { fichiersAFinir: false, installer: false, sansVerifier });
|
|
@@ -495,18 +568,21 @@ export function suivre(montee, { ecrireLeProjet, verifier }) {
|
|
|
495
568
|
dire(
|
|
496
569
|
`Commit ${commit.slice(0, 7)} « Montée du cadre à ${version} » : ${fichiers.join(', ')} ; ${branche} avancée.`
|
|
497
570
|
);
|
|
498
|
-
const apres = [];
|
|
499
571
|
if (resultatDeGit(principal, ['remote', 'get-url', 'origin']).status === 0) {
|
|
500
572
|
const p = resultatDeGit(principal, ['push', '-q', 'origin', branche]);
|
|
501
573
|
if (p.status !== 0) {
|
|
502
|
-
|
|
503
|
-
signaler(
|
|
574
|
+
const ligne = `⛔ \`git push origin ${branche}\` échoue : ${p.stderr.trim()}`;
|
|
575
|
+
signaler(ligne);
|
|
576
|
+
echecs.push({
|
|
577
|
+
lignes: [ligne],
|
|
578
|
+
rejeu: `Poussée en échec : \`git push origin ${branche}\` la rejoue dans ${principal}.`,
|
|
579
|
+
});
|
|
504
580
|
}
|
|
505
581
|
}
|
|
506
|
-
|
|
582
|
+
apresLAvance(montee, true, echecs);
|
|
507
583
|
restaurer(copie, version);
|
|
508
584
|
retirerOuDire(montee);
|
|
509
|
-
return echecs
|
|
585
|
+
return redire(echecs);
|
|
510
586
|
}
|
|
511
587
|
return arreter(
|
|
512
588
|
`⛔ main a avancé à chacune des ${PASSES_MAX} passes : la montée s'arrête sans avancer main.`
|
package/scripts/nuit.sh
CHANGED
|
@@ -44,9 +44,10 @@
|
|
|
44
44
|
# path, whatever the environment of the night's launcher; a faulty key turns the night red, the
|
|
45
45
|
# log naming it, and nothing runs.
|
|
46
46
|
# - TEMPORAL: after the tools of the project, before any command, the night lays the pinned program of
|
|
47
|
-
# Temporal down (`grillhouse temporal installer --programme-seul`, by the
|
|
48
|
-
# version playing the night,
|
|
49
|
-
#
|
|
47
|
+
# Temporal down (`grillhouse temporal installer --programme-seul`, by the command of the
|
|
48
|
+
# version playing the night, in the frame's repository the published version the key
|
|
49
|
+
# grillhouse.outil names, never the copy's code: the copy has no build yet; idempotent: a
|
|
50
|
+
# program already laid down is not downloaded again) and exports its path as TEMPORAL, over any key left
|
|
50
51
|
# in a package.json. A laying that fails does not stop the night: the log names it, TEMPORAL
|
|
51
52
|
# stays unset, and a test that starts a server resolves the program from the shared cache
|
|
52
53
|
# (~/.cache/grillhouse/temporal/<version>/temporal), or fails on itself naming the command that
|
|
@@ -119,7 +120,10 @@
|
|
|
119
120
|
# among them), else the full pass by its command, the night tests, the project's
|
|
120
121
|
# night script by its command, or the preparation when the night is red before any step. Each
|
|
121
122
|
# red task comments the open ticket labelled `nuit` whose title names it (« <task> »), once per
|
|
122
|
-
# ticket, or opens its own, « La nuit est rouge sur « <task> » depuis la nuit du <date> ».
|
|
123
|
+
# ticket, or opens its own, « La nuit est rouge sur « <task> » depuis la nuit du <date> ». Its
|
|
124
|
+
# title, « number — subject — components », is one the departure of a circuit reads, so that
|
|
125
|
+
# the ticket launches itself; fixes may be created under it. Its components are those of a defect
|
|
126
|
+
# of the CI of main (scripts/ci-de-main.mjs), over the lots entered since the last green. The
|
|
123
127
|
# text, the same for each, gives the commits since the last green, where `git bisect` looks for
|
|
124
128
|
# the culprit, each red step and each red task, with or without a last green, then the end of
|
|
125
129
|
# the log. With a last green, each red task of the full pass that comes with its command gets the
|
|
@@ -333,8 +337,9 @@ jouer() {
|
|
|
333
337
|
fi
|
|
334
338
|
eval "$outils"
|
|
335
339
|
# The pinned program of Temporal, laid down and exported for every command. The command is that
|
|
336
|
-
# of the version playing the night (already built
|
|
337
|
-
#
|
|
340
|
+
# of the version playing the night (already built; in the frame's repository the published one,
|
|
341
|
+
# installation.md §5.5), not the copy's code: the copy is cleaned of its build and has no
|
|
342
|
+
# node_modules before the `npm ci` below.
|
|
338
343
|
local temporal
|
|
339
344
|
if temporal=$(env -C "$copie" node "$ici/../bin/grillhouse.mjs" temporal installer --programme-seul); then
|
|
340
345
|
export TEMPORAL="$temporal"
|
|
@@ -481,8 +486,9 @@ fi
|
|
|
481
486
|
ouverts=
|
|
482
487
|
commentes=" "
|
|
483
488
|
# Reports one cause: comments the open night ticket whose title names it (once a night), or opens
|
|
484
|
-
# its own (title « number — subject —
|
|
485
|
-
# prefix as `prefixe` reads it in `.beads/config.yaml`, the subject naming « <cause>
|
|
489
|
+
# its own (title « number — subject — components », the number being the id without the project's
|
|
490
|
+
# prefix as `prefixe` reads it in `.beads/config.yaml`, the subject naming « <cause> », the
|
|
491
|
+
# components those of `composants`; without a prefix, « subject — components »); its id goes to
|
|
486
492
|
# `numero`.
|
|
487
493
|
signaler() {
|
|
488
494
|
local cause="$1" sujet="$2" texte="$3" ouvert neuf= prefixe
|
|
@@ -496,9 +502,9 @@ signaler() {
|
|
|
496
502
|
commentes="$commentes$ouvert " ;;
|
|
497
503
|
esac
|
|
498
504
|
else
|
|
499
|
-
neuf="$(cd "$racine" && bd create "$sujet" -t bug -p 1 -l nuit -d "$texte" --silent)"
|
|
505
|
+
neuf="$(cd "$racine" && bd create "$sujet — $composants" -t bug -p 1 -l nuit -d "$texte" --silent)"
|
|
500
506
|
if prefixe="$(node "$ici/prefixe-des-tickets.mjs" "$racine" 2>&1)"; then
|
|
501
|
-
[ -n "$neuf" ] && (cd "$racine" && bd update "$neuf" --title "${neuf#"$prefixe"-} — $sujet —
|
|
507
|
+
[ -n "$neuf" ] && (cd "$racine" && bd update "$neuf" --title "${neuf#"$prefixe"-} — $sujet — $composants" >/dev/null)
|
|
502
508
|
else
|
|
503
509
|
echo "⛔ ${prefixe}" >> "$journal"
|
|
504
510
|
fi
|
|
@@ -543,8 +549,11 @@ $liste
|
|
|
543
549
|
Journal : $journal
|
|
544
550
|
Fin du journal :
|
|
545
551
|
$(tail -40 "$journal")"
|
|
546
|
-
#
|
|
547
|
-
|
|
552
|
+
# The components of a ticket the night opens: those of the lots entered since its last green.
|
|
553
|
+
composants="$(node "$ici/ci-de-main.mjs" composants "$racine" "$vert" "$tete" 2>> "$journal")"
|
|
554
|
+
[ -n "$composants" ] || composants=.
|
|
555
|
+
# Each red task reports on the night ticket that names it, else on its own: a defect ticket that
|
|
556
|
+
# launches itself, under which its fixes may be created.
|
|
548
557
|
for tache in "${taches[@]}"; do
|
|
549
558
|
signaler "$tache" "La nuit est rouge sur « $tache » depuis la nuit du $(date +%Y-%m-%d)" "$texte"
|
|
550
559
|
echo "✗ rouge : ticket ${numero:-neuf} (étiquette nuit) sur « $tache »." >> "$journal"
|
package/scripts/registre.d.mts
CHANGED
|
@@ -20,6 +20,8 @@ export interface Tarif {
|
|
|
20
20
|
lecture: number;
|
|
21
21
|
ecriture5m: number;
|
|
22
22
|
ecriture1h: number;
|
|
23
|
+
/** The upper tier, of a request of more than `au` input tokens, cache included. */
|
|
24
|
+
palier?: Omit<Tarif, 'palier'> & { au: number };
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
/** A line of the register. */
|
|
@@ -60,7 +62,6 @@ export function ligne(
|
|
|
60
62
|
tours: [number, number][];
|
|
61
63
|
jetons: number;
|
|
62
64
|
cache: number;
|
|
63
|
-
cout?: number | null;
|
|
64
65
|
modeles?: Record<string, Partial<Tarif>>;
|
|
65
66
|
},
|
|
66
67
|
projet: string
|
|
@@ -86,5 +87,10 @@ export function aRattraper(
|
|
|
86
87
|
maintenant?: number
|
|
87
88
|
): EntreeDuCrochet[];
|
|
88
89
|
export function ecrire(l: LigneDuRegistre): boolean;
|
|
90
|
+
export function depenseJusqua(
|
|
91
|
+
lectures: ({ reponses: object[] } | undefined)[],
|
|
92
|
+
fin: number
|
|
93
|
+
): { jetons: number; cache: number; modeles: Record<string, object>; ecartee: boolean };
|
|
94
|
+
export function ecrireLaLigne(input: EntreeDuCrochet, projet: string, home?: string): boolean;
|
|
89
95
|
export function transcriptionsDeLaCopie(copie: string, home: string): string;
|
|
90
96
|
export function deLaCopie(copie: string, home: string, connus: Set<string>): EntreeDuCrochet[];
|