@fullstackhouse/cerber 1.2.0-pr.81.aa49442 → 1.2.0-pr.81.f904d9c

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/README.md CHANGED
@@ -165,7 +165,8 @@ need their URL pasted every time. Cerber never drafts one on its own and never
165
165
  taps you about one: press `r` when you want a self-review. Send posts it as a
166
166
  comment, since GitHub takes no approve or change request from a PR's author,
167
167
  and auto-send leaves it alone. Skip one to hide it; it leaves for good once it
168
- merges or closes.
168
+ merges or closes. PRs of yours idle for more than 30 days stay out
169
+ (`daemon.ownPrMaxAgeDays`; 0 turns that off).
169
170
 
170
171
  ### Settled means you settled it
171
172
 
@@ -53,6 +53,13 @@ export const DaemonConfigSchema = z.object({
53
53
  parallel: z.number().int().positive().default(3),
54
54
  /** Repos to watch (owner/repo). Empty = everything your gh account can see. */
55
55
  repos: z.array(z.string()).default([]),
56
+ /**
57
+ * Your own PRs with no activity for longer than this many days are left out
58
+ * of the inbox — applied in the author search itself (`updated:>=`), so they
59
+ * never arrive and never take a slot of its 50. 0 or null turns the cut off.
60
+ * Your own PRs only: a review somebody asked you for is never aged out.
61
+ */
62
+ ownPrMaxAgeDays: z.number().int().nonnegative().nullable().default(30),
56
63
  });
57
64
  export const ConfigSchema = z.object({
58
65
  /** Whose PRs may be reviewed by running code. See core/trust.ts for syntax. */
package/dist/core/gh.js CHANGED
@@ -536,13 +536,15 @@ export async function fetchPriorRemarks(ref, people) {
536
536
  * every time. Both are the same search with one flag changed, so they cannot
537
537
  * drift apart on what "open" means or which repos are read-only.
538
538
  */
539
- export function searchPrsArgs(search, repoFilter, limit = 50) {
539
+ export function searchPrsArgs(search, repoFilter, limit = 50, updatedSince = null) {
540
540
  const args = [
541
541
  "search",
542
542
  "prs",
543
543
  // An archived repo is read-only: its PRs can never merge, close, or take a
544
544
  // review. Without this they'd sit in the inbox forever — nothing retires them.
545
545
  "archived:false",
546
+ // Only the author search is ever given one (`ownPrUpdatedSince`).
547
+ ...(updatedSince ? [`updated:>=${updatedSince}`] : []),
546
548
  `--${search}=@me`,
547
549
  "--state=open",
548
550
  "--limit",
@@ -564,10 +566,23 @@ export async function searchAwaitingMe(repoFilter, limit = 50) {
564
566
  * Open PRs the current gh user opened, drafts included. They come to the inbox
565
567
  * to be reviewed on demand and never automatically — see `isOwnPr` (`own.ts`).
566
568
  */
567
- export async function searchAuthoredByMe(repoFilter, limit = 50) {
568
- const out = await gh(searchPrsArgs("author", repoFilter, limit));
569
+ export async function searchAuthoredByMe(repoFilter, updatedSince = null, limit = 50) {
570
+ const out = await gh(searchPrsArgs("author", repoFilter, limit, updatedSince));
569
571
  return mapSearchResults(JSON.parse(out));
570
572
  }
573
+ /**
574
+ * The day your own PRs must have been active on or after to come into the
575
+ * inbox (`daemon.ownPrMaxAgeDays`), as GitHub's `updated:>=` reads it — or null
576
+ * for no cut. A PR of yours nobody has touched in months is not one you are
577
+ * about to self-review, and fifty of them would fill the search's whole page.
578
+ * A calendar day in UTC: GitHub's qualifier takes a date, and a day either way
579
+ * at the edge changes nothing anyone would notice.
580
+ */
581
+ export function ownPrUpdatedSince(days, now = new Date()) {
582
+ if (!days)
583
+ return null;
584
+ return new Date(now.getTime() - days * 86_400_000).toISOString().slice(0, 10);
585
+ }
571
586
  /**
572
587
  * Who this repo will let you put on a PR — the list behind the handoff's
573
588
  * suggestions.
@@ -2,7 +2,7 @@ import { SCHEMA_VERSION, artifactId, artifactKey } from "../core/artifact.js";
2
2
  import { evaluateAutoSend } from "../core/autosend.js";
3
3
  import { anyAutoReview, autoReviewFor, capAutoReview } from "../core/autoreview.js";
4
4
  import { loadConfig } from "../core/config.js";
5
- import { classifyReply, currentLogin, fetchConversation, fetchLastReviewRequest, fetchOwnReview, fetchPrInfo, fetchReviewRequests, lastMentionOfYou, lastWordOfYours, searchAuthoredByMe, searchAwaitingMe, stillRequested, submitReview, } from "../core/gh.js";
5
+ import { classifyReply, currentLogin, fetchConversation, fetchLastReviewRequest, fetchOwnReview, fetchPrInfo, fetchReviewRequests, lastMentionOfYou, lastWordOfYours, ownPrUpdatedSince, searchAuthoredByMe, searchAwaitingMe, stillRequested, submitReview, } from "../core/gh.js";
6
6
  import { withWriter } from "../core/history.js";
7
7
  import { isOwnPr } from "../core/own.js";
8
8
  import { pendingNews, notice, notify } from "../core/notify.js";
@@ -288,13 +288,17 @@ export function startDaemon(opts) {
288
288
  * PR decides nothing — a team you are on can be requested on your own PR,
289
289
  * and `isOwnPr` reads the author either way.
290
290
  */
291
- async function discover(me) {
291
+ async function discover(me, ownPrMaxAgeDays) {
292
292
  const filters = opts.repos.length > 0 ? opts.repos : [undefined];
293
+ // Your own PRs only: a review request is never aged out. One that went
294
+ // stale leaves the search, and the reaper below drops its stub like any
295
+ // other the search stopped returning — a draft of yours stays put.
296
+ const since = ownPrUpdatedSince(ownPrMaxAgeDays);
293
297
  const [awaiting, authored] = await Promise.all([
294
298
  Promise.all(filters.map((repo) => searchAwaitingMe(repo))),
295
299
  me === null
296
300
  ? Promise.resolve(null)
297
- : Promise.all(filters.map((repo) => searchAuthoredByMe(repo))).catch((err) => {
301
+ : Promise.all(filters.map((repo) => searchAuthoredByMe(repo, since))).catch((err) => {
298
302
  log(`could not search for your own PRs: ${err instanceof Error ? err.message : String(err)}`);
299
303
  return null;
300
304
  }),
@@ -857,7 +861,7 @@ export function startDaemon(opts) {
857
861
  status.lastSummary = "polling off (settings) — the queue only shows what you review by hand";
858
862
  return;
859
863
  }
860
- const { refs, ownSearched } = await discover(me);
864
+ const { refs, ownSearched } = await discover(me, knobs.ownPrMaxAgeDays);
861
865
  // Your own PRs are synced into the queue with the rest, but nobody is
862
866
  // asking you for them: they are not "awaiting" in anything the strip
863
867
  // counts, and the cockpit's open-requests tab — "GitHub still lists you
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstackhouse/cerber",
3
- "version": "1.2.0-pr.81.aa49442",
3
+ "version": "1.2.0-pr.81.f904d9c",
4
4
  "description": "AI code-review cockpit: Claude reviews your PRs into local artifacts; nothing reaches GitHub until you say so.",
5
5
  "license": "MIT",
6
6
  "keywords": [