@sentry/junior-github 0.302.0 → 0.303.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/events-CrbJHQ0w.js +2466 -0
- package/dist/index.d.ts +71 -3
- package/dist/index.js +7185 -8133
- package/dist/testing.d.ts +51 -1
- package/dist/testing.js +1 -6
- package/package.json +10 -13
- package/dist/account-links.d.ts +0 -8
- package/dist/annotations.d.ts +0 -33
- package/dist/chunk-6SOJ5TN6.js +0 -2618
- package/dist/clone-command.d.ts +0 -7
- package/dist/configured-repository.d.ts +0 -10
- package/dist/conversation-title-context.d.ts +0 -20
- package/dist/credential-support.d.ts +0 -107
- package/dist/db/database.d.ts +0 -5
- package/dist/db/schema.d.ts +0 -1412
- package/dist/default-branch.d.ts +0 -15
- package/dist/draft-readiness.d.ts +0 -31
- package/dist/egress-policy.d.ts +0 -25
- package/dist/events/comment.d.ts +0 -14
- package/dist/events/declarations.d.ts +0 -18
- package/dist/events/deployment.d.ts +0 -38
- package/dist/events/issue.d.ts +0 -42
- package/dist/events/pull-request.d.ts +0 -75
- package/dist/events/release.d.ts +0 -42
- package/dist/events/repository.d.ts +0 -23
- package/dist/events/resource-url.d.ts +0 -5
- package/dist/events/scope.d.ts +0 -13
- package/dist/git-config.d.ts +0 -52
- package/dist/github-status.d.ts +0 -16
- package/dist/graphql-documents.d.ts +0 -44
- package/dist/hooks-path-command.d.ts +0 -5
- package/dist/images.d.ts +0 -8
- package/dist/issue-outcomes/store.d.ts +0 -42
- package/dist/merge-conflict-checks/heartbeat.d.ts +0 -31
- package/dist/merge-conflict-checks/policy.d.ts +0 -74
- package/dist/merge-conflict-checks/store.d.ts +0 -44
- package/dist/merge-conflict-checks/webhooks.d.ts +0 -23
- package/dist/object-facts.d.ts +0 -29
- package/dist/permissions.d.ts +0 -6
- package/dist/plugin.d.ts +0 -45
- package/dist/pull-request-outcomes/apply.d.ts +0 -22
- package/dist/pull-request-outcomes/commit-composition.d.ts +0 -6
- package/dist/pull-request-outcomes/reconcile.d.ts +0 -42
- package/dist/pull-request-outcomes/store.d.ts +0 -120
- package/dist/pull-request-requesters/draft-reviewers.d.ts +0 -15
- package/dist/pull-request-requesters/store.d.ts +0 -41
- package/dist/pull-request-review-policy.d.ts +0 -6
- package/dist/receive-pack-policy.d.ts +0 -21
- package/dist/reply-markdown.d.ts +0 -18
- package/dist/sandbox-paths.d.ts +0 -4
- package/dist/tool-support/attribution.d.ts +0 -52
- package/dist/tool-support/github-api.d.ts +0 -51
- package/dist/tool-support/github-text.d.ts +0 -8
- package/dist/tool-support/pull-request-description.d.ts +0 -8
- package/dist/tools/clone-repository.d.ts +0 -287
- package/dist/tools/comment-on-issue.d.ts +0 -289
- package/dist/tools/comment-on-pull-request.d.ts +0 -294
- package/dist/tools/create-issue.d.ts +0 -300
- package/dist/tools/create-pull-request.d.ts +0 -322
- package/dist/tools/footer.d.ts +0 -17
- package/dist/tools/get-deployment.d.ts +0 -346
- package/dist/tools/get-issue.d.ts +0 -330
- package/dist/tools/get-pull-request.d.ts +0 -358
- package/dist/tools/get-release.d.ts +0 -325
- package/dist/tools/get-repository.d.ts +0 -308
- package/dist/tools/get-status.d.ts +0 -295
- package/dist/tools/react-to-issue.d.ts +0 -289
- package/dist/tools/resolve-pull-request-review-thread.d.ts +0 -288
- package/dist/tools/stack-pull-request.d.ts +0 -43
- package/dist/tools/submit-pull-request-review.d.ts +0 -300
- package/dist/tools/update-issue-comment.d.ts +0 -290
- package/dist/tools/update-issue.d.ts +0 -331
- package/dist/tools/update-pull-request-feedback.d.ts +0 -324
- package/dist/tools/update-pull-request.d.ts +0 -338
- package/dist/tools.d.ts +0 -13
- package/dist/webhooks/check-suite.d.ts +0 -121
- package/dist/webhooks/event-targets.d.ts +0 -44
- package/dist/webhooks/events.d.ts +0 -23
- package/dist/webhooks/fail-open-log.d.ts +0 -10
- package/dist/webhooks/handler.d.ts +0 -57
- package/dist/webhooks/installation-requests.d.ts +0 -105
- package/dist/webhooks/issue-outcome.d.ts +0 -11
- package/dist/webhooks/issue-update.d.ts +0 -8
- package/dist/webhooks/merge-conflict.d.ts +0 -53
- package/dist/webhooks/ownership.d.ts +0 -14
- package/dist/webhooks/pull-request-action.d.ts +0 -37
- package/dist/webhooks/pull-request-activity.d.ts +0 -11
- package/dist/webhooks/pull-request-match-data.d.ts +0 -31
- package/dist/webhooks/pull-request-outcome.d.ts +0 -16
- package/dist/webhooks/pull-request-people.d.ts +0 -51
- package/dist/webhooks/pull-request-preview.d.ts +0 -12
- package/dist/webhooks/pull-request-ready-reviewers.d.ts +0 -25
- package/dist/workspace-prepare.d.ts +0 -3
package/dist/default-branch.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default branch lookup for the Git push policy.
|
|
3
|
-
*
|
|
4
|
-
* The egress grant hook decides whether a push may leave the sandbox, so it
|
|
5
|
-
* cannot read GitHub through host egress. This file calls GitHub directly,
|
|
6
|
-
* with a metadata-only installation token.
|
|
7
|
-
*/
|
|
8
|
-
import type { PluginCache } from "@sentry/junior-plugin-api";
|
|
9
|
-
import { type GitHubRepository } from "./credential-support.js";
|
|
10
|
-
import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
|
|
11
|
-
/**
|
|
12
|
-
* Read a repository's default branch with a metadata-only installation
|
|
13
|
-
* token. Results are cached for ten minutes.
|
|
14
|
-
*/
|
|
15
|
-
export declare function loadDefaultBranch(env: GitHubInstallationEnv, cache: PluginCache, repository: GitHubRepository): Promise<string>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a draft needs before Junior marks it ready: the code owners that
|
|
3
|
-
* GitHub asks to review, and the repository's AGENTS.md, which can ask that
|
|
4
|
-
* pull requests stay drafts for a person to mark ready.
|
|
5
|
-
*
|
|
6
|
-
* GitHub reads the first CODEOWNERS file of the base branch, in `.github/`,
|
|
7
|
-
* the repository root, or `docs/`. For each changed file the last matching
|
|
8
|
-
* rule wins, and a matching rule with no owners leaves the file without
|
|
9
|
-
* owners. GitHub asks the owners to review when the pull request is ready for
|
|
10
|
-
* review, so a draft has not asked them yet.
|
|
11
|
-
*
|
|
12
|
-
* CODEOWNERS uses gitignore patterns, which the `ignore` package matches.
|
|
13
|
-
* One difference: GitHub matches `docs/*` only to files directly in `docs/`,
|
|
14
|
-
* and gitignore also matches the files below. That error finds too many
|
|
15
|
-
* owners, never too few, so Junior does not ping owners it did not expect.
|
|
16
|
-
*/
|
|
17
|
-
import type { PluginEgress } from "@sentry/junior-plugin-api";
|
|
18
|
-
/**
|
|
19
|
-
* Read the code owners of the files that one draft changes and the root
|
|
20
|
-
* AGENTS.md, both from its base branch.
|
|
21
|
-
*/
|
|
22
|
-
export declare function readDraftReadiness(egress: PluginEgress, repo: {
|
|
23
|
-
name: string;
|
|
24
|
-
owner: string;
|
|
25
|
-
}, pullRequest: {
|
|
26
|
-
base: string;
|
|
27
|
-
number: number;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
agentsMd?: string;
|
|
30
|
-
codeOwners: string[];
|
|
31
|
-
}>;
|
package/dist/egress-policy.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub egress policy and grant selection.
|
|
3
|
-
*
|
|
4
|
-
* Owns which GitHub requests Junior may make and which credential grant
|
|
5
|
-
* each request needs. Junior-owned issue, pull request, review, and push
|
|
6
|
-
* writes never fall back to user OAuth. Merge, fork, branch deletion, REST ref
|
|
7
|
-
* writes, and administration stay unsupported; unknown REST writes and
|
|
8
|
-
* GraphQL mutations are denied. Git pushes never touch the default branch.
|
|
9
|
-
*/
|
|
10
|
-
import { type EgressHookContext, type EgressResponseHookContext } from "@sentry/junior-plugin-api";
|
|
11
|
-
import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
|
|
12
|
-
import { type GitHubGrant } from "./credential-support.js";
|
|
13
|
-
/**
|
|
14
|
-
* Classify a GitHub response as a permission denial.
|
|
15
|
-
*
|
|
16
|
-
* Returns a message only when GitHub says that the credential lacks access.
|
|
17
|
-
* Other GitHub refusals return undefined, so the runtime does not call them
|
|
18
|
-
* permission problems.
|
|
19
|
-
*/
|
|
20
|
-
export declare function githubPermissionDeniedMessage(ctx: EgressResponseHookContext): Promise<string | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Select the GitHub grant for one egress request, and name its repository
|
|
23
|
-
* for the write audit event.
|
|
24
|
-
*/
|
|
25
|
-
export declare function githubGrantForEgress(ctx: EgressHookContext, env: GitHubInstallationEnv): Promise<GitHubGrant>;
|
package/dist/events/comment.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type EventMatchFields } from "@sentry/junior-plugin-api";
|
|
2
|
-
/**
|
|
3
|
-
* Filters on the GitHub user who sent the webhook: who wrote a comment or
|
|
4
|
-
* review, or who made an issue update. Resource types that merge these maps
|
|
5
|
-
* keep one description, so it names every case.
|
|
6
|
-
*/
|
|
7
|
-
export declare function gitHubSenderMatchFields(events: readonly string[]): EventMatchFields;
|
|
8
|
-
/**
|
|
9
|
-
* Filters on a GitHub comment or review: who wrote it and whether it mentions
|
|
10
|
-
* the App. Issue comments, pull request comments, reviews, and inline review
|
|
11
|
-
* comments set them, so the issue, pull request, and repository resource types
|
|
12
|
-
* share one definition.
|
|
13
|
-
*/
|
|
14
|
-
export declare function gitHubCommentMatchFields(events: readonly string[]): EventMatchFields;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { PluginEventDeclaration } from "@sentry/junior-plugin-api";
|
|
2
|
-
import { type GitHubPullRequestEvent } from "./pull-request.js";
|
|
3
|
-
/**
|
|
4
|
-
* Declare the reach and guidance of every GitHub event.
|
|
5
|
-
*
|
|
6
|
-
* - Deployment events reach every repository. They carry status facts,
|
|
7
|
-
* Junior adds no reaction, and they load nothing from GitHub.
|
|
8
|
-
* - Release, issue, and pull request events need a `repo` filter. They carry
|
|
9
|
-
* release notes, titles, bodies, comments, or reviews from repositories
|
|
10
|
-
* that can be private, and comments and reviews make Junior add a
|
|
11
|
-
* reaction. The filter limits how many repositories a trigger covers. It
|
|
12
|
-
* does not check that the person can see the repository.
|
|
13
|
-
*
|
|
14
|
-
* Pull request filters such as `authors` and `openerRole` load data from
|
|
15
|
-
* GitHub. Core skips a trigger with no identifier when its `repo` filter does
|
|
16
|
-
* not match the event, so it loads nothing for other repositories.
|
|
17
|
-
*/
|
|
18
|
-
export declare function gitHubEventDeclarations(pullRequestGuidance: Partial<Record<GitHubPullRequestEvent, string>>): Record<string, PluginEventDeclaration>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
-
export declare const GITHUB_DEPLOYMENT_EVENTS: readonly ["deployment.created", "deployment.queued", "deployment.pending", "deployment.in_progress", "deployment.succeeded", "deployment.failed", "deployment.error"];
|
|
3
|
-
export declare const GITHUB_DEPLOYMENT_SUGGESTED_EVENTS: string[];
|
|
4
|
-
/**
|
|
5
|
-
* Trusted deployment values that watches and event automations can match.
|
|
6
|
-
* Every deployment event sets them; the repository resource type also has
|
|
7
|
-
* events that do not.
|
|
8
|
-
*/
|
|
9
|
-
export declare const GITHUB_DEPLOYMENT_MATCH_FIELDS: Record<string, {
|
|
10
|
-
kind: "boolean" | "number" | "string";
|
|
11
|
-
description: string;
|
|
12
|
-
enum?: string[] | undefined;
|
|
13
|
-
list?: true | undefined;
|
|
14
|
-
case?: "lower" | "upper" | undefined;
|
|
15
|
-
events?: string[] | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
/** The identifier shape that `gitHubDeploymentSourceResource` builds. */
|
|
18
|
-
export declare const GITHUB_DEPLOYMENT_SOURCE_IDENTIFIER: {
|
|
19
|
-
format: string;
|
|
20
|
-
pattern: string;
|
|
21
|
-
};
|
|
22
|
-
/** Build the stable deployment-source identity shared by tools and webhooks. */
|
|
23
|
-
export declare function gitHubDeploymentSourceResource(input: {
|
|
24
|
-
commitSha: string;
|
|
25
|
-
environment?: string;
|
|
26
|
-
repo: string;
|
|
27
|
-
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
28
|
-
/**
|
|
29
|
-
* Describe a deployment source that a conversation can watch.
|
|
30
|
-
* Return undefined when the host cannot create Watches.
|
|
31
|
-
*/
|
|
32
|
-
export declare function gitHubDeploymentSourceSubscribable(input: {
|
|
33
|
-
/** `ctx.events.canSubscribe` from the tool context. */
|
|
34
|
-
canSubscribe: boolean;
|
|
35
|
-
commitSha: string;
|
|
36
|
-
environment?: string;
|
|
37
|
-
repo: string;
|
|
38
|
-
}): SubscribableResource | undefined;
|
package/dist/events/issue.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
-
export declare const GITHUB_ISSUE_EVENTS: string[];
|
|
3
|
-
export declare const GITHUB_ISSUE_SUGGESTED_EVENTS: string[];
|
|
4
|
-
/**
|
|
5
|
-
* The `issues` webhook actions that `issue.updated` publishes. The webhook
|
|
6
|
-
* schema and the `change` match field both use this list.
|
|
7
|
-
*/
|
|
8
|
-
export declare const GITHUB_ISSUE_UPDATE_CHANGES: readonly ["edited", "labeled", "unlabeled", "assigned", "unassigned", "milestoned", "demilestoned"];
|
|
9
|
-
/**
|
|
10
|
-
* Exact values GitHub sets on issue event data. Every issue event sets the
|
|
11
|
-
* repository and issue number. Comments and updates set who acted. Only
|
|
12
|
-
* updates set `change` and `label`, so an automation can run on one label
|
|
13
|
-
* that one person adds without the model deciding from untrusted text.
|
|
14
|
-
*/
|
|
15
|
-
export declare const GITHUB_ISSUE_MATCH_FIELDS: Record<string, {
|
|
16
|
-
kind: "boolean" | "number" | "string";
|
|
17
|
-
description: string;
|
|
18
|
-
enum?: string[] | undefined;
|
|
19
|
-
list?: true | undefined;
|
|
20
|
-
case?: "lower" | "upper" | undefined;
|
|
21
|
-
events?: string[] | undefined;
|
|
22
|
-
}>;
|
|
23
|
-
/** The identifier shape that `gitHubIssueResource` builds. */
|
|
24
|
-
export declare const GITHUB_ISSUE_IDENTIFIER: {
|
|
25
|
-
format: string;
|
|
26
|
-
pattern: string;
|
|
27
|
-
};
|
|
28
|
-
/** Build the stable issue identity shared by tools and webhooks. */
|
|
29
|
-
export declare function gitHubIssueResource(input: {
|
|
30
|
-
number: number;
|
|
31
|
-
repo: string;
|
|
32
|
-
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
33
|
-
/**
|
|
34
|
-
* Describe an issue as a resource that a conversation can watch.
|
|
35
|
-
* Return undefined when the host cannot create Watches.
|
|
36
|
-
*/
|
|
37
|
-
export declare function gitHubIssueSubscribable(input: {
|
|
38
|
-
/** `ctx.events.canSubscribe` from the tool context. */
|
|
39
|
-
canSubscribe: boolean;
|
|
40
|
-
number: number;
|
|
41
|
-
repo: string;
|
|
42
|
-
}): SubscribableResource | undefined;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
-
export declare const GITHUB_PULL_REQUEST_EVENTS: readonly ["pull_request.checks.failed", "pull_request.checks.passed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
3
|
-
export type GitHubPullRequestEvent = (typeof GITHUB_PULL_REQUEST_EVENTS)[number];
|
|
4
|
-
/** Combine provider defaults with app guidance for pull request events. */
|
|
5
|
-
export declare function gitHubPullRequestEventGuidance(guidance?: Partial<Record<GitHubPullRequestEvent, string>>): Partial<Record<GitHubPullRequestEvent, string>>;
|
|
6
|
-
/** App-configured pull request event behavior. */
|
|
7
|
-
export interface GitHubPullRequestEventOptions {
|
|
8
|
-
/** App guidance applied within the matching subscription or event automation instruction. */
|
|
9
|
-
guidance?: Partial<Record<GitHubPullRequestEvent, string>>;
|
|
10
|
-
/**
|
|
11
|
-
* Temporary subscription created after Junior creates a pull request.
|
|
12
|
-
* Defaults to the maintenance Watch below. `false` turns it off.
|
|
13
|
-
*/
|
|
14
|
-
subscribeAfterCreate?: GitHubPullRequestSubscriptionConfig | false;
|
|
15
|
-
}
|
|
16
|
-
/** Temporary subscription created after Junior creates a pull request. */
|
|
17
|
-
export interface GitHubPullRequestSubscriptionConfig {
|
|
18
|
-
events: GitHubPullRequestEvent[];
|
|
19
|
-
intent: string;
|
|
20
|
-
}
|
|
21
|
-
/** Resolve the Watch to create after Junior creates a pull request, if any. */
|
|
22
|
-
export declare function gitHubPullRequestSubscription(config: GitHubPullRequestSubscriptionConfig | false | undefined): GitHubPullRequestSubscriptionConfig | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Build the Watch created after Junior creates a pull request. Only a draft
|
|
25
|
-
* Watch gets passing checks, so a ready pull request is not woken by each
|
|
26
|
-
* passing check suite.
|
|
27
|
-
*/
|
|
28
|
-
export declare function gitHubPullRequestCreateWatch(config: GitHubPullRequestSubscriptionConfig, pullRequest: {
|
|
29
|
-
draft: boolean;
|
|
30
|
-
}): {
|
|
31
|
-
events: GitHubPullRequestEvent[];
|
|
32
|
-
guidance: Partial<Record<GitHubPullRequestEvent, string>>;
|
|
33
|
-
intent: string;
|
|
34
|
-
};
|
|
35
|
-
export declare const GITHUB_PULL_REQUEST_SUGGESTED_EVENTS: readonly ["pull_request.checks.failed", "pull_request.comment.created", "pull_request.ready_for_review", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
36
|
-
/**
|
|
37
|
-
* Exact values GitHub may set on pull request event data. Missing keys do not
|
|
38
|
-
* match. The opener and author values load in
|
|
39
|
-
* `webhooks/pull-request-match-data.ts` for every payload pull request event.
|
|
40
|
-
* The pull request comment webhook has no head branch. A check suite result
|
|
41
|
-
* that GitHub links to no pull request has no `pullRequest`. The webhook
|
|
42
|
-
* checks for a Watch or event automation before it reads a pull request for
|
|
43
|
-
* a conflict, so `pull_request.merge_conflict` matches only `repo` and
|
|
44
|
-
* `pullRequest`.
|
|
45
|
-
*/
|
|
46
|
-
export declare const GITHUB_PULL_REQUEST_MATCH_FIELDS: Record<string, {
|
|
47
|
-
kind: "boolean" | "number" | "string";
|
|
48
|
-
description: string;
|
|
49
|
-
enum?: string[] | undefined;
|
|
50
|
-
list?: true | undefined;
|
|
51
|
-
case?: "lower" | "upper" | undefined;
|
|
52
|
-
events?: string[] | undefined;
|
|
53
|
-
}>;
|
|
54
|
-
/** The identifier shape that `gitHubPullRequestResource` builds. */
|
|
55
|
-
export declare const GITHUB_PULL_REQUEST_IDENTIFIER: {
|
|
56
|
-
format: string;
|
|
57
|
-
pattern: string;
|
|
58
|
-
};
|
|
59
|
-
/** Build the stable pull request identity shared by tools and webhooks. */
|
|
60
|
-
export declare function gitHubPullRequestResource(input: {
|
|
61
|
-
number: number;
|
|
62
|
-
repo: string;
|
|
63
|
-
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
64
|
-
/**
|
|
65
|
-
* Describe a pull request as a resource that a conversation can watch.
|
|
66
|
-
* Return undefined when the host cannot create Watches.
|
|
67
|
-
*/
|
|
68
|
-
export declare function gitHubPullRequestSubscribable(input: {
|
|
69
|
-
/** `ctx.events.canSubscribe` from the tool context. */
|
|
70
|
-
canSubscribe: boolean;
|
|
71
|
-
number: number;
|
|
72
|
-
repo: string;
|
|
73
|
-
/** Events already covered by a forced subscription; omit them from suggestions. */
|
|
74
|
-
omitSuggestedEvents?: readonly string[];
|
|
75
|
-
}): SubscribableResource | undefined;
|
package/dist/events/release.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
-
import * as z from "zod";
|
|
3
|
-
export declare const GITHUB_RELEASE_EVENTS: readonly ["release.published"];
|
|
4
|
-
/**
|
|
5
|
-
* `tag` in event data: the trimmed tag with ASCII letters in lowercase. The
|
|
6
|
-
* release-source identifier has the URI-encoded tag, and the plugin
|
|
7
|
-
* lowercases identifiers. Encoding turns other characters into `%XX`
|
|
8
|
-
* escapes, so only ASCII letters change case there. This form is the same
|
|
9
|
-
* text, so `release/1.0` is not `release%2f1.0`, and `Ü` stays `Ü`. To turn
|
|
10
|
-
* an identifier into a `tag` filter, decode its tag part.
|
|
11
|
-
*/
|
|
12
|
-
export declare const gitHubReleaseTagDataSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
13
|
-
/** Exact values that every release event sets. */
|
|
14
|
-
export declare const GITHUB_RELEASE_MATCH_FIELDS: Record<string, {
|
|
15
|
-
kind: "boolean" | "number" | "string";
|
|
16
|
-
description: string;
|
|
17
|
-
enum?: string[] | undefined;
|
|
18
|
-
list?: true | undefined;
|
|
19
|
-
case?: "lower" | "upper" | undefined;
|
|
20
|
-
events?: string[] | undefined;
|
|
21
|
-
}>;
|
|
22
|
-
export declare const GITHUB_RELEASE_SUGGESTED_EVENTS: string[];
|
|
23
|
-
/** The identifier shape that `gitHubReleaseSourceResource` builds. */
|
|
24
|
-
export declare const GITHUB_RELEASE_SOURCE_IDENTIFIER: {
|
|
25
|
-
format: string;
|
|
26
|
-
pattern: string;
|
|
27
|
-
};
|
|
28
|
-
/** Build the stable release-source identity shared by tools and webhooks. */
|
|
29
|
-
export declare function gitHubReleaseSourceResource(input: {
|
|
30
|
-
repo: string;
|
|
31
|
-
tag?: string;
|
|
32
|
-
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
33
|
-
/**
|
|
34
|
-
* Describe a release source that a conversation can watch.
|
|
35
|
-
* Return undefined when the host cannot create Watches.
|
|
36
|
-
*/
|
|
37
|
-
export declare function gitHubReleaseSourceSubscribable(input: {
|
|
38
|
-
/** `ctx.events.canSubscribe` from the tool context. */
|
|
39
|
-
canSubscribe: boolean;
|
|
40
|
-
repo: string;
|
|
41
|
-
tag?: string;
|
|
42
|
-
}): SubscribableResource | undefined;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
-
/** The identifier shape that `gitHubRepositoryResource` builds. */
|
|
3
|
-
export declare const GITHUB_REPOSITORY_IDENTIFIER: {
|
|
4
|
-
format: string;
|
|
5
|
-
pattern: string;
|
|
6
|
-
};
|
|
7
|
-
/** Build the stable repository identity shared by tools and webhooks. */
|
|
8
|
-
export declare function gitHubRepositoryResource(input: {
|
|
9
|
-
repo: string;
|
|
10
|
-
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
11
|
-
/** Events that a repository Watch gets: deployments, issues, and pull requests. */
|
|
12
|
-
export declare const GITHUB_REPOSITORY_EVENTS: readonly ["deployment.created", "deployment.queued", "deployment.pending", "deployment.in_progress", "deployment.succeeded", "deployment.failed", "deployment.error", ...string[], "pull_request.checks.failed", "pull_request.checks.passed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
13
|
-
/** Repository events to suggest when a conversation starts a Watch. */
|
|
14
|
-
export declare const GITHUB_REPOSITORY_SUGGESTED_EVENTS: readonly ["issue.opened", "pull_request.opened", ...string[], "pull_request.checks.failed", "pull_request.comment.created", "pull_request.ready_for_review", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
|
|
15
|
-
/**
|
|
16
|
-
* Describe a repository as a resource that a conversation can watch.
|
|
17
|
-
* Return undefined when the host cannot create Watches.
|
|
18
|
-
*/
|
|
19
|
-
export declare function gitHubRepositorySubscribable(input: {
|
|
20
|
-
/** `ctx.events.canSubscribe` from the tool context. */
|
|
21
|
-
canSubscribe: boolean;
|
|
22
|
-
repo: string;
|
|
23
|
-
}): SubscribableResource | undefined;
|
package/dist/events/scope.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type EventMatchFields } from "@sentry/junior-plugin-api";
|
|
2
|
-
import * as z from "zod";
|
|
3
|
-
/**
|
|
4
|
-
* `repo` in event data: lowercase `owner/repo`. GitHub ignores case in
|
|
5
|
-
* repository names, so tools accept this form.
|
|
6
|
-
*/
|
|
7
|
-
export declare const gitHubRepoDataSchema: z.ZodString;
|
|
8
|
-
/** `commitSha` in event data: the full lowercase commit SHA. */
|
|
9
|
-
export declare const gitHubCommitShaDataSchema: z.ZodString;
|
|
10
|
-
/** Filter on the repository of an event. */
|
|
11
|
-
export declare function gitHubRepoMatchFields(events: readonly string[]): EventMatchFields;
|
|
12
|
-
/** Filter on the commit of an event. */
|
|
13
|
-
export declare function gitHubCommitMatchFields(events: readonly string[]): EventMatchFields;
|
package/dist/git-config.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Git identity and commit-hook setup for GitHub sandboxes.
|
|
3
|
-
*/
|
|
4
|
-
import type { Actor, PluginEnv, SandboxPrepareHookContext, User } from "@sentry/junior-plugin-api";
|
|
5
|
-
/**
|
|
6
|
-
* Build `Co-Authored-By` trailers crediting human run actors.
|
|
7
|
-
*
|
|
8
|
-
* `run.actors` is attribution only (see `multi-actor-runs.md`): a steerer
|
|
9
|
-
* without a resolvable name and email is silently omitted rather than
|
|
10
|
-
* denying the commit. Dedupes by identity and resolved email so the same human
|
|
11
|
-
* under two display profiles, or an actor matching the bot identity, only ever
|
|
12
|
-
* produces one line.
|
|
13
|
-
*
|
|
14
|
-
* When the current actor has a linked GitHub identity, prefer that noreply
|
|
15
|
-
* address so external automation can resolve a login for assignment.
|
|
16
|
-
*/
|
|
17
|
-
export declare function additionalActorCoauthorTrailers(args: {
|
|
18
|
-
actors?: Actor[];
|
|
19
|
-
botEmail: string;
|
|
20
|
-
/** Linked user for the current run actor, when already resolved. */
|
|
21
|
-
currentUser?: User;
|
|
22
|
-
}): string[];
|
|
23
|
-
/**
|
|
24
|
-
* Client hooks that Junior's hooks directory passes to the repository.
|
|
25
|
-
*
|
|
26
|
-
* Junior's `core.hooksPath` replaces the repository hooks directory: the
|
|
27
|
-
* repository's own `core.hooksPath` (husky) or `.git/hooks` (simple-git-hooks,
|
|
28
|
-
* Git LFS). Git would skip those hooks without these pass-through hooks.
|
|
29
|
-
* `prepare-commit-msg` is not in the list because Junior's own hook runs the
|
|
30
|
-
* repository hook first.
|
|
31
|
-
*/
|
|
32
|
-
export declare const REPOSITORY_HOOK_NAMES: readonly ["applypatch-msg", "pre-applypatch", "post-applypatch", "pre-commit", "pre-merge-commit", "commit-msg", "post-commit", "pre-rebase", "post-checkout", "post-merge", "pre-push", "post-rewrite", "pre-auto-gc"];
|
|
33
|
-
/** Directory for Junior's Git hooks under the sandbox Junior root. */
|
|
34
|
-
export declare function gitHooksPath(juniorRoot: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Point Git at Junior's hooks for one command.
|
|
37
|
-
*
|
|
38
|
-
* Command env config has a higher priority than every config file, so it
|
|
39
|
-
* also wins over a repository `core.hooksPath` such as husky's.
|
|
40
|
-
*/
|
|
41
|
-
export declare function setGitHooksPathEnv(env: PluginEnv, hooksPath: string): void;
|
|
42
|
-
/** Build a hook that runs the repository's own hook with the same name. */
|
|
43
|
-
export declare function repositoryHook(name: string): string;
|
|
44
|
-
/** Build the hook that replaces model-supplied commit attribution. */
|
|
45
|
-
export declare function prepareCommitMsgHook(): string;
|
|
46
|
-
/**
|
|
47
|
-
* Write Junior's Git hooks and global Git config inside the sandbox.
|
|
48
|
-
*
|
|
49
|
-
* This runs on every sandbox acquire, and each sandbox call is one provider
|
|
50
|
-
* round trip, so all of the setup is one command.
|
|
51
|
-
*/
|
|
52
|
-
export declare function prepareSandboxGit(ctx: SandboxPrepareHookContext): Promise<void>;
|
package/dist/github-status.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PluginCache } from "@sentry/junior-plugin-api";
|
|
2
|
-
/** One incident from githubstatus.com. */
|
|
3
|
-
export type GitHubStatusIncident = {
|
|
4
|
-
components: string[];
|
|
5
|
-
impact: string;
|
|
6
|
-
name: string;
|
|
7
|
-
resolvedAt?: string;
|
|
8
|
-
startedAt: string;
|
|
9
|
-
status: string;
|
|
10
|
-
url: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Read GitHub incidents that are open, or that were resolved within
|
|
14
|
-
* `withinMs`. Callers share one cached read of githubstatus.com.
|
|
15
|
-
*/
|
|
16
|
-
export declare function loadGitHubStatusIncidents(cache: PluginCache, withinMs: number): Promise<GitHubStatusIncident[]>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** The `operationName` and `query` of one GraphQL request body. */
|
|
2
|
-
export interface GitHubGraphqlOperation {
|
|
3
|
-
operationName: string;
|
|
4
|
-
query: string;
|
|
5
|
-
}
|
|
6
|
-
/** Add one reaction to a review body. */
|
|
7
|
-
export declare const ADD_REVIEW_REACTION: GitHubGraphqlOperation;
|
|
8
|
-
/** Remove one reaction from a review body. */
|
|
9
|
-
export declare const REMOVE_REVIEW_REACTION: GitHubGraphqlOperation;
|
|
10
|
-
/** Read the reactions of a review body, with the bots that added them. */
|
|
11
|
-
export declare const REVIEW_REACTIONS: GitHubGraphqlOperation;
|
|
12
|
-
/** Mark a draft pull request ready for review. */
|
|
13
|
-
export declare const MARK_PULL_REQUEST_READY_FOR_REVIEW: GitHubGraphqlOperation;
|
|
14
|
-
/** Convert a pull request to a draft. */
|
|
15
|
-
export declare const CONVERT_PULL_REQUEST_TO_DRAFT: GitHubGraphqlOperation;
|
|
16
|
-
/** Read a review thread with the pull request that owns it. */
|
|
17
|
-
export declare const REVIEW_THREAD_OWNERSHIP: GitHubGraphqlOperation;
|
|
18
|
-
/** Resolve a review thread. */
|
|
19
|
-
export declare const RESOLVE_REVIEW_THREAD: GitHubGraphqlOperation;
|
|
20
|
-
/**
|
|
21
|
-
* Read the merge state of one pull request and the checks of its head
|
|
22
|
-
* commit, with whether each check is required.
|
|
23
|
-
*/
|
|
24
|
-
export declare const PULL_REQUEST_CHECKS: GitHubGraphqlOperation;
|
|
25
|
-
/**
|
|
26
|
-
* Read the CODEOWNERS files and the root AGENTS.md of a base branch, and one
|
|
27
|
-
* page of the files that a pull request changes. Each `*Expression` is
|
|
28
|
-
* `<base>:<path>`.
|
|
29
|
-
*/
|
|
30
|
-
export declare const PULL_REQUEST_DRAFT_READINESS: GitHubGraphqlOperation;
|
|
31
|
-
/** Read one page of a pull request search, with mergeability. */
|
|
32
|
-
export declare const OPEN_PULL_REQUEST_MERGEABILITY: GitHubGraphqlOperation;
|
|
33
|
-
/**
|
|
34
|
-
* Read what decides a merge conflict fix on one pull request: the review
|
|
35
|
-
* decision, when it opened, and its latest pushes, reviews, and comments.
|
|
36
|
-
* Pushes have their own window, so comments, which anyone can add, cannot
|
|
37
|
-
* push Junior's earlier fixes out of it.
|
|
38
|
-
*/
|
|
39
|
-
export declare const PULL_REQUEST_CONFLICT_HISTORY: GitHubGraphqlOperation;
|
|
40
|
-
/**
|
|
41
|
-
* Return the query that reads the lifecycle of `count` pull requests of one
|
|
42
|
-
* repository. Pull request `i` has the alias `pr<i>` and the variable `$n<i>`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function pullRequestLifecycles(count: number): GitHubGraphqlOperation;
|
package/dist/images.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Description images of GitHub objects, served through the Junior image
|
|
3
|
-
* route. Each read checks that the viewer's linked GitHub account can see
|
|
4
|
-
* the repository. Only then does Junior fetch the image with the App.
|
|
5
|
-
*/
|
|
6
|
-
import { type PluginImageSource } from "@sentry/junior-plugin-api";
|
|
7
|
-
/** Serve the description images of GitHub objects to viewers who can see the repository. */
|
|
8
|
-
export declare const githubImageSource: PluginImageSource;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import type { GitHubDb } from "../db/database.js";
|
|
3
|
-
declare const githubIssueOutcomeInputSchema: z.ZodObject<{
|
|
4
|
-
candidateOwned: z.ZodBoolean;
|
|
5
|
-
closedAt: z.ZodOptional<z.ZodDate>;
|
|
6
|
-
issueId: z.ZodString;
|
|
7
|
-
number: z.ZodNumber;
|
|
8
|
-
openedAt: z.ZodDate;
|
|
9
|
-
repositoryFullName: z.ZodString;
|
|
10
|
-
repositoryId: z.ZodString;
|
|
11
|
-
state: z.ZodEnum<{
|
|
12
|
-
closed: "closed";
|
|
13
|
-
open: "open";
|
|
14
|
-
}>;
|
|
15
|
-
stateReason: z.ZodOptional<z.ZodEnum<{
|
|
16
|
-
completed: "completed";
|
|
17
|
-
duplicate: "duplicate";
|
|
18
|
-
not_planned: "not_planned";
|
|
19
|
-
reopened: "reopened";
|
|
20
|
-
}>>;
|
|
21
|
-
updatedAt: z.ZodDate;
|
|
22
|
-
}, z.core.$strict>;
|
|
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>;
|
|
29
|
-
/**
|
|
30
|
-
* Record the newest lifecycle projection for one Junior-owned issue.
|
|
31
|
-
* Ownership-qualified opening or closing events insert; later events update
|
|
32
|
-
* existing rows, and older provider timestamps cannot regress them.
|
|
33
|
-
* Returns the written row state so follow-up annotation updates stay scoped to
|
|
34
|
-
* associated conversations.
|
|
35
|
-
*/
|
|
36
|
-
export declare function recordGitHubIssueOutcome(db: GitHubDb, input: GitHubIssueOutcomeInput): Promise<{
|
|
37
|
-
applied: boolean;
|
|
38
|
-
conversationIds: string[];
|
|
39
|
-
}>;
|
|
40
|
-
/** Append native conversation ids to an existing Junior-owned issue projection. */
|
|
41
|
-
export declare function recordGitHubIssueConversations(db: GitHubDb, input: GitHubIssueConversationsInput): Promise<boolean>;
|
|
42
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The heartbeat part of merge conflict checks. For each due repository, a
|
|
3
|
-
* GraphQL search reads the open Junior pull requests with their
|
|
4
|
-
* mergeability. Only a conflicted Junior pull request also reads its
|
|
5
|
-
* history. Only a conflict that a Watch or event automation wants, and that
|
|
6
|
-
* `policy.ts` allows, publishes `pull_request.merge_conflict`. No agent runs
|
|
7
|
-
* for the check.
|
|
8
|
-
*/
|
|
9
|
-
import type { EventPublisher, PluginConversationReviewItems, PluginLogger, PluginState } from "@sentry/junior-plugin-api";
|
|
10
|
-
import type { GitHubDb } from "../db/database.js";
|
|
11
|
-
import { type GitHubPullRequestRef } from "../webhooks/merge-conflict.js";
|
|
12
|
-
type SearchOpenPullRequests = (input: {
|
|
13
|
-
after?: string;
|
|
14
|
-
repositoryFullName: string;
|
|
15
|
-
}) => Promise<unknown>;
|
|
16
|
-
interface CheckArgs {
|
|
17
|
-
db: GitHubDb;
|
|
18
|
-
events: EventPublisher;
|
|
19
|
-
loadHistory(ref: GitHubPullRequestRef): Promise<unknown>;
|
|
20
|
-
log: Pick<PluginLogger, "error" | "warn">;
|
|
21
|
-
now: Date;
|
|
22
|
-
reviewItems: PluginConversationReviewItems;
|
|
23
|
-
search: SearchOpenPullRequests;
|
|
24
|
-
state: PluginState;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Run the merge conflict checks that are due. Only a repository with open
|
|
28
|
-
* Junior pull requests can have a check.
|
|
29
|
-
*/
|
|
30
|
-
export declare function runGitHubConflictChecks(args: CheckArgs): Promise<void>;
|
|
31
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* When a merge conflict wakes Junior. A fix is a full agent turn, so only a
|
|
3
|
-
* Junior pull request that people still work on gets one:
|
|
4
|
-
*
|
|
5
|
-
* - A draft gets nothing.
|
|
6
|
-
* - In the first 2 days after the latest activity by a person, Junior fixes
|
|
7
|
-
* the conflict, at most once a day and 3 times in total.
|
|
8
|
-
* - After that, or after the third fix, Junior adds a review desk notice to
|
|
9
|
-
* the Conversation that asked for the pull request.
|
|
10
|
-
* - After 3 days without activity by a person, nothing.
|
|
11
|
-
* - An approved pull request would be ready to merge but for the conflict,
|
|
12
|
-
* so it gets a fix after the 2 days too, and without the daily wait. The
|
|
13
|
-
* ready to merge notice needs a clean merge state, so it waits for the
|
|
14
|
-
* fix. The total limit still holds.
|
|
15
|
-
*
|
|
16
|
-
* Junior keeps no state for this. Each conflict reads the pull request's
|
|
17
|
-
* history from GitHub. Opening the pull request counts as activity, because
|
|
18
|
-
* a person asked for it. Merges and force pushes by a bot count as fixes.
|
|
19
|
-
* The event key names the head commit, so a check of the same commit, or a
|
|
20
|
-
* webhook and the heartbeat at once, publish one fix. A conflict on a pull
|
|
21
|
-
* request that Junior did not open goes to its Watch as before, except for
|
|
22
|
-
* a draft.
|
|
23
|
-
*/
|
|
24
|
-
import type { EventInput, PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
|
|
25
|
-
import type { GitHubDb } from "../db/database.js";
|
|
26
|
-
import type { GitHubMergeConflict, GitHubPullRequestRef } from "../webhooks/merge-conflict.js";
|
|
27
|
-
/** The dedupe key of the merge conflict notice of one pull request. */
|
|
28
|
-
export declare function gitHubConflictNoticeKey(ref: GitHubPullRequestRef): string;
|
|
29
|
-
/**
|
|
30
|
-
* Return the merge conflict events to publish for one conflicted pull
|
|
31
|
-
* request that a Watch or event automation wants. A fix returns `events`.
|
|
32
|
-
* A notice goes to the review desk and returns no events. The notice is
|
|
33
|
-
* optional, so a failure is logged, and the next check tries again.
|
|
34
|
-
*/
|
|
35
|
-
export declare function applyGitHubConflictPolicy(args: {
|
|
36
|
-
conflict: GitHubMergeConflict;
|
|
37
|
-
db: GitHubDb;
|
|
38
|
-
draft: boolean;
|
|
39
|
-
events: EventInput[];
|
|
40
|
-
/** Read the pull request's `PULL_REQUEST_CONFLICT_HISTORY` from GitHub. */
|
|
41
|
-
loadHistory(ref: GitHubPullRequestRef): Promise<unknown>;
|
|
42
|
-
log?: Pick<PluginLogger, "error" | "warn">;
|
|
43
|
-
now: Date;
|
|
44
|
-
ref: GitHubPullRequestRef;
|
|
45
|
-
reviewItems: PluginConversationReviewItems;
|
|
46
|
-
title?: string;
|
|
47
|
-
}): Promise<EventInput[]>;
|
|
48
|
-
/** Why a merge conflict notice closes when GitHub reports no conflict. */
|
|
49
|
-
export declare const GITHUB_CONFLICT_GONE_REASON = "The pull request no longer has merge conflicts.";
|
|
50
|
-
/**
|
|
51
|
-
* Close the merge conflict notice of one Junior pull request. Throws when
|
|
52
|
-
* the review desk fails, so a caller with no later check can try again.
|
|
53
|
-
*/
|
|
54
|
-
export declare function closeGitHubConflictNotice(args: {
|
|
55
|
-
db: GitHubDb;
|
|
56
|
-
reason: string;
|
|
57
|
-
ref: GitHubPullRequestRef;
|
|
58
|
-
reviewItems: PluginConversationReviewItems;
|
|
59
|
-
status: "done" | "dismissed";
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Close the merge conflict notices of some Junior pull requests, such as
|
|
63
|
-
* ones that GitHub reports as mergeable. A notice is optional, so a failed
|
|
64
|
-
* close is logged, and the next check closes it again.
|
|
65
|
-
*/
|
|
66
|
-
export declare function closeGitHubConflictNotices(args: {
|
|
67
|
-
db: GitHubDb;
|
|
68
|
-
log?: Pick<PluginLogger, "error" | "warn">;
|
|
69
|
-
numbers: number[];
|
|
70
|
-
reason: string;
|
|
71
|
-
repositoryFullName: string;
|
|
72
|
-
reviewItems: PluginConversationReviewItems;
|
|
73
|
-
status: "done" | "dismissed";
|
|
74
|
-
}): Promise<void>;
|