@sentry/junior-github 0.112.0 → 0.114.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.
@@ -21,10 +21,17 @@ declare const githubIssueOutcomeInputSchema: z.ZodObject<{
21
21
  updatedAt: z.ZodDate;
22
22
  }, z.core.$strict>;
23
23
  export type GitHubIssueOutcomeInput = z.output<typeof githubIssueOutcomeInputSchema>;
24
+ declare const githubIssueConversationsInputSchema: z.ZodObject<{
25
+ conversationIds: z.ZodArray<z.ZodString>;
26
+ issueId: z.ZodString;
27
+ }, z.core.$strict>;
28
+ export type GitHubIssueConversationsInput = z.output<typeof githubIssueConversationsInputSchema>;
24
29
  /**
25
30
  * Record the newest lifecycle projection for one Junior-owned issue.
26
31
  * Ownership-qualified opening or closing events insert; later events update
27
32
  * existing rows, and older provider timestamps cannot regress them.
28
33
  */
29
34
  export declare function recordGitHubIssueOutcome(db: GitHubDb, input: GitHubIssueOutcomeInput): Promise<void>;
35
+ /** Append native conversation ids to an existing Junior-owned issue projection. */
36
+ export declare function recordGitHubIssueConversations(db: GitHubDb, input: GitHubIssueConversationsInput): Promise<boolean>;
30
37
  export {};
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ import type { GitHubDb } from "../db/database.js";
3
+ declare const costWindowSchema: z.ZodPipe<z.ZodObject<{
4
+ days: z.ZodNumber;
5
+ issueCostUsd: z.ZodNullable<z.ZodNumber>;
6
+ medianIssueCostUsd: z.ZodNullable<z.ZodNumber>;
7
+ medianPullRequestCostUsd: z.ZodNullable<z.ZodNumber>;
8
+ pullRequestCostUsd: z.ZodNullable<z.ZodNumber>;
9
+ }, z.core.$strict>, z.ZodTransform<{
10
+ days: number;
11
+ issueCostUsd: number | undefined;
12
+ medianIssueCostUsd: number | undefined;
13
+ medianPullRequestCostUsd: number | undefined;
14
+ pullRequestCostUsd: number | undefined;
15
+ }, {
16
+ days: number;
17
+ issueCostUsd: number | null;
18
+ medianIssueCostUsd: number | null;
19
+ medianPullRequestCostUsd: number | null;
20
+ pullRequestCostUsd: number | null;
21
+ }>>;
22
+ declare const repositoryCostSchema: z.ZodPipe<z.ZodObject<{
23
+ issueCostUsd: z.ZodNullable<z.ZodNumber>;
24
+ pullRequestCostUsd: z.ZodNullable<z.ZodNumber>;
25
+ repository: z.ZodString;
26
+ }, z.core.$strict>, z.ZodTransform<{
27
+ issueCostUsd: number | undefined;
28
+ pullRequestCostUsd: number | undefined;
29
+ repository: string;
30
+ }, {
31
+ issueCostUsd: number | null;
32
+ pullRequestCostUsd: number | null;
33
+ repository: string;
34
+ }>>;
35
+ export type GitHubCostWindow = z.output<typeof costWindowSchema>;
36
+ export type GitHubRepositoryCost = z.output<typeof repositoryCostSchema>;
37
+ /** Aggregate PR and issue conversation cost across the standard report windows. */
38
+ export declare function aggregateGitHubCostWindows(args: {
39
+ db: GitHubDb;
40
+ nowMs: number;
41
+ windows: readonly number[];
42
+ }): Promise<GitHubCostWindow[]>;
43
+ /** Aggregate repository-level PR and issue cost for the trailing 30 days. */
44
+ export declare function aggregateGitHubRepositoryCosts(args: {
45
+ db: GitHubDb;
46
+ nowMs: number;
47
+ }): Promise<GitHubRepositoryCost[]>;
48
+ /** Format estimated model cost in USD for GitHub operational reports. */
49
+ export declare function formatCostUsd(value: number | undefined): string;
50
+ export {};
@@ -27,6 +27,14 @@ declare const githubPullRequestConversationsInputSchema: z.ZodObject<{
27
27
  pullRequestId: z.ZodString;
28
28
  }, z.core.$strict>;
29
29
  export type GitHubPullRequestConversationsInput = z.output<typeof githubPullRequestConversationsInputSchema>;
