@roomi-fields/grillhouse 0.25.3 → 0.25.5

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.
@@ -4,7 +4,8 @@
4
4
  //
5
5
  // - `<dossier>/cargo/<run>.json`, one per run: `{ taches, cibles }`, each task as the join types
6
6
  // it (`code` null for a task planned that did not run; `tests` true for the runs of nextest and
7
- // of the doctests), and the file of each test binary of nextest by its id (`ws-core`,
7
+ // of the doctests; `journal`, from the root, the log of the task `build`, the build of a crate's
8
+ // test targets, which the circuit reads for a failed build), and the file of each test binary of nextest by its id (`ws-core`,
8
9
  // `ws-core::integ`, `ws-core::bin/outil`), its target's source.
9
10
  // - `<dossier>/nextest/<run>-<crate>.xml`, the JUnit report of each run of nextest: each
10
11
  // `testsuite`, a test binary, gives a test file, each `testcase` a test, failed when it holds a
@@ -32,6 +32,8 @@
32
32
  // refusal inscribed in the project's debt (`grillhouse-dette.json`, see `dette.mjs`) passes,
33
33
  // keyed by the interface and `consommateur-sans-arbitrage`. Comments that cannot be read refuse,
34
34
  // never inscribed.
35
+ // - The judgement (`juger`) takes the interfaces' texts and the readers of the ticket passed in;
36
+ // `verifier` reads them from git and bd.
35
37
  import { spawnSync } from 'node:child_process';
36
38
  import { existsSync, readFileSync } from 'node:fs';
37
39
  import path from 'node:path';
