@roomi-fields/grillhouse 0.50.2 → 0.51.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 (132) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/agents/developpeur.md +1 -1
  4. package/agents/direct.md +1 -1
  5. package/agents/explorateur.md +1 -1
  6. package/agents/questionneur.md +1 -1
  7. package/agents/relecteur.md +1 -1
  8. package/agents/testwriter.md +1 -1
  9. package/cadre/templates/c/package.json +1 -0
  10. package/cadre/templates/cargo/package.json +1 -0
  11. package/cadre/templates/python/package.json +1 -0
  12. package/charte.md +17 -12
  13. package/dist/machine/part-par-sorte.d.ts +16 -0
  14. package/dist/machine/part-par-sorte.js +36 -0
  15. package/dist/machine/part-par-sorte.js.map +1 -0
  16. package/dist/temporal/circuit/appel.js +1 -1
  17. package/dist/temporal/circuit/appel.js.map +1 -1
  18. package/dist/temporal/circuit/client.d.ts +5 -4
  19. package/dist/temporal/circuit/client.js +39 -16
  20. package/dist/temporal/circuit/client.js.map +1 -1
  21. package/dist/temporal/circuit/contrat.d.ts +11 -7
  22. package/dist/temporal/circuit/contrat.js +5 -9
  23. package/dist/temporal/circuit/contrat.js.map +1 -1
  24. package/dist/temporal/circuit/deroule.js +18 -6
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/commande.js +12 -3
  27. package/dist/temporal/commande.js.map +1 -1
  28. package/dist/temporal/installation.d.ts +54 -3
  29. package/dist/temporal/installation.js +187 -17
  30. package/dist/temporal/installation.js.map +1 -1
  31. package/dist/temporal/places/client.d.ts +5 -1
  32. package/dist/temporal/places/client.js +23 -11
  33. package/dist/temporal/places/client.js.map +1 -1
  34. package/docs/ARCHITECTURE.md +23 -2700
  35. package/docs/INTERFACE.md +23 -8
  36. package/docs/architecture/circuit.md +59 -12
  37. package/docs/architecture/entree.md +20 -7
  38. package/docs/architecture/greffon.md +6 -2
  39. package/docs/architecture/installation.md +30 -11
  40. package/docs/architecture/machine.md +50 -37
  41. package/docs/architecture/tests.md +52 -14
  42. package/docs/lexique.md +154 -0
  43. package/hooks/register.tsx +1 -1
  44. package/package.json +1 -1
  45. package/scripts/activites.mjs +85 -60
  46. package/scripts/aiguillage.mjs +15 -7
  47. package/scripts/attente-de-la-machine.mjs +4 -8
  48. package/scripts/avancement.mjs +12 -8
  49. package/scripts/bilan.mjs +10 -7
  50. package/scripts/branche-de-nuit.mjs +2 -2
  51. package/scripts/ci-de-main.mjs +18 -21
  52. package/scripts/circuit.mjs +86 -43
  53. package/scripts/circuits-du-serveur.mjs +5 -5
  54. package/scripts/composants-affectes.mjs +30 -12
  55. package/scripts/composition-des-langages.mjs +5 -3
  56. package/scripts/conformite.mjs +1 -1
  57. package/scripts/consommation-des-passes.mjs +8 -6
  58. package/scripts/copies-finies.mjs +3 -14
  59. package/scripts/depart-du-ticket.d.mts +8 -2
  60. package/scripts/depart-du-ticket.mjs +26 -8
  61. package/scripts/direct.mjs +158 -72
  62. package/scripts/droits.mjs +63 -185
  63. package/scripts/engendres.mjs +3 -14
  64. package/scripts/enveloppe/enveloppe.mjs +75 -30
  65. package/scripts/enveloppe/lancer.sh +59 -45
  66. package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
  67. package/scripts/enveloppe/travail-de-la-copie.mjs +115 -3
  68. package/scripts/etapes.mjs +84 -22
  69. package/scripts/faits-du-circuit.mjs +8 -2
  70. package/scripts/grillhouse-maj.mjs +43 -18
  71. package/scripts/groupe-cles.d.mts +15 -0
  72. package/scripts/groupe-cles.mjs +77 -2
  73. package/scripts/init.mjs +9 -2
  74. package/scripts/integration/rejeu.mjs +8 -1
  75. package/scripts/jointure.d.ts +22 -3
  76. package/scripts/langages/c/index.mjs +5 -2
  77. package/scripts/langages/cargo/commandes.mjs +35 -15
  78. package/scripts/langages/cargo/composants.mjs +45 -3
  79. package/scripts/langages/cargo/index.mjs +6 -3
  80. package/scripts/langages/cargo/sccache.mjs +10 -3
  81. package/scripts/langages/python/index.mjs +5 -2
  82. package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
  83. package/scripts/langages/typescript/index.mjs +4 -2
  84. package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
  85. package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
  86. package/scripts/langages/typescript/turbo-des-paquets.mjs +99 -36
  87. package/scripts/langages/typescript/verdict.mjs +29 -3
  88. package/scripts/langages/typescript/verifier.mjs +1 -1
  89. package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
  90. package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
  91. package/scripts/langages.mjs +54 -4
  92. package/scripts/matieres-lues.mjs +1 -1
  93. package/scripts/mesure/base-de-passe.mjs +32 -90
  94. package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
  95. package/scripts/migrations.mjs +21 -7
  96. package/scripts/paquets.d.ts +3 -0
  97. package/scripts/paquets.mjs +88 -1
  98. package/scripts/passe-de-la-machine.mjs +109 -36
  99. package/scripts/places-de-la-machine.mjs +81 -29
  100. package/scripts/plafond-de-la-machine.d.mts +2 -5
  101. package/scripts/plafond-de-la-machine.mjs +9 -9
  102. package/scripts/reprise.mjs +42 -13
  103. package/scripts/resultats.mjs +76 -54
  104. package/scripts/retirer-les-copies-finies.mjs +1 -1
  105. package/scripts/seances.mjs +426 -115
  106. package/scripts/services-du-noyau.mjs +9 -1
  107. package/scripts/session-start.sh +14 -1
  108. package/scripts/sortie.mjs +37 -6
  109. package/scripts/sous-commandes.mjs +0 -2
  110. package/scripts/superviseur.mjs +33 -13
  111. package/scripts/tableau.mjs +61 -16
  112. package/scripts/transitions.d.mts +25 -2
  113. package/scripts/transitions.mjs +137 -29
  114. package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
  115. package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
  116. package/skills/developpeur/SKILL.md +38 -15
  117. package/skills/direct/SKILL.md +29 -9
  118. package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
  119. package/skills/domain-modeling/SKILL.md +14 -12
  120. package/skills/explorateur/SKILL.md +30 -6
  121. package/skills/pitmaster/SKILL.md +12 -16
  122. package/skills/pitmaster/references/consigne-agent.md +12 -11
  123. package/skills/relecteur/SKILL.md +12 -5
  124. package/skills/systematic-debugging/SKILL.md +281 -0
  125. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  126. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  127. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  128. package/skills/systematic-debugging/find-polluter.sh +72 -0
  129. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  130. package/skills/testwriter/SKILL.md +35 -29
  131. package/scripts/verrous/commande.mjs +0 -214
  132. package/scripts/verrous/verrou.mjs +0 -311
