更新代码仓库相关功能,修改 API 参数,添加删除仓库功能,更新文档和测试用例
This commit is contained in:
37
test/agent.ts
Normal file
37
test/agent.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { app, showMore } from './common.ts';
|
||||
|
||||
// const res = await app.run({
|
||||
// path: 'cnb',
|
||||
// key: 'create-repo',
|
||||
// payload: {
|
||||
// name: 'kevisual/exam',
|
||||
// description: 'kevisual 创建的代码仓库',
|
||||
// visibility: 'public',
|
||||
// }
|
||||
// })
|
||||
|
||||
// console.log(showMore(res));
|
||||
|
||||
|
||||
// const res2 = await app.run({
|
||||
// path: 'cnb',
|
||||
// key: 'create-repo-file',
|
||||
// payload: {
|
||||
// name: 'kevisual/exam',
|
||||
// path: 'README.md',
|
||||
// content: '# Example Skill\nThis is an example skill created via API.',
|
||||
// encoding: 'raw',
|
||||
// },
|
||||
// })
|
||||
|
||||
// console.log(showMore(res2));
|
||||
|
||||
// const deleteRes = await app.run({
|
||||
// path: 'cnb',
|
||||
// key: 'delete-repo',
|
||||
// payload: {
|
||||
// name: 'kevisual/exam',
|
||||
// },
|
||||
// })
|
||||
|
||||
// console.log(showMore(deleteRes));
|
||||
@@ -6,13 +6,16 @@ const config = useConfig()
|
||||
export const token = useKey("CNB_TOKEN") as string || '';
|
||||
export const cookie = useKey("CNB_COOKIE") as string || '';
|
||||
console.log('token', token)
|
||||
import { app } from '../agent/index.ts'
|
||||
|
||||
export { app }
|
||||
export const cnb = new CNB({ token, cookie });
|
||||
export const showMore = (obj: any) => {
|
||||
return util.inspect(obj, { showHidden: false, depth: null, colors: true });
|
||||
}
|
||||
const worksaceList = await cnb.workspace.list({ status: 'running' });
|
||||
// const worksaceList = await cnb.workspace.list({ status: 'running' });
|
||||
|
||||
console.log("worksaceList", showMore(worksaceList));
|
||||
// console.log("worksaceList", showMore(worksaceList));
|
||||
|
||||
// const sn = 'cnb-o18-1jbklfuoh'
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Repo } from "../src/repo";
|
||||
|
||||
import { app } from '../agent/index.ts'
|
||||
import { token, showMore, cookie } from "./common.ts";
|
||||
import util from 'node:util';
|
||||
|
||||
const repo = new Repo({ token: token, cookie: cookie });
|
||||
|
||||
export { app }
|
||||
// const res = await repo.createRepo({
|
||||
// name: "test-cnb-2",
|
||||
// description: "This is my new repository",
|
||||
|
||||
Reference in New Issue
Block a user