architecture-harness 0.29.3 → 0.29.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architecture-harness",
3
- "version": "0.29.3",
3
+ "version": "0.29.5",
4
4
  "type": "module",
5
5
  "description": "Architecture gates, lint rules and scaffolding for the bounded-vertical-slice architecture",
6
6
  "license": "MIT",
@@ -16,6 +16,18 @@ import { commandWords } from "./shell-command.mjs";
16
16
 
17
17
  const hash = (value) => createHash("sha256").update(value).digest("hex");
18
18
  const itemKey = ({ repo, number }) => `${repo.toLowerCase()}#${number}`;
19
+ // Prompt and Stop hooks have 5 seconds. The merge guard hook has 25 seconds and also spends up to 6 seconds on its lane.
20
+ const POLL_DEADLINE_MS = 3500;
21
+ const MERGE_DEADLINE_MS = 10_000;
22
+ const PAGE_SIZE = 100;
23
+ // A later `since` read starts this far before the last check, so local clock skew cannot hide a comment.
24
+ const SINCE_MARGIN_MS = 10 * 60_000;
25
+ // A /dev/null comment matches only the viewer's comment created in this window around the post-tool hook.
26
+ const POSTED_BEFORE_MS = 2 * 60_000;
27
+ const POSTED_AFTER_MS = 60_000;
28
+ const MARKER_TTL_MS = 10 * 60_000;
29
+ const iso = (ms) => new Date(Math.floor(ms / 1000) * 1000).toISOString();
30
+ const bodyText = (body) => (body ?? "").split("\r").join("").trim();
19
31
  const itemUrl = /https:\/\/github\.com\/([^/\s]+\/[^/\s]+)\/(issues|pull)\/(\d+)/g;
20
32
 
21
33
  // GitHub links no reference inside code, so a hex colour such as `#128282` names no issue.