@@ -87,24 +89,70 @@ function nonNommes(texte, noms) {
87
89
 
88
90
  const git = (racine, ...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
89
91
 
90
- // The ticket of the copy at <racine>: <ticket> of its branch `agent/<ticket>`, or null.
92
+ /** The ticket of the branch <branche>: <ticket> of `agent/<ticket>`, or null. */
93
+ export function ticketDeLaBranche(branche) {
94
+ return /^agent\/(.+)$/.exec(branche)?.[1] ?? null;
95
+ }
96
+
97
+ // The ticket of the copy at <racine>, by its branch, or null.
91
98
  function ticketDeLaCopie(racine) {
92
99
  const r = git(racine, 'rev-parse', '--abbrev-ref', 'HEAD');
93
- const m = r.status === 0 ? /^agent\/(.+)$/.exec(r.stdout.trim()) : null;
94
- return m ? m[1] : null;
100
+ return r.status === 0 ? ticketDeLaBranche(r.stdout.trim()) : null;
101
+ }
102
+
103
+ // What `bd <args>` prints, run from <principal>, parsed as JSON; throws with what it says when it
104
+ // fails.
105
+ function bdJson(principal, args) {
106
+ const r = spawnSync('bd', args, {
107
+ cwd: principal,
108
+ encoding: 'utf8',
109
+ maxBuffer: 256 * 1024 * 1024,
110
+ });
111
+ if (r.status !== 0) throw new Error(r.stderr || r.error?.message || `code ${r.status}`);
112
+ return JSON.parse(r.stdout || '[]');
95
113
  }
96
114
 
97
- // The findings of the copy <racine> under <env>, in the debt's form (`dette.mjs`).
115
+ // The findings of the copy <racine> under <env>, in the debt's form (`dette.mjs`): its ticket,
116
+ // read from its branch, its interfaces at HEAD and in its working tree, and the ticket's comments
117
+ // and plan read by bd from the main tree, judged by `juger`.
98
118
  export function verifier(racine, env = process.env) {
99
119
  const ticket = ticketDeLaCopie(racine);
100
120
  if (!ticket) return [];
101
- const changees = [];
121
+ const interfaces = [];
102
122
  for (const c of aVerifier(racine, env)) {
103
123
  const iface = path.join(c.dir, 'docs', 'INTERFACE.md');
104
124
  if (!existsSync(iface)) continue;
105
125
  const rel = path.relative(racine, iface);
106
126
  const head = git(racine, 'show', `HEAD:${rel}`);
107
- const lignesAvant = head.status === 0 ? lignesConsommateurs(head.stdout) : [];
127
+ interfaces.push({
128
+ rel,
129
+ avant: head.status === 0 ? head.stdout : null,
130
+ apres: readFileSync(iface, 'utf8'),
131
+ });
132
+ }
133
+ const principal = () =>
134
+ path.dirname(
135
+ git(racine, 'rev-parse', '--path-format=absolute', '--git-common-dir').stdout.trim()
136
+ );
137
+ return juger(
138
+ ticket,
139
+ interfaces,
140
+ () => bdJson(principal(), ['comments', ticket, '--json']),
141
+ () => bdJson(principal(), ['show', ticket, '--json'])?.[0]
142
+ );
143
+ }
144
+
145
+ /**
146
+ * The findings on the lot of <ticket>, in the debt's form (`dette.mjs`): <interfaces>
147
+ * `[{ rel, avant, apres }]`, each interface's path from the root, its text at HEAD (null when
148
+ * absent) and in the working tree; `commentaires()` the ticket's comments (`[{ text }]`) and
149
+ * `ticketLu()` the ticket (`{ title, description }`), each read only when a changed line needs it,
150
+ * throwing when it does not read.
151
+ */
152
+ export function juger(ticket, interfaces, commentaires, ticketLu) {
153
+ const changees = [];
154
+ for (const { rel, avant: texteAvant, apres } of interfaces) {
155
+ const lignesAvant = texteAvant === null ? [] : lignesConsommateurs(texteAvant);
108
156
  const avant = new Set(lignesAvant);
109
157
  // The names each consumer of HEAD's section reads (`lireLigne` of scripts/langages/typescript/consommateurs.mjs,
110
158
  // the one reading of such a line: a line that is no list of names gives none).
@@ -112,7 +160,7 @@ export function verifier(racine, env = process.env) {
112
160
  for (const l of lignesAvant.map(lireLigne).filter(l => l?.noms)) {
113
161
  nomsAvant.set(l.consommateur, new Set([...(nomsAvant.get(l.consommateur) ?? []), ...l.noms]));
114
162
  }
115
- for (const ligne of lignesConsommateurs(readFileSync(iface, 'utf8'))) {
163
+ for (const ligne of lignesConsommateurs(apres)) {
116
164
  if (avant.has(ligne)) continue;
117
165
  const l = lireLigne(ligne);
118
166
  const lue = l?.noms ? l : null;
@@ -122,17 +170,9 @@ export function verifier(racine, env = process.env) {
122
170
  }
123
171
  }
124
172
  if (changees.length === 0) return [];
125
- const commun = git(racine, 'rev-parse', '--path-format=absolute', '--git-common-dir');
126
- const principal = path.dirname(commun.stdout.trim());
127
- const r = spawnSync('bd', ['comments', ticket, '--json'], {
128
- cwd: principal,
129
- encoding: 'utf8',
130
- maxBuffer: 256 * 1024 * 1024,
131
- });
132
173
  let comments;
133
174
  try {
134
- if (r.status !== 0) throw new Error(r.stderr || r.error?.message || `code ${r.status}`);
135
- comments = (JSON.parse(r.stdout || '[]') ?? []).map(x => ({ text: String(x.text ?? '') }));
175
+ comments = (commentaires() ?? []).map(x => ({ text: String(x.text ?? '') }));
136
176
  } catch (e) {
137
177
  return [
138
178
  {
@@ -148,17 +188,9 @@ export function verifier(racine, env = process.env) {
148
188
  if (restantes.length === 0) return [];
149
189
  // The lines no arbitrage settles: the ticket's plan, its title and its sections « Architecture »
150
190
  // and « Noms publiés ».
151
- const show = spawnSync('bd', ['show', ticket, '--json'], {
152
- cwd: principal,
153
- encoding: 'utf8',
154
- maxBuffer: 256 * 1024 * 1024,
155
- });
156
191
  let plan;
157
192
  try {
158
- if (show.status !== 0) {
159
- throw new Error(show.stderr || show.error?.message || `code ${show.status}`);
160
- }
161
- const t = JSON.parse(show.stdout || '[]')?.[0];
193
+ const t = ticketLu();
162
194
  plan = [
163
195
  t?.title ?? '',
164
196
  section(t?.description, /^Architecture\b/),
@@ -230,14 +230,22 @@ function fournisseur(spec, fichier, tous, soi) {
230
230
  }
231
231
 
232
232
  // What each component really uses of the others: Map provider → Map consumer → Set of names. Its
233
- // production code counts for every provider, its tests for a package of the material only.
234
- export function utilise(racine, tous = composants(racine)) {
233
+ // production code counts for every provider, its tests for a package of the material only; the
234
+ // providers its tests import, the material's included, go in <parLesTests>, when given (Map
235
+ // consumer → Set of providers, each of <tous>).
236
+ export function utilise(racine, tous = composants(racine), parLesTests = null) {
235
237
  const out = new Map();
236
238
  const matiere = new Set(matieres(racine).map(m => m.nom));
237
239
  for (const c of tous) {
238
240
  for (const { f, test } of fichiers(c.dir)) {
239
241
  for (const { spec, noms } of imports(lireSiPresent(f) ?? '')) {
240
242
  const p = fournisseur(spec, f, tous, c);
243
+ if (p && test && parLesTests) {
244
+ if (!parLesTests.has(c)) {
245
+ parLesTests.set(c, new Set());
246
+ }
247
+ parLesTests.get(c).add(p);
248
+ }
241
249
  if (!p || (test && !matiere.has(p.nom))) continue;
242
250
  if (!out.has(p.nom)) out.set(p.nom, new Map());
243
251
  const parConsommateur = out.get(p.nom);
@@ -15,7 +15,8 @@
15
15
  // imports the provider (the test file's path).
16
16
  // - By the types (scripts/langages/typescript/references-par-les-types.mjs): each element the text writes, resolved by
17
17
  // TypeScript's language service over the components' `tsconfig.json`.
18
- // - What each component reads (`lit`): its imports, and the providers of the elements it reads.
18
+ // - What each component reads (`lit`): its imports, and the providers of the elements it reads;
19
+ // what its tests read (`parLesTests`): the components its tests import.
19
20
  import { existsSync, readFileSync } from 'node:fs';
20
21
  import path from 'node:path';
21
22
  import {
@@ -97,12 +98,13 @@ function importe(texte, fichier, p) {
97
98
  // components <composants> of <racine> (`composants` of the module), the components the text
98
99
  // names <nommes>: `{ elements: [{ nom, fournisseur, lecteurs: [{ composant, par }] }],
99
100
  // sansFournisseur, types: { etat, raison, elements: [{ nom, declarations: [{ composant, publie }],
100
- // lecteurs: Map composant → Set of « par » }] }, lit: Map composant → Set of composants }`, each
101
- // component one of <composants>.
101
+ // lecteurs: Map composant → Set of « par » }] }, lit: Map composant → Set of composants,
102
+ // parLesTests: Map composant → Set of composants }`, each component one of <composants>.
102
103
  export function lecteurs(racine, { composants, noms, texte, nommes }) {
103
104
  const tous = composants.map(c => ({ nom: c.nom, dir: c.dossier, paquet: c.paquet, c }));
104
105
  const exterieur = i => i.c;
105
- const reel = utilise(racine, tous);
106
+ const testsLisent = new Map();
107
+ const reel = utilise(racine, tous, testsLisent);
106
108
  const ifaces = interfacesDe(racine, tous);
107
109
  const tests = new Map();
108
110
  const testsDuComposant = c => {
@@ -157,6 +159,12 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
157
159
  }
158
160
  }
159
161
  for (const e of elements) for (const l of e.lecteurs) lit.get(l.composant).add(e.fournisseur);
162
+ const parLesTests = new Map(composants.map(c => [c, new Set()]));
163
+ for (const [c, lus] of testsLisent) {
164
+ for (const p of lus) {
165
+ parLesTests.get(c.c).add(p.c);
166
+ }
167
+ }
160
168
  return {
161
169
  elements,
162
170
  sansFournisseur: sansFournisseur.filter(
@@ -175,5 +183,6 @@ export function lecteurs(racine, { composants, noms, texte, nommes }) {
175
183
  })),
176
184
  },
177
185
  lit,
186
+ parLesTests,
178
187
  };
179
188
  }
@@ -349,6 +349,7 @@ function appliquer(projet, { p, modele, source, version }, joueDesTests) {
349
349
  return {
350
350
  bilan,
351
351
  lignes: rapport(bilan),
352
+ aFaire: [],
352
353
  installer:
353
354
  bilan.plageDuCadre !== null ||
354
355
  bilan.configVitest !== null ||
@@ -261,8 +261,12 @@ export function leService(racine, tous) {
261
261
  // components the ticket names (<contexte>: `{ fichiers, composants }`, Sets of file names and of
262
262
  // components), when it has some: `{ etat: 'fait', raison: null, elements: [{ nom, ecrit,
263
263
  // declarations: [{ c, publie }], lecteurs: Map component → Set of « par » }] }`, or
264
- // `{ etat: 'impossible', raison, elements: [] }` when it cannot run.
264
+ // `{ etat: 'impossible', raison, elements: [] }` when it cannot run. Without any element, the
265
+ // survey is done at once: no language service is built.
265
266
  export function parLesTypes(racine, tous, ecrits, contexte = {}) {
267
+ if (ecrits.length === 0) {
268
+ return { etat: 'fait', raison: null, elements: [] };
269
+ }
266
270
  try {
267
271
  return releveParLesTypes(racine, tous, ecrits, contexte);
268
272
  } catch (e) {
package/scripts/nuit.sh CHANGED
@@ -63,6 +63,14 @@
63
63
  # the night ticket « La poussée de la nuit est refusée sur <commit> vers « origin/<branch> » »
64
64
  # (or comments the open one that names « origin/<branch> »), and exits 1; a remote already at
65
65
  # the commit accepts the push.
66
+ # - The copies whose content is on main: once its steps are played, whatever their verdict, the
67
+ # night passes each copy `git worktree list` names, the main tree and its own left out, through
68
+ # scripts/retirer-copie.sh without `--jetable` (scripts/copies-finies.mjs), as a CI cleans its
69
+ # workspaces at the end of a pipeline: a copy whose commits and local work have all entered
70
+ # main by their content goes, and its branch (main and a branch another copy holds stay); a copy
71
+ # refused (commits or work not entered, a lock) or held by a running circuit (its ticket in progress, its
72
+ # `<copie>.travail`, the lock of the integration or of the queue) stays, its log line naming
73
+ # why. The removal never changes the night's verdict.
66
74
  # - It takes no lock of the integration or of the queue (scripts/integration/file.mjs): an
67
75
  # integration and the queue run during the night, each in its own copy.
68
76
  # - Its log is <git common dir>/nuit/<date>.log. Green: HEAD becomes the last green commit
@@ -265,6 +273,9 @@ fin() {
265
273
  }
266
274
  jouer >> "$journal" 2>&1
267
275
  verdict=$?
276
+ # The copies whose content is on main go once the steps are played, the night's own kept; their
277
+ # removal never changes the verdict.
278
+ (cd "$racine" && node "$ici/copies-finies.mjs" "$copie") >> "$journal" 2>&1 || true
268
279
 
269
280
  if [ "$verdict" -eq 75 ]; then
270
281
  echo "⏱ à repasser : ${tete:0:7} n'est ni vert ni rouge, la machine est restée chargée ; le dernier vert reste, aucun ticket, la nuit suivante rejoue." >> "$journal"
@@ -24,7 +24,10 @@
24
24
  // - `reponses` (`titre` of the finding, `etat` levé or contesté, `raison` for a contesté,
25
25
  // `piece`): as the author answers in each thread of a review on GitHub or Gerrit, a FAIT
26
26
  // answers each finding of the reviewer open for him, by its title, and the circuit refuses a
27
- // sheet without the answer to one (`reponsesAuxConstats`) and gives the next review each answer
27
+ // sheet without the answer to one (`reponsesAuxConstats`), save in a run where the supervisor
28
+ // gives the task (`--contexte`, the findings open at the run's launch then its context, the
29
+ // ones a RENDU states within it still its task: `constatsDeLaSeance` of
30
+ // scripts/circuit.mjs), and gives the next review each answer
28
31
  // under its finding (BP 320.21: the cause of his choice in a handover the circuit does not
29
32
  // read, three RENDU, then the stop) (developpeur);
30
33
  // - `ecarts` (`sujet`, `texte`): the body of the commit message, written by the circuit, each
@@ -2,7 +2,8 @@
2
2
  # The removal of a working copy, called by the three places that end one: the agent copy (by
3
3
  # scripts/integration/integrer.mjs once its lot is committed, and by the supervisor for a ticket
4
4
  # closed without integration), the integration copy (by the same script) and the night copy
5
- # (scripts/nuit.sh), the last two when their existing copy does not get ready.
5
+ # (scripts/nuit.sh), the last two when their existing copy does not get ready; and by the night
6
+ # for every other copy once its steps are played (scripts/copies-finies.mjs), without `--jetable`.
6
7
  #
7
8
  # npx grillhouse retirer-copie [--jetable] [--garder-travail] <copie>
8
9
  #
@@ -19,7 +19,8 @@
19
19
  // the working tree holds no change. Nothing is pushed: the owner validates the push, whose
20
20
  // command the script names; `.github/workflows/release.yml` then plays the CI on the tagged
21
21
  // commit and, once it is green, checks the tag (`--verifier-etiquette`), publishes the package
22
- // on the npm registry (trusted publishing, no token stored) and the release on GitHub.
22
+ // on the npm registry (trusted publishing, no token stored) and the release on GitHub. The git
23
+ // it runs is passed in (`etiqueter`'s `git`): the command runs git in the repository.
23
24
  // - The marketplace roomi-fields (GitHub, roomi-fields/claude-plugins, a repository of its own)
24
25
  // lists the plugin by its source npm, ENTREE_DU_MARCHE: the package, without a subdirectory (a
25
26
  // source npm has none: the package's root is the plugin's) and without a version, so the machine
@@ -95,9 +96,12 @@ export function preparerSortie(racine, version, date) {
95
96
  );
96
97
  }
97
98
 
98
- // Creates the annotated tag of the release at <racine> on HEAD, and returns its name.
99
- export function etiqueter(racine) {
100
- const git = (...args) => execFileSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
99
+ // Creates the annotated tag of the release at <racine> on HEAD, and returns its name; <git> runs
100
+ // git in <racine> (its arguments, its output as text).
101
+ export function etiqueter(
102
+ racine,
103
+ git = (...args) => execFileSync('git', ['-C', racine, ...args], { encoding: 'utf8' })
104
+ ) {
101
105
  const etiquette = `v${versionDuCadre(racine)}`;
102
106
  if (git('status', '--porcelain').trim() !== '') {
103
107
  throw new Error(
@@ -30,6 +30,8 @@
30
30
  // reference, no tag. The branch `agent/<ticket>` of the ticket itself does not count for that
31
31
  // ticket: the integration commits there before the queue brings the commit onto main, which
32
32
  // then holds the one delivery; the branch of another ticket counts.
33
+ // - The reading of the history and the answers of Beads are passed in (`controle`, `commitsDelivering`,
34
+ // `gitLog`, `lireBeads`): the hook wires git and bd, a test passes its own.
33
35
  import { execFileSync } from 'node:child_process';
34
36
  import { readFileSync } from 'node:fs';
35
37
  import { pathToFileURL } from 'node:url';
@@ -108,6 +110,11 @@ function beads(id) {
108
110
  } catch (e) {
109
111
  out = typeof e?.stdout === 'string' ? e.stdout : '';
110
112
  }
113
+ return lireBeads(out, id);
114
+ }
115
+
116
+ // What the output <out> of `bd show <id> --json` answers on <id>: as `beads`.
117
+ export function lireBeads(out, id) {
111
118
  let answer;
112
119
  try {
113
120
  answer = JSON.parse(out);
@@ -121,15 +128,16 @@ function beads(id) {
121
128
  return answer && typeof answer === 'object' && 'error' in answer ? 'unknown' : null;
122
129
  }
123
130
 
124
- // `git log` with these arguments, its output as text.
125
- function log(...args) {
126
- return execFileSync('git', ['log', ...args], { encoding: 'utf8' });
127
- }
131
+ /** `git log` in the repository at <racine>: its arguments, its output as text. */
132
+ export const gitLog =
133
+ racine =>
134
+ (...args) =>
135
+ execFileSync('git', ['-C', racine, 'log', ...args], { encoding: 'utf8' });
128
136
 
129
137
  // The reverting commits of the history, over the branches, as a map from a commit's full sha to the
130
138
  // full sha it reverts. Git keeps the commits whose message holds a `This reverts commit` line and a
131
139
  // `Revert "` or `Reapply "` line; the output grows with those commits alone.
132
- function revertingCommits() {
140
+ function revertingCommits(log) {
133
141
  const out = log(
134
142
  '--branches',
135
143
  '--all-match',
@@ -152,8 +160,8 @@ function revertingCommits() {
152
160
  // The commits among `candidates` (`{ full, short }`) that no effective reverting commit names, and
153
161
  // that are not reverting commits themselves. A reverting commit is effective when no effective
154
162
  // reverting commit names it.
155
- function withoutWithdrawn(candidates) {
156
- const reverts = revertingCommits();
163
+ function withoutWithdrawn(candidates, log) {
164
+ const reverts = revertingCommits(log);
157
165
  const namedBy = new Map();
158
166
  for (const [hash, target] of reverts) {
159
167
  namedBy.set(target, [...(namedBy.get(target) ?? []), hash]);
@@ -177,7 +185,7 @@ function withoutWithdrawn(candidates) {
177
185
  // of its subject (`%<(N,trunc)%B`), which keeps its first line whole; that line decides. The output
178
186
  // grows with the commits quoting the id: by their first paragraphs, and by one byte per line of
179
187
  // their bodies, since the cut keeps every line break.
180
- function commitsDelivering(id, prefix) {
188
+ export function commitsDelivering(id, prefix, log) {
181
189
  const subjects = log(
182
190
  `--exclude=agent/${id}`,
183
191
  '--branches',
@@ -207,16 +215,22 @@ function commitsDelivering(id, prefix) {
207
215
  .filter(([, first = '']) => named(first, prefix).includes(id))
208
216
  .map(([hash]) => hash);
209
217
  return withoutWithdrawn(
210
- delivering.map(short => ({ short, full: subjects.find(c => c.hash === short).full }))
218
+ delivering.map(short => ({ short, full: subjects.find(c => c.hash === short).full })),
219
+ log
211
220
  ).map(c => c.short);
212
221
  }
213
222
 
214
- if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
215
- const prefix = prefixe();
223
+ /**
224
+ * The verdict of the hook on the message <message>, the prefix <prefix> read from Beads,
225
+ * `commitsOf(id)` the earlier commits delivering the id, `answer(id)` what Beads answers on it (as
226
+ * `beads`, each id asked once): `{ lignes, code }`, the lines the hook writes on its error output
227
+ * and its exit code (1 on a refusal).
228
+ */
229
+ export function controle(message, prefix, commitsOf, answer) {
216
230
  const answers = new Map();
217
- const answer = id => {
231
+ const answerOf = id => {
218
232
  if (!answers.has(id)) {
219
- answers.set(id, beads(id));
233
+ answers.set(id, answer(id));
220
234
  }
221
235
  return answers.get(id);
222
236
  };
@@ -224,23 +238,39 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
224
238
  const reason =
225
239
  prefix && !prefix.includes(' ')
226
240
  ? refusal(
227
- readFileSync(process.argv[2], 'utf8'),
241
+ message,
228
242
  prefix,
229
- id => commitsDelivering(id, prefix),
243
+ commitsOf,
230
244
  id => {
231
- const status = answer(id)?.status;
245
+ const status = answerOf(id)?.status;
232
246
  return typeof status === 'string' && status !== 'closed';
233
247
  },
234
- id => answer(id) !== 'unknown'
248
+ id => answerOf(id) !== 'unknown'
235
249
  )
236
250
  : null;
251
+ const lignes = [];
237
252
  if ([...answers.values()].includes(null)) {
238
- process.stderr.write(
239
- `Beads injoignable : chaque mot ${prefix}-… du titre compte pour un ticket, connu ou non.\n`
253
+ lignes.push(
254
+ `Beads injoignable : chaque mot ${prefix}-… du titre compte pour un ticket, connu ou non.`
240
255
  );
241
256
  }
242
257
  if (reason) {
243
- process.stderr.write(`⛔ ${reason}\n`);
244
- process.exitCode = 1;
258
+ lignes.push(`⛔ ${reason}`);
259
+ }
260
+ return { lignes, code: reason ? 1 : 0 };
261
+ }
262
+
263
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
264
+ const prefix = prefixe();
265
+ const log = gitLog(process.cwd());
266
+ const { lignes, code } = controle(
267
+ readFileSync(process.argv[2], 'utf8'),
268
+ prefix,
269
+ id => commitsDelivering(id, prefix, log),
270
+ beads
271
+ );
272
+ for (const l of lignes) {
273
+ process.stderr.write(`${l}\n`);
245
274
  }
275
+ process.exitCode = code;
246
276
  }
@@ -13,7 +13,8 @@
13
13
  // A project that declares no language (`grillhouse.langages`) is refused, exit code 2, the
14
14
  // update named: the lock cannot judge its writes, and a hook that throws would let them pass.
15
15
  // - developpeur writes none of the testwriter's files, and no other file until its ticket's
16
- // description holds a "## Architecture" section. The ticket is the "TON TICKET : <id>" line of the agent's
16
+ // description holds a "## Architecture" section (`sansArchitecture`, which the start of the
17
+ // circuit reads too). The ticket is the "TON TICKET : <id>" line of the agent's
17
18
  // launch prompt, read from its transcript.
18
19
  // - In an envelope (`GRILLHOUSE_ENVELOPPE`, the packages of the plan, scripts/enveloppe/
19
20
  // paquets-du-plan.mjs), a write in the copy out of the packages the plan writes (`ecritsDuPlan`
@@ -46,6 +47,14 @@ function isInside(file, dir) {
46
47
  return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
47
48
  }
48
49
 
50
+ // The refusal of the ticket <id> whose <description> holds no "## Architecture" section, or null:
51
+ // the one rule the developer's lock and the start of the circuit (scripts/circuit.mjs) read.
52
+ export function sansArchitecture(id, description) {
53
+ return /^##\s+Architecture\b/m.test(String(description ?? ''))
54
+ ? null
55
+ : `Le ticket ${id} n'a pas sa section « ## Architecture » : le code attend l'architecture. Rends la question au superviseur.`;
56
+ }
57
+
49
58
  const isScratch = (file, tmp = tmpdir()) => isInside(file, tmp);
50
59
 
51
60
  // The root of the git repository (or worktree) that holds the absolute path <file>, read from its
@@ -172,10 +181,7 @@ export function refusal(role, input, { tmp = tmpdir(), describe = ticketDescript
172
181
  if (description === null) {
173
182
  return `Le ticket ${id} est illisible par bd.`;
174
183
  }
175
- if (!/^##\s+Architecture\b/m.test(description)) {
176
- return `Le ticket ${id} n'a pas sa section « ## Architecture » : le code attend l'architecture. Rends la question au superviseur.`;
177
- }
178
- return null;
184
+ return sansArchitecture(id, description);
179
185
  }
180
186
  return `Rôle inconnu du verrou : ${role}.`;
181
187
  }
@@ -168,7 +168,11 @@ son adresse) : le circuit la consigne fermée sous ton ticket, et tu continues.
168
168
  `titre` tel que ta consigne l'écrit : `levé`, avec sa `piece`, ou `contesté`, avec sa `raison`
169
169
  et sa `piece` ; le circuit refuse une fiche à laquelle il en manque une, et le relecteur lit
170
170
  chaque réponse sous son constat, comme l'auteur répond dans chaque fil d'une revue. Une
171
- passation qui dit pourquoi tu gardes ton choix ne suffit pas : le relecteur ne la reçoit pas ;
171
+ passation qui dit pourquoi tu gardes ton choix ne suffit pas : le relecteur ne la reçoit pas.
172
+ Quand le superviseur te donne ta tâche, en tête de ta consigne, les constats ouverts au
173
+ lancement de sa passe sont ton contexte : aucune réponse ne leur est exigée, et une réponse
174
+ donnée reste lue sous son constat ; un constat qu'un `RENDU` pose dans la passe exige la
175
+ sienne ;
172
176
  - `ecarts` : ce que le message de commit nomme, chacun sous son `sujet` (ce qui s'écarte :
173
177
  une référence, un test, un plafond), avec son `texte` ;
174
178
  - `decouvertes` : ce que le circuit consigne fermé sous le ticket.
@@ -183,7 +187,11 @@ son adresse) : le circuit la consigne fermée sous ton ticket, et tu continues.
183
187
  valables. La dernière tentative, sur le modèle fort, est une séance neuve et entière. Ainsi tu
184
188
  repars de ce que tu sais. Toute relance (des contrôles rouges, un `RENDU`, une reprise du
185
189
  superviseur) porte les constats du relecteur qui restent ouverts pour toi, tous, jusqu'à la
186
- relecture qui les juge levés. Ainsi aucun constat ne se perd d'une relance à l'autre.
190
+ relecture qui les juge levés. Ainsi aucun constat ne se perd d'une relance à l'autre. Une
191
+ relance du superviseur avec son contexte (`--contexte`) te donne ce contexte en tête de ta
192
+ consigne : c'est ta tâche, qui passe avant le ticket, le rapport et les constats ; ceux
193
+ ouverts au lancement de sa passe te sont donnés en contexte, ceux qu'un `RENDU` pose dans la
194
+ passe restent ta tâche. Ainsi la demande du superviseur prime.
187
195
  - **Les tests ciblés** : les tests touchés et voisins, plus ceux des composants en aval quand une
188
196
  interface change (`npm test -- <fichiers>`).
189
197
  - **Une suite se juge sur tous ses échecs** : leur liste se compare nom par nom aux échecs connus.
@@ -138,7 +138,10 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
138
138
  le même lot (la charge, main), et `--depuis developpeur` repart du développeur, le refus comme
139
139
  son rapport, quand le lot est en cause ; `--arreter`, son motif en
140
140
  `--contexte`, quand le ticket
141
- doit changer avant tout travail. Une décision du responsable qui change le plan entre dans la
141
+ doit changer avant tout travail. Mon `--contexte` est la tâche du testwriter et du
142
+ développeur : il vient en tête de leur consigne, et les constats du relecteur ouverts au
143
+ lancement de la passe leur sont donnés en contexte, sans réponse exigée ; un constat qu'un
144
+ `RENDU` pose dans la passe reste leur tâche. Une décision du responsable qui change le plan entre dans la
142
145
  description du ticket (`bd update <ticket> -d`), que tous les agents lisent, avant que je
143
146
  reprenne. 22 (`questionnement`) : des questions du plan restent ouvertes après la réponse de
144
147
  l'explorateur, au ticket avec leur pièce ; je change le plan (`bd update <ticket>`) ou je le
@@ -302,7 +305,8 @@ Le circuit du ticket fait chaque commit après le verdict `ACCEPTÉ` du relecteu
302
305
  ## L'architecture tranche d'abord
303
306
 
304
307
  - **Un ticket part avec sa section « Architecture »** (charte, « Le flux d'une tâche ») : je
305
- l'écris avant de le proposer. Un mécanisme manquant devient le travail, jamais une compensation
308
+ l'écris avant de le proposer ; le circuit refuse dès son départ un ticket qui ne l'a pas, avec
309
+ la raison du verrou du développeur. Un mécanisme manquant devient le travail, jamais une compensation
306
310
  locale.
307
311
  - **Les critères naissent avec le ticket** : je crée chaque ticket de réalisation avec ses
308
312
  critères d'acceptation numérotés (`docs/agents/issue-tracker.md`, « Conventions »). Un cas
@@ -3,7 +3,10 @@
3
3
  Huit gabarits, que le circuit du ticket (`packages/grillhouse/scripts/circuit.mjs`) remplit, chaque `{{champ}}` reçu
4
4
  de lui : le premier pour chaque séance neuve du testwriter et du développeur, une par rôle pour
5
5
  tout le ticket, dans l'enveloppe du plan du ticket, le lanceur ajoutant ses sections, chaque
6
- consigne portant les constats du relecteur qui restent ouverts pour son rôle ; le second pour chaque séance du relecteur, hors
6
+ consigne portant les constats du relecteur qui restent ouverts pour son rôle, et, quand le
7
+ superviseur relance le circuit avec `--contexte`, ce contexte en tête, comme sa tâche
8
+ (`{{tache}}`), les constats ouverts au lancement de la passe devenant son contexte, après
9
+ ceux qu'un `RENDU` pose dans la passe (`{{ouverts}}`, leur titre, et `{{constats}}`) ; le second pour chaque séance du relecteur, hors
7
10
  enveloppe, après la passe finale verte, qui porte la liste des éléments du lot, et après un `RENDU` la relecture d'avant (la
8
11
  commande de la différence entre le lot qu'elle a lu et celui d'aujourd'hui, ses fichiers, les
9
12
  constats qui restent ouverts, chacun avec la réponse du développeur sous lui) et ne nomme que les fichiers que le lot change depuis elle ; le troisième pour la reprise
@@ -34,7 +37,7 @@ Tu es le {{role}} du dépôt {{depot}}. Contexte neuf, une seule tâche.
34
37
 
35
38
  Premier geste : charge ta compétence (outil Skill), puis suis-la. Ainsi tu travailles dans le cadre écrit.
36
39
 
37
- TON TICKET : {{ticket}} — {{sujet}}
40
+ {{tache}}TON TICKET : {{ticket}} — {{sujet}}
38
41
 
39
42
  TON PLAN : {{paquets}}, les paquets du ticket, le fournisseur d'abord ; ta séance porte tout le ticket, dans tous ces paquets.
40
43
 
@@ -42,8 +45,6 @@ REPRISE : {{reprise}}
42
45
 
43
46
  LOTS À LIRE : {{lots}}
44
47
 
45
- CONTEXTE : {{contexte}}
46
-
47
48
  LE TICKET, sa description et ses critères, lus au lancement de ta séance :
48
49
 
49
50
  {{description}}
@@ -52,7 +53,7 @@ LE RAPPORT DE L'ÉTAPE D'AVANT, mesuré par le circuit :
52
53
 
53
54
  {{rapport}}
54
55
 
55
- LES CONSTATS DU RELECTEUR QUI RESTENT OUVERTS pour ton rôle, chacun jusqu'à la relecture qui le juge levé :
56
+ {{ouverts}} :
56
57
 
57
58
  {{constats}}
58
59
 
@@ -68,7 +69,7 @@ LES RÉFÉRENCES QUE LE CIRCUIT RÉGÉNÈRE à l'étape 4.2, sur la copie entiè
68
69
 
69
70
  Ta séance finit sur ta fiche, que ton schéma décrit et que le circuit lit seule ; ta passation au ticket (`bd comments add`) reste, pour l'humain et la séance suivante de ton rôle : ce qui est fait, ce qui ne l'est pas et pourquoi.
70
71
 
71
- Testwriter : chaque test vert avant le code entre dans `verts_attendus` (son fichier depuis la racine, son nom complet tel que le rapport de la preuve l'écrit, sa raison) ; pour un fichier de tests que HEAD tient, adapté, dont tous les verts ont une même raison, le fichier et la raison seuls, qui n'excusent aucun rouge et ne valent rien sur un fichier neuf ; quand le ticket change un type ou un nom d'un paquet du plan, tu migres aussi, dans la même séance, la matière de test partagée et les tests du plan qui le lisent ; tu inscris, dans le même lot, chaque nom de la matière de test partagée que tes tests se mettent à importer, sur la ligne de leur paquet dans la section « Consommateurs » de l'interface du fournisseur. Développeur : quand le rouge qui reste est dans les tests du lot, ta fiche porte `renvoi` (testwriter), et le circuit relance le testwriter, puis la preuve et ta séance, sa consigne portant ta fiche, ta passation et la sortie rouge des derniers contrôles ; un critère que tu ne tiens pas parce qu'il demande un paquet hors du plan va dans `hors_plan` (son numéro, ce paquet, sa pièce), même quand ta fiche dit FAIT, et le circuit monte au superviseur à 3 Code ; sur FAIT, ta fiche répond à chaque constat du relecteur ouvert pour toi, par son titre, dans `reponses` (`levé` avec sa `piece`, ou `contesté` avec sa `raison` et sa `piece`), que le relecteur lit sous son constat, et le circuit refuse une fiche à laquelle il en manque une ; un écart que le commit doit nommer va dans `ecarts`, sous son sujet. Ainsi chaque rouge va à l'agent qui le lève.
72
+ Testwriter : chaque test vert avant le code entre dans `verts_attendus` (son fichier depuis la racine, son nom complet tel que le rapport de la preuve l'écrit, sa raison) ; pour un fichier de tests que HEAD tient, adapté, dont tous les verts ont une même raison, le fichier et la raison seuls, qui n'excusent aucun rouge et ne valent rien sur un fichier neuf ; quand le ticket change un type ou un nom d'un paquet du plan, tu migres aussi, dans la même séance, la matière de test partagée et les tests du plan qui le lisent ; tu inscris, dans le même lot, chaque nom de la matière de test partagée que tes tests se mettent à importer, sur la ligne de leur paquet dans la section « Consommateurs » de l'interface du fournisseur. Développeur : quand le rouge qui reste est dans les tests du lot, ta fiche porte `renvoi` (testwriter), et le circuit relance le testwriter, puis la preuve et ta séance, sa consigne portant ta fiche, ta passation et la sortie rouge des derniers contrôles ; un critère que tu ne tiens pas parce qu'il demande un paquet hors du plan va dans `hors_plan` (son numéro, ce paquet, sa pièce), même quand ta fiche dit FAIT, et le circuit monte au superviseur à 3 Code ; sur FAIT, ta fiche répond à chaque constat du relecteur ouvert pour toi, par son titre, dans `reponses` (`levé` avec sa `piece`, ou `contesté` avec sa `raison` et sa `piece`), que le relecteur lit sous son constat, et le circuit refuse une fiche à laquelle il en manque une ; quand le superviseur te donne ta tâche, en tête de cette consigne, les constats ouverts au lancement de sa passe te sont donnés en contexte : une réponse que tu leur donnes reste lue sous son constat, aucune n'est exigée ; un constat qu'un `RENDU` pose dans la passe exige la sienne ; un écart que le commit doit nommer va dans `ecarts`, sous son sujet. Ainsi chaque rouge va à l'agent qui le lève.
72
73
 
73
74
  Le `statut` de ta fiche : FAIT quand ta part est faite ; BLOQUÉ, avec sa `raison`, quand ce qui reste est hors de ta portée (dans les tests, dans la matière de test partagée, dans un fichier hors du plan, ou une décision hors de ton rôle) ; BESOIN, avec sa `question`, quand une réponse te manque pour avancer. Sur BESOIN, ou BLOQUÉ sans `renvoi`, le circuit s'arrête sans te relancer, et ta question monte au superviseur ; une découverte hors des critères va dans `decouvertes`, que le circuit consigne. Ainsi aucune séance ne tourne sur ce que son agent a dit hors de sa portée.
74
75
 
@@ -130,7 +131,7 @@ Ta séance a fini sans fiche conforme : {{erreur}}. Le circuit ne lit rien d'aut
130
131
  ## Testwriter et développeur, sur une reprise (rempli par le circuit)
131
132
 
132
133
  ```text
133
- TON TICKET : {{ticket}} — {{sujet}}
134
+ {{tache}}TON TICKET : {{ticket}} — {{sujet}}
134
135
 
135
136
  TON PLAN : {{paquets}}
136
137
 
@@ -142,11 +143,11 @@ LE RAPPORT NEUF, mesuré par le circuit :
142
143
 
143
144
  {{rapport}}
144
145
 
145
- LES CONSTATS DU RELECTEUR QUI RESTENT OUVERTS pour ton rôle :
146
+ {{ouverts}} :
146
147
 
147
148
  {{constats}}
148
149
 
149
- Lève ce que disent ce rapport et ces constats, dans le cadre de ta consigne. Ta séance finit sur ta fiche, que le circuit lit : `statut` FAIT, BLOQUÉ avec sa `raison`, ou BESOIN avec sa `question` ; développeur, sur FAIT, ta réponse à chacun de ces constats, par son titre (`reponses`). Ainsi le circuit lit ta fin.
150
+ Fais ta tâche quand le superviseur t'en donne une, en tête de cette consigne, et lève ce que disent ce rapport et les constats qui ne sont pas donnés en contexte ; sans tâche, lève ce que disent ce rapport et ces constats ; toujours dans le cadre de ta consigne. Ta séance finit sur ta fiche, que le circuit lit : `statut` FAIT, BLOQUÉ avec sa `raison`, ou BESOIN avec sa `question` ; développeur, sur FAIT, ta réponse à ces constats, par son titre (`reponses`), exigée pour chacun qui n'est pas donné en contexte. Ainsi le circuit lit ta fin.
150
151
  ```
151
152
 
152
153
  ## Questionneur, sur le plan (rempli par le circuit)
@@ -140,6 +140,13 @@ circuit cherche chaque pièce fichier:ligne dans la copie et refuse une fiche do
140
140
  introuvable. Le circuit l'écrit au ticket, sur plusieurs lignes, son premier mot le verdict, que le
141
141
  script d'intégration et le tableau lisent, puis tes remarques. Tu n'écris rien au ticket toi-même.
142
142
 
143
+ **Une pièce que le ticket exige se lit avant ton verdict** : une pièce qu'un critère ou une section
144
+ du ticket exige (une passation, une sortie, une décision) et que tu ne peux pas lire rend le lot
145
+ (`RENDU`), par un constat bloquant que son `role` adresse à l'agent qui la doit ; une décision qui
146
+ revient au responsable et que le lot n'a pas reçue monte par ta `question`, jamais sous un
147
+ `ACCEPTÉ`. Ainsi le lot n'entre sur main que sur des pièces lues, comme une revue mûre n'approuve
148
+ aucune preuve qu'elle n'a pas vue.
149
+
143
150
  **Un constat bloquant tient un critère du plan ou une règle du cadre**, que son champ `regle`
144
151
  nomme (« critère 2 », ou le document et sa règle) ; tout autre constat est une remarque (`genre`
145
152
  `remarque`), que le circuit écrit au ticket sans relancer personne. Seuls les constats bloquants