30
+ declare const githubPullRequestLinkedIssuesInputSchema: z.ZodObject<{
31
+ linkedIssues: z.ZodArray<z.ZodObject<{
32
+ number: z.ZodNumber;
33
+ repositoryFullName: z.ZodString;
34
+ }, z.core.$strict>>;
35
+ pullRequestId: z.ZodString;
36
+ }, z.core.$strict>;
37
+ export type GitHubPullRequestLinkedIssuesInput = z.output<typeof githubPullRequestLinkedIssuesInputSchema>;
30
38
  /**
31
39
  * Record the newest lifecycle projection for one Junior-owned pull request.
32
40
  * An ownership-qualified opening or terminal recovery inserts; later events
@@ -39,4 +47,6 @@ export declare function recordGitHubPullRequestOutcome(db: GitHubDb, input: GitH
39
47
  }>;
40
48
  /** Append native conversation ids to an existing Junior-owned PR projection. */
41
49
  export declare function recordGitHubPullRequestConversations(db: GitHubDb, input: GitHubPullRequestConversationsInput): Promise<boolean>;
50
+ /** Link an existing Junior-owned PR to tracked issues across repositories. */
51
+ export declare function recordGitHubPullRequestLinkedIssues(db: GitHubDb, input: GitHubPullRequestLinkedIssuesInput): Promise<boolean>;
42
52
  export {};
@@ -5,6 +5,11 @@ export declare function sentryConversationUrl(conversationId: string): string |
5
5
  export declare function githubConversationFooter(conversationId: string, dashboardUrl?: string): string | undefined;
6
6
  /** Read opaque native conversation ids from Junior-owned GitHub footers. */
7
7
  export declare function githubConversationIds(body: string | null | undefined): string[];
8
+ /** Read same- and cross-repository issue references from a pull request body. */
9
+ export declare function githubLinkedIssues(body: string | null | undefined, repositoryFullName: string): {
10
+ number: number;
11
+ repositoryFullName: string;
12
+ }[];
8
13
  /**
9
14
  * Append (or replace an existing) Junior session footer to a GitHub body string.
10
15
  * Without a dashboard or Sentry link, returns the body unchanged (existing footer stripped).
@@ -1,6 +1,11 @@
1
- import type { GitHubIssueOutcomeInput } from "../issue-outcomes/store.js";
1
+ import type { GitHubIssueConversationsInput, GitHubIssueOutcomeInput } from "../issue-outcomes/store.js";
2
2
  /** Normalize only the fields required for the Junior-owned issue projection. */
3
3
  export declare function normalizeGitHubIssueOutcome(args: {
4
4
  body: unknown;
5
5
  botEmail?: string;
6
6
  }): GitHubIssueOutcomeInput | undefined;
7
+ /** Normalize native conversation ids written to a Junior-owned issue by its bot. */
8
+ export declare function normalizeGitHubIssueConversations(args: {
9
+ body: unknown;
10
+ botEmail?: string;
11
+ }): GitHubIssueConversationsInput | undefined;
@@ -1,4 +1,4 @@
1
- import type { GitHubPullRequestConversationsInput, GitHubPullRequestOutcomeInput } from "../pull-request-outcomes/store.js";
1
+ import type { GitHubPullRequestConversationsInput, GitHubPullRequestLinkedIssuesInput, GitHubPullRequestOutcomeInput } from "../pull-request-outcomes/store.js";
2
2
  /** Normalize only the fields required for the Junior-owned PR projection. */
