@roomi-fields/grillhouse 0.50.3 → 0.52.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 (150) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -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/plan.md +47 -0
  13. package/charte/preuve.md +39 -0
  14. package/charte/superviseur.md +61 -0
  15. package/charte/tests.md +38 -0
  16. package/charte.md +39 -189
  17. package/dist/machine/part-par-sorte.d.ts +16 -0
  18. package/dist/machine/part-par-sorte.js +36 -0
  19. package/dist/machine/part-par-sorte.js.map +1 -0
  20. package/dist/temporal/circuit/appel.js +1 -1
  21. package/dist/temporal/circuit/appel.js.map +1 -1
  22. package/dist/temporal/circuit/client.d.ts +4 -4
  23. package/dist/temporal/circuit/client.js +38 -16
  24. package/dist/temporal/circuit/client.js.map +1 -1
  25. package/dist/temporal/circuit/contrat.d.ts +11 -7
  26. package/dist/temporal/circuit/contrat.js +5 -9
  27. package/dist/temporal/circuit/contrat.js.map +1 -1
  28. package/dist/temporal/circuit/deroule.js +18 -6
  29. package/dist/temporal/circuit/deroule.js.map +1 -1
  30. package/dist/temporal/commande.js +12 -3
  31. package/dist/temporal/commande.js.map +1 -1
  32. package/dist/temporal/installation.d.ts +54 -3
  33. package/dist/temporal/installation.js +187 -17
  34. package/dist/temporal/installation.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +5 -1
  36. package/dist/temporal/places/client.js +23 -11
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/docs/ARCHITECTURE.md +23 -2700
  39. package/docs/INTERFACE.md +26 -10
  40. package/docs/architecture/circuit.md +61 -14
  41. package/docs/architecture/entree.md +21 -8
  42. package/docs/architecture/greffon.md +49 -20
  43. package/docs/architecture/installation.md +46 -17
  44. package/docs/architecture/machine.md +79 -39
  45. package/docs/architecture/tests.md +59 -16
  46. package/docs/lexique.md +163 -0
  47. package/hooks/hooks.json +0 -10
  48. package/hooks/register.tsx +92 -4
  49. package/package.json +2 -1
  50. package/scripts/activites.mjs +105 -65
  51. package/scripts/aiguillage.mjs +15 -8
  52. package/scripts/attente-au-tour.mjs +2 -3
  53. package/scripts/attente-de-la-machine.mjs +4 -8
  54. package/scripts/avancement.mjs +12 -8
  55. package/scripts/bilan.mjs +126 -63
  56. package/scripts/bilans-gardes.mjs +37 -0
  57. package/scripts/branche-de-nuit.mjs +2 -2
  58. package/scripts/ci-de-main.mjs +18 -21
  59. package/scripts/circuit.mjs +89 -44
  60. package/scripts/circuits-du-serveur.mjs +5 -5
  61. package/scripts/composants-affectes.mjs +30 -12
  62. package/scripts/composition-des-langages.mjs +5 -3
  63. package/scripts/conformite.mjs +1 -1
  64. package/scripts/consommation-des-passes.mjs +8 -6
  65. package/scripts/copies-finies.mjs +3 -14
  66. package/scripts/depart-du-ticket.d.mts +8 -2
  67. package/scripts/depart-du-ticket.mjs +26 -8
  68. package/scripts/direct.mjs +158 -72
  69. package/scripts/droits.mjs +165 -208
  70. package/scripts/engendres.mjs +3 -14
  71. package/scripts/entree-de-seance.mjs +35 -0
  72. package/scripts/enveloppe/enveloppe.mjs +98 -46
  73. package/scripts/enveloppe/lancer.sh +90 -66
  74. package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
  75. package/scripts/enveloppe/travail-de-la-copie.mjs +192 -3
  76. package/scripts/etapes.mjs +84 -22
  77. package/scripts/faits-du-circuit.mjs +8 -2
  78. package/scripts/grillhouse-maj.mjs +43 -18
  79. package/scripts/groupe-cles.d.mts +15 -0
  80. package/scripts/groupe-cles.mjs +77 -2
  81. package/scripts/init.mjs +9 -2
  82. package/scripts/integration/rejeu.mjs +8 -1
  83. package/scripts/jointure.d.ts +24 -4
  84. package/scripts/langages/c/index.mjs +5 -2
  85. package/scripts/langages/cargo/commandes.mjs +35 -15
  86. package/scripts/langages/cargo/composants.mjs +45 -3
  87. package/scripts/langages/cargo/index.mjs +6 -3
  88. package/scripts/langages/python/commandes.mjs +50 -7
  89. package/scripts/langages/python/index.mjs +5 -2
  90. package/scripts/langages/python/squelette.mjs +2 -1
  91. package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
  92. package/scripts/langages/typescript/index.mjs +16 -14
  93. package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
  94. package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
  95. package/scripts/langages/typescript/turbo-des-paquets.mjs +151 -38
  96. package/scripts/langages/typescript/verdict.mjs +29 -3
  97. package/scripts/langages/typescript/verifier.mjs +28 -3
  98. package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
  99. package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
  100. package/scripts/langages.mjs +54 -4
  101. package/scripts/matieres-lues.mjs +1 -1
  102. package/scripts/mesure/base-de-passe.mjs +32 -90
  103. package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
  104. package/scripts/migrations/suivi-du-superviseur-retire.mjs +56 -0
  105. package/scripts/migrations.mjs +23 -7
  106. package/scripts/nuit.sh +3 -2
  107. package/scripts/paquet.mjs +1 -1
  108. package/scripts/paquets.d.ts +3 -0
  109. package/scripts/paquets.mjs +88 -1
  110. package/scripts/passe-de-la-machine.mjs +109 -36
  111. package/scripts/places-de-la-machine.mjs +81 -29
  112. package/scripts/plafond-de-la-machine.d.mts +2 -5
  113. package/scripts/plafond-de-la-machine.mjs +9 -9
  114. package/scripts/reprise.mjs +42 -13
  115. package/scripts/resultats.mjs +78 -56
  116. package/scripts/retirer-les-copies-finies.mjs +1 -1
  117. package/scripts/seances.mjs +471 -133
  118. package/scripts/services-du-noyau.mjs +9 -1
  119. package/scripts/session-start.sh +22 -7
  120. package/scripts/sortie-de-seance.mjs +70 -0
  121. package/scripts/sortie.mjs +37 -6
  122. package/scripts/sous-commandes.mjs +0 -3
  123. package/scripts/superviseur.mjs +400 -162
  124. package/scripts/tableau.mjs +188 -65
  125. package/scripts/transitions.d.mts +25 -2
  126. package/scripts/transitions.mjs +137 -29
  127. package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
  128. package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
  129. package/skills/developpeur/SKILL.md +38 -15
  130. package/skills/direct/SKILL.md +29 -9
  131. package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
  132. package/skills/domain-modeling/SKILL.md +14 -12
  133. package/skills/explorateur/SKILL.md +32 -8
  134. package/skills/grill/SKILL.md +3 -2
  135. package/skills/pitmaster/SKILL.md +80 -50
  136. package/skills/pitmaster/references/cadre.md +1 -1
  137. package/skills/pitmaster/references/consigne-agent.md +12 -11
  138. package/skills/pitmaster/references/tour.md +6 -5
  139. package/skills/relecteur/SKILL.md +13 -6
  140. package/skills/systematic-debugging/SKILL.md +281 -0
  141. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  142. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  143. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  144. package/skills/systematic-debugging/find-polluter.sh +72 -0
  145. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  146. package/skills/testwriter/SKILL.md +37 -31
  147. package/cadre/templates/projet/pitmaster/SUIVI.md +0 -22
  148. package/scripts/attente-a-l-arret.mjs +0 -114
  149. package/scripts/verrous/commande.mjs +0 -214
  150. package/scripts/verrous/verrou.mjs +0 -311
