@roomi-fields/grillhouse 0.53.0 → 0.54.1

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 (62) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +54 -0
  3. package/cadre/templates/projet/docs/agents/issue-tracker.md +2 -2
  4. package/charte.md +12 -0
  5. package/dist/temporal/circuit/deroule.js +5 -9
  6. package/dist/temporal/circuit/deroule.js.map +1 -1
  7. package/dist/temporal/installation.d.ts +15 -2
  8. package/dist/temporal/installation.js +69 -17
  9. package/dist/temporal/installation.js.map +1 -1
  10. package/docs/INTERFACE.md +21 -1
  11. package/docs/architecture/circuit.md +3 -3
  12. package/docs/architecture/entree.md +4 -4
  13. package/docs/architecture/greffon.md +28 -17
  14. package/docs/architecture/installation.md +21 -11
  15. package/docs/architecture/machine.md +1 -1
  16. package/docs/architecture/tests.md +1 -1
  17. package/hooks/register.tsx +50 -24
  18. package/package.json +1 -1
  19. package/scripts/aiguillage.mjs +4 -2
  20. package/scripts/bd-garde.mjs +69 -0
  21. package/scripts/ci-de-main.mjs +259 -56
  22. package/scripts/circuit.mjs +20 -5
  23. package/scripts/commandes-composees.mjs +1 -1
  24. package/scripts/droits.mjs +11 -4
  25. package/scripts/file-des-tickets.mjs +27 -9
  26. package/scripts/greffons.mjs +282 -17
  27. package/scripts/langages/c/commandes.mjs +1 -1
  28. package/scripts/langages/cargo/commandes.mjs +1 -1
  29. package/scripts/langages/cargo/tailles-des-tests.mjs +115 -6
  30. package/scripts/langages/python/commandes.mjs +1 -1
  31. package/scripts/langages/typescript/code-mort.mjs +36 -3
  32. package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +95 -24
  33. package/scripts/langages/typescript/mise-a-jour.mjs +49 -12
  34. package/scripts/langages/typescript/parcours.mjs +5 -1
  35. package/scripts/langages.d.mts +6 -0
  36. package/scripts/langages.mjs +6 -0
  37. package/scripts/lire.mjs +236 -0
  38. package/scripts/migrations/cout-des-jetons-au-registre.mjs +136 -0
  39. package/scripts/migrations/lire-un-ticket.mjs +46 -0
  40. package/scripts/migrations.mjs +4 -0
  41. package/scripts/montee.mjs +123 -47
  42. package/scripts/nuit.sh +21 -12
  43. package/scripts/registre.d.mts +7 -1
  44. package/scripts/registre.mjs +114 -102
  45. package/scripts/resultats.mjs +15 -5
  46. package/scripts/retirer-copie.sh +7 -0
  47. package/scripts/sous-commandes.mjs +1 -0
  48. package/scripts/suiveur.mjs +12 -4
  49. package/scripts/superviseur.mjs +111 -31
  50. package/scripts/tableau.mjs +527 -119
  51. package/scripts/tarifs.mjs +67 -0
  52. package/scripts/ticket-du-circuit.mjs +3 -4
  53. package/scripts/transitions.d.mts +0 -5
  54. package/scripts/transitions.mjs +3 -13
  55. package/scripts/verdict-de-la-nuit.mjs +2 -2
  56. package/skills/explorateur/SKILL.md +10 -5
  57. package/skills/mesure/SKILL.md +4 -3
  58. package/skills/pitmaster/SKILL.md +18 -4
  59. package/skills/pitmaster/references/erreurs.md +4 -2
  60. package/skills/pitmaster/references/tour.md +11 -4
  61. package/types/index.d.ts +3 -1
  62. package/scripts/base-des-workflows.mjs +0 -58
@@ -36,20 +36,24 @@
36
36
  // Exit 0, whatever it finds.
37
37
  //
38
38
  // npx grillhouse superviseur --jalon <fichier>
39
+ // npx grillhouse superviseur --note <fichier>
39
40
  // npx grillhouse superviseur --question <fichier>
40
41
  //
41
42
  // - Played by the session that holds the lock, from the root of the repository. The note of
42
43
  // resumption, one per repository, is `<git common dir>/grillhouse-reprise.md`. `--jalon` replaces
43
44
  // it whole by the text of <fichier> and declares a milestone, which replaces the one before
