@sentry/junior-github 0.102.3 → 0.103.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/index.js +12 -8
- package/dist/tools/footer.d.ts +4 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -119,22 +119,24 @@ function sentryConversationUrl(conversationId) {
|
|
|
119
119
|
const port = parsed.port ? `:${parsed.port}` : "";
|
|
120
120
|
return `${parsed.protocol}//${parsed.hostname}${port}/organizations/${orgSlug}/${path}`;
|
|
121
121
|
}
|
|
122
|
-
function githubConversationFooter(conversationId) {
|
|
122
|
+
function githubConversationFooter(conversationId, dashboardUrl) {
|
|
123
123
|
const id = nonEmptyString(conversationId, "conversationId");
|
|
124
|
-
const
|
|
124
|
+
const normalizedDashboardUrl = dashboardUrl?.trim();
|
|
125
|
+
const sessionUrl = normalizedDashboardUrl || sentryConversationUrl(id);
|
|
125
126
|
if (!sessionUrl) {
|
|
126
127
|
return void 0;
|
|
127
128
|
}
|
|
129
|
+
const label = normalizedDashboardUrl ? "View Junior Session" : "View Junior Session in Sentry";
|
|
128
130
|
return `${GITHUB_SESSION_FOOTER_START}
|
|
129
131
|
|
|
130
132
|
--
|
|
131
133
|
|
|
132
|
-
[
|
|
134
|
+
[${label}](${sessionUrl})
|
|
133
135
|
|
|
134
136
|
${GITHUB_SESSION_FOOTER_END}`;
|
|
135
137
|
}
|
|
136
|
-
function appendGitHubFooter(body, conversationId) {
|
|
137
|
-
const footer = githubConversationFooter(conversationId);
|
|
138
|
+
function appendGitHubFooter(body, conversationId, dashboardUrl) {
|
|
139
|
+
const footer = githubConversationFooter(conversationId, dashboardUrl);
|
|
138
140
|
const normalizedBody = body.trimEnd();
|
|
139
141
|
const existingFooter = new RegExp(
|
|
140
142
|
`${escapeRegExp(GITHUB_SESSION_FOOTER_START)}[\\s\\S]*?${escapeRegExp(GITHUB_SESSION_FOOTER_END)}`
|
|
@@ -645,7 +647,7 @@ function isDefinitiveGitHubPullRequestCreateRejection(error) {
|
|
|
645
647
|
}
|
|
646
648
|
return [400, 401, 404, 410, 422].includes(error.status);
|
|
647
649
|
}
|
|
648
|
-
function createGitHubPullRequestRequest(conversationId, input, actor) {
|
|
650
|
+
function createGitHubPullRequestRequest(conversationId, input, actor, dashboardUrl) {
|
|
649
651
|
const repo = parseRepo2(input.repo);
|
|
650
652
|
const payload = {
|
|
651
653
|
title: nonEmptyString3(input.title, "title"),
|
|
@@ -653,7 +655,8 @@ function createGitHubPullRequestRequest(conversationId, input, actor) {
|
|
|
653
655
|
base: nonEmptyString3(input.base, "base"),
|
|
654
656
|
body: appendGitHubFooter(
|
|
655
657
|
appendGitHubRequesterAttribution(input.body ?? "", actor),
|
|
656
|
-
conversationId
|
|
658
|
+
conversationId,
|
|
659
|
+
dashboardUrl
|
|
657
660
|
),
|
|
658
661
|
...input.draft !== void 0 ? { draft: input.draft } : {}
|
|
659
662
|
};
|
|
@@ -788,7 +791,8 @@ function createGitHubPullRequestTool(ctx) {
|
|
|
788
791
|
const request = createGitHubPullRequestRequest(
|
|
789
792
|
conversationId,
|
|
790
793
|
parsedInput,
|
|
791
|
-
ctx.actor
|
|
794
|
+
ctx.actor,
|
|
795
|
+
ctx.slack?.conversationLink?.url
|
|
792
796
|
);
|
|
793
797
|
const pendingState = {
|
|
794
798
|
status: "pending",
|
package/dist/tools/footer.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export declare const GITHUB_SESSION_FOOTER_START = "<!-- junior-session-footer:start -->";
|
|
2
2
|
export declare const GITHUB_SESSION_FOOTER_END = "<!-- junior-session-footer:end -->";
|
|
3
3
|
export declare function sentryConversationUrl(conversationId: string): string | undefined;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
* Returns undefined when Sentry DSN/org are not configured.
|
|
7
|
-
*/
|
|
8
|
-
export declare function githubConversationFooter(conversationId: string): string | undefined;
|
|
4
|
+
/** Build the Junior session footer, preferring a host-provided dashboard link. */
|
|
5
|
+
export declare function githubConversationFooter(conversationId: string, dashboardUrl?: string): string | undefined;
|
|
9
6
|
/**
|
|
10
7
|
* Append (or replace an existing) Junior session footer to a GitHub body string.
|
|
11
|
-
*
|
|
8
|
+
* Without a dashboard or Sentry link, returns the body unchanged (existing footer stripped).
|
|
12
9
|
*/
|
|
13
|
-
export declare function appendGitHubFooter(body: string, conversationId: string): string;
|
|
10
|
+
export declare function appendGitHubFooter(body: string, conversationId: string, dashboardUrl?: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.103.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@sinclair/typebox": "^0.34.49",
|
|
27
27
|
"zod": "^4.4.3",
|
|
28
|
-
"@sentry/junior-plugin-api": "0.
|
|
28
|
+
"@sentry/junior-plugin-api": "0.103.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^25.9.1",
|