@roomi-fields/grillhouse 0.28.3 → 0.30.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 +739 -0
- package/bin/grillhouse.mjs +128 -26
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +37 -4
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +813 -53
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +161 -30
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +328 -0
- package/scripts/avancement.mjs +159 -64
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +888 -3654
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +30 -11
- package/scripts/conformite.mjs +19 -10
- package/scripts/copies-finies.mjs +188 -42
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +27 -32
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
- package/scripts/etapes.mjs +6 -3
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/fusion-du-changelog.mjs +0 -1
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +477 -422
- package/scripts/integration/integrer.mjs +20 -22
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +168 -28
- package/scripts/langages/cargo/commandes.mjs +426 -119
- package/scripts/langages/cargo/composants.mjs +187 -3
- package/scripts/langages/cargo/exemples.mjs +75 -17
- package/scripts/langages/cargo/index.mjs +32 -13
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +62 -16
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +232 -79
- package/scripts/langages/python/composants.mjs +65 -3
- package/scripts/langages/python/exemples.mjs +21 -12
- package/scripts/langages/python/index.mjs +25 -5
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +19 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +48 -63
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +110 -296
- package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +11 -9
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +29 -15
- package/scripts/outil.mjs +72 -0
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +112 -14
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +29 -14
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +28 -11
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +23 -4
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +39 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +382 -16
- package/scripts/tableau.mjs +329 -130
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +322 -62
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +62 -28
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +22 -8
- package/skills/testwriter/SKILL.md +47 -39
- package/scripts/demon.mjs +0 -138
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
// The tasks of the graph of the packages, which the modules of every language run the same way: the
|
|
2
|
+
// tests of the packages of a language, and the build of a copy for the plan of a session. A package
|
|
3
|
+
// of any language is a node of the graph the project's task runner reads (a `package.json` beside
|
|
4
|
+
// its manifest, scripts/paquet-npm.mjs), so the cache of its tasks selects what plays again, as
|
|
5
|
+
// Bazel's cache of a test target does, with no choice of the frame's own.
|
|
6
|
+
//
|
|
7
|
+
// The module gives <outil>, the name of the task runner, which this file does not name: the core
|
|
8
|
+
// names no tool (tests/unit/jointure.spec.ts).
|
|
9
|
+
//
|
|
10
|
+
// - `lancerLesTaches` runs `<outil> run <tâche>… --filter=<paquet>… --continue=dependencies-successful`
|
|
11
|
+
// in the project: every task whose dependencies succeed plays to its end, a red hides no other.
|
|
12
|
+
// The paths a targeted run names, and its options, reach the task in the variable
|
|
13
|
+
// `GRILLHOUSE_TESTS` (`TESTS_CIBLES`), JSON `{ arguments, rejouer? }`, which the `env` of the task
|
|
14
|
+
// `test:unit` names: it enters that task's hash alone, so a run by path of a package unchanged
|
|
15
|
+
// replays from the cache, and another path moves the hash. `rejouer`, the moment of the run, is a
|
|
16
|
+
// value no cached run holds: the task plays for real. The variable of the caller never passes on.
|
|
17
|
+
// - `construireDuPlan` is the command `construire --echec <fichier> <plan>` of every module, which
|
|
18
|
+
// the launcher (scripts/enveloppe/lancer.sh) runs in the prepared copy: the session finds built
|
|
19
|
+
// what it reads out of its plan. As Bazel builds the dependencies of a target before the target:
|
|
20
|
+
// for a plan whose every path is a package of the graph, their providers are built first (the
|
|
21
|
+
// builds their builds wait for, read in the runner's plan `run build --filter=<paquet>…
|
|
22
|
+
// --dry=json`), and a failure stops the launch; then the traces of other packages their tests
|
|
23
|
+
// wait for (`grillhouse.traces`, read in the plan of their tests), which the envelope shows
|
|
24
|
+
// read-only, and a failure stops the launch. A task of either step that waits, directly or not,
|
|
25
|
+
// for a task of a package of the plan (`attendentLePlan`) is not played there: as with Bazel's
|
|
26
|
+
// --keep_going, a package of the plan stays a target of the plan even as another's provider, and
|
|
27
|
+
// goes with the plan. Then the packages, the traces of the plan or that wait for it, and what
|
|
28
|
+
// their tests read (`run build <those traces> --filter=<paquet>… --continue=dependencies-successful`),
|
|
29
|
+
// whose failure does not stop the launch. Any other plan, the whole repository (`.`) included, or
|
|
30
|
+
// a path that is no package of the graph, reads the graph of the whole copy dry (`run build
|
|
31
|
+
// --dry=json`), whose failure stops the launch, then builds the copy whole as far as it builds
|
|
32
|
+
// (`run build --continue=dependencies-successful`), whose failure does not stop the launch either.
|
|
33
|
+
// A build that fails without stopping the launch writes in <fichier> the line that says which
|
|
34
|
+
// build failed and what was built, then its output, which the launcher puts in the session's
|
|
35
|
+
// instruction. The exit code: 0 when the launch goes on, a build failure included; 1 for a step
|
|
36
|
+
// that stops it; 2 for a malformed call.
|
|
37
|
+
import { spawnSync } from 'node:child_process';
|
|
38
|
+
import { closeSync, openSync, readFileSync, writeFileSync } from 'node:fs';
|
|
39
|
+
import path from 'node:path';
|
|
40
|
+
import { lireLaListe } from './enveloppe/paquets-du-plan.mjs';
|
|
41
|
+
import { paquets } from './paquets.mjs';
|
|
42
|
+
|
|
43
|
+
/** The name of the script and of the task of the tests of a package, the same for every language. */
|
|
44
|
+
export const SCRIPT_DES_TESTS = 'test:unit';
|
|
45
|
+
// The variable that carries the paths and the options of a targeted run to the task of the tests.
|
|
46
|
+
export const TESTS_CIBLES = 'GRILLHOUSE_TESTS';
|
|
47
|
+
/**
|
|
48
|
+
* Set by the composed command (./commandes-composees.mjs) to the modules of a `verifier` that
|
|
49
|
+
* plays beside the module whose manifest is a package.json: that one passes over the whole graph
|
|
50
|
+
* (`verifier.mjs` of typescript), so the others play no task of the graph again.
|
|
51
|
+
*/
|
|
52
|
+
export const GRAPHE_JOUE = 'GRILLHOUSE_GRAPHE_JOUE';
|
|
53
|
+
/** The variable that tells a module it plays after a red one: that pass keeps no green. */
|
|
54
|
+
export const PASSE_ROUGE = 'GRILLHOUSE_PASSE_ROUGE';
|
|
55
|
+
/** The beginning of the name of a trace task, the output of a package that another's tests read. */
|
|
56
|
+
export const TRACE = 'trace:';
|
|
57
|
+
const SANS_INSTALLER = '--no-install';
|
|
58
|
+
const ENTIERE =
|
|
59
|
+
"La construction de la copie entière échoue ; ce qui n'attend pas la construction en échec est construit.";
|
|
60
|
+
const DU_PLAN =
|
|
61
|
+
"La construction des paquets de ton plan échoue ; leurs fournisseurs et ce que leurs tests lisent sans dépendre d'eux sont construits.";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The name of the package of the graph whose folder is <dossier> (absolute) in <racine>, the
|
|
65
|
+
* `name` of its package.json; null when that folder is no package of the graph, or is out of the
|
|
66
|
+
* frame.
|
|
67
|
+
* @param {string} racine
|
|
68
|
+
* @param {string} dossier
|
|
69
|
+
* @returns {string | null}
|
|
70
|
+
*/
|
|
71
|
+
export function nomDuPaquet(racine, dossier) {
|
|
72
|
+
const p = paquets(racine).find(x => !x.hors && path.join(racine, x.dossier) === dossier);
|
|
73
|
+
return typeof p?.pkg?.name === 'string' ? p.pkg.name : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Runs the tasks <taches> of the packages <noms> (all of them when <noms> is empty) with <outil> in
|
|
78
|
+
* <racine>, each task whose dependencies succeed played to its end: its exit code, the runner's.
|
|
79
|
+
* <tests>, when given, is the content of the variable `TESTS_CIBLES` of the run (`{ arguments,
|
|
80
|
+
* rejouer? }`); the variable of <env> never passes on.
|
|
81
|
+
* @param {{ outil: string, racine: string, taches: string[], noms?: Iterable<string>,
|
|
82
|
+
* tests?: { arguments: string[], rejouer?: string }, env?: NodeJS.ProcessEnv }} o
|
|
83
|
+
* @returns {number}
|
|
84
|
+
*/
|
|
85
|
+
export function lancerLesTaches({
|
|
86
|
+
outil,
|
|
87
|
+
racine,
|
|
88
|
+
taches,
|
|
89
|
+
noms = [],
|
|
90
|
+
tests,
|
|
91
|
+
env = process.env,
|
|
92
|
+
}) {
|
|
93
|
+
const e = { ...env };
|
|
94
|
+
delete e[TESTS_CIBLES];
|
|
95
|
+
if (tests) {
|
|
96
|
+
e[TESTS_CIBLES] = JSON.stringify(tests);
|
|
97
|
+
}
|
|
98
|
+
const filtres = [...new Set(noms)].sort().map(n => `--filter=${n}`);
|
|
99
|
+
const r = spawnSync(
|
|
100
|
+
outil,
|
|
101
|
+
['run', ...taches, ...filtres, '--continue=dependencies-successful'],
|
|
102
|
+
{ cwd: racine, stdio: 'inherit', env: e }
|
|
103
|
+
);
|
|
104
|
+
return r.status ?? 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The content of the variable `TESTS_CIBLES` for a targeted run: the paths and options
|
|
109
|
+
* <arguments> it names, and the moment of the run when <force> (the task plays for real); undefined
|
|
110
|
+
* when there is nothing to carry, the variable then unset.
|
|
111
|
+
* @param {{ arguments: string[], force?: boolean }} o
|
|
112
|
+
* @returns {{ arguments: string[], rejouer?: string } | undefined}
|
|
113
|
+
*/
|
|
114
|
+
export function testsCibles({ arguments: donnes, force = false }) {
|
|
115
|
+
if (donnes.length === 0 && !force) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
return { arguments: donnes, ...(force ? { rejouer: new Date().toISOString() } : {}) };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The paths and the options of a task of the tests of a package, run by its script: the paths
|
|
123
|
+
* <donnes> its script names (its own folder), each replaced by the paths of the variable
|
|
124
|
+
* `TESTS_CIBLES` of <env> that lie in the same component (<dossierDe>, from an absolute path, the
|
|
125
|
+
* folder of its component or null), and the options of the variable. A task with no path of the
|
|
126
|
+
* variable in its component plays whole what its script names.
|
|
127
|
+
* @param {{ racine: string, donnes: string[], env?: NodeJS.ProcessEnv,
|
|
128
|
+
* dossierDe: (absolu: string) => string | null }} o
|
|
129
|
+
* @returns {{ chemins: string[], options: string[] }}
|
|
130
|
+
*/
|
|
131
|
+
export function cheminsDeLaTache({ racine, donnes, env = process.env, dossierDe }) {
|
|
132
|
+
let variable = [];
|
|
133
|
+
try {
|
|
134
|
+
const lu = JSON.parse(env[TESTS_CIBLES] ?? '{}')?.arguments;
|
|
135
|
+
variable = Array.isArray(lu) ? lu.map(String) : [];
|
|
136
|
+
} catch {
|
|
137
|
+
variable = [];
|
|
138
|
+
}
|
|
139
|
+
const nommes = variable.filter(a => !a.startsWith('-'));
|
|
140
|
+
const dossier = chemin => dossierDe(path.resolve(racine, chemin));
|
|
141
|
+
const chemins = donnes.flatMap(g => {
|
|
142
|
+
const d = dossier(g);
|
|
143
|
+
const siens = d === null ? [] : nommes.filter(n => dossier(n) === d);
|
|
144
|
+
return siens.length ? siens : [g];
|
|
145
|
+
});
|
|
146
|
+
return { chemins: [...new Set(chemins)], options: variable.filter(a => a.startsWith('-')) };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The trace tasks of a plan of the runner (`run … --dry=json`, parsed), its tasks that <garder>
|
|
151
|
+
* keeps: their task ids (`<producer>#trace:<name>`), sorted.
|
|
152
|
+
* @param {{ tasks: { task: string, taskId: string }[] }} plan
|
|
153
|
+
* @param {(t: any) => boolean} [garder]
|
|
154
|
+
* @returns {string[]}
|
|
155
|
+
*/
|
|
156
|
+
export const tracesDuPlan = (plan, garder = () => true) =>
|
|
157
|
+
plan.tasks
|
|
158
|
+
.filter(t => t.task.startsWith(TRACE) && garder(t))
|
|
159
|
+
.map(t => t.taskId)
|
|
160
|
+
.sort();
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The tasks of a plan of the runner (`run … --dry=json`, parsed) that wait, directly or not, for a
|
|
164
|
+
* task of one of the packages <paquets>, those tasks included: their task ids. As Bazel under
|
|
165
|
+
* --keep_going, a task that waits for a target of the plan goes with the plan, whose failure is the
|
|
166
|
+
* session's work; the others are the plan's providers.
|
|
167
|
+
* @param {{ tasks: { taskId: string, package: string, dependencies?: string[] }[] }} plan
|
|
168
|
+
* @param {string[]} paquets
|
|
169
|
+
* @returns {Set<string>}
|
|
170
|
+
*/
|
|
171
|
+
function attendentLePlan(plan, paquets) {
|
|
172
|
+
const parId = new Map(plan.tasks.map(t => [t.taskId, t]));
|
|
173
|
+
const verdicts = new Map();
|
|
174
|
+
const attend = id => {
|
|
175
|
+
if (verdicts.has(id)) {
|
|
176
|
+
return verdicts.get(id);
|
|
177
|
+
}
|
|
178
|
+
// A cycle of tasks is no wait on the plan by itself; the runner refuses it anyway.
|
|
179
|
+
verdicts.set(id, false);
|
|
180
|
+
const t = parId.get(id);
|
|
181
|
+
const v =
|
|
182
|
+
t !== undefined && (paquets.includes(t.package) || (t.dependencies ?? []).some(attend));
|
|
183
|
+
verdicts.set(id, v);
|
|
184
|
+
return v;
|
|
185
|
+
};
|
|
186
|
+
return new Set(plan.tasks.map(t => t.taskId).filter(attend));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
class Arret extends Error {}
|
|
190
|
+
|
|
191
|
+
// The runner with <args> in <racine>, its output on this process's; throws Arret on a failure.
|
|
192
|
+
function jouer(outil, racine, args) {
|
|
193
|
+
const r = spawnSync('npx', [SANS_INSTALLER, outil, ...args], { cwd: racine, stdio: 'inherit' });
|
|
194
|
+
if (r.status !== 0) {
|
|
195
|
+
throw new Arret(`${outil} ${args.join(' ')}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// The plan of the runner of <args> in <racine>, parsed; throws Arret on a failure.
|
|
200
|
+
function plan(outil, racine, args) {
|
|
201
|
+
const r = spawnSync('npx', [SANS_INSTALLER, outil, ...args, '--dry=json'], {
|
|
202
|
+
cwd: racine,
|
|
203
|
+
encoding: 'utf8',
|
|
204
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
205
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
206
|
+
});
|
|
207
|
+
if (r.status !== 0) {
|
|
208
|
+
throw new Arret(`${outil} ${args.join(' ')} --dry=json`);
|
|
209
|
+
}
|
|
210
|
+
return JSON.parse(r.stdout);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// The build <args> in <racine>, its output in <echec> then on this process's: when it fails,
|
|
214
|
+
// <echec> holds <ligne> then that output, and the warning <alerte> follows it.
|
|
215
|
+
function construireJusquOuIlConstruit(outil, racine, args, echec, ligne, alerte) {
|
|
216
|
+
const fd = openSync(echec, 'w');
|
|
217
|
+
let r;
|
|
218
|
+
try {
|
|
219
|
+
r = spawnSync('npx', [SANS_INSTALLER, outil, ...args], {
|
|
220
|
+
cwd: racine,
|
|
221
|
+
stdio: ['ignore', fd, fd],
|
|
222
|
+
});
|
|
223
|
+
} finally {
|
|
224
|
+
closeSync(fd);
|
|
225
|
+
}
|
|
226
|
+
const sortie = readFileSync(echec, 'utf8');
|
|
227
|
+
process.stdout.write(sortie);
|
|
228
|
+
if (r.status === 0) {
|
|
229
|
+
writeFileSync(echec, '');
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
process.stdout.write(`${alerte}\n`);
|
|
233
|
+
writeFileSync(echec, `${ligne}\n${sortie}`);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Builds the copy at <racine> for the plan <liste> with <outil>, the failure of a build that does
|
|
238
|
+
* not stop the launch written in <echec>: the exit code (see the header).
|
|
239
|
+
* @param {string} outil the task runner
|
|
240
|
+
* @param {string} racine the root of the copy
|
|
241
|
+
* @param {string} liste the plan, in the form of the envelope's variable
|
|
242
|
+
* @param {string} echec the file of a build that fails
|
|
243
|
+
* @returns {number}
|
|
244
|
+
*/
|
|
245
|
+
function construire(outil, racine, liste, echec) {
|
|
246
|
+
writeFileSync(echec, '');
|
|
247
|
+
const tous = paquets(racine).filter(p => !p.hors);
|
|
248
|
+
const noms = lireLaListe(liste).map(
|
|
249
|
+
d => tous.find(p => p.dossier === path.normalize(d).replace(/\/$/, ''))?.pkg.name ?? null
|
|
250
|
+
);
|
|
251
|
+
try {
|
|
252
|
+
if (noms.length === 0 || !noms.every(Boolean)) {
|
|
253
|
+
plan(outil, racine, ['run', 'build']);
|
|
254
|
+
construireJusquOuIlConstruit(
|
|
255
|
+
outil,
|
|
256
|
+
racine,
|
|
257
|
+
['run', 'build', '--continue=dependencies-successful'],
|
|
258
|
+
echec,
|
|
259
|
+
ENTIERE,
|
|
260
|
+
"⚠️ La construction de la copie échoue : la séance s'ouvre, la consigne porte l'erreur."
|
|
261
|
+
);
|
|
262
|
+
return 0;
|
|
263
|
+
}
|
|
264
|
+
const cibles = noms.map(n => `--filter=${n}`);
|
|
265
|
+
// Their providers: the builds their own builds wait for, save those that wait for a package
|
|
266
|
+
// of the plan, which go with the plan below.
|
|
267
|
+
const graphe = plan(outil, racine, ['run', 'build', ...cibles]);
|
|
268
|
+
const avecLePlan = attendentLePlan(graphe, noms);
|
|
269
|
+
const fournisseurs = graphe.tasks
|
|
270
|
+
.map(t => t.taskId)
|
|
271
|
+
.filter(id => !avecLePlan.has(id))
|
|
272
|
+
.sort();
|
|
273
|
+
if (fournisseurs.length) {
|
|
274
|
+
jouer(outil, racine, ['run', ...fournisseurs]);
|
|
275
|
+
}
|
|
276
|
+
// The traces their tests wait for: another package's trace that waits for no package of the
|
|
277
|
+
// plan is produced here, a failure stopping the launch, as a provider's; a trace of the plan,
|
|
278
|
+
// or one that waits for it, is produced with the plan below.
|
|
279
|
+
const tests = plan(outil, racine, ['run', SCRIPT_DES_TESTS, ...cibles]);
|
|
280
|
+
const attend = attendentLePlan(tests, noms);
|
|
281
|
+
const autres = tracesDuPlan(tests, t => !attend.has(t.taskId));
|
|
282
|
+
if (autres.length) {
|
|
283
|
+
jouer(outil, racine, ['run', ...autres]);
|
|
284
|
+
}
|
|
285
|
+
const avec = tracesDuPlan(tests, t => attend.has(t.taskId));
|
|
286
|
+
construireJusquOuIlConstruit(
|
|
287
|
+
outil,
|
|
288
|
+
racine,
|
|
289
|
+
[
|
|
290
|
+
'run',
|
|
291
|
+
'build',
|
|
292
|
+
...avec,
|
|
293
|
+
...noms.map(n => `--filter=${n}...`),
|
|
294
|
+
'--continue=dependencies-successful',
|
|
295
|
+
],
|
|
296
|
+
echec,
|
|
297
|
+
DU_PLAN,
|
|
298
|
+
`⚠️ La construction du plan (${noms.join(' ')}) échoue : la séance s'ouvre, la consigne porte l'erreur.`
|
|
299
|
+
);
|
|
300
|
+
return 0;
|
|
301
|
+
} catch (e) {
|
|
302
|
+
if (!(e instanceof Arret)) {
|
|
303
|
+
throw e;
|
|
304
|
+
}
|
|
305
|
+
process.stderr.write(`⛔ ${e.message} échoue.\n`);
|
|
306
|
+
return 1;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The command `construire --echec <fichier> <plan>` of a module, run from the root of the copy:
|
|
312
|
+
* its exit code. <args> are the arguments after the command's name; a call without the file of a
|
|
313
|
+
* failure and a plan is refused (2).
|
|
314
|
+
* @param {string} outil the task runner
|
|
315
|
+
* @param {string[]} args
|
|
316
|
+
* @param {string} [racine]
|
|
317
|
+
* @returns {number}
|
|
318
|
+
*/
|
|
319
|
+
export function construireDepuisLesArguments(outil, args, racine = process.cwd()) {
|
|
320
|
+
const i = args.indexOf('--echec');
|
|
321
|
+
const echec = i >= 0 ? args[i + 1] : undefined;
|
|
322
|
+
const reste = i >= 0 ? [...args.slice(0, i), ...args.slice(i + 2)] : args;
|
|
323
|
+
if (!echec || reste.length !== 1) {
|
|
324
|
+
process.stderr.write('usage: construire --echec <fichier> <plan>\n');
|
|
325
|
+
return 2;
|
|
326
|
+
}
|
|
327
|
+
return construire(outil, racine, reste[0], echec);
|
|
328
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// The ticket of a circuit, read and written as the circuit and its activities share it
|
|
2
|
+
// (scripts/circuit.mjs, scripts/seances.mjs): its comments and its description in Beads, the
|
|
3
|
+
// sheets and the results of its sessions (`<ticket>.fiches.jsonl`), its log, the components of its
|
|
4
|
+
// repository, and the stop of the circuit (`Arret`). Every function takes the circuit's context
|
|
5
|
+
// <ctx> (`contexte` of scripts/circuit.mjs: `bd`, `ticket`, `fiches`, `journal`, `copie`,
|
|
6
|
+
// `racine`) and holds no state of its own. Its writings at the ticket and among the sheets are
|
|
7
|
+
// effects (scripts/effets.mjs `emettre`), and its readings see those an act of the workflow
|
|
8
|
+
// emitted and has not yet played (`rendusDe`).
|
|
9
|
+
import { appendFileSync, existsSync, readFileSync } from 'node:fs';
|
|
10
|
+
import { gesteDe } from './etapes.mjs';
|
|
11
|
+
import { paquetsDuLangage } from './enveloppe/paquets-du-plan.mjs';
|
|
12
|
+
import { langageDe } from './langages.mjs';
|
|
13
|
+
import { AUTEUR_DU_CIRCUIT, PREFIXE, emettre, rendusDe, sansCouleurs } from './effets.mjs';
|
|
14
|
+
|
|
15
|
+
// The author of a comment, the circuit's, and the start of its lines: those of its one writer.
|
|
16
|
+
export { ACTEUR, AUTEUR_DU_CIRCUIT, PREFIXE, premiereLigne, sansCouleurs } from './effets.mjs';
|
|
17
|
+
|
|
18
|
+
// A stop of the circuit: its name (a key of ARRETS) and its report; for a stop of the checks, its
|
|
19
|
+
// reds read in the structured results (`{ paquet, texte, detail }`) and its motive, the report
|
|
20
|
+
// without their list; the outcome of the step it stops, when it has one (a proof's, the checks'
|
|
21
|
+
// with their reds), which the bilan reads; and what its montée carries beyond the question of its kind (scripts/etapes.mjs,
|
|
22
|
+
// MONTEES): its `piece` (file:line, or command and output), its own `question`, and who must
|
|
23
|
+
// answer it (`qui`, the owner for the reviewer's question).
|
|
24
|
+
export class Arret extends Error {
|
|
25
|
+
constructor(
|
|
26
|
+
nom,
|
|
27
|
+
rapport,
|
|
28
|
+
{
|
|
29
|
+
rouges = null,
|
|
30
|
+
motif = null,
|
|
31
|
+
resultat = null,
|
|
32
|
+
piece = null,
|
|
33
|
+
question = null,
|
|
34
|
+
qui = null,
|
|
35
|
+
etape = null,
|
|
36
|
+
} = {}
|
|
37
|
+
) {
|
|
38
|
+
super(nom);
|
|
39
|
+
this.nom = nom;
|
|
40
|
+
this.rapport = rapport;
|
|
41
|
+
this.rouges = rouges;
|
|
42
|
+
this.motif = motif;
|
|
43
|
+
this.resultat = resultat;
|
|
44
|
+
this.piece = piece;
|
|
45
|
+
this.question = question;
|
|
46
|
+
this.qui = qui;
|
|
47
|
+
// The step the stop stands at, when it is not the step that throws it.
|
|
48
|
+
this.etape = etape;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const fin = (t, n) => sansCouleurs(t).split('\n').slice(-n).join('\n');
|
|
53
|
+
export const enUneLigne = t =>
|
|
54
|
+
sansCouleurs(t)
|
|
55
|
+
.split('\n')
|
|
56
|
+
.map(l => l.trim())
|
|
57
|
+
.filter(Boolean)
|
|
58
|
+
.join(' ')
|
|
59
|
+
.slice(0, 300);
|
|
60
|
+
|
|
61
|
+
// The components of the repository at <racine> as the module of its language gives them, and the
|
|
62
|
+
// packages out of the frame a plan may name (`paquetsDuLangage`, as the envelope reads them):
|
|
63
|
+
// `{ dossier, pkg: { name }, hors }`, `dossier` relative to <racine>, `.` for a component at its
|
|
64
|
+
// root (a crate whose workspace is its own, as OSC Bridge's).
|
|
65
|
+
export const composantsDe = racine => paquetsDuLangage(langageDe(racine), racine);
|
|
66
|
+
|
|
67
|
+
// Every comment at the ticket, in their order, `{ author, text }` as Beads gives them, then those
|
|
68
|
+
// emitted and not yet played; a failed read throws.
|
|
69
|
+
export function lesCommentaires(ctx) {
|
|
70
|
+
const r = ctx.bd('comments', ctx.ticket, '--json');
|
|
71
|
+
if (r.status !== 0) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`commentaires de ${ctx.ticket} illisibles : ${r.error?.message ?? r.stderr ?? ''}`.trim()
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return [
|
|
77
|
+
...(JSON.parse(r.stdout || '[]') ?? []).map(c => ({
|
|
78
|
+
author: String(c.author ?? ''),
|
|
79
|
+
text: String(c.text ?? ''),
|
|
80
|
+
})),
|
|
81
|
+
...rendusDe(ctx, 'commentaire')
|
|
82
|
+
.filter(e => e.ticket === ctx.ticket)
|
|
83
|
+
.map(e => ({ author: e.auteur ?? AUTEUR_DU_CIRCUIT, text: e.texte })),
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The ticket's description (its criteria), notes, title and labels as Beads holds them at this
|
|
88
|
+
// moment, read at the launch of each session, the plan emitted and not yet played written over
|
|
89
|
+
// them: `{ description, notes, titre, labels }`; a failed read throws.
|
|
90
|
+
export function leTicket(ctx) {
|
|
91
|
+
const r = ctx.bd('show', ctx.ticket, '--json');
|
|
92
|
+
if (r.status !== 0) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`ticket ${ctx.ticket} illisible : ${r.error?.message ?? r.stderr ?? ''}`.trim()
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
const t = JSON.parse(r.stdout || '[]')[0] ?? {};
|
|
98
|
+
const lu = {
|
|
99
|
+
description: String(t.description ?? ''),
|
|
100
|
+
notes: String(t.notes ?? ''),
|
|
101
|
+
titre: String(t.title ?? ''),
|
|
102
|
+
labels: Array.isArray(t.labels) ? t.labels.map(String) : [],
|
|
103
|
+
};
|
|
104
|
+
for (const p of rendusDe(ctx, 'plan')) {
|
|
105
|
+
if (p.titre !== null) {
|
|
106
|
+
lu.titre = p.titre;
|
|
107
|
+
}
|
|
108
|
+
if (p.description !== null) {
|
|
109
|
+
lu.description = p.description;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return lu;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// The comments of the agents at the ticket, `{ author, text }`: every comment but the circuit's
|
|
116
|
+
// own. The circuit reads none of them: it hands an agent's last one to the next session of its
|
|
117
|
+
// author, and names it in a stop.
|
|
118
|
+
export const passations = ctx => lesCommentaires(ctx).filter(c => c.author !== AUTEUR_DU_CIRCUIT);
|
|
119
|
+
|
|
120
|
+
// The last handover at the ticket of the author <qui>, or null.
|
|
121
|
+
export const derniereDe = (ctx, qui) =>
|
|
122
|
+
passations(ctx)
|
|
123
|
+
.filter(c => c.author === qui)
|
|
124
|
+
.at(-1) ?? null;
|
|
125
|
+
|
|
126
|
+
// The sheets of the ticket's sessions and the circuit's reports, in their order
|
|
127
|
+
// (`<ticket>.fiches.jsonl`, beside the copy): `{ date, role, fiche }` for the sheet of a session,
|
|
128
|
+
// `{ date, role: 'circuit', etape, rapport }` for the report of a proof or of checks, which the
|
|
129
|
+
// reviewer receives; then those emitted and not yet played.
|
|
130
|
+
export function lesFiches(ctx) {
|
|
131
|
+
return [
|
|
132
|
+
...lire(ctx.fiches)
|
|
133
|
+
.split('\n')
|
|
134
|
+
.filter(Boolean)
|
|
135
|
+
.flatMap(l => {
|
|
136
|
+
try {
|
|
137
|
+
return [JSON.parse(l)];
|
|
138
|
+
} catch {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
...rendusDe(ctx, 'fiche').map(e => e.entree),
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// A result kept among the sheets of <ctx>, dated: the effect `fiche`.
|
|
147
|
+
export const inscrire = (ctx, entree) =>
|
|
148
|
+
emettre(ctx, { genre: 'fiche', entree: { date: new Date().toISOString(), ...entree } });
|
|
149
|
+
|
|
150
|
+
// The sheets of <role>, in their order.
|
|
151
|
+
export const fichesDe = (ctx, role) =>
|
|
152
|
+
lesFiches(ctx)
|
|
153
|
+
.filter(e => e.role === role)
|
|
154
|
+
.map(e => e.fiche);
|
|
155
|
+
|
|
156
|
+
// One line of the circuit's history at the ticket: `Circuit · <étape> : <texte>`, the effect
|
|
157
|
+
// `commentaire`; one not written is said, and the circuit goes on (`ecrireLEffet`).
|
|
158
|
+
export function commenter(ctx, etape, texte) {
|
|
159
|
+
emettre(ctx, {
|
|
160
|
+
genre: 'commentaire',
|
|
161
|
+
ticket: ctx.ticket,
|
|
162
|
+
texte: `${PREFIXE}${etape} : ${texte}`,
|
|
163
|
+
auteur: AUTEUR_DU_CIRCUIT,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// The time <d> in local time with its offset, to the second, as ISO 8601 writes it and as the
|
|
168
|
+
// envelope dates the header of a session (`date -Iseconds`): « 2026-10-25T12:42:11+01:00 ».
|
|
169
|
+
export function heureLocale(d = new Date()) {
|
|
170
|
+
const deux = n => String(n).padStart(2, '0');
|
|
171
|
+
const decalage = -d.getTimezoneOffset();
|
|
172
|
+
const a = Math.abs(decalage);
|
|
173
|
+
return `${d.getFullYear()}-${deux(d.getMonth() + 1)}-${deux(d.getDate())}T${deux(d.getHours())}:${deux(d.getMinutes())}:${deux(d.getSeconds())}${decalage < 0 ? '-' : '+'}${deux(Math.floor(a / 60))}:${deux(a % 60)}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// The header line of a step or a session in the ticket's log, in local time, as the envelope
|
|
177
|
+
// dates a session's.
|
|
178
|
+
export const entete = (ctx, etape) =>
|
|
179
|
+
appendFileSync(ctx.journal, `=== ${heureLocale()} · circuit · ${etape} ===\n`);
|
|
180
|
+
|
|
181
|
+
// The name of each package of <dossiers> as a title writes it: its component's name, or its path.
|
|
182
|
+
export function nomsDe(ctx, dossiers) {
|
|
183
|
+
const liste = composantsDe(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
|
|
184
|
+
return dossiers.map(d => liste.find(p => p.dossier === d)?.pkg.name ?? d);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const lire = f => (existsSync(f) ? readFileSync(f, 'utf8') : '');
|
|
188
|
+
|
|
189
|
+
// The gesture <genre> of the circuit (scripts/etapes.mjs, GESTES), with no session: its line at
|
|
190
|
+
// the ticket and in the log, with its rule.
|
|
191
|
+
export function geste(ctx, genre) {
|
|
192
|
+
const g = gesteDe(genre);
|
|
193
|
+
const texte = `${genre} → ${g.geste} (règle : ${g.regle})`;
|
|
194
|
+
commenter(ctx, 'geste', texte);
|
|
195
|
+
entete(ctx, 'geste');
|
|
196
|
+
appendFileSync(ctx.journal, `geste : ${texte}\n`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// The JSON of the file <f>, or null when it does not read.
|
|
200
|
+
export const lireJson = f => {
|
|
201
|
+
try {
|
|
202
|
+
return JSON.parse(readFileSync(f, 'utf8'));
|
|
203
|
+
} catch {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// The types of the decisions of the circuit (./transitions.mjs), which the workflow of a ticket
|
|
2
|
+
// under Temporal (src/temporal/circuit/) imports.
|
|
3
|
+
|
|
4
|
+
/** The run at its step. */
|
|
5
|
+
export interface EtatDeLaTransition {
|
|
6
|
+
etape: string;
|
|
7
|
+
tentative: number;
|
|
8
|
+
rapport: string | null;
|
|
9
|
+
finale: boolean;
|
|
10
|
+
relanceSurLeRefus?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** What a decision reads: the run, the circuit's memory, the ticket, the facts read so far. */
|
|
14
|
+
export interface EntreeDeLaTransition {
|
|
15
|
+
etat: EtatDeLaTransition;
|
|
16
|
+
memoire: Record<string, unknown>;
|
|
17
|
+
ticket: { id: string; paquets: string[]; sorte: unknown; copie: string };
|
|
18
|
+
reprend?: boolean;
|
|
19
|
+
faits?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The next fact to read, with what the step decided before it; or the decision of the step. */
|
|
23
|
+
export interface Transition {
|
|
24
|
+
besoin?: { fait: string; [parametre: string]: unknown };
|
|
25
|
+
suivant?: EtatDeLaTransition;
|
|
26
|
+
memoire?: Record<string, unknown>;
|
|
27
|
+
effets?: unknown[];
|
|
28
|
+
arret?: Record<string, unknown> & { nom?: string };
|
|
29
|
+
fin?: boolean;
|
|
30
|
+
usage?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The decision of the step of <entree>, or the next fact it needs. */
|
|
34
|
+
export function transition(entree: EntreeDeLaTransition): Transition;
|
|
35
|
+
|
|
36
|
+
/** The state of the plan of a ticket: the explorateur's sheet, the questionneur's, the questions put, the answer. */
|
|
37
|
+
export interface EtatDuPlan {
|
|
38
|
+
plan: { questions: unknown[] } | null;
|
|
39
|
+
lu: unknown;
|
|
40
|
+
posees: string[];
|
|
41
|
+
reponse: unknown;
|
|
42
|
+
[cle: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The step of the plan that follows <e>. */
|
|
46
|
+
export function pasDuPlan(e: EtatDuPlan): 'explorateur' | 'questionneur' | 'reponse' | 'conclure';
|
|
47
|
+
|
|
48
|
+
/** The questions the explorateur answers in the questionneur's sheet <lu>. */
|
|
49
|
+
export function questionsPosees(lu: {
|
|
50
|
+
issue: string;
|
|
51
|
+
desaccord?: string;
|
|
52
|
+
questions: { question: string }[];
|
|
53
|
+
}): string[];
|
|
54
|
+
|
|
55
|
+
/** What stays open of the plan once the explorateur answered <reponses> to the questions <posees>. */
|
|
56
|
+
export function ouvertesDuPlan<Q>(
|
|
57
|
+
plan: { questions: Q[] },
|
|
58
|
+
posees: string[],
|
|
59
|
+
reponses: { numero: number | string }[]
|
|
60
|
+
): (Q | { question: string; piece: string })[];
|
|
61
|
+
|
|
62
|
+
/** The effects <effets> an act gave back as the workflow plays them: consecutive states are one. */
|
|
63
|
+
export function effetsAJouer<E extends { genre: string }>(effets: E[]): E[];
|
|
64
|
+
|
|
65
|
+
/** The stop « inattendu » at <etat> that no act could write at the ticket, its message <message>, its piece <ou>. */
|
|
66
|
+
export function arretSansActe(
|
|
67
|
+
etat: EtatDeLaTransition,
|
|
68
|
+
message: string,
|
|
69
|
+
ou: string
|
|
70
|
+
): {
|
|
71
|
+
code: number;
|
|
72
|
+
nom: string;
|
|
73
|
+
question: { arret: string; fait: string; piece: string; question: string; qui: string };
|
|
74
|
+
etat: EtatDeLaTransition & { raison: string };
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** The steps of the run by their state (scripts/etapes.mjs): 1.1 to 5.3. */
|
|
78
|
+
export const GESTE: string;
|
|
79
|
+
export const TESTS: string;
|
|
80
|
+
export const PREUVE: string;
|
|
81
|
+
export const CODE: string;
|
|
82
|
+
export const CONTROLES: string;
|
|
83
|
+
export const REFERENCES: string;
|
|
84
|
+
export const RELECTURE: string;
|
|
85
|
+
export const INTEGRATION: string;
|
|
86
|
+
export const EN_FILE: string;
|
|
87
|
+
export const TRI: string;
|
|
88
|
+
|
|
89
|
+
/** The bounded loops: the testwriter's relaunches, the developpeur's sessions, the reviews. */
|
|
90
|
+
export const RELANCES_TESTWRITER: number;
|
|
91
|
+
export const SEANCES_DEVELOPPEUR: number;
|
|
92
|
+
export const RELECTURES: number;
|
|
93
|
+
|
|
94
|
+
/** What changed for a developpeur relaunched on the integration's refusal of his lot unchanged. */
|
|
95
|
+
export const CHANGE_DU_REFUS: string;
|
|
96
|
+
|
|
97
|
+
/** A stop of a decision: its name, its report, and the options of an Arret of the circuit. */
|
|
98
|
+
interface ArretDeLaDecision {
|
|
99
|
+
nom: string;
|
|
100
|
+
rapport: string;
|
|
101
|
+
piece: string | null;
|
|
102
|
+
question: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The finding of the reviewer, as the decisions read it. */
|
|
106
|
+
interface Constat {
|
|
107
|
+
titre: string;
|
|
108
|
+
role: string;
|
|
109
|
+
piece?: string;
|
|
110
|
+
[champ: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The developpeur's report on the integration's refusal <refus>. */
|
|
114
|
+
export function rapportDuRefus(refus: { rapport: string }): string;
|
|
115
|
+
|
|
116
|
+
/** The step after the plan of sort <sorte>: the gesture, the developpeur, or the testwriter. */
|
|
117
|
+
export function etapeApresLePlan(e: {
|
|
118
|
+
sorte?: { genre?: string } | null;
|
|
119
|
+
sansTests?: boolean;
|
|
120
|
+
}): string;
|
|
121
|
+
|
|
122
|
+
/** The step after a proof that passes: the developpeur, or the checks. */
|
|
123
|
+
export function apresLaPreuve(e: {
|
|
124
|
+
rouges: number;
|
|
125
|
+
pourLeDeveloppeur?: boolean;
|
|
126
|
+
inchange?: boolean;
|
|
127
|
+
}): string;
|
|
128
|
+
|
|
129
|
+
/** What follows a red of the reading of the copy after the session <tentative> of <role>. */
|
|
130
|
+
export function suiteDuRougeDeLecture(
|
|
131
|
+
role: string,
|
|
132
|
+
tentative: number
|
|
133
|
+
): { etape: string; tentative: number } | { arret: string };
|
|
134
|
+
|
|
135
|
+
/** The findings of the reviewer open for <role> among <constats>, in their order. */
|
|
136
|
+
export function ouverts<C extends Constat>(constats: C[] | null | undefined, role: string): C[];
|
|
137
|
+
|
|
138
|
+
/** The stop for the findings open that go to the testwriter when the plan skips him, or null. */
|
|
139
|
+
export function arretDuTestwriterSaute(
|
|
140
|
+
e: { constats?: Constat[] | null; sansTests?: boolean; paquets: string[] },
|
|
141
|
+
texte: string
|
|
142
|
+
): ArretDeLaDecision | null;
|
|
143
|
+
|
|
144
|
+
/** The stop for a RENDU of a mechanical lot, or null. */
|
|
145
|
+
export function arretDuGesteMecanique(
|
|
146
|
+
e: { constats?: Constat[] | null; mecanique?: boolean; sorte?: { raison?: string } | null },
|
|
147
|
+
texte: string
|
|
148
|
+
): ArretDeLaDecision | null;
|