@roomi-fields/grillhouse 0.24.6 → 0.24.8
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.
- package/.claude-plugin/plugin.json +1 -1
- package/charte.md +2 -2
- package/docs/ARCHITECTURE.md +48 -20
- package/package.json +1 -1
- package/scripts/bilan.mjs +89 -52
- package/scripts/circuit.mjs +130 -59
- package/scripts/composants-affectes.mjs +2 -1
- package/scripts/consommateurs.mjs +23 -13
- package/scripts/droits.mjs +51 -12
- package/scripts/elements-du-lot.mjs +1 -1
- package/scripts/enveloppe/lancer.sh +26 -19
- package/scripts/etapes.mjs +3 -3
- package/scripts/greffons.mjs +44 -14
- package/scripts/grillhouse-maj.mjs +87 -3
- package/scripts/migrations/0.24.7-matiere-dans-les-tests.mjs +40 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/resultats.mjs +50 -17
- package/scripts/session-start.sh +2 -2
- package/scripts/turbo-des-paquets.mjs +20 -0
- package/skills/explorateur/SKILL.md +8 -3
- package/skills/grill/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +7 -6
- package/skills/pitmaster/references/consigne-agent.md +4 -4
- package/skills/redacteur/references/documents-d-un-composant.md +3 -1
- package/skills/relecteur/SKILL.md +8 -2
package/scripts/droits.mjs
CHANGED
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
// settings and charter, and the frame's plugin it enables (agents, skills, common charter,
|
|
16
16
|
// hooks), stay in.
|
|
17
17
|
// - `--settings <json>` (the settings of the role, on the command line: no file the session could
|
|
18
|
-
// change): its permissions (`allow`, the commands its skill names
|
|
18
|
+
// change): its permissions (`allow`, the commands its skill names, and the reading of its
|
|
19
|
+
// skill's files, references included, and of the METACADRE.md its skill names, in the frame's
|
|
20
|
+
// plugin as installed for the copy, else for the project, by `Read` and `ls` and with no writing; `deny`, the change of its
|
|
19
21
|
// author at the ticket, AUTEUR_FIXE, for a role that writes the editing by script, the test
|
|
20
22
|
// tool run directly and the reading again of the ticket its instruction carries, and for a role
|
|
21
23
|
// that writes nothing at the ticket, the explorateur and the questionneur, every write of bd,
|
|
@@ -92,6 +94,9 @@ const LIRE_GIT = [
|
|
|
92
94
|
'Bash(git -C * ls-files*)',
|
|
93
95
|
'Bash(git -C * grep*)',
|
|
94
96
|
];
|
|
97
|
+
// The test tool run directly, Vitest or Turborepo that plays it (charter, « Aucun agent ne lance
|
|
98
|
+
// l'outil de test directement »): `npm test` and `npm run verifier` play it with what it depends on.
|
|
99
|
+
// `turbo *` ends on a word, so `npx grillhouse turbo-des-paquets` stays open.
|
|
95
100
|
const TEST_DIRECT = [
|
|
96
101
|
'Bash(vitest*)',
|
|
97
102
|
'Bash(npx vitest*)',
|
|
@@ -99,6 +104,12 @@ const TEST_DIRECT = [
|
|
|
99
104
|
'Bash(npm exec vitest*)',
|
|
100
105
|
'Bash(npm exec * vitest*)',
|
|
101
106
|
'Bash(node_modules/.bin/vitest*)',
|
|
107
|
+
'Bash(turbo *)',
|
|
108
|
+
'Bash(npx turbo *)',
|
|
109
|
+
'Bash(npx * turbo *)',
|
|
110
|
+
'Bash(npm exec turbo *)',
|
|
111
|
+
'Bash(npm exec * turbo *)',
|
|
112
|
+
'Bash(node_modules/.bin/turbo *)',
|
|
102
113
|
];
|
|
103
114
|
// The skills Claude Code keeps listed when its own are off (`disableBundledSkills`), measured on
|
|
104
115
|
// Claude Code 2.1.305.
|
|
@@ -120,12 +131,14 @@ const LIRE = ['Bash', 'Read', 'Skill'];
|
|
|
120
131
|
const ECRIRE = ['Edit', 'Write'];
|
|
121
132
|
|
|
122
133
|
// Each role the circuit launches: whether it writes (files, `ecrit`; the ticket, unless
|
|
123
|
-
// `ecritAuTicket` is false), whether it uses the index,
|
|
124
|
-
//
|
|
134
|
+
// `ecritAuTicket` is false), whether it uses the index, whether its skill names the frame's
|
|
135
|
+
// METACADRE.md (`metacadre`, read at the root of the plugin installed), and the commands its skill
|
|
136
|
+
// names (the frame's plugin, `mods/grillhouse/skills/<rôle>/`), as permission rules.
|
|
125
137
|
export const ROLES = {
|
|
126
138
|
// It writes no file and nothing at the ticket: it surveys the components and reads the code by
|
|
127
139
|
// the index, and ends on the plan in its sheet, which the circuit writes at the ticket.
|
|
128
140
|
explorateur: {
|
|
141
|
+
metacadre: true,
|
|
129
142
|
index: true,
|
|
130
143
|
ecritAuTicket: false,
|
|
131
144
|
commandes: [
|
|
@@ -140,6 +153,7 @@ export const ROLES = {
|
|
|
140
153
|
// It writes the tests of the whole ticket, in the envelope of its plan, and reads the whole copy
|
|
141
154
|
// by the index (charter, « L'index d'abord »).
|
|
142
155
|
testwriter: {
|
|
156
|
+
metacadre: true,
|
|
143
157
|
ecrit: true,
|
|
144
158
|
index: true,
|
|
145
159
|
commandes: [
|
|
@@ -154,6 +168,7 @@ export const ROLES = {
|
|
|
154
168
|
// It writes the code of the whole ticket, in the envelope of its plan, and reads the whole copy
|
|
155
169
|
// by the index.
|
|
156
170
|
developpeur: {
|
|
171
|
+
metacadre: true,
|
|
157
172
|
ecrit: true,
|
|
158
173
|
index: true,
|
|
159
174
|
commandes: [
|
|
@@ -168,6 +183,7 @@ export const ROLES = {
|
|
|
168
183
|
],
|
|
169
184
|
},
|
|
170
185
|
relecteur: {
|
|
186
|
+
metacadre: true,
|
|
171
187
|
index: true,
|
|
172
188
|
commandes: [
|
|
173
189
|
...LIRE_GIT,
|
|
@@ -210,23 +226,43 @@ function greffonsDuProjet(racine) {
|
|
|
210
226
|
return [...actifs].sort();
|
|
211
227
|
}
|
|
212
228
|
|
|
213
|
-
// The installed path of the plugin <nom> for the
|
|
214
|
-
//
|
|
215
|
-
function cheminDuGreffon(nom,
|
|
229
|
+
// The installed path of the plugin <nom> for the projects <projets>: the entry of the first that
|
|
230
|
+
// has one, else the user's.
|
|
231
|
+
function cheminDuGreffon(nom, projets, home) {
|
|
216
232
|
const entrees =
|
|
217
233
|
lireJson(path.join(home, '.claude', 'plugins', 'installed_plugins.json'))?.plugins?.[nom] ?? [];
|
|
218
234
|
const e =
|
|
219
|
-
|
|
235
|
+
projets.map(p => entrees.find(x => x.projectPath === p)).find(Boolean) ??
|
|
236
|
+
entrees.find(x => x.scope === 'user') ??
|
|
237
|
+
null;
|
|
220
238
|
return e?.installPath ?? null;
|
|
221
239
|
}
|
|
222
240
|
|
|
241
|
+
// The reading of the skill of <role> (SKILL.md and its references/) in the frame's plugin, as
|
|
242
|
+
// installed for the copy where the session runs, else for the project, and of the plugin's
|
|
243
|
+
// METACADRE.md alone for a role whose skill names it: rules `Read(//…)`, which let through the
|
|
244
|
+
// tool Read and `ls` of those folders, and write nothing (measured on Claude Code in `dontAsk`).
|
|
245
|
+
// Narrower than a folder of work (`--add-dir`), which would open the whole plugin; none when the
|
|
246
|
+
// plugin is not installed.
|
|
247
|
+
function lireSaCompetence(role, { racine, copie, home }) {
|
|
248
|
+
const cadre = greffonsDuProjet(racine).find(g => g.startsWith(GREFFON_DU_CADRE));
|
|
249
|
+
const dossier = cadre && cheminDuGreffon(cadre, [copie, racine], home);
|
|
250
|
+
if (!dossier) {
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
return [
|
|
254
|
+
`Read(/${path.join(dossier, 'skills', role)}/**)`,
|
|
255
|
+
...(ROLES[role].metacadre ? [`Read(/${path.join(dossier, 'METACADRE.md')})`] : []),
|
|
256
|
+
];
|
|
257
|
+
}
|
|
258
|
+
|
|
223
259
|
// The servers of the index: the project's `.mcp.json`, then the manifests of the plugins it enables.
|
|
224
260
|
function serveursDeLIndex(racine, home) {
|
|
225
261
|
const out = {};
|
|
226
262
|
const projet = lireJson(path.join(racine, '.mcp.json'))?.mcpServers ?? {};
|
|
227
263
|
for (const n of INDEX) if (projet[n]) out[n] = projet[n];
|
|
228
264
|
for (const greffon of greffonsDuProjet(racine)) {
|
|
229
|
-
const dossier = cheminDuGreffon(greffon, racine, home);
|
|
265
|
+
const dossier = cheminDuGreffon(greffon, [racine], home);
|
|
230
266
|
if (!dossier) continue;
|
|
231
267
|
const serveurs =
|
|
232
268
|
lireJson(path.join(dossier, '.claude-plugin', 'plugin.json'))?.mcpServers ??
|
|
@@ -241,8 +277,8 @@ function serveursDeLIndex(racine, home) {
|
|
|
241
277
|
}
|
|
242
278
|
|
|
243
279
|
// The settings of the session of <role>, for the ticket <ticket>, its copy <copie> (where the
|
|
244
|
-
// project's own skills are read) and the main tree <racine
|
|
245
|
-
function reglagesDuRole(role, { racine, copie = racine, ticket }) {
|
|
280
|
+
// project's own skills are read) and the main tree <racine>; <home> holds the plugins installed.
|
|
281
|
+
function reglagesDuRole(role, { racine, copie = racine, ticket, home }) {
|
|
246
282
|
const r = ROLES[role];
|
|
247
283
|
if (!r) throw new Error(`rôle sans droits : ${role}`);
|
|
248
284
|
const deny = [...AUTEUR_FIXE, ...(r.ecritAuTicket === false ? ECRIRE_AU_TICKET : [])];
|
|
@@ -263,7 +299,10 @@ function reglagesDuRole(role, { racine, copie = racine, ticket }) {
|
|
|
263
299
|
: []),
|
|
264
300
|
];
|
|
265
301
|
const reglages = {
|
|
266
|
-
permissions: {
|
|
302
|
+
permissions: {
|
|
303
|
+
allow: [...r.commandes, ...lireSaCompetence(role, { racine, copie, home })],
|
|
304
|
+
deny,
|
|
305
|
+
},
|
|
267
306
|
autoMemoryEnabled: false,
|
|
268
307
|
disableBundledSkills: true,
|
|
269
308
|
skillOverrides: Object.fromEntries(autres.map(s => [s, 'off'])),
|
|
@@ -312,7 +351,7 @@ export function optionsDuRole(role, contexte) {
|
|
|
312
351
|
'--setting-sources',
|
|
313
352
|
'project,local',
|
|
314
353
|
'--settings',
|
|
315
|
-
JSON.stringify(reglagesDuRole(role, contexte)),
|
|
354
|
+
JSON.stringify(reglagesDuRole(role, { ...contexte, home })),
|
|
316
355
|
'--tools',
|
|
317
356
|
outils.join(','),
|
|
318
357
|
'--strict-mcp-config',
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// that no element of its package's sources already names (a type that changed through another),
|
|
22
22
|
// is an element of the report itself, exported.
|
|
23
23
|
// - A changed source that the service does not read (a package without `tsconfig.json`) is named
|
|
24
|
-
// in `horsDuService`: the reviewer surveys its elements himself
|
|
24
|
+
// in `horsDuService`: the reviewer surveys its elements himself, each named `<fichier>#<nom>`.
|
|
25
25
|
import { spawnSync } from 'node:child_process';
|
|
26
26
|
import { existsSync } from 'node:fs';
|
|
27
27
|
import { createRequire } from 'node:module';
|
|
@@ -54,14 +54,19 @@
|
|
|
54
54
|
# agent finds the builds of the packages out of its plan. As Bazel builds the dependencies of a
|
|
55
55
|
# target before the target: for a plan whose every path is a package of the frame (the circuit's
|
|
56
56
|
# session over the whole ticket, `.` as its component and the plan as `--paquets`, or a component
|
|
57
|
-
# alone), their providers are built first (the
|
|
58
|
-
#
|
|
59
|
-
#
|
|
57
|
+
# alone), their providers are built first (the builds their builds wait for, read in Turborepo's
|
|
58
|
+
# graph, `turbo run build --filter=<paquet>… --dry=json`, which node reads on its standard input,
|
|
59
|
+
# whatever its size), and a failure stops the launch, CODE_COPIE;
|
|
60
60
|
# then the traces of other packages their tests wait for (`grillhouse.traces`, read in Turborepo's
|
|
61
61
|
# plan of their tests, `turbo run test:vitest --filter=<paquet>… --dry=json`), which the envelope
|
|
62
|
-
# shows read-only, and a failure stops the launch, CODE_COPIE
|
|
63
|
-
#
|
|
64
|
-
#
|
|
62
|
+
# shows read-only, and a failure stops the launch, CODE_COPIE. A task of either step that waits,
|
|
63
|
+
# directly or not, for a task of a package of the plan (`attendentLePlan` of
|
|
64
|
+
# turbo-des-paquets.mjs) is not played there: as with Bazel's --keep_going, a package of the plan
|
|
65
|
+
# stays a target of the plan even as another's provider (BPScript's 990-corpus, the shared test
|
|
66
|
+
# material, which the trace of 060-encoder waits for), and goes with the plan. Then the packages,
|
|
67
|
+
# the traces of the plan or that wait for it, and what their tests read (`turbo run build <those
|
|
68
|
+
# traces> --filter=<paquet>...… --continue=dependencies-successful`), whose failure does not
|
|
69
|
+
# stop it: each task whose
|
|
65
70
|
# dependencies succeed goes to its end, so what their tests read without depending on them is
|
|
66
71
|
# built whole; the session opens, its instruction ending with a section « La construction de ton
|
|
67
72
|
# paquet échoue » with the end of that output, since repairing it is the session's work (a
|
|
@@ -243,30 +248,32 @@ echec=$(mktemp)
|
|
|
243
248
|
mapfile -t lesNoms <<<"$noms"
|
|
244
249
|
cibles=() lecteurs=()
|
|
245
250
|
for n in "${lesNoms[@]}"; do cibles+=("--filter=$n"); lecteurs+=("--filter=$n..."); done
|
|
246
|
-
# Their providers: the
|
|
251
|
+
# Their providers: the builds their own builds wait for, as Turborepo reads them, save those
|
|
252
|
+
# that wait for a package of the plan, which go with the plan below. The graph comes on the
|
|
253
|
+
# standard input: as an argument, it may pass the size Linux allows one.
|
|
247
254
|
graphe=$(cd "$copie" && monter npx --no-install turbo run build "${cibles[@]}" --dry=json) || exit 1
|
|
248
|
-
|
|
249
|
-
fournisseurs=$(node -e 'const plan = process.argv.slice(1); const t = JSON.parse(require("node:fs").readFileSync(0, "utf8")).tasks.filter(t => !plan.includes(t.package)); console.log([...new Set(t.map(t => `--filter=${t.package}`))].join("\n"));' "${lesNoms[@]}" <<<"$graphe") || exit 1
|
|
255
|
+
fournisseurs=$(node --input-type=module -e "import { readFileSync } from 'node:fs'; import { attendentLePlan } from '$ici/../turbo-des-paquets.mjs'; const g = JSON.parse(readFileSync(0, 'utf8')); const avec = attendentLePlan(g, process.argv.slice(1)); console.log(g.tasks.map(t => t.taskId).filter(id => !avec.has(id)).sort().join('\n'));" "${lesNoms[@]}" <<<"$graphe") || exit 1
|
|
250
256
|
if [ -n "$fournisseurs" ]; then
|
|
251
|
-
mapfile -t
|
|
252
|
-
(cd "$copie" && monter npx --no-install turbo run
|
|
257
|
+
mapfile -t ids <<<"$fournisseurs"
|
|
258
|
+
(cd "$copie" && monter npx --no-install turbo run "${ids[@]}") || exit 1
|
|
253
259
|
fi
|
|
254
260
|
# The traces their tests wait for, as Turborepo's plan of their tests reads them. Another
|
|
255
|
-
# package's trace
|
|
256
|
-
#
|
|
261
|
+
# package's trace that waits for no package of the plan is produced here, and a failure
|
|
262
|
+
# stops the launch, as a provider's; a trace of the plan, or one that waits for a package of
|
|
263
|
+
# the plan, is produced with the plan below.
|
|
257
264
|
plan=$(cd "$copie" && monter npx --no-install turbo run test:vitest "${cibles[@]}" --dry=json) || exit 1
|
|
258
|
-
traces() { node --input-type=module -e "import { readFileSync } from 'node:fs'; import { tracesDuPlan } from '$ici/../turbo-des-paquets.mjs'; const [
|
|
265
|
+
traces() { node --input-type=module -e "import { readFileSync } from 'node:fs'; import { attendentLePlan, tracesDuPlan } from '$ici/../turbo-des-paquets.mjs'; const [avec, ...noms] = process.argv.slice(1); const p = JSON.parse(readFileSync(0, 'utf8')); const attend = attendentLePlan(p, noms); console.log(tracesDuPlan(p, t => attend.has(t.taskId) === (avec === 'oui')).join('\n'));" "$1" "${lesNoms[@]}" <<<"$plan"; }
|
|
259
266
|
autres=$(traces non) || exit 1
|
|
260
267
|
if [ -n "$autres" ]; then
|
|
261
268
|
mapfile -t ids <<<"$autres"
|
|
262
269
|
(cd "$copie" && monter npx --no-install turbo run "${ids[@]}") || exit 1
|
|
263
270
|
fi
|
|
264
|
-
|
|
271
|
+
avec=$(traces oui) || exit 1
|
|
265
272
|
ids=()
|
|
266
|
-
[ -z "$
|
|
267
|
-
# The packages of the plan,
|
|
268
|
-
# material), built after their providers: a failure does not stop the launch, it
|
|
269
|
-
# the instruction. Each task whose dependencies succeed goes to its end
|
|
273
|
+
[ -z "$avec" ] || mapfile -t ids <<<"$avec"
|
|
274
|
+
# The packages of the plan, the traces that go with them, and what their tests read (the
|
|
275
|
+
# shared test material), built after their providers: a failure does not stop the launch, it
|
|
276
|
+
# goes into the instruction. Each task whose dependencies succeed goes to its end
|
|
270
277
|
# (--continue=dependencies-successful): one package's failure does not cancel the build of
|
|
271
278
|
# what the tests read without depending on it, which the envelope shows read-only.
|
|
272
279
|
if ! (cd "$copie" && monter npx --no-install turbo run build ${ids[@]+"${ids[@]}"} "${lecteurs[@]}" --continue=dependencies-successful) > "$echec" 2>&1; then
|
package/scripts/etapes.mjs
CHANGED
|
@@ -197,10 +197,10 @@ export const GESTES = [
|
|
|
197
197
|
{
|
|
198
198
|
genre: 'regeneration',
|
|
199
199
|
geste:
|
|
200
|
-
'à la régénération des références (4.2), puis la passe finale restreinte à ce qu’elle change',
|
|
200
|
+
'à la régénération des références (4.2), puis la passe finale : celle qui est due, après les contrôles ; restreinte à ce qu’elle change, après une passe finale',
|
|
201
201
|
regle:
|
|
202
|
-
'un rouge de la passe finale est celui d’une référence, même mêlé à d’autres : une que le projet déclare (`grillhouse.references`), ou un fichier que le cadre engendre (l’index des interfaces, les turbo.json, les rapports d’API) ; ou la passe abaisse la dette des gardes (`dette.mjs --abaisser`, depuis ses notes)',
|
|
203
|
-
cas: 'BP 320.9 : 292 min autour des références, dont 163 min d’attente pour régénérer à la main l’index des interfaces, le plafond et l’empreinte, des rouges de références mêlés à d’autres',
|
|
202
|
+
'un rouge de la passe finale est celui d’une référence, même mêlé à d’autres, ou les contrôles du plan sont verts hors des rouges de références : une que le projet déclare (`grillhouse.references`), ou un fichier que le cadre engendre (l’index des interfaces, les turbo.json, les rapports d’API) ; ou la passe abaisse la dette des gardes (`dette.mjs --abaisser`, depuis ses notes)',
|
|
203
|
+
cas: 'BP 320.9 : 292 min autour des références, dont 163 min d’attente pour régénérer à la main l’index des interfaces, le plafond et l’empreinte, des rouges de références mêlés à d’autres ; BP 320.3.9 : le plafond rouge aux contrôles, laissé à une passe finale qui rejoue les mêmes tests sur le même arbre (6,1 min)',
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
206
|
genre: 'rien-a-livrer',
|
package/scripts/greffons.mjs
CHANGED
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
// the project's settings stay untouched; the source is `repo` for github, `url` for git and url,
|
|
16
16
|
// `path` for directory and file, any other type is a failure); then each declared plugin not
|
|
17
17
|
// installed for the project is installed by `claude plugin install <id> --scope project`, run
|
|
18
|
-
// from the project's root
|
|
18
|
+
// from the project's root; last, the frame's mod installed for the project at a version behind
|
|
19
|
+
// the package's (see `ecart` below) is updated by `claude plugin update <id> --scope <its
|
|
20
|
+
// scope>`, from the project's root, and read again. `claude` rewrites `.claude/settings.json` in its own key order; once
|
|
19
21
|
// the installs are done, the file holds the keys in the order it had before them (the keys
|
|
20
22
|
// claude added after), and its exact text when the JSON value is the same.
|
|
21
23
|
// - A plugin is installed for the project when `claude plugin list --json` has an entry for it of
|
|
22
24
|
// scope user, or of scope project or local whose `projectPath` is the project's root (both paths
|
|
23
25
|
// resolved); the entry's state (enabled, errors) is not read.
|
|
24
26
|
// - A failure has its line on the error output, naming the plugin and the command that installs it
|
|
25
|
-
// (a failed add: the marketplace's command, then the plugin's
|
|
26
|
-
//
|
|
27
|
+
// (a failed add: the marketplace's command, then the plugin's; a mod left at another version than
|
|
28
|
+
// the package's, after its update or ahead of the package: both versions and the command of its
|
|
29
|
+
// `ecart` line); the others are still tried and the code is 1. A state reading that fails installs nothing. Without `claude`, each plugin has its line.
|
|
27
30
|
// - `--absents` prints `claude` (the command is missing), `greffon <id>` per declared plugin not
|
|
28
31
|
// installed for the project, or `lecture <reason>` when the state cannot be read; each claude
|
|
29
32
|
// call stops after 5 s. It also prints `ecart <id> <mod's version> <package's version>
|
|
@@ -238,7 +241,30 @@ function installer(projet) {
|
|
|
238
241
|
lignes.push(`${id} : l'installation échoue ; lance \`${commandeGreffon(id)}\`.`);
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
|
-
return lignes;
|
|
244
|
+
return [...lignes, ...aligner(racine, d.plugins)];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Brings the frame's mod, installed for the project, to the package's version: behind it, the mod
|
|
248
|
+
// is updated at its scope from the project's root (`claude plugin update`, its source's latest),
|
|
249
|
+
// then read again. Returns the line of a mod that stays at another version, with the command that
|
|
250
|
+
// aligns it (`ecart`); none when the versions agree or compare nothing.
|
|
251
|
+
function aligner(racine, declares) {
|
|
252
|
+
const lecture = lireListe(['plugin', 'list'], undefined);
|
|
253
|
+
const avant = lecture.liste ? ecart(lecture.liste, declares, racine) : null;
|
|
254
|
+
if (!avant) {
|
|
255
|
+
return [];
|
|
256
|
+
}
|
|
257
|
+
let reste = avant;
|
|
258
|
+
if (avant.derriere) {
|
|
259
|
+
const r = claude(['plugin', 'update', avant.id, '--scope', avant.scope], { cwd: racine });
|
|
260
|
+
const relue = r.ok ? lireListe(['plugin', 'list'], undefined) : {};
|
|
261
|
+
reste = relue.liste ? ecart(relue.liste, declares, racine) : avant;
|
|
262
|
+
}
|
|
263
|
+
return reste
|
|
264
|
+
? [
|
|
265
|
+
`${reste.id} : le greffon est en ${reste.greffon}, le paquet ${NOM_DU_PAQUET} en ${reste.paquet} ; lance \`${reste.commande}\`.`,
|
|
266
|
+
]
|
|
267
|
+
: [];
|
|
242
268
|
}
|
|
243
269
|
|
|
244
270
|
/**
|
|
@@ -263,8 +289,11 @@ export function greffonsAbsents(projet) {
|
|
|
263
289
|
return [`lecture ${lecture.erreur}`];
|
|
264
290
|
}
|
|
265
291
|
const absents = d.plugins.filter(id => !installePourLeProjet(lecture.liste, id, racine));
|
|
266
|
-
const
|
|
267
|
-
return [
|
|
292
|
+
const e = ecart(lecture.liste, d.plugins, racine);
|
|
293
|
+
return [
|
|
294
|
+
...absents.map(id => `greffon ${id}`),
|
|
295
|
+
...(e ? [`ecart ${e.id} ${e.greffon} ${e.paquet} ${e.commande}`] : []),
|
|
296
|
+
];
|
|
268
297
|
}
|
|
269
298
|
|
|
270
299
|
// The frame's mod and its package: one version, the `version` of the package.json beside this
|
|
@@ -282,12 +311,12 @@ function versionDuPaquet() {
|
|
|
282
311
|
}
|
|
283
312
|
}
|
|
284
313
|
|
|
285
|
-
// The
|
|
286
|
-
//
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
//
|
|
290
|
-
function
|
|
314
|
+
// The frame's mod, declared and installed for the project (its entry of scope local, else
|
|
315
|
+
// project, else user, as Claude Code applies them), when it carries another version than the
|
|
316
|
+
// package: `{ id, scope, greffon, paquet, derriere, commande }`, the command aligning the one
|
|
317
|
+
// behind (the mod's update at its scope, or the package's install at the mod's version); null
|
|
318
|
+
// otherwise.
|
|
319
|
+
function ecart(entrees, declares, racine) {
|
|
291
320
|
const paquet = versionDuPaquet();
|
|
292
321
|
const id = declares.find(x => x.slice(0, x.indexOf('@')) === GREFFON_DU_CADRE);
|
|
293
322
|
if (!paquet || !id) {
|
|
@@ -301,10 +330,11 @@ function ecartDeVersions(entrees, declares, racine) {
|
|
|
301
330
|
if (typeof greffon !== 'string' || !X_Y_Z.test(greffon) || greffon === paquet) {
|
|
302
331
|
return null;
|
|
303
332
|
}
|
|
304
|
-
const
|
|
333
|
+
const derriere = plusAncienne(greffon, paquet);
|
|
334
|
+
const commande = derriere
|
|
305
335
|
? `claude plugin update ${id} --scope ${entree.scope}`
|
|
306
336
|
: `npm install -D ${NOM_DU_PAQUET}@${greffon}`;
|
|
307
|
-
return
|
|
337
|
+
return { id, scope: entree.scope, greffon, paquet, derriere, commande };
|
|
308
338
|
}
|
|
309
339
|
|
|
310
340
|
// True when version <a> comes before version <b> (x.y.z, numbers compared in order).
|
|
@@ -113,8 +113,10 @@
|
|
|
113
113
|
// the frame's lines of a former version give way to the current ones.
|
|
114
114
|
// - The plugins: after the files, the command line installs the plugins the project's settings
|
|
115
115
|
// declare, for the project, by scripts/greffons.mjs (the mechanism `grillhouse init` also calls;
|
|
116
|
-
// `mettreAJour` itself never calls claude)
|
|
117
|
-
//
|
|
116
|
+
// `mettreAJour` itself never calls claude), and brings the frame's mod to the package's version,
|
|
117
|
+
// as `npm install` brings what is installed to what is declared. A plugin that cannot be
|
|
118
|
+
// installed, or a mod left at another version, has its line naming the command to type; the
|
|
119
|
+
// update has finished its files, and the exit code is non-zero.
|
|
118
120
|
// - The generated files: after the package.json, each generator of the frame is run in the project
|
|
119
121
|
// by the project's command (`node_modules/.bin/grillhouse`, its installed package) for the file
|
|
120
122
|
// it writes when the project holds that file (`grillhouse frontieres --ecrire` for
|
|
@@ -129,6 +131,18 @@
|
|
|
129
131
|
// `npm install` (the frame's package and tools), and the exit code is non-zero. `interfaces-contre-code.mjs` is not
|
|
130
132
|
// run: it writes after a build.
|
|
131
133
|
// - The report names the version of the frame, « Cadre 0.23.0. », the package's.
|
|
134
|
+
// - Last, the update plays the project's verification, `npm run verifier`, from its root, its
|
|
135
|
+
// output shown, as Nx affected moves its base to the last green commit of main: its green keeps
|
|
136
|
+
// the last green (scripts/dernier-vert.mjs), HEAD and the tree of the working tree, the update's
|
|
137
|
+
// changes included, so that once they are committed as they stand, a copy that starts from that
|
|
138
|
+
// commit measures nothing changed (witness: BPScript 320.3.9, whose full pass measured 26 files
|
|
139
|
+
// since main's last green, 11 from the updates 0.24.5 and 0.24.6 committed without one). The
|
|
140
|
+
// update exits with its code (a failure before it, a plugin's, keeps 1), and the report's last
|
|
141
|
+
// line says it: green, the last green kept; red, its code, the last green as it was; 75, « à
|
|
142
|
+
// repasser ». It is not played, the line saying why, when the update leaves its files to finish
|
|
143
|
+
// (a migration's `aFaire`, a generator that fails: on the error stream, the exit code already
|
|
144
|
+
// non-zero), when the project has no `verifier` script, or when the report asks for
|
|
145
|
+
// `npm install` first (a tool or the frame's package newly declared).
|
|
132
146
|
import { spawnSync } from 'node:child_process';
|
|
133
147
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
134
148
|
import { createRequire } from 'node:module';
|
|
@@ -571,6 +585,66 @@ export function rapport(b) {
|
|
|
571
585
|
return lignes.map(l => `${l}\n`).join('');
|
|
572
586
|
}
|
|
573
587
|
|
|
588
|
+
// Whether the bilan <b> of `mettreAJour` asks for `npm install` (a tool or the frame's package
|
|
589
|
+
// newly declared), which the verification needs first.
|
|
590
|
+
const aInstaller = b =>
|
|
591
|
+
b.dependances.length > 0 || b.configVitest !== null || b.dependanceDuCadre !== null;
|
|
592
|
+
|
|
593
|
+
// The project's verification, the last step of the update (see the header): `{ code, ligne,
|
|
594
|
+
// erreur }`, the code of `npm run verifier` (null when it is not played), the line of the report,
|
|
595
|
+
// and whether it goes on the error stream.
|
|
596
|
+
function verifier(projet, { fichiersAFinir, installer, vitest }) {
|
|
597
|
+
const VERT_INTACT = 'le dernier vert reste où il était';
|
|
598
|
+
if (fichiersAFinir) {
|
|
599
|
+
return {
|
|
600
|
+
code: null,
|
|
601
|
+
erreur: true,
|
|
602
|
+
ligne: `Vérification non jouée : la mise à jour laisse à faire ci-dessus ; ${VERT_INTACT}. Fais-le, puis \`npm run verifier\`.`,
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
if (typeof lireJson(path.join(projet, 'package.json'), {})?.scripts?.verifier !== 'string') {
|
|
606
|
+
return {
|
|
607
|
+
code: null,
|
|
608
|
+
erreur: false,
|
|
609
|
+
ligne: `Vérification non jouée : le projet n’a pas de script verifier ; aucun dernier vert n’est posé. ${
|
|
610
|
+
vitest
|
|
611
|
+
? 'La ligne « Vitest : » ci-dessus dit pourquoi : installe à la racine le Vitest que le cadre exige, puis relance `npx grillhouse maj`, qui écrit le script.'
|
|
612
|
+
: 'La mise à jour l’écrit dans un projet testé par Vitest ; sinon, écris-le pour ses tests.'
|
|
613
|
+
}`,
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
if (installer) {
|
|
617
|
+
return {
|
|
618
|
+
code: null,
|
|
619
|
+
erreur: false,
|
|
620
|
+
ligne: `Vérification non jouée : \`npm install\` d’abord, qui installe ce que la mise à jour déclare, puis \`npm run verifier\` ; ${VERT_INTACT}.`,
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
const r = spawnSync('npm', ['run', 'verifier'], { cwd: projet, stdio: 'inherit' });
|
|
624
|
+
const code = r.status ?? 1;
|
|
625
|
+
if (code === 0) {
|
|
626
|
+
return {
|
|
627
|
+
code,
|
|
628
|
+
erreur: false,
|
|
629
|
+
ligne:
|
|
630
|
+
'Vérification : `npm run verifier` vert ; il pose le dernier vert sur l’arbre que laisse la mise à jour. Commite ces changements tels quels : une copie partie de ce commit mesure contre ce vert.',
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
if (code === 75) {
|
|
634
|
+
return {
|
|
635
|
+
code,
|
|
636
|
+
erreur: true,
|
|
637
|
+
ligne: `Vérification : \`npm run verifier\` à repasser (code 75) ; ni vert ni rouge, ${VERT_INTACT}. Relance \`npm run verifier\` plus tard.`,
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
const cause = r.error ? ` (${r.error.message})` : '';
|
|
641
|
+
return {
|
|
642
|
+
code,
|
|
643
|
+
erreur: true,
|
|
644
|
+
ligne: `Vérification : \`npm run verifier\` rouge (code ${code})${cause} ; ${VERT_INTACT}. Ses rouges sont nommés ci-dessus (⛔).`,
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
574
648
|
const USAGE =
|
|
575
649
|
'Usage : npx grillhouse maj met le projet à jour du paquet installé (npm install -D @roomi-fields/grillhouse@<version> d’abord)\n';
|
|
576
650
|
|
|
@@ -597,7 +671,8 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
597
671
|
}
|
|
598
672
|
}
|
|
599
673
|
process.stdout.write(rapport(b));
|
|
600
|
-
|
|
674
|
+
const echecsDesGeneres = regenerer(projet);
|
|
675
|
+
for (const l of [...echecsDesGeneres, ...installerGreffons(projet)]) {
|
|
601
676
|
process.stderr.write(`${l}\n`);
|
|
602
677
|
process.exitCode = 1;
|
|
603
678
|
}
|
|
@@ -606,5 +681,14 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
606
681
|
`Migration ${version} (${nom}), reste au projet :\n${lignes.map(l => `- ${l}\n`).join('')}`
|
|
607
682
|
);
|
|
608
683
|
}
|
|
684
|
+
const v = verifier(projet, {
|
|
685
|
+
fichiersAFinir: resteAFaire || echecsDesGeneres.length > 0,
|
|
686
|
+
installer: aInstaller(b),
|
|
687
|
+
vitest: b.vitest,
|
|
688
|
+
});
|
|
689
|
+
(v.erreur ? process.stderr : process.stdout).write(`${v.ligne}\n`);
|
|
690
|
+
if (v.code !== null && !process.exitCode) {
|
|
691
|
+
process.exitCode = v.code;
|
|
692
|
+
}
|
|
609
693
|
}
|
|
610
694
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// From 0.24.7 the guard of the consumers reads the uses of a package of the shared test material in
|
|
2
|
+
// the tests of its consumers (scripts/consommateurs.mjs, as knip counts test files as entries out
|
|
3
|
+
// of its `--production` mode): the material has only tests for readers, and every name declared
|
|
4
|
+
// for it came out « declared, not used » (BPScript 990-corpus: 176 names, inscribed as debt at
|
|
5
|
+
// 0.24.6). A test that imports a name of the material its interface does not declare is now
|
|
6
|
+
// refused (`usage-non-declare`), as production code is; a project that updates may hold such
|
|
7
|
+
// imports, and its main would turn red at its next pass without a word. As the updates of 0.24.4
|
|
8
|
+
// and 0.24.6 name their findings, the update names these uses, and the command that inscribes them
|
|
9
|
+
// as the project's known debt, once, at the passage of the rule (dette.mjs, as ESLint's
|
|
10
|
+
// `--suppress-all`).
|
|
11
|
+
//
|
|
12
|
+
// - The migration changes no file (`migrer` returns no line): the project decides between the
|
|
13
|
+
// debt and the edit of its interfaces.
|
|
14
|
+
// - What stays to the project (`restes`): one line per use no interface declares, beyond what
|
|
15
|
+
// `grillhouse-dette.json` already inscribes (`juger` of dette.mjs), the guard's message; then the
|
|
16
|
+
// line of the command, `npm run grillhouse:dette:inscrire`. Nothing once the debt holds them, or
|
|
17
|
+
// once each name is declared.
|
|
18
|
+
import { juger, lire } from '../dette.mjs';
|
|
19
|
+
import { verifier } from '../consommateurs.mjs';
|
|
20
|
+
|
|
21
|
+
export const version = '0.24.7';
|
|
22
|
+
export const nom = 'matière de test lue dans les tests';
|
|
23
|
+
|
|
24
|
+
/** The uses no interface declares in the project at <projet>, and the command. */
|
|
25
|
+
export function restes(projet) {
|
|
26
|
+
const constats = verifier(projet).refus.filter(r => r.regle === 'usage-non-declare');
|
|
27
|
+
const { refus } = juger(lire(projet), 'consommateurs', constats);
|
|
28
|
+
if (refus.length === 0) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return [
|
|
32
|
+
...refus.map(r => r.message),
|
|
33
|
+
`la garde des consommateurs lit désormais les usages de la matière de test dans les tests de ses consommateurs, et refuse ces usages non déclarés (${refus.length} en tout) : \`npm run grillhouse:dette:inscrire\` les inscrit dans grillhouse-dette.json, la dette connue du projet, ou chaque nom entre dans sa ligne (- \`consommateur\` : nom, nom)`,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Changes nothing: the uses are reported by `restes`. */
|
|
38
|
+
export function migrer() {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import * as circuitSimplifie from './migrations/0.24.0-circuit-simplifie.mjs';
|
|
|
28
28
|
import * as apiExtractorDuPaquet from './migrations/0.24.2-api-extractor-du-paquet.mjs';
|
|
29
29
|
import * as nomsDeclaresInutilises from './migrations/0.24.4-noms-declares-inutilises.mjs';
|
|
30
30
|
import * as lignesMalFormees from './migrations/0.24.6-lignes-mal-formees.mjs';
|
|
31
|
+
import * as matiereDansLesTests from './migrations/0.24.7-matiere-dans-les-tests.mjs';
|
|
31
32
|
|
|
32
33
|
/** The migrations of the package. */
|
|
33
34
|
export const MIGRATIONS = [
|
|
@@ -40,6 +41,7 @@ export const MIGRATIONS = [
|
|
|
40
41
|
apiExtractorDuPaquet,
|
|
41
42
|
nomsDeclaresInutilises,
|
|
42
43
|
lignesMalFormees,
|
|
44
|
+
matiereDansLesTests,
|
|
43
45
|
];
|
|
44
46
|
|
|
45
47
|
/**
|