cloudcc-cli 2.3.1 → 2.3.3
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/.claude/settings.json +25 -0
- package/.cloudcc-cache.json +21 -4
- package/.cursor/skills/cloudcc-cli-dev.zip +0 -0
- package/.cursor/skills/cloudcc-cli-usage/SKILL.md +68 -0
- package/README.md +22 -0
- package/bin/cc.js +13 -8
- package/bin/index.js +9 -2
- package/bin/mcp.js +1 -1
- package/build/component-CCPlugin1774500425584.common.js +831 -0
- package/build/component-CCPlugin1774500425584.common.js.map +1 -0
- package/build/component-CCPlugin1774500425584.css +1 -0
- package/build/component-CCPlugin1774500425584.umd.js +874 -0
- package/build/component-CCPlugin1774500425584.umd.js.map +1 -0
- package/build/component-CCPlugin1774500425584.umd.min.js +8 -0
- package/build/component-CCPlugin1774500425584.umd.min.js.map +1 -0
- package/build/demo.html +1 -0
- package/{src/mcp → mcp}/tools/Class Editor Guide/handler.js +12 -4
- package/{src/mcp → mcp}/tools/Component Editor Guide/handler.js +15 -14
- package/{src/mcp → mcp}/tools/Trigger Editor Guide/handler.js +8 -2
- package/package.json +3 -2
- package/src/application/doc.js +46 -0
- package/src/application/docs/devguide.md +173 -0
- package/src/application/docs/introduction.md +81 -0
- package/src/application/index.js +1 -0
- package/src/brief/get.js +1 -1
- package/src/classes/create.js +6 -1
- package/src/classes/delete.js +7 -1
- package/src/classes/detail.js +8 -1
- package/src/classes/doc.js +49 -472
- package/src/classes/docs/devguide.md +541 -0
- package/src/classes/get.js +9 -2
- package/src/classes/index.js +2 -1
- package/src/classes/publish.js +6 -1
- package/src/classes/pull.js +6 -1
- package/src/classes/pullList.js +6 -3
- package/src/config/doc.js +31 -0
- package/src/config/docs/devguide.md +100 -0
- package/src/config/index.js +5 -0
- package/src/customPage/create.js +52 -19
- package/src/customPage/doc.js +46 -0
- package/src/customPage/docs/devguide.md +200 -0
- package/{.cursor/skills/cloudcc-cli-dev/docs//350/207/252/345/256/232/344/271/211/351/241/265/351/235/242.md → src/customPage/docs/introduction.md} +1 -5
- package/src/customPage/index.js +1 -0
- package/src/customSetting/create.js +9 -0
- package/src/customSetting/delete.js +10 -1
- package/src/customSetting/deleteCustomSettingField.js +43 -0
- package/src/customSetting/detail.js +10 -1
- package/src/customSetting/doc.js +22 -179
- package/src/customSetting/docs/devguide.md +181 -0
- package/src/customSetting/docs/introduction.md +3 -0
- package/src/customSetting/editCustomSettingField.js +34 -0
- package/src/customSetting/get.js +9 -0
- package/src/customSetting/index.js +6 -1
- package/src/customSetting/modify.js +30 -0
- package/src/customSetting/saveCustomSettingField.js +46 -0
- package/src/fields/doc.js +45 -0
- package/src/fields/docs/devguide.md +224 -0
- package/src/fields/docs/introduction.md +217 -0
- package/src/fields/index.js +1 -0
- package/src/globalSelectList/create.js +51 -0
- package/src/globalSelectList/delete.js +56 -0
- package/src/globalSelectList/detail.js +45 -0
- package/src/globalSelectList/doc.js +52 -0
- package/src/globalSelectList/docs/devguide.md +153 -0
- package/src/globalSelectList/docs/introduction.md +82 -0
- package/src/globalSelectList/get.js +31 -0
- package/src/globalSelectList/index.js +16 -0
- package/src/menu/create-page.js +43 -6
- package/src/menu/create-script.js +67 -19
- package/src/menu/doc.js +57 -0
- package/src/menu/docs/devguide.md +129 -0
- package/src/menu/docs/introduction.md +99 -0
- package/src/menu/index.js +1 -0
- package/src/menu/validator.js +80 -0
- package/src/object/doc.js +45 -0
- package/src/object/docs/devguide.md +112 -0
- package/src/object/docs/introduction.md +187 -0
- package/src/object/get.js +1 -23
- package/src/object/index.js +1 -0
- package/src/pagelayout/create.js +123 -0
- package/src/pagelayout/delete.js +57 -0
- package/src/pagelayout/doc.js +46 -0
- package/src/pagelayout/docs/devguide.md +83 -0
- package/src/pagelayout/docs/introduction.md +44 -0
- package/src/pagelayout/get.js +46 -0
- package/src/pagelayout/index.js +10 -0
- package/src/plugin/doc.js +43 -863
- package/src/plugin/docs/devguide.md +996 -0
- package/src/profile/create.js +108 -0
- package/src/profile/delete.js +59 -0
- package/src/profile/doc.js +46 -0
- package/src/profile/docs/devguide.md +77 -0
- package/src/profile/docs/introduction.md +123 -0
- package/src/profile/get.js +55 -0
- package/src/profile/index.js +14 -0
- package/src/project/doc.js +39 -372
- package/src/project/docs/devguide.md +359 -0
- package/src/project/docs/introduction.md +3 -0
- package/src/recordType/create.js +77 -0
- package/src/recordType/delete.js +52 -0
- package/src/recordType/doc.js +36 -0
- package/src/recordType/docs/devguide.md +160 -0
- package/src/recordType/docs/introduction.md +53 -0
- package/src/recordType/editInfo.js +39 -0
- package/src/recordType/editSave.js +47 -0
- package/src/recordType/getList.js +31 -0
- package/src/recordType/index.js +16 -3
- package/src/recordType/newInfo.js +39 -0
- package/src/recordType/validDelete.js +91 -0
- package/src/res.md +66 -0
- package/src/role/create.js +153 -0
- package/src/role/delete.js +59 -0
- package/src/role/doc.js +46 -0
- package/src/role/docs/devguide.md +81 -0
- package/src/role/docs/introduction.md +124 -0
- package/src/role/get.js +57 -0
- package/src/role/index.js +10 -0
- package/src/scheduleJob/doc.js +49 -0
- package/src/scheduleJob/docs/devguide.md +79 -0
- package/src/scheduleJob/docs/introduction.md +101 -0
- package/src/scheduleJob/index.js +5 -0
- package/src/script/delete.js +112 -0
- package/src/script/doc.js +31 -245
- package/src/script/docs/devguide.md +290 -0
- package/src/script/docs/introduction.md +48 -0
- package/src/script/index.js +1 -0
- package/src/staticResource/count.js +31 -10
- package/src/staticResource/create.js +97 -0
- package/src/staticResource/delete.js +30 -8
- package/src/staticResource/detail.js +32 -10
- package/src/staticResource/doc.js +21 -88
- package/src/staticResource/docs/devguide.md +157 -0
- package/src/staticResource/docs/introduction.md +3 -0
- package/src/staticResource/get.js +31 -8
- package/src/staticResource/index.js +2 -1
- package/src/timer/create.js +6 -1
- package/src/timer/delete.js +7 -1
- package/src/timer/detail.js +5 -5
- package/src/timer/doc.js +57 -0
- package/{.cursor/skills/cloudcc-cli-dev/docs/cloudcc/345/256/232/346/227/266/344/275/234/344/270/232.md → src/timer/docs/devguide.md} +83 -1
- package/src/timer/get.js +7 -1
- package/src/timer/index.js +3 -1
- package/src/timer/publish.js +6 -1
- package/src/timer/pull.js +6 -1
- package/src/timer/pullList.js +5 -3
- package/src/triggers/detail.js +5 -5
- package/src/triggers/doc.js +49 -364
- package/src/triggers/docs/devguide.md +442 -0
- package/src/triggers/get.js +7 -3
- package/src/triggers/index.js +1 -4
- package/src/triggers/pullList.js +7 -7
- package/src/user/create.js +50 -0
- package/src/user/delete.js +59 -0
- package/src/user/doc.js +46 -0
- package/src/user/docs/devguide.md +122 -0
- package/src/user/docs/introduction.md +124 -0
- package/src/user/get.js +112 -0
- package/src/user/index.js +12 -0
- package/src/user/update.js +96 -0
- package/src/user/view.js +60 -0
- package/test/classes.cli.test.js +7 -4
- package/test/customPage.cli.test.js +96 -0
- package/test/globalSelectList.cli.test.js +94 -0
- package/test/menu-script.cli.test.js +147 -0
- package/test/menu.cli.test.js +8 -1
- package/test/plugin.cli.test.js +5 -3
- package/test/timer.cli.test.js +15 -8
- package/test/trigger.cli.test.js +5 -3
- package/.cursor/skills/cloudcc-cli-dev/BACKEND_CLASS.md +0 -111
- package/.cursor/skills/cloudcc-cli-dev/BACKEND_SCHEDULE.md +0 -152
- package/.cursor/skills/cloudcc-cli-dev/BACKEND_TRIGGER.md +0 -150
- package/.cursor/skills/cloudcc-cli-dev/CLI_CHEATSHEET.md +0 -372
- package/.cursor/skills/cloudcc-cli-dev/CUSTOM-SETTING-API.md +0 -62
- package/.cursor/skills/cloudcc-cli-dev/INSTALL_AND_BOOTSTRAP.md +0 -62
- package/.cursor/skills/cloudcc-cli-dev/OBJECTS_AND_FIELDS.md +0 -214
- package/.cursor/skills/cloudcc-cli-dev/REQUIREMENTS_BREAKDOWN.md +0 -113
- package/.cursor/skills/cloudcc-cli-dev/SKILL.md +0 -66
- package/.cursor/skills/cloudcc-cli-dev/STATIC-RESOURCE-API.md +0 -60
- package/.cursor/skills/cloudcc-cli-dev/VUE_CUSTOM_COMPONENT.md +0 -151
- package/.cursor/skills/cloudcc-cli-dev/VUE_CUSTOM_PAGE.md +0 -216
- package/src/approval/approve.js +0 -105
- package/src/approval/get.js +0 -245
- package/src/approval/index.js +0 -11
- package/src/approval/reject.js +0 -105
- package/src/plugin/readme.md +0 -7
- /package/{src/mcp → mcp}/cliRunner.js +0 -0
- /package/{src/mcp → mcp}/index.js +0 -0
- /package/{src/mcp → mcp}/readme.md +0 -0
- /package/{src/mcp → mcp}/tools/Application Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Approval/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Class Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Class Detail Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Class List Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Class Publisher/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Class Puller/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Client Script Detail Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Client Script Editor Guide/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Client Script List Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Client Script Publisher/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Client Script Puller/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/CloudCC Development Overview/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Component Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Component Detail Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Component List Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Component Publisher/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Component Puller/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Dev Environment Creator/fetcher.js +0 -0
- /package/{src/mcp → mcp}/tools/Dev Environment Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Dev Environment Validator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Developer Key Setup Guide/fetcher.js +0 -0
- /package/{src/mcp → mcp}/tools/Developer Key Setup Guide/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/JSP Migrator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Menu Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Object Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Object Fields Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Object Fields Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Object List Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Scheduled Class Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Scheduled Class Detail Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Scheduled Class List Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Scheduled Class Publisher/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Scheduled Class Puller/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Trigger Creator/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Trigger Detail Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Trigger List Retriever/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Trigger Publisher/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/Trigger Puller/handler.js +0 -0
- /package/{src/mcp → mcp}/tools/index.js +0 -0
- /package/{.cursor/skills/cloudcc-cli-dev/docs//350/207/252/345/256/232/344/271/211/347/261/273.md" → src/classes/docs/introduction.md} +0 -0
- /package/{.cursor/skills/cloudcc-cli-dev/docs/CloudCC/350/207/252/345/256/232/344/271/211/347/273/204/344/273/266/344/275/277/347/224/250/350/257/264/346/230/216.md" → src/plugin/docs/introduction.md} +0 -0
- /package/{.cursor/skills/cloudcc-cli-dev/docs/cloudcc/345/256/232/346/227/266/347/261/273.md" → src/timer/docs/introduction.md} +0 -0
- /package/{.cursor/skills/cloudcc-cli-dev/docs//350/247/246/345/217/221/345/231/250/347/261/273.md" → src/triggers/docs/introduction.md} +0 -0
|
@@ -1,25 +1,46 @@
|
|
|
1
1
|
const { getPackageJson } = require("../../utils/config");
|
|
2
|
-
const
|
|
2
|
+
const BaseUrl = "https://developer.apis.cloudcc.cn";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 静态资源 - 容量统计
|
|
6
|
+
* CLI: cc count staticResource <projectPath> [encodedCondJson]
|
|
7
|
+
* 参数说明:
|
|
8
|
+
* - projectPath: 项目根目录,默认 process.cwd()
|
|
9
|
+
* - encodedCondJson(可选): encodeURI(JSON.stringify(body))
|
|
10
|
+
* - body: 统计条件对象(可为空 {})
|
|
11
|
+
* 请求头说明:
|
|
12
|
+
* - accessToken: 从 cloudcc-cli.config.js 读取
|
|
13
|
+
* - source: 默认 cloudcc_cli
|
|
14
|
+
*/
|
|
4
15
|
async function count(projectPath = process.cwd(), encodedCondJson, isMcp = false) {
|
|
5
16
|
let body = {};
|
|
6
17
|
if (encodedCondJson) {
|
|
7
18
|
body = JSON.parse(decodeURI(encodedCondJson));
|
|
8
19
|
}
|
|
9
20
|
const config = await getPackageJson(projectPath);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
const devSvcDispatch = config.devSvcDispatch || "/devconsole";
|
|
22
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
23
|
+
const res = await fetch(
|
|
24
|
+
`${baseUrl}${devSvcDispatch}/staticResource/countStaticResource`,
|
|
25
|
+
{
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
29
|
+
accessToken: config.accessToken,
|
|
30
|
+
source: config.source || "cloudcc_cli",
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify(body),
|
|
33
|
+
}
|
|
14
34
|
);
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
const data = await res.json();
|
|
36
|
+
if (data && (data.result || String(data.returnCode) === "200" || String(data.returnCode).endsWith("-OK"))) {
|
|
37
|
+
const countData = data.data || {};
|
|
17
38
|
if (!isMcp) {
|
|
18
|
-
console.log(JSON.stringify(
|
|
39
|
+
console.log(JSON.stringify(countData));
|
|
19
40
|
}
|
|
20
|
-
return
|
|
41
|
+
return countData;
|
|
21
42
|
}
|
|
22
|
-
throw new Error("Count Static Resource Failed: " + (
|
|
43
|
+
throw new Error("Count Static Resource Failed: " + (data?.returnInfo || data?.message || "Unknown error"));
|
|
23
44
|
}
|
|
24
45
|
|
|
25
46
|
module.exports = count;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 静态资源 - 新建/编辑(上传)
|
|
3
|
+
* CLI: cc create staticResource <projectPath> <encodedBodyJson>
|
|
4
|
+
* 参数说明:
|
|
5
|
+
* - projectPath: 项目根目录
|
|
6
|
+
* - encodedBodyJson: encodeURI(JSON.stringify(body))
|
|
7
|
+
* - body:
|
|
8
|
+
* {
|
|
9
|
+
* filePath?: string, // 新建必填;编辑不换文件可不传
|
|
10
|
+
* label: string, // 必填
|
|
11
|
+
* desc?: string, // 可选
|
|
12
|
+
* id?: string, // 编辑时传
|
|
13
|
+
* name?: string, // 可选,不传默认取文件名
|
|
14
|
+
* type?: string // 可选,不传默认取文件后缀
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
const fs = require("fs");
|
|
18
|
+
const path = require("path");
|
|
19
|
+
const chalk = require("chalk");
|
|
20
|
+
const { getPackageJson } = require("../../utils/config");
|
|
21
|
+
|
|
22
|
+
const BaseUrl = "https://developer.apis.cloudcc.cn";
|
|
23
|
+
|
|
24
|
+
async function create(projectPath = process.cwd(), encodedBodyJson) {
|
|
25
|
+
if (!encodedBodyJson) {
|
|
26
|
+
throw new Error("Create Static Resource Failed: encodedBodyJson is required");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const body = JSON.parse(decodeURI(encodedBodyJson));
|
|
30
|
+
const { filePath, label, desc = "", id = "", name, type } = body || {};
|
|
31
|
+
|
|
32
|
+
if (!label) {
|
|
33
|
+
throw new Error("Create Static Resource Failed: label is required");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const config = await getPackageJson(projectPath);
|
|
37
|
+
if (!config || !config.accessToken) {
|
|
38
|
+
throw new Error("Create Static Resource Failed: accessToken is missing");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const devSvcDispatch = config.devSvcDispatch || "/devconsole";
|
|
42
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
43
|
+
const url = `${baseUrl}${devSvcDispatch}/staticResource/saveStaticResource`;
|
|
44
|
+
|
|
45
|
+
const formData = new FormData();
|
|
46
|
+
formData.append("label", String(label));
|
|
47
|
+
formData.append("desc", String(desc));
|
|
48
|
+
if (id) {
|
|
49
|
+
formData.append("id", String(id));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (filePath) {
|
|
53
|
+
const absPath = path.isAbsolute(filePath) ? filePath : path.resolve(projectPath, filePath);
|
|
54
|
+
if (!fs.existsSync(absPath)) {
|
|
55
|
+
throw new Error(`Create Static Resource Failed: file not found - ${absPath}`);
|
|
56
|
+
}
|
|
57
|
+
const fileBuffer = fs.readFileSync(absPath);
|
|
58
|
+
const fileName = name || path.basename(absPath);
|
|
59
|
+
const fileType = type || path.extname(fileName).replace(".", "");
|
|
60
|
+
formData.append("name", fileName);
|
|
61
|
+
formData.append("type", fileType);
|
|
62
|
+
formData.append("file", new Blob([fileBuffer]), fileName);
|
|
63
|
+
} else {
|
|
64
|
+
// 编辑且不更换文件时,按接口约定传空字符串。
|
|
65
|
+
formData.append("file", "");
|
|
66
|
+
if (name) {
|
|
67
|
+
formData.append("name", String(name));
|
|
68
|
+
}
|
|
69
|
+
if (type) {
|
|
70
|
+
formData.append("type", String(type));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.error();
|
|
75
|
+
console.error(chalk.green("Saving static resource, please wait..."));
|
|
76
|
+
console.error();
|
|
77
|
+
|
|
78
|
+
const res = await fetch(url, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: {
|
|
81
|
+
accessToken: config.accessToken,
|
|
82
|
+
source: config.source || "cloudcc_cli",
|
|
83
|
+
},
|
|
84
|
+
body: formData,
|
|
85
|
+
});
|
|
86
|
+
const result = await res.json();
|
|
87
|
+
|
|
88
|
+
if (result && (result.result || String(result.returnCode) === "200" || String(result.returnCode).endsWith("-OK"))) {
|
|
89
|
+
console.error(chalk.green("Success! Static resource saved."));
|
|
90
|
+
console.error();
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
throw new Error("Create Static Resource Failed: " + (result?.returnInfo || result?.message || "Unknown error"));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = create;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
const chalk = require("chalk");
|
|
2
2
|
const { getPackageJson } = require("../../utils/config");
|
|
3
|
-
const
|
|
3
|
+
const BaseUrl = "https://developer.apis.cloudcc.cn";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 静态资源 - 删除
|
|
7
|
+
* CLI: cc delete staticResource <projectPath> <resourceId>
|
|
8
|
+
* 参数说明:
|
|
9
|
+
* - projectPath: 项目根目录,默认 process.cwd()
|
|
10
|
+
* - id(resourceId): 静态资源 id(必填)
|
|
11
|
+
* 请求体说明:
|
|
12
|
+
* - { id }
|
|
13
|
+
* 请求头说明:
|
|
14
|
+
* - accessToken: 从 cloudcc-cli.config.js 读取
|
|
15
|
+
* - source: 默认 cloudcc_cli
|
|
16
|
+
*/
|
|
5
17
|
async function remove(projectPath = process.cwd(), id) {
|
|
6
18
|
if (!id) {
|
|
7
19
|
throw new Error("Delete Static Resource Failed: id is required");
|
|
@@ -10,17 +22,27 @@ async function remove(projectPath = process.cwd(), id) {
|
|
|
10
22
|
console.error();
|
|
11
23
|
console.error(chalk.green(`Deleting static resource (${id}), please wait...`));
|
|
12
24
|
console.error();
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
const devSvcDispatch = config.devSvcDispatch || "/devconsole";
|
|
26
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
27
|
+
const res = await fetch(
|
|
28
|
+
`${baseUrl}${devSvcDispatch}/staticResource/deleteStaticResource`,
|
|
29
|
+
{
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
33
|
+
accessToken: config.accessToken,
|
|
34
|
+
source: config.source || "cloudcc_cli",
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify({ id }),
|
|
37
|
+
}
|
|
17
38
|
);
|
|
18
|
-
|
|
39
|
+
const data = await res.json();
|
|
40
|
+
if (data && (data.result || String(data.returnCode) === "200" || String(data.returnCode).endsWith("-OK"))) {
|
|
19
41
|
console.error(chalk.green("Success! Static resource deleted."));
|
|
20
42
|
console.error();
|
|
21
|
-
return
|
|
43
|
+
return data;
|
|
22
44
|
}
|
|
23
|
-
throw new Error("Delete Static Resource Failed: " + (
|
|
45
|
+
throw new Error("Delete Static Resource Failed: " + (data?.returnInfo || data?.message || "Unknown error"));
|
|
24
46
|
}
|
|
25
47
|
|
|
26
48
|
module.exports = remove;
|
|
@@ -1,24 +1,46 @@
|
|
|
1
1
|
const { getPackageJson } = require("../../utils/config");
|
|
2
|
-
const
|
|
2
|
+
const BaseUrl = "https://developer.apis.cloudcc.cn";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 静态资源 - 查询详情
|
|
6
|
+
* CLI: cc detail staticResource <projectPath> <resourceId>
|
|
7
|
+
* 参数说明:
|
|
8
|
+
* - projectPath: 项目根目录,默认 process.cwd()
|
|
9
|
+
* - id(resourceId): 静态资源 id(必填)
|
|
10
|
+
* 请求体说明:
|
|
11
|
+
* - { id }
|
|
12
|
+
* 请求头说明:
|
|
13
|
+
* - accessToken: 从 cloudcc-cli.config.js 读取
|
|
14
|
+
* - source: 默认 cloudcc_cli
|
|
15
|
+
*/
|
|
4
16
|
async function detail(projectPath = process.cwd(), id, isMcp = false) {
|
|
5
17
|
if (!id) {
|
|
6
18
|
throw new Error("Static Resource detail requires id");
|
|
7
19
|
}
|
|
8
20
|
const config = await getPackageJson(projectPath);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
const devSvcDispatch = config.devSvcDispatch || "/devconsole";
|
|
22
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
23
|
+
const res = await fetch(
|
|
24
|
+
`${baseUrl}${devSvcDispatch}/staticResource/detailStaticResource`,
|
|
25
|
+
{
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
29
|
+
accessToken: config.accessToken,
|
|
30
|
+
source: config.source || "cloudcc_cli",
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify({ id }),
|
|
33
|
+
}
|
|
13
34
|
);
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
const data = await res.json();
|
|
36
|
+
if (data && (data.result || String(data.returnCode) === "200" || String(data.returnCode).endsWith("-OK"))) {
|
|
37
|
+
const detailData = data.data || {};
|
|
16
38
|
if (!isMcp) {
|
|
17
|
-
console.log(JSON.stringify(
|
|
39
|
+
console.log(JSON.stringify(detailData));
|
|
18
40
|
}
|
|
19
|
-
return
|
|
41
|
+
return detailData;
|
|
20
42
|
}
|
|
21
|
-
throw new Error("Get Static Resource Detail Failed: " + (
|
|
43
|
+
throw new Error("Get Static Resource Detail Failed: " + (data?.returnInfo || data?.message || "Unknown error"));
|
|
22
44
|
}
|
|
23
45
|
|
|
24
46
|
module.exports = detail;
|
|
@@ -1,103 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* staticResource
|
|
2
|
+
* staticResource 文档入口:仅读取 docs/devguide.md。
|
|
3
3
|
*/
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"# CloudCC 静态资源(Static Resource)操作指南",
|
|
10
|
-
"",
|
|
11
|
-
"直接查看:`cc doc staticResource`",
|
|
12
|
-
"",
|
|
13
|
-
"> 静态资源用于在平台侧保存并复用静态文件(如图片、JS、CSS、压缩包等)。",
|
|
14
|
-
"> 本文档包含页面操作要点 + 相关接口速查(附录自动引入)。",
|
|
15
|
-
"",
|
|
16
|
-
"---",
|
|
17
|
-
"",
|
|
18
|
-
"## 1. 常见操作流程",
|
|
19
|
-
"",
|
|
20
|
-
"### 1.1 查询列表",
|
|
21
|
-
"",
|
|
22
|
-
"- 在静态资源列表页查看已有资源",
|
|
23
|
-
"- 可按 `label`(标签/名称)筛选(部分页面当前固定传空)",
|
|
24
|
-
"",
|
|
25
|
-
"### 1.2 新建静态资源(上传)",
|
|
26
|
-
"",
|
|
27
|
-
"核心字段:",
|
|
28
|
-
"- `label`:标签/名称(必填)",
|
|
29
|
-
"- `file`:上传文件(新建必传)",
|
|
30
|
-
"- `name`:文件名(通常取上传文件名)",
|
|
31
|
-
"- `type`:文件后缀(通常从文件名提取)",
|
|
32
|
-
"- `desc`:描述(可选)",
|
|
33
|
-
"",
|
|
34
|
-
"### 1.3 编辑静态资源",
|
|
35
|
-
"",
|
|
36
|
-
"- 编辑时需要传 `id`",
|
|
37
|
-
"- 若不重新上传文件,`file` 通常传空字符串 `\"\"`(以接口契约为准)",
|
|
38
|
-
"",
|
|
39
|
-
"### 1.4 查看详情",
|
|
40
|
-
"",
|
|
41
|
-
"- 通过资源 `id` 打开查看弹窗/详情接口",
|
|
42
|
-
"",
|
|
43
|
-
"### 1.5 删除静态资源",
|
|
44
|
-
"",
|
|
45
|
-
"- 通过资源 `id` 删除",
|
|
46
|
-
"- 删除前建议确认是否被页面、脚本或组件引用",
|
|
47
|
-
"",
|
|
48
|
-
"### 1.6 上传前容量校验",
|
|
49
|
-
"",
|
|
50
|
-
"- 上传前可先调用容量统计接口,获取当前占用大小",
|
|
51
|
-
"- 前端通常据此判断总大小是否超限(常见阈值约 15MB,具体以产品为准)",
|
|
52
|
-
"",
|
|
53
|
-
"---",
|
|
54
|
-
"",
|
|
55
|
-
"## 2. 接口与动作映射",
|
|
56
|
-
"",
|
|
57
|
-
"- **列表**:`POST /staticResource/listStaticResource`",
|
|
58
|
-
"- **详情**:`POST /staticResource/detailStaticResource`(`id`)",
|
|
59
|
-
"- **新建/编辑**:`POST /staticResource/saveStaticResource`(`FormData`)",
|
|
60
|
-
"- **删除**:`POST /staticResource/deleteStaticResource`(`id`)",
|
|
61
|
-
"- **容量统计**:`POST /staticResource/countStaticResource`",
|
|
62
|
-
"",
|
|
63
|
-
"---",
|
|
64
|
-
"",
|
|
65
|
-
"## 3. Checklist",
|
|
66
|
-
"",
|
|
67
|
-
"- [ ] 上传前已通过容量统计确认大小不会超限",
|
|
68
|
-
"- [ ] `label` 清晰可检索,避免重复命名",
|
|
69
|
-
"- [ ] 编辑不换文件时,确认 `file` 参数是否应传空字符串",
|
|
70
|
-
"- [ ] 删除前确认没有被页面/脚本/组件引用",
|
|
71
|
-
"",
|
|
72
|
-
];
|
|
7
|
+
const DOCS_DIR = path.join(__dirname, "docs");
|
|
8
|
+
const DEVGUIDE = path.join(DOCS_DIR, "devguide.md");
|
|
73
9
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let apiContent = "";
|
|
10
|
+
function generateFullMarkdownDoc() {
|
|
11
|
+
let content = "";
|
|
77
12
|
try {
|
|
78
|
-
|
|
13
|
+
content = fs.readFileSync(DEVGUIDE, "utf8").trim();
|
|
79
14
|
} catch (e) {
|
|
80
|
-
|
|
15
|
+
content = `# CloudCC 静态资源(Static Resource)操作指南\n\n(未找到文件:${DEVGUIDE})\n`;
|
|
81
16
|
}
|
|
82
17
|
|
|
83
|
-
return
|
|
84
|
-
base,
|
|
85
|
-
"",
|
|
86
|
-
"---",
|
|
87
|
-
"",
|
|
88
|
-
"## 附录:静态资源接口速查",
|
|
89
|
-
"",
|
|
90
|
-
"> 来源:`cloudcc-cli-dev/STATIC-RESOURCE-API.md`",
|
|
91
|
-
"",
|
|
92
|
-
apiContent.trim(),
|
|
93
|
-
"",
|
|
94
|
-
].join("\n");
|
|
18
|
+
return content;
|
|
95
19
|
}
|
|
96
20
|
|
|
97
|
-
function doc() {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
21
|
+
function doc(argvs = []) {
|
|
22
|
+
const subType = String(argvs[2] || "").trim().toLowerCase();
|
|
23
|
+
if (!subType || subType === "devguide") {
|
|
24
|
+
const content = generateFullMarkdownDoc();
|
|
25
|
+
console.log(content);
|
|
26
|
+
return content;
|
|
27
|
+
}
|
|
28
|
+
if (subType === "introduction") {
|
|
29
|
+
const content = getIntroductionDoc();
|
|
30
|
+
console.log(content);
|
|
31
|
+
return content;
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`doc 不支持的子命令: ${argvs[2]},请使用 introduction 或 devguide`);
|
|
101
34
|
}
|
|
102
35
|
|
|
103
36
|
doc.getEditGuide = doc;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# 静态资源(Static Resource)操作指南
|
|
2
|
+
|
|
3
|
+
直接查看:`cc doc staticResource`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 常见操作
|
|
8
|
+
|
|
9
|
+
- 查询静态资源列表
|
|
10
|
+
- 查看静态资源详情
|
|
11
|
+
- 新建/编辑静态资源(上传)
|
|
12
|
+
- 删除静态资源
|
|
13
|
+
- 查询静态资源容量(上传前校验)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. 常用 CLI 命令
|
|
18
|
+
|
|
19
|
+
### 1) 查看静态资源指导文档
|
|
20
|
+
|
|
21
|
+
命令:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cc doc staticResource
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
说明:输出静态资源完整操作文档,并自动附带本文件内容。
|
|
28
|
+
|
|
29
|
+
### 2) 查询静态资源列表
|
|
30
|
+
|
|
31
|
+
命令:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cc get staticResource <projectPath> [encodedCondJson]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
参数说明:
|
|
38
|
+
|
|
39
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
40
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
41
|
+
| projectPath | string | 非必须 | 当前目录 | 项目根目录 |
|
|
42
|
+
| encodedCondJson | string | 非必须 | — | `encodeURI(JSON.stringify(body))` 后的查询条件 |
|
|
43
|
+
|
|
44
|
+
请求体(decoded 后)常用字段:
|
|
45
|
+
|
|
46
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
47
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
48
|
+
| label | string | 非必须 | `""` | 可用于按标签/名称筛选 |
|
|
49
|
+
|
|
50
|
+
### 3) 查询静态资源详情
|
|
51
|
+
|
|
52
|
+
命令:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cc detail staticResource <projectPath> <resourceId>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
参数说明:
|
|
59
|
+
|
|
60
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
61
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
62
|
+
| projectPath | string | 非必须 | 当前目录 | 项目根目录 |
|
|
63
|
+
| resourceId | string | 必须 | — | 静态资源 id |
|
|
64
|
+
|
|
65
|
+
### 4) 新建/编辑静态资源(上传)
|
|
66
|
+
|
|
67
|
+
命令:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cc create staticResource <projectPath> <encodedBodyJson>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
参数说明:
|
|
74
|
+
|
|
75
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
76
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
77
|
+
| projectPath | string | 非必须 | 当前目录 | 项目根目录 |
|
|
78
|
+
| encodedBodyJson | string | 必须 | — | `encodeURI(JSON.stringify(body))` |
|
|
79
|
+
|
|
80
|
+
请求体(decoded 后)字段:
|
|
81
|
+
|
|
82
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
83
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
84
|
+
| filePath | string | 视场景 | — | 新建必填;编辑不换文件可不传 |
|
|
85
|
+
| label | string | 必须 | — | 标签/名称 |
|
|
86
|
+
| desc | string | 非必须 | `""` | 描述 |
|
|
87
|
+
| id | string | 仅编辑 | `""` | 编辑时传静态资源 id |
|
|
88
|
+
| name | string | 非必须 | 文件名 | 不传则从 `filePath` 推导 |
|
|
89
|
+
| type | string | 非必须 | 文件后缀 | 不传则从文件名推导 |
|
|
90
|
+
|
|
91
|
+
### 5) 删除静态资源
|
|
92
|
+
|
|
93
|
+
命令:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cc delete staticResource <projectPath> <resourceId>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
参数说明:
|
|
100
|
+
|
|
101
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
102
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
103
|
+
| projectPath | string | 非必须 | 当前目录 | 项目根目录 |
|
|
104
|
+
| resourceId | string | 必须 | — | 静态资源 id |
|
|
105
|
+
|
|
106
|
+
### 6) 统计静态资源容量(上传前校验)
|
|
107
|
+
|
|
108
|
+
命令:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cc count staticResource <projectPath> [encodedCondJson]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
参数说明:
|
|
115
|
+
|
|
116
|
+
| 参数名称 | 类型 | 是否必须 | 默认值 | 备注 |
|
|
117
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
118
|
+
| projectPath | string | 非必须 | 当前目录 | 项目根目录 |
|
|
119
|
+
| encodedCondJson | string | 非必须 | — | 当前实现通常不传,传值时同样为 `encodeURI(JSON.stringify(body))` |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 3. 示例
|
|
124
|
+
|
|
125
|
+
### 按 label 查询列表
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
cc get staticResource . "$(node -e 'console.log(encodeURI(JSON.stringify({label:\"logo\"})))')"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 查询容量统计
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
cc count staticResource .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 新建静态资源(上传文件)
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
cc create staticResource . "$(node -e "console.log(encodeURI(JSON.stringify({filePath:'./assets/logo.png',label:'logo_png',desc:'cli upload'})))")"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 编辑静态资源(不替换文件)
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
cc create staticResource . "$(node -e "console.log(encodeURI(JSON.stringify({id:'69c4f469ec9eb4d5c8a1b76d',label:'logo_png_v2',desc:'rename only'})))")"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 4. Checklist
|
|
152
|
+
|
|
153
|
+
- [ ] 已在正确项目目录执行命令(或显式传入 `projectPath`)
|
|
154
|
+
- [ ] 列表查询条件已按 `encodeURI(JSON.stringify(...))` 传入
|
|
155
|
+
- [ ] 删除前已确认资源未被页面/脚本/组件引用
|
|
156
|
+
- [ ] 上传前已先执行容量统计
|
|
157
|
+
|
|
@@ -1,25 +1,48 @@
|
|
|
1
1
|
const { getPackageJson } = require("../../utils/config");
|
|
2
|
-
const
|
|
2
|
+
const BaseUrl = "https://developer.apis.cloudcc.cn";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 静态资源 - 查询列表
|
|
6
|
+
* CLI: cc get staticResource <projectPath> [encodedCondJson]
|
|
7
|
+
* 参数说明:
|
|
8
|
+
* - projectPath: 项目根目录,默认 process.cwd()
|
|
9
|
+
* - encodedCondJson(可选): encodeURI(JSON.stringify(body))
|
|
10
|
+
* - body: 查询条件对象(可为空 {}),常用字段:label
|
|
11
|
+
* 请求头说明:
|
|
12
|
+
* - accessToken: 从 cloudcc-cli.config.js 读取
|
|
13
|
+
* - source: 默认 cloudcc_cli
|
|
14
|
+
*/
|
|
4
15
|
async function get(projectPath = process.cwd(), encodedCondJson, isMcp = false) {
|
|
5
16
|
let body = {};
|
|
6
17
|
if (encodedCondJson) {
|
|
7
18
|
body = JSON.parse(decodeURI(encodedCondJson));
|
|
8
19
|
}
|
|
9
20
|
const config = await getPackageJson(projectPath);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
const devSvcDispatch = config.devSvcDispatch || "/devconsole";
|
|
22
|
+
const baseUrl = config.baseUrl || BaseUrl;
|
|
23
|
+
const res = await fetch(
|
|
24
|
+
`${baseUrl}${devSvcDispatch}/staticResource/listStaticResource`,
|
|
25
|
+
{
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
29
|
+
accessToken: config.accessToken,
|
|
30
|
+
source: config.source || "cloudcc_cli",
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify(body),
|
|
33
|
+
}
|
|
14
34
|
);
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
const data = await res.json();
|
|
36
|
+
if (data && (data.result || String(data.returnCode) === "200" || String(data.returnCode).endsWith("-OK"))) {
|
|
37
|
+
const list = Array.isArray(data?.data)
|
|
38
|
+
? data.data
|
|
39
|
+
: (data?.data?.objList || data?.data?.list || []);
|
|
17
40
|
if (!isMcp) {
|
|
18
41
|
console.log(JSON.stringify(list));
|
|
19
42
|
}
|
|
20
43
|
return list;
|
|
21
44
|
}
|
|
22
|
-
throw new Error("Get Static Resource Failed: " + (
|
|
45
|
+
throw new Error("Get Static Resource Failed: " + (data?.returnInfo || data?.message || "Unknown error"));
|
|
23
46
|
}
|
|
24
47
|
|
|
25
48
|
module.exports = get;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const cc = {};
|
|
2
2
|
cc.doc = require("./doc");
|
|
3
|
+
cc.create = require("./create");
|
|
3
4
|
cc.get = require("./get");
|
|
4
5
|
cc.detail = require("./detail");
|
|
5
6
|
cc.delete = require("./delete");
|
|
6
7
|
cc.count = require("./count");
|
|
7
8
|
function StaticResource(action, argvs) {
|
|
8
|
-
cc[action](argvs
|
|
9
|
+
cc[action](...argvs.slice(2));
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
module.exports = StaticResource;
|
package/src/timer/create.js
CHANGED
|
@@ -4,7 +4,12 @@ const path = require("path")
|
|
|
4
4
|
const chalk = require("chalk")
|
|
5
5
|
const { getPackageJson } = require("../../utils/config.js")
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* cc create timer <name>
|
|
9
|
+
* @param {string[]} argvs
|
|
10
|
+
*/
|
|
11
|
+
async function create(argvs) {
|
|
12
|
+
const name = argvs[2]
|
|
8
13
|
let res = await checkUpdate();
|
|
9
14
|
if (!res) {
|
|
10
15
|
let config = await getPackageJson();
|
package/src/timer/delete.js
CHANGED
|
@@ -4,7 +4,13 @@ const chalk = require("chalk");
|
|
|
4
4
|
const { getPackageJson } = require("../../utils/config");
|
|
5
5
|
const { postClass } = require("../../utils/http");
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* cc delete timer <nameOrId> [projectPath]
|
|
9
|
+
* @param {string[]} argvs
|
|
10
|
+
*/
|
|
11
|
+
async function remove(argvs) {
|
|
12
|
+
const nameOrId = argvs[2]
|
|
13
|
+
const projectPath = argvs[3] != null && argvs[3] !== "" ? argvs[3] : process.cwd()
|
|
8
14
|
let scheduleId = nameOrId;
|
|
9
15
|
const schedulePath = path.join(projectPath, `schedule/${nameOrId}/`);
|
|
10
16
|
const configPath = path.join(schedulePath, "config.json");
|
package/src/timer/detail.js
CHANGED
|
@@ -5,12 +5,12 @@ const { getPackageJson } = require("../../utils/config")
|
|
|
5
5
|
const { postClass } = require("../../utils/http")
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {string}
|
|
10
|
-
* @param {string} id - 定时类ID(当没有name时从服务器查询)
|
|
11
|
-
* @returns {Object} 定时类详细信息
|
|
8
|
+
* cc detail timer <name> <id>
|
|
9
|
+
* @param {string[]} argvs
|
|
12
10
|
*/
|
|
13
|
-
async function detail(
|
|
11
|
+
async function detail(argvs) {
|
|
12
|
+
const name = argvs[2]
|
|
13
|
+
const id = argvs[3]
|
|
14
14
|
// 如果有 name,优先查询本地
|
|
15
15
|
if (name && name !== '') {
|
|
16
16
|
const schedulePath = path.join(process.cwd(), `schedule/${name}/`);
|