@eduardo191labs/opencode-actions 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.
- package/LICENSE +22 -0
- package/README.md +311 -2
- package/action.yml +251 -0
- package/dist/actions.d.ts +351 -0
- package/dist/actions.js +561 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +180 -0
- package/dist/commands.d.ts +23 -0
- package/dist/commands.js +120 -0
- package/dist/compile.d.ts +49 -0
- package/dist/compile.js +217 -0
- package/dist/config.d.ts +306 -0
- package/dist/config.js +133 -0
- package/dist/detect.d.ts +55 -0
- package/dist/detect.js +215 -0
- package/dist/format.d.ts +79 -0
- package/dist/format.js +168 -0
- package/dist/git.d.ts +38 -0
- package/dist/git.js +125 -0
- package/dist/github.d.ts +213 -0
- package/dist/github.js +227 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/install.d.ts +2 -0
- package/dist/install.js +299 -0
- package/dist/loader.d.ts +54 -0
- package/dist/loader.js +306 -0
- package/dist/mcp-server.d.ts +16 -0
- package/dist/mcp-server.js +402 -0
- package/dist/prompts.d.ts +70 -0
- package/dist/prompts.js +260 -0
- package/dist/runner.d.ts +108 -0
- package/dist/runner.js +318 -0
- package/dist/summary.d.ts +2 -0
- package/dist/summary.js +99 -0
- package/package.json +57 -4
- package/schemas/opencode-actions.schema.json +527 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MCP server that exposes GitHub operations to the OpenCode agent.
|
|
4
|
+
*
|
|
5
|
+
* OpenCode launches this over stdio. The server implements the Model Context
|
|
6
|
+
* Protocol by hand (JSON-RPC 2.0 framed by newlines) so the package has no
|
|
7
|
+
* runtime dependencies.
|
|
8
|
+
*
|
|
9
|
+
* Every tool re-checks the bot configuration before acting, so a tool cannot
|
|
10
|
+
* bypass `bot.permissions` even if the agent decides to call it directly.
|
|
11
|
+
*/
|
|
12
|
+
import { createInterface } from "node:readline";
|
|
13
|
+
import { GitHub, repoFromEnv, tokenFromEnv } from "./github.js";
|
|
14
|
+
import { bot, permission } from "./config.js";
|
|
15
|
+
import { parseConfigText, mergeConfig } from "./loader.js";
|
|
16
|
+
import { DEFAULT_CONFIG } from "./config.js";
|
|
17
|
+
const TOOLS = [
|
|
18
|
+
{
|
|
19
|
+
name: "github_get_pull_request",
|
|
20
|
+
description: "Read a pull request: title, body, branches, stats and the list of changed files with their patches.",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: { number: { type: "number", description: "Pull request number" } },
|
|
24
|
+
required: ["number"],
|
|
25
|
+
},
|
|
26
|
+
async handler({ number }, { github, repo, config }) {
|
|
27
|
+
const pull = await github.getPull(repo, number);
|
|
28
|
+
const files = await github.listPullFiles(repo, number);
|
|
29
|
+
const review = bot(config).review ?? {};
|
|
30
|
+
const maxKb = (review.max_diff_kb ?? 256) * 1024;
|
|
31
|
+
return {
|
|
32
|
+
number: pull.number,
|
|
33
|
+
title: pull.title,
|
|
34
|
+
body: pull.body,
|
|
35
|
+
base: pull.base.ref,
|
|
36
|
+
head: pull.head.ref,
|
|
37
|
+
draft: pull.draft,
|
|
38
|
+
changedFiles: files.map((file) => ({
|
|
39
|
+
filename: file.filename,
|
|
40
|
+
status: file.status,
|
|
41
|
+
additions: file.additions,
|
|
42
|
+
deletions: file.deletions,
|
|
43
|
+
})),
|
|
44
|
+
patch: files
|
|
45
|
+
.filter((file) => file.patch)
|
|
46
|
+
.map((file) => `--- ${file.filename}\n${file.patch}`)
|
|
47
|
+
.join("\n")
|
|
48
|
+
.slice(0, maxKb),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "github_get_issue",
|
|
54
|
+
description: "Read an issue with its labels and recent comments.",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
number: { type: "number" },
|
|
59
|
+
comments: { type: "boolean", description: "Include recent comments" },
|
|
60
|
+
},
|
|
61
|
+
required: ["number"],
|
|
62
|
+
},
|
|
63
|
+
async handler({ number, comments }, { github, repo }) {
|
|
64
|
+
const issue = await github.getIssue(repo, number);
|
|
65
|
+
let discussion = [];
|
|
66
|
+
if (comments) {
|
|
67
|
+
const list = await github.paginate(`/repos/${repo.owner}/${repo.repo}/issues/${number}/comments?per_page=100`, 2);
|
|
68
|
+
discussion = list.slice(-20).map((c) => `@${c.user.login}: ${c.body}`);
|
|
69
|
+
}
|
|
70
|
+
return { number: issue.number, title: issue.title, body: issue.body, state: issue.state, labels: issue.labels.map((l) => l.name), discussion };
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "github_comment",
|
|
75
|
+
description: "Post a comment on an issue or pull request. Respects bot.permissions.comment.",
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
number: { type: "number" },
|
|
80
|
+
body: { type: "string", description: "Markdown body" },
|
|
81
|
+
},
|
|
82
|
+
required: ["number", "body"],
|
|
83
|
+
},
|
|
84
|
+
async handler({ number, body }, { github, repo, config }) {
|
|
85
|
+
deny(config, "comment");
|
|
86
|
+
const result = await github.comment(repo, number, body);
|
|
87
|
+
return { posted: true, id: result?.id };
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "github_create_review",
|
|
92
|
+
description: "Create a pull request review. Inline comments must target lines present in the diff. Respects review permissions.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
number: { type: "number" },
|
|
97
|
+
body: { type: "string" },
|
|
98
|
+
event: { type: "string", enum: ["COMMENT", "APPROVE", "REQUEST_CHANGES"] },
|
|
99
|
+
comments: {
|
|
100
|
+
type: "array",
|
|
101
|
+
items: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
path: { type: "string" },
|
|
105
|
+
line: { type: "number" },
|
|
106
|
+
side: { type: "string", enum: ["LEFT", "RIGHT"] },
|
|
107
|
+
body: { type: "string" },
|
|
108
|
+
},
|
|
109
|
+
required: ["path", "line", "body"],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
required: ["number", "body"],
|
|
114
|
+
},
|
|
115
|
+
async handler({ number, body, event, comments }, { github, repo, config }) {
|
|
116
|
+
deny(config, "comment");
|
|
117
|
+
return github.createReview(repo, number, { body, event: event ?? "COMMENT", comments });
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "github_create_issue",
|
|
122
|
+
description: "Open an issue. Respects bot.permissions.manage_issues.",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
title: { type: "string" },
|
|
127
|
+
body: { type: "string" },
|
|
128
|
+
labels: { type: "array", items: { type: "string" } },
|
|
129
|
+
assignees: { type: "array", items: { type: "string" } },
|
|
130
|
+
},
|
|
131
|
+
required: ["title"],
|
|
132
|
+
},
|
|
133
|
+
async handler(args, { github, repo, config }) {
|
|
134
|
+
deny(config, "manage_issues");
|
|
135
|
+
const issue = await github.createIssue(repo, {
|
|
136
|
+
title: args.title,
|
|
137
|
+
body: args.body,
|
|
138
|
+
labels: args.labels,
|
|
139
|
+
assignees: args.assignees,
|
|
140
|
+
});
|
|
141
|
+
return { number: issue.number, url: issue.html_url };
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "github_update_issue",
|
|
146
|
+
description: "Edit, close or reopen an issue. Respects bot.permissions.manage_issues.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
number: { type: "number" },
|
|
151
|
+
title: { type: "string" },
|
|
152
|
+
body: { type: "string" },
|
|
153
|
+
state: { type: "string", enum: ["open", "closed"] },
|
|
154
|
+
labels: { type: "array", items: { type: "string" } },
|
|
155
|
+
assignees: { type: "array", items: { type: "string" } },
|
|
156
|
+
},
|
|
157
|
+
required: ["number"],
|
|
158
|
+
},
|
|
159
|
+
async handler({ number, ...input }, { github, repo, config }) {
|
|
160
|
+
deny(config, "manage_issues");
|
|
161
|
+
await github.updateIssue(repo, number, input);
|
|
162
|
+
return { updated: true };
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "github_create_pull_request",
|
|
167
|
+
description: "Open a pull request from a branch. Respects bot.permissions.manage_pull_requests.",
|
|
168
|
+
inputSchema: {
|
|
169
|
+
type: "object",
|
|
170
|
+
properties: {
|
|
171
|
+
title: { type: "string" },
|
|
172
|
+
head: { type: "string" },
|
|
173
|
+
base: { type: "string" },
|
|
174
|
+
body: { type: "string" },
|
|
175
|
+
draft: { type: "boolean" },
|
|
176
|
+
},
|
|
177
|
+
required: ["title", "head", "base"],
|
|
178
|
+
},
|
|
179
|
+
async handler(args, { github, repo, config }) {
|
|
180
|
+
deny(config, "manage_pull_requests");
|
|
181
|
+
const pull = await github.createPull(repo, args);
|
|
182
|
+
return { number: pull.number, url: pull.html_url };
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "github_merge_pull_request",
|
|
187
|
+
description: "Merge a pull request. Requires merge permission; protected bases need merge_protected.",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
properties: {
|
|
191
|
+
number: { type: "number" },
|
|
192
|
+
method: { type: "string", enum: ["merge", "squash", "rebase"] },
|
|
193
|
+
},
|
|
194
|
+
required: ["number"],
|
|
195
|
+
},
|
|
196
|
+
async handler({ number, method }, { github, repo, config }) {
|
|
197
|
+
const pull = await github.getPull(repo, number);
|
|
198
|
+
const isProtected = (bot(config).protected_branches ?? []).some((pattern) => new RegExp(`^${pattern.replace(/\*/g, ".*")}$`).test(pull.base.ref));
|
|
199
|
+
const gate = isProtected ? permission(config, "merge_protected") : permission(config, "merge_pull_requests");
|
|
200
|
+
if (gate !== "allow")
|
|
201
|
+
throw new Error(`Merge denied: set bot.permissions.${isProtected ? "merge_protected" : "merge_pull_requests"} to "allow"`);
|
|
202
|
+
return github.mergePull(repo, number, { merge_method: method ?? "squash" });
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "github_read_file",
|
|
207
|
+
description: "Read a file from the repository at a given ref. Respects secret-read restrictions.",
|
|
208
|
+
inputSchema: {
|
|
209
|
+
type: "object",
|
|
210
|
+
properties: {
|
|
211
|
+
path: { type: "string" },
|
|
212
|
+
ref: { type: "string", description: "Branch, tag or commit (default: default branch)" },
|
|
213
|
+
},
|
|
214
|
+
required: ["path"],
|
|
215
|
+
},
|
|
216
|
+
async handler({ path, ref }, { github, repo, config }) {
|
|
217
|
+
if (permission(config, "read_secrets") !== "allow" && /(\.env|\.pem|\.key|id_rsa)/.test(path)) {
|
|
218
|
+
throw new Error(`Refusing to read ${path}: bot.permissions.read_secrets is not "allow"`);
|
|
219
|
+
}
|
|
220
|
+
const file = await github.getFile(repo, path, ref);
|
|
221
|
+
if (!file)
|
|
222
|
+
throw new Error(`File not found: ${path}`);
|
|
223
|
+
return { path, content: file.content };
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "github_list_files",
|
|
228
|
+
description: "List the entries of a repository directory.",
|
|
229
|
+
inputSchema: {
|
|
230
|
+
type: "object",
|
|
231
|
+
properties: { path: { type: "string" }, ref: { type: "string" } },
|
|
232
|
+
},
|
|
233
|
+
async handler({ path, ref }, { github, repo }) {
|
|
234
|
+
return github.listDir(repo, path ?? "", ref);
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "github_search_issues",
|
|
239
|
+
description: "Search issues and pull requests with the GitHub search syntax.",
|
|
240
|
+
inputSchema: {
|
|
241
|
+
type: "object",
|
|
242
|
+
properties: { query: { type: "string" } },
|
|
243
|
+
required: ["query"],
|
|
244
|
+
},
|
|
245
|
+
async handler({ query }, { github, repo }) {
|
|
246
|
+
const scoped = query.includes("repo:") ? query : `repo:${repo.owner}/${repo.repo} ${query}`;
|
|
247
|
+
const result = await github.searchIssues(scoped);
|
|
248
|
+
return result.items.map((item) => ({
|
|
249
|
+
number: item.number,
|
|
250
|
+
title: item.title,
|
|
251
|
+
state: item.state,
|
|
252
|
+
url: item.html_url,
|
|
253
|
+
pullRequest: Boolean(item.pull_request),
|
|
254
|
+
}));
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "github_workflow_logs",
|
|
259
|
+
description: "Read the failed jobs and log tail of a workflow run.",
|
|
260
|
+
inputSchema: {
|
|
261
|
+
type: "object",
|
|
262
|
+
properties: { runId: { type: "number" } },
|
|
263
|
+
required: ["runId"],
|
|
264
|
+
},
|
|
265
|
+
async handler({ runId }, { github, repo }) {
|
|
266
|
+
const jobs = await github.getWorkflowRunJobs(repo, runId);
|
|
267
|
+
const failed = jobs.jobs.filter((job) => job.conclusion === "failure");
|
|
268
|
+
const logs = {};
|
|
269
|
+
for (const job of failed.slice(0, 3)) {
|
|
270
|
+
try {
|
|
271
|
+
const log = await github.getJobLog(repo, job.id);
|
|
272
|
+
logs[job.name] = log.replace(/\u001b\[[0-9;]*m/g, "").slice(-8000);
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
logs[job.name] = `(could not read: ${error.message})`;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return { jobs: jobs.jobs.map((j) => ({ name: j.name, conclusion: j.conclusion })), logs };
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "bot_permissions",
|
|
283
|
+
description: "Return the bot's effective GitHub permissions and enabled features.",
|
|
284
|
+
inputSchema: { type: "object", properties: {} },
|
|
285
|
+
async handler(_args, { config }) {
|
|
286
|
+
return { permissions: bot(config).permissions, features: bot(config).features, write: bot(config).write !== false };
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
];
|
|
290
|
+
function deny(config, key) {
|
|
291
|
+
if (permission(config, key) !== "allow") {
|
|
292
|
+
throw new Error(`Permission denied: bot.permissions.${String(key)} must be "allow"`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// ------------------------------------------------------------------ protocol
|
|
296
|
+
function loadConfigFromEnv() {
|
|
297
|
+
const inline = process.env.OPENCODE_ACTIONS_CONFIG;
|
|
298
|
+
if (!inline)
|
|
299
|
+
return DEFAULT_CONFIG;
|
|
300
|
+
try {
|
|
301
|
+
return mergeConfig(DEFAULT_CONFIG, parseConfigText(inline, "OPENCODE_ACTIONS_CONFIG"));
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
return DEFAULT_CONFIG;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const PROTOCOL_VERSION = "2024-11-05";
|
|
308
|
+
async function main() {
|
|
309
|
+
const config = loadConfigFromEnv();
|
|
310
|
+
const ctx = {
|
|
311
|
+
github: new GitHub({ token: tokenFromEnv() }),
|
|
312
|
+
repo: repoFromEnv(),
|
|
313
|
+
config,
|
|
314
|
+
};
|
|
315
|
+
const rl = createInterface({ input: process.stdin });
|
|
316
|
+
const send = (message) => process.stdout.write(JSON.stringify(message) + "\n");
|
|
317
|
+
rl.on("line", async (line) => {
|
|
318
|
+
if (!line.trim())
|
|
319
|
+
return;
|
|
320
|
+
let request;
|
|
321
|
+
try {
|
|
322
|
+
request = JSON.parse(line);
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const { id, method, params } = request;
|
|
328
|
+
try {
|
|
329
|
+
switch (method) {
|
|
330
|
+
case "initialize":
|
|
331
|
+
send({
|
|
332
|
+
jsonrpc: "2.0",
|
|
333
|
+
id,
|
|
334
|
+
result: {
|
|
335
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
336
|
+
capabilities: { tools: {} },
|
|
337
|
+
serverInfo: { name: "opencode-actions", version: "0.1.0" },
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
return;
|
|
341
|
+
case "notifications/initialized":
|
|
342
|
+
case "initialized":
|
|
343
|
+
return;
|
|
344
|
+
case "tools/list":
|
|
345
|
+
send({
|
|
346
|
+
jsonrpc: "2.0",
|
|
347
|
+
id,
|
|
348
|
+
result: {
|
|
349
|
+
tools: TOOLS.map((tool) => ({
|
|
350
|
+
name: tool.name,
|
|
351
|
+
description: tool.description,
|
|
352
|
+
inputSchema: tool.inputSchema,
|
|
353
|
+
})),
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
return;
|
|
357
|
+
case "tools/call": {
|
|
358
|
+
const name = params?.name;
|
|
359
|
+
const tool = TOOLS.find((candidate) => candidate.name === name);
|
|
360
|
+
if (!tool) {
|
|
361
|
+
send({ jsonrpc: "2.0", id, error: { code: -32602, message: `Unknown tool: ${name}` } });
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
try {
|
|
365
|
+
const result = await tool.handler(params?.arguments ?? {}, ctx);
|
|
366
|
+
send({
|
|
367
|
+
jsonrpc: "2.0",
|
|
368
|
+
id,
|
|
369
|
+
result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] },
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
send({
|
|
374
|
+
jsonrpc: "2.0",
|
|
375
|
+
id,
|
|
376
|
+
result: {
|
|
377
|
+
isError: true,
|
|
378
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
379
|
+
},
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
case "ping":
|
|
385
|
+
send({ jsonrpc: "2.0", id, result: {} });
|
|
386
|
+
return;
|
|
387
|
+
default:
|
|
388
|
+
if (id !== undefined)
|
|
389
|
+
send({ jsonrpc: "2.0", id, error: { code: -32601, message: `Unknown method: ${method}` } });
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
if (id !== undefined)
|
|
394
|
+
send({ jsonrpc: "2.0", id, error: { code: -32603, message: error.message } });
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
main().catch((error) => {
|
|
399
|
+
process.stderr.write(`MCP server failed: ${error.stack}\n`);
|
|
400
|
+
process.exit(1);
|
|
401
|
+
});
|
|
402
|
+
export { TOOLS };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { BotConfig } from "./config.js";
|
|
2
|
+
/** Shared rules every bot prompt inherits. */
|
|
3
|
+
export declare function baseSystem(config: BotConfig): string;
|
|
4
|
+
/**
|
|
5
|
+
* Review contract. Findings are structured JSON so the bot can post valid
|
|
6
|
+
* inline comments (GitHub rejects comments on lines outside the diff).
|
|
7
|
+
*/
|
|
8
|
+
export declare const REVIEW_SCHEMA = "{\n \"summary\": \"string \u2014 2-5 sentences on what the change does and whether it is safe\",\n \"verdict\": \"APPROVE | COMMENT | REQUEST_CHANGES\",\n \"findings\": [\n {\n \"path\": \"string \u2014 file path exactly as in the diff\",\n \"line\": \"number \u2014 a line that exists on the RIGHT side of the diff\",\n \"severity\": \"critical | high | medium | low | info\",\n \"title\": \"string \u2014 one short sentence\",\n \"body\": \"string \u2014 the problem and why it matters\",\n \"suggestion\": \"string | null \u2014 exact replacement for the referenced lines, or null\"\n }\n ],\n \"strengths\": [\"string \u2014 what the change does well\"]\n}";
|
|
9
|
+
export declare function reviewPrompt(input: {
|
|
10
|
+
config: BotConfig;
|
|
11
|
+
repo: string;
|
|
12
|
+
prNumber: number;
|
|
13
|
+
title: string;
|
|
14
|
+
author: string;
|
|
15
|
+
base: string;
|
|
16
|
+
head: string;
|
|
17
|
+
filesSummary: string;
|
|
18
|
+
diffDigest: string;
|
|
19
|
+
facts?: string;
|
|
20
|
+
extraInstructions?: string;
|
|
21
|
+
}): string;
|
|
22
|
+
export declare const ISSUE_SCHEMA = "{\n \"summary\": \"string \u2014 what the issue is really asking for\",\n \"severity\": \"critical | high | medium | low\",\n \"labels\": [\"string \u2014 existing labels that apply\"],\n \"answer\": \"string \u2014 markdown to post on the issue; empty if this is a bug to fix\",\n \"plan\": [\"string \u2014 ordered implementation steps\"],\n \"files\": [\"string \u2014 files that would need to change\"],\n \"reproducible\": \"yes | no | unknown\",\n \"needs_info\": \"string | null \u2014 the single question for the reporter, or null\"\n}";
|
|
23
|
+
export declare function issuePrompt(input: {
|
|
24
|
+
config: BotConfig;
|
|
25
|
+
repo: string;
|
|
26
|
+
number: number;
|
|
27
|
+
title: string;
|
|
28
|
+
body: string;
|
|
29
|
+
labels: string[];
|
|
30
|
+
comments: string;
|
|
31
|
+
facts?: string;
|
|
32
|
+
mode: "triage" | "answer" | "implement";
|
|
33
|
+
}): string;
|
|
34
|
+
export declare const AUTOFIX_SCHEMA = "{\n \"diagnosis\": \"string \u2014 the root cause of the failure\",\n \"fixable\": \"boolean\",\n \"changes\": [\"string \u2014 files you changed\"],\n \"commit_message\": \"string \u2014 Conventional Commit message\",\n \"summary\": \"string \u2014 one paragraph for the PR body\",\n \"explanation\": \"string \u2014 what you changed and why it fixes the failure\"\n}";
|
|
35
|
+
export declare function autofixPrompt(input: {
|
|
36
|
+
config: BotConfig;
|
|
37
|
+
repo: string;
|
|
38
|
+
runUrl: string;
|
|
39
|
+
workflow: string;
|
|
40
|
+
branch: string;
|
|
41
|
+
sha: string;
|
|
42
|
+
failedJobs: string;
|
|
43
|
+
logExcerpt: string;
|
|
44
|
+
workflowFile: string | null;
|
|
45
|
+
}): string;
|
|
46
|
+
export declare function commandPrompt(input: {
|
|
47
|
+
config: BotConfig;
|
|
48
|
+
command: string;
|
|
49
|
+
args: string[];
|
|
50
|
+
repo: string;
|
|
51
|
+
target: string;
|
|
52
|
+
actor: string;
|
|
53
|
+
body: string;
|
|
54
|
+
context: string;
|
|
55
|
+
}): string;
|
|
56
|
+
export declare function describePrompt(input: {
|
|
57
|
+
config: BotConfig;
|
|
58
|
+
repo: string;
|
|
59
|
+
prNumber: number;
|
|
60
|
+
base: string;
|
|
61
|
+
head: string;
|
|
62
|
+
currentBody: string;
|
|
63
|
+
title: string;
|
|
64
|
+
}): string;
|
|
65
|
+
/** A short reply when the agent was asked something conversational. */
|
|
66
|
+
export declare function replyPrompt(input: {
|
|
67
|
+
config: BotConfig;
|
|
68
|
+
question: string;
|
|
69
|
+
context: string;
|
|
70
|
+
}): string;
|