feat(issue): 添加查询 Issue 列表功能,更新完成 Issue 的状态处理,版本升级至 0.0.6

This commit is contained in:
2026-01-29 13:23:17 +08:00
parent e15cf4f7be
commit 86b24cc9ef
3 changed files with 55 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import { createSkill, tool } from '@kevisual/router';
import { app, cnb } from '../../app.ts';
import { IssueItem } from '@/index.ts';
// 创建cnb issue, 仓库为 kevisual/kevisual 标题为 "自动化测试创建issue", 内容为 "这是通过API创建的issue用于测试目的", body: "这是通过API创建的issue用于测试目的"
app.route({
@@ -55,7 +56,7 @@ app.route({
tags: ['opencode'],
...createSkill({
skill: 'complete-issue',
title: '完成 Issue',
title: '完成 CNB的任务Issue',
args: {
repo: tool.schema.string().describe('代码仓库名称, 如 my-user/my-repo'),
issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe('Issue 编号'),
@@ -72,9 +73,10 @@ app.route({
if (!repo || !issueNumber) {
ctx.throw(400, '缺少参数 repo 或 issueNumber');
}
const res = await cnb.issue.updateIssue(repo, issueNumber, {
state: state,
});
const iss: Partial<IssueItem> = { state: state };
if (iss.state === 'closed') {
iss.state_reason = 'completed';
}
const res = await cnb.issue.updateIssue(repo, issueNumber, iss);
ctx.forward(res);
}).addTo(app);