@@ -1,49 +1,58 @@
1
- #!/usr/bin/env node
2
1
  // The rights and the context of each role session the circuit launches, from one source (ROLES):
3
2
  // the testwriter and the developpeur in the envelope of their plan (scripts/enveloppe/lancer.sh),
4
3
  // the explorateur, the questionneur and the reviewer out of it (scripts/circuit.mjs). A session
5
- // receives the rights the commands of its skill name, and the context its work reads.
6
- // Architecture: docs/architecture/machine.md (§3.2, §2.5).
4
+ // has every tool its work uses and runs every command: what it writes is bounded by the mounts of
5
+ // its envelope and judged on its lot (scripts/seances.mjs), never by a rule on its commands.
6
+ // Architecture: docs/architecture/machine.md (§3.2, §5.5).
7
7
  //
8
8
  // npx grillhouse droits <rôle> --racine <arbre principal> --copie <copie> --ticket <ticket>
9
9
  //
10
10
  // prints the options of claude for that session, one per line (`optionsDuRole`):
11
11
  //
12
12
  // - `--setting-sources project,local`: the user's own configuration stays out (their hooks, the
13
- // skills of their account, their servers, their environment); the project's settings and
13
+ // skills of their account, their servers, their environment; of their settings, the settings of
14
+ // the role carry the output style alone, below); the project's settings and
14
15
  // charter, and the frame's plugin it enables (agents, skills, common charter, hooks), stay in.
15
16
  // Claude Code loads the user's charter (`~/.claude/CLAUDE.md`) whatever the sources, so the
16
17
  // settings of the role exclude it by its path (`claudeMdExcludes`), and the envelope does not
17
- // mount it.
18
+ // mount it. The common charter is cut by public: its core, `charte.md`, which each session loads,
19
+ // imports one module per public (`charte/<module>.md`, MODULES_DE_LA_CHARTE); the settings of the
20
+ // role exclude each module the role does not apply (`modules`, ROLES) by the same key, wherever
21
+ // the charter is read, the package installed or the frame's source.
18
22
  // - `--settings <json>` (the settings of the role, on the command line: no file the session could
