@oss-autopilot/core 3.33.0 → 3.34.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.
Files changed (86) hide show
  1. package/dist/cli-pre-action.js +20 -20
  2. package/dist/cli-registry.js +59 -23
  3. package/dist/cli.bundle.cjs +140 -129
  4. package/dist/commands/check-integration.d.ts +2 -2
  5. package/dist/commands/comments.js +3 -3
  6. package/dist/commands/compliance-score.js +1 -1
  7. package/dist/commands/config.js +1 -1
  8. package/dist/commands/daily-render.js +6 -13
  9. package/dist/commands/daily.d.ts +1 -2
  10. package/dist/commands/daily.js +8 -4
  11. package/dist/commands/dashboard-cache.js +1 -1
  12. package/dist/commands/dashboard-data.js +7 -6
  13. package/dist/commands/dashboard-lifecycle.js +3 -5
  14. package/dist/commands/dashboard-server.js +3 -3
  15. package/dist/commands/detect-formatters.d.ts +1 -1
  16. package/dist/commands/dismiss.js +2 -2
  17. package/dist/commands/doctor.js +3 -3
  18. package/dist/commands/eval.d.ts +11 -0
  19. package/dist/commands/eval.js +11 -0
  20. package/dist/commands/features.js +1 -1
  21. package/dist/commands/guidelines.js +5 -5
  22. package/dist/commands/index.d.ts +1 -0
  23. package/dist/commands/index.js +1 -0
  24. package/dist/commands/init.js +1 -1
  25. package/dist/commands/ledger-backfill.d.ts +40 -0
  26. package/dist/commands/ledger-backfill.js +216 -0
  27. package/dist/commands/local-repos.d.ts +1 -1
  28. package/dist/commands/overnight.js +13 -18
  29. package/dist/commands/parse-list.d.ts +2 -2
  30. package/dist/commands/parse-list.js +7 -7
  31. package/dist/commands/repo-vet.js +3 -3
  32. package/dist/commands/search.js +9 -10
  33. package/dist/commands/setup.js +8 -8
  34. package/dist/commands/startup.js +1 -1
  35. package/dist/commands/status.d.ts +1 -1
  36. package/dist/commands/vet-list.js +17 -7
  37. package/dist/commands/vet.js +5 -3
  38. package/dist/core/__fixtures__/prompt-injection-payloads.js +1 -1
  39. package/dist/core/anti-llm-policy.js +3 -3
  40. package/dist/core/checklist-analysis.d.ts +3 -0
  41. package/dist/core/checklist-analysis.js +67 -16
  42. package/dist/core/ci-analysis.js +1 -1
  43. package/dist/core/close-reason.d.ts +25 -0
  44. package/dist/core/close-reason.js +28 -0
  45. package/dist/core/comment-decision.js +1 -1
  46. package/dist/core/compliance-score.js +2 -2
  47. package/dist/core/daily-logic.d.ts +12 -0
  48. package/dist/core/daily-logic.js +11 -2
  49. package/dist/core/display-utils.js +1 -1
  50. package/dist/core/errors.js +4 -5
  51. package/dist/core/eval-report.d.ts +55 -0
  52. package/dist/core/eval-report.js +211 -0
  53. package/dist/core/follow-up-history.d.ts +1 -2
  54. package/dist/core/follow-up-history.js +1 -1
  55. package/dist/core/github-stats.d.ts +9 -0
  56. package/dist/core/github-stats.js +27 -1
  57. package/dist/core/guidelines-store.js +2 -2
  58. package/dist/core/http-cache.js +1 -2
  59. package/dist/core/index.d.ts +3 -2
  60. package/dist/core/index.js +3 -2
  61. package/dist/core/issue-conversation.js +1 -1
  62. package/dist/core/issue-effort.js +12 -6
  63. package/dist/core/paths.d.ts +7 -0
  64. package/dist/core/paths.js +25 -3
  65. package/dist/core/pick-snapshot.d.ts +23 -0
  66. package/dist/core/pick-snapshot.js +51 -0
  67. package/dist/core/pr-comments-fetcher.js +1 -1
  68. package/dist/core/review-analysis.js +5 -9
  69. package/dist/core/state-persistence.js +1 -1
  70. package/dist/core/state-schema.d.ts +117 -0
  71. package/dist/core/state-schema.js +48 -0
  72. package/dist/core/state.d.ts +22 -1
  73. package/dist/core/state.js +65 -12
  74. package/dist/core/strategy.js +2 -3
  75. package/dist/core/types.d.ts +1 -1
  76. package/dist/core/untrusted-content.js +9 -9
  77. package/dist/core/urls.js +1 -1
  78. package/dist/dashboard/assets/chart-panel-DPKNBUts.js +3 -0
  79. package/dist/dashboard/assets/{confetti.module-BYDB1iN2.js → confetti.module-D2UmBLOm.js} +1 -1
  80. package/dist/dashboard/assets/index-B25bZOYX.js +55 -0
  81. package/dist/dashboard/index.html +1 -1
  82. package/dist/formatters/json.d.ts +10 -2
  83. package/dist/formatters/json.js +2 -2
  84. package/package.json +1 -1
  85. package/dist/dashboard/assets/chart-panel-CmNIsCjO.js +0 -3
  86. package/dist/dashboard/assets/index-CTKGc-Ns.js +0 -55
