@oss-autopilot/core 3.38.0 → 3.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-registry.js +7 -4
- package/dist/cli.bundle.cjs +139 -132
- package/dist/commands/daily-dismiss-filter.d.ts +37 -0
- package/dist/commands/daily-dismiss-filter.js +80 -0
- package/dist/commands/daily-merged-pr-notes.d.ts +27 -0
- package/dist/commands/daily-merged-pr-notes.js +166 -0
- package/dist/commands/daily-reviewed-prs.d.ts +41 -0
- package/dist/commands/daily-reviewed-prs.js +270 -0
- package/dist/commands/daily-warnings.d.ts +28 -0
- package/dist/commands/daily-warnings.js +37 -0
- package/dist/commands/daily.d.ts +22 -1
- package/dist/commands/daily.js +287 -107
- package/dist/commands/dashboard-cache.js +9 -2
- package/dist/commands/dashboard-data.js +40 -20
- package/dist/commands/dashboard-gist-sync.d.ts +4 -0
- package/dist/commands/dashboard-gist-sync.js +5 -1
- package/dist/commands/dismiss.d.ts +25 -5
- package/dist/commands/dismiss.js +38 -10
- package/dist/commands/overnight.js +14 -1
- package/dist/commands/scout-bridge.js +4 -1
- package/dist/commands/validation.d.ts +11 -0
- package/dist/commands/validation.js +16 -0
- package/dist/core/checklist-analysis.js +34 -0
- package/dist/core/closed-pr-status.d.ts +73 -0
- package/dist/core/closed-pr-status.js +113 -0
- package/dist/core/comment-decision.d.ts +10 -3
- package/dist/core/comment-decision.js +13 -5
- package/dist/core/comment-utils.d.ts +38 -1
- package/dist/core/comment-utils.js +124 -1
- package/dist/core/concurrency.d.ts +6 -0
- package/dist/core/concurrency.js +13 -0
- package/dist/core/daily-logic.d.ts +13 -1
- package/dist/core/daily-logic.js +59 -2
- package/dist/core/engaged-issues.d.ts +93 -0
- package/dist/core/engaged-issues.js +183 -0
- package/dist/core/errors.d.ts +4 -0
- package/dist/core/errors.js +10 -0
- package/dist/core/github-stats.d.ts +10 -0
- package/dist/core/github-stats.js +35 -0
- package/dist/core/index.d.ts +10 -5
- package/dist/core/index.js +9 -4
- package/dist/core/issue-conversation.d.ts +83 -12
- package/dist/core/issue-conversation.js +306 -118
- package/dist/core/merged-pr-notes.d.ts +192 -0
- package/dist/core/merged-pr-notes.js +340 -0
- package/dist/core/pr-assembly.js +3 -0
- package/dist/core/pr-monitor.d.ts +62 -0
- package/dist/core/pr-monitor.js +113 -3
- package/dist/core/reviewed-prs-fetch.d.ts +91 -0
- package/dist/core/reviewed-prs-fetch.js +271 -0
- package/dist/core/reviewed-prs.d.ts +244 -0
- package/dist/core/reviewed-prs.js +380 -0
- package/dist/core/state-persistence.js +4 -23
- package/dist/core/state-schema.d.ts +6 -0
- package/dist/core/state-schema.js +9 -0
- package/dist/core/state.d.ts +70 -8
- package/dist/core/state.js +101 -10
- package/dist/core/types.d.ts +47 -0
- package/dist/core/urls.d.ts +13 -0
- package/dist/core/urls.js +16 -0
- package/dist/formatters/json.d.ts +186 -1
- package/dist/formatters/json.js +78 -0
- package/package.json +1 -1
|
@@ -342,6 +342,7 @@ export declare const AgentConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
342
342
|
aiPolicyBlocklist: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
343
343
|
shelvedPRUrls: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
344
344
|
dismissedIssues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
345
|
+
dismissedPRHeads: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
345
346
|
statusOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
346
347
|
status: z.ZodEnum<{
|
|
347
348
|
needs_addressing: "needs_addressing";
|
|
@@ -402,6 +403,7 @@ export declare const AgentConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
402
403
|
aiPolicyBlocklist: string[];
|
|
403
404
|
shelvedPRUrls: string[];
|
|
404
405
|
dismissedIssues: Record<string, string>;
|
|
406
|
+
dismissedPRHeads: Record<string, string>;
|
|
405
407
|
projectCategories: ("nonprofit" | "devtools" | "infrastructure" | "web-frameworks" | "data-ml" | "education")[];
|
|
406
408
|
preferredOrgs: string[];
|
|
407
409
|
diffTool: "inline" | "custom" | "sourcetree" | "vscode";
|
|
@@ -452,6 +454,7 @@ export declare const AgentConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
452
454
|
aiPolicyBlocklist: string[];
|
|
453
455
|
shelvedPRUrls: string[];
|
|
454
456
|
dismissedIssues: Record<string, string>;
|
|
457
|
+
dismissedPRHeads: Record<string, string>;
|
|
455
458
|
projectCategories: ("nonprofit" | "devtools" | "infrastructure" | "web-frameworks" | "data-ml" | "education")[];
|
|
456
459
|
preferredOrgs: string[];
|
|
457
460
|
diffTool: "inline" | "custom" | "sourcetree" | "vscode";
|
|
@@ -736,6 +739,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
736
739
|
aiPolicyBlocklist: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
737
740
|
shelvedPRUrls: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
738
741
|
dismissedIssues: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
742
|
+
dismissedPRHeads: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
739
743
|
statusOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
740
744
|
status: z.ZodEnum<{
|
|
741
745
|
needs_addressing: "needs_addressing";
|
|
@@ -796,6 +800,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
796
800
|
aiPolicyBlocklist: string[];
|
|
797
801
|
shelvedPRUrls: string[];
|
|
798
802
|
dismissedIssues: Record<string, string>;
|
|
803
|
+
dismissedPRHeads: Record<string, string>;
|
|
799
804
|
projectCategories: ("nonprofit" | "devtools" | "infrastructure" | "web-frameworks" | "data-ml" | "education")[];
|
|
800
805
|
preferredOrgs: string[];
|
|
801
806
|
diffTool: "inline" | "custom" | "sourcetree" | "vscode";
|
|
@@ -846,6 +851,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
846
851
|
aiPolicyBlocklist: string[];
|
|
847
852
|
shelvedPRUrls: string[];
|
|
848
853
|
dismissedIssues: Record<string, string>;
|
|
854
|
+
dismissedPRHeads: Record<string, string>;
|
|
849
855
|
projectCategories: ("nonprofit" | "devtools" | "infrastructure" | "web-frameworks" | "data-ml" | "education")[];
|
|
850
856
|
preferredOrgs: string[];
|
|
851
857
|
diffTool: "inline" | "custom" | "sourcetree" | "vscode";
|
|
@@ -329,6 +329,15 @@ export const AgentConfigSchema = z
|
|
|
329
329
|
aiPolicyBlocklist: z.array(z.string()).default(['matplotlib/matplotlib']),
|
|
330
330
|
shelvedPRUrls: z.array(z.string()).default([]),
|
|
331
331
|
dismissedIssues: z.record(z.string(), z.string()).default({}),
|
|
332
|
+
/**
|
|
333
|
+
* PR URL -> head SHA the PR had when its review follow-up was dismissed
|
|
334
|
+
* (#1857). Set by `dismiss <pr-url> --head <sha>`; the follow-up stays
|
|
335
|
+
* hidden while the head is unchanged and no comment newer than the
|
|
336
|
+
* dismiss stamp in `dismissedIssues` qualifies, and a different head
|
|
337
|
+
* resurfaces it. Cleared by `undismiss` and by a dismiss without `--head`
|
|
338
|
+
* (that one goes back to the stamp-only rule). Older states lack the key.
|
|
339
|
+
*/
|
|
340
|
+
dismissedPRHeads: z.record(z.string(), z.string()).default({}),
|
|
332
341
|
statusOverrides: z.record(z.string(), StatusOverrideSchema).optional(),
|
|
333
342
|
issueListPath: z.string().optional(),
|
|
334
343
|
skippedIssuesPath: z.string().optional(),
|
package/dist/core/state.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ import { type GistHealth } from './gist-health.js';
|
|
|
13
13
|
export { acquireLock, releaseLock, atomicWriteFileSync } from './state-persistence.js';
|
|
14
14
|
export type { LoadRecoveryInfo } from './state-persistence.js';
|
|
15
15
|
export type { Stats } from './repo-score-manager.js';
|
|
16
|
+
/**
|
|
17
|
+
* Outcome of {@link StateManager.releaseIssue} (#1863): the claim was
|
|
18
|
+
* removed, the issue was never tracked, or a claim recorded at/after the
|
|
19
|
+
* cutoff was deliberately kept.
|
|
20
|
+
*/
|
|
21
|
+
export type ReleaseIssueResult = 'released' | 'not_tracked' | 'newer_claim';
|
|
16
22
|
/** Cap on `state.pickSnapshots` (#1824): ~180 bytes each, so ~55 KB at the cap. */
|
|
17
23
|
export declare const MAX_PICK_SNAPSHOTS = 300;
|
|
18
24
|
/**
|
|
@@ -344,10 +350,44 @@ export declare class StateManager {
|
|
|
344
350
|
*/
|
|
345
351
|
updateConfig(config: Partial<AgentState['config']>): void;
|
|
346
352
|
/**
|
|
347
|
-
* Track a new issue
|
|
353
|
+
* Track a new issue, or refresh the claim on one already tracked.
|
|
354
|
+
*
|
|
355
|
+
* Matching uses {@link issueRefKey} (same normalization as
|
|
356
|
+
* {@link releaseIssue}), so a re-claim through a differently cased or
|
|
357
|
+
* suffixed URL updates the existing entry instead of adding a duplicate.
|
|
358
|
+
* On a match only `status` and `updatedAt` are taken from `issue`:
|
|
359
|
+
* `updatedAt` is the claim stamp `releaseIssue` compares against the PR's
|
|
360
|
+
* close time (#1863), so a re-claim after the close must move it forward
|
|
361
|
+
* or the daily run would release the new claim as if it were the old one.
|
|
362
|
+
*
|
|
348
363
|
* @param issue - The issue to track
|
|
349
364
|
*/
|
|
350
365
|
addIssue(issue: TrackedIssue): void;
|
|
366
|
+
/**
|
|
367
|
+
* Release a claim: drop the issue from `activeIssues` (#1863). Called by
|
|
368
|
+
* the daily run when the user closed their own PR for the issue unmerged.
|
|
369
|
+
*
|
|
370
|
+
* What changes: the issue leaves the tracked set that
|
|
371
|
+
* `IssueConversationMonitor.fetchCommentedIssues` excludes, so from the
|
|
372
|
+
* next run it re-enters the commented-issue monitor like any other issue
|
|
373
|
+
* the user has commented on, and it stops reading as in progress wherever
|
|
374
|
+
* `activeIssues` is listed. Capacity is NOT affected: `assessCapacity`
|
|
375
|
+
* counts open PRs only, never tracked issues.
|
|
376
|
+
*
|
|
377
|
+
* Matching uses {@link issueRefKey} (case-insensitive owner/repo, trailing
|
|
378
|
+
* slash and fragment ignored), falling back to the exact string for a URL
|
|
379
|
+
* that does not parse. The removal cannot be undone, so with
|
|
380
|
+
* `claimedBefore` set the entry is kept when its `updatedAt` is at or after
|
|
381
|
+
* that instant: `updatedAt` is the claim stamp the `claim` command writes
|
|
382
|
+
* (`createdAt` there is the issue's GitHub creation date), so a claim made
|
|
383
|
+
* after the PR closed is a deliberate re-claim that must survive.
|
|
384
|
+
* Unparseable timestamps keep the entry for the same reason.
|
|
385
|
+
*
|
|
386
|
+
* @param issueUrl - URL of the issue to release
|
|
387
|
+
* @param claimedBefore - ISO instant (the PR's close time); only a claim
|
|
388
|
+
* recorded strictly before it is released
|
|
389
|
+
*/
|
|
390
|
+
releaseIssue(issueUrl: string, claimedBefore?: string): ReleaseIssueResult;
|
|
351
391
|
/**
|
|
352
392
|
* Add a repository to the trusted projects list. No-op if already trusted.
|
|
353
393
|
* @param repo - Repository in "owner/repo" format
|
|
@@ -388,14 +428,27 @@ export declare class StateManager {
|
|
|
388
428
|
*/
|
|
389
429
|
isPRShelved(url: string): boolean;
|
|
390
430
|
/**
|
|
391
|
-
* Dismiss an issue's notifications. Auto-resurfaces
|
|
392
|
-
*
|
|
431
|
+
* Dismiss an issue's (or merged PR's, #1861) notifications. Auto-resurfaces
|
|
432
|
+
* on new activity.
|
|
433
|
+
* @param url - The issue or PR URL to dismiss
|
|
393
434
|
* @param timestamp - ISO timestamp of dismissal
|
|
394
|
-
* @
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
*
|
|
435
|
+
* @param options.refresh - When set, an existing dismissal is re-stamped with
|
|
436
|
+
* `timestamp` instead of being left alone, so a second "skip" after newer
|
|
437
|
+
* activity moves the cutoff forward. Default keeps the original stamp.
|
|
438
|
+
* @param options.headSha - For a reviewed PR (#1857): the head SHA the PR
|
|
439
|
+
* had when it was dismissed, recorded in `config.dismissedPRHeads` so the
|
|
440
|
+
* follow-up stays hidden until the head moves. Any head recorded earlier
|
|
441
|
+
* is replaced, or dropped when this dismiss names none.
|
|
442
|
+
* @returns true if newly dismissed (or re-stamped under `refresh`), false if
|
|
443
|
+
* already dismissed
|
|
444
|
+
*/
|
|
445
|
+
dismissIssue(url: string, timestamp: string, options?: {
|
|
446
|
+
refresh?: boolean;
|
|
447
|
+
headSha?: string;
|
|
448
|
+
}): boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Restore a dismissed issue to notifications. A recorded dismiss head
|
|
451
|
+
* (#1857) goes with it.
|
|
399
452
|
* @param url - The issue URL to undismiss
|
|
400
453
|
* @returns true if undismissed, false if not currently dismissed
|
|
401
454
|
*/
|
|
@@ -405,6 +458,15 @@ export declare class StateManager {
|
|
|
405
458
|
* @param url - The issue URL to check
|
|
406
459
|
*/
|
|
407
460
|
getIssueDismissedAt(url: string): string | undefined;
|
|
461
|
+
/**
|
|
462
|
+
* The head SHA recorded when a reviewed PR's follow-up was dismissed
|
|
463
|
+
* (#1857), or undefined when the PR is not dismissed or was dismissed
|
|
464
|
+
* without one.
|
|
465
|
+
* @param url - The PR URL to check
|
|
466
|
+
*/
|
|
467
|
+
getDismissedPRHead(url: string): string | undefined;
|
|
468
|
+
/** Record or (with `undefined`) drop the dismiss head for `url`; no save. */
|
|
469
|
+
private setDismissedPRHead;
|
|
408
470
|
/**
|
|
409
471
|
* Set a manual status override for a PR. Auto-clears when the PR has new activity.
|
|
410
472
|
* @param url - The PR URL
|
package/dist/core/state.js
CHANGED
|
@@ -16,7 +16,7 @@ import * as guidelinesStoreModule from './guidelines-store.js';
|
|
|
16
16
|
export const OVERNIGHT_REPORT_DOCUMENT = 'overnight-report.md';
|
|
17
17
|
import { renderGistWarning } from './gist-health.js';
|
|
18
18
|
import { getStatePath, getStateCachePath, getGistIdPath } from './paths.js';
|
|
19
|
-
import { parseGitHubUrl } from './urls.js';
|
|
19
|
+
import { parseGitHubUrl, issueRefKey } from './urls.js';
|
|
20
20
|
export { acquireLock, releaseLock, atomicWriteFileSync } from './state-persistence.js';
|
|
21
21
|
const MODULE = 'state';
|
|
22
22
|
/**
|
|
@@ -891,19 +891,77 @@ export class StateManager {
|
|
|
891
891
|
}
|
|
892
892
|
// === Issue Management ===
|
|
893
893
|
/**
|
|
894
|
-
* Track a new issue
|
|
894
|
+
* Track a new issue, or refresh the claim on one already tracked.
|
|
895
|
+
*
|
|
896
|
+
* Matching uses {@link issueRefKey} (same normalization as
|
|
897
|
+
* {@link releaseIssue}), so a re-claim through a differently cased or
|
|
898
|
+
* suffixed URL updates the existing entry instead of adding a duplicate.
|
|
899
|
+
* On a match only `status` and `updatedAt` are taken from `issue`:
|
|
900
|
+
* `updatedAt` is the claim stamp `releaseIssue` compares against the PR's
|
|
901
|
+
* close time (#1863), so a re-claim after the close must move it forward
|
|
902
|
+
* or the daily run would release the new claim as if it were the old one.
|
|
903
|
+
*
|
|
895
904
|
* @param issue - The issue to track
|
|
896
905
|
*/
|
|
897
906
|
addIssue(issue) {
|
|
898
|
-
const
|
|
907
|
+
const key = issueRefKey(issue.url);
|
|
908
|
+
const existing = this.state.activeIssues.find((i) => (key ? issueRefKey(i.url) === key : i.url === issue.url));
|
|
899
909
|
if (existing) {
|
|
900
|
-
|
|
910
|
+
existing.status = issue.status;
|
|
911
|
+
existing.updatedAt = issue.updatedAt;
|
|
912
|
+
debug(MODULE, `Issue ${issue.url} already tracked; refreshed claim stamp to ${issue.updatedAt}`);
|
|
913
|
+
this.autoSave();
|
|
901
914
|
return;
|
|
902
915
|
}
|
|
903
916
|
this.state.activeIssues.push(issue);
|
|
904
917
|
debug(MODULE, `Added issue: ${issue.repo}#${issue.number}`);
|
|
905
918
|
this.autoSave();
|
|
906
919
|
}
|
|
920
|
+
/**
|
|
921
|
+
* Release a claim: drop the issue from `activeIssues` (#1863). Called by
|
|
922
|
+
* the daily run when the user closed their own PR for the issue unmerged.
|
|
923
|
+
*
|
|
924
|
+
* What changes: the issue leaves the tracked set that
|
|
925
|
+
* `IssueConversationMonitor.fetchCommentedIssues` excludes, so from the
|
|
926
|
+
* next run it re-enters the commented-issue monitor like any other issue
|
|
927
|
+
* the user has commented on, and it stops reading as in progress wherever
|
|
928
|
+
* `activeIssues` is listed. Capacity is NOT affected: `assessCapacity`
|
|
929
|
+
* counts open PRs only, never tracked issues.
|
|
930
|
+
*
|
|
931
|
+
* Matching uses {@link issueRefKey} (case-insensitive owner/repo, trailing
|
|
932
|
+
* slash and fragment ignored), falling back to the exact string for a URL
|
|
933
|
+
* that does not parse. The removal cannot be undone, so with
|
|
934
|
+
* `claimedBefore` set the entry is kept when its `updatedAt` is at or after
|
|
935
|
+
* that instant: `updatedAt` is the claim stamp the `claim` command writes
|
|
936
|
+
* (`createdAt` there is the issue's GitHub creation date), so a claim made
|
|
937
|
+
* after the PR closed is a deliberate re-claim that must survive.
|
|
938
|
+
* Unparseable timestamps keep the entry for the same reason.
|
|
939
|
+
*
|
|
940
|
+
* @param issueUrl - URL of the issue to release
|
|
941
|
+
* @param claimedBefore - ISO instant (the PR's close time); only a claim
|
|
942
|
+
* recorded strictly before it is released
|
|
943
|
+
*/
|
|
944
|
+
releaseIssue(issueUrl, claimedBefore) {
|
|
945
|
+
const key = issueRefKey(issueUrl);
|
|
946
|
+
const index = this.state.activeIssues.findIndex((i) => (key ? issueRefKey(i.url) === key : i.url === issueUrl));
|
|
947
|
+
if (index === -1) {
|
|
948
|
+
debug(MODULE, `releaseIssue: ${issueUrl} is not tracked; nothing to release`);
|
|
949
|
+
return 'not_tracked';
|
|
950
|
+
}
|
|
951
|
+
const entry = this.state.activeIssues[index];
|
|
952
|
+
if (claimedBefore !== undefined) {
|
|
953
|
+
const claimedMs = Date.parse(entry.updatedAt);
|
|
954
|
+
const cutoffMs = Date.parse(claimedBefore);
|
|
955
|
+
if (Number.isNaN(claimedMs) || Number.isNaN(cutoffMs) || claimedMs >= cutoffMs) {
|
|
956
|
+
debug(MODULE, `releaseIssue: keeping ${entry.repo}#${entry.number}; claim stamp ${entry.updatedAt} is not before ${claimedBefore}`);
|
|
957
|
+
return 'newer_claim';
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
this.state.activeIssues.splice(index, 1);
|
|
961
|
+
debug(MODULE, `Released issue claim: ${entry.repo}#${entry.number}`);
|
|
962
|
+
this.autoSave();
|
|
963
|
+
return 'released';
|
|
964
|
+
}
|
|
907
965
|
// === Trusted Projects ===
|
|
908
966
|
/**
|
|
909
967
|
* Add a repository to the trusted projects list. No-op if already trusted.
|
|
@@ -1009,24 +1067,35 @@ export class StateManager {
|
|
|
1009
1067
|
}
|
|
1010
1068
|
// === Dismiss / Undismiss Issues ===
|
|
1011
1069
|
/**
|
|
1012
|
-
* Dismiss an issue's notifications. Auto-resurfaces
|
|
1013
|
-
*
|
|
1070
|
+
* Dismiss an issue's (or merged PR's, #1861) notifications. Auto-resurfaces
|
|
1071
|
+
* on new activity.
|
|
1072
|
+
* @param url - The issue or PR URL to dismiss
|
|
1014
1073
|
* @param timestamp - ISO timestamp of dismissal
|
|
1015
|
-
* @
|
|
1074
|
+
* @param options.refresh - When set, an existing dismissal is re-stamped with
|
|
1075
|
+
* `timestamp` instead of being left alone, so a second "skip" after newer
|
|
1076
|
+
* activity moves the cutoff forward. Default keeps the original stamp.
|
|
1077
|
+
* @param options.headSha - For a reviewed PR (#1857): the head SHA the PR
|
|
1078
|
+
* had when it was dismissed, recorded in `config.dismissedPRHeads` so the
|
|
1079
|
+
* follow-up stays hidden until the head moves. Any head recorded earlier
|
|
1080
|
+
* is replaced, or dropped when this dismiss names none.
|
|
1081
|
+
* @returns true if newly dismissed (or re-stamped under `refresh`), false if
|
|
1082
|
+
* already dismissed
|
|
1016
1083
|
*/
|
|
1017
|
-
dismissIssue(url, timestamp) {
|
|
1084
|
+
dismissIssue(url, timestamp, options = {}) {
|
|
1018
1085
|
if (!this.state.config.dismissedIssues) {
|
|
1019
1086
|
this.state.config.dismissedIssues = {};
|
|
1020
1087
|
}
|
|
1021
|
-
if (url in this.state.config.dismissedIssues) {
|
|
1088
|
+
if (url in this.state.config.dismissedIssues && !options.refresh) {
|
|
1022
1089
|
return false;
|
|
1023
1090
|
}
|
|
1024
1091
|
this.state.config.dismissedIssues[url] = timestamp;
|
|
1092
|
+
this.setDismissedPRHead(url, options.headSha);
|
|
1025
1093
|
this.autoSave();
|
|
1026
1094
|
return true;
|
|
1027
1095
|
}
|
|
1028
1096
|
/**
|
|
1029
|
-
* Restore a dismissed issue to notifications.
|
|
1097
|
+
* Restore a dismissed issue to notifications. A recorded dismiss head
|
|
1098
|
+
* (#1857) goes with it.
|
|
1030
1099
|
* @param url - The issue URL to undismiss
|
|
1031
1100
|
* @returns true if undismissed, false if not currently dismissed
|
|
1032
1101
|
*/
|
|
@@ -1035,6 +1104,7 @@ export class StateManager {
|
|
|
1035
1104
|
return false;
|
|
1036
1105
|
}
|
|
1037
1106
|
delete this.state.config.dismissedIssues[url];
|
|
1107
|
+
this.setDismissedPRHead(url, undefined);
|
|
1038
1108
|
this.autoSave();
|
|
1039
1109
|
return true;
|
|
1040
1110
|
}
|
|
@@ -1045,6 +1115,27 @@ export class StateManager {
|
|
|
1045
1115
|
getIssueDismissedAt(url) {
|
|
1046
1116
|
return this.state.config.dismissedIssues?.[url];
|
|
1047
1117
|
}
|
|
1118
|
+
/**
|
|
1119
|
+
* The head SHA recorded when a reviewed PR's follow-up was dismissed
|
|
1120
|
+
* (#1857), or undefined when the PR is not dismissed or was dismissed
|
|
1121
|
+
* without one.
|
|
1122
|
+
* @param url - The PR URL to check
|
|
1123
|
+
*/
|
|
1124
|
+
getDismissedPRHead(url) {
|
|
1125
|
+
return this.state.config.dismissedPRHeads?.[url];
|
|
1126
|
+
}
|
|
1127
|
+
/** Record or (with `undefined`) drop the dismiss head for `url`; no save. */
|
|
1128
|
+
setDismissedPRHead(url, headSha) {
|
|
1129
|
+
if (!this.state.config.dismissedPRHeads) {
|
|
1130
|
+
this.state.config.dismissedPRHeads = {};
|
|
1131
|
+
}
|
|
1132
|
+
if (headSha === undefined) {
|
|
1133
|
+
delete this.state.config.dismissedPRHeads[url];
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
this.state.config.dismissedPRHeads[url] = headSha;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1048
1139
|
// === Status Overrides ===
|
|
1049
1140
|
/**
|
|
1050
1141
|
* Set a manual status override for a PR. Auto-clears when the PR has new activity.
|
package/dist/core/types.d.ts
CHANGED
|
@@ -140,6 +140,24 @@ export interface FetchedPR {
|
|
|
140
140
|
repo: string;
|
|
141
141
|
number: number;
|
|
142
142
|
title: string;
|
|
143
|
+
/**
|
|
144
|
+
* Issue the PR closes, parsed from the first closing keyword in its body
|
|
145
|
+
* (same `closingIssueUrl` the merged/closed ledger uses, #1824). Lets the
|
|
146
|
+
* daily run tell a closed PR that was superseded by a still-open PR on the
|
|
147
|
+
* same issue from one whose work really ended (#1863). Undefined when the
|
|
148
|
+
* body has no closing keyword.
|
|
149
|
+
*/
|
|
150
|
+
issueUrl?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Every issue or PR the title and body mention, closing keyword or not
|
|
153
|
+
* (`#12`, `owner/repo#12`, issue or pull URL), as canonical issue URLs
|
|
154
|
+
* (`mentionedIssueUrls`, #1863). Widens the supersede check: a follow-up
|
|
155
|
+
* PR that says "supersedes #8" or "another take on #12" counts as the
|
|
156
|
+
* successor of a closed PR even without `Fixes #12`. Parsed at assembly
|
|
157
|
+
* time so the daily run needs no extra API calls; empty when nothing is
|
|
158
|
+
* mentioned.
|
|
159
|
+
*/
|
|
160
|
+
mentionedIssueUrls?: string[];
|
|
143
161
|
/** Computed by `determineStatus()` based on the fields below. */
|
|
144
162
|
status: FetchedPRStatus;
|
|
145
163
|
/** Granular reason for needs_addressing status. Undefined when waiting_on_maintainer. */
|
|
@@ -294,17 +312,46 @@ export interface StarFilter {
|
|
|
294
312
|
export declare function isBelowMinStars(stargazersCount: number | undefined, minStars: number): boolean;
|
|
295
313
|
/** Status of a user's comment thread on a GitHub issue. */
|
|
296
314
|
export type IssueConversationStatus = 'new_response' | 'waiting' | 'acknowledged';
|
|
315
|
+
/** How the user is engaged on an issue (#1862), strongest first. */
|
|
316
|
+
export type EngagementReason = 'open_pr' | 'claim' | 'closed_pr' | 'merged_pr';
|
|
317
|
+
/** Why a commented-issue entry was scanned under the engaged rule (#1862). */
|
|
318
|
+
export interface IssueEngagement {
|
|
319
|
+
/** Strongest reason when several apply (open PR, then claim, closed PR, merged PR). */
|
|
320
|
+
reason: EngagementReason;
|
|
321
|
+
/** The PR behind `reason`, for the PR reasons. */
|
|
322
|
+
prUrl?: string;
|
|
323
|
+
/**
|
|
324
|
+
* ISO time of the user's latest engagement step: the claim stamp, or when
|
|
325
|
+
* the PR was opened. Comments at or before it were answered by the
|
|
326
|
+
* engagement itself, so only later ones can be replies to the user. Absent
|
|
327
|
+
* when the PR's opening time is not known (older ledger entries); the
|
|
328
|
+
* user's last comment is the baseline then.
|
|
329
|
+
*/
|
|
330
|
+
since?: string;
|
|
331
|
+
}
|
|
297
332
|
/** Base fields shared by all issue conversation states. */
|
|
298
333
|
interface CommentedIssueBase {
|
|
299
334
|
repo: string;
|
|
300
335
|
number: number;
|
|
301
336
|
title: string;
|
|
302
337
|
url: string;
|
|
338
|
+
/**
|
|
339
|
+
* When the user last spoke on the thread. For an engaged issue the user
|
|
340
|
+
* never commented on, the engagement time (`engagement.since`: the claim
|
|
341
|
+
* or the PR opening) with an empty `userLastCommentBody`.
|
|
342
|
+
*/
|
|
303
343
|
userLastCommentedAt: string;
|
|
304
344
|
/** User's most recent comment body, truncated to 200 chars (+ "..." suffix when truncated). #1290 */
|
|
305
345
|
userLastCommentBody: string;
|
|
306
346
|
labels: string[];
|
|
307
347
|
daysSinceUserComment: number;
|
|
348
|
+
/**
|
|
349
|
+
* Set when the issue was scanned under the engaged rule (#1862): the user
|
|
350
|
+
* claimed it or one of their PRs links it, so any substantive non-bot
|
|
351
|
+
* comment after their last word counts as a reply, not only maintainer or
|
|
352
|
+
* @mention ones. Absent for issues the user only commented on in passing.
|
|
353
|
+
*/
|
|
354
|
+
engagement?: IssueEngagement;
|
|
308
355
|
}
|
|
309
356
|
/** Issue where someone responded after the user's last comment. */
|
|
310
357
|
export interface CommentedIssueWithResponse extends CommentedIssueBase {
|
package/dist/core/urls.d.ts
CHANGED
|
@@ -33,6 +33,19 @@ export interface ParsedGitHubUrl {
|
|
|
33
33
|
* // null
|
|
34
34
|
*/
|
|
35
35
|
export declare function parseGitHubUrl(url: string): ParsedGitHubUrl | null;
|
|
36
|
+
/**
|
|
37
|
+
* Case-insensitive identity of a GitHub issue or PR URL: `owner/repo#number`,
|
|
38
|
+
* lowercased. Trailing slashes, `#fragment`s and `?query`s fall away because
|
|
39
|
+
* only the path segments are read, and `/issues/N` and `/pull/N` map to the
|
|
40
|
+
* same key: a repo has one number space, so a bare `#N` mention names the
|
|
41
|
+
* same object whichever kind it is. Returns null when the URL does not
|
|
42
|
+
* parse (see {@link parseGitHubUrl}).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* issueRefKey('https://github.com/Org/Repo/issues/5/')
|
|
46
|
+
* // "org/repo#5"
|
|
47
|
+
*/
|
|
48
|
+
export declare function issueRefKey(url: string): string | null;
|
|
36
49
|
/**
|
|
37
50
|
* Extracts the owner and repo from a GitHub web URL
|
|
38
51
|
* (e.g. `https://github.com/owner/repo/pull/42`, `https://github.com/owner/repo/`).
|
package/dist/core/urls.js
CHANGED
|
@@ -58,6 +58,22 @@ export function parseGitHubUrl(url) {
|
|
|
58
58
|
}
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Case-insensitive identity of a GitHub issue or PR URL: `owner/repo#number`,
|
|
63
|
+
* lowercased. Trailing slashes, `#fragment`s and `?query`s fall away because
|
|
64
|
+
* only the path segments are read, and `/issues/N` and `/pull/N` map to the
|
|
65
|
+
* same key: a repo has one number space, so a bare `#N` mention names the
|
|
66
|
+
* same object whichever kind it is. Returns null when the URL does not
|
|
67
|
+
* parse (see {@link parseGitHubUrl}).
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* issueRefKey('https://github.com/Org/Repo/issues/5/')
|
|
71
|
+
* // "org/repo#5"
|
|
72
|
+
*/
|
|
73
|
+
export function issueRefKey(url) {
|
|
74
|
+
const parsed = parseGitHubUrl(url);
|
|
75
|
+
return parsed ? `${parsed.owner.toLowerCase()}/${parsed.repo.toLowerCase()}#${parsed.number}` : null;
|
|
76
|
+
}
|
|
61
77
|
/**
|
|
62
78
|
* Extracts the owner and repo from a GitHub web URL
|
|
63
79
|
* (e.g. `https://github.com/owner/repo/pull/42`, `https://github.com/owner/repo/`).
|