@@ -1,311 +0,0 @@
1
- #!/usr/bin/env node
2
- // The write lock of a role agent: a PreToolUse hook declared in the settings of its session
3
- // (scripts/droits.mjs: `npx grillhouse verrou <role>`). It reads the hook's JSON on stdin and refuses a
4
- // file write the role does not own, with exit code 2 and its reason on stderr. Architecture:
5
- // docs/architecture/machine.md (§3.1, §5.5 « Les verrous dans la séance »).
6
- //
7
- // - A path under the system temp directory (the session scratchpad) is always writable.
8
- // - testwriter writes the files it owns, those the rule of a test file of the module of the
9
- // project's language classes (`estUnTest`, scripts/jointure.d.ts, scripts/langages.mjs): its test
10
- // files, the helpers of its folders of tests, and every file of a package of the shared test
11
- // material. Of the manifests, it writes what the module declares its (`manifestes`): a write of
12
- // a component's manifest whose only change from the file on disk lies in the part of its tests
13
- // (`horsDesTests` empty; the text after an Edit or a MultiEdit is the file's with its
14
- // replacements), and the lock files of the versions; any other change of a manifest is refused,
15
- // the path and each part named. A file of code is judged the same way when the module declares
16
- // a part of it the tests' (cargo: the test module of a file of `src/`).
17
- // - The repository root is that of the git repository holding the written file, whatever the
18
- // agent's working directory; a file outside any repository is read against the working directory.
19
- // A project that declares no language (the column « Langage » of its docs/ARCHITECTURE.md) is
20
- // refused, exit code 2, the column named: the lock cannot judge its writes, and a hook that
21
- // throws would let them pass.
22
- // - developpeur writes none of the testwriter's files, and no other file until its ticket's
23
- // description holds a "## Architecture" section (`sansArchitecture`, which the start of the
24
- // circuit reads too). The ticket is the "TON TICKET : <id>" line of the agent's
25
- // launch prompt, read from its transcript.
26
- // - direct writes tests and code of its plan together (a ticket led by `npx grillhouse direct`).
27
- // - In an envelope (`GRILLHOUSE_ENVELOPPE`, the packages of the plan, scripts/enveloppe/
28
- // paquets-du-plan.mjs), a write in the copy out of the packages the plan writes (`ecritsDuPlan`
29
- // on the components of the module of the language, `paquetsDuLangage`, as the envelope reads them)
30
- // and out of the shared test material, whose rule is the one above, and for the testwriter out
31
- // of the lock files of the versions (`manifestes.verrous`), stops the session: the hook answers Claude Code's
32
- // `continue: false`, the tool refused (`permissionDecision: deny`), its reason naming the file's
33
- // package and the plan, and leaves that reason in the session's working directory
34
- // (`MARQUE_HORS_PLAN` under TMPDIR), which the launcher hands to the circuit. The mount of the
35
- // envelope refuses the same write to any tool; the hook says why, and stops.
36
- import { execFileSync } from 'node:child_process';
37
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
38
- import { tmpdir } from 'node:os';
39
- import path from 'node:path';
40
- import { pathToFileURL } from 'node:url';
41
- import {
42
- ecritsDuPlan,
43
- MARQUE_HORS_PLAN,
44
- MARQUE_HORS_PLAN_FAIT,
45
- paquetQuiTient,
46
- paquetsDeLEnveloppe,
47
- paquetsDuLangage,
48
- testsEtendusDeLEnveloppe,
49
- } from '../enveloppe/paquets-du-plan.mjs';
50
- import { langageDeLaCopie } from '../langages.mjs';
51
-
52
- const WRITE_TOOLS = new Set(['Write', 'Edit', 'MultiEdit', 'NotebookEdit']);
53
-
54
- // True when <file> lies strictly under the directory <dir>.
55
- function isInside(file, dir) {
56
- const rel = path.relative(path.resolve(dir), file);
57
- return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
58
- }
59
-
60
- // The refusal of the ticket <id> whose <description> holds no "## Architecture" section, or null:
61
- // the one rule the developer's lock and the start of the circuit (scripts/circuit.mjs) read.
62
- export function sansArchitecture(id, description) {
63
- return /^##\s+Architecture\b/m.test(String(description ?? ''))
64
- ? null
65
- : `Le ticket ${id} n'a pas sa section « ## Architecture » : le code attend l'architecture. Rends la question au superviseur.`;
66
- }
67
-
68
- const isScratch = (file, tmp = tmpdir()) => isInside(file, tmp);
69
-
70
- // The root of the git repository (or worktree) that holds the absolute path <file>, read from its
71
- // nearest existing directory; null when no repository holds it.
72
- export function racineDe(file) {
73
- let dir = path.dirname(file);
74
- while (!existsSync(dir)) {
75
- const parent = path.dirname(dir);
76
- if (parent === dir) {
77
- return null;
78
- }
79
- dir = parent;
80
- }
81
- try {
82
- return execFileSync('git', ['-C', dir, 'rev-parse', '--show-toplevel'], {
83
- encoding: 'utf8',
84
- stdio: 'pipe',
85
- }).trim();
86
- } catch {
87
- return null;
88
- }
89
- }
90
-
91
- // The role that writes the tests, the shared test material and the lock files of the versions.
92
- const TESTWRITER = 'testwriter';
93
-
94
- // The stop of a write of <role> out of the plan of the envelope <env>, `{ paquet, raison }`, or
95
- // null: a write in the repository holding the file, out of the packages the plan writes, out of
96
- // the shared test material and, for the testwriter, out of the lock files of the versions.
97
- export function horsDuPlan(input, { tmp = tmpdir(), env = process.env, role = null } = {}) {
98
- const plan = paquetsDeLEnveloppe(env);
99
- if (!plan || !WRITE_TOOLS.has(input.tool_name)) {
100
- return null;
101
- }
102
- const raw = input.tool_input?.file_path ?? input.tool_input?.notebook_path;
103
- if (!raw) {
104
- return null;
105
- }
106
- const file = path.resolve(input.cwd ?? process.cwd(), raw);
107
- if (isScratch(file, tmp)) {
108
- return null;
109
- }
110
- const copie = racineDe(file);
111
- if (!copie) {
112
- return null;
113
- }
114
- const langage = langageDeLaCopie(copie);
115
- const liste = paquetsDuLangage(langage, copie);
116
- const ecrits = ecritsDuPlan(plan, liste);
117
- const rel = path.relative(copie, file);
118
- if (ecrits.includes('.') || ecrits.some(d => rel.startsWith(`${d}/`))) {
119
- return null;
120
- }
121
- if (langage.estUnTest(file, copie)?.matiere) {
122
- return null;
123
- }
124
- if (role === TESTWRITER && langage.manifestes.verrous.includes(rel)) {
125
- return null;
126
- }
127
- // The test files of a reader package the circuit extended the plan to (`testsEtendus`, given to
128
- // the testwriter's envelope alone): never its code nor its manifest.
129
- if (
130
- role === TESTWRITER &&
131
- testsEtendusDeLEnveloppe(env).some(d => rel.startsWith(`${d}/`)) &&
132
- langage.estUnTest(file, copie)?.test
133
- ) {
134
- return null;
135
- }
136
- const tenant = paquetQuiTient(rel, liste);
137
- const paquet = tenant === '.' ? 'la racine du dépôt' : tenant;
138
- return {
139
- paquet,
140
- chemin: rel,
141
- racine: tenant === '.',
142
- raison: `⛔ hors-plan — ${rel} est dans ${paquet}, hors des paquets du plan (${plan.join(', ')}) : ta séance s'arrête là, et le superviseur étend le plan ou refuse l'écriture.`,
143
- };
144
- }
145
-
146
- // The text of the file at <file>, null when there is none.
147
- const lu = file => (existsSync(file) ? readFileSync(file, 'utf8') : null);
148
-
149
- // The text the write <input> leaves at <file>: a Write's content, the file's text with each
150
- // replacement of an Edit or a MultiEdit, as Claude Code applies them; null for another tool.
151
- function texteApres(input, file) {
152
- const t = input.tool_input ?? {};
153
- const remplacer = (texte, e) =>
154
- e.replace_all
155
- ? texte.split(e.old_string ?? '').join(e.new_string ?? '')
156
- : texte.replace(e.old_string ?? '', () => e.new_string ?? '');
157
- if (input.tool_name === 'Write') {
158
- return t.content ?? '';
159
- }
160
- if (input.tool_name === 'Edit') {
161
- return remplacer(lu(file) ?? '', t);
162
- }
163
- if (input.tool_name === 'MultiEdit') {
164
- return (t.edits ?? []).reduce(remplacer, lu(file) ?? '');
165
- }
166
- return null;
167
- }
168
-
169
- // The ticket id of the launch prompt. A sub-agent's prompt opens its own transcript, next to the
170
- // session's; an agent launched as its own session (`claude --agent`) has it in the session's.
171
- function ticketOf(input) {
172
- if (!input.transcript_path) {
173
- return null;
174
- }
175
- const transcript = input.agent_id
176
- ? path.join(
177
- input.transcript_path.replace(/\.jsonl$/, ''),
178
- 'subagents',
179
- `agent-${input.agent_id}.jsonl`
180
- )
181
- : input.transcript_path;
182
- let first;
183
- try {
184
- first = readFileSync(transcript, 'utf8')
185
- .split('\n')
186
- .filter(Boolean)
187
- .map(l => JSON.parse(l))
188
- .find(e => e.type === 'user');
189
- } catch {
190
- return null;
191
- }
192
- const content = first?.message?.content;
193
- const text = Array.isArray(content) ? content.map(c => c.text ?? '').join('\n') : content;
194
- const m = /TON TICKET\s*:\s*([A-Za-z0-9_.-]+)/.exec(text ?? '');
195
- return m ? m[1] : null;
196
- }
197
-
198
- function ticketDescription(id, cwd) {
199
- try {
200
- const out = execFileSync('bd', ['show', id, '--json'], {
201
- cwd,
202
- encoding: 'utf8',
203
- stdio: 'pipe',
204
- maxBuffer: 256 * 1024 * 1024,
205
- });
206
- return JSON.parse(out)[0]?.description ?? null;
207
- } catch {
208
- return null;
209
- }
210
- }
211
-
212
- // The refusal reason for this hook input, or null when the write is allowed.
213
- export function refusal(role, input, { tmp = tmpdir(), describe = ticketDescription } = {}) {
214
- if (!WRITE_TOOLS.has(input.tool_name)) {
215
- return null;
216
- }
217
- const raw = input.tool_input?.file_path ?? input.tool_input?.notebook_path;
218
- if (!raw) {
219
- return null;
220
- }
221
- const cwd = input.cwd ?? process.cwd();
222
- const file = path.resolve(cwd, raw);
223
- if (isScratch(file, tmp)) {
224
- return null;
225
- }
226
- const racine = racineDe(file) ?? cwd;
227
- const langage = langageDeLaCopie(racine);
228
- const classe = langage.estUnTest(file, racine);
229
- const testwriter = classe !== null;
230
-
231
- if (role === TESTWRITER) {
232
- if (testwriter || langage.manifestes.verrous.includes(path.relative(racine, file))) {
233
- return null;
234
- }
235
- const apres = texteApres(input, file);
236
- const hors =
237
- apres === null ? null : langage.manifestes.horsDesTests(file, racine, lu(file), apres);
238
- if (hors?.length === 0) {
239
- return null;
240
- }
241
- const regle =
242
- "Le testwriter écrit seulement des fichiers de test, la matière de test partagée et, d'un manifeste ou d'un fichier de code, la part de ses tests";
243
- return hors
244
- ? `${regle} ; ce changement de ${raw} touche aussi ${hors.join(', ')}. Le reste du fichier revient au développeur.`
245
- : `${regle} ; ${raw} n'est rien de cela. Le code revient au développeur.`;
246
- }
247
- if (role === 'developpeur') {
248
- if (testwriter) {
249
- return classe.test
250
- ? `Les tests appartiennent au testwriter : ${raw} est un fichier de test. Un test faux se signale au superviseur.`
251
- : `La matière de test partagée appartient au testwriter : ${raw} en fait partie. Un besoin de matière se signale au superviseur.`;
252
- }
253
- const id = ticketOf(input);
254
- if (!id) {
255
- return 'Ton ticket est introuvable : ton message de lancement porte « TON TICKET : <id> ».';
256
- }
257
- const description = describe(id, input.cwd);
258
- if (description === null) {
259
- return `Le ticket ${id} est illisible par bd.`;
260
- }
261
- return sansArchitecture(id, description);
262
- }
263
- if (role === 'direct') {
264
- // The agent of a direct writes tests and code together; the envelope of its plan (`horsDuPlan`)
265
- // bounds its writes, and its ticket needs no « ## Architecture » section.
266
- return null;
267
- }
268
- return `Rôle inconnu du verrou : ${role}.`;
269
- }
270
-
271
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
272
- const input = JSON.parse(readFileSync(0, 'utf8'));
273
- // A project the lock cannot judge (no language declared, scripts/langages.mjs) is refused, as a
274
- // hook that throws exits 1, which Claude Code lets pass.
275
- let stop = null;
276
- let reason = null;
277
- try {
278
- stop = horsDuPlan(input, { role: process.argv[2] });
279
- if (!stop) {
280
- reason = refusal(process.argv[2], input);
281
- }
282
- } catch (e) {
283
- reason = e.message;
284
- }
285
- if (stop) {
286
- // The mark for the circuit; the stop below is the hook's answer, mark or not.
287
- try {
288
- writeFileSync(path.join(tmpdir(), MARQUE_HORS_PLAN), stop.raison);
289
- writeFileSync(
290
- path.join(tmpdir(), MARQUE_HORS_PLAN_FAIT),
291
- JSON.stringify({ chemin: stop.chemin, paquet: stop.paquet, racine: stop.racine })
292
- );
293
- } catch {
294
- // A working directory gone leaves no mark; the session still stops.
295
- }
296
- process.stdout.write(
297
- `${JSON.stringify({
298
- continue: false,
299
- stopReason: stop.raison,
300
- hookSpecificOutput: {
301
- hookEventName: 'PreToolUse',
302
- permissionDecision: 'deny',
303
- permissionDecisionReason: stop.raison,
304
- },
305
- })}\n`
306
- );
307
- } else if (reason) {
308
- process.stderr.write(reason + '\n');
309
- process.exitCode = 2;
310
- }
311
- }