@kana-ai/edgar-ext-github 0.0.0-stage → 0.1.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 (136) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +469 -2
  3. package/agents/dismiss/agent.toml +4 -0
  4. package/agents/dismiss/instructions.md +25 -0
  5. package/dist/src/api/app.d.ts +16 -0
  6. package/dist/src/api/app.js +32 -0
  7. package/dist/src/api/client.d.ts +26 -0
  8. package/dist/src/api/client.js +103 -0
  9. package/dist/src/api/failures.d.ts +8 -0
  10. package/dist/src/api/failures.js +31 -0
  11. package/dist/src/feed/alerts.d.ts +26 -0
  12. package/dist/src/feed/alerts.js +117 -0
  13. package/dist/src/feed/cards.d.ts +32 -0
  14. package/dist/src/feed/cards.js +164 -0
  15. package/dist/src/feed/service.d.ts +28 -0
  16. package/dist/src/feed/service.js +163 -0
  17. package/dist/src/index.d.ts +490 -0
  18. package/dist/src/index.js +62 -0
  19. package/dist/src/schemas/config.d.ts +57 -0
  20. package/dist/src/schemas/config.js +89 -0
  21. package/dist/src/schemas/github.d.ts +417 -0
  22. package/dist/src/schemas/github.js +216 -0
  23. package/dist/src/schemas/tools.d.ts +620 -0
  24. package/dist/src/schemas/tools.js +501 -0
  25. package/dist/src/tools/alerts.d.ts +45 -0
  26. package/dist/src/tools/alerts.js +100 -0
  27. package/dist/src/tools/branch.d.ts +9 -0
  28. package/dist/src/tools/branch.js +48 -0
  29. package/dist/src/tools/checks.d.ts +118 -0
  30. package/dist/src/tools/checks.js +223 -0
  31. package/dist/src/tools/discussion.d.ts +41 -0
  32. package/dist/src/tools/discussion.js +66 -0
  33. package/dist/src/tools/pull-request.d.ts +195 -0
  34. package/dist/src/tools/pull-request.js +537 -0
  35. package/dist/src/tools/repository.d.ts +53 -0
  36. package/dist/src/tools/repository.js +134 -0
  37. package/dist/src/tools/screenshot.d.ts +21 -0
  38. package/dist/src/tools/screenshot.js +99 -0
  39. package/dist/src/tracker/assignee.d.ts +15 -0
  40. package/dist/src/tracker/assignee.js +65 -0
  41. package/dist/src/tracker/cards.d.ts +41 -0
  42. package/dist/src/tracker/cards.js +361 -0
  43. package/dist/src/tracker/comments.d.ts +9 -0
  44. package/dist/src/tracker/comments.js +68 -0
  45. package/dist/src/tracker/description.d.ts +19 -0
  46. package/dist/src/tracker/description.js +55 -0
  47. package/dist/src/tracker/hand-back.d.ts +8 -0
  48. package/dist/src/tracker/hand-back.js +60 -0
  49. package/dist/src/tracker/port.d.ts +2 -0
  50. package/dist/src/tracker/port.js +42 -0
  51. package/dist/src/tracker/states.d.ts +77 -0
  52. package/dist/src/tracker/states.js +189 -0
  53. package/dist/src/tracker/tools.d.ts +143 -0
  54. package/dist/src/tracker/tools.js +131 -0
  55. package/dist/src/tracker/transitions.d.ts +12 -0
  56. package/dist/src/tracker/transitions.js +101 -0
  57. package/edgar-extension.json +507 -0
  58. package/package.json +43 -3
  59. package/schemas/assign.in.json +15 -0
  60. package/schemas/assign.out.json +14 -0
  61. package/schemas/attach_screenshot.in.json +44 -0
  62. package/schemas/attach_screenshot.out.json +31 -0
  63. package/schemas/batch_cards.in.json +27 -0
  64. package/schemas/batch_cards.out.json +37 -0
  65. package/schemas/branch_protection.in.json +15 -0
  66. package/schemas/branch_protection.out.json +67 -0
  67. package/schemas/ci_run.in.json +12 -0
  68. package/schemas/ci_run.out.json +109 -0
  69. package/schemas/close.in.json +14 -0
  70. package/schemas/close.out.json +10 -0
  71. package/schemas/close_pull_request.in.json +21 -0
  72. package/schemas/close_pull_request.out.json +14 -0
  73. package/schemas/comment.in.json +19 -0
  74. package/schemas/comment.out.json +10 -0
  75. package/schemas/config.json +202 -0
  76. package/schemas/count_sighting.in.json +17 -0
  77. package/schemas/count_sighting.out.json +10 -0
  78. package/schemas/create_card.in.json +108 -0
  79. package/schemas/create_card.out.json +13 -0
  80. package/schemas/dependabot_alerts.in.json +49 -0
  81. package/schemas/dependabot_alerts.out.json +75 -0
  82. package/schemas/dismiss_dependabot_alert.in.json +26 -0
  83. package/schemas/dismiss_dependabot_alert.out.json +27 -0
  84. package/schemas/find_assignee.in.json +15 -0
  85. package/schemas/find_assignee.out.json +10 -0
  86. package/schemas/find_cards.in.json +18 -0
  87. package/schemas/find_cards.out.json +33 -0
  88. package/schemas/find_dependabot_dismissal.in.json +12 -0
  89. package/schemas/find_dependabot_dismissal.out.json +27 -0
  90. package/schemas/find_description.in.json +15 -0
  91. package/schemas/find_description.out.json +10 -0
  92. package/schemas/find_pull_request.in.json +25 -0
  93. package/schemas/find_pull_request.out.json +14 -0
  94. package/schemas/hand_back.in.json +11 -0
  95. package/schemas/hand_back.out.json +18 -0
  96. package/schemas/linked_pull_requests.in.json +15 -0
  97. package/schemas/linked_pull_requests.out.json +44 -0
  98. package/schemas/list_pull_requests.in.json +26 -0
  99. package/schemas/list_pull_requests.out.json +42 -0
  100. package/schemas/merge_pull_request.in.json +22 -0
  101. package/schemas/merge_pull_request.out.json +16 -0
  102. package/schemas/move.in.json +15 -0
  103. package/schemas/move.out.json +10 -0
  104. package/schemas/note_pull_request.in.json +15 -0
  105. package/schemas/note_pull_request.out.json +10 -0
  106. package/schemas/open_pull_request.in.json +113 -0
  107. package/schemas/open_pull_request.out.json +15 -0
  108. package/schemas/pull_request_checks.in.json +11 -0
  109. package/schemas/pull_request_checks.out.json +72 -0
  110. package/schemas/pull_request_discussion.in.json +11 -0
  111. package/schemas/pull_request_discussion.out.json +107 -0
  112. package/schemas/pull_request_state.in.json +11 -0
  113. package/schemas/pull_request_state.out.json +52 -0
  114. package/schemas/push_branch.in.json +21 -0
  115. package/schemas/push_branch.out.json +13 -0
  116. package/schemas/release_follow_ups.in.json +15 -0
  117. package/schemas/release_follow_ups.out.json +13 -0
  118. package/schemas/reopen_dependabot_alert.in.json +33 -0
  119. package/schemas/reopen_dependabot_alert.out.json +22 -0
  120. package/schemas/restore_assignee.in.json +20 -0
  121. package/schemas/restore_assignee.out.json +10 -0
  122. package/schemas/restore_description.in.json +20 -0
  123. package/schemas/restore_description.out.json +10 -0
  124. package/schemas/update_description.in.json +15 -0
  125. package/schemas/update_description.out.json +14 -0
  126. package/schemas/update_pull_request.in.json +81 -0
  127. package/schemas/update_pull_request.out.json +10 -0
  128. package/schemas/wait_for_checks.in.json +11 -0
  129. package/schemas/wait_for_checks.out.json +72 -0
  130. package/schemas/wait_for_merge.in.json +11 -0
  131. package/schemas/wait_for_merge.out.json +17 -0
  132. package/schemas/wait_for_passed_checks.in.json +11 -0
  133. package/schemas/wait_for_passed_checks.out.json +72 -0
  134. package/schemas/wait_for_review.in.json +11 -0
  135. package/schemas/wait_for_review.out.json +52 -0
  136. package/workflows/resume.toml +17 -0
