patchwork-os 0.2.0-alpha.21 → 0.2.0-alpha.22

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 (169) hide show
  1. package/README.md +26 -12
  2. package/deploy/bootstrap-vps.sh +184 -0
  3. package/dist/approvalHttp.js +6 -1
  4. package/dist/approvalHttp.js.map +1 -1
  5. package/dist/automation.d.ts +20 -0
  6. package/dist/automation.js +35 -0
  7. package/dist/automation.js.map +1 -1
  8. package/dist/bridge.js +22 -4
  9. package/dist/bridge.js.map +1 -1
  10. package/dist/bridgeToken.js +57 -19
  11. package/dist/bridgeToken.js.map +1 -1
  12. package/dist/commands/recipe.d.ts +256 -0
  13. package/dist/commands/recipe.js +1313 -0
  14. package/dist/commands/recipe.js.map +1 -0
  15. package/dist/config.d.ts +8 -0
  16. package/dist/config.js +9 -0
  17. package/dist/config.js.map +1 -1
  18. package/dist/connectors/baseConnector.d.ts +117 -0
  19. package/dist/connectors/baseConnector.js +213 -0
  20. package/dist/connectors/baseConnector.js.map +1 -0
  21. package/dist/connectors/confluence.d.ts +111 -0
  22. package/dist/connectors/confluence.js +406 -0
  23. package/dist/connectors/confluence.js.map +1 -0
  24. package/dist/connectors/fixtureLibrary.d.ts +21 -0
  25. package/dist/connectors/fixtureLibrary.js +70 -0
  26. package/dist/connectors/fixtureLibrary.js.map +1 -0
  27. package/dist/connectors/fixtureRecorder.d.ts +1 -0
  28. package/dist/connectors/fixtureRecorder.js +35 -0
  29. package/dist/connectors/fixtureRecorder.js.map +1 -0
  30. package/dist/connectors/github.js +2 -11
  31. package/dist/connectors/github.js.map +1 -1
  32. package/dist/connectors/gmail.js +23 -7
  33. package/dist/connectors/gmail.js.map +1 -1
  34. package/dist/connectors/googleCalendar.js +23 -7
  35. package/dist/connectors/googleCalendar.js.map +1 -1
  36. package/dist/connectors/jira.d.ts +98 -0
  37. package/dist/connectors/jira.js +379 -0
  38. package/dist/connectors/jira.js.map +1 -0
  39. package/dist/connectors/linear.js +2 -11
  40. package/dist/connectors/linear.js.map +1 -1
  41. package/dist/connectors/mcpOAuth.d.ts +1 -0
  42. package/dist/connectors/mcpOAuth.js +30 -4
  43. package/dist/connectors/mcpOAuth.js.map +1 -1
  44. package/dist/connectors/mockConnector.d.ts +28 -0
  45. package/dist/connectors/mockConnector.js +81 -0
  46. package/dist/connectors/mockConnector.js.map +1 -0
  47. package/dist/connectors/notion.d.ts +143 -0
  48. package/dist/connectors/notion.js +424 -0
  49. package/dist/connectors/notion.js.map +1 -0
  50. package/dist/connectors/sentry.js +2 -11
  51. package/dist/connectors/sentry.js.map +1 -1
  52. package/dist/connectors/slack.js +50 -15
  53. package/dist/connectors/slack.js.map +1 -1
  54. package/dist/connectors/tokenStorage.d.ts +35 -0
  55. package/dist/connectors/tokenStorage.js +394 -0
  56. package/dist/connectors/tokenStorage.js.map +1 -0
  57. package/dist/connectors/zendesk.d.ts +104 -0
  58. package/dist/connectors/zendesk.js +424 -0
  59. package/dist/connectors/zendesk.js.map +1 -0
  60. package/dist/featureFlags.d.ts +73 -0
  61. package/dist/featureFlags.js +203 -0
  62. package/dist/featureFlags.js.map +1 -0
  63. package/dist/fp/automationInterpreter.js +1 -0
  64. package/dist/fp/automationInterpreter.js.map +1 -1
  65. package/dist/fp/automationProgram.d.ts +1 -1
  66. package/dist/fp/automationProgram.js.map +1 -1
  67. package/dist/fp/policyParser.js +17 -0
  68. package/dist/fp/policyParser.js.map +1 -1
  69. package/dist/index.js +508 -36
  70. package/dist/index.js.map +1 -1
  71. package/dist/oauth.d.ts +4 -1
  72. package/dist/oauth.js +50 -14
  73. package/dist/oauth.js.map +1 -1
  74. package/dist/recipes/chainedRunner.d.ts +104 -0
  75. package/dist/recipes/chainedRunner.js +359 -0
  76. package/dist/recipes/chainedRunner.js.map +1 -0
  77. package/dist/recipes/dependencyGraph.d.ts +39 -0
  78. package/dist/recipes/dependencyGraph.js +199 -0
  79. package/dist/recipes/dependencyGraph.js.map +1 -0
  80. package/dist/recipes/legacyRecipeCompat.d.ts +1 -0
  81. package/dist/recipes/legacyRecipeCompat.js +97 -0
  82. package/dist/recipes/legacyRecipeCompat.js.map +1 -0
  83. package/dist/recipes/nestedRecipeStep.d.ts +58 -0
  84. package/dist/recipes/nestedRecipeStep.js +95 -0
  85. package/dist/recipes/nestedRecipeStep.js.map +1 -0
  86. package/dist/recipes/outputRegistry.d.ts +28 -0
  87. package/dist/recipes/outputRegistry.js +52 -0
  88. package/dist/recipes/outputRegistry.js.map +1 -0
  89. package/dist/recipes/schemaGenerator.d.ts +28 -0
  90. package/dist/recipes/schemaGenerator.js +484 -0
  91. package/dist/recipes/schemaGenerator.js.map +1 -0
  92. package/dist/recipes/templateEngine.d.ts +62 -0
  93. package/dist/recipes/templateEngine.js +182 -0
  94. package/dist/recipes/templateEngine.js.map +1 -0
  95. package/dist/recipes/toolRegistry.d.ts +181 -0
  96. package/dist/recipes/toolRegistry.js +300 -0
  97. package/dist/recipes/toolRegistry.js.map +1 -0
  98. package/dist/recipes/tools/calendar.d.ts +6 -0
  99. package/dist/recipes/tools/calendar.js +61 -0
  100. package/dist/recipes/tools/calendar.js.map +1 -0
  101. package/dist/recipes/tools/confluence.d.ts +6 -0
  102. package/dist/recipes/tools/confluence.js +254 -0
  103. package/dist/recipes/tools/confluence.js.map +1 -0
  104. package/dist/recipes/tools/diagnostics.d.ts +6 -0
  105. package/dist/recipes/tools/diagnostics.js +36 -0
  106. package/dist/recipes/tools/diagnostics.js.map +1 -0
  107. package/dist/recipes/tools/file.d.ts +6 -0
  108. package/dist/recipes/tools/file.js +170 -0
  109. package/dist/recipes/tools/file.js.map +1 -0
  110. package/dist/recipes/tools/git.d.ts +6 -0
  111. package/dist/recipes/tools/git.js +63 -0
  112. package/dist/recipes/tools/git.js.map +1 -0
  113. package/dist/recipes/tools/github.d.ts +6 -0
  114. package/dist/recipes/tools/github.js +91 -0
  115. package/dist/recipes/tools/github.js.map +1 -0
  116. package/dist/recipes/tools/gmail.d.ts +6 -0
  117. package/dist/recipes/tools/gmail.js +210 -0
  118. package/dist/recipes/tools/gmail.js.map +1 -0
  119. package/dist/recipes/tools/index.d.ts +18 -0
  120. package/dist/recipes/tools/index.js +21 -0
  121. package/dist/recipes/tools/index.js.map +1 -0
  122. package/dist/recipes/tools/linear.d.ts +6 -0
  123. package/dist/recipes/tools/linear.js +83 -0
  124. package/dist/recipes/tools/linear.js.map +1 -0
  125. package/dist/recipes/tools/notion.d.ts +6 -0
  126. package/dist/recipes/tools/notion.js +278 -0
  127. package/dist/recipes/tools/notion.js.map +1 -0
  128. package/dist/recipes/tools/slack.d.ts +6 -0
  129. package/dist/recipes/tools/slack.js +72 -0
  130. package/dist/recipes/tools/slack.js.map +1 -0
  131. package/dist/recipes/tools/zendesk.d.ts +6 -0
  132. package/dist/recipes/tools/zendesk.js +245 -0
  133. package/dist/recipes/tools/zendesk.js.map +1 -0
  134. package/dist/recipes/yamlRunner.d.ts +71 -7
  135. package/dist/recipes/yamlRunner.js +406 -439
  136. package/dist/recipes/yamlRunner.js.map +1 -1
  137. package/dist/riskTier.js +1 -0
  138. package/dist/riskTier.js.map +1 -1
  139. package/dist/runLog.d.ts +18 -0
  140. package/dist/runLog.js +5 -0
  141. package/dist/runLog.js.map +1 -1
  142. package/dist/server.d.ts +4 -0
  143. package/dist/server.js +224 -0
  144. package/dist/server.js.map +1 -1
  145. package/dist/streamableHttp.js +2 -0
  146. package/dist/streamableHttp.js.map +1 -1
  147. package/dist/tools/github/actions.js +4 -2
  148. package/dist/tools/github/actions.js.map +1 -1
  149. package/dist/tools/github/composite.d.ts +339 -0
  150. package/dist/tools/github/composite.js +343 -0
  151. package/dist/tools/github/composite.js.map +1 -0
  152. package/dist/tools/github/index.d.ts +1 -0
  153. package/dist/tools/github/index.js +1 -0
  154. package/dist/tools/github/index.js.map +1 -1
  155. package/dist/tools/github/issues.js +8 -4
  156. package/dist/tools/github/issues.js.map +1 -1
  157. package/dist/tools/github/pr.js +14 -7
  158. package/dist/tools/github/pr.js.map +1 -1
  159. package/dist/tools/index.js +10 -1
  160. package/dist/tools/index.js.map +1 -1
  161. package/dist/tools/searchTools.js +1 -1
  162. package/dist/tools/searchTools.js.map +1 -1
  163. package/dist/transport.d.ts +7 -1
  164. package/dist/transport.js +85 -11
  165. package/dist/transport.js.map +1 -1
  166. package/package.json +1 -1
  167. package/templates/automation-policies/recipe-authoring.json +25 -0
  168. package/templates/automation-policy.example.json +6 -0
  169. package/templates/recipes/lint-on-save.yaml +1 -2
