update
This commit is contained in:
23
agent/routes/workspace/index.ts
Normal file
23
agent/routes/workspace/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { app, cnb } from '@/agent/app.ts';
|
||||
|
||||
app.route({
|
||||
path: 'cnb',
|
||||
key: 'start-workspace',
|
||||
description: '启动开发工作空间, 参数 repo',
|
||||
middleware: ['auth'],
|
||||
metadata: {
|
||||
tags: ['opencode']
|
||||
}
|
||||
}).define(async (ctx) => {
|
||||
const repo = ctx.query?.repo;
|
||||
const branch = ctx.query?.branch;
|
||||
const ref = ctx.query?.ref;
|
||||
if (!repo) {
|
||||
ctx.throw(400, '缺少参数 repo');
|
||||
}
|
||||
const res = await cnb.workspace.startWorkspace(repo, {
|
||||
branch,
|
||||
ref
|
||||
});
|
||||
ctx.forward(res);
|
||||
}).addTo(app);
|
||||
Reference in New Issue
Block a user