19
- // change): its permissions (`allow`, the commands its skill names, and the reading of its
20
- // skill's files, references included, and of the METACADRE.md its skill names, in the frame's
21
- // plugin as installed for the copy, else for the project, by `Read` and `ls` and with no writing; `deny`, the change of its
22
- // author at the ticket, AUTEUR_FIXE, for a role that writes the editing by script, the test
23
- // tool run directly and the reading again of the ticket its instruction carries, and for a role
24
- // that writes nothing at the ticket, the explorateur and the questionneur, every write of bd,
25
- // ECRIRE_AU_TICKET); the
26
- // automatic memory off; the skills of Claude Code off (`disableBundledSkills`, and the few it keeps,
27
- // INTEGREES), and the project's own skills (`.claude/skills/` of the copy) off
28
- // (`skillOverrides`); every plugin the project enables off (`enabledPlugins`: their skills,
29
- // hooks and servers are not the role's), save the frame's (`grillhouse@…`), which carries the
30
- // role's agent, its skills and the frame's hooks: Claude Code applies no `skillOverrides` to the
31
- // skills of a plugin, and the role's agent preloads its own (`skills` of its definition);
32
- // the background tasks off and Code Mode on (`env`, ENV_DES_SEANCES: a role waits in the
23
+ // change): its permissions (`allow`, every command of `Bash`, the tools of the index for a role
24
+ // that uses it, and the reading of its skill's files, references included, of those of the
25
+ // debugging skill for a role whose skill loads it (`debogage`), and of the METACADRE.md its
26
+ // skill names, in the frame's plugin as installed for the copy, else for the project, by `Read`
27
+ // and `ls` and with no writing; `deny`, the change of its author at the ticket, AUTEUR_FIXE,
28
+ // for a role whose instruction carries its ticket the reading of it again, for a role that
29
+ // writes the test tool run directly, and for a role that writes nothing at the ticket every write
30
+ // of bd, ECRIRE_AU_TICKET); no hook; the
31
+ // automatic memory off; the skills of Claude Code off (`disableBundledSkills`); every plugin the
32
+ // project enables off (`enabledPlugins`: their skills, hooks and servers are not the role's),
33
+ // save the frame's (`grillhouse@…`), which carries the role's agent, its skills and the frame's
34
+ // hooks; the background tasks off and Code Mode on (`env`, ENV_DES_SEANCES: a role waits in the
33
35
  // foreground for what it launches, and its session ends with its sheet; `claude -p` gets Code
34
- // Mode, the REPL, only from this block); for a role that writes, its locks as hooks (PreToolUse: verrous/verrou.mjs on the tools of
35
- // writing, verrous/commande.mjs on Bash), since the hooks of an agent's definition do not run in
36
- // a folder Claude Code has not trusted, as the copy of a ticket.
36
+ // Mode, the REPL, only from this block), and, in the same block, the prompt cache forced to five
37
+ // minutes for a role that takes it (`cacheCinqMinutes`, ROLES; CINQ_MINUTES_DE_CACHE); no line of
38
+ // attribution of commit or pull request
39
+ // (`attribution`, both empty, whatever the project and the user choose: a role commits nothing);
40
+ // the output style the user chooses (`outputStyle` of `<home>/.claude/settings.json`), left out
41
+ // when they choose none, and when a settings file of the project chooses one (`settings.json`
42
+ // of the copy, `settings.local.json` of the main tree or of the copy), which the command line
43
+ // would override. The name of the style alone goes: a style the session cannot resolve (a file
44
+ // of `~/.claude/output-styles`, a plugin it does not load) does not apply.
45
+ // - The skills the session lists and may load are no option: they go on its standard input
46
+ // (`competencesDuRole`, scripts/entree-de-seance.mjs), the one list no setting can bound for the
47
+ // skills of a plugin.
37
48
  // - `--tools <list>`: the tools its work uses; Edit and Write for a role that writes alone, the
38
49
  // tool search for a role whose index Claude Code defers.
39
50
  // - `--strict-mcp-config --mcp-config <json>`: the servers of the index (codegraph, rtfm) for a
40
51
  // role that uses it, read in the project's `.mcp.json` and in the manifests of the plugins it
41
52
  // enables, at their installed path (`~/.claude/plugins/installed_plugins.json`, the project's
42
- // entry first, else the user's); none for the others.
43
- //
44
- // The skills' commands and the permissions answer one another: tests/unit/droits.spec.ts fails on a
45
- // command a skill names that no permission covers, and on a permission no command names.
46
- import { existsSync, readdirSync, readFileSync } from 'node:fs';
53
+ // entry first, else the user's); a project's entry whose command is the bare name of the program
54
+ // a plugin ships runs that program; none for the others.
55
+ import { readFileSync } from 'node:fs';
47
56
  import os from 'node:os';
48
57
  import path from 'node:path';
49
58
  import { pathToFileURL } from 'node:url';
@@ -60,18 +69,6 @@ export const AUTEUR_FIXE = [
60
69
  'Bash(bd * -a*)',
61
70
  `Bash(*${ACTEUR}*)`,
62
71
  ];
63
- // What a role that writes may not run: a file is edited by its tools of writing, which its lock
64
- // judges, and the tests run by `npm test` (charter, « Les tests se lancent par npm test »).
65
- const ECRIRE_PAR_SCRIPT = [
66
- 'Bash(python *)',
67
- 'Bash(python3 *)',
68
- 'Bash(sed -i*)',
69
- 'Bash(sed * -i*)',
70
- 'Bash(perl -i*)',
71
- 'Bash(perl -pi*)',
72
- 'Bash(perl * -i*)',
73
- 'Bash(perl * -pi*)',
74
- ];
75
72
  // What a role that writes nothing at the ticket may not run: the circuit writes its exchange there,
