@roomi-fields/grillhouse 0.54.1 → 0.55.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +73 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
- package/cadre/templates/projet/CONTRIBUTING.md +0 -5
- package/cadre/templates/projet/README.md +0 -126
- package/cadre/templates/projet/_npmignore +1 -6
- package/cadre/templates/projet/package.json +5 -32
- package/cadre/templates/projet/tsconfig.json +4 -4
- package/cadre/templates/projet/vitest.config.cjs +3 -2
- package/charte/tests.md +14 -0
- package/dist/machine/part-par-sorte.d.ts +9 -9
- package/dist/machine/part-par-sorte.js +20 -24
- package/dist/machine/part-par-sorte.js.map +1 -1
- package/dist/machine/table-des-consommations.d.ts +65 -0
- package/dist/machine/table-des-consommations.js +94 -0
- package/dist/machine/table-des-consommations.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +2 -0
- package/dist/temporal/circuit/activites.js +87 -3
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/client.js +9 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +32 -4
- package/dist/temporal/circuit/deroule.js +54 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/circuit/versions.d.ts +12 -0
- package/dist/temporal/circuit/versions.js +22 -0
- package/dist/temporal/circuit/versions.js.map +1 -0
- package/dist/temporal/consommation/activites.d.ts +2 -0
- package/dist/temporal/consommation/activites.js +9 -0
- package/dist/temporal/consommation/activites.js.map +1 -0
- package/dist/temporal/consommation/actualisation.d.ts +2 -0
- package/dist/temporal/consommation/actualisation.js +71 -0
- package/dist/temporal/consommation/actualisation.js.map +1 -0
- package/dist/temporal/consommation/client.d.ts +12 -0
- package/dist/temporal/consommation/client.js +28 -0
- package/dist/temporal/consommation/client.js.map +1 -0
- package/dist/temporal/consommation/commande.d.ts +5 -0
- package/dist/temporal/consommation/commande.js +32 -0
- package/dist/temporal/consommation/commande.js.map +1 -0
- package/dist/temporal/consommation/contrat.d.ts +15 -0
- package/dist/temporal/consommation/contrat.js +13 -0
- package/dist/temporal/consommation/contrat.js.map +1 -0
- package/dist/temporal/consommation/deroule.d.ts +2 -0
- package/dist/temporal/consommation/deroule.js +14 -0
- package/dist/temporal/consommation/deroule.js.map +1 -0
- package/dist/temporal/deroules.d.ts +2 -1
- package/dist/temporal/deroules.js +3 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/file/deroule.js +14 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +6 -0
- package/dist/temporal/installation.js +15 -0
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +2 -1
- package/dist/temporal/nuits/activites.js +127 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/client.d.ts +19 -5
- package/dist/temporal/nuits/client.js +33 -23
- package/dist/temporal/nuits/client.js.map +1 -1
- package/dist/temporal/nuits/commande.js +16 -11
- package/dist/temporal/nuits/commande.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +29 -0
- package/dist/temporal/nuits/contrat.js +10 -0
- package/dist/temporal/nuits/contrat.js.map +1 -1
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +18 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/nuits/pc2.d.ts +72 -0
- package/dist/temporal/nuits/pc2.js +206 -0
- package/dist/temporal/nuits/pc2.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +23 -1
- package/dist/temporal/places/activites.js +38 -2
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +18 -2
- package/dist/temporal/places/client.js +28 -3
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +79 -14
- package/dist/temporal/places/contrat.js +7 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +159 -23
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/places/reservation.d.ts +54 -0
- package/dist/temporal/places/reservation.js +69 -0
- package/dist/temporal/places/reservation.js.map +1 -0
- package/dist/temporal/planification.d.ts +6 -0
- package/dist/temporal/planification.js +26 -0
- package/dist/temporal/planification.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +0 -2
- package/dist/temporal/tickets/activites.js +2 -52
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +7 -26
- package/dist/temporal/tickets/deroule.js +35 -23
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +2 -0
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +16 -11
- package/docs/architecture/circuit.md +62 -58
- package/docs/architecture/entree.md +87 -63
- package/docs/architecture/greffon.md +24 -21
- package/docs/architecture/installation.md +35 -30
- package/docs/architecture/machine.md +48 -40
- package/docs/architecture/tests.md +37 -33
- package/docs/lexique.md +4 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +351 -180
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +3 -22
- package/scripts/avancement.mjs +21 -30
- package/scripts/bilan.mjs +22 -2
- package/scripts/branche-de-nuit.mjs +1 -1
- package/scripts/circuit.mjs +75 -39
- package/scripts/codes-de-sortie.mjs +0 -6
- package/scripts/coeurs-dedies.mjs +19 -2
- package/scripts/consommation-des-passes.mjs +67 -35
- package/scripts/consommation.mjs +152 -24
- package/scripts/copies-finies.mjs +15 -35
- package/scripts/dernier-vert.mjs +4 -5
- package/scripts/dette.mjs +5 -3
- package/scripts/droits.mjs +2 -2
- package/scripts/echantillonneur-de-la-passe.mjs +7 -31
- package/scripts/engendres.mjs +5 -61
- package/scripts/enveloppe/enveloppe.mjs +30 -34
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
- package/scripts/etapes.mjs +21 -7
- package/scripts/etat-du-depot.mjs +61 -0
- package/scripts/faits-du-circuit.mjs +7 -4
- package/scripts/fermeture-de-la-machine.d.mts +6 -4
- package/scripts/fermeture-de-la-machine.mjs +12 -16
- package/scripts/fichier-du-poste.d.mts +9 -0
- package/scripts/file-des-tickets.d.mts +0 -18
- package/scripts/file-des-tickets.mjs +0 -42
- package/scripts/fusion-du-changelog.mjs +1 -1
- package/scripts/grillhouse-maj.mjs +1 -1
- package/scripts/index-des-rouges.d.mts +40 -0
- package/scripts/index-des-rouges.mjs +104 -0
- package/scripts/integration/file.mjs +13 -63
- package/scripts/integration/integrer.mjs +157 -424
- package/scripts/integration/jugement.mjs +109 -0
- package/scripts/integration/rejeu.mjs +94 -71
- package/scripts/jointure.d.ts +34 -27
- package/scripts/journal-des-etats.d.mts +1 -1
- package/scripts/langages/c/commandes.mjs +27 -12
- package/scripts/langages/cargo/commandes.mjs +148 -94
- package/scripts/langages/cargo/index.mjs +2 -1
- package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
- package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/python/commandes.mjs +31 -15
- package/scripts/langages/python/index.mjs +2 -1
- package/scripts/langages/python/lectures-des-tests.mjs +148 -0
- package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
- package/scripts/langages/typescript/index.mjs +4 -0
- package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
- package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
- package/scripts/langages/typescript/tests.mjs +11 -37
- package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
- package/scripts/langages/typescript/verifier.mjs +74 -44
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
- package/scripts/lectures-communes.mjs +234 -0
- package/scripts/machine.mjs +11 -18
- package/scripts/mesure/base-de-passe.mjs +1 -2
- package/scripts/mesure-de-la-machine.d.mts +43 -3
- package/scripts/mesure-de-la-machine.mjs +209 -11
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
- package/scripts/migrations/nuit-yml-retire.mjs +25 -0
- package/scripts/migrations/part-retiree.mjs +31 -0
- package/scripts/migrations/table-des-consommations.mjs +36 -0
- package/scripts/migrations.mjs +6 -0
- package/scripts/montee.mjs +9 -0
- package/scripts/nuit-de-pc2.mjs +628 -0
- package/scripts/nuit.sh +8 -131
- package/scripts/paquets.mjs +1 -1
- package/scripts/passe-de-la-machine.mjs +365 -105
- package/scripts/place-du-circuit.d.mts +15 -0
- package/scripts/place-du-circuit.mjs +32 -0
- package/scripts/places-de-la-machine.mjs +148 -627
- package/scripts/places-du-serveur.mjs +43 -16
- package/scripts/plafond-de-la-machine.d.mts +8 -13
- package/scripts/plafond-de-la-machine.mjs +37 -69
- package/scripts/registre-des-entrees.mjs +57 -0
- package/scripts/regles-des-places.d.mts +84 -50
- package/scripts/regles-des-places.mjs +200 -156
- package/scripts/retirer-copie.sh +2 -2
- package/scripts/seances.mjs +181 -63
- package/scripts/secours.mjs +95 -0
- package/scripts/services-du-noyau.mjs +11 -19
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/sous-modules.sh +1 -1
- package/scripts/superviseur.mjs +16 -7
- package/scripts/table-des-consommations.d.mts +9 -0
- package/scripts/table-des-consommations.mjs +35 -0
- package/scripts/tableau.mjs +33 -19
- package/scripts/taches-du-graphe.mjs +124 -2
- package/scripts/transitions.d.mts +27 -5
- package/scripts/transitions.mjs +125 -104
- package/scripts/verdict-de-la-nuit.d.mts +13 -0
- package/scripts/verdict-de-la-nuit.mjs +34 -7
- package/scripts/verrou-de-fichier.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +2 -2
- package/skills/developpeur/SKILL.md +8 -2
- package/skills/direct/SKILL.md +5 -0
- package/skills/explorateur/SKILL.md +10 -1
- package/skills/grill/SKILL.md +2 -4
- package/skills/pitmaster/SKILL.md +7 -5
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +15 -2
- package/cadre/templates/projet/.env.example +0 -57
- package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
- package/cadre/templates/projet/deployment/README.md +0 -98
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
- package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
- package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
- package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
- package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
- package/cadre/templates/projet/ecosystem.config.cjs +0 -73
- package/cadre/templates/projet/src/config.ts +0 -68
- package/cadre/templates/projet/src/errors.ts +0 -102
- package/cadre/templates/projet/src/index.ts +0 -46
- package/cadre/templates/projet/src/services/.gitkeep +0 -8
- package/cadre/templates/projet/src/types/index.ts +0 -24
- package/cadre/templates/projet/src/utils/logger.ts +0 -106
- package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
- package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
- package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
- package/cadre/templates/projet/tsconfig.build.json +0 -14
- package/scripts/flux-de-la-nuit.mjs +0 -39
- package/scripts/garde-de-la-memoire.mjs +0 -231
- package/scripts/repli-de-la-nuit.mjs +0 -184
|
@@ -1,141 +1,62 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// The
|
|
3
|
-
// « Actes de la file », §5.1)
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// refused. The circuit of the ticket then sends the branch to the queue of the
|
|
7
|
-
// workflow `file:<racine>`, src/temporal/file/deroule.ts), which brings it onto main.
|
|
8
|
-
// working tree of the repository, it works on the main tree, found from git's common
|
|
2
|
+
// The entry of a lot into the queue (packages/grillhouse/docs/architecture/entree.md §3.1
|
|
3
|
+
// « Actes de la file », §5.1), run by the circuit of the ticket (scripts/circuit.mjs) at 5.1, once
|
|
4
|
+
// the reviewer has accepted the lot the final pass committed in the ticket's copy and judged. It
|
|
5
|
+
// gives that commit its final message, without changing its tree, or refuses it with the full output
|
|
6
|
+
// of the step that refused. The circuit of the ticket then sends the branch to the queue of the
|
|
7
|
+
// project (the workflow `file:<racine>`, src/temporal/file/deroule.ts), which brings it onto main.
|
|
8
|
+
// Run from any working tree of the repository, it works on the main tree, found from git's common
|
|
9
|
+
// directory.
|
|
9
10
|
//
|
|
10
|
-
// npx grillhouse integrer --ticket <id>
|
|
11
|
-
// [--tests <patch>] [--code <patch>] --message <file> [--references <file>]
|
|
11
|
+
// npx grillhouse integrer --ticket <id> [--message <file>]
|
|
12
12
|
//
|
|
13
13
|
// One delivery is one ticket: the ticket gives its branch `agent/<ticket>` and its copy
|
|
14
|
-
// (`.claude/worktrees/<ticket>`, the
|
|
15
|
-
//
|
|
14
|
+
// (`.claude/worktrees/<ticket>`, which holds the commit of the lot); a second --ticket is a usage
|
|
15
|
+
// error, named. In order, each step refusing stops the run:
|
|
16
16
|
// 0. the keys of the project, read from the package.json of the main tree: its generated files
|
|
17
|
-
// (`grillhouse.engendres`, scripts/engendres.mjs)
|
|
18
|
-
// scripts/outils-cles.mjs), a faulty key refused by its name before any work;
|
|
17
|
+
// (`grillhouse.engendres`, scripts/engendres.mjs), its tools (`grillhouse.outils`,
|
|
18
|
+
// scripts/outils-cles.mjs) and its data, a faulty key refused by its name before any work;
|
|
19
19
|
// 1. the verdict: the ticket has `ACCEPTÉ` as its last reviewer verdict (`ACCEPTÉ` or
|
|
20
20
|
// `RENDU` at the start of a comment of the author `relecteur`; another author's is none) and, when labelled `arbitrage`, each arbitrage
|
|
21
21
|
// (`estArbitrage`: a « ## Arbitrage » comment, the supervisor's) is settled
|
|
22
22
|
// (`arbitrageTranche`: `### Verdict — tranché`, or a « ## Réponse du
|
|
23
23
|
// responsable » comment after it): `refusArbitrage`, the one rule of the label, which the
|
|
24
24
|
// circuit plays too at its launch and at each resumption (scripts/circuit.mjs);
|
|
25
|
-
// 2. the
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
// ticket
|
|
38
|
-
//
|
|
39
|
-
// (below), then the replay makes the dependencies agree with the lock file and the manifests
|
|
40
|
-
// of the copy (`npm ci`, as the continuous integration runs it); an install that fails refuses
|
|
41
|
-
// the lot, « Les dépendances de la copie ne s'installent pas. »; then the other references
|
|
42
|
-
// regenerate (`installerEtRegenerer` of scripts/engendres.mjs);
|
|
43
|
-
// 6. the commit in the copy, its hooks included, under GRILLHOUSE_INTEGRATION=1: a pre-commit
|
|
44
|
-
// hook that plays the guards skips them, as the final pass plays them; nothing is verified
|
|
45
|
-
// here: the queue lays the branch on the tip of main, and its final pass judges the lot before
|
|
46
|
-
// main moves (scripts/integration/file.mjs); the commit committed is the commit that pass
|
|
47
|
-
// judges;
|
|
48
|
-
// 7. the branch `agent/<ticket>` is set on that commit, the ticket's copy follows it and is
|
|
49
|
-
// removed by `scripts/retirer-copie.sh` (no `--jetable`; `--garder-travail`: the working
|
|
50
|
-
// directory of the ticket's circuit, `<copie>.travail`, stays for the circuit that still runs,
|
|
51
|
-
// and the queue removes it at the ticket's closure): a refusal, a locked copy for
|
|
52
|
-
// example, is written to the ticket, the commit stands. The ticket is labelled
|
|
53
|
-
// `en-file`, which the queue removes. main does not move here.
|
|
25
|
+
// 2. the commit of the lot (`refusDuLot`): the copy is on its branch, its HEAD is the commit the
|
|
26
|
+
// circuit posed, it holds no change since, and the tree of that commit is in the registry of the
|
|
27
|
+
// trees judged (scripts/arbres-juges.mjs), as bors enters only the tree it tested;
|
|
28
|
+
// 3. the main tree: every file of the lot is unmodified there;
|
|
29
|
+
// 4. the commit takes the message, its hooks included, under GRILLHOUSE_INTEGRATION=1 (a
|
|
30
|
+
// pre-commit hook that plays the guards skips them, as the final pass plays them; commit-msg
|
|
31
|
+
// judges the message), its tree unchanged: a commit a hook refuses, or whose tree it changes,
|
|
32
|
+
// is left as it was;
|
|
33
|
+
// 5. the ticket is labelled `en-file`, which the queue removes, and the copy is removed by
|
|
34
|
+
// `scripts/retirer-copie.sh` (no `--jetable`; `--garder-travail`: the working directory of the
|
|
35
|
+
// ticket's circuit, `<copie>.travail`, stays for the circuit that still runs, and the queue
|
|
36
|
+
// removes it at the ticket's closure): a refusal, a locked copy for example, is written to the
|
|
37
|
+
// ticket, the commit stands. main does not move here, and main advanced since the judgement
|
|
38
|
+
// sends nothing back: the queue lays the branch on the tip of main and judges it again.
|
|
54
39
|
//
|
|
55
|
-
// The
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
// scripts/engendres.mjs reads them). As a genrule of Bazel writes its output again on the merged
|
|
61
|
-
// tree, and npm install writes package-lock.json again after a merge, a file of the lot a reference
|
|
62
|
-
// writes in full is not applied: main's version stays, and each reference whose files or reads the
|
|
63
|
-
// lot touches plays in the copy, on main of the moment, before the commit, through the mounts, with
|
|
64
|
-
// the tools of the project, and what it writes enters the commit (`regenerer` of
|
|
65
|
-
// scripts/engendres.mjs): one that writes package-lock.json before the install, the others after it
|
|
66
|
-
// (`installerEtRegenerer`). A command of the project at another code than 0, one of
|
|
67
|
-
// the frame on a real failure (126, 127, a signal), or a file it changes that its `fichiers` do not
|
|
68
|
-
// cover, refuses the lot, the command, its code and its output named. A conflict on any other file
|
|
69
|
-
// refuses it, as the three-way application says. A generated file of the project the lot removes
|
|
70
|
-
// from the key (`encoreDeclares` of scripts/engendres.mjs, read in the copy once the lots are
|
|
71
|
-
// applied) follows the lot: its deletion is done, any other change applied, its command not played.
|
|
72
|
-
//
|
|
73
|
-
// What steps 2, 3 and 5 read of a lot is its files: each file added, modified or deleted, a
|
|
74
|
-
// rename counting its source and its destination (named as the file is, not as git quotes it in
|
|
75
|
-
// the patch), a copy its destination only. Step 2 judges them against the testwriter's files, step 3
|
|
76
|
-
// against the main tree and the ticket's copy, and step 5 compares them with the copy's own base
|
|
77
|
-
// plus the lot.
|
|
78
|
-
//
|
|
79
|
-
// The main tree is not touched. The duration is written at the end.
|
|
80
|
-
// One integration runs at a time (`.git/integration.lock`): another waits for the end of the
|
|
81
|
-
// running one; a lock whose process is gone is taken over. Exit code: 0 committed, 1 refused,
|
|
82
|
-
// 2 usage, 3 refused because a lot does not apply on main (`LOT_NE_S_APPLIQUE_PAS` of
|
|
83
|
-
// scripts/etapes.mjs).
|
|
84
|
-
// Called without a lot to apply (neither `--tests` nor `--code`), it does not commit: the lot is
|
|
85
|
-
// already on main (`lotSurMain`, exit 0, nothing done) or it is refused by the name `lot-absent`
|
|
86
|
-
// (exit 1), the same rule the circuit's resumption reads (scripts/activites.mjs).
|
|
40
|
+
// The main tree is not touched. The duration is written at the end. Exit code: 0 done, 1 refused,
|
|
41
|
+
// 2 usage.
|
|
42
|
+
// Called without a message, it does not commit: the lot is already on main (`lotSurMain`, exit 0,
|
|
43
|
+
// nothing done) or it is refused by the name `lot-absent` (exit 1), the same rule the circuit's
|
|
44
|
+
// resumption reads (scripts/activites.mjs).
|
|
87
45
|
import { spawnSync } from 'node:child_process';
|
|
88
|
-
import { existsSync
|
|
46
|
+
import { existsSync } from 'node:fs';
|
|
89
47
|
import path from 'node:path';
|
|
90
48
|
import { pathToFileURL } from 'node:url';
|
|
91
49
|
import { arbitrageTranche, estArbitrage } from '../arbitrages.mjs';
|
|
92
|
-
import {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
installerEtRegenerer,
|
|
96
|
-
partDesLots,
|
|
97
|
-
poserLesRetires,
|
|
98
|
-
touchesPar,
|
|
99
|
-
} from '../engendres.mjs';
|
|
100
|
-
import { LOT_NE_S_APPLIQUE_PAS } from '../etapes.mjs';
|
|
101
|
-
import { langageDe } from '../langages.mjs';
|
|
50
|
+
import { arbreEstJuge } from '../arbres-juges.mjs';
|
|
51
|
+
import { commitDuLot, marquerLeLot } from '../etat-du-depot.mjs';
|
|
52
|
+
import { engendresDe } from '../engendres.mjs';
|
|
102
53
|
import { prefixe } from '../prefixe-des-tickets.mjs';
|
|
103
54
|
import { commitsDelivering, gitLog } from '../un-commit-par-ticket.mjs';
|
|
104
55
|
import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
|
|
105
56
|
import { matieresDeclareesDe } from '../matieres-cles.mjs';
|
|
106
57
|
import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
|
|
107
|
-
import {
|
|
108
|
-
import { ouvrirCopie, RETIRER_COPIE } from './rejeu.mjs';
|
|
58
|
+
import { monterDans, RETIRER_COPIE } from './rejeu.mjs';
|
|
109
59
|
import { verdictDe } from './verdict.mjs';
|
|
110
|
-
import { ouvrirBase } from '../mesure/base-de-passe.mjs';
|
|
111
|
-
|
|
112
|
-
// A file name as git writes it in a patch: a name with a character outside ASCII, a quote, a
|
|
113
|
-
// backslash or a control character comes between quotes with C escapes (`\303\251` for `é`).
|
|
114
|
-
// Returns the name itself.
|
|
115
|
-
function nomDeGit(ecrit) {
|
|
116
|
-
if (!ecrit.startsWith('"')) {
|
|
117
|
-
return ecrit;
|
|
118
|
-
}
|
|
119
|
-
const octets = [];
|
|
120
|
-
const echappes = { n: 10, t: 9, r: 13, a: 7, b: 8, f: 12, v: 11 };
|
|
121
|
-
const corps = Buffer.from(ecrit.slice(1, -1), 'utf8');
|
|
122
|
-
for (let i = 0; i < corps.length; i++) {
|
|
123
|
-
if (corps[i] !== 0x5c) {
|
|
124
|
-
octets.push(corps[i]);
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
const suite = String.fromCharCode(corps[i + 1]);
|
|
128
|
-
const octal = /^[0-7]{3}/.exec(corps.subarray(i + 1, i + 4).toString('latin1'));
|
|
129
|
-
if (octal) {
|
|
130
|
-
octets.push(Number.parseInt(octal[0], 8));
|
|
131
|
-
i += 3;
|
|
132
|
-
} else {
|
|
133
|
-
octets.push(echappes[suite] ?? corps[i + 1]);
|
|
134
|
-
i += 1;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return Buffer.from(octets).toString('utf8');
|
|
138
|
-
}
|
|
139
60
|
|
|
140
61
|
// The refusal for the verdicts of one ticket, or null. `ticket` and `comments` are Beads' JSON.
|
|
141
62
|
export function refusVerdicts(ticket, comments) {
|
|
@@ -170,27 +91,6 @@ export function refusArbitrage(ticket, comments) {
|
|
|
170
91
|
return null;
|
|
171
92
|
}
|
|
172
93
|
|
|
173
|
-
// The refusal for the files of the lots, or null; the tests lot holds only what the testwriter
|
|
174
|
-
// writes, the code lot none of it. The files are relative to the repository root; each is judged
|
|
175
|
-
// on the tree where it exists, as each side of a diff is read in its own tree: a file present
|
|
176
|
-
// after the lot on <apres> (the ticket's copy), one the lot deletes or renames away on <avant>
|
|
177
|
-
// (the main tree), so a lot that creates or moves a package is read with its own map.
|
|
178
|
-
export function refusLots(tests, code, { avant, apres }) {
|
|
179
|
-
const testwriter = f => {
|
|
180
|
-
const racine = existsSync(path.join(apres, f)) ? apres : avant;
|
|
181
|
-
return langageDe(racine).estUnTest(f, racine) !== null;
|
|
182
|
-
};
|
|
183
|
-
const horsTests = tests.filter(f => !testwriter(f));
|
|
184
|
-
if (horsTests.length) {
|
|
185
|
-
return `Le lot de tests touche du code : ${horsTests.join(', ')}.`;
|
|
186
|
-
}
|
|
187
|
-
const duTestwriter = code.filter(testwriter);
|
|
188
|
-
if (duTestwriter.length) {
|
|
189
|
-
return `Le lot de code touche des fichiers du testwriter (tests ou matière de test partagée) : ${duTestwriter.join(', ')}.`;
|
|
190
|
-
}
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
94
|
/**
|
|
195
95
|
* The commit of main that holds the lot of <ticket>, or null: the one rule that says a lot is on
|
|
196
96
|
* main, which the queue (scripts/integration/file.mjs) and the circuit's resumption
|
|
@@ -234,16 +134,38 @@ export function lotSurMain(o, ticket) {
|
|
|
234
134
|
);
|
|
235
135
|
}
|
|
236
136
|
|
|
237
|
-
// The refusal « lot-absent » for <ticket>: no
|
|
238
|
-
//
|
|
239
|
-
//
|
|
137
|
+
// The refusal « lot-absent » for <ticket>: no commit to send into the queue and no commit of the
|
|
138
|
+
// ticket on main. The one text, which the integrator's direct call and the circuit's resumption both
|
|
139
|
+
// give, the name `lot-absent` first.
|
|
240
140
|
export const refusLotAbsent = ticket =>
|
|
241
|
-
`lot-absent : ${ticket} n'a aucun lot à
|
|
141
|
+
`lot-absent : ${ticket} n'a aucun lot à mettre en file et aucun commit de ce ticket n'est sur main.`;
|
|
142
|
+
|
|
143
|
+
const git = (dossier, ...args) =>
|
|
144
|
+
spawnSync('git', ['-C', dossier, ...args], { encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
|
|
242
145
|
|
|
243
|
-
|
|
244
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Why the commit of the lot of the copy <copie> does not enter the queue of the repository at
|
|
148
|
+
* <racine>, or null: its HEAD is not the commit the circuit posed, the copy changed since, or its
|
|
149
|
+
* tree is not in the registry of the trees judged. The one rule, which the circuit reads before it
|
|
150
|
+
* sends the lot back to the final pass (scripts/activites.mjs).
|
|
151
|
+
*/
|
|
152
|
+
export function refusDuLot(racine, copie) {
|
|
153
|
+
if (!commitDuLot(copie)) {
|
|
154
|
+
return `La copie ${copie} ne porte pas le commit du lot`;
|
|
155
|
+
}
|
|
156
|
+
const statut = git(copie, 'status', '--porcelain', '--untracked-files=all');
|
|
157
|
+
if (statut.status !== 0 || statut.stdout.trim()) {
|
|
158
|
+
return `La copie ${copie} a changé depuis le jugement :\n${statut.stdout.trimEnd()}${statut.stderr}`;
|
|
159
|
+
}
|
|
160
|
+
const arbre = git(copie, 'rev-parse', 'HEAD^{tree}').stdout.trim();
|
|
161
|
+
return arbreEstJuge(racine, arbre)
|
|
162
|
+
? null
|
|
163
|
+
: `L'arbre ${arbre} du commit du lot n'est pas au registre des arbres jugés`;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// The options, or { faute } for a usage error.
|
|
245
167
|
export function lire(argv) {
|
|
246
|
-
const o = { ticket: null,
|
|
168
|
+
const o = { ticket: null, message: null };
|
|
247
169
|
for (let i = 0; i < argv.length; i++) {
|
|
248
170
|
const v = argv[i + 1];
|
|
249
171
|
switch (argv[i]) {
|
|
@@ -256,79 +178,25 @@ export function lire(argv) {
|
|
|
256
178
|
o.ticket = v;
|
|
257
179
|
i++;
|
|
258
180
|
break;
|
|
259
|
-
case '--tests':
|
|
260
|
-
o.tests = v;
|
|
261
|
-
i++;
|
|
262
|
-
break;
|
|
263
|
-
case '--code':
|
|
264
|
-
o.code = v;
|
|
265
|
-
i++;
|
|
266
|
-
break;
|
|
267
181
|
case '--message':
|
|
268
182
|
o.message = v;
|
|
269
183
|
i++;
|
|
270
184
|
break;
|
|
271
|
-
case '--references':
|
|
272
|
-
o.references = v;
|
|
273
|
-
i++;
|
|
274
|
-
break;
|
|
275
185
|
default:
|
|
276
186
|
return { faute: null };
|
|
277
187
|
}
|
|
278
188
|
}
|
|
279
|
-
if (!o.ticket
|
|
189
|
+
if (!o.ticket) {
|
|
280
190
|
return { faute: null };
|
|
281
191
|
}
|
|
282
192
|
return o;
|
|
283
193
|
}
|
|
284
194
|
|
|
285
|
-
// The files of the ticket's copy that are not the lot: every modified, deleted or untracked file
|
|
286
|
-
// (ignored ones do not count) the lot does not name.
|
|
287
|
-
function horsLot(copieTicket, fichiers) {
|
|
288
|
-
const r = spawnSync(
|
|
289
|
-
'git',
|
|
290
|
-
['-C', copieTicket, 'status', '--porcelain=v1', '-z', '-uall', '--no-renames'],
|
|
291
|
-
{ encoding: 'utf8' }
|
|
292
|
-
);
|
|
293
|
-
if (r.status !== 0) {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
const dans = new Set(fichiers);
|
|
297
|
-
return r.stdout
|
|
298
|
-
.split('\0')
|
|
299
|
-
.filter(Boolean)
|
|
300
|
-
.map(l => l.slice(3))
|
|
301
|
-
.filter(f => !dans.has(f));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// The files of the lot whose content in the ticket's copy differs from its own base plus the lot:
|
|
305
|
-
// the lots are applied to the copy's HEAD in a temporary index, which the copy's files are compared
|
|
306
|
-
// to. Every file of the lot differs when the lots do not apply to that base.
|
|
307
|
-
function differents(copieTicket, lots, fichiers, tmp) {
|
|
308
|
-
const index = path.join(tmp, 'index-copie');
|
|
309
|
-
const env = { ...process.env, GIT_INDEX_FILE: index };
|
|
310
|
-
const dansCopie = (...args) =>
|
|
311
|
-
spawnSync('git', ['-C', copieTicket, ...args], { encoding: 'utf8', env });
|
|
312
|
-
if (dansCopie('read-tree', 'HEAD').status !== 0) {
|
|
313
|
-
return fichiers;
|
|
314
|
-
}
|
|
315
|
-
for (const p of lots) {
|
|
316
|
-
if (dansCopie('apply', '--cached', p).status !== 0) {
|
|
317
|
-
return fichiers;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
const r = dansCopie('diff', '--name-only', '--no-renames', '-z', '--', ...fichiers);
|
|
321
|
-
if (r.status !== 0) {
|
|
322
|
-
return fichiers;
|
|
323
|
-
}
|
|
324
|
-
return r.stdout.split('\0').filter(Boolean);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
195
|
export function main(argv, ou = process.cwd()) {
|
|
328
196
|
const o = lire(argv);
|
|
329
197
|
if ('faute' in o) {
|
|
330
198
|
process.stderr.write(
|
|
331
|
-
'usage: integrer.mjs --ticket <id> [--
|
|
199
|
+
'usage: integrer.mjs --ticket <id> [--message <file>]\n' +
|
|
332
200
|
(o.faute ? `⛔ ${o.faute}\n` : '')
|
|
333
201
|
);
|
|
334
202
|
return 2;
|
|
@@ -339,7 +207,6 @@ export function main(argv, ou = process.cwd()) {
|
|
|
339
207
|
encoding: 'utf8',
|
|
340
208
|
}).stdout.trim();
|
|
341
209
|
const racine = path.dirname(commun);
|
|
342
|
-
const git = (...args) => spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
|
|
343
210
|
const bd = (...a) =>
|
|
344
211
|
spawnSync('bd', a, { cwd: racine, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
|
|
345
212
|
const dire = s => process.stdout.write(`${s}\n`);
|
|
@@ -347,13 +214,11 @@ export function main(argv, ou = process.cwd()) {
|
|
|
347
214
|
process.stdout.write(`⛔ ${s}\nLe lot retourne à son agent avec cette sortie.\n`);
|
|
348
215
|
return 1;
|
|
349
216
|
};
|
|
350
|
-
const absolu = p => path.resolve(p);
|
|
351
217
|
|
|
352
|
-
// Without a
|
|
353
|
-
//
|
|
354
|
-
//
|
|
355
|
-
|
|
356
|
-
if (!(o.tests || o.code)) {
|
|
218
|
+
// Without a message: the lot is already on main, nothing to commit (exit 0), or it is absent and
|
|
219
|
+
// the call is refused by its name `lot-absent` — the same rule `lotSurMain` the circuit's
|
|
220
|
+
// resumption reads, not the usage (exit 2).
|
|
221
|
+
if (!o.message) {
|
|
357
222
|
let entre;
|
|
358
223
|
try {
|
|
359
224
|
entre = lotSurMain({ racine }, o.ticket);
|
|
@@ -367,232 +232,100 @@ export function main(argv, ou = process.cwd()) {
|
|
|
367
232
|
return 0;
|
|
368
233
|
}
|
|
369
234
|
|
|
370
|
-
// One integration at a time: a second waits for the end of the first; a lock whose process is
|
|
371
|
-
// gone is taken over.
|
|
372
|
-
const verrou = path.join(commun, 'integration.lock');
|
|
373
|
-
prendreVerrou(verrou, { attendre: true });
|
|
374
235
|
const debut = Date.now();
|
|
375
|
-
// The
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
236
|
+
// 0. The keys of the project, before any work.
|
|
237
|
+
let outils;
|
|
238
|
+
let empreintes;
|
|
239
|
+
let donnees;
|
|
379
240
|
try {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
empreintes = empreintesDe(racine);
|
|
389
|
-
donnees = donneesDe(racine);
|
|
390
|
-
matieresDeclareesDe(racine);
|
|
391
|
-
} catch (e) {
|
|
392
|
-
return refuser(`Une clé grillhouse du package.json est refusée :\n${e.message}`);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// 1. The verdict.
|
|
396
|
-
const show = bd('show', o.ticket, '--json');
|
|
397
|
-
const comments = bd('comments', o.ticket, '--json');
|
|
398
|
-
if (show.status !== 0 || comments.status !== 0) {
|
|
399
|
-
return refuser(`Ticket ${o.ticket} illisible : ${show.stderr}${comments.stderr}`);
|
|
400
|
-
}
|
|
401
|
-
const r1 = refusVerdicts(JSON.parse(show.stdout)[0], JSON.parse(comments.stdout || '[]'));
|
|
402
|
-
if (r1) {
|
|
403
|
-
return refuser(r1);
|
|
404
|
-
}
|
|
405
|
-
dire('✓ verdicts');
|
|
406
|
-
|
|
407
|
-
// 2. The lots.
|
|
408
|
-
const lots = [o.tests, o.code].filter(Boolean).map(absolu);
|
|
409
|
-
const fichiersDe = p => {
|
|
410
|
-
const r = git('apply', '--numstat', '-z', p);
|
|
411
|
-
if (r.status !== 0) {
|
|
412
|
-
return null;
|
|
413
|
-
}
|
|
414
|
-
const destinations = r.stdout
|
|
415
|
-
.split('\0')
|
|
416
|
-
.map(l => l.split('\t')[2])
|
|
417
|
-
.filter(Boolean);
|
|
418
|
-
// A rename names its source too (numstat names only the destination); a copy leaves its
|
|
419
|
-
// source intact, so only its destination counts.
|
|
420
|
-
const sources = [...readFileSync(p, 'utf8').matchAll(/^rename from (.+)$/gm)].map(m =>
|
|
421
|
-
nomDeGit(m[1])
|
|
422
|
-
);
|
|
423
|
-
return [...destinations, ...sources];
|
|
424
|
-
};
|
|
425
|
-
const tests = o.tests ? fichiersDe(absolu(o.tests)) : [];
|
|
426
|
-
const code = o.code ? fichiersDe(absolu(o.code)) : [];
|
|
427
|
-
if (!tests || !code) {
|
|
428
|
-
return refuser('Un patch du lot est illisible.');
|
|
429
|
-
}
|
|
430
|
-
// The ticket's copy holds the lot; a ticket without a copy (none was made, or it is gone) has
|
|
431
|
-
// its lot judged on the main tree alone, and nothing to check nor to remove.
|
|
432
|
-
const copieTicket = path.join(racine, '.claude', 'worktrees', o.ticket);
|
|
433
|
-
const avecCopie = existsSync(copieTicket);
|
|
434
|
-
const r2 = refusLots(tests, code, { avant: racine, apres: avecCopie ? copieTicket : racine });
|
|
435
|
-
if (r2) {
|
|
436
|
-
return refuser(r2);
|
|
437
|
-
}
|
|
438
|
-
const fichiers = [...new Set([...tests, ...code])];
|
|
439
|
-
dire(`✓ lots : ${fichiers.length} fichiers`);
|
|
440
|
-
let duCircuit = [];
|
|
441
|
-
if (o.references) {
|
|
442
|
-
try {
|
|
443
|
-
duCircuit = JSON.parse(readFileSync(absolu(o.references), 'utf8'));
|
|
444
|
-
} catch (e) {
|
|
445
|
-
return refuser(`Les références ${o.references} ne se lisent pas : ${e.message}`);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
const duProjet = engendres.map(e => ({ ...e, cadre: false }));
|
|
449
|
-
const references = [...duProjet, ...duCircuit.map(r => ({ ...r, lit: r.lit ?? [] }))];
|
|
450
|
-
// The files of the lot a reference writes in full, and the references the lot touches.
|
|
451
|
-
const entiers = fichiers.filter(f => references.some(r => couvertPar(r.entiers, f)));
|
|
452
|
-
const aRegenerer = touchesPar(references, fichiers);
|
|
241
|
+
engendresDe(racine);
|
|
242
|
+
outils = outilsDe(racine);
|
|
243
|
+
empreintes = empreintesDe(racine);
|
|
244
|
+
donnees = donneesDe(racine);
|
|
245
|
+
matieresDeclareesDe(racine);
|
|
246
|
+
} catch (e) {
|
|
247
|
+
return refuser(`Une clé grillhouse du package.json est refusée :\n${e.message}`);
|
|
248
|
+
}
|
|
453
249
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
['-C', copieTicket, 'rev-parse', '--abbrev-ref', 'HEAD'],
|
|
466
|
-
{ encoding: 'utf8' }
|
|
467
|
-
);
|
|
468
|
-
if (surBranche.stdout.trim() !== branche) {
|
|
469
|
-
return refuser(`La copie du ticket ${copieTicket} n'est pas sur la branche ${branche}.`);
|
|
470
|
-
}
|
|
471
|
-
const autres = horsLot(copieTicket, fichiers);
|
|
472
|
-
if (autres === null) {
|
|
473
|
-
return refuser(`L'état de la copie ${copieTicket} ne se lit pas.`);
|
|
474
|
-
}
|
|
475
|
-
if (autres.length) {
|
|
476
|
-
return refuser(
|
|
477
|
-
`La copie du ticket porte autre chose que le lot :\n${autres.map(f => ` ${f}`).join('\n')}`
|
|
478
|
-
);
|
|
479
|
-
}
|
|
480
|
-
dire('✓ copie du ticket : le lot seul');
|
|
481
|
-
}
|
|
250
|
+
// 1. The verdict.
|
|
251
|
+
const show = bd('show', o.ticket, '--json');
|
|
252
|
+
const comments = bd('comments', o.ticket, '--json');
|
|
253
|
+
if (show.status !== 0 || comments.status !== 0) {
|
|
254
|
+
return refuser(`Ticket ${o.ticket} illisible : ${show.stderr}${comments.stderr}`);
|
|
255
|
+
}
|
|
256
|
+
const r1 = refusVerdicts(JSON.parse(show.stdout)[0], JSON.parse(comments.stdout || '[]'));
|
|
257
|
+
if (r1) {
|
|
258
|
+
return refuser(r1);
|
|
259
|
+
}
|
|
260
|
+
dire('✓ verdicts');
|
|
482
261
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
262
|
+
// 2. The commit of the lot.
|
|
263
|
+
const copie = path.join(racine, '.claude', 'worktrees', o.ticket);
|
|
264
|
+
const branche = `agent/${o.ticket}`;
|
|
265
|
+
if (!existsSync(copie)) {
|
|
266
|
+
return refuser(`Le ticket n'a pas de copie ${copie} qui porte le commit de son lot.`);
|
|
267
|
+
}
|
|
268
|
+
if (git(copie, 'rev-parse', '--abbrev-ref', 'HEAD').stdout.trim() !== branche) {
|
|
269
|
+
return refuser(`La copie du ticket ${copie} n'est pas sur la branche ${branche}.`);
|
|
270
|
+
}
|
|
271
|
+
const r2 = refusDuLot(racine, copie);
|
|
272
|
+
if (r2) {
|
|
273
|
+
return refuser(`${r2}.`);
|
|
274
|
+
}
|
|
275
|
+
const juge = commitDuLot(copie);
|
|
276
|
+
dire(`✓ commit du lot jugé : ${juge.slice(0, 7)}`);
|
|
491
277
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
// The generated files the lots remove from the key follow the lots: main's version is not kept.
|
|
504
|
-
const part = partDesLots({
|
|
505
|
-
references,
|
|
506
|
-
duProjet,
|
|
507
|
-
entiers,
|
|
508
|
-
touchees: aRegenerer,
|
|
509
|
-
arbre: copie,
|
|
510
|
-
});
|
|
511
|
-
let neSAppliquePas = false;
|
|
512
|
-
const suivis = poserLesRetires({
|
|
513
|
-
lots,
|
|
514
|
-
fichiers: part.suivis,
|
|
515
|
-
dansCopie,
|
|
516
|
-
surNonApplique: () => (neSAppliquePas = true),
|
|
517
|
-
});
|
|
518
|
-
if (suivis) {
|
|
519
|
-
const refus = refuser(suivis);
|
|
520
|
-
return neSAppliquePas ? LOT_NE_S_APPLIQUE_PAS : refus;
|
|
521
|
-
}
|
|
522
|
-
const divergents = avecCopie ? differents(copieTicket, lots, fichiers, tmp) : [];
|
|
523
|
-
if (divergents.length) {
|
|
524
|
-
return refuser(
|
|
525
|
-
`Des fichiers du lot diffèrent dans la copie du ticket :\n${divergents.map(f => ` ${f}`).join('\n')}`
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
dire('✓ lots appliqués');
|
|
529
|
-
const aRejouer = part.rejouees;
|
|
530
|
-
const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env, empreintes));
|
|
531
|
-
const { installation, refus } = installerEtRegenerer({
|
|
532
|
-
refs: aRejouer,
|
|
533
|
-
installer,
|
|
534
|
-
dansCopie,
|
|
535
|
-
lancer: commande =>
|
|
536
|
-
spawnSync('bash', monter('sh', '-c', commande), {
|
|
537
|
-
cwd: copie,
|
|
538
|
-
encoding: 'utf8',
|
|
539
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
540
|
-
env,
|
|
541
|
-
}),
|
|
542
|
-
});
|
|
543
|
-
if (installation || refus) {
|
|
544
|
-
return refuser(installation ?? refus);
|
|
545
|
-
}
|
|
546
|
-
if (aRejouer.length) {
|
|
547
|
-
dire(`✓ références régénérées sur main à jour : ${aRejouer.map(r => r.nom).join(', ')}`);
|
|
548
|
-
}
|
|
278
|
+
// 3. The main tree: the lot's files are free there, so the queue can bring them.
|
|
279
|
+
const fichiers = git(copie, 'diff', '--name-only', '--no-renames', '-z', `${juge}^`, juge)
|
|
280
|
+
.stdout.split('\0')
|
|
281
|
+
.filter(Boolean);
|
|
282
|
+
const tenus = fichiers.length
|
|
283
|
+
? git(racine, 'status', '--porcelain', '--', ...fichiers).stdout.trim()
|
|
284
|
+
: '';
|
|
285
|
+
if (tenus) {
|
|
286
|
+
return refuser(`Des fichiers du lot sont modifiés dans l'arbre :\n${tenus}`);
|
|
287
|
+
}
|
|
288
|
+
dire('✓ arbre principal libre');
|
|
549
289
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
290
|
+
// 4. The final message, on the same tree.
|
|
291
|
+
const montee = monterDans(copie);
|
|
292
|
+
if (montee.refus) {
|
|
293
|
+
return refuser(montee.refus);
|
|
294
|
+
}
|
|
295
|
+
const env = avecLesDonnees(donnees, avecLesOutils(outils, process.env, empreintes));
|
|
296
|
+
const c = spawnSync(
|
|
297
|
+
'bash',
|
|
298
|
+
montee.monter('git', '-C', copie, 'commit', '-q', '--amend', '-F', path.resolve(o.message)),
|
|
299
|
+
{ encoding: 'utf8', env: { ...env, GRILLHOUSE_INTEGRATION: '1' } }
|
|
300
|
+
);
|
|
301
|
+
if (c.status !== 0) {
|
|
302
|
+
return refuser(`Le message final du commit est refusé :\n${c.stdout}${c.stderr}`);
|
|
303
|
+
}
|
|
304
|
+
const arbreDe = rev => git(copie, 'rev-parse', `${rev}^{tree}`).stdout.trim();
|
|
305
|
+
if (arbreDe('HEAD') !== arbreDe(juge)) {
|
|
306
|
+
git(copie, 'reset', '-q', juge);
|
|
307
|
+
return refuser(
|
|
308
|
+
`Un crochet change l'arbre du commit jugé en écrivant son message ; le commit ${juge.slice(0, 7)} est gardé.\n${c.stdout}${c.stderr}`
|
|
561
309
|
);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
const commit = dansCopie('rev-parse', 'HEAD').stdout.trim();
|
|
310
|
+
}
|
|
311
|
+
marquerLeLot(copie);
|
|
312
|
+
const commit = git(copie, 'rev-parse', 'HEAD').stdout.trim();
|
|
566
313
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
bd('
|
|
577
|
-
dire(
|
|
578
|
-
const retrait = avecCopie
|
|
579
|
-
? spawnSync('bash', [RETIRER_COPIE, '--garder-travail', copieTicket], {
|
|
580
|
-
cwd: racine,
|
|
581
|
-
encoding: 'utf8',
|
|
582
|
-
})
|
|
583
|
-
: { status: 0, stderr: '' };
|
|
584
|
-
if (retrait.status !== 0) {
|
|
585
|
-
const raison = `La copie ${copieTicket} n'est pas retirée après le commit de ${branche} : ${retrait.stderr.trim()}`;
|
|
586
|
-
bd('comments', 'add', o.ticket, raison);
|
|
587
|
-
dire(`⚠ ${raison}`);
|
|
588
|
-
}
|
|
589
|
-
const duree = Math.round((Date.now() - debut) / 100) / 10;
|
|
590
|
-
dire(`⏱ ${duree} s`);
|
|
591
|
-
return 0;
|
|
592
|
-
} finally {
|
|
593
|
-
base.fermer();
|
|
594
|
-
lacherVerrou(verrou);
|
|
314
|
+
// 5. The ticket enters the queue and its copy goes.
|
|
315
|
+
bd('update', o.ticket, '--add-label', 'en-file');
|
|
316
|
+
dire(`✓ commit ${commit.slice(0, 7)} sur ${branche}`);
|
|
317
|
+
const retrait = spawnSync('bash', [RETIRER_COPIE, '--garder-travail', copie], {
|
|
318
|
+
cwd: racine,
|
|
319
|
+
encoding: 'utf8',
|
|
320
|
+
});
|
|
321
|
+
if (retrait.status !== 0) {
|
|
322
|
+
const raison = `La copie ${copie} n'est pas retirée après le commit de ${branche} : ${retrait.stderr.trim()}`;
|
|
323
|
+
bd('comments', 'add', o.ticket, raison);
|
|
324
|
+
dire(`⚠ ${raison}`);
|
|
595
325
|
}
|
|
326
|
+
const duree = Math.round((Date.now() - debut) / 100) / 10;
|
|
327
|
+
dire(`⏱ ${duree} s`);
|
|
328
|
+
return 0;
|
|
596
329
|
}
|
|
597
330
|
|
|
598
331
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|