@@ -0,0 +1,339 @@
1
+ import type { PullRequestCallbackResult } from "./pr.js";
2
+ export declare function createGithubPRTool(workspace: string, onPullRequest?: (result: PullRequestCallbackResult) => void, _defaultRepo?: string | null): {
3
+ schema: {
4
+ name: string;
5
+ description: string;
6
+ annotations: {
7
+ openWorldHint: boolean;
8
+ };
9
+ inputSchema: {
10
+ type: "object";
11
+ required: string[];
12
+ properties: {
13
+ operation: {
14
+ type: string;
15
+ enum: string[];
16
+ description: string;
17
+ };
18
+ title: {
19
+ type: string;
20
+ description: string;
21
+ };
22
+ body: {
23
+ type: string;
24
+ description: string;
25
+ };
26
+ base: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ draft: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ assignee: {
35
+ type: string;
36
+ description: string;
37
+ };
38
+ number: {
39
+ type: string;
40
+ description: string;
41
+ };
42
+ prNumber: {
43
+ type: string;
44
+ description: string;
45
+ };
46
+ repo: {
47
+ type: string;
48
+ description: string;
49
+ };
50
+ state: {
51
+ type: string;
52
+ enum: string[];
53
+ description: string;
54
+ };
55
+ limit: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ author: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ comments: {
64
+ type: string;
65
+ description: string;
66
+ items: {
67
+ type: string;
68
+ };
69
+ };
70
+ event: {
71
+ type: string;
72
+ enum: string[];
73
+ description: string;
74
+ };
75
+ mergeMethod: {
76
+ type: string;
77
+ enum: string[];
78
+ description: string;
79
+ };
80
+ commitTitle: {
81
+ type: string;
82
+ description: string;
83
+ };
84
+ commitMessage: {
85
+ type: string;
86
+ description: string;
87
+ };
88
+ };
89
+ additionalProperties: false;
90
+ };
91
+ outputSchema: {
92
+ type: string;
93
+ description: string;
94
+ properties: {
95
+ url: {
96
+ type: string;
97
+ };
98
+ number: {
99
+ type: string[];
100
+ };
101
+ title: {
102
+ type: string;
103
+ };
104
+ prs: {
105
+ type: string;
106
+ };
107
+ count: {
108
+ type: string;
109
+ };
110
+ state: {
111
+ type: string;
112
+ };
113
+ body: {
114
+ type: string;
115
+ };
116
+ diff: {
117
+ type: string;
118
+ };
119
+ truncated: {
120
+ type: string;
121
+ };
122
+ reviewId: {
123
+ type: string[];
124
+ };
125
+ commentsPosted: {
126
+ type: string;
127
+ };
128
+ event: {
129
+ type: string;
130
+ };
131
+ merged: {
132
+ type: string;
133
+ };
134
+ sha: {
135
+ type: string;
136
+ };
137
+ message: {
138
+ type: string;
139
+ };
140
+ };
141
+ };
142
+ };
143
+ handler: (args: Record<string, unknown>, signal?: AbortSignal) => Promise<{
144
+ content: Array<{
145
+ type: string;
146
+ text: string;
147
+ }>;
148
+ structuredContent: unknown;
149
+ } | {
150
+ content: Array<{
151
+ type: string;
152
+ text: string;
153
+ }>;
154
+ isError: true;
155
+ }>;
156
+ };
157
+ export declare function createGithubIssueTool(workspace: string): {
158
+ schema: {
159
+ name: string;
160
+ description: string;
161
+ annotations: {
162
+ openWorldHint: boolean;
163
+ };
164
+ inputSchema: {
165
+ type: "object";
166
+ required: string[];
167
+ properties: {
168
+ operation: {
169
+ type: string;
170
+ enum: string[];
171
+ description: string;
172
+ };
173
+ number: {
174
+ type: string;
175
+ description: string;
176
+ };
177
+ title: {
178
+ type: string;
179
+ description: string;
180
+ };
181
+ body: {
182
+ type: string;
183
+ description: string;
184
+ };
185
+ assignee: {
186
+ type: string;
187
+ description: string;
188
+ };
189
+ label: {
190
+ type: string;
191
+ description: string;
192
+ };
193
+ milestone: {
194
+ type: string;
195
+ description: string;
196
+ };
197
+ state: {
198
+ type: string;
199
+ enum: string[];
200
+ description: string;
201
+ };
202
+ limit: {
203
+ type: string;
204
+ description: string;
205
+ };
206
+ };
207
+ additionalProperties: false;
208
+ };
209
+ outputSchema: {
210
+ type: string;
211
+ description: string;
212
+ properties: {
213
+ issues: {
214
+ type: string;
215
+ };
216
+ count: {
217
+ type: string;
218
+ };
219
+ number: {
220
+ type: string;
221
+ };
222
+ title: {
223
+ type: string;
224
+ };
225
+ state: {
226
+ type: string;
227
+ };
228
+ url: {
229
+ type: string;
230
+ };
231
+ body: {
232
+ type: string[];
233
+ };
234
+ issueNumber: {
235
+ type: string;
236
+ };
237
+ };
238
+ };
239
+ };
240
+ handler: (args: Record<string, unknown>, signal?: AbortSignal) => Promise<{
241
+ content: Array<{
242
+ type: string;
243
+ text: string;
244
+ }>;
245
+ structuredContent: unknown;
246
+ } | {
247
+ content: Array<{
248
+ type: string;
249
+ text: string;
250
+ }>;
251
+ isError: true;
252
+ }>;
253
+ };
254
+ export declare function createGithubActionsTool(workspace: string, defaultRepo?: string | null): {
255
+ schema: {
256
+ name: string;
257
+ description: string;
258
+ annotations: {
259
+ readOnlyHint: boolean;
260
+ openWorldHint: boolean;
261
+ };
262
+ inputSchema: {
263
+ type: "object";
264
+ required: string[];
265
+ properties: {
266
+ operation: {
267
+ type: string;
268
+ enum: string[];
269
+ description: string;
270
+ };
271
+ branch: {
272
+ type: string;
273
+ description: string;
274
+ };
275
+ workflow: {
276
+ type: string;
277
+ description: string;
278
+ };
279
+ status: {
280
+ type: string;
281
+ description: string;
282
+ };
283
+ limit: {
284
+ type: string;
285
+ description: string;
286
+ };
287
+ runId: {
288
+ type: string;
289
+ description: string;
290
+ };
291
+ failedOnly: {
292
+ type: string;
293
+ description: string;
294
+ };
295
+ };
296
+ additionalProperties: false;
297
+ };
298
+ outputSchema: {
299
+ type: string;
300
+ description: string;
301
+ properties: {
302
+ runs: {
303
+ type: string;
304
+ };
305
+ count: {
306
+ type: string;
307
+ };
308
+ runId: {
309
+ type: string;
310
+ };
311
+ failedOnly: {
312
+ type: string;
313
+ };
314
+ logs: {
315
+ type: string;
316
+ };
317
+ truncated: {
318
+ type: string;
319
+ };
320
+ note: {
321
+ type: string;
322
+ };
323
+ };
324
+ };
325
+ };
326
+ handler: (args: Record<string, unknown>, signal?: AbortSignal) => Promise<{
327
+ content: Array<{
328
+ type: string;
329
+ text: string;
330
+ }>;
331
+ structuredContent: unknown;
332
+ } | {
333
+ content: Array<{
334
+ type: string;
335
+ text: string;
336
+ }>;
337
+ isError: true;
338
+ }>;
339
+ };
@@ -0,0 +1,343 @@
1
+ import { error } from "../utils.js";
2
+ import { createGithubGetRunLogsTool, createGithubListRunsTool, } from "./actions.js";
3
+ import { createGithubCommentIssueTool, createGithubCreateIssueTool, createGithubGetIssueTool, createGithubListIssuesTool, } from "./issues.js";
4
+ import { createGithubApprovePRTool, createGithubCreatePRTool, createGithubGetPRDiffTool, createGithubListPRsTool, createGithubMergePRTool, createGithubPostPRReviewTool, createGithubViewPRTool, } from "./pr.js";
5
+ export function createGithubPRTool(workspace, onPullRequest, _defaultRepo = null) {
6
+ const createPR = createGithubCreatePRTool(workspace, onPullRequest);
7
+ const viewPR = createGithubViewPRTool(workspace);
8
+ const listPRs = createGithubListPRsTool(workspace);
9
+ const getDiff = createGithubGetPRDiffTool(workspace);
10
+ const postReview = createGithubPostPRReviewTool(workspace);
11
+ const approvePR = createGithubApprovePRTool(workspace);
12
+ const mergePR = createGithubMergePRTool(workspace);
13
+ return {
14
+ schema: {
15
+ name: "githubPR",
16
+ description: "Composite GitHub pull request tool. Dispatches to the appropriate operation based on 'operation' field.\n" +
17
+ "Operations:\n" +
18
+ " create — Create a PR (title required; optional: body, base, draft, assignee)\n" +
19
+ " view — View PR details (optional: number — omit for current branch)\n" +
20
+ " list — List PRs (optional: state, limit, author)\n" +
21
+ " getDiff — Fetch full diff + metadata (prNumber required; optional: repo)\n" +
22
+ " postReview — Post a code review COMMENT or REQUEST_CHANGES (prNumber, body required; optional: comments, event, repo)\n" +
23
+ " approve — Approve a PR (prNumber required; optional: body, repo)\n" +
24
+ " merge — Merge a PR (prNumber required; optional: mergeMethod, commitTitle, commitMessage, repo)",
25
+ annotations: { openWorldHint: true },
26
+ inputSchema: {
27
+ type: "object",
28
+ required: ["operation"],
29
+ properties: {
30
+ operation: {
31
+ type: "string",
32
+ enum: [
33
+ "create",
34
+ "view",
35
+ "list",
36
+ "getDiff",
37
+ "postReview",
38
+ "approve",
39
+ "merge",
40
+ ],
41
+ description: "Which PR operation to perform",
42
+ },
43
+ // create
44
+ title: { type: "string", description: "PR title (create)" },
45
+ body: {
46
+ type: "string",
47
+ description: "PR body / review body (create, postReview, approve)",
48
+ },
49
+ base: { type: "string", description: "Base branch (create)" },
50
+ draft: {
51
+ type: "boolean",
52
+ description: "Draft PR flag (create)",
53
+ },
54
+ assignee: {
55
+ type: "string",
56
+ description: "Assignee username (create)",
57
+ },
58
+ // view / approve / merge / getDiff / postReview
59
+ number: {
60
+ type: "integer",
61
+ description: "PR number (view — omit for current branch)",
62
+ },
63
+ prNumber: {
64
+ type: "integer",
65
+ description: "PR number (getDiff, postReview, approve, merge)",
66
+ },
67
+ repo: {
68
+ type: "string",
69
+ description: "owner/repo override (getDiff, postReview, approve, merge)",
70
+ },
71
+ // list
72
+ state: {
73
+ type: "string",
74
+ enum: ["open", "closed", "merged", "all"],
75
+ description: "PR state filter (list)",
76
+ },
77
+ limit: {
78
+ type: "integer",
79
+ description: "Max results (list)",
80
+ },
81
+ author: {
82
+ type: "string",
83
+ description: "Filter by author (list)",
84
+ },
85
+ // postReview
86
+ comments: {
87
+ type: "array",
88
+ description: "Inline review comments (postReview)",
89
+ items: { type: "object" },
90
+ },
91
+ event: {
92
+ type: "string",
93
+ enum: ["COMMENT", "REQUEST_CHANGES"],
94
+ description: "Review event type (postReview)",
95
+ },
96
+ // merge
97
+ mergeMethod: {
98
+ type: "string",
99
+ enum: ["merge", "squash", "rebase"],
100
+ description: "Merge strategy (merge)",
101
+ },
102
+ commitTitle: {
103
+ type: "string",
104
+ description: "Merge commit title (merge)",
105
+ },
106
+ commitMessage: {
107
+ type: "string",
108
+ description: "Merge commit message (merge)",
109
+ },
110
+ },
111
+ additionalProperties: false,
112
+ },
113
+ outputSchema: {
114
+ type: "object",
115
+ description: "Result shape varies by operation — see individual tool outputSchemas",
116
+ properties: {
117
+ // create
118
+ url: { type: "string" },
119
+ number: { type: ["integer", "null"] },
120
+ title: { type: "string" },
121
+ // list
122
+ prs: { type: "array" },
123
+ count: { type: "integer" },
124
+ // view
125
+ state: { type: "string" },
126
+ body: { type: "string" },
127
+ // getDiff
128
+ diff: { type: "string" },
129
+ truncated: { type: "boolean" },
130
+ // postReview / approve
131
+ reviewId: { type: ["integer", "null"] },
132
+ commentsPosted: { type: "integer" },
133
+ event: { type: "string" },
134
+ // merge
135
+ merged: { type: "boolean" },
136
+ sha: { type: "string" },
137
+ message: { type: "string" },
138
+ },
139
+ },
140
+ },
141
+ handler: async (args, signal) => {
142
+ const operation = args.operation;
143
+ const rest = { ...args };
144
+ delete rest.operation;
145
+ switch (operation) {
146
+ case "create":
147
+ return createPR.handler(rest, signal);
148
+ case "view":
149
+ return viewPR.handler(rest, signal);
150
+ case "list":
151
+ return listPRs.handler(rest, signal);
152
+ case "getDiff":
153
+ return getDiff.handler(rest, signal);
154
+ case "postReview":
155
+ return postReview.handler(rest, signal);
156
+ case "approve":
157
+ return approvePR.handler(rest, signal);
158
+ case "merge":
159
+ return mergePR.handler(rest, signal);
160
+ default:
161
+ return error(`Unknown operation "${operation}". Must be one of: create, view, list, getDiff, postReview, approve, merge.`);
162
+ }
163
+ },
164
+ };
165
+ }
166
+ export function createGithubIssueTool(workspace) {
167
+ const listIssues = createGithubListIssuesTool(workspace);
168
+ const getIssue = createGithubGetIssueTool(workspace);
169
+ const createIssue = createGithubCreateIssueTool(workspace);
170
+ const commentIssue = createGithubCommentIssueTool(workspace);
171
+ return {
172
+ schema: {
173
+ name: "githubIssue",
174
+ description: "Composite GitHub issue tool. Dispatches to the appropriate operation based on 'operation' field.\n" +
175
+ "Operations:\n" +
176
+ " list — List issues (optional: state, limit, assignee, label, milestone)\n" +
177
+ " get — View full issue details (number required)\n" +
178
+ " create — Create a new issue (title required; optional: body, assignee, label, milestone)\n" +
179
+ " comment — Add a comment to an issue (number, body required)",
180
+ annotations: { openWorldHint: true },
181
+ inputSchema: {
182
+ type: "object",
183
+ required: ["operation"],
184
+ properties: {
185
+ operation: {
186
+ type: "string",
187
+ enum: ["list", "get", "create", "comment"],
188
+ description: "Which issue operation to perform",
189
+ },
190
+ // get / comment
191
+ number: {
192
+ type: "integer",
193
+ description: "Issue number (get, comment)",
194
+ },
195
+ // create
196
+ title: { type: "string", description: "Issue title (create)" },
197
+ body: {
198
+ type: "string",
199
+ description: "Issue body or comment body (create, comment)",
200
+ },
201
+ assignee: {
202
+ type: "string",
203
+ description: "Assignee username (create, list)",
204
+ },
205
+ label: {
206
+ type: "string",
207
+ description: "Label filter or label to apply (list, create)",
208
+ },
209
+ milestone: {
210
+ type: "string",
211
+ description: "Milestone filter or title (list, create)",
212
+ },
213
+ // list
214
+ state: {
215
+ type: "string",
216
+ enum: ["open", "closed", "all"],
217
+ description: "Issue state filter (list)",
218
+ },
219
+ limit: {
220
+ type: "integer",
221
+ description: "Max results (list)",
222
+ },
223
+ },
224
+ additionalProperties: false,
225
+ },
226
+ outputSchema: {
227
+ type: "object",
228
+ description: "Result shape varies by operation",
229
+ properties: {
230
+ // list
231
+ issues: { type: "array" },
232
+ count: { type: "integer" },
233
+ // get
234
+ number: { type: "integer" },
235
+ title: { type: "string" },
236
+ state: { type: "string" },
237
+ url: { type: "string" },
238
+ body: { type: ["string", "null"] },
239
+ // comment
240
+ issueNumber: { type: "integer" },
241
+ },
242
+ },
243
+ },
244
+ handler: async (args, signal) => {
245
+ const operation = args.operation;
246
+ const rest = { ...args };
247
+ delete rest.operation;
248
+ switch (operation) {
249
+ case "list":
250
+ return listIssues.handler(rest, signal);
251
+ case "get":
252
+ return getIssue.handler(rest, signal);
253
+ case "create":
254
+ return createIssue.handler(rest, signal);
255
+ case "comment":
256
+ return commentIssue.handler(rest, signal);
257
+ default:
258
+ return error(`Unknown operation "${operation}". Must be one of: list, get, create, comment.`);
259
+ }
260
+ },
261
+ };
262
+ }
263
+ export function createGithubActionsTool(workspace, defaultRepo = null) {
264
+ const listRuns = createGithubListRunsTool(workspace, defaultRepo);
265
+ const getRunLogs = createGithubGetRunLogsTool(workspace, defaultRepo);
266
+ return {
267
+ schema: {
268
+ name: "githubActions",
269
+ description: "Composite GitHub Actions tool. Dispatches to the appropriate operation based on 'operation' field.\n" +
270
+ "Operations:\n" +
271
+ " listRuns — List workflow runs (optional: branch, workflow, status, limit)\n" +
272
+ " getRunLogs — Fetch run logs (runId required; optional: failedOnly)",
273
+ annotations: { readOnlyHint: true, openWorldHint: true },
274
+ inputSchema: {
275
+ type: "object",
276
+ required: ["operation"],
277
+ properties: {
278
+ operation: {
279
+ type: "string",
280
+ enum: ["listRuns", "getRunLogs"],
281
+ description: "Which Actions operation to perform",
282
+ },
283
+ // listRuns
284
+ branch: {
285
+ type: "string",
286
+ description: "Filter by branch (listRuns)",
287
+ },
288
+ workflow: {
289
+ type: "string",
290
+ description: "Filter by workflow file or name (listRuns)",
291
+ },
292
+ status: {
293
+ type: "string",
294
+ description: "Filter by status (listRuns)",
295
+ },
296
+ limit: {
297
+ type: "integer",
298
+ description: "Max results (listRuns)",
299
+ },
300
+ // getRunLogs
301
+ runId: {
302
+ type: "integer",
303
+ description: "Workflow run databaseId (getRunLogs)",
304
+ },
305
+ failedOnly: {
306
+ type: "boolean",
307
+ description: "Only failed step logs (getRunLogs, default: true)",
308
+ },
309
+ },
310
+ additionalProperties: false,
311
+ },
312
+ outputSchema: {
313
+ type: "object",
314
+ description: "Result shape varies by operation",
315
+ properties: {
316
+ // listRuns
317
+ runs: { type: "array" },
318
+ count: { type: "integer" },
319
+ // getRunLogs
320
+ runId: { type: "integer" },
321
+ failedOnly: { type: "boolean" },
322
+ logs: { type: "string" },
323
+ truncated: { type: "boolean" },
324
+ note: { type: "string" },
325
+ },
326
+ },
327
+ },
328
+ handler: async (args, signal) => {
329
+ const operation = args.operation;
330
+ const rest = { ...args };
331
+ delete rest.operation;
332
+ switch (operation) {
333
+ case "listRuns":
334
+ return listRuns.handler(rest, signal);
335
+ case "getRunLogs":
336
+ return getRunLogs.handler(rest, signal);
337
+ default:
338
+ return error(`Unknown operation "${operation}". Must be one of: listRuns, getRunLogs.`);
339
+ }
340
+ },
341
+ };
342
+ }
343
+ //# sourceMappingURL=composite.js.map