@oss-scout/core 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,6 +108,19 @@ export interface RecommendationInput {
108
108
  * instead of a competing-PR penalty.
109
109
  */
110
110
  ownPR: boolean;
111
+ /**
112
+ * The linked PR was already merged (#249 part B). The issue is effectively
113
+ * resolved, so it is a hard skip — surfacing it as a contribution
114
+ * opportunity is noise. Distinct from an open competing PR (which may be
115
+ * revivable). Defaults to false.
116
+ */
117
+ linkedPRMerged?: boolean;
118
+ /**
119
+ * The linked PR was closed without merging (#249 part B). The previous
120
+ * attempt was abandoned or rejected, so default to skip rather than
121
+ * re-surfacing it. Defaults to false.
122
+ */
123
+ linkedPRClosed?: boolean;
111
124
  notClaimed: boolean;
112
125
  clearRequirements: boolean;
113
126
  contributionGuidelinesFound: boolean;
@@ -37,7 +37,11 @@ export function deriveRecommendation(input) {
37
37
  if (!input.noExistingPR)
38
38
  notes.push(input.ownPR
39
39
  ? "Your PR is already in flight for this issue"
40
- : "Existing PR found for this issue");
40
+ : input.linkedPRMerged
41
+ ? "A PR for this issue was already merged"
42
+ : input.linkedPRClosed
43
+ ? "A PR for this issue was closed without merging"
44
+ : "Existing PR found for this issue");
41
45
  if (!input.notClaimed)
42
46
  notes.push("Issue appears to be claimed by someone");
43
47
  if (input.existingPRInconclusive) {
@@ -57,8 +61,16 @@ export function deriveRecommendation(input) {
57
61
  if (!input.contributionGuidelinesFound)
58
62
  notes.push("No CONTRIBUTING.md found");
59
63
  // Reasons to skip / approve.
60
- if (!input.noExistingPR)
61
- reasonsToSkip.push(input.ownPR ? "You already have a PR in flight" : "Has existing PR");
64
+ if (!input.noExistingPR) {
65
+ if (input.ownPR)
66
+ reasonsToSkip.push("You already have a PR in flight");
67
+ else if (input.linkedPRMerged)
68
+ reasonsToSkip.push("Linked PR already merged");
69
+ else if (input.linkedPRClosed)
70
+ reasonsToSkip.push("Linked PR closed without merge");
71
+ else
72
+ reasonsToSkip.push("Has existing PR");
73
+ }
62
74
  if (!input.notClaimed)
63
75
  reasonsToSkip.push("Already claimed");
64
76
  if (!input.projectIsActive && !input.projectCheckFailed)
@@ -92,6 +104,13 @@ export function deriveRecommendation(input) {
92
104
  if (input.issueClosed) {
93
105
  recommendation = "skip";
94
106
  }
107
+ else if (input.linkedPRMerged || input.linkedPRClosed) {
108
+ // The issue is resolved (merged) or its attempt was abandoned/rejected
109
+ // (closed) — a hard skip, not a revive opportunity (#249 part B). An OPEN
110
+ // competing PR is deliberately NOT caught here; it falls through to the
111
+ // existing competing-PR handling below.
112
+ recommendation = "skip";
113
+ }
95
114
  else if (input.ownPR) {
96
115
  // You're already working on this; don't re-surface it as competition.
97
116
  recommendation = "skip";
@@ -201,6 +220,12 @@ export class IssueVetter {
201
220
  !linkedPR.merged &&
202
221
  username !== "" &&
203
222
  linkedPR.author.toLowerCase() === username.toLowerCase();
223
+ // Linked-PR lifecycle gate (#249 part B): a merged linked PR means the
224
+ // issue is resolved; a closed-unmerged one means the attempt was
225
+ // abandoned/rejected. Both are hard skips. (state === "closed" && merged
226
+ // is how buildLinkedPRFromTimelineEvent encodes a merged PR.)
227
+ const linkedPRMerged = !!linkedPR && linkedPR.merged;
228
+ const linkedPRClosed = !!linkedPR && linkedPR.state === "closed" && !linkedPR.merged;
204
229
  // Analyze issue quality
205
230
  const clearRequirements = analyzeRequirements(core.body);
206
231
  // When the health check itself failed (API error), use a neutral default:
@@ -263,6 +288,8 @@ export class IssueVetter {
263
288
  const { notes, reasonsToApprove, reasonsToSkip, recommendation } = deriveRecommendation({
264
289
  noExistingPR,
265
290
  ownPR,
291
+ linkedPRMerged,
292
+ linkedPRClosed,
266
293
  notClaimed,
267
294
  clearRequirements,
268
295
  contributionGuidelinesFound: !!contributionGuidelines,
@@ -281,6 +281,21 @@ export interface SearchOptions {
281
281
  * `interPhaseDelayMs` for the rationale (#143).
282
282
  */
283
283
  broadPhaseDelayMs?: number;
284
+ /**
285
+ * Exclude issues already surfaced by a recent search so consecutive
286
+ * searches rotate to fresh candidates instead of returning the same set
287
+ * (#249). A result counts as "recently surfaced" when its `lastSeenAt`
288
+ * (recorded by `saveResults`) is within `recentlySurfacedTtlDays`.
289
+ * Defaults to `true`. Pass `false` to force-resurface (e.g. an explicit
290
+ * "search the same pool again" request).
291
+ */
292
+ excludeRecentlySurfaced?: boolean;
293
+ /**
294
+ * TTL in days for the `excludeRecentlySurfaced` rotation window (#249).
295
+ * Results last surfaced more than this many days ago are eligible to
296
+ * resurface. Defaults to 7.
297
+ */
298
+ recentlySurfacedTtlDays?: number;
284
299
  }
285
300
  /** Result of a search operation. */
286
301
  export interface SearchResult {
package/dist/scout.js CHANGED
@@ -170,6 +170,18 @@ export class OssScout {
170
170
  // Auto-cull expired skips before searching
171
171
  this.cullExpiredSkips();
172
172
  const skippedUrls = new Set((this.state.skippedIssues ?? []).map((s) => s.url));
173
+ // Rotation (#249): also exclude issues surfaced by a recent search so
174
+ // consecutive searches return fresh candidates instead of the same set.
175
+ // Folded into the same exclusion set the issue filter already honors.
176
+ if (options?.excludeRecentlySurfaced ?? true) {
177
+ const ttlDays = options?.recentlySurfacedTtlDays ?? 7;
178
+ const cutoff = Date.now() - ttlDays * 24 * 60 * 60 * 1000;
179
+ for (const r of this.state.savedResults ?? []) {
180
+ const seen = Date.parse(r.lastSeenAt);
181
+ if (!Number.isNaN(seen) && seen >= cutoff)
182
+ skippedUrls.add(r.issueUrl);
183
+ }
184
+ }
173
185
  const discovery = new IssueDiscovery(this.githubToken, this.state.preferences, this);
174
186
  // Per-call flags override the persisted personalization defaults (#168).
175
187
  // An empty preference array reads as "no boost" just like an absent flag.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-scout/core",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Personalized GitHub issue finder with multi-strategy search, deep vetting, and viability scoring — CLI, library, MCP server, and Claude Code plugin",
5
5
  "type": "module",
6
6
  "bin": {