@roomi-fields/grillhouse 0.51.0 → 0.53.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 (149) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +1 -1
  4. package/cadre/templates/projet/vitest.config.cjs +45 -0
  5. package/charte/plan.md +47 -0
  6. package/charte/preuve.md +39 -0
  7. package/charte/superviseur.md +60 -0
  8. package/charte/tests.md +38 -0
  9. package/charte.md +23 -178
  10. package/dist/temporal/circuit/appel.d.ts +2 -0
  11. package/dist/temporal/circuit/appel.js +24 -2
  12. package/dist/temporal/circuit/appel.js.map +1 -1
  13. package/dist/temporal/circuit/client.d.ts +15 -7
  14. package/dist/temporal/circuit/client.js +42 -11
  15. package/dist/temporal/circuit/client.js.map +1 -1
  16. package/dist/temporal/circuit/commande.js +17 -6
  17. package/dist/temporal/circuit/commande.js.map +1 -1
  18. package/dist/temporal/circuit/contrat.d.ts +9 -0
  19. package/dist/temporal/circuit/contrat.js +6 -0
  20. package/dist/temporal/circuit/contrat.js.map +1 -1
  21. package/dist/temporal/circuit/deroule.js +25 -4
  22. package/dist/temporal/circuit/deroule.js.map +1 -1
  23. package/dist/temporal/client.d.ts +35 -1
  24. package/dist/temporal/client.js +144 -1
  25. package/dist/temporal/client.js.map +1 -1
  26. package/dist/temporal/commande.js +31 -13
  27. package/dist/temporal/commande.js.map +1 -1
  28. package/dist/temporal/etat.d.ts +3 -1
  29. package/dist/temporal/etat.js +31 -17
  30. package/dist/temporal/etat.js.map +1 -1
  31. package/dist/temporal/file/activites.js +1 -1
  32. package/dist/temporal/file/activites.js.map +1 -1
  33. package/dist/temporal/file/contrat.d.ts +4 -5
  34. package/dist/temporal/file/contrat.js +2 -2
  35. package/dist/temporal/file/contrat.js.map +1 -1
  36. package/dist/temporal/file/deroule.js +7 -5
  37. package/dist/temporal/file/deroule.js.map +1 -1
  38. package/dist/temporal/installation.d.ts +103 -53
  39. package/dist/temporal/installation.js +842 -237
  40. package/dist/temporal/installation.js.map +1 -1
  41. package/dist/temporal/nuits/deroule.js +3 -1
  42. package/dist/temporal/nuits/deroule.js.map +1 -1
  43. package/dist/temporal/places/deroule.js +2 -1
  44. package/dist/temporal/places/deroule.js.map +1 -1
  45. package/dist/temporal/sonde/deroule.js +2 -1
  46. package/dist/temporal/sonde/deroule.js.map +1 -1
  47. package/dist/temporal/tickets/deroule.js +4 -3
  48. package/dist/temporal/tickets/deroule.js.map +1 -1
  49. package/dist/temporal/travailleur.d.ts +7 -1
  50. package/dist/temporal/travailleur.js +49 -25
  51. package/dist/temporal/travailleur.js.map +1 -1
  52. package/docs/INTERFACE.md +20 -14
  53. package/docs/architecture/circuit.md +19 -16
  54. package/docs/architecture/entree.md +8 -9
  55. package/docs/architecture/greffon.md +54 -20
  56. package/docs/architecture/installation.md +99 -60
  57. package/docs/architecture/machine.md +31 -4
  58. package/docs/architecture/tests.md +22 -8
  59. package/docs/lexique.md +12 -3
  60. package/hooks/hooks.json +10 -10
  61. package/hooks/register.tsx +84 -2
  62. package/package.json +4 -2
  63. package/scripts/activites.mjs +25 -9
  64. package/scripts/aiguillage.mjs +1 -1
  65. package/scripts/attente-au-tour.mjs +2 -3
  66. package/scripts/bilan.mjs +116 -56
  67. package/scripts/bilans-gardes.mjs +37 -0
  68. package/scripts/circuit.mjs +256 -42
  69. package/scripts/circuits-du-serveur.mjs +3 -2
  70. package/scripts/circuits-tenus.d.mts +7 -0
  71. package/scripts/circuits-tenus.mjs +17 -0
  72. package/scripts/copie-de-montee.mjs +354 -0
  73. package/scripts/copies-du-depot.d.mts +13 -0
  74. package/scripts/copies-du-depot.mjs +66 -0
  75. package/scripts/copies-finies.mjs +6 -40
  76. package/scripts/crochets.mjs +16 -2
  77. package/scripts/direct.mjs +2 -2
  78. package/scripts/droits.mjs +117 -38
  79. package/scripts/engendres.mjs +5 -3
  80. package/scripts/entree-de-seance.mjs +35 -0
  81. package/scripts/enveloppe/enveloppe.mjs +23 -16
  82. package/scripts/enveloppe/lancer.sh +32 -22
  83. package/scripts/enveloppe/travail-de-la-copie.mjs +154 -0
  84. package/scripts/etapes.mjs +11 -3
  85. package/scripts/faits-du-circuit.mjs +12 -5
  86. package/scripts/file-des-tickets.d.mts +13 -2
  87. package/scripts/file-des-tickets.mjs +44 -12
  88. package/scripts/greffons.mjs +42 -27
  89. package/scripts/grillhouse-maj.mjs +105 -85
  90. package/scripts/init.mjs +1 -1
  91. package/scripts/integration/file.mjs +5 -2
  92. package/scripts/integration/integrer.mjs +14 -4
  93. package/scripts/jointure.d.ts +18 -1
  94. package/scripts/langages/c/commandes.mjs +17 -7
  95. package/scripts/langages/cargo/commandes.mjs +87 -34
  96. package/scripts/langages/cargo/index.mjs +6 -3
  97. package/scripts/langages/cargo/sccache.mjs +15 -12
  98. package/scripts/langages/python/commandes.mjs +68 -15
  99. package/scripts/langages/python/squelette.mjs +4 -3
  100. package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
  101. package/scripts/langages/typescript/index.mjs +14 -12
  102. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +299 -0
  103. package/scripts/langages/typescript/squelette.mjs +20 -17
  104. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
  105. package/scripts/langages/typescript/turbo-des-paquets.mjs +76 -39
  106. package/scripts/langages/typescript/verifier.mjs +27 -2
  107. package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
  108. package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
  109. package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
  110. package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
  111. package/scripts/mesure/pression.mjs +5 -3
  112. package/scripts/migrations/serveurs-de-l-index.mjs +1 -1
  113. package/scripts/migrations/suivi-du-superviseur-retire.mjs +56 -0
  114. package/scripts/migrations.mjs +2 -0
  115. package/scripts/montee.mjs +524 -0
  116. package/scripts/nuit.sh +3 -2
  117. package/scripts/outil.mjs +5 -3
  118. package/scripts/paquet-npm.mjs +22 -0
  119. package/scripts/paquet.mjs +5 -5
  120. package/scripts/pre-compact.mjs +25 -0
  121. package/scripts/reponses-du-circuit.d.mts +17 -2
  122. package/scripts/reponses-du-circuit.mjs +78 -20
  123. package/scripts/resultats.mjs +42 -14
  124. package/scripts/retirer-les-copies-finies.mjs +4 -7
  125. package/scripts/seances.mjs +81 -29
  126. package/scripts/services-du-noyau.mjs +7 -2
  127. package/scripts/session-start.sh +19 -10
  128. package/scripts/sortie-de-seance.mjs +70 -0
  129. package/scripts/sortie.mjs +4 -7
  130. package/scripts/sous-commandes.mjs +1 -1
  131. package/scripts/superviseur.mjs +417 -159
  132. package/scripts/tableau.mjs +249 -152
  133. package/scripts/ticket-du-circuit.mjs +22 -0
  134. package/scripts/transitions.d.mts +6 -9
  135. package/scripts/transitions.mjs +123 -36
  136. package/scripts/verrou-de-fichier.d.mts +11 -0
  137. package/skills/direct/SKILL.md +21 -11
  138. package/skills/explorateur/SKILL.md +8 -3
  139. package/skills/grill/SKILL.md +11 -8
  140. package/skills/grill/references/paquets.md +4 -4
  141. package/skills/pitmaster/SKILL.md +99 -53
  142. package/skills/pitmaster/references/cadre.md +1 -1
  143. package/skills/pitmaster/references/consigne-agent.md +1 -1
  144. package/skills/pitmaster/references/tour.md +6 -5
  145. package/skills/relecteur/SKILL.md +9 -2
  146. package/skills/testwriter/SKILL.md +3 -3
  147. package/cadre/templates/projet/pitmaster/SUIVI.md +0 -22
  148. package/cadre/templates/projet/vitest.config.ts +0 -44
  149. package/scripts/attente-a-l-arret.mjs +0 -114