@@ -0,0 +1,195 @@
1
+ import { z } from "zod";
2
+ import { type Reply } from "#api/client";
3
+ import { review } from "#schemas/github";
4
+ import { openPullRequest, type reviewStates } from "#schemas/tools";
5
+ /** `owner/name` in lower case from `owner/name`, an SSH remote or an HTTPS URL of github.com: GitHub names are not case-sensitive, so one repository has one name in every key. */
6
+ export declare function repoPath(repo: string): string | undefined;
7
+ /** The API path of a pull request from its `https://github.com/<owner>/<name>/pull/<n>` URL. */
8
+ export declare function pullPath(url: string): string | undefined;
9
+ /** The card id of an `edgar/<card>-<slug>` branch, as `ENG-123`, or `null`. */
10
+ export declare function cardOf(branch: string): string | null;
11
+ /** The review state from each reviewer's latest deciding review. A change request made on a commit before `head` is pending: a push answered it, and its reviewer has not reviewed the new head, so no approval of another reviewer counts yet. */
12
+ export declare function reviewState(reviews: readonly z.infer<typeof review>[], head?: string): z.infer<typeof reviewStates>;
13
+ /** `owner/name` of a repository, or `invalid_input`. */
14
+ export declare function repoOf(repo: string): Reply<string>;
15
+ /** The API path of a pull request URL, or `invalid_input`. */
16
+ export declare function pullOf(url: string): Reply<string>;
17
+ /** The large change line past `largeLines` changed lines, then each path notice whose prefix a file is under, once each. */
18
+ export declare function changeNotices(files: readonly {
19
+ readonly filename: string;
20
+ readonly changes: number;
21
+ }[], largeLines: number | undefined, paths: readonly {
22
+ readonly prefix: string;
23
+ readonly notice: string;
24
+ }[]): string[];
25
+ /** The proof of a change as the body shows it. "Verified" lists each check that ended with exit code 0, from the check stage's own results and from no words of a model. "Not verified" lists each other check, then each thing the author did not check; a check with no exit code did not run, because a check before it failed, or did not end. With `checks`, "Verified" is there also when it is empty, so a reader can tell that nothing passed, or that nothing ran, from a body with no proof. "Not verified" says that nothing is outstanding only when the author gave a list and it is empty. With neither input, the body has no proof. */
26
+ export declare function proofOf(checks: z.infer<typeof openPullRequest.input>["checks"], notVerified: readonly string[] | undefined): string[];
27
+ /** The pull request tools of the GitHub extension, by the name the manifest gives them. */
28
+ export declare const pullRequestTools: {
29
+ /** A retry after a lost answer gets 422 for the pull request its earlier attempt opened: a 422 reads the branch's open pull request back and returns it, and stays `invalid` when there is none. */
30
+ open_pull_request: import("@kana-ai/edgar-sdk").Tool<{
31
+ repo: string;
32
+ branch: string;
33
+ title: string;
34
+ body: string;
35
+ review: string;
36
+ labels?: string[] | undefined;
37
+ large_diff_lines?: number | undefined;
38
+ path_notices?: {
39
+ prefix: string;
40
+ notice: string;
41
+ }[] | undefined;
42
+ checks?: {
43
+ results: {
44
+ check: string;
45
+ exit_code: number | null;
46
+ }[];
47
+ } | undefined;
48
+ not_verified?: string[] | undefined;
49
+ related?: string | string[] | undefined;
50
+ }, {
51
+ url: string;
52
+ number: number;
53
+ }, "GITHUB_TOKEN">;
54
+ /** The review line of the first body is left out: that review read the change before this one. */
55
+ update_pull_request: import("@kana-ai/edgar-sdk").Tool<{
56
+ url: string;
57
+ title: string;
58
+ body: string;
59
+ large_diff_lines?: number | undefined;
60
+ path_notices?: {
61
+ prefix: string;
62
+ notice: string;
63
+ }[] | undefined;
64
+ checks?: {
65
+ results: {
66
+ check: string;
67
+ exit_code: number | null;
68
+ }[];
69
+ } | undefined;
70
+ not_verified?: string[] | undefined;
71
+ }, {
72
+ url: string;
73
+ }, "GITHUB_TOKEN">;
74
+ /** The picture goes to the branch `edgar/screenshots` of the same repository, never to the pull request's branch, and the body shows it pinned to the commit that holds it, to each person who can see the pull request. A picture that is missing, too large or not stored still gives the body one line that says why, and the outcome says it too; only an input that is not a pull request fails. */
75
+ attach_screenshot: import("@kana-ai/edgar-sdk").Tool<{
76
+ url: string;
77
+ shot: {
78
+ path: string;
79
+ bytes: number;
80
+ caption: string;
81
+ } | {
82
+ missing: string;
83
+ };
84
+ }, {
85
+ attached: true;
86
+ image: string;
87
+ } | {
88
+ attached: false;
89
+ missing: string;
90
+ }, "GITHUB_TOKEN">;
91
+ close_pull_request: import("@kana-ai/edgar-sdk").Tool<{
92
+ stage_output: {
93
+ url: string;
94
+ };
95
+ text?: string | undefined;
96
+ }, {
97
+ url: string;
98
+ state: "closed" | "merged" | "open";
99
+ }, "GITHUB_TOKEN">;
100
+ /** One comment on the pull request holds every line, so a person reads what EDGAR did there in one place and gets no comment for each step. The comment is found by its first line. A call whose line is already the last line writes nothing, so a retry after a lost answer adds no second line. shortcut: the oldest 100 comments are read, so a note after them is not found and a second one is made; upgrade to `Link` pagination when a pull request holds more. */
101
+ note_pull_request: import("@kana-ai/edgar-sdk").Tool<{
102
+ url: string;
103
+ text: string;
104
+ }, {
105
+ url: string;
106
+ }, "GITHUB_TOKEN">;
107
+ /** Only the pull requests of `repo` are read, so a card cannot bring code from another repository into the project's tracker. A link that answers 404 or 403 is left out, because a pull request EDGAR cannot read is no reason to stop the work on the card. shortcut: the first 5 links, 100 files each, and 4,000 characters of each patch; upgrade to paging when a linked fix is larger. */
108
+ linked_pull_requests: import("@kana-ai/edgar-sdk").Tool<{
109
+ text: string;
110
+ repo: string;
111
+ }, {
112
+ pull_requests: {
113
+ url: string;
114
+ state: "closed" | "merged" | "open";
115
+ title: string;
116
+ body: string;
117
+ files: {
118
+ path: string;
119
+ patch: string;
120
+ }[];
121
+ }[];
122
+ }, "GITHUB_TOKEN">;
123
+ find_pull_request: import("@kana-ai/edgar-sdk").Tool<{
124
+ operation_id: string;
125
+ input: {
126
+ repo: string;
127
+ branch: string;
128
+ };
129
+ }, {
130
+ url: string;
131
+ state: "closed" | "merged" | "open";
132
+ }, "GITHUB_TOKEN">;
133
+ /** A pull request whose head is in another repository, such as a fork, is left out: its branch name proves nothing. shortcut: one page of 100 per repository, so with `merged_within_hours` a merge past the 100 closed pull requests updated last is not read; upgrade to `Link` pagination when a repository closes more within the window. */
134
+ list_pull_requests: import("@kana-ai/edgar-sdk").Tool<{
135
+ services: {
136
+ repo: string;
137
+ }[];
138
+ merged_within_hours?: number | undefined;
139
+ }, {
140
+ pull_requests: {
141
+ url: string;
142
+ branch: string;
143
+ card: string;
144
+ unmerged: {
145
+ url: string;
146
+ state: "closed" | "open";
147
+ }[];
148
+ }[];
149
+ }, "GITHUB_TOKEN">;
150
+ pull_request_state: import("@kana-ai/edgar-sdk").Tool<{
151
+ url: string;
152
+ }, {
153
+ url: string;
154
+ state: "closed" | "merged" | "open";
155
+ merged: boolean;
156
+ review_state: "approved" | "changes_requested" | "pending";
157
+ approved_by: string[];
158
+ card: string | null;
159
+ commit: string;
160
+ branch: string;
161
+ head_repo: string | null;
162
+ }, "GITHUB_TOKEN">;
163
+ /** The recheck of a `wait` stage: a recheck's `done` ends the wait, so an open pull request with no deciding review answers `skipped`. */
164
+ wait_for_review: import("@kana-ai/edgar-sdk").Tool<{
165
+ url: string;
166
+ }, {
167
+ url: string;
168
+ state: "closed" | "merged" | "open";
169
+ merged: boolean;
170
+ review_state: "approved" | "changes_requested" | "pending";
171
+ approved_by: string[];
172
+ card: string | null;
173
+ commit: string;
174
+ branch: string;
175
+ head_repo: string | null;
176
+ }, "GITHUB_TOKEN">;
177
+ /** The recheck of a `wait` stage that ends on the merge or the close of a pull request, and on nothing else, so an approval does not end it. */
178
+ wait_for_merge: import("@kana-ai/edgar-sdk").Tool<{
179
+ url: string;
180
+ }, {
181
+ url: string;
182
+ merged: boolean;
183
+ sha?: string | undefined;
184
+ }, "GITHUB_TOKEN">;
185
+ /** Merges `commit` only: the approval a person gave covers that commit, and GitHub answers 409 when the head has moved. A retry after a lost answer gets 405 for the merge its earlier attempt made: a `tool_error` reads the pull request back and returns its merge commit when it is merged at `commit`; a merge at another head is `invalid`. */
186
+ merge_pull_request: import("@kana-ai/edgar-sdk").Tool<{
187
+ url: string;
188
+ commit: string;
189
+ changed_files?: number | undefined;
190
+ }, {
191
+ url: string;
192
+ merged: boolean;
193
+ commit: string;
194
+ }, "GITHUB_TOKEN">;
195
+ };