helixlife-course-cli 0.0.0-stage → 0.1.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.en.md +36 -0
- package/README.md +98 -3
- package/cli/bin/helixlife-course.js +3 -0
- package/cli/dist/core/api/client.d.ts +24 -0
- package/cli/dist/core/api/client.d.ts.map +1 -0
- package/cli/dist/core/api/client.js +92 -0
- package/cli/dist/core/api/client.js.map +1 -0
- package/cli/dist/core/api/http.d.ts +3 -0
- package/cli/dist/core/api/http.d.ts.map +1 -0
- package/cli/dist/core/api/http.js +22 -0
- package/cli/dist/core/api/http.js.map +1 -0
- package/cli/dist/core/auth/index.d.ts +35 -0
- package/cli/dist/core/auth/index.d.ts.map +1 -0
- package/cli/dist/core/auth/index.js +150 -0
- package/cli/dist/core/auth/index.js.map +1 -0
- package/cli/dist/core/env-config.d.ts +16 -0
- package/cli/dist/core/env-config.d.ts.map +1 -0
- package/cli/dist/core/env-config.js +80 -0
- package/cli/dist/core/env-config.js.map +1 -0
- package/cli/dist/core/errors.d.ts +33 -0
- package/cli/dist/core/errors.d.ts.map +1 -0
- package/cli/dist/core/errors.js +82 -0
- package/cli/dist/core/errors.js.map +1 -0
- package/cli/dist/core/index.d.ts +10 -0
- package/cli/dist/core/index.d.ts.map +1 -0
- package/cli/dist/core/index.js +10 -0
- package/cli/dist/core/index.js.map +1 -0
- package/cli/dist/core/output/index.d.ts +6 -0
- package/cli/dist/core/output/index.d.ts.map +1 -0
- package/cli/dist/core/output/index.js +16 -0
- package/cli/dist/core/output/index.js.map +1 -0
- package/cli/dist/core/token/index.d.ts +7 -0
- package/cli/dist/core/token/index.d.ts.map +1 -0
- package/cli/dist/core/token/index.js +46 -0
- package/cli/dist/core/token/index.js.map +1 -0
- package/cli/dist/core/types/config.d.ts +7 -0
- package/cli/dist/core/types/config.d.ts.map +1 -0
- package/cli/dist/core/types/config.js +24 -0
- package/cli/dist/core/types/config.js.map +1 -0
- package/cli/dist/core/update/notifier.d.ts +53 -0
- package/cli/dist/core/update/notifier.d.ts.map +1 -0
- package/cli/dist/core/update/notifier.js +310 -0
- package/cli/dist/core/update/notifier.js.map +1 -0
- package/cli/dist/core/version.d.ts +2 -0
- package/cli/dist/core/version.d.ts.map +1 -0
- package/cli/dist/core/version.js +10 -0
- package/cli/dist/core/version.js.map +1 -0
- package/cli/dist/index.d.ts +2 -0
- package/cli/dist/index.d.ts.map +1 -0
- package/cli/dist/index.js +27 -0
- package/cli/dist/index.js.map +1 -0
- package/cli/dist/modules/auth/index.d.ts +3 -0
- package/cli/dist/modules/auth/index.d.ts.map +1 -0
- package/cli/dist/modules/auth/index.js +81 -0
- package/cli/dist/modules/auth/index.js.map +1 -0
- package/cli/dist/modules/course/api.d.ts +19 -0
- package/cli/dist/modules/course/api.d.ts.map +1 -0
- package/cli/dist/modules/course/api.js +50 -0
- package/cli/dist/modules/course/api.js.map +1 -0
- package/cli/dist/modules/course/constants.d.ts +32 -0
- package/cli/dist/modules/course/constants.d.ts.map +1 -0
- package/cli/dist/modules/course/constants.js +31 -0
- package/cli/dist/modules/course/constants.js.map +1 -0
- package/cli/dist/modules/course/index.d.ts +3 -0
- package/cli/dist/modules/course/index.d.ts.map +1 -0
- package/cli/dist/modules/course/index.js +52 -0
- package/cli/dist/modules/course/index.js.map +1 -0
- package/cli/dist/modules/ticket/api.d.ts +8 -0
- package/cli/dist/modules/ticket/api.d.ts.map +1 -0
- package/cli/dist/modules/ticket/api.js +30 -0
- package/cli/dist/modules/ticket/api.js.map +1 -0
- package/cli/dist/modules/ticket/constants.d.ts +8 -0
- package/cli/dist/modules/ticket/constants.d.ts.map +1 -0
- package/cli/dist/modules/ticket/constants.js +8 -0
- package/cli/dist/modules/ticket/constants.js.map +1 -0
- package/cli/dist/modules/ticket/index.d.ts +3 -0
- package/cli/dist/modules/ticket/index.d.ts.map +1 -0
- package/cli/dist/modules/ticket/index.js +24 -0
- package/cli/dist/modules/ticket/index.js.map +1 -0
- package/cli/dist/modules/upgrade/index.d.ts +4 -0
- package/cli/dist/modules/upgrade/index.d.ts.map +1 -0
- package/cli/dist/modules/upgrade/index.js +82 -0
- package/cli/dist/modules/upgrade/index.js.map +1 -0
- package/cli/dist/program.d.ts +3 -0
- package/cli/dist/program.d.ts.map +1 -0
- package/cli/dist/program.js +62 -0
- package/cli/dist/program.js.map +1 -0
- package/package.json +33 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,aAAa,IAAI,OAAO,CA+DvC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { getPackageVersion, emitJson, getDefaultBaseUrl, getDefaultAuthBaseUrl, updateLocalConfigField, isValidConfigSetKey, CONFIG_SET_KEYS, } from "./core/index.js";
|
|
3
|
+
import { registerAuthCommands } from "./modules/auth/index.js";
|
|
4
|
+
import { registerUpgradeCommand } from "./modules/upgrade/index.js";
|
|
5
|
+
import { registerCourseCommands } from "./modules/course/index.js";
|
|
6
|
+
import { registerTicketCommands } from "./modules/ticket/index.js";
|
|
7
|
+
// 创建 CLI 根命令并挂载各模块
|
|
8
|
+
export function createProgram() {
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program
|
|
11
|
+
.name("helixlife-course")
|
|
12
|
+
.description("解螺旋课程模块 CLI")
|
|
13
|
+
.version(getPackageVersion());
|
|
14
|
+
// 本地配置:helixlife-course config / helixlife-course config set <key> <value>
|
|
15
|
+
const config = program
|
|
16
|
+
.command("config")
|
|
17
|
+
.description("查看或修改本地接口基址配置");
|
|
18
|
+
// helixlife-course config:查看当前生效的 api / agent_api
|
|
19
|
+
config.action(() => {
|
|
20
|
+
emitJson({
|
|
21
|
+
ok: true,
|
|
22
|
+
api: getDefaultBaseUrl(),
|
|
23
|
+
agent_api: getDefaultAuthBaseUrl(),
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
// helixlife-course config set api|agent_api <完整基址>
|
|
27
|
+
config
|
|
28
|
+
.command("set <key> <value>")
|
|
29
|
+
.description(`设置本地接口基址覆盖(${CONFIG_SET_KEYS.join(" | ")}),值为完整 URL`)
|
|
30
|
+
.action((key, value) => {
|
|
31
|
+
if (!isValidConfigSetKey(key)) {
|
|
32
|
+
emitJson({
|
|
33
|
+
ok: false,
|
|
34
|
+
message: `非法配置项 "${key}",合法值:${CONFIG_SET_KEYS.join(", ")}`,
|
|
35
|
+
});
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!value.trim()) {
|
|
40
|
+
emitJson({
|
|
41
|
+
ok: false,
|
|
42
|
+
message: "配置值不能为空",
|
|
43
|
+
});
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
updateLocalConfigField(key, value);
|
|
48
|
+
emitJson({
|
|
49
|
+
ok: true,
|
|
50
|
+
key,
|
|
51
|
+
value: key === "api" ? getDefaultBaseUrl() : getDefaultAuthBaseUrl(),
|
|
52
|
+
api: getDefaultBaseUrl(),
|
|
53
|
+
agent_api: getDefaultAuthBaseUrl(),
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
registerUpgradeCommand(program);
|
|
57
|
+
registerAuthCommands(program);
|
|
58
|
+
registerCourseCommands(program);
|
|
59
|
+
registerTicketCommands(program);
|
|
60
|
+
return program;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,mBA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QAED,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,QAAQ,CAAC;gBACP,EAAE,EAAE,KAAK;gBACT,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YACH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QAED,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnC,QAAQ,CAAC;YACP,EAAE,EAAE,IAAI;YACR,GAAG;YACH,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,qBAAqB,EAAE;YACpE,GAAG,EAAE,iBAAiB,EAAE;YACxB,SAAS,EAAE,qBAAqB,EAAE;SACnC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEhC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "helixlife-course-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "helixlife-course-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "helixlife 产品课程模块后台命令行工具",
|
|
6
|
+
"bin": {
|
|
7
|
+
"helixlife-course": "./cli/bin/helixlife-course.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./cli/dist/index.js",
|
|
10
|
+
"types": "./cli/dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"cli/bin",
|
|
13
|
+
"cli/dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p cli/tsconfig.json",
|
|
17
|
+
"dev": "node --import tsx cli/src/index.ts",
|
|
18
|
+
"typecheck": "tsc -p cli/tsconfig.json --noEmit",
|
|
19
|
+
"test": "tsx --test cli/tests/*.test.ts",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"commander": "^13.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.10.0",
|
|
27
|
+
"tsx": "^4.19.0",
|
|
28
|
+
"typescript": "^5.7.0"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
}
|
|
33
|
+
}
|