Files
cnb/agent/routes/repo/list.ts
xiongxiao 50332fe2f4 feat: update package dependencies and add new routes for CNB environment management
- Updated package.json and pnpm-lock.yaml with new dependencies and versions.
- Removed outdated readme files from requirements.
- Enhanced CNB environment configuration in cnb-env.ts with new VS Code remote SSH settings.
- Modified KnowledgeBase class to return structured results.
- Updated Workspace class to return structured results.
- Implemented new routes for managing CNB cookies and VS Code proxy URIs.
- Added AI chat functionality for querying knowledge base.
- Created skills for cleaning up closed workspaces.
2026-01-27 04:02:34 +08:00

45 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { createSkill } from '@kevisual/router';
import { app, cnb } from '../../app.ts';
import { tool } from "@opencode-ai/plugin/tool"
// "列出我的代码仓库search blog"
// 列出我的知识库的代码仓库
app.route({
path: 'cnb',
key: 'list-repos',
description: '列出我的代码仓库',
middleware: ['auth'],
metadata: {
tags: ['opencode'],
...createSkill({
skill: 'list-repos',
title: '列出cnb代码仓库',
summary: '列出cnb代码仓库, 可选flags参数如 KnowledgeBase',
args: {
search: tool.schema.string().optional().describe('搜索关键词'),
pageSize: tool.schema.number().optional().describe('每页数量默认999'),
flags: tool.schema.string().optional().describe('仓库标记,如果是知识库则填写 KnowledgeBase'),
},
})
}
}).define(async (ctx) => {
const search = ctx.query?.search;
const pageSize = ctx.query?.pageSize || 9999;
const flags = ctx.query?.flags;
const params: any = {};
if (flags) {
params.flags = flags;
}
const res = await cnb.repo.getRepoList({ search, page_size: pageSize, role: 'developer', ...params });
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), list: res.data };
} else {
ctx.throw(500, '获取仓库列表失败');
}
}).addTo(app);