更新版本号至0.0.22,重构Repo类的deleteRepo方法并添加WorkspaceLinkDetail接口

This commit is contained in:
2026-02-09 03:51:34 +08:00
parent a1339014a3
commit 13401d9aa0
3 changed files with 20 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@kevisual/cnb", "name": "@kevisual/cnb",
"version": "0.0.21", "version": "0.0.22",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@@ -22,10 +22,14 @@ export class Repo extends CNBCore {
}; };
return this.post({ url, data: postData }); return this.post({ url, data: postData });
} }
deleteRepo(name: string): Promise<any> { deleteRepoCookie(repo: string): Promise<any> {
const url = `${this.hackURL}/${name}`; const url = `${this.hackURL}/${repo}`;
return this.delete({ url, useCookie: true }); return this.delete({ url, useCookie: true });
} }
deleteRepo(repo: string): Promise<any> {
const url = `/${repo}`;
return this.delete({ url });
}
async createCommit(repo: string, data: CreateCommitData): Promise<any> { async createCommit(repo: string, data: CreateCommitData): Promise<any> {
const commitList = await this.getCommitList(repo, { const commitList = await this.getCommitList(repo, {
page: 1, page: 1,

View File

@@ -81,18 +81,7 @@ export class Workspace extends CNBCore {
* @param repo 仓库路径例如groupname/reponame * @param repo 仓库路径例如groupname/reponame
* @param sn 流水线构建号 * @param sn 流水线构建号
*/ */
async getDetail(repo: string, sn: string): Promise<{ async getDetail(repo: string, sn: string): Promise<Result<WorkspaceLinkDetail>> {
codebuddy: string;
codebuddycn: string;
cursor: string;
jetbrains: Record<string, string>;
jumpUrl: string;
remoteSsh: string;
ssh: string;
vscode: string;
'vscode-insiders': string;
webide: string;
}> {
return this.get({ url: `/${repo}/-/workspace/detail/${sn}` }); return this.get({ url: `/${repo}/-/workspace/detail/${sn}` });
} }
/** /**
@@ -126,7 +115,18 @@ export class Workspace extends CNBCore {
} }
} }
export interface WorkspaceLinkDetail {
codebuddy: string;
codebuddycn: string;
cursor: string;
jetbrains: Record<string, string>;
jumpUrl: string;
remoteSsh: string;
ssh: string;
vscode: string;
'vscode-insiders': string;
webide: string;
}
export type ResultList<T> = { export type ResultList<T> = {
hasMore: boolean; hasMore: boolean;
list: T[]; list: T[];