3
3
  export declare function normalizeGitHubPullRequestOutcome(args: {
4
4
  body: unknown;
@@ -9,3 +9,8 @@ export declare function normalizeGitHubPullRequestConversations(args: {
9
9
  body: unknown;
10
10
  botEmail?: string;
11
11
  }): GitHubPullRequestConversationsInput | undefined;
12
+ /** Normalize linked issues written into a Junior-owned PR body by its bot. */
13
+ export declare function normalizeGitHubPullRequestLinkedIssues(args: {
14
+ body: unknown;
15
+ botEmail?: string;
16
+ }): GitHubPullRequestLinkedIssuesInput | undefined;
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "junior_github_issues" ADD COLUMN "conversation_ids" text[] DEFAULT ARRAY[]::text[] NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "junior_github_pull_requests" ADD COLUMN "linked_issue_numbers" integer[] DEFAULT ARRAY[]::integer[] NOT NULL;
@@ -0,0 +1,9 @@
1
+ CREATE TABLE "junior_github_pull_request_issues" (
2
+ "pull_request_id" text NOT NULL,
3
+ "issue_repository_full_name" text NOT NULL,
4
+ "issue_number" integer NOT NULL,
5
+ CONSTRAINT "junior_github_pull_request_issues_pull_request_id_issue_repository_full_name_issue_number_pk" PRIMARY KEY("pull_request_id","issue_repository_full_name","issue_number")
6
+ );
7
+ --> statement-breakpoint
8
+ ALTER TABLE "junior_github_pull_request_issues" ADD CONSTRAINT "junior_github_pull_request_issues_pull_request_id_junior_github_pull_requests_pull_request_id_fk" FOREIGN KEY ("pull_request_id") REFERENCES "public"."junior_github_pull_requests"("pull_request_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
9
+ ALTER TABLE "junior_github_pull_requests" DROP COLUMN "linked_issue_numbers";
@@ -0,0 +1,289 @@
1
+ {
2
+ "id": "c77b9011-8d0d-4d16-8b63-a9a45c162c6a",
3
+ "prevId": "6e0acdc7-db48-4ebf-846e-0589fc32afb5",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.junior_github_issues": {
8
+ "name": "junior_github_issues",
9
+ "schema": "",
10
+ "columns": {
11
+ "issue_id": {
12
+ "name": "issue_id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "repository_id": {
18
+ "name": "repository_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "repository_full_name": {
24
+ "name": "repository_full_name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "number": {
30
+ "name": "number",
31
+ "type": "integer",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "state": {
36
+ "name": "state",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "state_reason": {
42
+ "name": "state_reason",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": false
46
+ },
47
+ "opened_at": {
48
+ "name": "opened_at",
49
+ "type": "timestamp with time zone",
50
+ "primaryKey": false,
51
+ "notNull": true
52
+ },
53
+ "closed_at": {
54
+ "name": "closed_at",
55
+ "type": "timestamp with time zone",
56
+ "primaryKey": false,
57
+ "notNull": false
58
+ },
59
+ "updated_at": {
60
+ "name": "updated_at",
61
+ "type": "timestamp with time zone",
62
+ "primaryKey": false,
63
+ "notNull": true
64
+ },
65
+ "conversation_ids": {
66
+ "name": "conversation_ids",
67
+ "type": "text[]",
68
+ "primaryKey": false,
69
+ "notNull": true,
70
+ "default": "ARRAY[]::text[]"
71
+ }
72
+ },
73
+ "indexes": {
74
+ "junior_github_issues_opened_at_idx": {
75
+ "name": "junior_github_issues_opened_at_idx",
76
+ "columns": [
77
+ {
78
+ "expression": "opened_at",
79
+ "isExpression": false,
80
+ "asc": true,
81
+ "nulls": "last"
82
+ }
83
+ ],
84
+ "isUnique": false,
85
+ "concurrently": false,
86
+ "method": "btree",
87
+ "with": {}
88
+ },
89
+ "junior_github_issues_closed_at_idx": {
90
+ "name": "junior_github_issues_closed_at_idx",
91
+ "columns": [
92
+ {
93
+ "expression": "closed_at",
94
+ "isExpression": false,
95
+ "asc": true,
96
+ "nulls": "last"
97
+ }
98
+ ],
99
+ "isUnique": false,
100
+ "concurrently": false,
101
+ "method": "btree",
102
+ "with": {}
103
+ },
104
+ "junior_github_issues_open_idx": {
105
+ "name": "junior_github_issues_open_idx",
106
+ "columns": [
107
+ {
108
+ "expression": "issue_id",
109
+ "isExpression": false,
110
+ "asc": true,
111
+ "nulls": "last"
112
+ }
113
+ ],
114
+ "isUnique": false,
115
+ "where": "\"junior_github_issues\".\"state\" = 'open'",
116
+ "concurrently": false,
117
+ "method": "btree",
118
+ "with": {}
119
+ }
120
+ },
121
+ "foreignKeys": {},
122
+ "compositePrimaryKeys": {},
123
+ "uniqueConstraints": {},
124
+ "policies": {},
125
+ "checkConstraints": {},
126
+ "isRLSEnabled": false
127
+ },
128
+ "public.junior_github_pull_requests": {
129
+ "name": "junior_github_pull_requests",
130
+ "schema": "",
131
+ "columns": {
132
+ "pull_request_id": {
133
+ "name": "pull_request_id",
134
+ "type": "text",
135
+ "primaryKey": true,
136
+ "notNull": true
137
+ },
138
+ "repository_id": {
139
+ "name": "repository_id",
140
+ "type": "text",
141
+ "primaryKey": false,
142
+ "notNull": true
143
+ },
144
+ "repository_full_name": {
145
+ "name": "repository_full_name",
146
+ "type": "text",
147
+ "primaryKey": false,
148
+ "notNull": true
149
+ },
150
+ "number": {
151
+ "name": "number",
152
+ "type": "integer",
153
+ "primaryKey": false,
154
+ "notNull": true
155
+ },
156
+ "state": {
157
+ "name": "state",
158
+ "type": "text",
159
+ "primaryKey": false,
160
+ "notNull": true
161
+ },
162
+ "commit_composition": {
163
+ "name": "commit_composition",
164
+ "type": "text",
165
+ "primaryKey": false,
166
+ "notNull": false
167
+ },
168
+ "conversation_ids": {
169
+ "name": "conversation_ids",
170
+ "type": "text[]",
171
+ "primaryKey": false,
172
+ "notNull": true,
173
+ "default": "ARRAY[]::text[]"
174
+ },
175
+ "opened_at": {
176
+ "name": "opened_at",
177
+ "type": "timestamp with time zone",
178
+ "primaryKey": false,
179
+ "notNull": true
180
+ },
181
+ "merged_at": {
182
+ "name": "merged_at",
183
+ "type": "timestamp with time zone",
184
+ "primaryKey": false,
185
+ "notNull": false
186
+ },
187
+ "closed_at": {
188
+ "name": "closed_at",
189
+ "type": "timestamp with time zone",
190
+ "primaryKey": false,
191
+ "notNull": false
192
+ },
193
+ "updated_at": {
194
+ "name": "updated_at",
195
+ "type": "timestamp with time zone",
196
+ "primaryKey": false,
197
+ "notNull": true
198
+ },
199
+ "linked_issue_numbers": {
200
+ "name": "linked_issue_numbers",
201
+ "type": "integer[]",
202
+ "primaryKey": false,
203
+ "notNull": true,
204
+ "default": "ARRAY[]::integer[]"
205
+ }
206
+ },
207
+ "indexes": {
208
+ "junior_github_pull_requests_opened_at_idx": {
209
+ "name": "junior_github_pull_requests_opened_at_idx",
210
+ "columns": [
211
+ {
212
+ "expression": "opened_at",
213
+ "isExpression": false,
214
+ "asc": true,
215
+ "nulls": "last"
216
+ }
217
+ ],
218
+ "isUnique": false,
219
+ "concurrently": false,
220
+ "method": "btree",
221
+ "with": {}
222
+ },
223
+ "junior_github_pull_requests_merged_at_idx": {
224
+ "name": "junior_github_pull_requests_merged_at_idx",
225
+ "columns": [
226
+ {
227
+ "expression": "merged_at",
228
+ "isExpression": false,
229
+ "asc": true,
230
+ "nulls": "last"
231
+ }
232
+ ],
233
+ "isUnique": false,
234
+ "concurrently": false,
235
+ "method": "btree",
236
+ "with": {}
237
+ },
238
+ "junior_github_pull_requests_closed_at_idx": {
239
+ "name": "junior_github_pull_requests_closed_at_idx",
240
+ "columns": [
241
+ {
242
+ "expression": "closed_at",
243
+ "isExpression": false,
244
+ "asc": true,
245
+ "nulls": "last"
246
+ }
247
+ ],
248
+ "isUnique": false,
249
+ "concurrently": false,
250
+ "method": "btree",
251
+ "with": {}
252
+ },
253
+ "junior_github_pull_requests_open_idx": {
254
+ "name": "junior_github_pull_requests_open_idx",
255
+ "columns": [
256
+ {
257
+ "expression": "pull_request_id",
258
+ "isExpression": false,
259
+ "asc": true,
260
+ "nulls": "last"
261
+ }
262
+ ],
263
+ "isUnique": false,
264
+ "where": "\"junior_github_pull_requests\".\"state\" = 'open'",
265
+ "concurrently": false,
266
+ "method": "btree",
267
+ "with": {}
268
+ }
269
+ },
270
+ "foreignKeys": {},
271
+ "compositePrimaryKeys": {},
272
+ "uniqueConstraints": {},
273
+ "policies": {},
274
+ "checkConstraints": {},
275
+ "isRLSEnabled": false
276
+ }
277
+ },
278
+ "enums": {},
279
+ "schemas": {},
280
+ "sequences": {},
281
+ "roles": {},
282
+ "policies": {},
283
+ "views": {},
284
+ "_meta": {
285
+ "columns": {},
286
+ "schemas": {},
287
+ "tables": {}
288
+ }
289
+ }