@@ -9,6 +9,7 @@
9
9
  * Unknown keys are stripped by default (Zod 4 behavior).
10
10
  */
11
11
  import { z } from 'zod';
12
+ import { CLOSE_REASONS } from './close-reason.js';
12
13
  // ── 1. Enum / union schemas ───────────────────────────────────────────
13
14
  export const IssueStatusSchema = z.enum(['candidate', 'claimed', 'in_progress', 'pr_submitted']);
14
15
  export const FetchedPRStatusSchema = z.enum(['needs_addressing', 'waiting_on_maintainer']);
@@ -40,6 +41,39 @@ export const RepoScoreSchema = z.object({
40
41
  stargazersCount: z.number().optional(),
41
42
  language: z.string().nullable().optional(),
42
43
  });
44
+ /**
45
+ * What the tool predicted about an issue when it was vetted (#1824). Recorded
46
+ * by `vet` / `vet-list` keyed by issue URL, then copied onto the outcome
47
+ * ledger entry of the PR that closes that issue, so outcomes can be compared
48
+ * against the prediction that picked them (calibration).
49
+ */
50
+ export const PickSnapshotSchema = z.object({
51
+ issueUrl: z.string(),
52
+ /** Success-likelihood grade (1-10) from issue-grading. */
53
+ grade: z.number(),
54
+ recommendation: z.string(),
55
+ stargazersCount: z.number().optional(),
56
+ /** `list`: the curated list's `**Tier (N/10)**` score, imported by ledger-backfill. */
57
+ source: z.enum(['vet', 'vet-list', 'list']),
58
+ /** When the vet ran. Absent for `list` picks: the list does not record vet dates reliably. */
59
+ capturedAt: z.string().optional(),
60
+ });
61
+ /**
62
+ * Outcome-ledger fields added by #1824, shared by merged and closed entries.
63
+ * All optional: entries written before #1824 have none of them.
64
+ */
65
+ const LedgerPredictionFields = {
66
+ /** Issue the PR closes, parsed from a closing keyword in the PR body. */
67
+ issueUrl: z.string().optional(),
68
+ /** The vet-time prediction for `issueUrl`, when one was recorded. */
69
+ pick: PickSnapshotSchema.optional(),
70
+ /** Review decision from the last digest that saw the PR open. */
71
+ lastReviewDecision: z.string().optional(),
72
+ /** CI status from the last digest that saw the PR open. */
73
+ lastCiStatus: z.string().optional(),
74
+ /** When ledger-backfill got GitHub's answer for this PR; later runs skip it. */
75
+ backfilledAt: z.string().optional(),
76
+ };
43
77
  export const StoredMergedPRSchema = z.object({
44
78
  url: z.string(),
45
79
  title: z.string(),
@@ -64,6 +98,7 @@ export const StoredMergedPRSchema = z.object({
64
98
  commentsFetchedAt: z.string().datetime().optional(),
65
99
  /** When the host last ran LLM extraction over this PR's comment bundle (#867). */
66
100
  learningsExtractedAt: z.string().datetime().optional(),
101
+ ...LedgerPredictionFields,
67
102
  });
68
103
  export const StoredClosedPRSchema = z.object({
69
104
  url: z.string(),
@@ -82,6 +117,9 @@ export const StoredClosedPRSchema = z.object({
82
117
  commentsFetchedAt: z.string().datetime().optional(),
83
118
  /** When the host last ran LLM extraction over this PR's comment bundle (#867). */
84
119
  learningsExtractedAt: z.string().datetime().optional(),
120
+ ...LedgerPredictionFields,
121
+ /** Why it closed unmerged (#1824), set by ledger-backfill. */
122
+ closeReason: z.enum(CLOSE_REASONS).optional(),
85
123
  });
86
124
  export const AnalyzedIssueConversationSchema = z.object({
87
125
  url: z.string(),
@@ -310,6 +348,8 @@ export const ClosedPRSchema = z.object({
310
348
  * Optional: digests persisted by older producers don't have it.
311
349
  */
312
350
  openedAt: z.string().optional(),
351
+ /** Issue the PR closes, parsed from the PR body (#1824). */
352
+ issueUrl: z.string().optional(),
313
353
  });
314
354
  export const MergedPRSchema = z.object({
315
355
  url: z.string(),
@@ -323,6 +363,8 @@ export const MergedPRSchema = z.object({
323
363
  * Optional: digests persisted by older producers don't have it.
324
364
  */
325
365
  openedAt: z.string().optional(),
366
+ /** Issue the PR closes, parsed from the PR body (#1824). */
367
+ issueUrl: z.string().optional(),
326
368
  });
327
369
  export const DailyDigestSummarySchema = z.object({
328
370
  totalActivePRs: z.number(),
@@ -509,6 +551,12 @@ export const AgentStateSchema = z.object({
509
551
  * it cannot grow without bound.
510
552
  */
511
553
  searchSeen: z.array(SearchSeenEntrySchema).default([]),
554
+ /**
555
+ * Vet-time predictions keyed by issue URL (#1824), newest last. Joined onto
556
+ * outcome-ledger entries at merge/close detection. Capped at
557
+ * MAX_PICK_SNAPSHOTS so it cannot grow without bound.
558
+ */
559
+ pickSnapshots: z.array(PickSnapshotSchema).default([]),
512
560
  /** Latest overnight run (#1574). Absent until the first `overnight`. */
513
561
  lastOvernight: OvernightRecordSchema.optional(),
514
562
  /**
@@ -3,7 +3,7 @@
3
3
  * Thin coordinator that delegates persistence to state-persistence.ts
4
4
  * and scoring logic to repo-score-manager.ts.
5
5
  */
6
- import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, DailyDigest, LocalRepoCache, StatusOverride, FetchedPRStatus, StoredMergedPR, StoredClosedPR, SearchSeenEntry, OvernightRecord, SearchRotation } from './types.js';
6
+ import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, DailyDigest, LocalRepoCache, StatusOverride, FetchedPRStatus, StoredMergedPR, StoredClosedPR, SearchSeenEntry, PickSnapshot, OvernightRecord, SearchRotation } from './types.js';
7
7
  import { type LoadRecoveryInfo } from './state-persistence.js';
8
8
  import type { Stats } from './repo-score-manager.js';
9
9
  import { GistStateStore } from './gist-state-store.js';
@@ -13,6 +13,8 @@ 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
+ /** Cap on `state.pickSnapshots` (#1824): ~180 bytes each, so ~55 KB at the cap. */
17
+ export declare const MAX_PICK_SNAPSHOTS = 300;
16
18
  /**
17
19
  * Push state to the backing Gist when Gist mode is active. Best-effort:
18
20
  * network/auth failures are logged via `warn()` but never propagated —
@@ -257,6 +259,12 @@ export declare class StateManager {
257
259
  added: number;
258
260
  dropped: number;
259
261
  };
262
+ /**
263
+ * Copy the vet-time prediction for the PR's closing issue onto a ledger
264
+ * entry (#1824). Returns the entry unchanged when it has no issueUrl, already
265
+ * carries a pick, or no snapshot was recorded for that issue.
266
+ */
267
+ private withPick;
260
268
  /** Returns the most recent merge date, used as a watermark for incremental fetching. */
261
269
  getMergedPRWatermark(): string | undefined;
262
270
  /** Returns all stored closed-without-merge PRs (sorted by close date descending via addClosedPRs). */
@@ -362,6 +370,19 @@ export declare class StateManager {
362
370
  * @param status - The overridden status
363
371
  * @param lastActivityAt - ISO timestamp of PR's last activity when override was set
364
372
  */
373
+ /** Vet-time predictions awaiting a ledger join (#1824), oldest first. */
374
+ getPickSnapshots(): PickSnapshot[];
375
+ /**
376
+ * Record vet-time predictions (#1824). The first prediction for an issue
377
+ * wins: a later re-vet (often after the user's own PR exists) must not
378
+ * replace the one that picked it. The oldest entries are dropped past
379
+ * {@link MAX_PICK_SNAPSHOTS}.
380
+ *
381
+ * ponytail: never refreshed, so an issue vetted months before it is picked
382
+ * keeps its old grade. Replace snapshots older than N days if that skews
383
+ * calibration.
384
+ */
385
+ recordPickSnapshots(snapshots: PickSnapshot[]): void;
365
386
  /**
366
387
  * The durable search seen-set (#1528) — issue URLs surfaced by recent
367
388
  * searches, fed into oss-scout for result rotation. Returns `[]` when none
@@ -37,8 +37,19 @@ function filterValidUrlEntries(entries, kind) {
37
37
  }
38
38
  return { valid, dropped };
39
39
  }
40
+ /** Optional outcome-ledger fields (#1461, #1824) that a re-seen entry may fill in. */
41
+ const LEDGER_FIELDS = [
42
+ 'openedAt',
43
+ 'firstMaintainerResponseAt',
44
+ 'issueUrl',
45
+ 'pick',
46
+ 'lastReviewDecision',
47
+ 'lastCiStatus',
48
+ 'backfilledAt',
49
+ 'closeReason',
50
+ ];
40
51
  /**
41
- * Fill outcome-ledger timestamps (#1461) missing on an existing stored PR
52
+ * Fill outcome-ledger fields (#1461, #1824) missing on an existing stored PR
42
53
  * from a richer re-seen entry. Only fills absent fields — never overwrites —
43
54
  * so an earlier enriched write (and stamps like commentsFetchedAt that live
44
55
  * solely on the stored entry) cannot be clobbered by a later minimal one.
@@ -46,16 +57,16 @@ function filterValidUrlEntries(entries, kind) {
46
57
  */
47
58
  function upgradeLedgerFields(existing, incoming) {
48
59
  let changed = false;
49
- if (incoming.openedAt && !existing.openedAt) {
50
- existing.openedAt = incoming.openedAt;
51
- changed = true;
52
- }
53
- if (incoming.firstMaintainerResponseAt && !existing.firstMaintainerResponseAt) {
54
- existing.firstMaintainerResponseAt = incoming.firstMaintainerResponseAt;
55
- changed = true;
60
+ for (const key of LEDGER_FIELDS) {
61
+ if (incoming[key] !== undefined && existing[key] === undefined) {
62
+ existing[key] = incoming[key];
63
+ changed = true;
64
+ }
56
65
  }
57
66
  return changed;
58
67
  }
68
+ /** Cap on `state.pickSnapshots` (#1824): ~180 bytes each, so ~55 KB at the cap. */
69
+ export const MAX_PICK_SNAPSHOTS = 300;
59
70
  /**
60
71
  * Push state to the backing Gist when Gist mode is active. Best-effort:
61
72
  * network/auth failures are logged via `warn()` but never propagated —
@@ -371,7 +382,7 @@ export class StateManager {
371
382
  mode: 'gist',
372
383
  degraded: {
373
384
  cause: 'bootstrap-degraded',
374
- ...(this.staleness ? { since: this.staleness.detectedAt } : {}),
385
+ ...(this.staleness && { since: this.staleness.detectedAt }),
375
386
  recoverable: true,
376
387
  },
377
388
  };
@@ -590,7 +601,8 @@ export class StateManager {
590
601
  addMergedPRs(prs) {
591
602
  if (prs.length === 0)
592
603
  return { added: 0, dropped: 0 };
593
- const { valid, dropped } = filterValidUrlEntries(prs, 'merged');
604
+ const { valid: unpicked, dropped } = filterValidUrlEntries(prs, 'merged');
605
+ const valid = unpicked.map((pr) => this.withPick(pr));
594
606
  if (valid.length === 0)
595
607
  return { added: 0, dropped };
596
608
  if (!this.state.mergedPRs)
@@ -616,6 +628,18 @@ export class StateManager {
616
628
  this.autoSave();
617
629
  return { added: newPRs.length, dropped };
618
630
  }
631
+ /**
632
+ * Copy the vet-time prediction for the PR's closing issue onto a ledger
633
+ * entry (#1824). Returns the entry unchanged when it has no issueUrl, already
634
+ * carries a pick, or no snapshot was recorded for that issue.
635
+ */
636
+ withPick(pr) {
637
+ if (!pr.issueUrl || pr.pick)
638
+ return pr;
639
+ const key = pr.issueUrl.toLowerCase();
640
+ const pick = this.getPickSnapshots().find((p) => p.issueUrl.toLowerCase() === key);
641
+ return pick ? { ...pr, pick } : pr;
642
+ }
619
643
  /** Returns the most recent merge date, used as a watermark for incremental fetching. */
620
644
  getMergedPRWatermark() {
621
645
  return this.state.mergedPRs?.[0]?.mergedAt || undefined;
@@ -640,7 +664,8 @@ export class StateManager {
640
664
  addClosedPRs(prs) {
641
665
  if (prs.length === 0)
642
666
  return { added: 0, dropped: 0 };
643
- const { valid, dropped } = filterValidUrlEntries(prs, 'closed');
667
+ const { valid: unpicked, dropped } = filterValidUrlEntries(prs, 'closed');
668
+ const valid = unpicked.map((pr) => this.withPick(pr));
644
669
  if (valid.length === 0)
645
670
  return { added: 0, dropped };
646
671
  if (!this.state.closedPRs)
@@ -744,7 +769,7 @@ export class StateManager {
744
769
  const repoLower = repo.toLowerCase();
745
770
  if (repos.some((r) => r.toLowerCase() === repoLower))
746
771
  return true;
747
- if (orgs?.some((o) => o.toLowerCase() === repoLower.split('/')[0]))
772
+ if (orgs?.some((o) => o.toLowerCase() === repoLower.split('/', 1)[0]))
748
773
  return true;
749
774
  return false;
750
775
  }
@@ -876,6 +901,34 @@ export class StateManager {
876
901
  * @param status - The overridden status
877
902
  * @param lastActivityAt - ISO timestamp of PR's last activity when override was set
878
903
  */
904
+ /** Vet-time predictions awaiting a ledger join (#1824), oldest first. */
905
+ getPickSnapshots() {
906
+ return this.state.pickSnapshots ?? [];
907
+ }
908
+ /**
909
+ * Record vet-time predictions (#1824). The first prediction for an issue
910
+ * wins: a later re-vet (often after the user's own PR exists) must not
911
+ * replace the one that picked it. The oldest entries are dropped past
912
+ * {@link MAX_PICK_SNAPSHOTS}.
913
+ *
914
+ * ponytail: never refreshed, so an issue vetted months before it is picked
915
+ * keeps its old grade. Replace snapshots older than N days if that skews
916
+ * calibration.
917
+ */
918
+ recordPickSnapshots(snapshots) {
919
+ const known = new Set(this.getPickSnapshots().map((p) => p.issueUrl.toLowerCase()));
920
+ const fresh = snapshots.filter((p) => {
921
+ const key = p.issueUrl.toLowerCase();
922
+ if (known.has(key))
923
+ return false;
924
+ known.add(key);
925
+ return true;
926
+ });
927
+ if (fresh.length === 0)
928
+ return;
929
+ this.state.pickSnapshots = [...this.getPickSnapshots(), ...fresh].slice(-MAX_PICK_SNAPSHOTS);
930
+ this.autoSave();
931
+ }
879
932
  /**
880
933
  * The durable search seen-set (#1528) — issue URLs surfaced by recent
881
934
  * searches, fed into oss-scout for result rotation. Returns `[]` when none
@@ -186,7 +186,7 @@ export function computeStrategy(state) {
186
186
  tests: 0,
187
187
  other: 0,
188
188
  };
189
- const cutoff = Date.now() - RECENT_WINDOW_DAYS * 86400000;
189
+ const cutoff = Date.now() - RECENT_WINDOW_DAYS * 86_400_000;
190
190
  for (const pr of merged) {
191
191
  const mergedAt = Date.parse(pr.mergedAt);
192
192
  if (Number.isNaN(mergedAt) || mergedAt < cutoff)
@@ -298,12 +298,11 @@ export function shouldComputeStrategy(state, nowIso) {
298
298
  function deriveIssueTypePreferences(distribution) {
299
299
  // Recommend the user's two strongest PR types — they have a track
300
300
  // record there, so issues in those buckets are higher-yield.
301
- const ranked = Object.entries(distribution)
301
+ return Object.entries(distribution)
302
302
  .filter(([type]) => type !== 'other')
303
303
  .sort((a, b) => b[1] - a[1])
304
304
  .slice(0, 2)
305
305
  .map(([type]) => type);
306
- return ranked;
307
306
  }
308
307
  function deriveAvoidPatterns(capacity, patterns) {
309
308
  const out = [];
@@ -2,7 +2,7 @@
2
2
  * Core types for the Open Source Contribution Agent
3
3
  */
4
4
  import type { FetchedPRStatus, RepoSignals, TrackedIssue, IssueVettingResult, IssueScope, DiffTool, AgentConfig, AgentState } from './state-schema.js';
5
- export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, } from './state-schema.js';
5
+ export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, PickSnapshot, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, } from './state-schema.js';
6
6
  /** CI pipeline status for a PR's latest commit. */
7
7
  export type CIStatus = 'passing' | 'failing' | 'pending' | 'unknown';
8
8
  /**
@@ -54,19 +54,19 @@ export const UNTRUSTED_CLOSE_TAG = `</${UNTRUSTED_OPEN_TAG_NAME}>`;
54
54
  */
55
55
  const AMP_ESCAPE = '&amp;';
56
56
  const CLOSE_TAG_ESCAPE = `&lt;/${UNTRUSTED_OPEN_TAG_NAME}&gt;`;
57
- const OPEN_TAG_PATTERN = new RegExp(`<${UNTRUSTED_OPEN_TAG_NAME}\\b`, 'g');
57
+ const OPEN_TAG_PATTERN = new RegExp(String.raw `<${UNTRUSTED_OPEN_TAG_NAME}\b`, 'g');
58
58
  const OPEN_TAG_ESCAPE = `&lt;${UNTRUSTED_OPEN_TAG_NAME}`;
59
59
  function escapeAttr(value) {
60
60
  // Newlines/carriage returns can't break out of a quoted attribute (no `"`)
61
61
  // but they visually fragment the open tag in the prompt text the LLM
62
62
  // reads, so encode them as numeric entities for defense-in-depth.
63
63
  return value
64
- .replace(/&/g, '&amp;')
65
- .replace(/"/g, '&quot;')
66
- .replace(/</g, '&lt;')
67
- .replace(/>/g, '&gt;')
68
- .replace(/\n/g, '&#10;')
69
- .replace(/\r/g, '&#13;');
64
+ .replaceAll('&', '&amp;')
65
+ .replaceAll('"', '&quot;')
66
+ .replaceAll('<', '&lt;')
67
+ .replaceAll('>', '&gt;')
68
+ .replaceAll('\n', '&#10;')
69
+ .replaceAll('\r', '&#13;');
70
70
  }
71
71
  /**
72
72
  * Wrap `text` in a `<github-content>` fence labeled with `label` and the
@@ -86,7 +86,7 @@ export function wrapUntrustedContent(text, label, meta = {}) {
86
86
  .join(AMP_ESCAPE)
87
87
  .split(UNTRUSTED_CLOSE_TAG)
88
88
  .join(CLOSE_TAG_ESCAPE)
89
- .replace(OPEN_TAG_PATTERN, OPEN_TAG_ESCAPE);
89
+ .replaceAll(OPEN_TAG_PATTERN, OPEN_TAG_ESCAPE);
90
90
  const attrs = [`label="${escapeAttr(label)}"`];
91
91
  if (meta.author !== undefined)
92
92
  attrs.push(`author="${escapeAttr(meta.author)}"`);
@@ -103,7 +103,7 @@ export function wrapUntrustedContent(text, label, meta = {}) {
103
103
  * markdown with this; it's for tests + symmetric reasoning only.
104
104
  */
105
105
  export function extractFromFence(fenced) {
106
- const openMatch = fenced.match(new RegExp(`^<${UNTRUSTED_OPEN_TAG_NAME}\\b[^>]*>`));
106
+ const openMatch = fenced.match(new RegExp(String.raw `^<${UNTRUSTED_OPEN_TAG_NAME}\b[^>]*>`));
107
107
  if (!openMatch) {
108
108
  throw new Error('extractFromFence: input does not start with a <github-content> open tag');
109
109
  }
package/dist/core/urls.js CHANGED
@@ -86,7 +86,7 @@ export function extractOwnerRepo(url) {
86
86
  * @throws {Error} If the input is not in the form `"owner/repo"`.
87
87
  */
88
88
  export function splitRepo(repoFullName) {
89
- const [owner, repo] = repoFullName.split('/');
89
+ const [owner, repo] = repoFullName.split('/', 2);
90
90
  if (!owner || !repo) {
91
91
  throw new Error(`Invalid repo format: expected "owner/repo", got "${repoFullName}"`);
92
92
  }