76
73
  // from its sheet.
77
74
  const ECRIRE_AU_TICKET = [
@@ -92,25 +89,19 @@ const ENV_DES_SEANCES = {
92
89
  CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: '1',
93
90
  CLAUDE_CODE_EXPERIMENTAL_CODE_MODE: '1',
94
91
  };
92
+ // The variable the env block adds for a role whose prompt cache lasts five minutes
93
+ // (`cacheCinqMinutes`, ROLES): the explorateur, the questionneur, the testwriter and the relecteur,
94
+ // whose turns mostly follow each other within five minutes, and a cache write kept five minutes
95
+ // costs 1.25 times an input, against 2 times for one hour. The developpeur and the direct often
96
+ // wait longer (tests, builds) and would lose by it (simulated: developpeur −3.6 %, direct
97
+ // −11.9 %): they keep Claude Code's default, one hour on the subscription.
98
+ const CINQ_MINUTES_DE_CACHE = { FORCE_PROMPT_CACHING_5M: '1' };
95
99
 
96
- // The reads of git in the copy, by its path (`git -C <copie> …`), which Claude Code does not let
97
- // through without a rule, as it does `git status` in the working directory.
98
- const LIRE_GIT = [
99
- 'Bash(git -C * status*)',
100
- 'Bash(git -C * diff*)',
101
- 'Bash(git -C * log*)',
102
- 'Bash(git -C * ls-files*)',
103
- 'Bash(git -C * grep*)',
104
- ];
105
- // The skills Claude Code keeps listed when its own are off (`disableBundledSkills`), measured on
106
- // Claude Code 2.1.305.
107
- const INTEGREES = ['design', 'doctor', 'plugin-authoring'];
108
100
  // The frame's plugin, by the start of its identifier (`grillhouse@<place de marché>`).
109
101
  const GREFFON_DU_CADRE = 'grillhouse@';
110
- // The servers of the index (charter, « L'index d'abord »).
102
+ // The servers of the index (charter, « L'index d'abord »), and their tools of reading: codegraph
103
+ // for the calls, rtfm for the search and the reading of a result whole.
111
104
  const INDEX = ['codegraph', 'rtfm'];
112
- // The reads of the index by a role that writes: codegraph for the calls, rtfm for the search and
113
- // the reading of a result whole.
114
105
  const LIRE_L_INDEX = [
115
106
  'Bash(codegraph explore *)',
116
107
  'mcp__codegraph__codegraph_explore',
@@ -121,138 +112,107 @@ const LIRE_L_INDEX = [
121
112
  const LIRE = ['Bash', 'Read', 'Skill'];
122
113
  const ECRIRE = ['Edit', 'Write'];
123
114
 
124
- // The charter prescribes `env -C <dossier>` in place of `cd`: a command run in the copy carries
125
- // that prefix, which a bare rule does not match. Each rule of command, out of bd, git and env -C,
126
- // gets its twin `Bash(env -C * <commande>)`, as git has `git show` and `git -C * show`.
127
- /** @param {string[]} regles @returns {string[]} */
128
- function avecJumelles(regles) {
129
- return regles.flatMap(r => {
130
- const bash = /^Bash\((.*)\)$/.exec(r);
131
- return bash && !/^(bd|git|env -C) /.test(bash[1]) ? [r, `Bash(env -C * ${bash[1]})`] : [r];
132
- });
133
- }
115
+ // The rules that permit a role its commands, every one, and the tools of the index for a role that
116
+ // uses it.
117
+ const TOUTE_COMMANDE = ['Bash'];
118
+ const TOUTE_COMMANDE_ET_L_INDEX = [...TOUTE_COMMANDE, ...LIRE_L_INDEX];
119
+
120
+ // The modules of the common charter (`charte/<module>.md`, beside `charte.md`), and the folders
121
+ // that hold the charter: the package installed in a project, the frame's source in its repository.
122
+ const MODULES_DE_LA_CHARTE = ['superviseur', 'plan', 'preuve', 'tests'];
123
+ const DOSSIERS_DE_LA_CHARTE = ['node_modules/@roomi-fields/grillhouse', 'mods/grillhouse'];
134
124
 
135
- // Each role the circuit launches: whether it writes (files, `ecrit`; the ticket, unless
136
- // `ecritAuTicket` is false), whether it uses the index, whether its skill names the frame's
137
- // METACADRE.md (`metacadre`, read at the root of the plugin installed), and the commands its skill
138
- // names (the frame's plugin, `mods/grillhouse/skills/<rôle>/`), as permission rules.
125
+ // Each role the circuit launches: the modules of the common charter it applies (`modules`; the
126
+ // supervisor's is no role's), whether it writes (files, `ecrit`; the ticket, unless
127
+ // `ecritAuTicket` is false), whether its instruction carries its ticket (`porteSonTicket`),
128
+ // whether it uses the index, the rules of its commands (`commandes`), whether its skill names the
129
+ // frame's METACADRE.md (`metacadre`, read at the root of the plugin installed), whether its skill
130
+ // loads the debugging skill of the plugin (`debogage`, read with its neighbouring files), the other
131
+ // skills of the plugin its skill or the common charter ask it to load (`competences`), and whether
132
+ // its prompt cache lasts five minutes (`cacheCinqMinutes`).
139
133
  export const ROLES = {
140
134
  // It writes no file and nothing at the ticket: it surveys the components and reads the code by
141
- // the index, and ends on the plan in its sheet, which the circuit writes at the ticket. At the
142
- // tri of the discoveries, it reads each one and its parent, the commit of main and its history
143
- // (`git show`, `git log`, in its working directory, the main tree, or by `git -C`), and builds
144
- // a package before it judges an error of types of its export; it has no pass. Its
145
- // instruction of the tri lists these commands (`commandesPermises`).
135
+ // the index, and ends on the plan in its sheet, which the circuit writes at the ticket.
146
136
  explorateur: {
137
+ cacheCinqMinutes: true,
138
+ modules: ['plan', 'preuve'],
147
139
  metacadre: true,
140
+ debogage: true,
141
+ competences: ['mesure'],
148
142
  index: true,
149
143
  ecritAuTicket: false,
150
- commandes: avecJumelles([
151
- 'Bash(bd show *)',
152
- 'Bash(bd comments *)',
153
- 'Bash(git show *)',
154
- 'Bash(git log *)',
155
- 'Bash(git -C * show *)',
156
- 'Bash(git -C * log *)',
157
- 'Bash(npx grillhouse composants-affectes *)',
158
- 'Bash(npm run build -- --filter=*)',
159
- 'Bash(codegraph explore *)',
160
- 'mcp__codegraph__codegraph_explore',
161
- 'mcp__rtfm__rtfm_search',
162
- ]),
144
+ commandes: TOUTE_COMMANDE_ET_L_INDEX,
163
145
  },
164
- // It writes the tests of the whole ticket, in the envelope of its plan, and reads the whole copy
165
- // by the index (charter, « L'index d'abord »).
146
+ // It writes the tests of the whole ticket, in the envelope of its plan.
166
147
  testwriter: {
148
+ cacheCinqMinutes: true,
149
+ modules: ['preuve', 'tests'],
167
150
  metacadre: true,
151
+ competences: ['mesure'],
168
152
  ecrit: true,
169
153
  index: true,
170
- commandes: avecJumelles([
171
- 'Bash(bd update * --claim)',
172
- 'Bash(bd comments add *)',
173
- 'Bash(npm test *)',
174
- // The removal of a file of its tests, by a script of its temporary directory.
175
- 'Bash(node $TMPDIR/*)',
176
- // The size guard on its batch before it hands back its sheet: no argument, the whole repository.
177
- 'Bash(npx grillhouse tailles-des-tests)',
178
- ...LIRE_L_INDEX,
179
- ]),
154
+ porteSonTicket: true,
155
+ commandes: TOUTE_COMMANDE_ET_L_INDEX,
180
156
  },
181
- // It writes the code of the whole ticket, in the envelope of its plan, and reads the whole copy
182
- // by the index.
157
+ // It writes the code of the whole ticket, in the envelope of its plan.
183
158
  developpeur: {
159
+ modules: [],
184
160
  metacadre: true,
161
+ debogage: true,
162
+ competences: ['mesure', 'redacteur', 'writing-for-agents'],
185
163
  ecrit: true,
186
164
  index: true,
187
- commandes: avecJumelles([
188
- 'Bash(bd update * --claim)',
189
- 'Bash(bd update * --notes*)',
190
- 'Bash(bd comments add *)',
191
- 'Bash(git -C * status*)',
192
- 'Bash(git -C * diff*)',
193
- 'Bash(npm test *)',
194
- 'Bash(npm run api*)',
195
- ...LIRE_L_INDEX,
196
- ]),
165
+ porteSonTicket: true,
166
+ commandes: TOUTE_COMMANDE_ET_L_INDEX,
197
167
  },
198
168
  // The agent of a ticket led out of the circuit (`npx grillhouse direct`, scripts/direct.mjs): it
199
- // writes the tests and the code of the whole ticket together, in the envelope of its plan, and
200
- // reads the whole copy by the index. A role of its own: the developpeur keeps the rights of the
201
- // circuit (no test file).
169
+ // writes the tests and the code of the whole ticket together, in the envelope of its plan.
202
170
  direct: {
171
+ modules: ['preuve', 'tests'],
172
+ debogage: true,
173
+ competences: ['mesure', 'redacteur', 'writing-for-agents'],
203
174
  ecrit: true,
204
175
  index: true,
205
- commandes: avecJumelles([
206
- 'Bash(bd update * --claim)',
207
- 'Bash(bd comments add *)',
208
- 'Bash(git -C * status*)',
209
- 'Bash(git -C * diff*)',
210
- 'Bash(npm test *)',
211
- 'Bash(npm run api*)',
212
- // The removal of a file, by a script of its temporary directory.
213
- 'Bash(node $TMPDIR/*)',
214
- ...LIRE_L_INDEX,
215
- ]),
176
+ porteSonTicket: true,
177
+ commandes: TOUTE_COMMANDE_ET_L_INDEX,
216
178
  },
217
179
  relecteur: {
180
+ cacheCinqMinutes: true,
181
+ modules: ['plan', 'preuve', 'tests'],
218
182
  metacadre: true,
219
183
  index: true,
220
- commandes: avecJumelles([
221
- ...LIRE_GIT,
222
- 'Bash(npx grillhouse index-interfaces --publie *)',
223
- 'Bash(npm test *)',
224
- 'Bash(npm run verifier -- --gardes*)',
225
- 'Bash(codegraph explore *)',
226
- 'mcp__codegraph__codegraph_explore',
227
- 'mcp__rtfm__rtfm_search',
228
- ]),
184
+ ecritAuTicket: false,
185
+ porteSonTicket: true,
186
+ commandes: TOUTE_COMMANDE_ET_L_INDEX,
229
187
  },
230
188
  // It asks, and decides nothing: it reads the proposal its instruction carries and the code by
231
189
  // the index; the circuit writes its questions at the ticket.
232
190
  questionneur: {
191
+ cacheCinqMinutes: true,
192
+ modules: ['plan', 'preuve'],
233
193
  index: true,
234
194
  ecritAuTicket: false,
235
- commandes: avecJumelles([
236
- 'Bash(codegraph explore *)',
237
- 'mcp__codegraph__codegraph_explore',
238
- 'mcp__rtfm__rtfm_search',
239
- ]),
195
+ commandes: TOUTE_COMMANDE_ET_L_INDEX,
240
196
  },
241
197
  };
242
198
 
243
- // The commands the rights of <role> permit (ROLES.<role>.commandes), one line each, in Markdown, as
244
- // the help of a tool lists its commands: a rule of Bash as its command, `…` for its wildcard; a
245
- // tool by its name. Its instruction carries them, so that it names no command its rights refuse.
246
- /** @param {keyof typeof ROLES} role @returns {string} */
247
- export function commandesPermises(role) {
248
- return ROLES[role].commandes
249
- .map(r => {
250
- const bash = /^Bash\((.*)\)$/.exec(r);
251
- return bash
252
- ? `- \`${bash[1].replaceAll('*', '…')}\``
253
- : `- l'outil \`${r.split('__').at(-1)}\``;
254
- })
255
- .join('\n');
199
+ // The skills of the plugin <role> loads: its own, then the debugging skill for a role that debugs.
200
+ const competencesDeTravail = role => [
201
+ role,
202
+ ...(ROLES[role].debogage ? ['systematic-debugging'] : []),
203
+ ];
204
+
205
+ /**
206
+ * The skills a session of `role` lists and may load, qualified by the frame's plugin: its own, the
207
+ * debugging skill for a role that debugs, and those its skill and the common charter ask of it.
208
+ */
209
+ export function competencesDuRole(role) {
210
+ if (!ROLES[role]) {
211
+ throw new Error(`rôle sans droits : ${role}`);
212
+ }
213
+ return [...competencesDeTravail(role), ...(ROLES[role].competences ?? [])].map(
214
+ c => `grillhouse:${c}`
215
+ );
256
216
  }
257
217
 
258
218
  const lireJson = f => {
@@ -290,8 +250,9 @@ function cheminDuGreffon(nom, projets, home) {
290
250
  }
291
251
 
292
252
  // The reading of the skill of <role> (SKILL.md and its references/) in the frame's plugin, as
293
- // installed for the copy where the session runs, else for the project, and of the plugin's
294
- // METACADRE.md alone for a role whose skill names it: rules `Read(//…)`, which let through the
253
+ // installed for the copy where the session runs, else for the project, of the debugging skill for a
254
+ // role whose skill loads it (`debogage`), whose neighbouring files the tool Skill does not give,
255
+ // and of the plugin's METACADRE.md alone for a role whose skill names it: rules `Read(//…)`, which let through the
295
256
  // tool Read and `ls` of those folders, and write nothing (measured on Claude Code in `dontAsk`).
296
257
  // Narrower than a folder of work (`--add-dir`), which would open the whole plugin; none when the
297
258
  // plugin is not installed.
@@ -302,12 +263,15 @@ function lireSaCompetence(role, { racine, copie, home }) {
302
263
  return [];
303
264
  }
304
265
  return [
305
- `Read(/${path.join(dossier, 'skills', role)}/**)`,
266
+ ...competencesDeTravail(role).map(c => `Read(/${path.join(dossier, 'skills', c)}/**)`),
306
267
  ...(ROLES[role].metacadre ? [`Read(/${path.join(dossier, 'METACADRE.md')})`] : []),
307
268
  ];
308
269
  }
309
270
 
310
271
  // The servers of the index: the project's `.mcp.json`, then the manifests of the plugins it enables.
272
+ // An entry of the project whose command is the bare name of the program a plugin ships runs that
273
+ // program, with the rest of the project's entry: the envelope mounts the plugin, and the PATH of a
274
+ // session does not hold its `bin/`.
311
275
  function serveursDeLIndex(racine, home) {
312
276
  const out = {};
313
277
  const projet = lireJson(path.join(racine, '.mcp.json'))?.mcpServers ?? {};
@@ -326,17 +290,51 @@ function serveursDeLIndex(racine, home) {
326
290
  lireJson(path.join(dossier, '.mcp.json'))?.mcpServers ??
327
291
  {};
328
292
  for (const n of INDEX) {
329
- if (out[n] || !serveurs[n]) {
293
+ if (!serveurs[n]) {
330
294
  continue;
331
295
  }
332
- out[n] = JSON.parse(JSON.stringify(serveurs[n]).replaceAll('${CLAUDE_PLUGIN_ROOT}', dossier));
296
+ const porte = JSON.parse(
297
+ JSON.stringify(serveurs[n]).replaceAll('${CLAUDE_PLUGIN_ROOT}', dossier)
298
+ );
299
+ if (!out[n]) {
300
+ out[n] = porte;
301
+ } else if (out[n].command === path.basename(porte.command ?? '')) {
302
+ out[n] = { ...out[n], command: porte.command };
303
+ }
333
304
  }
334
305
  }
335
306
  return out;
336
307
  }
337
308
 
338
- // The settings of the session of <role>, for the ticket <ticket>, its copy <copie> (where the
339
- // project's own skills are read) and the main tree <racine>; <home> holds the plugins installed.
309
+ // The output style of the session, as the settings to add: the one the user chooses in <home>,
310
+ // none when a settings file of the project that the session reads chooses one (in a copy, Claude
311
+ // Code reads `settings.json` there, and `settings.local.json` at the main tree and there).
312
+ function styleDuPoste({ racine, copie, home }) {
313
+ const style = (base, f) => lireJson(path.join(base, '.claude', f))?.outputStyle;
314
+ const duProjet = [
315
+ style(copie, 'settings.json'),
316
+ style(racine, 'settings.local.json'),
317
+ style(copie, 'settings.local.json'),
318
+ ].some(s => s !== undefined);
319
+ const duPoste = style(home, 'settings.json');
320
+ return duPoste && !duProjet ? { outputStyle: duPoste } : {};
321
+ }
322
+
323
+ // What the session of the role <r> does not load of the charters: the user's own, by its path, and
324
+ // each module of the common charter the role does not apply, by a pattern that Claude Code matches
325
+ // against the absolute path of each file it loads, an imported one too.
326
+ function chartesExclues(r, home) {
327
+ return [
328
+ path.join(home, '.claude', 'CLAUDE.md'),
329
+ ...MODULES_DE_LA_CHARTE.filter(m => !r.modules.includes(m)).flatMap(m =>
330
+ DOSSIERS_DE_LA_CHARTE.map(d => `**/${d}/charte/${m}.md`)
331
+ ),
332
+ ];
333
+ }
334
+
335
+ // The settings of the session of <role>, for the ticket <ticket>, its copy <copie> (whose
336
+ // language names the test tool, and whose settings may choose the output style) and the main tree
337
+ // <racine>; <home> holds the plugins installed and the settings of the user.
340
338
  function reglagesDuRole(role, { racine, copie = racine, ticket, home }) {
341
339
  const r = ROLES[role];
342
340
  if (!r) {
@@ -346,76 +344,35 @@ function reglagesDuRole(role, { racine, copie = racine, ticket, home }) {
346
344
  if (r.ecrit) {
347
345
  // The test tool run directly (charter, « Aucun agent ne lance l'outil de test directement »),
348
346
  // as the module of the copy's language names it: `npm test` and `npm run verifier` play it.
349
- deny.push(...ECRIRE_PAR_SCRIPT, ...langageDe(copie).droits);
347
+ deny.push(...langageDe(copie).droits);
348
+ }
349
+ if (r.porteSonTicket) {
350
350
  // The ticket its instruction carries, its description, notes and last handover.
351
351
  for (const lecture of ['show', 'comments']) {
352
352
  deny.push(`Bash(bd ${lecture} ${ticket})`, `Bash(bd ${lecture} ${ticket} *)`);
353
353
  }
354
354
  }
355
- const propres = path.join(copie, '.claude', 'skills');
356
- const autres = [
357
- ...INTEGREES,
358
- ...(existsSync(propres)
359
- ? readdirSync(propres, { withFileTypes: true })
360
- .filter(d => d.isDirectory())
361
- .map(d => d.name)
362
- : []),
363
- ];
364
- const reglages = {
355
+ return {
365
356
  permissions: {
366
357
  allow: [...r.commandes, ...lireSaCompetence(role, { racine, copie, home })],
367
358
  deny,
368
359
  },
369
360
  autoMemoryEnabled: false,
370
- claudeMdExcludes: [path.join(home, '.claude', 'CLAUDE.md')],
361
+ claudeMdExcludes: chartesExclues(r, home),
371
362
  disableBundledSkills: true,
372
- skillOverrides: Object.fromEntries(autres.map(s => [s, 'off'])),
373
363
  enabledPlugins: Object.fromEntries(
374
364
  greffonsDuProjet(racine)
375
365
  .filter(g => !g.startsWith(GREFFON_DU_CADRE))
376
366
  .map(g => [g, false])
377
367
  ),
378
- env: ENV_DES_SEANCES,
368
+ env: { ...ENV_DES_SEANCES, ...(r.cacheCinqMinutes ? CINQ_MINUTES_DE_CACHE : {}) },
369
+ attribution: { commit: '', pr: '' },
370
+ ...styleDuPoste({ racine, copie, home }),
379
371
  };
380
- // The write lock runs the frame of the main tree, never the copy's; a copy that is the root keeps
381
- // the project's own command.
382
- const distincte = path.resolve(copie) !== path.resolve(racine);
383
- const cadre = distincte ? racine : '$CLAUDE_PROJECT_DIR';
384
- const commande = `"${cadre}/node_modules/.bin/grillhouse"`;
385
- // Fails closed (a firewall's rule): a missing command makes the shell exit 127, which Claude Code
386
- // reads as an error that does not block, so a copy with a main tree lacking the frame refuses (2).
387
- const verrou = distincte
388
- ? `[ -x ${commande} ] || { echo "⛔ verrou : le cadre de l'arbre principal manque ou n'est pas exécutable : ${cadre}/node_modules/.bin/grillhouse (écriture refusée)" >&2; exit 2; }; exec ${commande} verrou ${role}`
389
- : `${commande} verrou ${role}`;
390
- if (r.ecrit) {
391
- reglages.hooks = {
392
- PreToolUse: [
393
- {
394
- matcher: 'Write|Edit|MultiEdit|NotebookEdit',
395
- hooks: [
396
- {
397
- type: 'command',
398
- command: verrou,
399
- },
400
- ],
401
- },
402
- {
403
- matcher: 'Bash',
404
- hooks: [
405
- {
406
- type: 'command',
407
- command: '"$CLAUDE_PROJECT_DIR/node_modules/.bin/grillhouse" commande',
408
- },
409
- ],
410
- },
411
- ],
412
- };
413
- }
414
- return reglages;
415
372
  }
416
373
 
417
374
  // The options of claude for the session of <role> (the header's list); <home> holds the plugins
418
- // installed.
375
+ // installed and the settings of the user.
419
376
  export function optionsDuRole(role, contexte) {
420
377
  const { racine, home = os.homedir() } = contexte;
421
378
  const r = ROLES[role];
@@ -34,24 +34,13 @@
34
34
  import { existsSync, readFileSync } from 'node:fs';
35
35
  import path from 'node:path';
36
36
  import { arbrePrincipal } from './outils-cles.mjs';
37
+ import { couvertPar } from './paquets.mjs';
38
+
39
+ export { couvertPar };
37
40
 
38
41
  // The lock file `npm ci` installs from, at the root of the tree.
39
42
  const VERROU = 'package-lock.json';
40
43
 
41
- /**
42
- * Whether one of <motifs> covers the file <fichier>, both from the root of the copy, as the inputs
43
- * of Turborepo read them: a path names that file, a directory every file under it, a glob pattern
44
- * (`*`, `**`) the files it matches (`path.matchesGlob` of Node).
45
- * @param {string[]} motifs
46
- * @param {string} fichier
47
- */
48
- export function couvertPar(motifs, fichier) {
49
- return motifs.some(m => {
50
- const dossier = m.replace(/\/+$/, '');
51
- return fichier === dossier || fichier.startsWith(`${dossier}/`) || path.matchesGlob(fichier, m);
52
- });
53
- }
54
-
55
44
  // Whether the pattern <m> leaves the repository: absolute, or climbing above the root.
56
45
  const horsDuDepot = m => path.isAbsolute(m) || path.posix.normalize(m).split('/')[0] === '..';
57
46
 
@@ -0,0 +1,35 @@
1
+ // The standard input of a role session, which both launchers compose here (scripts/seances.mjs
2
+ // out of the envelope, scripts/enveloppe/lancer.sh in it), as claude reads it under
3
+ // `--input-format stream-json`: the `initialize` request, whose `skills` bound the skills the
4
+ // session lists and may load by the tool Skill, then the whole instruction as one message of the
5
+ // user, one line of JSON each. No setting of `--settings` takes a skill of a plugin out of that
6
+ // list; the field `skills` is in the protocol of the Agent SDK, absent from `claude --help`, and
7
+ // the night holds it (packages/grillhouse-essais/tests/competences-de-seance.nuit.spec.ts).
8
+ // Architecture: docs/architecture/machine.md (§3.2).
9
+ //
10
+ // node entree-de-seance.mjs <rôle> < <consigne>
11
+ //
12
+ // writes the input of a session of <rôle> that carries the instruction, with the skills of the role
13
+ // (`competencesDuRole` of scripts/droits.mjs).
14
+ import { randomUUID } from 'node:crypto';
15
+ import { readFileSync } from 'node:fs';
16
+ import { pathToFileURL } from 'node:url';
17
+ import { competencesDuRole } from './droits.mjs';
18
+
19
+ /** The input of a session that lists the skills `competences` and receives `consigne`. */
20
+ export function entreeDeSeance({ competences, consigne }) {
21
+ const messages = [
22
+ {
23
+ type: 'control_request',
24
+ request_id: randomUUID(),
25
+ request: { subtype: 'initialize', skills: competences },
26
+ },
27
+ { type: 'user', message: { role: 'user', content: consigne }, parent_tool_use_id: null },
28
+ ];
29
+ return messages.map(m => `${JSON.stringify(m)}\n`).join('');
30
+ }
31
+
32
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
33
+ const competences = competencesDuRole(process.argv[2]);
34
+ process.stdout.write(entreeDeSeance({ competences, consigne: readFileSync(0, 'utf8') }));
35
+ }