@@ -29,7 +41,7 @@ function references(body, repo, add, linked = false) {
29
41
  if (linked) {
30
42
  for (const match of body.matchAll(/(?<![\w/])#(\d+)\b/g)) add(repo, Number(match[1]));
31
43
  } else {
32
- for (const match of body.matchAll(/\b(?:fixes|refs)\s+([^\r\n]*)/gi)) references(match[1], repo, add, true);
44
+ for (const match of body.matchAll(/\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?|refs)\s+([^\n\r]*)/gi)) references(match[1], repo, add, true);
33
45
  }
34
46
  }
35
47
 
@@ -123,11 +135,13 @@ function ledger(root, session) {
123
135
  const own = new Set();
124
136
  const reviews = new Map();
125
137
  const starts = new Map();
138
+ const viewers = new Map();
126
139
  let next = null;
127
140
  try {
128
141
  for (const line of readFileSync(file, "utf8").split("\n")) {
129
142
  try {
130
143
  const record = JSON.parse(line);
144
+ if (record.viewer?.owner && record.viewer.login) { viewers.set(record.viewer.owner, record.viewer.login); continue; }
131
145
  if (record.reviewStart) { starts.set(record.reviewStart, record.start); continue; }
132
146
  if (record.review) { reviews.set(record.review.key, record.review); continue; }
133
147
  if (record.reviewDone) { reviews.delete(record.reviewDone); continue; }
@@ -135,8 +149,9 @@ function ledger(root, session) {
135
149
  if (record.next) { next = record.next; continue; }
136
150
  if (typeof record.retired === "string") { const item = items.get(record.retired); if (item) item.retired = true; continue; }
137
151
  const key = itemKey(record);
138
- const item = items.get(key) ?? { repo: record.repo, number: record.number, seen: new Set(), shown: new Set(), pending: new Map(), prs: new Set() };
152
+ const item = items.get(key) ?? { repo: record.repo, number: record.number, seen: new Set(), shown: new Set(), pending: new Map(), prs: new Set(), cursors: new Map() };
139
153
  if (record.kind) item.kind = record.kind;
154
+ if (record.cursor?.endpoint) item.cursors.set(record.cursor.endpoint, record.cursor);
140
155
  if (record.retired === false) item.retired = false;
141
156
  if (record.updatedAt !== undefined) item.updatedAt = record.updatedAt;
142
157
  for (const pr of record.prs ?? []) item.prs.add(pr);
@@ -147,7 +162,7 @@ function ledger(root, session) {
147
162
  } catch { /* A torn record leaves earlier acknowledgments intact. */ }
148
163
  }
149
164
  } catch (error) { if (error.code !== "ENOENT") throw error; }
150
- return { items, own, reviews, starts, next, append(record) {
165
+ return { items, own, reviews, starts, viewers, next, append(record) {
151
166
  mkdirSync(path.dirname(file), { recursive: true });
152
167
  appendFileSync(file, `\n${JSON.stringify(record)}\n`);
153
168
  } };
@@ -183,16 +198,49 @@ function github(root, config, deadline, run) {
183
198
  };
184
199
  }
185
200
 
186
- async function comments(item, gh) {
187
- const prefix = `repos/${item.repo}`;
188
- const list = async (endpoint) => {
189
- const pages = await gh(item.repo, ["api", "--paginate", `${prefix}/${endpoint}?per_page=100`]);
190
- if (!Array.isArray(pages) || !pages.every(Array.isArray)) throw new Error("pages");
191
- return pages.flat().map(row => ({ ...row, endpoint: `${prefix}/${endpoint}` }));
192
- };
201
+ // Fragment: read one endpoint page by page from the item's cursor, and keep the progress of each full page.
202
+ // Comment endpoints accept `since`; the reviews endpoint does not, so its cursor keeps the last page instead.
203
+ async function readEndpoint(item, endpoint, gh, rows, progress, fromStart) {
204
+ const full = `repos/${item.repo}/${endpoint}`;
205
+ const since = !endpoint.endsWith("/reviews");
206
+ const cursor = item.cursors?.get(endpoint) ?? {};
207
+ const started = cursor.started ?? iso(Date.now());
208
+ // A merge reads from page 1: an edit moves a comment to an earlier `since` page, and reviews have no `since`.
209
+ let page = !fromStart && Number.isSafeInteger(cursor.page) && cursor.page > 0 ? cursor.page : 1;
210
+ for (;;) {
211
+ const query = [`per_page=${PAGE_SIZE}`, ...(since && cursor.since ? [`since=${cursor.since}`] : []), `page=${page}`].join("&");
212
+ const result = await gh(item.repo, ["api", `${full}?${query}`]);
213
+ if (!Array.isArray(result)) throw new Error("pages");
214
+ rows.push(...result.map(row => ({ ...row, endpoint: full })));
215
+ if (result.length < PAGE_SIZE) break;
216
+ // A resumed scan reads this full page again, so a deleted comment that shifts the pages hides no row.
217
+ progress.set(endpoint, { endpoint, since: cursor.since ?? null, page, started });
218
+ page++;
219
+ }
220
+ progress.set(endpoint, since ? { endpoint, since: iso(Date.parse(started) - SINCE_MARGIN_MS), page: 1 } : { endpoint, page });
221
+ }
222
+
223
+ async function comments(item, gh, progress, fromStart) {
193
224
  const endpoints = [`issues/${item.number}/comments`];
194
225
  if (item.kind === "pr") endpoints.push(`pulls/${item.number}/reviews`, `pulls/${item.number}/comments`);
195
- return (await Promise.all(endpoints.map(list))).flat();
226
+ const rows = [];
227
+ const results = await Promise.allSettled(endpoints.map(endpoint => readEndpoint(item, endpoint, gh, rows, progress, fromStart)));
228
+ return { rows, error: results.find(result => result.status === "rejected")?.reason };
229
+ }
230
+
231
+ function saveCursors(state, item, progress) {
232
+ for (const cursor of progress.values()) state.append({ repo: item.repo, number: item.number, cursor });
233
+ }
234
+
235
+ const ownRow = (state, row) => state.own.has(row.html_url) || state.own.has(row.url) || state.own.has(`${row.endpoint}:${row.id}`);
236
+ const previewOf = (row) => ({ id: row.id, url: row.url, html_url: row.html_url, endpoint: row.endpoint, user: { login: row.user?.login },
237
+ state: row.state, body: (row.body ?? "").slice(0, 700), truncated: true });
238
+
239
+ // Fragment: pending rows the session has not acknowledged; a legacy record without a preview still names its comment.
240
+ function pendingRows(item, all) {
241
+ return [...(item.pending?.values() ?? [])].filter(pending => !item.seen?.has(pending.stamp) && (all || pending.row))
242
+ .map(pending => ({ stamp: pending.stamp, row: pending.row ?? pending.preview ??
243
+ { id: pending.id, url: pending.url, html_url: pending.url, endpoint: pending.endpoint, body: "", truncated: true } }));
196
244
  }
197
245
 
198
246
  // Fragment: ask for every watched item's metadata in one request per repository.
@@ -206,14 +254,51 @@ async function itemMetadata(repo, items, gh) {
206
254
  return result.data.repository;
207
255
  }
208
256
 
209
- async function unseen(item, gh, state) {
210
- const rows = await comments(item, gh);
211
- for (const marker of state.reviews.values()) {
257
+ // Fragment: new rows since the item's cursor plus the pending rows not yet acknowledged.
258
+ // A failed read keeps the rows it got as pending, saves its page progress, and throws.
259
+ // Resource: the gh account login for a repository owner, cached in the ledger.
260
+ async function viewerLogin(state, repo, gh) {
261
+ const owner = repo.split("/")[0].toLowerCase();
262
+ if (state.viewers.has(owner)) return state.viewers.get(owner);
263
+ try {
264
+ const login = (await gh(repo, ["api", "user"]))?.login;
265
+ if (typeof login !== "string" || !login) return null;
266
+ state.append({ viewer: { owner, login } });
267
+ state.viewers.set(owner, login);
268
+ return login;
269
+ } catch {
270
+ // Without the login no comment can match the marker, so the comment stays unseen; that is the safe side.
271
+ return null;
272
+ }
273
+ }
274
+
275
+ // Fragment: claim the session's /dev/null comment by viewer login, body, and the time nearest the post.
276
+ async function claimComment(marker, item, rows, gh, state) {
277
+ const posted = Date.parse(marker.posted);
278
+ const candidates = Number.isNaN(posted) ? [] : rows.filter(row => row.endpoint.endsWith(`/issues/${item.number}/comments`) &&
279
+ !state.own.has(`${row.endpoint}:${row.id}`) && hash(bodyText(row.body)) === marker.bodyHash &&
280
+ Date.parse(row.created_at) >= posted - POSTED_BEFORE_MS && Date.parse(row.created_at) <= posted + POSTED_AFTER_MS);
281
+ const login = candidates.length ? await viewerLogin(state, item.repo, gh) : null;
282
+ const row = candidates.filter(row => login && row.user?.login?.toLowerCase() === login.toLowerCase())
283
+ .sort((a, b) => Math.abs(Date.parse(a.created_at) - posted) - Math.abs(Date.parse(b.created_at) - posted) || a.id - b.id)[0];
284
+ if (row) return row;
285
+ if (Number.isNaN(posted) || Date.now() > posted + MARKER_TTL_MS) {
286
+ state.append({ reviewDone: marker.key });
287
+ state.reviews.delete(marker.key);
288
+ }
289
+ return null;
290
+ }
291
+
292
+ async function unseen(item, gh, state, fromStart = false) {
293
+ const progress = new Map();
294
+ const { rows, error } = await comments(item, gh, progress, fromStart);
295
+ for (const marker of [...state.reviews.values()]) {
212
296
  if (itemKey(marker) !== itemKey(item)) continue;
213
- const row = rows.filter(row => row.endpoint.endsWith("/reviews") &&
214
- !state.own.has(`${row.endpoint}:${row.id}`) && Date.parse(row.submitted_at) >= Date.parse(marker.start) &&
215
- (marker.empty ? row.state === marker.state : hash(row.body ?? "") === marker.bodyHash))
216
- .sort((a, b) => Date.parse(a.submitted_at) - Date.parse(b.submitted_at) || a.id - b.id)[0];
297
+ const row = marker.kind === "comment" ? await claimComment(marker, item, rows, gh, state)
298
+ : rows.filter(row => row.endpoint.endsWith("/reviews") &&
299
+ !state.own.has(`${row.endpoint}:${row.id}`) && Date.parse(row.submitted_at) >= Date.parse(marker.start) &&
300
+ (marker.empty ? row.state === marker.state : hash(row.body ?? "") === marker.bodyHash))
301
+ .sort((a, b) => Date.parse(a.submitted_at) - Date.parse(b.submitted_at) || a.id - b.id)[0];
217
302
  if (!row) continue;
218
303
  const key = `${row.endpoint}:${row.id}`;
219
304
  state.append({ own: [key] });
@@ -221,13 +306,23 @@ async function unseen(item, gh, state) {
221
306
  state.append({ reviewDone: marker.key });
222
307
  state.reviews.delete(marker.key);
223
308
  }
224
- return rows.filter((row) => !state.own.has(row.html_url) && !state.own.has(row.url) && !state.own.has(`${row.endpoint}:${row.id}`) && (row.body?.trim() || row.state))
309
+ const fresh = new Map(rows.filter((row) => !ownRow(state, row) && (row.body?.trim() || row.state))
225
310
  .map((row) => ({ row, stamp: hash(JSON.stringify([row.html_url, row.id, row.updated_at ?? row.submitted_at ?? row.created_at, row.body, row.state])) }))
226
- .filter(({ stamp }) => !item.seen?.has(stamp));
311
+ .filter(({ stamp }) => !item.seen?.has(stamp)).map(entry => [entry.stamp, entry]));
312
+ const read = [...fresh.values()];
313
+ for (const entry of pendingRows(item, true)) if (!fresh.has(entry.stamp) && !ownRow(state, entry.row)) fresh.set(entry.stamp, entry);
314
+ if (error) {
315
+ const kept = read.filter(({ stamp }) => !item.pending?.has(stamp))
316
+ .map(({ row, stamp }) => ({ stamp, id: row.id, endpoint: row.endpoint, url: row.url, ...(truncated(row) ? { preview: previewOf(row) } : { row }) }));
317
+ if (kept.length) state.append({ repo: item.repo, number: item.number, pending: kept });
318
+ saveCursors(state, item, progress);
319
+ throw error;
320
+ }
321
+ return { fresh: [...fresh.values()], progress };
227
322
  }
228
323
 
229
324
  const bodyOf = (row) => [row.state, row.body].filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
230
- const truncated = (row) => bodyOf(row).length > 700;
325
+ const truncated = (row) => row.truncated === true || bodyOf(row).length > 700;
231
326
  const describe = (item, row) => `@${row.user?.login ?? "unknown"} on ${itemKey(item)} ${row.html_url}: ${bodyOf(row).slice(0, 700)}${truncated(row) ? ` [truncated; read in full: gh api ${row.endpoint} --paginate]` : ""}`;
232
327
  const context = (event, text) => ({ hookSpecificOutput: { hookEventName: event, additionalContext: text } });
233
328
 
@@ -236,7 +331,7 @@ function recordPreview(state, item, fresh, acknowledge = false) {
236
331
  const seen = acknowledge ? fresh.filter(({ row }) => !truncated(row)).map(({ stamp }) => stamp) : [];
237
332
  const shown = fresh.filter(({ row }) => truncated(row)).map(({ stamp }) => stamp);
238
333
  const pending = fresh.filter(({ row }) => truncated(row) || !acknowledge)
239
- .map(({ row, stamp }) => ({ stamp, id: row.id, endpoint: row.endpoint, url: row.url, ...(!truncated(row) ? { row } : {}) }));
334
+ .map(({ row, stamp }) => ({ stamp, id: row.id, endpoint: row.endpoint, url: row.url, ...(!truncated(row) ? { row } : { preview: previewOf(row) }) }));
240
335
  if (seen.length || pending.length) state.append({ repo: item.repo, number: item.number, seen, shown, pending });
241
336
  }
242
337
 
@@ -318,7 +413,7 @@ export async function commentWatch(call, { gh: run = runCommentGh, merges: merge
318
413
  if (config.commentWatch === false) return null;
319
414
  const state = ledger(root, call.session_id);
320
415
  if (!state) return null;
321
- const deadline = Date.now() + 3500;
416
+ const deadline = Date.now() + (event === "PreToolUse" ? MERGE_DEADLINE_MS : POLL_DEADLINE_MS);
322
417
  const gh = github(root, config, deadline, run);
323
418
  if (event === "PostToolUse") {
324
419
  const parse = PARSERS[call.tool_name];
@@ -326,7 +421,8 @@ export async function commentWatch(call, { gh: run = runCommentGh, merges: merge
326
421
  const origin = originOf(root, 1000);
327
422
  if (call.tool_response?.is_error || call.tool_response?.exit_code > 0) return null;
328
423
  const watched = watchedItems(call, origin, parse);
329
- const prs = [...state.items.values(), ...watched].filter(item => item.kind === "pr");
424
+ // Only a PR named in the same command links an item; a later merge reads the PR body and commits for the rest.
425
+ const prs = watched.filter(item => item.kind === "pr");
330
426
  for (const item of watched) watch(state, { ...item, prs: prs.filter(pr => pr.repo === item.repo).map(itemKey) });
331
427
  for (const { words, env } of ghCalls(call.tool_input?.command ?? "", parse)) {
332
428
  const command = { ...ghCommand(words), env };
@@ -355,6 +451,12 @@ export async function commentWatch(call, { gh: run = runCommentGh, merges: merge
355
451
  const endpoint = `repos/${repo.toLowerCase()}/${resource}`;
356
452
  const keys = createdKeys(call.tool_response, endpoint);
357
453
  state.append({ own: keys });
454
+ // Output sent to /dev/null carries no URL, so the next read matches the session's comment by author, body, and time.
455
+ const comment = bodyText(found.body);
456
+ if (command.verb === "comment" && comment && !keys.some(key => key.startsWith(`${endpoint}:`) || /#issuecomment-\d+$/.test(key))) {
457
+ state.append({ review: { kind: "comment", repo: repo.toLowerCase(), number, posted: new Date().toISOString(),
458
+ bodyHash: hash(comment), key: randomUUID() } });
459
+ }
358
460
  if (command.group === "pr" && command.verb === "review" && !keys.some(key => key.startsWith(`${endpoint}:`) || /(?:#pullrequestreview-\d+|\/pulls\/\d+\/reviews\/\d+)$/.test(key))) {
359
461
  const body = found.body.replace(/^\n/, "");
360
462
  const start = state.starts.get(hash(call.tool_input.command)) ?? new Date(Math.floor(Date.now() / 1000) * 1000).toISOString();
@@ -410,10 +512,10 @@ export async function commentWatch(call, { gh: run = runCommentGh, merges: merge
410
512
  if (!info || !["OPEN", "CLOSED", "MERGED"].includes(info.state) || typeof info.updatedAt !== "string" || !info.updatedAt) throw new Error("response");
411
513
  if (info.__typename === "PullRequest") item.kind = "pr";
412
514
  const changed = info.updatedAt !== item.updatedAt;
413
- const fresh = changed ? await unseen(item, gh, state)
414
- : [...item.pending.values()].filter(pending => pending.row && !item.seen.has(pending.stamp)).map(({ row, stamp }) => ({ row, stamp }));
515
+ const { fresh, progress } = changed ? await unseen(item, gh, state) : { fresh: pendingRows(item, false), progress: new Map() };
415
516
  lines.push(...fresh.filter(({ stamp }) => !item.shown.has(stamp)).map(({ row }) => describe(item, row)));
416
517
  recordPreview(state, item, fresh, event === "UserPromptSubmit");
518
+ saveCursors(state, item, progress);
417
519
  if (changed) state.append({ repo: item.repo, number: item.number, kind: item.kind, updatedAt: info.updatedAt });
418
520
  if (["CLOSED", "MERGED"].includes(info.state)) state.append({ retired: itemKey(item) });
419
521
  } catch (error) {
@@ -448,22 +550,28 @@ export async function commentWatch(call, { gh: run = runCommentGh, merges: merge
448
550
  selector = String(result.data?.node?.number ?? "");
449
551
  }
450
552
  if (!repo) throw new Error("repository");
451
- const pr = await gh(repo, ["pr", "view", ...(selector ? [selector] : []), "-R", repo, "--json", "number,body,commits"]);
553
+ const pr = await gh(repo, ["pr", "view", ...(selector ? [selector] : []), "-R", repo, "--json", "number,body,commits,closingIssuesReferences"]);
452
554
  const targets = new Map();
453
555
  const key = itemKey({ repo, number: pr.number });
454
556
  const add = (repo, number, kind = "issue") => targets.set(itemKey({ repo, number }), { repo: repo.toLowerCase(), number, kind, prs: [key] });
455
557
  references(pr.body ?? "", repo, add, true);
456
558
  for (const commit of pr.commits ?? []) references(`${commit.messageHeadline ?? ""}\n${commit.messageBody ?? ""}`, repo, add);
559
+ for (const ref of pr.closingIssuesReferences ?? []) {
560
+ const owner = ref.repository?.owner?.login;
561
+ const name = ref.repository?.name;
562
+ add(owner && name ? `${owner}/${name}` : repo, ref.number);
563
+ }
457
564
  for (const item of state.items.values()) {
458
- if (item.prs.has(key) || (item.kind !== "pr" && !item.prs.size && item.repo === repo.toLowerCase())) add(item.repo, item.number, item.kind);
565
+ if (item.prs.has(key)) add(item.repo, item.number, item.kind);
459
566
  }
460
567
  add(repo, pr.number, "pr");
461
568
  await Promise.all([...targets.values()].map(async target => {
462
569
  watch(state, target);
463
570
  const item = { ...state.items.get(itemKey(target)), ...target };
464
571
  try {
465
- const fresh = await unseen(item, gh, state);
572
+ const { fresh, progress } = await unseen(item, gh, state, true);
466
573
  recordPreview(state, item, fresh);
574
+ saveCursors(state, item, progress);
467
575
  lines.push(...fresh.map(({ row }) => describe(item, row)));
468
576
  }
469
577
  catch { failed = true; lines.push(`GitHub comments for ${itemKey(target)} could not be checked.`); }
@@ -145,7 +145,7 @@ function fixture(t) {
145
145
  if (data.fail || args.some(arg => arg.includes(data.failEndpoint ?? 'NEVER_MATCH'))) return { status: 1, stderr: data.failure ?? 'TOKEN_MUST_STAY_SECRET' };
146
146
  if (args[0] === 'api' && args[1].includes('/git/ref/heads/') && args.at(-2) === '--jq' && args.at(-1) === '.object.sha') return { status: 0, stdout: data.baseOid };
147
147
  let result;
148
- if (args[0] === 'pr') result = { baseRefName: 'main', baseRefOid: data.baseOid, labels: [], number: 7, body: data.body ?? 'Fixes #4; https://github.com/ArentInc/other/issues/8', commits: data.commits ?? [] };
148
+ if (args[0] === 'pr') result = { baseRefName: 'main', baseRefOid: data.baseOid, labels: [], number: 7, body: data.body ?? 'Fixes #4; https://github.com/ArentInc/other/issues/8', commits: data.commits ?? [], closingIssuesReferences: data.closing ?? [] };
149
149
  else if (args[1] === 'user') result = { login: 'self' };
150
150
  else if (args[1] === 'graphql') {
151
151
  const query = args.find(arg => arg.startsWith('query=')) ?? '';
@@ -160,15 +160,30 @@ function fixture(t) {
160
160
  const endpoint = args.at(-1);
161
161
  if (/issues\\/7$/.test(endpoint)) result = { pull_request: {} };
162
162
  else if (/issues\\/\\d+$/.test(endpoint)) result = {};
163
- else result = [[], data.rows.filter(row => endpoint.includes(row.endpoint)).map(({endpoint, ...row}) => row)];
163
+ else if (args.includes('--paginate')) result = [[], data.rows.filter(row => endpoint.includes(row.endpoint)).map(({endpoint, ...row}) => row)];
164
+ else {
165
+ const [route, query = ''] = endpoint.split('?');
166
+ const params = new URLSearchParams(query);
167
+ const since = params.get('since');
168
+ const size = Number(params.get('per_page') ?? 30);
169
+ const page = Number(params.get('page') ?? 1);
170
+ result = data.rows.filter(row => route.endsWith('/' + row.endpoint) && (!since || !row.updated_at || row.updated_at >= since))
171
+ .map(({endpoint, ...row}) => row).slice((page - 1) * size, page * size);
172
+ }
164
173
  }
165
- return {status: 0, stdout: args.includes('--paginate') ? result.map(page => JSON.stringify(page)).join('\\n') : JSON.stringify(result)};
174
+ const rows = Array.isArray(result) ? result.flat().length : 0;
175
+ return {status: 0, rows, stdout: args.includes('--paginate') ? result.map(page => JSON.stringify(page)).join('\\n') : JSON.stringify(result)};
166
176
  };
167
177
  cp.execFile = (program, args, options, callback) => {
168
178
  const data = JSON.parse(readFileSync(process.env.DATA, 'utf8'));
169
179
  appendFileSync(process.env.CALLS, JSON.stringify({ start: Date.now(), args, config: options.env.GH_CONFIG_DIR }) + '\\n');
170
180
  const result = cp.spawnSync(program, args, options);
171
- setTimeout(() => callback(result.status ? new Error('gh failed') : null, result.stdout, result.stderr), data.delay ?? 0);
181
+ const delay = (data.delay ?? 0) + (data.rowDelay ?? 0) * (result.rows ?? 0);
182
+ if (options.timeout && delay > options.timeout) {
183
+ setTimeout(() => callback(Object.assign(new Error('killed'), { killed: true }), '', ''), options.timeout);
184
+ return;
185
+ }
186
+ setTimeout(() => callback(result.status ? new Error('gh failed') : null, result.stdout, result.stderr), delay);
172
187
  };
173
188
  syncBuiltinESMExports();
174
189
  `);
@@ -238,7 +253,7 @@ test("prompts show shared-login feedback once, retain failures, and isolate sess
238
253
  const output = f.run("UserPromptSubmit").hookSpecificOutput.additionalContext;
239
254
  for (const id of [1, 2, 3, 4, 5]) assert.match(output, new RegExp(`Comment ${id}`));
240
255
  assert.equal(f.run("UserPromptSubmit"), null);
241
- f.rows.push({ ...f.rows[0], body: "Edited comment" });
256
+ f.rows.push({ ...f.rows[0], body: "Edited comment", updated_at: new Date().toISOString() });
242
257
  f.update();
243
258
  assert.match(JSON.stringify(f.run("UserPromptSubmit")), /Edited comment/);
244
259
  assert.equal(f.run("UserPromptSubmit", "", "comment-watch.mjs", "other-session"), null);
@@ -450,13 +465,13 @@ test("a PR body read at merge skips hex colours in code spans", (t) => {
450
465
  assert.doesNotMatch(readFileSync(f.calls, "utf8"), /issues\/128282/);
451
466
  });
452
467
 
453
- test("merge targets include commit-only references and previously watched issues", (t) => {
468
+ test("merge targets include commit-only references and issues an earlier command linked to the PR", (t) => {
454
469
  const f = fixture(t);
455
470
  f.rows.length = 0;
456
471
  f.rows.push(...[9, 10].map(id => ({ id, endpoint: `issues/${id}/comments`, body: `Comment ${id}`, html_url: `https://github.com/comments/${id}` })));
457
472
  f.update({ commits: [{ messageHeadline: "Fixes #9", messageBody: "Refs #11" }] });
458
473
  f.run("PostToolUse", "gh pr view 7");
459
- f.run("PostToolUse", 'git commit -m "Refs #10"');
474
+ f.run("PostToolUse", 'gh pr comment 7 --body "Refs #10"');
460
475
  const output = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs");
461
476
  assert.match(JSON.stringify(output), /Comment 9/);
462
477
  assert.match(JSON.stringify(output), /Comment 10/);
@@ -501,7 +516,7 @@ test("polls batch metadata per repository and fetch comments only when updatedAt
501
516
  assert.match(query, /state updatedAt/);
502
517
  const commentCalls = calls.filter(call => call.args[1] !== "graphql");
503
518
  assert.equal(commentCalls.length, 5);
504
- assert.ok(commentCalls.every(call => call.args.includes("--paginate")));
519
+ assert.ok(commentCalls.every(call => call.args.at(-1).includes("per_page=100")));
505
520
  assert.ok(calls.every(call => !call.args.includes("--slurp")));
506
521
  writeFileSync(f.calls, "");
507
522
  assert.equal(f.run("UserPromptSubmit"), null);
@@ -513,7 +528,7 @@ test("polls batch metadata per repository and fetch comments only when updatedAt
513
528
  assert.equal(f.run("UserPromptSubmit"), null);
514
529
  const named = readFileSync(f.calls, "utf8").trim().split("\n").map(JSON.parse);
515
530
  assert.ok(named.every(call => call.args[1] === "graphql"));
516
- f.rows[0].body = "Retry this item";
531
+ Object.assign(f.rows[0], { body: "Retry this item", updated_at: new Date().toISOString() });
517
532
  f.update({ failEndpoint: "issues/4/comments" });
518
533
  assert.match(JSON.stringify(f.run("UserPromptSubmit")), /Comment watch: 1 items could not be checked \(gh\); retry on the next prompt\./);
519
534
  f.update();
@@ -557,7 +572,7 @@ for (const state of ["CLOSED", "MERGED"]) test(`${state} items retire after one
557
572
  f.run("UserPromptSubmit");
558
573
  const calls = readFileSync(f.calls, "utf8").trim().split("\n").map(JSON.parse).filter(call => call.start);
559
574
  assert.equal(calls.filter(call => call.args[1] === "graphql").length, 1);
560
- assert.equal(calls.filter(call => call.args.includes("--paginate")).length, number === 7 ? 3 : 1);
575
+ assert.equal(calls.filter(call => call.args.at(-1).includes("per_page=100")).length, number === 7 ? 3 : 1);
561
576
  });
562
577
 
563
578
  test("a merge checks a retired issue named in the PR body again", (t) => {
@@ -565,7 +580,7 @@ test("a merge checks a retired issue named in the PR body again", (t) => {
565
580
  f.update({ metadata: { 4: { state: "CLOSED" } } });
566
581
  f.run("PostToolUse", "gh issue close 4");
567
582
  f.run("UserPromptSubmit");
568
- f.rows[0].body = "Feedback after retirement";
583
+ Object.assign(f.rows[0], { body: "Feedback after retirement", updated_at: new Date().toISOString() });
569
584
  f.update();
570
585
  assert.equal(f.run("UserPromptSubmit"), null);
571
586
  writeFileSync(f.calls, "");
@@ -722,8 +737,172 @@ test("a gh API command naming a retired item watches it again", (t) => {
722
737
  f.update({ metadata: { 4: { state: "CLOSED" } } });
723
738
  f.run("PostToolUse", "gh issue view 4");
724
739
  f.run("UserPromptSubmit");
725
- f.rows[0].body = "New feedback on the retired issue";
740
+ Object.assign(f.rows[0], { body: "New feedback on the retired issue", updated_at: new Date().toISOString() });
726
741
  f.update();
727
742
  f.run("PostToolUse", "gh api repos/shawrylk/example/issues/4");
728
743
  assert.match(JSON.stringify(f.run("UserPromptSubmit")), /New feedback on the retired issue/);
729
744
  });
745
+
746
+ test("a 500-comment issue no longer exceeds the deadline after its first check", (t) => {
747
+ const f = fixture(t);
748
+ f.rows.length = 0;
749
+ for (let id = 1; id <= 500; id++) f.rows.push({ id, endpoint: "issues/4/comments", user: { login: "other" }, body: `Old note ${id}`,
750
+ html_url: `https://github.com/shawrylk/example/issues/4#issuecomment-${id}`, created_at: "2026-01-01T00:00:00Z", updated_at: "2026-01-01T00:00:00Z" });
751
+ // 8 ms a row: one page of 100 takes 0.8 s, and the full history takes 4 s against the 3.5 s prompt deadline.
752
+ f.update({ rowDelay: 8 });
753
+ f.run("PostToolUse", "gh issue view 4");
754
+ const first = JSON.stringify(f.run("UserPromptSubmit"));
755
+ assert.match(first, /1 items could not be checked \(deadline\)/);
756
+ const output = JSON.stringify(f.run("UserPromptSubmit"));
757
+ assert.doesNotMatch(output, /could not be checked/);
758
+ assert.match(output, /Old note 1\b/);
759
+ assert.match(output, /Old note 500\b/);
760
+ const now = new Date().toISOString();
761
+ f.rows.push({ id: 501, endpoint: "issues/4/comments", user: { login: "other" }, body: "Fresh foreign note",
762
+ html_url: "https://github.com/shawrylk/example/issues/4#issuecomment-501", created_at: now, updated_at: now });
763
+ f.update({ rowDelay: 8 });
764
+ writeFileSync(f.calls, "");
765
+ const next = JSON.stringify(f.run("UserPromptSubmit"));
766
+ assert.match(next, /Fresh foreign note/);
767
+ assert.doesNotMatch(next, /could not be checked/);
768
+ assert.doesNotMatch(next, /Old note/);
769
+ const reads = readFileSync(f.calls, "utf8").trim().split("\n").map(JSON.parse).filter(call => call.start && call.args[1] !== "graphql");
770
+ assert.ok(reads.length > 0 && reads.every(call => /[?&]since=/.test(call.args.at(-1))), JSON.stringify(reads));
771
+ });
772
+
773
+ for (const redirected of [false, true]) test(`comments the session posts with gh issue comment and gh pr comment are own (${redirected ? "output to /dev/null" : "URL output"})`, (t) => {
774
+ const f = fixture(t);
775
+ const now = new Date().toISOString();
776
+ const note = (id, number, body) => ({ id, endpoint: `issues/${number}/comments`, user: { login: "self" }, body,
777
+ html_url: `https://github.com/shawrylk/example/issues/${number}#issuecomment-${id}`, created_at: now, updated_at: now });
778
+ f.rows.length = 0;
779
+ f.rows.push(note(40, 4, "Triage: load timeout, joins #2925."), note(41, 7, "Ready to merge."));
780
+ f.update({ body: "Fixes #4" });
781
+ const tail = redirected ? " >/dev/null" : "";
782
+ f.run("PostToolUse", `gh issue comment 4 --body "Triage: load timeout, joins #2925."${tail}`, "comment-watch.mjs", "session-a",
783
+ { stdout: redirected ? "" : f.rows[0].html_url, stderr: "" }, "Bash");
784
+ f.run("PostToolUse", `gh pr comment 7 --body "Ready to merge."${tail}`, "comment-watch.mjs", "session-a",
785
+ { stdout: redirected ? "" : f.rows[1].html_url, stderr: "" }, "Bash");
786
+ const merge = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs");
787
+ assert.notEqual(merge?.hookSpecificOutput?.permissionDecision, "deny", JSON.stringify(merge));
788
+ assert.equal(f.run("UserPromptSubmit"), null);
789
+ });
790
+
791
+ test("a merge names one new foreign comment and ignores watched issues the PR does not link", (t) => {
792
+ const f = fixture(t);
793
+ const now = new Date().toISOString();
794
+ const note = (id, number, body, login) => ({ id, endpoint: `issues/${number}/comments`, user: { login }, body,
795
+ html_url: `https://github.com/shawrylk/example/issues/${number}#issuecomment-${id}`, created_at: now, updated_at: now });
796
+ f.rows.length = 0;
797
+ f.rows.push(note(50, 4, "Session triage note", "self"), note(51, 12, "Dashboard chatter", "other"));
798
+ f.update({ body: "Fixes #4" });
799
+ f.run("PostToolUse", 'gh issue comment 4 --body "Session triage note" >/dev/null', "comment-watch.mjs", "session-a", { stdout: "", stderr: "" }, "Bash");
800
+ f.run("PostToolUse", "gh issue view 12", "comment-watch.mjs", "session-a", { stdout: "", stderr: "" }, "Bash");
801
+ const passed = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs");
802
+ assert.notEqual(passed?.hookSpecificOutput?.permissionDecision, "deny", JSON.stringify(passed));
803
+ f.rows.push(note(52, 4, "Please keep the permission assertions", "reviewer"));
804
+ f.update({ body: "Fixes #4" });
805
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
806
+ assert.equal(denied?.permissionDecision, "deny");
807
+ assert.match(denied.permissionDecisionReason, /@reviewer on shawrylk\/example#4 .*Please keep the permission assertions/);
808
+ assert.doesNotMatch(denied.permissionDecisionReason, /Session triage note|Dashboard chatter/);
809
+ });
810
+
811
+ const issueNote = (id, number, body, login, at) => ({ id, endpoint: `issues/${number}/comments`, user: { login }, body,
812
+ html_url: `https://github.com/shawrylk/example/issues/${number}#issuecomment-${id}`, created_at: at, updated_at: at });
813
+
814
+ test("a foreign comment with the same body as an own /dev/null comment still denies the merge", (t) => {
815
+ const f = fixture(t);
816
+ const earlier = new Date(Date.now() - 120_000).toISOString();
817
+ const now = new Date().toISOString();
818
+ f.rows.length = 0;
819
+ f.rows.push(issueNote(60, 4, "LGTM", "reviewer", earlier), issueNote(61, 4, "LGTM", "self", now));
820
+ f.update({ body: "Fixes #4" });
821
+ f.run("PostToolUse", 'gh issue comment 4 --body "LGTM" >/dev/null', "comment-watch.mjs", "session-a", { stdout: "", stderr: "" }, "Bash");
822
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
823
+ assert.equal(denied?.permissionDecision, "deny");
824
+ assert.match(denied.permissionDecisionReason, /@reviewer on shawrylk\/example#4/);
825
+ assert.doesNotMatch(denied.permissionDecisionReason, /@self/);
826
+ });
827
+
828
+ test("an own comment marker from a failed post never claims a later foreign comment", (t) => {
829
+ const f = fixture(t);
830
+ f.rows.length = 0;
831
+ f.update({ body: "Fixes #4" });
832
+ f.run("PostToolUse", 'gh issue comment 4 --body "Done." >/dev/null 2>&1 || true', "comment-watch.mjs", "session-a", { stdout: "", stderr: "" }, "Bash");
833
+ f.rows.push(issueNote(70, 4, "Done.", "reviewer", new Date().toISOString()));
834
+ f.update({ body: "Fixes #4" });
835
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
836
+ assert.equal(denied?.permissionDecision, "deny");
837
+ assert.match(denied.permissionDecisionReason, /@reviewer on shawrylk\/example#4 .*Done\./);
838
+ });
839
+
840
+ test("an own /dev/null comment stays unseen when the viewer login cannot be read", (t) => {
841
+ const f = fixture(t);
842
+ f.rows.length = 0;
843
+ f.rows.push(issueNote(75, 4, "Session note", "self", new Date().toISOString()));
844
+ f.update({ body: "Fixes #4", failEndpoint: "user" });
845
+ f.run("PostToolUse", 'gh issue comment 4 --body "Session note" >/dev/null', "comment-watch.mjs", "session-a", { stdout: "", stderr: "" }, "Bash");
846
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
847
+ assert.equal(denied?.permissionDecision, "deny");
848
+ assert.match(denied.permissionDecisionReason, /Session note/);
849
+ });
850
+
851
+ for (const [link, extra] of [
852
+ ["a commit that says Closes #4", { commits: [{ messageHeadline: "fix: x", messageBody: "Closes #4" }] }],
853
+ ["a commit that says Resolved #4", { commits: [{ messageHeadline: "Resolved #4", messageBody: "" }] }],
854
+ ["the Development sidebar", { closing: [{ number: 4, repository: { name: "example", owner: { login: "shawrylk" } } }] }],
855
+ ]) test(`an issue linked by ${link} gates the merge`, (t) => {
856
+ const f = fixture(t);
857
+ f.rows.length = 0;
858
+ f.update({ body: "Summary only", ...extra });
859
+ f.run("PostToolUse", "gh issue view 4", "comment-watch.mjs", "session-a", { stdout: "", stderr: "" }, "Bash");
860
+ f.rows.push(issueNote(80, 4, "Requirement changed, do not merge", "reviewer", new Date().toISOString()));
861
+ f.update({ body: "Summary only", ...extra });
862
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
863
+ assert.equal(denied?.permissionDecision, "deny");
864
+ assert.match(denied.permissionDecisionReason, /Requirement changed, do not merge/);
865
+ });
866
+
867
+ test("a merge reads every review page, so an edited review on page 1 still denies", (t) => {
868
+ const f = fixture(t);
869
+ f.rows.length = 0;
870
+ for (let id = 1; id <= 150; id++) f.rows.push({ id, endpoint: "pulls/7/reviews", user: { login: "reviewer" }, state: "COMMENTED",
871
+ body: `Review ${id}`, html_url: `https://github.com/shawrylk/example/pull/7#pullrequestreview-${id}`, submitted_at: "2026-01-01T00:00:00Z" });
872
+ f.update({ body: "Summary only" });
873
+ f.run("PostToolUse", "gh pr view 7");
874
+ assert.match(JSON.stringify(f.run("UserPromptSubmit")), /Review 150\b/);
875
+ assert.equal(f.run("UserPromptSubmit"), null);
876
+ assert.notEqual(f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput?.permissionDecision, "deny");
877
+ f.rows[0].body = "Edited: this breaks the import path";
878
+ f.update({ body: "Summary only" });
879
+ writeFileSync(f.calls, "");
880
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
881
+ assert.equal(denied?.permissionDecision, "deny");
882
+ assert.match(denied.permissionDecisionReason, /Edited: this breaks the import path/);
883
+ const reviewReads = readFileSync(f.calls, "utf8").trim().split("\n").map(JSON.parse).filter(call => call.start && /pulls\/7\/reviews/.test(call.args.at(-1)));
884
+ assert.match(reviewReads[0].args.at(-1), /page=1$/);
885
+ });
886
+
887
+ test("a merge rereads a partial comment scan from page 1, so an edit on an early page still denies", (t) => {
888
+ const f = fixture(t);
889
+ f.rows.length = 0;
890
+ for (let id = 1; id <= 300; id++) f.rows.push(issueNote(id, 4, id === 1 ? "LGTM" : `Note ${id}`, "reviewer", "2026-01-01T00:00:00Z"));
891
+ f.update({ body: "Fixes #4" });
892
+ // The ledger of a first scan that stopped at page 3, after a prompt acknowledged every row it had shown.
893
+ const stamp = (row) => createHash("sha256").update(JSON.stringify([row.html_url, row.id, row.updated_at, row.body, row.state])).digest("hex");
894
+ const dir = path.join(f.cwd, ".git", "qc");
895
+ mkdirSync(dir, { recursive: true });
896
+ writeFileSync(path.join(dir, `comment-watch-${createHash("sha256").update("session-a").digest("hex")}.jsonl`), [
897
+ { repo: "shawrylk/example", number: 4, kind: "issue", prs: ["shawrylk/example#7"], seen: f.rows.map(stamp) },
898
+ { repo: "shawrylk/example", number: 4, cursor: { endpoint: "issues/4/comments", since: null, page: 3, started: new Date(Date.now() - 60_000).toISOString() } },
899
+ ].map(record => JSON.stringify(record)).join("\n") + "\n");
900
+ Object.assign(f.rows[0], { body: "blocker, do not merge", updated_at: new Date().toISOString() });
901
+ f.update({ body: "Fixes #4" });
902
+ writeFileSync(f.calls, "");
903
+ const denied = f.run("PreToolUse", "gh pr merge 7", "merge-guard.mjs")?.hookSpecificOutput;
904
+ assert.equal(denied?.permissionDecision, "deny");
905
+ assert.match(denied.permissionDecisionReason, /@reviewer on shawrylk\/example#4 .*blocker, do not merge/);
906
+ const reads = readFileSync(f.calls, "utf8").trim().split("\n").map(JSON.parse).filter(call => call.start && /issues\/4\/comments/.test(call.args.at(-1)));
907
+ assert.match(reads[0].args.at(-1), /page=1$/);
908
+ });
@@ -4,12 +4,21 @@
4
4
 
5
5
  import { spawnSync } from "node:child_process";
6
6
  import { createRequire } from "node:module";
7
- import { existsSync, readFileSync } from "node:fs";
7
+ import { existsSync, readFileSync, statSync } from "node:fs";
8
8
  import path from "node:path";
9
9
  import { pathToFileURL } from "node:url";
10
10
  import { gitOut, gitStatusWithin } from "./git-read.mjs";
11
11
 
12
12
  const LINTABLE = /\.(?:[cm]?[jt]sx?)$/;
13
+ const CONFIG_NAMES = ["eslint.config.js", "eslint.config.mjs", "eslint.config.cjs", "eslint.config.ts", "eslint.config.mts", "eslint.config.cts"];
14
+
15
+ /** True when a flat config sits in the folder of `file` or in any folder above it. */
16
+ function configAbove(file) {
17
+ for (let dir = path.dirname(file); ; dir = path.dirname(dir)) {
18
+ if (CONFIG_NAMES.some((name) => statSync(path.join(dir, name), { throwIfNoEntry: false })?.isFile())) return true;
19
+ if (path.dirname(dir) === dir) return false;
20
+ }
21
+ }
13
22
  const DIFF_TIMEOUT_MS = 30_000;
14
23
 
15
24
  /**
@@ -174,13 +183,21 @@ export async function runLintChanged(config, args) {
174
183
  const eslint = new ESLint({ cwd: root });
175
184
  const files = [];
176
185
  const applicableBaseline = new Map();
186
+ let unconfigured = 0;
177
187
  for (const file of new Set([...changed.keys(), ...Object.keys(baseline)])) {
178
188
  if (!LINTABLE.test(file) || (wanted.size > 0 && !wanted.has(file))) continue;
189
+ // ESLint can arrive as a dependency of another package, so an install does not mean the repository uses it.
190
+ // ESLint 9 looks up the config from cwd only, so a config in a subfolder keeps the file and its old error.
191
+ if (typeof eslint.findConfigFile === "function" && !(await eslint.findConfigFile(path.join(root, file))) && !configAbove(path.join(root, file))) {
192
+ unconfigured++;
193
+ continue;
194
+ }
179
195
  if (await eslint.isPathIgnored(path.join(root, file))) continue;
180
196
  if (Object.hasOwn(baseline, file)) applicableBaseline.set(file, baseline[file]);
181
197
  if (!options.staged && !existsSync(path.join(root, file))) continue;
182
198
  files.push(file);
183
199
  }
200
+ if (unconfigured > 0) console.log(`lint skipped ${unconfigured} file(s) with no ESLint config`);
184
201
  const results = [];
185
202
  for (const file of files) {
186
203
  const filePath = path.join(root, file);
@@ -101,6 +101,31 @@ test("a repository without ESLint skips the lint", (t) => {
101
101
  assert.match(result.stdout, /lint skipped/);
102
102
  });
103
103
 
104
+ test("a file with no ESLint config is skipped, and the lint passes", (t) => {
105
+ const { root, qc } = repo(t);
106
+ rmSync(path.join(root, "eslint.config.mjs"));
107
+ writeFileSync(path.join(root, "src", "new.mjs"), "var fresh = 1;\nexport { fresh };\n");
108
+ const result = qc();
109
+ assert.equal(result.status, 0, result.stderr);
110
+ assert.match(result.stdout, /lint skipped 1 file\(s\) with no ESLint config/);
111
+ mkdirSync(path.join(root, "nested"));
112
+ writeFileSync(path.join(root, "nested", "eslint.config.mjs"), 'export default [{ rules: { "no-var": "error" } }];\n');
113
+ writeFileSync(path.join(root, "nested", "file.mjs"), "var nested = 1;\nexport { nested };\n");
114
+ const nested = qc("nested/file.mjs");
115
+ assert.notEqual(nested.status, 0, "a config in a subfolder keeps its file linted");
116
+ assert.doesNotMatch(nested.stdout, /lint skipped/);
117
+ });
118
+
119
+ test("a directory named eslint.config.mjs above a changed file is skipped", (t) => {
120
+ const { root, qc } = repo(t);
121
+ rmSync(path.join(root, "eslint.config.mjs"));
122
+ mkdirSync(path.join(root, "eslint.config.mjs"));
123
+ writeFileSync(path.join(root, "src", "new.mjs"), "var fresh = 1;\nexport { fresh };\n");
124
+ const result = qc();
125
+ assert.equal(result.status, 0, result.stderr);
126
+ assert.match(result.stdout, /lint skipped 1 file\(s\) with no ESLint config/);
127
+ });
128
+
104
129
  test("qc lint applies the baseline per file and rule up to the recorded count", (t) => {
105
130
  const { root, qc } = repo(t);
106
131
  writeFileSync(path.join(root, "eslint-suppressions.json"), JSON.stringify({ "src/old.mjs": { "no-var": { count: 1 } } }));
package/src/cli/tools.mjs CHANGED
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  const TOOLS = {
7
7
  stack: { repo: "shawrylk/qc-stack", sha: "e34c270d92e3995b2e512f6eb690ea3cb0bc4699", bin: "qc-stack" },
8
8
  screens: { repo: "shawrylk/qc-screens", sha: "886c303508f4406f397b2221b470115c3cb89589", bin: "qc-screens" },
9
- "throwaway-db": { repo: "shawrylk/qc-throwaway-db", sha: "042fb52425d92ad5f656aa2c18884350ebe4dc08", bin: "qc-throwaway-db" },
9
+ "throwaway-db": { repo: "shawrylk/qc-throwaway-db", sha: "44c1a1189de893d1dbd181bbc2bea95cc6898dd3", bin: "qc-throwaway-db" },
10
10
  };
11
11
 
12
12
  /** Runs a pinned tool without passing its arguments through a shell. */
@@ -58,7 +58,7 @@ test("throwaway-db falls back to shell-free npx on POSIX and keeps the command s
58
58
  const argv = ["--port", "auto", "--", "node", "script with spaces.mjs", "a&b"];
59
59
  await runTool("throwaway-db", argv, options);
60
60
  assert.deepEqual(calls, [["npx", ["--yes", "-p",
61
- "github:shawrylk/qc-throwaway-db#042fb52425d92ad5f656aa2c18884350ebe4dc08", "qc-throwaway-db", ...argv,
61
+ "github:shawrylk/qc-throwaway-db#44c1a1189de893d1dbd181bbc2bea95cc6898dd3", "qc-throwaway-db", ...argv,
62
62
  ], { stdio: "inherit", env: { PATH: "/bin", CUSTOM: "kept", npm_config_allow_git: "all" } }]]);
63
63
  });
64
64