@roomi-fields/grillhouse 0.50.2 → 0.51.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 +52 -0
- package/agents/developpeur.md +1 -1
- package/agents/direct.md +1 -1
- package/agents/explorateur.md +1 -1
- package/agents/questionneur.md +1 -1
- package/agents/relecteur.md +1 -1
- package/agents/testwriter.md +1 -1
- package/cadre/templates/c/package.json +1 -0
- package/cadre/templates/cargo/package.json +1 -0
- package/cadre/templates/python/package.json +1 -0
- package/charte.md +17 -12
- package/dist/machine/part-par-sorte.d.ts +16 -0
- package/dist/machine/part-par-sorte.js +36 -0
- package/dist/machine/part-par-sorte.js.map +1 -0
- package/dist/temporal/circuit/appel.js +1 -1
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +5 -4
- package/dist/temporal/circuit/client.js +39 -16
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +11 -7
- package/dist/temporal/circuit/contrat.js +5 -9
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +18 -6
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +12 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +54 -3
- package/dist/temporal/installation.js +187 -17
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/places/client.d.ts +5 -1
- package/dist/temporal/places/client.js +23 -11
- package/dist/temporal/places/client.js.map +1 -1
- package/docs/ARCHITECTURE.md +23 -2700
- package/docs/INTERFACE.md +23 -8
- package/docs/architecture/circuit.md +59 -12
- package/docs/architecture/entree.md +20 -7
- package/docs/architecture/greffon.md +6 -2
- package/docs/architecture/installation.md +30 -11
- package/docs/architecture/machine.md +50 -37
- package/docs/architecture/tests.md +52 -14
- package/docs/lexique.md +154 -0
- package/hooks/register.tsx +1 -1
- package/package.json +1 -1
- package/scripts/activites.mjs +85 -60
- package/scripts/aiguillage.mjs +15 -7
- package/scripts/attente-de-la-machine.mjs +4 -8
- package/scripts/avancement.mjs +12 -8
- package/scripts/bilan.mjs +10 -7
- package/scripts/branche-de-nuit.mjs +2 -2
- package/scripts/ci-de-main.mjs +18 -21
- package/scripts/circuit.mjs +86 -43
- package/scripts/circuits-du-serveur.mjs +5 -5
- package/scripts/composants-affectes.mjs +30 -12
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +1 -1
- package/scripts/consommation-des-passes.mjs +8 -6
- package/scripts/copies-finies.mjs +3 -14
- package/scripts/depart-du-ticket.d.mts +8 -2
- package/scripts/depart-du-ticket.mjs +26 -8
- package/scripts/direct.mjs +158 -72
- package/scripts/droits.mjs +63 -185
- package/scripts/engendres.mjs +3 -14
- package/scripts/enveloppe/enveloppe.mjs +75 -30
- package/scripts/enveloppe/lancer.sh +59 -45
- package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
- package/scripts/enveloppe/travail-de-la-copie.mjs +115 -3
- package/scripts/etapes.mjs +84 -22
- package/scripts/faits-du-circuit.mjs +8 -2
- package/scripts/grillhouse-maj.mjs +43 -18
- package/scripts/groupe-cles.d.mts +15 -0
- package/scripts/groupe-cles.mjs +77 -2
- package/scripts/init.mjs +9 -2
- package/scripts/integration/rejeu.mjs +8 -1
- package/scripts/jointure.d.ts +22 -3
- package/scripts/langages/c/index.mjs +5 -2
- package/scripts/langages/cargo/commandes.mjs +35 -15
- package/scripts/langages/cargo/composants.mjs +45 -3
- package/scripts/langages/cargo/index.mjs +6 -3
- package/scripts/langages/cargo/sccache.mjs +10 -3
- package/scripts/langages/python/index.mjs +5 -2
- package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +4 -2
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
- package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +99 -36
- package/scripts/langages/typescript/verdict.mjs +29 -3
- package/scripts/langages/typescript/verifier.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
- package/scripts/langages.mjs +54 -4
- package/scripts/matieres-lues.mjs +1 -1
- package/scripts/mesure/base-de-passe.mjs +32 -90
- package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
- package/scripts/migrations.mjs +21 -7
- package/scripts/paquets.d.ts +3 -0
- package/scripts/paquets.mjs +88 -1
- package/scripts/passe-de-la-machine.mjs +109 -36
- package/scripts/places-de-la-machine.mjs +81 -29
- package/scripts/plafond-de-la-machine.d.mts +2 -5
- package/scripts/plafond-de-la-machine.mjs +9 -9
- package/scripts/reprise.mjs +42 -13
- package/scripts/resultats.mjs +76 -54
- package/scripts/retirer-les-copies-finies.mjs +1 -1
- package/scripts/seances.mjs +426 -115
- package/scripts/services-du-noyau.mjs +9 -1
- package/scripts/session-start.sh +14 -1
- package/scripts/sortie.mjs +37 -6
- package/scripts/sous-commandes.mjs +0 -2
- package/scripts/superviseur.mjs +33 -13
- package/scripts/tableau.mjs +61 -16
- package/scripts/transitions.d.mts +25 -2
- package/scripts/transitions.mjs +137 -29
- package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
- package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
- package/skills/developpeur/SKILL.md +38 -15
- package/skills/direct/SKILL.md +29 -9
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
- package/skills/domain-modeling/SKILL.md +14 -12
- package/skills/explorateur/SKILL.md +30 -6
- package/skills/pitmaster/SKILL.md +12 -16
- package/skills/pitmaster/references/consigne-agent.md +12 -11
- package/skills/relecteur/SKILL.md +12 -5
- package/skills/systematic-debugging/SKILL.md +281 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/testwriter/SKILL.md +35 -29
- package/scripts/verrous/commande.mjs +0 -214
- package/scripts/verrous/verrou.mjs +0 -311
|
@@ -18,8 +18,14 @@ export interface TicketDeBeads {
|
|
|
18
18
|
/** A ticket a circuit cannot start on, by its reason. */
|
|
19
19
|
export class DepartRefuse extends Error {}
|
|
20
20
|
|
|
21
|
-
/** The directory of the component <nom> of a title among <liste
|
|
22
|
-
|
|
21
|
+
/** The directory of the component <nom> of a title among <liste>, a new path kept as it is on a
|
|
22
|
+
* direct ticket (<neuf>); or a refusal. */
|
|
23
|
+
export function resoudreComposant(
|
|
24
|
+
liste: Composant[],
|
|
25
|
+
base: string,
|
|
26
|
+
nom: string,
|
|
27
|
+
options?: { neuf?: boolean }
|
|
28
|
+
): string;
|
|
23
29
|
|
|
24
30
|
/** The ticket <id> as `bd show --json` gives it in <sortie>, refused without its architecture. */
|
|
25
31
|
export function ticketAuDepart(
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
// the same way (scripts/circuit.mjs `contexte`).
|
|
5
5
|
//
|
|
6
6
|
// - The ticket is read by `bd show <id> --json` in the main tree; one Beads cannot show is refused.
|
|
7
|
-
// - Its description holds a « ## Architecture » section
|
|
8
|
-
//
|
|
7
|
+
// - Its description holds a « ## Architecture » section (`sansArchitecture`, the one reading of
|
|
8
|
+
// the rule): the code waits for the architecture. The
|
|
9
9
|
// supervisor's stop (`--arreter`) reads neither it nor the title: it does not depend on the
|
|
10
10
|
// ticket's content, as GitLab cancels a pipeline whatever its configuration; its plan is empty.
|
|
11
11
|
// - Its title names its plan after its last « — », separated by commas: each one a path
|
|
12
12
|
// (`packages/<nom>`, or `.`), or the name of a package, which becomes its directory, read in the
|
|
13
13
|
// ticket's copy when it exists, else in the main tree (`composantsLisibles`). A title without it, and
|
|
14
|
-
// a component that names neither, are refused by their name
|
|
14
|
+
// a component that names neither, are refused by their name, but a new path of the repository
|
|
15
|
+
// on a ticket labelled `direct`, kept as it is written. An act after the opening is given
|
|
15
16
|
// the plan its workflow holds (<plan>) and reads only the subject of the title: the integration
|
|
16
17
|
// removes the ticket's copy while the circuit still runs, and a component the lot creates is in
|
|
17
18
|
// neither tree then.
|
|
@@ -19,8 +20,20 @@
|
|
|
19
20
|
import { spawnSync } from 'node:child_process';
|
|
20
21
|
import { existsSync } from 'node:fs';
|
|
21
22
|
import path from 'node:path';
|
|
23
|
+
import { estUnCheminNeuf } from './enveloppe/paquets-du-plan.mjs';
|
|
22
24
|
import { composantsLisibles } from './ticket-du-circuit.mjs';
|
|
23
|
-
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The refusal of the ticket <id> whose <description> holds no "## Architecture" section, or null.
|
|
28
|
+
* @param {string} id
|
|
29
|
+
* @param {unknown} description
|
|
30
|
+
* @returns {string | null}
|
|
31
|
+
*/
|
|
32
|
+
export function sansArchitecture(id, description) {
|
|
33
|
+
return /^##\s+Architecture\b/m.test(String(description ?? ''))
|
|
34
|
+
? null
|
|
35
|
+
: `Le ticket ${id} n'a pas sa section « ## Architecture » : le code attend l'architecture. Rends la question au superviseur.`;
|
|
36
|
+
}
|
|
24
37
|
|
|
25
38
|
/** A ticket a circuit cannot start on, by its reason. */
|
|
26
39
|
export class DepartRefuse extends Error {
|
|
@@ -32,10 +45,11 @@ export class DepartRefuse extends Error {
|
|
|
32
45
|
|
|
33
46
|
/**
|
|
34
47
|
* The directory of the component <nom> of a title among <liste> (`composantsLisibles` of the repository
|
|
35
|
-
* at <base>): `.` itself; a component by its path or its name; else a path of the repository;
|
|
36
|
-
*
|
|
48
|
+
* at <base>): `.` itself; a component by its path or its name; else a path of the repository; else,
|
|
49
|
+
* for a direct ticket (<neuf>), a path the repository does not hold yet, as it is written
|
|
50
|
+
* (`estUnCheminNeuf`): a package is born of a direct ticket; or a refusal.
|
|
37
51
|
*/
|
|
38
|
-
export function resoudreComposant(liste, base, nom) {
|
|
52
|
+
export function resoudreComposant(liste, base, nom, { neuf = false } = {}) {
|
|
39
53
|
const brut = path.normalize(nom);
|
|
40
54
|
const norme = brut.endsWith('/') ? brut.slice(0, -1) : brut;
|
|
41
55
|
if (norme === '.') {
|
|
@@ -51,6 +65,9 @@ export function resoudreComposant(liste, base, nom) {
|
|
|
51
65
|
if (!norme.startsWith('..') && existsSync(path.join(base, norme))) {
|
|
52
66
|
return norme;
|
|
53
67
|
}
|
|
68
|
+
if (neuf && estUnCheminNeuf(nom)) {
|
|
69
|
+
return norme;
|
|
70
|
+
}
|
|
54
71
|
throw new DepartRefuse(
|
|
55
72
|
`le composant « ${nom} » du titre ne nomme ni un paquet ni un chemin du dépôt.`
|
|
56
73
|
);
|
|
@@ -115,7 +132,8 @@ export function ticketAuLancement(racine, id, { arreter = false, bd = null, plan
|
|
|
115
132
|
const copie = path.join(racine, '.claude', 'worktrees', id);
|
|
116
133
|
const base = existsSync(copie) ? copie : racine;
|
|
117
134
|
const liste = composantsLisibles(base);
|
|
118
|
-
const
|
|
135
|
+
const neuf = Boolean(ticket?.labels?.includes('direct'));
|
|
136
|
+
const resoudre = nom => resoudreComposant(liste, base, nom, { neuf });
|
|
119
137
|
// The supervisor's stop reads neither the ticket's « ## Architecture » section nor its title.
|
|
120
138
|
const titre = arreter
|
|
121
139
|
? { sujet: String(ticket?.title ?? id), plan: [] }
|
package/scripts/direct.mjs
CHANGED
|
@@ -7,9 +7,19 @@
|
|
|
7
7
|
// supervisor never writes it: it reads the lot, plays the full verification, commits, advances main
|
|
8
8
|
// and pushes.
|
|
9
9
|
//
|
|
10
|
-
// npx grillhouse direct <ticket> [--paquet <chemin>]… [--contexte <texte>]
|
|
10
|
+
// npx grillhouse direct <ticket> --panne <texte> [--paquet <chemin>]… [--contexte <texte>]
|
|
11
11
|
// npx grillhouse direct <ticket> --deverrouiller
|
|
12
12
|
//
|
|
13
|
+
// - It exists for a failure of the engine alone, which `--panne` names: without it, or with a
|
|
14
|
+
// blank text, the command refuses before any work.
|
|
15
|
+
// - It refuses a closed ticket, and a ticket whose workflow runs on the server, a question
|
|
16
|
+
// included; a server that does not read (silent, or its client not built) does not stop it, the
|
|
17
|
+
// failure of the engine being its case, and the ticket says the check was not made.
|
|
18
|
+
// - Once nothing refuses it, it takes the ticket (`in_progress`), so that the queue of the tickets
|
|
19
|
+
// starts no circuit on it, and writes there the failure, once; each review writes its verdict.
|
|
20
|
+
// - It asks nothing of the arbiter of the machine: no place, and its sessions run under the mark of
|
|
21
|
+
// a place held, so that a closed machine does not hold them back.
|
|
22
|
+
//
|
|
13
23
|
// - The ticket carries the label `direct`. Its packages are the components of its title, as the
|
|
14
24
|
// circuit writes them (« numéro — sujet — composant, composant »), completed by each `--paquet`;
|
|
15
25
|
// without any, the command refuses, naming the title. A path no package holds (the skeleton of a
|
|
@@ -34,27 +44,33 @@ import { existsSync, realpathSync } from 'node:fs';
|
|
|
34
44
|
import path from 'node:path';
|
|
35
45
|
import { pathToFileURL } from 'node:url';
|
|
36
46
|
import { ecritPar, preparer } from './enveloppe/travail-de-la-copie.mjs';
|
|
37
|
-
import {
|
|
47
|
+
import { circuitsDuServeur, ClientNonConstruit, ServeurMuet } from './circuits-du-serveur.mjs';
|
|
48
|
+
import { VARIABLE_TENUE } from './places-de-la-machine.mjs';
|
|
38
49
|
import { bloquantsDeLaFiche } from './resultats.mjs';
|
|
39
|
-
import {
|
|
50
|
+
import { consigneDuRelecteurDUnLotDirect } from './seances.mjs';
|
|
40
51
|
|
|
41
52
|
// The RENDU verdicts in a row that stop the command, as the circuit stops its third.
|
|
42
53
|
const RENDUS_MAX = 3;
|
|
43
54
|
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
'
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
// What the rescue command alone says of its lot to the reviewer.
|
|
56
|
+
const PROPRE_A_LA_VOIE_DE_SECOURS =
|
|
57
|
+
'Ce lot est mené par la voie de secours `npx grillhouse direct`, réservée aux pannes du moteur.';
|
|
58
|
+
|
|
59
|
+
// The mark of a place held under which the command plays: its sessions and their commands ask the
|
|
60
|
+
// arbiter of the machine for no place and read no closure; each still takes its part of the poste.
|
|
61
|
+
const SANS_ARBITRE = 'voie-de-secours';
|
|
62
|
+
|
|
63
|
+
// What the ticket says of a launch that could not read the circuits.
|
|
64
|
+
const NON_VERIFIE = "La commande n'a pas pu vérifier qu'aucun circuit ne vit sur ce ticket";
|
|
49
65
|
|
|
50
66
|
/**
|
|
51
|
-
* The instruction of the reviewer of a
|
|
52
|
-
*
|
|
67
|
+
* The instruction of the reviewer of a lot of the rescue command: that of a direct lot
|
|
68
|
+
* (`consigneDuRelecteurDUnLotDirect`), with what the command alone says of it.
|
|
53
69
|
* @param {Record<string, string>} valeurs
|
|
54
70
|
* @returns {string}
|
|
55
71
|
*/
|
|
56
72
|
export function consigneDuRelecteurDuDirect(valeurs) {
|
|
57
|
-
return
|
|
73
|
+
return consigneDuRelecteurDUnLotDirect(valeurs, PROPRE_A_LA_VOIE_DE_SECOURS);
|
|
58
74
|
}
|
|
59
75
|
|
|
60
76
|
/**
|
|
@@ -161,25 +177,59 @@ export function deverrouillerLaCopie(copie, git) {
|
|
|
161
177
|
}
|
|
162
178
|
}
|
|
163
179
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
// Refuses the ticket <id> while a workflow of its circuit runs on the server, a question included;
|
|
181
|
+
// returns null, or what the ticket says when the server does not read.
|
|
182
|
+
async function refuserUnCircuitVivant(id, ports) {
|
|
183
|
+
let circuits;
|
|
184
|
+
try {
|
|
185
|
+
circuits = await ports.circuits();
|
|
186
|
+
} catch (e) {
|
|
187
|
+
if (e instanceof ServeurMuet || e instanceof ClientNonConstruit) {
|
|
188
|
+
return `${NON_VERIFIE} : ${e.message}.`;
|
|
189
|
+
}
|
|
190
|
+
throw e;
|
|
191
|
+
}
|
|
192
|
+
if (circuits.some(c => c.ticket === id && c.fin === null)) {
|
|
173
193
|
throw new Error(
|
|
174
|
-
`Le ticket ${id}
|
|
194
|
+
`Le ticket ${id} a un circuit qui vit sur le serveur : finis-le par \`npx grillhouse circuit ${id} --arreter\` ; si son déroulé en panne ne finit pas sur ce mot, termine-le au serveur par \`temporal workflow terminate --workflow-id '${await ports.deroule()}'\`, puis relance la commande.`
|
|
175
195
|
);
|
|
176
196
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Writes at the ticket the use of the rescue way: the failure <panne>, once for each failure, and
|
|
201
|
+
// <nonVerifie>, when the circuits were not read, once too unless the failure is new.
|
|
202
|
+
async function ecrireLUsage(panne, nonVerifie, ports) {
|
|
203
|
+
const dits = (await ports.commentaires()).map(c => c.text);
|
|
204
|
+
const entree = `Voie de secours (\`npx grillhouse direct\`), panne du moteur : ${panne}`;
|
|
205
|
+
const neuve = !dits.some(t => t === entree || t.startsWith(`${entree}\n`));
|
|
206
|
+
const lignes = [
|
|
207
|
+
neuve ? entree : null,
|
|
208
|
+
nonVerifie && (neuve || !dits.some(t => t.includes(NON_VERIFIE))) ? nonVerifie : null,
|
|
209
|
+
].filter(Boolean);
|
|
210
|
+
if (lignes.length) {
|
|
211
|
+
await ports.commenter(lignes.join('\n\n'));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Plays <f> under the mark of a place held, the environment given back at its end.
|
|
216
|
+
async function sansArbitre(f) {
|
|
217
|
+
const avant = process.env[VARIABLE_TENUE];
|
|
218
|
+
process.env[VARIABLE_TENUE] = avant || SANS_ARBITRE;
|
|
219
|
+
try {
|
|
220
|
+
return await f();
|
|
221
|
+
} finally {
|
|
222
|
+
if (avant === undefined) {
|
|
223
|
+
delete process.env[VARIABLE_TENUE];
|
|
224
|
+
} else {
|
|
225
|
+
process.env[VARIABLE_TENUE] = avant;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// The lot of the direct <id> on the paths <plan>: the copy, then what the sheets of the reviewer
|
|
231
|
+
// decide.
|
|
232
|
+
async function menerLeLot(plan, ports) {
|
|
183
233
|
const copie = ports.copie();
|
|
184
234
|
ports.verrouiller(copie);
|
|
185
235
|
const decision = decisionDuDirect(ports.fiches(), ports.lot());
|
|
@@ -196,24 +246,54 @@ export async function lancerLeDirect({ id, ticket, options = [], ports }) {
|
|
|
196
246
|
};
|
|
197
247
|
}
|
|
198
248
|
const constats = decision.constats ?? [];
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const { fichiers = [] } = (await ports.avancer(copie)) ?? {};
|
|
206
|
-
const fiche = await ports.seance('direct', { constats, paquets: plan, conflits: fichiers });
|
|
207
|
-
if (fiche?.statut && fiche.statut !== 'FAIT') {
|
|
208
|
-
return { arret: true, statut: fiche.statut, fiche, copie };
|
|
209
|
-
}
|
|
210
|
-
const relue = await ports.relecture({ constats });
|
|
211
|
-
return { verdict: relue.verdict, constats: relue.constats ?? [], fiche: relue.fiche, copie };
|
|
212
|
-
} finally {
|
|
213
|
-
rendre();
|
|
249
|
+
// The copy moves onto main before the session: the files its work meets in conflict go to the
|
|
250
|
+
// agent, who writes them all, as the author of a lot resolves his own rebase.
|
|
251
|
+
const { fichiers = [] } = (await ports.avancer(copie)) ?? {};
|
|
252
|
+
const fiche = await ports.seance('direct', { constats, paquets: plan, conflits: fichiers });
|
|
253
|
+
if (fiche?.statut && fiche.statut !== 'FAIT') {
|
|
254
|
+
return { arret: true, statut: fiche.statut, fiche, copie };
|
|
214
255
|
}
|
|
256
|
+
const relue = await ports.relecture({ constats });
|
|
257
|
+
return { verdict: relue.verdict, constats: relue.constats ?? [], fiche: relue.fiche, copie };
|
|
215
258
|
}
|
|
216
259
|
|
|
260
|
+
/**
|
|
261
|
+
* The command: its refusals, which leave the ticket as it was, then the ticket taken and the use
|
|
262
|
+
* of the rescue way written there, then the agent, the reviewer, and it stops. <ports> are what it
|
|
263
|
+
* reads, writes and launches (`circuits`, `deroule`, `prendre`, `commentaires`, `commenter`,
|
|
264
|
+
* `copie`, `verrouiller`, `avancer`, `fiches`, `lot`, `resoudre`, `seance`, `relecture`); <panne>
|
|
265
|
+
* the failure of the engine that justifies it; <options> the paths `--paquet` adds to the plan.
|
|
266
|
+
* @param {{ id: string, ticket: { title?: string, labels?: string[], status?: string }, panne?: string | null, options?: string[], ports: any }} o
|
|
267
|
+
* @returns {Promise<{ verdict?: string, copie?: string, constats?: object[], arret?: boolean, statut?: string, rendus?: number, fiche?: object }>}
|
|
268
|
+
*/
|
|
269
|
+
export async function lancerLeDirect({ id, ticket, panne, options = [], ports }) {
|
|
270
|
+
const motif = String(panne ?? '').trim();
|
|
271
|
+
if (!motif) {
|
|
272
|
+
throw new Error(SANS_PANNE);
|
|
273
|
+
}
|
|
274
|
+
if (!(ticket.labels ?? []).includes('direct')) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`Le ticket ${id} n'est pas étiqueté direct : la commande ne mène que les tickets de la voie directe (charte, « Un ticket prend l'une de trois voies »).`
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
if (ticket.status === 'closed') {
|
|
280
|
+
throw new Error(`Le ticket ${id} est fermé : la commande ne le rouvre pas.`);
|
|
281
|
+
}
|
|
282
|
+
const { plan } = planDuDirect({
|
|
283
|
+
id,
|
|
284
|
+
titre: ticket.title ?? '',
|
|
285
|
+
options,
|
|
286
|
+
resoudre: ports.resoudre,
|
|
287
|
+
});
|
|
288
|
+
const nonVerifie = await refuserUnCircuitVivant(id, ports);
|
|
289
|
+
await ports.prendre();
|
|
290
|
+
await ecrireLUsage(motif, nonVerifie, ports);
|
|
291
|
+
return sansArbitre(() => menerLeLot(plan, ports));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const SANS_PANNE =
|
|
295
|
+
"La commande est la voie de secours, réservée aux pannes du moteur : nomme celle qui la justifie par `--panne <texte>`.";
|
|
296
|
+
|
|
217
297
|
/**
|
|
218
298
|
* What the agent of a direct reads of the files its work meets in conflict with main (« aucun »
|
|
219
299
|
* without any).
|
|
@@ -228,14 +308,23 @@ export function rapportDuConflit(fichiers) {
|
|
|
228
308
|
|
|
229
309
|
// The task the agent of a direct reads at the head of its instruction.
|
|
230
310
|
const TACHE_DU_DIRECT =
|
|
231
|
-
"Ce ticket est mené en direct,
|
|
311
|
+
"Ce ticket est mené en direct, par la voie de secours : tu écris ses tests et son code ensemble, dans les paquets de ton plan. Un défaut corrigé porte un test qui le reproduit. Aucune preuve du rouge ni aucun contrôle du circuit ne suit ta séance : un relecteur juge ton lot, puis le superviseur le vérifie. Les constats ci-dessous, s'il y en a, viennent de ce relecteur.";
|
|
312
|
+
|
|
313
|
+
// bd writing at the ticket of <ctx> under the supervisor, who launches the command; a failed write
|
|
314
|
+
// throws.
|
|
315
|
+
function ecrireAuTicket(ctx, ...args) {
|
|
316
|
+
const r = ctx.bdSous('superviseur', ...args);
|
|
317
|
+
if (r.status !== 0) {
|
|
318
|
+
throw new Error(`bd ${args[0]} échoue : ${r.error?.message ?? r.stderr ?? ''}`.trim());
|
|
319
|
+
}
|
|
320
|
+
}
|
|
232
321
|
|
|
233
322
|
// The ports of the command on the project at the working directory, the circuit's own sessions.
|
|
234
323
|
async function portsDuProjet(id, { contexteDuSuperviseur }) {
|
|
235
324
|
const { contexte } = await import('./circuit.mjs');
|
|
236
325
|
const { seance, idDeSeance } = await import('./seances.mjs');
|
|
237
326
|
const { arbreDeLaCopie, relire } = await import('./activites.mjs');
|
|
238
|
-
const { lesFiches } = await import('./ticket-du-circuit.mjs');
|
|
327
|
+
const { lesCommentaires, lesFiches } = await import('./ticket-du-circuit.mjs');
|
|
239
328
|
const ctx = contexte({ ticket: id, arreter: true, contexte: contexteDuSuperviseur });
|
|
240
329
|
const git = (...a) => spawnSync('git', ['-C', ctx.racine, ...a], { encoding: 'utf8' });
|
|
241
330
|
const ouverts = constats =>
|
|
@@ -259,27 +348,16 @@ async function portsDuProjet(id, { contexteDuSuperviseur }) {
|
|
|
259
348
|
}
|
|
260
349
|
return ctx.copie;
|
|
261
350
|
},
|
|
262
|
-
// The
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
dire: l => process.stdout.write(`${l}\n`),
|
|
269
|
-
});
|
|
270
|
-
const avant = process.env[VARIABLE_TENUE];
|
|
271
|
-
if (p.id) {
|
|
272
|
-
process.env[VARIABLE_TENUE] = p.id;
|
|
273
|
-
}
|
|
274
|
-
return () => {
|
|
275
|
-
if (avant === undefined) {
|
|
276
|
-
delete process.env[VARIABLE_TENUE];
|
|
277
|
-
} else {
|
|
278
|
-
process.env[VARIABLE_TENUE] = avant;
|
|
279
|
-
}
|
|
280
|
-
p.rendre();
|
|
281
|
-
};
|
|
351
|
+
// The circuits of the repository, the integrated ones included: a workflow still at its
|
|
352
|
+
// triage runs.
|
|
353
|
+
circuits: () => circuitsDuServeur(ctx.racine, { integres: true }),
|
|
354
|
+
deroule: async () => {
|
|
355
|
+
const { idDuCircuit } = await import('../dist/temporal/circuit/contrat.js');
|
|
356
|
+
return idDuCircuit(ctx.racine, id);
|
|
282
357
|
},
|
|
358
|
+
prendre: () => ecrireAuTicket(ctx, 'update', id, '--status', 'in_progress'),
|
|
359
|
+
commentaires: () => lesCommentaires(ctx),
|
|
360
|
+
commenter: texte => ecrireAuTicket(ctx, 'comments', 'add', id, texte),
|
|
283
361
|
verrouiller: copie => verrouillerLaCopie(copie, git),
|
|
284
362
|
fiches: () =>
|
|
285
363
|
lesFiches(ctx).map(e => (e.role === 'relecteur' ? { ...e, lot: e.lot?.arbre } : e)),
|
|
@@ -305,7 +383,6 @@ async function portsDuProjet(id, { contexteDuSuperviseur }) {
|
|
|
305
383
|
derniere: true,
|
|
306
384
|
seanceId: idDeSeance(ctx, 'direct'),
|
|
307
385
|
evenement: 'neuve',
|
|
308
|
-
fiche: 'developpeur',
|
|
309
386
|
constats: ouverts(constats),
|
|
310
387
|
rapport: conflits.length ? rapportDuConflit(conflits) : undefined,
|
|
311
388
|
lectures: { lots: () => [], references: () => [] },
|
|
@@ -324,20 +401,23 @@ async function portsDuProjet(id, { contexteDuSuperviseur }) {
|
|
|
324
401
|
};
|
|
325
402
|
}
|
|
326
403
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
404
|
+
/**
|
|
405
|
+
* The command's options for <argv>: the ticket, the failure of the engine, the paths added to the
|
|
406
|
+
* plan, the context, and the unlocking; or null, a usage fault.
|
|
407
|
+
* @param {string[]} argv
|
|
408
|
+
*/
|
|
409
|
+
export function lireLesOptions(argv) {
|
|
410
|
+
const o = { id: null, panne: null, paquets: [], contexte: null, deverrouiller: false };
|
|
331
411
|
for (let i = 0; i < argv.length; i++) {
|
|
332
412
|
const a = argv[i];
|
|
333
|
-
if (a === '--paquet' || a === '--contexte') {
|
|
413
|
+
if (a === '--paquet' || a === '--contexte' || a === '--panne') {
|
|
334
414
|
if (i + 1 >= argv.length) {
|
|
335
415
|
return null;
|
|
336
416
|
}
|
|
337
417
|
if (a === '--paquet') {
|
|
338
418
|
o.paquets.push(argv[++i]);
|
|
339
419
|
} else {
|
|
340
|
-
o.
|
|
420
|
+
o[a.slice(2)] = argv[++i];
|
|
341
421
|
}
|
|
342
422
|
} else if (a === '--deverrouiller') {
|
|
343
423
|
o.deverrouiller = true;
|
|
@@ -351,7 +431,7 @@ function lireLesOptions(argv) {
|
|
|
351
431
|
}
|
|
352
432
|
|
|
353
433
|
const USAGE =
|
|
354
|
-
'usage : npx grillhouse direct <ticket> [--paquet <chemin>]… [--contexte <texte>] | npx grillhouse direct <ticket> --deverrouiller\n';
|
|
434
|
+
'usage : npx grillhouse direct <ticket> --panne <texte> [--paquet <chemin>]… [--contexte <texte>] | npx grillhouse direct <ticket> --deverrouiller\n';
|
|
355
435
|
|
|
356
436
|
// The command on <argv>: its exit code.
|
|
357
437
|
async function commande(argv) {
|
|
@@ -360,6 +440,11 @@ async function commande(argv) {
|
|
|
360
440
|
process.stderr.write(USAGE);
|
|
361
441
|
return 2;
|
|
362
442
|
}
|
|
443
|
+
// Refused before any work: the context of the ticket already writes beside its copy.
|
|
444
|
+
if (!o.deverrouiller && !o.panne?.trim()) {
|
|
445
|
+
process.stderr.write(`⛔ ${SANS_PANNE}\n${USAGE}`);
|
|
446
|
+
return 2;
|
|
447
|
+
}
|
|
363
448
|
const { ctx, ports, git } = await portsDuProjet(o.id, { contexteDuSuperviseur: '' });
|
|
364
449
|
ctx.contexteDuDirect = o.contexte ? `${TACHE_DU_DIRECT}\n\n${o.contexte}` : TACHE_DU_DIRECT;
|
|
365
450
|
if (o.deverrouiller) {
|
|
@@ -375,6 +460,7 @@ async function commande(argv) {
|
|
|
375
460
|
const r = await lancerLeDirect({
|
|
376
461
|
id: o.id,
|
|
377
462
|
ticket: JSON.parse(show.stdout || '[]')[0] ?? {},
|
|
463
|
+
panne: o.panne,
|
|
378
464
|
options: o.paquets,
|
|
379
465
|
ports,
|
|
380
466
|
});
|