@kana-ai/edgar-ext-github 0.0.0-stage → 0.1.1
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/LICENSE +202 -0
- package/README.md +469 -2
- package/agents/dismiss/agent.toml +4 -0
- package/agents/dismiss/instructions.md +25 -0
- package/dist/src/api/app.d.ts +16 -0
- package/dist/src/api/app.js +32 -0
- package/dist/src/api/client.d.ts +26 -0
- package/dist/src/api/client.js +103 -0
- package/dist/src/api/failures.d.ts +8 -0
- package/dist/src/api/failures.js +31 -0
- package/dist/src/feed/alerts.d.ts +26 -0
- package/dist/src/feed/alerts.js +117 -0
- package/dist/src/feed/cards.d.ts +32 -0
- package/dist/src/feed/cards.js +164 -0
- package/dist/src/feed/service.d.ts +28 -0
- package/dist/src/feed/service.js +163 -0
- package/dist/src/index.d.ts +490 -0
- package/dist/src/index.js +62 -0
- package/dist/src/schemas/config.d.ts +57 -0
- package/dist/src/schemas/config.js +89 -0
- package/dist/src/schemas/github.d.ts +417 -0
- package/dist/src/schemas/github.js +216 -0
- package/dist/src/schemas/tools.d.ts +620 -0
- package/dist/src/schemas/tools.js +501 -0
- package/dist/src/tools/alerts.d.ts +45 -0
- package/dist/src/tools/alerts.js +100 -0
- package/dist/src/tools/branch.d.ts +9 -0
- package/dist/src/tools/branch.js +48 -0
- package/dist/src/tools/checks.d.ts +118 -0
- package/dist/src/tools/checks.js +223 -0
- package/dist/src/tools/discussion.d.ts +41 -0
- package/dist/src/tools/discussion.js +66 -0
- package/dist/src/tools/pull-request.d.ts +195 -0
- package/dist/src/tools/pull-request.js +537 -0
- package/dist/src/tools/repository.d.ts +53 -0
- package/dist/src/tools/repository.js +134 -0
- package/dist/src/tools/screenshot.d.ts +21 -0
- package/dist/src/tools/screenshot.js +99 -0
- package/dist/src/tracker/assignee.d.ts +15 -0
- package/dist/src/tracker/assignee.js +65 -0
- package/dist/src/tracker/cards.d.ts +41 -0
- package/dist/src/tracker/cards.js +361 -0
- package/dist/src/tracker/comments.d.ts +9 -0
- package/dist/src/tracker/comments.js +68 -0
- package/dist/src/tracker/description.d.ts +19 -0
- package/dist/src/tracker/description.js +55 -0
- package/dist/src/tracker/hand-back.d.ts +8 -0
- package/dist/src/tracker/hand-back.js +60 -0
- package/dist/src/tracker/port.d.ts +2 -0
- package/dist/src/tracker/port.js +42 -0
- package/dist/src/tracker/states.d.ts +77 -0
- package/dist/src/tracker/states.js +189 -0
- package/dist/src/tracker/tools.d.ts +143 -0
- package/dist/src/tracker/tools.js +131 -0
- package/dist/src/tracker/transitions.d.ts +12 -0
- package/dist/src/tracker/transitions.js +101 -0
- package/edgar-extension.json +507 -0
- package/package.json +43 -3
- package/schemas/assign.in.json +15 -0
- package/schemas/assign.out.json +14 -0
- package/schemas/attach_screenshot.in.json +44 -0
- package/schemas/attach_screenshot.out.json +31 -0
- package/schemas/batch_cards.in.json +27 -0
- package/schemas/batch_cards.out.json +37 -0
- package/schemas/branch_protection.in.json +15 -0
- package/schemas/branch_protection.out.json +67 -0
- package/schemas/ci_run.in.json +12 -0
- package/schemas/ci_run.out.json +109 -0
- package/schemas/close.in.json +14 -0
- package/schemas/close.out.json +10 -0
- package/schemas/close_pull_request.in.json +21 -0
- package/schemas/close_pull_request.out.json +14 -0
- package/schemas/comment.in.json +19 -0
- package/schemas/comment.out.json +10 -0
- package/schemas/config.json +202 -0
- package/schemas/count_sighting.in.json +17 -0
- package/schemas/count_sighting.out.json +10 -0
- package/schemas/create_card.in.json +108 -0
- package/schemas/create_card.out.json +13 -0
- package/schemas/dependabot_alerts.in.json +49 -0
- package/schemas/dependabot_alerts.out.json +75 -0
- package/schemas/dismiss_dependabot_alert.in.json +26 -0
- package/schemas/dismiss_dependabot_alert.out.json +27 -0
- package/schemas/find_assignee.in.json +15 -0
- package/schemas/find_assignee.out.json +10 -0
- package/schemas/find_cards.in.json +18 -0
- package/schemas/find_cards.out.json +33 -0
- package/schemas/find_dependabot_dismissal.in.json +12 -0
- package/schemas/find_dependabot_dismissal.out.json +27 -0
- package/schemas/find_description.in.json +15 -0
- package/schemas/find_description.out.json +10 -0
- package/schemas/find_pull_request.in.json +25 -0
- package/schemas/find_pull_request.out.json +14 -0
- package/schemas/hand_back.in.json +11 -0
- package/schemas/hand_back.out.json +18 -0
- package/schemas/linked_pull_requests.in.json +15 -0
- package/schemas/linked_pull_requests.out.json +44 -0
- package/schemas/list_pull_requests.in.json +26 -0
- package/schemas/list_pull_requests.out.json +42 -0
- package/schemas/merge_pull_request.in.json +22 -0
- package/schemas/merge_pull_request.out.json +16 -0
- package/schemas/move.in.json +15 -0
- package/schemas/move.out.json +10 -0
- package/schemas/note_pull_request.in.json +15 -0
- package/schemas/note_pull_request.out.json +10 -0
- package/schemas/open_pull_request.in.json +113 -0
- package/schemas/open_pull_request.out.json +15 -0
- package/schemas/pull_request_checks.in.json +11 -0
- package/schemas/pull_request_checks.out.json +72 -0
- package/schemas/pull_request_discussion.in.json +11 -0
- package/schemas/pull_request_discussion.out.json +107 -0
- package/schemas/pull_request_state.in.json +11 -0
- package/schemas/pull_request_state.out.json +52 -0
- package/schemas/push_branch.in.json +21 -0
- package/schemas/push_branch.out.json +13 -0
- package/schemas/release_follow_ups.in.json +15 -0
- package/schemas/release_follow_ups.out.json +13 -0
- package/schemas/reopen_dependabot_alert.in.json +33 -0
- package/schemas/reopen_dependabot_alert.out.json +22 -0
- package/schemas/restore_assignee.in.json +20 -0
- package/schemas/restore_assignee.out.json +10 -0
- package/schemas/restore_description.in.json +20 -0
- package/schemas/restore_description.out.json +10 -0
- package/schemas/update_description.in.json +15 -0
- package/schemas/update_description.out.json +14 -0
- package/schemas/update_pull_request.in.json +81 -0
- package/schemas/update_pull_request.out.json +10 -0
- package/schemas/wait_for_checks.in.json +11 -0
- package/schemas/wait_for_checks.out.json +72 -0
- package/schemas/wait_for_merge.in.json +11 -0
- package/schemas/wait_for_merge.out.json +17 -0
- package/schemas/wait_for_passed_checks.in.json +11 -0
- package/schemas/wait_for_passed_checks.out.json +72 -0
- package/schemas/wait_for_review.in.json +11 -0
- package/schemas/wait_for_review.out.json +52 -0
- package/workflows/resume.toml +17 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** A pull request as the REST API answers it, with the fields the tools read. */
|
|
3
|
+
export const pull = z.object({
|
|
4
|
+
html_url: z.string(),
|
|
5
|
+
number: z.number().int(),
|
|
6
|
+
state: z.enum(["open", "closed"]),
|
|
7
|
+
merged_at: z.string().nullable(),
|
|
8
|
+
merge_commit_sha: z.string().nullable(),
|
|
9
|
+
updated_at: z.string(),
|
|
10
|
+
head: z.object({
|
|
11
|
+
ref: z.string(),
|
|
12
|
+
sha: z.string(),
|
|
13
|
+
repo: z.object({ full_name: z.string() }).nullish(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
/** A pull request with its body, which `update_pull_request` and `attach_screenshot` keep a part of. */
|
|
17
|
+
export const pullBody = pull.extend({ body: z.string().nullish() });
|
|
18
|
+
/** A blob, a tree or a commit as the Git database API answers its creation, or a commit of a list. */
|
|
19
|
+
export const gitObject = z.object({ sha: z.string() });
|
|
20
|
+
/** A ref as `GET` and `POST /repos/{owner}/{repo}/git/refs` answer it. */
|
|
21
|
+
export const gitRef = z.object({ ref: z.string(), object: gitObject });
|
|
22
|
+
/** The answer of `PUT /repos/{owner}/{repo}/contents/{path}`: the commit that holds the file. */
|
|
23
|
+
export const storedFile = z.object({ commit: gitObject });
|
|
24
|
+
/** One pull request as `GET /repos/{owner}/{repo}/pulls/{n}` answers it, which a list does not: with the number of files it changes. */
|
|
25
|
+
export const onePull = pull.extend({ changed_files: z.number().int() });
|
|
26
|
+
/** A pull request with the words a person reads, for a role that checks whether it fixes a card. */
|
|
27
|
+
export const linkedPull = pull.extend({ title: z.string(), body: z.string().nullable() });
|
|
28
|
+
/** One file of `GET /repos/{owner}/{repo}/pulls/{n}/files`; a binary or very large file has no `patch`. */
|
|
29
|
+
export const pullFile = z.object({ filename: z.string(), patch: z.string().optional() });
|
|
30
|
+
const person = z.object({ login: z.string() });
|
|
31
|
+
/** An open pull request as `GET /repos/{owner}/{repo}/pulls?state=open` lists it, with who wrote it and who is asked to review it or is assigned. */
|
|
32
|
+
export const openPull = pull.extend({
|
|
33
|
+
title: z.string(),
|
|
34
|
+
user: person.nullable(),
|
|
35
|
+
requested_reviewers: z.array(person).default([]),
|
|
36
|
+
assignees: z.array(person).default([]),
|
|
37
|
+
});
|
|
38
|
+
/** The user a token signs in as, from `GET /user`. */
|
|
39
|
+
export const viewer = person;
|
|
40
|
+
/** One review of a pull request, with the head commit it was made on. */
|
|
41
|
+
export const review = z.object({
|
|
42
|
+
user: z.object({ id: z.number(), login: z.string() }).nullable(),
|
|
43
|
+
state: z.string(),
|
|
44
|
+
commit_id: z.string().nullish(),
|
|
45
|
+
});
|
|
46
|
+
/** The files a comparison of two refs changes, from `GET /repos/{owner}/{repo}/compare/{base}...{head}`; GitHub lists at most 300. */
|
|
47
|
+
export const comparison = z.object({
|
|
48
|
+
files: z.array(z.object({ filename: z.string(), changes: z.number().int() })).default([]),
|
|
49
|
+
});
|
|
50
|
+
/** The answer of a merge. */
|
|
51
|
+
export const merge = z.object({ sha: z.string(), merged: z.boolean() });
|
|
52
|
+
/** The body of an error answer. */
|
|
53
|
+
export const errorBody = z.object({
|
|
54
|
+
message: z.string().optional(),
|
|
55
|
+
documentation_url: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/** One check run of a commit, from `GET /repos/{owner}/{repo}/commits/{ref}/check-runs`. */
|
|
58
|
+
export const checkRun = z.object({
|
|
59
|
+
id: z.number().int().optional(),
|
|
60
|
+
head_sha: z.string().optional(),
|
|
61
|
+
name: z.string(),
|
|
62
|
+
status: z.string(),
|
|
63
|
+
conclusion: z.string().nullable(),
|
|
64
|
+
html_url: z.string().nullable(),
|
|
65
|
+
details_url: z.string().nullable(),
|
|
66
|
+
});
|
|
67
|
+
/** The check runs of a commit. */
|
|
68
|
+
export const checkRuns = z.object({ total_count: z.number().int(), check_runs: z.array(checkRun) });
|
|
69
|
+
/** The combined status of a commit, from `GET /repos/{owner}/{repo}/commits/{ref}/status`. */
|
|
70
|
+
export const combinedStatus = z.object({
|
|
71
|
+
statuses: z.array(z.object({ context: z.string(), state: z.string(), target_url: z.string().nullable() })),
|
|
72
|
+
});
|
|
73
|
+
const login = z.object({ login: z.string() }).nullable();
|
|
74
|
+
/** A Dependabot alert, from `GET /repos/{owner}/{repo}/dependabot/alerts`; the dismissal fields are set on a dismissed alert. */
|
|
75
|
+
export const alert = z.object({
|
|
76
|
+
number: z.number().int(),
|
|
77
|
+
state: z.string(),
|
|
78
|
+
html_url: z.string(),
|
|
79
|
+
dismissed_reason: z.string().nullish(),
|
|
80
|
+
dismissed_comment: z.string().nullish(),
|
|
81
|
+
dependency: z.object({
|
|
82
|
+
package: z.object({ ecosystem: z.string(), name: z.string() }).nullish(),
|
|
83
|
+
manifest_path: z.string().nullish(),
|
|
84
|
+
scope: z.string().nullish(),
|
|
85
|
+
}),
|
|
86
|
+
security_advisory: z.object({
|
|
87
|
+
ghsa_id: z.string(),
|
|
88
|
+
cve_id: z.string().nullable(),
|
|
89
|
+
summary: z.string(),
|
|
90
|
+
severity: z.string(),
|
|
91
|
+
}),
|
|
92
|
+
security_vulnerability: z.object({
|
|
93
|
+
severity: z.string(),
|
|
94
|
+
vulnerable_version_range: z.string(),
|
|
95
|
+
first_patched_version: z.object({ identifier: z.string() }).nullable(),
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
/** A review with its author and words, from `GET .../pulls/{n}/reviews`. */
|
|
99
|
+
export const said = z.object({
|
|
100
|
+
user: login,
|
|
101
|
+
state: z.string(),
|
|
102
|
+
body: z.string().nullable(),
|
|
103
|
+
submitted_at: z.string().nullish(),
|
|
104
|
+
});
|
|
105
|
+
/** A comment on a line of a pull request's diff, from `GET .../pulls/{n}/comments`. */
|
|
106
|
+
export const lineComment = z.object({
|
|
107
|
+
id: z.number().int(),
|
|
108
|
+
in_reply_to_id: z.number().int().optional(),
|
|
109
|
+
user: login,
|
|
110
|
+
body: z.string(),
|
|
111
|
+
path: z.string(),
|
|
112
|
+
line: z.number().int().nullable(),
|
|
113
|
+
original_line: z.number().int().nullish(),
|
|
114
|
+
diff_hunk: z.string(),
|
|
115
|
+
created_at: z.string(),
|
|
116
|
+
});
|
|
117
|
+
/** A comment of a pull request's conversation, from `GET .../issues/{n}/comments`. */
|
|
118
|
+
export const issueComment = z.object({ user: login, body: z.string(), created_at: z.string() });
|
|
119
|
+
/** A comment of a pull request as the note tool reads and writes it; GitHub gives `body` as null for an empty one. */
|
|
120
|
+
export const note = z.object({
|
|
121
|
+
id: z.number().int(),
|
|
122
|
+
html_url: z.string(),
|
|
123
|
+
body: z.string().nullable(),
|
|
124
|
+
});
|
|
125
|
+
/** A GitHub Actions workflow run, from `GET .../actions/runs/{id}`. */
|
|
126
|
+
export const workflowRun = z.object({
|
|
127
|
+
id: z.number().int(),
|
|
128
|
+
name: z.string().nullable(),
|
|
129
|
+
html_url: z.string(),
|
|
130
|
+
status: z.string().nullable(),
|
|
131
|
+
conclusion: z.string().nullable(),
|
|
132
|
+
head_sha: z.string(),
|
|
133
|
+
head_branch: z.string().nullable(),
|
|
134
|
+
run_attempt: z.number().int(),
|
|
135
|
+
});
|
|
136
|
+
/** The jobs of a run's latest attempt, from `GET .../actions/runs/{id}/jobs`. */
|
|
137
|
+
export const jobs = z.object({
|
|
138
|
+
jobs: z.array(z.object({
|
|
139
|
+
id: z.number().int(),
|
|
140
|
+
name: z.string(),
|
|
141
|
+
status: z.string(),
|
|
142
|
+
conclusion: z.string().nullable(),
|
|
143
|
+
steps: z.array(z.object({ name: z.string(), conclusion: z.string().nullable() })).default([]),
|
|
144
|
+
})),
|
|
145
|
+
});
|
|
146
|
+
/** A branch with its protection as a reader sees it, from `GET .../branches/{branch}`. */
|
|
147
|
+
export const branch = z.object({
|
|
148
|
+
name: z.string(),
|
|
149
|
+
protected: z.boolean(),
|
|
150
|
+
protection: z
|
|
151
|
+
.object({
|
|
152
|
+
required_status_checks: z.object({ contexts: z.array(z.string()) }).nullish(),
|
|
153
|
+
})
|
|
154
|
+
.nullish(),
|
|
155
|
+
});
|
|
156
|
+
/** One rule that applies to a branch, from `GET .../rules/branches/{branch}`. */
|
|
157
|
+
export const rule = z.object({
|
|
158
|
+
type: z.string(),
|
|
159
|
+
ruleset_id: z.number().int(),
|
|
160
|
+
ruleset_source: z.string(),
|
|
161
|
+
parameters: z
|
|
162
|
+
.object({
|
|
163
|
+
required_approving_review_count: z.number().int().optional(),
|
|
164
|
+
required_status_checks: z.array(z.object({ context: z.string() })).optional(),
|
|
165
|
+
})
|
|
166
|
+
.optional(),
|
|
167
|
+
});
|
|
168
|
+
/** A classic branch protection rule, from `GET .../branches/{branch}/protection`; admins only. */
|
|
169
|
+
export const classicProtection = z.object({
|
|
170
|
+
required_pull_request_reviews: z
|
|
171
|
+
.object({ required_approving_review_count: z.number().int().default(0) })
|
|
172
|
+
.optional(),
|
|
173
|
+
required_status_checks: z.object({ contexts: z.array(z.string()) }).nullish(),
|
|
174
|
+
});
|
|
175
|
+
/** An issue as `GET /repos/{owner}/{repo}/issues` lists it and `GET .../issues/{n}` answers it, with the fields a card reads; a pull request has `pull_request`. */
|
|
176
|
+
export const issue = z.object({
|
|
177
|
+
number: z.number().int(),
|
|
178
|
+
title: z.string(),
|
|
179
|
+
body: z.string().nullish(),
|
|
180
|
+
state: z.enum(["open", "closed"]),
|
|
181
|
+
state_reason: z.string().nullish(),
|
|
182
|
+
html_url: z.string(),
|
|
183
|
+
labels: z.array(z.union([z.string(), z.object({ name: z.string() })])),
|
|
184
|
+
assignees: z.array(person).nullish(),
|
|
185
|
+
pull_request: z.object({}).nullish(),
|
|
186
|
+
});
|
|
187
|
+
/** One comment of an issue, from `GET .../issues/{n}/comments`. */
|
|
188
|
+
export const cardComment = z.object({
|
|
189
|
+
id: z.number().int(),
|
|
190
|
+
user: login,
|
|
191
|
+
body: z.string().nullish(),
|
|
192
|
+
created_at: z.string(),
|
|
193
|
+
});
|
|
194
|
+
/** A label as `GET /repos/{owner}/{repo}/labels/{name}` and its `POST` answer it. */
|
|
195
|
+
export const namedLabel = z.object({ name: z.string() });
|
|
196
|
+
/** A user as `GET /users/{username}` answers it; `email` is null unless the user made it public. */
|
|
197
|
+
export const user = z.object({
|
|
198
|
+
login: z.string(),
|
|
199
|
+
name: z.string().nullish(),
|
|
200
|
+
email: z.string().nullish(),
|
|
201
|
+
});
|
|
202
|
+
/** The issues of `GET /search/issues` that match, each with the repository it is in. */
|
|
203
|
+
export const foundIssues = z.object({
|
|
204
|
+
items: z.array(issue.extend({ repository_url: z.string(), created_at: z.string() })),
|
|
205
|
+
});
|
|
206
|
+
/** A user as an issue or an event names them; `type` is `Bot` for an App. */
|
|
207
|
+
export const actor = z.object({ login: z.string(), type: z.string().optional() });
|
|
208
|
+
/** An issue with its writer and the time it was made, which `hand_back` and `find_cards` read. */
|
|
209
|
+
export const issueBy = issue.extend({ user: actor.nullable(), created_at: z.string() });
|
|
210
|
+
/** One event of an issue, from `GET .../issues/{n}/events`; an `assigned` event names who assigned whom. */
|
|
211
|
+
export const issueEvent = z.object({
|
|
212
|
+
event: z.string(),
|
|
213
|
+
created_at: z.string(),
|
|
214
|
+
actor: actor.nullable(),
|
|
215
|
+
assignee: actor.nullish(),
|
|
216
|
+
});
|