@roomi-fields/grillhouse 0.52.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 (130) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +48 -0
  3. package/agents/direct.md +1 -1
  4. package/cadre/templates/projet/vitest.config.cjs +45 -0
  5. package/charte/superviseur.md +36 -37
  6. package/charte.md +1 -1
  7. package/dist/temporal/circuit/appel.d.ts +2 -0
  8. package/dist/temporal/circuit/appel.js +24 -2
  9. package/dist/temporal/circuit/appel.js.map +1 -1
  10. package/dist/temporal/circuit/client.d.ts +14 -5
  11. package/dist/temporal/circuit/client.js +41 -9
  12. package/dist/temporal/circuit/client.js.map +1 -1
  13. package/dist/temporal/circuit/commande.js +17 -6
  14. package/dist/temporal/circuit/commande.js.map +1 -1
  15. package/dist/temporal/circuit/contrat.d.ts +9 -0
  16. package/dist/temporal/circuit/contrat.js +6 -0
  17. package/dist/temporal/circuit/contrat.js.map +1 -1
  18. package/dist/temporal/circuit/deroule.js +25 -4
  19. package/dist/temporal/circuit/deroule.js.map +1 -1
  20. package/dist/temporal/client.d.ts +35 -1
  21. package/dist/temporal/client.js +144 -1
  22. package/dist/temporal/client.js.map +1 -1
  23. package/dist/temporal/commande.js +31 -13
  24. package/dist/temporal/commande.js.map +1 -1
  25. package/dist/temporal/etat.d.ts +3 -1
  26. package/dist/temporal/etat.js +31 -17
  27. package/dist/temporal/etat.js.map +1 -1
  28. package/dist/temporal/file/activites.js +1 -1
  29. package/dist/temporal/file/activites.js.map +1 -1
  30. package/dist/temporal/file/contrat.d.ts +4 -5
  31. package/dist/temporal/file/contrat.js +2 -2
  32. package/dist/temporal/file/contrat.js.map +1 -1
  33. package/dist/temporal/file/deroule.js +7 -5
  34. package/dist/temporal/file/deroule.js.map +1 -1
  35. package/dist/temporal/installation.d.ts +103 -53
  36. package/dist/temporal/installation.js +842 -237
  37. package/dist/temporal/installation.js.map +1 -1
  38. package/dist/temporal/nuits/deroule.js +3 -1
  39. package/dist/temporal/nuits/deroule.js.map +1 -1
  40. package/dist/temporal/places/deroule.js +2 -1
  41. package/dist/temporal/places/deroule.js.map +1 -1
  42. package/dist/temporal/sonde/deroule.js +2 -1
  43. package/dist/temporal/sonde/deroule.js.map +1 -1
  44. package/dist/temporal/tickets/deroule.js +4 -3
  45. package/dist/temporal/tickets/deroule.js.map +1 -1
  46. package/dist/temporal/travailleur.d.ts +7 -1
  47. package/dist/temporal/travailleur.js +49 -25
  48. package/dist/temporal/travailleur.js.map +1 -1
  49. package/docs/INTERFACE.md +17 -12
  50. package/docs/architecture/circuit.md +18 -15
  51. package/docs/architecture/entree.md +7 -8
  52. package/docs/architecture/greffon.md +30 -21
  53. package/docs/architecture/installation.md +87 -58
  54. package/docs/architecture/machine.md +1 -1
  55. package/docs/architecture/tests.md +14 -5
  56. package/docs/lexique.md +2 -2
  57. package/hooks/hooks.json +10 -0
  58. package/hooks/register.tsx +19 -25
  59. package/package.json +3 -2
  60. package/scripts/activites.mjs +5 -4
  61. package/scripts/aiguillage.mjs +1 -0
  62. package/scripts/circuit.mjs +254 -42
  63. package/scripts/circuits-du-serveur.mjs +3 -2
  64. package/scripts/circuits-tenus.d.mts +7 -0
  65. package/scripts/circuits-tenus.mjs +17 -0
  66. package/scripts/copie-de-montee.mjs +354 -0
  67. package/scripts/copies-du-depot.d.mts +13 -0
  68. package/scripts/copies-du-depot.mjs +66 -0
  69. package/scripts/copies-finies.mjs +6 -40
  70. package/scripts/crochets.mjs +16 -2
  71. package/scripts/direct.mjs +2 -2
  72. package/scripts/droits.mjs +2 -2
  73. package/scripts/engendres.mjs +5 -3
  74. package/scripts/enveloppe/travail-de-la-copie.mjs +77 -0
  75. package/scripts/etapes.mjs +11 -3
  76. package/scripts/faits-du-circuit.mjs +12 -5
  77. package/scripts/file-des-tickets.d.mts +13 -2
  78. package/scripts/file-des-tickets.mjs +44 -12
  79. package/scripts/greffons.mjs +42 -27
  80. package/scripts/grillhouse-maj.mjs +105 -85
  81. package/scripts/init.mjs +1 -1
  82. package/scripts/integration/file.mjs +5 -2
  83. package/scripts/integration/integrer.mjs +14 -4
  84. package/scripts/jointure.d.ts +16 -0
  85. package/scripts/langages/c/commandes.mjs +17 -7
  86. package/scripts/langages/cargo/commandes.mjs +87 -34
  87. package/scripts/langages/cargo/index.mjs +6 -3
  88. package/scripts/langages/cargo/sccache.mjs +15 -12
  89. package/scripts/langages/python/commandes.mjs +18 -8
  90. package/scripts/langages/python/squelette.mjs +2 -2
  91. package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
  92. package/scripts/langages/typescript/index.mjs +2 -0
  93. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +299 -0
  94. package/scripts/langages/typescript/squelette.mjs +20 -17
  95. package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
  96. package/scripts/langages/typescript/turbo-des-paquets.mjs +24 -37
  97. package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
  98. package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
  99. package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
  100. package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
  101. package/scripts/mesure/pression.mjs +5 -3
  102. package/scripts/montee.mjs +524 -0
  103. package/scripts/outil.mjs +5 -3
  104. package/scripts/paquet-npm.mjs +22 -0
  105. package/scripts/paquet.mjs +5 -5
  106. package/scripts/pre-compact.mjs +25 -0
  107. package/scripts/reponses-du-circuit.d.mts +17 -2
  108. package/scripts/reponses-du-circuit.mjs +78 -20
  109. package/scripts/resultats.mjs +40 -12
  110. package/scripts/retirer-les-copies-finies.mjs +4 -7
  111. package/scripts/seances.mjs +28 -3
  112. package/scripts/services-du-noyau.mjs +7 -2
  113. package/scripts/session-start.sh +18 -11
  114. package/scripts/sortie.mjs +4 -7
  115. package/scripts/sous-commandes.mjs +1 -0
  116. package/scripts/superviseur.mjs +110 -70
  117. package/scripts/tableau.mjs +127 -108
  118. package/scripts/ticket-du-circuit.mjs +22 -0
  119. package/scripts/transitions.d.mts +6 -9
  120. package/scripts/transitions.mjs +123 -36
  121. package/scripts/verrou-de-fichier.d.mts +11 -0
  122. package/skills/direct/SKILL.md +21 -11
  123. package/skills/explorateur/SKILL.md +6 -1
  124. package/skills/grill/SKILL.md +9 -7
  125. package/skills/grill/references/paquets.md +4 -4
  126. package/skills/pitmaster/SKILL.md +45 -33
  127. package/skills/pitmaster/references/consigne-agent.md +1 -1
  128. package/skills/relecteur/SKILL.md +8 -1
  129. package/skills/testwriter/SKILL.md +1 -1
  130. package/cadre/templates/projet/vitest.config.ts +0 -44
