添加获取单个 Issue 的功能,更新相关类型和环境变量
This commit is contained in:
@@ -49,4 +49,37 @@ app.route({
|
||||
|
||||
const res = await cnb.issue.getList(repo, params);
|
||||
ctx.forward(res);
|
||||
}).addTo(app);
|
||||
|
||||
app.route({
|
||||
path: 'cnb',
|
||||
key: 'getIssue',
|
||||
description: '获取 单个 Issue',
|
||||
middleware: ['auth'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
skill: 'getIssue',
|
||||
title: '获取 单个 Issue',
|
||||
args: {
|
||||
repo: tool.schema.string().optional().describe('代码仓库名称, 如 my-user/my-repo'),
|
||||
issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe('Issue 编号'),
|
||||
},
|
||||
summary: '获取 单个 Issue',
|
||||
})
|
||||
}
|
||||
}).define(async (ctx) => {
|
||||
const cnb = await cnbManager.getContext(ctx);
|
||||
let repo = ctx.query?.repo || useKey('CNB_REPO_SLUG_LOWERCASE');
|
||||
const issueNumber = ctx.query?.issueNumber;
|
||||
|
||||
if (!repo) {
|
||||
ctx.throw(400, '缺少参数 repo');
|
||||
}
|
||||
if (!issueNumber) {
|
||||
ctx.throw(400, '缺少参数 issueNumber');
|
||||
}
|
||||
|
||||
const res = await cnb.issue.getItem(repo, issueNumber);
|
||||
ctx.forward(res);
|
||||
}).addTo(app);
|
||||
Reference in New Issue
Block a user