@roomi-fields/grillhouse 0.52.0 → 0.54.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.
Files changed (155) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +96 -0
  3. package/agents/direct.md +1 -1
  4. package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
  5. package/cadre/templates/projet/vitest.config.cjs +45 -0
  6. package/charte/superviseur.md +36 -37
  7. package/charte.md +13 -1
  8. package/dist/temporal/circuit/appel.d.ts +2 -0
  9. package/dist/temporal/circuit/appel.js +24 -2
  10. package/dist/temporal/circuit/appel.js.map +1 -1
  11. package/dist/temporal/circuit/client.d.ts +14 -5
  12. package/dist/temporal/circuit/client.js +41 -9
  13. package/dist/temporal/circuit/client.js.map +1 -1
  14. package/dist/temporal/circuit/commande.js +17 -6
  15. package/dist/temporal/circuit/commande.js.map +1 -1
  16. package/dist/temporal/circuit/contrat.d.ts +9 -0
  17. package/dist/temporal/circuit/contrat.js +6 -0
  18. package/dist/temporal/circuit/contrat.js.map +1 -1
  19. package/dist/temporal/circuit/deroule.js +29 -12
  20. package/dist/temporal/circuit/deroule.js.map +1 -1
  21. package/dist/temporal/client.d.ts +35 -1
  22. package/dist/temporal/client.js +144 -1
  23. package/dist/temporal/client.js.map +1 -1
  24. package/dist/temporal/commande.js +31 -13
  25. package/dist/temporal/commande.js.map +1 -1
  26. package/dist/temporal/etat.d.ts +3 -1
  27. package/dist/temporal/etat.js +31 -17
  28. package/dist/temporal/etat.js.map +1 -1
  29. package/dist/temporal/file/activites.js +1 -1
  30. package/dist/temporal/file/activites.js.map +1 -1
  31. package/dist/temporal/file/contrat.d.ts +4 -5
  32. package/dist/temporal/file/contrat.js +2 -2
  33. package/dist/temporal/file/contrat.js.map +1 -1
  34. package/dist/temporal/file/deroule.js +7 -5
  35. package/dist/temporal/file/deroule.js.map +1 -1
  36. package/dist/temporal/installation.d.ts +116 -53
  37. package/dist/temporal/installation.js +898 -241
  38. package/dist/temporal/installation.js.map +1 -1
  39. package/dist/temporal/nuits/deroule.js +3 -1
  40. package/dist/temporal/nuits/deroule.js.map +1 -1
  41. package/dist/temporal/places/deroule.js +2 -1
  42. package/dist/temporal/places/deroule.js.map +1 -1
  43. package/dist/temporal/sonde/deroule.js +2 -1
  44. package/dist/temporal/sonde/deroule.js.map +1 -1
  45. package/dist/temporal/tickets/deroule.js +4 -3
  46. package/dist/temporal/tickets/deroule.js.map +1 -1
  47. package/dist/temporal/travailleur.d.ts +7 -1
  48. package/dist/temporal/travailleur.js +49 -25
  49. package/dist/temporal/travailleur.js.map +1 -1
  50. package/docs/INTERFACE.md +37 -12
  51. package/docs/architecture/circuit.md +21 -18
  52. package/docs/architecture/entree.md +10 -11
  53. package/docs/architecture/greffon.md +45 -27
  54. package/docs/architecture/installation.md +92 -59
  55. package/docs/architecture/machine.md +2 -2
  56. package/docs/architecture/tests.md +15 -6
  57. package/docs/lexique.md +2 -2
  58. package/hooks/hooks.json +10 -0
  59. package/hooks/register.tsx +59 -39
  60. package/package.json +3 -2
  61. package/scripts/activites.mjs +5 -4
  62. package/scripts/aiguillage.mjs +5 -2
  63. package/scripts/bd-garde.mjs +69 -0
  64. package/scripts/ci-de-main.mjs +259 -56
  65. package/scripts/circuit.mjs +274 -47
  66. package/scripts/circuits-du-serveur.mjs +3 -2
  67. package/scripts/circuits-tenus.d.mts +7 -0
  68. package/scripts/circuits-tenus.mjs +17 -0
  69. package/scripts/commandes-composees.mjs +1 -1
  70. package/scripts/copie-de-montee.mjs +354 -0
  71. package/scripts/copies-du-depot.d.mts +13 -0
  72. package/scripts/copies-du-depot.mjs +66 -0
  73. package/scripts/copies-finies.mjs +6 -40
  74. package/scripts/crochets.mjs +16 -2
  75. package/scripts/direct.mjs +2 -2
  76. package/scripts/droits.mjs +13 -6
  77. package/scripts/engendres.mjs +5 -3
  78. package/scripts/enveloppe/travail-de-la-copie.mjs +77 -0
  79. package/scripts/etapes.mjs +11 -3
  80. package/scripts/faits-du-circuit.mjs +12 -5
  81. package/scripts/file-des-tickets.d.mts +13 -2
  82. package/scripts/file-des-tickets.mjs +71 -21
  83. package/scripts/greffons.mjs +42 -27
  84. package/scripts/grillhouse-maj.mjs +105 -85
  85. package/scripts/init.mjs +1 -1
  86. package/scripts/integration/file.mjs +5 -2
  87. package/scripts/integration/integrer.mjs +14 -4
  88. package/scripts/jointure.d.ts +16 -0
  89. package/scripts/langages/c/commandes.mjs +18 -8
  90. package/scripts/langages/cargo/commandes.mjs +88 -35
  91. package/scripts/langages/cargo/index.mjs +6 -3
  92. package/scripts/langages/cargo/sccache.mjs +15 -12
  93. package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
  94. package/scripts/langages/python/commandes.mjs +19 -9
  95. package/scripts/langages/python/squelette.mjs +2 -2
  96. package/scripts/langages/typescript/code-mort.mjs +36 -3
  97. package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
  98. package/scripts/langages/typescript/index.mjs +2 -0
  99. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +370 -0
  100. package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
  101. package/scripts/langages/typescript/parcours.mjs +5 -1
  102. package/scripts/langages/typescript/squelette.mjs +20 -17
  103. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
  104. package/scripts/langages/typescript/turbo-des-paquets.mjs +24 -37
  105. package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
  106. package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
  107. package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
  108. package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
  109. package/scripts/langages.d.mts +6 -0
  110. package/scripts/langages.mjs +6 -0
  111. package/scripts/lire.mjs +236 -0
  112. package/scripts/mesure/pression.mjs +5 -3
  113. package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
  114. package/scripts/migrations/lire-un-ticket.mjs +46 -0
  115. package/scripts/migrations.mjs +4 -0
  116. package/scripts/montee.mjs +588 -0
  117. package/scripts/nuit.sh +21 -12
  118. package/scripts/outil.mjs +5 -3
  119. package/scripts/paquet-npm.mjs +22 -0
  120. package/scripts/paquet.mjs +5 -5
  121. package/scripts/pre-compact.mjs +25 -0
  122. package/scripts/registre.d.mts +7 -1
  123. package/scripts/registre.mjs +114 -102
  124. package/scripts/reponses-du-circuit.d.mts +17 -2
  125. package/scripts/reponses-du-circuit.mjs +78 -20
  126. package/scripts/resultats.mjs +55 -17
  127. package/scripts/retirer-les-copies-finies.mjs +4 -7
  128. package/scripts/seances.mjs +28 -3
  129. package/scripts/services-du-noyau.mjs +7 -2
  130. package/scripts/session-start.sh +18 -11
  131. package/scripts/sortie.mjs +4 -7
  132. package/scripts/sous-commandes.mjs +2 -0
  133. package/scripts/suiveur.mjs +12 -4
  134. package/scripts/superviseur.mjs +135 -84
  135. package/scripts/tableau.mjs +651 -224
  136. package/scripts/tarifs.mjs +67 -0
  137. package/scripts/ticket-du-circuit.mjs +25 -4
  138. package/scripts/transitions.d.mts +6 -14
  139. package/scripts/transitions.mjs +126 -49
  140. package/scripts/verdict-de-la-nuit.mjs +2 -2
  141. package/scripts/verrou-de-fichier.d.mts +11 -0
  142. package/skills/direct/SKILL.md +21 -11
  143. package/skills/explorateur/SKILL.md +16 -6
  144. package/skills/grill/SKILL.md +9 -7
  145. package/skills/grill/references/paquets.md +4 -4
  146. package/skills/mesure/SKILL.md +4 -3
  147. package/skills/pitmaster/SKILL.md +56 -35
  148. package/skills/pitmaster/references/consigne-agent.md +1 -1
  149. package/skills/pitmaster/references/erreurs.md +4 -2
  150. package/skills/pitmaster/references/tour.md +11 -4
  151. package/skills/relecteur/SKILL.md +8 -1
  152. package/skills/testwriter/SKILL.md +1 -1
  153. package/types/index.d.ts +3 -1
  154. package/cadre/templates/projet/vitest.config.ts +0 -44
  155. package/scripts/base-des-workflows.mjs +0 -58
