添加获取单个 Issue 的功能,更新相关类型和环境变量

This commit is contained in:
xiongxiao
2026-03-12 23:47:19 +08:00
committed by cnb
parent 2e630b2da9
commit 525f0af8ba
5 changed files with 78 additions and 13 deletions

View File

@@ -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);