@comate/zulu 0.2.1-beta.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -13
- package/comate-engine/bin/comate.js +9 -0
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +8 -8
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/user-DQgjkMe9.js +44 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +24 -6
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +8 -8
- package/comate-engine/node_modules/@comate/preview-proxy/dist/index.js +59 -72
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.css +1 -1
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js +1 -1
- package/comate-engine/node_modules/better-sqlite3/node_modules/.bin/prebuild-install +2 -2
- package/comate-engine/plugins/demo-feature/dist/index.js +337 -30
- package/comate-engine/server.js +11 -11
- package/dist/bundle/index.js +8 -8
- package/package.json +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/user-Buhpnssj.js +0 -44
- package/comate-engine/plugins/aiscan/assets/icon.svg +0 -12
- package/comate-engine/plugins/aiscan/dist/index.js +0 -53861
- package/comate-engine/plugins/aiscan/package.json +0 -67
- package/comate-engine/plugins/appdev/assets/icon.png +0 -0
- package/comate-engine/plugins/appdev/dist/help.md +0 -12
- package/comate-engine/plugins/appdev/dist/index.d.ts +0 -2
- package/comate-engine/plugins/appdev/dist/index.js +0 -194
- package/comate-engine/plugins/appdev/dist/providers/err.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/err.js +0 -37
- package/comate-engine/plugins/appdev/dist/providers/fallback.d.ts +0 -5
- package/comate-engine/plugins/appdev/dist/providers/fallback.js +0 -28
- package/comate-engine/plugins/appdev/dist/providers/help.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/help.js +0 -19
- package/comate-engine/plugins/appdev/dist/providers/medusa.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/medusa.js +0 -39
- package/comate-engine/plugins/appdev/dist/providers/qa.d.ts +0 -8
- package/comate-engine/plugins/appdev/dist/providers/qa.js +0 -33
- package/comate-engine/plugins/appdev/package.json +0 -67
- package/comate-engine/plugins/bfc/assets/bfc-icon.png +0 -0
- package/comate-engine/plugins/bfc/dist/config/config.d.ts +0 -4
- package/comate-engine/plugins/bfc/dist/config/config.js +0 -4
- package/comate-engine/plugins/bfc/dist/help.md +0 -11
- package/comate-engine/plugins/bfc/dist/index.d.ts +0 -2
- package/comate-engine/plugins/bfc/dist/index.js +0 -452
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.js +0 -77
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.js +0 -71
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.js +0 -74
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.d.ts +0 -10
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.js +0 -71
- package/comate-engine/plugins/bfc/dist/providers/help.d.ts +0 -8
- package/comate-engine/plugins/bfc/dist/providers/help.js +0 -19
- package/comate-engine/plugins/bfc/dist/service/generateService.d.ts +0 -14
- package/comate-engine/plugins/bfc/dist/service/generateService.js +0 -27
- package/comate-engine/plugins/bfc/package.json +0 -85
- package/comate-engine/plugins/bpm/assets/bpm.png +0 -0
- package/comate-engine/plugins/bpm/dist/index.js +0 -313
- package/comate-engine/plugins/bpm/package.json +0 -65
- package/comate-engine/plugins/casebuilder/assets/icon.svg +0 -1
- package/comate-engine/plugins/casebuilder/dist/help.md +0 -33
- package/comate-engine/plugins/casebuilder/dist/index.js +0 -837
- package/comate-engine/plugins/casebuilder/package.json +0 -80
- package/comate-engine/plugins/centrino/assets/icon.png +0 -0
- package/comate-engine/plugins/centrino/dist/help.md +0 -30
- package/comate-engine/plugins/centrino/dist/index.js +0 -1046
- package/comate-engine/plugins/centrino/package.json +0 -68
- package/comate-engine/plugins/cnap/assets/cnap.png +0 -0
- package/comate-engine/plugins/cnap/dist/help.md +0 -11
- package/comate-engine/plugins/cnap/dist/index.js +0 -171
- package/comate-engine/plugins/cnap/package.json +0 -65
- package/comate-engine/plugins/demo-timer/assets/icon.svg +0 -2
- package/comate-engine/plugins/demo-timer/dist/index.js +0 -463
- package/comate-engine/plugins/demo-timer/package.json +0 -73
- package/comate-engine/plugins/dev-tools/assets/icon.png +0 -0
- package/comate-engine/plugins/dev-tools/dist/help.md +0 -18
- package/comate-engine/plugins/dev-tools/dist/index.js +0 -166160
- package/comate-engine/plugins/dev-tools/package.json +0 -95
- package/comate-engine/plugins/devaux/assets/icon.svg +0 -1
- package/comate-engine/plugins/devaux/dist/help.md +0 -41
- package/comate-engine/plugins/devaux/dist/index.js +0 -74138
- package/comate-engine/plugins/devaux/dist/static/tree-sitter-cpp.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/devaux/package.json +0 -83
- package/comate-engine/plugins/f2c/assets/icon.svg +0 -11
- package/comate-engine/plugins/f2c/dist/help.md +0 -13
- package/comate-engine/plugins/f2c/dist/index.js +0 -81787
- package/comate-engine/plugins/f2c/package.json +0 -56
- package/comate-engine/plugins/fcnap/assets/icon.png +0 -0
- package/comate-engine/plugins/fcnap/dist/help.md +0 -9
- package/comate-engine/plugins/fcnap/dist/index.js +0 -105
- package/comate-engine/plugins/fcnap/package.json +0 -50
- package/comate-engine/plugins/front-end-skills/assets/icon.svg +0 -1
- package/comate-engine/plugins/front-end-skills/dist/help.md +0 -17
- package/comate-engine/plugins/front-end-skills/dist/index.js +0 -8172
- package/comate-engine/plugins/front-end-skills/package.json +0 -79
- package/comate-engine/plugins/gdp/assets/icon.png +0 -0
- package/comate-engine/plugins/gdp/dist/help.md +0 -11
- package/comate-engine/plugins/gdp/dist/index.js +0 -53065
- package/comate-engine/plugins/gdp/package.json +0 -79
- package/comate-engine/plugins/git/assets/git.svg +0 -1
- package/comate-engine/plugins/git/assets/icon.svg +0 -1
- package/comate-engine/plugins/git/dist/help.md +0 -7
- package/comate-engine/plugins/git/dist/index.js +0 -32675
- package/comate-engine/plugins/git/package.json +0 -91
- package/comate-engine/plugins/harmonyos/assets/harmonyos.png +0 -0
- package/comate-engine/plugins/harmonyos/dist/index.js +0 -78
- package/comate-engine/plugins/harmonyos/package.json +0 -37
- package/comate-engine/plugins/iapi/assets/icon.png +0 -0
- package/comate-engine/plugins/iapi/dist/help.md +0 -13
- package/comate-engine/plugins/iapi/dist/index.js +0 -458
- package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-java.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/tree-sitter-java.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/iapi/package.json +0 -102
- package/comate-engine/plugins/icafe/assets/icafe.svg +0 -1
- package/comate-engine/plugins/icafe/dist/help.md +0 -5
- package/comate-engine/plugins/icafe/dist/index.js +0 -885
- package/comate-engine/plugins/icafe/package.json +0 -74
- package/comate-engine/plugins/ievalue/assets/iEValue.svg +0 -10
- package/comate-engine/plugins/ievalue/dist/index.js +0 -2920
- package/comate-engine/plugins/ievalue/package.json +0 -88
- package/comate-engine/plugins/ipipe/assets/iPipePlugin.png +0 -0
- package/comate-engine/plugins/ipipe/dist/help.md +0 -15
- package/comate-engine/plugins/ipipe/dist/index.js +0 -7264
- package/comate-engine/plugins/ipipe/package.json +0 -62
- package/comate-engine/plugins/jarvis/assets/icon.svg +0 -1
- package/comate-engine/plugins/jarvis/dist/help.md +0 -17
- package/comate-engine/plugins/jarvis/dist/index.js +0 -140416
- package/comate-engine/plugins/jarvis/package.json +0 -93
- package/comate-engine/plugins/mapsearch/assets/mapsearchicon.png +0 -0
- package/comate-engine/plugins/mapsearch/dist/help.md +0 -4
- package/comate-engine/plugins/mapsearch/dist/index.js +0 -145
- package/comate-engine/plugins/mapsearch/package.json +0 -53
- package/comate-engine/plugins/paddle/assets/icon.png +0 -0
- package/comate-engine/plugins/paddle/assets/paconvert-3.0.1-py3-none-any.whl +0 -0
- package/comate-engine/plugins/paddle/dist/help.md +0 -31
- package/comate-engine/plugins/paddle/dist/index.js +0 -1011
- package/comate-engine/plugins/paddle/package.json +0 -129
- package/comate-engine/plugins/robot/assets/Robot.png +0 -0
- package/comate-engine/plugins/robot/dist/index.js +0 -288
- package/comate-engine/plugins/robot/package.json +0 -67
- package/comate-engine/plugins/security/assets/comate.png +0 -0
- package/comate-engine/plugins/security/dist/index.js +0 -18393
- package/comate-engine/plugins/security/package.json +0 -82
- package/comate-engine/plugins/smartapp/assets/icon.png +0 -0
- package/comate-engine/plugins/smartapp/dist/help.md +0 -4
- package/comate-engine/plugins/smartapp/dist/index.js +0 -113
- package/comate-engine/plugins/smartapp/package.json +0 -54
- package/comate-engine/plugins/testmate/assets/icon.svg +0 -1
- package/comate-engine/plugins/testmate/dist/help.md +0 -62
- package/comate-engine/plugins/testmate/dist/index.js +0 -21483
- package/comate-engine/plugins/testmate/package.json +0 -85
- package/comate-engine/plugins/tor/assets/TorPlugin.png +0 -0
- package/comate-engine/plugins/tor/dist/help.md +0 -22
- package/comate-engine/plugins/tor/dist/index.js +0 -807
- package/comate-engine/plugins/tor/package.json +0 -99
- package/comate-engine/plugins/weiyun/assets/icon.png +0 -0
- package/comate-engine/plugins/weiyun/dist/help.md +0 -11
- package/comate-engine/plugins/weiyun/dist/index.js +0 -100491
- package/comate-engine/plugins/weiyun/package.json +0 -55
- package/comate-engine/plugins/workcard/assets/favicon.png +0 -0
- package/comate-engine/plugins/workcard/dist/help.md +0 -30
- package/comate-engine/plugins/workcard/dist/index.js +0 -490
- package/comate-engine/plugins/workcard/package.json +0 -95
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase, complexity, max-depth */
|
|
2
|
-
import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
|
|
3
|
-
import { generateService, ResponseCode } from '../service/generateService.js';
|
|
4
|
-
import { caseGitcaseId } from '../config/config.js';
|
|
5
|
-
export class GenNewCaseSkillProvider extends SkillProvider {
|
|
6
|
-
static skillName = 'generateBfcCode';
|
|
7
|
-
static displayName = 'bfc用例生成';
|
|
8
|
-
static description = 'bfc用例生成';
|
|
9
|
-
static parameters = {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {},
|
|
12
|
-
};
|
|
13
|
-
async *execute() {
|
|
14
|
-
const stream = new StringChunkStream();
|
|
15
|
-
try {
|
|
16
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
17
|
-
if (!userDetail) {
|
|
18
|
-
yield stream.flushReplaceLast('请先完成授权');
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const { query, activeFilePath: filePath, activeFileContent: codeContent } = this.currentContext;
|
|
22
|
-
if (!query) {
|
|
23
|
-
yield stream.flushReplaceLast('请输入需求描述。');
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const case_full_name = filePath.split('/').pop() || '';
|
|
27
|
-
if (!filePath.endsWith('.py') || !case_full_name.startsWith('test_')) {
|
|
28
|
-
yield stream.flushReplaceLast('请确认打开的文件为用例文件。');
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const userName = userDetail.name;
|
|
32
|
-
const realQuery = `修改点:${query}`;
|
|
33
|
-
yield stream.flush('开始生成服务代码...\n\n');
|
|
34
|
-
yield stream.flush('\n\n正在生成服务代码...\n\n');
|
|
35
|
-
const retServerCode = await generateService(this, {
|
|
36
|
-
function_name: 'gen_case_by_demo',
|
|
37
|
-
user_demand: realQuery,
|
|
38
|
-
username: userName,
|
|
39
|
-
gitcase_ids: [caseGitcaseId],
|
|
40
|
-
case_path: filePath,
|
|
41
|
-
case_demo: codeContent,
|
|
42
|
-
});
|
|
43
|
-
const { code, message: msg, data } = retServerCode;
|
|
44
|
-
if (code !== ResponseCode.SUCCESS || !data) {
|
|
45
|
-
yield stream.flush(`生成服务代码出错:${msg},错误码:${code}\n\n`);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (Array.isArray(data[caseGitcaseId]) && data[caseGitcaseId].length > 0) {
|
|
49
|
-
const case_data = data[caseGitcaseId];
|
|
50
|
-
const lens = case_data.length;
|
|
51
|
-
for (let i = 0; i < lens; i++) {
|
|
52
|
-
const content = case_data[i].content;
|
|
53
|
-
if (case_data[i].filename && case_data[i].filename !== '') {
|
|
54
|
-
yield stream.flush(`- 参考文件名:${case_data[i].filename}\n\n`);
|
|
55
|
-
}
|
|
56
|
-
yield stream.flush([
|
|
57
|
-
'```python',
|
|
58
|
-
content,
|
|
59
|
-
'```',
|
|
60
|
-
'\n\n',
|
|
61
|
-
]
|
|
62
|
-
.join('\n'));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
yield stream.flush(`未生成服务代码,请联系负责人或稍后再试。${data}\n\n`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
this.logger.error(`Error: ${error}`);
|
|
71
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人或稍后再试。${error}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk, ProviderInit } from '@comate/plugin-host';
|
|
2
|
-
export declare class GetBatchCases extends SkillProvider {
|
|
3
|
-
static skillName: string;
|
|
4
|
-
static displayName: string;
|
|
5
|
-
static description: string;
|
|
6
|
-
private readonly cwd;
|
|
7
|
-
constructor(init: ProviderInit);
|
|
8
|
-
static parameters: FunctionParameterDefinition;
|
|
9
|
-
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
10
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "@comate/plugin-host/jsx-runtime";
|
|
2
|
-
import { ElementChunkStream, SkillProvider, StringChunkStream } from '@comate/plugin-host';
|
|
3
|
-
import { generateService, ResponseCode } from '../service/generateService.js';
|
|
4
|
-
export class GetBatchCases extends SkillProvider {
|
|
5
|
-
static skillName = 'getBatchCases';
|
|
6
|
-
static displayName = '获取自动化用例列表';
|
|
7
|
-
static description = '获取自动化用例列表';
|
|
8
|
-
cwd;
|
|
9
|
-
constructor(init) {
|
|
10
|
-
super(init);
|
|
11
|
-
this.cwd = init.cwd;
|
|
12
|
-
}
|
|
13
|
-
static parameters = {
|
|
14
|
-
type: 'object',
|
|
15
|
-
properties: {},
|
|
16
|
-
required: [],
|
|
17
|
-
};
|
|
18
|
-
async *execute() {
|
|
19
|
-
const stream = new ElementChunkStream();
|
|
20
|
-
const strStream = new StringChunkStream();
|
|
21
|
-
try {
|
|
22
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
23
|
-
if (!userDetail) {
|
|
24
|
-
yield strStream.flushReplaceLast('请先完成授权');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const { query, activeFilePath: filePath, activeFileContent: codeContent } = this.currentContext;
|
|
28
|
-
if (!query) {
|
|
29
|
-
yield strStream.flushReplaceLast('请输入 gitcase 项目名称。');
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const case_full_name = filePath.split('/').pop() || '';
|
|
33
|
-
if (!filePath.endsWith('.py') || !case_full_name.startsWith('test_')) {
|
|
34
|
-
yield strStream.flushReplaceLast('请确认当前打开的文件为自动化用例文件,采纳文件将与该文件保存至同一目录下。');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const userName = userDetail.name;
|
|
38
|
-
const retServerCode = await generateService(this, {
|
|
39
|
-
function_name: 'get_batch_cases',
|
|
40
|
-
user_demand: query,
|
|
41
|
-
username: userName,
|
|
42
|
-
gitcase_ids: ["0"],
|
|
43
|
-
case_path: this.cwd + '/' + filePath,
|
|
44
|
-
case_demo: ""
|
|
45
|
-
});
|
|
46
|
-
const { code, message: msg, data } = retServerCode;
|
|
47
|
-
if (code !== ResponseCode.SUCCESS || !data) {
|
|
48
|
-
yield stream.flush(_jsxs("p", { children: ["\u67E5\u8BE2\u751F\u6210\u7528\u4F8B\u5931\u8D25\uFF0C\u9519\u8BEF\u4FE1\u606F\uFF1A", msg] }));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
yield stream.flush(_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "GitCase ID" }), _jsx("th", { children: "\u63CF\u8FF0" }), _jsx("th", { children: "\u7528\u4F8B\u6587\u4EF6\u540D" }), _jsx("th", { children: _jsx("flex", { horizontalCentered: true, children: "\u64CD\u4F5C" }) })] }) }), _jsx("tbody", { children: (() => {
|
|
52
|
-
const rows = [];
|
|
53
|
-
for (let i = 0; i < data.length; i++) {
|
|
54
|
-
const item = data[i];
|
|
55
|
-
rows.push(_jsxs("tr", { children: [_jsx("td", { children: item.gitcase_id }), _jsx("td", { children: item.case_desc }), _jsx("td", { children: item.case_name }), _jsx("td", { children: _jsx("flex", { horizontalCentered: true, children: _jsx("command-button", { commandName: "commitMessage:confirmIssue", data: "yes", replyText: "\u5355\u72ECButton replyText",
|
|
56
|
-
// variant="text"
|
|
57
|
-
action: "insertToFile", actionData: {
|
|
58
|
-
filePath: item.case_path,
|
|
59
|
-
position: { line: 1, character: 0 },
|
|
60
|
-
newText: item.case_content,
|
|
61
|
-
}, children: "\u91C7\u7EB3" }) }) })] }));
|
|
62
|
-
}
|
|
63
|
-
return rows;
|
|
64
|
-
})() })] }));
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
this.logger.error(`Error: ${error}`);
|
|
68
|
-
yield strStream.flushReplaceLast(`请求出错,请联系负责人或稍后再试。${error}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FunctionParameterDefinition, SkillProvider, TaskProgressChunk } from '@comate/plugin-host';
|
|
2
|
-
export declare class HelpSkillProvider extends SkillProvider {
|
|
3
|
-
static skillName: string;
|
|
4
|
-
static displayName: '插件介绍';
|
|
5
|
-
static description: string;
|
|
6
|
-
static parameters: FunctionParameterDefinition;
|
|
7
|
-
execute(): AsyncIterableIterator<TaskProgressChunk>;
|
|
8
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SkillProvider, StringChunkStream, } from '@comate/plugin-host';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { dirname } from 'path';
|
|
5
|
-
export class HelpSkillProvider extends SkillProvider {
|
|
6
|
-
static skillName = 'bfc-help';
|
|
7
|
-
static displayName;
|
|
8
|
-
static description = '插件介绍';
|
|
9
|
-
static parameters = {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {},
|
|
12
|
-
};
|
|
13
|
-
async *execute() {
|
|
14
|
-
const stream = new StringChunkStream();
|
|
15
|
-
const filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const content = readFileSync(`${dirname(filename)}/help.md`, 'utf8');
|
|
17
|
-
yield stream.flush(content);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface GenerateBfcCodeParams {
|
|
2
|
-
function_name: string;
|
|
3
|
-
user_demand: string;
|
|
4
|
-
username: string;
|
|
5
|
-
gitcase_ids: string[];
|
|
6
|
-
case_path: string;
|
|
7
|
-
case_demo: string;
|
|
8
|
-
}
|
|
9
|
-
export declare enum ResponseCode {
|
|
10
|
-
SUCCESS = 200,
|
|
11
|
-
FAILURE = 300
|
|
12
|
-
}
|
|
13
|
-
export declare function generateService(_this: any, params: GenerateBfcCodeParams): Promise<any>;
|
|
14
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AI_SERVER_HOST } from '../config/config.js';
|
|
2
|
-
export var ResponseCode;
|
|
3
|
-
(function (ResponseCode) {
|
|
4
|
-
ResponseCode[ResponseCode["SUCCESS"] = 200] = "SUCCESS";
|
|
5
|
-
ResponseCode[ResponseCode["FAILURE"] = 300] = "FAILURE";
|
|
6
|
-
})(ResponseCode || (ResponseCode = {}));
|
|
7
|
-
export async function generateService(_this, params) {
|
|
8
|
-
try {
|
|
9
|
-
const response = await fetch(`${AI_SERVER_HOST}/mockAPICaseGenerator`, {
|
|
10
|
-
method: 'POST',
|
|
11
|
-
headers: {
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
},
|
|
14
|
-
body: JSON.stringify({
|
|
15
|
-
...params,
|
|
16
|
-
}),
|
|
17
|
-
signal: AbortSignal.timeout(300000),
|
|
18
|
-
});
|
|
19
|
-
return await response.json();
|
|
20
|
-
}
|
|
21
|
-
catch (ex) {
|
|
22
|
-
if (ex.name === 'TimeoutError') {
|
|
23
|
-
return { code: ResponseCode.FAILURE, message: '网络请求超时。' };
|
|
24
|
-
}
|
|
25
|
-
return { code: ResponseCode.FAILURE, message: `执行失败 ${ex instanceof Error ? `: ${ex.message}` : ''}` };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"private": true,
|
|
3
|
-
"name": "@comate-plugin/bfc",
|
|
4
|
-
"version": "0.9.2",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"clean": "rm -rf dist",
|
|
8
|
-
"dev": "cpd dev",
|
|
9
|
-
"build": "tsc && cpd build",
|
|
10
|
-
"lint": "eslint --max-warnings=0 src"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@comate/plugin-cli": "^0.9.2",
|
|
14
|
-
"@comate/plugin-host": "^0.9.2",
|
|
15
|
-
"@comate/plugin-shared-internals": "^0.9.2"
|
|
16
|
-
},
|
|
17
|
-
"comate": {
|
|
18
|
-
"name": "bfc",
|
|
19
|
-
"version": "1.0.0",
|
|
20
|
-
"icon": "./assets/bfc-icon.png",
|
|
21
|
-
"entry": "./dist/index.js",
|
|
22
|
-
"displayName": "BFC",
|
|
23
|
-
"description": "BFC 用例生成插件",
|
|
24
|
-
"keyword": [
|
|
25
|
-
"BFC"
|
|
26
|
-
],
|
|
27
|
-
"author": [
|
|
28
|
-
{
|
|
29
|
-
"name": "lixin79",
|
|
30
|
-
"email": "lixin79@baidu.com"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"capabilities": [
|
|
34
|
-
{
|
|
35
|
-
"type": "Skill",
|
|
36
|
-
"name": "bfc-help",
|
|
37
|
-
"displayName": "插件介绍",
|
|
38
|
-
"description": "插件介绍",
|
|
39
|
-
"placeholder": "无需输入内容,回车获得插件介绍"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"type": "Skill",
|
|
43
|
-
"name": "genBfcCode",
|
|
44
|
-
"displayName": "生成BFC代码",
|
|
45
|
-
"description": "生成BFC代码",
|
|
46
|
-
"placeholder": "生成BFC代码"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"type": "Skill",
|
|
50
|
-
"name": "genAbnormalCode",
|
|
51
|
-
"displayName": "生成异常用例",
|
|
52
|
-
"description": "生成异常用例",
|
|
53
|
-
"placeholder": "请按序提供请求路径、请求名称、接口名称,以空格区分"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "Skill",
|
|
57
|
-
"name": "bfcInstructMode",
|
|
58
|
-
"displayName": "BFC用例指令",
|
|
59
|
-
"description": "BFC用例指令",
|
|
60
|
-
"placeholder": "请按[业务线:指令内容]格式输入指令,中文冒号"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"type": "Skill",
|
|
64
|
-
"name": "getBatchCases",
|
|
65
|
-
"displayName": "获取自动化用例列表",
|
|
66
|
-
"description": "获取自动化用例列表"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"configSchema": {
|
|
70
|
-
"enabled": true,
|
|
71
|
-
"sections": [
|
|
72
|
-
{
|
|
73
|
-
"title": "配置",
|
|
74
|
-
"properties": {
|
|
75
|
-
"projectId": {
|
|
76
|
-
"type": "string",
|
|
77
|
-
"title": "项目 ID",
|
|
78
|
-
"description": "项目 ID"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
Binary file
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { FallbackProvider, TaskProgressChunkStream, SkillProvider, StringChunkStream } from '@comate/plugin-host';
|
|
2
|
-
|
|
3
|
-
function jsx(type, props) {
|
|
4
|
-
// 按照React的逻辑,`boolean`、`null`、`undefined`是不会显示出来的
|
|
5
|
-
const children = Array.isArray(props.children) ? props.children.filter((v)=>v != null && typeof v !== 'boolean') : props.children;
|
|
6
|
-
return {
|
|
7
|
-
type,
|
|
8
|
-
...props,
|
|
9
|
-
children
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const fetchWithTimeout = (url, options, timeout = 60000)=>{
|
|
14
|
-
return Promise.race([
|
|
15
|
-
fetch(url, options),
|
|
16
|
-
new Promise((_, reject)=>setTimeout(()=>reject(new Error('Fetch timeout')), timeout))
|
|
17
|
-
]);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultAbilityUrl = 'http://10.138.182.237:8233/bpm/default';
|
|
21
|
-
const legoAbilityUrl = 'http://10.138.182.237:8233/bpm/lego';
|
|
22
|
-
const envSearchUrl = 'http://10.138.182.237:8233/bpm/env';
|
|
23
|
-
const bpmApiQueryUrl = 'http://10.138.182.237:8233/bpm/api';
|
|
24
|
-
const legoWidgetUrl = 'http://10.138.182.237:8233/bpm/lego/widget';
|
|
25
|
-
|
|
26
|
-
class HelpFallbackProvider extends FallbackProvider {
|
|
27
|
-
static{
|
|
28
|
-
this.description = '默认能力';
|
|
29
|
-
}
|
|
30
|
-
async *handleQuery() {
|
|
31
|
-
const stream = new TaskProgressChunkStream();
|
|
32
|
-
try {
|
|
33
|
-
const myHeaders = new Headers();
|
|
34
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
35
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
36
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
37
|
-
const raw = JSON.stringify({
|
|
38
|
-
query: this.currentContext.query,
|
|
39
|
-
user: realUserName
|
|
40
|
-
});
|
|
41
|
-
const options = {
|
|
42
|
-
method: 'POST',
|
|
43
|
-
headers: {
|
|
44
|
-
'Content-Type': 'application/json'
|
|
45
|
-
},
|
|
46
|
-
body: raw
|
|
47
|
-
};
|
|
48
|
-
const response = await fetchWithTimeout(defaultAbilityUrl, options);
|
|
49
|
-
const result = await response.json();
|
|
50
|
-
const data = result.data;
|
|
51
|
-
if (data.type === 'api_code') {
|
|
52
|
-
yield stream.flush(`api组件类型: ${data.componentType} \n\n\n`);
|
|
53
|
-
for (const [key, value] of Object.entries(data.content)){
|
|
54
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
55
|
-
closed: true,
|
|
56
|
-
language: 'java',
|
|
57
|
-
children: String(value)
|
|
58
|
-
}));
|
|
59
|
-
yield stream.flush('\n\n\n');
|
|
60
|
-
}
|
|
61
|
-
} else if (data.type === 'form_code') {
|
|
62
|
-
yield stream.flush(`发单代码:\n\n`);
|
|
63
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
64
|
-
closed: true,
|
|
65
|
-
language: 'java',
|
|
66
|
-
children: String(data.content.create_process_code)
|
|
67
|
-
}));
|
|
68
|
-
yield stream.flush('\n\n');
|
|
69
|
-
yield stream.flush(`Maven引入BPM SDK代码:\n\n`);
|
|
70
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
71
|
-
closed: true,
|
|
72
|
-
language: 'java',
|
|
73
|
-
children: String(data.content.maven_config_code)
|
|
74
|
-
}));
|
|
75
|
-
yield stream.flush('\n\n');
|
|
76
|
-
yield stream.flush(`BPM环境信息配置代码:\n\n`);
|
|
77
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
78
|
-
closed: true,
|
|
79
|
-
language: 'java',
|
|
80
|
-
children: String(data.content.bpm_config_code)
|
|
81
|
-
}));
|
|
82
|
-
yield stream.flush('\n\n');
|
|
83
|
-
} else {
|
|
84
|
-
yield stream.flushReplaceLast(`${result.data.content}`);
|
|
85
|
-
}
|
|
86
|
-
} catch (error) {
|
|
87
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@zhangzhehao01或稍后再试。${error}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
class LegoCodeProvider extends SkillProvider {
|
|
93
|
-
static{
|
|
94
|
-
this.skillName = 'lego代码生成';
|
|
95
|
-
}
|
|
96
|
-
static{
|
|
97
|
-
this.displayName = '乐高代码生成';
|
|
98
|
-
}
|
|
99
|
-
static{
|
|
100
|
-
this.description = '乐高代码生成';
|
|
101
|
-
}
|
|
102
|
-
static{
|
|
103
|
-
this.parameters = {
|
|
104
|
-
type: 'object',
|
|
105
|
-
properties: {}
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
async *execute() {
|
|
109
|
-
const stream = new TaskProgressChunkStream();
|
|
110
|
-
try {
|
|
111
|
-
const myHeaders = new Headers();
|
|
112
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
113
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
114
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
115
|
-
const raw = JSON.stringify({
|
|
116
|
-
query: this.currentContext.query,
|
|
117
|
-
user: realUserName
|
|
118
|
-
});
|
|
119
|
-
const options = {
|
|
120
|
-
method: 'POST',
|
|
121
|
-
headers: {
|
|
122
|
-
'Content-Type': 'application/json'
|
|
123
|
-
},
|
|
124
|
-
body: raw
|
|
125
|
-
};
|
|
126
|
-
const response = await fetchWithTimeout(legoAbilityUrl, options);
|
|
127
|
-
const result = await response.json();
|
|
128
|
-
const data = result.data;
|
|
129
|
-
if (data.type === 'api_code') {
|
|
130
|
-
yield stream.flush(`api组件类型: ${data.componentType} \n\n\n`);
|
|
131
|
-
for (const [key, value] of Object.entries(data.content)){
|
|
132
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
133
|
-
closed: true,
|
|
134
|
-
language: 'java',
|
|
135
|
-
children: String(value)
|
|
136
|
-
}));
|
|
137
|
-
yield stream.flush('\n\n\n');
|
|
138
|
-
}
|
|
139
|
-
} else if (data.type === 'form_code') {
|
|
140
|
-
yield stream.flush(`发单代码:\n\n`);
|
|
141
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
142
|
-
closed: true,
|
|
143
|
-
language: 'java',
|
|
144
|
-
children: String(data.content.create_process_code)
|
|
145
|
-
}));
|
|
146
|
-
yield stream.flush('\n\n');
|
|
147
|
-
yield stream.flush(`Maven引入BPM SDK代码:\n\n`);
|
|
148
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
149
|
-
closed: true,
|
|
150
|
-
language: 'java',
|
|
151
|
-
children: String(data.content.maven_config_code)
|
|
152
|
-
}));
|
|
153
|
-
yield stream.flush('\n\n');
|
|
154
|
-
yield stream.flush(`BPM环境信息配置代码:\n\n`);
|
|
155
|
-
yield stream.flush(/*#__PURE__*/ jsx("code-block", {
|
|
156
|
-
closed: true,
|
|
157
|
-
language: 'java',
|
|
158
|
-
children: String(data.content.bpm_config_code)
|
|
159
|
-
}));
|
|
160
|
-
yield stream.flush('\n\n');
|
|
161
|
-
} else {
|
|
162
|
-
yield stream.flushReplaceLast(`${result.data.content}`);
|
|
163
|
-
}
|
|
164
|
-
} catch (error) {
|
|
165
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@zhangzhehao01或稍后再试。${error}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
class EnvSearchProvider extends SkillProvider {
|
|
171
|
-
static{
|
|
172
|
-
this.skillName = '环境查询';
|
|
173
|
-
}
|
|
174
|
-
static{
|
|
175
|
-
this.displayName = '环境查询';
|
|
176
|
-
}
|
|
177
|
-
static{
|
|
178
|
-
this.description = '环境查询';
|
|
179
|
-
}
|
|
180
|
-
static{
|
|
181
|
-
this.parameters = {
|
|
182
|
-
type: 'object',
|
|
183
|
-
properties: {}
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
async *execute() {
|
|
187
|
-
const stream = new TaskProgressChunkStream();
|
|
188
|
-
try {
|
|
189
|
-
const myHeaders = new Headers();
|
|
190
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
191
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
192
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
193
|
-
const raw = JSON.stringify({
|
|
194
|
-
query: this.currentContext.query,
|
|
195
|
-
user: realUserName
|
|
196
|
-
});
|
|
197
|
-
const options = {
|
|
198
|
-
method: 'POST',
|
|
199
|
-
headers: {
|
|
200
|
-
'Content-Type': 'application/json'
|
|
201
|
-
},
|
|
202
|
-
body: raw
|
|
203
|
-
};
|
|
204
|
-
const response = await fetchWithTimeout(envSearchUrl, options);
|
|
205
|
-
const result = await response.json();
|
|
206
|
-
const data = result.data;
|
|
207
|
-
yield stream.flush(String(data.content));
|
|
208
|
-
yield stream.flush('\n\n\n');
|
|
209
|
-
} catch (error) {
|
|
210
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@zhangzhehao01或稍后再试。${error}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
class BpmApiQueryProvider extends SkillProvider {
|
|
216
|
-
static{
|
|
217
|
-
this.skillName = 'BPM接口查询';
|
|
218
|
-
}
|
|
219
|
-
static{
|
|
220
|
-
this.displayName = 'BPM接口查询';
|
|
221
|
-
}
|
|
222
|
-
static{
|
|
223
|
-
this.description = 'BPM接口查询';
|
|
224
|
-
}
|
|
225
|
-
static{
|
|
226
|
-
this.parameters = {
|
|
227
|
-
type: 'object',
|
|
228
|
-
properties: {}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
async *execute() {
|
|
232
|
-
const stream = new StringChunkStream();
|
|
233
|
-
try {
|
|
234
|
-
const myHeaders = new Headers();
|
|
235
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
236
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
237
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
238
|
-
const raw = JSON.stringify({
|
|
239
|
-
query: this.currentContext.query,
|
|
240
|
-
user: realUserName
|
|
241
|
-
});
|
|
242
|
-
const options = {
|
|
243
|
-
method: 'POST',
|
|
244
|
-
headers: {
|
|
245
|
-
'Content-Type': 'application/json'
|
|
246
|
-
},
|
|
247
|
-
body: raw
|
|
248
|
-
};
|
|
249
|
-
const response = await fetchWithTimeout(bpmApiQueryUrl, options);
|
|
250
|
-
const result = await response.json();
|
|
251
|
-
const data = result.data;
|
|
252
|
-
yield stream.flush(String(data.content));
|
|
253
|
-
yield stream.flush('\n\n\n');
|
|
254
|
-
} catch (error) {
|
|
255
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@zhangzhehao01或稍后再试。${error}`);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
class LegoWidgetProvider extends SkillProvider {
|
|
261
|
-
static{
|
|
262
|
-
this.skillName = 'LeGo表单控件查询';
|
|
263
|
-
}
|
|
264
|
-
static{
|
|
265
|
-
this.displayName = 'LeGo表单控件查询';
|
|
266
|
-
}
|
|
267
|
-
static{
|
|
268
|
-
this.description = 'LeGo表单控件查询';
|
|
269
|
-
}
|
|
270
|
-
static{
|
|
271
|
-
this.parameters = {
|
|
272
|
-
type: 'object',
|
|
273
|
-
properties: {}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
async *execute() {
|
|
277
|
-
const stream = new StringChunkStream();
|
|
278
|
-
try {
|
|
279
|
-
const myHeaders = new Headers();
|
|
280
|
-
myHeaders.append('Content-Type', 'application/json');
|
|
281
|
-
const userDetail = await this.currentUser.requestDetail();
|
|
282
|
-
const realUserName = userDetail && userDetail.name || '未知用户';
|
|
283
|
-
const raw = JSON.stringify({
|
|
284
|
-
query: this.currentContext.query,
|
|
285
|
-
user: realUserName
|
|
286
|
-
});
|
|
287
|
-
const options = {
|
|
288
|
-
method: 'POST',
|
|
289
|
-
headers: {
|
|
290
|
-
'Content-Type': 'application/json'
|
|
291
|
-
},
|
|
292
|
-
body: raw
|
|
293
|
-
};
|
|
294
|
-
const response = await fetchWithTimeout(legoWidgetUrl, options);
|
|
295
|
-
const result = await response.json();
|
|
296
|
-
const data = result.data;
|
|
297
|
-
yield stream.flush(String(data.content));
|
|
298
|
-
yield stream.flush('\n\n\n');
|
|
299
|
-
} catch (error) {
|
|
300
|
-
yield stream.flushReplaceLast(`请求出错,请联系负责人@zhangzhehao01或稍后再试。${error}`);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function setup({ registry }) {
|
|
306
|
-
registry.registerFallbackProvider('fallback', HelpFallbackProvider, true);
|
|
307
|
-
registry.registerSkillProvider('lego-code', LegoCodeProvider);
|
|
308
|
-
registry.registerSkillProvider('env-search', EnvSearchProvider);
|
|
309
|
-
registry.registerSkillProvider('bpm-api', BpmApiQueryProvider);
|
|
310
|
-
registry.registerSkillProvider('lego-widget', LegoWidgetProvider);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
export { setup };
|