@@ -78,7 +78,10 @@
78
78
  // from the ticket's type: bug fix, chore, docs, else feat) and runs
79
79
  // scripts/integration/integrer.mjs: 0 commits on agent/<ticket> and labels the ticket `en-file`,
80
80
  // 75 plays it once more (`rejeu`) then stops at « a-repasser », any other code is a refusal
81
- // (« integration »). The queue is the workflow `file:<racine>` (src/temporal/file/deroule.ts).
81
+ // (« integration »), but a lot that does not apply while main moved past the copy, which goes
82
+ // back to the pass that judges it (gesture `conflit-de-l-avance`). The queue is the workflow `file:<racine>` (src/temporal/file/deroule.ts).
83
+ // A branch it reopens on a conflict goes back the same way, its copy made again at the base of
84
+ // the lot, the lot as local work (`remettreEnTravail`).
82
85
  // - The tri of the discoveries (5.3, `trier`) never stops the circuit nor undoes the integration.
83
86
  // - The working files live beside the copy: `.claude/worktrees/<ticket>.travail` (instructions,
84
87
  // results, errors, patches), `.log`, `.fiches.jsonl` (`{ date, role, fiche }`), `.bilan.json`
@@ -88,7 +91,11 @@
88
91
  // verifie, mene, reprise, refus, aRegenerer, controlesRouges, rang, circuit, journal }`.
89
92
  // - The circuit (`long`, `court` or `direct`) is fixed at the first opening, `direct` on the label
90
93
  // of the ticket, with no plan; a resumption keeps that of the stopped state, and the sort turns
91
- // `long` and `court` (`circuitSuivant` of scripts/transitions.mjs).
94
+ // `long` and `court` (`circuitSuivant` of scripts/transitions.mjs). A plan of sort correction
95
+ // triviale, once passed, turns the ticket `direct`, its label `circuit` swapped for `direct`, and
96
+ // starts at the code (`finirLOuverture`); its sheet is refused on a ticket the agent direct has
97
+ // worked. The supervisor's answer `--planifier` turns a direct circuit back to the plan
98
+ // (`planifier`).
92
99
  // - The plan writes `## Noms publiés` (`noms_publies` of the explorateur's last sheet; an empty list
93
100
  // erases the section, a sheet without the field keeps it) and `## Sorte` (`sorteDuPlan`,
94
101
  // scripts/resultats.mjs; absent or unreadable, comportement) in the description; a mechanical
