@roomi-fields/grillhouse 0.34.1 → 0.35.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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +35 -13
- package/cadre/templates/projet/.claude/settings.json +0 -1
- package/cadre/templates/projet/_gitignore +1 -0
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +4 -4
- package/dist/temporal/circuit/appel.d.ts +2 -0
- package/dist/temporal/circuit/appel.js +12 -0
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/commande.js +10 -1
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/docs/ARCHITECTURE.md +10 -4
- package/docs/INTERFACE.md +4 -3
- package/hooks/crochet.mjs +0 -6
- package/package.json +1 -1
- package/scripts/activites.mjs +41 -7
- package/scripts/adresse-du-registre.mjs +10 -0
- package/scripts/attente-a-l-arret.mjs +2 -2
- package/scripts/attente-au-tour.mjs +2 -2
- package/scripts/bilan.mjs +5 -4
- package/scripts/branche-de-nuit.mjs +15 -6
- package/scripts/circuit.mjs +10 -2
- package/scripts/enveloppe/enveloppe.mjs +44 -14
- package/scripts/enveloppe/lancer.sh +5 -1
- package/scripts/enveloppe/paquets-du-plan.mjs +3 -0
- package/scripts/etapes.mjs +1 -1
- package/scripts/flux-des-paquets.mjs +22 -8
- package/scripts/grillhouse-maj.mjs +19 -0
- package/scripts/langages/cargo/sccache.mjs +22 -16
- package/scripts/langages/typescript/index.mjs +8 -4
- package/scripts/langages/typescript/migrations/0.34.1-cache-des-outils.mjs +53 -0
- package/scripts/langages/typescript/vitest-config/base.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/registre.setup.mjs +35 -0
- package/scripts/mesure/base-de-passe.mjs +7 -0
- package/scripts/migrations/0.35.0-greffon-mattpocock-retire.mjs +41 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/places-du-serveur.mjs +12 -2
- package/scripts/registre.mjs +3 -3
- package/scripts/reponses-du-circuit.mjs +1 -1
- package/scripts/seances.mjs +24 -2
- package/scripts/superviseur.mjs +29 -11
- package/scripts/tableau.mjs +90 -11
- package/scripts/verrous/verrou.mjs +7 -0
- package/skills/codebase-design/DEEPENING.md +37 -0
- package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/skills/codebase-design/SKILL.md +114 -0
- package/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/grill/SKILL.md +4 -5
- package/skills/grilling/SKILL.md +30 -0
- package/skills/pitmaster/SKILL.md +4 -3
- package/skills/pitmaster/references/cadre.md +1 -1
- package/skills/redacteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +7 -4
- package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/skills/writing-for-agents/SKILL.md +81 -0
|
@@ -52,19 +52,28 @@ export function refusSurMain(remote, refs, { principale, ecoute, jugee }) {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Whether one of the runs <runs> of a commit (`gh run list --json headBranch,conclusion`)
|
|
57
|
+
* concluded green on a ticket branch. The conclusion is read run by run: the status filter of
|
|
58
|
+
* GitHub's API lags its runs by minutes (grillhouse-do5e).
|
|
59
|
+
* @param {{ headBranch?: string, conclusion?: string }[]} runs
|
|
60
|
+
*/
|
|
61
|
+
export const jugeeDansLesRuns = runs =>
|
|
62
|
+
runs.some(x => x.conclusion === 'success' && String(x.headBranch).startsWith('agent/'));
|
|
63
|
+
|
|
55
64
|
// Whether a run of the CI concluded green on the commit <sha> on a ticket branch, read by gh in
|
|
56
65
|
// <racine>; true when gh does not answer (the server's ruleset judges then).
|
|
57
66
|
function jugeeParGh(racine, sha) {
|
|
58
|
-
const r = spawnSync(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
67
|
+
const r = spawnSync('gh', ['run', 'list', '--commit', sha, '--json', 'headBranch,conclusion'], {
|
|
68
|
+
cwd: racine,
|
|
69
|
+
encoding: 'utf8',
|
|
70
|
+
timeout: 30_000,
|
|
71
|
+
});
|
|
63
72
|
if (r.status !== 0) {
|
|
64
73
|
return true;
|
|
65
74
|
}
|
|
66
75
|
try {
|
|
67
|
-
return JSON.parse(r.stdout || '[]')
|
|
76
|
+
return jugeeDansLesRuns(JSON.parse(r.stdout || '[]'));
|
|
68
77
|
} catch {
|
|
69
78
|
return true;
|
|
70
79
|
}
|
package/scripts/circuit.mjs
CHANGED
|
@@ -1543,7 +1543,8 @@ export function arretDe(ctx, a) {
|
|
|
1543
1543
|
// rule settles: its question (`{ arret, fait, piece, question, qui }`: the fact, the first line of
|
|
1544
1544
|
// its motive or its report; its piece, the one it carries, else its reds with their file and line,
|
|
1545
1545
|
// else the end of the log; the question of its kind, scripts/etapes.mjs MONTEES, after the agent's
|
|
1546
|
-
// own
|
|
1546
|
+
// own, or the agent's alone for a hors-plan stop, MONTEES' text its fallback when the stop carries
|
|
1547
|
+
// none; who must answer it) kept in the state, written at the ticket and on the error output. Its
|
|
1547
1548
|
// exit code.
|
|
1548
1549
|
export function monter(ctx, a) {
|
|
1549
1550
|
const m = monteeDe(a.nom);
|
|
@@ -1555,7 +1556,14 @@ export function monter(ctx, a) {
|
|
|
1555
1556
|
String(a.piece ?? '').trim() ||
|
|
1556
1557
|
rouges ||
|
|
1557
1558
|
`Le journal du ticket, ${ctx.journal} (il se cite en pièce, \`${ctx.ticket}.log:<ligne>\`) :\n${fin(lire(ctx.journal), 20)}`;
|
|
1558
|
-
|
|
1559
|
+
// A hors-plan stop carries its own question (the exact command for its path, or the refusal
|
|
1560
|
+
// alone for the repository root): the generic one would offer `--etendre` for any path.
|
|
1561
|
+
const question =
|
|
1562
|
+
a.question && a.nom === 'hors-plan'
|
|
1563
|
+
? a.question
|
|
1564
|
+
: a.question
|
|
1565
|
+
? `${a.question}\n\n${m.question}`
|
|
1566
|
+
: m.question;
|
|
1559
1567
|
const qui = a.qui ?? m.qui;
|
|
1560
1568
|
ecrireEtat(ctx, {
|
|
1561
1569
|
...a.etat,
|
|
@@ -150,6 +150,33 @@ const sortiesDe = (dir, sorties, lien = () => null) =>
|
|
|
150
150
|
});
|
|
151
151
|
})
|
|
152
152
|
.map(s => path.join(dir, s));
|
|
153
|
+
// The packages of the copy that the plan <paquets> does not name and that are not the shared test
|
|
154
|
+
// material, relative to the copy: where the envelope opens an empty own output to each run. The
|
|
155
|
+
// root package is the copy's own root, treated apart.
|
|
156
|
+
const paquetsHorsDuPlan = (paquets, paquetsDeLaCopie, matieres) => {
|
|
157
|
+
const ecrits = ecritsDuPlan(paquets, paquetsDeLaCopie);
|
|
158
|
+
return paquetsDeLaCopie
|
|
159
|
+
.map(p => p.dossier)
|
|
160
|
+
.filter(d => d !== '.' && !ecrits.includes(d) && !matieres.includes(d));
|
|
161
|
+
};
|
|
162
|
+
// Creates, in the writable copy and before anything is mounted, the own outputs of the language
|
|
163
|
+
// that are missing: in each package out of the plan, in the shared test material for a role that
|
|
164
|
+
// does not write it, and at the root of the copy when the plan does not write it. An output that a
|
|
165
|
+
// link carries out of the copy is left out. bwrap then has a directory to mount an empty one over.
|
|
166
|
+
export function preparerLesSorties({ copie, paquets, paquetsDeLaCopie, matieres, role, sorties }) {
|
|
167
|
+
const dossiers = paquetsHorsDuPlan(paquets, paquetsDeLaCopie, matieres);
|
|
168
|
+
if (role !== ROLE_MATIERE) {
|
|
169
|
+
dossiers.push(...matieres);
|
|
170
|
+
}
|
|
171
|
+
if (!ecritsDuPlan(paquets, paquetsDeLaCopie).includes('.')) {
|
|
172
|
+
dossiers.push('.');
|
|
173
|
+
}
|
|
174
|
+
for (const d of dossiers) {
|
|
175
|
+
for (const s of sortiesDe(path.join(copie, d), sorties.propres, lienSurDisque)) {
|
|
176
|
+
mkdirSync(s, { recursive: true });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
153
180
|
// The machine's temporary directory: an empty one, proper to the session, replaces it.
|
|
154
181
|
const TEMPORAIRE = '/tmp';
|
|
155
182
|
// What stays read-only inside `~/.claude`: the configuration and what it loads.
|
|
@@ -656,6 +683,17 @@ export function plan(
|
|
|
656
683
|
}
|
|
657
684
|
}
|
|
658
685
|
}
|
|
686
|
+
// Each package out of the plan has its own outputs as empty directories proper to the session,
|
|
687
|
+
// as a sandbox of Bazel opens the declared outputs whatever the package; the rest stays read-only.
|
|
688
|
+
if (!toute) {
|
|
689
|
+
for (const d of paquetsHorsDuPlan(paquets, paquetsDeLaCopie, matieres)) {
|
|
690
|
+
for (const s of sortiesDe(path.join(copie, d), sorties.propres, fs.lien)) {
|
|
691
|
+
if (fs.existe(s)) {
|
|
692
|
+
args.push('--tmpfs', s);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
659
697
|
const gitDeLaCopie = path.join(copie, '.git');
|
|
660
698
|
if (fs.existe(gitDeLaCopie)) {
|
|
661
699
|
args.push('--ro-bind', gitDeLaCopie, gitDeLaCopie);
|
|
@@ -824,22 +862,14 @@ function envelopper(argv) {
|
|
|
824
862
|
maison: os.homedir(),
|
|
825
863
|
principal: path.dirname(commun),
|
|
826
864
|
});
|
|
827
|
-
//
|
|
828
|
-
//
|
|
829
|
-
|
|
830
|
-
for (const m of matieres) {
|
|
831
|
-
for (const s of sortiesDe(path.join(copie, m), sorties.propres, lienSurDisque)) {
|
|
832
|
-
mkdirSync(s, { recursive: true });
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
// For a plan that leaves the root read-only, where the language's tools write at the root of the
|
|
837
|
-
// copy is created here, so that bwrap mounts it, empty or in writing, inside the read-only copy.
|
|
865
|
+
// The own outputs of the language are created here, while the copy is writable, so that bwrap
|
|
866
|
+
// mounts an empty one over each inside the read-only copy: at its root, in the packages out of
|
|
867
|
+
// the plan, and in the material for a role that does not write it.
|
|
838
868
|
const paquetsDeLaCopie = paquetsDuLangage(langage, copie);
|
|
869
|
+
preparerLesSorties({ copie, paquets, paquetsDeLaCopie, matieres, role, sorties });
|
|
870
|
+
// For a plan that leaves the root read-only, where the language's tools write at the root of the
|
|
871
|
+
// copy is created here, so that bwrap mounts it in writing, inside the read-only copy.
|
|
839
872
|
if (!ecritsDuPlan(paquets, paquetsDeLaCopie).includes('.')) {
|
|
840
|
-
for (const s of sortiesDe(copie, sorties.propres, lienSurDisque)) {
|
|
841
|
-
mkdirSync(s, { recursive: true });
|
|
842
|
-
}
|
|
843
873
|
for (const s of sortiesDe(copie, sorties.ecrites, lienSurDisque)) {
|
|
844
874
|
creer(s, fichiers.includes(path.relative(copie, s)));
|
|
845
875
|
}
|
|
@@ -182,8 +182,9 @@ rang="$copie.travail/seances/${seance:-${reprise:-courante}}"
|
|
|
182
182
|
fin="$rang/fin"
|
|
183
183
|
resultat="$rang/resultat.json"
|
|
184
184
|
hors_plan="$rang/hors-plan"
|
|
185
|
+
hors_plan_fait="$rang/hors-plan.json"
|
|
185
186
|
mkdir -p "$(dirname "$copie")" "$rang"
|
|
186
|
-
rm -f "$fin" "$resultat" "$hors_plan"
|
|
187
|
+
rm -f "$fin" "$resultat" "$hors_plan" "$hors_plan_fait"
|
|
187
188
|
printf '=== %s · %s · %s ===\n' "$(date -Iseconds)" "$role" "$composant" >> "$journal"
|
|
188
189
|
# The temporary directory of the ticket (`ouvrirBaseDuTicket`, scripts/mesure/base-de-passe.mjs):
|
|
189
190
|
# TMPDIR, TMP and TEMP of the rest of the launch and of the session, whose scratchpads and working
|
|
@@ -293,6 +294,9 @@ if [ -f "$travail/hors-plan" ]; then
|
|
|
293
294
|
mv "$travail/hors-plan" "$hors_plan"
|
|
294
295
|
{ cat "$hors_plan"; echo; } >> "$journal"
|
|
295
296
|
fi
|
|
297
|
+
if [ -f "$travail/hors-plan.json" ]; then
|
|
298
|
+
mv "$travail/hors-plan.json" "$hors_plan_fait"
|
|
299
|
+
fi
|
|
296
300
|
echo "$code" > "$fin"
|
|
297
301
|
# The envelope ended: the session's line goes to the register from outside it, whatever its end hook did.
|
|
298
302
|
node "$ici/../registre.mjs" --copie "$copie" >> "$journal" 2>&1 || true
|
|
@@ -15,6 +15,9 @@ export const VARIABLE = 'GRILLHOUSE_ENVELOPPE';
|
|
|
15
15
|
// write out of the plan (scripts/verrous/verrou.mjs); the launcher hands it to the circuit in the
|
|
16
16
|
// session's result folder, `<copie>.travail/seances/<id>/hors-plan` (scripts/enveloppe/lancer.sh).
|
|
17
17
|
export const MARQUE_HORS_PLAN = 'hors-plan';
|
|
18
|
+
// Its structured twin, `{ chemin, paquet, racine }` in JSON: the path written, the package that
|
|
19
|
+
// holds it (`.` for the repository root), whether the root holds it. The circuit reads it, not the text.
|
|
20
|
+
export const MARQUE_HORS_PLAN_FAIT = 'hors-plan.json';
|
|
18
21
|
|
|
19
22
|
// The list <paquets> as the variable carries it.
|
|
20
23
|
export const ecrireLaListe = paquets => paquets.join(path.delimiter);
|
package/scripts/etapes.mjs
CHANGED
|
@@ -254,7 +254,7 @@ export const RESPONSABLE = 'responsable';
|
|
|
254
254
|
// The commands by which the supervisor answers a question (scripts/circuit.mjs): resume, extend
|
|
255
255
|
// the plan, stop.
|
|
256
256
|
const REPONSES =
|
|
257
|
-
'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), ou `--arreter`.';
|
|
257
|
+
'Le superviseur répond par une commande du circuit : `--reprendre` (avec `--contexte`) ou `--depuis <testwriter|developpeur>` (avec `--contexte`), `--etendre <paquet>` (le plan gagne ce paquet, puis l’étape en cours reprend), `--reporter <heure>` (la question se tait jusqu’à l’heure, le circuit en attente), ou `--arreter`.';
|
|
258
258
|
|
|
259
259
|
// The question of each stop no gesture settles, as a CI calls a person only for what no rule
|
|
260
260
|
// settles (the approval of a review): every stop of ARRETS, « a-repasser » once the circuit has
|
|
@@ -110,6 +110,23 @@ function fichiersDeFlux(racine) {
|
|
|
110
110
|
.sort();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* The workflow files of the project at <racine> (.yml, .yaml under .github/workflows) that
|
|
115
|
+
* `grillhouse.flux` of its package.json does not declare, sorted; nothing else (not a declared
|
|
116
|
+
* file that is absent, not an unknown package), and none when the key is faulty. The guard and the
|
|
117
|
+
* update (`grillhouse maj`) read the flows without entry through it.
|
|
118
|
+
* @param {string} racine the root of the project
|
|
119
|
+
* @returns {string[]}
|
|
120
|
+
*/
|
|
121
|
+
export function fluxSansEntree(racine) {
|
|
122
|
+
const { flux, fautes } = lireFlux(lireJson(path.join(racine, 'package.json')));
|
|
123
|
+
if (fautes.length) {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
const declares = new Set(flux.map(f => f.fichier));
|
|
127
|
+
return fichiersDeFlux(racine).filter(f => !declares.has(f));
|
|
128
|
+
}
|
|
129
|
+
|
|
113
130
|
/**
|
|
114
131
|
* The findings of the guard on the project at <racine>: `{ fichier, message }`, none when each
|
|
115
132
|
* workflow is declared with packages the graph carries.
|
|
@@ -123,14 +140,11 @@ export function constats(racine) {
|
|
|
123
140
|
return out;
|
|
124
141
|
}
|
|
125
142
|
const connus = new Set(paquets(racine).map(p => p.pkg.name));
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
message: `${f} : flux de la CI sans entrée dans ${CLE} du package.json ; chaque flux déclare les paquets qu'il exerce, le relecteur le lit.`,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
143
|
+
for (const f of fluxSansEntree(racine)) {
|
|
144
|
+
out.push({
|
|
145
|
+
fichier: f,
|
|
146
|
+
message: `${f} : flux de la CI sans entrée dans ${CLE} du package.json ; chaque flux déclare les paquets qu'il exerce, le relecteur le lit.`,
|
|
147
|
+
});
|
|
134
148
|
}
|
|
135
149
|
for (const { fichier, paquets: noms } of flux) {
|
|
136
150
|
if (!existsSync(path.join(racine, fichier))) {
|
|
@@ -151,6 +151,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
151
151
|
import { CADRE, VERSION } from './cadre.mjs';
|
|
152
152
|
import { poserCrochets } from './crochets.mjs';
|
|
153
153
|
import { ATTRIBUT } from './fusion-du-changelog.mjs';
|
|
154
|
+
import { fluxSansEntree } from './flux-des-paquets.mjs';
|
|
154
155
|
import { installerGreffons } from './greffons.mjs';
|
|
155
156
|
import { migrer, restesAuProjet } from './migrations.mjs';
|
|
156
157
|
import { langageDe, langagesDe } from './langages.mjs';
|
|
@@ -329,6 +330,8 @@ export function mettreAJour(projet, source, { inscrite = VERSION } = {}) {
|
|
|
329
330
|
ligneEtat: false,
|
|
330
331
|
greffon: false,
|
|
331
332
|
workflows: [],
|
|
333
|
+
fluxSansEntree: [],
|
|
334
|
+
fluxDeclares: {},
|
|
332
335
|
duLangage: { lignes: [], aFaire: [], installer: false, sansVerifier: null },
|
|
333
336
|
};
|
|
334
337
|
const pkg = path.join(projet, 'package.json');
|
|
@@ -433,6 +436,10 @@ export function mettreAJour(projet, source, { inscrite = VERSION } = {}) {
|
|
|
433
436
|
};
|
|
434
437
|
}
|
|
435
438
|
writeFileSync(pkg, `${JSON.stringify(p, null, 2)}\n`);
|
|
439
|
+
// The flows of the CI without entry in `grillhouse.flux` (the guard's read), with the entries
|
|
440
|
+
// already declared, which the command of the report keeps.
|
|
441
|
+
bilan.fluxSansEntree = fluxSansEntree(projet);
|
|
442
|
+
bilan.fluxDeclares = bilan.fluxSansEntree.length > 0 ? (p.grillhouse?.flux ?? {}) : {};
|
|
436
443
|
ignorer(projet);
|
|
437
444
|
}
|
|
438
445
|
bilan.ligneEtat = reglerLigneEtat(projet);
|
|
@@ -558,6 +565,18 @@ export function rapport(b) {
|
|
|
558
565
|
`Workflows du cadre : ${b.workflows.join(', ')} écrit(s) depuis le gabarit ; leur machine est la variable RUNNER du dépôt sur GitHub (ubuntu-latest sans elle), que la mise à jour ne touche pas.`
|
|
559
566
|
);
|
|
560
567
|
}
|
|
568
|
+
if (b.fluxSansEntree?.length > 0) {
|
|
569
|
+
// The whole object: the declared entries as they are, each missing flow with a name the graph
|
|
570
|
+
// does not know, so the guard stays red until the project names the package the flow exercises.
|
|
571
|
+
const objet = { ...b.fluxDeclares };
|
|
572
|
+
for (const f of b.fluxSansEntree) {
|
|
573
|
+
objet[f] = ['<paquet>'];
|
|
574
|
+
}
|
|
575
|
+
const json = JSON.stringify(objet).replaceAll("'", "'\\''");
|
|
576
|
+
lignes.push(
|
|
577
|
+
`Flux de la CI sans entrée dans grillhouse.flux : ${b.fluxSansEntree.join(', ')}. Déclare les paquets que chacun exerce : \`npm pkg set --json grillhouse.flux='${json}'\`, puis remplace chaque <paquet> par le nom du paquet que le flux exerce (la garde flux-des-paquets reste rouge d'ici là).`
|
|
578
|
+
);
|
|
579
|
+
}
|
|
561
580
|
if (b.gardes?.deplace) {
|
|
562
581
|
lignes.push(
|
|
563
582
|
`Gardes du projet : le script integration:gardes devient gardes, que \`npm run verifier\` joue à côté des tests.`
|
|
@@ -23,16 +23,20 @@
|
|
|
23
23
|
// Every command of the module that compiles (tests, verification, typing, clippy) runs cargo
|
|
24
24
|
// under this environment, in a copy as in an agent's envelope.
|
|
25
25
|
//
|
|
26
|
-
// - One server per copy and per namespace of processes: by default the
|
|
27
|
-
// on 127.0.0.1:4226 (README of v0.19.0), one for the whole machine, and
|
|
28
|
-
// network, so that a server born in one agent's envelope would serve
|
|
29
|
-
// outside would compile for an agent out of his envelope. Each run
|
|
30
|
-
// (`SCCACHE_SERVER_UDS`), an abstract unix socket (the README's
|
|
31
|
-
// the copy
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
26
|
+
// - One server per copy, per temporary directory and per namespace of processes: by default the
|
|
27
|
+
// server of sccache listens on 127.0.0.1:4226 (README of v0.19.0), one for the whole machine, and
|
|
28
|
+
// the envelope shares the network, so that a server born in one agent's envelope would serve
|
|
29
|
+
// another copy, and one born outside would compile for an agent out of his envelope. Each run
|
|
30
|
+
// names its server's socket (`SCCACHE_SERVER_UDS`), an abstract unix socket (the README's
|
|
31
|
+
// `\x00<name>` form), named after the copy, the temporary directory of the run (TMPDIR) and the
|
|
32
|
+
// namespace of processes it runs in (`/proc/self/ns/pid`), which each envelope creates
|
|
33
|
+
// (`--unshare-pid`): the two sides of an envelope, and two envelopes of one copy, never share a
|
|
34
|
+
// server, whatever the environment says. An abstract socket writes no file, so that neither the
|
|
35
|
+
// read-only copy nor the 108 bytes of a socket's path bind it, and it goes with its server,
|
|
36
|
+
// leaving no stale file. A server cargo starts keeps the temporary directory of its run, where it
|
|
37
|
+
// writes as it compiles, and outlives it (its idle time): a pass, whose temporary directory goes
|
|
38
|
+
// at its end, never joins the server of another (SyntHub, grillhouse-67dz). The disk cache stays
|
|
39
|
+
// common.
|
|
36
40
|
// - The server starts before each run of cargo that compiles, under the machine's `/tmp`
|
|
37
41
|
// (`demarrerLeServeur`): sccache 0.19.0 starts its server by binding a socket of a path under
|
|
38
42
|
// TMPDIR (`<TMPDIR>/sccacheXXXXXX/sock`, src/commands.rs, `run_server_process`), which fails
|
|
@@ -51,7 +55,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
51
55
|
import { createHash } from 'node:crypto';
|
|
52
56
|
import { readFileSync, readlinkSync, realpathSync } from 'node:fs';
|
|
53
57
|
import { createRequire } from 'node:module';
|
|
54
|
-
import { homedir } from 'node:os';
|
|
58
|
+
import { homedir, tmpdir } from 'node:os';
|
|
55
59
|
import path from 'node:path';
|
|
56
60
|
import {
|
|
57
61
|
cacheDeCompilation,
|
|
@@ -122,14 +126,16 @@ const reel = p => {
|
|
|
122
126
|
};
|
|
123
127
|
|
|
124
128
|
/**
|
|
125
|
-
* The socket of the server of sccache for the copy at <racine
|
|
126
|
-
* <espace>: an abstract unix socket, named after
|
|
129
|
+
* The socket of the server of sccache for the copy at <racine>, the temporary directory
|
|
130
|
+
* <temporaire> and the namespace of processes <espace>: an abstract unix socket, named after the
|
|
131
|
+
* three.
|
|
127
132
|
* @param {string} racine
|
|
133
|
+
* @param {string} temporaire the temporary directory of the run (its TMPDIR)
|
|
128
134
|
* @param {string} [espace] this process's namespace by default
|
|
129
135
|
*/
|
|
130
|
-
export function socketDuServeur(racine, espace = espaceDesProcessus()) {
|
|
136
|
+
export function socketDuServeur(racine, temporaire, espace = espaceDesProcessus()) {
|
|
131
137
|
const empreinte = createHash('sha256')
|
|
132
|
-
.update(`${reel(racine)}\0${espace}`)
|
|
138
|
+
.update(`${reel(racine)}\0${reel(temporaire)}\0${espace}`)
|
|
133
139
|
.digest('hex');
|
|
134
140
|
return `\\x00grillhouse-sccache-${empreinte.slice(0, 16)}`;
|
|
135
141
|
}
|
|
@@ -244,6 +250,6 @@ export function avecSccache(racine, env) {
|
|
|
244
250
|
...cible,
|
|
245
251
|
RUSTC_WRAPPER: 'sccache',
|
|
246
252
|
SCCACHE_DIR: cacheDeCompilation('sccache', env),
|
|
247
|
-
SCCACHE_SERVER_UDS: socketDuServeur(racine),
|
|
253
|
+
SCCACHE_SERVER_UDS: socketDuServeur(racine, env.TMPDIR || tmpdir()),
|
|
248
254
|
};
|
|
249
255
|
}
|
|
@@ -72,6 +72,7 @@ import * as prefixeDesTickets from './migrations/0.30.0-prefixe-des-tickets.mjs'
|
|
|
72
72
|
import * as titresNommantUnTicket from './migrations/0.30.0-titres-nommant-un-ticket.mjs';
|
|
73
73
|
import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
|
|
74
74
|
import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
|
|
75
|
+
import * as cacheDesOutils from './migrations/0.34.1-cache-des-outils.mjs';
|
|
75
76
|
|
|
76
77
|
// The scripts of this module, beside this file.
|
|
77
78
|
const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -208,16 +209,18 @@ export default {
|
|
|
208
209
|
// No program the installer of Temporal looks for: Node is a tool of the account.
|
|
209
210
|
executables: [],
|
|
210
211
|
// What its tools write in a project: Turborepo's runs and cache, and Vitest's reports of the
|
|
211
|
-
// tranches of a pass (./tranches.mjs)
|
|
212
|
-
|
|
212
|
+
// tranches of a pass (./tranches.mjs), and the cache of the lint and of the format check of the
|
|
213
|
+
// project (`.cache-outils/`).
|
|
214
|
+
ignorer: ['.turbo', '.vitest-reports', '.cache-outils'],
|
|
213
215
|
// Where its tools write: the cache of Turborepo in the main tree, shared by every copy, written;
|
|
214
216
|
// the logs of Turborepo's tasks (`.turbo/turbo-<task>.log`, written on every run, a task replayed
|
|
215
217
|
// from its cache included, and which no option of Turborepo sends elsewhere) and the cache of
|
|
216
218
|
// Vite, where Vitest writes the results of a run (`node_modules/.vite/vitest/`) and whose failure
|
|
217
|
-
// fails it, proper to the session
|
|
219
|
+
// fails it, proper to the session; and the cache of ESLint and Prettier (`.cache-outils/`),
|
|
220
|
+
// proper to the session too, an empty one costing a whole reading, as without a cache.
|
|
218
221
|
sorties: {
|
|
219
222
|
ecrites: ['//.turbo/cache/'],
|
|
220
|
-
propres: ['.turbo', 'node_modules/.vite'],
|
|
223
|
+
propres: ['.turbo', 'node_modules/.vite', '.cache-outils'],
|
|
221
224
|
lues: [],
|
|
222
225
|
},
|
|
223
226
|
// The test tool run directly, Vitest or Turborepo that plays it: `npm test` and `npm run
|
|
@@ -350,6 +353,7 @@ export default {
|
|
|
350
353
|
titresNommantUnTicket,
|
|
351
354
|
binaireDeJour,
|
|
352
355
|
testsDuPoste,
|
|
356
|
+
cacheDesOutils,
|
|
353
357
|
],
|
|
354
358
|
miseAJour: miseAJour(joueDesTests),
|
|
355
359
|
squelette,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// From 0.34.1 the cache of the lint and of the format check lives under `.cache-outils/`, a clean
|
|
2
|
+
// output of the module typescript, no longer under `node_modules/.cache/`: a session's envelope
|
|
3
|
+
// mounts `/` read-only and the `node_modules` of a copy is a link out of it, so ESLint and
|
|
4
|
+
// Prettier failed to write their cache there (EROFS). The migration moves it in a project.
|
|
5
|
+
//
|
|
6
|
+
// - In the `lint` and `format:check` scripts of `package.json`, the former path
|
|
7
|
+
// (`node_modules/.cache/`) is replaced by the new one (`.cache-outils/`), wherever it falls;
|
|
8
|
+
// every other byte of the file stays, and every other script is left.
|
|
9
|
+
// - One line per script rewritten; a project without `package.json`, or whose scripts lack the
|
|
10
|
+
// former path, is left, nothing said.
|
|
11
|
+
// - Replayable without effect: once moved, nothing.
|
|
12
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
|
|
15
|
+
export const version = '0.34.1';
|
|
16
|
+
export const nom = 'cache des outils';
|
|
17
|
+
|
|
18
|
+
const ANCIEN = 'node_modules/.cache/';
|
|
19
|
+
const NOUVEAU = '.cache-outils/';
|
|
20
|
+
const SCRIPTS = ['lint', 'format:check'];
|
|
21
|
+
|
|
22
|
+
/** Moves the cache path of the `lint` and `format:check` scripts of <projet>; returns its lines. */
|
|
23
|
+
export function migrer(projet) {
|
|
24
|
+
const fichier = path.join(projet, 'package.json');
|
|
25
|
+
if (!existsSync(fichier)) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
let texte = readFileSync(fichier, 'utf8');
|
|
29
|
+
const debut = texte.indexOf('"scripts"');
|
|
30
|
+
if (debut === -1) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const lignes = [];
|
|
34
|
+
for (const script of SCRIPTS) {
|
|
35
|
+
const motif = new RegExp(`("${script}"\\s*:\\s*")((?:[^"\\\\]|\\\\.)*)(")`);
|
|
36
|
+
const trouve = motif.exec(texte.slice(debut));
|
|
37
|
+
if (!trouve || !trouve[2].includes(ANCIEN)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const place = debut + trouve.index + trouve[1].length;
|
|
41
|
+
texte =
|
|
42
|
+
texte.slice(0, place) +
|
|
43
|
+
trouve[2].replaceAll(ANCIEN, NOUVEAU) +
|
|
44
|
+
texte.slice(place + trouve[2].length);
|
|
45
|
+
lignes.push(
|
|
46
|
+
`package.json : le cache du script ${script} passe de ${ANCIEN} à ${NOUVEAU}, une sortie propre de la séance`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
if (lignes.length > 0) {
|
|
50
|
+
writeFileSync(fichier, texte);
|
|
51
|
+
}
|
|
52
|
+
return lignes;
|
|
53
|
+
}
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
// scripts/mesure/avancement.mjs), the reporter of progress writes there the files done and planned of its
|
|
66
66
|
// task at each test file done, which the board reads (scripts/avancement.mjs,
|
|
67
67
|
// scripts/tableau.mjs).
|
|
68
|
+
import { readdirSync, rmSync } from 'node:fs';
|
|
69
|
+
import path from 'node:path';
|
|
68
70
|
import { fileURLToPath } from 'node:url';
|
|
69
71
|
import {
|
|
70
72
|
ligneDesRestes,
|
|
@@ -120,6 +122,13 @@ function baseDeVitest() {
|
|
|
120
122
|
Object.assign(process.env, b.env);
|
|
121
123
|
retirerALInterruption(b.fermer);
|
|
122
124
|
process.on('exit', () => {
|
|
125
|
+
// The registers of the test files (registre.setup.mjs): a file whose tests are all skipped
|
|
126
|
+
// runs no `afterAll`, so its register directory goes with the base, not as a rest.
|
|
127
|
+
for (const n of readdirSync(b.dossier)) {
|
|
128
|
+
if (n.startsWith('grillhouse-registre-')) {
|
|
129
|
+
rmSync(path.join(b.dossier, n),{ recursive: true, force: true });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
123
132
|
const ligne = ligneDesRestes([
|
|
124
133
|
...b.restes().filter(n => !CACHES_DES_OUTILS.has(n)),
|
|
125
134
|
...b.essais(),
|
|
@@ -154,6 +163,7 @@ export default {
|
|
|
154
163
|
ici('./mesure.setup.mjs'),
|
|
155
164
|
ici('./machine.setup.mjs'),
|
|
156
165
|
ici('./resultats.setup.mjs'),
|
|
166
|
+
ici('./registre.setup.mjs'),
|
|
157
167
|
],
|
|
158
168
|
watch: false,
|
|
159
169
|
...travailleurs(),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// A setup file of the base configuration: a test file's register is its own, as git's tests give
|
|
2
|
+
// each test a HOME of its own. When the launch names no register (`GRILLHOUSE_REGISTRE`), the file
|
|
3
|
+
// names one under a directory of its own in the temporary directory, which every process the test
|
|
4
|
+
// starts inherits (scripts/registre.mjs reads the variable first); the directory is removed at the
|
|
5
|
+
// end of the test file, and at the exit of the process for one made inside a running test. A
|
|
6
|
+
// register the launch names stays.
|
|
7
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
8
|
+
import { tmpdir } from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { afterAll, onTestFinished } from 'vitest';
|
|
11
|
+
|
|
12
|
+
const DOSSIERS = (globalThis.__grillhouseRegistresDEssai ??= new Set());
|
|
13
|
+
if (DOSSIERS.size === 0) {
|
|
14
|
+
process.on('exit', () => {
|
|
15
|
+
for (const d of DOSSIERS) {
|
|
16
|
+
rmSync(d, { recursive: true, force: true });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!process.env.GRILLHOUSE_REGISTRE) {
|
|
22
|
+
const dossier = mkdtempSync(path.join(tmpdir(), 'grillhouse-registre-'));
|
|
23
|
+
DOSSIERS.add(dossier);
|
|
24
|
+
process.env.GRILLHOUSE_REGISTRE = path.join(dossier, 'essai.jsonl');
|
|
25
|
+
const retirer = () => {
|
|
26
|
+
rmSync(dossier, { recursive: true, force: true });
|
|
27
|
+
DOSSIERS.delete(dossier);
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
// Imported inside a running test (a test of this file's behavior): the end of that test.
|
|
31
|
+
onTestFinished(retirer);
|
|
32
|
+
} catch {
|
|
33
|
+
afterAll(retirer);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -46,6 +46,13 @@
|
|
|
46
46
|
// namespace of the sweeper (an envelope has its own, bwrap --unshare-pid, where a number means
|
|
47
47
|
// nothing outside): a base of another namespace, a base without a readable owner (one being
|
|
48
48
|
// created) and a base whose owner lives are never touched.
|
|
49
|
+
// - The trial directories under the home, `~/.cache/grillhouse-essais-*` (`racineSousLaMaison`,
|
|
50
|
+
// grillhouse-matiere), are not in the base: each holds its owner file (`.grillhouse-base`, the
|
|
51
|
+
// pass that made it). Opening a base sweeps them too (`balayerLesEssais`), from the host alone
|
|
52
|
+
// (the home is read-only in an envelope): one whose pass is gone (`passeMorte`) is removed, and
|
|
53
|
+
// one without a readable owner file, after 24 hours. `essais()` of a base names those of its own
|
|
54
|
+
// pass, which a run of Vitest counts as a leftover that fails it (the base configuration of the
|
|
55
|
+
// module typescript, vitest-config/base.mjs).
|
|
49
56
|
import { createHash } from 'node:crypto';
|
|
50
57
|
import {
|
|
51
58
|
existsSync,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// From 0.35.0 the four skills of the plugin of mattpocock that the frame calls live in the frame's
|
|
2
|
+
// plugin (`grillhouse:grilling`, `grillhouse:writing-for-agents`, `grillhouse:codebase-design`,
|
|
3
|
+
// `grillhouse:domain-modeling`), and the template no longer enables the whole plugin
|
|
4
|
+
// (grillhouse-8gp).
|
|
5
|
+
//
|
|
6
|
+
// - A project's .claude/settings.json that enables `mattpocock-skills@claude-plugins-official` in
|
|
7
|
+
// `enabledPlugins` loses that key, whatever its value; the other plugins and keys keep their
|
|
8
|
+
// place. The update cannot tell a project that enabled it for itself from one that took it from
|
|
9
|
+
// the template: it removes it and says so once.
|
|
10
|
+
// - A project without .claude/settings.json, without `enabledPlugins` or without that plugin is
|
|
11
|
+
// not written: a second pass changes nothing and returns no line.
|
|
12
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
|
|
15
|
+
export const version = '0.35.0';
|
|
16
|
+
export const nom = 'greffon mattpocock retiré';
|
|
17
|
+
|
|
18
|
+
const GREFFON = 'mattpocock-skills@claude-plugins-official';
|
|
19
|
+
|
|
20
|
+
/** Removes the whole plugin of mattpocock from the plugins a project enables. */
|
|
21
|
+
export function migrer(projet) {
|
|
22
|
+
const f = path.join(projet, '.claude', 'settings.json');
|
|
23
|
+
if (!existsSync(f)) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const texte = readFileSync(f, 'utf8');
|
|
27
|
+
const reglages = JSON.parse(texte);
|
|
28
|
+
const plugins = reglages.enabledPlugins;
|
|
29
|
+
if (!plugins || typeof plugins !== 'object' || !(GREFFON in plugins)) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
delete plugins[GREFFON];
|
|
33
|
+
const fin = texte.endsWith('\n') ? '\n' : '';
|
|
34
|
+
writeFileSync(f, JSON.stringify(reglages, null, 2) + fin);
|
|
35
|
+
return [
|
|
36
|
+
`.claude/settings.json : le greffon ${GREFFON} n'est plus activé (les quatre compétences ` +
|
|
37
|
+
`que le cadre appelle vivent dans son greffon : grillhouse:grilling, ` +
|
|
38
|
+
`grillhouse:writing-for-agents, grillhouse:codebase-design, grillhouse:domain-modeling) ; ` +
|
|
39
|
+
`pour le réactiver à la main, remettre « ${GREFFON} »: true dans enabledPlugins`,
|
|
40
|
+
];
|
|
41
|
+
}
|
package/scripts/migrations.mjs
CHANGED
|
@@ -39,6 +39,7 @@ import * as ciDesBranchesDeTicket from './migrations/0.33.0-ci-des-branches-de-t
|
|
|
39
39
|
import * as node26 from './migrations/0.33.0-node-26.mjs';
|
|
40
40
|
import * as ciDuCadre from './migrations/0.33.0-ci-du-cadre.mjs';
|
|
41
41
|
import * as cacheDistant from './migrations/0.33.0-cache-distant.mjs';
|
|
42
|
+
import * as greffonMattpocockRetire from './migrations/0.35.0-greffon-mattpocock-retire.mjs';
|
|
42
43
|
|
|
43
44
|
/** The migrations of the core. */
|
|
44
45
|
export const MIGRATIONS = [
|
|
@@ -57,6 +58,7 @@ export const MIGRATIONS = [
|
|
|
57
58
|
node26,
|
|
58
59
|
ciDuCadre,
|
|
59
60
|
cacheDistant,
|
|
61
|
+
greffonMattpocockRetire,
|
|
60
62
|
];
|
|
61
63
|
|
|
62
64
|
/**
|
|
@@ -69,9 +69,19 @@ export async function avecReprises(
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Whether the socket <s> is connected to itself: its local end is its remote end, as Linux opens a
|
|
74
|
+
* connection to a free local port whose source port happens to be that port (TCP simultaneous
|
|
75
|
+
* open; go-redis and Go's PostgreSQL driver tell it the same way).
|
|
76
|
+
* @param {import('node:net').Socket} s
|
|
77
|
+
*/
|
|
78
|
+
export const connecteeASoi = s =>
|
|
79
|
+
s.localPort === s.remotePort && s.localAddress === s.remoteAddress;
|
|
80
|
+
|
|
72
81
|
/**
|
|
73
82
|
* Whether something listens on <adresse> (`hote:port`): false when the connection is refused (no
|
|
74
|
-
* server), true when it opens or does not
|
|
83
|
+
* server) or opens on itself (`connecteeASoi`), true when it opens on another end or does not
|
|
84
|
+
* answer within <delaiMs> (a server busy).
|
|
75
85
|
* @param {string} adresse
|
|
76
86
|
* @param {number} [delaiMs]
|
|
77
87
|
* @returns {Promise<boolean>}
|
|
@@ -84,7 +94,7 @@ export function ecoute(adresse, delaiMs = 2_000) {
|
|
|
84
94
|
s.destroy();
|
|
85
95
|
ok(r);
|
|
86
96
|
};
|
|
87
|
-
s.once('connect', () => fin(
|
|
97
|
+
s.once('connect', () => fin(!connecteeASoi(s)));
|
|
88
98
|
s.once('error', () => fin(false));
|
|
89
99
|
s.setTimeout(delaiMs, () => fin(true));
|
|
90
100
|
});
|
package/scripts/registre.mjs
CHANGED
|
@@ -47,9 +47,9 @@ import { roleDeLAgent } from './etapes.mjs';
|
|
|
47
47
|
import { lireFichier, ROLE_DE_LA_NUIT, ROLE_DU_CIRCUIT, roleDuMeta, tourne } from './tableau.mjs';
|
|
48
48
|
import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
import { REGISTRE } from './adresse-du-registre.mjs';
|
|
51
|
+
|
|
52
|
+
export { REGISTRE };
|
|
53
53
|
|
|
54
54
|
// The transcript and the role the hook's input names: a sub-agent's sits next to the session's.
|
|
55
55
|
export function source(input) {
|
|
@@ -23,6 +23,6 @@ export function lesReponses(ticket, statut, ecrit) {
|
|
|
23
23
|
}
|
|
24
24
|
const etendre = '--etendre <paquet>';
|
|
25
25
|
return statut === 'RUNNING'
|
|
26
|
-
? `${circuit} --reprendre\`, \`${depuis}\`, \`${etendre}
|
|
26
|
+
? `${circuit} --reprendre\`, \`${depuis}\`, \`${etendre}\`, \`--reporter <heure>\` ou \`--arreter`
|
|
27
27
|
: `${circuit} --reprendre\`, \`${depuis}\` ou \`${etendre}`;
|
|
28
28
|
}
|