44
- // (`<git common dir>/grillhouse-jalon.json`); `--question` adds the text at its end, creating it,
45
- // and declares nothing. Exit 2 and the reason on the error stream, nothing written, on a file
45
+ // (`<git common dir>/grillhouse-jalon.json`); in the 30 minutes that follow a renewal at a
46
+ // milestone, it declares none and says on its output from which hour one holds. `--note` replaces
47
+ // the note whole and `--question` adds the text at its end, creating it; both declare nothing.
48
+ // Exit 2 and the reason on the error stream, nothing written, on a file
46
49
  // that is absent or empty, a session that does not hold the lock, a session of a role or a copy.
47
50
  //
48
- // npx grillhouse superviseur --renouveler <dossier> <arretA> <messageA>
51
+ // npx grillhouse superviseur --renouveler <dossier> <arretA> <messageA> [sans-reponse]
49
52
  //
50
53
  // - Played by the greffon at each period: writes the line `{"reprise": <message>}` when the session
51
54
  // is to be compacted (`renouvellement`: the message of resumption at a milestone that is due,
52
- // empty after 55 minutes of idleness), nothing otherwise.
55
+ // empty after 55 minutes of idleness), nothing otherwise. `sans-reponse` says that <arretA> is
56
+ // the end of a turn with no answer, which serves idleness alone.
53
57
  //
54
58
  // npx grillhouse pre-compact
55
59
  //
@@ -77,9 +81,10 @@
77
81
  // and the opening lists it; one answered leaves the file
78
82
  // `.claude/worktrees/questions-remontees.json`. A stop is kept there by its ticket, the run of
79
83
  // its workflow, the rank of its question in that run and its stop, with the times of the first
80
- // going up and of the last presentation. The alert of the CI of main (a red, or a CI not read,
81
- // scripts/ci-de-main.mjs) is given once per passage (`.claude/worktrees/ci-de-main-rendue.json`),
82
- // cleared at the next green. A circuit integrated gives nothing: it is read on the board.
84
+ // going up and of the last presentation. The alert of the CI of main (a red, a CI not read, or
85
+ // main no longer judged, scripts/ci-de-main.mjs) is given once per passage
86
+ // (`.claude/worktrees/ci-de-main-rendue.json`), cleared when the reading tells nothing. A circuit
87
+ // integrated gives nothing: it is read on the board.
83
88
  // - The reading covers the project and each other project of its group (`grillhouse.groupe`) that
84
89
  // no other live session of supervision holds, each under its name and its folder.
85
90
  import { spawnSync } from 'node:child_process';
