@roomi-fields/grillhouse 0.28.1 → 0.28.3
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 +13 -1
- package/docs/ARCHITECTURE.md +19 -2
- package/docs/INTERFACE.md +11 -2
- package/hooks/register.tsx +132 -161
- package/package.json +1 -1
- package/scripts/copies-finies.mjs +15 -4
- package/scripts/enveloppe/enveloppe.mjs +8 -5
- package/scripts/enveloppe/lancer.sh +12 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +13 -6
- package/scripts/jointure.d.ts +14 -0
- package/scripts/langages/cargo/composants.mjs +4 -0
- package/scripts/langages/cargo/index.mjs +4 -2
- package/scripts/langages/cargo/sccache.mjs +37 -6
- package/scripts/langages/python/commandes.mjs +9 -2
- package/scripts/langages/python/index.mjs +3 -2
- package/scripts/langages/typescript/consommateurs.mjs +3 -41
- package/scripts/langages/typescript/interfaces-contre-code.mjs +2 -1
- package/scripts/langages/typescript/lecteurs.mjs +2 -8
- package/scripts/langages/typescript/parcours.mjs +49 -0
- package/scripts/langages/typescript/references-par-les-types.mjs +2 -1
- package/scripts/langages/typescript/tests-de-nuit.mjs +10 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +2 -1
- package/scripts/langages/typescript/vitest-config/lances.mjs +6 -15
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +4 -1
- package/scripts/mesure/base-de-passe.mjs +202 -9
- package/scripts/services-du-noyau.mjs +9 -2
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/tableau.mjs +203 -77
- package/scripts/verrou-de-machine.mjs +147 -4
- package/skills/pitmaster/SKILL.md +6 -0
- package/skills/pitmaster/references/consigne-agent.md +4 -0
- package/types/index.d.ts +6 -14
package/charte.md
CHANGED
|
@@ -172,7 +172,8 @@ dossier.
|
|
|
172
172
|
|
|
173
173
|
## Outils
|
|
174
174
|
|
|
175
|
-
- ⛔ **Des commandes sans invite** : tout fichier temporaire dans le scratchpad de session
|
|
175
|
+
- ⛔ **Des commandes sans invite** : tout fichier temporaire dans le scratchpad de session, ou
|
|
176
|
+
dans le dossier temporaire du ticket ;
|
|
176
177
|
`env -C <dossier>` ou `git -C` à la place de `cd`, et le greffon refuse une commande qui
|
|
177
178
|
commence par `cd` ; une suppression passe par un script node du
|
|
178
179
|
scratchpad (`rmSync` de `node:fs`) sur un chemin nommé et lu ; un signal vise seulement un
|
|
@@ -191,6 +192,17 @@ dossier.
|
|
|
191
192
|
qu'un test y laisse ; le module de chaque langage nomme son outil et porte cette garde. Ainsi le
|
|
192
193
|
dossier temporaire, souvent un disque en mémoire que partagent les séances du poste, ne sature
|
|
193
194
|
jamais.
|
|
195
|
+
- **Un fichier temporaire meurt avec son propriétaire** : une passe ou une séance hors ticket (la
|
|
196
|
+
nuit, une vérification) écrit sous un dossier temporaire à elle, retiré à sa fin, même
|
|
197
|
+
interrompue, et balayé par la suivante quand son processus est tué ; un agent écrit sous celui
|
|
198
|
+
de son ticket, que donne `npx grillhouse temporaire <ticket>`, qui vit le temps de son ticket,
|
|
199
|
+
d'une séance et d'une reprise à l'autre, gel compris, et part quand le ticket se ferme. Ce qu'un
|
|
200
|
+
agent doit avoir pour
|
|
201
|
+
reprendre vit dans la copie du ticket ou sa passation, jamais dans le seul dossier temporaire,
|
|
202
|
+
qui ne porte que ce qui se refait. Le dossier temporaire ne tient ni copie du dépôt, ni
|
|
203
|
+
`node_modules`, ni cache : un cache de compilation va sous `~/.cache/grillhouse/`. Une passe
|
|
204
|
+
lourde qui y trouve moins de 4 Go libres attend la place et dit ce qui l'occupe, le ticket
|
|
205
|
+
nommé. Ainsi le poste ne sature jamais son disque en mémoire.
|
|
194
206
|
- **Main reste vert** : l'intégration exige un `npm run verifier` vert. Un test connu rouge se met
|
|
195
207
|
en quarantaine dans le test lui-même (`it.skip` ou `it.fails`), avec le ticket qui le corrige.
|
|
196
208
|
Ainsi chaque rouge a son ticket.
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -437,6 +437,23 @@ tests (typescript : la base de chaque lancement de Vitest, `mkdtempSync` retiré
|
|
|
437
437
|
cargo : `tester` et `verifier`, le crate `tempfile`). Ainsi un essai oublié ne remplit jamais le
|
|
438
438
|
dossier temporaire de la machine, et le test qui l'oublie est nommé.
|
|
439
439
|
|
|
440
|
+
**Un fichier temporaire meurt avec son propriétaire** : une base a pour propriétaire un
|
|
441
|
+
processus, un ticket ou un dossier, comme `PrivateTmp=` de systemd donne à un service un /tmp
|
|
442
|
+
détruit avec lui. Une passe et une séance hors ticket ont la base de leur processus. Le dossier
|
|
443
|
+
temporaire d'un ticket, `grillhouse-ticket-<id>/`, est celui de ses agents : le lanceur le donne à
|
|
444
|
+
chaque séance du ticket (son `TMPDIR`, `TMP` et `TEMP`, ses scratchpads et son dossier de travail
|
|
445
|
+
dedans), `npx grillhouse temporaire <ticket>` au superviseur pour ses sous-agents ; il reste d'une
|
|
446
|
+
séance et d'une reprise à l'autre, gel compris, et part avec les copies finies quand le ticket
|
|
447
|
+
est fermé, comme une politique de rétention fixée d'avance. Ce qu'un agent doit avoir pour reprendre vit dans
|
|
448
|
+
la copie du ticket ou sa passation, jamais dans le seul dossier temporaire. Les caches de compilation ne vivent jamais dans le dossier temporaire : sccache et uv sous
|
|
449
|
+
`~/.cache/grillhouse/` (`cacheDeCompilation`), comme l'output_base de Bazel, et un espace cargo
|
|
450
|
+
enraciné dans le dossier temporaire compile sous `~/.cache/grillhouse/cargo/`, balayé quand sa
|
|
451
|
+
racine n'est plus, vue de l'espace de processus qui l'a ouvert, ou, depuis l'hôte, après 7 jours
|
|
452
|
+
sans usage, comme un cache de GitHub Actions. Une passe lourde (le verrou de la machine, les tests de nuit) qui trouve moins
|
|
453
|
+
de 4 Go libres dans le dossier temporaire attend la place sous la borne du verrou et dit ce qui
|
|
454
|
+
l'occupe, le ticket dont le dossier tient la place nommé, au lieu d'échouer faute de place (la nuit du 2026-11-01 : 25 rouges, 8 Go de
|
|
455
|
+
scratchpads sur 16). Ainsi le disque en mémoire du poste ne sature jamais.
|
|
456
|
+
|
|
440
457
|
**Le dossier du circuit appartient au ticket** : `.claude/worktrees/<ticket>.travail` vit autant
|
|
441
458
|
que le ticket, comme l'espace de travail d'un pipeline ; aucun balayage n'y touche, la file
|
|
442
459
|
l'efface à la clôture, `npx grillhouse retirer-copie` avec la copie d'un ticket fermé sans
|
|
@@ -696,7 +713,7 @@ la tâche `test` de Turborepo dépend de `build` : des tests qui ne compilent pa
|
|
|
696
713
|
« construction de <crate> » de la preuve du rouge, et se jouent aux contrôles ; la vérification par cargo-deny,
|
|
697
714
|
sous le verrou de la machine ; chaque commande qui compile (tests, vérification, typage, clippy)
|
|
698
715
|
à travers sccache (`RUSTC_WRAPPER=sccache`), le cache de compilation de Mozilla qu'emploient
|
|
699
|
-
Firefox et les CI Rust, son cache sous la maison (`~/.cache/sccache`), commun aux copies du poste
|
|
716
|
+
Firefox et les CI Rust, son cache sous la maison (`~/.cache/grillhouse/sccache`), commun aux copies du poste
|
|
700
717
|
et que l'enveloppe ouvre en écriture : chaque copie garde son `target/`, sans le verrou que cargo
|
|
701
718
|
pose sur un dossier commun, et ne recompile pas ce qu’une autre a compilé ; un serveur de sccache par copie et par espace de processus (`/proc/self/ns/pid`, que chaque enveloppe crée), sur un socket unix abstrait nommé d'après eux (`SCCACHE_SERVER_UDS`), puisque le serveur par défaut écoute 127.0.0.1:4226 pour toute la machine et que l'enveloppe partage le réseau ; ce serveur démarre avant chaque lancement de cargo qui compile, sous `/tmp` (celui de la machine, ou dans une enveloppe celui, vide, de la séance), car sccache 0.19.0 démarre le sien par un socket au chemin sous TMPDIR, refusé au-delà des 108 octets d'un chemin de socket, et le dossier temporaire d'une passe sous le dossier de travail d'une séance les dépasse ; un lanceur de rustc que le projet pose reste le sien, sans sccache, lu comme cargo le lit (l'environnement, puis `build.rustc-wrapper` des `.cargo/config.toml` du projet vers la racine, puis de `$CARGO_HOME`) ; sans sccache sur le PATH, ces commandes refusent avant cargo, en une ligne qui nomme `npx grillhouse maj` ; le refus, avant tout lancement de cargo, d'un espace dont git ne
|
|
702
719
|
suit pas le Cargo.lock, comme `npm ci` refuse un projet sans package-lock.json : les tests, la
|
|
@@ -715,7 +732,7 @@ dans chaque paquet, leur rapport JUnit, le typage par `python -m compileall`, la
|
|
|
715
732
|
`.python-version` ; le code-octet sous un seul `__pycache__` à la racine, PYTHONPYCACHEPREFIX, que
|
|
716
733
|
l'enveloppe rend propre à la séance ; l'environnement de uv et le cache de pytest de chaque paquet
|
|
717
734
|
sous `.venv/<dossier>` et `.pytest_cache/<dossier>` à la racine, que l'enveloppe ouvre en écriture
|
|
718
|
-
avec `~/.cache/uv
|
|
735
|
+
avec le cache de uv, `~/.cache/grillhouse/uv` (UV_CACHE_DIR), plutôt que dans le dossier du paquet, qu'une séance dont le plan ne l'écrit pas
|
|
719
736
|
ne pourrait écrire ; les Python de uv en lecture ; la garde des tailles des tests en Python, et celle
|
|
720
737
|
du dossier temporaire, `tempfile` et jamais `mkdtemp` à la main ; l'index des interfaces, qu'il
|
|
721
738
|
engendre comme cargo, et que l'index du noyau remplace dans un projet de plusieurs langages), ses
|
package/docs/INTERFACE.md
CHANGED
|
@@ -142,7 +142,7 @@ noyau, et chaque réponse décrit sans agir, sauf `verifier` d'un fichier engend
|
|
|
142
142
|
dépendances git, ses avis de sécurité et les fichiers de ses verrous et du cache de ses paquets
|
|
143
143
|
écrits ; `~/.cargo/` (son `env`, que les shells sourcent, sa configuration, ses binaires) et
|
|
144
144
|
`~/.rustup/` lus ; `python` : `.venv/` et `.pytest_cache/`, où ses commandes font écrire uv et pytest pour chaque
|
|
145
|
-
paquet, et `~/.cache/uv/` écrits,
|
|
145
|
+
paquet, et `~/.cache/grillhouse/uv/` écrits,
|
|
146
146
|
`__pycache__` propre (le code-octet de Python, sous un seul arbre à la racine), les Python de uv,
|
|
147
147
|
`~/.local/share/uv/python/`, lus.
|
|
148
148
|
- `droits` : les règles de Claude Code qui refusent à un rôle qui écrit l'outil de test lancé
|
|
@@ -235,7 +235,16 @@ qu'il emploie, et `scripts/jointure.d.ts` les type : le plan d'une enveloppe, l'
|
|
|
235
235
|
passe et sa mesure, la base d'une passe (son dossier temporaire, nommé dans `TMPDIR`, `TMP` et
|
|
236
236
|
`TEMP` ; la ligne de sa garde, qui nomme ce que les tests y laissent ; son retrait à
|
|
237
237
|
l'interruption), la pression de la machine et son verrou, le dernier vert,
|
|
238
|
-
les arbitrages d'un ticket, les fichiers sources d'un projet.
|
|
238
|
+
les arbitrages d'un ticket, les fichiers sources d'un projet. Pour le dossier temporaire et les
|
|
239
|
+
caches de compilation : `dansLeTemporaire(chemin, env)`, si un chemin est sous le dossier
|
|
240
|
+
temporaire (`TMPDIR`, celui du système, `/tmp`) ; `cacheDeCompilation(outil, env)`, le cache d'un
|
|
241
|
+
outil sous `${XDG_CACHE_HOME:-~/.cache}/grillhouse/<outil>`, jamais sous le dossier temporaire ;
|
|
242
|
+
`cacheDeLaRacine(outil, racine, env, { creer })`, le cache d'une construction enracinée sous le
|
|
243
|
+
dossier temporaire, balayé quand sa racine n'est plus, vue du même espace de processus, ou depuis l'hôte
|
|
244
|
+
après 7 jours sans usage, son seul
|
|
245
|
+
chemin quand `creer` est faux ;
|
|
246
|
+
`attendreDeLaPlace(options)`, l'attente de 4 Go libres dans le dossier temporaire avant une passe
|
|
247
|
+
lourde, qui nomme ce qui l'occupe et rend 75 à sa borne. Un module n'importe rien d'autre du noyau que ses entrées publiées
|
|
239
248
|
(`./jointure`, `./paquets`, `./dette`, `./resultats`, `./conformite`).
|
|
240
249
|
|
|
241
250
|
## La conformité
|
package/hooks/register.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { atom, read, update } from 'claude-code'
|
|
2
2
|
import type { EngineInterface, Register } from 'claude-code'
|
|
3
3
|
|
|
4
|
-
import type { Etat, Fiche, Ligne,
|
|
4
|
+
import type { Etat, Fiche, Ligne, Tableau } from '../types'
|
|
5
5
|
|
|
6
6
|
// The board of a Grillhouse project, in the pane (/grillhouse) on its three levels. The frame's
|
|
7
7
|
// command of the project (`node_modules/.bin/grillhouse tableau`, the package
|
|
@@ -15,8 +15,9 @@ import type { Etat, Fiche, Ligne, Lu, Tableau } from '../types'
|
|
|
15
15
|
// session, an agent's copy included, has a Bash command that starts with cd refused, with the
|
|
16
16
|
// form to take (`env -C`, `git -C`). A session that coordinates several projects adds them to its
|
|
17
17
|
// pane (`/grillhouse ajouter <chemin>`, `/grillhouse retirer <chemin>`), as a multi-root workspace
|
|
18
|
-
// of VS Code lists its folders: the list is kept for the session's folder in the mod's store,
|
|
19
|
-
//
|
|
18
|
+
// of VS Code lists its folders: the list is kept for the session's folder in the mod's store, and
|
|
19
|
+
// the frame's command measures their board as one (`grillhouse tableau <dossier>…`), which the
|
|
20
|
+
// pane draws as it draws one project's.
|
|
20
21
|
const PANE = 'grillhouse'
|
|
21
22
|
// The frame's command, which the project's `npm install` links, and its package.
|
|
22
23
|
const GRILLHOUSE = 'node_modules/.bin/grillhouse'
|
|
@@ -59,6 +60,7 @@ const etat = atom({ plugin: 'grillhouse', key: 'etat' } as const, {
|
|
|
59
60
|
tableau: null,
|
|
60
61
|
erreur: null,
|
|
61
62
|
lu: 0,
|
|
63
|
+
revision: 0,
|
|
62
64
|
choisi: null,
|
|
63
65
|
element: null,
|
|
64
66
|
grand: false,
|
|
@@ -134,10 +136,38 @@ export const defiler = (avant: number, by: number, n: number, rangs: number) =>
|
|
|
134
136
|
// A line the pane lists, the key of its Button and `i`, its index in the lines shown.
|
|
135
137
|
export type Visible = { l: Ligne; cle: string | null; i: number }
|
|
136
138
|
|
|
137
|
-
// The lines the pane lists, each with the key of its Button: `<ticket>:<
|
|
138
|
-
// `>:<
|
|
139
|
+
// The lines the pane lists, each with the key of its Button: `<ticket>:<n>` for the n-th line of a
|
|
140
|
+
// ticket (from 0), `>:<groupe>` for a folded group's title, none for a plain line. A key names its
|
|
141
|
+
// line by what it shows, never by its place, as React's keys do: a new measure that adds lines
|
|
142
|
+
// above keeps the key the ring holds.
|
|
139
143
|
export function visibles(lignes: Ligne[]): Visible[] {
|
|
140
|
-
|
|
144
|
+
const vus = new Map<string, number>()
|
|
145
|
+
return lignes.map((l, i) => {
|
|
146
|
+
if (l.ticket) {
|
|
147
|
+
const n = vus.get(l.ticket) ?? 0
|
|
148
|
+
vus.set(l.ticket, n + 1)
|
|
149
|
+
return { l, cle: `${l.ticket}:${n}`, i }
|
|
150
|
+
}
|
|
151
|
+
return { l, cle: l.groupe ? `>:${l.groupe}` : null, i }
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// A computation kept from its last inputs, as React's useMemo keeps it from its dependencies:
|
|
156
|
+
// called with the same dependencies (each the same value; by default every argument), it gives
|
|
157
|
+
// the last result again without computing it.
|
|
158
|
+
export function memoire<A extends unknown[], R>(
|
|
159
|
+
calcul: (...a: A) => R,
|
|
160
|
+
dependances: (...a: A) => unknown[] = (...a) => a,
|
|
161
|
+
): (...a: A) => R {
|
|
162
|
+
let dernier: { d: unknown[]; r: R } | null = null
|
|
163
|
+
return (...a: A) => {
|
|
164
|
+
const d = dependances(...a)
|
|
165
|
+
const avant = dernier
|
|
166
|
+
if (avant && avant.d.length === d.length && d.every((x, j) => Object.is(x, avant.d[j]))) return avant.r
|
|
167
|
+
const r = calcul(...a)
|
|
168
|
+
dernier = { d, r }
|
|
169
|
+
return r
|
|
170
|
+
}
|
|
141
171
|
}
|
|
142
172
|
|
|
143
173
|
// The first of `n` lines to show in `rangs` rows: the window stays where it was (`avant`) while the
|
|
@@ -219,122 +249,61 @@ export function dossierDe(chemin: string, dossier: string, maison = ''): string
|
|
|
219
249
|
return `/${parts.join('/')}`
|
|
220
250
|
}
|
|
221
251
|
|
|
222
|
-
// A project's label in a fused board: its ticket prefix, else its folder's name.
|
|
223
|
-
const nomDu = (dossier: string) => dossier.split('/').filter(Boolean).pop() ?? dossier
|
|
224
|
-
const etiquetteDe = (l: Lu) => l.tableau?.prefixe || nomDu(l.dossier)
|
|
225
|
-
|
|
226
|
-
// The width of the step's column in a fused board, « 3 Code », « ? Question ».
|
|
227
|
-
const ETAPE = 13
|
|
228
|
-
// A ticket line's step in words: « ? Question » stopped on a question, « ■ Arrêté » after the
|
|
229
|
-
// steps, else its number and title.
|
|
230
|
-
const libelleDEtape = (l: Ligne) =>
|
|
231
|
-
l.question ? '? Question' : l.etape?.numero ? `${l.etape.numero} ${l.etape.titre}` : '■ Arrêté'
|
|
232
|
-
// The rank a ticket line sorts by in a fused board, the maquette's order: the steps from the last
|
|
233
|
-
// to the first, a step after its sub-steps (« 4 » is « 4.0 »), then the questions, then the
|
|
234
|
-
// circuits stopped after the steps.
|
|
235
|
-
const rangDe = (l: Ligne): number[] =>
|
|
236
|
-
l.question ? [1] : l.etape?.numero ? [0, ...l.etape.numero.split('.').map(n => -Number(n))] : [2]
|
|
237
|
-
const comparer = (a: number[], b: number[]) => {
|
|
238
|
-
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
239
|
-
const d = (a[i] ?? 0) - (b[i] ?? 0)
|
|
240
|
-
if (d) return d
|
|
241
|
-
}
|
|
242
|
-
return 0
|
|
243
|
-
}
|
|
244
|
-
const couperA = (x: string, n: number) => (x.length > n ? `${x.slice(0, n - 1)}…` : x)
|
|
245
|
-
|
|
246
|
-
// The boards of several projects fused into one, the owner's maquette (grillhouse-erp): the tickets
|
|
247
|
-
// at a step of each project in one list sorted by step, each line « <étape> [<projet>] <id> —
|
|
248
|
-
// <sujet> », then each project's chantiers prefixed by its label; the states' view of each project
|
|
249
|
-
// under its label; every card, and the folder of each ticket's project (`dossiers`); a footer
|
|
250
|
-
// (`pied`) that sums up each project, « osc 2▶ · SH 1▶ 3 en attente · OSD 0 », and names each
|
|
251
|
-
// project whose board does not read with its fault.
|
|
252
|
-
export function fusionner(lus: Lu[]): Tableau {
|
|
253
|
-
const lisibles = lus.flatMap(l => (l.tableau && !l.erreur ? [{ ...l, tableau: l.tableau }] : []))
|
|
254
|
-
const fautifs = lus.filter(l => !l.tableau || l.erreur)
|
|
255
|
-
const large = Math.max(0, ...lisibles.map(l => etiquetteDe(l).length + 2))
|
|
256
|
-
const prefixe = (l: Lu) => `[${etiquetteDe(l)}]`.padEnd(large)
|
|
257
|
-
const tickets = lisibles.flatMap(lu =>
|
|
258
|
-
lu.tableau.lignes
|
|
259
|
-
.filter(l => l.section === 'agents' && l.ticket && l.etape)
|
|
260
|
-
.map(l => ({
|
|
261
|
-
...l,
|
|
262
|
-
texte: `${couperA(libelleDEtape(l), ETAPE).padEnd(ETAPE)} ${prefixe(lu)} ${l.ticket} — ${lu.tableau.fiches[l.ticket ?? '']?.titre ?? ''}`,
|
|
263
|
-
})),
|
|
264
|
-
)
|
|
265
|
-
tickets.sort((a, b) => comparer(rangDe(a), rangDe(b)))
|
|
266
|
-
const chantiers = lisibles.flatMap(lu =>
|
|
267
|
-
lu.tableau.lignes
|
|
268
|
-
.filter(l => l.chantier && l.ticket)
|
|
269
|
-
.map(l => ({ ...l, texte: `[${etiquetteDe(lu)}] ${l.texte}` })),
|
|
270
|
-
)
|
|
271
|
-
const vueEtats: Ligne[] = lisibles.flatMap((lu, i) => [
|
|
272
|
-
...(i ? [{ texte: '', section: 'etats' as const }] : []),
|
|
273
|
-
{ texte: etiquetteDe(lu), ton: 'titre' as const, section: 'etats' as const },
|
|
274
|
-
...(lu.tableau.vueEtats ?? []),
|
|
275
|
-
])
|
|
276
|
-
// The summaries share a line while they fit the pane's width, then go on to the next.
|
|
277
|
-
const pied: Ligne[] = []
|
|
278
|
-
for (const lu of lisibles) {
|
|
279
|
-
const c = lu.tableau.global?.compteurs
|
|
280
|
-
const resume = [
|
|
281
|
-
etiquetteDe(lu),
|
|
282
|
-
...(c?.enCours ? [`${c.enCours}▶`] : []),
|
|
283
|
-
...(c?.enAttente ? [`${c.enAttente} en attente`] : []),
|
|
284
|
-
...(!c?.enCours && !c?.enAttente ? ['0'] : []),
|
|
285
|
-
].join(' ')
|
|
286
|
-
const avant = pied[pied.length - 1]
|
|
287
|
-
if (avant && avant.texte.length + 3 + resume.length <= COLONNES) avant.texte += ` · ${resume}`
|
|
288
|
-
else pied.push({ texte: resume, ton: 'discret', section: 'agents' })
|
|
289
|
-
}
|
|
290
|
-
for (const lu of fautifs) {
|
|
291
|
-
const faute = (lu.erreur ?? '').split('\n')[0]?.trim() || 'le tableau ne se lit pas'
|
|
292
|
-
pied.push({ texte: `⚠ ${nomDu(lu.dossier)} : ${faute}`, ton: 'alerte', section: 'agents' })
|
|
293
|
-
}
|
|
294
|
-
const dossiers: Record<string, string> = {}
|
|
295
|
-
for (const lu of lisibles) for (const id of Object.keys(lu.tableau.fiches)) dossiers[id] ??= lu.dossier
|
|
296
|
-
return {
|
|
297
|
-
lignes: [...tickets, ...(chantiers.length ? [{ texte: '', section: 'chantier' as const }, ...chantiers] : [])],
|
|
298
|
-
vueEtats,
|
|
299
|
-
groupes: {},
|
|
300
|
-
fiches: Object.assign({}, ...lisibles.map(l => l.tableau.fiches)) as Tableau['fiches'],
|
|
301
|
-
dernier: lisibles.map(l => l.tableau.dernier).find(Boolean) ?? null,
|
|
302
|
-
pied,
|
|
303
|
-
dossiers,
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
252
|
// The session's project, whether it is a Grillhouse project, whether the board applies to it, and
|
|
308
253
|
// whether the board is on.
|
|
309
254
|
let cwd = ''
|
|
310
255
|
let projet = false
|
|
311
256
|
let eligible = false
|
|
312
257
|
let actif = false
|
|
313
|
-
// The pane's window: its first line, the element it last followed
|
|
314
|
-
//
|
|
258
|
+
// The pane's window: its first line, the element it last followed and that element's line, and
|
|
259
|
+
// the wheel's notches not drawn yet. The wheel moves it; the ring moving to another line makes it
|
|
260
|
+
// follow.
|
|
315
261
|
let fenetre = 0
|
|
316
262
|
let suivi: string | null = null
|
|
317
|
-
let
|
|
263
|
+
let ligneSuivie = -1
|
|
264
|
+
let crans: number[] = []
|
|
318
265
|
// The whole card's window: the first row of its text shown, and, while it is drawn, the text's
|
|
319
266
|
// rows and the rows it shows them in.
|
|
320
267
|
let ligneTexte = 0
|
|
321
268
|
let texteDessine: { n: number; rangs: number } | null = null
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
269
|
+
// The lines the pane lists, kept until the board or the view changes.
|
|
270
|
+
const listeDe = memoire(
|
|
271
|
+
(s: Etat) => visibles(lignesDe(s)),
|
|
272
|
+
s => [s.revision, s.vue, s.groupe],
|
|
273
|
+
)
|
|
274
|
+
// The cards the pane has drawn, by their key, kept until the board, the width or the surface's
|
|
275
|
+
// elements change.
|
|
276
|
+
const cartesGardees = memoire(
|
|
277
|
+
(_revision: number, _colonnes: number, _elements: unknown) => new Map<string, JSX.Element>(),
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
// The lines the window runs over, every line of the board, the window placed on them. A board
|
|
281
|
+
// measured again keeps the followed line on its row, as a browser's scroll anchoring keeps the
|
|
282
|
+
// line in view where it was. When the ring has moved to another line since the window last
|
|
283
|
+
// followed it, the window follows it (`debut`). Then the wheel's notches move it, one by one,
|
|
284
|
+
// each within the lines.
|
|
285
|
+
function placer(liste: Visible[], element: string | null, rangs: number, focus: boolean): void {
|
|
286
|
+
const ici = liste.findIndex(x => x.cle === element)
|
|
287
|
+
if (focus && ici >= 0 && element === suivi && ligneSuivie >= 0) fenetre += ici - ligneSuivie
|
|
288
|
+
if (focus && ici >= 0 && element !== suivi) {
|
|
330
289
|
// The ring's next stops: the nearest lines with a button, above and below.
|
|
331
290
|
const avant = liste.slice(0, ici).findLastIndex(x => x.cle)
|
|
332
291
|
const apres = liste.findIndex((x, j) => j > ici && x.cle)
|
|
333
292
|
fenetre = debut(liste.length, ici, rangs, fenetre, avant < 0 ? ici - 1 : avant, apres < 0 ? ici + 1 : apres)
|
|
334
|
-
suivi =
|
|
293
|
+
suivi = element
|
|
335
294
|
}
|
|
295
|
+
ligneSuivie = ici
|
|
336
296
|
fenetre = Math.max(0, Math.min(fenetre, liste.length - rangs))
|
|
337
|
-
|
|
297
|
+
for (const by of crans) fenetre = Math.max(0, Math.min(fenetre + by, liste.length - rangs))
|
|
298
|
+
crans = []
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Another view starts its window over: at its first line, following nothing, no notch kept.
|
|
302
|
+
function recommencer(): void {
|
|
303
|
+
fenetre = 0
|
|
304
|
+
suivi = null
|
|
305
|
+
ligneSuivie = -1
|
|
306
|
+
crans = []
|
|
338
307
|
}
|
|
339
308
|
|
|
340
309
|
// Measures the board again and redraws the pane.
|
|
@@ -374,35 +343,30 @@ async function bientot($: EngineInterface) {
|
|
|
374
343
|
await rafraichir($)
|
|
375
344
|
}
|
|
376
345
|
|
|
377
|
-
// The board
|
|
378
|
-
// process returns (4 MiB) or that does not parse is said,
|
|
379
|
-
|
|
380
|
-
const r = await $.process.run([GRILLHOUSE, 'tableau'], { cwd: dossier, timeoutMs: 20_000 })
|
|
381
|
-
if (r.exitCode !== 0) return { dossier, tableau: null, erreur: r.stderr.slice(0, 300) }
|
|
382
|
-
try {
|
|
383
|
-
if (r.isStdoutTruncated) throw new Error('la sortie de grillhouse tableau dépasse 4 Mio')
|
|
384
|
-
return { dossier, tableau: JSON.parse(r.stdout) as Tableau, erreur: null }
|
|
385
|
-
} catch (err) {
|
|
386
|
-
return { dossier, tableau: null, erreur: `Tableau illisible : ${(err as Error).message}`.slice(0, 300) }
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// The session's board alone, a fault keeping the last board read; with other projects, every
|
|
391
|
-
// board, read side by side, fused.
|
|
346
|
+
// The board, the session's project with the projects the pane shows beside it; a fault keeps the
|
|
347
|
+
// last board read. A board past what a process returns (4 MiB) or that does not parse is said,
|
|
348
|
+
// never thrown.
|
|
392
349
|
async function mesurer($: EngineInterface) {
|
|
393
350
|
if (!actif) return
|
|
394
351
|
const { projets } = await read($, etat)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
await update($, etat, s => ({ ...s,
|
|
352
|
+
const r = await $.process.run([GRILLHOUSE, 'tableau', ...projets], { cwd, timeoutMs: 20_000 })
|
|
353
|
+
if (r.exitCode !== 0) {
|
|
354
|
+
await update($, etat, s => ({ ...s, erreur: r.stderr.slice(0, 300) }))
|
|
398
355
|
return
|
|
399
356
|
}
|
|
400
|
-
|
|
401
|
-
|
|
357
|
+
let tableau: Tableau
|
|
358
|
+
try {
|
|
359
|
+
if (r.isStdoutTruncated) throw new Error('la sortie de grillhouse tableau dépasse 4 Mio')
|
|
360
|
+
tableau = JSON.parse(r.stdout) as Tableau
|
|
361
|
+
} catch (err) {
|
|
362
|
+
await update($, etat, s => ({ ...s, erreur: `Tableau illisible : ${(err as Error).message}`.slice(0, 300) }))
|
|
363
|
+
return
|
|
364
|
+
}
|
|
365
|
+
await update($, etat, s => ({ ...s, tableau, erreur: null, lu: Date.now(), revision: (s.revision || 0) + 1 }))
|
|
402
366
|
}
|
|
403
367
|
|
|
404
|
-
// The folder of the project the ticket <id> belongs to
|
|
405
|
-
// session's.
|
|
368
|
+
// The folder of the project the ticket <id> belongs to, which the board names beside the
|
|
369
|
+
// session's (`dossiers`); the session's otherwise.
|
|
406
370
|
const dossierDu = (t: Tableau | null, id: string) => t?.dossiers?.[id] ?? cwd
|
|
407
371
|
|
|
408
372
|
// The whole text of a ticket, read from Beads in its project when the card fills the pane: the
|
|
@@ -550,9 +514,10 @@ export const register: Register = on => {
|
|
|
550
514
|
return r
|
|
551
515
|
})
|
|
552
516
|
|
|
553
|
-
// The pane draws its own rows: the wheel
|
|
554
|
-
//
|
|
555
|
-
//
|
|
517
|
+
// The pane draws its own rows: each notch of the wheel is kept, and the next render moves the
|
|
518
|
+
// window by every notch kept, one by one within its lines, as a browser folds the scroll events
|
|
519
|
+
// of one frame into one paint: a notch reads nothing and computes nothing. On the whole card,
|
|
520
|
+
// the wheel, the arrows and the page keys move its text by `e.by` rows, and the engine's window is held on the row under the card's spare top row, so an
|
|
556
521
|
// arrow up scrolls as an arrow down does, wherever the text stands.
|
|
557
522
|
on('ui.scroll', async ($, e, next) => {
|
|
558
523
|
if (e.requestId !== PANE) return next(e)
|
|
@@ -561,8 +526,7 @@ export const register: Register = on => {
|
|
|
561
526
|
$.ui.invalidate('ui.render')
|
|
562
527
|
return next({ ...e, offset: 1 })
|
|
563
528
|
}
|
|
564
|
-
|
|
565
|
-
fenetre = Math.max(0, Math.min(fenetre + e.by, liste.length - cadre.rangs))
|
|
529
|
+
crans.push(e.by)
|
|
566
530
|
$.ui.invalidate('ui.render')
|
|
567
531
|
return {}
|
|
568
532
|
})
|
|
@@ -576,11 +540,9 @@ export const register: Register = on => {
|
|
|
576
540
|
// Focused, the card shows the chosen ticket; otherwise the one that moved last.
|
|
577
541
|
const montre = e.props.isFocused ? choisi : (t.dernier ?? choisi)
|
|
578
542
|
const fiche = montre ? t.fiches[montre] : undefined
|
|
579
|
-
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
cadre = { rangs, focus: e.props.isFocused }
|
|
583
|
-
const liste = placer(s, rangs, e.props.isFocused)
|
|
543
|
+
const rangs = Math.max(1, e.props.scroll.bodyRows - FICHE - 1)
|
|
544
|
+
const liste = listeDe(s)
|
|
545
|
+
placer(liste, element, rangs, e.props.isFocused)
|
|
584
546
|
const ici = liste.findIndex(x => x.cle === element)
|
|
585
547
|
// The chantier the keyboard is on, which `h` switches on or off.
|
|
586
548
|
const chantier = ici >= 0 && liste[ici]?.l.chantier ? liste[ici]?.l.ticket : undefined
|
|
@@ -597,8 +559,7 @@ export const register: Register = on => {
|
|
|
597
559
|
plain
|
|
598
560
|
hotkey="e"
|
|
599
561
|
onPress={() => {
|
|
600
|
-
|
|
601
|
-
suivi = null
|
|
562
|
+
recommencer()
|
|
602
563
|
void update($, etat, basculerVue)
|
|
603
564
|
}}
|
|
604
565
|
>
|
|
@@ -610,8 +571,7 @@ export const register: Register = on => {
|
|
|
610
571
|
plain
|
|
611
572
|
hotkey="o"
|
|
612
573
|
onPress={() => {
|
|
613
|
-
|
|
614
|
-
suivi = null
|
|
574
|
+
recommencer()
|
|
615
575
|
void update($, etat, x => ouvrirGroupe(x, groupe))
|
|
616
576
|
}}
|
|
617
577
|
>
|
|
@@ -683,8 +643,18 @@ export const register: Register = on => {
|
|
|
683
643
|
)
|
|
684
644
|
}
|
|
685
645
|
const premier = fenetre
|
|
646
|
+
const montrees = liste.slice(premier, premier + rangs)
|
|
686
647
|
// A card fills the pane's last rows: the whole title on as many lines as it takes, then the
|
|
687
|
-
// component, state, duration and tokens, then the description in the rows left.
|
|
648
|
+
// component, state, duration and tokens, then the description in the rows left. Each card is
|
|
649
|
+
// drawn once for a board, a width and a surface, and kept.
|
|
650
|
+
const gardees = cartesGardees(s.revision, colonnes, Box)
|
|
651
|
+
const garder = (cle: string, dessin: () => JSX.Element) => {
|
|
652
|
+
const deja = gardees.get(cle)
|
|
653
|
+
if (deja) return deja
|
|
654
|
+
const neuf = dessin()
|
|
655
|
+
gardees.set(cle, neuf)
|
|
656
|
+
return neuf
|
|
657
|
+
}
|
|
688
658
|
const carte = (f: Fiche | undefined) => {
|
|
689
659
|
const [titre, etatDuTicket, resume] = ficheLignes(f)
|
|
690
660
|
return (
|
|
@@ -712,7 +682,7 @@ export const register: Register = on => {
|
|
|
712
682
|
return (
|
|
713
683
|
<Box flexDirection="column" height={e.props.scroll.bodyRows}>
|
|
714
684
|
<Box flexDirection="column" flexGrow={1} overflow="hidden">
|
|
715
|
-
{
|
|
685
|
+
{montrees.map(({ l, cle }) => {
|
|
716
686
|
const texte = (
|
|
717
687
|
<Text bold={l.ton === 'titre'} dimColor={l.ton === 'discret'} color={couleur(l.ton)} wrap="truncate-end">
|
|
718
688
|
{l.texte || ' '}
|
|
@@ -741,28 +711,29 @@ export const register: Register = on => {
|
|
|
741
711
|
)
|
|
742
712
|
})}
|
|
743
713
|
</Box>
|
|
744
|
-
{pied.map((l, i) => (
|
|
745
|
-
<Text key={`pied:${i}`} dimColor={l.ton === 'discret'} color={couleur(l.ton)} wrap="truncate-end">
|
|
746
|
-
{l.texte}
|
|
747
|
-
</Text>
|
|
748
|
-
))}
|
|
749
714
|
{regle('tout le texte')}
|
|
750
715
|
<Box flexDirection="column" height={FICHE} flexShrink={0}>
|
|
751
|
-
{carte(fiche)}
|
|
752
|
-
{
|
|
716
|
+
{garder(`carte:${montre ?? ''}`, () => carte(fiche))}
|
|
717
|
+
{[...new Set(montrees.map(x => x.l.ticket))].map(id => {
|
|
718
|
+
const f = id ? t.fiches[id] : undefined
|
|
753
719
|
// The card of the ticket under the pointer, drawn over the chosen one on a blank of its
|
|
754
|
-
// size, so no character of the chosen card shows through
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
<
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
720
|
+
// size, so no character of the chosen card shows through: one for each ticket of the
|
|
721
|
+
// lines in the window, the only ones the pointer can be over.
|
|
722
|
+
return id && f
|
|
723
|
+
? garder(`survol:${id}`, () => (
|
|
724
|
+
<Box position="absolute" top={0} left={0} display="none" hover={{ scope: id, display: 'flex' }}>
|
|
725
|
+
<Box flexDirection="column">
|
|
726
|
+
{Array.from({ length: FICHE }, () => (
|
|
727
|
+
<Text>{' '.repeat(colonnes)}</Text>
|
|
728
|
+
))}
|
|
729
|
+
</Box>
|
|
730
|
+
<Box position="absolute" top={0} left={0}>
|
|
731
|
+
{carte(f)}
|
|
732
|
+
</Box>
|
|
733
|
+
</Box>
|
|
734
|
+
))
|
|
735
|
+
: null
|
|
736
|
+
})}
|
|
766
737
|
</Box>
|
|
767
738
|
</Box>
|
|
768
739
|
)
|
package/package.json
CHANGED
|
@@ -44,7 +44,14 @@
|
|
|
44
44
|
// - The line of each copy kept names the place it holds, as `du -sk` counts it (« 2,7 Go »).
|
|
45
45
|
// - The branch of a copy removed goes (`git branch -D`), its content being HEAD's, on main; main
|
|
46
46
|
// and a branch another copy holds stay.
|
|
47
|
-
// -
|
|
47
|
+
// - The temporary directory of each closed ticket goes too (`grillhouse-ticket-<id>/` of the
|
|
48
|
+
// temporary directory, which the launcher gives each session of the ticket and
|
|
49
|
+
// `npx grillhouse temporaire <ticket>` the supervisor, `balayerLesTickets` of
|
|
50
|
+
// scripts/mesure/base-de-passe.mjs), as its copy goes; a ticket open, frozen or not, keeps it, as
|
|
51
|
+
// a retention policy fixed in advance. The closed tickets are read only when such a directory
|
|
52
|
+
// is there.
|
|
53
|
+
// - One line per copy removed or kept, and per ticket's temporary directory removed, on the
|
|
54
|
+
// output, which the night adds to its log. The exit is
|
|
48
55
|
// 0 whatever is removed or kept: the removal never changes the night's verdict.
|
|
49
56
|
import { spawnSync } from 'node:child_process';
|
|
50
57
|
import { existsSync, lstatSync, realpathSync, rmSync } from 'node:fs';
|
|
@@ -52,6 +59,7 @@ import path from 'node:path';
|
|
|
52
59
|
import { pathToFileURL } from 'node:url';
|
|
53
60
|
import { PILOTE } from './fusion-du-changelog.mjs';
|
|
54
61
|
import { langageDe } from './langages.mjs';
|
|
62
|
+
import { balayerLesTickets } from './mesure/base-de-passe.mjs';
|
|
55
63
|
|
|
56
64
|
const RETIRER = path.join(import.meta.dirname, 'retirer-copie.sh');
|
|
57
65
|
const PRINCIPALE = 'main';
|
|
@@ -322,19 +330,22 @@ function ignoresDuLangage(racine) {
|
|
|
322
330
|
|
|
323
331
|
/**
|
|
324
332
|
* The removal of the copies of the repository at <racine> (`retirerLesCopiesFinies`), the copy of
|
|
325
|
-
* the night and the copies <garder> left out, the tickets read by bd
|
|
326
|
-
* of
|
|
333
|
+
* the night and the copies <garder> left out, the tickets read by bd, then of the temporary
|
|
334
|
+
* directories of its closed tickets (`balayerLesTickets`): what the night and the end of each
|
|
335
|
+
* circuit (scripts/circuit.mjs) run. Its lines.
|
|
327
336
|
* @param {string} racine the main tree
|
|
328
337
|
* @param {string[]} [garder]
|
|
329
338
|
* @returns {string[]}
|
|
330
339
|
*/
|
|
331
340
|
export function retirerLesCopiesDuDepot(racine, garder = []) {
|
|
332
|
-
|
|
341
|
+
const lignes = retirerLesCopiesFinies(racine, {
|
|
333
342
|
garder: [path.join(racine, NUIT), ...garder],
|
|
334
343
|
lireEnCours: () => tickets(racine, 'in_progress'),
|
|
335
344
|
lireFermes: () => tickets(racine, 'closed'),
|
|
336
345
|
ignorer: ignoresDuLangage(racine),
|
|
337
346
|
});
|
|
347
|
+
const retires = balayerLesTickets(() => tickets(racine, 'closed'));
|
|
348
|
+
return [...lignes, ...retires.map(t => `✓ dossier temporaire du ticket ${t} retiré.`)];
|
|
338
349
|
}
|
|
339
350
|
|
|
340
351
|
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
@@ -49,8 +49,9 @@
|
|
|
49
49
|
// sudo's env_reset and bwrap's --clearenv give it: the base of a login session, claude's own
|
|
50
50
|
// configuration and credentials (`ANTHROPIC_*`, `CLAUDE_CODE_OAUTH_TOKEN`), the author of its
|
|
51
51
|
// comments at the ticket (`BEADS_ACTOR`, which bd reads), the npm cache it
|
|
52
|
-
// mounts, `npm_config_ignore_scripts=true`, and `TMPDIR`, the session's working
|
|
53
|
-
// `mktemp
|
|
52
|
+
// mounts, `npm_config_ignore_scripts=true`, and `TMPDIR`, `TMP` and `TEMP`, the session's working
|
|
53
|
+
// directory, where `mktemp`, `os.tmpdir()` and Python's `tempfile` write: under a launch, in the
|
|
54
|
+
// temporary directory of the ticket (scripts/enveloppe/lancer.sh), which goes with the ticket. With it npm runs no lifecycle script (`npm install` leaves the
|
|
54
55
|
// `prepare` that writes under the read-only `.git`; the launcher installs outside the session),
|
|
55
56
|
// while `npm test` and `npm run <script>` still run their script, without its `pre` or `post`
|
|
56
57
|
// (npm's `ignore-scripts`, docs/content/using-npm/config.md); no script of the frame has one. bwrap
|
|
@@ -221,7 +222,7 @@ function scratchpadsDe(copie, env = process.env) {
|
|
|
221
222
|
|
|
222
223
|
// The working directory of a session in <copie> under the environment <env> of the launch:
|
|
223
224
|
// `travail` in the copy's scratchpads, which the envelope mounts in writing. The envelope creates
|
|
224
|
-
// it and names it in `TMPDIR`; the launcher names it in the instruction.
|
|
225
|
+
// it and names it in `TMPDIR`, `TMP` and `TEMP`; the launcher names it in the instruction.
|
|
225
226
|
export function dossierDeTravail(copie, env = process.env) {
|
|
226
227
|
return path.join(scratchpadsDe(copie, env), 'travail');
|
|
227
228
|
}
|
|
@@ -230,8 +231,8 @@ export function dossierDeTravail(copie, env = process.env) {
|
|
|
230
231
|
// variables and families that <env> holds, `npm_config_cache` set to the npm cache that the
|
|
231
232
|
// envelope mounts in writing, `npm_config_ignore_scripts` set to `true` (npm runs no lifecycle
|
|
232
233
|
// script: a `prepare` that writes under the read-only `.git` would fail `npm install`; the
|
|
233
|
-
// launcher installs outside the session), `TMPDIR` set to the session's working
|
|
234
|
-
// <travail>, and `GRILLHOUSE_ENVELOPPE` set to the plan <paquets>; with them, each tool of the
|
|
234
|
+
// launcher installs outside the session), `TMPDIR`, `TMP` and `TEMP` set to the session's working
|
|
235
|
+
// directory <travail>, and `GRILLHOUSE_ENVELOPPE` set to the plan <paquets>; with them, each tool of the
|
|
235
236
|
// project <outils> (`grillhouse.outils`), its variable set to its path. Nothing else of <env>
|
|
236
237
|
// enters.
|
|
237
238
|
export function environnementDeLaSeance(env, { cacheNpm, paquets, travail, outils = {} }) {
|
|
@@ -246,6 +247,8 @@ export function environnementDeLaSeance(env, { cacheNpm, paquets, travail, outil
|
|
|
246
247
|
npm_config_cache: cacheNpm,
|
|
247
248
|
npm_config_ignore_scripts: 'true',
|
|
248
249
|
TMPDIR: travail,
|
|
250
|
+
TMP: travail,
|
|
251
|
+
TEMP: travail,
|
|
249
252
|
[VARIABLE]: ecrireLaListe(paquets),
|
|
250
253
|
};
|
|
251
254
|
}
|