@@ -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,
@@ -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
  }
@@ -1160,6 +1209,9 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1160
1209
  return relire(ctx, { constats: ctx.constats ?? [] });
1161
1210
  case 'rendus':
1162
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');
1163
1215
  case 'constats':
1164
1216
  try {
1165
1217
  return { constats: constatsOuverts(ctx, faits.relecture.fiche, faits.relecture.texte) };
@@ -1167,7 +1219,10 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1167
1219
  if (!(e instanceof Arret)) {
1168
1220
  throw e;
1169
1221
  }
1170
- 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
+ };
1171
1226
  }
1172
1227
  case 'integration': {
1173
1228
  const r = integrer(ctx);
@@ -1177,6 +1232,34 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1177
1232
  commande: r.commande,
1178
1233
  };
1179
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
+ }
1180
1263
  case 'commit':
1181
1264
  return spawnSync('git', ['-C', ctx.racine, 'rev-parse', '--short', `agent/${ctx.ticket}`], {
1182
1265
  encoding: 'utf8',
@@ -1246,6 +1329,7 @@ export function monter(ctx, a) {
1246
1329
  raison: a.nom,
1247
1330
  rapport: a.rapport,
1248
1331
  question: { arret: a.nom, fait, piece, question, qui },
1332
+ ...(a.demande ? { motif: a.demande } : {}),
1249
1333
  });
1250
1334
  const ou = ouDansLeCircuit({ ...a.etat, raison: a.nom });
1251
1335
  commenter(ctx, 'question', `${a.nom} à ${ou} — ${fait} — au ${qui} : ${question}`);
@@ -1402,7 +1486,9 @@ const empreinteDuPlan = ({ titre, description }) => {
1402
1486
  // Whether the plan of fingerprint <empreinte> has passed: a plan whose questioning left no
1403
1487
  // question open, or the supervisor's resumption of its stop.
1404
1488
  const planPasse = (ctx, empreinte) =>
1405
- 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
+ );
1406
1492
 
1407
1493
  // The heading of the section of the open questions in a plan's description.
1408
1494
  const QUESTIONS_OUVERTES = '## Questions ouvertes';
@@ -1595,6 +1681,75 @@ function basculer(ctx, e) {
1595
1681
  return { ...e, etape: r.suivant.etape, raison: null, question: null, rapport: null };
1596
1682
  }
1597
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
+
1598
1753
  // The packages the plan of <ctx> gained by an extension (`etendus`, kept among the circuit's
1599
1754
  // sheets), which the circuit keeps in the plan by itself (`avecLesEtendus`).
1600
1755
  const etendusDuPlan = ctx => [
@@ -1783,6 +1938,14 @@ async function sessionDuPlan(ctx, role, texte, options) {
1783
1938
  return { fiche, seance };
1784
1939
  }
1785
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
+
1786
1949
  // The explorateur's options on the plan of <ctx> whose state is <e>: its description before the
1787
1950
  // plan (`avant`), the components its title named then (`composants`), and the plan a sheet
1788
1951
  // answers (`plan`, null before it), whose `ecartes` an answer that says none keeps
@@ -1790,6 +1953,8 @@ async function sessionDuPlan(ctx, role, texte, options) {
1790
1953
  const optionsDeLExplorateur = (ctx, e) => ({
1791
1954
  droits: horsDeLEnveloppe(ctx, EXPLORATEUR, 'sonnet'),
1792
1955
  valider: f =>
1956
+ refusDeLaBascule(ctx, f) ??
1957
+ fauteDeLaSorteCourte(ctx, f) ??
1793
1958
  fautesDesPaquets(
1794
1959
  ctx,
1795
1960
  f,
@@ -1834,21 +1999,27 @@ const PAS_DU_PLAN = {
1834
1999
  // The explorateur writes the plan, which the circuit writes at the ticket.
1835
2000
  async explorateur(ctx, e) {
1836
2001
  const t = leTicket(ctx);
2002
+ const bascule = basculeVersLePlanEnCours(ctx);
1837
2003
  const { fiche: plan, seance } = await sessionDuPlan(
1838
2004
  ctx,
1839
2005
  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
- ),
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'),
1852
2023
  { ...optionsDeLExplorateur(ctx, e), id: idDeSeance(ctx, 'plan'), evenement: 'plan' }
1853
2024
  );
1854
2025
  ecrireLePlan(
@@ -2030,19 +2201,26 @@ export async function arreter(ctx, e) {
2030
2201
  return 0;
2031
2202
  }
2032
2203
 
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
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
2036
2207
  // taken off, as a change whose approval is withdrawn leaves a merge queue (bors `r-`, Zuul's
2037
2208
  // dequeue): Beads keeps the ticket from starting again until his word reopens it.
2038
2209
  export const sortirDeLaFile = ctx =>
2039
- 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
+ });
2040
2216
 
2041
2217
  // 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.
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.
2043
2220
  export function rentrerDansLaFile(ctx, e) {
2044
2221
  if (e?.raison === 'arrete') {
2045
- 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] });
2046
2224
  }
2047
2225
  }
2048
2226
 
@@ -2166,9 +2344,16 @@ async function avantLePlan(ctx, e) {
2166
2344
  if (ctx.mecanique) {
2167
2345
  e = basculer(ctx, e);
2168
2346
  }
2347
+ if (ctx.planifier) {
2348
+ e = planifier(ctx, e);
2349
+ }
2169
2350
  // The findings open at the launch of a run with the supervisor's context (`--contexte`, or the
2170
2351
  // answer `--etendre` gives to the stop) are its sessions' context; without one, their task.
2171
- 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
+ }
2172
2357
  // The rank of the circuit's arrival among the machine's waits for a place: drawn at its
2173
2358
  // launch, kept by its state from one session to the next and across a resumption, so that a
2174
2359
  // circuit well advanced is not passed by a ticket that arrived after it.
@@ -2255,12 +2440,39 @@ export async function ouvrirJusquAuPlan(ctx, e) {
2255
2440
  }
2256
2441
 
2257
2442
  /**
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 }`.
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 }`.
2260
2448
  */
2261
2449
  export function finirLOuverture(ctx, d) {
2262
2450
  // 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 };
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 } };
2266
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);