@@ -128,6 +135,7 @@ import {
128
135
  AUTEURS_DE_LOT,
129
136
  agentsDuLot,
130
137
  auteurDuCode,
138
+ DEMANDE_UN_PLAN,
131
139
  leRole,
132
140
  ARRETS,
133
141
  AUTO,
@@ -140,10 +148,13 @@ import {
140
148
  SUITE,
141
149
  } from './etapes.mjs';
142
150
  import {
151
+ CODE,
143
152
  CONTROLES,
144
153
  PREUVE,
154
+ RELECTURE,
145
155
  circuitDeLaSorte,
146
156
  circuitSuivant,
157
+ MEMOIRE,
147
158
  correctionsDuPlan,
148
159
  ouvertesDuPlan,
149
160
  pasDuPlan,
@@ -157,6 +168,7 @@ import {
157
168
  } from './transitions.mjs';
158
169
  import {
159
170
  arbreDeLaCopie,
171
+ changements,
160
172
  controles,
161
173
  empreinte,
162
174
  empreinteDeLEtape,
@@ -193,6 +205,8 @@ import {
193
205
  inscrire,
194
206
  lesCommentaires,
195
207
  lesFiches,
208
+ basculeVersLePlanEnCours,
209
+ fichesDepuisLaBascule,
196
210
  leTicket,
197
211
  lire,
198
212
  nomsDe,
@@ -216,6 +230,7 @@ import { releve } from './composants-affectes.mjs';
216
230
  import { ligneDEtape, transcriptionsDeLaCopie } from './registre.mjs';
217
231
  import {
218
232
  bloquantsDeLaFiche,
233
+ estLeCircuitCourt,
219
234
  cleDuConstat,
220
235
  estUneBascule,
221
236
  estUnPlan,
@@ -227,7 +242,12 @@ import {
227
242
 
228
243
  // The sheet of the plan that says a field, as scripts/resultats.mjs reads it.
229
244
  export { ficheDuPlan };
230
- import { preparer, rendreLIndex, rolesDuConflit } from './enveloppe/travail-de-la-copie.mjs';
245
+ import {
246
+ preparer,
247
+ remettreEnTravail,
248
+ rendreLIndex,
249
+ rolesDuConflit,
250
+ } from './enveloppe/travail-de-la-copie.mjs';
231
251
  import { refusArbitrage } from './integration/integrer.mjs';
232
252
  import { prendreUnRang } from './places-de-la-machine.mjs';
233
253
  import { langageDe, langageDeLaCopie } from './langages.mjs';
@@ -236,7 +256,7 @@ import { fichiersNommesAuTicket } from './fichiers-nommes.mjs';
236
256
  import { ouvrirBase } from './mesure/base-de-passe.mjs';
237
257
  import { GREFFON } from './cadre.mjs';
238
258
  import { retirerLesCopiesDuDepot } from './copies-finies.mjs';
239
- import { lesReponses, reponseMecanique } from './reponses-du-circuit.mjs';
259
+ import { lesReponses, reponseMecanique, reponsePlanifier } from './reponses-du-circuit.mjs';
240
260
 
241
261
  // The time a session's transcripts may stand still before the circuit stops it.
242
262
  export const IMMOBILE_MS = 20 * 60 * 1000;
@@ -891,22 +911,36 @@ const renvoiDuTestwriter = (ctx, fiche) =>
891
911
  // again, which keeps its mark `enContexte` (`auLancement`), a finding the sheet states coming
892
912
  // without it. Each one `{ titre, regle, role, corps, piece }`, its recipient the agent it names, one
893
913
  // of those who write the lot of its circuit (`agentsDuLot`), without the developpeur's answer to the
894
- // review before (`reponse`): his next sheet answers it again. Throws an Arret `relecture-arret` for a finding without a valid recipient or one
895
- // that puts a criterion in question.
896
- export function constatsOuverts(ctx, fiche, texte) {
897
- const arret = raison =>
898
- new Arret('relecture-arret', `${raison}\n\nLe verdict :\n\n${texte}`, { piece: raison });
914
+ // review before (`reponse`): his next sheet answers it again. A finding without a valid recipient or
915
+ // one that puts a criterion in question is faulty: kept without a recipient (`critere_en_cause`
916
+ // kept), no author of the lot receives it, and the supervisor's context settles it. With a faulty
917
+ // finding, throws an Arret `relecture-arret` that names each one with its reason, in its piece
918
+ // too, and carries the findings still open as `constats`.
919
+ export function constatsOuverts(ctx, fiche, texte, destinataire = null) {
920
+ const agents = agentsDuLot(ctx.circuit);
921
+ const raisons = [];
899
922
  const neufs = bloquantsDeLaFiche(fiche).map(c => {
923
+ const constat = role => ({
924
+ titre: c.titre,
925
+ regle: c.regle,
926
+ ...(role ? { role } : {}),
927
+ corps: c.corps,
928
+ piece: c.piece,
929
+ });
930
+ if (destinataire) {
931
+ return constat(destinataire);
932
+ }
900
933
  if (c.critere_en_cause) {
901
- throw arret(`Le constat « ${c.titre} » met en cause un critère du ticket.`);
934
+ raisons.push(`Le constat « ${c.titre} » met en cause un critère du ticket.`);
935
+ return { ...constat(null), critere_en_cause: c.critere_en_cause };
902
936
  }
903
- const agents = agentsDuLot(ctx.circuit);
904
937
  if (!agents.includes(c.role)) {
905
- throw arret(
938
+ raisons.push(
906
939
  `Le constat « ${c.titre} » n'a pas de destinataire valide : il nomme ${c.role ? `« ${c.role} »` : 'personne'}, quand le rôle est ${agents.join(' ou ')}.`
907
940
  );
941
+ return constat(null);
908
942
  }
909
- return { titre: c.titre, regle: c.regle, role: c.role, corps: c.corps, piece: c.piece };
943
+ return constat(c.role);
910
944
  });
911
945
  const leves = new Set(
912
946
  (fiche.suivi ?? []).filter(s => s.etat === 'levé').map(s => cleDuConstat(s.titre))
@@ -914,7 +948,13 @@ export function constatsOuverts(ctx, fiche, texte) {
914
948
  const restes = (ctx.constats ?? [])
915
949
  .filter(c => !leves.has(c.titre) && !neufs.some(n => n.titre === c.titre))
916
950
  .map(c => Object.fromEntries(Object.entries(c).filter(([k]) => k !== 'reponse')));
917
- return [...restes, ...neufs];
951
+ const constats = [...restes, ...neufs];
952
+ if (raisons.length) {
953
+ const piece = raisons.join('\n');
954
+ const arret = new Arret('relecture-arret', `${piece}\n\nLe verdict :\n\n${texte}`, { piece });
955
+ throw Object.assign(arret, { constats });
956
+ }
957
+ return constats;
918
958
  }
919
959
 
920
960
  // The sort of the ticket of <ctx>, read from its kept results (`sorteDesFiches` of
@@ -938,7 +978,9 @@ export const cheminMecanique = ctx =>
938
978
 
939
979
  // The RENDU verdicts since the ticket's last ACCEPTÉ: a lot the queue sent back starts a new count.
940
980
  export function rendusDepuisAccepte(ctx) {
941
- const verdicts = fichesDe(ctx, 'relecteur').map(f => f.verdict);
981
+ const verdicts = fichesDepuisLaBascule(ctx)
982
+ .filter(e => e.role === 'relecteur')
983
+ .map(e => e.fiche.verdict);
942
984
  return verdicts.length - (verdicts.lastIndexOf('ACCEPTÉ') + 1);
943
985
  }
944
986
 
@@ -1000,7 +1042,13 @@ export function publierLArret(ctx, erreur, etat) {
1000
1042
  const code = ARRETS[e.nom];
1001
1043
  const lieu = e.etape ?? etat.etape;
1002
1044
  const arrete = { ...etat, etape: lieu };
1003
- ecrireEtat(ctx, { ...arrete, code, raison: e.nom, rapport: e.rapport });
1045
+ ecrireEtat(ctx, {
1046
+ ...arrete,
1047
+ code,
1048
+ raison: e.nom,
1049
+ rapport: e.rapport,
1050
+ ...(e.demande ? { motif: e.demande } : {}),
1051
+ });
1004
1052
  // The stop kept with the circuit's results, which the bilan counts.
1005
1053
  inscrire(ctx, {
1006
1054
  role: AUTEUR_DU_CIRCUIT,
@@ -1010,7 +1058,11 @@ export function publierLArret(ctx, erreur, etat) {
1010
1058
  // The hour a usage limit lifts is no outcome of a pass: the bilan reads none of it.
1011
1059
  ...(e.resultat && e.nom !== 'limite-d-usage' ? { resultat: e.resultat } : {}),
1012
1060
  });
1013
- const ou = ouDansLeCircuit({ etape: lieu, finale: etat.finale && lieu === CONTROLES });
1061
+ const ou = ouDansLeCircuit({
1062
+ etape: lieu,
1063
+ finale: etat.finale && lieu === CONTROLES,
1064
+ questionnement: arrete.questionnement,
1065
+ });
1014
1066
  commenter(
1015
1067
  ctx,
1016
1068
  lieu,
@@ -1026,6 +1078,7 @@ export function publierLArret(ctx, erreur, etat) {
1026
1078
  piece: e.piece,
1027
1079
  question: e.question,
1028
1080
  qui: e.qui,
1081
+ demande: e.demande,
1029
1082
  etat: arrete,
1030
1083
  };
1031
1084
  }
@@ -1160,6 +1213,9 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1160
1213
  return relire(ctx, { constats: ctx.constats ?? [] });
1161
1214
  case 'rendus':
1162
1215
  return rendusDepuisAccepte(ctx);
1216
+ case 'constatsDeLaDemande':
1217
+ // The findings of a verdict that asks for a plan go to the agent direct, whoever they name.
1218
+ return constatsOuverts(ctx, faits.relecture.fiche, faits.relecture.texte, 'direct');
1163
1219
  case 'constats':
1164
1220
  try {
1165
1221
  return { constats: constatsOuverts(ctx, faits.relecture.fiche, faits.relecture.texte) };
@@ -1167,7 +1223,10 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1167
1223
  if (!(e instanceof Arret)) {
1168
1224
  throw e;
1169
1225
  }
1170
- return { arret: { nom: e.nom, rapport: e.rapport, piece: e.piece } };
1226
+ return {
1227
+ constats: e.constats,
1228
+ arret: { nom: e.nom, rapport: e.rapport, piece: e.piece },
1229
+ };
1171
1230
  }
1172
1231
  case 'integration': {
1173
1232
  const r = integrer(ctx);
@@ -1177,6 +1236,34 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1177
1236
  commande: r.commande,
1178
1237
  };
1179
1238
  }
1239
+ case 'mainAvancee': {
1240
+ // Whether the main tree's HEAD holds a commit the copy does not, which its advance brings.
1241
+ const tete = spawnSync('git', ['-C', ctx.racine, 'rev-parse', 'HEAD'], { encoding: 'utf8' });
1242
+ const r = spawnSync('git', [
1243
+ '-C',
1244
+ ctx.copie,
1245
+ 'merge-base',
1246
+ '--is-ancestor',
1247
+ tete.stdout.trim(),
1248
+ 'HEAD',
1249
+ ]);
1250
+ return r.status === 1;
1251
+ }
1252
+ case 'remiseEnTravail': {
1253
+ const branche = `agent/${ctx.ticket}`;
1254
+ const r = remettreEnTravail({ racine: ctx.racine, copie: ctx.copie, branche });
1255
+ if (!r.ok) {
1256
+ throw new Arret(
1257
+ 'lancement',
1258
+ `La copie ${ctx.copie} ne se recrée pas avec le lot de ${branche} en travail local ; la branche et son commit sont gardés.\n\n${r.message}`,
1259
+ {
1260
+ piece: `$ ${r.commande}\n${r.message}`,
1261
+ question: `Ce que git refuse ci-dessus se lève sans perdre le commit de ${branche}, puis \`npx grillhouse circuit ${ctx.ticket} --reprendre\`, qui renvoie la branche en file et recrée la copie.`,
1262
+ }
1263
+ );
1264
+ }
1265
+ return true;
1266
+ }
1180
1267
  case 'commit':
1181
1268
  return spawnSync('git', ['-C', ctx.racine, 'rev-parse', '--short', `agent/${ctx.ticket}`], {
1182
1269
  encoding: 'utf8',
@@ -1246,6 +1333,7 @@ export function monter(ctx, a) {
1246
1333
  raison: a.nom,
1247
1334
  rapport: a.rapport,
1248
1335
  question: { arret: a.nom, fait, piece, question, qui },
1336
+ ...(a.demande ? { motif: a.demande } : {}),
1249
1337
  });
1250
1338
  const ou = ouDansLeCircuit({ ...a.etat, raison: a.nom });
1251
1339
  commenter(ctx, 'question', `${a.nom} à ${ou} — ${fait} — au ${qui} : ${question}`);
@@ -1402,7 +1490,9 @@ const empreinteDuPlan = ({ titre, description }) => {
1402
1490
  // Whether the plan of fingerprint <empreinte> has passed: a plan whose questioning left no
1403
1491
  // question open, or the supervisor's resumption of its stop.
1404
1492
  const planPasse = (ctx, empreinte) =>
1405
- lesFiches(ctx).some(e => e.role === AUTEUR_DU_CIRCUIT && e.plan?.empreinte === empreinte);
1493
+ fichesDepuisLaBascule(ctx).some(
1494
+ e => e.role === AUTEUR_DU_CIRCUIT && e.plan?.empreinte === empreinte
1495
+ );
1406
1496
 
1407
1497
  // The heading of the section of the open questions in a plan's description.
1408
1498
  const QUESTIONS_OUVERTES = '## Questions ouvertes';
@@ -1595,6 +1685,75 @@ function basculer(ctx, e) {
1595
1685
  return { ...e, etape: r.suivant.etape, raison: null, question: null, rapport: null };
1596
1686
  }
1597
1687
 
1688
+ // The `--planifier` answer of <ctx> to the stop <e> of a direct circuit that asks for a plan
1689
+ // (`reponsePlanifier`, which refuses out of that stop or without a reason: a Usage): the label
1690
+ // `direct` becomes `circuit`, the request (its reason and its piece) is kept among the sheets,
1691
+ // which starts the judgment over (`fichesDepuisLaBascule`), and nothing the circuit kept of the old
1692
+ // lot stands. The copy stays as the agent direct left it. The run starts over at the plan.
1693
+ function planifier(ctx, e) {
1694
+ const r = reponsePlanifier({
1695
+ etat: e && { ...e, circuit: ctx.circuit },
1696
+ contexte: ctx.contexte,
1697
+ });
1698
+ if (r.refus) {
1699
+ throw new Usage(r.refus);
1700
+ }
1701
+ const f = lesFiches(ctx).findLast(
1702
+ x => ['direct', 'relecteur'].includes(x.role) && x.fiche?.motif === DEMANDE_UN_PLAN
1703
+ )?.fiche;
1704
+ const raison =
1705
+ f?.raison ??
1706
+ ((f ? bloquantsDeLaFiche(f) : []).map(c => `${c.titre} — ${c.corps}`).join('\n') ||
1707
+ e.question?.fait);
1708
+ inscrire(ctx, {
1709
+ role: AUTEUR_DU_CIRCUIT,
1710
+ planifier: { raison, piece: f?.piece ?? e.question?.piece },
1711
+ });
1712
+ emettre(ctx, {
1713
+ genre: 'etiquettes',
1714
+ ticket: ctx.ticket,
1715
+ etiquettes: ['circuit'],
1716
+ retirees: ['direct'],
1717
+ });
1718
+ commenter(ctx, 'plan', 'le superviseur bascule le circuit direct vers le plan (`--planifier`).');
1719
+ for (const cle of [...MEMOIRE, 'seanceReprise', 'sorte']) {
1720
+ ctx[cle] = null;
1721
+ }
1722
+ ctx.constats = [];
1723
+ ctx.verts = {};
1724
+ ctx.circuit = 'long';
1725
+ return e;
1726
+ }
1727
+
1728
+ // What the explorateur reads of the switch to the plan under way (<bascule>, `{ raison, piece }`):
1729
+ // the request, and what the agent direct left in the copy.
1730
+ function consigneDeLaBascule(ctx, bascule) {
1731
+ const fichiers = changements(ctx).map(c => c.fichier);
1732
+ return [
1733
+ '## La bascule du direct vers le plan',
1734
+ '',
1735
+ 'Le superviseur bascule ce ticket du circuit direct vers le plan ; sa raison est le CONTEXTE ci-dessus.',
1736
+ `Raison de la demande : ${bascule.raison}`,
1737
+ `Sa pièce : ${bascule.piece}`,
1738
+ `La copie du ticket, ${ctx.copie}, porte ce que l'agent direct y a écrit ; ses fichiers changés : ${fichiers.join(', ') || 'aucun'}.`,
1739
+ 'Écris en critères ce que le plan en garde et ce qu’il en retire : le testwriter et le développeur retirent ce qu’il ne garde pas.',
1740
+ ...(fichiers.length
1741
+ ? [
1742
+ 'La copie est modifiée : la sorte mécanique et « comportement inchangé » (le circuit court) sont refusées.',
1743
+ ]
1744
+ : []),
1745
+ ].join('\n');
1746
+ }
1747
+
1748
+ // Refuses a plan of the short circuit on a copy the agent direct changed, its switch under way.
1749
+ function fauteDeLaSorteCourte(ctx, fiche) {
1750
+ return basculeVersLePlanEnCours(ctx) &&
1751
+ estLeCircuitCourt(sorteDuPlan(fiche)) &&
1752
+ changements(ctx).length
1753
+ ? 'sorte : la copie porte des changements de l’agent direct, le plan ne fait pas un circuit court (ni mécanique ni « comportement inchangé »)'
1754
+ : null;
1755
+ }
1756
+
1598
1757
  // The packages the plan of <ctx> gained by an extension (`etendus`, kept among the circuit's
1599
1758
  // sheets), which the circuit keeps in the plan by itself (`avecLesEtendus`).
1600
1759
  const etendusDuPlan = ctx => [
@@ -1763,6 +1922,10 @@ const etatDuPlan = () => ({
1763
1922
  rapport: null,
1764
1923
  });
1765
1924
 
1925
+ // The state a stop of the plan is written at: the work on the plan named, which places it at
1926
+ // « 1 Plan » (`etapeDuCircuit`).
1927
+ const etatDuPlanArrete = () => ({ ...etatDuPlan(), questionnement: { objet: 'plan' } });
1928
+
1766
1929
  // The session of <role> on the plan of <ctx>, its work named in the state while it runs: its
1767
1930
  // sheet, and the session it ran (`seance`), which the answer resumes.
1768
1931
  async function sessionDuPlan(ctx, role, texte, options) {
@@ -1783,6 +1946,14 @@ async function sessionDuPlan(ctx, role, texte, options) {
1783
1946
  return { fiche, seance };
1784
1947
  }
1785
1948
 
1949
+ // What refuses the sheet of the plan <fiche> of sort correction triviale on a ticket the agent
1950
+ // direct has worked (a sheet of his kept): a plan written after a direct work switches no more
1951
+ // (circuit.md §5.6). null for any other sheet.
1952
+ const refusDeLaBascule = (ctx, fiche) =>
1953
+ sorteDuPlan(fiche).genre === 'correction triviale' && lesFiches(ctx).some(e => e.role === 'direct' && e.fiche)
1954
+ ? `sorte : « correction triviale » est refusée sur un ticket que l’agent direct a déjà travaillé ; dis une autre sorte`
1955
+ : null;
1956
+
1786
1957
  // The explorateur's options on the plan of <ctx> whose state is <e>: its description before the
1787
1958
  // plan (`avant`), the components its title named then (`composants`), and the plan a sheet
1788
1959
  // answers (`plan`, null before it), whose `ecartes` an answer that says none keeps
@@ -1790,6 +1961,8 @@ async function sessionDuPlan(ctx, role, texte, options) {
1790
1961
  const optionsDeLExplorateur = (ctx, e) => ({
1791
1962
  droits: horsDeLEnveloppe(ctx, EXPLORATEUR, 'sonnet'),
1792
1963
  valider: f =>
1964
+ refusDeLaBascule(ctx, f) ??
1965
+ fauteDeLaSorteCourte(ctx, f) ??
1793
1966
  fautesDesPaquets(
1794
1967
  ctx,
1795
1968
  f,
@@ -1817,13 +1990,14 @@ export async function unPasDuPlan(ctx, pas, e) {
1817
1990
  if (!(x instanceof Arret)) {
1818
1991
  throw x;
1819
1992
  }
1993
+ inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, etape: TESTS, arret: x.nom });
1820
1994
  return {
1821
1995
  code: monter(ctx, {
1822
1996
  code: ARRETS[x.nom],
1823
1997
  nom: x.nom,
1824
1998
  rapport: x.rapport,
1825
1999
  piece: x.piece,
1826
- etat: etatDuPlan(),
2000
+ etat: etatDuPlanArrete(),
1827
2001
  }),
1828
2002
  };
1829
2003
  }
@@ -1834,21 +2008,27 @@ const PAS_DU_PLAN = {
1834
2008
  // The explorateur writes the plan, which the circuit writes at the ticket.
1835
2009
  async explorateur(ctx, e) {
1836
2010
  const t = leTicket(ctx);
2011
+ const bascule = basculeVersLePlanEnCours(ctx);
1837
2012
  const { fiche: plan, seance } = await sessionDuPlan(
1838
2013
  ctx,
1839
2014
  EXPLORATEUR,
1840
- consigne(
1841
- {
1842
- depot: ctx.racine,
1843
- ticket: ctx.ticket,
1844
- sujet: ctx.sujet,
1845
- titre: t.titre,
1846
- description: t.description.trim() || 'aucune',
1847
- notes: t.notes.trim() || 'aucune',
1848
- contexte: ctx.contexte || 'aucun',
1849
- },
1850
- 5
1851
- ),
2015
+ [
2016
+ consigne(
2017
+ {
2018
+ depot: ctx.racine,
2019
+ ticket: ctx.ticket,
2020
+ sujet: ctx.sujet,
2021
+ titre: t.titre,
2022
+ description: t.description.trim() || 'aucune',
2023
+ notes: t.notes.trim() || 'aucune',
2024
+ contexte: ctx.contexte || 'aucun',
2025
+ },
2026
+ 5
2027
+ ),
2028
+ bascule && consigneDeLaBascule(ctx, bascule),
2029
+ ]
2030
+ .filter(Boolean)
2031
+ .join('\n\n'),
1852
2032
  { ...optionsDeLExplorateur(ctx, e), id: idDeSeance(ctx, 'plan'), evenement: 'plan' }
1853
2033
  );
1854
2034
  ecrireLePlan(
@@ -1995,15 +2175,17 @@ const PAS_DU_PLAN = {
1995
2175
  nom: 'questionnement',
1996
2176
  rapport: `Des questions du plan restent ouvertes après la réponse de l'explorateur.\n\n${liste}\n\nL'échange est au ticket (\`Circuit · … · questionnement\`).`,
1997
2177
  piece: liste,
1998
- etat: etatDuPlan(),
2178
+ etat: etatDuPlanArrete(),
1999
2179
  }),
2000
2180
  };
2001
2181
  },
2002
2182
  };
2003
2183
 
2004
2184
  // The circuit stopped on the supervisor's word (`--arreter`) at its state <e>, which the workflow
2005
- // holds, its session ended with the act the workflow cancelled: the state keeps its step, its stop
2006
- // « arrete », its question lifted, said at the ticket. Its exit code, 0.
2185
+ // holds, its session ended with the act the workflow cancelled: the state keeps its step, the work
2186
+ // on its plan (`questionnement`), the motive of the stop it receives (`motif`), its loops
2187
+ // (`boucles`) and its relaunch on the refusal (`relanceSurLeRefus`), its stop « arrete », its
2188
+ // question lifted, said at the ticket. Its exit code, 0.
2007
2189
  export async function arreter(ctx, e) {
2008
2190
  const lu = e;
2009
2191
  ctx.circuit = ctx.circuit ?? lu.circuit;
@@ -2023,6 +2205,10 @@ export async function arreter(ctx, e) {
2023
2205
  ? `Le superviseur arrête le circuit : ${ctx.contexte}`
2024
2206
  : (lu.rapport ?? null),
2025
2207
  finale: lu.finale === true,
2208
+ questionnement: lu.questionnement ?? null,
2209
+ boucles: lu.boucles ?? null,
2210
+ relanceSurLeRefus: lu.relanceSurLeRefus === true,
2211
+ ...(lu.motif ? { motif: lu.motif } : {}),
2026
2212
  });
2027
2213
  const pourquoi = ctx.contexte ? ` : ${ctx.contexte}` : '.';
2028
2214
  commenter(ctx, 'arret', `le superviseur arrête le circuit${pourquoi}`);
@@ -2030,19 +2216,26 @@ export async function arreter(ctx, e) {
2030
2216
  return 0;
2031
2217
  }
2032
2218
 
2033
- // The label `circuit` is the ticket's place in the queue of the tickets of its project
2034
- // (scripts/file-des-tickets.mjs `enFile`), which starts every open ticket that holds it and whose
2035
- // circuit does not run. A circuit stopped on the supervisor's word leaves that queue, its label
2219
+ // The labels `circuit` and `direct` are the ticket's place in the queue of the tickets of its
2220
+ // project (scripts/file-des-tickets.mjs `enFile`), which starts every open ticket that holds one and
2221
+ // whose circuit does not run. A circuit stopped on the supervisor's word leaves that queue, both
2036
2222
  // taken off, as a change whose approval is withdrawn leaves a merge queue (bors `r-`, Zuul's
2037
2223
  // dequeue): Beads keeps the ticket from starting again until his word reopens it.
2038
2224
  export const sortirDeLaFile = ctx =>
2039
- emettre(ctx, { genre: 'etiquettes', ticket: ctx.ticket, etiquettes: [], retirees: ['circuit'] });
2225
+ emettre(ctx, {
2226
+ genre: 'etiquettes',
2227
+ ticket: ctx.ticket,
2228
+ etiquettes: [],
2229
+ retirees: ['circuit', 'direct'],
2230
+ });
2040
2231
 
2041
2232
  // The run of <ctx> that opens on the supervisor's answer to that stop (the state <e> it resumes
2042
- // from, its stop « arrete ») is in the circuit again: its label put back.
2233
+ // from, its stop « arrete ») is in the queue again: the label of its path put back, `direct` for a
2234
+ // direct circuit, `circuit` for a long or a short one.
2043
2235
  export function rentrerDansLaFile(ctx, e) {
2044
2236
  if (e?.raison === 'arrete') {
2045
- emettre(ctx, { genre: 'etiquettes', ticket: ctx.ticket, etiquettes: ['circuit'] });
2237
+ const etiquette = e.circuit === 'direct' ? 'direct' : 'circuit';
2238
+ emettre(ctx, { genre: 'etiquettes', ticket: ctx.ticket, etiquettes: [etiquette] });
2046
2239
  }
2047
2240
  }
2048
2241
 
@@ -2166,9 +2359,16 @@ async function avantLePlan(ctx, e) {
2166
2359
  if (ctx.mecanique) {
2167
2360
  e = basculer(ctx, e);
2168
2361
  }
2362
+ if (ctx.planifier) {
2363
+ e = planifier(ctx, e);
2364
+ }
2169
2365
  // The findings open at the launch of a run with the supervisor's context (`--contexte`, or the
2170
2366
  // answer `--etendre` gives to the stop) are its sessions' context; without one, their task.
2171
- ctx.constats = auLancement(ctx.contexte, ctx.constats);
2367
+ // Resumed on the direct circuit after the reviewer asked for a plan, the findings of that
2368
+ // verdict stay the task of the agent direct.
2369
+ if (!(ctx.reprendre && e?.etape === RELECTURE && e.motif === DEMANDE_UN_PLAN)) {
2370
+ ctx.constats = auLancement(ctx.contexte, ctx.constats);
2371
+ }
2172
2372
  // The rank of the circuit's arrival among the machine's waits for a place: drawn at its
2173
2373
  // launch, kept by its state from one session to the next and across a resumption, so that a
2174
2374
  // circuit well advanced is not passed by a ticket that arrived after it.
@@ -2255,12 +2455,39 @@ export async function ouvrirJusquAuPlan(ctx, e) {
2255
2455
  }
2256
2456
 
2257
2457
  /**
2258
- * The end of the opening of <ctx> at the step <d>: the sort of the ticket, none for a direct
2259
- * circuit, and the circuit that follows it. `{ debut }`.
2458
+ * The end of the opening of <ctx> at the step <d>: the sort of the ticket and the circuit that
2459
+ * follows it. A correction triviale whose plan has passed switches to the direct circuit without a
2460
+ * stop (circuit.md §5.6): the label `circuit` becomes `direct`, and the run starts at the code,
2461
+ * with the agent direct. A direct circuit keeps that sort, none when it was born direct.
2462
+ * `{ debut }`.
2260
2463
  */
2261
2464
  export function finirLOuverture(ctx, d) {
2262
2465
  // The sort of the ticket its plan says, which the run reads at each step.
2263
- ctx.sorte = ctx.circuit === 'direct' ? null : sorteDuTicket(ctx);
2264
- ctx.circuit = circuitSuivant(ctx.circuit, ctx.sorte);
2265
- return { debut: d };
2466
+ const sorte = sorteDuTicket(ctx);
2467
+ const triviale = sorte.genre === 'correction triviale';
2468
+ if (ctx.circuit === 'direct') {
2469
+ ctx.sorte = triviale ? sorte : null;
2470
+ return { debut: d };
2471
+ }
2472
+ ctx.sorte = sorte;
2473
+ // A plan that has not passed switches nothing: its questions keep the circuit long.
2474
+ if (triviale && !planPasse(ctx, empreinteDuPlan(leTicket(ctx)))) {
2475
+ return { debut: d };
2476
+ }
2477
+ ctx.circuit = circuitSuivant(ctx.circuit, sorte);
2478
+ if (!triviale) {
2479
+ return { debut: d };
2480
+ }
2481
+ emettre(ctx, {
2482
+ genre: 'etiquettes',
2483
+ ticket: ctx.ticket,
2484
+ etiquettes: ['direct'],
2485
+ retirees: ['circuit'],
2486
+ });
2487
+ commenter(
2488
+ ctx,
2489
+ 'plan',
2490
+ `${texteDeLaSorte(sorte)} : le ticket passe au circuit direct, à 3 Code, avec l'agent direct.`
2491
+ );
2492
+ return { debut: { ...d, etape: CODE, tentative: 1, rapport: null, finale: false } };
2266
2493
  }
@@ -82,7 +82,8 @@ const sansReponse = e =>
82
82
  * DELAI_MS throws `ServeurMuet`, which its caller tells from a repository without circuits and
83
83
  * from any other fault, thrown as it is; a client not built throws `ClientNonConstruit`.
84
84
  * @param {string} racine
85
- * @param {{ integres?: boolean }} [options]
85
+ * @param {{ integres?: boolean, adresse?: string, espace?: string }} [options] `adresse` and
86
+ * `espace` the server read, the environment's by default
86
87
  */
87
88
  export async function circuitsDuServeur(racine, options = {}) {
88
89
  if (!existsSync(CONSTRUIT)) {
@@ -91,7 +92,7 @@ export async function circuitsDuServeur(racine, options = {}) {
91
92
  const { lienDuTableauWeb, ouvrirLeClient } = await import('../dist/temporal/client.js');
92
93
  const { lireLesCircuits } = await import('../dist/temporal/circuit/client.js');
93
94
  const { idDuCircuit } = await import('../dist/temporal/circuit/contrat.js');
94
- const c = ouvrirLeClient();
95
+ const c = ouvrirLeClient({ adresse: options.adresse, espace: options.espace });
95
96
  try {
96
97
  const lus = await c.client.connection.withDeadline(Date.now() + DELAI_MS, () =>
97
98
  lireLesCircuits(c.client, racine, options)
@@ -0,0 +1,7 @@
1
+ // The types of ./circuits-tenus.mjs.
2
+
3
+ /** The tickets of the circuits of <racine> the server holds; rejects when it does not answer. */
4
+ export function ticketsTenus(
5
+ racine: string,
6
+ ou?: { adresse?: string; espace?: string }
7
+ ): Promise<string[]>;
@@ -0,0 +1,17 @@
1
+ // The circuits the Temporal server holds, whose copy no one may take away: the removal of the
2
+ // finished copies (./retirer-les-copies-finies.mjs) and the purge of the versions of the tool
3
+ // (src/temporal/installation.ts) judge them by this one rule.
4
+ import { circuitsDuServeur } from './circuits-du-serveur.mjs';
5
+
6
+ /**
7
+ * The tickets of the circuits of the repository at <racine> the server <ou> holds: each that has
8
+ * not ended (it runs, or waits an answer or a place), and each ended without its issue, which
9
+ * waits the supervisor's answer. It throws as `circuitsDuServeur` does.
10
+ * @param {string} racine
11
+ * @param {{ adresse?: string, espace?: string }} [ou] the environment's server by default
12
+ * @returns {Promise<string[]>}
13
+ */
14
+ export const ticketsTenus = async (racine, ou = {}) =>
15
+ (await circuitsDuServeur(racine, ou))
16
+ .filter(c => c.fin === null || c.question)
17
+ .map(c => c.ticket);
@@ -42,6 +42,7 @@
42
42
  import { spawnSync } from 'node:child_process';
43
43
  import { constants } from 'node:os';
44
44
  import { fileURLToPath, pathToFileURL } from 'node:url';
45
+ import { A_REPASSER } from './codes-de-sortie.mjs';
45
46
  import { moduleDuFichier } from './composition-des-langages.mjs';
46
47
  import { garderLeVert } from './dernier-vert.mjs';
47
48
  import { etatDuDepot } from './etat-du-depot.mjs';
@@ -50,7 +51,6 @@ import { constructionDuGraphe, GRAPHE_JOUE, PASSE_ROUGE } from './taches-du-grap
50
51
 
51
52
  /** This script, the one every composed command runs. */
52
53
  export const SCRIPT = fileURLToPath(import.meta.url);
53
- const A_REPASSER = 75;
54
54
 
55
55
  /**
56
56
  * The verdict of the codes <codes> joined: 0 when every code is 0, 75 when the others are 75,