@@ -120,9 +125,11 @@ import {
120
125
 
121
126
  const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
122
127
  // In the common directory of git: the note of resumption of the supervisor, its declared milestone,
123
- // and the start of the last night whose request was given.
128
+ // what is held of its last renewal at a milestone, and the start of the last night whose request was
129
+ // given.
124
130
  const NOTE_DE_REPRISE = 'grillhouse-reprise.md';
125
131
  const JALON = 'grillhouse-jalon.json';
132
+ const RENOUVELLEMENT = 'grillhouse-renouvellement.json';
126
133
  const DEMANDE_DE_NUIT = 'grillhouse-demande-de-nuit.json';
127
134
  // The message the greffon submits once the compaction of a milestone is installed; the note, the
128
135
  // questions and the circuits come with the opening.
@@ -130,6 +137,9 @@ const MESSAGE_DE_REPRISE =
130
137
  "Reprends la supervision : ta séance vient d'être compactée au jalon que tu as déclaré. L'ouverture te donne la note de reprise, les questions et les circuits : suis-la.";
131
138
  // How long a session without a turn stays before it is compacted: its prompt cache lasts one hour.
132
139
  const INACTIVITE_MS = 55 * 60_000;
140
+ // One renewal at a milestone per period, as the intensity and the period of an OTP supervisor
141
+ // (`StartLimitBurst` and `StartLimitIntervalSec` of systemd), the intensity being 1.
142
+ const PERIODE_DU_RENOUVELLEMENT_MS = 30 * 60_000;
133
143
  // The output of a hook of Claude Code stays under this many characters.
134
144
  const PLAFOND_DU_CROCHET = 10_000;
135
145
  const COQUILLES = new Set(['sh', 'bash', 'dash', 'zsh']);
@@ -244,7 +254,8 @@ const ou = c => {
244
254
  const etatsDe = racine => path.join(racine, '.claude', 'worktrees');
245
255
 
246
256
  // The alert of the CI of main of the project at <racine> (scripts/ci-de-main.mjs), read for the
247
- // supervisor: `{ cle, texte }` for a red or a CI not read, null for a green (the alert clears),
257
+ // supervisor: `{ cle, texte }` for a red, a CI not read or main no longer judged, null when there is
258
+ // nothing to tell (the alert clears),
248
259
  // undefined for a project with no CI to read. The lots entered since the last green are named by
249
260
  // git; nothing is kept but the reading, for five minutes.
250
261
  export function ciDeMainDe(racine, o = {}) {
@@ -253,7 +264,8 @@ export function ciDeMainDe(racine, o = {}) {
253
264
  }
254
265
 
255
266
  // The alert of the CI of main given by the waits of the repository at <racine>, its key: kept while
256
- // it stands, so that one is given once, cleared at the next green and given again if it comes back.
267
+ // it stands, so that one is given once, cleared when the reading tells nothing and given again if it
268
+ // comes back.
257
269
  const ciDeMainRendue = racine => path.join(etatsDe(racine), 'ci-de-main-rendue.json');
258
270
  function lireLaCiDeMainRendue(racine) {
259
271
  try {
@@ -275,8 +287,8 @@ function ecrireLaCiDeMainRendue(racine, cle) {
275
287
  }
276
288
  }
277
289
 
278
- // The alert of the CI of main <alerte> (`{ cle, texte }`, null at a green) as a question, when it is
279
- // not the one already given; the file keeps the key that stands.
290
+ // The alert of the CI of main <alerte> (`{ cle, texte }`, null when the reading tells nothing) as a
291
+ // question, when it is not the one already given; the file keeps the key that stands.
280
292
  function releverLaCiDeMain(racine, alerte, toutes) {
281
293
  const avant = lireLaCiDeMainRendue(racine);
282
294
  const cle = alerte?.cle ?? null;
@@ -387,8 +399,8 @@ export function marquerChezLeResponsable(racine, { cle, depuisA }) {
387
399
  * given is presented now, and one that goes up has its `depuis` set now. The file is written whole
388
400
  * with the stops that still stand, their circuit waiting for the supervisor: a question answered
389
401
  * so leaves it, and the next stop of its circuit is new. The alert of the CI of main <ciDeMain>
390
- * (`{ cle, texte }`; null at a green, which clears it; undefined when it is not read, which keeps
391
- * what was given) is given once per passage. A circuit integrated gives nothing. The result is the
402
+ * (`{ cle, texte }`; null when the reading tells nothing, which clears it; undefined when it is not
403
+ * read, which keeps what was given) is given once per passage. A circuit integrated gives nothing. The result is the
392
404
  * questions given, each marked `representee` when it comes back, then the alert of the CI of main.
393
405
  * @param {string} racine
394
406
  * @param {import('./circuits-du-serveur.mjs').CircuitDuServeur[]} circuits
@@ -780,18 +792,49 @@ function surLaNote(dossier, fichier, env, ecrire) {
780
792
  /**
781
793
  * The session that holds the lock of the supervisor of <dossier> declares a milestone: the text of
782
794
  * <fichier> replaces its note of resumption whole, and the milestone, which holds for the context
783
- * that declares it, replaces the one before (`superviseur --jalon`).
795
+ * that declares it, replaces the one before (`superviseur --jalon`). In the period that follows a
796
+ * renewal at a milestone of this session, the note is replaced and no milestone is declared.
784
797
  * @param {string} dossier
785
798
  * @param {string} fichier
786
799
  * @param {{ env?: Record<string, string | undefined> }} [options]
787
- * @returns {Promise<{ code: number, raison: string }>} code 2 and its reason, nothing written, on a
788
- * refusal
800
+ * @returns {Promise<{ code: number, raison: string, avis?: string }>} code 2 and its reason,
801
+ * nothing written, on a refusal; `avis` says that no milestone is declared, and from which hour one
802
+ * holds
789
803
  */
790
804
  export async function declarerLeJalon(dossier, fichier, { env = process.env } = {}) {
791
- return surLaNote(dossier, fichier, env, ({ commun, tenant }, texte) => {
805
+ let avis;
806
+ const rendu = surLaNote(dossier, fichier, env, ({ commun, tenant }, texte) => {
792
807
  ecrireEntier(path.join(commun, NOTE_DE_REPRISE), texte);
808
+ const tenu = lireJson(path.join(commun, RENOUVELLEMENT));
809
+ const fin = tenu?.tenant === tenant ? tenu.depuisA + PERIODE_DU_RENOUVELLEMENT_MS : NaN;
810
+ if (Date.now() < fin) {
811
+ avis = `La note est remplacée, aucun jalon n'est déclaré : ta séance a été renouvelée à un jalon il y a moins de 30 minutes. Une déclaration vaut à partir de ${heureDe(fin)}.`;
812
+ return;
813
+ }
793
814
  ecrireEntier(path.join(commun, JALON), `${JSON.stringify({ declareA: Date.now(), tenant })}\n`);
794
815
  });
816
+ return avis ? { ...rendu, avis } : rendu;
817
+ }
818
+
819
+ // The local hour and minutes of the first whole minute at or after `ms`.
820
+ function heureDe(ms) {
821
+ const d = new Date(Math.ceil(ms / 60_000) * 60_000);
822
+ return `${d.getHours()}:${String(d.getMinutes()).padStart(2, '0')}`;
823
+ }
824
+
825
+ /**
826
+ * The text of <fichier> replaces whole the note of resumption of the session that holds the lock; no
827
+ * milestone is declared, and one not yet played stays as it was (`superviseur --note`).
828
+ * @param {string} dossier
829
+ * @param {string} fichier
830
+ * @param {{ env?: Record<string, string | undefined> }} [options]
831
+ * @returns {Promise<{ code: number, raison: string }>} code 2 and its reason, nothing written, on a
832
+ * refusal
833
+ */
834
+ export async function ecrireLaNote(dossier, fichier, { env = process.env } = {}) {
835
+ return surLaNote(dossier, fichier, env, ({ commun }, texte) => {
836
+ ecrireEntier(path.join(commun, NOTE_DE_REPRISE), texte);
837
+ });
795
838
  }
796
839
 
797
840
  /**
@@ -816,14 +859,20 @@ export async function ajouterLaQuestion(dossier, fichier, { env = process.env }
816
859
  * Whether the session of supervision of <dossier> is to be compacted (`superviseur --renouveler`),
817
860
  * the session holding the lock: at a milestone it declared, once a quiet Stop (<arretA>, ms, 0
818
861
  * without one) is later than it, with the message of resumption; else once that Stop is 55 minutes
819
- * old, with an empty message, a note or a milestone or not. A message of the owner (<messageA>, ms,
862
+ * old, with an empty message, a note or a milestone or not. With <sansReponse>, <arretA> is the end
863
+ * of a turn that gave no answer, not a Stop: it serves idleness alone and plays no milestone. A message of the owner (<messageA>, ms,
820
864
  * 0 without one) later than the declaration cancels the milestone. The reading keeps a milestone
821
- * that is due: the opening that follows the compaction removes it.
865
+ * that is due, and records that its message was given: the opening that follows the compaction
866
+ * removes it.
822
867
  * @param {string} dossier
823
- * @param {{ arretA: number, messageA: number, env?: Record<string, string | undefined> }} options
868
+ * @param {{ arretA: number, messageA: number, sansReponse?: boolean,
869
+ * env?: Record<string, string | undefined> }} options
824
870
  * @returns {Promise<{ reprise: string } | null>} null when nothing is to be done
825
871
  */
826
- export async function renouvellement(dossier, { arretA, messageA, env = process.env }) {
872
+ export async function renouvellement(
873
+ dossier,
874
+ { arretA, messageA, sansReponse = false, env = process.env },
875
+ ) {
827
876
  const session = laSeanceQuiTient(dossier, env);
828
877
  if (session.refus) {
829
878
  return null;
@@ -833,7 +882,11 @@ export async function renouvellement(dossier, { arretA, messageA, env = process.
833
882
  if (jalon && jalon.tenant === session.tenant) {
834
883
  if (messageA > jalon.declareA) {
835
884
  rmSync(f, { force: true });
836
- } else if (arretA > jalon.declareA) {
885
+ } else if (!sansReponse && arretA > jalon.declareA) {
886
+ ecrireEntier(
887
+ path.join(session.commun, RENOUVELLEMENT),
888
+ `${JSON.stringify({ tenant: session.tenant, rendu: jalon.declareA })}\n`
889
+ );
837
890
  return { reprise: MESSAGE_DE_REPRISE };
838
891
  }
839
892
  }
@@ -903,12 +956,29 @@ const REPRISES = {
903
956
  ].join('\n'),
904
957
  };
905
958
 
959
+ // At an opening of the holder of the lock, before the declared milestone is removed: a compaction
960
+ // that removes a milestone given due starts the period of the renewal; any other compaction leaves
961
+ // what is held, and any other source removes it.
962
+ function tenirLaPeriode(commun, { compactage, source, tenant }) {
963
+ const f = path.join(commun, RENOUVELLEMENT);
964
+ if (source !== 'compact') {
965
+ rmSync(f, { force: true });
966
+ return;
967
+ }
968
+ const jalon = lireJson(path.join(commun, JALON));
969
+ const tenu = lireJson(f);
970
+ if (compactage && jalon?.tenant === tenant && tenu?.rendu === jalon.declareA) {
971
+ ecrireEntier(f, `${JSON.stringify({ tenant, depuisA: Date.now() })}\n`);
972
+ }
973
+ }
974
+
906
975
  /**
907
976
  * The check of the supervisor at the opening of a session in <dossier> (greffon.md, §5.2): what it
908
977
  * says (empty when nothing), the lock taken when it is free. <source> is the one of the
909
978
  * SessionStart hook. The session that takes the lock, and the holder after a /clear or a
910
979
  * compaction, receive the circuits and the note of resumption; every opening of the holder removes
911
- * the declared milestone.
980
+ * the declared milestone. A compaction of the holder that removes a milestone given due starts the
981
+ * period of the renewal; every opening of another source lifts it.
912
982
  * @param {string} dossier the directory the session opens in
913
983
  * @param {{ source?: string, env?: Record<string, string | undefined>, circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]> }} [options]
914
984
  * @returns {Promise<string>}
@@ -927,6 +997,7 @@ export async function ouvertureDuSuperviseur(
927
997
  if (!tenait && !prendreVerrou(verrou, { attendre: false, pid: moi })) {
928
998
  return unAutreSuperviseur(verrou, moi);
929
999
  }
1000
+ tenirLaPeriode(commun, { compactage: tenait && source === 'compact', source, tenant: moi });
930
1001
  rmSync(path.join(commun, JALON), { force: true });
931
1002
  const reprise = Object.hasOwn(REPRISES, source) ? REPRISES[source] : '';
932
1003
  if (tenait && !reprise) {
@@ -1125,22 +1196,31 @@ function racineDe(dossier) {
1125
1196
  }
1126
1197
 
1127
1198
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
1128
- if (process.argv[2] === '--jalon' || process.argv[2] === '--question') {
1129
- // superviseur --jalon|--question <fichier> : played from the root of the repository.
1130
- const geste = process.argv[2] === '--jalon' ? declarerLeJalon : ajouterLaQuestion;
1131
- const { code, raison } = process.argv[3]
1132
- ? await geste(process.cwd(), process.argv[3])
1199
+ const gestes = {
1200
+ '--jalon': declarerLeJalon,
1201
+ '--note': ecrireLaNote,
1202
+ '--question': ajouterLaQuestion,
1203
+ };
1204
+ if (Object.hasOwn(gestes, process.argv[2] ?? '')) {
1205
+ // superviseur --jalon|--note|--question <fichier> : played from the root of the repository.
1206
+ const { code, raison, avis } = process.argv[3]
1207
+ ? await gestes[process.argv[2]](process.cwd(), process.argv[3])
1133
1208
  : { code: 2, raison: 'le fichier manque' };
1209
+ if (avis) {
1210
+ process.stdout.write(`${avis}\n`);
1211
+ }
1134
1212
  if (raison) {
1135
1213
  process.stderr.write(`${process.argv[2]} : ${raison}.\n`);
1136
1214
  }
1137
1215
  process.exitCode = code;
1138
1216
  } else if (process.argv[2] === '--renouveler') {
1139
- // superviseur --renouveler <dossier> <arretA> <messageA> (the greffon, at each period).
1140
- const [, , , dossier, arretA, messageA] = process.argv;
1217
+ // superviseur --renouveler <dossier> <arretA> <messageA> [sans-reponse] (the greffon, at each
1218
+ // period).
1219
+ const [, , , dossier, arretA, messageA, fin] = process.argv;
1141
1220
  const rendu = await renouvellement(dossier ?? process.cwd(), {
1142
1221
  arretA: Number(arretA),
1143
1222
  messageA: Number(messageA),
1223
+ sansReponse: fin === 'sans-reponse',
1144
1224
  });
1145
1225
  if (rendu) {
1146
1226
  process.stdout.write(`${JSON.stringify(rendu)}\n`);