@@ -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, 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,
@@ -1026,6 +1074,7 @@ export function publierLArret(ctx, erreur, etat) {
1026
1074
  piece: e.piece,
1027
1075
  question: e.question,
1028
1076
  qui: e.qui,
1077
+ demande: e.demande,
1029
1078
  etat: arrete,
1030
1079
  };
1031
1080
  }
@@ -1033,6 +1082,8 @@ export function publierLArret(ctx, erreur, etat) {
1033
1082
  // The fact <fait> of the circuit of <ctx>, with its <parametres>, the facts <faits> of the step
1034
1083
  // read before it: a session, a pass, a reading of the copy or of the ticket.
1035
1084
  export async function lireLeFait(ctx, fait, parametres, faits) {
1085
+ // Before any fact reads the copy: the index a killed pass left is put back.
1086
+ rendreLIndex(ctx.copie);
1036
1087
  switch (fait) {
1037
1088
  case 'mecanique':
1038
1089
  return cheminMecanique(ctx);
@@ -1158,6 +1209,9 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1158
1209
  return relire(ctx, { constats: ctx.constats ?? [] });
1159
1210
  case 'rendus':
1160
1211
  return rendusDepuisAccepte(ctx);
1212
+ case 'constatsDeLaDemande':
1213
+ // The findings of a verdict that asks for a plan go to the agent direct, whoever they name.
1214
+ return constatsOuverts(ctx, faits.relecture.fiche, faits.relecture.texte, 'direct');
1161
1215
  case 'constats':
1162
1216
  try {
1163
1217
  return { constats: constatsOuverts(ctx, faits.relecture.fiche, faits.relecture.texte) };
@@ -1165,7 +1219,10 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1165
1219
  if (!(e instanceof Arret)) {
1166
1220
  throw e;
1167
1221
  }
1168
- return { arret: { nom: e.nom, rapport: e.rapport, piece: e.piece } };
1222
+ return {
1223
+ constats: e.constats,
1224
+ arret: { nom: e.nom, rapport: e.rapport, piece: e.piece },
1225
+ };
1169
1226
  }
1170
1227
  case 'integration': {
1171
1228
  const r = integrer(ctx);
@@ -1175,6 +1232,34 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1175
1232
  commande: r.commande,
1176
1233
  };
1177
1234
  }
1235
+ case 'mainAvancee': {
1236
+ // Whether the main tree's HEAD holds a commit the copy does not, which its advance brings.
1237
+ const tete = spawnSync('git', ['-C', ctx.racine, 'rev-parse', 'HEAD'], { encoding: 'utf8' });
1238
+ const r = spawnSync('git', [
1239
+ '-C',
1240
+ ctx.copie,
1241
+ 'merge-base',
1242
+ '--is-ancestor',
1243
+ tete.stdout.trim(),
1244
+ 'HEAD',
1245
+ ]);
1246
+ return r.status === 1;
1247
+ }
1248
+ case 'remiseEnTravail': {
1249
+ const branche = `agent/${ctx.ticket}`;
1250
+ const r = remettreEnTravail({ racine: ctx.racine, copie: ctx.copie, branche });
1251
+ if (!r.ok) {
1252
+ throw new Arret(
1253
+ 'lancement',
1254
+ `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}`,
1255
+ {
1256
+ piece: `$ ${r.commande}\n${r.message}`,
1257
+ 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.`,
1258
+ }
1259
+ );
1260
+ }
1261
+ return true;
1262
+ }
1178
1263
  case 'commit':
1179
1264
  return spawnSync('git', ['-C', ctx.racine, 'rev-parse', '--short', `agent/${ctx.ticket}`], {
1180
1265
  encoding: 'utf8',
@@ -1244,6 +1329,7 @@ export function monter(ctx, a) {
1244
1329
  raison: a.nom,
1245
1330
  rapport: a.rapport,
1246
1331
  question: { arret: a.nom, fait, piece, question, qui },
1332
+ ...(a.demande ? { motif: a.demande } : {}),
1247
1333
  });
1248
1334
  const ou = ouDansLeCircuit({ ...a.etat, raison: a.nom });
1249
1335
  commenter(ctx, 'question', `${a.nom} à ${ou} — ${fait} — au ${qui} : ${question}`);
@@ -1400,7 +1486,9 @@ const empreinteDuPlan = ({ titre, description }) => {
1400
1486
  // Whether the plan of fingerprint <empreinte> has passed: a plan whose questioning left no
1401
1487
  // question open, or the supervisor's resumption of its stop.
1402
1488
  const planPasse = (ctx, empreinte) =>
1403
- lesFiches(ctx).some(e => e.role === AUTEUR_DU_CIRCUIT && e.plan?.empreinte === empreinte);
1489
+ fichesDepuisLaBascule(ctx).some(
1490
+ e => e.role === AUTEUR_DU_CIRCUIT && e.plan?.empreinte === empreinte
1491
+ );
1404
1492
 
1405
1493
  // The heading of the section of the open questions in a plan's description.
1406
1494
  const QUESTIONS_OUVERTES = '## Questions ouvertes';
@@ -1593,6 +1681,75 @@ function basculer(ctx, e) {
1593
1681
  return { ...e, etape: r.suivant.etape, raison: null, question: null, rapport: null };
1594
1682
  }
1595
1683
 
1684
+ // The `--planifier` answer of <ctx> to the stop <e> of a direct circuit that asks for a plan
1685
+ // (`reponsePlanifier`, which refuses out of that stop or without a reason: a Usage): the label
1686
+ // `direct` becomes `circuit`, the request (its reason and its piece) is kept among the sheets,
1687
+ // which starts the judgment over (`fichesDepuisLaBascule`), and nothing the circuit kept of the old
1688
+ // lot stands. The copy stays as the agent direct left it. The run starts over at the plan.
1689
+ function planifier(ctx, e) {
1690
+ const r = reponsePlanifier({
1691
+ etat: e && { ...e, circuit: ctx.circuit },
1692
+ contexte: ctx.contexte,
1693
+ });
1694
+ if (r.refus) {
1695
+ throw new Usage(r.refus);
1696
+ }
1697
+ const f = lesFiches(ctx).findLast(
1698
+ x => ['direct', 'relecteur'].includes(x.role) && x.fiche?.motif === DEMANDE_UN_PLAN
1699
+ )?.fiche;
1700
+ const raison =
1701
+ f?.raison ??
1702
+ ((f ? bloquantsDeLaFiche(f) : []).map(c => `${c.titre} — ${c.corps}`).join('\n') ||
1703
+ e.question?.fait);
1704
+ inscrire(ctx, {
1705
+ role: AUTEUR_DU_CIRCUIT,
1706
+ planifier: { raison, piece: f?.piece ?? e.question?.piece },
1707
+ });
1708
+ emettre(ctx, {
1709
+ genre: 'etiquettes',
1710
+ ticket: ctx.ticket,
1711
+ etiquettes: ['circuit'],
1712
+ retirees: ['direct'],
1713
+ });
1714
+ commenter(ctx, 'plan', 'le superviseur bascule le circuit direct vers le plan (`--planifier`).');
1715
+ for (const cle of [...MEMOIRE, 'seanceReprise', 'sorte']) {
1716
+ ctx[cle] = null;
1717
+ }
1718
+ ctx.constats = [];
1719
+ ctx.verts = {};
1720
+ ctx.circuit = 'long';
1721
+ return e;
1722
+ }
1723
+
1724
+ // What the explorateur reads of the switch to the plan under way (<bascule>, `{ raison, piece }`):
1725
+ // the request, and what the agent direct left in the copy.
1726
+ function consigneDeLaBascule(ctx, bascule) {
1727
+ const fichiers = changements(ctx).map(c => c.fichier);
1728
+ return [
1729
+ '## La bascule du direct vers le plan',
1730
+ '',
1731
+ 'Le superviseur bascule ce ticket du circuit direct vers le plan ; sa raison est le CONTEXTE ci-dessus.',
1732
+ `Raison de la demande : ${bascule.raison}`,
1733
+ `Sa pièce : ${bascule.piece}`,
1734
+ `La copie du ticket, ${ctx.copie}, porte ce que l'agent direct y a écrit ; ses fichiers changés : ${fichiers.join(', ') || 'aucun'}.`,
1735
+ 'É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.',
1736
+ ...(fichiers.length
1737
+ ? [
1738
+ 'La copie est modifiée : la sorte mécanique et « comportement inchangé » (le circuit court) sont refusées.',
1739
+ ]
1740
+ : []),
1741
+ ].join('\n');
1742
+ }
1743
+
1744
+ // Refuses a plan of the short circuit on a copy the agent direct changed, its switch under way.
1745
+ function fauteDeLaSorteCourte(ctx, fiche) {
1746
+ return basculeVersLePlanEnCours(ctx) &&
1747
+ estLeCircuitCourt(sorteDuPlan(fiche)) &&
1748
+ changements(ctx).length
1749
+ ? 'sorte : la copie porte des changements de l’agent direct, le plan ne fait pas un circuit court (ni mécanique ni « comportement inchangé »)'
1750
+ : null;
1751
+ }
1752
+
1596
1753
  // The packages the plan of <ctx> gained by an extension (`etendus`, kept among the circuit's
1597
1754
  // sheets), which the circuit keeps in the plan by itself (`avecLesEtendus`).
1598
1755
  const etendusDuPlan = ctx => [
@@ -1781,6 +1938,14 @@ async function sessionDuPlan(ctx, role, texte, options) {
1781
1938
  return { fiche, seance };
1782
1939
  }
1783
1940
 
1941
+ // What refuses the sheet of the plan <fiche> of sort correction triviale on a ticket the agent
1942
+ // direct has worked (a sheet of his kept): a plan written after a direct work switches no more
1943
+ // (circuit.md §5.6). null for any other sheet.
1944
+ const refusDeLaBascule = (ctx, fiche) =>
1945
+ sorteDuPlan(fiche).genre === 'correction triviale' && lesFiches(ctx).some(e => e.role === 'direct' && e.fiche)
1946
+ ? `sorte : « correction triviale » est refusée sur un ticket que l’agent direct a déjà travaillé ; dis une autre sorte`
1947
+ : null;
1948
+
1784
1949
  // The explorateur's options on the plan of <ctx> whose state is <e>: its description before the
1785
1950
  // plan (`avant`), the components its title named then (`composants`), and the plan a sheet
1786
1951
  // answers (`plan`, null before it), whose `ecartes` an answer that says none keeps
@@ -1788,6 +1953,8 @@ async function sessionDuPlan(ctx, role, texte, options) {
1788
1953
  const optionsDeLExplorateur = (ctx, e) => ({
1789
1954
  droits: horsDeLEnveloppe(ctx, EXPLORATEUR, 'sonnet'),
1790
1955
  valider: f =>
1956
+ refusDeLaBascule(ctx, f) ??
1957
+ fauteDeLaSorteCourte(ctx, f) ??
1791
1958
  fautesDesPaquets(
1792
1959
  ctx,
1793
1960
  f,
@@ -1832,21 +1999,27 @@ const PAS_DU_PLAN = {
1832
1999
  // The explorateur writes the plan, which the circuit writes at the ticket.
1833
2000
  async explorateur(ctx, e) {
1834
2001
  const t = leTicket(ctx);
2002
+ const bascule = basculeVersLePlanEnCours(ctx);
1835
2003
  const { fiche: plan, seance } = await sessionDuPlan(
1836
2004
  ctx,
1837
2005
  EXPLORATEUR,
1838
- consigne(
1839
- {
1840
- depot: ctx.racine,
1841
- ticket: ctx.ticket,
1842
- sujet: ctx.sujet,
1843
- titre: t.titre,
1844
- description: t.description.trim() || 'aucune',
1845
- notes: t.notes.trim() || 'aucune',
1846
- contexte: ctx.contexte || 'aucun',
1847
- },
1848
- 5
1849
- ),
2006
+ [
2007
+ consigne(
2008
+ {
2009
+ depot: ctx.racine,
2010
+ ticket: ctx.ticket,
2011
+ sujet: ctx.sujet,
2012
+ titre: t.titre,
2013
+ description: t.description.trim() || 'aucune',
2014
+ notes: t.notes.trim() || 'aucune',
2015
+ contexte: ctx.contexte || 'aucun',
2016
+ },
2017
+ 5
2018
+ ),
2019
+ bascule && consigneDeLaBascule(ctx, bascule),
2020
+ ]
2021
+ .filter(Boolean)
2022
+ .join('\n\n'),
1850
2023
  { ...optionsDeLExplorateur(ctx, e), id: idDeSeance(ctx, 'plan'), evenement: 'plan' }
1851
2024
  );
1852
2025
  ecrireLePlan(
@@ -2028,19 +2201,26 @@ export async function arreter(ctx, e) {
2028
2201
  return 0;
2029
2202
  }
2030
2203
 
2031
- // The label `circuit` is the ticket's place in the queue of the tickets of its project
2032
- // (scripts/file-des-tickets.mjs `enFile`), which starts every open ticket that holds it and whose
2033
- // circuit does not run. A circuit stopped on the supervisor's word leaves that queue, its label
2204
+ // The labels `circuit` and `direct` are the ticket's place in the queue of the tickets of its
2205
+ // project (scripts/file-des-tickets.mjs `enFile`), which starts every open ticket that holds one and
2206
+ // whose circuit does not run. A circuit stopped on the supervisor's word leaves that queue, both
2034
2207
  // taken off, as a change whose approval is withdrawn leaves a merge queue (bors `r-`, Zuul's
2035
2208
  // dequeue): Beads keeps the ticket from starting again until his word reopens it.
2036
2209
  export const sortirDeLaFile = ctx =>
2037
- emettre(ctx, { genre: 'etiquettes', ticket: ctx.ticket, etiquettes: [], retirees: ['circuit'] });
2210
+ emettre(ctx, {
2211
+ genre: 'etiquettes',
2212
+ ticket: ctx.ticket,
2213
+ etiquettes: [],
2214
+ retirees: ['circuit', 'direct'],
2215
+ });
2038
2216
 
2039
2217
  // The run of <ctx> that opens on the supervisor's answer to that stop (the state <e> it resumes
2040
- // from, its stop « arrete ») is in the circuit again: its label put back.
2218
+ // from, its stop « arrete ») is in the queue again: the label of its path put back, `direct` for a
2219
+ // direct circuit, `circuit` for a long or a short one.
2041
2220
  export function rentrerDansLaFile(ctx, e) {
2042
2221
  if (e?.raison === 'arrete') {
2043
- emettre(ctx, { genre: 'etiquettes', ticket: ctx.ticket, etiquettes: ['circuit'] });
2222
+ const etiquette = e.circuit === 'direct' ? 'direct' : 'circuit';
2223
+ emettre(ctx, { genre: 'etiquettes', ticket: ctx.ticket, etiquettes: [etiquette] });
2044
2224
  }
2045
2225
  }
2046
2226
 
@@ -2164,9 +2344,16 @@ async function avantLePlan(ctx, e) {
2164
2344
  if (ctx.mecanique) {
2165
2345
  e = basculer(ctx, e);
2166
2346
  }
2347
+ if (ctx.planifier) {
2348
+ e = planifier(ctx, e);
2349
+ }
2167
2350
  // The findings open at the launch of a run with the supervisor's context (`--contexte`, or the
2168
2351
  // answer `--etendre` gives to the stop) are its sessions' context; without one, their task.
2169
- ctx.constats = auLancement(ctx.contexte, ctx.constats);
2352
+ // Resumed on the direct circuit after the reviewer asked for a plan, the findings of that
2353
+ // verdict stay the task of the agent direct.
2354
+ if (!(ctx.reprendre && e?.etape === RELECTURE && e.motif === DEMANDE_UN_PLAN)) {
2355
+ ctx.constats = auLancement(ctx.contexte, ctx.constats);
2356
+ }
2170
2357
  // The rank of the circuit's arrival among the machine's waits for a place: drawn at its
2171
2358
  // launch, kept by its state from one session to the next and across a resumption, so that a
2172
2359
  // circuit well advanced is not passed by a ticket that arrived after it.
@@ -2253,12 +2440,39 @@ export async function ouvrirJusquAuPlan(ctx, e) {
2253
2440
  }
2254
2441
 
2255
2442
  /**
2256
- * The end of the opening of <ctx> at the step <d>: the sort of the ticket, none for a direct
2257
- * circuit, and the circuit that follows it. `{ debut }`.
2443
+ * The end of the opening of <ctx> at the step <d>: the sort of the ticket and the circuit that
2444
+ * follows it. A correction triviale whose plan has passed switches to the direct circuit without a
2445
+ * stop (circuit.md §5.6): the label `circuit` becomes `direct`, and the run starts at the code,
2446
+ * with the agent direct. A direct circuit keeps that sort, none when it was born direct.
2447
+ * `{ debut }`.
2258
2448
  */
2259
2449
  export function finirLOuverture(ctx, d) {
2260
2450
  // The sort of the ticket its plan says, which the run reads at each step.
2261
- ctx.sorte = ctx.circuit === 'direct' ? null : sorteDuTicket(ctx);
2262
- ctx.circuit = circuitSuivant(ctx.circuit, ctx.sorte);
2263
- return { debut: d };
2451
+ const sorte = sorteDuTicket(ctx);
2452
+ const triviale = sorte.genre === 'correction triviale';
2453
+ if (ctx.circuit === 'direct') {
2454
+ ctx.sorte = triviale ? sorte : null;
2455
+ return { debut: d };
2456
+ }
2457
+ ctx.sorte = sorte;
2458
+ // A plan that has not passed switches nothing: its questions keep the circuit long.
2459
+ if (triviale && !planPasse(ctx, empreinteDuPlan(leTicket(ctx)))) {
2460
+ return { debut: d };
2461
+ }
2462
+ ctx.circuit = circuitSuivant(ctx.circuit, sorte);
2463
+ if (!triviale) {
2464
+ return { debut: d };
2465
+ }
2466
+ emettre(ctx, {
2467
+ genre: 'etiquettes',
2468
+ ticket: ctx.ticket,
2469
+ etiquettes: ['direct'],
2470
+ retirees: ['circuit'],
2471
+ });
2472
+ commenter(
2473
+ ctx,
2474
+ 'plan',
2475
+ `${texteDeLaSorte(sorte)} : le ticket passe au circuit direct, à 3 Code, avec l'agent direct.`
2476
+ );
2477
+ return { debut: { ...d, etape: CODE, tentative: 1, rapport: null, finale: false } };
2264
2478
  }
@@ -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);