添加仓库管理功能,包括创建、删除和列出代码仓库,更新依赖安装逻辑,修复环境变量配置
This commit is contained in:
37
agent/routes/repo/list.ts
Normal file
37
agent/routes/repo/list.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { createSkill } from '@kevisual/router';
|
||||
import { app, cnb } from '../../app.ts';
|
||||
import { tool } from "@opencode-ai/plugin/tool"
|
||||
|
||||
app.route({
|
||||
path: 'cnb',
|
||||
key: 'list-repos',
|
||||
description: '列出我的代码仓库',
|
||||
middleware: ['auth'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
skill: 'list-repos',
|
||||
title: '列出代码仓库',
|
||||
summary: '列出代码仓库',
|
||||
args: {
|
||||
search: tool.schema.string().optional().describe('搜索关键词'),
|
||||
pageSize: tool.schema.number().optional().describe('每页数量,默认999'),
|
||||
},
|
||||
})
|
||||
}
|
||||
}).define(async (ctx) => {
|
||||
const search = ctx.query?.search;
|
||||
const pageSize = ctx.query?.pageSize || 9999;
|
||||
const res = await cnb.repo.getRepoList({ search, page_size: pageSize, role: 'developer' });
|
||||
if (res.code === 200) {
|
||||
const repos = res.data.map((item) => ({
|
||||
name: item.name,
|
||||
path: item.path,
|
||||
description: item.description,
|
||||
web_url: item.web_url,
|
||||
}));
|
||||
ctx.body = { content: JSON.stringify(repos) };
|
||||
} else {
|
||||
ctx.throw(500, '获取仓库列表失败');
|
||||
}
|
||||
}).addTo(app);
|
||||
Reference in New Issue
Block a user